0f3ee5dd0c1b1c1d6f0e4918dc5180d798697e34
[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 Mon Dec 24 02:45:06 EET 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 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 if test -f "/system/gnu_library/bin/ar.pm"; then
169      _exe=".pm"
170 else
171      _exe=""
172 fi
173
174 ccname=''
175 ccversion=''
176 ccsymbols=''
177 cppccsymbols=''
178 cppsymbols=''
179 from=''
180 run=''
181 targetarch=''
182 to=''
183 usecrosscompile=''
184 perllibs=''
185 dynamic_ext=''
186 extensions=''
187 known_extensions=''
188 nonxs_ext=''
189 static_ext=''
190 useopcode=''
191 useposix=''
192 extras=''
193 d_bsd=''
194 d_eunice=''
195 d_xenix=''
196 eunicefix=''
197 Mcc=''
198 ar=''
199 awk=''
200 bash=''
201 bison=''
202 byacc=''
203 cat=''
204 chgrp=''
205 chmod=''
206 chown=''
207 comm=''
208 compress=''
209 cp=''
210 cpio=''
211 cpp=''
212 csh=''
213 date=''
214 echo=''
215 egrep=''
216 emacs=''
217 expr=''
218 find=''
219 flex=''
220 gmake=''
221 grep=''
222 gzip=''
223 inews=''
224 ksh=''
225 less=''
226 line=''
227 lint=''
228 ln=''
229 lp=''
230 lpr=''
231 ls=''
232 mail=''
233 mailx=''
234 make=''
235 mkdir=''
236 more=''
237 mv=''
238 nm=''
239 nroff=''
240 perl=''
241 pg=''
242 pmake=''
243 pr=''
244 rm=''
245 rmail=''
246 sed=''
247 sendmail=''
248 shar=''
249 sleep=''
250 smail=''
251 sort=''
252 submit=''
253 tail=''
254 tar=''
255 tbl=''
256 tee=''
257 test=''
258 touch=''
259 tr=''
260 troff=''
261 uname=''
262 uniq=''
263 uuname=''
264 vi=''
265 zcat=''
266 zip=''
267 full_ar=''
268 full_sed=''
269 libswanted=''
270 hint=''
271 myuname=''
272 osname=''
273 osvers=''
274 Author=''
275 Date=''
276 Header=''
277 Id=''
278 Locker=''
279 Log=''
280 RCSfile=''
281 Revision=''
282 Source=''
283 State=''
284 _a=''
285 _exe=''
286 _o=''
287 archobjs=''
288 exe_ext=''
289 firstmakefile=''
290 lib_ext=''
291 obj_ext=''
292 path_sep=''
293 afs=''
294 afsroot=''
295 alignbytes=''
296 ansi2knr=''
297 archlib=''
298 archlibexp=''
299 d_archlib=''
300 installarchlib=''
301 archname=''
302 myarchname=''
303 d_atolf=''
304 d_atoll=''
305 baserev=''
306 bin=''
307 binexp=''
308 installbin=''
309 bincompat5005=''
310 d_bincompat5005=''
311 byteorder=''
312 cc=''
313 ccflags=''
314 cppflags=''
315 ldflags=''
316 lkflags=''
317 locincpth=''
318 optimize=''
319 cf_email=''
320 cf_by=''
321 cf_time=''
322 charsize=''
323 contains=''
324 cpp_stuff=''
325 cpplast=''
326 cppminus=''
327 cpprun=''
328 cppstdin=''
329 d__fwalk=''
330 d_access=''
331 d_accessx=''
332 d_alarm=''
333 d_attribut=''
334 d_bcmp=''
335 d_bcopy=''
336 d_bzero=''
337 d_casti32=''
338 castflags=''
339 d_castneg=''
340 d_chown=''
341 d_chroot=''
342 d_chsize=''
343 d_class=''
344 d_closedir=''
345 d_void_closedir=''
346 d_cmsghdr_s=''
347 d_const=''
348 cryptlib=''
349 d_crypt=''
350 d_csh=''
351 full_csh=''
352 d_cuserid=''
353 d_dbl_dig=''
354 d_dbminitproto=''
355 d_difftime=''
356 d_dirfd=''
357 d_dlerror=''
358 d_dlopen=''
359 d_dlsymun=''
360 d_dosuid=''
361 d_suidsafe=''
362 d_drand48proto=''
363 d_dup2=''
364 d_eaccess=''
365 d_endgrent=''
366 d_endhent=''
367 d_endnent=''
368 d_endpent=''
369 d_endpwent=''
370 d_endsent=''
371 d_fchdir=''
372 d_fchmod=''
373 d_fchown=''
374 d_fcntl=''
375 d_fcntl_can_lock=''
376 d_fd_macros=''
377 d_fd_set=''
378 d_fds_bits=''
379 d_fgetpos=''
380 d_finite=''
381 d_finitel=''
382 d_flexfnam=''
383 d_flock=''
384 d_flockproto=''
385 d_fork=''
386 d_fp_class=''
387 d_fpclass=''
388 d_fpclassify=''
389 d_fpclassl=''
390 d_fpos64_t=''
391 d_frexpl=''
392 d_fs_data_s=''
393 d_fseeko=''
394 d_fsetpos=''
395 d_fstatfs=''
396 d_fsync=''
397 d_ftello=''
398 d_ftime=''
399 d_gettimeod=''
400 d_Gconvert=''
401 d_getcwd=''
402 d_getespwnam=''
403 d_getfsstat=''
404 d_getgrent=''
405 d_getgrps=''
406 d_gethbyaddr=''
407 d_gethbyname=''
408 d_gethent=''
409 aphostname=''
410 d_gethname=''
411 d_phostname=''
412 d_uname=''
413 d_gethostprotos=''
414 d_getitimer=''
415 d_getlogin=''
416 d_getmnt=''
417 d_getmntent=''
418 d_getnbyaddr=''
419 d_getnbyname=''
420 d_getnent=''
421 d_getnetprotos=''
422 d_getpagsz=''
423 d_getpent=''
424 d_getpgid=''
425 d_getpgrp2=''
426 d_bsdgetpgrp=''
427 d_getpgrp=''
428 d_getppid=''
429 d_getprior=''
430 d_getpbyname=''
431 d_getpbynumber=''
432 d_getprotoprotos=''
433 d_getprpwnam=''
434 d_getpwent=''
435 d_getsent=''
436 d_getservprotos=''
437 d_getspnam=''
438 d_getsbyname=''
439 d_getsbyport=''
440 d_gnulibc=''
441 d_hasmntopt=''
442 d_htonl=''
443 d_inetaton=''
444 d_int64_t=''
445 d_isascii=''
446 d_isfinite=''
447 d_isinf=''
448 d_isnan=''
449 d_isnanl=''
450 d_killpg=''
451 d_lchown=''
452 d_ldbl_dig=''
453 d_link=''
454 d_locconv=''
455 d_lockf=''
456 d_longdbl=''
457 longdblsize=''
458 d_longlong=''
459 longlongsize=''
460 d_lseekproto=''
461 d_lstat=''
462 d_madvise=''
463 d_mblen=''
464 d_mbstowcs=''
465 d_mbtowc=''
466 d_memchr=''
467 d_memcmp=''
468 d_memcpy=''
469 d_memmove=''
470 d_memset=''
471 d_mkdir=''
472 d_mkdtemp=''
473 d_mkfifo=''
474 d_mkstemp=''
475 d_mkstemps=''
476 d_mktime=''
477 d_mmap=''
478 mmaptype=''
479 d_modfl=''
480 d_modfl_pow32_bug=''
481 d_mprotect=''
482 d_msg=''
483 d_msgctl=''
484 d_msgget=''
485 d_msghdr_s=''
486 d_msgrcv=''
487 d_msgsnd=''
488 d_msync=''
489 d_munmap=''
490 d_nice=''
491 d_nl_langinfo=''
492 d_off64_t=''
493 d_open3=''
494 d_fpathconf=''
495 d_pathconf=''
496 d_pause=''
497 d_pipe=''
498 d_poll=''
499 d_portable=''
500 d_procselfexe=''
501 procselfexe=''
502 d_old_pthread_create_joinable=''
503 old_pthread_create_joinable=''
504 d_pthread_atfork=''
505 d_pthread_yield=''
506 d_sched_yield=''
507 sched_yield=''
508 d_qgcvt=''
509 d_readdir=''
510 d_rewinddir=''
511 d_seekdir=''
512 d_telldir=''
513 d_readlink=''
514 d_readv=''
515 d_recvmsg=''
516 d_rename=''
517 d_rmdir=''
518 d_safebcpy=''
519 d_safemcpy=''
520 d_sanemcmp=''
521 d_sbrkproto=''
522 d_select=''
523 d_sem=''
524 d_semctl=''
525 d_semget=''
526 d_semop=''
527 d_sendmsg=''
528 d_setegid=''
529 d_seteuid=''
530 d_setgrent=''
531 d_setgrps=''
532 d_sethent=''
533 d_setitimer=''
534 d_setlinebuf=''
535 d_setlocale=''
536 d_setnent=''
537 d_setpent=''
538 d_setpgid=''
539 d_setpgrp2=''
540 d_bsdsetpgrp=''
541 d_setpgrp=''
542 d_setprior=''
543 d_setproctitle=''
544 d_setpwent=''
545 d_setregid=''
546 d_setresgid=''
547 d_setresuid=''
548 d_setreuid=''
549 d_setrgid=''
550 d_setruid=''
551 d_setsent=''
552 d_setsid=''
553 d_setvbuf=''
554 d_sfio=''
555 usesfio=''
556 d_shm=''
557 d_shmat=''
558 d_shmatprototype=''
559 shmattype=''
560 d_shmctl=''
561 d_shmdt=''
562 d_shmget=''
563 d_sigaction=''
564 d_sigprocmask=''
565 d_sigsetjmp=''
566 d_sockatmark=''
567 d_sockatmarkproto=''
568 d_msg_ctrunc=''
569 d_msg_dontroute=''
570 d_msg_oob=''
571 d_msg_peek=''
572 d_msg_proxy=''
573 d_oldsock=''
574 d_scm_rights=''
575 d_socket=''
576 d_sockpair=''
577 sockethdr=''
578 socketlib=''
579 d_socklen_t=''
580 d_socks5_init=''
581 d_sqrtl=''
582 d_sresgproto=''
583 d_sresuproto=''
584 d_statblks=''
585 d_statfs_f_flags=''
586 d_statfs_s=''
587 d_fstatvfs=''
588 d_statvfs=''
589 d_stdio_cnt_lval=''
590 d_stdio_ptr_lval=''
591 d_stdio_ptr_lval_nochange_cnt=''
592 d_stdio_ptr_lval_sets_cnt=''
593 d_stdiobase=''
594 d_stdstdio=''
595 stdio_base=''
596 stdio_bufsiz=''
597 stdio_cnt=''
598 stdio_filbuf=''
599 stdio_ptr=''
600 d_index=''
601 d_strchr=''
602 d_strcoll=''
603 d_strctcpy=''
604 d_strerrm=''
605 d_strerror=''
606 d_sysernlst=''
607 d_syserrlst=''
608 d_strftime=''
609 d_strtod=''
610 d_strtol=''
611 d_strtold=''
612 d_strtoll=''
613 d_strtoq=''
614 d_strtoul=''
615 d_strtoull=''
616 d_strtouq=''
617 d_strxfrm=''
618 d_symlink=''
619 d_syscall=''
620 d_syscallproto=''
621 d_sysconf=''
622 d_system=''
623 d_tcgetpgrp=''
624 d_tcsetpgrp=''
625 d_telldirproto=''
626 d_time=''
627 timetype=''
628 clocktype=''
629 d_times=''
630 d_truncate=''
631 d_tzname=''
632 d_u32align=''
633 d_ualarm=''
634 d_umask=''
635 d_semctl_semid_ds=''
636 d_semctl_semun=''
637 d_union_semun=''
638 d_unordered=''
639 d_usleep=''
640 d_usleepproto=''
641 d_ustat=''
642 d_vfork=''
643 usevfork=''
644 d_voidsig=''
645 signal_t=''
646 d_volatile=''
647 d_charvspr=''
648 d_vprintf=''
649 d_wait4=''
650 d_waitpid=''
651 d_wcstombs=''
652 d_wctomb=''
653 d_writev=''
654 dlext=''
655 cccdlflags=''
656 ccdlflags=''
657 dlsrc=''
658 ld=''
659 lddlflags=''
660 usedl=''
661 doublesize=''
662 ebcdic=''
663 fflushNULL=''
664 fflushall=''
665 fpossize=''
666 fpostype=''
667 gccosandvers=''
668 gccversion=''
669 gidformat=''
670 gidsign=''
671 gidsize=''
672 gidtype=''
673 groupstype=''
674 h_fcntl=''
675 h_sysfile=''
676 i_arpainet=''
677 db_hashtype=''
678 db_prefixtype=''
679 db_version_major=''
680 db_version_minor=''
681 db_version_patch=''
682 i_db=''
683 i_dbm=''
684 i_rpcsvcdbm=''
685 d_dirnamlen=''
686 direntrytype=''
687 i_dirent=''
688 i_dld=''
689 i_dlfcn=''
690 i_fcntl=''
691 i_float=''
692 i_fp=''
693 i_fp_class=''
694 i_gdbm=''
695 d_grpasswd=''
696 i_grp=''
697 i_ieeefp=''
698 i_inttypes=''
699 i_langinfo=''
700 i_libutil=''
701 i_limits=''
702 i_locale=''
703 i_machcthr=''
704 i_malloc=''
705 i_math=''
706 i_memory=''
707 i_mntent=''
708 i_ndbm=''
709 i_netdb=''
710 i_neterrno=''
711 i_netinettcp=''
712 i_niin=''
713 i_sysin=''
714 i_poll=''
715 i_prot=''
716 i_pthread=''
717 d_pwage=''
718 d_pwchange=''
719 d_pwclass=''
720 d_pwcomment=''
721 d_pwexpire=''
722 d_pwgecos=''
723 d_pwpasswd=''
724 d_pwquota=''
725 i_pwd=''
726 i_sfio=''
727 i_shadow=''
728 i_socks=''
729 i_stddef=''
730 i_stdlib=''
731 i_string=''
732 strings=''
733 i_sunmath=''
734 i_sysaccess=''
735 i_sysdir=''
736 i_sysfile=''
737 d_voidtty=''
738 i_bsdioctl=''
739 i_sysfilio=''
740 i_sysioctl=''
741 i_syssockio=''
742 i_syslog=''
743 i_sysmman=''
744 i_sysmode=''
745 i_sysmount=''
746 i_sysndir=''
747 i_sysparam=''
748 i_sysresrc=''
749 i_syssecrt=''
750 i_sysselct=''
751 i_sysstat=''
752 i_sysstatfs=''
753 i_sysstatvfs=''
754 i_systimes=''
755 i_systypes=''
756 i_sysuio=''
757 i_sysun=''
758 i_sysutsname=''
759 i_sysvfs=''
760 i_syswait=''
761 i_sgtty=''
762 i_termio=''
763 i_termios=''
764 i_systime=''
765 i_systimek=''
766 i_time=''
767 timeincl=''
768 i_unistd=''
769 i_ustat=''
770 i_utime=''
771 i_values=''
772 i_stdarg=''
773 i_varargs=''
774 i_varhdr=''
775 i_vfork=''
776 inc_version_list=''
777 inc_version_list_init=''
778 installprefix=''
779 installprefixexp=''
780 installstyle=''
781 installusrbinperl=''
782 intsize=''
783 longsize=''
784 shortsize=''
785 issymlink=''
786 libc=''
787 ldlibpthname=''
788 libperl=''
789 shrpenv=''
790 useshrplib=''
791 glibpth=''
792 libpth=''
793 loclibpth=''
794 plibpth=''
795 xlibpth=''
796 ignore_versioned_solibs=''
797 libs=''
798 libsdirs=''
799 libsfiles=''
800 libsfound=''
801 libspath=''
802 lns=''
803 d_PRIEUldbl=''
804 d_PRIFUldbl=''
805 d_PRIGUldbl=''
806 d_PRIeldbl=''
807 d_PRIfldbl=''
808 d_PRIgldbl=''
809 d_SCNfldbl=''
810 sPRIEUldbl=''
811 sPRIFUldbl=''
812 sPRIGUldbl=''
813 sPRIeldbl=''
814 sPRIfldbl=''
815 sPRIgldbl=''
816 sSCNfldbl=''
817 lseeksize=''
818 lseektype=''
819 make_set_make=''
820 d_mymalloc=''
821 freetype=''
822 mallocobj=''
823 mallocsrc=''
824 malloctype=''
825 usemymalloc=''
826 installman1dir=''
827 man1dir=''
828 man1direxp=''
829 man1ext=''
830 installman3dir=''
831 man3dir=''
832 man3direxp=''
833 man3ext=''
834 modetype=''
835 multiarch=''
836 mydomain=''
837 myhostname=''
838 phostname=''
839 c=''
840 n=''
841 d_eofnblk=''
842 eagain=''
843 o_nonblock=''
844 rd_nodata=''
845 need_va_copy=''
846 netdb_hlen_type=''
847 netdb_host_type=''
848 netdb_name_type=''
849 netdb_net_type=''
850 groupcat=''
851 hostcat=''
852 passcat=''
853 orderlib=''
854 ranlib=''
855 d_perl_otherlibdirs=''
856 otherlibdirs=''
857 package=''
858 spackage=''
859 pager=''
860 api_revision=''
861 api_subversion=''
862 api_version=''
863 api_versionstring=''
864 patchlevel=''
865 perl_patchlevel=''
866 revision=''
867 subversion=''
868 version=''
869 version_patchlevel_string=''
870 perl5=''
871 perladmin=''
872 perlpath=''
873 d_nv_preserves_uv=''
874 d_nv_preserves_uv_bits=''
875 i16size=''
876 i16type=''
877 i32size=''
878 i32type=''
879 i64size=''
880 i64type=''
881 i8size=''
882 i8type=''
883 ivsize=''
884 ivtype=''
885 nvsize=''
886 nvtype=''
887 u16size=''
888 u16type=''
889 u32size=''
890 u32type=''
891 u64size=''
892 u64type=''
893 u8size=''
894 u8type=''
895 uvsize=''
896 uvtype=''
897 ivdformat=''
898 nvEUformat=''
899 nvFUformat=''
900 nvGUformat=''
901 nveformat=''
902 nvfformat=''
903 nvgformat=''
904 uvXUformat=''
905 uvoformat=''
906 uvuformat=''
907 uvxformat=''
908 pidtype=''
909 prefix=''
910 prefixexp=''
911 installprivlib=''
912 privlib=''
913 privlibexp=''
914 prototype=''
915 ptrsize=''
916 d_PRIXU64=''
917 d_PRId64=''
918 d_PRIi64=''
919 d_PRIo64=''
920 d_PRIu64=''
921 d_PRIx64=''
922 sPRIXU64=''
923 sPRId64=''
924 sPRIi64=''
925 sPRIo64=''
926 sPRIu64=''
927 sPRIx64=''
928 d_quad=''
929 quadkind=''
930 quadtype=''
931 uquadtype=''
932 drand01=''
933 randbits=''
934 randfunc=''
935 randseedtype=''
936 seedfunc=''
937 installscript=''
938 scriptdir=''
939 scriptdirexp=''
940 selectminbits=''
941 selecttype=''
942 sh=''
943 sig_count=''
944 sig_name=''
945 sig_name_init=''
946 sig_num=''
947 sig_num_init=''
948 sig_size=''
949 installsitearch=''
950 sitearch=''
951 sitearchexp=''
952 installsitebin=''
953 sitebin=''
954 sitebinexp=''
955 installsitelib=''
956 sitelib=''
957 sitelib_stem=''
958 sitelibexp=''
959 siteprefix=''
960 siteprefixexp=''
961 sizesize=''
962 sizetype=''
963 so=''
964 socksizetype=''
965 sharpbang=''
966 shsharp=''
967 spitshell=''
968 src=''
969 ssizetype=''
970 startperl=''
971 startsh=''
972 stdchar=''
973 d_stdio_stream_array=''
974 stdio_stream_array=''
975 sysman=''
976 trnl=''
977 uidformat=''
978 uidsign=''
979 uidsize=''
980 uidtype=''
981 archname64=''
982 use64bitall=''
983 use64bitint=''
984 ccflags_uselargefiles=''
985 ldflags_uselargefiles=''
986 libswanted_uselargefiles=''
987 uselargefiles=''
988 uselongdouble=''
989 usemorebits=''
990 usemultiplicity=''
991 nm_opt=''
992 nm_so_opt=''
993 runnm=''
994 usenm=''
995 useperlio=''
996 usesocks=''
997 d_oldpthreads=''
998 use5005threads=''
999 useithreads=''
1000 usereentrant=''
1001 usethreads=''
1002 incpath=''
1003 mips_type=''
1004 usrinc=''
1005 d_vendorarch=''
1006 installvendorarch=''
1007 vendorarch=''
1008 vendorarchexp=''
1009 d_vendorbin=''
1010 installvendorbin=''
1011 vendorbin=''
1012 vendorbinexp=''
1013 d_vendorlib=''
1014 installvendorlib=''
1015 vendorlib=''
1016 vendorlib_stem=''
1017 vendorlibexp=''
1018 usevendorprefix=''
1019 vendorprefix=''
1020 vendorprefixexp=''
1021 versiononly=''
1022 defvoidused=''
1023 voidflags=''
1024 pm_apiversion=''
1025 xs_apiversion=''
1026 yacc=''
1027 yaccflags=''
1028 CONFIG=''
1029
1030 define='define'
1031 undef='undef'
1032 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1033 rmlist=''
1034
1035 : We must find out about Eunice early
1036 eunicefix=':'
1037 if test -f /etc/unixtovms; then
1038         eunicefix=/etc/unixtovms
1039 fi
1040 if test -f /etc/unixtovms.exe; then
1041         eunicefix=/etc/unixtovms.exe
1042 fi
1043
1044 i_whoami=''
1045 ccname=''
1046 ccversion=''
1047 perllibs=''
1048 : set useposix=false in your hint file to disable the POSIX extension.
1049 useposix=true
1050 : set useopcode=false in your hint file to disable the Opcode extension.
1051 useopcode=true
1052 : Trailing extension.  Override this in a hint file, if needed.
1053 : Extra object files, if any, needed on this platform.
1054 archobjs=''
1055 _exe="$_exe"
1056 archname=''
1057 : Possible local include directories to search.
1058 : Set locincpth to "" in a hint file to defeat local include searches.
1059 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1060 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1061 :
1062 : no include file wanted by default
1063 inclwanted=''
1064
1065 groupstype=''
1066 libnames=''
1067 : change the next line if compiling for Xenix/286 on Xenix/386
1068 xlibpth='/usr/lib/386 /lib/386'
1069 : Possible local library directories to search.
1070 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1071 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1072
1073 : general looking path for locating libraries
1074 glibpth="/lib /usr/lib $xlibpth"
1075 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1076 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1077 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1078
1079 : Private path used by Configure to find libraries.  Its value
1080 : is prepended to libpth. This variable takes care of special
1081 : machines, like the mips.  Usually, it should be empty.
1082 plibpth=''
1083
1084 : default library list
1085 libswanted=''
1086 : some systems want to use only the non-versioned libso:s
1087 ignore_versioned_solibs=''
1088 archname64=''
1089 ccflags_uselargefiles=''
1090 ldflags_uselargefiles=''
1091 libswanted_uselargefiles=''
1092 : set usemultiplicity on the Configure command line to enable multiplicity.
1093 : set usesocks on the Configure command line to enable socks.
1094 : set usethreads on the Configure command line to enable threads.
1095 usereentrant='undef'
1096 : full support for void wanted by default
1097 defvoidused=15
1098
1099 : List of libraries we want.
1100 : If anyone needs -lnet, put it in a hint file.
1101 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1102 libswanted="$libswanted dld ld sun m c cposix posix"
1103 libswanted="$libswanted ndir dir crypt sec"
1104 libswanted="$libswanted ucb bsd BSD PW x util"
1105 : We probably want to search /usr/shlib before most other libraries.
1106 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1107 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1108 glibpth="/usr/shlib $glibpth"
1109 : Do not use vfork unless overridden by a hint file.
1110 usevfork=false
1111
1112 : Find the basic shell for Bourne shell scripts
1113 case "$sh" in
1114 '')
1115         case "$SYSTYPE" in
1116         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1117         *) xxx='/bin/sh';;
1118         esac
1119         if test -f "$xxx"; then
1120                 sh="$xxx"
1121         else
1122                 : Build up a list and do a single loop so we can 'break' out.
1123                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1124                 for xxx in sh bash ksh pdksh ash; do
1125                         for p in $pth; do
1126                                 try="$try ${p}/${xxx}"
1127                         done
1128                 done
1129                 for xxx in $try; do
1130                         if test -f "$xxx"; then
1131                                 sh="$xxx";
1132                                 break
1133                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1134                                 sh="$xxx";
1135                                 break
1136                         elif test -f "$xxx.exe"; then
1137                                 sh="$xxx";
1138                                 break
1139                         fi
1140                 done
1141         fi
1142         ;;
1143 esac
1144
1145 case "$sh" in
1146 '')     cat >&2 <<EOM
1147 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1148
1149 Usually it's in /bin/sh.  How did you even get this far?
1150 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1151 we'll try to straighten this all out.
1152 EOM
1153         exit 1
1154         ;;
1155 esac
1156
1157 : see if sh knows # comments
1158 if `$sh -c '#' >/dev/null 2>&1`; then
1159         shsharp=true
1160         spitshell=cat
1161         xcat=/bin/cat
1162         test -f $xcat$_exe || xcat=/usr/bin/cat
1163         if test ! -f $xcat$_exe; then
1164                 for p in $paths; do
1165                         if test -f $p/cat$_exe; then
1166                                 xcat=$p/cat
1167                                 break
1168                         fi
1169                 done
1170                 if test ! -f $xcat$_exe; then
1171                         echo "Can't find cat anywhere!"
1172                         exit 1
1173                 fi
1174         fi
1175         echo "#!$xcat" >sharp
1176         $eunicefix sharp
1177         chmod +x sharp
1178         ./sharp > today
1179         if test -s today; then
1180                 sharpbang='#!'
1181         else
1182                 echo "#! $xcat" > sharp
1183                 $eunicefix sharp
1184                 chmod +x sharp
1185                 ./sharp > today
1186                 if test -s today; then
1187                         sharpbang='#! '
1188                 else
1189                         sharpbang=': use '
1190                 fi
1191         fi
1192 else
1193         echo " "
1194         echo "Your $sh doesn't grok # comments--I will strip them later on."
1195         shsharp=false
1196         cd ..
1197         echo "exec grep -v '^[  ]*#'" >spitshell
1198         chmod +x spitshell
1199         $eunicefix spitshell
1200         spitshell=`pwd`/spitshell
1201         cd UU
1202         echo "I presume that if # doesn't work, #! won't work either!"
1203         sharpbang=': use '
1204 fi
1205 rm -f sharp today
1206
1207 : figure out how to guarantee sh startup
1208 case "$startsh" in
1209 '') startsh=${sharpbang}${sh} ;;
1210 *)
1211 esac
1212 cat >sharp <<EOSS
1213 $startsh
1214 set abc
1215 test "$?abc" != 1
1216 EOSS
1217
1218 chmod +x sharp
1219 $eunicefix sharp
1220 if ./sharp; then
1221         : echo "Yup, it does."
1222 else
1223         echo "Hmm... '$startsh' does not guarantee sh startup..."
1224         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1225 fi
1226 rm -f sharp
1227
1228
1229 : Save command line options in file UU/cmdline.opt for later use in
1230 : generating config.sh.
1231 cat > cmdline.opt <<EOSH
1232 # Configure command line arguments.
1233 config_arg0='$0'
1234 config_args='$*'
1235 config_argc=$#
1236 EOSH
1237 argn=1
1238 args_exp=''
1239 args_sep=''
1240 for arg in "$@"; do
1241         cat >>cmdline.opt <<EOSH
1242 config_arg$argn='$arg'
1243 EOSH
1244         # Extreme backslashitis: replace each ' by '"'"'
1245         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1246 $arg
1247 EOC
1248         arg_exp=`cat cmdl.opt`
1249         args_exp="$args_exp$args_sep'$arg_exp'"
1250         argn=`expr $argn + 1`
1251         args_sep=' '
1252 done
1253 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1254 # used by ./hints/os2.sh
1255 rm -f cmdl.opt
1256
1257 : produce awk script to parse command line options
1258 cat >options.awk <<'EOF'
1259 BEGIN {
1260         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1261
1262         len = length(optstr);
1263         for (i = 1; i <= len; i++) {
1264                 c = substr(optstr, i, 1);
1265                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1266                 if (a == ":") {
1267                         arg[c] = 1;
1268                         i++;
1269                 }
1270                 opt[c] = 1;
1271         }
1272 }
1273 {
1274         expect = 0;
1275         str = $0;
1276         if (substr(str, 1, 1) != "-") {
1277                 printf("'%s'\n", str);
1278                 next;
1279         }
1280         len = length($0);
1281         for (i = 2; i <= len; i++) {
1282                 c = substr(str, i, 1);
1283                 if (!opt[c]) {
1284                         printf("-%s\n", substr(str, i));
1285                         next;
1286                 }
1287                 printf("-%s\n", c);
1288                 if (arg[c]) {
1289                         if (i < len)
1290                                 printf("'%s'\n", substr(str, i + 1));
1291                         else
1292                                 expect = 1;
1293                         next;
1294                 }
1295         }
1296 }
1297 END {
1298         if (expect)
1299                 print "?";
1300 }
1301 EOF
1302
1303 : process the command line options
1304 set X `for arg in "$@"; do echo "X$arg"; done |
1305         sed -e s/X// | awk -f options.awk`
1306 eval "set $*"
1307 shift
1308 rm -f options.awk
1309
1310 : set up default values
1311 fastread=''
1312 reuseval=false
1313 config_sh=''
1314 alldone=''
1315 error=''
1316 silent=''
1317 extractsh=''
1318 override=''
1319 knowitall=''
1320 rm -f optdef.sh posthint.sh
1321 cat >optdef.sh <<EOS
1322 $startsh
1323 EOS
1324
1325
1326 : option parsing
1327 while test $# -gt 0; do
1328         case "$1" in
1329         -d) shift; fastread=yes;;
1330         -e) shift; alldone=cont;;
1331         -f)
1332                 shift
1333                 cd ..
1334                 if test -r "$1"; then
1335                         config_sh="$1"
1336                 else
1337                         echo "$me: cannot read config file $1." >&2
1338                         error=true
1339                 fi
1340                 cd UU
1341                 shift;;
1342         -h) shift; error=true;;
1343         -r) shift; reuseval=true;;
1344         -s) shift; silent=true; realsilent=true;;
1345         -E) shift; alldone=exit;;
1346         -K) shift; knowitall=true;;
1347         -O) shift; override=true;;
1348         -S) shift; silent=true; extractsh=true;;
1349         -D)
1350                 shift
1351                 case "$1" in
1352                 *=)
1353                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1354                         echo "$me: ignoring -D $1" >&2
1355                         ;;
1356                 *=*) echo "$1" | \
1357                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1358                 *) echo "$1='define'" >> optdef.sh;;
1359                 esac
1360                 shift
1361                 ;;
1362         -U)
1363                 shift
1364                 case "$1" in
1365                 *=) echo "$1" >> optdef.sh;;
1366                 *=*)
1367                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1368                         echo "$me: ignoring -U $1" >&2
1369                         ;;
1370                 *) echo "$1='undef'" >> optdef.sh;;
1371                 esac
1372                 shift
1373                 ;;
1374         -A)
1375             shift
1376             xxx=''
1377             yyy="$1"
1378             zzz=''
1379             uuu=undef
1380             case "$yyy" in
1381             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1382                  case "$zzz" in
1383                  *:*) zzz='' ;;
1384                  *)   xxx=append
1385                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1386                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1387                  esac
1388                  ;;
1389             esac
1390             case "$xxx" in
1391             '')  case "$yyy" in
1392                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1393                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1394                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1395                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1396                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1397                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1398                  esac
1399                  ;;       
1400             esac
1401             case "$xxx" in
1402             append)
1403                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1404             clear)
1405                 echo "$yyy=''"                  >> posthint.sh ;;
1406             define)
1407                 case "$zzz" in
1408                 '') zzz=define ;;
1409                 esac
1410                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1411             eval)
1412                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1413             prepend)
1414                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1415             undef)
1416                 case "$zzz" in
1417                 '') zzz="$uuu" ;;
1418                 esac
1419                 echo "$yyy=$zzz"                >> posthint.sh ;;
1420             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1421             esac
1422             shift
1423             ;;
1424         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1425             exit 0;;
1426         --) break;;
1427         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1428         *) break;;
1429         esac
1430 done
1431
1432 case "$error" in
1433 true)
1434         cat >&2 <<EOM
1435 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1436                  [-U symbol] [-U symbol=] [-A command:symbol...]
1437   -d : use defaults for all answers.
1438   -e : go on without questioning past the production of config.sh.
1439   -f : specify an alternate default configuration file.
1440   -h : print this help message and exit (with an error status).
1441   -r : reuse C symbols value if possible (skips costly nm extraction).
1442   -s : silent mode, only echoes questions and essential information.
1443   -D : define symbol to have some value:
1444          -D symbol         symbol gets the value 'define'
1445          -D symbol=value   symbol gets the value 'value'
1446   -E : stop at the end of questions, after having produced config.sh.
1447   -K : do not use unless you know what you are doing.
1448   -O : let -D and -U override definitions from loaded configuration file.
1449   -S : perform variable substitutions on all .SH files (can mix with -f)
1450   -U : undefine symbol:
1451          -U symbol    symbol gets the value 'undef'
1452          -U symbol=   symbol gets completely empty
1453   -A : manipulate symbol after the platform specific hints have been applied:
1454          -A symbol=value                append " "value to symbol
1455          -A append:symbol=value         append value to symbol
1456          -A define:symbol=value         define symbol to have value
1457          -A clear:symbol                define symbol to be ''
1458          -A define:symbol               define symbol to be 'define'
1459          -A eval:symbol=value           define symbol to be eval of value
1460          -A prepend:symbol=value        prepend value to symbol
1461          -A undef:symbol                define symbol to be 'undef'
1462          -A undef:symbol=               define symbol to be ''
1463   -V : print version number and exit (with a zero status).
1464 EOM
1465         exit 1
1466         ;;
1467 esac
1468
1469 : Sanity checks
1470 case "$fastread$alldone" in
1471 yescont|yesexit) ;;
1472 *)
1473         case "$extractsh" in
1474         true) ;;
1475         *)
1476                 if test ! -t 0; then
1477                         echo "Say 'sh Configure', not 'sh <Configure'"
1478                         exit 1
1479                 fi
1480                 ;;
1481         esac
1482         ;;
1483 esac
1484
1485 exec 4>&1
1486 case "$silent" in
1487 true) exec 1>/dev/null;;
1488 esac
1489
1490 : run the defines and the undefines, if any, but leave the file out there...
1491 touch optdef.sh
1492 . ./optdef.sh
1493 : create the posthint manipulation script and leave the file out there...
1494 touch posthint.sh
1495
1496 : set package name
1497 package=perl5
1498 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1499 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1500 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1501 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1502 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1503 esac
1504
1505 : Some greps do not return status, grrr.
1506 echo "grimblepritz" >grimble
1507 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1508         contains=contains
1509 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1510         contains=grep
1511 else
1512         contains=contains
1513 fi
1514 rm -f grimble
1515 : the following should work in any shell
1516 case "$contains" in
1517 contains*)
1518         echo " "
1519         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1520         cat >contains <<'EOSS'
1521 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1522 EOSS
1523 chmod +x contains
1524 esac
1525
1526 : Find the path to the source tree
1527 case "$src" in
1528 '') case "$0" in
1529     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1530          case "$src" in
1531          /*)    ;;
1532          .)     ;;
1533          *)     src=`cd ../$src && pwd` ;;
1534          esac
1535          ;;
1536     *)   src='.';;
1537     esac;;
1538 esac
1539 case "$src" in
1540 '')     src=/
1541         rsrc=/
1542         ;;
1543 /*) rsrc="$src";;
1544 *) rsrc="../$src";;
1545 esac
1546 if test -f $rsrc/Configure && \
1547         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1548 then
1549    : found it, so we are ok.
1550 else
1551         rsrc=''
1552         for src in . .. ../.. ../../.. ../../../..; do
1553                 if test -f ../$src/Configure && \
1554                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1555                 then
1556                         rsrc=../$src
1557                         break
1558                 fi
1559         done
1560 fi
1561 case "$rsrc" in
1562 '')
1563         cat <<EOM >&4
1564
1565 Sorry, I can't seem to locate the source dir for $package.  Please start
1566 Configure with an explicit path -- i.e. /some/path/Configure.
1567
1568 EOM
1569         exit 1
1570         ;;
1571 ../.)   rsrc='..';;
1572 *)
1573         echo " "
1574         echo "Sources for $package found in \"$src\"." >&4
1575         ;;
1576 esac
1577
1578 : script used to extract .SH files with variable substitutions
1579 cat >extract <<'EOS'
1580 PERL_CONFIG_SH=true
1581 echo "Doing variable substitutions on .SH files..."
1582 if test -f MANIFEST; then
1583         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1584 else
1585         echo "(Looking for .SH files under the source directory.)"
1586         set x `(cd $src; find . -name "*.SH" -print)`
1587 fi
1588 shift
1589 case $# in
1590 0) set x `(cd $src; echo *.SH)`; shift;;
1591 esac
1592 if test ! -f $src/$1; then
1593         shift
1594 fi
1595 mkdir_p='
1596 name=$1;
1597 create="";
1598 while test $name; do
1599         if test ! -d "$name"; then
1600                 create="$name $create";
1601                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1602                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1603         else
1604                 name="";
1605         fi;
1606 done;
1607 for file in $create; do
1608         mkdir $file;
1609 done
1610 '
1611 for file in $*; do
1612         case "$src" in
1613         ".")
1614                 case "$file" in
1615                 */*)
1616                         dir=`expr X$file : 'X\(.*\)/'`
1617                         file=`expr X$file : 'X.*/\(.*\)'`
1618                         (cd $dir && . ./$file)
1619                         ;;
1620                 *)
1621                         . ./$file
1622                         ;;
1623                 esac
1624                 ;;
1625         *)
1626                 case "$file" in
1627                 */*)
1628                         dir=`expr X$file : 'X\(.*\)/'`
1629                         file=`expr X$file : 'X.*/\(.*\)'`
1630                         (set x $dir; shift; eval $mkdir_p)
1631                         sh <$src/$dir/$file
1632                         ;;
1633                 *)
1634                         sh <$src/$file
1635                         ;;
1636                 esac
1637                 ;;
1638         esac
1639 done
1640 if test -f $src/config_h.SH; then
1641         if test ! -f config.h; then
1642         : oops, they left it out of MANIFEST, probably, so do it anyway.
1643         . $src/config_h.SH
1644         fi
1645 fi
1646 EOS
1647
1648 : extract files and exit if asked to do so
1649 case "$extractsh" in
1650 true)
1651         case "$realsilent" in
1652         true) ;;
1653         *) exec 1>&4;;
1654         esac
1655         case "$config_sh" in
1656         '') config_sh='config.sh';;
1657         esac
1658         echo " "
1659         echo "Fetching answers from $config_sh..."
1660         cd ..
1661         . $config_sh
1662         test "$override" && . ./optdef.sh
1663         echo " "
1664         . UU/extract
1665         rm -rf UU
1666         echo "Extraction done."
1667         exit 0
1668         ;;
1669 esac
1670
1671 : Eunice requires " " instead of "", can you believe it
1672 echo " "
1673 : Here we go...
1674 echo "Beginning of configuration questions for $package."
1675
1676 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1677
1678 : first determine how to suppress newline on echo command
1679 echo " "
1680 echo "Checking echo to see how to suppress newlines..."
1681 (echo "hi there\c" ; echo " ") >.echotmp
1682 if $contains c .echotmp >/dev/null 2>&1 ; then
1683         echo "...using -n."
1684         n='-n'
1685         c=''
1686 else
1687         cat <<'EOM'
1688 ...using \c
1689 EOM
1690         n=''
1691         c='\c'
1692 fi
1693 echo $n "The star should be here-->$c"
1694 echo '*'
1695 rm -f .echotmp
1696
1697 : Now test for existence of everything in MANIFEST
1698 echo " "
1699 if test -f $rsrc/MANIFEST; then
1700         echo "First let's make sure your kit is complete.  Checking..." >&4
1701         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1702         rm -f missing
1703         tmppwd=`pwd`
1704         for filelist in x??; do
1705                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1706         done
1707         if test -s missing; then
1708                 cat missing >&4
1709                 cat >&4 <<'EOM'
1710
1711 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1712
1713 You have the option of continuing the configuration process, despite the
1714 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1715 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1716 and contact the author (perlbug@perl.org).
1717
1718 EOM
1719                 echo $n "Continue? [n] $c" >&4
1720                 read ans
1721                 case "$ans" in
1722                 y*)
1723                         echo "Continuing..." >&4
1724                         rm -f missing
1725                         ;;
1726                 *)
1727                         echo "ABORTING..." >&4
1728                         kill $$
1729                         ;;
1730                 esac
1731         else
1732                 echo "Looks good..."
1733         fi
1734 else
1735         echo "There is no MANIFEST file.  I hope your kit is complete !"
1736 fi
1737 rm -f missing x??
1738
1739 echo " "
1740 : Find the appropriate value for a newline for tr
1741 if test -n "$DJGPP"; then
1742        trnl='\012'
1743 fi
1744 if test X"$trnl" = X; then
1745         case "`echo foo|tr '\n' x 2>/dev/null`" in
1746         foox) trnl='\n' ;;
1747         esac
1748 fi
1749 if test X"$trnl" = X; then
1750         case "`echo foo|tr '\012' x 2>/dev/null`" in
1751         foox) trnl='\012' ;;
1752         esac
1753 fi
1754 if test X"$trnl" = X; then
1755         cat <<EOM >&2
1756
1757 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1758
1759 EOM
1760         exit 1
1761 fi
1762
1763 : compute the number of columns on the terminal for proper question formatting
1764 case "$COLUMNS" in
1765 '') COLUMNS='80';;
1766 esac
1767
1768 : set up the echo used in my read
1769 myecho="case \"\$xxxm\" in
1770 '') echo $n \"\$rp $c\" >&4;;
1771 *) case \"\$rp\" in
1772         '') echo $n \"[\$xxxm] $c\";;
1773         *)
1774                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1775                         echo \"\$rp\" >&4
1776                         echo $n \"[\$xxxm] $c\" >&4
1777                 else
1778                         echo $n \"\$rp [\$xxxm] $c\" >&4
1779                 fi
1780                 ;;
1781         esac;;
1782 esac"
1783
1784 : now set up to do reads with possible shell escape and default assignment
1785 cat <<EOSC >myread
1786 $startsh
1787 xxxm=\$dflt
1788 $myecho
1789 ans='!'
1790 case "\$fastread" in
1791 yes) case "\$dflt" in
1792         '') ;;
1793         *) ans='';
1794                 case "\$silent-\$rp" in
1795                 true-) ;;
1796                 *) echo " " >&4;;
1797                 esac;;
1798         esac;;
1799 *) case "\$silent" in
1800         true) case "\$rp" in
1801                 '') ans='';;
1802                 esac;;
1803         esac;;
1804 esac
1805 while expr "X\$ans" : "X!" >/dev/null; do
1806         read answ
1807         set x \$xxxm
1808         shift
1809         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1810         case  "\$answ" in
1811         "!")
1812                 sh 1>&4
1813                 echo " "
1814                 $myecho
1815                 ;;
1816         !*)
1817                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1818                 shift
1819                 sh 1>&4 -c "\$*"
1820                 echo " "
1821                 $myecho
1822                 ;;
1823         "\$ans")
1824                 case "\$ans" in
1825                 \\&*)
1826                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1827                         shift
1828                         case "\$1" in
1829                         -d)
1830                                 fastread=yes
1831                                 echo "(OK, I'll run with -d after this question.)" >&4
1832                                 ;;
1833                         -*)
1834                                 echo "*** Sorry, \$1 not supported yet." >&4
1835                                 ;;
1836                         esac
1837                         $myecho
1838                         ans=!
1839                         ;;
1840                 esac;;
1841         *)
1842                 case "\$aok" in
1843                 y)
1844                         echo "*** Substitution done -- please confirm."
1845                         xxxm="\$ans"
1846                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1847                         xxxm="\$ans"
1848                         ans=!
1849                         ;;
1850                 *)
1851                         echo "*** Error -- try again."
1852                         ans=!
1853                         ;;
1854                 esac
1855                 $myecho
1856                 ;;
1857         esac
1858         case "\$ans\$xxxm\$nostick" in
1859         '')
1860                 ans=!
1861                 $myecho
1862                 ;;
1863         esac
1864 done
1865 case "\$ans" in
1866 '') ans="\$xxxm";;
1867 esac
1868 EOSC
1869
1870 : create .config dir to save info across Configure sessions
1871 test -d ../.config || mkdir ../.config
1872 cat >../.config/README <<EOF
1873 This directory created by Configure to save information that should
1874 persist across sessions for $package.
1875
1876 You may safely delete it if you wish.
1877 EOF
1878
1879 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1880 case "$usedevel" in
1881 $define|true|[yY]*) ;;
1882 *) case "$xversion" in
1883    *[13579])
1884         cat >&4 <<EOH
1885 *** WHOA THERE!!! ***
1886
1887     This is an UNSTABLE DEVELOPMENT release.
1888     The version of this $package distribution is $xversion, that is, odd,
1889     (as opposed to even) and that signifies a development release.
1890     If you want a maintenance release, you want an even-numbered version.
1891
1892     Do ***NOT*** install this into production use.
1893     Data corruption and crashes are possible.
1894
1895     It is most seriously suggested that you do not continue any further
1896     unless you want to help in developing and debugging Perl.
1897
1898     If you *still* want to build perl, you can answer 'y' now,
1899     or pass -Dusedevel to Configure.
1900
1901 EOH
1902         rp='Do you really want to continue?'
1903         dflt='n'
1904         . ./myread
1905         case "$ans" in
1906         [yY]) echo >&4 "Okay, continuing."
1907               usedevel="$define" ;;
1908         *) echo >&4 "Okay, bye."
1909            exit 1
1910            ;;
1911         esac
1912         ;;
1913     esac
1914     ;;
1915 esac
1916 case "$usedevel" in
1917 $define|true|[yY]*)
1918         case "$versiononly" in
1919         '') versiononly="$define" ;;
1920         esac
1921         case "$installusrbinperl" in
1922         '') installusrbinperl="$undef" ;;
1923         esac
1924         ;;
1925 esac
1926
1927 : general instructions
1928 needman=true
1929 firsttime=true
1930 user=`(logname) 2>/dev/null`
1931 case "$user" in
1932 '') user=`whoami 2>&1`;;
1933 esac
1934 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1935         firsttime=false
1936         echo " "
1937         rp='Would you like to see the instructions?'
1938         dflt=n
1939         . ./myread
1940         case "$ans" in
1941         [yY]*) ;;
1942         *) needman=false;;
1943         esac
1944 fi
1945 if $needman; then
1946         cat <<EOH
1947
1948 This installation shell script will examine your system and ask you questions
1949 to determine how the perl5 package should be installed. If you get
1950 stuck on a question, you may use a ! shell escape to start a subshell or
1951 execute a command.  Many of the questions will have default answers in square
1952 brackets; typing carriage return will give you the default.
1953
1954 On some of the questions which ask for file or directory names you are allowed
1955 to use the ~name construct to specify the login directory belonging to "name",
1956 even if you don't have a shell which knows about that.  Questions where this is
1957 allowed will be marked "(~name ok)".
1958
1959 EOH
1960         rp=''
1961         dflt='Type carriage return to continue'
1962         . ./myread
1963         cat <<'EOH'
1964
1965 The prompter used in this script allows you to use shell variables and
1966 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1967 in the default answer, as if the default line was a set of arguments given to a
1968 script shell.  This means you may also use $* to repeat the whole default line,
1969 so you do not have to re-type everything to add something to the default.
1970
1971 Everytime there is a substitution, you will have to confirm.  If there is an
1972 error (e.g. an unmatched backtick), the default answer will remain unchanged
1973 and you will be prompted again.
1974
1975 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1976 the questions and use the computed defaults (or the previous answers if there
1977 was already a config.sh file). Type 'Configure -h' for a list of options.
1978 You may also start interactively and then answer '& -d' at any prompt to turn
1979 on the non-interactive behaviour for the remainder of the execution.
1980
1981 EOH
1982         . ./myread
1983         cat <<EOH
1984
1985 Much effort has been expended to ensure that this shell script will run on any
1986 Unix system.  If despite that it blows up on yours, your best bet is to edit
1987 Configure and run it again.  If you can't run Configure for some reason,
1988 you'll have to generate a config.sh file by hand.  Whatever problems you
1989 have, let me (perlbug@perl.org) know how I blew it.
1990
1991 This installation script affects things in two ways:
1992
1993 1) it may do direct variable substitutions on some of the files included
1994    in this kit.
1995 2) it builds a config.h file for inclusion in C programs.  You may edit
1996    any of these files as the need arises after running this script.
1997
1998 If you make a mistake on a question, there is no easy way to back up to it
1999 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2000 files.  Configure will offer to let you do this before it runs the SH files.
2001
2002 EOH
2003         dflt='Type carriage return to continue'
2004         . ./myread
2005         case "$firsttime" in
2006         true) echo $user >>../.config/instruct;;
2007         esac
2008 fi
2009
2010 : find out where common programs are
2011 echo " "
2012 echo "Locating common programs..." >&4
2013 cat <<EOSC >loc
2014 $startsh
2015 case \$# in
2016 0) exit 1;;
2017 esac
2018 thing=\$1
2019 shift
2020 dflt=\$1
2021 shift
2022 for dir in \$*; do
2023         case "\$thing" in
2024         .)
2025         if test -d \$dir/\$thing; then
2026                 echo \$dir
2027                 exit 0
2028         fi
2029         ;;
2030         *)
2031         for thisthing in \$dir/\$thing; do
2032                 : just loop through to pick last item
2033         done
2034         if test -f \$thisthing; then
2035                 echo \$thisthing
2036                 exit 0
2037         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2038                 echo \$thisthing
2039                 exit 0
2040         elif test -f \$dir/\$thing.exe; then
2041                 if test -n "$DJGPP"; then
2042                         echo \$dir/\$thing.exe
2043                 else
2044                         : on Eunice apparently
2045                         echo \$dir/\$thing
2046                 fi
2047                 exit 0
2048         fi
2049         ;;
2050         esac
2051 done
2052 echo \$dflt
2053 exit 1
2054 EOSC
2055 chmod +x loc
2056 $eunicefix loc
2057 loclist="
2058 awk
2059 cat
2060 chmod
2061 comm
2062 cp
2063 echo
2064 expr
2065 grep
2066 ls
2067 mkdir
2068 rm
2069 sed
2070 sort
2071 touch
2072 tr
2073 uniq
2074 "
2075 trylist="
2076 Mcc
2077 ar
2078 bison
2079 byacc
2080 cpp
2081 csh
2082 date
2083 egrep
2084 gmake
2085 gzip
2086 less
2087 ln
2088 make
2089 more
2090 nm
2091 nroff
2092 pg
2093 test
2094 uname
2095 zip
2096 "
2097 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2098 pth="$pth /lib /usr/lib"
2099 for file in $loclist; do
2100         eval xxx=\$$file
2101         case "$xxx" in
2102         /*|?:[\\/]*)
2103                 if test -f "$xxx"; then
2104                         : ok
2105                 else
2106                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2107                         xxx=`./loc $file $file $pth`
2108                 fi
2109                 ;;
2110         '') xxx=`./loc $file $file $pth`;;
2111         *) xxx=`./loc $xxx $xxx $pth`;;
2112         esac
2113         eval $file=$xxx$_exe
2114         eval _$file=$xxx
2115         case "$xxx" in
2116         /*)
2117                 echo $file is in $xxx.
2118                 ;;
2119         ?:[\\/]*)
2120                 echo $file is in $xxx.
2121                 ;;
2122         *)
2123                 echo "I don't know where '$file' is, and my life depends on it." >&4
2124                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2125                 exit 1
2126                 ;;
2127         esac
2128 done
2129 echo " "
2130 echo "Don't worry if any of the following aren't found..."
2131 say=offhand
2132 for file in $trylist; do
2133         eval xxx=\$$file
2134         case "$xxx" in
2135         /*|?:[\\/]*)
2136                 if test -f "$xxx"; then
2137                         : ok
2138                 else
2139                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2140                         xxx=`./loc $file $file $pth`
2141                 fi
2142                 ;;
2143         '') xxx=`./loc $file $file $pth`;;
2144         *) xxx=`./loc $xxx $xxx $pth`;;
2145         esac
2146         eval $file=$xxx
2147         eval _$file=$xxx
2148         case "$xxx" in
2149         /*)
2150                 echo $file is in $xxx.
2151                 ;;
2152         ?:[\\/]*)
2153                 echo $file is in $xxx.
2154                 ;;
2155         *)
2156                 echo "I don't see $file out there, $say."
2157                 say=either
2158                 ;;
2159         esac
2160 done
2161 case "$egrep" in
2162 egrep)
2163         echo "Substituting grep for egrep."
2164         egrep=$grep
2165         ;;
2166 esac
2167 case "$ln" in
2168 ln)
2169         echo "Substituting cp for ln."
2170         ln=$cp
2171         ;;
2172 esac
2173 case "$make" in
2174 make)   
2175         case "$gmake" in
2176         gmake)
2177         echo "I can't find make or gmake, and my life depends on it." >&4
2178         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2179         exit 1
2180         ;;
2181         esac
2182         ;;
2183 esac    
2184 case "$gmake" in
2185 gmake)  ;;
2186 *)      # We can't have osname yet.
2187         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2188                 # Assume that gmake, if found, is definitely GNU make
2189                 # and prefer it over the system make.
2190                 echo "Substituting gmake for make."
2191                 make=$gmake
2192         fi
2193         ;;
2194 esac
2195 case "$test" in
2196 test)
2197         echo "Hopefully test is built into your sh."
2198         ;;
2199 *)
2200         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2201                 echo "Using the test built into your sh."
2202                 test=test
2203                 _test=test
2204         fi
2205         ;;
2206 esac
2207 case "$echo" in
2208 echo)
2209         echo "Hopefully echo is built into your sh."
2210         ;;
2211 '') ;;
2212 *)
2213         echo " "
2214 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2215         $echo $n "hi there$c" >foo1
2216         echo $n "hi there$c" >foo2
2217         if cmp foo1 foo2 >/dev/null 2>&1; then
2218                 echo "They are compatible.  In fact, they may be identical."
2219         else
2220                 case "$n" in
2221                 '-n') n='' c='\c';;
2222                 *) n='-n' c='';;
2223                 esac
2224                 cat <<FOO
2225 They are not compatible!  You are probably running ksh on a non-USG system.
2226 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2227 have echo built in and we may have to run some Bourne shell scripts.  That
2228 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2229
2230 FOO
2231                 $echo $n "The star should be here-->$c"
2232                 $echo "*"
2233         fi
2234         $rm -f foo1 foo2
2235         ;;
2236 esac
2237
2238 cat <<EOS >checkcc
2239 $startsh
2240 EOS
2241 cat <<'EOSC' >>checkcc
2242 case "$cc" in
2243 '') ;;
2244 *)  $rm -f try try.*
2245     $cat >try.c <<EOM
2246 int main(int argc, char *argv[]) {
2247   return 0;
2248 }
2249 EOM
2250     if $cc -o try $ccflags $ldflags try.c; then
2251        :
2252     else
2253         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2254         despair=yes
2255         trygcc=yes
2256         case "$cc" in
2257         *gcc*) trygcc=no ;;
2258         esac
2259         case "`$cc -v -c try.c 2>&1`" in
2260         *gcc*) trygcc=no ;;
2261         esac
2262         if $test X"$trygcc" = Xyes; then
2263             if gcc -o try -c try.c; then
2264                 echo " "
2265                 echo "You seem to have a working gcc, though." >&4
2266                 rp="Would you like to use it?"
2267                 dflt=y
2268                 if $test -f myread; then
2269                     . ./myread
2270                 else
2271                     if $test -f UU/myread; then
2272                         . ./UU/myread
2273                     else
2274                         echo "Cannot find myread, sorry.  Aborting." >&2
2275                         exit 1
2276                     fi
2277                 fi  
2278                 case "$ans" in
2279                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2280                 esac
2281             fi
2282         fi
2283         if $test X"$despair" = Xyes; then
2284             $cat >&4 <<EOM
2285 You need to find a working C compiler.
2286 Either (purchase and) install the C compiler supplied by your OS vendor,
2287 or for a free C compiler try http://gcc.gnu.org/
2288 I cannot continue any further, aborting.
2289 EOM
2290             exit 1
2291         fi
2292     fi
2293     $rm -f try try.*
2294     ;;
2295 esac
2296 EOSC
2297
2298 : determine whether symbolic links are supported
2299 echo " "
2300 $touch blurfl
2301 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2302         echo "Symbolic links are supported." >&4
2303         lns="$ln -s"
2304 else
2305         echo "Symbolic links are NOT supported." >&4
2306         lns="$ln"
2307 fi
2308 $rm -f blurfl sym
2309
2310 : determine whether symbolic links are supported
2311 echo " "
2312 case "$lns" in
2313 *"ln -s")
2314         echo "Checking how to test for symbolic links..." >&4
2315         $lns blurfl sym
2316         if $test "X$issymlink" = X; then
2317                 case "$newsh" in
2318                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2319                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2320                 esac
2321                 if test $? = 0; then
2322                         issymlink="test -h"
2323                 else
2324                         echo "Your builtin 'test -h' may be broken." >&4
2325                         case "$test" in
2326                         /*)     ;;
2327                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2328                                 for p in $pth
2329                                 do
2330                                         if test -f "$p/$test"; then
2331                                                 test="$p/$test"
2332                                                 break
2333                                         fi
2334                                 done
2335                                 ;;
2336                         esac
2337                         case "$test" in
2338                         /*)
2339                                 echo "Trying external '$test -h'." >&4
2340                                 issymlink="$test -h"
2341                                 if $test ! -h sym >/dev/null 2>&1; then
2342                                         echo "External '$test -h' is broken, too." >&4
2343                                         issymlink=''
2344                                 fi
2345                                 ;;
2346                         *)      issymlink='' ;;
2347                         esac
2348                 fi              
2349         fi
2350         if $test "X$issymlink" = X; then
2351                 if $test -L sym 2>/dev/null; then
2352                         issymlink="$test -L"
2353                         echo "The builtin '$test -L' worked." >&4
2354                 fi
2355         fi
2356         if $test "X$issymlink" != X; then
2357                 echo "You can test for symbolic links with '$issymlink'." >&4
2358         else
2359                 echo "I do not know how you can test for symbolic links." >&4
2360         fi
2361         $rm -f blurfl sym
2362         ;;
2363 *)      echo "No symbolic links, so not testing for their testing..." >&4
2364         ;;
2365 esac
2366 echo " "
2367
2368
2369 case "$mksymlinks" in
2370 $define|true|[yY]*)
2371         case "$src" in
2372         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2373                 exit 1
2374                 ;;
2375         *)      case "$lns:$issymlink" in
2376                 *"ln -s:"*"test -"?)
2377                         echo "Creating the symbolic links..." >&4
2378                         echo "(First creating the subdirectories...)" >&4
2379                         cd ..
2380                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2381                                 read directory
2382                                 test -z "$directory" && break
2383                                 mkdir -p $directory
2384                         done
2385                         # Sanity check 1.
2386                         if test ! -d t/base; then
2387                                 echo "Failed to create the subdirectories.  Aborting." >&4
2388                                 exit 1
2389                         fi
2390                         echo "(Then creating the symlinks...)" >&4
2391                         awk '{print $1}' $src/MANIFEST | while true; do
2392                                 read filename
2393                                 test -z "$filename" && break
2394                                 if test -f $filename; then
2395                                         if $issymlink $filename; then
2396                                                 rm -f $filename
2397                                         fi
2398                                 fi
2399                                 if test -f $filename; then
2400                                         echo "$filename already exists, not symlinking."
2401                                 else
2402                                         ln -s $src/$filename $filename
2403                                 fi
2404                         done
2405                         # Sanity check 2.
2406                         if test ! -f t/base/lex.t; then
2407                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2408                                 exit 1
2409                         fi
2410                         cd UU
2411                         ;;
2412                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2413                         ;;
2414                 esac
2415                 ;;
2416         esac
2417         ;;
2418 esac
2419
2420
2421 case "$usecrosscompile" in
2422 $define|true|[yY]*)
2423         $echo "Cross-compiling..."
2424         croak=''
2425         case "$cc" in
2426         *-*-gcc) # A cross-compiling gcc, probably.
2427             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2428             ar=$targetarch-ar
2429             # leave out ld, choosing it is more complex
2430             nm=$targetarch-nm
2431             ranlib=$targetarch-ranlib
2432             $echo 'extern int foo;' > try.c
2433             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2434             shift
2435             if $test $# -gt 0; then
2436                 incpth="$incpth $*"
2437                 incpth="`$echo $incpth|$sed 's/^ //'`"
2438                 echo "Guessing incpth '$incpth'." >&4
2439                 for i in $*; do
2440                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2441                     if $test -d $j; then
2442                         libpth="$libpth $j"
2443                     fi
2444                 done   
2445                 libpth="`$echo $libpth|$sed 's/^ //'`"
2446                 echo "Guessing libpth '$libpth'." >&4
2447             fi
2448             $rm -f try.c
2449             ;;
2450         esac
2451         case "$targetarch" in
2452         '') echo "Targetarch not defined." >&4; croak=y ;;
2453         *)  echo "Using targetarch $targetarch." >&4 ;;
2454         esac
2455         case "$incpth" in
2456         '') echo "Incpth not defined." >&4; croak=y ;;
2457         *)  echo "Using incpth '$incpth'." >&4 ;;
2458         esac
2459         case "$libpth" in
2460         '') echo "Libpth not defined." >&4; croak=y ;;
2461         *)  echo "Using libpth '$libpth'." >&4 ;;
2462         esac
2463         case "$usrinc" in
2464         '') for i in $incpth; do
2465                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2466                     usrinc=$i
2467                     echo "Guessing usrinc $usrinc." >&4
2468                     break
2469                 fi
2470             done
2471             case "$usrinc" in
2472             '') echo "Usrinc not defined." >&4; croak=y ;;
2473             esac
2474             ;;
2475         *)  echo "Using usrinc $usrinc." >&4 ;;
2476         esac
2477         case "$targethost" in
2478         '') echo "Targethost not defined." >&4; croak=y ;;
2479         *)  echo "Using targethost $targethost." >&4
2480         esac
2481         locincpth=' '
2482         loclibpth=' '
2483         case "$croak" in
2484         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2485         esac
2486         case "$src" in
2487         /*) run=$src/Cross/run
2488             targetmkdir=$src/Cross/mkdir
2489             to=$src/Cross/to
2490             from=$src/Cross/from
2491             ;;
2492         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2493             run=$pwd/Cross/run
2494             targetmkdir=$pwd/Cross/mkdir
2495             to=$pwd/Cross/to
2496             from=$pwd/Cross/from
2497             ;;
2498         esac
2499         case "$targetrun" in
2500         '') targetrun=ssh ;;
2501         esac
2502         case "$targetto" in
2503         '') targetto=scp ;;
2504         esac
2505         case "$targetfrom" in
2506         '') targetfrom=scp ;;
2507         esac
2508         run=$run-$targetrun
2509         to=$to-$targetto
2510         from=$from-$targetfrom
2511         case "$targetdir" in
2512         '')  targetdir=/tmp
2513              echo "Guessing targetdir $targetdir." >&4
2514              ;;
2515         esac
2516         case "$targetuser" in
2517         '')  targetuser=root
2518              echo "Guessing targetuser $targetuser." >&4
2519              ;;
2520         esac
2521         case "$targetfrom" in
2522         scp)    q=-q ;;
2523         *)      q='' ;;
2524         esac
2525         case "$targetrun" in
2526         ssh|rsh)
2527             cat >$run <<EOF
2528 #!/bin/sh
2529 case "\$1" in
2530 -cwd)
2531   shift
2532   cwd=\$1
2533   shift
2534   ;;
2535 esac
2536 case "\$cwd" in
2537 '') cwd=$targetdir ;;
2538 esac
2539 exe=\$1
2540 shift
2541 if $test ! -f \$exe.xok; then
2542   $to \$exe
2543   $touch \$exe.xok
2544 fi
2545 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2546 EOF
2547             ;;
2548         *)  echo "Unknown targetrun '$targetrun'" >&4
2549             exit 1
2550             ;;
2551         esac
2552         case "$targetmkdir" in
2553         */Cross/mkdir)
2554             cat >$targetmkdir <<EOF
2555 #!/bin/sh
2556 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2557 EOF
2558             $chmod a+rx $targetmkdir
2559             ;;
2560         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2561             exit 1
2562             ;;
2563         esac
2564         case "$targetto" in
2565         scp|rcp)
2566             cat >$to <<EOF
2567 #!/bin/sh
2568 for f in \$@
2569 do
2570   case "\$f" in
2571   /*)
2572     $targetmkdir \`dirname \$f\`
2573     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2574     ;;
2575   *)
2576     $targetmkdir $targetdir/\`dirname \$f\`
2577     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2578     ;;
2579   esac
2580 done
2581 exit 0
2582 EOF
2583             ;;
2584         cp) cat >$to <<EOF
2585 #!/bin/sh
2586 for f in \$@
2587 do
2588   case "\$f" in
2589   /*)
2590     $mkdir -p $targetdir/\`dirname \$f\`
2591     $cp \$f $targetdir/\$f || exit 1
2592     ;;
2593   *)
2594     $targetmkdir $targetdir/\`dirname \$f\`
2595     $cp \$f $targetdir/\$f || exit 1
2596     ;;
2597   esac
2598 done
2599 exit 0
2600 EOF
2601             ;;
2602         *)  echo "Unknown targetto '$targetto'" >&4
2603             exit 1
2604             ;;
2605         esac
2606         case "$targetfrom" in
2607         scp|rcp)
2608           cat >$from <<EOF
2609 #!/bin/sh
2610 for f in \$@
2611 do
2612   $rm -f \$f
2613   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2614 done
2615 exit 0
2616 EOF
2617             ;;
2618         cp) cat >$from <<EOF
2619 #!/bin/sh
2620 for f in \$@
2621 do
2622   $rm -f \$f
2623   cp $targetdir/\$f . || exit 1
2624 done
2625 exit 0
2626 EOF
2627             ;;
2628         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2629             exit 1
2630             ;;
2631         esac
2632         if $test ! -f $run; then
2633             echo "Target 'run' script '$run' not found." >&4
2634         else
2635             $chmod a+rx $run
2636         fi
2637         if $test ! -f $to; then
2638             echo "Target 'to' script '$to' not found." >&4
2639         else
2640             $chmod a+rx $to
2641         fi
2642         if $test ! -f $from; then
2643             echo "Target 'from' script '$from' not found." >&4
2644         else
2645             $chmod a+rx $from
2646         fi
2647         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2648             exit 1
2649         fi
2650         cat >&4 <<EOF
2651 Using '$run' for remote execution,
2652 and '$from' and '$to'
2653 for remote file transfer.
2654 EOF
2655         ;;
2656 *)      run=''
2657         to=:
2658         from=:
2659         usecrosscompile='undef'
2660         targetarch=''
2661         ;;
2662 esac
2663
2664 : see whether [:lower:] and [:upper:] are supported character classes
2665 echo " "
2666 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2667 ABYZ)
2668         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2669         up='[:upper:]'
2670         low='[:lower:]'
2671         ;;
2672 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2673         # (0xc9 and 0xd1), therefore that is a nice testing point.
2674         if test "X$up" = X -o "X$low" = X; then
2675             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2676             ij) up='[A-Z]'
2677                 low='[a-z]'
2678                 ;;
2679             esac
2680         fi
2681         if test "X$up" = X -o "X$low" = X; then
2682             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2683             ij) up='A-Z'
2684                 low='a-z'
2685                 ;;
2686             esac
2687         fi
2688         if test "X$up" = X -o "X$low" = X; then
2689             case "`echo IJ | od -x 2>/dev/null`" in
2690             *C9D1*|*c9d1*)
2691                 echo "Hey, this might be EBCDIC." >&4
2692                 if test "X$up" = X -o "X$low" = X; then
2693                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2694                     ij) up='[A-IJ-RS-Z]'
2695                         low='[a-ij-rs-z]'
2696                         ;;
2697                     esac
2698                 fi
2699                 if test "X$up" = X -o "X$low" = X; then
2700                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2701                     ij) up='A-IJ-RS-Z'
2702                         low='a-ij-rs-z'
2703                         ;;
2704                     esac
2705                 fi
2706                 ;;
2707             esac
2708         fi
2709 esac
2710 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2711 ij)
2712     echo "Using $up and $low to convert case." >&4
2713     ;;
2714 *)
2715     echo "I don't know how to translate letters from upper to lower case." >&4
2716     echo "Your tr is not acting any way I know of." >&4
2717     exit 1
2718     ;;
2719 esac
2720 : set up the translation script tr, must be called with ./tr of course
2721 cat >tr <<EOSC
2722 $startsh
2723 case "\$1\$2" in
2724 '[A-Z][a-z]') exec $tr '$up' '$low';;
2725 '[a-z][A-Z]') exec $tr '$low' '$up';;
2726 esac
2727 exec $tr "\$@"
2728 EOSC
2729 chmod +x tr
2730 $eunicefix tr
2731
2732 : Try to determine whether config.sh was made on this system
2733 case "$config_sh" in
2734 '')
2735 myuname=`$uname -a 2>/dev/null`
2736 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2737 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2738 # because the A-Z/a-z are not consecutive.
2739 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2740         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2741 newmyuname="$myuname"
2742 dflt=n
2743 case "$knowitall" in
2744 '')
2745         if test -f ../config.sh; then
2746                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2747                         eval "`grep myuname= ../config.sh`"
2748                 fi
2749                 if test "X$myuname" = "X$newmyuname"; then
2750                         dflt=y
2751                 fi
2752         fi
2753         ;;
2754 *) dflt=y;;
2755 esac
2756
2757 : Get old answers from old config file if Configure was run on the
2758 : same system, otherwise use the hints.
2759 hint=default
2760 cd ..
2761 if test -f config.sh; then
2762         echo " "
2763         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2764         . UU/myread
2765         case "$ans" in
2766         n*|N*) echo "OK, I'll ignore it."
2767                 mv config.sh config.sh.old
2768                 myuname="$newmyuname"
2769                 ;;
2770         *)  echo "Fetching default answers from your old config.sh file..." >&4
2771                 tmp_n="$n"
2772                 tmp_c="$c"
2773                 tmp_sh="$sh"
2774                 . ./config.sh
2775                 cp config.sh UU
2776                 n="$tmp_n"
2777                 c="$tmp_c"
2778                 : Older versions did not always set $sh.  Catch re-use of such
2779                 : an old config.sh.
2780                 case "$sh" in
2781                 '') sh="$tmp_sh" ;;
2782                 esac
2783                 hint=previous
2784                 ;;
2785         esac
2786 fi
2787 . ./UU/checkcc
2788 if test ! -f config.sh; then
2789         $cat <<EOM
2790
2791 First time through, eh?  I have some defaults handy for some systems
2792 that need some extra help getting the Configure answers right:
2793
2794 EOM
2795         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2796         dflt=''
2797         : Half the following guesses are probably wrong... If you have better
2798         : tests or hints, please send them to perlbug@perl.org
2799         : The metaconfig authors would also appreciate a copy...
2800         $test -f /irix && osname=irix
2801         $test -f /xenix && osname=sco_xenix
2802         $test -f /dynix && osname=dynix
2803         $test -f /dnix && osname=dnix
2804         $test -f /lynx.os && osname=lynxos
2805         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2806         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2807         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2808         $test -f /bin/mips && /bin/mips && osname=mips
2809         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2810                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2811         $test -d /usr/apollo/bin && osname=apollo
2812         $test -f /etc/saf/_sactab && osname=svr4
2813         $test -d /usr/include/minix && osname=minix
2814         $test -d /system && osname=vos
2815         if $test -d /MachTen -o -d /MachTen_Folder; then
2816                 osname=machten
2817                 if $test -x /sbin/version; then
2818                         osvers=`/sbin/version | $awk '{print $2}' |
2819                         $sed -e 's/[A-Za-z]$//'`
2820                 elif $test -x /usr/etc/version; then
2821                         osvers=`/usr/etc/version | $awk '{print $2}' |
2822                         $sed -e 's/[A-Za-z]$//'`
2823                 else
2824                         osvers="$2.$3"
2825                 fi
2826         fi
2827
2828         $test -f /sys/posix.dll &&
2829                 $test -f /usr/bin/what &&
2830                 set X `/usr/bin/what /sys/posix.dll` &&
2831                 $test "$3" = UWIN &&
2832                 osname=uwin &&
2833                 osvers="$5"
2834
2835         if $test -f $uname; then
2836                 set X $myuname
2837                 shift
2838
2839                 case "$5" in
2840                 fps*) osname=fps ;;
2841                 mips*)
2842                         case "$4" in
2843                         umips) osname=umips ;;
2844                         *) osname=mips ;;
2845                         esac;;
2846                 [23]100) osname=mips ;;
2847                 next*) osname=next ;;
2848                 i386*)
2849                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2850                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2851                                 osname='sco'
2852                                 osvers=$tmp
2853                         elif $test -f /etc/kconfig; then
2854                                 osname=isc
2855                                 if test "$lns" = "$ln -s"; then
2856                                         osvers=4
2857                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2858                                         osvers=3
2859                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2860                                         osvers=2
2861                                 fi
2862                         fi
2863                         tmp=''
2864                         ;;
2865                 pc*)
2866                         if test -n "$DJGPP"; then
2867                                 osname=dos
2868                                 osvers=djgpp
2869                         fi
2870                         ;;
2871                 esac
2872
2873                 case "$1" in
2874                 aix) osname=aix
2875                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2876                         case "$tmp" in
2877                         'not found') osvers="$4"."$3" ;;
2878                         '<3240'|'<>3240') osvers=3.2.0 ;;
2879                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2880                         '=3250'|'>3250') osvers=3.2.5 ;;
2881                         *) osvers=$tmp;;
2882                         esac
2883                         ;;
2884                 bsd386) osname=bsd386
2885                         osvers=`$uname -r`
2886                         ;;
2887                 cygwin*) osname=cygwin
2888                         osvers="$3"
2889                         ;;
2890                 *dc.osx) osname=dcosx
2891                         osvers="$3"
2892                         ;;
2893                 dnix) osname=dnix
2894                         osvers="$3"
2895                         ;;
2896                 domainos) osname=apollo
2897                         osvers="$3"
2898                         ;;
2899                 dgux) osname=dgux 
2900                         osvers="$3"
2901                         ;;
2902                 dynixptx*) osname=dynixptx
2903                         osvers=`echo "$4"|sed 's/^v//'`
2904                         ;;
2905                 freebsd) osname=freebsd 
2906                         osvers="$3" ;;
2907                 genix) osname=genix ;;
2908                 hp*) osname=hpux 
2909                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2910                         ;;
2911                 irix*) osname=irix
2912                         case "$3" in
2913                         4*) osvers=4 ;;
2914                         5*) osvers=5 ;;
2915                         *)      osvers="$3" ;;
2916                         esac
2917                         ;;
2918                 linux) osname=linux
2919                         case "$3" in
2920                         *)      osvers="$3" ;;
2921                         esac
2922                         ;;
2923                 MiNT) osname=mint
2924                         ;;
2925                 netbsd*) osname=netbsd
2926                         osvers="$3"
2927                         ;;
2928                 news-os) osvers="$3"
2929                         case "$3" in
2930                         4*) osname=newsos4 ;;
2931                         *) osname=newsos ;;
2932                         esac
2933                         ;;
2934                 next*) osname=next ;;
2935                 nonstop-ux) osname=nonstopux ;;
2936                 POSIX-BC | posix-bc ) osname=posix-bc
2937                         osvers="$3"
2938                         ;;
2939                 powerux | power_ux | powermax_os | powermaxos | \
2940                 powerunix | power_unix) osname=powerux
2941                         osvers="$3"
2942                         ;;
2943                 qnx) osname=qnx
2944                         osvers="$4"
2945                         ;;
2946                 solaris) osname=solaris
2947                         case "$3" in
2948                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2949                         *)      osvers="$3" ;;
2950                         esac
2951                         ;;
2952                 sunos) osname=sunos
2953                         case "$3" in
2954                         5*) osname=solaris
2955                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2956                         *)      osvers="$3" ;;
2957                         esac
2958                         ;;
2959                 titanos) osname=titanos
2960                         case "$3" in
2961                         1*) osvers=1 ;;
2962                         2*) osvers=2 ;;
2963                         3*) osvers=3 ;;
2964                         4*) osvers=4 ;;
2965                         *)      osvers="$3" ;;
2966                         esac
2967                         ;;
2968                 ultrix) osname=ultrix
2969                         osvers="$3"
2970                         ;;
2971                 osf1|mls+)      case "$5" in
2972                                 alpha)
2973                                         osname=dec_osf
2974                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2975                                         case "$osvers" in
2976                                         [1-9].[0-9]*) ;;
2977                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2978                                         esac
2979                                         ;;
2980                         hp*)    osname=hp_osf1  ;;
2981                         mips)   osname=mips_osf1 ;;
2982                         esac
2983                         ;;
2984                 unixware) osname=svr5
2985                         osvers="$4"
2986                         ;;
2987                 uts)    osname=uts
2988                         osvers="$3"
2989                         ;;
2990                 vos) osvers="$3"
2991                         ;;
2992                 $2) case "$osname" in
2993                         *isc*) ;;
2994                         *freebsd*) ;;
2995                         svr*)
2996                                 : svr4.x or possibly later
2997                                 case "svr$3" in 
2998                                 ${osname}*)
2999                                         osname=svr$3
3000                                         osvers=$4
3001                                         ;;
3002                                 esac
3003                                 case "$osname" in
3004                                 svr4.0)
3005                                         : Check for ESIX
3006                                         if test -f /stand/boot ; then
3007                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3008                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3009                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3010                                                         if test -n "$isesix"; then
3011                                                                 osname=esix4
3012                                                         fi
3013                                                 fi
3014                                         fi
3015                                         ;;
3016                                 esac
3017                                 ;;
3018                         *)      if test -f /etc/systemid; then
3019                                         osname=sco
3020                                         set `echo $3 | $sed 's/\./ /g'` $4
3021                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3022                                                 osvers=$1.$2.$3
3023                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3024                                                 osvers=$1.$2
3025                                         elif $test -f $src/hints/sco_$1.sh; then
3026                                                 osvers=$1
3027                                         fi
3028                                 else
3029                                         case "$osname" in
3030                                         '') : Still unknown.  Probably a generic Sys V.
3031                                                 osname="sysv"
3032                                                 osvers="$3"
3033                                                 ;;
3034                                         esac
3035                                 fi
3036                                 ;;
3037                         esac
3038                         ;;
3039                 *)      case "$osname" in
3040                         '') : Still unknown.  Probably a generic BSD.
3041                                 osname="$1"
3042                                 osvers="$3"
3043                                 ;;
3044                         esac
3045                         ;;
3046                 esac
3047         else
3048                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3049                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3050                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3051                                 osname=news_os
3052                         fi
3053                         $rm -f UU/kernel.what
3054                 elif test -d c:/.; then
3055                         set X $myuname
3056                         osname=os2
3057                         osvers="$5"
3058                 fi
3059         fi
3060         
3061         case "$targetarch" in
3062         '') ;;
3063         *)  hostarch=$osname
3064             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3065             osvers=''
3066             ;;
3067         esac
3068
3069         : Now look for a hint file osname_osvers, unless one has been
3070         : specified already.
3071         case "$hintfile" in
3072         ''|' ')
3073                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3074                 : Also try without trailing minor version numbers.
3075                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3076                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3077                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3078                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3079                 case "$file" in
3080                 '') dflt=none ;;
3081                 *)  case "$osvers" in
3082                         '') dflt=$file
3083                                 ;;
3084                         *)  if $test -f $src/hints/$file.sh ; then
3085                                         dflt=$file
3086                                 elif $test -f $src/hints/$xfile.sh ; then
3087                                         dflt=$xfile
3088                                 elif $test -f $src/hints/$xxfile.sh ; then
3089                                         dflt=$xxfile
3090                                 elif $test -f $src/hints/$xxxfile.sh ; then
3091                                         dflt=$xxxfile
3092                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3093                                         dflt=$xxxxfile
3094                                 elif $test -f "$src/hints/${osname}.sh" ; then
3095                                         dflt="${osname}"
3096                                 else
3097                                         dflt=none
3098                                 fi
3099                                 ;;
3100                         esac
3101                         ;;
3102                 esac
3103                 if $test -f Policy.sh ; then
3104                         case "$dflt" in
3105                         *Policy*) ;;
3106                         none) dflt="Policy" ;;
3107                         *) dflt="Policy $dflt" ;;
3108                         esac
3109                 fi
3110                 ;;
3111         *)
3112                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3113                 ;;
3114         esac
3115
3116         if $test -f Policy.sh ; then
3117                 $cat <<EOM
3118
3119 There's also a Policy hint file available, which should make the
3120 site-specific (policy) questions easier to answer.
3121 EOM
3122
3123         fi
3124
3125         $cat <<EOM
3126
3127 You may give one or more space-separated answers, or "none" if appropriate.
3128 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3129 is a good thing.  DO NOT give a wrong version or a wrong OS.
3130
3131 EOM
3132
3133         rp="Which of these apply, if any?"
3134         . UU/myread
3135         tans=$ans
3136         for file in $tans; do
3137                 if $test X$file = XPolicy -a -f Policy.sh; then
3138                         . Policy.sh
3139                         $cat Policy.sh >> UU/config.sh
3140                 elif $test -f $src/hints/$file.sh; then
3141                         . $src/hints/$file.sh
3142                         $cat $src/hints/$file.sh >> UU/config.sh
3143                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3144                         : nothing
3145                 else
3146                         : Give one chance to correct a possible typo.
3147                         echo "$file.sh does not exist"
3148                         dflt=$file
3149                         rp="hint to use instead?"
3150                         . UU/myread
3151                         for file in $ans; do
3152                                 if $test -f "$src/hints/$file.sh"; then
3153                                         . $src/hints/$file.sh
3154                                         $cat $src/hints/$file.sh >> UU/config.sh
3155                                 elif $test X$ans = X -o X$ans = Xnone ; then
3156                                         : nothing
3157                                 else
3158                                         echo "$file.sh does not exist -- ignored."
3159                                 fi
3160                         done
3161                 fi
3162         done
3163
3164         hint=recommended
3165         : Remember our hint file for later.
3166         if $test -f "$src/hints/$file.sh" ; then
3167                 hintfile="$file"
3168         else
3169                 hintfile=''
3170         fi
3171 fi
3172 cd UU
3173 ;;
3174 *)
3175         echo " "
3176         echo "Fetching default answers from $config_sh..." >&4
3177         tmp_n="$n"
3178         tmp_c="$c"
3179         cd ..
3180         cp $config_sh config.sh 2>/dev/null
3181         chmod +w config.sh
3182         . ./config.sh
3183         cd UU
3184         cp ../config.sh .
3185         n="$tmp_n"
3186         c="$tmp_c"
3187         hint=previous
3188         ;;
3189 esac
3190 test "$override" && . ./optdef.sh
3191
3192 : Restore computed paths
3193 for file in $loclist $trylist; do
3194         eval $file="\$_$file"
3195 done
3196
3197 cat << EOM
3198
3199 Configure uses the operating system name and version to set some defaults.
3200 The default value is probably right if the name rings a bell. Otherwise,
3201 since spelling matters for me, either accept the default or answer "none"
3202 to leave it blank.
3203
3204 EOM
3205 case "$osname" in
3206         ''|' ')
3207                 case "$hintfile" in
3208                 ''|' '|none) dflt=none ;;
3209                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3210                 esac
3211                 ;;
3212         *) dflt="$osname" ;;
3213 esac
3214 rp="Operating system name?"
3215 . ./myread
3216 case "$ans" in
3217 none)  osname='' ;;
3218 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3219 esac
3220 echo " "
3221 case "$osvers" in
3222         ''|' ')
3223                 case "$hintfile" in
3224                 ''|' '|none) dflt=none ;;
3225                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3226                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3227                         case "$dflt" in
3228                         ''|' ') dflt=none ;;
3229                         esac
3230                         ;;
3231                 esac
3232                 ;;
3233         *) dflt="$osvers" ;;
3234 esac
3235 rp="Operating system version?"
3236 . ./myread
3237 case "$ans" in
3238 none)  osvers='' ;;
3239 *) osvers="$ans" ;;
3240 esac
3241
3242
3243 . ./posthint.sh
3244
3245 : who configured the system
3246 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3247 cf_by=`(logname) 2>/dev/null`
3248 case "$cf_by" in
3249 "")
3250         cf_by=`(whoami) 2>/dev/null`
3251         case "$cf_by" in
3252         "") cf_by=unknown ;;
3253         esac ;;
3254 esac
3255
3256 : set up the script used to warn in case of inconsistency
3257 cat <<EOS >whoa
3258 $startsh
3259 EOS
3260 cat <<'EOSC' >>whoa
3261 dflt=y
3262 echo " "
3263 echo "*** WHOA THERE!!! ***" >&4
3264 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3265 rp="    Keep the $hint value?"
3266 . ./myread
3267 case "$ans" in
3268 y) td=$was; tu=$was;;
3269 esac
3270 EOSC
3271
3272 : function used to set $1 to $val
3273 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3274 case "$val$was" in
3275 $define$undef) . ./whoa; eval "$var=\$td";;
3276 $undef$define) . ./whoa; eval "$var=\$tu";;
3277 *) eval "$var=$val";;
3278 esac'
3279
3280 case "$usethreads" in
3281 $define|true|[yY]*)     dflt='y';;
3282 *) dflt='n';;
3283 esac
3284 cat <<EOM
3285
3286 Perl can be built to take advantage of threads on some systems.
3287 To do so, Configure can be run with -Dusethreads.
3288
3289 Note that threading is a highly experimental feature, and
3290 some known race conditions still remain.  If you choose to try
3291 it, be very sure to not actually deploy it for production
3292 purposes.  README.threads has more details, and is required
3293 reading if you enable threads.
3294
3295 If this doesn't make any sense to you, just accept the default '$dflt'.
3296 EOM
3297 rp='Build a threading Perl?'
3298 . ./myread
3299 case "$ans" in
3300 y|Y)    val="$define" ;;
3301 *)      val="$undef" ;;
3302 esac
3303 set usethreads
3304 eval $setvar
3305
3306 case "$usethreads" in
3307 $define)
3308         $cat <<EOM
3309
3310 As of 5.5.640, Perl has two different internal threading implementations,
3311 the 5.005 version (5005threads) and an interpreter-based version
3312 (ithreads) that has one interpreter per thread.  Both are very 
3313 experimental.  This arrangement exists to help developers work out
3314 which one is better.
3315
3316 If you're a casual user, you probably don't want interpreter-threads
3317 at this time.  But if you do, the 'threads' module allows their use,
3318 and the 'Thread' module offers an interface to both 5005threads and
3319 ithreads (whichever has been configured).
3320 EOM
3321         : Default to ithreads unless overridden on command line or with
3322         : old config.sh
3323         dflt='y'
3324         case "$use5005threads" in
3325                 $define|true|[yY]*) dflt='n';;
3326         esac
3327         case "$useithreads" in
3328                 $undef|false|[nN]*) dflt='n';;
3329         esac
3330         rp='Use interpreter-based ithreads?'
3331         . ./myread
3332         case "$ans" in
3333         y|Y)    val="$define" ;;
3334         *)      val="$undef" ;;
3335         esac
3336         set useithreads
3337         eval $setvar
3338         : Now set use5005threads to the opposite value.
3339         case "$useithreads" in
3340         $define) val="$undef" ;;
3341         *) val="$define" ;;
3342         esac
3343         set use5005threads
3344         eval $setvar
3345         ;;
3346 *)
3347         useithreads="$undef"
3348         use5005threads="$undef"
3349         ;;
3350 esac
3351
3352 case "$useithreads$use5005threads" in
3353 "$define$define")
3354         $cat >&4 <<EOM
3355
3356 You cannot have both the ithreads and the 5.005 threads enabled
3357 at the same time.  Disabling the 5.005 threads since they are
3358 much less stable than the ithreads.
3359
3360 EOM
3361         use5005threads="$undef"
3362         ;;
3363 esac
3364
3365 case "$d_oldpthreads" in
3366 '')     : Configure tests would be welcome here.  For now, assume undef.
3367         val="$undef" ;;
3368 *)      val="$d_oldpthreads" ;;
3369 esac
3370 set d_oldpthreads
3371 eval $setvar
3372
3373
3374 case "$usethreads" in
3375 "$define"|true|[yY]*)
3376 : Look for a hint-file generated 'call-back-unit'.  If the
3377 : user has specified that a threading perl is to be built,
3378 : we may need to set or change some other defaults.
3379         if $test -f usethreads.cbu; then
3380                 echo "Your platform has some specific hints for threaded builds, using them..."
3381                 . ./usethreads.cbu
3382         else
3383                 $cat <<EOM
3384 (Your platform doesn't have any specific hints for threaded builds.
3385  Assuming POSIX threads, then.)
3386 EOM
3387         fi
3388         ;;
3389 esac
3390
3391 cat <<EOM
3392
3393 Perl can be built so that multiple Perl interpreters can coexist
3394 within the same Perl executable.
3395 EOM
3396
3397 case "$useithreads" in
3398 $define)
3399         cat <<EOM
3400 This multiple interpreter support is required for interpreter-based threads.
3401 EOM
3402         val="$define"
3403         ;;
3404 *)      case "$usemultiplicity" in
3405         $define|true|[yY]*)     dflt='y';;
3406         *) dflt='n';;
3407         esac
3408         echo " "
3409         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3410         rp='Build Perl for multiplicity?'
3411         . ./myread
3412         case "$ans" in
3413         y|Y)    val="$define" ;;
3414         *)      val="$undef" ;;
3415         esac
3416         ;;
3417 esac
3418 set usemultiplicity
3419 eval $setvar
3420
3421
3422 case "$usemorebits" in
3423 "$define"|true|[yY]*)
3424         use64bitint="$define"
3425         uselongdouble="$define"
3426         usemorebits="$define"
3427         ;;
3428 *)      usemorebits="$undef"
3429         ;;
3430 esac
3431
3432 : make some quick guesses about what we are up against
3433 echo " "
3434 $echo $n "Hmm...  $c"
3435 echo exit 1 >bsd
3436 echo exit 1 >usg
3437 echo exit 1 >v7
3438 echo exit 1 >osf1
3439 echo exit 1 >eunice
3440 echo exit 1 >xenix
3441 echo exit 1 >venix
3442 echo exit 1 >os2
3443 d_bsd="$undef"
3444 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3445 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3446 then
3447         echo "Looks kind of like an OSF/1 system, but we'll see..."
3448         echo exit 0 >osf1
3449 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3450         xxx=`./loc addbib blurfl $pth`
3451         if $test -f $xxx; then
3452         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3453                 echo exit 0 >bsd
3454                 echo exit 0 >usg
3455         else
3456                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3457                         echo "Looks kind of like an extended USG system, but we'll see..."
3458                 else
3459                         echo "Looks kind of like a USG system, but we'll see..."
3460                 fi
3461                 echo exit 0 >usg
3462         fi
3463 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3464         echo "Looks kind of like a BSD system, but we'll see..."
3465         d_bsd="$define"
3466         echo exit 0 >bsd
3467 else
3468         echo "Looks kind of like a Version 7 system, but we'll see..."
3469         echo exit 0 >v7
3470 fi
3471 case "$eunicefix" in
3472 *unixtovms*)
3473         $cat <<'EOI'
3474 There is, however, a strange, musty smell in the air that reminds me of
3475 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3476 EOI
3477         echo exit 0 >eunice
3478         d_eunice="$define"
3479 : it so happens the Eunice I know will not run shell scripts in Unix format
3480         ;;
3481 *)
3482         echo " "
3483         echo "Congratulations.  You aren't running Eunice."
3484         d_eunice="$undef"
3485         ;;
3486 esac
3487 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3488 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3489 : semicolon as a patch separator
3490 case "$p_" in
3491 :) ;;
3492 *)
3493         $cat <<'EOI'
3494 I have the feeling something is not exactly right, however...don't tell me...
3495 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3496 (Or you may be running DOS with DJGPP.)
3497 EOI
3498         echo exit 0 >os2
3499         ;;
3500 esac
3501 if test -f /xenix; then
3502         echo "Actually, this looks more like a XENIX system..."
3503         echo exit 0 >xenix
3504         d_xenix="$define"
3505 else
3506         echo " "
3507         echo "It's not Xenix..."
3508         d_xenix="$undef"
3509 fi
3510 chmod +x xenix
3511 $eunicefix xenix
3512 if test -f /venix; then
3513         echo "Actually, this looks more like a VENIX system..."
3514         echo exit 0 >venix
3515 else
3516         echo " "
3517         if ./xenix; then
3518                 : null
3519         else
3520                 echo "Nor is it Venix..."
3521         fi
3522 fi
3523 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3524 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3525 $rm -f foo
3526
3527 case "$cc" in
3528 '') dflt=cc;;
3529 *) dflt="$cc";;
3530 esac
3531 rp="Use which C compiler?"
3532 . ./myread
3533 cc="$ans"
3534 : Look for a hint-file generated 'call-back-unit'.  Now that the
3535 : user has specified the compiler, we may need to set or change some
3536 : other defaults.
3537 if $test -f cc.cbu; then
3538     . ./cc.cbu
3539 fi
3540 . ./checkcc
3541
3542 echo " "
3543 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3544 $cat >try.c <<EOM
3545 #include <stdio.h>
3546 int main() {
3547 #ifdef __GNUC__
3548 #ifdef __VERSION__
3549         printf("%s\n", __VERSION__);
3550 #else
3551         printf("%s\n", "1");
3552 #endif
3553 #endif
3554         exit(0);
3555 }
3556 EOM
3557 if $cc -o try $ccflags $ldflags try.c; then
3558         gccversion=`$run ./try`
3559         case "$gccversion" in
3560         '') echo "You are not using GNU cc." ;;
3561         *)  echo "You are using GNU cc $gccversion."
3562             ccname=gcc  
3563             ;;
3564         esac
3565 else
3566         echo " "
3567         echo "*** WHOA THERE!!! ***" >&4
3568         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3569         case "$knowitall" in
3570         '')
3571         echo "    You'd better start hunting for one and let me know about it." >&4
3572                 exit 1
3573                 ;;
3574         esac
3575 fi
3576 $rm -f try try.*
3577 case "$gccversion" in
3578 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3579 esac
3580 case "$gccversion" in
3581 '') gccosandvers='' ;;
3582 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3583    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3584    gccshortvers=''
3585    case "$gccosandvers" in
3586    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3587    $osname$osvers) ;; # looking good
3588    $osname*) cat <<EOM >&4
3589
3590 *** WHOA THERE!!! ***
3591
3592     Your gcc has not been compiled for the exact release of
3593     your operating system ($gccosandvers versus $osname$osvers).
3594
3595     In general it is a good idea to keep gcc synchronized with
3596     the operating system because otherwise serious problems
3597     may ensue when trying to compile software, like Perl.
3598
3599     I'm trying to be optimistic here, though, and will continue.
3600     If later during the configuration and build icky compilation
3601     problems appear (headerfile conflicts being the most common
3602     manifestation), I suggest reinstalling the gcc to match
3603     your operating system release.
3604
3605 EOM
3606       ;;
3607    *) gccosandvers='' ;; # failed to parse, better be silent
3608    esac
3609    ;;
3610 esac
3611 case "$ccname" in
3612 '') ccname="$cc" ;;
3613 esac
3614
3615
3616 : decide how portable to be.  Allow command line overrides.
3617 case "$d_portable" in
3618 "$undef") ;;
3619 *)      d_portable="$define" ;;
3620 esac
3621
3622 : set up shell script to do ~ expansion
3623 cat >filexp <<EOSS
3624 $startsh
3625 : expand filename
3626 case "\$1" in
3627  ~/*|~)
3628         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3629         ;;
3630  ~*)
3631         if $test -f /bin/csh; then
3632                 /bin/csh -f -c "glob \$1"
3633                 failed=\$?
3634                 echo ""
3635                 exit \$failed
3636         else
3637                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3638                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3639                 if $test ! -d "\$dir"; then
3640                         me=\`basename \$0\`
3641                         echo "\$me: can't locate home directory for: \$name" >&2
3642                         exit 1
3643                 fi
3644                 case "\$1" in
3645                 */*)
3646                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3647                         ;;
3648                 *)
3649                         echo \$dir
3650                         ;;
3651                 esac
3652         fi
3653         ;;
3654 *)
3655         echo \$1
3656         ;;
3657 esac
3658 EOSS
3659 chmod +x filexp
3660 $eunicefix filexp
3661
3662 : now set up to get a file name
3663 cat <<EOS >getfile
3664 $startsh
3665 EOS
3666 cat <<'EOSC' >>getfile
3667 tilde=''
3668 fullpath=''
3669 already=''
3670 skip=''
3671 none_ok=''
3672 exp_file=''
3673 nopath_ok=''
3674 orig_rp="$rp"
3675 orig_dflt="$dflt"
3676 case "$gfpth" in
3677 '') gfpth='.' ;;
3678 esac
3679
3680 case "$fn" in
3681 *\(*)
3682         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3683         fn=`echo $fn | sed 's/(.*)//'`
3684         ;;
3685 esac
3686
3687 case "$fn" in
3688 *:*)
3689         loc_file=`expr $fn : '.*:\(.*\)'`
3690         fn=`expr $fn : '\(.*\):.*'`
3691         ;;
3692 esac
3693
3694 case "$fn" in
3695 *~*) tilde=true;;
3696 esac
3697 case "$fn" in
3698 */*) fullpath=true;;
3699 esac
3700 case "$fn" in
3701 *+*) skip=true;;
3702 esac
3703 case "$fn" in
3704 *n*) none_ok=true;;
3705 esac
3706 case "$fn" in
3707 *e*) exp_file=true;;
3708 esac
3709 case "$fn" in
3710 *p*) nopath_ok=true;;
3711 esac
3712
3713 case "$fn" in
3714 *f*) type='File';;
3715 *d*) type='Directory';;
3716 *l*) type='Locate';;
3717 esac
3718
3719 what="$type"
3720 case "$what" in
3721 Locate) what='File';;
3722 esac
3723
3724 case "$exp_file" in
3725 '')
3726         case "$d_portable" in
3727         "$define") ;;
3728         *) exp_file=true;;
3729         esac
3730         ;;
3731 esac
3732
3733 cd ..
3734 while test "$type"; do
3735         redo=''
3736         rp="$orig_rp"
3737         dflt="$orig_dflt"
3738         case "$tilde" in
3739         true) rp="$rp (~name ok)";;
3740         esac
3741         . UU/myread
3742         if test -f UU/getfile.ok && \
3743                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3744         then
3745                 value="$ans"
3746                 ansexp="$ans"
3747                 break
3748         fi
3749         case "$ans" in
3750         none)
3751                 value=''
3752                 ansexp=''
3753                 case "$none_ok" in
3754                 true) type='';;
3755                 esac
3756                 ;;
3757         *)
3758                 case "$tilde" in
3759                 '') value="$ans"
3760                         ansexp="$ans";;
3761                 *)
3762                         value=`UU/filexp $ans`
3763                         case $? in
3764                         0)
3765                                 if test "$ans" != "$value"; then
3766                                         echo "(That expands to $value on this system.)"
3767                                 fi
3768                                 ;;
3769                         *) value="$ans";;
3770                         esac
3771                         ansexp="$value"
3772                         case "$exp_file" in
3773                         '') value="$ans";;
3774                         esac
3775                         ;;
3776                 esac
3777                 case "$fullpath" in
3778                 true)
3779                         case "$ansexp" in
3780                         /*) value="$ansexp" ;;
3781                         [a-zA-Z]:/*) value="$ansexp" ;;
3782                         *)
3783                                 redo=true
3784                                 case "$already" in
3785                                 true)
3786                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3787                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3788                                         ;;
3789                                 *)
3790                                 echo "Please give a full path name, starting with slash." >&4
3791                                         case "$tilde" in
3792                                         true)
3793                                 echo "Note that using ~name is ok provided it expands well." >&4
3794                                                 already=true
3795                                                 ;;
3796                                         esac
3797                                 esac
3798                                 ;;
3799                         esac
3800                         ;;
3801                 esac
3802                 case "$redo" in
3803                 '')
3804                         case "$type" in
3805                         File)
3806                                 for fp in $gfpth; do
3807                                         if test "X$fp" = X.; then
3808                                             pf="$ansexp"
3809                                         else    
3810                                             pf="$fp/$ansexp"
3811                                         fi
3812                                         if test -f "$pf"; then
3813                                                 type=''
3814                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3815                                         then
3816                                                 echo "($value is not a plain file, but that's ok.)"
3817                                                 type=''
3818                                         fi
3819                                         if test X"$type" = X; then
3820                                             value="$pf"
3821                                             break
3822                                         fi
3823                                 done
3824                                 ;;
3825                         Directory)
3826                                 for fp in $gfpth; do
3827                                         if test "X$fp" = X.; then
3828                                             dir="$ans"
3829                                             direxp="$ansexp"
3830                                         else    
3831                                             dir="$fp/$ansexp"
3832                                             direxp="$fp/$ansexp"
3833                                         fi
3834                                         if test -d "$direxp"; then
3835                                                 type=''
3836                                                 value="$dir"
3837                                                 break
3838                                         fi
3839                                 done
3840                                 ;;
3841                         Locate)
3842                                 if test -d "$ansexp"; then
3843                                         echo "(Looking for $loc_file in directory $value.)"
3844                                         value="$value/$loc_file"
3845                                         ansexp="$ansexp/$loc_file"
3846                                 fi
3847                                 if test -f "$ansexp"; then
3848                                         type=''
3849                                 fi
3850                                 case "$nopath_ok" in
3851                                 true)   case "$value" in
3852                                         */*) ;;
3853                                         *)      echo "Assuming $value will be in people's path."
3854                                                 type=''
3855                                                 ;;
3856                                         esac
3857                                         ;;
3858                                 esac
3859                                 ;;
3860                         esac
3861
3862                         case "$skip" in
3863                         true) type='';
3864                         esac
3865
3866                         case "$type" in
3867                         '') ;;
3868                         *)
3869                                 if test "$fastread" = yes; then
3870                                         dflt=y
3871                                 else
3872                                         dflt=n
3873                                 fi
3874                                 rp="$what $value doesn't exist.  Use that name anyway?"
3875                                 . UU/myread
3876                                 dflt=''
3877                                 case "$ans" in
3878                                 y*) type='';;
3879                                 *) echo " ";;
3880                                 esac
3881                                 ;;
3882                         esac
3883                         ;;
3884                 esac
3885                 ;;
3886         esac
3887 done
3888 cd UU
3889 ans="$value"
3890 rp="$orig_rp"
3891 dflt="$orig_dflt"
3892 rm -f getfile.ok
3893 test "X$gfpthkeep" != Xy && gfpth=""
3894 EOSC
3895
3896 : What should the include directory be ?
3897 echo " "
3898 $echo $n "Hmm...  $c"
3899 dflt='/usr/include'
3900 incpath=''
3901 mips_type=''
3902 if $test -f /bin/mips && /bin/mips; then
3903         echo "Looks like a MIPS system..."
3904         $cat >usr.c <<'EOCP'
3905 #ifdef SYSTYPE_BSD43
3906 /bsd43
3907 #endif
3908 EOCP
3909         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3910                 dflt='/bsd43/usr/include'
3911                 incpath='/bsd43'
3912                 mips_type='BSD 4.3'
3913         else
3914                 mips_type='System V'
3915         fi
3916         $rm -f usr.c usr.out
3917         echo "and you're compiling with the $mips_type compiler and libraries."
3918         xxx_prompt=y
3919         echo "exit 0" >mips
3920 else
3921         echo "Doesn't look like a MIPS system."
3922         xxx_prompt=n
3923         echo "exit 1" >mips
3924 fi
3925 chmod +x mips
3926 $eunicefix mips
3927 case "$usrinc" in
3928 '') ;;
3929 *) dflt="$usrinc";;
3930 esac
3931 case "$xxx_prompt" in
3932 y)      fn=d/
3933         echo " "
3934         rp='Where are the include files you want to use?'
3935         . ./getfile
3936         usrinc="$ans"
3937         ;;
3938 *)      usrinc="$dflt"
3939         ;;
3940 esac
3941
3942 : see how we invoke the C preprocessor
3943 echo " "
3944 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3945 cat <<'EOT' >testcpp.c
3946 #define ABC abc
3947 #define XYZ xyz
3948 ABC.XYZ
3949 EOT
3950 cd ..
3951 if test ! -f cppstdin; then
3952         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3953                 # AIX cc -E doesn't show the absolute headerfile
3954                 # locations but we'll cheat by using the -M flag.
3955                 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
3956         else
3957                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3958         fi
3959 else
3960         echo "Keeping your $hint cppstdin wrapper."
3961 fi
3962 chmod 755 cppstdin
3963 wrapper=`pwd`/cppstdin
3964 ok='false'
3965 cd UU
3966
3967 if $test "X$cppstdin" != "X" && \
3968         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3969         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3970 then
3971         echo "You used to use $cppstdin $cppminus so we'll use that again."
3972         case "$cpprun" in
3973         '') echo "But let's see if we can live without a wrapper..." ;;
3974         *)
3975                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3976                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3977                 then
3978                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3979                         ok='true'
3980                 else
3981                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3982                 fi
3983                 ;;
3984         esac
3985 else
3986         case "$cppstdin" in
3987         '') ;;
3988         *)
3989                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3990                 ;;
3991         esac
3992 fi
3993
3994 if $ok; then
3995         : nothing
3996 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3997         $cc -E <testcpp.c >testcpp.out 2>&1; \
3998         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3999         echo "Yup, it does."
4000         x_cpp="$cc -E"
4001         x_minus='';
4002 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4003         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4004         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4005         echo "Yup, it does."
4006         x_cpp="$cc -E"
4007         x_minus='-';
4008 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4009         $cc -P <testcpp.c >testcpp.out 2>&1; \
4010         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4011         echo "Yipee, that works!"
4012         x_cpp="$cc -P"
4013         x_minus='';
4014 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4015         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4016         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4017         echo "At long last!"
4018         x_cpp="$cc -P"
4019         x_minus='-';
4020 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4021         $cpp <testcpp.c >testcpp.out 2>&1; \
4022         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4023         echo "It works!"
4024         x_cpp="$cpp"
4025         x_minus='';
4026 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4027         $cpp - <testcpp.c >testcpp.out 2>&1; \
4028         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4029         echo "Hooray, it works!  I was beginning to wonder."
4030         x_cpp="$cpp"
4031         x_minus='-';
4032 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4033         $wrapper <testcpp.c >testcpp.out 2>&1; \
4034         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4035         x_cpp="$wrapper"
4036         x_minus=''
4037         echo "Eureka!"
4038 else
4039         dflt=''
4040         rp="No dice.  I can't find a C preprocessor.  Name one:"
4041         . ./myread
4042         x_cpp="$ans"
4043         x_minus=''
4044         $x_cpp <testcpp.c >testcpp.out 2>&1
4045         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4046                 echo "OK, that will do." >&4
4047         else
4048 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4049                 exit 1
4050         fi
4051 fi
4052
4053 case "$ok" in
4054 false)
4055         cppstdin="$x_cpp"
4056         cppminus="$x_minus"
4057         cpprun="$x_cpp"
4058         cpplast="$x_minus"
4059         set X $x_cpp
4060         shift
4061         case "$1" in
4062         "$cpp")
4063                 echo "Perhaps can we force $cc -E using a wrapper..."
4064                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4065                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4066                 then
4067                         echo "Yup, we can."
4068                         cppstdin="$wrapper"
4069                         cppminus='';
4070                 else
4071                         echo "Nope, we'll have to live without it..."
4072                 fi
4073                 ;;
4074         esac
4075         case "$cpprun" in
4076         "$wrapper")
4077                 cpprun=''
4078                 cpplast=''
4079                 ;;
4080         esac
4081         ;;
4082 esac
4083
4084 case "$cppstdin" in
4085 "$wrapper"|'cppstdin') ;;
4086 *) $rm -f $wrapper;;
4087 esac
4088 $rm -f testcpp.c testcpp.out
4089
4090 : Set private lib path
4091 case "$plibpth" in
4092 '') if ./mips; then
4093                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4094         fi;;
4095 esac
4096 case "$libpth" in
4097 ' ') dlist='';;
4098 '') dlist="$loclibpth $plibpth $glibpth";;
4099 *) dlist="$libpth";;
4100 esac
4101
4102 : Now check and see which directories actually exist, avoiding duplicates
4103 libpth=''
4104 for xxx in $dlist
4105 do
4106     if $test -d $xxx; then
4107                 case " $libpth " in
4108                 *" $xxx "*) ;;
4109                 *) libpth="$libpth $xxx";;
4110                 esac
4111     fi
4112 done
4113 $cat <<'EOM'
4114
4115 Some systems have incompatible or broken versions of libraries.  Among
4116 the directories listed in the question below, please remove any you
4117 know not to be holding relevant libraries, and add any that are needed.
4118 Say "none" for none.
4119
4120 EOM
4121 case "$libpth" in
4122 '') dflt='none';;
4123 *)
4124         set X $libpth
4125         shift
4126         dflt=${1+"$@"}
4127         ;;
4128 esac
4129 rp="Directories to use for library searches?"
4130 . ./myread
4131 case "$ans" in
4132 none) libpth=' ';;
4133 *) libpth="$ans";;
4134 esac
4135
4136 : compute shared library extension
4137 case "$so" in
4138 '')
4139         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4140                 dflt='sl'
4141         else
4142                 dflt='so'
4143         fi
4144         ;;
4145 *) dflt="$so";;
4146 esac
4147 $cat <<EOM
4148
4149 On some systems, shared libraries may be available.  Answer 'none' if
4150 you want to suppress searching of shared libraries for the remainder
4151 of this configuration.
4152
4153 EOM
4154 rp='What is the file extension used for shared libraries?'
4155 . ./myread
4156 so="$ans"
4157
4158 : Define several unixisms.
4159 : Hints files or command line option can be used to override them.
4160 : The convoluted testing is in case hints files set either the old
4161 : or the new name.
4162 case "$_exe" in
4163 '')     case "$exe_ext" in
4164         '')     ;;
4165         *)      _exe="$exe_ext" ;;
4166         esac
4167         ;;
4168 esac
4169 case "$_a" in
4170 '')     case "$lib_ext" in
4171     '') _a='.a';;
4172         *)      _a="$lib_ext" ;;
4173         esac
4174         ;;
4175 esac
4176 case "$_o" in
4177 '') case "$obj_ext" in
4178         '')     _o='.o';;
4179         *)      _o="$obj_ext";;
4180         esac
4181         ;;
4182 esac
4183 case "$p_" in
4184 '') case "$path_sep" in
4185         '')     p_=':';;
4186         *)      p_="$path_sep";;
4187         esac
4188         ;;
4189 esac
4190 exe_ext=$_exe
4191 lib_ext=$_a
4192 obj_ext=$_o
4193 path_sep=$p_
4194
4195 : Which makefile gets called first.  This is used by make depend.
4196 case "$firstmakefile" in
4197 '') firstmakefile='makefile';;
4198 esac
4199
4200 case "$usesocks" in
4201 $define|true|[yY]*)     dflt='y';;
4202 *) dflt='n';;
4203 esac
4204 cat <<EOM
4205
4206 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4207 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4208 to use the PerlIO abstraction layer, this will be implicitly selected.
4209
4210 If this doesn't make any sense to you, just accept the default '$dflt'.
4211 EOM
4212 rp='Build Perl for SOCKS?'
4213 . ./myread
4214 case "$ans" in
4215 y|Y)    val="$define" ;;     
4216 *)      val="$undef" ;;
4217 esac
4218 set usesocks
4219 eval $setvar
4220
4221 case "$usesocks" in
4222 $define|true|[yY]*) useperlio="$define";;
4223 esac
4224
4225 : Looking for optional libraries
4226 echo " "
4227 echo "Checking for optional libraries..." >&4
4228 case "$libs" in
4229 ' '|'') dflt='';;
4230 *) dflt="$libs";;
4231 esac
4232 case "$libswanted" in
4233 '') libswanted='c_s';;
4234 esac
4235 case "$usesocks" in
4236 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4237 esac
4238 libsfound=''
4239 libsfiles=''
4240 libsdirs=''
4241 libspath=''
4242 for thisdir in $libpth $xlibpth; do
4243   test -d $thisdir && libspath="$libspath $thisdir"
4244 done
4245 for thislib in $libswanted; do
4246         for thisdir in $libspath; do
4247             xxx=''
4248             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4249                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4250                 $test -f "$xxx" && eval $libscheck
4251                 $test -f "$xxx" && libstyle=shared
4252             fi
4253             if test ! -f "$xxx"; then
4254                 xxx=$thisdir/lib$thislib.$so
4255                 $test -f "$xxx" && eval $libscheck
4256                 $test -f "$xxx" && libstyle=shared
4257             fi  
4258             if test ! -f "$xxx"; then
4259                 xxx=$thisdir/lib$thislib$_a
4260                 $test -f "$xxx" && eval $libscheck
4261                 $test -f "$xxx" && libstyle=static
4262             fi
4263             if test ! -f "$xxx"; then
4264                 xxx=$thisdir/$thislib$_a
4265                 $test -f "$xxx" && eval $libscheck
4266                 $test -f "$xxx" && libstyle=static
4267             fi
4268             if test ! -f "$xxx"; then
4269                 xxx=$thisdir/lib${thislib}_s$_a
4270                 $test -f "$xxx" && eval $libscheck
4271                 $test -f "$xxx" && libstyle=static
4272                 $test -f "$xxx" && thislib=${thislib}_s
4273             fi
4274             if test ! -f "$xxx"; then
4275                 xxx=$thisdir/Slib$thislib$_a
4276                 $test -f "$xxx" && eval $libscheck
4277                 $test -f "$xxx" && libstyle=static
4278             fi
4279             if $test -f "$xxx"; then
4280                 case "$libstyle" in
4281                 shared) echo "Found -l$thislib (shared)." ;;
4282                 static) echo "Found -l$thislib." ;;
4283                 *)      echo "Found -l$thislib ($libstyle)." ;;
4284                 esac
4285                 case " $dflt " in
4286                 *"-l$thislib "*);;
4287                 *) dflt="$dflt -l$thislib"
4288                    libsfound="$libsfound $xxx"
4289                    yyy=`basename $xxx`
4290                    libsfiles="$libsfiles $yyy"
4291                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4292                    case " $libsdirs " in
4293                    *" $yyy "*) ;;
4294                    *) libsdirs="$libsdirs $yyy" ;;
4295                    esac
4296                    ;;
4297                 esac
4298                 break
4299             fi  
4300         done
4301         if $test ! -f "$xxx"; then
4302             echo "No -l$thislib."
4303         fi
4304 done
4305 set X $dflt
4306 shift
4307 dflt="$*"
4308 case "$libs" in
4309 '') dflt="$dflt";;
4310 *) dflt="$libs";;
4311 esac
4312 case "$dflt" in
4313 ' '|'') dflt='none';;
4314 esac
4315
4316 $cat <<EOM
4317
4318 In order to compile $package on your machine, a number of libraries
4319 are usually needed.  Include any other special libraries here as well.
4320 Say "none" for none.  The default list is almost always right.
4321 EOM
4322
4323 echo " "
4324 rp="What libraries to use?"
4325 . ./myread
4326 case "$ans" in
4327 none) libs=' ';;
4328 *) libs="$ans";;
4329 esac
4330
4331 : determine optimization, if desired, or use for debug flag also
4332 case "$optimize" in
4333 ' '|$undef) dflt='none';;
4334 '') dflt='-O';;
4335 *) dflt="$optimize";;
4336 esac
4337 $cat <<EOH
4338
4339 By default, $package compiles with the -O flag to use the optimizer.
4340 Alternately, you might want to use the symbolic debugger, which uses
4341 the -g flag (on traditional Unix systems).  Either flag can be
4342 specified here.  To use neither flag, specify the word "none".
4343
4344 EOH
4345 rp="What optimizer/debugger flag should be used?"
4346 . ./myread
4347 optimize="$ans"
4348 case "$optimize" in
4349 'none') optimize=" ";;
4350 esac
4351
4352 dflt=''
4353 : We will not override a previous value, but we might want to
4354 : augment a hint file
4355 case "$hint" in
4356 default|recommended)
4357         case "$gccversion" in
4358         1*) dflt='-fpcc-struct-return' ;;
4359         esac
4360         case "$optimize" in
4361         *-g*) dflt="$dflt -DDEBUGGING";;
4362         esac
4363         case "$gccversion" in
4364         2*) if test -d /etc/conf/kconfig.d &&
4365                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4366                 then
4367                         dflt="$dflt -posix"
4368                 fi
4369                 ;;
4370         esac
4371         case "$gccversion" in
4372         1*) ;;
4373         2.[0-8]*) ;;
4374         ?*)     echo " "
4375                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4376                 echo 'int main(void) { return 0; }' > gcctest.c
4377                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4378                         echo "Yes, it does." 2>&1
4379                         case "$ccflags" in
4380                         *strict-aliasing*) 
4381                                 echo "Leaving current flags $ccflags alone." 2>&1
4382                                 ;;
4383                         *) dflt="$dflt -fno-strict-aliasing" ;;
4384                         esac
4385                 else
4386                         echo "Nope, it doesn't, but that's ok." 2>&1
4387                 fi
4388                 ;;
4389         esac
4390         ;;
4391 esac
4392
4393 case "$mips_type" in
4394 *BSD*|'') inclwanted="$locincpth $usrinc";;
4395 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4396 esac
4397 for thisincl in $inclwanted; do
4398         if $test -d $thisincl; then
4399                 if $test x$thisincl != x$usrinc; then
4400                         case "$dflt" in
4401                         *" -I$thisincl "*);;
4402                         *) dflt="$dflt -I$thisincl ";;
4403                         esac
4404                 fi
4405         fi
4406 done
4407
4408 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4409         xxx=true;
4410 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4411         xxx=true;
4412 else
4413         xxx=false;
4414 fi;
4415 if $xxx; then
4416         case "$dflt" in
4417         *$2*);;
4418         *) dflt="$dflt -D$2";;
4419         esac;
4420 fi'
4421
4422 set signal.h LANGUAGE_C; eval $inctest
4423
4424 case "$usesocks" in
4425 $define)
4426         ccflags="$ccflags -DSOCKS"
4427         ;;
4428 esac
4429
4430 case "$hint" in
4431 default|recommended) dflt="$ccflags $dflt" ;;
4432 *) dflt="$ccflags";;
4433 esac
4434
4435 case "$dflt" in
4436 ''|' ') dflt=none;;
4437 esac
4438
4439 $cat <<EOH
4440
4441 Your C compiler may want other flags.  For this question you should include
4442 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4443 but you should NOT include libraries or ld flags like -lwhatever.  If you
4444 want $package to honor its debug switch, you should include -DDEBUGGING here.
4445 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4446
4447 To use no flags, specify the word "none".
4448
4449 EOH
4450 set X $dflt
4451 shift
4452 dflt=${1+"$@"}
4453 rp="Any additional cc flags?"
4454 . ./myread
4455 case "$ans" in
4456 none) ccflags='';;
4457 *) ccflags="$ans";;
4458 esac
4459
4460 : the following weeds options from ccflags that are of no interest to cpp
4461 case "$cppflags" in
4462 '') cppflags="$ccflags" ;;
4463 *)  cppflags="$cppflags $ccflags" ;;
4464 esac
4465 case "$gccversion" in
4466 1*) cppflags="$cppflags -D__GNUC__"
4467 esac
4468 case "$mips_type" in
4469 '');;
4470 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4471 esac
4472 case "$cppflags" in
4473 '');;
4474 *)
4475         echo " "
4476         echo "Let me guess what the preprocessor flags are..." >&4
4477         set X $cppflags
4478         shift
4479         cppflags=''
4480         $cat >cpp.c <<'EOM'
4481 #define BLURFL foo
4482
4483 BLURFL xx LFRULB
4484 EOM
4485         previous=''
4486         for flag in $*
4487         do
4488                 case "$flag" in
4489                 -*) ftry="$flag";;
4490                 *) ftry="$previous $flag";;
4491                 esac
4492                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4493                         >cpp1.out 2>/dev/null && \
4494                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4495                         >cpp2.out 2>/dev/null && \
4496                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4497                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4498                 then
4499                         cppflags="$cppflags $ftry"
4500                         previous=''
4501                 else
4502                         previous="$flag"
4503                 fi
4504         done
4505         set X $cppflags
4506         shift
4507         cppflags=${1+"$@"}
4508         case "$cppflags" in
4509         *-*)  echo "They appear to be: $cppflags";;
4510         esac
4511         $rm -f cpp.c cpp?.out
4512         ;;
4513 esac
4514
4515 : flags used in final linking phase
4516 case "$ldflags" in
4517 '') if ./venix; then
4518                 dflt='-i -z'
4519         else
4520                 dflt=''
4521         fi
4522         case "$ccflags" in
4523         *-posix*) dflt="$dflt -posix" ;;
4524         esac
4525         ;;
4526 *) dflt="$ldflags";;
4527 esac
4528
4529 : Try to guess additional flags to pick up local libraries.
4530 for thislibdir in $libpth; do
4531         case " $loclibpth " in
4532         *" $thislibdir "*)
4533                 case "$dflt " in 
4534                 *"-L$thislibdir "*) ;;
4535                 *)  dflt="$dflt -L$thislibdir" ;;
4536                 esac
4537                 ;;
4538         esac
4539 done
4540
4541 case "$dflt" in
4542 '') dflt='none' ;;
4543 esac
4544
4545 $cat <<EOH
4546
4547 Your C linker may need flags.  For this question you should
4548 include -L/whatever and any other flags used by the C linker, but you
4549 should NOT include libraries like -lwhatever.
4550
4551 Make sure you include the appropriate -L/path flags if your C linker
4552 does not normally search all of the directories you specified above,
4553 namely
4554         $libpth
4555 To use no flags, specify the word "none".
4556
4557 EOH
4558
4559 rp="Any additional ld flags (NOT including libraries)?"
4560 . ./myread
4561 case "$ans" in
4562 none) ldflags='';;
4563 *) ldflags="$ans";;
4564 esac
4565 rmlist="$rmlist pdp11"
4566
4567 : coherency check
4568 echo " "
4569 echo "Checking your choice of C compiler and flags for coherency..." >&4
4570 $cat > try.c <<'EOF'
4571 #include <stdio.h>
4572 int main() { printf("Ok\n"); exit(0); }
4573 EOF
4574 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4575 shift
4576 $cat >try.msg <<'EOM'
4577 I've tried to compile and run the following simple program:
4578
4579 EOM
4580 $cat try.c >> try.msg
4581
4582 $cat >> try.msg <<EOM
4583
4584 I used the command:
4585
4586         $*
4587         $run ./try
4588
4589 and I got the following output:
4590
4591 EOM
4592 dflt=y
4593 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4594         if $sh -c "$run ./try" >>try.msg 2>&1; then
4595                 xxx=`$run ./try`
4596                 case "$xxx" in
4597                 "Ok") dflt=n ;;
4598                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4599                         case " $libs " in
4600                         *" -lsfio "*)
4601                                 cat >> try.msg <<'EOQS'
4602 If $libs contains -lsfio, and sfio is mis-configured, then it
4603 sometimes (apparently) runs and exits with a 0 status, but with no
4604 output!  It may have to do with sfio's use of _exit vs. exit.
4605
4606 EOQS
4607                                 rp="You have a big problem.  Shall I abort Configure"
4608                                 dflt=y
4609                                 ;;
4610                         esac
4611                         ;;
4612                 esac
4613         else
4614                 echo "The program compiled OK, but exited with status $?." >>try.msg
4615                 rp="You have a problem.  Shall I abort Configure"
4616                 dflt=y
4617         fi
4618 else
4619         echo "I can't compile the test program." >>try.msg
4620         rp="You have a BIG problem.  Shall I abort Configure"
4621         dflt=y
4622 fi
4623 case "$dflt" in
4624 y)
4625         $cat try.msg >&4
4626         case "$knowitall" in
4627         '')
4628                 echo "(The supplied flags or libraries might be incorrect.)"
4629                 ;;
4630         *) dflt=n;;
4631         esac
4632         echo " "
4633         . ./myread
4634         case "$ans" in
4635         n*|N*) ;;
4636         *)      echo "Ok.  Stopping Configure." >&4
4637                 exit 1
4638                 ;;
4639         esac
4640         ;;
4641 n) echo "OK, that should do.";;
4642 esac
4643 $rm -f try try.* core
4644
4645 : define a shorthand compile call
4646 compile='
4647 mc_file=$1;
4648 shift;
4649 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4650 : define a shorthand compile call for compilations that should be ok.
4651 compile_ok='
4652 mc_file=$1;
4653 shift;
4654 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4655
4656 : check for lengths of integral types
4657 echo " "
4658 case "$intsize" in
4659 '')
4660         echo "Checking to see how big your integers are..." >&4
4661         $cat >try.c <<'EOCP'
4662 #include <stdio.h>
4663 int main()
4664 {
4665         printf("intsize=%d;\n", (int)sizeof(int));
4666         printf("longsize=%d;\n", (int)sizeof(long));
4667         printf("shortsize=%d;\n", (int)sizeof(short));
4668         exit(0);
4669 }
4670 EOCP
4671         set try
4672         if eval $compile_ok && $run ./try > /dev/null; then
4673                 eval `$run ./try`
4674                 echo "Your integers are $intsize bytes long."
4675                 echo "Your long integers are $longsize bytes long."
4676                 echo "Your short integers are $shortsize bytes long."
4677         else
4678                 $cat >&4 <<EOM
4679 !
4680 Help! I can't compile and run the intsize test program: please enlighten me!
4681 (This is probably a misconfiguration in your system or libraries, and
4682 you really ought to fix it.  Still, I'll try anyway.)
4683 !
4684 EOM
4685                 dflt=4
4686                 rp="What is the size of an integer (in bytes)?"
4687                 . ./myread
4688                 intsize="$ans"
4689                 dflt=$intsize
4690                 rp="What is the size of a long integer (in bytes)?"
4691                 . ./myread
4692                 longsize="$ans"
4693                 dflt=2
4694                 rp="What is the size of a short integer (in bytes)?"
4695                 . ./myread
4696                 shortsize="$ans"
4697         fi
4698         ;;
4699 esac
4700 $rm -f try try.*
4701
4702 : check for void type
4703 echo " "
4704 echo "Checking to see how well your C compiler groks the void type..." >&4
4705 case "$voidflags" in
4706 '')
4707         $cat >try.c <<'EOCP'
4708 #if TRY & 1
4709 void sub() {
4710 #else
4711 sub() {
4712 #endif
4713         extern void moo();      /* function returning void */
4714         void (*goo)();          /* ptr to func returning void */
4715 #if TRY & 8
4716         void *hue;              /* generic ptr */
4717 #endif
4718 #if TRY & 2
4719         void (*foo[10])();
4720 #endif
4721
4722 #if TRY & 4
4723         if(goo == moo) {
4724                 exit(0);
4725         }
4726 #endif
4727         exit(0);
4728 }
4729 int main() { sub(); }
4730 EOCP
4731         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4732                 voidflags=$defvoidused
4733         echo "Good.  It appears to support void to the level $package wants.">&4
4734                 if $contains warning .out >/dev/null 2>&1; then
4735                         echo "However, you might get some warnings that look like this:"
4736                         $cat .out
4737                 fi
4738         else
4739 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4740                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4741                         echo "It supports 1..."
4742                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4743                                 echo "It also supports 2..."
4744                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4745                                         voidflags=7
4746                                         echo "And it supports 4 but not 8 definitely."
4747                                 else
4748                                         echo "It doesn't support 4..."
4749                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4750                                                 voidflags=11
4751                                                 echo "But it supports 8."
4752                                         else
4753                                                 voidflags=3
4754                                                 echo "Neither does it support 8."
4755                                         fi
4756                                 fi
4757                         else
4758                                 echo "It does not support 2..."
4759                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4760                                         voidflags=13
4761                                         echo "But it supports 4 and 8."
4762                                 else
4763                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4764                                                 voidflags=5
4765                                                 echo "And it supports 4 but has not heard about 8."
4766                                         else
4767                                                 echo "However it supports 8 but not 4."
4768                                         fi
4769                                 fi
4770                         fi
4771                 else
4772                         echo "There is no support at all for void."
4773                         voidflags=0
4774                 fi
4775         fi
4776 esac
4777 case "$voidflags" in
4778 "$defvoidused") ;;
4779 *)      $cat >&4 <<'EOM'
4780   Support flag bits are:
4781     1: basic void declarations.
4782     2: arrays of pointers to functions returning void.
4783     4: operations between pointers to and addresses of void functions.
4784     8: generic void pointers.
4785 EOM
4786         dflt="$voidflags";
4787         rp="Your void support flags add up to what?"
4788         . ./myread
4789         voidflags="$ans"
4790         ;;
4791 esac
4792 $rm -f try.* .out
4793
4794 : check for length of pointer
4795 echo " "
4796 case "$ptrsize" in
4797 '')
4798         echo "Checking to see how big your pointers are..." >&4
4799         if test "$voidflags" -gt 7; then
4800                 echo '#define VOID_PTR char *' > try.c
4801         else
4802                 echo '#define VOID_PTR void *' > try.c
4803         fi
4804         $cat >>try.c <<'EOCP'
4805 #include <stdio.h>
4806 int main()
4807 {
4808     printf("%d\n", (int)sizeof(VOID_PTR));
4809     exit(0);
4810 }
4811 EOCP
4812         set try
4813         if eval $compile_ok; then
4814                 ptrsize=`$run ./try`
4815                 echo "Your pointers are $ptrsize bytes long."
4816         else
4817                 dflt='4'
4818                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4819                 rp="What is the size of a pointer (in bytes)?"
4820                 . ./myread
4821                 ptrsize="$ans"
4822         fi
4823         ;;
4824 esac
4825 $rm -f try.c try
4826
4827 : check for long long
4828 echo " "
4829 echo "Checking to see if you have long long..." >&4
4830 echo 'int main() { long long x = 7; return 0; }' > try.c
4831 set try
4832 if eval $compile; then
4833         val="$define"
4834         echo "You have long long."
4835 else
4836         val="$undef"
4837         echo "You do not have long long."
4838 fi
4839 $rm try.*
4840 set d_longlong
4841 eval $setvar
4842
4843 : check for length of long long
4844 case "${d_longlong}${longlongsize}" in
4845 $define)
4846         echo " "
4847         echo "Checking to see how big your long longs are..." >&4
4848         $cat >try.c <<'EOCP'
4849 #include <stdio.h>
4850 int main()
4851 {
4852     printf("%d\n", (int)sizeof(long long));
4853     return(0);
4854 }
4855 EOCP
4856         set try
4857         if eval $compile_ok; then
4858                 longlongsize=`$run ./try`
4859                 echo "Your long longs are $longlongsize bytes long."
4860         else
4861                 dflt='8'
4862                 echo " "
4863                 echo "(I can't seem to compile the test program.  Guessing...)"
4864                 rp="What is the size of a long long (in bytes)?"
4865                 . ./myread
4866                 longlongsize="$ans"
4867         fi
4868         if $test "X$longsize" = "X$longlongsize"; then
4869                 echo "(That isn't any different from an ordinary long.)"
4870         fi      
4871         ;;
4872 esac
4873 $rm -f try.* try
4874
4875 : determine filename position in cpp output
4876 echo " "
4877 echo "Computing filename position in cpp output for #include directives..." >&4
4878 case "$osname" in
4879 vos) testaccess=-e ;;
4880 *)   testaccess=-r ;;
4881 esac
4882 echo '#include <stdio.h>' > foo.c
4883 $cat >fieldn <<EOF
4884 $startsh
4885 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4886 $grep '^[       ]*#.*stdio\.h' | \
4887 while read cline; do
4888         pos=1
4889         set \$cline
4890         while $test \$# -gt 0; do
4891                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4892                         echo "\$pos"
4893                         exit 0
4894                 fi
4895                 shift
4896                 pos=\`expr \$pos + 1\`
4897         done
4898 done
4899 EOF
4900 chmod +x fieldn
4901 fieldn=`./fieldn`
4902 $rm -f foo.c fieldn
4903 case $fieldn in
4904 '') pos='???';;
4905 1) pos=first;;
4906 2) pos=second;;
4907 3) pos=third;;
4908 *) pos="${fieldn}th";;
4909 esac
4910 echo "Your cpp writes the filename in the $pos field of the line."
4911
4912 case "$osname" in
4913 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4914 *)   cppfilter='' ;;
4915 esac
4916 : locate header file
4917 $cat >findhdr <<EOF
4918 $startsh
4919 wanted=\$1
4920 name=''
4921 for usrincdir in $usrinc
4922 do
4923         if test -f \$usrincdir/\$wanted; then
4924                 echo "\$usrincdir/\$wanted"
4925                 exit 0
4926         fi
4927 done
4928 awkprg='{ print \$$fieldn }'
4929 echo "#include <\$wanted>" > foo\$\$.c
4930 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4931 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4932 while read cline; do
4933         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4934         case "\$name" in
4935         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4936         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4937         *) exit 2;;
4938         esac;
4939 done;
4940 #
4941 # status = 0: grep returned 0 lines, case statement not executed
4942 # status = 1: headerfile found
4943 # status = 2: while loop executed, no headerfile found
4944 #
4945 status=\$?
4946 $rm -f foo\$\$.c;
4947 if test \$status -eq 1; then
4948         exit 0;
4949 fi
4950 exit 1
4951 EOF
4952 chmod +x findhdr
4953
4954 : define an alternate in-header-list? function
4955 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4956 cont=true; xxf="echo \"<\$1> found.\" >&4";
4957 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4958 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4959 esac;
4960 case $# in 4) instead=instead;; *) instead="at last";; esac;
4961 while $test "$cont"; do
4962         xxx=`./findhdr $1`
4963         var=$2; eval "was=\$$2";
4964         if $test "$xxx" && $test -r "$xxx";
4965         then eval $xxf;
4966         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4967                 cont="";
4968         else eval $xxnf;
4969         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4970         set $yyy; shift; shift; yyy=$@;
4971         case $# in 0) cont="";;
4972         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4973                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4974         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4975                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4976         esac;
4977 done;
4978 while $test "$yyy";
4979 do set $yyy; var=$2; eval "was=\$$2";
4980         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4981         set $yyy; shift; shift; yyy=$@;
4982 done'
4983
4984 : see if inttypes.h is available
4985 : we want a real compile instead of Inhdr because some systems
4986 : have an inttypes.h which includes non-existent headers
4987 echo " "
4988 $cat >try.c <<EOCP
4989 #include <inttypes.h>
4990 int main() {
4991         static int32_t foo32 = 0x12345678;
4992 }
4993 EOCP
4994 set try
4995 if eval $compile; then
4996         echo "<inttypes.h> found." >&4
4997         val="$define"
4998 else
4999         echo "<inttypes.h> NOT found." >&4
5000         val="$undef"
5001 fi
5002 $rm -f try.c try
5003 set i_inttypes
5004 eval $setvar
5005
5006 : check for int64_t
5007 echo " "
5008 echo "Checking to see if you have int64_t..." >&4
5009 $cat >try.c <<EOCP
5010 #include <sys/types.h>
5011 #$i_inttypes I_INTTYPES
5012 #ifdef I_INTTYPES
5013 #include <inttypes.h>
5014 #endif
5015 int main() { int64_t x = 7; }
5016 EOCP
5017 set try
5018 if eval $compile; then
5019         val="$define"
5020         echo "You have int64_t."
5021 else
5022         val="$undef"
5023         echo "You do not have int64_t."
5024 fi
5025 $rm -f try try.*
5026 set d_int64_t
5027 eval $setvar
5028
5029
5030 echo " "
5031 echo "Checking which 64-bit integer type we could use..." >&4
5032
5033 case "$intsize" in
5034 8) val=int
5035    set quadtype
5036    eval $setvar
5037    val='"unsigned int"'
5038    set uquadtype
5039    eval $setvar
5040    quadkind=1
5041    ;;
5042 *) case "$longsize" in
5043    8) val=long
5044       set quadtype
5045       eval $setvar
5046       val='"unsigned long"'
5047       set uquadtype
5048       eval $setvar
5049       quadkind=2
5050       ;;
5051    *) case "$d_longlong:$longlongsize" in
5052       define:8)
5053         val='"long long"'
5054         set quadtype
5055         eval $setvar
5056         val='"unsigned long long"'
5057         set uquadtype
5058         eval $setvar
5059         quadkind=3
5060         ;;
5061       *) case "$d_int64_t" in
5062          define)
5063            val=int64_t
5064            set quadtype
5065            eval $setvar
5066            val=uint64_t
5067            set uquadtype
5068            eval $setvar
5069            quadkind=4
5070            ;;
5071          esac
5072          ;;
5073       esac
5074       ;;
5075    esac
5076    ;;
5077 esac
5078
5079 case "$quadtype" in
5080 '')     echo "Alas, no 64-bit integer types in sight." >&4
5081         d_quad="$undef"
5082         ;;
5083 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5084         d_quad="$define"
5085         ;;
5086 esac
5087
5088
5089 case "$uselonglong" in
5090 "$define"|true|[yY]*)
5091         cat <<EOM >&4
5092
5093 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5094 EOM
5095         use64bitint="$define"
5096         ;;
5097 esac                          
5098 case "$use64bits" in
5099 "$define"|true|[yY]*)
5100         cat <<EOM >&4
5101
5102 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5103 EOM
5104         use64bitint="$define"
5105         ;;
5106 esac                          
5107 case "$use64bitints" in
5108 "$define"|true|[yY]*)
5109         cat <<EOM >&4
5110
5111 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5112 EOM
5113         use64bitint="$define"
5114         ;;
5115 esac                          
5116 case "$use64bitsint" in
5117 "$define"|true|[yY]*)
5118         cat <<EOM >&4
5119
5120 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5121 EOM
5122         use64bitint="$define"
5123         ;;
5124 esac                          
5125 case "$uselonglongs" in
5126 "$define"|true|[yY]*)
5127         cat <<EOM >&4
5128
5129 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5130 EOM
5131         use64bitint="$define"
5132         ;;
5133 esac                          
5134 case "$use64bitsall" in
5135 "$define"|true|[yY]*)
5136         cat <<EOM >&4
5137
5138 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5139 EOM
5140         use64bitall="$define"
5141         ;;
5142 esac                          
5143
5144 case "$ccflags" in
5145 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5146 esac
5147 case "$use64bitall" in
5148 "$define"|true|[yY]*) use64bitint="$define" ;;
5149 esac
5150
5151 case "$longsize" in
5152 8) cat <<EOM
5153
5154 You have natively 64-bit long integers.
5155 EOM
5156    val="$define"
5157    ;;
5158 *) case "$use64bitint" in
5159    "$define"|true|[yY]*) dflt='y';;
5160    *) dflt='n';;
5161    esac
5162    case "$d_quad" in
5163    "$define") ;;
5164    *) dflt='n' ;;
5165    esac
5166    cat <<EOM
5167
5168 Perl can be built to take advantage of 64-bit integer types
5169 on some systems.  To do so, Configure can be run with -Duse64bitint.
5170 Choosing this option will most probably introduce binary incompatibilities.
5171
5172 If this doesn't make any sense to you, just accept the default '$dflt'.
5173 (The default has been chosen based on your configuration.)
5174 EOM
5175    rp='Try to use 64-bit integers, if available?'
5176    . ./myread
5177    case "$ans" in
5178    [yY]*) val="$define" ;;
5179    *)     val="$undef"  ;;
5180    esac
5181    ;;
5182 esac
5183 set use64bitint
5184 eval $setvar
5185
5186 case "$use64bitall" in
5187 "$define"|true|[yY]*) dflt='y' ;;
5188 *) case "$longsize" in
5189    8) dflt='y' ;;
5190    *) dflt='n' ;;
5191    esac
5192    ;;
5193 esac    
5194 cat <<EOM
5195
5196 You may also choose to try maximal 64-bitness.  It means using as much
5197 64-bitness as possible on the platform.  This in turn means even more
5198 binary incompatibilities.  On the other hand, your platform may not
5199 have any more 64-bitness available than what you already have chosen.
5200
5201 If this doesn't make any sense to you, just accept the default '$dflt'.
5202 (The default has been chosen based on your configuration.)
5203 EOM
5204 rp='Try to use maximal 64-bit support, if available?'
5205 . ./myread
5206 case "$ans" in
5207 [yY]*) val="$define" ;;
5208 *)     val="$undef"  ;;
5209 esac
5210 set use64bitall
5211 eval $setvar
5212 case "$use64bitall" in
5213 "$define")
5214         case "$use64bitint" in
5215         "$undef")
5216                 cat <<EOM
5217
5218 Since you have chosen a maximally 64-bit build, I'm also turning on
5219 the use of 64-bit integers.
5220 EOM
5221                 use64bitint="$define" ;;
5222         esac
5223         ;;
5224 esac
5225
5226 case "$use64bitall" in
5227 "$define"|true|[yY]*)
5228         case "$ptrsize" in
5229         4)      cat <<EOM >&4
5230
5231 *** You have chosen a maximally 64-bit build, but your pointers
5232 *** are only 4 bytes wide, disabling maximal 64-bitness.
5233
5234 EOM
5235                 use64bitall="$undef"
5236                 case "$use64bitint" in
5237                 "$define"|true|[yY]*) ;;
5238                 *)      cat <<EOM >&4
5239
5240 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5241
5242 EOM
5243                         use64bitint="$define"
5244                         ;;
5245                 esac
5246                 ;;
5247         esac
5248         ;;
5249 esac
5250
5251 case "$use64bitint" in
5252 "$define"|true|[yY]*)
5253 : Look for a hint-file generated 'call-back-unit'.  If the
5254 : user has specified that a 64-bit perl is to be built,
5255 : we may need to set or change some other defaults.
5256         if $test -f use64bitint.cbu; then
5257                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5258                 . ./use64bitint.cbu
5259         fi
5260         case "$longsize" in
5261         4) case "$archname64" in
5262            '') archname64=64int ;;
5263            esac
5264            ;;
5265         esac
5266         ;;
5267 esac
5268
5269 case "$use64bitall" in
5270 "$define"|true|[yY]*)
5271 : Look for a hint-file generated 'call-back-unit'.  If the
5272 : user has specified that a maximally 64-bit perl is to be built,
5273 : we may need to set or change some other defaults.
5274         if $test -f use64bitall.cbu; then
5275                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5276                 . ./use64bitall.cbu
5277         fi
5278         case "$longsize" in
5279         4) case "$archname64" in
5280            ''|64int) archname64=64all ;;
5281            esac
5282            ;;
5283         esac
5284         ;;
5285 esac
5286
5287 echo " "
5288 echo "Checking for GNU C Library..." >&4
5289 cat >try.c <<EOM
5290 #include <stdio.h>
5291 int main()
5292 {
5293 #ifdef __GLIBC__
5294     exit(0);
5295 #else
5296     exit(1);
5297 #endif
5298 }
5299 EOM
5300 set try
5301 if eval $compile_ok && $run ./try; then
5302         val="$define"
5303         echo "You are using the GNU C Library"
5304 else
5305         val="$undef"
5306         echo "You are not using the GNU C Library"
5307 fi
5308 $rm -f try try.*
5309 set d_gnulibc
5310 eval $setvar
5311
5312 : see if nm is to be used to determine whether a symbol is defined or not
5313 case "$usenm" in
5314 '')
5315         dflt=''
5316         case "$d_gnulibc" in
5317         "$define")
5318                 echo " "
5319                 echo "nm probably won't work on the GNU C Library." >&4
5320                 dflt=n
5321                 ;;
5322         esac
5323         case "$dflt" in
5324         '') 
5325                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5326                         echo " "
5327                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5328                         echo "'nm' won't be sufficient on this sytem." >&4
5329                         dflt=n
5330                 fi
5331                 ;;
5332         esac
5333         case "$dflt" in
5334         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5335                 if $test $dflt -gt 20; then
5336                         dflt=y
5337                 else
5338                         dflt=n
5339                 fi
5340                 ;;
5341         esac
5342         ;;
5343 *)
5344         case "$usenm" in
5345         true|$define) dflt=y;;
5346         *) dflt=n;;
5347         esac
5348         ;;
5349 esac
5350 $cat <<EOM
5351
5352 I can use $nm to extract the symbols from your C libraries. This
5353 is a time consuming task which may generate huge output on the disk (up
5354 to 3 megabytes) but that should make the symbols extraction faster. The
5355 alternative is to skip the 'nm' extraction part and to compile a small
5356 test program instead to determine whether each symbol is present. If
5357 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5358 this may be the best solution.
5359
5360 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5361
5362 EOM
5363 rp="Shall I use $nm to extract C symbols from the libraries?"
5364 . ./myread
5365 case "$ans" in
5366 [Nn]*) usenm=false;;
5367 *) usenm=true;;
5368 esac
5369
5370 runnm=$usenm
5371 case "$reuseval" in
5372 true) runnm=false;;
5373 esac
5374
5375 : nm options which may be necessary
5376 case "$nm_opt" in
5377 '') if $test -f /mach_boot; then
5378                 nm_opt=''       # Mach
5379         elif $test -d /usr/ccs/lib; then
5380                 nm_opt='-p'     # Solaris (and SunOS?)
5381         elif $test -f /dgux; then
5382                 nm_opt='-p'     # DG-UX
5383         elif $test -f /lib64/rld; then
5384                 nm_opt='-p'     # 64-bit Irix
5385         else
5386                 nm_opt=''
5387         fi;;
5388 esac
5389
5390 : nm options which may be necessary for shared libraries but illegal
5391 : for archive libraries.  Thank you, Linux.
5392 case "$nm_so_opt" in
5393 '')     case "$myuname" in
5394         *linux*)
5395                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5396                         nm_so_opt='--dynamic'
5397                 fi
5398                 ;;
5399         esac
5400         ;;
5401 esac
5402
5403 case "$runnm" in
5404 true)
5405 : get list of predefined functions in a handy place
5406 echo " "
5407 case "$libc" in
5408 '') libc=unknown
5409         case "$libs" in
5410         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5411         esac
5412         ;;
5413 esac
5414 case "$libs" in
5415 '') ;;
5416 *)  for thislib in $libs; do
5417         case "$thislib" in
5418         -lc|-lc_s)
5419                 : Handle C library specially below.
5420                 ;;
5421         -l*)
5422                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5423                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5424                         :
5425                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5426                         :
5427                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5428                         :
5429                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5430                         :
5431                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5432                         :
5433                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5434                         :
5435                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5436                         :
5437                 else
5438                         try=''
5439                 fi
5440                 libnames="$libnames $try"
5441                 ;;
5442         *) libnames="$libnames $thislib" ;;
5443         esac
5444         done
5445         ;;
5446 esac
5447 xxx=normal
5448 case "$libc" in
5449 unknown)
5450         set /lib/libc.$so
5451         for xxx in $libpth; do
5452                 $test -r $1 || set $xxx/libc.$so
5453                 : The messy sed command sorts on library version numbers.
5454                 $test -r $1 || \
5455                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5456                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5457                                 h
5458                                 s/[0-9][0-9]*/0000&/g
5459                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5460                                 G
5461                                 s/\n/ /' | \
5462                          $sort | $sed -e 's/^.* //'`
5463                 eval set \$$#
5464         done
5465         $test -r $1 || set /usr/ccs/lib/libc.$so
5466         $test -r $1 || set /lib/libsys_s$_a
5467         ;;
5468 *)
5469         set blurfl
5470         ;;
5471 esac
5472 if $test -r "$1"; then
5473         echo "Your (shared) C library seems to be in $1."
5474         libc="$1"
5475 elif $test -r /lib/libc && $test -r /lib/clib; then
5476         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5477         xxx=apollo
5478         libc='/lib/clib /lib/libc'
5479         if $test -r /lib/syslib; then
5480                 echo "(Your math library is in /lib/syslib.)"
5481                 libc="$libc /lib/syslib"
5482         fi
5483 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5484         echo "Your C library seems to be in $libc, as you said before."
5485 elif $test -r $incpath/usr/lib/libc$_a; then
5486         libc=$incpath/usr/lib/libc$_a;
5487         echo "Your C library seems to be in $libc.  That's fine."
5488 elif $test -r /lib/libc$_a; then
5489         libc=/lib/libc$_a;
5490         echo "Your C library seems to be in $libc.  You're normal."
5491 else
5492         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5493                 :
5494         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5495                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5496         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5497                 :
5498         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5499                 :
5500         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5501                 :
5502         else
5503                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5504         fi
5505         if $test -r "$tans"; then
5506                 echo "Your C library seems to be in $tans, of all places."
5507                 libc=$tans
5508         else
5509                 libc='blurfl'
5510         fi
5511 fi
5512 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5513         dflt="$libc"
5514         cat <<EOM
5515
5516 If the guess above is wrong (which it might be if you're using a strange
5517 compiler, or your machine supports multiple models), you can override it here.
5518
5519 EOM
5520 else
5521         dflt=''
5522         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5523         cat >&4 <<EOM
5524 I can't seem to find your C library.  I've looked in the following places:
5525
5526 EOM
5527         $sed 's/^/      /' libpath
5528         cat <<EOM
5529
5530 None of these seems to contain your C library. I need to get its name...
5531
5532 EOM
5533 fi
5534 fn=f
5535 rp='Where is your C library?'
5536 . ./getfile
5537 libc="$ans"
5538
5539 echo " "
5540 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5541 set X `cat libnames`
5542 shift
5543 xxx=files
5544 case $# in 1) xxx=file; esac
5545 echo "Extracting names from the following $xxx for later perusal:" >&4
5546 echo " "
5547 $sed 's/^/      /' libnames >&4
5548 echo " "
5549 $echo $n "This may take a while...$c" >&4
5550
5551 for file in $*; do
5552         case $file in
5553         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5554         *) $nm $nm_opt $file 2>/dev/null;;
5555         esac
5556 done >libc.tmp
5557
5558 $echo $n ".$c"
5559 $grep fprintf libc.tmp > libc.ptf
5560 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5561 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5562 xxx='[ADTSIW]'
5563 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5564         eval $xscan;\
5565         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5566                 eval $xrun
5567 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5568         eval $xscan;\
5569         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5570                 eval $xrun
5571 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5572         eval $xscan;\
5573         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5574                 eval $xrun
5575 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5576         eval $xscan;\
5577         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5578                 eval $xrun
5579 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5580         eval $xscan;\
5581         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5582                 eval $xrun
5583 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5584         eval $xscan;\
5585         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5586                 eval $xrun
5587 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5588                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5589         eval $xscan;\
5590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5591                 eval $xrun
5592 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5593         eval $xscan;\
5594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5595                 eval $xrun
5596 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5597         eval $xscan;\
5598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5599                 eval $xrun
5600 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5601         eval $xscan;\
5602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5603                 eval $xrun
5604 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5605         eval $xscan;\
5606         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5607                 eval $xrun
5608 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5609         eval $xscan;\
5610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5611                 eval $xrun
5612 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5613         eval $xscan;\
5614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5615                 eval $xrun
5616 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5617         eval $xscan;\
5618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5619                 eval $xrun
5620 else
5621         $nm -p $* 2>/dev/null >libc.tmp
5622         $grep fprintf libc.tmp > libc.ptf
5623         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5624                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5625         then
5626                 nm_opt='-p'
5627                 eval $xrun
5628         else
5629                 echo " "
5630                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5631                 com=''
5632                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5633                         for thisname in $libnames $libc; do
5634                                 $ar t $thisname >>libc.tmp
5635                         done
5636                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5637                         echo "Ok." >&4
5638                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5639                         # Repeat libc to extract forwarders to DLL entries too
5640                         for thisname in $libnames $libc; do
5641                                 $ar tv $thisname >>libc.tmp
5642                                 # Revision 50 of EMX has bug in $ar.
5643                                 # it will not extract forwarders to DLL entries
5644                                 # Use emximp which will extract exactly them.
5645                                 emximp -o tmp.imp $thisname \
5646                                     2>/dev/null && \
5647                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5648                                     < tmp.imp >>libc.tmp
5649                                 $rm tmp.imp
5650                         done
5651                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5652                         echo "Ok." >&4
5653                 else
5654                         echo "$ar didn't seem to work right." >&4
5655                         echo "Maybe this is a Cray...trying bld instead..." >&4
5656                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5657                         then
5658                                 for thisname in $libnames; do
5659                                         bld t $libnames | \
5660                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5661                                         $ar t $thisname >>libc.tmp
5662                                 done
5663                                 echo "Ok." >&4
5664                         else
5665                                 echo "That didn't work either.  Giving up." >&4
5666                                 exit 1
5667                         fi
5668                 fi
5669         fi
5670 fi
5671 nm_extract="$com"
5672 if $test -f /lib/syscalls.exp; then
5673         echo " "
5674         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5675         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5676 fi
5677 ;;
5678 esac
5679 $rm -f libnames libpath
5680
5681 : is a C symbol defined?
5682 csym='tlook=$1;
5683 case "$3" in
5684 -v) tf=libc.tmp; tc=""; tdc="";;
5685 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5686 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5687 esac;
5688 tx=yes;
5689 case "$reuseval-$4" in
5690 true-) ;;
5691 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5692 esac;
5693 case "$tx" in
5694 yes)
5695         case "$runnm" in
5696         true)
5697                 if $contains $tlook $tf >/dev/null 2>&1;
5698                 then tval=true;
5699                 else tval=false;
5700                 fi;;
5701         *)
5702                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5703                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5704                 then tval=true;
5705                 else tval=false;
5706                 fi;
5707                 $rm -f t t.c;;
5708         esac;;
5709 *)
5710         case "$tval" in
5711         $define) tval=true;;
5712         *) tval=false;;
5713         esac;;
5714 esac;
5715 eval "$2=$tval"'
5716
5717 : define an is-in-libc? function
5718 inlibc='echo " "; td=$define; tu=$undef;
5719 sym=$1; var=$2; eval "was=\$$2";
5720 tx=yes;
5721 case "$reuseval$was" in
5722 true) ;;
5723 true*) tx=no;;
5724 esac;
5725 case "$tx" in
5726 yes)
5727         set $sym tres -f;
5728         eval $csym;
5729         case "$tres" in
5730         true)
5731                 echo "$sym() found." >&4;
5732                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5733         *)
5734                 echo "$sym() NOT found." >&4;
5735                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5736         esac;;
5737 *)
5738         case "$was" in
5739         $define) echo "$sym() found." >&4;;
5740         *) echo "$sym() NOT found." >&4;;
5741         esac;;
5742 esac'
5743
5744 : see if sqrtl exists
5745 set sqrtl d_sqrtl
5746 eval $inlibc
5747
5748 case "$ccflags" in
5749 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5750 esac
5751
5752 case "$uselongdouble" in
5753 $define|true|[yY]*)     dflt='y';;
5754 *) dflt='n';;
5755 esac
5756 cat <<EOM
5757
5758 Perl can be built to take advantage of long doubles which
5759 (if available) may give more accuracy and range for floating point numbers.
5760
5761 If this doesn't make any sense to you, just accept the default '$dflt'.
5762 EOM
5763 rp='Try to use long doubles if available?'
5764 . ./myread
5765 case "$ans" in
5766 y|Y)    val="$define"   ;;
5767 *)      val="$undef"    ;;
5768 esac
5769 set uselongdouble
5770 eval $setvar
5771
5772 case "$uselongdouble" in
5773 true|[yY]*) uselongdouble="$define" ;;
5774 esac
5775
5776 case "$uselongdouble" in
5777 $define)
5778 : Look for a hint-file generated 'call-back-unit'.  If the
5779 : user has specified that long doubles should be used,
5780 : we may need to set or change some other defaults.
5781         if $test -f uselongdouble.cbu; then
5782                 echo "Your platform has some specific hints for long doubles, using them..."
5783                 . ./uselongdouble.cbu
5784         else
5785                 $cat <<EOM
5786 (Your platform doesn't have any specific hints for long doubles.)
5787 EOM
5788         fi
5789         ;;
5790 esac
5791
5792 case "$uselongdouble:$d_sqrtl" in
5793 $define:$undef)
5794                 $cat <<EOM >&4
5795
5796 *** You requested the use of long doubles but you do not seem to have
5797 *** the mathematic functions for long doubles.  I'm disabling the use
5798 *** of long doubles.
5799
5800 EOM
5801         uselongdouble=$undef
5802         ;;
5803 esac
5804
5805 : check for length of double
5806 echo " "
5807 case "$doublesize" in
5808 '')
5809         echo "Checking to see how big your double precision numbers are..." >&4
5810         $cat >try.c <<'EOCP'
5811 #include <stdio.h>
5812 int main()
5813 {
5814     printf("%d\n", (int)sizeof(double));
5815     exit(0);
5816 }
5817 EOCP
5818         set try
5819         if eval $compile_ok; then
5820                 doublesize=`$run ./try`
5821                 echo "Your double is $doublesize bytes long."
5822         else
5823                 dflt='8'
5824                 echo "(I can't seem to compile the test program.  Guessing...)"
5825                 rp="What is the size of a double precision number (in bytes)?"
5826                 . ./myread
5827                 doublesize="$ans"
5828         fi
5829         ;;
5830 esac
5831 $rm -f try.c try
5832
5833 : check for long doubles
5834 echo " "
5835 echo "Checking to see if you have long double..." >&4
5836 echo 'int main() { long double x = 7.0; }' > try.c
5837 set try
5838 if eval $compile; then
5839         val="$define"
5840         echo "You have long double."
5841 else
5842         val="$undef"
5843         echo "You do not have long double."
5844 fi
5845 $rm try.*
5846 set d_longdbl
5847 eval $setvar
5848
5849 : check for length of long double
5850 case "${d_longdbl}${longdblsize}" in
5851 $define)
5852         echo " "
5853         echo "Checking to see how big your long doubles are..." >&4
5854         $cat >try.c <<'EOCP'
5855 #include <stdio.h>
5856 int main()
5857 {
5858         printf("%d\n", sizeof(long double));
5859 }
5860 EOCP
5861         set try
5862         set try
5863         if eval $compile; then
5864                 longdblsize=`$run ./try`
5865                 echo "Your long doubles are $longdblsize bytes long."
5866         else
5867                 dflt='8'
5868                 echo " "
5869                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5870                 rp="What is the size of a long double (in bytes)?"
5871                 . ./myread
5872                 longdblsize="$ans"
5873         fi
5874         if $test "X$doublesize" = "X$longdblsize"; then
5875                 echo "(That isn't any different from an ordinary double.)"
5876         fi      
5877         ;;
5878 esac
5879 $rm -f try.* try
5880
5881 case "$useperlio" in
5882 $define|true|[yY]*|'')  dflt='y';;
5883 *) dflt='n';;
5884 esac
5885 cat <<EOM
5886
5887 Previous version of $package used the standard IO mechanisms as
5888 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5889 alternate IO mechanisms via the PerlIO abstraction layer, but the
5890 stdio mechanism is still available if needed.  The abstraction layer
5891 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5892 Using PerlIO with sfio may cause problems with some extension modules.
5893
5894 If this doesn't make any sense to you, just accept the default '$dflt'.
5895 EOM
5896 rp='Use the PerlIO abstraction layer?'
5897 . ./myread
5898 case "$ans" in
5899 y|Y) 
5900         val="$define"
5901         ;;
5902 *)      
5903         echo "Ok, doing things the stdio way."
5904         val="$undef"
5905         ;;
5906 esac
5907 set useperlio
5908 eval $setvar 
5909
5910 case "$usesocks" in
5911 $define|true|[yY]*)
5912         case "$useperlio" in
5913         $define|true|[yY]*) ;;
5914         *)      cat >&4 <<EOM
5915
5916 You are using the SOCKS proxy protocol library which means that you
5917 should also use the PerlIO layer.  You may be headed for trouble.
5918
5919 EOM
5920                 ;;
5921         esac
5922         ;;
5923 esac
5924
5925         
5926 : determine the architecture name
5927 echo " "
5928 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5929         tarch=`arch`"-$osname"
5930 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5931         if uname -m > tmparch 2>&1 ; then
5932                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5933                         -e 's/$/'"-$osname/" tmparch`
5934         else
5935                 tarch="$osname"
5936         fi
5937         $rm -f tmparch
5938 else
5939         tarch="$osname"
5940 fi
5941 case "$myarchname" in
5942 ''|"$tarch") ;;
5943 *)
5944         echo "(Your architecture name used to be $myarchname.)"
5945         archname=''
5946         ;;
5947 esac
5948 case "$targetarch" in
5949 '') ;;
5950 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5951 esac
5952 myarchname="$tarch"
5953 case "$archname" in
5954 '') dflt="$tarch";;
5955 *) dflt="$archname";;
5956 esac
5957 rp='What is your architecture name'
5958 . ./myread
5959 archname="$ans"
5960 case "$usethreads" in
5961 $define)
5962         echo "Threads selected." >&4
5963         case "$archname" in
5964         *-thread*) echo "...and architecture name already has -thread." >&4
5965                 ;;
5966         *)      archname="$archname-thread"
5967                 echo "...setting architecture name to $archname." >&4
5968                 ;;
5969         esac
5970         ;;
5971 esac
5972 case "$usemultiplicity" in
5973 $define)
5974         echo "Multiplicity selected." >&4
5975         case "$archname" in
5976         *-multi*) echo "...and architecture name already has -multi." >&4
5977                 ;;
5978         *)      archname="$archname-multi"
5979                 echo "...setting architecture name to $archname." >&4
5980                 ;;
5981         esac
5982         ;;
5983 esac
5984 case "$use64bitint$use64bitall" in
5985 *"$define"*)
5986         case "$archname64" in
5987         '')
5988                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5989                 ;;
5990         *)
5991                 case "$use64bitint" in
5992                 "$define") echo "64 bit integers selected." >&4 ;;
5993                 esac
5994                 case "$use64bitall" in
5995                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5996                 esac
5997                 case "$archname" in
5998                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5999                         ;;
6000                 *)      archname="$archname-$archname64"
6001                         echo "...setting architecture name to $archname." >&4
6002                         ;;
6003                 esac
6004                 ;;
6005         esac
6006 esac
6007 case "$uselongdouble" in
6008 $define)
6009         echo "Long doubles selected." >&4
6010         case "$longdblsize" in
6011         $doublesize)
6012                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6013                 ;;
6014         *)
6015                 case "$archname" in
6016                 *-ld*) echo "...and architecture name already has -ld." >&4
6017                         ;;
6018                 *)      archname="$archname-ld"
6019                         echo "...setting architecture name to $archname." >&4
6020                         ;;
6021                 esac
6022                 ;;
6023         esac
6024         ;;
6025 esac
6026 case "$useperlio" in
6027 $define)
6028         echo "Perlio selected." >&4
6029         ;;
6030 *)
6031         echo "Perlio not selected, using stdio." >&4
6032         case "$archname" in
6033         *-stdio*) echo "...and architecture name already has -stdio." >&4
6034                 ;;
6035         *)      archname="$archname-stdio"
6036                 echo "...setting architecture name to $archname." >&4
6037                 ;;
6038         esac
6039         ;;
6040 esac
6041
6042 : determine root of directory hierarchy where package will be installed.
6043 case "$prefix" in
6044 '')
6045         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6046         ;;
6047 *)
6048         dflt="$prefix"
6049         ;;
6050 esac
6051 $cat <<EOM
6052
6053 By default, $package will be installed in $dflt/bin, manual pages
6054 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6055 installation directories. Typically this is something like /usr/local.
6056 If you wish to have binaries under /usr/bin but other parts of the
6057 installation under /usr/local, that's ok: you will be prompted
6058 separately for each of the installation directories, the prefix being
6059 only used to set the defaults.
6060
6061 EOM
6062 fn=d~
6063 rp='Installation prefix to use?'
6064 . ./getfile
6065 oldprefix=''
6066 case "$prefix" in
6067 '') ;;
6068 *)
6069         case "$ans" in
6070         "$prefix") ;;
6071         *) oldprefix="$prefix";;
6072         esac
6073         ;;
6074 esac
6075 prefix="$ans"
6076 prefixexp="$ansexp"
6077
6078 case "$afsroot" in
6079 '')     afsroot=/afs ;;
6080 *)      afsroot=$afsroot ;;
6081 esac
6082
6083 : is AFS running?
6084 echo " "
6085 case "$afs" in
6086 $define|true)   afs=true ;;
6087 $undef|false)   afs=false ;;
6088 *)      if test -d $afsroot; then
6089                 afs=true
6090         else
6091                 afs=false
6092         fi
6093         ;;
6094 esac
6095 if $afs; then
6096         echo "AFS may be running... I'll be extra cautious then..." >&4
6097 else
6098         echo "AFS does not seem to be running..." >&4
6099 fi
6100
6101 : determine installation prefix for where package is to be installed.
6102 if $afs; then 
6103 $cat <<EOM
6104
6105 Since you are running AFS, I need to distinguish the directory in which
6106 files will reside from the directory in which they are installed (and from
6107 which they are presumably copied to the former directory by occult means).
6108
6109 EOM
6110         case "$installprefix" in
6111         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6112         *) dflt="$installprefix";;
6113         esac
6114 else
6115 $cat <<EOM
6116
6117 In some special cases, particularly when building $package for distribution,
6118 it is convenient to distinguish between the directory in which files should 
6119 be installed from the directory ($prefix) in which they 
6120 will eventually reside.  For most users, these two directories are the same.
6121
6122 EOM
6123         case "$installprefix" in
6124         '') dflt=$prefix ;;
6125         *) dflt=$installprefix;;
6126         esac
6127 fi
6128 fn=d~
6129 rp='What installation prefix should I use for installing files?'
6130 . ./getfile
6131 installprefix="$ans"
6132 installprefixexp="$ansexp"
6133
6134 : set the prefixit variable, to compute a suitable default value
6135 prefixit='case "$3" in
6136 ""|none)
6137         case "$oldprefix" in
6138         "") eval "$1=\"\$$2\"";;
6139         *)
6140                 case "$3" in
6141                 "") eval "$1=";;
6142                 none)
6143                         eval "tp=\"\$$2\"";
6144                         case "$tp" in
6145                         ""|" ") eval "$1=\"\$$2\"";;
6146                         *) eval "$1=";;
6147                         esac;;
6148                 esac;;
6149         esac;;
6150 *)
6151         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6152         case "$tp" in
6153         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6154         /*-$oldprefix/*|\~*-$oldprefix/*)
6155                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6156         *) eval "$1=\"\$$2\"";;
6157         esac;;
6158 esac'
6159
6160 : get the patchlevel
6161 echo " "
6162 echo "Getting the current patchlevel..." >&4
6163 if $test -r $rsrc/patchlevel.h;then
6164         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6165         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6166         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6167         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6168         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6169         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6170        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6171 else
6172         revision=0
6173         patchlevel=0
6174         subversion=0
6175         api_revision=0
6176         api_version=0
6177         api_subversion=0
6178         perl_patchlevel=0
6179         $echo "(You do not have patchlevel.h.  Eek.)"
6180 fi
6181 if $test -r $rsrc/.patch ; then  
6182         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6183                 perl_patchlevel=`cat $rsrc/.patch`
6184         fi
6185 fi
6186 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6187 version_patchlevel_string="version $patchlevel subversion $subversion"
6188 case "$perl_patchlevel" in
6189 0|'') ;;
6190 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6191 esac
6192
6193 $echo "(You have $package $version_patchlevel_string.)"
6194
6195 case "$osname" in
6196 dos|vms)
6197         : XXX Should be a Configure test for double-dots in filenames.
6198         version=`echo $revision $patchlevel $subversion | \
6199                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6200         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6201                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6202         ;;
6203 *)
6204         version=`echo $revision $patchlevel $subversion | \
6205                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6206         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6207                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6208         ;;
6209 esac
6210 : Special case the 5.005_xx maintenance series, which used 5.005
6211 : without any subversion label as a subdirectory in $sitelib
6212 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6213         api_versionstring='5.005'
6214 fi
6215
6216 : determine installation style
6217 : For now, try to deduce it from prefix unless it is already set.
6218 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6219 case "$installstyle" in
6220 '')     case "$prefix" in
6221                 *perl*) dflt='lib';;
6222                 *) dflt='lib/perl5' ;;
6223         esac
6224         ;;
6225 *)      dflt="$installstyle" ;;
6226 esac
6227 : Probably not worth prompting for this since we prompt for all
6228 : the directories individually, and the prompt would be too long and
6229 : confusing anyway.
6230 installstyle=$dflt
6231
6232 : determine where private library files go
6233 : Usual default is /usr/local/lib/perl5/$version.
6234 : Also allow things like /opt/perl/lib/$version, since 
6235 : /opt/perl/lib/perl5... would be redundant.
6236 : The default "style" setting is made in installstyle.U
6237 case "$installstyle" in
6238 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6239 *)       set dflt privlib lib/$version ;;
6240 esac
6241 eval $prefixit
6242 $cat <<EOM
6243
6244 There are some auxiliary files for $package that need to be put into a
6245 private library directory that is accessible by everyone.
6246
6247 EOM
6248 fn=d~+
6249 rp='Pathname where the private library files will reside?'
6250 . ./getfile
6251 privlib="$ans"
6252 privlibexp="$ansexp"
6253 : Change installation prefix, if necessary.
6254 if $test X"$prefix" != X"$installprefix"; then
6255         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6256 else
6257         installprivlib="$privlibexp"
6258 fi
6259
6260 : set the prefixup variable, to restore leading tilda escape
6261 prefixup='case "$prefixexp" in
6262 "$prefix") ;;
6263 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6264 esac'
6265
6266 : determine where public architecture dependent libraries go
6267 set archlib archlib
6268 eval $prefixit
6269 : privlib default is /usr/local/lib/$package/$version
6270 : archlib default is /usr/local/lib/$package/$version/$archname
6271 : privlib may have an optional trailing /share.
6272 tdflt=`echo $privlib | $sed 's,/share$,,'`
6273 tdflt=$tdflt/$archname
6274 case "$archlib" in
6275 '')     dflt=$tdflt
6276         ;;
6277 *)      dflt="$archlib"
6278     ;;
6279 esac
6280 $cat <<EOM
6281
6282 $spackage contains architecture-dependent library files.  If you are
6283 sharing libraries in a heterogeneous environment, you might store
6284 these files in a separate location.  Otherwise, you can just include
6285 them with the rest of the public library files.
6286
6287 EOM
6288 fn=d+~
6289 rp='Where do you want to put the public architecture-dependent libraries?'
6290 . ./getfile
6291 archlib="$ans"
6292 archlibexp="$ansexp"
6293 if $test X"$archlib" = X"$privlib"; then
6294         d_archlib="$undef"
6295 else
6296         d_archlib="$define"
6297 fi
6298 : Change installation prefix, if necessary.
6299 if $test X"$prefix" != X"$installprefix"; then
6300         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6301 else
6302         installarchlib="$archlibexp"
6303 fi
6304
6305
6306 : Binary compatibility with 5.005 is not possible for builds
6307 : with advanced features
6308 case "$usethreads$usemultiplicity" in
6309 *define*)
6310         bincompat5005="$undef"
6311         d_bincompat5005="$undef"
6312         ;;
6313 *)      $cat <<EOM
6314
6315 This version of Perl can be compiled for binary compatibility with 5.005.
6316 If you decide to do so, you will be able to continue using most of the
6317 extensions that were compiled for Perl 5.005.
6318
6319 EOM
6320         case "$bincompat5005$d_bincompat5005" in
6321         *"$undef"*) dflt=n ;;
6322         *) dflt=y ;;
6323         esac
6324         rp='Binary compatibility with Perl 5.005?'
6325         . ./myread
6326         case "$ans" in
6327         y*) val="$define" ;;
6328         *)  val="$undef" ;;
6329         esac
6330         set d_bincompat5005
6331         eval $setvar
6332         case "$d_bincompat5005" in
6333         "$define")
6334                 bincompat5005="$define"
6335                 ;;
6336         *)      bincompat5005="$undef"
6337                 d_bincompat5005="$undef"
6338                 ;;
6339         esac
6340         ;;
6341 esac
6342
6343
6344 : see if setuid scripts can be secure
6345 $cat <<EOM
6346
6347 Some kernels have a bug that prevents setuid #! scripts from being
6348 secure.  Some sites have disabled setuid #! scripts because of this.
6349
6350 First let's decide if your kernel supports secure setuid #! scripts.
6351 (If setuid #! scripts would be secure but have been disabled anyway,
6352 don't say that they are secure if asked.)
6353
6354 EOM
6355
6356 val="$undef"
6357 if $test -d /dev/fd; then
6358         echo "#!$ls" >reflect
6359         chmod +x,u+s reflect
6360         ./reflect >flect 2>&1
6361         if $contains "/dev/fd" flect >/dev/null; then
6362                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6363                 val="$define"
6364         else
6365                 $cat <<EOM
6366 If you are not sure if they are secure, I can check but I'll need a
6367 username and password different from the one you are using right now.
6368 If you don't have such a username or don't want me to test, simply
6369 enter 'none'.
6370
6371 EOM
6372                 rp='Other username to test security of setuid scripts with?'
6373                 dflt='none'
6374                 . ./myread
6375                 case "$ans" in
6376                 n|none)
6377                         case "$d_suidsafe" in
6378                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6379                                 dflt=n;;
6380                         "$undef")
6381                                 echo "Well, the $hint value is *not* secure." >&4
6382                                 dflt=n;;
6383                         *)      echo "Well, the $hint value *is* secure." >&4
6384                                 dflt=y;;
6385                         esac
6386                         ;;
6387                 *)
6388                         $rm -f reflect flect
6389                         echo "#!$ls" >reflect
6390                         chmod +x,u+s reflect
6391                         echo >flect
6392                         chmod a+w flect
6393                         echo '"su" will (probably) prompt you for '"$ans's password."
6394                         su $ans -c './reflect >flect'
6395                         if $contains "/dev/fd" flect >/dev/null; then
6396                                 echo "Okay, it looks like setuid scripts are secure." >&4
6397                                 dflt=y
6398                         else
6399                                 echo "I don't think setuid scripts are secure." >&4
6400                                 dflt=n
6401                         fi
6402                         ;;
6403                 esac
6404                 rp='Does your kernel have *secure* setuid scripts?'
6405                 . ./myread
6406                 case "$ans" in
6407                 [yY]*)  val="$define";;
6408                 *)      val="$undef";;
6409                 esac
6410         fi
6411 else
6412         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6413         echo "(That's for file descriptors, not floppy disks.)"
6414         val="$undef"
6415 fi
6416 set d_suidsafe
6417 eval $setvar
6418
6419 $rm -f reflect flect
6420
6421 : now see if they want to do setuid emulation
6422 echo " "
6423 val="$undef"
6424 case "$d_suidsafe" in
6425 "$define")
6426         val="$undef"
6427         echo "No need to emulate SUID scripts since they are secure here." >&4
6428         ;;
6429 *)
6430         $cat <<EOM
6431 Some systems have disabled setuid scripts, especially systems where
6432 setuid scripts cannot be secure.  On systems where setuid scripts have
6433 been disabled, the setuid/setgid bits on scripts are currently
6434 useless.  It is possible for $package to detect those bits and emulate
6435 setuid/setgid in a secure fashion.  This emulation will only work if
6436 setuid scripts have been disabled in your kernel.
6437
6438 EOM
6439         case "$d_dosuid" in
6440         "$define") dflt=y ;;
6441         *) dflt=n ;;
6442         esac
6443         rp="Do you want to do setuid/setgid emulation?"
6444         . ./myread
6445         case "$ans" in
6446         [yY]*)  val="$define";;
6447         *)      val="$undef";;
6448         esac
6449         ;;
6450 esac
6451 set d_dosuid
6452 eval $setvar
6453
6454 : see if this is a malloc.h system
6455 set malloc.h i_malloc
6456 eval $inhdr
6457
6458 : see if stdlib is available
6459 set stdlib.h i_stdlib
6460 eval $inhdr
6461
6462 : determine which malloc to compile in
6463 echo " "
6464 case "$usemymalloc" in
6465 [yY]*|true|$define)     dflt='y' ;;
6466 [nN]*|false|$undef)     dflt='n' ;;
6467 *)      case "$ptrsize" in
6468         4) dflt='y' ;;
6469         *) dflt='n' ;;
6470         esac
6471         ;;
6472 esac
6473 rp="Do you wish to attempt to use the malloc that comes with $package?"
6474 . ./myread
6475 usemymalloc="$ans"
6476 case "$ans" in
6477 y*|true)
6478         usemymalloc='y'
6479         mallocsrc='malloc.c'
6480         mallocobj="malloc$_o"
6481         d_mymalloc="$define"
6482         case "$libs" in
6483         *-lmalloc*)
6484                 : Remove malloc from list of libraries to use
6485                 echo "Removing unneeded -lmalloc from library list" >&4
6486                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6487                 shift
6488                 libs="$*"
6489                 echo "libs = $libs" >&4
6490                 ;;
6491         esac
6492         ;;
6493 *)
6494         usemymalloc='n'
6495         mallocsrc=''
6496         mallocobj=''
6497         d_mymalloc="$undef"
6498         ;;
6499 esac
6500
6501 : compute the return types of malloc and free
6502 echo " "
6503 $cat >malloc.c <<END
6504 #$i_malloc I_MALLOC
6505 #$i_stdlib I_STDLIB
6506 #include <stdio.h>
6507 #include <sys/types.h>
6508 #ifdef I_MALLOC
6509 #include <malloc.h>
6510 #endif
6511 #ifdef I_STDLIB
6512 #include <stdlib.h>
6513 #endif
6514 #ifdef TRY_MALLOC
6515 void *malloc();
6516 #endif
6517 #ifdef TRY_FREE
6518 void free();
6519 #endif
6520 END
6521 case "$malloctype" in
6522 '')
6523         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6524                 malloctype='void *'
6525         else
6526                 malloctype='char *'
6527         fi
6528         ;;
6529 esac
6530 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6531
6532 case "$freetype" in
6533 '')
6534         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6535                 freetype='void'
6536         else
6537                 freetype='int'
6538         fi
6539         ;;
6540 esac
6541 echo "Your system uses $freetype free(), it would seem." >&4
6542 $rm -f malloc.[co]
6543 $cat <<EOM
6544
6545 After $package is installed, you may wish to install various
6546 add-on modules and utilities.  Typically, these add-ons will
6547 be installed under $prefix with the rest
6548 of this package.  However, you may wish to install such add-ons
6549 elsewhere under a different prefix.
6550
6551 If you do not wish to put everything under a single prefix, that's
6552 ok.  You will be prompted for the individual locations; this siteprefix
6553 is only used to suggest the defaults.
6554
6555 The default should be fine for most people.
6556
6557 EOM
6558 fn=d~+
6559 rp='Installation prefix to use for add-on modules and utilities?'
6560 : XXX Here might be another good place for an installstyle setting.
6561 case "$siteprefix" in
6562 '') dflt=$prefix ;;
6563 *)  dflt=$siteprefix ;;
6564 esac
6565 . ./getfile
6566 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6567 oldsiteprefix=''
6568 case "$siteprefix" in
6569 '') ;;
6570 *)      case "$ans" in
6571         "$prefix") ;;
6572         *) oldsiteprefix="$prefix";;
6573         esac
6574         ;;
6575 esac
6576 siteprefix="$ans"
6577 siteprefixexp="$ansexp"
6578
6579 : determine where site specific libraries go.
6580 : Usual default is /usr/local/lib/perl5/site_perl/$version
6581 : The default "style" setting is made in installstyle.U
6582 : XXX No longer works with Prefixit stuff.
6583 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6584 case "$sitelib" in
6585 '') case "$installstyle" in
6586         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6587         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6588         esac
6589         ;;
6590 *)      dflt="$sitelib"
6591         ;;
6592 esac
6593 $cat <<EOM
6594
6595 The installation process will create a directory for
6596 site-specific extensions and modules.  Most users find it convenient
6597 to place all site-specific files in this directory rather than in the
6598 main distribution directory.
6599
6600 EOM
6601 fn=d~+
6602 rp='Pathname for the site-specific library files?'
6603 . ./getfile
6604 sitelib="$ans"
6605 sitelibexp="$ansexp"
6606 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6607 : Change installation prefix, if necessary.
6608 if $test X"$prefix" != X"$installprefix"; then
6609         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6610 else
6611         installsitelib="$sitelibexp"
6612 fi
6613
6614 : determine where site specific architecture-dependent libraries go.
6615 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6616 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6617 : sitelib may have an optional trailing /share.
6618 case "$sitearch" in
6619 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6620         dflt="$dflt/$archname"
6621         ;;
6622 *)      dflt="$sitearch"
6623         ;;
6624 esac
6625 set sitearch sitearch none
6626 eval $prefixit
6627 $cat <<EOM
6628
6629 The installation process will also create a directory for
6630 architecture-dependent site-specific extensions and modules.
6631
6632 EOM
6633 fn=d~+
6634 rp='Pathname for the site-specific architecture-dependent library files?'
6635 . ./getfile
6636 sitearch="$ans"
6637 sitearchexp="$ansexp"
6638 : Change installation prefix, if necessary.
6639 if $test X"$prefix" != X"$installprefix"; then
6640         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6641 else
6642         installsitearch="$sitearchexp"
6643 fi
6644
6645 $cat <<EOM
6646
6647 The installation process will also create a directory for
6648 vendor-supplied add-ons.  Vendors who supply perl with their system
6649 may find it convenient to place all vendor-supplied files in this
6650 directory rather than in the main distribution directory.  This will
6651 ease upgrades between binary-compatible maintenance versions of perl.
6652
6653 Of course you may also use these directories in whatever way you see
6654 fit.  For example, you might use them to access modules shared over a
6655 company-wide network.
6656
6657 The default answer should be fine for most people.
6658 This causes further questions about vendor add-ons to be skipped
6659 and no vendor-specific directories will be configured for perl.
6660
6661 EOM
6662 rp='Do you want to configure vendor-specific add-on directories?'
6663 case "$usevendorprefix" in
6664 define|true|[yY]*) dflt=y ;;
6665 *)      : User may have set vendorprefix directly on Configure command line.
6666         case "$vendorprefix" in
6667         ''|' ') dflt=n ;;
6668         *)      dflt=y ;;
6669         esac
6670         ;;
6671 esac
6672 . ./myread
6673 case "$ans" in
6674 [yY]*)  fn=d~+
6675         rp='Installation prefix to use for vendor-supplied add-ons?'
6676         case "$vendorprefix" in
6677         '') dflt='' ;;
6678         *)  dflt=$vendorprefix ;;
6679         esac
6680         . ./getfile
6681         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6682         oldvendorprefix=''
6683         case "$vendorprefix" in
6684         '') ;;
6685         *)      case "$ans" in
6686                 "$prefix") ;;
6687                 *) oldvendorprefix="$prefix";;
6688                 esac
6689                 ;;
6690         esac
6691         usevendorprefix="$define"
6692         vendorprefix="$ans"
6693         vendorprefixexp="$ansexp"
6694         ;;
6695 *)      usevendorprefix="$undef"
6696         vendorprefix=''
6697         vendorprefixexp=''
6698         ;;
6699 esac
6700
6701 case "$vendorprefix" in
6702 '')     d_vendorlib="$undef"
6703         vendorlib=''
6704         vendorlibexp=''
6705         ;;
6706 *)      d_vendorlib="$define"
6707         : determine where vendor-supplied modules go.
6708         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6709         case "$vendorlib" in
6710         '')
6711                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6712                 case "$installstyle" in
6713                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6714                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6715                 esac
6716                 ;;
6717         *)      dflt="$vendorlib"
6718                 ;;
6719         esac
6720         fn=d~+
6721         rp='Pathname for the vendor-supplied library files?'
6722         . ./getfile
6723         vendorlib="$ans"
6724         vendorlibexp="$ansexp"
6725         ;;
6726 esac
6727 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6728 : Change installation prefix, if necessary.
6729 if $test X"$prefix" != X"$installprefix"; then
6730         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6731 else
6732         installvendorlib="$vendorlibexp"
6733 fi
6734
6735 case "$vendorprefix" in
6736 '')     d_vendorarch="$undef"
6737         vendorarch=''
6738         vendorarchexp=''
6739         ;;
6740 *)      d_vendorarch="$define"
6741         : determine where vendor-supplied architecture-dependent libraries go.
6742         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6743         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6744         : vendorlib may have an optional trailing /share.
6745         case "$vendorarch" in
6746         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6747                 dflt="$dflt/$archname"
6748                 ;;
6749         *)      dflt="$vendorarch" ;;
6750         esac
6751         fn=d~+
6752         rp='Pathname for vendor-supplied architecture-dependent files?'
6753         . ./getfile
6754         vendorarch="$ans"
6755         vendorarchexp="$ansexp"
6756         ;;
6757 esac
6758 : Change installation prefix, if necessary.
6759 if $test X"$prefix" != X"$installprefix"; then
6760         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6761 else
6762         installvendorarch="$vendorarchexp"
6763 fi
6764
6765 : Final catch-all directories to search
6766 $cat <<EOM
6767
6768 Lastly, you can have perl look in other directories for extensions and
6769 modules in addition to those already specified.
6770 These directories will be searched after 
6771         $sitearch 
6772         $sitelib 
6773 EOM
6774 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6775 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6776 echo ' '
6777 case "$otherlibdirs" in
6778 ''|' ') dflt='none' ;;
6779 *)      dflt="$otherlibdirs" ;;
6780 esac
6781 $cat <<EOM
6782 Enter a colon-separated set of extra paths to include in perl's @INC
6783 search path, or enter 'none' for no extra paths.
6784
6785 EOM
6786
6787 rp='Colon-separated list of additional directories for perl to search?'
6788 . ./myread
6789 case "$ans" in
6790 ' '|''|none)    otherlibdirs=' ' ;;     
6791 *)      otherlibdirs="$ans" ;;
6792 esac
6793 case "$otherlibdirs" in
6794 ' ') val=$undef ;;
6795 *)      val=$define ;;
6796 esac
6797 set d_perl_otherlibdirs
6798 eval $setvar
6799
6800 : Cruising for prototypes
6801 echo " "
6802 echo "Checking out function prototypes..." >&4
6803 $cat >prototype.c <<'EOCP'
6804 int main(int argc, char *argv[]) {
6805         exit(0);}
6806 EOCP
6807 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6808         echo "Your C compiler appears to support function prototypes."
6809         val="$define"
6810 else
6811         echo "Your C compiler doesn't seem to understand function prototypes."
6812         val="$undef"
6813 fi
6814 set prototype
6815 eval $setvar
6816 $rm -f prototype*
6817
6818 case "$prototype" in
6819 "$define") ;;
6820 *)      ansi2knr='ansi2knr'
6821         echo " "
6822         cat <<EOM >&4
6823
6824 $me:  FATAL ERROR:
6825 This version of $package can only be compiled by a compiler that 
6826 understands function prototypes.  Unfortunately, your C compiler 
6827         $cc $ccflags
6828 doesn't seem to understand them.  Sorry about that.
6829
6830 If GNU cc is available for your system, perhaps you could try that instead.  
6831
6832 Eventually, we hope to support building Perl with pre-ANSI compilers.
6833 If you would like to help in that effort, please contact <perlbug@perl.org>.
6834
6835 Aborting Configure now.
6836 EOM
6837         exit 2
6838         ;;
6839 esac
6840
6841 : determine where public executables go
6842 echo " "
6843 set dflt bin bin
6844 eval $prefixit
6845 fn=d~
6846 rp='Pathname where the public executables will reside?'
6847 . ./getfile
6848 if $test "X$ansexp" != "X$binexp"; then
6849         installbin=''
6850 fi
6851 bin="$ans"
6852 binexp="$ansexp"
6853 : Change installation prefix, if necessary.
6854 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6855 if $test X"$prefix" != X"$installprefix"; then
6856         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6857 else
6858         installbin="$binexp"
6859 fi
6860
6861 echo " "
6862 case "$extras" in
6863 '') dflt='n';;
6864 *) dflt='y';;
6865 esac
6866 cat <<EOM
6867 Perl can be built with extra modules or bundles of modules which
6868 will be fetched from the CPAN and installed alongside Perl.
6869
6870 Notice that you will need access to the CPAN; either via the Internet,
6871 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6872 be asked later to configure the CPAN.pm module which will in turn do
6873 the installation of the rest of the extra modules or bundles.)
6874
6875 Notice also that if the modules require any external software such as
6876 libraries and headers (the libz library and the zlib.h header for the
6877 Compress::Zlib module, for example) you MUST have any such software
6878 already installed, this configuration process will NOT install such
6879 things for you.
6880
6881 If this doesn't make any sense to you, just accept the default '$dflt'.
6882 EOM
6883 rp='Install any extra modules (y or n)?'
6884 . ./myread
6885 case "$ans" in
6886 y|Y)
6887         cat <<EOM
6888
6889 Please list any extra modules or bundles to be installed from CPAN,
6890 with spaces between the names.  The names can be in any format the
6891 'install' command of CPAN.pm will understand.  (Answer 'none',
6892 without the quotes, to install no extra modules or bundles.)
6893 EOM
6894         rp='Extras?'
6895         dflt="$extras"
6896         . ./myread
6897         extras="$ans"
6898 esac
6899 case "$extras" in
6900 ''|'none')
6901         val=''
6902         $rm -f ../extras.lst
6903         ;;
6904 *)      echo "(Saving the list of extras for later...)"
6905         echo "$extras" > ../extras.lst
6906         val="'$extras'"
6907         ;;
6908 esac
6909 set extras
6910 eval $setvar
6911 echo " "
6912
6913 : Find perl5.005 or later.
6914 echo "Looking for a previously installed perl5.005 or later... "
6915 case "$perl5" in
6916 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6917                 : Check if this perl is recent and can load a simple module
6918                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6919                         perl5=$tdir/perl
6920                         break;
6921                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6922                         perl5=$tdir/perl5
6923                         break;
6924                 fi
6925         done
6926         ;;
6927 *)      perl5="$perl5"
6928         ;;
6929 esac
6930 case "$perl5" in
6931 '')     echo "None found.  That's ok.";;
6932 *)      echo "Using $perl5." ;;
6933 esac
6934
6935 : Determine list of previous versions to include in @INC
6936 $cat > getverlist <<EOPL
6937 #!$perl5 -w
6938 use File::Basename;
6939 \$api_versionstring = "$api_versionstring";
6940 \$version = "$version";
6941 \$stem = "$sitelib_stem";
6942 \$archname = "$archname";
6943 EOPL
6944         $cat >> getverlist <<'EOPL'
6945 # Can't have leading @ because metaconfig interprets it as a command!
6946 ;@inc_version_list=();
6947 # XXX Redo to do opendir/readdir? 
6948 if (-d $stem) {
6949     chdir($stem);
6950     ;@candidates = glob("5.*");
6951 }
6952 else {
6953     ;@candidates = ();
6954 }
6955
6956 # XXX ToDo:  These comparisons must be reworked when two-digit
6957 # subversions come along, so that 5.7.10 compares as greater than
6958 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6959 # widespread that we can use the built-in version vectors rather
6960 # than reinventing them here.  For 5.6.0, however, we must
6961 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6962 foreach $d (@candidates) {
6963     if ($d lt $version) {
6964         if ($d ge $api_versionstring) {
6965             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6966         }
6967         elsif ($d ge "5.005") {
6968             unshift(@inc_version_list, grep { -d } $d);
6969         }
6970     }
6971     else {
6972         # Skip newer version.  I.e. don't look in
6973         # 5.7.0 if we're installing 5.6.1.
6974     }
6975 }
6976
6977 if (@inc_version_list) {
6978     print join(' ', @inc_version_list);
6979 }
6980 else {
6981     # Blank space to preserve value for next Configure run.
6982     print " ";
6983 }
6984 EOPL
6985 chmod +x getverlist
6986 case "$inc_version_list" in
6987 '')     if test -x "$perl5$exe_ext"; then
6988                 dflt=`$perl5 getverlist`
6989         else
6990                 dflt='none'
6991         fi
6992         ;;
6993 $undef) dflt='none' ;;
6994 *)  eval dflt=\"$inc_version_list\" ;;
6995 esac
6996 case "$dflt" in
6997 ''|' ') dflt=none ;;
6998 esac
6999 case "$dflt" in
7000 5.005) case "$bincompat5005" in
7001        $define|true|[yY]*) ;;
7002        *) dflt=none ;;
7003        esac
7004        ;;
7005 esac
7006 $cat <<'EOM'
7007
7008 In order to ease the process of upgrading, this version of perl 
7009 can be configured to use modules built and installed with earlier 
7010 versions of perl that were installed under $prefix.  Specify here
7011 the list of earlier versions that this version of perl should check.
7012 If Configure detected no earlier versions of perl installed under
7013 $prefix, then the list will be empty.  Answer 'none' to tell perl
7014 to not search earlier versions.
7015
7016 The default should almost always be sensible, so if you're not sure,
7017 just accept the default.
7018 EOM
7019
7020 rp='List of earlier versions to include in @INC?'
7021 . ./myread
7022 case "$ans" in
7023 [Nn]one|''|' ') inc_version_list=' ' ;;
7024 *) inc_version_list="$ans" ;;
7025 esac
7026 case "$inc_version_list" in
7027 ''|' ') 
7028         inc_version_list_init='0';;
7029 *)      inc_version_list_init=`echo $inc_version_list |
7030                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7031         ;;
7032 esac
7033 $rm -f getverlist
7034
7035 : determine whether to install perl also as /usr/bin/perl
7036
7037 echo " "
7038 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7039         $cat <<EOM
7040 Many scripts expect perl to be installed as /usr/bin/perl.
7041 I can install the perl you are about to compile also as /usr/bin/perl
7042 (in addition to $installbin/perl).
7043 EOM
7044         case "$installusrbinperl" in
7045         "$undef"|[nN]*) dflt='n';;
7046         *)              dflt='y';;
7047         esac
7048         rp="Do you want to install perl as /usr/bin/perl?"
7049         . ./myread
7050         case "$ans" in
7051         [yY]*)  val="$define";;
7052         *)      val="$undef" ;;
7053         esac
7054 else
7055         val="$undef"
7056 fi
7057 set installusrbinperl
7058 eval $setvar
7059
7060 : see if dld is available
7061 set dld.h i_dld
7062 eval $inhdr
7063
7064 : see if dlopen exists
7065 xxx_runnm="$runnm"
7066 runnm=false
7067 set dlopen d_dlopen
7068 eval $inlibc
7069 runnm="$xxx_runnm"
7070
7071 : determine which dynamic loading, if any, to compile in
7072 echo " "
7073 dldir="ext/DynaLoader"
7074 case "$usedl" in
7075 $define|y|true)
7076         dflt='y'
7077         usedl="$define"
7078         ;;
7079 $undef|n|false)
7080         dflt='n'
7081         usedl="$undef"
7082         ;;
7083 *) 
7084         dflt='n'
7085         case "$d_dlopen" in
7086             $define) dflt='y' ;;
7087         esac
7088         case "$i_dld" in
7089             $define) dflt='y' ;;
7090         esac
7091         : Does a dl_xxx.xs file exist for this operating system
7092         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7093         ;;
7094 esac
7095 rp="Do you wish to use dynamic loading?"
7096 . ./myread
7097 usedl="$ans"
7098 case "$ans" in
7099 y*) usedl="$define"
7100         case "$dlsrc" in
7101         '')
7102                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7103                         dflt="$dldir/dl_${osname}.xs"
7104                 elif $test "$d_dlopen" = "$define" ; then
7105                         dflt="$dldir/dl_dlopen.xs"
7106                 elif $test "$i_dld" = "$define" ; then
7107                         dflt="$dldir/dl_dld.xs"
7108                 else
7109                         dflt=''
7110                 fi
7111                 ;;
7112         *)      dflt="$dldir/$dlsrc"
7113                 ;;
7114         esac
7115     echo "The following dynamic loading files are available:"
7116         : Can not go over to $dldir because getfile has path hard-coded in.
7117         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7118         rp="Source file to use for dynamic loading"
7119         fn="fne"
7120         gfpth="$src"
7121         . ./getfile
7122         usedl="$define"
7123         : emulate basename
7124         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7125
7126         $cat << EOM
7127
7128 Some systems may require passing special flags to $cc -c to
7129 compile modules that will be used to create a shared library.
7130 To use no flags, say "none".
7131
7132 EOM
7133     case "$cccdlflags" in
7134     '') case "$gccversion" in
7135                 '') case "$osname" in
7136                         hpux)   dflt='+z' ;;
7137                         next)   dflt='none' ;;
7138                         irix*)  dflt='-KPIC' ;;
7139                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7140                         sunos)  dflt='-pic' ;;
7141                         *)      dflt='none' ;;
7142                     esac
7143                         ;;
7144                 *)  case "$osname" in
7145                         darwin) dflt='none' ;;
7146                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7147                         *)      dflt='-fpic' ;;
7148                     esac ;;
7149             esac ;;
7150         ' ') dflt='none' ;;
7151     *)  dflt="$cccdlflags" ;;
7152     esac
7153     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7154     . ./myread
7155     case "$ans" in
7156     none) cccdlflags=' ' ;;
7157     *) cccdlflags="$ans" ;;
7158     esac
7159
7160     cat << EOM
7161
7162 Some systems use ld to create libraries that can be dynamically loaded,
7163 while other systems (such as those using ELF) use $cc.
7164
7165 EOM
7166         case "$ld" in
7167         '')     $cat >try.c <<'EOM'
7168 /* Test for whether ELF binaries are produced */
7169 #include <fcntl.h>
7170 #include <stdlib.h>
7171 int main() {
7172         char b[4];
7173         int i = open("a.out",O_RDONLY);
7174         if(i == -1) 
7175                 exit(1); /* fail */
7176         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7177                 exit(0); /* succeed (yes, it's ELF) */
7178         else
7179                 exit(1); /* fail */
7180 }
7181 EOM
7182                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7183                         cat <<EOM
7184 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7185 EOM
7186                         dflt="$cc"
7187                 else
7188                         echo "I'll use ld to build dynamic libraries."
7189                         dflt='ld'
7190                 fi
7191                 rm -f try.c a.out
7192                 ;;
7193         *)      dflt="$ld"
7194                 ;;
7195         esac
7196
7197     rp="What command should be used to create dynamic libraries?"
7198     . ./myread
7199         ld="$ans"
7200
7201     cat << EOM
7202
7203 Some systems may require passing special flags to $ld to create a
7204 library that can be dynamically loaded.  If your ld flags include
7205 -L/other/path options to locate libraries outside your loader's normal
7206 search path, you may need to specify those -L options here as well.  To
7207 use no flags, say "none".
7208
7209 EOM
7210     case "$lddlflags" in
7211     '') case "$osname" in
7212                         beos) dflt='-nostart' ;;
7213                         hpux) dflt='-b';
7214                               case "$gccversion" in
7215                               '') dflt="$dflt +vnocompatwarnings" ;;
7216                               esac
7217                               ;;        
7218                         linux|irix*)    dflt='-shared' ;;
7219                         next)  dflt='none' ;;
7220                         solaris) dflt='-G' ;;
7221                         sunos) dflt='-assert nodefinitions' ;;
7222                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7223                 *)     dflt='none' ;;
7224                         esac
7225                         ;;
7226     *) dflt="$lddlflags" ;;
7227     esac
7228
7229         : Try to guess additional flags to pick up local libraries.
7230         : Be careful not to append to a plain 'none'
7231         case "$dflt" in
7232         none) dflt='' ;;
7233         esac
7234         for thisflag in $ldflags; do
7235                 case "$thisflag" in
7236                 -L*|-R*|-Wl,-R*)
7237                         case " $dflt " in
7238                         *" $thisflag "*) ;;
7239                         *) dflt="$dflt $thisflag" ;;
7240                         esac
7241                         ;;
7242                 esac
7243         done
7244
7245         case "$dflt" in
7246         ''|' ') dflt='none' ;;
7247         esac
7248
7249     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7250     . ./myread
7251     case "$ans" in
7252     none) lddlflags=' ' ;;
7253     *) lddlflags="$ans" ;;
7254     esac
7255
7256         cat <<EOM
7257
7258 Some systems may require passing special flags to $cc to indicate that
7259 the resulting executable will use dynamic linking.  To use no flags,
7260 say "none".
7261
7262 EOM
7263     case "$ccdlflags" in
7264     '') case "$osname" in
7265                 hpux)   dflt='-Wl,-E' ;;
7266                 linux)  dflt='-rdynamic' ;;
7267                 next)   dflt='none' ;;
7268                 sunos)  dflt='none' ;;
7269                 *)      dflt='none' ;;
7270             esac ;;
7271     ' ')  dflt='none' ;;
7272     *)  dflt="$ccdlflags" ;;
7273     esac
7274     rp="Any special flags to pass to $cc to use dynamic linking?"
7275     . ./myread
7276     case "$ans" in
7277     none) ccdlflags=' ' ;;
7278     *) ccdlflags="$ans" ;;
7279     esac
7280     ;;
7281 *)  usedl="$undef"
7282         ld='ld'
7283     dlsrc='dl_none.xs'
7284     lddlflags=''
7285     ccdlflags=''
7286     ;;
7287 esac
7288
7289 also=''
7290 case "$usedl" in
7291 $undef)
7292         # No dynamic loading being used, so don't bother even to prompt.
7293         useshrplib='false'
7294         ;;
7295 *)      case "$useshrplib" in
7296         '')     case "$osname" in
7297                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7298                         dflt=y
7299                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7300                         ;;
7301                 next*)
7302                         case "$osvers" in
7303                         4*)     dflt=y
7304                                 also='Building a shared libperl is needed for MAB support.'
7305                                 ;;
7306                         *)      dflt=n
7307                                 ;;
7308                         esac
7309                         ;;
7310                 *)      dflt=n
7311                         ;;
7312                 esac
7313                 ;;
7314         $define|true|[Yy]*)
7315                 dflt=y
7316                 ;;
7317         *)      dflt=n
7318                 ;;
7319         esac
7320         $cat << EOM
7321
7322 The perl executable is normally obtained by linking perlmain.c with
7323 libperl${_a}, any static extensions (usually just DynaLoader), and
7324 any other libraries needed on this system (such as -lm, etc.).  Since
7325 your system supports dynamic loading, it is probably possible to build
7326 a shared libperl.$so.  If you will have more than one executable linked
7327 to libperl.$so, this will significantly reduce the size of each
7328 executable, but it may have a noticeable affect on performance.  The
7329 default is probably sensible for your system.
7330 $also
7331
7332 EOM
7333         rp="Build a shared libperl.$so (y/n)"
7334         . ./myread
7335         case "$ans" in
7336         true|$define|[Yy]*)
7337                 useshrplib='true'  ;;
7338         *)      useshrplib='false' ;;
7339         esac
7340         ;;
7341 esac
7342
7343 case "$useshrplib" in
7344 true)
7345         case "$libperl" in
7346         '')
7347                 # Figure out a good name for libperl.so.  Since it gets stored in
7348                 # a version-specific architecture-dependent library, the version
7349                 # number isn't really that important, except for making cc/ld happy.
7350                 #
7351                 # A name such as libperl.so.3.1
7352                 majmin="libperl.$so.$patchlevel.$subversion"
7353                 # A name such as libperl.so.301
7354                 majonly=`echo $patchlevel $subversion |
7355                         $awk '{printf "%d%02d", $1, $2}'`
7356                 majonly=libperl.$so.$majonly
7357                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7358                 # rely on figuring it out from the naming of libc.
7359                 case "${osname}${osvers}" in
7360                 next4*)
7361                         dflt=libperl.5.$so
7362                         # XXX How handle the --version stuff for MAB?
7363                         ;;
7364                 linux*)  # ld won't link with a bare -lperl otherwise.
7365                         dflt=libperl.$so
7366                         ;;
7367                 cygwin*) # include version
7368                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7369                         ;;
7370                 *)      # Try to guess based on whether libc has major.minor.
7371                         case "$libc" in
7372                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7373                         *libc.$so.[0-9]*) dflt=$majonly ;;
7374                         *)      dflt=libperl.$so ;;
7375                         esac
7376                         ;;
7377                 esac
7378                 ;;
7379         *)      dflt=$libperl
7380                 ;;
7381         esac
7382         cat << EOM
7383
7384 I need to select a good name for the shared libperl.  If your system uses
7385 library names with major and minor numbers, then you might want something
7386 like $majmin.  Alternatively, if your system uses a single version
7387 number for shared libraries, then you might want to use $majonly.
7388 Or, your system might be quite happy with a simple libperl.$so.
7389
7390 Since the shared libperl will get installed into a version-specific
7391 architecture-dependent directory, the version number of the shared perl
7392 library probably isn't important, so the default should be o.k.
7393
7394 EOM
7395         rp='What name do you want to give to the shared libperl?'
7396         . ./myread
7397         libperl=$ans
7398         echo "Ok, I'll use $libperl"
7399         ;;
7400 *)
7401         libperl="libperl${_a}"
7402         ;;
7403 esac
7404
7405 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7406 case "$shrpdir" in
7407 '') ;;
7408 *)      $cat >&4 <<EOM
7409 WARNING:  Use of the shrpdir variable for the installation location of
7410 the shared $libperl is not supported.  It was never documented and
7411 will not work in this version.  Let me (perlbug@perl.org)
7412 know of any problems this may cause.
7413
7414 EOM
7415         case "$shrpdir" in
7416         "$archlibexp/CORE")
7417                 $cat >&4 <<EOM
7418 But your current setting of $shrpdir is
7419 the default anyway, so it's harmless.
7420 EOM
7421                 ;;
7422         *)
7423                 $cat >&4 <<EOM
7424 Further, your current attempted setting of $shrpdir
7425 conflicts with the value of $archlibexp/CORE
7426 that installperl will use.
7427 EOM
7428                 ;;
7429         esac
7430         ;;
7431 esac
7432
7433 # How will the perl executable find the installed shared $libperl?
7434 # Add $xxx to ccdlflags.
7435 # If we can't figure out a command-line option, use $shrpenv to
7436 # set env LD_RUN_PATH.  The main perl makefile uses this.
7437 shrpdir=$archlibexp/CORE
7438 xxx=''
7439 tmp_shrpenv=''
7440 if "$useshrplib"; then
7441     case "$osname" in 
7442         aix)
7443                 # We'll set it in Makefile.SH...
7444                 ;;
7445         solaris)
7446                 xxx="-R $shrpdir"
7447                 ;;
7448         freebsd|netbsd)
7449                 xxx="-Wl,-R$shrpdir"
7450                 ;;
7451         linux|irix*|dec_osf)
7452                 xxx="-Wl,-rpath,$shrpdir"
7453                 ;;
7454         next)
7455                 # next doesn't like the default...
7456                 ;;
7457         beos)
7458                 # beos doesn't like the default, either.
7459                 ;;
7460         hpux*)
7461                 # hpux doesn't like the default, either.
7462                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7463                 ;;
7464         *)
7465                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7466                 ;;
7467         esac
7468         case "$xxx" in
7469         '') ;;
7470         *)      
7471                 # Only add $xxx if it isn't already in ccdlflags.
7472                 case " $ccdlflags " in
7473                 *" $xxx "*)     ;;
7474                 *)      ccdlflags="$ccdlflags $xxx"
7475                         cat <<EOM >&4
7476
7477 Adding $xxx to the flags
7478 passed to $ld so that the perl executable will find the 
7479 installed shared $libperl.
7480
7481 EOM
7482                         ;;
7483                 esac
7484                 ;;
7485         esac
7486 fi
7487 # Fix ccdlflags in AIX for building external extensions.
7488 # (For building Perl itself bare -bE:perl.exp is needed,
7489 #  Makefile.SH takes care of this.)
7490 case "$osname" in
7491 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7492 esac
7493 # Respect a hint or command-line value.
7494 case "$shrpenv" in
7495 '') shrpenv="$tmp_shrpenv" ;;
7496 esac
7497 case "$ldlibpthname" in
7498 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7499 none)   ldlibpthname='' ;;
7500 esac
7501
7502 : determine where manual pages are on this system
7503 echo " "
7504 case "$sysman" in
7505 '') 
7506         syspath='/usr/share/man/man1 /usr/man/man1'
7507         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7508         syspath="$syspath /usr/man/u_man/man1"
7509         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7510         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7511         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7512         sysman=`./loc . /usr/man/man1 $syspath`
7513         ;;
7514 esac
7515 if $test -d "$sysman"; then
7516         echo "System manual is in $sysman." >&4
7517 else
7518         echo "Could not find manual pages in source form." >&4
7519 fi
7520
7521 : determine where manual pages go
7522 set man1dir man1dir none
7523 eval $prefixit
7524 $cat <<EOM
7525
7526 $spackage has manual pages available in source form.
7527 EOM
7528 case "$nroff" in
7529 nroff)
7530         echo "However, you don't have nroff, so they're probably useless to you."
7531         case "$man1dir" in
7532         '') man1dir="none";;
7533         esac;;
7534 esac
7535 echo "If you don't want the manual sources installed, answer 'none'."
7536 case "$man1dir" in
7537 ' ') dflt=none
7538         ;;
7539 '')
7540         lookpath="$prefixexp/share/man/man1"
7541         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7542         lookpath="$lookpath $prefixexp/man/p_man/man1"
7543         lookpath="$lookpath $prefixexp/man/u_man/man1"
7544         lookpath="$lookpath $prefixexp/man/man.1"
7545         case "$sysman" in
7546         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7547         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7548         esac
7549         set dflt
7550         eval $prefixup
7551         ;;
7552 *)  dflt="$man1dir"
7553         ;;
7554 esac
7555 echo " "
7556 fn=dn+~
7557 rp="Where do the main $spackage manual pages (source) go?"
7558 . ./getfile
7559 if $test "X$man1direxp" != "X$ansexp"; then
7560         installman1dir=''
7561 fi
7562 man1dir="$ans"
7563 man1direxp="$ansexp"
7564 case "$man1dir" in
7565 '')     man1dir=' '
7566         installman1dir='';;
7567 esac
7568
7569 : Change installation prefix, if necessary.
7570 if $test X"$prefix" != X"$installprefix"; then
7571         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7572 else
7573         installman1dir="$man1direxp"
7574 fi
7575
7576 : What suffix to use on installed man pages
7577
7578 case "$man1dir" in
7579 ' ')
7580         man1ext='0'
7581         ;;
7582 *)
7583         rp="What suffix should be used for the main $spackage man pages?"
7584         case "$man1ext" in
7585         '')     case "$man1dir" in
7586                 *1)  dflt=1 ;;
7587                 *1p) dflt=1p ;;
7588                 *1pm) dflt=1pm ;;
7589                 *l) dflt=l;;
7590                 *n) dflt=n;;
7591                 *o) dflt=o;;
7592                 *p) dflt=p;;
7593                 *C) dflt=C;;
7594                 *L) dflt=L;;
7595                 *L1) dflt=L1;;
7596                 *) dflt=1;;
7597                 esac
7598                 ;;
7599         *)      dflt="$man1ext";;
7600         esac
7601         . ./myread
7602         man1ext="$ans"
7603         ;;
7604 esac
7605
7606 : see if we can have long filenames
7607 echo " "
7608 first=123456789abcdef
7609 $rm -f $first
7610 if (echo hi >$first) 2>/dev/null; then
7611         if $test -f 123456789abcde; then
7612                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7613                 val="$undef"
7614         else
7615                 echo 'You can have filenames longer than 14 characters.'>&4
7616                 val="$define"
7617         fi
7618 else
7619         $cat <<'EOM'
7620 You can't have filenames longer than 14 chars.
7621 You can't even think about them!
7622 EOM
7623         val="$undef"
7624 fi 
7625 set d_flexfnam
7626 eval $setvar
7627 $rm -rf 123456789abcde*
7628
7629 : determine where library module manual pages go
7630 set man3dir man3dir none
7631 eval $prefixit
7632 $cat <<EOM
7633
7634 $spackage has manual pages for many of the library modules.
7635 EOM
7636
7637 case "$nroff" in
7638 nroff)
7639         $cat <<'EOM'
7640 However, you don't have nroff, so they're probably useless to you.
7641 EOM
7642         case "$man3dir" in
7643         '') man3dir="none";;
7644         esac;;
7645 esac
7646
7647 case "$d_flexfnam" in
7648 undef)
7649         $cat <<'EOM'
7650 However, your system can't handle the long file names like File::Basename.3. 
7651 EOM
7652         case "$man3dir" in
7653         '') man3dir="none";;
7654         esac;;
7655 esac
7656
7657 echo "If you don't want the manual sources installed, answer 'none'."
7658 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7659 case "$man3dir" in
7660 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7661         if $test -d "$privlib/man/man3"; then
7662                 cat <<EOM >&4
7663
7664 WARNING:  Previous versions of perl installed man3 pages into
7665 $privlib/man/man3.  This version will suggest a 
7666 new default of $dflt.  
7667 EOM
7668                 tdflt=$dflt
7669                 dflt='n'
7670                 rp='Do you wish to preserve the old behavior?(y/n)'
7671                 . ./myread
7672                 case "$ans" in
7673                 y*) dflt="$privlib/man/man3" ;;
7674                 *)  dflt=$tdflt ;;
7675                 esac
7676     fi
7677         ;;
7678 *)      dflt="$man3dir" ;;
7679 esac
7680 case "$dflt" in
7681 ' ') dflt=none ;;
7682 esac
7683 echo " "
7684 fn=dn+~
7685 rp="Where do the $package library man pages (source) go?"
7686 . ./getfile
7687 man3dir="$ans"
7688 man3direxp="$ansexp"
7689 case "$man3dir" in
7690 '')     man3dir=' '
7691         installman3dir='';;
7692 esac
7693
7694 : Change installation prefix, if necessary.
7695 if $test X"$prefix" != X"$installprefix"; then
7696         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7697 else
7698         installman3dir="$man3direxp"
7699 fi
7700
7701 : What suffix to use on installed man pages
7702 case "$man3dir" in
7703 ' ')
7704         man3ext='0'
7705         ;;
7706 *)
7707         rp="What suffix should be used for the $package library man pages?"
7708         case "$man3ext" in
7709         '')     case "$man3dir" in
7710                 *3)  dflt=3 ;;
7711                 *3p) dflt=3p ;;
7712                 *3pm) dflt=3pm ;;
7713                 *l) dflt=l;;
7714                 *n) dflt=n;;
7715                 *o) dflt=o;;
7716                 *p) dflt=p;;
7717                 *C) dflt=C;;
7718                 *L) dflt=L;;
7719                 *L3) dflt=L3;;
7720                 *) dflt=3;;
7721                 esac
7722                 ;;
7723         *)      dflt="$man3ext";;
7724         esac
7725         . ./myread
7726         man3ext="$ans"
7727         ;;
7728 esac
7729
7730 : see if we have to deal with yellow pages, now NIS.
7731 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
7732         if $test -f /usr/etc/nibindd; then
7733                 echo " "
7734                 echo "I'm fairly confident you're on a NeXT."
7735                 echo " "
7736                 rp='Do you get the hosts file via NetInfo?'
7737                 dflt=y
7738                 case "$hostcat" in
7739                 nidump*) ;;
7740                 '') ;;
7741                 *) dflt=n;;
7742                 esac
7743                 . ./myread
7744                 case "$ans" in
7745                 y*) hostcat='nidump hosts .';;
7746                 *)      case "$hostcat" in
7747                         nidump*) hostcat='';;
7748                         esac
7749                         ;;
7750                 esac
7751         fi
7752         case "$hostcat" in
7753         nidump*) ;;
7754         *)
7755                 case "$hostcat" in
7756                 *ypcat*) dflt=y;;
7757                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7758                                 dflt=y
7759                         else
7760                                 dflt=n
7761                         fi;;
7762                 *) dflt=n;;
7763                 esac
7764                 echo " "
7765                 rp='Are you getting the hosts file via yellow pages?'
7766                 . ./myread
7767                 case "$ans" in
7768                 y*) hostcat='ypcat hosts';;
7769                 *) hostcat='cat /etc/hosts';;
7770                 esac
7771                 ;;
7772         esac
7773 fi
7774 case "$hostcat" in
7775 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7776 esac
7777 case "$groupcat" in
7778 '') test -f /etc/group && groupcat='cat /etc/group';;
7779 esac
7780 case "$passcat" in
7781 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7782 esac
7783
7784 : now get the host name
7785 echo " "
7786 echo "Figuring out host name..." >&4
7787 case "$myhostname" in
7788 '') cont=true
7789         echo 'Maybe "hostname" will work...'
7790         if tans=`sh -c hostname 2>&1` ; then
7791                 myhostname=$tans
7792                 phostname=hostname
7793                 cont=''
7794         fi
7795         ;;
7796 *) cont='';;
7797 esac
7798 if $test "$cont"; then
7799         if ./xenix; then
7800                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7801                 if tans=`cat /etc/systemid 2>&1` ; then
7802                         myhostname=$tans
7803                         phostname='cat /etc/systemid'
7804                         echo "Whadyaknow.  Xenix always was a bit strange..."
7805                         cont=''
7806                 fi
7807         elif $test -r /etc/systemid; then
7808                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7809         fi
7810 fi
7811 if $test "$cont"; then
7812         echo 'No, maybe "uuname -l" will work...'
7813         if tans=`sh -c 'uuname -l' 2>&1` ; then
7814                 myhostname=$tans
7815                 phostname='uuname -l'
7816         else
7817                 echo 'Strange.  Maybe "uname -n" will work...'
7818                 if tans=`sh -c 'uname -n' 2>&1` ; then
7819                         myhostname=$tans
7820                         phostname='uname -n'
7821                 else
7822                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7823                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7824                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7825                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7826                         else
7827                                 case "$myhostname" in
7828                                 '') echo "Does this machine have an identity crisis or something?"
7829                                         phostname='';;
7830                                 *)
7831                                         echo "Well, you said $myhostname before..."
7832                                         phostname='echo $myhostname';;
7833                                 esac
7834                         fi
7835                 fi
7836         fi
7837 fi
7838 : you do not want to know about this
7839 set $myhostname
7840 myhostname=$1
7841
7842 : verify guess
7843 if $test "$myhostname" ; then
7844         dflt=y
7845         rp='Your host name appears to be "'$myhostname'".'" Right?"
7846         . ./myread
7847         case "$ans" in
7848         y*) ;;
7849         *) myhostname='';;
7850         esac
7851 fi
7852
7853 : bad guess or no guess
7854 while $test "X$myhostname" = X ; do
7855         dflt=''
7856         rp="Please type the (one word) name of your host:"
7857         . ./myread
7858         myhostname="$ans"
7859 done
7860
7861 : translate upper to lower if necessary
7862 case "$myhostname" in
7863 *[A-Z]*)
7864         echo "(Normalizing case in your host name)"
7865         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7866         ;;
7867 esac
7868
7869 case "$myhostname" in
7870 *.*)
7871         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7872         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7873         echo "(Trimming domain name from host name--host name is now $myhostname)"
7874         ;;
7875 *) case "$mydomain" in
7876         '')
7877                 {
7878                         test "X$hostcat" = "Xypcat hosts" &&
7879                         ypmatch "$myhostname" hosts 2>/dev/null |\
7880                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7881                         $test -s hosts
7882                 } || {
7883                         test "X$hostcat" != "X" &&
7884                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7885                                         /[       ]$myhostname[  . ]/p" > hosts
7886                 }
7887                 tmp_re="[       . ]"
7888                 if $test -f hosts; then
7889                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7890                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7891                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7892                                 hosts | $sort | $uniq | \
7893                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7894                         case `$echo X$dflt` in
7895                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7896                                 dflt=.
7897                                 ;;
7898                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7899                                 ;;
7900                         esac
7901                 else
7902                         echo "(I cannot locate a hosts database anywhere)"
7903                         dflt=.
7904                 fi
7905                 case "$dflt" in
7906                 .)
7907                         tans=`./loc resolv.conf X /etc /usr/etc`
7908                         if $test -f "$tans"; then
7909                                 echo "(Attempting domain name extraction from $tans)"
7910                                 dflt=.`$sed -n -e 's/   / /g' \
7911                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7912                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7913                                 case "$dflt" in
7914                                 .) dflt=.`$sed -n -e 's/        / /g' \
7915                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7916                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7917                                         ;;
7918                                 esac
7919                         fi
7920                         ;;
7921                 esac
7922                 case "$dflt" in
7923                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7924                         dflt=.`sh -c domainname 2>/dev/null`
7925                         case "$dflt" in
7926                         '') dflt='.';;
7927                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7928                         esac
7929                         ;;
7930                 esac
7931                 case "$dflt$osname" in
7932                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7933                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7934                         ;;
7935                 esac
7936                 case "$dflt" in
7937                 .) echo "(Lost all hope -- silly guess then)"
7938                         dflt='.uucp'
7939                         ;;
7940                 esac
7941                 $rm -f hosts
7942                 ;;
7943         *) dflt="$mydomain";;
7944         esac;;
7945 esac
7946 echo " "
7947 rp="What is your domain name?"
7948 . ./myread
7949 tans="$ans"
7950 case "$ans" in
7951 '') ;;
7952 .*) ;;
7953 *) tans=".$tans";;
7954 esac
7955 mydomain="$tans"
7956
7957 : translate upper to lower if necessary
7958 case "$mydomain" in
7959 *[A-Z]*)
7960         echo "(Normalizing case in your domain name)"
7961         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7962         ;;
7963 esac
7964
7965 : a little sanity check here
7966 case "$phostname" in
7967 '') ;;
7968 *)
7969         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7970         $myhostname$mydomain|$myhostname) ;;
7971         *)
7972                 case "$phostname" in
7973                 sed*)
7974                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7975                         ;;
7976                 *)
7977                         echo "(That doesn't agree with your $phostname command, by the way.)"
7978                         ;;
7979                 esac
7980         ;;
7981         esac
7982         ;;
7983 esac
7984
7985 $cat <<EOM
7986
7987 I need to get your e-mail address in Internet format if possible, i.e.
7988 something like user@host.domain. Please answer accurately since I have
7989 no easy means to double check it. The default value provided below
7990 is most probably close to reality but may not be valid from outside
7991 your organization...
7992
7993 EOM
7994 cont=x
7995 while test "$cont"; do
7996         case "$cf_email" in
7997         '') dflt="$cf_by@$myhostname$mydomain";;
7998         *) dflt="$cf_email";;
7999         esac
8000         rp='What is your e-mail address?'
8001         . ./myread
8002         cf_email="$ans"
8003         case "$cf_email" in
8004         *@*.*) cont='' ;;
8005         *)
8006                 rp='Address does not look like an Internet one.  Use it anyway?'
8007                 case "$fastread" in
8008                 yes) dflt=y ;;
8009                 *) dflt=n ;;
8010                 esac
8011                 . ./myread
8012                 case "$ans" in
8013                 y*) cont='' ;;
8014                 *) echo " " ;;
8015                 esac
8016                 ;;
8017         esac
8018 done
8019
8020 $cat <<EOM
8021
8022 If you or somebody else will be maintaining perl at your site, please
8023 fill in the correct e-mail address here so that they may be contacted
8024 if necessary. Currently, the "perlbug" program included with perl
8025 will send mail to this address in addition to perlbug@perl.org. You may
8026 enter "none" for no administrator.
8027
8028 EOM
8029 case "$perladmin" in
8030 '') dflt="$cf_email";;
8031 *) dflt="$perladmin";;
8032 esac
8033 rp='Perl administrator e-mail address'
8034 . ./myread
8035 perladmin="$ans"
8036
8037 : determine whether to only install version-specific parts.
8038 echo " "
8039 $cat <<EOM
8040 Do you want to install only the version-specific parts of the perl
8041 distribution?  Usually you do *not* want to do this.
8042 EOM
8043 case "$versiononly" in
8044 "$define"|[Yy]*|true) dflt='y' ;;
8045 *) dflt='n';
8046 esac
8047 rp="Do you want to install only the version-specific parts of perl?"
8048 . ./myread
8049 case "$ans" in
8050 [yY]*)  val="$define";;
8051 *)      val="$undef" ;;
8052 esac
8053 set versiononly
8054 eval $setvar
8055
8056 : figure out how to guarantee perl startup
8057 case "$startperl" in
8058 '')
8059         case "$sharpbang" in
8060         *!)
8061                 $cat <<EOH
8062
8063 I can use the #! construct to start perl on your system. This will
8064 make startup of perl scripts faster, but may cause problems if you
8065 want to share those scripts and perl is not in a standard place
8066 ($binexp/perl) on all your platforms. The alternative is to force
8067 a shell by starting the script with a single ':' character.
8068
8069 EOH
8070                 case "$versiononly" in
8071                 "$define")      dflt="$binexp/perl$version";;  
8072                 *)              dflt="$binexp/perl";;
8073                 esac
8074                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8075                 . ./myread
8076                 case "$ans" in
8077                 none)   startperl=": # use perl";;
8078                 *)      startperl="#!$ans"
8079                         if $test 30 -lt `echo "$ans" | wc -c`; then
8080                                 $cat >&4 <<EOM
8081
8082 WARNING:  Some systems limit the #! command to 32 characters.
8083 If you experience difficulty running Perl scripts with #!, try
8084 installing Perl in a directory with a shorter pathname.
8085
8086 EOM
8087                         fi ;;
8088                 esac
8089                 ;;
8090         *) startperl=": # use perl"
8091                 ;;
8092         esac
8093         ;;
8094 esac
8095 echo "I'll use $startperl to start perl scripts."
8096
8097 : figure best path for perl in scripts
8098 case "$perlpath" in
8099 '')
8100         case "$versiononly" in
8101         "$define")      perlpath="$binexp/perl$version";;
8102         *)              perlpath="$binexp/perl";;
8103         esac
8104         case "$startperl" in
8105         *!*) ;;
8106         *)
8107                 $cat <<EOH
8108
8109 I will use the "eval 'exec'" idiom to start Perl on your system.
8110 I can use the full path of your Perl binary for this purpose, but
8111 doing so may cause problems if you want to share those scripts and
8112 Perl is not always in a standard place ($binexp/perl).
8113
8114 EOH
8115                 dflt="$binexp/perl"
8116                 rp="What path shall I use in \"eval 'exec'\"?"
8117                 . ./myread
8118                 perlpath="$ans"
8119                 ;;
8120         esac
8121         ;;
8122 esac
8123 case "$startperl" in
8124 *!*)    ;;
8125 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8126 esac
8127
8128 : determine where public executable scripts go
8129 set scriptdir scriptdir
8130 eval $prefixit
8131 case "$scriptdir" in
8132 '')
8133         dflt="$bin"
8134         : guess some guesses
8135         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8136         $test -d /usr/share/bin     && dflt=/usr/share/bin
8137         $test -d /usr/local/script  && dflt=/usr/local/script
8138         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8139         $test -d $prefixexp/script  && dflt=$prefixexp/script
8140         set dflt
8141         eval $prefixup
8142         ;;
8143 *)  dflt="$scriptdir"
8144         ;;
8145 esac
8146 $cat <<EOM
8147  
8148 Some installations have a separate directory just for executable scripts so
8149 that they can mount it across multiple architectures but keep the scripts in
8150 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8151 Or you might just lump your scripts in with all your other executables.
8152  
8153 EOM
8154 fn=d~
8155 rp='Where do you keep publicly executable scripts?'
8156 . ./getfile
8157 if $test "X$ansexp" != "X$scriptdirexp"; then
8158         installscript=''
8159 fi
8160 scriptdir="$ans"
8161 scriptdirexp="$ansexp"
8162 : Change installation prefix, if necessary.
8163 if $test X"$prefix" != X"$installprefix"; then
8164         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8165 else
8166         installscript="$scriptdirexp"
8167 fi
8168
8169 : determine where add-on public executables go
8170 case "$sitebin" in
8171 '')     dflt=$siteprefix/bin ;;
8172 *)      dflt=$sitebin ;;
8173 esac
8174 fn=d~
8175 rp='Pathname where the add-on public executables should be installed?'
8176 . ./getfile
8177 sitebin="$ans"
8178 sitebinexp="$ansexp"
8179 : Change installation prefix, if necessary.
8180 if $test X"$prefix" != X"$installprefix"; then
8181         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8182 else
8183         installsitebin="$sitebinexp"
8184 fi
8185
8186 : define an is-a-typedef? function
8187 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8188 case "$inclist" in
8189 "") inclist="sys/types.h";;
8190 esac;
8191 eval "varval=\$$var";
8192 case "$varval" in
8193 "")
8194         $rm -f temp.c;
8195         for inc in $inclist; do
8196                 echo "#include <$inc>" >>temp.c;
8197         done;
8198         echo "#ifdef $type" >> temp.c;
8199         echo "printf(\"We have $type\");" >> temp.c;
8200         echo "#endif" >> temp.c;
8201         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8202         if $contains $type temp.E >/dev/null 2>&1; then
8203                 eval "$var=\$type";
8204         else
8205                 eval "$var=\$def";
8206         fi;
8207         $rm -f temp.?;;
8208 *) eval "$var=\$varval";;
8209 esac'
8210
8211 : define an is-a-typedef? function that prompts if the type is not available.
8212 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8213 case "$inclist" in
8214 "") inclist="sys/types.h";;
8215 esac;
8216 eval "varval=\$$var";
8217 case "$varval" in
8218 "")
8219         $rm -f temp.c;
8220         for inc in $inclist; do
8221                 echo "#include <$inc>" >>temp.c;
8222         done;
8223         echo "#ifdef $type" >> temp.c;
8224         echo "printf(\"We have $type\");" >> temp.c;
8225         echo "#endif" >> temp.c;
8226         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8227         echo " " ;
8228         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8229         if $contains $type temp.E >/dev/null 2>&1; then
8230                 echo "$type found." >&4;
8231                 eval "$var=\$type";
8232         else
8233                 echo "$type NOT found." >&4;
8234                 dflt="$def";
8235                 . ./myread ;
8236                 eval "$var=\$ans";
8237         fi;
8238         $rm -f temp.?;;
8239 *) eval "$var=\$varval";;
8240 esac'
8241
8242 : see what type lseek is declared as in the kernel
8243 rp="What is the type used for lseek's offset on this system?"
8244 set off_t lseektype long stdio.h sys/types.h
8245 eval $typedef_ask
8246
8247 echo " "
8248 echo "Checking to see how big your file offsets are..." >&4
8249 $cat >try.c <<EOCP
8250 #include <sys/types.h>
8251 #include <stdio.h>
8252 int main()
8253 {
8254     printf("%d\n", (int)sizeof($lseektype));
8255     return(0); 
8256 }
8257 EOCP
8258 set try
8259 if eval $compile_ok; then
8260         lseeksize=`$run ./try`
8261         echo "Your file offsets are $lseeksize bytes long."
8262 else
8263         dflt=$longsize
8264         echo " "
8265         echo "(I can't seem to compile the test program.  Guessing...)"
8266         rp="What is the size of your file offsets (in bytes)?"
8267         . ./myread
8268         lseeksize="$ans"
8269 fi
8270 $rm -f try.c try
8271
8272 : see what type file positions are declared as in the library
8273 rp="What is the type for file position used by fsetpos()?"
8274 set fpos_t fpostype long stdio.h sys/types.h
8275 eval $typedef_ask
8276
8277 echo " "
8278 case "$fpostype" in
8279 *_t) zzz="$fpostype"    ;;
8280 *)   zzz="fpos_t"       ;;
8281 esac
8282 echo "Checking the size of $zzz..." >&4 
8283 cat > try.c <<EOCP
8284 #include <sys/types.h>
8285 #include <stdio.h>
8286 int main() {
8287     printf("%d\n", (int)sizeof($fpostype));
8288     exit(0);
8289 }
8290 EOCP
8291 set try
8292 if eval $compile_ok; then
8293         yyy=`$run ./try`
8294         case "$yyy" in
8295         '')     fpossize=4
8296                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8297                 ;;
8298         *)      fpossize=$yyy
8299                 echo "Your $zzz is $fpossize bytes long."
8300                 ;;
8301         esac
8302 else
8303         dflt="$longsize"
8304         echo " " >&4
8305         echo "(I can't compile the test program.  Guessing...)" >&4
8306         rp="What is the size of your file positions (in bytes)?"
8307         . ./myread
8308         fpossize="$ans"
8309 fi
8310
8311
8312
8313 # Backward compatibility (uselfs is deprecated).
8314 case "$uselfs" in
8315 "$define"|true|[yY]*)
8316         cat <<EOM >&4
8317
8318 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8319 EOM
8320         uselargefiles="$define"
8321         ;;
8322 esac                          
8323
8324 case "$lseeksize:$fpossize" in
8325 8:8) cat <<EOM
8326
8327 You can have files larger than 2 gigabytes.
8328 EOM
8329    val="$define" ;;
8330 *)    case "$uselargefiles" in
8331    "$undef"|false|[nN]*) dflt='n' ;;
8332    *)   dflt='y' ;;
8333    esac
8334    cat <<EOM
8335
8336 Perl can be built to understand large files (files larger than 2 gigabytes)
8337 on some systems.  To do so, Configure can be run with -Duselargefiles.
8338
8339 If this doesn't make any sense to you, just accept the default '$dflt'.
8340 EOM
8341    rp='Try to understand large files, if available?'
8342    . ./myread
8343    case "$ans" in
8344    y|Y)         val="$define" ;;
8345    *)           val="$undef"  ;;
8346    esac
8347    ;;
8348 esac
8349 set uselargefiles
8350 eval $setvar
8351 case "$uselargefiles" in
8352 "$define")
8353 : Look for a hint-file generated 'call-back-unit'.  If the
8354 : user has specified that a large files perl is to be built,
8355 : we may need to set or change some other defaults.
8356         if $test -f uselargefiles.cbu; then
8357                 echo "Your platform has some specific hints for large file builds, using them..."
8358                 . ./uselargefiles.cbu
8359                 echo " "
8360                 echo "Rechecking to see how big your file offsets are..." >&4
8361                 $cat >try.c <<EOCP
8362 #include <sys/types.h>
8363 #include <stdio.h>
8364 int main()
8365 {
8366     printf("%d\n", (int)sizeof($lseektype));
8367     return(0); 
8368 }
8369 EOCP
8370                 set try
8371                 if eval $compile_ok; then
8372                         lseeksize=`$run ./try`
8373                         $echo "Your file offsets are now $lseeksize bytes long."
8374                 else
8375                         dflt="$lseeksize"
8376                         echo " "
8377                         echo "(I can't seem to compile the test program.  Guessing...)"
8378                         rp="What is the size of your file offsets (in bytes)?"
8379                         . ./myread
8380                         lseeksize="$ans"
8381                 fi
8382                 case "$fpostype" in
8383                 *_t) zzz="$fpostype"    ;;
8384                 *)   zzz="fpos_t"       ;;
8385                 esac
8386                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8387                 $cat > try.c <<EOCP
8388 #include <sys/types.h>
8389 #include <stdio.h>
8390 int main() {
8391     printf("%d\n", (int)sizeof($fpostype));
8392     exit(0);
8393 }
8394 EOCP
8395                 set try
8396                 if eval $compile_ok; then
8397                         yyy=`$run ./try`
8398                         dflt="$lseeksize"
8399                         case "$yyy" in
8400                         '')     echo " "
8401                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8402                                 ;;
8403                         *)      fpossize=$yyy
8404                                 echo " $fpossize bytes." >&4
8405                                 ;;
8406                         esac
8407                 else
8408                         dflt="$fpossize"
8409                         echo " "
8410                         echo "(I can't compile the test program.  Guessing...)" >&4
8411                         rp="What is the size of your file positions (in bytes)?"
8412                         . ./myread
8413                         fpossize="$ans"
8414                 fi
8415                 $rm -f try.c try
8416         fi
8417         ;;
8418 esac
8419
8420 case "$vendorprefix" in
8421 '')     d_vendorbin="$undef"
8422         vendorbin=''
8423         vendorbinexp=''
8424         ;;
8425 *)      d_vendorbin="$define"
8426         : determine where vendor-supplied executables go.
8427         case "$vendorbin" in
8428         '') dflt=$vendorprefix/bin ;;
8429         *)      dflt="$vendorbin" ;;
8430         esac
8431         fn=d~+
8432         rp='Pathname for the vendor-supplied executables directory?'
8433         . ./getfile
8434         vendorbin="$ans"
8435         vendorbinexp="$ansexp"
8436         ;;
8437 esac
8438 : Change installation prefix, if necessary.
8439 if $test X"$prefix" != X"$installprefix"; then
8440         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8441 else
8442         installvendorbin="$vendorbinexp"
8443 fi
8444
8445 : see if qgcvt exists
8446 set qgcvt d_qgcvt
8447 eval $inlibc
8448
8449 echo " "
8450
8451 if $test X"$d_longdbl" = X"$define"; then
8452
8453 echo "Checking how to print long doubles..." >&4
8454
8455 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8456         $cat >try.c <<'EOCP'
8457 #include <sys/types.h>
8458 #include <stdio.h>
8459 int main() {
8460   double d = 123.456;
8461   printf("%.3f\n", d);
8462 }
8463 EOCP
8464         set try
8465         if eval $compile; then
8466                 yyy=`$run ./try`
8467                 case "$yyy" in
8468                 123.456)
8469                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8470                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8471                         echo "We will use %f."
8472                         ;;
8473                 esac
8474         fi
8475 fi
8476
8477 if $test X"$sPRIfldbl" = X; then
8478         $cat >try.c <<'EOCP'
8479 #include <sys/types.h>
8480 #include <stdio.h>
8481 int main() {
8482   long double d = 123.456;
8483   printf("%.3Lf\n", d);
8484 }
8485 EOCP
8486         set try
8487         if eval $compile; then
8488                 yyy=`$run ./try`
8489                 case "$yyy" in
8490                 123.456)
8491                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8492                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8493                         echo "We will use %Lf."
8494                         ;;
8495                 esac
8496         fi
8497 fi
8498
8499 if $test X"$sPRIfldbl" = X; then
8500         $cat >try.c <<'EOCP'
8501 #include <sys/types.h>
8502 #include <stdio.h>
8503 int main() {
8504   long double d = 123.456;
8505   printf("%.3llf\n", d);
8506 }
8507 EOCP
8508         set try
8509         if eval $compile; then
8510                 yyy=`$run ./try`
8511                 case "$yyy" in
8512                 123.456)
8513                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8514                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8515                         echo "We will use %llf."
8516                         ;;
8517                 esac
8518         fi
8519 fi
8520
8521 if $test X"$sPRIfldbl" = X; then
8522         $cat >try.c <<'EOCP'
8523 #include <sys/types.h>
8524 #include <stdio.h>
8525 int main() {
8526   long double d = 123.456;
8527   printf("%.3lf\n", d);
8528 }
8529 EOCP
8530         set try
8531         if eval $compile; then
8532                 yyy=`$run ./try`
8533                 case "$yyy" in
8534                 123.456)
8535                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8536                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8537                         echo "We will use %lf."
8538                         ;;
8539                 esac
8540         fi
8541 fi
8542
8543 if $test X"$sPRIfldbl" = X; then
8544         echo "Cannot figure out how to print long doubles." >&4
8545 else
8546         sSCNfldbl=$sPRIfldbl    # expect consistency
8547 fi
8548
8549 $rm -f try try.*
8550
8551 fi # d_longdbl
8552
8553 case "$sPRIfldbl" in
8554 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8555         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8556         d_SCNfldbl="$undef";
8557         ;;
8558 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8559         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8560         d_SCNfldbl="$define";
8561         ;;
8562 esac
8563
8564 : Check how to convert floats to strings.
8565 echo " "
8566 echo "Checking for an efficient way to convert floats to strings."
8567 echo " " > try.c
8568 case "$uselongdouble" in
8569 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8570 esac
8571 case "$d_longdbl" in
8572 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8573 esac
8574 case "$d_PRIgldbl" in
8575 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8576 esac
8577 $cat >>try.c <<EOP
8578 #ifdef TRY_gconvert
8579 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8580 char *myname = "gconvert";
8581 #endif
8582 #ifdef TRY_gcvt
8583 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8584 char *myname = "gcvt";
8585 #endif
8586 #ifdef TRY_qgcvt
8587 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8588 char *myname = "qgcvt";
8589 #define DOUBLETYPE long double
8590 #endif
8591 #ifdef TRY_sprintf
8592 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8593 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8594 #else
8595 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8596 #endif
8597 char *myname = "sprintf";
8598 #endif
8599
8600 #ifndef DOUBLETYPE
8601 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8602 #define DOUBLETYPE long double
8603 #else
8604 #define DOUBLETYPE double
8605 #endif
8606 #endif
8607
8608 #include <stdio.h>
8609
8610 #define I_STDLIB $i_stdlib
8611 #ifdef I_STDLIB
8612 #include <stdlib.h>
8613 #endif
8614
8615 int
8616 checkit(expect, got)
8617 char *expect;
8618 char *got;
8619 {
8620     if (strcmp(expect, got)) {
8621                 printf("%s oddity:  Expected %s, got %s\n",
8622                         myname, expect, got);
8623                 exit(1);
8624         }
8625 }
8626
8627 int main()
8628
8629         char buf[64]; 
8630         buf[63] = '\0';
8631
8632         /* This must be 1st test on (which?) platform */
8633         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8634         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8635         checkit("0.1", buf);
8636
8637         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8638         checkit("1", buf);
8639
8640         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8641         checkit("1.1", buf);
8642
8643         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8644         checkit("1.01", buf);
8645
8646         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8647         checkit("1.001", buf);
8648
8649         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8650         checkit("1.0001", buf);
8651
8652         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8653         checkit("1.00001", buf);
8654
8655         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8656         checkit("1.000001", buf);
8657
8658         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8659         checkit("0", buf);
8660
8661         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8662         checkit("-1", buf);
8663
8664         /* Some Linux gcvt's give 1.e+5 here. */
8665         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8666         checkit("100000", buf);
8667         
8668         /* Some Linux gcvt's give -1.e+5 here. */
8669         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8670         checkit("-100000", buf);
8671
8672         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8673         checkit("123.456", buf);
8674
8675         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8676         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8677         if (strlen(buf) > 5)
8678             checkit("1e+030", buf); /* for Microsoft */
8679         else
8680             checkit("1e+30", buf);
8681
8682         exit(0);
8683 }
8684 EOP
8685 case "$d_Gconvert" in
8686 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8687 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8688 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8689 *) xxx_list='gconvert gcvt sprintf' ;;
8690 esac
8691
8692 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8693 "$define$define$define")
8694     # for long doubles prefer first qgcvt, then sprintf
8695     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8696     xxx_list="sprintf $xxx_list"
8697     case "$d_qgcvt" in
8698     "$define") xxx_list="qgcvt $xxx_list" ;;
8699     esac
8700     ;;
8701 esac
8702
8703 for xxx_convert in $xxx_list; do
8704         echo "Trying $xxx_convert..."
8705         $rm -f try try$_o
8706         set try -DTRY_$xxx_convert
8707         if eval $compile; then
8708                 echo "$xxx_convert() found." >&4
8709                 if $run ./try; then
8710                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8711                         break;
8712                 else
8713                         echo "...But $xxx_convert didn't work as I expected."
8714                 fi
8715         else
8716                 echo "$xxx_convert NOT found." >&4
8717         fi
8718 done
8719         
8720 case "$xxx_convert" in
8721 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8722 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8723 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8724 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8725    "$define$define$define")
8726       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8727    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8728    esac
8729    ;;  
8730 esac
8731
8732 : see if _fwalk exists
8733 set fwalk d__fwalk
8734 eval $inlibc
8735
8736 : Initialize h_fcntl
8737 h_fcntl=false
8738
8739 : Initialize h_sysfile
8740 h_sysfile=false
8741
8742 : access call always available on UNIX
8743 set access d_access
8744 eval $inlibc
8745
8746 : locate the flags for 'access()'
8747 case "$d_access" in
8748 "$define")
8749         echo " "
8750         $cat >access.c <<'EOCP'
8751 #include <sys/types.h>
8752 #ifdef I_FCNTL
8753 #include <fcntl.h>
8754 #endif
8755 #ifdef I_SYS_FILE
8756 #include <sys/file.h>
8757 #endif
8758 #ifdef I_UNISTD
8759 #include <unistd.h>
8760 #endif
8761 int main() {
8762         exit(R_OK);
8763 }
8764 EOCP
8765         : check sys/file.h first, no particular reason here
8766         if $test `./findhdr sys/file.h` && \
8767                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8768                 h_sysfile=true;
8769                 echo "<sys/file.h> defines the *_OK access constants." >&4
8770         elif $test `./findhdr fcntl.h` && \
8771                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8772                 h_fcntl=true;
8773                 echo "<fcntl.h> defines the *_OK access constants." >&4
8774         elif $test `./findhdr unistd.h` && \
8775                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8776                 echo "<unistd.h> defines the *_OK access constants." >&4
8777         else
8778                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8779         fi
8780         ;;
8781 esac
8782 $rm -f access*
8783
8784 : see if accessx exists
8785 set accessx d_accessx
8786 eval $inlibc
8787
8788 : see if alarm exists
8789 set alarm d_alarm
8790 eval $inlibc
8791
8792 : see if atolf exists
8793 set atolf d_atolf
8794 eval $inlibc
8795
8796 : see if atoll exists
8797 set atoll d_atoll
8798 eval $inlibc
8799
8800 : Look for GNU-cc style attribute checking
8801 echo " "
8802 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8803 $cat >attrib.c <<'EOCP'
8804 #include <stdio.h>
8805 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8806 EOCP
8807 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8808         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8809                 echo "Your C compiler doesn't fully support __attribute__."
8810                 val="$undef"
8811         else
8812                 echo "Your C compiler supports __attribute__."
8813                 val="$define"
8814         fi
8815 else
8816         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8817         val="$undef"
8818 fi
8819 set d_attribut
8820 eval $setvar
8821 $rm -f attrib*
8822
8823 : see if bcmp exists
8824 set bcmp d_bcmp
8825 eval $inlibc
8826
8827 : see if bcopy exists
8828 set bcopy d_bcopy
8829 eval $inlibc
8830
8831 : see if this is a unistd.h system
8832 set unistd.h i_unistd
8833 eval $inhdr
8834
8835 : see if getpgrp exists
8836 set getpgrp d_getpgrp
8837 eval $inlibc
8838
8839 case "$d_getpgrp" in
8840 "$define")
8841         echo " "
8842         echo "Checking to see which flavor of getpgrp is in use..."
8843         $cat >try.c <<EOP
8844 #$i_unistd I_UNISTD
8845 #include <sys/types.h>
8846 #ifdef I_UNISTD
8847 #  include <unistd.h>
8848 #endif
8849 int main()
8850 {
8851         if (getuid() == 0) {
8852                 printf("(I see you are running Configure as super-user...)\n");
8853                 setuid(1);
8854         }
8855 #ifdef TRY_BSD_PGRP
8856         if (getpgrp(1) == 0)
8857                 exit(0);
8858 #else
8859         if (getpgrp() > 0)
8860                 exit(0);
8861 #endif
8862         exit(1);
8863 }
8864 EOP
8865         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8866                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8867                 val="$define"
8868         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8869                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8870                 val="$undef"
8871         else
8872                 echo "I can't seem to compile and run the test program."
8873                 if ./usg; then
8874                         xxx="a USG one, i.e. you use getpgrp()."
8875                 else
8876                         # SVR4 systems can appear rather BSD-ish.
8877                         case "$i_unistd" in
8878                         $undef)
8879                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8880                                 val="$define"
8881                                 ;;
8882                         $define)
8883                                 xxx="probably a USG one, i.e. you use getpgrp()."
8884                                 val="$undef"
8885                                 ;;
8886                         esac
8887                 fi
8888                 echo "Assuming your getpgrp is $xxx" >&4
8889         fi
8890         ;;
8891 *) val="$undef";;
8892 esac
8893 set d_bsdgetpgrp
8894 eval $setvar
8895 $rm -f try try.*
8896
8897 : see if setpgrp exists
8898 set setpgrp d_setpgrp
8899 eval $inlibc
8900
8901 case "$d_setpgrp" in
8902 "$define")
8903         echo " "
8904         echo "Checking to see which flavor of setpgrp is in use..."
8905         $cat >try.c <<EOP
8906 #$i_unistd I_UNISTD
8907 #include <sys/types.h>
8908 #ifdef I_UNISTD
8909 #  include <unistd.h>
8910 #endif
8911 int main()
8912 {
8913         if (getuid() == 0) {
8914                 printf("(I see you are running Configure as super-user...)\n");
8915                 setuid(1);
8916         }
8917 #ifdef TRY_BSD_PGRP
8918         if (-1 == setpgrp(1, 1))
8919                 exit(0);
8920 #else
8921         if (setpgrp() != -1)
8922                 exit(0);
8923 #endif
8924         exit(1);
8925 }
8926 EOP
8927         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8928                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8929                 val="$define"
8930         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8931                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8932                 val="$undef"
8933         else
8934                 echo "(I can't seem to compile and run the test program.)"
8935                 if ./usg; then
8936                         xxx="a USG one, i.e. you use setpgrp()."
8937                 else
8938                         # SVR4 systems can appear rather BSD-ish.
8939                         case "$i_unistd" in
8940                         $undef)
8941                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8942                                 val="$define"
8943                                 ;;
8944                         $define)
8945                                 xxx="probably a USG one, i.e. you use setpgrp()."
8946                                 val="$undef"
8947                                 ;;
8948                         esac
8949                 fi
8950                 echo "Assuming your setpgrp is $xxx" >&4
8951         fi
8952         ;;
8953 *) val="$undef";;
8954 esac
8955 set d_bsdsetpgrp
8956 eval $setvar
8957 $rm -f try try.*
8958 : see if bzero exists
8959 set bzero d_bzero
8960 eval $inlibc
8961
8962 : see if signal is declared as pointer to function returning int or void
8963 echo " "
8964 xxx=`./findhdr signal.h`
8965 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8966 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8967         echo "You have int (*signal())() instead of void." >&4
8968         val="$undef"
8969 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8970         echo "You have void (*signal())()." >&4
8971         val="$define"
8972 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8973         echo "You have int (*signal())() instead of void." >&4
8974         val="$undef"
8975 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8976         echo "You have void (*signal())()." >&4
8977         val="$define"
8978 else
8979         case "$d_voidsig" in
8980         '')
8981         echo "I can't determine whether signal handler returns void or int..." >&4
8982                 dflt=void
8983                 rp="What type does your signal handler return?"
8984                 . ./myread
8985                 case "$ans" in
8986                 v*) val="$define";;
8987                 *) val="$undef";;
8988                 esac;;
8989         "$define")
8990                 echo "As you already told me, signal handler returns void." >&4
8991                 val="$define"
8992                 ;;
8993         *)      echo "As you already told me, signal handler returns int." >&4
8994                 val="$undef"
8995                 ;;
8996         esac
8997 fi
8998 set d_voidsig
8999 eval $setvar
9000 case "$d_voidsig" in
9001 "$define") signal_t="void";;
9002 *) signal_t="int";;
9003 esac
9004 $rm -f $$.tmp
9005
9006 : check for ability to cast large floats to 32-bit ints.
9007 echo " "
9008 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9009 if $test "$intsize" -ge 4; then
9010         xxx=int
9011 else
9012         xxx=long
9013 fi
9014 $cat >try.c <<EOCP
9015 #include <stdio.h>
9016 #include <sys/types.h>
9017 #include <signal.h>
9018 $signal_t blech(s) int s; { exit(3); }
9019 int main()
9020 {
9021         $xxx i32;
9022         double f, g;
9023         int result = 0;
9024         char str[16];
9025         signal(SIGFPE, blech);
9026
9027         /* Don't let compiler optimize the test away.  Store the number 
9028            in a writable string for gcc to pass to sscanf under HP/UX.
9029         */
9030         sprintf(str, "2147483647");
9031         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9032         g = 10 * f;
9033         i32  = ($xxx) g;
9034
9035         /* x86 processors will probably give 0x8000 0000, which is a
9036        sign change.  We don't want that.  We want to mimic SPARC
9037            behavior here, which is to preserve the sign and give
9038            back 0x7fff ffff.
9039         */
9040         if (i32 != ($xxx) f)
9041                 result |= 1;
9042         exit(result);
9043 }
9044 EOCP
9045 set try
9046 if eval $compile_ok; then
9047         $run ./try
9048         yyy=$?
9049 else
9050         echo "(I can't seem to compile the test program--assuming it can't)"
9051         yyy=1
9052 fi
9053 case "$yyy" in
9054 0)      val="$define"
9055         echo "Yup, it can."
9056         ;;
9057 *)      val="$undef"
9058         echo "Nope, it can't."
9059         ;;
9060 esac
9061 set d_casti32
9062 eval $setvar
9063 $rm -f try try.*
9064
9065 : check for ability to cast negative floats to unsigned
9066 echo " "
9067 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9068 $cat >try.c <<EOCP
9069 #include <stdio.h>
9070 #include <sys/types.h>
9071 #include <signal.h>
9072 $signal_t blech(s) int s; { exit(7); }
9073 $signal_t blech_in_list(s) int s; { exit(4); }
9074 unsigned long dummy_long(p) unsigned long p; { return p; }
9075 unsigned int dummy_int(p) unsigned int p; { return p; }
9076 unsigned short dummy_short(p) unsigned short p; { return p; }
9077 int main()
9078 {
9079         double f;
9080         unsigned long along;
9081         unsigned int aint;
9082         unsigned short ashort;
9083         int result = 0;
9084         char str[16];
9085         
9086         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9087            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9088            optimized the whole file away
9089         */
9090         /* Store the number in a writable string for gcc to pass to 
9091            sscanf under HP/UX.
9092         */
9093         sprintf(str, "-123");
9094         sscanf(str, "%lf", &f);  /* f = -123.; */
9095
9096         signal(SIGFPE, blech);
9097         along = (unsigned long)f;
9098         aint = (unsigned int)f;
9099         ashort = (unsigned short)f;
9100         if (along != (unsigned long)-123)
9101                 result |= 1;
9102         if (aint != (unsigned int)-123)
9103                 result |= 1;
9104         if (ashort != (unsigned short)-123)
9105                 result |= 1;
9106         sprintf(str, "1073741824.");
9107         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9108         f = f + f;
9109         along = 0;
9110         along = (unsigned long)f;
9111         if (along != 0x80000000)
9112                 result |= 2;
9113         f -= 1.;
9114         along = 0;
9115         along = (unsigned long)f;
9116         if (along != 0x7fffffff)
9117                 result |= 1;
9118         f += 2.;
9119         along = 0;
9120         along = (unsigned long)f;
9121         if (along != 0x80000001)
9122                 result |= 2;
9123         if (result)
9124                 exit(result);
9125         signal(SIGFPE, blech_in_list);
9126         sprintf(str, "123.");
9127         sscanf(str, "%lf", &f);  /* f = 123.; */
9128         along = dummy_long((unsigned long)f);
9129         aint = dummy_int((unsigned int)f);
9130         ashort = dummy_short((unsigned short)f);
9131         if (along != (unsigned long)123)
9132                 result |= 4;
9133         if (aint != (unsigned int)123)
9134                 result |= 4;
9135         if (ashort != (unsigned short)123)
9136                 result |= 4;
9137         exit(result);
9138
9139 }
9140 EOCP
9141 set try
9142 if eval $compile_ok; then
9143         $run ./try
9144         castflags=$?
9145 else
9146         echo "(I can't seem to compile the test program--assuming it can't)"
9147         castflags=7
9148 fi
9149 case "$castflags" in
9150 0)      val="$define"
9151         echo "Yup, it can."
9152         ;;
9153 *)      val="$undef"
9154         echo "Nope, it can't."
9155         ;;
9156 esac
9157 set d_castneg
9158 eval $setvar
9159 $rm -f try.*
9160
9161 : see if vprintf exists
9162 echo " "
9163 if set vprintf val -f d_vprintf; eval $csym; $val; then
9164         echo 'vprintf() found.' >&4
9165         val="$define"
9166         $cat >try.c <<'EOF'
9167 #include <varargs.h>
9168
9169 int main() { xxx("foo"); }
9170
9171 xxx(va_alist)
9172 va_dcl
9173 {
9174         va_list args;
9175         char buf[10];
9176
9177         va_start(args);
9178         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9179 }
9180 EOF
9181         set try
9182         if eval $compile && $run ./try; then
9183                 echo "Your vsprintf() returns (int)." >&4
9184                 val2="$undef"
9185         else
9186                 echo "Your vsprintf() returns (char*)." >&4
9187                 val2="$define"
9188         fi
9189 else
9190         echo 'vprintf() NOT found.' >&4
9191                 val="$undef"
9192                 val2="$undef"
9193 fi
9194 $rm -f try try.*
9195 set d_vprintf
9196 eval $setvar
9197 val=$val2
9198 set d_charvspr
9199 eval $setvar
9200
9201 : see if chown exists
9202 set chown d_chown
9203 eval $inlibc
9204
9205 : see if chroot exists
9206 set chroot d_chroot
9207 eval $inlibc
9208
9209 : see if chsize exists
9210 set chsize d_chsize
9211 eval $inlibc
9212
9213 : see if class exists
9214 set class d_class
9215 eval $inlibc
9216
9217 hasstruct='varname=$1; struct=$2; shift; shift;
9218 while $test $# -ge 2; do
9219         case "$1" in
9220         $define) echo "#include <$2>";;
9221         esac ;
9222     shift 2;
9223 done > try.c;
9224 echo "int main () { struct $struct foo; }" >> try.c;
9225 set try;
9226 if eval $compile; then
9227         val="$define";
9228 else
9229         val="$undef";
9230 fi;
9231 set $varname;
9232 eval $setvar;
9233 $rm -f try.c try.o'
9234
9235 : see if sys/types.h has to be included
9236 set sys/types.h i_systypes
9237 eval $inhdr
9238
9239 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9240 while $test $# -ge 2; do
9241         case "$1" in
9242         $define) echo "#include <$2>";;
9243         esac ;
9244     shift 2;
9245 done > try.c;
9246 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9247 set try;
9248 if eval $compile; then
9249         val="$define";
9250 else
9251         val="$undef";
9252 fi;
9253 set $varname;
9254 eval $setvar;
9255 $rm -f try.c try.o'
9256
9257 socketlib=''
9258 sockethdr=''
9259 : see whether socket exists
9260 echo " "
9261 $echo $n "Hmm... $c" >&4
9262 if set socket val -f d_socket; eval $csym; $val; then
9263         echo "Looks like you have Berkeley networking support." >&4
9264         d_socket="$define"
9265         if set setsockopt val -f; eval $csym; $val; then
9266                 d_oldsock="$undef"
9267         else
9268                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9269                 d_oldsock="$define"
9270         fi
9271 else
9272         if $contains socklib libc.list >/dev/null 2>&1; then
9273                 echo "Looks like you have Berkeley networking support." >&4
9274                 d_socket="$define"
9275                 : we will have to assume that it supports the 4.2 BSD interface
9276                 d_oldsock="$undef"
9277         else
9278                 echo "You don't have Berkeley networking in libc$_a..." >&4
9279                 if test "X$d_socket" = "X$define"; then
9280                    echo "...but you seem to believe that you have sockets." >&4
9281                 else
9282                         for net in net socket
9283                         do
9284                                 if test -f /usr/lib/lib$net$_a; then
9285                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9286                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9287                                         if $contains socket libc.list >/dev/null 2>&1; then
9288                                                 d_socket="$define"
9289                                                 socketlib="-l$net"
9290                                                 case "$net" in
9291                                                 net)
9292                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9293                                                         sockethdr="-I/usr/netinclude"
9294                                                         ;;
9295                                                 esac
9296                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9297                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9298                                                         d_oldsock="$undef"
9299                                                 else
9300                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9301                                                         d_oldsock="$define"
9302                                                 fi
9303                                                 break
9304                                         fi
9305                                 fi
9306                         done
9307                         if test "X$d_socket" != "X$define"; then
9308                            echo "or anywhere else I see." >&4
9309                            d_socket="$undef"
9310                            d_oldsock="$undef"
9311                         fi
9312                 fi
9313         fi
9314 fi
9315
9316 : see if socketpair exists
9317 set socketpair d_sockpair
9318 eval $inlibc
9319
9320
9321 echo " "
9322 echo "Checking the availability of certain socket constants..." >&4
9323 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9324         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9325         $cat >try.c <<EOF
9326 #include <sys/types.h>
9327 #include <sys/socket.h>
9328 int main() {
9329     int i = $ENUM;
9330 }
9331 EOF
9332         val="$undef"
9333         set try; if eval $compile; then
9334                 val="$define"
9335         fi
9336         set d_${enum}; eval $setvar
9337         $rm -f try.c try
9338 done
9339
9340 : see if this is a sys/uio.h system
9341 set sys/uio.h i_sysuio
9342 eval $inhdr
9343
9344
9345 echo " "
9346 echo "Checking to see if your system supports struct cmsghdr..." >&4
9347 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9348 eval $hasstruct
9349 case "$d_cmsghdr_s" in
9350 "$define")      echo "Yes, it does."   ;;
9351 *)              echo "No, it doesn't." ;;
9352 esac
9353
9354
9355 : check for const keyword
9356 echo " "
9357 echo 'Checking to see if your C compiler knows about "const"...' >&4
9358 $cat >const.c <<'EOCP'
9359 typedef struct spug { int drokk; } spug;
9360 int main()
9361 {
9362         const char *foo;
9363         const spug y;
9364 }
9365 EOCP
9366 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9367         val="$define"
9368         echo "Yup, it does."
9369 else
9370         val="$undef"
9371         echo "Nope, it doesn't."
9372 fi
9373 set d_const
9374 eval $setvar
9375
9376 : see if crypt exists
9377 echo " "
9378 set crypt d_crypt
9379 eval $inlibc
9380 case "$d_crypt" in
9381 $define) cryptlib='' ;;
9382 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9383                 echo 'crypt() found.' >&4
9384                 val="$define"
9385                 cryptlib=''
9386         else
9387                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9388                 if $test -z "$cryptlib"; then
9389                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9390                 else
9391                         cryptlib=-lcrypt
9392                 fi
9393                 if $test -z "$cryptlib"; then
9394                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9395                 else
9396                         cryptlib=-lcrypt
9397                 fi
9398                 if $test -z "$cryptlib"; then
9399                         cryptlib=`./loc libcrypt$_a "" $libpth`
9400                 else
9401                         cryptlib=-lcrypt
9402                 fi
9403                 if $test -z "$cryptlib"; then
9404                         echo 'crypt() NOT found.' >&4
9405                         val="$undef"
9406                 else
9407                         val="$define"
9408                 fi
9409         fi
9410         set d_crypt
9411         eval $setvar
9412         ;;
9413 esac
9414
9415 : get csh whereabouts
9416 case "$csh" in
9417 'csh') val="$undef" ;;
9418 *) val="$define" ;;
9419 esac
9420 set d_csh
9421 eval $setvar
9422 : Respect a hint or command line value for full_csh.
9423 case "$full_csh" in
9424 '') full_csh=$csh ;;
9425 esac
9426
9427 : see if cuserid exists
9428 set cuserid d_cuserid
9429 eval $inlibc
9430
9431 : see if this is a limits.h system
9432 set limits.h i_limits
9433 eval $inhdr
9434
9435 : see if this is a float.h system
9436 set float.h i_float
9437 eval $inhdr
9438
9439 : See if number of significant digits in a double precision number is known
9440 echo " "
9441 $cat >dbl_dig.c <<EOM
9442 #$i_limits I_LIMITS
9443 #$i_float I_FLOAT
9444 #ifdef I_LIMITS
9445 #include <limits.h>
9446 #endif
9447 #ifdef I_FLOAT
9448 #include <float.h>
9449 #endif
9450 #ifdef DBL_DIG
9451 printf("Contains DBL_DIG");
9452 #endif
9453 EOM
9454 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9455 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9456         echo "DBL_DIG found." >&4
9457         val="$define"
9458 else
9459         echo "DBL_DIG NOT found." >&4
9460         val="$undef"
9461 fi
9462 $rm -f dbl_dig.?
9463 set d_dbl_dig
9464 eval $setvar
9465
9466 hasproto='varname=$1; func=$2; shift; shift;
9467 while $test $# -ge 2; do
9468         case "$1" in
9469         $define) echo "#include <$2>";;
9470         esac ;
9471     shift 2;
9472 done > try.c;
9473 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9474 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9475         echo "$func() prototype found.";
9476         val="$define";
9477 else
9478         echo "$func() prototype NOT found.";
9479         val="$undef";
9480 fi;
9481 set $varname;
9482 eval $setvar;
9483 $rm -f try.c tryout.c'
9484
9485 : see if dbm.h is available
9486 : see if dbmclose exists
9487 set dbmclose d_dbmclose
9488 eval $inlibc
9489
9490 case "$d_dbmclose" in
9491 $define)
9492         set dbm.h i_dbm
9493         eval $inhdr
9494         case "$i_dbm" in
9495         $define)
9496                 val="$undef"
9497                 set i_rpcsvcdbm
9498                 eval $setvar
9499                 ;;
9500         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9501                 eval $inhdr
9502                 ;;
9503         esac
9504         ;;
9505 *)      echo "We won't be including <dbm.h>"
9506         val="$undef"
9507         set i_dbm
9508         eval $setvar
9509         val="$undef"
9510         set i_rpcsvcdbm
9511         eval $setvar
9512         ;;
9513 esac
9514
9515 : see if prototype for dbminit is available
9516 echo " "
9517 set d_dbminitproto dbminit $i_dbm dbm.h
9518 eval $hasproto
9519
9520 : see if difftime exists
9521 set difftime d_difftime
9522 eval $inlibc
9523
9524 : see if this is a dirent system
9525 echo " "
9526 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9527         val="$define"
9528         echo "<dirent.h> found." >&4
9529 else
9530         val="$undef"
9531         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9532                 echo "<sys/dir.h> found." >&4
9533                 echo " "
9534         else
9535                 xinc=`./findhdr sys/ndir.h`
9536         fi
9537         echo "<dirent.h> NOT found." >&4
9538 fi
9539 set i_dirent
9540 eval $setvar
9541
9542 : Look for type of directory structure.
9543 echo " "
9544 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9545
9546 case "$direntrytype" in
9547 ''|' ')
9548         case "$i_dirent" in
9549         $define) guess1='struct dirent' ;;
9550         *) guess1='struct direct'  ;;
9551         esac
9552         ;;
9553 *)      guess1="$direntrytype"
9554         ;;
9555 esac
9556
9557 case "$guess1" in
9558 'struct dirent') guess2='struct direct' ;;
9559 *) guess2='struct dirent' ;;
9560 esac
9561                 
9562 if $contains "$guess1" try.c >/dev/null 2>&1; then
9563         direntrytype="$guess1"
9564         echo "Your directory entries are $direntrytype." >&4
9565 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9566         direntrytype="$guess2"
9567         echo "Your directory entries seem to be $direntrytype." >&4
9568 else
9569         echo "I don't recognize your system's directory entries." >&4
9570         rp="What type is used for directory entries on this system?"
9571         dflt="$guess1"
9572         . ./myread
9573         direntrytype="$ans"
9574 fi
9575 $rm -f try.c
9576
9577
9578 : see if the directory entry stores field length
9579 echo " "
9580 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9581 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9582         echo "Good, your directory entry keeps length information in d_namlen." >&4
9583         val="$define"
9584 else
9585         echo "Your directory entry does not know about the d_namlen field." >&4
9586         val="$undef"
9587 fi
9588 set d_dirnamlen
9589 eval $setvar
9590 $rm -f try.c
9591
9592 : see if this is an sysdir system
9593 set sys/dir.h i_sysdir
9594 eval $inhdr
9595
9596 : see if this is an sysndir system
9597 set sys/ndir.h i_sysndir
9598 eval $inhdr
9599
9600 : Look for dirfd
9601 echo " "
9602 $cat >dirfd.c <<EOM
9603 #include <stdio.h>
9604 #$i_dirent I_DIRENT             /**/
9605 #$i_sysdir I_SYS_DIR            /**/
9606 #$i_sysndir I_SYS_NDIR          /**/
9607 #$i_systypes I_SYS_TYPES        /**/
9608 #if defined(I_SYS_TYPES)
9609 #include <sys/types.h>
9610 #endif
9611 #if defined(I_DIRENT)
9612 #include <dirent.h>
9613 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
9614 #include <sys/dir.h>
9615 #endif
9616 #else
9617 #ifdef I_SYS_NDIR
9618 #include <sys/ndir.h>
9619 #else
9620 #ifdef I_SYS_DIR
9621 #ifdef hp9000s500
9622 #include <ndir.h>       /* may be wrong in the future */
9623 #else
9624 #include <sys/dir.h>
9625 #endif
9626 #endif
9627 #endif
9628 #endif 
9629 int main() {
9630         DIR *dirp = opendir(".");
9631         if (dirfd(dirp) >= 0)
9632                 exit(0);
9633         else
9634                 exit(1);
9635 }
9636 EOM
9637 set dirfd
9638 if eval $compile; then
9639         val="$define"
9640 fi
9641 case "$val" in
9642 $define)        echo "dirfd() found." >&4       ;;
9643 *)              echo "dirfd() NOT found." >&4   ;;
9644 esac
9645 set d_dirfd
9646 eval $setvar
9647 $rm -f dirfd*
9648
9649 : see if dlerror exists
9650 xxx_runnm="$runnm"
9651 runnm=false
9652 set dlerror d_dlerror
9653 eval $inlibc
9654 runnm="$xxx_runnm"
9655
9656 : see if dlfcn is available
9657 set dlfcn.h i_dlfcn
9658 eval $inhdr
9659
9660 case "$usedl" in
9661 $define|y|true)
9662         $cat << EOM
9663
9664 On a few systems, the dynamically loaded modules that perl generates and uses
9665 will need a different extension than shared libs. The default will probably
9666 be appropriate.
9667
9668 EOM
9669         case "$dlext" in
9670         '')     dflt="$so" ;;
9671         *)      dflt="$dlext" ;;
9672         esac
9673         rp='What is the extension of dynamically loaded modules'
9674         . ./myread
9675         dlext="$ans"
9676         ;;
9677 *)
9678         dlext="none"
9679         ;;
9680 esac
9681
9682 : Check if dlsym need a leading underscore
9683 echo " "
9684 val="$undef"
9685
9686 case "$dlsrc" in
9687 dl_dlopen.xs)
9688         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9689         $cat >dyna.c <<'EOM'
9690 fred () { }
9691 EOM
9692
9693 $cat >fred.c<<EOM
9694
9695 #include <stdio.h>
9696 #$i_dlfcn I_DLFCN
9697 #ifdef I_DLFCN
9698 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9699 #else
9700 #include <sys/types.h>
9701 #include <nlist.h>
9702 #include <link.h>
9703 #endif
9704
9705 extern int fred() ;
9706
9707 int main()
9708 {
9709     void * handle ;
9710     void * symbol ;
9711 #ifndef RTLD_LAZY
9712     int mode = 1 ;
9713 #else
9714     int mode = RTLD_LAZY ;
9715 #endif
9716     handle = dlopen("./dyna.$dlext", mode) ;
9717     if (handle == NULL) {
9718         printf ("1\n") ;
9719         fflush (stdout) ;
9720         exit(0);
9721     }
9722     symbol = dlsym(handle, "fred") ;
9723     if (symbol == NULL) {
9724         /* try putting a leading underscore */
9725         symbol = dlsym(handle, "_fred") ;
9726         if (symbol == NULL) {
9727             printf ("2\n") ;
9728             fflush (stdout) ;
9729             exit(0);
9730         }
9731         printf ("3\n") ;
9732     }
9733     else
9734         printf ("4\n") ;
9735     fflush (stdout) ;
9736     exit(0);
9737 }
9738 EOM
9739         : Call the object file tmp-dyna.o in case dlext=o.
9740         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9741                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9742                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9743                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9744                 xxx=`$run ./fred`
9745                 case $xxx in
9746                 1)      echo "Test program failed using dlopen." >&4
9747                         echo "Perhaps you should not use dynamic loading." >&4;;
9748                 2)      echo "Test program failed using dlsym." >&4
9749                         echo "Perhaps you should not use dynamic loading." >&4;;
9750                 3)      echo "dlsym needs a leading underscore" >&4
9751                         val="$define" ;;
9752                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9753                 esac
9754         else
9755                 echo "I can't compile and run the test program." >&4
9756                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9757         fi
9758         ;;
9759 esac
9760                 
9761 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
9762
9763 set d_dlsymun
9764 eval $setvar
9765
9766 : see if prototype for drand48 is available
9767 echo " "
9768 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9769 eval $hasproto
9770
9771 : see if dup2 exists
9772 set dup2 d_dup2
9773 eval $inlibc
9774
9775 : see if eaccess exists
9776 set eaccess d_eaccess
9777 eval $inlibc
9778
9779 : see if endgrent exists
9780 set endgrent d_endgrent
9781 eval $inlibc
9782
9783 : see if endhostent exists
9784 set endhostent d_endhent
9785 eval $inlibc
9786
9787 : see if endnetent exists
9788 set endnetent d_endnent
9789 eval $inlibc
9790
9791 : see if endprotoent exists
9792 set endprotoent d_endpent
9793 eval $inlibc
9794
9795 : see if endpwent exists
9796 set endpwent d_endpwent
9797 eval $inlibc
9798
9799 : see if endservent exists
9800 set endservent d_endsent
9801 eval $inlibc
9802
9803 : Locate the flags for 'open()'
9804 echo " "
9805 $cat >try.c <<'EOCP'
9806 #include <sys/types.h>
9807 #ifdef I_FCNTL
9808 #include <fcntl.h>
9809 #endif
9810 #ifdef I_SYS_FILE
9811 #include <sys/file.h>
9812 #endif
9813 int main() {
9814         if(O_RDONLY);
9815 #ifdef O_TRUNC
9816         exit(0);
9817 #else
9818         exit(1);
9819 #endif
9820 }
9821 EOCP
9822 : check sys/file.h first to get FREAD on Sun
9823 if $test `./findhdr sys/file.h` && \
9824                 set try -DI_SYS_FILE && eval $compile; then
9825         h_sysfile=true;
9826         echo "<sys/file.h> defines the O_* constants..." >&4
9827         if $run ./try; then
9828                 echo "and you have the 3 argument form of open()." >&4
9829                 val="$define"
9830         else
9831                 echo "but not the 3 argument form of open().  Oh, well." >&4
9832                 val="$undef"
9833         fi
9834 elif $test `./findhdr fcntl.h` && \
9835                 set try -DI_FCNTL && eval $compile; then
9836         h_fcntl=true;
9837         echo "<fcntl.h> defines the O_* constants..." >&4
9838         if $run ./try; then
9839                 echo "and you have the 3 argument form of open()." >&4
9840                 val="$define"
9841         else
9842                 echo "but not the 3 argument form of open().  Oh, well." >&4
9843                 val="$undef"
9844         fi
9845 else
9846         val="$undef"
9847         echo "I can't find the O_* constant definitions!  You got problems." >&4
9848 fi
9849 set d_open3
9850 eval $setvar
9851 $rm -f try try.*
9852
9853 : see which of string.h or strings.h is needed
9854 echo " "
9855 strings=`./findhdr string.h`
9856 if $test "$strings" && $test -r "$strings"; then
9857         echo "Using <string.h> instead of <strings.h>." >&4
9858         val="$define"
9859 else
9860         val="$undef"
9861         strings=`./findhdr strings.h`
9862         if $test "$strings" && $test -r "$strings"; then
9863                 echo "Using <strings.h> instead of <string.h>." >&4
9864         else
9865                 echo "No string header found -- You'll surely have problems." >&4
9866         fi
9867 fi
9868 set i_string
9869 eval $setvar
9870 case "$i_string" in
9871 "$undef") strings=`./findhdr strings.h`;;
9872 *)        strings=`./findhdr string.h`;;
9873 esac
9874
9875 : see if this is a sys/file.h system
9876 val=''
9877 set sys/file.h val
9878 eval $inhdr
9879
9880 : do we need to include sys/file.h ?
9881 case "$val" in
9882 "$define")
9883         echo " "
9884         if $h_sysfile; then
9885                 val="$define"
9886                 echo "We'll be including <sys/file.h>." >&4
9887         else
9888                 val="$undef"
9889                 echo "We won't be including <sys/file.h>." >&4
9890         fi
9891         ;;
9892 *)
9893         h_sysfile=false
9894         ;;
9895 esac
9896 set i_sysfile
9897 eval $setvar
9898
9899 : see if fcntl.h is there
9900 val=''
9901 set fcntl.h val
9902 eval $inhdr
9903
9904 : see if we can include fcntl.h
9905 case "$val" in
9906 "$define")
9907         echo " "
9908         if $h_fcntl; then
9909                 val="$define"
9910                 echo "We'll be including <fcntl.h>." >&4
9911         else
9912                 val="$undef"
9913                 if $h_sysfile; then
9914         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
9915                 else
9916                         echo "We won't be including <fcntl.h>." >&4
9917                 fi
9918         fi
9919         ;;
9920 *)
9921         h_fcntl=false
9922         val="$undef"
9923         ;;
9924 esac
9925 set i_fcntl
9926 eval $setvar
9927
9928 : check for non-blocking I/O stuff
9929 case "$h_sysfile" in
9930 true) echo "#include <sys/file.h>" > head.c;;
9931 *)
9932        case "$h_fcntl" in
9933        true) echo "#include <fcntl.h>" > head.c;;
9934        *) echo "#include <sys/fcntl.h>" > head.c;;
9935        esac
9936        ;;
9937 esac
9938 echo " "
9939 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9940 case "$o_nonblock" in
9941 '')
9942         $cat head.c > try.c
9943         $cat >>try.c <<EOCP
9944 #include <stdio.h>
9945 #include <stdlib.h>
9946 #$i_fcntl I_FCNTL
9947 #ifdef I_FCNTL
9948 #include <fcntl.h>
9949 #endif
9950 int main() {
9951 #ifdef O_NONBLOCK
9952         printf("O_NONBLOCK\n");
9953         exit(0);
9954 #endif
9955 #ifdef O_NDELAY
9956         printf("O_NDELAY\n");
9957         exit(0);
9958 #endif
9959 #ifdef FNDELAY
9960         printf("FNDELAY\n");
9961         exit(0);
9962 #endif
9963         exit(0);
9964 }
9965 EOCP
9966         set try
9967         if eval $compile_ok; then
9968                 o_nonblock=`$run ./try`
9969                 case "$o_nonblock" in
9970                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9971                 *) echo "Seems like we can use $o_nonblock.";;
9972                 esac
9973         else
9974                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9975         fi
9976         ;;
9977 *) echo "Using $hint value $o_nonblock.";;
9978 esac
9979 $rm -f try try.* .out core
9980
9981 echo " "
9982 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9983 case "$eagain" in
9984 '')
9985         $cat head.c > try.c
9986         $cat >>try.c <<EOCP
9987 #include <errno.h>
9988 #include <sys/types.h>
9989 #include <signal.h>
9990 #include <stdio.h> 
9991 #include <stdlib.h> 
9992 #$i_fcntl I_FCNTL
9993 #ifdef I_FCNTL
9994 #include <fcntl.h>
9995 #endif
9996 #define MY_O_NONBLOCK $o_nonblock
9997 #ifndef errno  /* XXX need better Configure test */
9998 extern int errno;
9999 #endif
10000 #$i_unistd I_UNISTD
10001 #ifdef I_UNISTD
10002 #include <unistd.h>
10003 #endif
10004 #$i_string I_STRING
10005 #ifdef I_STRING
10006 #include <string.h>
10007 #else
10008 #include <strings.h>
10009 #endif
10010 $signal_t blech(x) int x; { exit(3); }
10011 EOCP
10012         $cat >> try.c <<'EOCP'
10013 int main()
10014 {
10015         int pd[2];
10016         int pu[2];
10017         char buf[1];
10018         char string[100];
10019
10020         pipe(pd);       /* Down: child -> parent */
10021         pipe(pu);       /* Up: parent -> child */
10022         if (0 != fork()) {
10023                 int ret;
10024                 close(pd[1]);   /* Parent reads from pd[0] */
10025                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
10026 #ifdef F_SETFL
10027                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
10028                         exit(1);
10029 #else
10030                 exit(4);
10031 #endif
10032                 signal(SIGALRM, blech);
10033                 alarm(5);
10034                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
10035                         exit(2);
10036                 sprintf(string, "%d\n", ret);
10037                 write(2, string, strlen(string));
10038                 alarm(0);
10039 #ifdef EAGAIN
10040                 if (errno == EAGAIN) {
10041                         printf("EAGAIN\n");
10042                         goto ok;
10043                 }
10044 #endif
10045 #ifdef EWOULDBLOCK
10046                 if (errno == EWOULDBLOCK)
10047                         printf("EWOULDBLOCK\n");
10048 #endif
10049         ok:
10050                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
10051                 sleep(2);                               /* Give it time to close our pipe */
10052                 alarm(5);
10053                 ret = read(pd[0], buf, 1);      /* Should read EOF */
10054                 alarm(0);
10055                 sprintf(string, "%d\n", ret);
10056                 write(3, string, strlen(string));
10057                 exit(0);
10058         }
10059
10060         close(pd[0]);                   /* We write to pd[1] */
10061         close(pu[1]);                   /* We read from pu[0] */
10062         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
10063         close(pd[1]);                   /* Pipe pd is now fully closed! */
10064         exit(0);                                /* Bye bye, thank you for playing! */
10065 }
10066 EOCP
10067         set try
10068         if eval $compile_ok; then
10069                 echo "$startsh" >mtry
10070                 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
10071                 chmod +x mtry
10072                 ./mtry >/dev/null 2>&1
10073                 case $? in
10074                 0) eagain=`$cat try.out`;;
10075                 1) echo "Could not perform non-blocking setting!";;
10076                 2) echo "I did a successful read() for something that was not there!";;
10077                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
10078                 4) echo "Could not find F_SETFL!";;
10079                 *) echo "Something terribly wrong happened during testing.";;
10080                 esac
10081                 rd_nodata=`$cat try.ret`
10082                 echo "A read() system call with no data present returns $rd_nodata."
10083                 case "$rd_nodata" in
10084                 0|-1) ;;
10085                 *)
10086                         echo "(That's peculiar, fixing that to be -1.)"
10087                         rd_nodata=-1
10088                         ;;
10089                 esac
10090                 case "$eagain" in
10091                 '')
10092                         echo "Forcing errno EAGAIN on read() with no data available."
10093                         eagain=EAGAIN
10094                         ;;
10095                 *)
10096                         echo "Your read() sets errno to $eagain when no data is available."
10097                         ;;
10098                 esac
10099                 status=`$cat try.err`
10100                 case "$status" in
10101                 0) echo "And it correctly returns 0 to signal EOF.";;
10102                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
10103                 *) echo "However, your read() returns '$status' on EOF??";;
10104                 esac
10105                 val="$define"
10106                 if test "$status" = "$rd_nodata"; then
10107                         echo "WARNING: you can't distinguish between EOF and no data!"
10108                         val="$undef"
10109                 fi
10110         else
10111                 echo "I can't compile the test program--assuming errno EAGAIN will do."
10112                 eagain=EAGAIN
10113         fi
10114         set d_eofnblk
10115         eval $setvar
10116         ;;
10117 *)
10118         echo "Using $hint value $eagain."
10119         echo "Your read() returns $rd_nodata when no data is present."
10120         case "$d_eofnblk" in
10121         "$define") echo "And you can see EOF because read() returns 0.";;
10122         "$undef") echo "But you can't see EOF status from read() returned value.";;
10123         *)
10124                 echo "(Assuming you can't see EOF status from read anyway.)"
10125                 d_eofnblk=$undef
10126                 ;;
10127         esac
10128         ;;
10129 esac
10130 $rm -f try try.* .out core head.c mtry
10131
10132 : see if fchdir exists
10133 set fchdir d_fchdir
10134 eval $inlibc
10135
10136 : see if fchmod exists
10137 set fchmod d_fchmod
10138 eval $inlibc
10139
10140 : see if fchown exists
10141 set fchown d_fchown
10142 eval $inlibc
10143
10144 : see if this is an fcntl system
10145 set fcntl d_fcntl
10146 eval $inlibc
10147
10148 echo " "
10149 : See if fcntl-based locking works.
10150 $cat >try.c <<EOCP
10151 #include <stdlib.h>
10152 #include <unistd.h>
10153 #include <fcntl.h>
10154 #include <signal.h>
10155 $signal_t blech(x) int x; { exit(3); }
10156 int main() {
10157 #if defined(F_SETLK) && defined(F_SETLKW)
10158      struct flock flock;
10159      int retval, fd;
10160      fd = open("try.c", O_RDONLY);
10161      flock.l_type = F_RDLCK;
10162      flock.l_whence = SEEK_SET;
10163      flock.l_start = flock.l_len = 0;
10164      signal(SIGALRM, blech);
10165      alarm(10);
10166      retval = fcntl(fd, F_SETLK, &flock);
10167      close(fd);
10168      (retval < 0 ? exit(2) : exit(0));
10169 #else
10170      exit(2);
10171 #endif
10172 }
10173 EOCP
10174 echo "Checking if fcntl-based file locking works... "
10175 case "$d_fcntl" in
10176 "$define")
10177         set try
10178         if eval $compile_ok; then
10179                 if $run ./try; then
10180                         echo "Yes, it seems to work."
10181                         val="$define"
10182                 else
10183                         echo "Nope, it didn't work."
10184                         val="$undef"
10185                         case "$?" in
10186                         3) $cat >&4 <<EOM
10187 ***
10188 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
10189 *** This is (almost) impossible.
10190 *** If your NFS lock daemons are not feeling well, something like
10191 *** this may happen, please investigate.  Cannot continue, aborting.
10192 ***
10193 EOM
10194                                 exit 1
10195                                 ;;
10196                         esac
10197                 fi
10198         else
10199                 echo "I'm unable to compile the test program, so I'll assume not."
10200                 val="$undef"
10201         fi
10202         ;;
10203 *) val="$undef";
10204         echo "Nope, since you don't even have fcntl()."
10205         ;;
10206 esac
10207 set d_fcntl_can_lock
10208 eval $setvar
10209 $rm -f try*
10210
10211
10212 : see if sys/select.h has to be included
10213 set sys/select.h i_sysselct
10214 eval $inhdr
10215
10216 : see if we should include time.h, sys/time.h, or both
10217 echo " "
10218 if test "X$timeincl" = X; then
10219         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10220         $echo $n "I'm now running the test program...$c"
10221         $cat >try.c <<'EOCP'
10222 #include <sys/types.h>
10223 #ifdef I_TIME
10224 #include <time.h>
10225 #endif
10226 #ifdef I_SYSTIME
10227 #ifdef SYSTIMEKERNEL
10228 #define KERNEL
10229 #endif
10230 #include <sys/time.h>
10231 #endif
10232 #ifdef I_SYSSELECT
10233 #include <sys/select.h>
10234 #endif
10235 int main()
10236 {
10237         struct tm foo;
10238 #ifdef S_TIMEVAL
10239         struct timeval bar;
10240 #endif
10241 #ifdef S_TIMEZONE
10242         struct timezone tzp;
10243 #endif
10244         if (foo.tm_sec == foo.tm_sec)
10245                 exit(0);
10246 #ifdef S_TIMEVAL
10247         if (bar.tv_sec == bar.tv_sec)
10248                 exit(0);
10249 #endif
10250         exit(1);
10251 }
10252 EOCP
10253         flags=''
10254         for s_timezone in '-DS_TIMEZONE' ''; do
10255         sysselect=''
10256         for s_timeval in '-DS_TIMEVAL' ''; do
10257         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10258         for i_time in '' '-DI_TIME'; do
10259         for i_systime in '-DI_SYSTIME' ''; do
10260                 case "$flags" in
10261                 '') $echo $n ".$c"
10262                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10263                         if eval $compile; then
10264                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10265                                 shift
10266                                 flags="$*"
10267                                 echo " "
10268                                 $echo $n "Succeeded with $flags$c"
10269                         fi
10270                         ;;
10271                 esac
10272         done
10273         done
10274         done
10275         done
10276         done
10277         timeincl=''
10278         echo " "
10279         case "$flags" in
10280         *SYSTIMEKERNEL*) i_systimek="$define"
10281                 timeincl=`./findhdr sys/time.h`
10282                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10283         *) i_systimek="$undef";;
10284         esac
10285         case "$flags" in
10286         *I_TIME*) i_time="$define"
10287                 timeincl=`./findhdr time.h`" $timeincl"
10288                 echo "We'll include <time.h>." >&4;;
10289         *) i_time="$undef";;
10290         esac
10291         case "$flags" in
10292         *I_SYSTIME*) i_systime="$define"
10293                 timeincl=`./findhdr sys/time.h`" $timeincl"
10294                 echo "We'll include <sys/time.h>." >&4;;
10295         *) i_systime="$undef";;
10296         esac
10297         $rm -f try.c try
10298 fi
10299
10300 : check for fd_set items
10301 $cat <<EOM
10302
10303 Checking to see how well your C compiler handles fd_set and friends ...
10304 EOM
10305 $cat >try.c <<EOCP
10306 #$i_systime I_SYS_TIME
10307 #$i_sysselct I_SYS_SELECT
10308 #$d_socket HAS_SOCKET
10309 #include <sys/types.h>
10310 #ifdef HAS_SOCKET
10311 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10312 #endif
10313 #ifdef I_SYS_TIME
10314 #include <sys/time.h>
10315 #endif
10316 #ifdef I_SYS_SELECT
10317 #include <sys/select.h>
10318 #endif
10319 int main() {
10320         fd_set fds;
10321
10322 #ifdef TRYBITS
10323         if(fds.fds_bits);
10324 #endif
10325
10326 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10327         exit(0);
10328 #else
10329         exit(1);
10330 #endif
10331 }
10332 EOCP
10333 set try -DTRYBITS
10334 if eval $compile; then
10335         d_fds_bits="$define"
10336         d_fd_set="$define"
10337         echo "Well, your system knows about the normal fd_set typedef..." >&4
10338         if $run ./try; then
10339                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10340                 d_fd_macros="$define"
10341         else
10342                 $cat >&4 <<'EOM'
10343 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10344 EOM
10345                 d_fd_macros="$undef"
10346         fi
10347 else
10348         $cat <<'EOM'
10349 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10350 EOM
10351         set try
10352         if eval $compile; then
10353                 d_fds_bits="$undef"
10354                 d_fd_set="$define"
10355                 echo "Well, your system has some sort of fd_set available..." >&4
10356                 if $run ./try; then
10357                         echo "and you have the normal fd_set macros." >&4
10358                         d_fd_macros="$define"
10359                 else
10360                         $cat <<'EOM'
10361 but not the normal fd_set macros!  Gross!  More work for me...
10362 EOM
10363                         d_fd_macros="$undef"
10364                 fi
10365         else
10366         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10367                 d_fd_set="$undef"
10368                 d_fds_bits="$undef"
10369                 d_fd_macros="$undef"
10370         fi
10371 fi
10372 $rm -f try try.*
10373
10374 : see if fgetpos exists
10375 set fgetpos d_fgetpos
10376 eval $inlibc
10377
10378 : see if finite exists
10379 set finite d_finite
10380 eval $inlibc
10381
10382 : see if finitel exists
10383 set finitel d_finitel
10384 eval $inlibc
10385
10386 : see if flock exists
10387 set flock d_flock
10388 eval $inlibc
10389
10390 : see if prototype for flock is available
10391 echo " "
10392 set d_flockproto flock $i_sysfile sys/file.h
10393 eval $hasproto
10394
10395 : see if fork exists
10396 set fork d_fork
10397 eval $inlibc
10398
10399 : see if fp_class exists
10400 set fp_class d_fp_class
10401 eval $inlibc
10402
10403 : see if pathconf exists
10404 set pathconf d_pathconf
10405 eval $inlibc
10406
10407 : see if fpathconf exists
10408 set fpathconf d_fpathconf
10409 eval $inlibc
10410
10411 : see if fpclass exists
10412 set fpclass d_fpclass
10413 eval $inlibc
10414
10415 : see if fpclassify exists
10416 set fpclassify d_fpclassify
10417 eval $inlibc
10418
10419 : see if fpclassl exists
10420 set fpclassl d_fpclassl
10421 eval $inlibc
10422
10423
10424 : check for fpos64_t
10425 echo " "
10426 echo "Checking to see if you have fpos64_t..." >&4
10427 $cat >try.c <<EOCP
10428 #include <stdio.h>
10429 int main() { fpos64_t x = 7; }
10430 EOCP
10431 set try
10432 if eval $compile; then
10433         val="$define"
10434         echo "You have fpos64_t."
10435 else
10436         val="$undef"
10437         echo "You do not have fpos64_t."
10438         case "$fpossize" in
10439         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10440         esac
10441 fi
10442 $rm -f try.* try
10443 set d_fpos64_t
10444 eval $setvar
10445
10446 : see if frexpl exists
10447 set frexpl d_frexpl
10448 eval $inlibc
10449
10450 : see if this is a sys/param system
10451 set sys/param.h i_sysparam
10452 eval $inhdr
10453
10454 : see if this is a sys/mount.h system
10455 set sys/mount.h i_sysmount
10456 eval $inhdr
10457
10458
10459 echo " "
10460 echo "Checking to see if your system supports struct fs_data..." >&4
10461 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10462 eval $hasstruct
10463 case "$d_fs_data_s" in
10464 "$define")      echo "Yes, it does."   ;;
10465 *)              echo "No, it doesn't." ;;
10466 esac
10467
10468 : see if fseeko exists
10469 set fseeko d_fseeko
10470 eval $inlibc
10471 case "$longsize" in
10472 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10473 esac
10474
10475 : see if fsetpos exists
10476 set fsetpos d_fsetpos
10477 eval $inlibc
10478
10479
10480 : see if fstatfs exists
10481 set fstatfs d_fstatfs
10482 eval $inlibc
10483
10484
10485 : see if statvfs exists
10486 set statvfs d_statvfs
10487 eval $inlibc
10488
10489 : see if fstatvfs exists
10490 set fstatvfs d_fstatvfs
10491 eval $inlibc
10492
10493
10494 : see if fsync exists
10495 set fsync d_fsync
10496 eval $inlibc
10497
10498 : see if ftello exists
10499 set ftello d_ftello
10500 eval $inlibc
10501 case "$longsize" in
10502 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10503 esac
10504
10505 : see if getcwd exists
10506 set getcwd d_getcwd
10507 eval $inlibc
10508
10509 : see if getespwnam exists
10510 set getespwnam d_getespwnam
10511 eval $inlibc
10512
10513
10514 : see if getfsstat exists
10515 set getfsstat d_getfsstat
10516 eval $inlibc
10517
10518 : see if getgrent exists
10519 set getgrent d_getgrent
10520 eval $inlibc
10521
10522 : see if gethostbyaddr exists
10523 set gethostbyaddr d_gethbyaddr
10524 eval $inlibc
10525
10526 : see if gethostbyname exists
10527 set gethostbyname d_gethbyname
10528 eval $inlibc
10529
10530 : see if gethostent exists
10531 set gethostent d_gethent
10532 eval $inlibc
10533
10534 : see how we will look up host name
10535 echo " "
10536 call=''
10537 if set gethostname val -f d_gethname; eval $csym; $val; then
10538         echo 'gethostname() found.' >&4
10539         d_gethname="$define"
10540         call=gethostname
10541 fi
10542 if set uname val -f d_uname; eval $csym; $val; then
10543         if ./xenix; then
10544                 $cat <<'EOM'
10545 uname() was found, but you're running xenix, and older versions of xenix
10546 have a broken uname(). If you don't really know whether your xenix is old
10547 enough to have a broken system call, use the default answer.
10548
10549 EOM
10550                 dflt=y
10551                 case "$d_uname" in
10552                 "$define") dflt=n;;
10553                 esac
10554                 rp='Is your uname() broken?'
10555                 . ./myread
10556                 case "$ans" in
10557                 n*) d_uname="$define"; call=uname;;
10558                 esac
10559         else
10560                 echo 'uname() found.' >&4
10561                 d_uname="$define"
10562                 case "$call" in
10563                 '') call=uname ;;
10564                 esac
10565         fi
10566 fi
10567 case "$d_gethname" in
10568 '') d_gethname="$undef";;
10569 esac
10570 case "$d_uname" in
10571 '') d_uname="$undef";;
10572 esac
10573 case "$d_uname$d_gethname" in
10574 *define*)
10575         dflt=n
10576         cat <<EOM
10577  
10578 Every now and then someone has a $call() that lies about the hostname
10579 but can't be fixed for political or economic reasons.  If you wish, I can
10580 pretend $call() isn't there and maybe compute hostname at run-time
10581 thanks to the '$phostname' command.
10582
10583 EOM
10584         rp="Shall I ignore $call() from now on?"
10585         . ./myread
10586         case "$ans" in
10587         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10588         esac;;
10589 esac
10590 case "$phostname" in
10591 '') aphostname='';;
10592 *) case "$aphostname" in
10593         /*) ;;
10594         *) set X $phostname
10595                 shift
10596                 file=$1
10597                 shift
10598                 file=`./loc $file $file $pth`
10599                 aphostname=`echo $file $*`
10600                 ;;
10601         esac
10602         ;;
10603 esac
10604 case "$d_uname$d_gethname" in
10605 *define*) ;;
10606 *)
10607         case "$phostname" in
10608         '')
10609                 echo "There will be no way for $package to get your hostname." >&4;;
10610         *)
10611         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10612                 ;;
10613         esac;;
10614 esac
10615 case "$d_phostname" in
10616 '') d_phostname="$undef";;
10617 esac
10618
10619 : see if this is a netdb.h system
10620 set netdb.h i_netdb
10621 eval $inhdr
10622
10623 : see if prototypes for various gethostxxx netdb.h functions are available
10624 echo " "
10625 set d_gethostprotos gethostent $i_netdb netdb.h
10626 eval $hasproto
10627
10628 : see if getitimer exists
10629 set getitimer d_getitimer
10630 eval $inlibc
10631
10632 : see if getlogin exists
10633 set getlogin d_getlogin
10634 eval $inlibc
10635
10636 : see if getmnt exists
10637 set getmnt d_getmnt
10638 eval $inlibc
10639
10640 : see if getmntent exists
10641 set getmntent d_getmntent
10642 eval $inlibc
10643
10644 : see if getnetbyaddr exists
10645 set getnetbyaddr d_getnbyaddr
10646 eval $inlibc
10647
10648 : see if getnetbyname exists
10649 set getnetbyname d_getnbyname
10650 eval $inlibc
10651
10652 : see if getnetent exists
10653 set getnetent d_getnent
10654 eval $inlibc
10655
10656 : see if prototypes for various getnetxxx netdb.h functions are available
10657 echo " "
10658 set d_getnetprotos getnetent $i_netdb netdb.h
10659 eval $hasproto
10660
10661 : see if getpagesize exists
10662 set getpagesize d_getpagsz
10663 eval $inlibc
10664
10665
10666 : see if getprotobyname exists
10667 set getprotobyname d_getpbyname
10668 eval $inlibc
10669
10670 : see if getprotobynumber exists
10671 set getprotobynumber d_getpbynumber
10672 eval $inlibc
10673
10674 : see if getprotoent exists
10675 set getprotoent d_getpent
10676 eval $inlibc
10677
10678 : see if getpgid exists
10679 set getpgid d_getpgid
10680 eval $inlibc
10681
10682 : see if getpgrp2 exists
10683 set getpgrp2 d_getpgrp2
10684 eval $inlibc
10685
10686 : see if getppid exists
10687 set getppid d_getppid
10688 eval $inlibc
10689
10690 : see if getpriority exists
10691 set getpriority d_getprior
10692 eval $inlibc
10693
10694 : see if prototypes for various getprotoxxx netdb.h functions are available
10695 echo " "
10696 set d_getprotoprotos getprotoent $i_netdb netdb.h
10697 eval $hasproto
10698
10699 : see if getprpwnam exists
10700 set getprpwnam d_getprpwnam
10701 eval $inlibc
10702
10703 : see if getpwent exists
10704 set getpwent d_getpwent
10705 eval $inlibc
10706
10707
10708 : see if getservbyname exists
10709 set getservbyname d_getsbyname
10710 eval $inlibc
10711
10712 : see if getservbyport exists
10713 set getservbyport d_getsbyport
10714 eval $inlibc
10715
10716 : see if getservent exists
10717 set getservent d_getsent
10718 eval $inlibc
10719
10720 : see if prototypes for various getservxxx netdb.h functions are available
10721 echo " "
10722 set d_getservprotos getservent $i_netdb netdb.h
10723 eval $hasproto
10724
10725 : see if getspnam exists
10726 set getspnam d_getspnam
10727 eval $inlibc
10728
10729 : see if gettimeofday or ftime exists
10730 set gettimeofday d_gettimeod
10731 eval $inlibc
10732 case "$d_gettimeod" in
10733 "$undef")
10734         set ftime d_ftime 
10735         eval $inlibc
10736         ;;
10737 *)
10738         val="$undef"; set d_ftime; eval $setvar
10739         ;;
10740 esac
10741 case "$d_gettimeod$d_ftime" in
10742 "$undef$undef")
10743         echo " "
10744         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10745         ;;
10746 esac
10747
10748 : see if this is an grp system
10749 set grp.h i_grp
10750 eval $inhdr
10751
10752 case "$i_grp" in
10753 $define)
10754         xxx=`./findhdr grp.h`
10755         $cppstdin $cppflags $cppminus < $xxx >$$.h
10756
10757         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10758                 val="$define"
10759         else
10760                 val="$undef"
10761         fi
10762         set d_grpasswd
10763         eval $setvar
10764
10765         $rm -f $$.h
10766         ;;
10767 *)
10768         val="$undef";
10769         set d_grpasswd; eval $setvar
10770         ;;
10771 esac
10772
10773 : see if hasmntopt exists
10774 set hasmntopt d_hasmntopt
10775 eval $inlibc
10776
10777 : see if this is a netinet/in.h or sys/in.h system
10778 set netinet/in.h i_niin sys/in.h i_sysin
10779 eval $inhdr
10780
10781 : see if arpa/inet.h has to be included
10782 set arpa/inet.h i_arpainet
10783 eval $inhdr
10784
10785 : see if htonl --and friends-- exists
10786 val=''
10787 set htonl val
10788 eval $inlibc
10789
10790 : Maybe they are macros.
10791 case "$val" in
10792 $undef)
10793         $cat >htonl.c <<EOM
10794 #include <stdio.h>
10795 #include <sys/types.h>
10796 #$i_niin I_NETINET_IN
10797 #$i_sysin I_SYS_IN
10798 #$i_arpainet I_ARPA_INET
10799 #ifdef I_NETINET_IN
10800 #include <netinet/in.h>
10801 #endif
10802 #ifdef I_SYS_IN
10803 #include <sys/in.h>
10804 #endif
10805 #ifdef I_ARPA_INET
10806 #include <arpa/inet.h>
10807 #endif
10808 #ifdef htonl
10809 printf("Defined as a macro.");
10810 #endif
10811 EOM
10812         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10813         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10814                 val="$define"
10815                 echo "But it seems to be defined as a macro." >&4
10816         fi
10817         $rm -f htonl.?
10818         ;;
10819 esac
10820 set d_htonl
10821 eval $setvar
10822
10823 : index or strchr
10824 echo " "
10825 if set index val -f; eval $csym; $val; then
10826         if set strchr val -f d_strchr; eval $csym; $val; then
10827                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10828                         val="$define"
10829                         vali="$undef"
10830                         echo "strchr() found." >&4
10831                 else
10832                         val="$undef"
10833                         vali="$define"
10834                         echo "index() found." >&4
10835                 fi
10836         else
10837                 val="$undef"
10838                 vali="$define"
10839                 echo "index() found." >&4
10840         fi
10841 else
10842         if set strchr val -f d_strchr; eval $csym; $val; then
10843                 val="$define"
10844                 vali="$undef"
10845                 echo "strchr() found." >&4
10846         else
10847                 echo "No index() or strchr() found!" >&4
10848                 val="$undef"
10849                 vali="$undef"
10850         fi
10851 fi
10852 set d_strchr; eval $setvar
10853 val="$vali"
10854 set d_index; eval $setvar
10855
10856 : check whether inet_aton exists
10857 set inet_aton d_inetaton
10858 eval $inlibc
10859
10860 : Look for isascii
10861 echo " "
10862 $cat >isascii.c <<'EOCP'
10863 #include <stdio.h>
10864 #include <ctype.h>
10865 int main() {
10866         int c = 'A';
10867         if (isascii(c))
10868                 exit(0);
10869         else
10870                 exit(1);
10871 }
10872 EOCP
10873 set isascii
10874 if eval $compile; then
10875         echo "isascii() found." >&4
10876         val="$define"
10877 else
10878         echo "isascii() NOT found." >&4
10879         val="$undef"
10880 fi
10881 set d_isascii
10882 eval $setvar
10883 $rm -f isascii*
10884
10885 : see if isfinite exists
10886 set isfinite d_isfinite
10887 eval $inlibc
10888
10889 : see if isinf exists
10890 set isinf d_isinf
10891 eval $inlibc
10892
10893 : see if isnan exists
10894 set isnan d_isnan
10895 eval $inlibc
10896
10897 : see if isnanl exists
10898 set isnanl d_isnanl
10899 eval $inlibc
10900
10901 : see if killpg exists
10902 set killpg d_killpg
10903 eval $inlibc
10904
10905 : see if lchown exists
10906 echo " "
10907 $cat > try.c <<'EOCP'
10908 /* System header to define __stub macros and hopefully few prototypes,
10909     which can conflict with char lchown(); below.  */
10910 #include <assert.h>
10911 /* Override any gcc2 internal prototype to avoid an error.  */
10912 /* We use char because int might match the return type of a gcc2
10913    builtin and then its argument prototype would still apply.  */
10914 char lchown();
10915 int main() {
10916     /*  The GNU C library defines this for functions which it implements
10917         to always fail with ENOSYS.  Some functions are actually named
10918         something starting with __ and the normal name is an alias.  */
10919 #if defined (__stub_lchown) || defined (__stub___lchown)
10920 choke me
10921 #else
10922 lchown();
10923 #endif
10924 ; return 0; }
10925 EOCP
10926 set try
10927 if eval $compile; then
10928     $echo "lchown() found." >&4
10929     val="$define"
10930 else
10931     $echo "lchown() NOT found." >&4
10932     val="$undef"
10933 fi
10934 set d_lchown
10935 eval $setvar
10936
10937 : See if number of significant digits in a double precision number is known
10938 echo " "
10939 $cat >ldbl_dig.c <<EOM
10940 #$i_limits I_LIMITS
10941 #$i_float I_FLOAT
10942 #ifdef I_LIMITS
10943 #include <limits.h>
10944 #endif
10945 #ifdef I_FLOAT
10946 #include <float.h>
10947 #endif
10948 #ifdef LDBL_DIG
10949 printf("Contains LDBL_DIG");
10950 #endif
10951 EOM
10952 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10953 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10954         echo "LDBL_DIG found." >&4
10955         val="$define"
10956 else
10957         echo "LDBL_DIG NOT found." >&4
10958         val="$undef"
10959 fi
10960 $rm -f ldbl_dig.?
10961 set d_ldbl_dig
10962 eval $setvar
10963
10964 : see if link exists
10965 set link d_link
10966 eval $inlibc
10967
10968 : see if localeconv exists
10969 set localeconv d_locconv
10970 eval $inlibc
10971
10972 : see if lockf exists
10973 set lockf d_lockf
10974 eval $inlibc
10975
10976 : see if prototype for lseek is available
10977 echo " "
10978 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10979 eval $hasproto
10980
10981 : see if lstat exists
10982 set lstat d_lstat
10983 eval $inlibc
10984
10985 : see if madvise exists
10986 set madvise d_madvise
10987 eval $inlibc
10988
10989 : see if mblen exists
10990 set mblen d_mblen
10991 eval $inlibc
10992
10993 : see if mbstowcs exists
10994 set mbstowcs d_mbstowcs
10995 eval $inlibc
10996
10997 : see if mbtowc exists
10998 set mbtowc d_mbtowc
10999 eval $inlibc
11000
11001 : see if memchr exists
11002 set memchr d_memchr
11003 eval $inlibc
11004
11005 : see if memcmp exists
11006 set memcmp d_memcmp
11007 eval $inlibc
11008
11009 : see if memcpy exists
11010 set memcpy d_memcpy
11011 eval $inlibc
11012
11013 : see if memmove exists
11014 set memmove d_memmove
11015 eval $inlibc
11016
11017 : see if memset exists
11018 set memset d_memset
11019 eval $inlibc
11020
11021 : see if mkdir exists
11022 set mkdir d_mkdir
11023 eval $inlibc
11024
11025 : see if mkdtemp exists
11026 set mkdtemp d_mkdtemp
11027 eval $inlibc
11028
11029 : see if mkfifo exists
11030 set mkfifo d_mkfifo
11031 eval $inlibc
11032
11033 : see if mkstemp exists
11034 set mkstemp d_mkstemp
11035 eval $inlibc
11036
11037 : see if mkstemps exists
11038 set mkstemps d_mkstemps
11039 eval $inlibc
11040
11041 : see if mktime exists
11042 set mktime d_mktime
11043 eval $inlibc
11044
11045 : see if this is a sys/mman.h system
11046 set sys/mman.h i_sysmman
11047 eval $inhdr
11048
11049 : see if mmap exists
11050 set mmap d_mmap
11051 eval $inlibc
11052 : see what shmat returns
11053 : default to something harmless
11054 mmaptype='void *'
11055 case "$i_sysmman$d_mmap" in
11056 "$define$define")
11057         $cat >mmap.c <<'END'
11058 #include <sys/mman.h>
11059 void *mmap();
11060 END
11061         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
11062                 mmaptype='void *'
11063         else
11064                 mmaptype='caddr_t'
11065         fi
11066         echo "and it returns ($mmaptype)." >&4
11067         ;;
11068 esac
11069
11070
11071
11072 : see if modfl exists
11073 set modfl d_modfl
11074 eval $inlibc
11075
11076 d_modfl_pow32_bug="$undef"
11077
11078 case "$d_longdbl$d_modfl" in
11079 $define$define)
11080         $cat <<EOM
11081 Checking to see whether your modfl() is okay for large values...
11082 EOM
11083 $cat >try.c <<EOCP
11084 #include <math.h> 
11085 #include <stdio.h>
11086 int main() {
11087     long double nv = 4294967303.15;
11088     long double v, w;
11089     v = modfl(nv, &w);         
11090 #ifdef __GLIBC__
11091     printf("glibc");
11092 #endif
11093     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
11094     return 0;
11095 }
11096 EOCP
11097         case "$osname:$gccversion" in
11098         aix:)   saveccflags="$ccflags"
11099                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
11100         esac
11101         set try
11102         if eval $compile; then
11103                 foo=`$run ./try`
11104                 case "$foo" in
11105                 *" 4294967303.150000 1.150000 4294967302.000000")
11106                         echo >&4 "Your modfl() is broken for large values."
11107                         d_modfl_pow32_bug="$define"
11108                         case "$foo" in
11109                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
11110                         ;;
11111                         esac
11112                         ;;
11113                 *" 4294967303.150000 0.150000 4294967303.000000")
11114                         echo >&4 "Your modfl() seems okay for large values."
11115                         ;;
11116                 *)      echo >&4 "I don't understand your modfl() at all."
11117                         d_modfl="$undef"
11118                         ;;
11119                 esac
11120                 $rm -f try.* try core core.try.*
11121         else
11122                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
11123                 d_modfl="$undef"
11124         fi
11125         case "$osname:$gccversion" in
11126         aix:)   ccflags="$saveccflags" ;; # restore
11127         esac
11128         ;;
11129 esac
11130
11131 : see if mprotect exists
11132 set mprotect d_mprotect
11133 eval $inlibc
11134
11135 : see if msgctl exists
11136 set msgctl d_msgctl
11137 eval $inlibc
11138
11139 : see if msgget exists
11140 set msgget d_msgget
11141 eval $inlibc
11142
11143 : see if msgsnd exists
11144 set msgsnd d_msgsnd
11145 eval $inlibc
11146
11147 : see if msgrcv exists
11148 set msgrcv d_msgrcv
11149 eval $inlibc
11150
11151 : see how much of the 'msg*(2)' library is present.
11152 h_msg=true
11153 echo " "
11154 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
11155 *"$undef"*) h_msg=false;;
11156 esac
11157 case "$osname" in
11158 freebsd)
11159     case "`ipcs 2>&1`" in
11160     "SVID messages"*"not configured"*)
11161         echo "Your $osname does not have the msg*(2) configured." >&4
11162         h_msg=false
11163         val="$undef"
11164         set msgctl d_msgctl
11165         eval $setvar
11166         set msgget d_msgget
11167         eval $setvar
11168         set msgsnd d_msgsnd
11169         eval $setvar
11170         set msgrcv d_msgrcv
11171         eval $setvar
11172         ;;
11173     esac
11174     ;;
11175 esac
11176 : we could also check for sys/ipc.h ...
11177 if $h_msg && $test `./findhdr sys/msg.h`; then
11178         echo "You have the full msg*(2) library." >&4
11179         val="$define"
11180 else
11181         echo "You don't have the full msg*(2) library." >&4
11182         val="$undef"
11183 fi
11184 set d_msg
11185 eval $setvar
11186
11187
11188 echo " "
11189 echo "Checking to see if your system supports struct msghdr..." >&4
11190 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11191 eval $hasstruct
11192 case "$d_msghdr_s" in
11193 "$define")      echo "Yes, it does."   ;;
11194 *)              echo "No, it doesn't." ;;
11195 esac
11196
11197
11198 : see if msync exists
11199 set msync d_msync
11200 eval $inlibc
11201
11202 : see if munmap exists
11203 set munmap d_munmap
11204 eval $inlibc
11205
11206 : see if nice exists
11207 set nice d_nice
11208 eval $inlibc
11209
11210 : see if this is a langinfo.h system
11211 set langinfo.h i_langinfo
11212 eval $inhdr
11213
11214 : see if nl_langinfo exists
11215 set nl_langinfo d_nl_langinfo
11216 eval $inlibc
11217
11218 : check for length of character
11219 echo " "
11220 case "$charsize" in
11221 '')
11222         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11223         $cat >try.c <<'EOCP'
11224 #include <stdio.h>
11225 int main()
11226 {
11227     printf("%d\n", (int)sizeof(char));
11228     exit(0);
11229 }
11230 EOCP
11231         set try
11232         if eval $compile_ok; then
11233                 dflt=`$run ./try`
11234         else
11235                 dflt='1'
11236                 echo "(I can't seem to compile the test program.  Guessing...)"
11237         fi
11238         ;;
11239 *)
11240         dflt="$charsize"
11241         ;;
11242 esac
11243 rp="What is the size of a character (in bytes)?"
11244 . ./myread
11245 charsize="$ans"
11246 $rm -f try.c try
11247
11248 : check for volatile keyword
11249 echo " "
11250 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11251 $cat >try.c <<'EOCP'
11252 int main()
11253 {
11254         typedef struct _goo_struct goo_struct;
11255         goo_struct * volatile goo = ((goo_struct *)0);
11256         struct _goo_struct {
11257                 long long_int;
11258                 int reg_int;
11259                 char char_var;
11260         };
11261         typedef unsigned short foo_t;
11262         char *volatile foo;
11263         volatile int bar;
11264         volatile foo_t blech;
11265         foo = foo;
11266 }
11267 EOCP
11268 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11269         val="$define"
11270         echo "Yup, it does."
11271 else
11272         val="$undef"
11273         echo "Nope, it doesn't."
11274 fi
11275 set d_volatile
11276 eval $setvar
11277 $rm -f try.*
11278
11279
11280 echo " "
11281 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11282
11283 case "$use64bitint:$d_quad:$quadtype" in
11284 define:define:?*)
11285         ivtype="$quadtype"
11286         uvtype="$uquadtype"
11287         ivsize=8
11288         uvsize=8
11289         ;;
11290 *)      ivtype="long"
11291         uvtype="unsigned long"
11292         ivsize=$longsize
11293         uvsize=$longsize
11294         ;;
11295 esac
11296
11297 case "$uselongdouble:$d_longdbl" in
11298 define:define)
11299         nvtype="long double"
11300         nvsize=$longdblsize
11301         ;;
11302 *)      nvtype=double
11303         nvsize=$doublesize
11304         ;;
11305 esac
11306
11307 $echo "(IV will be "$ivtype", $ivsize bytes)"
11308 $echo "(UV will be "$uvtype", $uvsize bytes)"
11309 $echo "(NV will be "$nvtype", $nvsize bytes)"
11310
11311 $cat >try.c <<EOCP
11312 #$i_inttypes I_INTTYPES
11313 #ifdef I_INTTYPES
11314 #include <inttypes.h>
11315 #endif
11316 #include <stdio.h>
11317 int main() {
11318 #ifdef INT8
11319    int8_t i =  INT8_MAX;
11320   uint8_t u = UINT8_MAX;
11321   printf("int8_t\n");
11322 #endif
11323 #ifdef INT16
11324    int16_t i =  INT16_MAX;
11325   uint16_t i = UINT16_MAX;
11326   printf("int16_t\n");
11327 #endif
11328 #ifdef INT32
11329    int32_t i =  INT32_MAX;
11330   uint32_t u = UINT32_MAX;
11331   printf("int32_t\n");
11332 #endif
11333 }
11334 EOCP
11335
11336 case "$i8type" in
11337 '')     case "$charsize" in
11338         1)      i8type=char
11339                 u8type="unsigned char"
11340                 i8size=$charsize
11341                 u8size=$charsize
11342                 ;;
11343         esac
11344         ;;
11345 esac
11346 case "$i8type" in
11347 '')     set try -DINT8
11348         if eval $compile; then
11349                 case "`$run ./try`" in
11350                 int8_t) i8type=int8_t
11351                         u8type=uint8_t
11352                         i8size=1
11353                         u8size=1
11354                         ;;
11355                 esac
11356         fi
11357         ;;
11358 esac
11359 case "$i8type" in
11360 '')     if $test $charsize -ge 1; then
11361                 i8type=char
11362                 u8type="unsigned char"
11363                 i8size=$charsize
11364                 u8size=$charsize
11365         fi
11366         ;;
11367 esac
11368
11369 case "$i16type" in
11370 '')     case "$shortsize" in
11371         2)      i16type=short
11372                 u16type="unsigned short"
11373                 i16size=$shortsize
11374                 u16size=$shortsize
11375                 ;;
11376         esac
11377         ;;
11378 esac
11379 case "$i16type" in
11380 '')     set try -DINT16
11381         if eval $compile; then
11382                 case "`$run ./try`" in
11383                 int16_t)
11384                         i16type=int16_t
11385                         u16type=uint16_t
11386                         i16size=2
11387                         u16size=2
11388                         ;;
11389                 esac
11390         fi
11391         ;;
11392 esac
11393 case "$i16type" in
11394 '')     if $test $shortsize -ge 2; then
11395                 i16type=short
11396                 u16type="unsigned short"
11397                 i16size=$shortsize
11398                 u16size=$shortsize
11399         fi
11400         ;;
11401 esac
11402
11403 case "$i32type" in
11404 '')     case "$longsize" in
11405         4)      i32type=long
11406                 u32type="unsigned long"
11407                 i32size=$longsize
11408                 u32size=$longsize
11409                 ;;
11410         *)      case "$intsize" in
11411                 4)      i32type=int
11412                         u32type="unsigned int"
11413                         i32size=$intsize
11414                         u32size=$intsize
11415                         ;;
11416                 esac
11417                 ;;
11418         esac
11419         ;;
11420 esac
11421 case "$i32type" in
11422 '')     set try -DINT32
11423         if eval $compile; then
11424                 case "`$run ./try`" in
11425                 int32_t)
11426                         i32type=int32_t
11427                         u32type=uint32_t
11428                         i32size=4
11429                         u32size=4
11430                         ;;
11431                 esac
11432         fi
11433         ;;
11434 esac
11435 case "$i32type" in
11436 '')     if $test $intsize -ge 4; then
11437                 i32type=int
11438                 u32type="unsigned int"
11439                 i32size=$intsize
11440                 u32size=$intsize
11441         fi
11442         ;;
11443 esac
11444
11445 case "$i64type" in
11446 '')     case "$d_quad:$quadtype" in
11447         define:?*)
11448                 i64type="$quadtype"
11449                 u64type="$uquadtype"
11450                 i64size=8
11451                 u64size=8
11452                 ;;
11453         esac
11454         ;;
11455 esac
11456
11457 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11458 : volatile so that the compiler has to store it out to memory.
11459 if test X"$d_volatile" = X"$define"; then
11460         volatile=volatile
11461 fi
11462 $cat <<EOP >try.c
11463 #include <stdio.h>
11464 #include <sys/types.h>
11465 #include <signal.h>
11466 #ifdef SIGFPE
11467 $volatile int bletched = 0;
11468 $signal_t blech(s) int s; { bletched = 1; }
11469 #endif
11470 int main() {
11471     $uvtype u = 0;
11472     $nvtype d;
11473     int     n = 8 * $uvsize;
11474     int     i;
11475 #ifdef SIGFPE
11476     signal(SIGFPE, blech);
11477 #endif
11478
11479     for (i = 0; i < n; i++) {
11480       u = u << 1 | ($uvtype)1;
11481       d = ($nvtype)u;
11482       if (($uvtype)d != u)
11483         break;
11484       if (d <= 0)
11485         break;
11486       d = ($nvtype)(u - 1);
11487       if (($uvtype)d != (u - 1))
11488         break;
11489 #ifdef SIGFPE
11490       if (bletched) {
11491         break;
11492 #endif
11493       } 
11494     }
11495     printf("%d\n", ((i == n) ? -n : i));
11496     exit(0);
11497 }
11498 EOP
11499 set try
11500
11501 d_nv_preserves_uv="$undef"
11502 if eval $compile; then
11503         d_nv_preserves_uv_bits="`$run ./try`"
11504 fi
11505 case "$d_nv_preserves_uv_bits" in
11506 \-[1-9]*)       
11507         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11508         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11509         d_nv_preserves_uv="$define"
11510         ;;
11511 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11512         d_nv_preserves_uv="$undef" ;;
11513 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11514         d_nv_preserves_uv_bits="$undef" ;;
11515 esac
11516
11517 $rm -f try.* try
11518
11519
11520 : check for off64_t
11521 echo " "
11522 echo "Checking to see if you have off64_t..." >&4
11523 $cat >try.c <<EOCP
11524 #include <sys/types.h>
11525 #include <unistd.h>
11526 int main() { off64_t x = 7; }
11527 EOCP
11528 set try
11529 if eval $compile; then
11530         val="$define"
11531         echo "You have off64_t."
11532 else
11533         val="$undef"
11534         echo "You do not have off64_t."
11535         case "$lseeksize" in
11536         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11537         esac
11538 fi
11539 $rm -f try.* try
11540 set d_off64_t
11541 eval $setvar
11542
11543 : see if POSIX threads are available
11544 set pthread.h i_pthread
11545 eval $inhdr
11546
11547
11548
11549
11550 : how to create joinable pthreads
11551 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11552         echo " "
11553         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11554         $cat >try.c <<'EOCP'
11555 #include <pthread.h>
11556 int main() {
11557     int detachstate = JOINABLE;
11558 }
11559 EOCP
11560         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11561         if eval $compile; then
11562                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11563                 val="$undef" # Yes, undef.
11564                 set d_old_pthread_create_joinable
11565                 eval $setvar
11566                 val=""
11567                 set old_pthread_create_joinable
11568                 eval $setvar
11569         else
11570                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11571                 if eval $compile; then
11572                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11573                         val="$define"
11574                         set d_old_pthread_create_joinable
11575                         eval $setvar
11576                         val=PTHREAD_CREATE_UNDETACHED
11577                         set old_pthread_create_joinable
11578                         eval $setvar
11579                 else            
11580                         set try -DJOINABLE=__UNDETACHED
11581                         if eval $compile; then
11582                                 echo "You seem to use __UNDETACHED." >&4
11583                                 val="$define"
11584                                 set d_old_pthread_create_joinable
11585                                 eval $setvar
11586                                 val=__UNDETACHED
11587                                 set old_pthread_create_joinable
11588                                 eval $setvar
11589                         else
11590                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11591                                 val="$define"
11592                                 set d_old_pthread_create_joinable
11593                                 eval $setvar
11594                                 val=0
11595                                 set old_pthread_create_joinable
11596                                 eval $setvar
11597                         fi
11598                 fi
11599         fi
11600         $rm -f try try.*
11601 else
11602     d_old_pthread_create_joinable="$undef"
11603     old_pthread_create_joinable=""
11604 fi
11605
11606 : see if pause exists
11607 set pause d_pause
11608 eval $inlibc
11609
11610 : see if pipe exists
11611 set pipe d_pipe
11612 eval $inlibc
11613
11614 : see if poll exists
11615 set poll d_poll
11616 eval $inlibc
11617
11618 : see if readlink exists
11619 set readlink d_readlink
11620 eval $inlibc
11621
11622 echo " "
11623 procselfexe=''
11624 val="$undef"
11625 case "$d_readlink" in
11626 "$define")
11627         if $issymlink /proc/self/exe ; then
11628                 $ls -l /proc/self/exe > reflect
11629                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11630                         echo "You have Linux-like /proc/self/exe."
11631                         procselfexe='"/proc/self/exe"'
11632                         val="$define"
11633                 fi
11634         fi
11635         if $issymlink /proc/curproc/file ; then
11636                 $ls -l /proc/curproc/file > reflect
11637                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11638                         echo "You have BSD-like /proc/curproc/file."
11639                         procselfexe='"/proc/curproc/file"'
11640                         val="$define"
11641                 fi
11642         fi
11643         ;;
11644 esac
11645 $rm -f reflect
11646 set d_procselfexe
11647 eval $setvar
11648
11649 : see if pthread_atfork exists
11650 set pthread_atfork d_pthread_atfork
11651 eval $inlibc
11652
11653
11654 : see whether the various POSIXish _yields exist
11655 $cat >try.c <<EOP
11656 #include <pthread.h>
11657 #include <stdio.h>
11658 int main() {
11659 #ifdef SCHED_YIELD
11660         sched_yield();
11661 #else
11662 #ifdef PTHREAD_YIELD
11663         pthread_yield();
11664 #else
11665 #ifdef PTHREAD_YIELD_NULL
11666         pthread_yield(NULL);
11667 #endif
11668 #endif
11669 #endif
11670 }
11671 EOP
11672 : see if sched_yield exists
11673 set try -DSCHED_YIELD
11674 if eval $compile; then
11675     val="$define"
11676     sched_yield='sched_yield()'
11677 else
11678     val="$undef"
11679 fi
11680 case "$usethreads" in
11681 $define)
11682         case "$val" in
11683         $define) echo 'sched_yield() found.' >&4        ;;
11684         *)       echo 'sched_yield() NOT found.' >&4    ;;
11685         esac
11686 esac
11687 set d_sched_yield
11688 eval $setvar
11689
11690 : see if pthread_yield exists
11691 set try -DPTHREAD_YIELD
11692 if eval $compile; then
11693     val="$define"
11694     case "$sched_yield" in
11695     '') sched_yield='pthread_yield()' ;;
11696     esac
11697 else
11698     set try -DPTHREAD_YIELD_NULL
11699     if eval $compile; then
11700         val="$define"
11701         case "$sched_yield" in
11702         '') sched_yield='pthread_yield(NULL)' ;;
11703         esac
11704     else
11705         val="$undef"
11706     fi
11707 fi
11708 case "$usethreads" in
11709 $define)
11710         case "$val" in
11711         $define) echo 'pthread_yield() found.' >&4      ;;
11712         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11713         esac
11714         ;;
11715 esac
11716 set d_pthread_yield
11717 eval $setvar
11718
11719 case "$sched_yield" in
11720 '') sched_yield=undef ;;
11721 esac
11722
11723 $rm -f try try.*
11724
11725 : see if this is a pwd.h system
11726 set pwd.h i_pwd
11727 eval $inhdr
11728
11729 case "$i_pwd" in
11730 $define)
11731         xxx=`./findhdr pwd.h`
11732         $cppstdin $cppflags $cppminus < $xxx >$$.h
11733
11734         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11735                 val="$define"
11736         else
11737                 val="$undef"
11738         fi
11739         set d_pwquota
11740         eval $setvar
11741
11742         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11743                 val="$define"
11744         else
11745                 val="$undef"
11746         fi
11747         set d_pwage
11748         eval $setvar
11749
11750         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11751                 val="$define"
11752         else
11753                 val="$undef"
11754         fi
11755         set d_pwchange
11756         eval $setvar
11757
11758         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11759                 val="$define"
11760         else
11761                 val="$undef"
11762         fi
11763         set d_pwclass
11764         eval $setvar
11765
11766         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11767                 val="$define"
11768         else
11769                 val="$undef"
11770         fi
11771         set d_pwexpire
11772         eval $setvar
11773
11774         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11775                 val="$define"
11776         else
11777                 val="$undef"
11778         fi
11779         set d_pwcomment
11780         eval $setvar
11781
11782         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11783                 val="$define"
11784         else
11785                 val="$undef"
11786         fi
11787         set d_pwgecos
11788         eval $setvar
11789
11790         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11791                 val="$define"
11792         else
11793                 val="$undef"
11794         fi
11795         set d_pwpasswd
11796         eval $setvar
11797
11798         $rm -f $$.h
11799         ;;
11800 *)
11801         val="$undef"; 
11802         set d_pwquota; eval $setvar
11803         set d_pwage; eval $setvar
11804         set d_pwchange; eval $setvar
11805         set d_pwclass; eval $setvar
11806         set d_pwexpire; eval $setvar
11807         set d_pwcomment; eval $setvar
11808         set d_pwgecos; eval $setvar
11809         set d_pwpasswd; eval $setvar
11810         ;;
11811 esac
11812
11813 : see if readdir and friends exist
11814 set readdir d_readdir
11815 eval $inlibc
11816 set seekdir d_seekdir
11817 eval $inlibc
11818 set telldir d_telldir
11819 eval $inlibc
11820 set rewinddir d_rewinddir
11821 eval $inlibc
11822
11823 : see if readv exists
11824 set readv d_readv
11825 eval $inlibc
11826
11827 : see if recvmsg exists
11828 set recvmsg d_recvmsg
11829 eval $inlibc
11830
11831 : see if rename exists
11832 set rename d_rename
11833 eval $inlibc
11834
11835 : see if rmdir exists
11836 set rmdir d_rmdir
11837 eval $inlibc
11838
11839 : see if memory.h is available.
11840 val=''
11841 set memory.h val
11842 eval $inhdr
11843
11844 : See if it conflicts with string.h
11845 case "$val" in
11846 $define)
11847         case "$strings" in
11848         '') ;;
11849         *)
11850                 $cppstdin $cppflags $cppminus < $strings > mem.h
11851                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11852                         echo " "
11853                         echo "We won't be including <memory.h>."
11854                         val="$undef"
11855                 fi
11856                 $rm -f mem.h
11857                 ;;
11858         esac
11859 esac
11860 set i_memory
11861 eval $setvar
11862
11863 : can bcopy handle overlapping blocks?
11864 echo " "
11865 val="$undef"
11866 case "$d_memmove" in
11867 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11868 *)      case "$d_bcopy" in
11869         "$define")
11870                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11871                 $cat >try.c <<EOCP
11872 #$i_memory I_MEMORY
11873 #$i_stdlib I_STDLIB
11874 #$i_string I_STRING
11875 #$i_unistd I_UNISTD
11876 EOCP
11877         $cat >>try.c <<'EOCP'
11878 #include <stdio.h>
11879 #ifdef I_MEMORY
11880 #  include <memory.h>
11881 #endif
11882 #ifdef I_STDLIB
11883 #  include <stdlib.h>
11884 #endif
11885 #ifdef I_STRING
11886 #  include <string.h>
11887 #else
11888 #  include <strings.h>
11889 #endif
11890 #ifdef I_UNISTD
11891 #  include <unistd.h>  /* Needed for NetBSD */
11892 #endif
11893 int main()
11894 {
11895 char buf[128], abc[128];
11896 char *b;
11897 int len;
11898 int off;
11899 int align;
11900
11901 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11902    try to store the string in read-only memory. */
11903 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11904
11905 for (align = 7; align >= 0; align--) {
11906         for (len = 36; len; len--) {
11907                 b = buf+align;
11908                 bcopy(abc, b, len);
11909                 for (off = 1; off <= len; off++) {
11910                         bcopy(b, b+off, len);
11911                         bcopy(b+off, b, len);
11912                         if (bcmp(b, abc, len))
11913                                 exit(1);
11914                 }
11915         }
11916 }
11917 exit(0);
11918 }
11919 EOCP
11920                 set try
11921                 if eval $compile_ok; then
11922                         if ./try 2>/dev/null; then
11923                                 echo "Yes, it can."
11924                                 val="$define"
11925                         else
11926                                 echo "It can't, sorry."
11927                         fi
11928                 else
11929                         echo "(I can't compile the test program, so we'll assume not...)"
11930                 fi
11931                 ;;
11932         esac
11933         $rm -f try.* try core
11934         ;;
11935 esac
11936 set d_safebcpy
11937 eval $setvar
11938
11939 : can memcpy handle overlapping blocks?
11940 echo " "
11941 val="$undef"
11942 case "$d_memmove" in
11943 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11944 *)      case "$d_memcpy" in
11945         "$define")
11946                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11947                 $cat >try.c <<EOCP
11948 #$i_memory I_MEMORY
11949 #$i_stdlib I_STDLIB
11950 #$i_string I_STRING
11951 #$i_unistd I_UNISTD
11952 EOCP
11953         $cat >>try.c <<'EOCP'
11954 #include <stdio.h>
11955 #ifdef I_MEMORY
11956 #  include <memory.h>
11957 #endif
11958 #ifdef I_STDLIB
11959 #  include <stdlib.h>
11960 #endif
11961 #ifdef I_STRING
11962 #  include <string.h>
11963 #else
11964 #  include <strings.h>
11965 #endif
11966 #ifdef I_UNISTD
11967 #  include <unistd.h>  /* Needed for NetBSD */
11968 #endif
11969 int main()
11970 {
11971 char buf[128], abc[128];
11972 char *b;
11973 int len;
11974 int off;
11975 int align;
11976
11977 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11978    try to store the string in read-only memory. */
11979 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11980
11981 for (align = 7; align >= 0; align--) {
11982         for (len = 36; len; len--) {
11983                 b = buf+align;
11984                 memcpy(b, abc, len);
11985                 for (off = 1; off <= len; off++) {
11986                         memcpy(b+off, b, len);
11987                         memcpy(b, b+off, len);
11988                         if (memcmp(b, abc, len))
11989                                 exit(1);
11990                 }
11991         }
11992 }
11993 exit(0);
11994 }
11995 EOCP
11996                 set try
11997                 if eval $compile_ok; then
11998                         if ./try 2>/dev/null; then
11999                                 echo "Yes, it can."
12000                                 val="$define"
12001                         else
12002                                 echo "It can't, sorry."
12003                         fi
12004                 else
12005                         echo "(I can't compile the test program, so we'll assume not...)"
12006                 fi
12007                 ;;
12008         esac
12009         $rm -f try.* try core
12010         ;;
12011 esac
12012 set d_safemcpy
12013 eval $setvar
12014
12015 : can memcmp be trusted to compare relative magnitude?
12016 val="$undef"
12017 case "$d_memcmp" in
12018 "$define")
12019         echo " "
12020         echo "Checking if your memcmp() can compare relative magnitude..." >&4
12021         $cat >try.c <<EOCP
12022 #$i_memory I_MEMORY
12023 #$i_stdlib I_STDLIB
12024 #$i_string I_STRING
12025 #$i_unistd I_UNISTD
12026 EOCP
12027         $cat >>try.c <<'EOCP'
12028 #include <stdio.h>
12029 #ifdef I_MEMORY
12030 #  include <memory.h>
12031 #endif
12032 #ifdef I_STDLIB
12033 #  include <stdlib.h>
12034 #endif
12035 #ifdef I_STRING
12036 #  include <string.h>
12037 #else
12038 #  include <strings.h>
12039 #endif
12040 #ifdef I_UNISTD
12041 #  include <unistd.h>  /* Needed for NetBSD */
12042 #endif
12043 int main()
12044 {
12045 char a = -1;
12046 char b = 0;
12047 if ((a < b) && memcmp(&a, &b, 1) < 0)
12048         exit(1);
12049 exit(0);
12050 }
12051 EOCP
12052         set try
12053         if eval $compile_ok; then
12054                 if $run ./try 2>/dev/null; then
12055                         echo "Yes, it can."
12056                         val="$define"
12057                 else
12058                         echo "No, it can't (it uses signed chars)."
12059                 fi
12060         else
12061                 echo "(I can't compile the test program, so we'll assume not...)"
12062         fi
12063         ;;
12064 esac
12065 $rm -f try.* try core
12066 set d_sanemcmp
12067 eval $setvar
12068
12069 : see if prototype for sbrk is available
12070 echo " "
12071 set d_sbrkproto sbrk $i_unistd unistd.h
12072 eval $hasproto
12073
12074 : see if select exists
12075 set select d_select
12076 eval $inlibc
12077
12078 : see if semctl exists
12079 set semctl d_semctl
12080 eval $inlibc
12081
12082 : see if semget exists
12083 set semget d_semget
12084 eval $inlibc
12085
12086 : see if semop exists
12087 set semop d_semop
12088 eval $inlibc
12089
12090 : see how much of the 'sem*(2)' library is present.
12091 h_sem=true
12092 echo " "
12093 case "$d_semctl$d_semget$d_semop" in
12094 *"$undef"*) h_sem=false;;
12095 esac
12096 case "$osname" in
12097 freebsd)
12098     case "`ipcs 2>&1`" in
12099     "SVID messages"*"not configured"*)
12100         echo "Your $osname does not have the sem*(2) configured." >&4
12101         h_sem=false
12102         val="$undef"
12103         set semctl d_semctl
12104         eval $setvar
12105         set semget d_semget
12106         eval $setvar
12107         set semop d_semop
12108         eval $setvar
12109         ;;
12110     esac
12111     ;;
12112 esac
12113 : we could also check for sys/ipc.h ...
12114 if $h_sem && $test `./findhdr sys/sem.h`; then
12115         echo "You have the full sem*(2) library." >&4
12116         val="$define"
12117 else
12118         echo "You don't have the full sem*(2) library." >&4
12119         val="$undef"
12120 fi
12121 set d_sem
12122 eval $setvar
12123
12124 : see whether sys/sem.h defines union semun
12125 echo " "
12126 $cat > try.c <<'END'
12127 #include <sys/types.h>
12128 #include <sys/ipc.h>
12129 #include <sys/sem.h>
12130 int main () { union semun semun; semun.buf = 0; }
12131 END
12132 set try
12133 if eval $compile; then
12134     echo "You have union semun in <sys/sem.h>." >&4
12135     val="$define"
12136 else
12137     echo "You do not have union semun in <sys/sem.h>." >&4
12138     val="$undef"
12139 fi
12140 $rm -f try try.c try.h
12141 set d_union_semun
12142 eval $setvar
12143
12144 : see how to do semctl IPC_STAT
12145 case "$d_sem" in
12146 $define)
12147     : see whether semctl IPC_STAT can use union semun
12148     echo " "
12149     $cat > try.h <<END
12150 #ifndef S_IRUSR
12151 #   ifdef S_IREAD
12152 #       define S_IRUSR S_IREAD
12153 #       define S_IWUSR S_IWRITE
12154 #       define S_IXUSR S_IEXEC
12155 #   else
12156 #       define S_IRUSR 0400
12157 #       define S_IWUSR 0200
12158 #       define S_IXUSR 0100
12159 #   endif
12160 #   define S_IRGRP (S_IRUSR>>3)
12161 #   define S_IWGRP (S_IWUSR>>3)
12162 #   define S_IXGRP (S_IXUSR>>3)
12163 #   define S_IROTH (S_IRUSR>>6)
12164 #   define S_IWOTH (S_IWUSR>>6)
12165 #   define S_IXOTH (S_IXUSR>>6)
12166 #endif
12167 #ifndef S_IRWXU
12168 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
12169 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
12170 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
12171 #endif
12172 END
12173
12174     $cat > try.c <<END
12175 #include <sys/types.h>
12176 #include <sys/ipc.h>
12177 #include <sys/sem.h>
12178 #include <sys/stat.h>
12179 #include <stdio.h>
12180 #include <errno.h>
12181 #include "try.h"
12182 #ifndef errno
12183 extern int errno;
12184 #endif
12185 #$d_union_semun HAS_UNION_SEMUN
12186 int main() {
12187     union semun
12188 #ifndef HAS_UNION_SEMUN
12189     {
12190         int val;
12191         struct semid_ds *buf;
12192         unsigned short *array;
12193     }
12194 #endif
12195     arg;
12196     int sem, st;
12197
12198 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
12199     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12200     if (sem > -1) {
12201         struct semid_ds argbuf;
12202         arg.buf = &argbuf;
12203 #       ifdef IPC_STAT
12204         st = semctl(sem, 0, IPC_STAT, arg);
12205         if (st == 0)
12206             printf("semun\n");
12207         else
12208 #       endif /* IPC_STAT */
12209             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12210 #       ifdef IPC_RMID
12211         if (semctl(sem, 0, IPC_RMID, arg) != 0)
12212 #       endif /* IPC_RMID */
12213             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12214     } else
12215 #endif /* IPC_PRIVATE && ... */
12216         printf("semget failed: errno = %d\n", errno);
12217   return 0;
12218 }
12219 END
12220     val="$undef"
12221     set try
12222     if eval $compile; then
12223         xxx=`$run ./try`
12224         case "$xxx" in
12225         semun) val="$define" ;;
12226         esac
12227     fi
12228     $rm -f try try.c
12229     set d_semctl_semun
12230     eval $setvar
12231     case "$d_semctl_semun" in
12232     $define)
12233         echo "You can use union semun for semctl IPC_STAT." >&4
12234         also='also'
12235         ;;
12236     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
12237         also=''
12238         ;;
12239     esac
12240
12241     : see whether semctl IPC_STAT can use struct semid_ds pointer
12242     $cat > try.c <<'END'
12243 #include <sys/types.h>
12244 #include <sys/ipc.h>
12245 #include <sys/sem.h>
12246 #include <sys/stat.h>
12247 #include "try.h"
12248 #include <stdio.h>
12249 #include <errno.h>
12250 #ifndef errno
12251 extern int errno;
12252 #endif
12253 int main() {
12254     struct semid_ds arg;
12255     int sem, st;
12256
12257 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
12258     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12259     if (sem > -1) {
12260 #       ifdef IPC_STAT
12261         st = semctl(sem, 0, IPC_STAT, &arg);
12262         if (st == 0)
12263             printf("semid_ds\n");
12264         else
12265 #       endif /* IPC_STAT */
12266             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12267 #       ifdef IPC_RMID
12268         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
12269 #       endif /* IPC_RMID */
12270             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12271     } else
12272 #endif /* IPC_PRIVATE && ... */
12273         printf("semget failed: errno = %d\n", errno);
12274
12275     return 0;
12276 }
12277 END
12278     val="$undef"
12279     set try
12280     if eval $compile; then
12281         xxx=`$run ./try`
12282         case "$xxx" in
12283         semid_ds) val="$define" ;;
12284         esac
12285     fi
12286     $rm -f try try.c
12287     set d_semctl_semid_ds
12288     eval $setvar
12289     case "$d_semctl_semid_ds" in
12290     $define)
12291         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
12292         ;;
12293     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
12294         ;;
12295     esac
12296     $rm -f try.h
12297     ;;
12298 *)  val="$undef"
12299
12300     # We do not have the full sem*(2) library, so assume we can not
12301     # use either.
12302
12303     set d_semctl_semun
12304     eval $setvar
12305
12306     set d_semctl_semid_ds
12307     eval $setvar
12308     ;;
12309 esac
12310
12311 : see if sendmsg exists
12312 set sendmsg d_sendmsg
12313 eval $inlibc
12314
12315 : see if setegid exists
12316 set setegid d_setegid
12317 eval $inlibc
12318
12319 : see if seteuid exists
12320 set seteuid d_seteuid
12321 eval $inlibc
12322
12323 : see if setgrent exists
12324 set setgrent d_setgrent
12325 eval $inlibc
12326
12327 : see if sethostent exists
12328 set sethostent d_sethent
12329 eval $inlibc
12330
12331 : see if setitimer exists
12332 set setitimer d_setitimer
12333 eval $inlibc
12334
12335 : see if setlinebuf exists
12336 set setlinebuf d_setlinebuf
12337 eval $inlibc
12338
12339 : see if setlocale exists
12340 set setlocale d_setlocale
12341 eval $inlibc
12342
12343 : see if setnetent exists
12344 set setnetent d_setnent
12345 eval $inlibc
12346
12347 : see if setprotoent exists
12348 set setprotoent d_setpent
12349 eval $inlibc
12350
12351 : see if setpgid exists
12352 set setpgid d_setpgid
12353 eval $inlibc
12354
12355 : see if setpgrp2 exists
12356 set setpgrp2 d_setpgrp2
12357 eval $inlibc
12358
12359 : see if setpriority exists
12360 set setpriority d_setprior
12361 eval $inlibc
12362
12363 : see if setproctitle exists
12364 set setproctitle d_setproctitle
12365 eval $inlibc
12366
12367 : see if setpwent exists
12368 set setpwent d_setpwent
12369 eval $inlibc
12370
12371 : see if setregid exists
12372 set setregid d_setregid
12373 eval $inlibc
12374 set setresgid d_setresgid
12375 eval $inlibc
12376
12377 : see if setreuid exists
12378 set setreuid d_setreuid
12379 eval $inlibc
12380 set setresuid d_setresuid
12381 eval $inlibc
12382
12383 : see if setrgid exists
12384 set setrgid d_setrgid
12385 eval $inlibc
12386
12387 : see if setruid exists
12388 set setruid d_setruid
12389 eval $inlibc
12390
12391 : see if setservent exists
12392 set setservent d_setsent
12393 eval $inlibc
12394
12395 : see if setsid exists
12396 set setsid d_setsid
12397 eval $inlibc
12398
12399 : see if setvbuf exists
12400 set setvbuf d_setvbuf
12401 eval $inlibc
12402
12403 : see if sfio.h is available
12404 set sfio.h i_sfio
12405 eval $inhdr
12406
12407
12408 : see if sfio library is available
12409 case "$i_sfio" in
12410 $define)
12411         val=''
12412         set sfreserve val
12413         eval $inlibc
12414         ;;
12415 *)
12416         val="$undef"
12417         ;;
12418 esac
12419 : Ok, but do we want to use it.
12420 case "$val" in
12421 $define)
12422         case "$usesfio" in
12423         true|$define|[yY]*) dflt='y';;
12424         *) dflt='n';;
12425         esac
12426         echo "$package can use the sfio library, but it is experimental."
12427         case "$useperlio" in
12428         "$undef")
12429             echo "For sfio also the PerlIO abstraction layer is needed."
12430             echo "Earlier you said you wouldn't want that."
12431             ;;
12432         esac
12433         rp="You seem to have sfio available, do you want to try using it?"
12434         . ./myread
12435         case "$ans" in
12436         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12437                 useperlio="$define"
12438                 val="$define"
12439                 ;;
12440         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12441                 val="$undef"
12442                 ;;
12443         esac
12444         ;;
12445 *)      case "$usesfio" in
12446         true|$define|[yY]*)
12447                 echo "Sorry, cannot find sfio on this machine." >&4
12448                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12449                 val="$undef"
12450                 ;;
12451         esac
12452         ;;
12453 esac
12454 set d_sfio
12455 eval $setvar
12456 case "$d_sfio" in
12457 $define) usesfio='true';;
12458 *) usesfio='false';;
12459 esac
12460 case "$d_sfio" in
12461 $define) ;;
12462 *)      : Remove sfio from list of libraries to use
12463         case "$libs" in
12464         *-lsfio*)
12465                 echo "Removing unneeded -lsfio from library list" >&4
12466                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12467                 shift
12468                 libs="$*"
12469                 echo "libs = $libs" >&4
12470                 ;;
12471         esac
12472 ;;
12473 esac
12474
12475
12476 : see if shmctl exists
12477 set shmctl d_shmctl
12478 eval $inlibc
12479
12480 : see if shmget exists
12481 set shmget d_shmget
12482 eval $inlibc
12483
12484 : see if shmat exists
12485 set shmat d_shmat
12486 eval $inlibc
12487 : see what shmat returns
12488 case "$d_shmat" in
12489 "$define")
12490         $cat >shmat.c <<'END'
12491 #include <sys/shm.h>
12492 void *shmat();
12493 END
12494         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12495                 shmattype='void *'
12496         else
12497                 shmattype='char *'
12498         fi
12499         echo "and it returns ($shmattype)." >&4
12500         : see if a prototype for shmat is available
12501         xxx=`./findhdr sys/shm.h`
12502         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12503         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12504                 val="$define"
12505         else
12506                 val="$undef"
12507         fi
12508         $rm -f shmat.[co]
12509         ;;
12510 *)
12511         val="$undef"
12512         ;;
12513 esac
12514 set d_shmatprototype
12515 eval $setvar
12516
12517 : see if shmdt exists
12518 set shmdt d_shmdt
12519 eval $inlibc
12520
12521 : see how much of the 'shm*(2)' library is present.
12522 h_shm=true
12523 echo " "
12524 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12525 *"$undef"*) h_shm=false;;
12526 esac
12527 case "$osname" in
12528 freebsd)
12529     case "`ipcs 2>&1`" in
12530     "SVID shared memory"*"not configured"*)
12531         echo "Your $osname does not have the shm*(2) configured." >&4
12532         h_shm=false
12533         val="$undef"
12534         set shmctl d_shmctl
12535         evat $setvar
12536         set shmget d_shmget
12537         evat $setvar
12538         set shmat d_shmat
12539         evat $setvar
12540         set shmdt d_shmdt
12541         evat $setvar
12542         ;;
12543     esac
12544     ;;
12545 esac
12546 : we could also check for sys/ipc.h ...
12547 if $h_shm && $test `./findhdr sys/shm.h`; then
12548         echo "You have the full shm*(2) library." >&4
12549         val="$define"
12550 else
12551         echo "You don't have the full shm*(2) library." >&4
12552         val="$undef"
12553 fi
12554 set d_shm
12555 eval $setvar
12556
12557 echo " "
12558 : see if we have sigaction
12559 if set sigaction val -f d_sigaction; eval $csym; $val; then
12560         echo 'sigaction() found.' >&4
12561         $cat > try.c <<'EOP'
12562 #include <stdio.h>
12563 #include <sys/types.h>
12564 #include <signal.h>
12565 int main()
12566 {
12567     struct sigaction act, oact;
12568     act.sa_flags = 0;
12569     oact.sa_handler = 0;
12570     /* so that act and oact are used */
12571     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12572 }
12573 EOP
12574         set try
12575         if eval $compile_ok; then
12576                 val="$define"
12577         else
12578                 echo "But you don't seem to have a useable struct sigaction." >&4
12579                 val="$undef"
12580         fi
12581 else
12582         echo 'sigaction NOT found.' >&4
12583         val="$undef"
12584 fi
12585 set d_sigaction; eval $setvar
12586 $rm -f try try$_o try.c
12587
12588 : see if sigprocmask exists
12589 set sigprocmask d_sigprocmask
12590 eval $inlibc
12591
12592 : see if sigsetjmp exists
12593 echo " "
12594 case "$d_sigsetjmp" in
12595 '')
12596         $cat >try.c <<'EOP'
12597 #include <setjmp.h>
12598 sigjmp_buf env;
12599 int set = 1;
12600 int main()
12601 {
12602         if (sigsetjmp(env,1))
12603                 exit(set);
12604         set = 0;
12605         siglongjmp(env, 1);
12606         exit(1);
12607 }
12608 EOP
12609         set try
12610         if eval $compile; then
12611                 if $run ./try >/dev/null 2>&1; then
12612                         echo "POSIX sigsetjmp found." >&4
12613                         val="$define"
12614                 else
12615                         $cat >&4 <<EOM
12616 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12617 I'll ignore them.
12618 EOM
12619                         val="$undef"
12620                 fi
12621         else
12622                 echo "sigsetjmp not found." >&4
12623                 val="$undef"
12624         fi
12625         ;;
12626 *) val="$d_sigsetjmp"
12627         case "$d_sigsetjmp" in
12628         $define) echo "POSIX sigsetjmp found." >&4;;
12629         $undef) echo "sigsetjmp not found." >&4;;
12630         esac
12631         ;;
12632 esac
12633 set d_sigsetjmp
12634 eval $setvar
12635 $rm -f try.c try
12636
12637 : see if sockatmark exists
12638 set sockatmark d_sockatmark
12639 eval $inlibc
12640
12641 : see if prototype for sockatmark is available
12642 echo " "
12643 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12644 eval $hasproto
12645
12646 : see if socks5_init exists
12647 set socks5_init d_socks5_init
12648 eval $inlibc
12649
12650 : see if prototype for setresgid is available
12651 echo " "
12652 set d_sresgproto setresgid $i_unistd unistd.h
12653 eval $hasproto
12654
12655 : see if prototype for setresuid is available
12656 echo " "
12657 set d_sresuproto setresuid $i_unistd unistd.h
12658 eval $hasproto
12659
12660 : see if sys/stat.h is available
12661 set sys/stat.h i_sysstat
12662 eval $inhdr
12663
12664
12665 : see if stat knows about block sizes
12666 echo " "
12667 echo "Checking to see if your struct stat has st_blocks field..." >&4
12668 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12669 eval $hasfield
12670
12671
12672 : see if this is a sys/vfs.h system
12673 set sys/vfs.h i_sysvfs
12674 eval $inhdr
12675
12676
12677 : see if this is a sys/statfs.h system
12678 set sys/statfs.h i_sysstatfs
12679 eval $inhdr
12680
12681
12682 echo " "
12683 echo "Checking to see if your system supports struct statfs..." >&4
12684 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
12685 eval $hasstruct
12686 case "$d_statfs_s" in
12687 "$define")      echo "Yes, it does."   ;;
12688 *)              echo "No, it doesn't." ;;
12689 esac
12690
12691
12692
12693 : see if struct statfs knows about f_flags
12694 case "$d_statfs_s" in
12695 define) 
12696         echo " "
12697         echo "Checking to see if your struct statfs has f_flags field..." >&4
12698         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
12699         eval $hasfield
12700         ;;
12701 *)      val="$undef"
12702         set d_statfs_f_flags
12703         eval $setvar
12704         ;;
12705 esac
12706 case "$d_statfs_f_flags" in
12707 "$define")      echo "Yes, it does."   ;;
12708 *)              echo "No, it doesn't." ;;
12709 esac
12710
12711 : see if _ptr and _cnt from stdio act std
12712 echo " "
12713
12714 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12715         echo "(Looks like you have stdio.h from BSD.)"
12716         case "$stdio_ptr" in
12717         '') stdio_ptr='((fp)->_p)'
12718                 ptr_lval=$define
12719                 ;;
12720         *)      ptr_lval=$d_stdio_ptr_lval;;
12721         esac
12722         case "$stdio_cnt" in
12723         '') stdio_cnt='((fp)->_r)'
12724                 cnt_lval=$define
12725                 ;;
12726         *)      cnt_lval=$d_stdio_cnt_lval;;
12727         esac
12728         case "$stdio_base" in
12729         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12730         esac
12731         case "$stdio_bufsiz" in
12732         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12733         esac
12734 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12735         echo "(Looks like you have stdio.h from Linux.)"
12736         case "$stdio_ptr" in
12737         '') stdio_ptr='((fp)->_IO_read_ptr)'
12738                 ptr_lval=$define
12739                 ;;
12740         *)      ptr_lval=$d_stdio_ptr_lval;;
12741         esac
12742         case "$stdio_cnt" in
12743         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12744                 cnt_lval=$undef
12745                 ;;
12746         *)      cnt_lval=$d_stdio_cnt_lval;;
12747         esac
12748         case "$stdio_base" in
12749         '') stdio_base='((fp)->_IO_read_base)';;
12750         esac
12751         case "$stdio_bufsiz" in
12752         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12753         esac
12754 else
12755         case "$stdio_ptr" in
12756         '') stdio_ptr='((fp)->_ptr)'
12757                 ptr_lval=$define
12758                 ;;
12759         *)      ptr_lval=$d_stdio_ptr_lval;;
12760         esac
12761         case "$stdio_cnt" in
12762         '') stdio_cnt='((fp)->_cnt)'
12763                 cnt_lval=$define
12764                 ;;
12765         *)      cnt_lval=$d_stdio_cnt_lval;;
12766         esac
12767         case "$stdio_base" in
12768         '') stdio_base='((fp)->_base)';;
12769         esac
12770         case "$stdio_bufsiz" in
12771         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12772         esac
12773 fi
12774
12775 : test whether _ptr and _cnt really work
12776 echo "Checking how std your stdio is..." >&4
12777 $cat >try.c <<EOP
12778 #include <stdio.h>
12779 #define FILE_ptr(fp)    $stdio_ptr
12780 #define FILE_cnt(fp)    $stdio_cnt
12781 int main() {
12782         FILE *fp = fopen("try.c", "r");
12783         char c = getc(fp);
12784         if (
12785                 18 <= FILE_cnt(fp) &&
12786                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12787         )
12788                 exit(0);
12789         exit(1);
12790 }
12791 EOP
12792 val="$undef"
12793 set try
12794 if eval $compile && $to try.c; then
12795         if $run ./try; then
12796                 echo "Your stdio acts pretty std."
12797                 val="$define"
12798         else
12799                 echo "Your stdio isn't very std."
12800         fi
12801 else
12802         echo "Your stdio doesn't appear very std."
12803 fi
12804 $rm -f try.c try
12805 set d_stdstdio
12806 eval $setvar
12807
12808 : Can _ptr be used as an lvalue?
12809 case "$d_stdstdio$ptr_lval" in
12810 $define$define) val=$define ;;
12811 *) val=$undef ;;
12812 esac
12813 set d_stdio_ptr_lval
12814 eval $setvar
12815
12816 : Can _cnt be used as an lvalue?
12817 case "$d_stdstdio$cnt_lval" in
12818 $define$define) val=$define ;;
12819 *) val=$undef ;;
12820 esac
12821 set d_stdio_cnt_lval
12822 eval $setvar
12823
12824
12825 : test whether setting _ptr sets _cnt as a side effect
12826 d_stdio_ptr_lval_sets_cnt="$undef"
12827 d_stdio_ptr_lval_nochange_cnt="$undef"
12828 case "$d_stdio_ptr_lval$d_stdstdio" in
12829 $define$define)
12830         echo "Checking to see what happens if we set the stdio ptr..." >&4
12831 $cat >try.c <<EOP
12832 #include <stdio.h>
12833 /* Can we scream? */
12834 /* Eat dust sed :-) */
12835 /* In the buffer space, no one can hear you scream. */
12836 #define FILE_ptr(fp)    $stdio_ptr
12837 #define FILE_cnt(fp)    $stdio_cnt
12838 #include <sys/types.h>
12839 int main() {
12840         FILE *fp = fopen("try.c", "r");
12841         int c;
12842         char *ptr;
12843         size_t cnt;
12844         if (!fp) {
12845             puts("Fail even to read");
12846             exit(1);
12847         }
12848         c = getc(fp); /* Read away the first # */
12849         if (c == EOF) {
12850             puts("Fail even to read");
12851             exit(1);
12852         }
12853         if (!(
12854                 18 <= FILE_cnt(fp) &&
12855                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12856         )) {
12857                 puts("Fail even to read");
12858                 exit (1);
12859         }
12860         ptr = (char*) FILE_ptr(fp);
12861         cnt = (size_t)FILE_cnt(fp);
12862
12863         FILE_ptr(fp) += 42;
12864
12865         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12866                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12867                 exit (1);
12868         }
12869         if (FILE_cnt(fp) <= 20) {
12870                 printf ("Fail (<20 chars to test)");
12871                 exit (1);
12872         }
12873         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12874                 puts("Fail compare");
12875                 exit (1);
12876         }
12877         if (cnt == FILE_cnt(fp)) {
12878                 puts("Pass_unchanged");
12879                 exit (0);
12880         }       
12881         if (FILE_cnt(fp) == (cnt - 42)) {
12882                 puts("Pass_changed");
12883                 exit (0);
12884         }
12885         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12886         return 1;
12887
12888 }
12889 EOP
12890         set try
12891         if eval $compile && $to try.c; then
12892                 case `$run ./try` in
12893                 Pass_changed)
12894                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12895                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12896                 Pass_unchanged)
12897                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12898                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12899                 Fail*)
12900                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12901                 *)
12902                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12903         esac
12904         else
12905                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12906         fi
12907         $rm -f try.c try
12908         ;;
12909 esac
12910
12911 : see if _base is also standard
12912 val="$undef"
12913 case "$d_stdstdio" in
12914 $define)
12915         $cat >try.c <<EOP
12916 #include <stdio.h>
12917 #define FILE_base(fp)   $stdio_base
12918 #define FILE_bufsiz(fp) $stdio_bufsiz
12919 int main() {
12920         FILE *fp = fopen("try.c", "r");
12921         char c = getc(fp);
12922         if (
12923                 19 <= FILE_bufsiz(fp) &&
12924                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12925         )
12926                 exit(0);
12927         exit(1);
12928 }
12929 EOP
12930         set try
12931         if eval $compile && $to try.c; then
12932                 if $run ./try; then
12933                         echo "And its _base field acts std."
12934                         val="$define"
12935                 else
12936                         echo "But its _base field isn't std."
12937                 fi
12938         else
12939                 echo "However, it seems to be lacking the _base field."
12940         fi
12941         $rm -f try.c try
12942         ;;
12943 esac
12944 set d_stdiobase
12945 eval $setvar
12946
12947 $cat >&4 <<EOM
12948 Checking how to access stdio streams by file descriptor number...
12949 EOM
12950 case "$stdio_stream_array" in
12951 '')     $cat >try.c <<EOCP
12952 #include <stdio.h>
12953 int main() {
12954   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12955     printf("yes\n");
12956 }
12957 EOCP
12958         for s in _iob __iob __sF
12959         do
12960                 set try -DSTDIO_STREAM_ARRAY=$s
12961                 if eval $compile; then
12962                         case "`$run ./try`" in
12963                         yes)    stdio_stream_array=$s; break ;;
12964                         esac
12965                 fi
12966         done
12967         $rm -f try.* try$exe_ext
12968 esac
12969 case "$stdio_stream_array" in
12970 '')     $cat >&4 <<EOM
12971 I can't figure out how to access stdio streams by file descriptor number.
12972 EOM
12973         d_stdio_stream_array="$undef"
12974         ;;
12975 *)      $cat >&4 <<EOM
12976 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12977 EOM
12978         d_stdio_stream_array="$define"
12979         ;;
12980 esac
12981
12982 : see if strcoll exists
12983 set strcoll d_strcoll
12984 eval $inlibc
12985
12986 : check for structure copying
12987 echo " "
12988 echo "Checking to see if your C compiler can copy structs..." >&4
12989 $cat >try.c <<'EOCP'
12990 int main()
12991 {
12992         struct blurfl {
12993                 int dyick;
12994         } foo, bar;
12995
12996         foo = bar;
12997 }
12998 EOCP
12999 if $cc -c try.c >/dev/null 2>&1 ; then
13000         val="$define"
13001         echo "Yup, it can."
13002 else
13003         val="$undef"
13004         echo "Nope, it can't."
13005 fi
13006 set d_strctcpy
13007 eval $setvar
13008 $rm -f try.*
13009
13010 : see if strerror and/or sys_errlist[] exist
13011 echo " "
13012 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
13013     if set strerror val -f d_strerror; eval $csym; $val; then
13014                 echo 'strerror() found.' >&4
13015                 d_strerror="$define"
13016                 d_strerrm='strerror(e)'
13017                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
13018                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
13019                         d_syserrlst="$define"
13020                 else
13021                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
13022                         d_syserrlst="$undef"
13023                 fi
13024     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
13025                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
13026                 echo 'strerror() found in string header.' >&4
13027                 d_strerror="$define"
13028                 d_strerrm='strerror(e)'
13029                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
13030                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
13031                                 d_syserrlst="$define"
13032                 else
13033                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
13034                         d_syserrlst="$undef"
13035                 fi
13036     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
13037                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
13038                 d_strerror="$undef"
13039                 d_syserrlst="$define"
13040                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
13041     else
13042                 echo 'strerror() and sys_errlist[] NOT found.' >&4
13043                 d_strerror="$undef"
13044                 d_syserrlst="$undef"
13045                 d_strerrm='"unknown"'
13046     fi
13047 fi
13048
13049 : see if strftime exists
13050 set strftime d_strftime
13051 eval $inlibc
13052
13053 : see if strtod exists
13054 set strtod d_strtod
13055 eval $inlibc
13056
13057 : see if strtol exists
13058 set strtol d_strtol
13059 eval $inlibc
13060
13061 : see if strtold exists
13062 set strtold d_strtold
13063 eval $inlibc
13064
13065 : see if strtoll exists
13066 set strtoll d_strtoll
13067 eval $inlibc
13068
13069 case "$d_longlong-$d_strtoll" in
13070 "$define-$define")
13071         $cat <<EOM
13072 Checking whether your strtoll() works okay...
13073 EOM
13074         $cat >try.c <<'EOCP'
13075 #include <errno.h>
13076 #ifdef __hpux
13077 #define strtoll __strtoll
13078 #endif
13079 #ifdef __EMX__
13080 #define strtoll _strtoll
13081 #endif
13082 #include <stdio.h>
13083 extern long long int strtoll(char *s, char **, int); 
13084 static int bad = 0;
13085 int check(char *s, long long ell, int een) {
13086         long long gll;
13087         errno = 0;
13088         gll = strtoll(s, 0, 10);
13089         if (!((gll == ell) && (errno == een)))
13090                 bad++;
13091 }
13092 int main() {
13093         check(" 1",                                      1LL, 0);
13094         check(" 0",                                      0LL, 0);
13095         check("-1",                                     -1LL, 0);
13096         check("-9223372036854775808", -9223372036854775808LL, 0);
13097         check("-9223372036854775808", -9223372036854775808LL, 0);
13098         check(" 9223372036854775807",  9223372036854775807LL, 0);
13099         check("-9223372036854775808", -9223372036854775808LL, 0);
13100         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
13101         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
13102         if (!bad)
13103                 printf("ok\n");
13104 }
13105 EOCP
13106         set try
13107         if eval $compile; then
13108                 yyy=`$run ./try`
13109                 case "$yyy" in
13110                 ok) echo "Your strtoll() seems to be working okay." ;;
13111                 *) cat <<EOM >&4
13112 Your strtoll() doesn't seem to be working okay.
13113 EOM
13114                    d_strtoll="$undef"
13115                    ;;
13116                 esac
13117         else
13118                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13119                 d_strtoll="$undef"
13120         fi
13121         ;;
13122 esac
13123
13124 : see if strtoq exists
13125 set strtoq d_strtoq
13126 eval $inlibc
13127
13128 : see if strtoul exists
13129 set strtoul d_strtoul
13130 eval $inlibc
13131
13132 case "$d_strtoul" in
13133 "$define")
13134         $cat <<EOM
13135 Checking whether your strtoul() works okay...
13136 EOM
13137         $cat >try.c <<'EOCP'
13138 #include <errno.h>
13139 #include <stdio.h>
13140 extern unsigned long int strtoul(char *s, char **, int); 
13141 static int bad = 0;
13142 void check(char *s, unsigned long eul, int een) {
13143         unsigned long gul;
13144         errno = 0;
13145         gul = strtoul(s, 0, 10);
13146         if (!((gul == eul) && (errno == een)))
13147                 bad++;
13148 }
13149 int main() {
13150         check(" 1", 1L, 0);
13151         check(" 0", 0L, 0);
13152 EOCP
13153         case "$longsize" in
13154         8)
13155             $cat >>try.c <<'EOCP'
13156         check("18446744073709551615", 18446744073709551615UL, 0);
13157         check("18446744073709551616", 18446744073709551615UL, ERANGE);
13158 #if 0 /* strtoul() for /^-/ strings is undefined. */
13159         check("-1", 18446744073709551615UL, 0);
13160         check("-18446744073709551614", 2, 0);
13161         check("-18446744073709551615", 1, 0);
13162         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
13163         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
13164 #endif
13165 EOCP
13166                 ;;
13167         4)
13168                     $cat >>try.c <<'EOCP'
13169         check("4294967295", 4294967295UL, 0);
13170         check("4294967296", 4294967295UL, ERANGE);
13171 #if 0 /* strtoul() for /^-/ strings is undefined. */
13172         check("-1", 4294967295UL, 0);
13173         check("-4294967294", 2, 0);
13174         check("-4294967295", 1, 0);
13175         check("-4294967296", 4294967295UL, ERANGE);
13176         check("-4294967297", 4294967295UL, ERANGE);
13177 #endif
13178 EOCP
13179                 ;;
13180         *)
13181 : Should we write these tests to be more portable by sprintf-ing
13182 : ~0 and then manipulating that char string as input for strtol?
13183                 ;;
13184         esac
13185         $cat >>try.c <<'EOCP'
13186         if (!bad)
13187                 printf("ok\n");
13188         return 0;
13189 }
13190 EOCP
13191         set try
13192         if eval $compile; then
13193                 case "`$run ./try`" in
13194                 ok) echo "Your strtoul() seems to be working okay." ;;
13195                 *) cat <<EOM >&4
13196 Your strtoul() doesn't seem to be working okay.
13197 EOM
13198                    d_strtoul="$undef"
13199                    ;;
13200                 esac
13201         fi
13202         ;;
13203 esac
13204
13205 : see if strtoull exists
13206 set strtoull d_strtoull
13207 eval $inlibc
13208
13209 case "$d_longlong-$d_strtoull" in
13210 "$define-$define")
13211         $cat <<EOM
13212 Checking whether your strtoull() works okay...
13213 EOM
13214         $cat >try.c <<'EOCP'
13215 #include <errno.h>
13216 #ifdef __hpux
13217 #define strtoull __strtoull
13218 #endif
13219 #include <stdio.h>
13220 extern unsigned long long int strtoull(char *s, char **, int); 
13221 static int bad = 0;
13222 int check(char *s, long long eull, int een) {
13223         long long gull;
13224         errno = 0;
13225         gull = strtoull(s, 0, 10);
13226         if (!((gull == eull) && (errno == een)))
13227                 bad++;
13228 }
13229 int main() {
13230         check(" 1",                                        1LL, 0);
13231         check(" 0",                                        0LL, 0);
13232         check("18446744073709551615",  18446744073709551615ULL, 0);
13233         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13234 #if 0 /* strtoull() for /^-/ strings is undefined. */
13235         check("-1",                    18446744073709551615ULL, 0);
13236         check("-18446744073709551614",                     2LL, 0);
13237         check("-18446744073709551615",                     1LL, 0);
13238         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13239         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13240 #endif
13241         if (!bad)
13242                 printf("ok\n");
13243 }
13244 EOCP
13245         set try
13246         if eval $compile; then
13247                 case "`$run ./try`" in
13248                 ok) echo "Your strtoull() seems to be working okay." ;;
13249                 *) cat <<EOM >&4
13250 Your strtoull() doesn't seem to be working okay.
13251 EOM
13252                    d_strtoull="$undef"
13253                    ;;
13254                 esac
13255         fi
13256         ;;
13257 esac
13258
13259 : see if strtouq exists
13260 set strtouq d_strtouq
13261 eval $inlibc
13262
13263 case "$d_strtouq" in
13264 "$define")
13265         $cat <<EOM
13266 Checking whether your strtouq() works okay...
13267 EOM
13268         $cat >try.c <<'EOCP'
13269 #include <errno.h>
13270 #include <stdio.h>
13271 extern unsigned long long int strtouq(char *s, char **, int); 
13272 static int bad = 0;
13273 void check(char *s, unsigned long long eull, int een) {
13274         unsigned long long gull;
13275         errno = 0;
13276         gull = strtouq(s, 0, 10);
13277         if (!((gull == eull) && (errno == een)))
13278                 bad++;
13279 }
13280 int main() {
13281         check(" 1",                                        1LL, 0);
13282         check(" 0",                                        0LL, 0);
13283         check("18446744073709551615",  18446744073709551615ULL, 0);
13284         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13285 #if 0 /* strtouq() for /^-/ strings is undefined. */
13286         check("-1",                    18446744073709551615ULL, 0);
13287         check("-18446744073709551614",                     2LL, 0);
13288         check("-18446744073709551615",                     1LL, 0);
13289         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13290         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13291 #endif
13292         if (!bad)
13293                 printf("ok\n");
13294         return 0;
13295 }
13296 EOCP
13297         set try
13298         if eval $compile; then
13299                 case "`$run ./try`" in
13300                 ok) echo "Your strtouq() seems to be working okay." ;;
13301                 *) cat <<EOM >&4
13302 Your strtouq() doesn't seem to be working okay.
13303 EOM
13304                    d_strtouq="$undef"
13305                    ;;
13306                 esac
13307         fi
13308         ;;
13309 esac
13310
13311 : see if strxfrm exists
13312 set strxfrm d_strxfrm
13313 eval $inlibc
13314
13315 : see if symlink exists
13316 set symlink d_symlink
13317 eval $inlibc
13318
13319 : see if syscall exists
13320 set syscall d_syscall
13321 eval $inlibc
13322
13323 : see if prototype for syscall is available
13324 echo " "
13325 set d_syscallproto syscall $i_unistd unistd.h
13326 eval $hasproto
13327
13328 : see if sysconf exists
13329 set sysconf d_sysconf
13330 eval $inlibc
13331
13332 : see if system exists
13333 set system d_system
13334 eval $inlibc
13335
13336 : see if tcgetpgrp exists
13337 set tcgetpgrp d_tcgetpgrp
13338 eval $inlibc
13339
13340 : see if tcsetpgrp exists
13341 set tcsetpgrp d_tcsetpgrp
13342 eval $inlibc
13343
13344 : see if prototype for telldir is available
13345 echo " "
13346 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13347 eval $hasproto
13348
13349 : see if this is a sys/times.h system
13350 set sys/times.h i_systimes
13351 eval $inhdr
13352
13353 : see if times exists
13354 echo " "
13355 if set times val -f d_times; eval $csym; $val; then
13356         echo 'times() found.' >&4
13357         d_times="$define"
13358         inc=''
13359         case "$i_systimes" in
13360         "$define") inc='sys/times.h';;
13361         esac
13362         rp="What is the type returned by times() on this system?"
13363         set clock_t clocktype long stdio.h sys/types.h $inc
13364         eval $typedef_ask
13365 else
13366         echo 'times() NOT found, hope that will do.' >&4
13367         d_times="$undef"
13368         clocktype='int'
13369 fi
13370
13371 : see if truncate exists
13372 set truncate d_truncate
13373 eval $inlibc
13374
13375 : see if tzname[] exists
13376 echo " "
13377 if set tzname val -a d_tzname; eval $csym; $val; then
13378         val="$define"
13379         echo 'tzname[] found.' >&4
13380 else
13381         val="$undef"
13382         echo 'tzname[] NOT found.' >&4
13383 fi
13384 set d_tzname
13385 eval $setvar
13386
13387 case "$osname" in
13388 next|rhapsody|darwin) multiarch="$define" ;;
13389 esac
13390 case "$multiarch" in
13391 ''|[nN]*) multiarch="$undef" ;;
13392 esac
13393
13394 : check for ordering of bytes in a long
13395 echo " "
13396 case "$usecrosscompile$multiarch" in
13397 *$define*)
13398         $cat <<EOM
13399 You seem to be either cross-compiling or doing a multiarchitecture build,
13400 skipping the byteorder check.
13401
13402 EOM
13403         byteorder='ffff'
13404         ;;
13405 *)
13406         case "$byteorder" in
13407         '')
13408                 $cat <<'EOM'
13409 In the following, larger digits indicate more significance.  A big-endian
13410 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13411 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13412 machines may have weird orders like 3412.  A Cray will report 87654321,
13413 an Alpha will report 12345678. If the test program works the default is
13414 probably right.
13415 I'm now running the test program...
13416 EOM
13417                 $cat >try.c <<'EOCP'
13418 #include <stdio.h>
13419 int main()
13420 {
13421         int i;
13422         union {
13423                 unsigned long l;
13424                 char c[sizeof(long)];
13425         } u;
13426
13427         if (sizeof(long) > 4)
13428                 u.l = (0x08070605L << 32) | 0x04030201L;
13429         else
13430                 u.l = 0x04030201L;
13431         for (i = 0; i < sizeof(long); i++)
13432                 printf("%c", u.c[i]+'0');
13433         printf("\n");
13434         exit(0);
13435 }
13436 EOCP
13437                 xxx_prompt=y
13438                 set try
13439                 if eval $compile && ./try > /dev/null; then
13440                         dflt=`$run ./try`
13441                         case "$dflt" in
13442                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13443                                 echo "(The test program ran ok.)"
13444                                 echo "byteorder=$dflt"
13445                                 xxx_prompt=n
13446                         ;;
13447                         ????|????????) echo "(The test program ran ok.)" ;;
13448                         *) echo "(The test program didn't run right for some reason.)" ;;
13449                         esac
13450                 else
13451                         dflt='4321'
13452                         cat <<'EOM'
13453 (I can't seem to compile the test program.  Guessing big-endian...)
13454 EOM
13455                 fi
13456                 case "$xxx_prompt" in
13457                 y)
13458                         rp="What is the order of bytes in a long?"
13459                         . ./myread
13460                         byteorder="$ans"
13461                         ;;
13462                 *)      byteorder=$dflt
13463                         ;;
13464                 esac
13465                 ;;
13466         esac
13467         $rm -f try.c try
13468         ;;
13469 esac
13470
13471
13472 $cat <<EOM
13473
13474 Checking to see whether you can access character data unalignedly...
13475 EOM
13476 $cat >try.c <<EOCP
13477 #include <stdio.h>
13478 #define U32 $u32type
13479 #define BYTEORDER $byteorder
13480 int main() {
13481 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13482     U8 buf[] = "\0\0\0\1\0\0\0\0";
13483     U32 *up;
13484     int i;
13485
13486     if (sizeof(U32) != 4) {
13487         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13488         exit(1);
13489     }
13490
13491     fflush(stdout);
13492
13493     for (i = 0; i < 4; i++) {
13494         up = (U32*)(buf + i);
13495         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13496                (*up == 1 << (8*(3-i)))  /* little-endian */
13497               )
13498            )
13499         {
13500             printf("read failed (%x)\n", *up);
13501             exit(2);
13502         }
13503     }
13504
13505     /* write test */
13506     for (i = 0; i < 4; i++) {
13507         up = (U32*)(buf + i);
13508         *up = 0xBeef;
13509         if (*up != 0xBeef) {
13510             printf("write failed (%x)\n", *up);
13511             exit(3);
13512         }
13513     }
13514
13515     exit(0);
13516 #else
13517     printf("1\n");
13518     exit(1);
13519 #endif
13520     return 0;
13521 }
13522 EOCP
13523 set try
13524 if eval $compile_ok; then
13525         echo "(Testing for character data alignment may dump core.)" >&4
13526         $run ./try 2>&1 >/dev/null
13527         case "$?" in
13528         0)      cat >&4 <<EOM
13529 You can access character data pretty unalignedly.
13530 EOM
13531                 d_u32align="$undef"
13532                 ;;
13533         *)      cat >&4 <<EOM
13534 It seems that you must access character data in an aligned manner.
13535 EOM
13536                 d_u32align="$define"
13537                 ;;
13538         esac
13539         $rm -f core core.try.* try.core
13540 else
13541         rp='Can you access character data at unaligned addresses?'
13542         dflt='n'
13543         . ./myread
13544         case "$ans" in
13545         [yY]*)  d_u32align="$undef"  ;;
13546         *)      d_u32align="$define" ;;
13547         esac
13548 fi
13549
13550 : see if ualarm exists
13551 set ualarm d_ualarm
13552 eval $inlibc
13553
13554 : see if umask exists
13555 set umask d_umask
13556 eval $inlibc
13557
13558 : see if unordered exists
13559 set unordered d_unordered
13560 eval $inlibc
13561
13562 : see if usleep exists
13563 set usleep d_usleep
13564 eval $inlibc
13565
13566 : see if prototype for usleep is available
13567 echo " "
13568 set d_usleepproto usleep $i_unistd unistd.h
13569 eval $hasproto
13570
13571 : see if ustat exists
13572 set ustat d_ustat
13573 eval $inlibc
13574
13575 : backward compatibility for d_hvfork
13576 if test X$d_hvfork != X; then
13577         d_vfork="$d_hvfork"
13578         d_hvfork=''
13579 fi
13580 : see if there is a vfork
13581 val=''
13582 set vfork val
13583 eval $inlibc
13584
13585 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13586 : perl on Solaris 2.x, and probably elsewhere.
13587 case "$val" in
13588 $define)
13589         echo " "
13590         case "$usevfork" in
13591         false) dflt='n';;
13592         *) dflt='y';;
13593         esac
13594         cat <<'EOM'
13595  
13596 Perl can only use a vfork() that doesn't suffer from strict
13597 restrictions on calling functions or modifying global data in
13598 the child.  For example, glibc-2.1 contains such a vfork()
13599 that is unsuitable.  If your system provides a proper fork()
13600 call, chances are that you do NOT want perl to use vfork().
13601
13602 EOM
13603         rp="Do you still want to use vfork()?"
13604         . ./myread
13605         case "$ans" in
13606         y|Y) ;;
13607         *)
13608                 echo "Ok, we won't use vfork()."
13609                 val="$undef"
13610                 ;;
13611         esac
13612         ;;
13613 esac
13614 set d_vfork
13615 eval $setvar
13616 case "$d_vfork" in
13617 $define) usevfork='true';;
13618 *) usevfork='false';;
13619 esac
13620
13621 : see if closedir exists
13622 set closedir d_closedir
13623 eval $inlibc
13624
13625 case "$d_closedir" in
13626 "$define")
13627         echo " "
13628         echo "Checking whether closedir() returns a status..." >&4
13629         cat > try.c <<EOM
13630 #$i_dirent I_DIRENT             /**/
13631 #$i_sysdir I_SYS_DIR            /**/
13632 #$i_sysndir I_SYS_NDIR          /**/
13633 #$i_systypes I_SYS_TYPES        /**/
13634
13635 #if defined(I_SYS_TYPES)
13636 #include <sys/types.h>
13637 #endif
13638 #if defined(I_DIRENT)
13639 #include <dirent.h>
13640 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13641 #include <sys/dir.h>
13642 #endif
13643 #else
13644 #ifdef I_SYS_NDIR
13645 #include <sys/ndir.h>
13646 #else
13647 #ifdef I_SYS_DIR
13648 #ifdef hp9000s500
13649 #include <ndir.h>       /* may be wrong in the future */
13650 #else
13651 #include <sys/dir.h>
13652 #endif
13653 #endif
13654 #endif
13655 #endif 
13656 int main() { return closedir(opendir(".")); }
13657 EOM
13658         set try
13659         if eval $compile_ok; then
13660                 if $run ./try > /dev/null 2>&1 ; then
13661                         echo "Yes, it does."
13662                         val="$undef"
13663                 else
13664                         echo "No, it doesn't."
13665                         val="$define"
13666                 fi
13667         else
13668                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13669                 val="$define"
13670         fi
13671         ;;
13672 *)
13673         val="$undef";
13674         ;;
13675 esac
13676 set d_void_closedir
13677 eval $setvar
13678 $rm -f try try.*
13679 : see if there is a wait4
13680 set wait4 d_wait4
13681 eval $inlibc
13682
13683 : see if waitpid exists
13684 set waitpid d_waitpid
13685 eval $inlibc
13686
13687 : see if wcstombs exists
13688 set wcstombs d_wcstombs
13689 eval $inlibc
13690
13691 : see if wctomb exists
13692 set wctomb d_wctomb
13693 eval $inlibc
13694
13695 : see if writev exists
13696 set writev d_writev
13697 eval $inlibc
13698
13699 : preserve RCS keywords in files with variable substitution, grrr
13700 Date='$Date'
13701 Id='$Id'
13702 Log='$Log'
13703 RCSfile='$RCSfile'
13704 Revision='$Revision'
13705
13706 : check for alignment requirements
13707 echo " "
13708 case "$usecrosscompile$multiarch" in
13709 *$define*)
13710         $cat <<EOM
13711 You seem to be either cross-compiling or doing a multiarchitecture build,
13712 skipping the memory alignment check.
13713
13714 EOM
13715         case "$alignbytes" in
13716         '') alignbytes=8 ;;
13717         esac
13718         ;;
13719 *)
13720         case "$alignbytes" in
13721         '') echo "Checking alignment constraints..." >&4
13722                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13723                         $cat >try.c <<'EOCP'
13724 typedef long double NV;
13725 EOCP
13726                 else
13727                         $cat >try.c <<'EOCP'
13728 typedef double NV;
13729 EOCP
13730                 fi
13731                 $cat >>try.c <<'EOCP'
13732 #include <stdio.h>
13733 struct foobar {
13734         char foo;
13735         NV bar;
13736 } try_algn;
13737 int main()
13738 {
13739     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13740     return(0);
13741 }
13742 EOCP
13743                 set try
13744                 if eval $compile_ok; then
13745                         dflt=`$run ./try`
13746                 else
13747                         dflt='8'
13748                         echo "(I can't seem to compile the test program...)"
13749                 fi
13750                 ;;
13751         *) dflt="$alignbytes"
13752                 ;;
13753         esac
13754         rp="Doubles must be aligned on a how-many-byte boundary?"
13755         . ./myread
13756         alignbytes="$ans"
13757         $rm -f try.c try
13758         ;;
13759 esac
13760
13761
13762 : set the base revision
13763 baserev=5.0
13764
13765 : how do we catenate cpp tokens here?
13766 echo " "
13767 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13768 $cat >cpp_stuff.c <<'EOCP'
13769 #define RCAT(a,b)a/**/b
13770 #define ACAT(a,b)a ## b
13771 RCAT(Rei,ser)
13772 ACAT(Cir,cus)
13773 EOCP
13774 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13775 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13776         echo "Oh!  Smells like ANSI's been here." >&4
13777         echo "We can catify or stringify, separately or together!"
13778         cpp_stuff=42
13779 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13780         echo "Ah, yes!  The good old days!" >&4
13781         echo "However, in the good old days we don't know how to stringify and"
13782         echo "catify at the same time."
13783         cpp_stuff=1
13784 else
13785         $cat >&4 <<EOM
13786 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13787 to have to edit the values of CAT[2-5] in config.h...
13788 EOM
13789         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13790 fi
13791 $rm -f cpp_stuff.*
13792
13793 : see if this is a db.h system
13794 set db.h i_db
13795 eval $inhdr
13796
13797 case "$i_db" in
13798 $define)
13799         : Check db version.
13800         echo " "
13801         echo "Checking Berkeley DB version ..." >&4
13802         $cat >try.c <<EOCP
13803 #$d_const HASCONST
13804 #ifndef HASCONST
13805 #define const
13806 #endif
13807 #include <sys/types.h>
13808 #include <stdio.h>
13809 #include <db.h>
13810 int main(int argc, char *argv[])
13811 {
13812 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13813     int Major, Minor, Patch ;
13814     unsigned long Version ;
13815     (void)db_version(&Major, &Minor, &Patch) ;
13816     if (argc == 2) {
13817         printf("%d %d %d %d %d %d\n",
13818                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13819                Major, Minor, Patch);
13820         exit(0);
13821     }
13822     printf("You have Berkeley DB Version 2 or greater.\n");
13823
13824     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13825                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13826     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13827                 Major, Minor, Patch) ;
13828
13829     /* check that db.h & libdb are compatible */
13830     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13831         printf("db.h and libdb are incompatible.\n") ;
13832         exit(3);        
13833     }
13834
13835     printf("db.h and libdb are compatible.\n") ;
13836
13837     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13838                 + DB_VERSION_PATCH ;
13839
13840     /* needs to be >= 2.3.4 */
13841     if (Version < 2003004) {
13842     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13843         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13844         exit(2);        
13845     }
13846
13847     exit(0);
13848 #else
13849 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13850     if (argc == 2) {
13851         printf("1 0 0\n");
13852         exit(0);
13853     }
13854     printf("You have Berkeley DB Version 1.\n");
13855     exit(0);    /* DB version < 2: the coast is clear. */
13856 #else
13857     exit(1);    /* <db.h> not Berkeley DB? */
13858 #endif
13859 #endif
13860 }
13861 EOCP
13862         set try
13863         if eval $compile_ok && $run ./try; then
13864                 echo 'Looks OK.' >&4
13865                 set `$run ./try 1`
13866                 db_version_major=$1
13867                 db_version_minor=$2
13868                 db_version_patch=$3
13869         else
13870                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13871                 i_db=$undef
13872                 case " $libs " in
13873                 *"-ldb "*)
13874                         : Remove db from list of libraries to use
13875                         echo "Removing unusable -ldb from library list" >&4
13876                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13877                         shift
13878                         libs="$*"
13879                         echo "libs = $libs" >&4
13880                         ;;
13881                 esac
13882         fi
13883         $rm -f try.*
13884         ;;
13885 esac
13886
13887 case "$i_db" in
13888 define)
13889         : Check the return type needed for hash 
13890         echo " "
13891         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13892         $cat >try.c <<EOCP
13893 #$d_const HASCONST
13894 #ifndef HASCONST
13895 #define const
13896 #endif
13897 #include <sys/types.h>
13898 #include <db.h>
13899
13900 #ifndef DB_VERSION_MAJOR
13901 u_int32_t hash_cb (ptr, size)
13902 const void *ptr;
13903 size_t size;
13904 {
13905 }
13906 HASHINFO info;
13907 int main()
13908 {
13909         info.hash = hash_cb;
13910 }
13911 #endif
13912 EOCP
13913         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13914                 if $contains warning try.out >>/dev/null 2>&1 ; then
13915                         db_hashtype='int'
13916                 else
13917                         db_hashtype='u_int32_t'
13918                 fi
13919         else
13920                 : XXX Maybe we should just give up here.
13921                 db_hashtype=u_int32_t
13922                 $cat try.out >&4
13923                 echo "Help:  I can't seem to compile the db test program." >&4
13924                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13925         fi
13926         $rm -f try.*
13927         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13928         ;;
13929 *)      db_hashtype=u_int32_t
13930         ;;
13931 esac
13932 case "$i_db" in
13933 define)
13934         : Check the return type needed for prefix 
13935         echo " "
13936         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13937         cat >try.c <<EOCP
13938 #$d_const HASCONST
13939 #ifndef HASCONST
13940 #define const
13941 #endif
13942 #include <sys/types.h>
13943 #include <db.h>
13944
13945 #ifndef DB_VERSION_MAJOR
13946 size_t prefix_cb (key1, key2)
13947 const DBT *key1;
13948 const DBT *key2;
13949 {
13950 }
13951 BTREEINFO info;
13952 int main()
13953 {
13954         info.prefix = prefix_cb;
13955 }
13956 #endif
13957 EOCP
13958         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13959                 if $contains warning try.out >>/dev/null 2>&1 ; then
13960                         db_prefixtype='int'
13961                 else
13962                         db_prefixtype='size_t'
13963                 fi
13964         else
13965                 db_prefixtype='size_t'
13966                 : XXX Maybe we should just give up here.
13967                 $cat try.out >&4
13968                 echo "Help:  I can't seem to compile the db test program." >&4
13969                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13970         fi
13971         $rm -f try.*
13972         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13973         ;;
13974 *)      db_prefixtype='size_t'
13975         ;;
13976 esac
13977
13978
13979 : How can we generate normalized random numbers ?
13980 echo " "
13981 echo "Looking for a random number function..." >&4
13982 case "$randfunc" in
13983 '')
13984         if set drand48 val -f; eval $csym; $val; then
13985                 dflt="drand48"
13986                 echo "Good, found drand48()." >&4
13987         elif set random val -f; eval $csym; $val; then
13988                 dflt="random"
13989                 echo "OK, found random()." >&4
13990         else
13991                 dflt="rand"
13992                 echo "Yick, looks like I have to use rand()." >&4
13993         fi
13994         echo " "
13995         ;;
13996 *)
13997         dflt="$randfunc"
13998         ;;
13999 esac
14000 cont=true
14001
14002 case "$ccflags" in
14003 *-Dmy_rand=*|*-Dmy_srand=*)
14004         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
14005         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
14006         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
14007         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
14008         ;;
14009 esac
14010
14011 while $test "$cont"; do
14012         rp="Use which function to generate random numbers?"
14013         . ./myread
14014         if $test "$ans" = "$dflt"; then
14015                 : null
14016         else
14017                 randbits=''
14018         fi
14019         randfunc="$ans"
14020         if set $ans val -f; eval $csym; $val; then
14021                 cont=''
14022         else
14023                 dflt=y
14024                 rp="I cannot find function $ans. Use that name anyway?"
14025                 . ./myread
14026                 dflt=rand
14027                 case "$ans" in
14028                         [yY]*) cont='';;
14029                 esac
14030         fi
14031         case "$cont" in
14032         '')
14033                 case "$randfunc" in
14034                 drand48)
14035                         drand01="drand48()"
14036                         seedfunc="srand48"
14037                         randbits=48
14038                         randseedtype=long
14039                         ;;
14040                 rand|random)
14041                         case "$randbits" in
14042                         '')
14043 echo "Checking to see how many bits your $randfunc() function produces..." >&4
14044                                 $cat >try.c <<EOCP
14045 #$i_unistd I_UNISTD
14046 #$i_stdlib I_STDLIB
14047 #include <stdio.h>
14048 #ifdef I_UNISTD
14049 #  include <unistd.h>
14050 #endif
14051 #ifdef I_STDLIB
14052 #  include <stdlib.h>
14053 #endif
14054 int main()
14055 {
14056         register int i;
14057         register unsigned long tmp;
14058         register unsigned long max = 0L;
14059
14060         for (i = 1000; i; i--) {
14061                 tmp = (unsigned long) $randfunc();
14062                 if (tmp > max) max = tmp;
14063         }
14064         for (i = 0; max; i++)
14065                 max /= 2;
14066         printf("%d\n",i);
14067 }
14068 EOCP
14069                                 set try
14070                                 if eval $compile_ok; then
14071                                         dflt=`try`
14072                                 else
14073                                         dflt='?'
14074                                         echo "(I can't seem to compile the test program...)"
14075                                 fi
14076                                 ;;
14077                         *)
14078                                 dflt="$randbits"
14079                                 ;;
14080                         esac
14081                         rp="How many bits does your $randfunc() function produce?"
14082                         . ./myread
14083                         randbits="$ans"
14084                         $rm -f try.c try
14085                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
14086                         seedfunc="s$randfunc"
14087                         randseedtype=unsigned
14088                         ;;
14089                 *)
14090                         dflt="31"
14091                         rp="How many bits does your $randfunc() function produce?"
14092                         . ./myread
14093                         randbits="$ans"
14094                         seedfunc="s$randfunc"
14095                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
14096                         if set $seedfunc val -f; eval $csym; $val; then
14097                                 echo "(Using $seedfunc() to seed random generator)"
14098                         else
14099                                 echo "(Warning: no $seedfunc() to seed random generator)"
14100                                 seedfunc=rand
14101                         fi
14102                         randseedtype=unsigned
14103                         ;;
14104                 esac
14105                 ;;
14106         esac
14107 done
14108
14109 echo " "
14110 echo "Determining whether or not we are on an EBCDIC system..." >&4
14111 $cat >try.c <<'EOM'
14112 int main()
14113 {
14114   if ('M'==0xd4) return 0;
14115   return 1;
14116 }
14117 EOM
14118
14119 val=$undef
14120 set try
14121 if eval $compile_ok; then
14122         if $run ./try; then
14123                 echo "You seem to speak EBCDIC." >&4
14124                 val="$define"
14125         else
14126                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
14127         fi
14128 else
14129         echo "I'm unable to compile the test program." >&4
14130         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
14131 fi
14132 $rm -f try try.*
14133 set ebcdic
14134 eval $setvar
14135
14136 echo " "
14137 $cat >&4 <<EOM
14138 Checking how to flush all pending stdio output...
14139 EOM
14140 # I only know how to find the first 32 possibly open files on SunOS.
14141 # See also hints/sunos_4_1.sh and util.c  --AD
14142 case "$osname" in
14143 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
14144 esac
14145 $cat >>try.c <<EOCP
14146 #include <stdio.h>
14147 #$i_unistd I_UNISTD
14148 #ifdef I_UNISTD
14149 # include <unistd.h>
14150 #endif
14151 #$d_sysconf HAS_SYSCONF
14152 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
14153 #ifdef HAS_STDIO_STREAM_ARRAY
14154 # define STDIO_STREAM_ARRAY $stdio_stream_array
14155 #endif
14156 int main() {
14157   FILE* p;
14158   unlink("try.out");
14159   p = fopen("try.out", "w");
14160 #ifdef TRY_FPUTC
14161   fputc('x', p);
14162 #else
14163 # ifdef TRY_FPRINTF
14164   fprintf(p, "x");
14165 # endif
14166 #endif
14167 #ifdef TRY_FFLUSH_NULL
14168   fflush(NULL);
14169 #endif
14170 #ifdef TRY_FFLUSH_ALL
14171   {
14172     long open_max = -1;
14173 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
14174     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
14175 # else
14176 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
14177     open_max = sysconf(_SC_OPEN_MAX);
14178 #  else
14179 #   ifdef FOPEN_MAX
14180     open_max = FOPEN_MAX;
14181 #   else
14182 #    ifdef OPEN_MAX
14183     open_max = OPEN_MAX;
14184 #    else
14185 #     ifdef _NFILE
14186     open_max = _NFILE;
14187 #     endif
14188 #    endif
14189 #   endif
14190 #  endif
14191 # endif 
14192 # ifdef HAS_STDIO_STREAM_ARRAY
14193     if (open_max > 0) {
14194       long i;
14195       for (i = 0; i < open_max; i++)
14196             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
14197                 STDIO_STREAM_ARRAY[i]._file < open_max &&
14198                 STDIO_STREAM_ARRAY[i]._flag)
14199                 fflush(&STDIO_STREAM_ARRAY[i]);
14200     }   
14201   }
14202 # endif
14203 #endif
14204   _exit(42);
14205 }
14206 EOCP
14207 : first we have to find out how _not_ to flush
14208 $to try.c
14209 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
14210     output=''
14211     set try -DTRY_FPUTC
14212     if eval $compile; then
14213             $run ./try 2>/dev/null
14214             code="$?"
14215             $from try.out
14216             if $test ! -s try.out -a "X$code" = X42; then
14217                 output=-DTRY_FPUTC
14218             fi
14219     fi
14220     case "$output" in
14221     '')
14222             set try -DTRY_FPRINTF
14223             if eval $compile; then
14224                     $run ./try 2>/dev/null
14225                     code="$?"
14226                     $from try.out
14227                     if $test ! -s try.out -a "X$code" = X42; then
14228                         output=-DTRY_FPRINTF
14229                     fi
14230             fi
14231         ;;
14232     esac
14233 fi
14234 : check for fflush NULL behaviour
14235 case "$fflushNULL" in
14236 '')     set try -DTRY_FFLUSH_NULL $output
14237         if eval $compile; then
14238                 $run ./try 2>/dev/null
14239                 code="$?"
14240                 $from try.out
14241                 if $test -s try.out -a "X$code" = X42; then
14242                         fflushNULL="`$cat try.out`"
14243                 else
14244                         if $test "X$code" != X42; then
14245                                 $cat >&4 <<EOM
14246 (If this test failed, don't worry, we'll try another method shortly.)
14247 EOM
14248                         fi
14249                 fi
14250         fi
14251         $rm -f core try.core core.try.*
14252         case "$fflushNULL" in
14253         x)      $cat >&4 <<EOM
14254 Your fflush(NULL) works okay for output streams.
14255 Let's see if it clobbers input pipes...
14256 EOM
14257 # As of mid-March 2000 all versions of Solaris appear to have a stdio
14258 # bug that improperly flushes the input end of pipes.  So we avoid the
14259 # autoflush on fork/system/exec support for now. :-(
14260 $cat >tryp.c <<EOCP
14261 #include <stdio.h>
14262 int
14263 main(int argc, char **argv)
14264 {
14265     char buf[1024];
14266     int i;
14267     char *bp = buf;
14268     while (1) {
14269         while ((i = getc(stdin)) != -1
14270                && (*bp++ = i) != '\n'
14271                && bp < &buf[1024])
14272         /* DO NOTHING */ ;
14273         *bp = '\0';
14274         fprintf(stdout, "%s", buf);
14275         fflush(NULL);
14276         if (i == -1)
14277             return 0;
14278         bp = buf;
14279     }
14280 }
14281 EOCP
14282                 fflushNULL="$define"
14283                 set tryp
14284                 if eval $compile; then
14285                     $rm -f tryp.out
14286                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14287                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
14288                        $cat >&4 <<EOM
14289 fflush(NULL) seems to behave okay with input streams.
14290 EOM
14291                         fflushNULL="$define"
14292                     else
14293                         $cat >&4 <<EOM
14294 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
14295 EOM
14296                         fflushNULL="$undef"
14297                     fi
14298                 fi
14299                 $rm -f core tryp.c tryp.core core.tryp.*
14300                 ;;
14301         '')     $cat >&4 <<EOM
14302 Your fflush(NULL) isn't working (contrary to ANSI C).
14303 EOM
14304                 fflushNULL="$undef"
14305                 ;;
14306         *)      $cat >&4 <<EOM
14307 Cannot figure out whether your fflush(NULL) works or not.
14308 I'm assuming it doesn't (contrary to ANSI C).
14309 EOM
14310                 fflushNULL="$undef"
14311                 ;;
14312         esac
14313         ;;
14314 $define|true|[yY]*)
14315         fflushNULL="$define"
14316         ;;
14317 *)
14318         fflushNULL="$undef"
14319         ;;
14320 esac
14321 : check explicit looping only if NULL did not work, and if the pipe
14322 : bug does not show up on an explicit flush too
14323 case "$fflushNULL" in
14324 "$undef")
14325         $cat >tryp.c <<EOCP
14326 #include <stdio.h>
14327 int
14328 main(int argc, char **argv)
14329 {
14330     char buf[1024];
14331     int i;
14332     char *bp = buf;
14333     while (1) {
14334         while ((i = getc(stdin)) != -1
14335                && (*bp++ = i) != '\n'
14336                && bp < &buf[1024])
14337         /* DO NOTHING */ ;
14338         *bp = '\0';
14339         fprintf(stdout, "%s", buf);
14340         fflush(stdin);
14341         if (i == -1)
14342             return 0;
14343         bp = buf;
14344     }
14345 }
14346 EOCP
14347         set tryp
14348         if eval $compile; then
14349             $rm -f tryp.out
14350             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14351             if cmp tryp.c tryp.out >/dev/null 2>&1; then
14352                $cat >&4 <<EOM
14353 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14354 EOM
14355                 : now check for fflushall behaviour
14356                 case "$fflushall" in
14357                 '')     set try -DTRY_FFLUSH_ALL $output
14358                         if eval $compile; then
14359                                 $cat >&4 <<EOM
14360 (Now testing the other method--but note that this also may fail.)
14361 EOM
14362                                 $run ./try 2>/dev/null
14363                                 code=$?
14364                                 $from try.out
14365                                 if $test -s try.out -a "X$code" = X42; then
14366                                         fflushall="`$cat try.out`"
14367                                 fi
14368                         fi
14369                         $rm -f core try.core core.try.*
14370                         case "$fflushall" in
14371                         x)      $cat >&4 <<EOM
14372 Whew. Flushing explicitly all the stdio streams works.
14373 EOM
14374                                 fflushall="$define"
14375                                 ;;
14376                         '')     $cat >&4 <<EOM
14377 Sigh. Flushing explicitly all the stdio streams doesn't work.
14378 EOM
14379                                 fflushall="$undef"
14380                                 ;;
14381                         *)      $cat >&4 <<EOM
14382 Cannot figure out whether flushing stdio streams explicitly works or not.
14383 I'm assuming it doesn't.
14384 EOM
14385                                 fflushall="$undef"
14386                                 ;;
14387                         esac
14388                         ;;
14389                 "$define"|true|[yY]*)
14390                         fflushall="$define"
14391                         ;;
14392                 *)
14393                         fflushall="$undef"
14394                         ;;
14395                 esac
14396             else
14397                 $cat >&4 <<EOM
14398 All is futile.  Even fflush(stdin) clobbers input pipes!
14399 EOM
14400                 fflushall="$undef"
14401             fi
14402         else
14403             fflushall="$undef"
14404         fi
14405         $rm -f core tryp.c tryp.core core.tryp.*
14406         ;;
14407 *)      fflushall="$undef"
14408         ;;
14409 esac
14410
14411 case "$fflushNULL$fflushall" in
14412 undefundef)
14413         $cat <<EOM
14414 OK, I give up.  I cannot figure out how to flush pending stdio output.
14415 We won't be flushing handles at all before fork/exec/popen.
14416 EOM
14417         ;;
14418 esac
14419 $rm -f try.* try$exe_ext
14420
14421 : Store the full pathname to the ar program for use in the C program
14422 : Respect a hint or command line value for full_ar.
14423 case "$full_ar" in
14424 '') full_ar=$ar ;;
14425 esac
14426
14427 : Store the full pathname to the sed program for use in the C program
14428 full_sed=$sed
14429
14430 : see what type gids are declared as in the kernel
14431 echo " "
14432 echo "Looking for the type for group ids returned by getgid()."
14433 set gid_t gidtype xxx stdio.h sys/types.h
14434 eval $typedef
14435 case "$gidtype" in
14436 xxx)
14437         xxx=`./findhdr sys/user.h`
14438         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14439         case $1 in
14440         unsigned) dflt="$1 $2" ;;
14441         *) dflt="$1" ;;
14442         esac
14443         ;;
14444 *) dflt="$gidtype";;
14445 esac
14446 case "$gidtype" in
14447 gid_t) echo "gid_t found." ;;
14448 *)      rp="What is the type for group ids returned by getgid()?"
14449         . ./myread
14450         gidtype="$ans"
14451         ;;
14452 esac
14453
14454 echo " "
14455 case "$gidtype" in
14456 *_t) zzz="$gidtype"     ;;
14457 *)   zzz="gid"          ;;
14458 esac
14459 echo "Checking the size of $zzz..." >&4 
14460 cat > try.c <<EOCP
14461 #include <sys/types.h>
14462 #include <stdio.h>
14463 int main() {
14464     printf("%d\n", (int)sizeof($gidtype));
14465     exit(0);
14466 }
14467 EOCP
14468 set try
14469 if eval $compile_ok; then
14470         yyy=`$run ./try`
14471         case "$yyy" in
14472         '')     gidsize=4
14473                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14474                 ;;
14475         *)      gidsize=$yyy
14476                 echo "Your $zzz is $gidsize bytes long."
14477                 ;;
14478         esac
14479 else
14480         gidsize=4
14481         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14482 fi
14483
14484
14485 echo " "
14486 case "$gidtype" in
14487 *_t) zzz="$gidtype"     ;;
14488 *)   zzz="gid"          ;;
14489 esac
14490 echo "Checking the sign of $zzz..." >&4 
14491 cat > try.c <<EOCP
14492 #include <sys/types.h>
14493 #include <stdio.h>
14494 int main() {
14495         $gidtype foo = -1;
14496         if (foo < 0)
14497                 printf("-1\n");
14498         else
14499                 printf("1\n");
14500 }
14501 EOCP
14502 set try
14503 if eval $compile; then
14504         yyy=`$run ./try`
14505         case "$yyy" in
14506         '')     gidsign=1
14507                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14508                 ;;
14509         *)      gidsign=$yyy
14510                 case "$gidsign" in
14511                  1) echo "Your $zzz is unsigned." ;;
14512                 -1) echo "Your $zzz is signed."   ;;
14513                 esac
14514                 ;;
14515         esac
14516 else
14517         gidsign=1
14518         echo "(I can't compile the test program--guessing unsigned.)" >&4
14519 fi
14520
14521
14522 echo " "
14523
14524 if $test X"$quadtype" != X; then
14525
14526 echo "Checking how to print 64-bit integers..." >&4
14527
14528 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14529         $cat >try.c <<'EOCP'
14530 #include <sys/types.h>
14531 #include <stdio.h>
14532 int main() {
14533   int q = 12345678901;
14534   printf("%ld\n", q);
14535 }
14536 EOCP
14537         set try
14538         if eval $compile; then
14539                 yyy=`$run ./try`
14540                 case "$yyy" in
14541                 12345678901)
14542                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14543                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14544                         echo "We will use %d."
14545                         ;;
14546                 esac
14547         fi
14548 fi
14549
14550 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14551         $cat >try.c <<'EOCP'
14552 #include <sys/types.h>
14553 #include <stdio.h>
14554 int main() {
14555   long q = 12345678901;
14556   printf("%ld\n", q);
14557 }
14558 EOCP
14559         set try
14560         if eval $compile; then
14561                 yyy=`$run ./try`
14562                 case "$yyy" in
14563                 12345678901)
14564                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14565                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14566                         echo "We will use %ld."
14567                         ;;
14568                 esac
14569         fi
14570 fi
14571
14572 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14573         $cat >try.c <<'EOCP'
14574 #include <sys/types.h>
14575 #include <inttypes.h>
14576 #include <stdio.h>
14577 int main() {
14578   int64_t q = 12345678901;
14579   printf("%" PRId64 "\n", q);
14580 }
14581 EOCP
14582         set try
14583         if eval $compile; then
14584                 yyy=`$run ./try`
14585                 case "$yyy" in
14586                 12345678901)
14587                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14588                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14589                         echo "We will use the C9X style."
14590                         ;;
14591                 esac
14592         fi
14593 fi
14594
14595 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14596         $cat >try.c <<EOCP
14597 #include <sys/types.h>
14598 #include <stdio.h>
14599 int main() {
14600   $quadtype q = 12345678901;
14601   printf("%Ld\n", q);
14602 }
14603 EOCP
14604         set try
14605         if eval $compile; then
14606                 yyy=`$run ./try`
14607                 case "$yyy" in
14608                 12345678901)
14609                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14610                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14611                         echo "We will use %Ld."
14612                         ;;
14613                 esac
14614         fi
14615 fi
14616
14617 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14618         $cat >try.c <<'EOCP'
14619 #include <sys/types.h>
14620 #include <stdio.h>
14621 int main() {
14622   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14623   printf("%lld\n", q);
14624 }
14625 EOCP
14626         set try
14627         if eval $compile; then
14628                 yyy=`$run ./try`
14629                 case "$yyy" in
14630                 12345678901)
14631                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14632                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14633                         echo "We will use the %lld style."
14634                         ;;
14635                 esac
14636         fi
14637 fi
14638
14639 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14640         $cat >try.c <<EOCP
14641 #include <sys/types.h>
14642 #include <stdio.h>
14643 int main() {
14644   $quadtype q = 12345678901;
14645   printf("%qd\n", q);
14646 }
14647 EOCP
14648         set try
14649         if eval $compile; then
14650                 yyy=`$run ./try`
14651                 case "$yyy" in
14652                 12345678901)
14653                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14654                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14655                         echo "We will use %qd."
14656                         ;;
14657                 esac
14658         fi
14659 fi
14660
14661 if $test X"$sPRId64" = X; then
14662         echo "Cannot figure out how to print 64-bit integers." >&4
14663 fi
14664
14665 $rm -f try try.*
14666
14667 fi
14668
14669 case "$sPRId64" in
14670 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14671         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14672         ;;
14673 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14674         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14675         ;;
14676 esac
14677
14678
14679 echo " "
14680 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14681
14682 if $test X"$ivsize" = X8; then
14683         ivdformat="$sPRId64"
14684         uvuformat="$sPRIu64"
14685         uvoformat="$sPRIo64"
14686         uvxformat="$sPRIx64"
14687         uvXUformat="$sPRIXU64"
14688 else
14689         if $test X"$ivsize" = X"$longsize"; then
14690                 ivdformat='"ld"'
14691                 uvuformat='"lu"'
14692                 uvoformat='"lo"'
14693                 uvxformat='"lx"'
14694                 uvXUformat='"lX"'
14695         else
14696                 if $test X"$ivsize" = X"$intsize"; then
14697                         ivdformat='"d"'
14698                         uvuformat='"u"'
14699                         uvoformat='"o"'
14700                         uvxformat='"x"'
14701                         uvXUformat='"X"'
14702                 else
14703                         : far out
14704                         if $test X"$ivsize" = X"$shortsize"; then
14705                                 ivdformat='"hd"'
14706                                 uvuformat='"hu"'
14707                                 uvoformat='"ho"'
14708                                 uvxformat='"hx"'
14709                                 uvXUformat='"hX"'
14710                         fi
14711                 fi
14712         fi
14713 fi
14714
14715 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14716         nveformat="$sPRIeldbl"
14717         nvfformat="$sPRIfldbl"
14718         nvgformat="$sPRIgldbl"
14719         nvEUformat="$sPRIEUldbl"
14720         nvFUformat="$sPRIFUldbl"
14721         nvGUformat="$sPRIGUldbl"
14722 else
14723         nveformat='"e"'
14724         nvfformat='"f"'
14725         nvgformat='"g"'
14726         nvEUformat='"E"'
14727         nvFUformat='"F"'
14728         nvGUformat='"G"'
14729 fi
14730
14731 case "$ivdformat" in
14732 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
14733     exit 1
14734     ;;
14735 esac
14736
14737
14738 echo " "
14739 $echo "Checking the format string to be used for gids..." >&4
14740
14741 case "$gidsign" in
14742 -1)     if $test X"$gidsize" = X"$ivsize"; then
14743                 gidformat="$ivdformat"
14744         else
14745                 if $test X"$gidsize" = X"$longsize"; then
14746                         gidformat='"ld"'
14747                 else
14748                         if $test X"$gidsize" = X"$intsize"; then
14749                                 gidformat='"d"'
14750                         else
14751                                 if $test X"$gidsize" = X"$shortsize"; then
14752                                         gidformat='"hd"'
14753                                 fi
14754                         fi
14755                 fi
14756         fi
14757         ;;
14758 *)      if $test X"$gidsize" = X"$uvsize"; then
14759                 gidformat="$uvuformat"
14760         else
14761                 if $test X"$gidsize" = X"$longsize"; then
14762                         gidformat='"lu"'
14763                 else
14764                         if $test X"$gidsize" = X"$intsize"; then
14765                                 gidformat='"u"'
14766                         else
14767                                 if $test X"$gidsize" = X"$shortsize"; then
14768                                         gidformat='"hu"'
14769                                 fi
14770                         fi
14771                 fi
14772         fi
14773         ;;
14774 esac
14775
14776 : see if getgroups exists
14777 set getgroups d_getgrps
14778 eval $inlibc
14779
14780 : see if setgroups exists
14781 set setgroups d_setgrps
14782 eval $inlibc
14783
14784
14785 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14786 echo " "
14787 case "$d_getgrps$d_setgrps" in
14788 *define*)
14789         case "$groupstype" in
14790         '') dflt="$gidtype" ;;
14791         *)  dflt="$groupstype" ;;
14792         esac
14793         $cat <<EOM
14794 What type of pointer is the second argument to getgroups() and setgroups()?
14795 Usually this is the same as group ids, $gidtype, but not always.
14796
14797 EOM
14798         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14799         . ./myread
14800         groupstype="$ans"
14801         ;;
14802 *)  groupstype="$gidtype";;
14803 esac
14804
14805 echo " "
14806 echo "Checking if your $make program sets \$(MAKE)..." >&4
14807 case "$make_set_make" in
14808 '')
14809         $sed 's/^X //' > testmake.mak << 'EOF'
14810 Xall:
14811 X       @echo 'maketemp="$(MAKE)"'
14812 EOF
14813         case "`$make -f testmake.mak 2>/dev/null`" in
14814         *maketemp=*) make_set_make='#' ;;
14815         *)      make_set_make="MAKE=$make" ;;
14816         esac
14817         $rm -f testmake.mak
14818         ;;
14819 esac
14820 case "$make_set_make" in
14821 '#') echo "Yup, it does.";;
14822 *) echo "Nope, it doesn't.";;
14823 esac
14824
14825 : see what type is used for mode_t
14826 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14827 set mode_t modetype int stdio.h sys/types.h
14828 eval $typedef_ask
14829
14830 : see if stdarg is available
14831 echo " "
14832 if $test `./findhdr stdarg.h`; then
14833         echo "<stdarg.h> found." >&4
14834         valstd="$define"
14835 else
14836         echo "<stdarg.h> NOT found." >&4
14837         valstd="$undef"
14838 fi
14839
14840 : see if varags is available
14841 echo " "
14842 if $test `./findhdr varargs.h`; then
14843         echo "<varargs.h> found." >&4
14844 else
14845         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14846 fi
14847
14848 : set up the varargs testing programs
14849 $cat > varargs.c <<EOP
14850 #ifdef I_STDARG
14851 #include <stdarg.h>
14852 #endif
14853 #ifdef I_VARARGS
14854 #include <varargs.h>
14855 #endif
14856
14857 #ifdef I_STDARG
14858 int f(char *p, ...)
14859 #else
14860 int f(va_alist)
14861 va_dcl
14862 #endif
14863 {
14864         va_list ap;
14865 #ifndef I_STDARG
14866         char *p;
14867 #endif
14868 #ifdef I_STDARG
14869         va_start(ap,p);
14870 #else
14871         va_start(ap);
14872         p = va_arg(ap, char *);
14873 #endif
14874         va_end(ap);
14875 }
14876 EOP
14877 $cat > varargs <<EOP
14878 $startsh
14879 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14880         echo "true"
14881 else
14882         echo "false"
14883 fi
14884 $rm -f varargs$_o
14885 EOP
14886 chmod +x varargs
14887
14888 : now check which varargs header should be included
14889 echo " "
14890 i_varhdr=''
14891 case "$valstd" in
14892 "$define")
14893         if `./varargs I_STDARG`; then
14894                 val='stdarg.h'
14895         elif `./varargs I_VARARGS`; then
14896                 val='varargs.h'
14897         fi
14898         ;;
14899 *)
14900         if `./varargs I_VARARGS`; then
14901                 val='varargs.h'
14902         fi
14903         ;;
14904 esac
14905 case "$val" in
14906 '')
14907 echo "I could not find the definition for va_dcl... You have problems..." >&4
14908         val="$undef"; set i_stdarg; eval $setvar
14909         val="$undef"; set i_varargs; eval $setvar
14910         ;;
14911 *) 
14912         set i_varhdr
14913         eval $setvar
14914         case "$i_varhdr" in
14915         stdarg.h)
14916                 val="$define"; set i_stdarg; eval $setvar
14917                 val="$undef"; set i_varargs; eval $setvar
14918                 ;;
14919         varargs.h)
14920                 val="$undef"; set i_stdarg; eval $setvar
14921                 val="$define"; set i_varargs; eval $setvar
14922                 ;;
14923         esac
14924         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14925 esac
14926 $rm -f varargs*
14927
14928 : see if we need va_copy
14929 echo " "
14930 case "$i_stdarg" in
14931 "$define")
14932         $cat >try.c <<EOCP
14933 #include <stdarg.h>
14934 #include <stdio.h>
14935 #$i_stdlib I_STDLIB
14936 #ifdef I_STDLIB
14937 #include <stdlib.h>
14938 #endif
14939 #include <signal.h>
14940
14941 int
14942 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14943 {
14944   return vfprintf(f, fmt, *valp);
14945 }
14946  
14947 int    
14948 myvfprintf(FILE *f, const  char *fmt, va_list val)
14949 {
14950   return ivfprintf(f, fmt, &val);
14951 }
14952       
14953 int
14954 myprintf(char *fmt, ...) 
14955 {
14956   va_list val;
14957   va_start(val, fmt);
14958   return myvfprintf(stdout, fmt, val); 
14959 }         
14960
14961 int
14962 main(int ac, char **av)
14963 {
14964   signal(SIGSEGV, exit);
14965
14966   myprintf("%s%cs all right, then\n", "that", '\'');                            
14967   exit(0);      
14968 }
14969 EOCP
14970         set try
14971         if eval $compile && $run ./try 2>&1 >/dev/null; then
14972                 case "`$run ./try`" in
14973                 "that's all right, then")
14974                         okay=yes
14975                         ;;
14976                 esac
14977         fi
14978         case "$okay" in
14979         yes)    echo "It seems that you don't need va_copy()." >&4
14980                 need_va_copy="$undef"
14981                 ;;
14982         *)      echo "It seems that va_copy() or similar will be needed." >&4
14983                 need_va_copy="$define"
14984                 ;;
14985         esac
14986         $rm -f try.* core core.* *.core *.core.*
14987         ;;
14988 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14989         ;;
14990 esac
14991
14992 : define a fucntion to check prototypes
14993 $cat > protochk <<EOSH
14994 $startsh
14995 cc="$cc"
14996 optimize="$optimize"
14997 ccflags="$ccflags"
14998 prototype="$prototype"
14999 define="$define"
15000 rm=$rm
15001 EOSH
15002
15003 $cat >> protochk <<'EOSH'
15004
15005 $rm -f try.c
15006 foo="$1"
15007 shift
15008 while test $# -ge 2; do
15009         case "$1" in
15010                 $define) echo "#include <$2>" >> try.c ;;
15011                 literal) echo "$2" >> try.c ;;
15012         esac
15013     shift 2
15014 done
15015 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
15016 cat >> try.c <<'EOCP'
15017 #ifdef CAN_PROTOTYPE
15018 #define _(args) args
15019 #else
15020 #define _(args) ()
15021 #endif
15022 EOCP
15023 echo "$foo" >> try.c
15024 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
15025 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
15026 status=$?
15027 $rm -f try.[co]
15028 exit $status
15029 EOSH
15030 chmod +x protochk
15031 $eunicefix protochk
15032
15033 : see what type is used for size_t
15034 rp="What is the type used for the length parameter for string functions?"
15035 set size_t sizetype 'unsigned int' stdio.h sys/types.h
15036 eval $typedef_ask
15037
15038 : check for type of arguments to gethostbyaddr. 
15039 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
15040         case "$d_gethbyaddr" in
15041         $define)
15042                 $cat <<EOM
15043
15044 Checking to see what type of arguments are accepted by gethostbyaddr().
15045 EOM
15046                 hdrs="$define sys/types.h
15047                         $d_socket sys/socket.h 
15048                         $i_niin netinet/in.h 
15049                         $i_netdb netdb.h
15050                         $i_unistd unistd.h"
15051                 : The first arg can 'char *' or 'void *'
15052                 : The second arg is some of integral type
15053                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
15054                         for yyy in size_t long int; do
15055                                 case "$netdb_host_type" in
15056                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
15057                                         if ./protochk "$try" $hdrs; then
15058                                                 echo "Your system accepts $xxx for the first arg."
15059                                                 echo "...and $yyy for the second arg."
15060                                                 netdb_host_type="$xxx"
15061                                                 netdb_hlen_type="$yyy"
15062                                         fi
15063                                         ;;
15064                                 esac
15065                         done
15066                 done
15067                 : In case none of those worked, prompt the user.
15068                 case "$netdb_host_type" in
15069                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
15070                         dflt='char *'
15071                         . ./myread
15072                         netdb_host_type=$ans
15073                         rp='What is the type for the 2nd argument to gethostbyaddr?'
15074                         dflt="$sizetype"
15075                         . ./myread
15076                         netdb_hlen_type=$ans
15077                         ;;
15078                 esac
15079                 ;;
15080         *)      : no gethostbyaddr, so pick harmless defaults
15081                 netdb_host_type='char *'
15082                 netdb_hlen_type="$sizetype"
15083                 ;;
15084         esac
15085         # Remove the "const" if needed. -- but then we'll have a 
15086         # prototype clash!
15087         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
15088 fi
15089
15090 : check for type of argument to gethostbyname. 
15091 if test "X$netdb_name_type" = X ; then
15092         case "$d_gethbyname" in
15093         $define)
15094                 $cat <<EOM
15095
15096 Checking to see what type of argument is accepted by gethostbyname().
15097 EOM
15098                 hdrs="$define sys/types.h
15099                         $d_socket sys/socket.h 
15100                         $i_niin netinet/in.h 
15101                         $i_netdb netdb.h
15102                         $i_unistd unistd.h"
15103                 for xxx in "const char *" "char *"; do
15104                         case "$netdb_name_type" in
15105                         '')     try="extern struct hostent *gethostbyname($xxx);"
15106                                 if ./protochk "$try" $hdrs; then
15107                                         echo "Your system accepts $xxx."
15108                                         netdb_name_type="$xxx"
15109                                 fi
15110                                 ;;
15111                         esac
15112                 done
15113                 : In case none of those worked, prompt the user.
15114                 case "$netdb_name_type" in
15115                 '')     rp='What is the type for the 1st argument to gethostbyname?'
15116                         dflt='char *'
15117                         . ./myread
15118                         netdb_name_type=$ans
15119                         ;;
15120                 esac
15121                 ;;
15122         *)      : no gethostbyname, so pick harmless default
15123                 netdb_name_type='char *'
15124                 ;;
15125         esac
15126 fi
15127
15128 : check for type of 1st argument to getnetbyaddr. 
15129 if test "X$netdb_net_type" = X ; then
15130         case "$d_getnbyaddr" in
15131         $define)
15132                 $cat <<EOM
15133
15134 Checking to see what type of 1st argument is accepted by getnetbyaddr().
15135 EOM
15136                 hdrs="$define sys/types.h
15137                         $d_socket sys/socket.h 
15138                         $i_niin netinet/in.h 
15139                         $i_netdb netdb.h
15140                         $i_unistd unistd.h"
15141                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
15142                         case "$netdb_net_type" in
15143                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
15144                                 if ./protochk "$try" $hdrs; then
15145                                         echo "Your system accepts $xxx."
15146                                         netdb_net_type="$xxx"
15147                                 fi
15148                                 ;;
15149                         esac
15150                 done
15151                 : In case none of those worked, prompt the user.
15152                 case "$netdb_net_type" in
15153                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
15154                         dflt='long'
15155                         . ./myread
15156                         netdb_net_type=$ans
15157                         ;;
15158                 esac
15159                 ;;
15160         *)      : no getnetbyaddr, so pick harmless default
15161                 netdb_net_type='long'
15162                 ;;
15163         esac
15164 fi
15165 : locate the preferred pager for this system
15166 case "$pager" in
15167 '')
15168         dflt=''
15169         case "$pg" in
15170         /*) dflt=$pg;;
15171         [a-zA-Z]:/*) dflt=$pg;;
15172         esac
15173         case "$more" in
15174         /*) dflt=$more;;
15175         [a-zA-Z]:/*) dflt=$more;;
15176         esac
15177         case "$less" in
15178         /*) dflt=$less;;
15179         [a-zA-Z]:/*) dflt=$less;;
15180         esac
15181         case "$dflt" in
15182         '') dflt=/usr/ucb/more;;
15183         esac
15184         ;;
15185 *) dflt="$pager";;
15186 esac
15187 echo " "
15188 fn=f/
15189 rp='What pager is used on your system?'
15190 . ./getfile
15191 pager="$ans"
15192
15193 : see what type pids are declared as in the kernel
15194 rp="What is the type of process ids on this system?"
15195 set pid_t pidtype int stdio.h sys/types.h
15196 eval $typedef_ask
15197
15198 : Find earliest binary compatible site_perl subdirectory perl can use.
15199 case "$bincompat5005" in
15200 "$define") xs_apiversion='5.005' ;;
15201 *) xs_apiversion=$version ;;   # The current site_perl version.
15202 esac
15203 : Find earliest pure perl site_perl subdirectory perl can use.
15204 : The versioned directories started at 5.005.
15205 pm_apiversion='5.005'
15206
15207 : see if ar generates random libraries by itself
15208 echo " "
15209 echo "Checking how to generate random libraries on your machine..." >&4
15210 echo 'int bar1() { return bar2(); }' > bar1.c
15211 echo 'int bar2() { return 2; }' > bar2.c
15212 $cat > foo.c <<'EOP'
15213 int main() { printf("%d\n", bar1()); exit(0); }
15214 EOP
15215 $cc $ccflags -c bar1.c >/dev/null 2>&1
15216 $cc $ccflags -c bar2.c >/dev/null 2>&1
15217 $cc $ccflags -c foo.c >/dev/null 2>&1
15218 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
15219 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15220         $run ./foobar >/dev/null 2>&1; then
15221         echo "$ar appears to generate random libraries itself."
15222         orderlib=false
15223         ranlib=":"
15224 elif $ar ts bar$_a >/dev/null 2>&1 &&
15225         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15226         $run ./foobar >/dev/null 2>&1; then
15227                 echo "a table of contents needs to be added with '$ar ts'."
15228                 orderlib=false
15229                 ranlib="$ar ts"
15230 else
15231         case "$ranlib" in
15232         :) ranlib='';;
15233         '')
15234                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
15235                 $test -f $ranlib || ranlib=''
15236                 ;;
15237         esac
15238         if $test -n "$ranlib"; then
15239                 echo "your system has '$ranlib'; we'll use that."
15240                 orderlib=false
15241         else
15242                 echo "your system doesn't seem to support random libraries"
15243                 echo "so we'll use lorder and tsort to order the libraries."
15244                 orderlib=true
15245                 ranlib=":"
15246         fi
15247 fi
15248 $rm -f foo* bar* 
15249
15250 : check for type of arguments to select. 
15251 case "$selecttype" in
15252 '') case "$d_select" in
15253         $define)
15254                 echo " "
15255                 $cat <<EOM
15256 Checking to see what type of arguments are accepted by select().
15257 EOM
15258                 hdrs="$define sys/types.h
15259                         $i_systime sys/time.h 
15260                         $i_sysselct sys/select.h
15261                         $d_socket sys/socket.h"
15262                 : The first arg can be int, unsigned, or size_t
15263                 : The last arg may or may not be 'const'
15264                 val=''
15265                 : void pointer has been seen but using that
15266                 : breaks the selectminbits test
15267                 for xxx in 'fd_set *' 'int *'; do
15268                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
15269                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
15270                                         case "$val" in
15271                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
15272                                                 if ./protochk "$try" $hdrs; then
15273                                                         echo "Your system accepts $xxx."
15274                                                         val="$xxx"
15275                                                 fi
15276                                                 ;;
15277                                         esac
15278                                 done
15279                         done
15280                 done
15281                 case "$val" in
15282                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
15283                         case "$d_fd_set" in
15284                                 $define) dflt="fd_set *" ;;
15285                                 *)              dflt="int *" ;;
15286                         esac
15287                         . ./myread
15288                         val=$ans
15289                         ;;
15290                 esac
15291                 selecttype="$val"
15292                 ;;
15293         *)      : no select, so pick a harmless default
15294                 selecttype='int *'
15295                 ;;
15296         esac
15297         ;;
15298 esac
15299
15300 : check for the select 'width'
15301 case "$selectminbits" in
15302 '') case "$d_select" in
15303         $define)
15304                 $cat <<EOM
15305
15306 Checking to see on how many bits at a time your select() operates...
15307 EOM
15308                 $cat >try.c <<EOCP
15309 #include <sys/types.h>
15310 #$i_time I_TIME
15311 #$i_systime I_SYS_TIME
15312 #$i_systimek I_SYS_TIME_KERNEL
15313 #ifdef I_TIME
15314 #   include <time.h>
15315 #endif
15316 #ifdef I_SYS_TIME
15317 #   ifdef I_SYS_TIME_KERNEL
15318 #       define KERNEL
15319 #   endif
15320 #   include <sys/time.h>
15321 #   ifdef I_SYS_TIME_KERNEL
15322 #       undef KERNEL
15323 #   endif
15324 #endif
15325 #$i_sysselct I_SYS_SELECT
15326 #ifdef I_SYS_SELECT
15327 #include <sys/select.h>
15328 #endif
15329 #$d_socket HAS_SOCKET
15330 #ifdef HAS_SOCKET
15331 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15332 #endif
15333 #include <stdio.h>
15334 $selecttype b;
15335 #define S sizeof(*(b))
15336 #define MINBITS 64
15337 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15338 #define NBITS  (NBYTES * 8)
15339 int main() {
15340     char s[NBYTES];
15341     struct timeval t;
15342     int i;
15343     FILE* fp;
15344     int fd;
15345
15346     fclose(stdin);
15347     fp = fopen("try.c", "r");
15348     if (fp == 0)
15349       exit(1);
15350     fd = fileno(fp);
15351     if (fd < 0)
15352       exit(2);
15353     b = ($selecttype)s;
15354     for (i = 0; i < NBITS; i++)
15355         FD_SET(i, b);
15356     t.tv_sec  = 0;
15357     t.tv_usec = 0;
15358     select(fd + 1, b, 0, 0, &t);
15359     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15360     printf("%d\n", i + 1);
15361     return 0;
15362 }
15363 EOCP
15364                 set try
15365                 if eval $compile_ok; then
15366                         selectminbits=`$run ./try`
15367                         case "$selectminbits" in
15368                         '')     cat >&4 <<EOM
15369 Cannot figure out on how many bits at a time your select() operates.
15370 I'll play safe and guess it is 32 bits.
15371 EOM
15372                                 selectminbits=32
15373                                 bits="32 bits"
15374                                 ;;
15375                         1)      bits="1 bit" ;;
15376                         *)      bits="$selectminbits bits" ;;
15377                         esac
15378                         echo "Your select() operates on $bits at a time." >&4
15379                 else
15380                         rp='What is the minimum number of bits your select() operates on?'
15381                         case "$byteorder" in
15382                         1234|12345678)  dflt=32 ;;
15383                         *)              dflt=1  ;;
15384                         esac
15385                         . ./myread
15386                         val=$ans
15387                         selectminbits="$val"
15388                 fi
15389                 $rm -f try.* try
15390                 ;;
15391         *)      : no select, so pick a harmless default
15392                 selectminbits='32'
15393                 ;;
15394         esac
15395         ;;
15396 esac
15397
15398 : Trace out the files included by signal.h, then look for SIGxxx names.
15399 : Remove SIGARRAYSIZE used by HPUX.
15400 : Remove SIGSTKSIZE used by Linux.
15401 : Remove SIGSTKSZ used by Posix.
15402 : Remove SIGTYP void lines used by OS2.
15403 : Some cpps, like os390, dont give the file name anywhere
15404 if [ "X$fieldn" = X ]; then
15405         : Just make some guesses.  We check them later.
15406         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15407 else
15408         xxx=`echo '#include <signal.h>' |
15409         $cppstdin $cppminus $cppflags 2>/dev/null |
15410         $grep '^[       ]*#.*include' | 
15411         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15412 fi
15413 : Check this list of files to be sure we have parsed the cpp output ok.
15414 : This will also avoid potentially non-existent files, such 
15415 : as ../foo/bar.h
15416 xxxfiles=''
15417 for xx in $xxx /dev/null ; do
15418         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15419 done
15420 : If we have found no files, at least try signal.h
15421 case "$xxxfiles" in
15422 '')     xxxfiles=`./findhdr signal.h` ;;
15423 esac
15424 xxx=`awk '
15425 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15426         print substr($2, 4, 20)
15427 }
15428 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15429         print substr($3, 4, 20)
15430 }' $xxxfiles`
15431 : Append some common names just in case the awk scan failed.
15432 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15433 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15434 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15435 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15436 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15437
15438 : generate a few handy files for later
15439 $cat > signal.c <<'EOCP'
15440 #include <sys/types.h>
15441 #include <signal.h>
15442 #include <stdio.h>
15443 int main() {
15444
15445 /* Strange style to avoid deeply-nested #if/#else/#endif */
15446 #ifndef NSIG
15447 #  ifdef _NSIG
15448 #    define NSIG (_NSIG)
15449 #  endif
15450 #endif
15451
15452 #ifndef NSIG
15453 #  ifdef SIGMAX
15454 #    define NSIG (SIGMAX+1)
15455 #  endif
15456 #endif
15457
15458 #ifndef NSIG
15459 #  ifdef SIG_MAX
15460 #    define NSIG (SIG_MAX+1)
15461 #  endif
15462 #endif
15463
15464 #ifndef NSIG
15465 #  ifdef MAXSIG
15466 #    define NSIG (MAXSIG+1)
15467 #  endif
15468 #endif
15469
15470 #ifndef NSIG
15471 #  ifdef MAX_SIG
15472 #    define NSIG (MAX_SIG+1)
15473 #  endif
15474 #endif
15475
15476 #ifndef NSIG
15477 #  ifdef SIGARRAYSIZE
15478 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15479 #  endif
15480 #endif
15481
15482 #ifndef NSIG
15483 #  ifdef _sys_nsig
15484 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15485 #  endif
15486 #endif
15487
15488 /* Default to some arbitrary number that's big enough to get most
15489    of the common signals.
15490 */
15491 #ifndef NSIG
15492 #    define NSIG 50
15493 #endif
15494
15495 printf("NSIG %d\n", NSIG);
15496
15497 #ifndef JUST_NSIG
15498
15499 EOCP
15500
15501 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15502 {
15503         printf "#ifdef SIG"; printf $1; printf "\n"
15504         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15505         printf $1; printf ");\n"
15506         printf "#endif\n"
15507 }
15508 END {
15509         printf "#endif /* JUST_NSIG */\n";
15510         printf "exit(0);\n}\n";
15511 }
15512 ' >>signal.c
15513 $cat >signal.awk <<'EOP'
15514 BEGIN { ndups = 0 }
15515 $1 ~ /^NSIG$/ { nsig = $2 }
15516 ($1 !~ /^NSIG$/) && (NF == 2) {
15517     if ($2 > maxsig) { maxsig = $2 }
15518     if (sig_name[$2]) {
15519         dup_name[ndups] = $1
15520         dup_num[ndups] = $2
15521         ndups++ 
15522     }
15523     else {
15524         sig_name[$2] = $1
15525         sig_num[$2] = $2
15526     }
15527 }
15528 END { 
15529     if (nsig == 0) {
15530         nsig = maxsig + 1
15531     }
15532     printf("NSIG %d\n", nsig);
15533     for (n = 1; n < nsig; n++) {
15534         if (sig_name[n]) {
15535             printf("%s %d\n", sig_name[n], sig_num[n])
15536         }
15537         else {
15538             printf("NUM%d %d\n", n, n) 
15539         }
15540     }
15541     for (n = 0; n < ndups; n++) {
15542         printf("%s %d\n", dup_name[n], dup_num[n])
15543     }
15544 }
15545 EOP
15546 $cat >signal_cmd <<EOS
15547 $startsh
15548 if $test -s signal.lst; then
15549     echo "Using your existing signal.lst file"
15550         exit 0
15551 fi
15552 xxx="$xxx"
15553 EOS
15554 $cat >>signal_cmd <<'EOS'
15555
15556 set signal
15557 if eval $compile_ok; then
15558         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15559 else
15560         echo "(I can't seem be able to compile the whole test program)" >&4
15561         echo "(I'll try it in little pieces.)" >&4
15562         set signal -DJUST_NSIG
15563         if eval $compile_ok; then
15564                 $run ./signal$_exe > signal.nsg
15565                 $cat signal.nsg
15566         else
15567                 echo "I can't seem to figure out how many signals you have." >&4
15568                 echo "Guessing 50." >&4
15569                 echo 'NSIG 50' > signal.nsg
15570         fi
15571         : Now look at all the signal names, one at a time.
15572         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15573                 $cat > signal.c <<EOCP
15574 #include <sys/types.h>
15575 #include <signal.h>
15576 #include <stdio.h>
15577 int main() {
15578 printf("$xx %d\n", SIG${xx});
15579 return 0;
15580 }
15581 EOCP
15582                 set signal
15583                 if eval $compile; then
15584                         echo "SIG${xx} found."
15585                         $run ./signal$_exe  >> signal.ls1
15586                 else
15587                         echo "SIG${xx} NOT found."
15588                 fi
15589         done
15590         if $test -s signal.ls1; then
15591                 $cat signal.nsg signal.ls1 |
15592                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15593         fi
15594
15595 fi
15596 if $test -s signal.lst; then
15597         :
15598 else
15599         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15600         echo 'kill -l' >signal
15601         set X `csh -f <signal`
15602         $rm -f signal
15603         shift
15604         case $# in
15605         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15606         esac
15607         echo $@ | $tr ' ' $trnl | \
15608             $awk '{ printf "%s %d\n", $1, ++s; }
15609                   END { printf "NSIG %d\n", ++s }' >signal.lst
15610 fi
15611 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15612 EOS
15613 chmod a+x signal_cmd
15614 $eunicefix signal_cmd
15615
15616 : generate list of signal names
15617 echo " "
15618 case "$sig_name_init" in
15619 '') doinit=yes ;;
15620 *)  case "$sig_num_init" in
15621     ''|*,*) doinit=yes ;;
15622     esac ;;
15623 esac
15624 case "$doinit" in
15625 yes)
15626         echo "Generating a list of signal names and numbers..." >&4
15627         . ./signal_cmd
15628         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15629         sig_name=`$awk 'BEGIN { printf "ZERO " }
15630                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15631         sig_num=`$awk  'BEGIN { printf "0 " }
15632                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15633         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15634                              !/^NSIG/   { printf "\"%s\", ", $1 }
15635                              END        { printf "0\n" }' signal.lst`
15636         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15637                              !/^NSIG/   { printf "%d, ", $2}
15638                              END        { printf "0\n"}' signal.lst`
15639         ;;
15640 esac
15641 echo "The following $sig_count signals are available:"
15642 echo " "
15643 echo $sig_name | $awk \
15644 'BEGIN { linelen = 0 }
15645 {
15646         for (i = 1; i <= NF; i++) {
15647                 name = "SIG" $i " "
15648                 linelen = linelen + length(name)
15649                 if (linelen > 70) {
15650                         printf "\n"
15651                         linelen = length(name)
15652                 }
15653                 printf "%s", name
15654         }
15655         printf "\n"
15656 }'
15657 sig_size=`echo $sig_name | awk '{print NF}'`
15658 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15659
15660 echo " "
15661 case "$sizetype" in
15662 *_t) zzz="$sizetype"    ;;
15663 *)   zzz="filesize"     ;;
15664 esac
15665 echo "Checking the size of $zzz..." >&4 
15666 cat > try.c <<EOCP
15667 #include <sys/types.h>
15668 #include <stdio.h>
15669 int main() {
15670     printf("%d\n", (int)sizeof($sizetype));
15671     exit(0);
15672 }
15673 EOCP
15674 set try
15675 if eval $compile_ok; then
15676         yyy=`$run ./try`
15677         case "$yyy" in
15678         '')     sizesize=4
15679                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15680                 ;;
15681         *)      sizesize=$yyy
15682                 echo "Your $zzz size is $sizesize bytes."
15683                 ;;
15684         esac
15685 else
15686         sizesize=4
15687         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15688 fi
15689
15690
15691 : check for socklen_t
15692 echo " "
15693 echo "Checking to see if you have socklen_t..." >&4
15694 $cat >try.c <<EOCP
15695 #include <sys/types.h>
15696 #$d_socket HAS_SOCKET
15697 #ifdef HAS_SOCKET
15698 #include <sys/socket.h>
15699 #endif
15700 int main() { socklen_t x = 16; }
15701 EOCP
15702 set try
15703 if eval $compile; then
15704         val="$define"
15705         echo "You have socklen_t."
15706 else
15707         val="$undef"
15708         echo "You do not have socklen_t."
15709         case "$sizetype" in
15710         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15711         esac
15712 fi
15713 $rm -f try try.*
15714 set d_socklen_t
15715 eval $setvar
15716
15717 : see if this is a socks.h system
15718 set socks.h i_socks
15719 eval $inhdr
15720
15721 : check for type of the size argument to socket calls
15722 case "$d_socket" in
15723 "$define")
15724         $cat <<EOM
15725
15726 Checking to see what type is the last argument of accept().
15727 EOM
15728         yyy=''
15729         case "$d_socklen_t" in
15730         "$define") yyy="$yyy socklen_t"
15731         esac
15732         yyy="$yyy $sizetype int long unsigned"
15733         for xxx in $yyy; do
15734                 case "$socksizetype" in
15735                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15736                         case "$usesocks" in
15737                         "$define")
15738                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15739                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15740                                         socksizetype="$xxx"
15741                                 fi
15742                                 ;;
15743                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15744                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15745                                         socksizetype="$xxx"
15746                                 fi
15747                                 ;;
15748                         esac
15749                         ;;
15750                 esac
15751         done
15752 : In case none of those worked, prompt the user.
15753         case "$socksizetype" in
15754         '')     rp='What is the type for socket address structure sizes?'
15755                 dflt='int'
15756                 . ./myread
15757                 socksizetype=$ans
15758                 ;;
15759         esac
15760         ;;
15761 *)      : no sockets, so pick relatively harmless default
15762         socksizetype='int'
15763         ;;
15764 esac
15765
15766 : see what type is used for signed size_t
15767 set ssize_t ssizetype int stdio.h sys/types.h
15768 eval $typedef
15769 dflt="$ssizetype"
15770 $cat > try.c <<EOM
15771 #include <stdio.h>
15772 #include <sys/types.h>
15773 #define Size_t $sizetype
15774 #define SSize_t $dflt
15775 int main()
15776 {
15777         if (sizeof(Size_t) == sizeof(SSize_t))
15778                 printf("$dflt\n");
15779         else if (sizeof(Size_t) == sizeof(int))
15780                 printf("int\n");
15781         else 
15782                 printf("long\n");
15783         exit(0);
15784 }
15785 EOM
15786 echo " "
15787 set try
15788 if eval $compile_ok && $run ./try > /dev/null; then
15789         ssizetype=`$run ./try`
15790         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15791 else
15792         $cat >&4 <<EOM
15793 Help! I can't compile and run the ssize_t test program: please enlighten me!
15794 (This is probably a misconfiguration in your system or libraries, and
15795 you really ought to fix it.  Still, I'll try anyway.)
15796
15797 I need a type that is the same size as $sizetype, but is guaranteed to
15798 be signed.  Common values are ssize_t, int and long.
15799
15800 EOM
15801         rp="What signed type is the same size as $sizetype?"
15802         . ./myread
15803         ssizetype="$ans"
15804 fi
15805 $rm -f try try.*
15806
15807 : see what type of char stdio uses.
15808 echo " "
15809 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15810 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15811         echo "Your stdio uses unsigned chars." >&4
15812         stdchar="unsigned char"
15813 else
15814         echo "Your stdio uses signed chars." >&4
15815         stdchar="char"
15816 fi
15817 $rm -f stdioh
15818
15819
15820
15821 : see if time exists
15822 echo " "
15823 if test "X$d_time" = X -o X"$timetype" = X; then
15824     if set time val -f d_time; eval $csym; $val; then
15825                 echo 'time() found.' >&4
15826                 val="$define"
15827                 rp="What is the type returned by time() on this system?"
15828                 set time_t timetype long stdio.h sys/types.h
15829                 eval $typedef_ask
15830     else
15831                 echo 'time() not found, hope that will do.' >&4
15832                 val="$undef"
15833                 timetype='int';
15834     fi
15835     set d_time
15836     eval $setvar
15837 fi
15838
15839 : see what type uids are declared as in the kernel
15840 echo " "
15841 echo "Looking for the type for user ids returned by getuid()."
15842 set uid_t uidtype xxx stdio.h sys/types.h
15843 eval $typedef
15844 case "$uidtype" in
15845 xxx)
15846         xxx=`./findhdr sys/user.h`
15847         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15848         case $1 in
15849         unsigned) dflt="$1 $2" ;;
15850         *) dflt="$1" ;;
15851         esac
15852         ;;
15853 *) dflt="$uidtype";;
15854 esac
15855 case "$uidtype" in
15856 uid_t)  echo "uid_t found." ;;
15857 *)      rp="What is the type for user ids returned by getuid()?"
15858         . ./myread
15859         uidtype="$ans"
15860         ;;
15861 esac
15862
15863 echo " "
15864 case "$uidtype" in
15865 *_t) zzz="$uidtype"     ;;
15866 *)   zzz="uid"          ;;
15867 esac
15868 echo "Checking the size of $zzz..." >&4 
15869 cat > try.c <<EOCP
15870 #include <sys/types.h>
15871 #include <stdio.h>
15872 int main() {
15873     printf("%d\n", (int)sizeof($uidtype));
15874     exit(0);
15875 }
15876 EOCP
15877 set try
15878 if eval $compile_ok; then
15879         yyy=`$run ./try`
15880         case "$yyy" in
15881         '')     uidsize=4
15882                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15883                 ;;
15884         *)      uidsize=$yyy
15885                 echo "Your $zzz is $uidsize bytes long."
15886                 ;;
15887         esac
15888 else
15889         uidsize=4
15890         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15891 fi
15892
15893 echo " "
15894 case "$uidtype" in
15895 *_t) zzz="$uidtype"     ;;
15896 *)   zzz="uid"          ;;
15897 esac
15898 echo "Checking the sign of $zzz..." >&4
15899 cat > try.c <<EOCP
15900 #include <sys/types.h>
15901 #include <stdio.h>
15902 int main() {
15903         $uidtype foo = -1;
15904         if (foo < 0)
15905                 printf("-1\n");
15906         else
15907                 printf("1\n");
15908 }
15909 EOCP
15910 set try
15911 if eval $compile; then
15912         yyy=`$run ./try`
15913         case "$yyy" in
15914         '')     uidsign=1
15915                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15916                 ;;
15917         *)      uidsign=$yyy
15918                 case "$uidsign" in
15919                  1) echo "Your $zzz is unsigned." ;;
15920                 -1) echo "Your $zzz is signed."   ;;
15921                 esac
15922                 ;;
15923         esac
15924 else
15925         uidsign=1
15926         echo "(I can't compile the test program--guessing unsigned.)" >&4
15927 fi
15928
15929
15930
15931 echo " "
15932 $echo "Checking the format string to be used for uids..." >&4
15933
15934 case "$uidsign" in
15935 -1)     if $test X"$uidsize" = X"$ivsize"; then
15936                 uidformat="$ivdformat"
15937         else
15938                 if $test X"$uidsize" = X"$longsize"; then
15939                         uidformat='"ld"'
15940                 else
15941                         if $test X"$uidsize" = X"$intsize"; then
15942                                 uidformat='"d"'
15943                         else
15944                                 if $test X"$uidsize" = X"$shortsize"; then
15945                                         uidformat='"hd"'
15946                                 fi
15947                         fi
15948                 fi
15949         fi
15950         ;;
15951 *)      if $test X"$uidsize" = X"$uvsize"; then
15952                 uidformat="$uvuformat"
15953         else
15954                 if $test X"$uidsize" = X"$longsize"; then
15955                         uidformat='"lu"'
15956                 else
15957                         if $test X"$uidsize" = X"$intsize"; then
15958                                 uidformat='"u"'
15959                         else
15960                                 if $test X"$uidsize" = X"$shortsize"; then
15961                                         uidformat='"hu"'
15962                                 fi
15963                         fi
15964                 fi
15965         fi
15966         ;;
15967 esac
15968
15969 : determine compiler compiler
15970 case "$yacc" in
15971 '')
15972         dflt=yacc;;
15973 *)
15974         dflt="$yacc";;
15975 esac
15976 echo " "
15977 comp='yacc'
15978 if $test -f "$byacc$_exe"; then
15979         dflt="$byacc"
15980         comp="byacc or $comp"
15981 fi
15982 if $test -f "$bison$_exe"; then
15983         comp="$comp or bison -y"
15984 fi
15985 rp="Which compiler compiler ($comp) shall I use?"
15986 . ./myread
15987 yacc="$ans"
15988 case "$yacc" in
15989 *bis*)
15990         case "$yacc" in
15991         *-y*) ;;
15992         *)
15993                 yacc="$yacc -y"
15994                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15995                 ;;
15996         esac
15997         ;;
15998 esac
15999
16000 : see if this is a fp.h system
16001 set fp.h i_fp
16002 eval $inhdr
16003
16004 : see if this is a fp_class.h system
16005 set fp_class.h i_fp_class
16006 eval $inhdr
16007
16008 : see if this is a ieeefp.h system
16009 case "$i_ieeefp" in
16010 '' ) set ieeefp.h i_ieeefp
16011      eval $inhdr
16012      ;;
16013 esac
16014
16015 : see if this is a libutil.h system
16016 set libutil.h i_libutil
16017 eval $inhdr
16018
16019 : see if locale.h is available
16020 set locale.h i_locale
16021 eval $inhdr
16022
16023 : see if mach cthreads are available
16024 if test "X$usethreads" = "X$define"; then
16025         set mach/cthreads.h i_machcthr
16026         eval $inhdr
16027 else
16028         i_machcthr="$undef"
16029 fi
16030
16031
16032
16033 : see if this is a math.h system
16034 set math.h i_math
16035 eval $inhdr
16036
16037 : see if this is a mntent.h system
16038 set mntent.h i_mntent
16039 eval $inhdr
16040
16041 : see if ndbm.h is available
16042 set ndbm.h t_ndbm
16043 eval $inhdr
16044 case "$t_ndbm" in
16045 $define)
16046         : see if dbm_open exists
16047         set dbm_open d_dbm_open
16048         eval $inlibc
16049         case "$d_dbm_open" in
16050         $undef)
16051                 t_ndbm="$undef"
16052                 echo "We won't be including <ndbm.h>"
16053                 ;;
16054         esac
16055         ;;
16056 esac
16057 val="$t_ndbm"
16058 set i_ndbm
16059 eval $setvar
16060
16061 : see if net/errno.h is available
16062 val=''
16063 set net/errno.h val
16064 eval $inhdr
16065
16066 : Unfortunately, it causes problems on some systems.  Arrgh.
16067 case "$val" in
16068 $define)
16069         cat > try.c <<'EOM'
16070 #include <stdio.h>
16071 #include <errno.h>
16072 #include <net/errno.h>
16073 int func()
16074 {
16075         return ENOTSOCK;
16076 }
16077 EOM
16078         if $cc $ccflags -c try.c >/dev/null 2>&1; then
16079                 echo "We'll be including <net/errno.h>." >&4
16080         else
16081                 echo "We won't be including <net/errno.h>." >&4
16082                 val="$undef"
16083         fi
16084         $rm -f try.* try
16085         ;;
16086 esac
16087 set i_neterrno
16088 eval $setvar
16089
16090 : see if netinet/tcp.h is available
16091 set netinet/tcp.h i_netinettcp
16092 eval $inhdr
16093
16094 : see if this is a poll.h system
16095 set poll.h i_poll
16096 eval $inhdr
16097
16098 : see if this is a prot.h system
16099 set prot.h i_prot
16100 eval $inhdr
16101
16102 echo " "
16103 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
16104 $cat <<'EOSH' > Cppsym.know
16105 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
16106 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
16107 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
16108 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
16109 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
16110 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
16111 bull c cadmus clipper CMU COFF COMPILER_VERSION
16112 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
16113 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
16114 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
16115 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
16116 GLIBC GLIBC_MINOR
16117 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
16118 H3050R H3050RX hbullx20 hcx host_mips
16119 hp200 hp300 hp700 HP700 hp800 hp9000
16120 hp9000s200 hp9000s300 hp9000s400 hp9000s500
16121 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
16122 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
16123 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
16124 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
16125 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
16126 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
16127 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
16128 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
16129 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
16130 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
16131 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
16132 MATH_HAS_NO_SIDE_EFFECTS
16133 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
16134 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
16135 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
16136 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
16137 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
16138 NetBSD news1500 news1700 news1800 news1900 news3700
16139 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
16140 ns32016 ns32332 ns32k nsc32000
16141 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
16142 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
16143 pc532 pdp11 PGC PIC plexus PORTAR posix
16144 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
16145 POSIX_C_SOURCE POSIX_SOURCE POWER
16146 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
16147 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
16148 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
16149 sony sony_news sonyrisc sparc sparclite spectrum
16150 stardent stdc STDC_EXT stratos sun sun3 sun386
16151 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
16152 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
16153 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
16154 sysV68 sysV88 Tek4132 Tek4300 titan
16155 TM3200 TM5400 TM5600
16156 tower tower32 tower32_200 tower32_600 tower32_700
16157 tower32_800 tower32_850 tss
16158 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
16159 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
16160 unix UNIX95 UNIX99 unixpc unos
16161 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
16162 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
16163 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
16164 USGr4 USGr4_2
16165 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
16166 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
16167 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
16168 z8000
16169 EOSH
16170 # Maybe put other stuff here too.
16171 cat <<EOSH >>Cppsym.know
16172 $osname
16173 EOSH
16174 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
16175 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
16176 $cat Cppsym.know > Cppsym.c
16177 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
16178 $rm -f Cppsym.a Cppsym.b Cppsym.c
16179 cat <<EOSH > Cppsym
16180 $startsh
16181 if $test \$# -gt 0; then
16182     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
16183     if $test -s Cppsym.got; then
16184         $rm -f Cppsym.got
16185         exit 0
16186     fi
16187     $rm -f Cppsym.got
16188     exit 1
16189 else
16190     $tr " " "$trnl" | ./Cppsym.try
16191     exit 0
16192 fi
16193 EOSH
16194 chmod +x Cppsym
16195 $eunicefix Cppsym
16196 cat <<EOSH > Cppsym.try
16197 $startsh
16198 cat <<'EOCP' > try.c
16199 #include <stdio.h>
16200 int main() {
16201 EOCP
16202 $awk \\
16203 EOSH
16204 cat <<'EOSH' >> Cppsym.try
16205 'length($1) > 0 {
16206     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
16207     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
16208     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
16209     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
16210 }'       >> try.c
16211 echo 'return 0;}' >> try.c
16212 EOSH
16213 cat <<EOSH >> Cppsym.try
16214 ccflags="$ccflags"
16215 case "$osname-$gccversion" in
16216 irix-) ccflags="\$ccflags -woff 1178" ;;
16217 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
16218 esac
16219 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
16220 EOSH
16221 chmod +x Cppsym.try
16222 $eunicefix Cppsym.try
16223 ./Cppsym < Cppsym.know > Cppsym.true
16224 : now check the C compiler for additional symbols
16225 postprocess_cc_v=''
16226 case "$osname" in
16227 aix) postprocess_cc_v="|$tr , ' '" ;;
16228 esac
16229 $cat >ccsym <<EOS
16230 $startsh
16231 $cat >tmp.c <<EOF
16232 extern int foo;
16233 EOF
16234 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
16235 do
16236         case "\$i" in
16237         -D*) echo "\$i" | $sed 's/^-D//';;
16238         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
16239         esac
16240 done
16241 $rm -f try.c
16242 EOS
16243 postprocess_cc_v=''
16244 chmod +x ccsym
16245 $eunicefix ccsym
16246 ./ccsym > ccsym1.raw
16247 if $test -s ccsym1.raw; then
16248        $sort ccsym1.raw | $uniq >ccsym.raw
16249 else
16250        mv ccsym1.raw ccsym.raw
16251 fi
16252
16253 $awk '/\=/ { print $0; next }
16254         { print $0"=1" }' ccsym.raw >ccsym.list
16255 $awk '/\=/ { print $0; next }
16256         { print $0"=1" }' Cppsym.true >ccsym.true
16257 $comm -13 ccsym.true ccsym.list >ccsym.own
16258 $comm -12 ccsym.true ccsym.list >ccsym.com
16259 $comm -23 ccsym.true ccsym.list >ccsym.cpp
16260 also=''
16261 if $test -z ccsym.raw; then
16262         echo "Your C compiler doesn't seem to define any symbols!" >&4
16263         echo " "
16264         echo "However, your C preprocessor defines the following symbols:"
16265         $cat Cppsym.true
16266         ccsymbols=''
16267         cppsymbols=`$cat Cppsym.true`
16268         cppsymbols=`echo $cppsymbols`
16269         cppccsymbols="$cppsymbols"
16270 else
16271         if $test -s ccsym.com; then
16272                 echo "Your C compiler and pre-processor define these symbols:"
16273                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
16274                 also='also '
16275                 symbols='ones'
16276                 cppccsymbols=`$cat ccsym.com`
16277                 cppccsymbols=`echo $cppccsymbols`
16278                 $test "$silent" || sleep 1
16279         fi
16280         if $test -s ccsym.cpp; then
16281                 $test "$also" && echo " "
16282                 echo "Your C pre-processor ${also}defines the following symbols:"
16283                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
16284                 also='further '
16285                 cppsymbols=`$cat ccsym.cpp`
16286                 cppsymbols=`echo $cppsymbols`
16287                 $test "$silent" || sleep 1
16288         fi
16289         if $test -s ccsym.own; then
16290                 $test "$also" && echo " "
16291                 echo "Your C compiler ${also}defines the following cpp symbols:"
16292                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
16293                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
16294                 ccsymbols=`$cat ccsym.own`
16295                 ccsymbols=`echo $ccsymbols`
16296                 $test "$silent" || sleep 1
16297         fi
16298 fi
16299
16300 : see if this is a termio system
16301 val="$undef"
16302 val2="$undef"
16303 val3="$undef"
16304 if $test `./findhdr termios.h`; then
16305         set tcsetattr i_termios
16306         eval $inlibc
16307         val3="$i_termios"
16308 fi
16309 echo " "
16310 case "$val3" in
16311 "$define") echo "You have POSIX termios.h... good!" >&4;;
16312 *) if ./Cppsym pyr; then
16313                 case "`/bin/universe`" in
16314                 ucb) if $test `./findhdr sgtty.h`; then
16315                                 val2="$define"
16316                                 echo "<sgtty.h> found." >&4
16317                         else
16318                                 echo "System is pyramid with BSD universe."
16319                                 echo "<sgtty.h> not found--you could have problems." >&4
16320                         fi;;
16321                 *) if $test `./findhdr termio.h`; then
16322                                 val="$define"
16323                                 echo "<termio.h> found." >&4
16324                         else
16325                                 echo "System is pyramid with USG universe."
16326                                 echo "<termio.h> not found--you could have problems." >&4
16327                         fi;;
16328                 esac
16329         elif ./usg; then
16330                 if $test `./findhdr termio.h`; then
16331                         echo "<termio.h> found." >&4
16332                         val="$define"
16333                 elif $test `./findhdr sgtty.h`; then
16334                         echo "<sgtty.h> found." >&4
16335                         val2="$define"
16336                 else
16337 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16338                 fi
16339         else
16340                 if $test `./findhdr sgtty.h`; then
16341                         echo "<sgtty.h> found." >&4
16342                         val2="$define"
16343                 elif $test `./findhdr termio.h`; then
16344                         echo "<termio.h> found." >&4
16345                         val="$define"
16346                 else
16347 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16348                 fi
16349         fi;;
16350 esac
16351 set i_termio; eval $setvar
16352 val=$val2; set i_sgtty; eval $setvar
16353 val=$val3; set i_termios; eval $setvar
16354
16355 : see if this is a shadow.h system
16356 set shadow.h i_shadow
16357 eval $inhdr
16358
16359 : see if stddef is available
16360 set stddef.h i_stddef
16361 eval $inhdr
16362
16363 : see if this is a sunmath.h system
16364 set sunmath.h i_sunmath
16365 eval $inhdr
16366
16367 : see if sys/access.h is available
16368 set sys/access.h i_sysaccess
16369 eval $inhdr
16370
16371 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16372 set sys/filio.h i_sysfilio
16373 eval $inhdr
16374 echo " "
16375 if $test `./findhdr sys/ioctl.h`; then
16376         val="$define"
16377         echo '<sys/ioctl.h> found.' >&4
16378 else
16379         val="$undef"
16380         if $test $i_sysfilio = "$define"; then
16381             echo '<sys/ioctl.h> NOT found.' >&4
16382         else
16383                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16384                 $test $i_termio = "$define" && xxx="termio.h"
16385                 $test $i_termios = "$define" && xxx="termios.h"
16386 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16387         fi
16388 fi
16389 set i_sysioctl
16390 eval $setvar
16391
16392 : see if socket ioctl defs are in sys/sockio.h
16393 echo " "
16394 xxx=`./findhdr sys/sockio.h`
16395 if $test "$xxx"; then
16396         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16397                 val="$define"
16398                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16399         else
16400                 val="$undef"
16401                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16402         fi
16403 else
16404         val="$undef"
16405         $cat <<EOM
16406 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16407 EOM
16408 fi
16409 set i_syssockio
16410 eval $setvar
16411
16412
16413 : see if this is a syslog.h system
16414 set syslog.h i_syslog
16415 eval $inhdr
16416
16417
16418 : see if this is a sys/mode.h system
16419 set sys/mode.h i_sysmode
16420 eval $inhdr
16421
16422 : see if sys/resource.h has to be included
16423 set sys/resource.h i_sysresrc
16424 eval $inhdr
16425
16426 : see if sys/security.h is available
16427 set sys/security.h i_syssecrt
16428 eval $inhdr
16429
16430 : see if this is a sys/statvfs.h system
16431 set sys/statvfs.h i_sysstatvfs
16432 eval $inhdr
16433
16434 : see if this is a sys/un.h system
16435 set sys/un.h i_sysun
16436 eval $inhdr
16437
16438
16439 : see if this is a sys/utsname.h system
16440 set sys/utsname.h i_sysutsname
16441 eval $inhdr
16442
16443 : see if this is a syswait system
16444 set sys/wait.h i_syswait
16445 eval $inhdr
16446
16447 : see if this is a ustat.h system
16448 set ustat.h i_ustat
16449 eval $inhdr
16450
16451 : see if this is an utime system
16452 set utime.h i_utime
16453 eval $inhdr
16454
16455 : see if this is a values.h system
16456 set values.h i_values
16457 eval $inhdr
16458
16459 : see if this is a vfork system
16460 case "$d_vfork" in
16461 "$define")
16462         set vfork.h i_vfork
16463         eval $inhdr
16464         ;;
16465 *)
16466         i_vfork="$undef"
16467         ;;
16468 esac
16469
16470 : see if gdbm.h is available
16471 set gdbm.h t_gdbm
16472 eval $inhdr
16473 case "$t_gdbm" in
16474 $define)
16475         : see if gdbm_open exists
16476         set gdbm_open d_gdbm_open
16477         eval $inlibc
16478         case "$d_gdbm_open" in
16479         $undef)
16480                 t_gdbm="$undef"
16481                 echo "We won't be including <gdbm.h>"
16482                 ;;
16483         esac
16484         ;;
16485 esac
16486 val="$t_gdbm"
16487 set i_gdbm
16488 eval $setvar
16489
16490 echo " "
16491 echo "Looking for extensions..." >&4
16492 : If we are using the old config.sh, known_extensions may contain
16493 : old or inaccurate or duplicate values.
16494 known_extensions=''
16495 nonxs_extensions=''
16496 : We do not use find because it might not be available.
16497 : We do not just use MANIFEST because the user may have dropped
16498 : some additional extensions into the source tree and expect them
16499 : to be built.
16500
16501 : Function to recursively find available extensions, ignoring DynaLoader
16502 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16503 find_extensions='
16504     for xxx in *; do
16505        case "$xxx" in
16506            DynaLoader|dynaload) ;;
16507            *)
16508            if $test -f $xxx/$xxx.xs; then
16509                known_extensions="$known_extensions $1$xxx";
16510            elif $test -f $xxx/Makefile.PL; then
16511                nonxs_extensions="$nonxs_extensions $1$xxx";
16512            else
16513                if $test -d $xxx -a $# -lt 10; then
16514                    set $1$xxx/ $*;
16515                    cd $xxx;
16516                    eval $find_extensions;
16517                    cd ..;
16518                    shift;
16519                fi;
16520            fi
16521            ;;
16522        esac;
16523     done'
16524 tdir=`pwd`
16525 cd $rsrc/ext
16526 set X
16527 shift
16528 eval $find_extensions
16529 # Special case:  Add in threads/shared since it is not picked up by the
16530 # recursive find above (and adding in general recursive finding breaks
16531 # SDBM_File/sdbm).  A.D.  10/25/2001.
16532 known_extensions="$known_extensions threads/shared"
16533 set X $nonxs_extensions
16534 shift
16535 nonxs_extensions="$*"
16536 set X $known_extensions
16537 shift
16538 known_extensions="$*"
16539 cd $tdir
16540
16541 : Now see which are supported on this system.
16542 avail_ext=''
16543 for xxx in $known_extensions ; do
16544         case "$xxx" in
16545         DB_File|db_file)
16546                 case "$i_db" in
16547                 $define) avail_ext="$avail_ext $xxx" ;;
16548                 esac
16549                 ;;
16550         GDBM_File|gdbm_fil)
16551                 case "$i_gdbm" in 
16552                 $define) avail_ext="$avail_ext $xxx" ;;
16553                 esac
16554                 ;;
16555         I18N/Langinfo|i18n_lan)
16556                 case "$i_langinfo$d_nl_langinfo" in 
16557                 $define$define) avail_ext="$avail_ext $xxx" ;;
16558                 esac
16559                 ;;
16560         NDBM_File|ndbm_fil)
16561                 case "$i_ndbm" in
16562                 $define)
16563                     case "$osname-$use64bitint" in
16564                     cygwin-*|hpux-define)
16565                         case "$libs" in
16566                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16567                         esac
16568                         ;;
16569                     *) avail_ext="$avail_ext $xxx" ;;
16570                     esac
16571                     ;;
16572                 esac
16573                 ;;
16574         ODBM_File|odbm_fil) 
16575                 case "${i_dbm}${i_rpcsvcdbm}" in
16576                 *"${define}"*)
16577                     case "$osname-$use64bitint" in
16578                     cygwin-*|hpux-define)
16579                         case "$libs" in
16580                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16581                         esac
16582                         ;;
16583                     *) avail_ext="$avail_ext $xxx" ;;
16584                     esac
16585                     ;;
16586                 esac
16587                 ;;
16588         POSIX|posix)
16589                 case "$useposix" in
16590                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16591                 esac
16592                 ;;
16593         Opcode|opcode)
16594                 case "$useopcode" in
16595                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16596                 esac
16597                 ;;
16598         Socket|socket)
16599                 case "$d_socket" in 
16600                 true|$define|y)
16601                     case "$osname" in
16602                     beos) ;; # not unless BONE
16603                     *) avail_ext="$avail_ext $xxx" ;;
16604                     esac
16605                     ;;
16606                 esac
16607                 ;;
16608         Sys/Syslog|sys/syslog)
16609                 : XXX syslog requires socket
16610                 case "$d_socket" in 
16611                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16612                 esac
16613                 ;;
16614         Thread|thread)
16615                 case "$usethreads" in
16616                 true|$define|y)
16617                         case "$useithreads" in
16618                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16619                         esac
16620                 esac
16621                 ;;
16622         threads|threads/shared)
16623                 case "$usethreads" in
16624                 true|$define|y)
16625                         case "$useithreads" in
16626                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
16627                         esac
16628                 esac
16629                 ;;
16630         IPC/SysV|ipc/sysv)
16631                 : XXX Do we need a useipcsysv variable here
16632                 case "${d_msg}${d_sem}${d_shm}" in 
16633                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16634                 esac
16635                 ;;
16636         *)      avail_ext="$avail_ext $xxx"
16637                 ;;
16638         esac
16639 done
16640
16641 set X $avail_ext
16642 shift
16643 avail_ext="$*"
16644
16645 : Now see which nonxs extensions are supported on this system.
16646 : For now assume all are.
16647 nonxs_ext=''
16648 for xxx in $nonxs_extensions ; do
16649         case "$xxx" in
16650         *)      nonxs_ext="$nonxs_ext $xxx"
16651                 ;;
16652         esac
16653 done
16654
16655 set X $nonxs_ext
16656 shift
16657 nonxs_ext="$*"
16658
16659 case $usedl in
16660 $define)
16661         $cat <<EOM
16662 A number of extensions are supplied with $package.  You may choose to
16663 compile these extensions for dynamic loading (the default), compile
16664 them into the $package executable (static loading), or not include
16665 them at all.  Answer "none" to include no extensions.
16666 Note that DynaLoader is always built and need not be mentioned here.
16667
16668 EOM
16669         case "$dynamic_ext" in
16670         '') dflt="$avail_ext" ;;
16671         *)      dflt="$dynamic_ext"
16672                 # Perhaps we are reusing an old out-of-date config.sh.
16673                 case "$hint" in
16674                 previous)
16675                         if test X"$dynamic_ext" != X"$avail_ext"; then
16676                                 $cat <<EOM
16677 NOTICE:  Your previous config.sh list may be incorrect. 
16678 The extensions now available to you are 
16679         ${avail_ext}
16680 but the default list from your previous config.sh is
16681         ${dynamic_ext} 
16682
16683 EOM
16684                         fi
16685                         ;;
16686                 esac
16687                 ;;
16688         esac
16689         case "$dflt" in
16690         '')     dflt=none;;
16691         esac
16692         rp="What extensions do you wish to load dynamically?"
16693         . ./myread
16694         case "$ans" in
16695         none) dynamic_ext=' ' ;;
16696         *) dynamic_ext="$ans" ;;
16697         esac
16698
16699         case "$static_ext" in
16700         '')
16701                 : Exclude those already listed in dynamic linking
16702                 dflt=''
16703                 for xxx in $avail_ext; do
16704                         case " $dynamic_ext " in
16705                         *" $xxx "*) ;;
16706                         *) dflt="$dflt $xxx" ;;
16707                         esac
16708                 done
16709                 set X $dflt
16710                 shift
16711                 dflt="$*"
16712                 ;;
16713         *)  dflt="$static_ext" 
16714                 ;;
16715         esac
16716
16717         case "$dflt" in
16718         '')     dflt=none;;
16719         esac
16720         rp="What extensions do you wish to load statically?"
16721         . ./myread
16722         case "$ans" in
16723         none) static_ext=' ' ;;
16724         *) static_ext="$ans" ;;
16725         esac
16726         ;;
16727 *)
16728         $cat <<EOM
16729 A number of extensions are supplied with $package.  Answer "none" 
16730 to include no extensions. 
16731 Note that DynaLoader is always built and need not be mentioned here.
16732
16733 EOM
16734         case "$static_ext" in
16735         '') dflt="$avail_ext" ;;
16736         *)      dflt="$static_ext"
16737                 # Perhaps we are reusing an old out-of-date config.sh.
16738                 case "$hint" in
16739                 previous)
16740                         if test X"$static_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         ${static_ext} 
16747
16748 EOM
16749                         fi
16750                         ;;
16751                 esac
16752                 ;;
16753         esac
16754         : Exclude those that are not xs extensions
16755         case "$dflt" in
16756         '')     dflt=none;;
16757         esac
16758         rp="What extensions do you wish to include?"
16759         . ./myread
16760         case "$ans" in
16761         none) static_ext=' ' ;;
16762         *) static_ext="$ans" ;;
16763         esac
16764         ;;
16765 esac
16766
16767 set X $dynamic_ext $static_ext $nonxs_ext
16768 shift
16769 extensions="$*"
16770
16771 : Remove libraries needed only for extensions
16772 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16773 : The exception is SunOS 4.x, which needs them.
16774 case "${osname}X${osvers}" in
16775 sunos*X4*)
16776     perllibs="$libs"
16777     ;;
16778 *) case "$usedl" in
16779     $define|true|[yY]*)
16780             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16781             shift
16782             perllibs="$*"
16783             ;;
16784     *)  perllibs="$libs"
16785             ;;
16786     esac
16787     ;;
16788 esac
16789
16790 : Remove build directory name from cppstdin so it can be used from
16791 : either the present location or the final installed location.
16792 echo " "
16793 : Get out of the UU directory to get correct path name.
16794 cd ..
16795 case "$cppstdin" in
16796 `pwd`/cppstdin)
16797         echo "Stripping down cppstdin path name"
16798         cppstdin=cppstdin
16799         ;;
16800 esac
16801 cd UU
16802
16803 : end of configuration questions
16804 echo " "
16805 echo "End of configuration questions."
16806 echo " "
16807
16808 : back to where it started
16809 if test -d ../UU; then
16810         cd ..
16811 fi
16812
16813 : configuration may be patched via a 'config.arch' file
16814 if $test -f config.arch; then
16815         echo "I see a config.arch file, loading it."
16816         . ./config.arch
16817 fi
16818
16819 : configuration may be patched via a 'config.over' file
16820 if $test -f config.over; then
16821         echo " "
16822         dflt=y
16823         rp='I see a config.over file.  Do you wish to load it?'
16824         . UU/myread
16825         case "$ans" in
16826         n*) echo "OK, I'll ignore it.";;
16827         *)      . ./config.over
16828                 echo "Configuration override changes have been loaded."
16829                 ;;
16830         esac
16831 fi
16832
16833 : in case they want portability, strip down executable paths
16834 case "$d_portable" in
16835 "$define")
16836         echo " "
16837         echo "Stripping down executable paths..." >&4
16838         for file in $loclist $trylist; do
16839                 eval temp=\$$file
16840                 eval $file=`basename $temp`
16841         done
16842         ;;
16843 esac
16844
16845 : create config.sh file
16846 echo " "
16847 echo "Creating config.sh..." >&4
16848 $spitshell <<EOT >config.sh
16849 $startsh
16850 #
16851 # This file was produced by running the Configure script. It holds all the
16852 # definitions figured out by Configure. Should you modify one of these values,
16853 # do not forget to propagate your changes by running "Configure -der". You may
16854 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16855 #
16856
16857 # Package name      : $package
16858 # Source directory  : $src
16859 # Configuration time: $cf_time
16860 # Configured by     : $cf_by
16861 # Target system     : $myuname
16862
16863 Author='$Author'
16864 Date='$Date'
16865 Header='$Header'
16866 Id='$Id'
16867 Locker='$Locker'
16868 Log='$Log'
16869 Mcc='$Mcc'
16870 RCSfile='$RCSfile'
16871 Revision='$Revision'
16872 Source='$Source'
16873 State='$State'
16874 _a='$_a'
16875 _exe='$_exe'
16876 _o='$_o'
16877 afs='$afs'
16878 afsroot='$afsroot'
16879 alignbytes='$alignbytes'
16880 ansi2knr='$ansi2knr'
16881 aphostname='$aphostname'
16882 api_revision='$api_revision'
16883 api_subversion='$api_subversion'
16884 api_version='$api_version'
16885 api_versionstring='$api_versionstring'
16886 ar='$ar'
16887 archlib='$archlib'
16888 archlibexp='$archlibexp'
16889 archname64='$archname64'
16890 archname='$archname'
16891 archobjs='$archobjs'
16892 awk='$awk'
16893 baserev='$baserev'
16894 bash='$bash'
16895 bin='$bin'
16896 bincompat5005='$bincompat5005'
16897 binexp='$binexp'
16898 bison='$bison'
16899 byacc='$byacc'
16900 byteorder='$byteorder'
16901 c='$c'
16902 castflags='$castflags'
16903 cat='$cat'
16904 cc='$cc'
16905 cccdlflags='$cccdlflags'
16906 ccdlflags='$ccdlflags'
16907 ccflags='$ccflags'
16908 ccflags_uselargefiles='$ccflags_uselargefiles'
16909 ccname='$ccname'
16910 ccsymbols='$ccsymbols'
16911 ccversion='$ccversion'
16912 cf_by='$cf_by'
16913 cf_email='$cf_email'
16914 cf_time='$cf_time'
16915 charsize='$charsize'
16916 chgrp='$chgrp'
16917 chmod='$chmod'
16918 chown='$chown'
16919 clocktype='$clocktype'
16920 comm='$comm'
16921 compress='$compress'
16922 contains='$contains'
16923 cp='$cp'
16924 cpio='$cpio'
16925 cpp='$cpp'
16926 cpp_stuff='$cpp_stuff'
16927 cppccsymbols='$cppccsymbols'
16928 cppflags='$cppflags'
16929 cpplast='$cpplast'
16930 cppminus='$cppminus'
16931 cpprun='$cpprun'
16932 cppstdin='$cppstdin'
16933 cppsymbols='$cppsymbols'
16934 cryptlib='$cryptlib'
16935 csh='$csh'
16936 d_Gconvert='$d_Gconvert'
16937 d_PRIEUldbl='$d_PRIEUldbl'
16938 d_PRIFUldbl='$d_PRIFUldbl'
16939 d_PRIGUldbl='$d_PRIGUldbl'
16940 d_PRIXU64='$d_PRIXU64'
16941 d_PRId64='$d_PRId64'
16942 d_PRIeldbl='$d_PRIeldbl'
16943 d_PRIfldbl='$d_PRIfldbl'
16944 d_PRIgldbl='$d_PRIgldbl'
16945 d_PRIi64='$d_PRIi64'
16946 d_PRIo64='$d_PRIo64'
16947 d_PRIu64='$d_PRIu64'
16948 d_PRIx64='$d_PRIx64'
16949 d_SCNfldbl='$d_SCNfldbl'
16950 d__fwalk='$d__fwalk'
16951 d_access='$d_access'
16952 d_accessx='$d_accessx'
16953 d_alarm='$d_alarm'
16954 d_archlib='$d_archlib'
16955 d_atolf='$d_atolf'
16956 d_atoll='$d_atoll'
16957 d_attribut='$d_attribut'
16958 d_bcmp='$d_bcmp'
16959 d_bcopy='$d_bcopy'
16960 d_bincompat5005='$d_bincompat5005'
16961 d_bsd='$d_bsd'
16962 d_bsdgetpgrp='$d_bsdgetpgrp'
16963 d_bsdsetpgrp='$d_bsdsetpgrp'
16964 d_bzero='$d_bzero'
16965 d_casti32='$d_casti32'
16966 d_castneg='$d_castneg'
16967 d_charvspr='$d_charvspr'
16968 d_chown='$d_chown'
16969 d_chroot='$d_chroot'
16970 d_chsize='$d_chsize'
16971 d_class='$d_class'
16972 d_closedir='$d_closedir'
16973 d_cmsghdr_s='$d_cmsghdr_s'
16974 d_const='$d_const'
16975 d_crypt='$d_crypt'
16976 d_csh='$d_csh'
16977 d_cuserid='$d_cuserid'
16978 d_dbl_dig='$d_dbl_dig'
16979 d_dbminitproto='$d_dbminitproto'
16980 d_difftime='$d_difftime'
16981 d_dirfd='$d_dirfd'
16982 d_dirnamlen='$d_dirnamlen'
16983 d_dlerror='$d_dlerror'
16984 d_dlopen='$d_dlopen'
16985 d_dlsymun='$d_dlsymun'
16986 d_dosuid='$d_dosuid'
16987 d_drand48proto='$d_drand48proto'
16988 d_dup2='$d_dup2'
16989 d_eaccess='$d_eaccess'
16990 d_endgrent='$d_endgrent'
16991 d_endhent='$d_endhent'
16992 d_endnent='$d_endnent'
16993 d_endpent='$d_endpent'
16994 d_endpwent='$d_endpwent'
16995 d_endsent='$d_endsent'
16996 d_eofnblk='$d_eofnblk'
16997 d_eunice='$d_eunice'
16998 d_fchdir='$d_fchdir'
16999 d_fchmod='$d_fchmod'
17000 d_fchown='$d_fchown'
17001 d_fcntl='$d_fcntl'
17002 d_fcntl_can_lock='$d_fcntl_can_lock'
17003 d_fd_macros='$d_fd_macros'
17004 d_fd_set='$d_fd_set'
17005 d_fds_bits='$d_fds_bits'
17006 d_fgetpos='$d_fgetpos'
17007 d_finite='$d_finite'
17008 d_finitel='$d_finitel'
17009 d_flexfnam='$d_flexfnam'
17010 d_flock='$d_flock'
17011 d_flockproto='$d_flockproto'
17012 d_fork='$d_fork'
17013 d_fp_class='$d_fp_class'
17014 d_fpathconf='$d_fpathconf'
17015 d_fpclass='$d_fpclass'
17016 d_fpclassify='$d_fpclassify'
17017 d_fpclassl='$d_fpclassl'
17018 d_fpos64_t='$d_fpos64_t'
17019 d_frexpl='$d_frexpl'
17020 d_fs_data_s='$d_fs_data_s'
17021 d_fseeko='$d_fseeko'
17022 d_fsetpos='$d_fsetpos'
17023 d_fstatfs='$d_fstatfs'
17024 d_fstatvfs='$d_fstatvfs'
17025 d_fsync='$d_fsync'
17026 d_ftello='$d_ftello'
17027 d_ftime='$d_ftime'
17028 d_getcwd='$d_getcwd'
17029 d_getespwnam='$d_getespwnam'
17030 d_getfsstat='$d_getfsstat'
17031 d_getgrent='$d_getgrent'
17032 d_getgrps='$d_getgrps'
17033 d_gethbyaddr='$d_gethbyaddr'
17034 d_gethbyname='$d_gethbyname'
17035 d_gethent='$d_gethent'
17036 d_gethname='$d_gethname'
17037 d_gethostprotos='$d_gethostprotos'
17038 d_getitimer='$d_getitimer'
17039 d_getlogin='$d_getlogin'
17040 d_getmnt='$d_getmnt'
17041 d_getmntent='$d_getmntent'
17042 d_getnbyaddr='$d_getnbyaddr'
17043 d_getnbyname='$d_getnbyname'
17044 d_getnent='$d_getnent'
17045 d_getnetprotos='$d_getnetprotos'
17046 d_getpagsz='$d_getpagsz'
17047 d_getpbyname='$d_getpbyname'
17048 d_getpbynumber='$d_getpbynumber'
17049 d_getpent='$d_getpent'
17050 d_getpgid='$d_getpgid'
17051 d_getpgrp2='$d_getpgrp2'
17052 d_getpgrp='$d_getpgrp'
17053 d_getppid='$d_getppid'
17054 d_getprior='$d_getprior'
17055 d_getprotoprotos='$d_getprotoprotos'
17056 d_getprpwnam='$d_getprpwnam'
17057 d_getpwent='$d_getpwent'
17058 d_getsbyname='$d_getsbyname'
17059 d_getsbyport='$d_getsbyport'
17060 d_getsent='$d_getsent'
17061 d_getservprotos='$d_getservprotos'
17062 d_getspnam='$d_getspnam'
17063 d_gettimeod='$d_gettimeod'
17064 d_gnulibc='$d_gnulibc'
17065 d_grpasswd='$d_grpasswd'
17066 d_hasmntopt='$d_hasmntopt'
17067 d_htonl='$d_htonl'
17068 d_index='$d_index'
17069 d_inetaton='$d_inetaton'
17070 d_int64_t='$d_int64_t'
17071 d_isascii='$d_isascii'
17072 d_isfinite='$d_isfinite'
17073 d_isinf='$d_isinf'
17074 d_isnan='$d_isnan'
17075 d_isnanl='$d_isnanl'
17076 d_killpg='$d_killpg'
17077 d_lchown='$d_lchown'
17078 d_ldbl_dig='$d_ldbl_dig'
17079 d_link='$d_link'
17080 d_locconv='$d_locconv'
17081 d_lockf='$d_lockf'
17082 d_longdbl='$d_longdbl'
17083 d_longlong='$d_longlong'
17084 d_lseekproto='$d_lseekproto'
17085 d_lstat='$d_lstat'
17086 d_madvise='$d_madvise'
17087 d_mblen='$d_mblen'
17088 d_mbstowcs='$d_mbstowcs'
17089 d_mbtowc='$d_mbtowc'
17090 d_memchr='$d_memchr'
17091 d_memcmp='$d_memcmp'
17092 d_memcpy='$d_memcpy'
17093 d_memmove='$d_memmove'
17094 d_memset='$d_memset'
17095 d_mkdir='$d_mkdir'
17096 d_mkdtemp='$d_mkdtemp'
17097 d_mkfifo='$d_mkfifo'
17098 d_mkstemp='$d_mkstemp'
17099 d_mkstemps='$d_mkstemps'
17100 d_mktime='$d_mktime'
17101 d_mmap='$d_mmap'
17102 d_modfl='$d_modfl'
17103 d_modfl_pow32_bug='$d_modfl_pow32_bug'
17104 d_mprotect='$d_mprotect'
17105 d_msg='$d_msg'
17106 d_msg_ctrunc='$d_msg_ctrunc'
17107 d_msg_dontroute='$d_msg_dontroute'
17108 d_msg_oob='$d_msg_oob'
17109 d_msg_peek='$d_msg_peek'
17110 d_msg_proxy='$d_msg_proxy'
17111 d_msgctl='$d_msgctl'
17112 d_msgget='$d_msgget'
17113 d_msghdr_s='$d_msghdr_s'
17114 d_msgrcv='$d_msgrcv'
17115 d_msgsnd='$d_msgsnd'
17116 d_msync='$d_msync'
17117 d_munmap='$d_munmap'
17118 d_mymalloc='$d_mymalloc'
17119 d_nice='$d_nice'
17120 d_nl_langinfo='$d_nl_langinfo'
17121 d_nv_preserves_uv='$d_nv_preserves_uv'
17122 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
17123 d_off64_t='$d_off64_t'
17124 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
17125 d_oldpthreads='$d_oldpthreads'
17126 d_oldsock='$d_oldsock'
17127 d_open3='$d_open3'
17128 d_pathconf='$d_pathconf'
17129 d_pause='$d_pause'
17130 d_perl_otherlibdirs='$d_perl_otherlibdirs'
17131 d_phostname='$d_phostname'
17132 d_pipe='$d_pipe'
17133 d_poll='$d_poll'
17134 d_portable='$d_portable'
17135 d_procselfexe='$d_procselfexe'
17136 d_pthread_atfork='$d_pthread_atfork'
17137 d_pthread_yield='$d_pthread_yield'
17138 d_pwage='$d_pwage'
17139 d_pwchange='$d_pwchange'
17140 d_pwclass='$d_pwclass'
17141 d_pwcomment='$d_pwcomment'
17142 d_pwexpire='$d_pwexpire'
17143 d_pwgecos='$d_pwgecos'
17144 d_pwpasswd='$d_pwpasswd'
17145 d_pwquota='$d_pwquota'
17146 d_qgcvt='$d_qgcvt'
17147 d_quad='$d_quad'
17148 d_readdir='$d_readdir'
17149 d_readlink='$d_readlink'
17150 d_readv='$d_readv'
17151 d_recvmsg='$d_recvmsg'
17152 d_rename='$d_rename'
17153 d_rewinddir='$d_rewinddir'
17154 d_rmdir='$d_rmdir'
17155 d_safebcpy='$d_safebcpy'
17156 d_safemcpy='$d_safemcpy'
17157 d_sanemcmp='$d_sanemcmp'
17158 d_sbrkproto='$d_sbrkproto'
17159 d_sched_yield='$d_sched_yield'
17160 d_scm_rights='$d_scm_rights'
17161 d_seekdir='$d_seekdir'
17162 d_select='$d_select'
17163 d_sem='$d_sem'
17164 d_semctl='$d_semctl'
17165 d_semctl_semid_ds='$d_semctl_semid_ds'
17166 d_semctl_semun='$d_semctl_semun'
17167 d_semget='$d_semget'
17168 d_semop='$d_semop'
17169 d_sendmsg='$d_sendmsg'
17170 d_setegid='$d_setegid'
17171 d_seteuid='$d_seteuid'
17172 d_setgrent='$d_setgrent'
17173 d_setgrps='$d_setgrps'
17174 d_sethent='$d_sethent'
17175 d_setitimer='$d_setitimer'
17176 d_setlinebuf='$d_setlinebuf'
17177 d_setlocale='$d_setlocale'
17178 d_setnent='$d_setnent'
17179 d_setpent='$d_setpent'
17180 d_setpgid='$d_setpgid'
17181 d_setpgrp2='$d_setpgrp2'
17182 d_setpgrp='$d_setpgrp'
17183 d_setprior='$d_setprior'
17184 d_setproctitle='$d_setproctitle'
17185 d_setpwent='$d_setpwent'
17186 d_setregid='$d_setregid'
17187 d_setresgid='$d_setresgid'
17188 d_setresuid='$d_setresuid'
17189 d_setreuid='$d_setreuid'
17190 d_setrgid='$d_setrgid'
17191 d_setruid='$d_setruid'
17192 d_setsent='$d_setsent'
17193 d_setsid='$d_setsid'
17194 d_setvbuf='$d_setvbuf'
17195 d_sfio='$d_sfio'
17196 d_shm='$d_shm'
17197 d_shmat='$d_shmat'
17198 d_shmatprototype='$d_shmatprototype'
17199 d_shmctl='$d_shmctl'
17200 d_shmdt='$d_shmdt'
17201 d_shmget='$d_shmget'
17202 d_sigaction='$d_sigaction'
17203 d_sigprocmask='$d_sigprocmask'
17204 d_sigsetjmp='$d_sigsetjmp'
17205 d_sockatmark='$d_sockatmark'
17206 d_sockatmarkproto='$d_sockatmarkproto'
17207 d_socket='$d_socket'
17208 d_socklen_t='$d_socklen_t'
17209 d_sockpair='$d_sockpair'
17210 d_socks5_init='$d_socks5_init'
17211 d_sqrtl='$d_sqrtl'
17212 d_sresgproto='$d_sresgproto'
17213 d_sresuproto='$d_sresuproto'
17214 d_statblks='$d_statblks'
17215 d_statfs_f_flags='$d_statfs_f_flags'
17216 d_statfs_s='$d_statfs_s'
17217 d_statvfs='$d_statvfs'
17218 d_stdio_cnt_lval='$d_stdio_cnt_lval'
17219 d_stdio_ptr_lval='$d_stdio_ptr_lval'
17220 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
17221 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
17222 d_stdio_stream_array='$d_stdio_stream_array'
17223 d_stdiobase='$d_stdiobase'
17224 d_stdstdio='$d_stdstdio'
17225 d_strchr='$d_strchr'
17226 d_strcoll='$d_strcoll'
17227 d_strctcpy='$d_strctcpy'
17228 d_strerrm='$d_strerrm'
17229 d_strerror='$d_strerror'
17230 d_strftime='$d_strftime'
17231 d_strtod='$d_strtod'
17232 d_strtol='$d_strtol'
17233 d_strtold='$d_strtold'
17234 d_strtoll='$d_strtoll'
17235 d_strtoq='$d_strtoq'
17236 d_strtoul='$d_strtoul'
17237 d_strtoull='$d_strtoull'
17238 d_strtouq='$d_strtouq'
17239 d_strxfrm='$d_strxfrm'
17240 d_suidsafe='$d_suidsafe'
17241 d_symlink='$d_symlink'
17242 d_syscall='$d_syscall'
17243 d_syscallproto='$d_syscallproto'
17244 d_sysconf='$d_sysconf'
17245 d_sysernlst='$d_sysernlst'
17246 d_syserrlst='$d_syserrlst'
17247 d_system='$d_system'
17248 d_tcgetpgrp='$d_tcgetpgrp'
17249 d_tcsetpgrp='$d_tcsetpgrp'
17250 d_telldir='$d_telldir'
17251 d_telldirproto='$d_telldirproto'
17252 d_time='$d_time'
17253 d_times='$d_times'
17254 d_truncate='$d_truncate'
17255 d_tzname='$d_tzname'
17256 d_u32align='$d_u32align'
17257 d_ualarm='$d_ualarm'
17258 d_umask='$d_umask'
17259 d_uname='$d_uname'
17260 d_union_semun='$d_union_semun'
17261 d_unordered='$d_unordered'
17262 d_usleep='$d_usleep'
17263 d_usleepproto='$d_usleepproto'
17264 d_ustat='$d_ustat'
17265 d_vendorarch='$d_vendorarch'
17266 d_vendorbin='$d_vendorbin'
17267 d_vendorlib='$d_vendorlib'
17268 d_vfork='$d_vfork'
17269 d_void_closedir='$d_void_closedir'
17270 d_voidsig='$d_voidsig'
17271 d_voidtty='$d_voidtty'
17272 d_volatile='$d_volatile'
17273 d_vprintf='$d_vprintf'
17274 d_wait4='$d_wait4'
17275 d_waitpid='$d_waitpid'
17276 d_wcstombs='$d_wcstombs'
17277 d_wctomb='$d_wctomb'
17278 d_writev='$d_writev'
17279 d_xenix='$d_xenix'
17280 date='$date'
17281 db_hashtype='$db_hashtype'
17282 db_prefixtype='$db_prefixtype'
17283 db_version_major='$db_version_major'
17284 db_version_minor='$db_version_minor'
17285 db_version_patch='$db_version_patch'
17286 defvoidused='$defvoidused'
17287 direntrytype='$direntrytype'
17288 dlext='$dlext'
17289 dlsrc='$dlsrc'
17290 doublesize='$doublesize'
17291 drand01='$drand01'
17292 dynamic_ext='$dynamic_ext'
17293 eagain='$eagain'
17294 ebcdic='$ebcdic'
17295 echo='$echo'
17296 egrep='$egrep'
17297 emacs='$emacs'
17298 eunicefix='$eunicefix'
17299 exe_ext='$exe_ext'
17300 expr='$expr'
17301 extensions='$extensions'
17302 extras='$extras'
17303 fflushNULL='$fflushNULL'
17304 fflushall='$fflushall'
17305 find='$find'
17306 firstmakefile='$firstmakefile'
17307 flex='$flex'
17308 fpossize='$fpossize'
17309 fpostype='$fpostype'
17310 freetype='$freetype'
17311 from='$from'
17312 full_ar='$full_ar'
17313 full_csh='$full_csh'
17314 full_sed='$full_sed'
17315 gccosandvers='$gccosandvers'
17316 gccversion='$gccversion'
17317 gidformat='$gidformat'
17318 gidsign='$gidsign'
17319 gidsize='$gidsize'
17320 gidtype='$gidtype'
17321 glibpth='$glibpth'
17322 gmake='$gmake'
17323 grep='$grep'
17324 groupcat='$groupcat'
17325 groupstype='$groupstype'
17326 gzip='$gzip'
17327 h_fcntl='$h_fcntl'
17328 h_sysfile='$h_sysfile'
17329 hint='$hint'
17330 hostcat='$hostcat'
17331 i16size='$i16size'
17332 i16type='$i16type'
17333 i32size='$i32size'
17334 i32type='$i32type'
17335 i64size='$i64size'
17336 i64type='$i64type'
17337 i8size='$i8size'
17338 i8type='$i8type'
17339 i_arpainet='$i_arpainet'
17340 i_bsdioctl='$i_bsdioctl'
17341 i_db='$i_db'
17342 i_dbm='$i_dbm'
17343 i_dirent='$i_dirent'
17344 i_dld='$i_dld'
17345 i_dlfcn='$i_dlfcn'
17346 i_fcntl='$i_fcntl'
17347 i_float='$i_float'
17348 i_fp='$i_fp'
17349 i_fp_class='$i_fp_class'
17350 i_gdbm='$i_gdbm'
17351 i_grp='$i_grp'
17352 i_ieeefp='$i_ieeefp'
17353 i_inttypes='$i_inttypes'
17354 i_langinfo='$i_langinfo'
17355 i_libutil='$i_libutil'
17356 i_limits='$i_limits'
17357 i_locale='$i_locale'
17358 i_machcthr='$i_machcthr'
17359 i_malloc='$i_malloc'
17360 i_math='$i_math'
17361 i_memory='$i_memory'
17362 i_mntent='$i_mntent'
17363 i_ndbm='$i_ndbm'
17364 i_netdb='$i_netdb'
17365 i_neterrno='$i_neterrno'
17366 i_netinettcp='$i_netinettcp'
17367 i_niin='$i_niin'
17368 i_poll='$i_poll'
17369 i_prot='$i_prot'
17370 i_pthread='$i_pthread'
17371 i_pwd='$i_pwd'
17372 i_rpcsvcdbm='$i_rpcsvcdbm'
17373 i_sfio='$i_sfio'
17374 i_sgtty='$i_sgtty'
17375 i_shadow='$i_shadow'
17376 i_socks='$i_socks'
17377 i_stdarg='$i_stdarg'
17378 i_stddef='$i_stddef'
17379 i_stdlib='$i_stdlib'
17380 i_string='$i_string'
17381 i_sunmath='$i_sunmath'
17382 i_sysaccess='$i_sysaccess'
17383 i_sysdir='$i_sysdir'
17384 i_sysfile='$i_sysfile'
17385 i_sysfilio='$i_sysfilio'
17386 i_sysin='$i_sysin'
17387 i_sysioctl='$i_sysioctl'
17388 i_syslog='$i_syslog'
17389 i_sysmman='$i_sysmman'
17390 i_sysmode='$i_sysmode'
17391 i_sysmount='$i_sysmount'
17392 i_sysndir='$i_sysndir'
17393 i_sysparam='$i_sysparam'
17394 i_sysresrc='$i_sysresrc'
17395 i_syssecrt='$i_syssecrt'
17396 i_sysselct='$i_sysselct'
17397 i_syssockio='$i_syssockio'
17398 i_sysstat='$i_sysstat'
17399 i_sysstatfs='$i_sysstatfs'
17400 i_sysstatvfs='$i_sysstatvfs'
17401 i_systime='$i_systime'
17402 i_systimek='$i_systimek'
17403 i_systimes='$i_systimes'
17404 i_systypes='$i_systypes'
17405 i_sysuio='$i_sysuio'
17406 i_sysun='$i_sysun'
17407 i_sysutsname='$i_sysutsname'
17408 i_sysvfs='$i_sysvfs'
17409 i_syswait='$i_syswait'
17410 i_termio='$i_termio'
17411 i_termios='$i_termios'
17412 i_time='$i_time'
17413 i_unistd='$i_unistd'
17414 i_ustat='$i_ustat'
17415 i_utime='$i_utime'
17416 i_values='$i_values'
17417 i_varargs='$i_varargs'
17418 i_varhdr='$i_varhdr'
17419 i_vfork='$i_vfork'
17420 ignore_versioned_solibs='$ignore_versioned_solibs'
17421 inc_version_list='$inc_version_list'
17422 inc_version_list_init='$inc_version_list_init'
17423 incpath='$incpath'
17424 inews='$inews'
17425 installarchlib='$installarchlib'
17426 installbin='$installbin'
17427 installman1dir='$installman1dir'
17428 installman3dir='$installman3dir'
17429 installprefix='$installprefix'
17430 installprefixexp='$installprefixexp'
17431 installprivlib='$installprivlib'
17432 installscript='$installscript'
17433 installsitearch='$installsitearch'
17434 installsitebin='$installsitebin'
17435 installsitelib='$installsitelib'
17436 installstyle='$installstyle'
17437 installusrbinperl='$installusrbinperl'
17438 installvendorarch='$installvendorarch'
17439 installvendorbin='$installvendorbin'
17440 installvendorlib='$installvendorlib'
17441 intsize='$intsize'
17442 issymlink='$issymlink'
17443 ivdformat='$ivdformat'
17444 ivsize='$ivsize'
17445 ivtype='$ivtype'
17446 known_extensions='$known_extensions'
17447 ksh='$ksh'
17448 ld='$ld'
17449 lddlflags='$lddlflags'
17450 ldflags='$ldflags'
17451 ldflags_uselargefiles='$ldflags_uselargefiles'
17452 ldlibpthname='$ldlibpthname'
17453 less='$less'
17454 lib_ext='$lib_ext'
17455 libc='$libc'
17456 libperl='$libperl'
17457 libpth='$libpth'
17458 libs='$libs'
17459 libsdirs='$libsdirs'
17460 libsfiles='$libsfiles'
17461 libsfound='$libsfound'
17462 libspath='$libspath'
17463 libswanted='$libswanted'
17464 libswanted_uselargefiles='$libswanted_uselargefiles'
17465 line='$line'
17466 lint='$lint'
17467 lkflags='$lkflags'
17468 ln='$ln'
17469 lns='$lns'
17470 locincpth='$locincpth'
17471 loclibpth='$loclibpth'
17472 longdblsize='$longdblsize'
17473 longlongsize='$longlongsize'
17474 longsize='$longsize'
17475 lp='$lp'
17476 lpr='$lpr'
17477 ls='$ls'
17478 lseeksize='$lseeksize'
17479 lseektype='$lseektype'
17480 mail='$mail'
17481 mailx='$mailx'
17482 make='$make'
17483 make_set_make='$make_set_make'
17484 mallocobj='$mallocobj'
17485 mallocsrc='$mallocsrc'
17486 malloctype='$malloctype'
17487 man1dir='$man1dir'
17488 man1direxp='$man1direxp'
17489 man1ext='$man1ext'
17490 man3dir='$man3dir'
17491 man3direxp='$man3direxp'
17492 man3ext='$man3ext'
17493 mips_type='$mips_type'
17494 mkdir='$mkdir'
17495 mmaptype='$mmaptype'
17496 modetype='$modetype'
17497 more='$more'
17498 multiarch='$multiarch'
17499 mv='$mv'
17500 myarchname='$myarchname'
17501 mydomain='$mydomain'
17502 myhostname='$myhostname'
17503 myuname='$myuname'
17504 n='$n'
17505 need_va_copy='$need_va_copy'
17506 netdb_hlen_type='$netdb_hlen_type'
17507 netdb_host_type='$netdb_host_type'
17508 netdb_name_type='$netdb_name_type'
17509 netdb_net_type='$netdb_net_type'
17510 nm='$nm'
17511 nm_opt='$nm_opt'
17512 nm_so_opt='$nm_so_opt'
17513 nonxs_ext='$nonxs_ext'
17514 nroff='$nroff'
17515 nvEUformat='$nvEUformat'
17516 nvFUformat='$nvFUformat'
17517 nvGUformat='$nvGUformat'
17518 nveformat='$nveformat'
17519 nvfformat='$nvfformat'
17520 nvgformat='$nvgformat'
17521 nvsize='$nvsize'
17522 nvtype='$nvtype'
17523 o_nonblock='$o_nonblock'
17524 obj_ext='$obj_ext'
17525 old_pthread_create_joinable='$old_pthread_create_joinable'
17526 optimize='$optimize'
17527 orderlib='$orderlib'
17528 osname='$osname'
17529 osvers='$osvers'
17530 otherlibdirs='$otherlibdirs'
17531 package='$package'
17532 pager='$pager'
17533 passcat='$passcat'
17534 patchlevel='$patchlevel'
17535 path_sep='$path_sep'
17536 perl5='$perl5'
17537 perl='$perl'
17538 perl_patchlevel='$perl_patchlevel'
17539 perladmin='$perladmin'
17540 perllibs='$perllibs'
17541 perlpath='$perlpath'
17542 pg='$pg'
17543 phostname='$phostname'
17544 pidtype='$pidtype'
17545 plibpth='$plibpth'
17546 pm_apiversion='$pm_apiversion'
17547 pmake='$pmake'
17548 pr='$pr'
17549 prefix='$prefix'
17550 prefixexp='$prefixexp'
17551 privlib='$privlib'
17552 privlibexp='$privlibexp'
17553 procselfexe='$procselfexe'
17554 prototype='$prototype'
17555 ptrsize='$ptrsize'
17556 quadkind='$quadkind'
17557 quadtype='$quadtype'
17558 randbits='$randbits'
17559 randfunc='$randfunc'
17560 randseedtype='$randseedtype'
17561 ranlib='$ranlib'
17562 rd_nodata='$rd_nodata'
17563 revision='$revision'
17564 rm='$rm'
17565 rmail='$rmail'
17566 run='$run'
17567 runnm='$runnm'
17568 sPRIEUldbl='$sPRIEUldbl'
17569 sPRIFUldbl='$sPRIFUldbl'
17570 sPRIGUldbl='$sPRIGUldbl'
17571 sPRIXU64='$sPRIXU64'
17572 sPRId64='$sPRId64'
17573 sPRIeldbl='$sPRIeldbl'
17574 sPRIfldbl='$sPRIfldbl'
17575 sPRIgldbl='$sPRIgldbl'
17576 sPRIi64='$sPRIi64'
17577 sPRIo64='$sPRIo64'
17578 sPRIu64='$sPRIu64'
17579 sPRIx64='$sPRIx64'
17580 sSCNfldbl='$sSCNfldbl'
17581 sched_yield='$sched_yield'
17582 scriptdir='$scriptdir'
17583 scriptdirexp='$scriptdirexp'
17584 sed='$sed'
17585 seedfunc='$seedfunc'
17586 selectminbits='$selectminbits'
17587 selecttype='$selecttype'
17588 sendmail='$sendmail'
17589 sh='$sh'
17590 shar='$shar'
17591 sharpbang='$sharpbang'
17592 shmattype='$shmattype'
17593 shortsize='$shortsize'
17594 shrpenv='$shrpenv'
17595 shsharp='$shsharp'
17596 sig_count='$sig_count'
17597 sig_name='$sig_name'
17598 sig_name_init='$sig_name_init'
17599 sig_num='$sig_num'
17600 sig_num_init='$sig_num_init'
17601 sig_size='$sig_size'
17602 signal_t='$signal_t'
17603 sitearch='$sitearch'
17604 sitearchexp='$sitearchexp'
17605 sitebin='$sitebin'
17606 sitebinexp='$sitebinexp'
17607 sitelib='$sitelib'
17608 sitelib_stem='$sitelib_stem'
17609 sitelibexp='$sitelibexp'
17610 siteprefix='$siteprefix'
17611 siteprefixexp='$siteprefixexp'
17612 sizesize='$sizesize'
17613 sizetype='$sizetype'
17614 sleep='$sleep'
17615 smail='$smail'
17616 so='$so'
17617 sockethdr='$sockethdr'
17618 socketlib='$socketlib'
17619 socksizetype='$socksizetype'
17620 sort='$sort'
17621 spackage='$spackage'
17622 spitshell='$spitshell'
17623 src='$src'
17624 ssizetype='$ssizetype'
17625 startperl='$startperl'
17626 startsh='$startsh'
17627 static_ext='$static_ext'
17628 stdchar='$stdchar'
17629 stdio_base='$stdio_base'
17630 stdio_bufsiz='$stdio_bufsiz'
17631 stdio_cnt='$stdio_cnt'
17632 stdio_filbuf='$stdio_filbuf'
17633 stdio_ptr='$stdio_ptr'
17634 stdio_stream_array='$stdio_stream_array'
17635 strings='$strings'
17636 submit='$submit'
17637 subversion='$subversion'
17638 sysman='$sysman'
17639 tail='$tail'
17640 tar='$tar'
17641 targetarch='$targetarch'
17642 tbl='$tbl'
17643 tee='$tee'
17644 test='$test'
17645 timeincl='$timeincl'
17646 timetype='$timetype'
17647 to='$to'
17648 touch='$touch'
17649 tr='$tr'
17650 trnl='$trnl'
17651 troff='$troff'
17652 u16size='$u16size'
17653 u16type='$u16type'
17654 u32size='$u32size'
17655 u32type='$u32type'
17656 u64size='$u64size'
17657 u64type='$u64type'
17658 u8size='$u8size'
17659 u8type='$u8type'
17660 uidformat='$uidformat'
17661 uidsign='$uidsign'
17662 uidsize='$uidsize'
17663 uidtype='$uidtype'
17664 uname='$uname'
17665 uniq='$uniq'
17666 uquadtype='$uquadtype'
17667 use5005threads='$use5005threads'
17668 use64bitall='$use64bitall'
17669 use64bitint='$use64bitint'
17670 usecrosscompile='$usecrosscompile'
17671 usedl='$usedl'
17672 useithreads='$useithreads'
17673 uselargefiles='$uselargefiles'
17674 uselongdouble='$uselongdouble'
17675 usemorebits='$usemorebits'
17676 usemultiplicity='$usemultiplicity'
17677 usemymalloc='$usemymalloc'
17678 usenm='$usenm'
17679 useopcode='$useopcode'
17680 useperlio='$useperlio'
17681 useposix='$useposix'
17682 usereentrant='$usereentrant'
17683 usesfio='$usesfio'
17684 useshrplib='$useshrplib'
17685 usesocks='$usesocks'
17686 usethreads='$usethreads'
17687 usevendorprefix='$usevendorprefix'
17688 usevfork='$usevfork'
17689 usrinc='$usrinc'
17690 uuname='$uuname'
17691 uvXUformat='$uvXUformat'
17692 uvoformat='$uvoformat'
17693 uvsize='$uvsize'
17694 uvtype='$uvtype'
17695 uvuformat='$uvuformat'
17696 uvxformat='$uvxformat'
17697 vendorarch='$vendorarch'
17698 vendorarchexp='$vendorarchexp'
17699 vendorbin='$vendorbin'
17700 vendorbinexp='$vendorbinexp'
17701 vendorlib='$vendorlib'
17702 vendorlib_stem='$vendorlib_stem'
17703 vendorlibexp='$vendorlibexp'
17704 vendorprefix='$vendorprefix'
17705 vendorprefixexp='$vendorprefixexp'
17706 version='$version'
17707 version_patchlevel_string='$version_patchlevel_string'
17708 versiononly='$versiononly'
17709 vi='$vi'
17710 voidflags='$voidflags'
17711 xlibpth='$xlibpth'
17712 xs_apiversion='$xs_apiversion'
17713 yacc='$yacc'
17714 yaccflags='$yaccflags'
17715 zcat='$zcat'
17716 zip='$zip'
17717 EOT
17718
17719 : Add in command line options if available
17720 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17721
17722 : add special variables
17723 $test -f $src/patchlevel.h && \
17724 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17725 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17726 echo "PERL_CONFIG_SH=true" >>config.sh
17727
17728 : propagate old symbols
17729 if $test -f UU/config.sh; then
17730         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17731         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17732         $sort | $uniq -u >UU/oldsyms
17733         set X `cat UU/oldsyms`
17734         shift
17735         case $# in
17736         0) ;;
17737         *)
17738                 cat <<EOM
17739 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17740 EOM
17741                 echo "# Variables propagated from previous config.sh file." >>config.sh
17742                 for sym in `cat UU/oldsyms`; do
17743                         echo "    Propagating $hint variable "'$'"$sym..."
17744                         eval 'tmp="$'"${sym}"'"'
17745                         echo "$tmp" | \
17746                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17747                 done
17748                 ;;
17749         esac
17750 fi
17751
17752 : Finish up by extracting the .SH files
17753 case "$alldone" in
17754 exit)
17755         $rm -rf UU
17756         echo "Extraction done."
17757         exit 0
17758         ;;
17759 cont)
17760         ;;
17761 '')
17762         dflt=''
17763         nostick=true
17764         $cat <<EOM
17765
17766 If you'd like to make any changes to the config.sh file before I begin
17767 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17768
17769 EOM
17770         rp="Press return or use a shell escape to edit config.sh:"
17771         . UU/myread
17772         nostick=''
17773         case "$ans" in
17774         '') ;;
17775         *) : in case they cannot read
17776                 sh 1>&4 -c "$ans";;
17777         esac
17778         ;;
17779 esac
17780
17781 : if this fails, just run all the .SH files by hand
17782 . ./config.sh
17783
17784 echo " "
17785 exec 1>&4
17786 pwd=`pwd`
17787 . ./UU/extract
17788 cd $pwd
17789
17790 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17791         dflt=y
17792         case "$silent" in
17793         true) ;;
17794         *)
17795                 $cat <<EOM
17796
17797 Now you need to generate make dependencies by running "$make depend".
17798 You might prefer to run it in background: "$make depend > makedepend.out &"
17799 It can take a while, so you might not want to run it right now.
17800
17801 EOM
17802                 ;;
17803         esac
17804         rp="Run $make depend now?"
17805         . UU/myread
17806         case "$ans" in
17807         y*)
17808                 $make depend && echo "Now you must run '$make'."
17809                 ;;
17810         *)
17811                 echo "You must run '$make depend' then '$make'."
17812                 ;;
17813         esac
17814 elif test -f [Mm]akefile; then
17815         echo " "
17816         echo "Now you must run a $make."
17817 else
17818         echo "Configure done."
17819 fi
17820
17821 if $test -f Policy.sh; then
17822     $cat <<EOM
17823
17824 If you compile $package on a different machine or from a different object
17825 directory, copy the Policy.sh file from this object directory to the
17826 new one before you run Configure -- this will help you with most of
17827 the policy defaults.
17828
17829 EOM
17830 fi
17831 if $test -f config.msg; then
17832     echo "Hmm.  I also noted the following information while running:"
17833     echo " "
17834     $cat config.msg >&4
17835     $rm -f config.msg
17836 fi
17837 $rm -f kit*isdone ark*isdone
17838 $rm -rf UU
17839
17840 : End of Configure
17841