HP-UX (induced) fixes.
[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 Jan 31 22:19:42 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/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 >/tmp/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 /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 inc_version_list_init=''
675 installprefix=''
676 installprefixexp=''
677 installstyle=''
678 installusrbinperl=''
679 intsize=''
680 longsize=''
681 shortsize=''
682 d_fpos64_t=''
683 d_off64_t=''
684 libc=''
685 ldlibpthname=''
686 libperl=''
687 shrpenv=''
688 useshrplib=''
689 glibpth=''
690 libpth=''
691 loclibpth=''
692 plibpth=''
693 xlibpth=''
694 ignore_versioned_solibs=''
695 libs=''
696 lns=''
697 d_PRIEldbl=''
698 d_PRIFldbl=''
699 d_PRIGldbl=''
700 d_PRIeldbl=''
701 d_PRIfldbl=''
702 d_PRIgldbl=''
703 sPRIEldbl=''
704 sPRIFldbl=''
705 sPRIGldbl=''
706 sPRIeldbl=''
707 sPRIfldbl=''
708 sPRIgldbl=''
709 lseeksize=''
710 lseektype=''
711 make_set_make=''
712 d_mymalloc=''
713 freetype=''
714 mallocobj=''
715 mallocsrc=''
716 malloctype=''
717 usemymalloc=''
718 installman1dir=''
719 man1dir=''
720 man1direxp=''
721 man1ext=''
722 installman3dir=''
723 man3dir=''
724 man3direxp=''
725 man3ext=''
726 huge=''
727 large=''
728 medium=''
729 models=''
730 small=''
731 split=''
732 modetype=''
733 multiarch=''
734 mydomain=''
735 myhostname=''
736 phostname=''
737 c=''
738 n=''
739 d_eofnblk=''
740 eagain=''
741 o_nonblock=''
742 rd_nodata=''
743 netdb_hlen_type=''
744 netdb_host_type=''
745 netdb_name_type=''
746 netdb_net_type=''
747 groupcat=''
748 hostcat=''
749 passcat=''
750 orderlib=''
751 ranlib=''
752 package=''
753 spackage=''
754 pager=''
755 api_revision=''
756 api_subversion=''
757 api_version=''
758 api_versionstring=''
759 patchlevel=''
760 subversion=''
761 version=''
762 perladmin=''
763 perlpath=''
764 d_nv_preserves_uv=''
765 i16size=''
766 i16type=''
767 i32size=''
768 i32type=''
769 i64size=''
770 i64type=''
771 i8size=''
772 i8type=''
773 ivsize=''
774 ivtype=''
775 nvsize=''
776 nvtype=''
777 u16size=''
778 u16type=''
779 u32size=''
780 u32type=''
781 u64size=''
782 u64type=''
783 u8size=''
784 u8type=''
785 uvsize=''
786 uvtype=''
787 ivdformat=''
788 uvoformat=''
789 uvuformat=''
790 uvxformat=''
791 pidtype=''
792 prefix=''
793 prefixexp=''
794 installprivlib=''
795 privlib=''
796 privlibexp=''
797 prototype=''
798 ptrsize=''
799 d_PRIX64=''
800 d_PRId64=''
801 d_PRIi64=''
802 d_PRIo64=''
803 d_PRIu64=''
804 d_PRIx64=''
805 sPRIX64=''
806 sPRId64=''
807 sPRIi64=''
808 sPRIo64=''
809 sPRIu64=''
810 sPRIx64=''
811 d_quad=''
812 quadkind=''
813 quadtype=''
814 uquadtype=''
815 drand01=''
816 randbits=''
817 randfunc=''
818 randseedtype=''
819 seedfunc=''
820 installscript=''
821 scriptdir=''
822 scriptdirexp=''
823 selectminbits=''
824 selecttype=''
825 sh=''
826 sig_count=''
827 sig_name=''
828 sig_name_init=''
829 sig_num=''
830 sig_num_init=''
831 installsitearch=''
832 sitearch=''
833 sitearchexp=''
834 installsitebin=''
835 sitebin=''
836 sitebinexp=''
837 installsitelib=''
838 sitelib=''
839 sitelibexp=''
840 siteprefix=''
841 siteprefixexp=''
842 sizetype=''
843 so=''
844 sharpbang=''
845 shsharp=''
846 spitshell=''
847 src=''
848 ssizetype=''
849 startperl=''
850 startsh=''
851 stdchar=''
852 d_stdio_stream_array=''
853 stdio_stream_array=''
854 sysman=''
855 trnl=''
856 uidformat=''
857 uidsign=''
858 uidsize=''
859 uidtype=''
860 archname64=''
861 use64bits=''
862 uselargefiles=''
863 uselongdouble=''
864 uselonglong=''
865 usemorebits=''
866 usemultiplicity=''
867 nm_opt=''
868 nm_so_opt=''
869 runnm=''
870 usenm=''
871 useperlio=''
872 usesocks=''
873 d_oldpthreads=''
874 use5005threads=''
875 useithreads=''
876 usethreads=''
877 incpath=''
878 mips_type=''
879 usrinc=''
880 d_vendorbin=''
881 installvendorbin=''
882 vendorbin=''
883 vendorbinexp=''
884 d_vendorlib=''
885 installvendorlib=''
886 vendorlib=''
887 vendorlibexp=''
888 usevendorprefix=''
889 vendorprefix=''
890 vendorprefixexp=''
891 defvoidused=''
892 voidflags=''
893 CONFIG=''
894
895 define='define'
896 undef='undef'
897 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
898 rmlist=''
899
900 : We must find out about Eunice early
901 eunicefix=':'
902 if test -f /etc/unixtovms; then
903         eunicefix=/etc/unixtovms
904 fi
905 if test -f /etc/unixtovms.exe; then
906         eunicefix=/etc/unixtovms.exe
907 fi
908
909 i_whoami=''
910 : set useposix=false in your hint file to disable the POSIX extension.
911 useposix=true
912 : set useopcode=false in your hint file to disable the Opcode extension.
913 useopcode=true
914 : Trailing extension.  Override this in a hint file, if needed.
915 _exe=''
916 : Extra object files, if any, needed on this platform.
917 archobjs=''
918 : Possible local include directories to search.
919 : Set locincpth to "" in a hint file to defeat local include searches.
920 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
921 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
922 :
923 : no include file wanted by default
924 inclwanted=''
925
926 groupstype=''
927 : change the next line if compiling for Xenix/286 on Xenix/386
928 xlibpth='/usr/lib/386 /lib/386'
929
930 : Possible local library directories to search.
931 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
932 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
933
934 : general looking path for locating libraries
935 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
936 glibpth="$glibpth /lib /usr/lib $xlibpth"
937 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
938 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
939
940 : Private path used by Configure to find libraries.  Its value
941 : is prepended to libpth. This variable takes care of special
942 : machines, like the mips.  Usually, it should be empty.
943 plibpth=''
944
945 : default library list
946 libswanted=''
947 : some systems want to use only the non-versioned libso:s
948 ignore_versioned_solibs=''
949 : set usemultiplicity on the Configure command line to enable multiplicity.
950 : set usesocks on the Configure command line to enable socks.
951 : set usethreads on the Configure command line to enable threads.
952 : full support for void wanted by default
953 defvoidused=15
954
955 : List of libraries we want.
956 : If anyone needs -lnet, put it in a hint file.
957 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
958 libswanted="$libswanted dld ld sun m c cposix posix"
959 libswanted="$libswanted ndir dir crypt sec"
960 libswanted="$libswanted ucb bsd BSD PW x"
961 : We probably want to search /usr/shlib before most other libraries.
962 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
963 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
964 glibpth="/usr/shlib $glibpth"
965 : Do not use vfork unless overridden by a hint file.
966 usevfork=false
967
968 : Find the basic shell for Bourne shell scripts
969 case "$sh" in
970 '')
971         case "$SYSTYPE" in
972         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
973         *) xxx='/bin/sh';;
974         esac
975         if test -f "$xxx"; then
976                 sh="$xxx"
977         else
978                 : Build up a list and do a single loop so we can 'break' out.
979                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
980                 for xxx in sh bash ksh pdksh ash; do
981                         for p in $pth; do
982                                 try="$try ${p}/${xxx}"
983                         done
984                 done
985                 for xxx in $try; do
986                         if test -f "$xxx"; then
987                                 sh="$xxx";
988                                 break
989                         elif test -f "$xxx.exe"; then
990                                 sh="$xxx";
991                                 break
992                         fi
993                 done
994         fi
995         ;;
996 esac
997
998 case "$sh" in
999 '')     cat <<EOM >&2
1000 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1001
1002 Usually it's in /bin/sh.  How did you even get this far?
1003 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1004 we'll try to straighten this all out.
1005 EOM
1006         exit 1
1007         ;;
1008 esac
1009
1010 : see if sh knows # comments
1011 if `$sh -c '#' >/dev/null 2>&1`; then
1012         shsharp=true
1013         spitshell=cat
1014         xcat=/bin/cat
1015         test -f $xcat || xcat=/usr/bin/cat
1016         echo "#!$xcat" >try
1017         $eunicefix try
1018         chmod +x try
1019         ./try > today
1020         if test -s today; then
1021                 sharpbang='#!'
1022         else
1023                 echo "#! $xcat" > try
1024                 $eunicefix try
1025                 chmod +x try
1026                 ./try > today
1027                 if test -s today; then
1028                         sharpbang='#! '
1029                 else
1030                         sharpbang=': use '
1031                 fi
1032         fi
1033 else
1034         echo " "
1035         echo "Your $sh doesn't grok # comments--I will strip them later on."
1036         shsharp=false
1037         cd ..
1038         echo "exec grep -v '^[  ]*#'" >spitshell
1039         chmod +x spitshell
1040         $eunicefix spitshell
1041         spitshell=`pwd`/spitshell
1042         cd UU
1043         echo "I presume that if # doesn't work, #! won't work either!"
1044         sharpbang=': use '
1045 fi
1046 rm -f try today
1047
1048 : figure out how to guarantee sh startup
1049 case "$startsh" in
1050 '') startsh=${sharpbang}${sh} ;;
1051 *)
1052 esac
1053 cat >try <<EOSS
1054 $startsh
1055 set abc
1056 test "$?abc" != 1
1057 EOSS
1058
1059 chmod +x try
1060 $eunicefix try
1061 if ./try; then
1062         : echo "Yup, it does."
1063 else
1064         echo "Hmm... '$startsh' does not guarantee sh startup..."
1065         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1066 fi
1067 rm -f try
1068
1069
1070 : Save command line options in file UU/cmdline.opt for later use in
1071 : generating config.sh.
1072 cat > cmdline.opt <<EOSH
1073 # Configure command line arguments.
1074 config_arg0='$0'
1075 config_args='$*'
1076 config_argc=$#
1077 EOSH
1078 argn=1
1079 for arg in "$@"; do
1080         cat >>cmdline.opt <<EOSH
1081 config_arg$argn='$arg'
1082 EOSH
1083         argn=`expr $argn + 1`
1084 done
1085
1086 : produce awk script to parse command line options
1087 cat >options.awk <<'EOF'
1088 BEGIN {
1089         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1090
1091         len = length(optstr);
1092         for (i = 1; i <= len; i++) {
1093                 c = substr(optstr, i, 1);
1094                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1095                 if (a == ":") {
1096                         arg[c] = 1;
1097                         i++;
1098                 }
1099                 opt[c] = 1;
1100         }
1101 }
1102 {
1103         expect = 0;
1104         str = $0;
1105         if (substr(str, 1, 1) != "-") {
1106                 printf("'%s'\n", str);
1107                 next;
1108         }
1109         len = length($0);
1110         for (i = 2; i <= len; i++) {
1111                 c = substr(str, i, 1);
1112                 if (!opt[c]) {
1113                         printf("-%s\n", substr(str, i));
1114                         next;
1115                 }
1116                 printf("-%s\n", c);
1117                 if (arg[c]) {
1118                         if (i < len)
1119                                 printf("'%s'\n", substr(str, i + 1));
1120                         else
1121                                 expect = 1;
1122                         next;
1123                 }
1124         }
1125 }
1126 END {
1127         if (expect)
1128                 print "?";
1129 }
1130 EOF
1131
1132 : process the command line options
1133 set X `for arg in "$@"; do echo "X$arg"; done |
1134         sed -e s/X// | awk -f options.awk`
1135 eval "set $*"
1136 shift
1137 rm -f options.awk
1138
1139 : set up default values
1140 fastread=''
1141 reuseval=false
1142 config_sh=''
1143 alldone=''
1144 error=''
1145 silent=''
1146 extractsh=''
1147 override=''
1148 knowitall=''
1149 rm -f optdef.sh posthint.sh
1150 cat >optdef.sh <<EOS
1151 $startsh
1152 EOS
1153
1154
1155 : option parsing
1156 while test $# -gt 0; do
1157         case "$1" in
1158         -d) shift; fastread=yes;;
1159         -e) shift; alldone=cont;;
1160         -f)
1161                 shift
1162                 cd ..
1163                 if test -r "$1"; then
1164                         config_sh="$1"
1165                 else
1166                         echo "$me: cannot read config file $1." >&2
1167                         error=true
1168                 fi
1169                 cd UU
1170                 shift;;
1171         -h) shift; error=true;;
1172         -r) shift; reuseval=true;;
1173         -s) shift; silent=true; realsilent=true;;
1174         -E) shift; alldone=exit;;
1175         -K) shift; knowitall=true;;
1176         -O) shift; override=true;;
1177         -S) shift; silent=true; extractsh=true;;
1178         -D)
1179                 shift
1180                 case "$1" in
1181                 *=)
1182                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1183                         echo "$me: ignoring -D $1" >&2
1184                         ;;
1185                 *=*) echo "$1" | \
1186                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1187                 *) echo "$1='define'" >> optdef.sh;;
1188                 esac
1189                 shift
1190                 ;;
1191         -U)
1192                 shift
1193                 case "$1" in
1194                 *=) echo "$1" >> optdef.sh;;
1195                 *=*)
1196                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1197                         echo "$me: ignoring -U $1" >&2
1198                         ;;
1199                 *) echo "$1='undef'" >> optdef.sh;;
1200                 esac
1201                 shift
1202                 ;;
1203         -A)
1204             shift
1205             xxx=''
1206             yyy="$1"
1207             zzz=''
1208             uuu=undef
1209             case "$yyy" in
1210             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1211                  case "$zzz" in
1212                  *:*) zzz='' ;;
1213                  *)   xxx=append
1214                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1215                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1216                  esac
1217                  ;;
1218             esac
1219             case "$xxx" in
1220             '')  case "$yyy" in
1221                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1222                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1223                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1224                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1225                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1226                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1227                  esac
1228                  ;;       
1229             esac
1230             case "$xxx" in
1231             append)
1232                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1233             clear)
1234                 echo "$yyy=''"                  >> posthint.sh ;;
1235             define)
1236                 case "$zzz" in
1237                 '') zzz=define ;;
1238                 esac
1239                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1240             eval)
1241                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1242             prepend)
1243                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1244             undef)
1245                 case "$zzz" in
1246                 '') zzz="$uuu" ;;
1247                 esac
1248                 echo "$yyy=$zzz"                >> posthint.sh ;;
1249             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1250             esac
1251             ;;
1252         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1253             exit 0;;
1254         --) break;;
1255         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1256         *) break;;
1257         esac
1258 done
1259
1260 case "$error" in
1261 true)
1262         cat >&2 <<EOM
1263 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1264                  [-U symbol] [-U symbol=] [-A command:symbol...]
1265   -d : use defaults for all answers.
1266   -e : go on without questioning past the production of config.sh.
1267   -f : specify an alternate default configuration file.
1268   -h : print this help message and exit (with an error status).
1269   -r : reuse C symbols value if possible (skips costly nm extraction).
1270   -s : silent mode, only echoes questions and essential information.
1271   -D : define symbol to have some value:
1272          -D symbol         symbol gets the value 'define'
1273          -D symbol=value   symbol gets the value 'value'
1274   -E : stop at the end of questions, after having produced config.sh.
1275   -K : do not use unless you know what you are doing.
1276   -O : let -D and -U override definitions from loaded configuration file.
1277   -S : perform variable substitutions on all .SH files (can mix with -f)
1278   -U : undefine symbol:
1279          -U symbol    symbol gets the value 'undef'
1280          -U symbol=   symbol gets completely empty
1281   -A : manipulate symbol after the platform specific hints have been applied:
1282          -A symbol=value                append " "value to symbol
1283          -A append:symbol=value         append value to symbol
1284          -A define:symbol=value         define symbol to have value
1285          -A clear:symbol                define symbol to be ''
1286          -A define:symbol               define symbol to be 'define'
1287          -A eval:symbol=value           define symbol to be eval of value
1288          -A prepend:symbol=value        prepend value to symbol
1289          -A undef:symbol                define symbol to be 'undef'
1290          -A undef:symbol=               define symbol to be ''
1291   -V : print version number and exit (with a zero status).
1292 EOM
1293         exit 1
1294         ;;
1295 esac
1296
1297 : Sanity checks
1298 case "$fastread$alldone" in
1299 yescont|yesexit) ;;
1300 *)
1301         if test ! -t 0; then
1302                 echo "Say 'sh Configure', not 'sh <Configure'"
1303                 exit 1
1304         fi
1305         ;;
1306 esac
1307
1308 exec 4>&1
1309 case "$silent" in
1310 true) exec 1>/dev/null;;
1311 esac
1312
1313 : run the defines and the undefines, if any, but leave the file out there...
1314 touch optdef.sh
1315 . ./optdef.sh
1316 : create the posthint manipulation script and leave the file out there...
1317 touch posthint.sh
1318
1319 : set package name
1320 package=perl5
1321 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1322 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1323 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1324 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1325 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1326 esac
1327
1328 : Some greps do not return status, grrr.
1329 echo "grimblepritz" >grimble
1330 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1331         contains=contains
1332 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1333         contains=grep
1334 else
1335         contains=contains
1336 fi
1337 rm -f grimble
1338 : the following should work in any shell
1339 case "$contains" in
1340 contains*)
1341         echo " "
1342         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1343         cat >contains <<'EOSS'
1344 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1345 EOSS
1346 chmod +x contains
1347 esac
1348
1349 : Find the path to the source tree
1350 case "$src" in
1351 '') case "$0" in
1352     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1353          case "$src" in
1354          /*)    ;;
1355          *)     src=`cd ../$src && pwd` ;;
1356          esac
1357          ;;
1358     *)   src='.';;
1359     esac;;
1360 esac
1361 case "$src" in
1362 '')     src=/
1363         rsrc=/
1364         ;;
1365 /*) rsrc="$src";;
1366 *) rsrc="../$src";;
1367 esac
1368 if test -f $rsrc/Configure && \
1369         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1370 then
1371    : found it, so we are ok.
1372 else
1373         rsrc=''
1374         for src in . .. ../.. ../../.. ../../../..; do
1375                 if test -f ../$src/Configure && \
1376                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1377                 then
1378                         rsrc=../$src
1379                         break
1380                 fi
1381         done
1382 fi
1383 case "$rsrc" in
1384 '')
1385         cat <<EOM >&4
1386
1387 Sorry, I can't seem to locate the source dir for $package.  Please start
1388 Configure with an explicit path -- i.e. /some/path/Configure.
1389
1390 EOM
1391         exit 1
1392         ;;
1393 ../.)   rsrc='..';;
1394 *)
1395         echo " "
1396         echo "Sources for $package found in \"$src\"." >&4
1397         ;;
1398 esac
1399
1400 : script used to extract .SH files with variable substitutions
1401 cat >extract <<'EOS'
1402 CONFIGDOTSH=true
1403 echo "Doing variable substitutions on .SH files..."
1404 if test -f $src/MANIFEST; then
1405         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1406 else
1407         echo "(Looking for .SH files under the source directory.)"
1408         set x `(cd $src; find . -name "*.SH" -print)`
1409 fi
1410 shift
1411 case $# in
1412 0) set x `(cd $src; echo *.SH)`; shift;;
1413 esac
1414 if test ! -f $src/$1; then
1415         shift
1416 fi
1417 mkdir_p='
1418 name=$1;
1419 create="";
1420 while test $name; do
1421         if test ! -d "$name"; then
1422                 create="$name $create";
1423                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1424                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1425         else
1426                 name="";
1427         fi;
1428 done;
1429 for file in $create; do
1430         mkdir $file;
1431 done
1432 '
1433 for file in $*; do
1434         case "$src" in
1435         ".")
1436                 case "$file" in
1437                 */*)
1438                         dir=`expr X$file : 'X\(.*\)/'`
1439                         file=`expr X$file : 'X.*/\(.*\)'`
1440                         (cd $dir && . ./$file)
1441                         ;;
1442                 *)
1443                         . ./$file
1444                         ;;
1445                 esac
1446                 ;;
1447         *)
1448                 case "$file" in
1449                 */*)
1450                         dir=`expr X$file : 'X\(.*\)/'`
1451                         file=`expr X$file : 'X.*/\(.*\)'`
1452                         (set x $dir; shift; eval $mkdir_p)
1453                         sh <$src/$dir/$file
1454                         ;;
1455                 *)
1456                         sh <$src/$file
1457                         ;;
1458                 esac
1459                 ;;
1460         esac
1461 done
1462 if test -f $src/config_h.SH; then
1463         if test ! -f config.h; then
1464         : oops, they left it out of MANIFEST, probably, so do it anyway.
1465         . $src/config_h.SH
1466         fi
1467 fi
1468 EOS
1469
1470 : extract files and exit if asked to do so
1471 case "$extractsh" in
1472 true)
1473         case "$realsilent" in
1474         true) ;;
1475         *) exec 1>&4;;
1476         esac
1477         case "$config_sh" in
1478         '') config_sh='config.sh';;
1479         esac
1480         echo " "
1481         echo "Fetching answers from $config_sh..."
1482         cd ..
1483         . $config_sh
1484         test "$override" && . ./optdef.sh
1485         echo " "
1486         . UU/extract
1487         rm -rf UU
1488         echo "Done."
1489         exit 0
1490         ;;
1491 esac
1492
1493 : Eunice requires " " instead of "", can you believe it
1494 echo " "
1495 : Here we go...
1496 echo "Beginning of configuration questions for $package."
1497
1498 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1499
1500 : first determine how to suppress newline on echo command
1501 echo " "
1502 echo "Checking echo to see how to suppress newlines..."
1503 (echo "hi there\c" ; echo " ") >.echotmp
1504 if $contains c .echotmp >/dev/null 2>&1 ; then
1505         echo "...using -n."
1506         n='-n'
1507         c=''
1508 else
1509         cat <<'EOM'
1510 ...using \c
1511 EOM
1512         n=''
1513         c='\c'
1514 fi
1515 echo $n "The star should be here-->$c"
1516 echo '*'
1517 rm -f .echotmp
1518
1519 : Now test for existence of everything in MANIFEST
1520 echo " "
1521 if test -f $rsrc/MANIFEST; then
1522         echo "First let's make sure your kit is complete.  Checking..." >&4
1523         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1524         rm -f missing
1525         tmppwd=`pwd`
1526         for filelist in x??; do
1527                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1528         done
1529         if test -s missing; then
1530                 cat missing >&4
1531                 cat >&4 <<'EOM'
1532
1533 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1534
1535 You have the option of continuing the configuration process, despite the
1536 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1537 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1538 and contact the author (perlbug@perl.com).
1539
1540 EOM
1541                 echo $n "Continue? [n] $c" >&4
1542                 read ans
1543                 case "$ans" in
1544                 y*)
1545                         echo "Continuing..." >&4
1546                         rm -f missing
1547                         ;;
1548                 *)
1549                         echo "ABORTING..." >&4
1550                         kill $$
1551                         ;;
1552                 esac
1553         else
1554                 echo "Looks good..."
1555         fi
1556 else
1557         echo "There is no MANIFEST file.  I hope your kit is complete !"
1558 fi
1559 rm -f missing x??
1560
1561 echo " "
1562 : Find the appropriate value for a newline for tr
1563 if test -n "$DJGPP"; then
1564        trnl='\012'
1565 fi
1566 if test X"$trnl" = X; then
1567         case "`echo foo|tr '\n' x 2>/dev/null`" in
1568         foox) trnl='\n' ;;
1569         esac
1570 fi
1571 if test X"$trnl" = X; then
1572         case "`echo foo|tr '\012' x 2>/dev/null`" in
1573         foox) trnl='\012' ;;
1574         esac
1575 fi
1576 if test X"$trnl" = X; then
1577         cat <<EOM >&2
1578
1579 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1580
1581 EOM
1582         exit 1
1583 fi
1584
1585 : compute the number of columns on the terminal for proper question formatting
1586 case "$COLUMNS" in
1587 '') COLUMNS='80';;
1588 esac
1589
1590 : set up the echo used in my read
1591 myecho="case \"\$xxxm\" in
1592 '') echo $n \"\$rp $c\" >&4;;
1593 *) case \"\$rp\" in
1594         '') echo $n \"[\$xxxm] $c\";;
1595         *)
1596                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1597                         echo \"\$rp\" >&4
1598                         echo $n \"[\$xxxm] $c\" >&4
1599                 else
1600                         echo $n \"\$rp [\$xxxm] $c\" >&4
1601                 fi
1602                 ;;
1603         esac;;
1604 esac"
1605
1606 : now set up to do reads with possible shell escape and default assignment
1607 cat <<EOSC >myread
1608 $startsh
1609 xxxm=\$dflt
1610 $myecho
1611 ans='!'
1612 case "\$fastread" in
1613 yes) case "\$dflt" in
1614         '') ;;
1615         *) ans='';
1616                 case "\$silent-\$rp" in
1617                 true-) ;;
1618                 *) echo " " >&4;;
1619                 esac;;
1620         esac;;
1621 *) case "\$silent" in
1622         true) case "\$rp" in
1623                 '') ans='';;
1624                 esac;;
1625         esac;;
1626 esac
1627 while expr "X\$ans" : "X!" >/dev/null; do
1628         read answ
1629         set x \$xxxm
1630         shift
1631         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1632         case  "\$answ" in
1633         "!")
1634                 sh 1>&4
1635                 echo " "
1636                 $myecho
1637                 ;;
1638         !*)
1639                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1640                 shift
1641                 sh 1>&4 -c "\$*"
1642                 echo " "
1643                 $myecho
1644                 ;;
1645         "\$ans")
1646                 case "\$ans" in
1647                 \\&*)
1648                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1649                         shift
1650                         case "\$1" in
1651                         -d)
1652                                 fastread=yes
1653                                 echo "(OK, I'll run with -d after this question.)" >&4
1654                                 ;;
1655                         -*)
1656                                 echo "*** Sorry, \$1 not supported yet." >&4
1657                                 ;;
1658                         esac
1659                         $myecho
1660                         ans=!
1661                         ;;
1662                 esac;;
1663         *)
1664                 case "\$aok" in
1665                 y)
1666                         echo "*** Substitution done -- please confirm."
1667                         xxxm="\$ans"
1668                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1669                         xxxm="\$ans"
1670                         ans=!
1671                         ;;
1672                 *)
1673                         echo "*** Error -- try again."
1674                         ans=!
1675                         ;;
1676                 esac
1677                 $myecho
1678                 ;;
1679         esac
1680         case "\$ans\$xxxm\$nostick" in
1681         '')
1682                 ans=!
1683                 $myecho
1684                 ;;
1685         esac
1686 done
1687 case "\$ans" in
1688 '') ans="\$xxxm";;
1689 esac
1690 EOSC
1691
1692 : create .config dir to save info across Configure sessions
1693 test -d ../.config || mkdir ../.config
1694 cat >../.config/README <<EOF
1695 This directory created by Configure to save information that should
1696 persist across sessions for $package.
1697
1698 You may safely delete it if you wish.
1699 EOF
1700
1701 : general instructions
1702 needman=true
1703 firsttime=true
1704 user=`(logname) 2>/dev/null`
1705 case "$user" in
1706 '') user=`whoami 2>&1`;;
1707 esac
1708 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1709         firsttime=false
1710         echo " "
1711         rp='Would you like to see the instructions?'
1712         dflt=n
1713         . ./myread
1714         case "$ans" in
1715         [yY]*) ;;
1716         *) needman=false;;
1717         esac
1718 fi
1719 if $needman; then
1720         cat <<EOH
1721
1722 This installation shell script will examine your system and ask you questions
1723 to determine how the perl5 package should be installed. If you get
1724 stuck on a question, you may use a ! shell escape to start a subshell or
1725 execute a command.  Many of the questions will have default answers in square
1726 brackets; typing carriage return will give you the default.
1727
1728 On some of the questions which ask for file or directory names you are allowed
1729 to use the ~name construct to specify the login directory belonging to "name",
1730 even if you don't have a shell which knows about that.  Questions where this is
1731 allowed will be marked "(~name ok)".
1732
1733 EOH
1734         rp=''
1735         dflt='Type carriage return to continue'
1736         . ./myread
1737         cat <<'EOH'
1738
1739 The prompter used in this script allows you to use shell variables and
1740 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1741 in the default answer, as if the default line was a set of arguments given to a
1742 script shell.  This means you may also use $* to repeat the whole default line,
1743 so you do not have to re-type everything to add something to the default.
1744
1745 Everytime there is a substitution, you will have to confirm.  If there is an
1746 error (e.g. an unmatched backtick), the default answer will remain unchanged
1747 and you will be prompted again.
1748
1749 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1750 the questions and use the computed defaults (or the previous answers if there
1751 was already a config.sh file). Type 'Configure -h' for a list of options.
1752 You may also start interactively and then answer '& -d' at any prompt to turn
1753 on the non-interactive behaviour for the remainder of the execution.
1754
1755 EOH
1756         . ./myread
1757         cat <<EOH
1758
1759 Much effort has been expended to ensure that this shell script will run on any
1760 Unix system.  If despite that it blows up on yours, your best bet is to edit
1761 Configure and run it again.  If you can't run Configure for some reason,
1762 you'll have to generate a config.sh file by hand.  Whatever problems you
1763 have, let me (perlbug@perl.com) know how I blew it.
1764
1765 This installation script affects things in two ways:
1766
1767 1) it may do direct variable substitutions on some of the files included
1768    in this kit.
1769 2) it builds a config.h file for inclusion in C programs.  You may edit
1770    any of these files as the need arises after running this script.
1771
1772 If you make a mistake on a question, there is no easy way to back up to it
1773 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1774 files.  Configure will offer to let you do this before it runs the SH files.
1775
1776 EOH
1777         dflt='Type carriage return to continue'
1778         . ./myread
1779         case "$firsttime" in
1780         true) echo $user >>../.config/instruct;;
1781         esac
1782 fi
1783
1784 : find out where common programs are
1785 echo " "
1786 echo "Locating common programs..." >&4
1787 cat <<EOSC >loc
1788 $startsh
1789 case \$# in
1790 0) exit 1;;
1791 esac
1792 thing=\$1
1793 shift
1794 dflt=\$1
1795 shift
1796 for dir in \$*; do
1797         case "\$thing" in
1798         .)
1799         if test -d \$dir/\$thing; then
1800                 echo \$dir
1801                 exit 0
1802         fi
1803         ;;
1804         *)
1805         for thisthing in \$dir/\$thing; do
1806                 : just loop through to pick last item
1807         done
1808         if test -f \$thisthing; then
1809                 echo \$thisthing
1810                 exit 0
1811         elif test -f \$dir/\$thing.exe; then
1812                 if test -n "$DJGPP"; then
1813                         echo \$dir/\$thing.exe
1814                 else
1815                         : on Eunice apparently
1816                         echo \$dir/\$thing
1817                 fi
1818                 exit 0
1819         fi
1820         ;;
1821         esac
1822 done
1823 echo \$dflt
1824 exit 1
1825 EOSC
1826 chmod +x loc
1827 $eunicefix loc
1828 loclist="
1829 awk
1830 cat
1831 comm
1832 cp
1833 echo
1834 expr
1835 grep
1836 ls
1837 make
1838 mkdir
1839 rm
1840 sed
1841 sort
1842 touch
1843 tr
1844 uniq
1845 "
1846 trylist="
1847 Mcc
1848 ar
1849 byacc
1850 cpp
1851 csh
1852 date
1853 egrep
1854 gzip
1855 less
1856 ln
1857 more
1858 nm
1859 nroff
1860 perl
1861 pg
1862 test
1863 uname
1864 zip
1865 "
1866 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1867 pth="$pth /lib /usr/lib"
1868 for file in $loclist; do
1869         eval xxx=\$$file
1870         case "$xxx" in
1871         /*|?:[\\/]*)
1872                 if test -f "$xxx"; then
1873                         : ok
1874                 else
1875                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1876                         xxx=`./loc $file $file $pth`
1877                 fi
1878                 ;;
1879         '') xxx=`./loc $file $file $pth`;;
1880         *) xxx=`./loc $xxx $xxx $pth`;;
1881         esac
1882         eval $file=$xxx
1883         eval _$file=$xxx
1884         case "$xxx" in
1885         /*)
1886                 echo $file is in $xxx.
1887                 ;;
1888         ?:[\\/]*)
1889                 echo $file is in $xxx.
1890                 ;;
1891         *)
1892                 echo "I don't know where '$file' is, and my life depends on it." >&4
1893                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1894                 exit 1
1895                 ;;
1896         esac
1897 done
1898 echo " "
1899 echo "Don't worry if any of the following aren't found..."
1900 say=offhand
1901 for file in $trylist; do
1902         eval xxx=\$$file
1903         case "$xxx" in
1904         /*|?:[\\/]*)
1905                 if test -f "$xxx"; then
1906                         : ok
1907                 else
1908                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1909                         xxx=`./loc $file $file $pth`
1910                 fi
1911                 ;;
1912         '') xxx=`./loc $file $file $pth`;;
1913         *) xxx=`./loc $xxx $xxx $pth`;;
1914         esac
1915         eval $file=$xxx
1916         eval _$file=$xxx
1917         case "$xxx" in
1918         /*)
1919                 echo $file is in $xxx.
1920                 ;;
1921         ?:[\\/]*)
1922                 echo $file is in $xxx.
1923                 ;;
1924         *)
1925                 echo "I don't see $file out there, $say."
1926                 say=either
1927                 ;;
1928         esac
1929 done
1930 case "$egrep" in
1931 egrep)
1932         echo "Substituting grep for egrep."
1933         egrep=$grep
1934         ;;
1935 esac
1936 case "$ln" in
1937 ln)
1938         echo "Substituting cp for ln."
1939         ln=$cp
1940         ;;
1941 esac
1942 case "$test" in
1943 test)
1944         echo "Hopefully test is built into your sh."
1945         ;;
1946 *)
1947         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1948                 echo "Using the test built into your sh."
1949                 test=test
1950                 _test=test
1951         fi
1952         ;;
1953 esac
1954 case "$echo" in
1955 echo)
1956         echo "Hopefully echo is built into your sh."
1957         ;;
1958 '') ;;
1959 *)
1960         echo " "
1961 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1962         $echo $n "hi there$c" >foo1
1963         echo $n "hi there$c" >foo2
1964         if cmp foo1 foo2 >/dev/null 2>&1; then
1965                 echo "They are compatible.  In fact, they may be identical."
1966         else
1967                 case "$n" in
1968                 '-n') n='' c='\c';;
1969                 *) n='-n' c='';;
1970                 esac
1971                 cat <<FOO
1972 They are not compatible!  You are probably running ksh on a non-USG system.
1973 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1974 have echo built in and we may have to run some Bourne shell scripts.  That
1975 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1976
1977 FOO
1978                 $echo $n "The star should be here-->$c"
1979                 $echo "*"
1980         fi
1981         $rm -f foo1 foo2
1982         ;;
1983 esac
1984
1985 : determine whether symbolic links are supported
1986 echo " "
1987 $touch blurfl
1988 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1989         echo "Symbolic links are supported." >&4
1990         lns="$ln -s"
1991 else
1992         echo "Symbolic links are NOT supported." >&4
1993         lns="$ln"
1994 fi
1995 $rm -f blurfl sym
1996
1997 : see whether [:lower:] and [:upper:] are supported character classes
1998 echo " "
1999 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2000 ABYZ)
2001         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2002         up='[:upper:]'
2003         low='[:lower:]'
2004         ;;
2005 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2006         # (0xc9 and 0xd1), therefore that is a nice testing point.
2007         if test "X$up" = X -o "X$low" = X; then
2008             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2009             ij) up='[A-Z]'
2010                 low='[a-z]'
2011                 ;;
2012             esac
2013         fi
2014         if test "X$up" = X -o "X$low" = X; then
2015             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2016             ij) up='A-Z'
2017                 low='a-z'
2018                 ;;
2019             esac
2020         fi
2021         if test "X$up" = X -o "X$low" = X; then
2022             case "`echo IJ | od -x 2>/dev/null`" in
2023             *C9D1*|*c9d1*)
2024                 echo "Hey, this might be EBCDIC." >&4
2025                 if test "X$up" = X -o "X$low" = X; then
2026                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2027                     ij) up='[A-IJ-RS-Z]'
2028                         low='[a-ij-rs-z]'
2029                         ;;
2030                     esac
2031                 fi
2032                 if test "X$up" = X -o "X$low" = X; then
2033                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2034                     ij) up='A-IJ-RS-Z'
2035                         low='a-ij-rs-z'
2036                         ;;
2037                     esac
2038                 fi
2039                 ;;
2040             esac
2041         fi
2042 esac
2043 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2044 ij)
2045     echo "Using $up and $low to convert case." >&4
2046     ;;
2047 *)
2048     echo "I don't know how to translate letters from upper to lower case." >&4
2049     echo "Your tr is not acting any way I know of." >&4
2050     exit 1
2051     ;;
2052 esac
2053 : set up the translation script tr, must be called with ./tr of course
2054 cat >tr <<EOSC
2055 $startsh
2056 case "\$1\$2" in
2057 '[A-Z][a-z]') exec $tr '$up' '$low';;
2058 '[a-z][A-Z]') exec $tr '$low' '$up';;
2059 esac
2060 exec $tr "\$@"
2061 EOSC
2062 chmod +x tr
2063 $eunicefix tr
2064
2065 : Try to determine whether config.sh was made on this system
2066 case "$config_sh" in
2067 '')
2068 myuname=`$uname -a 2>/dev/null`
2069 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2070 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2071 # because the A-Z/a-z are not consecutive.
2072 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2073         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2074 newmyuname="$myuname"
2075 dflt=n
2076 case "$knowitall" in
2077 '')
2078         if test -f ../config.sh; then
2079                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2080                         eval "`grep myuname= ../config.sh`"
2081                 fi
2082                 if test "X$myuname" = "X$newmyuname"; then
2083                         dflt=y
2084                 fi
2085         fi
2086         ;;
2087 *) dflt=y;;
2088 esac
2089
2090 : Get old answers from old config file if Configure was run on the
2091 : same system, otherwise use the hints.
2092 hint=default
2093 cd ..
2094 if test -f config.sh; then
2095         echo " "
2096         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2097         . UU/myread
2098         case "$ans" in
2099         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2100         *)  echo "Fetching default answers from your old config.sh file..." >&4
2101                 tmp_n="$n"
2102                 tmp_c="$c"
2103                 tmp_sh="$sh"
2104                 . ./config.sh
2105                 cp config.sh UU
2106                 n="$tmp_n"
2107                 c="$tmp_c"
2108                 : Older versions did not always set $sh.  Catch re-use of such
2109                 : an old config.sh.
2110                 case "$sh" in
2111                 '') sh="$tmp_sh" ;;
2112                 esac
2113                 hint=previous
2114                 ;;
2115         esac
2116 fi
2117 if test ! -f config.sh; then
2118         $cat <<EOM
2119
2120 First time through, eh?  I have some defaults handy for some systems
2121 that need some extra help getting the Configure answers right:
2122
2123 EOM
2124         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2125         dflt=''
2126         : Half the following guesses are probably wrong... If you have better
2127         : tests or hints, please send them to perlbug@perl.com
2128         : The metaconfig authors would also appreciate a copy...
2129         $test -f /irix && osname=irix
2130         $test -f /xenix && osname=sco_xenix
2131         $test -f /dynix && osname=dynix
2132         $test -f /dnix && osname=dnix
2133         $test -f /lynx.os && osname=lynxos
2134         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2135         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2136         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2137         $test -f /bin/mips && /bin/mips && osname=mips
2138         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2139                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2140         $test -d /usr/apollo/bin && osname=apollo
2141         $test -f /etc/saf/_sactab && osname=svr4
2142         $test -d /usr/include/minix && osname=minix
2143         if $test -d /MachTen -o -d /MachTen_Folder; then
2144                 osname=machten
2145                 if $test -x /sbin/version; then
2146                         osvers=`/sbin/version | $awk '{print $2}' |
2147                         $sed -e 's/[A-Za-z]$//'`
2148                 elif $test -x /usr/etc/version; then
2149                         osvers=`/usr/etc/version | $awk '{print $2}' |
2150                         $sed -e 's/[A-Za-z]$//'`
2151                 else
2152                         osvers="$2.$3"
2153                 fi
2154         fi
2155
2156         $test -f /sys/posix.dll &&
2157                 $test -f /usr/bin/what &&
2158                 set X `/usr/bin/what /sys/posix.dll` &&
2159                 $test "$3" = UWIN &&
2160                 osname=uwin &&
2161                 osvers="$5"
2162
2163         if $test -f $uname; then
2164                 set X $myuname
2165                 shift
2166
2167                 case "$5" in
2168                 fps*) osname=fps ;;
2169                 mips*)
2170                         case "$4" in
2171                         umips) osname=umips ;;
2172                         *) osname=mips ;;
2173                         esac;;
2174                 [23]100) osname=mips ;;
2175                 next*) osname=next ;;
2176                 i386*)
2177                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2178                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2179                                 osname='sco'
2180                                 osvers=$tmp
2181                         elif $test -f /etc/kconfig; then
2182                                 osname=isc
2183                                 if test "$lns" = "$ln -s"; then
2184                                         osvers=4
2185                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2186                                         osvers=3
2187                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2188                                         osvers=2
2189                                 fi
2190                         fi
2191                         tmp=''
2192                         ;;
2193                 pc*)
2194                         if test -n "$DJGPP"; then
2195                                 osname=dos
2196                                 osvers=djgpp
2197                         fi
2198                         ;;
2199                 esac
2200
2201                 case "$1" in
2202                 aix) osname=aix
2203                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2204                         case "$tmp" in
2205                         'not found') osvers="$4"."$3" ;;
2206                         '<3240'|'<>3240') osvers=3.2.0 ;;
2207                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2208                         '=3250'|'>3250') osvers=3.2.5 ;;
2209                         *) osvers=$tmp;;
2210                         esac
2211                         ;;
2212                 bsd386) osname=bsd386
2213                         osvers=`$uname -r`
2214                         ;;
2215                 cygwin*) osname=cygwin
2216                         osvers="$3"
2217                         ;;
2218                 *dc.osx) osname=dcosx
2219                         osvers="$3"
2220                         ;;
2221                 dnix) osname=dnix
2222                         osvers="$3"
2223                         ;;
2224                 domainos) osname=apollo
2225                         osvers="$3"
2226                         ;;
2227                 dgux) osname=dgux 
2228                         osvers="$3"
2229                         ;;
2230                 dynixptx*) osname=dynixptx
2231                         osvers=`echo "$4"|sed 's/^v//'`
2232                         ;;
2233                 freebsd) osname=freebsd 
2234                         osvers="$3" ;;
2235                 genix) osname=genix ;;
2236                 hp*) osname=hpux 
2237                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2238                         ;;
2239                 irix*) osname=irix
2240                         case "$3" in
2241                         4*) osvers=4 ;;
2242                         5*) osvers=5 ;;
2243                         *)      osvers="$3" ;;
2244                         esac
2245                         ;;
2246                 linux) osname=linux
2247                         case "$3" in
2248                         *)      osvers="$3" ;;
2249                         esac
2250                         ;;
2251                 MiNT) osname=mint
2252                         ;;
2253                 netbsd*) osname=netbsd
2254                         osvers="$3"
2255                         ;;
2256                 news-os) osvers="$3"
2257                         case "$3" in
2258                         4*) osname=newsos4 ;;
2259                         *) osname=newsos ;;
2260                         esac
2261                         ;;
2262                 next*) osname=next ;;
2263                 POSIX-BC | posix-bc ) osname=posix-bc
2264                         osvers="$3"
2265                         ;;
2266                 powerux | power_ux | powermax_os | powermaxos | \
2267                 powerunix | power_unix) osname=powerux
2268                         osvers="$3"
2269                         ;;
2270                 qnx) osname=qnx
2271                         osvers="$4"
2272                         ;;
2273                 solaris) osname=solaris
2274                         case "$3" in
2275                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2276                         *)      osvers="$3" ;;
2277                         esac
2278                         ;;
2279                 sunos) osname=sunos
2280                         case "$3" in
2281                         5*) osname=solaris
2282                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2283                         *)      osvers="$3" ;;
2284                         esac
2285                         ;;
2286                 titanos) osname=titanos
2287                         case "$3" in
2288                         1*) osvers=1 ;;
2289                         2*) osvers=2 ;;
2290                         3*) osvers=3 ;;
2291                         4*) osvers=4 ;;
2292                         *)      osvers="$3" ;;
2293                         esac
2294                         ;;
2295                 ultrix) osname=ultrix
2296                         osvers="$3"
2297                         ;;
2298                 osf1|mls+)      case "$5" in
2299                                 alpha)
2300                                         osname=dec_osf
2301                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2302                                         ;;
2303                         hp*)    osname=hp_osf1  ;;
2304                         mips)   osname=mips_osf1 ;;
2305                         esac
2306                         ;;
2307                 unixware) osname=svr5
2308                         osvers="$4"
2309                         ;;
2310                 uts) osname=uts
2311                         osvers="$3"
2312                         ;;
2313                 $2) case "$osname" in
2314                         *isc*) ;;
2315                         *freebsd*) ;;
2316                         svr*)
2317                                 : svr4.x or possibly later
2318                                 case "svr$3" in 
2319                                 ${osname}*)
2320                                         osname=svr$3
2321                                         osvers=$4
2322                                         ;;
2323                                 esac
2324                                 case "$osname" in
2325                                 svr4.0)
2326                                         : Check for ESIX
2327                                         if test -f /stand/boot ; then
2328                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2329                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2330                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2331                                                         if test -n "$isesix"; then
2332                                                                 osname=esix4
2333                                                         fi
2334                                                 fi
2335                                         fi
2336                                         ;;
2337                                 esac
2338                                 ;;
2339                         *)      if test -f /etc/systemid; then
2340                                         osname=sco
2341                                         set `echo $3 | $sed 's/\./ /g'` $4
2342                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2343                                                 osvers=$1.$2.$3
2344                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2345                                                 osvers=$1.$2
2346                                         elif $test -f $src/hints/sco_$1.sh; then
2347                                                 osvers=$1
2348                                         fi
2349                                 else
2350                                         case "$osname" in
2351                                         '') : Still unknown.  Probably a generic Sys V.
2352                                                 osname="sysv"
2353                                                 osvers="$3"
2354                                                 ;;
2355                                         esac
2356                                 fi
2357                                 ;;
2358                         esac
2359                         ;;
2360                 *)      case "$osname" in
2361                         '') : Still unknown.  Probably a generic BSD.
2362                                 osname="$1"
2363                                 osvers="$3"
2364                                 ;;
2365                         esac
2366                         ;;
2367                 esac
2368         else
2369                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2370                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2371                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2372                                 osname=news_os
2373                         fi
2374                         $rm -f UU/kernel.what
2375                 elif test -d c:/.; then
2376                         set X $myuname
2377                         osname=os2
2378                         osvers="$5"
2379                 fi
2380         fi
2381         
2382         : Now look for a hint file osname_osvers, unless one has been
2383         : specified already.
2384         case "$hintfile" in
2385         ''|' ')
2386                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2387                 : Also try without trailing minor version numbers.
2388                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2389                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2390                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2391                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2392                 case "$file" in
2393                 '') dflt=none ;;
2394                 *)  case "$osvers" in
2395                         '') dflt=$file
2396                                 ;;
2397                         *)  if $test -f $src/hints/$file.sh ; then
2398                                         dflt=$file
2399                                 elif $test -f $src/hints/$xfile.sh ; then
2400                                         dflt=$xfile
2401                                 elif $test -f $src/hints/$xxfile.sh ; then
2402                                         dflt=$xxfile
2403                                 elif $test -f $src/hints/$xxxfile.sh ; then
2404                                         dflt=$xxxfile
2405                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2406                                         dflt=$xxxxfile
2407                                 elif $test -f "$src/hints/${osname}.sh" ; then
2408                                         dflt="${osname}"
2409                                 else
2410                                         dflt=none
2411                                 fi
2412                                 ;;
2413                         esac
2414                         ;;
2415                 esac
2416                 if $test -f Policy.sh ; then
2417                         case "$dflt" in
2418                         *Policy*) ;;
2419                         none) dflt="Policy" ;;
2420                         *) dflt="Policy $dflt" ;;
2421                         esac
2422                 fi
2423                 ;;
2424         *)
2425                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2426                 ;;
2427         esac
2428
2429         if $test -f Policy.sh ; then
2430                 $cat <<EOM
2431
2432 There's also a Policy hint file available, which should make the
2433 site-specific (policy) questions easier to answer.
2434 EOM
2435
2436         fi
2437
2438         $cat <<EOM
2439
2440 You may give one or more space-separated answers, or "none" if appropriate.
2441 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2442 is a good thing.  DO NOT give a wrong version or a wrong OS.
2443
2444 EOM
2445
2446         rp="Which of these apply, if any?"
2447         . UU/myread
2448         tans=$ans
2449         for file in $tans; do
2450                 if $test X$file = XPolicy -a -f Policy.sh; then
2451                         . Policy.sh
2452                         $cat Policy.sh >> UU/config.sh
2453                 elif $test -f $src/hints/$file.sh; then
2454                         . $src/hints/$file.sh
2455                         $cat $src/hints/$file.sh >> UU/config.sh
2456                 elif $test X$tans = X -o X$tans = Xnone ; then
2457                         : nothing
2458                 else
2459                         : Give one chance to correct a possible typo.
2460                         echo "$file.sh does not exist"
2461                         dflt=$file
2462                         rp="hint to use instead?"
2463                         . UU/myread
2464                         for file in $ans; do
2465                                 if $test -f "$src/hints/$file.sh"; then
2466                                         . $src/hints/$file.sh
2467                                         $cat $src/hints/$file.sh >> UU/config.sh
2468                                 elif $test X$ans = X -o X$ans = Xnone ; then
2469                                         : nothing
2470                                 else
2471                                         echo "$file.sh does not exist -- ignored."
2472                                 fi
2473                         done
2474                 fi
2475         done
2476
2477         hint=recommended
2478         : Remember our hint file for later.
2479         if $test -f "$src/hints/$file.sh" ; then
2480                 hintfile="$file"
2481         else
2482                 hintfile=''
2483         fi
2484 fi
2485 cd UU
2486 ;;
2487 *)
2488         echo " "
2489         echo "Fetching default answers from $config_sh..." >&4
2490         tmp_n="$n"
2491         tmp_c="$c"
2492         cd ..
2493         cp $config_sh config.sh 2>/dev/null
2494         chmod +w config.sh
2495         . ./config.sh
2496         cd UU
2497         cp ../config.sh .
2498         n="$tmp_n"
2499         c="$tmp_c"
2500         hint=previous
2501         ;;
2502 esac
2503 test "$override" && . ./optdef.sh
2504 myuname="$newmyuname"
2505
2506 : Restore computed paths
2507 for file in $loclist $trylist; do
2508         eval $file="\$_$file"
2509 done
2510
2511 cat << EOM
2512
2513 Configure uses the operating system name and version to set some defaults.
2514 The default value is probably right if the name rings a bell. Otherwise,
2515 since spelling matters for me, either accept the default or answer "none"
2516 to leave it blank.
2517
2518 EOM
2519 case "$osname" in
2520         ''|' ')
2521                 case "$hintfile" in
2522                 ''|' '|none) dflt=none ;;
2523                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2524                 esac
2525                 ;;
2526         *) dflt="$osname" ;;
2527 esac
2528 rp="Operating system name?"
2529 . ./myread
2530 case "$ans" in
2531 none)  osname='' ;;
2532 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2533 esac
2534 echo " "
2535 case "$osvers" in
2536         ''|' ')
2537                 case "$hintfile" in
2538                 ''|' '|none) dflt=none ;;
2539                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2540                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2541                         case "$dflt" in
2542                         ''|' ') dflt=none ;;
2543                         esac
2544                         ;;
2545                 esac
2546                 ;;
2547         *) dflt="$osvers" ;;
2548 esac
2549 rp="Operating system version?"
2550 . ./myread
2551 case "$ans" in
2552 none)  osvers='' ;;
2553 *) osvers="$ans" ;;
2554 esac
2555
2556
2557 . ./posthint.sh
2558
2559 : who configured the system
2560 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2561 cf_by=`(logname) 2>/dev/null`
2562 case "$cf_by" in
2563 "")
2564         cf_by=`(whoami) 2>/dev/null`
2565         case "$cf_by" in
2566         "") cf_by=unknown ;;
2567         esac ;;
2568 esac
2569
2570 : set up the script used to warn in case of inconsistency
2571 cat <<EOS >whoa
2572 $startsh
2573 EOS
2574 cat <<'EOSC' >>whoa
2575 dflt=y
2576 echo " "
2577 echo "*** WHOA THERE!!! ***" >&4
2578 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2579 rp="    Keep the $hint value?"
2580 . ./myread
2581 case "$ans" in
2582 y) td=$was; tu=$was;;
2583 esac
2584 EOSC
2585
2586 : function used to set $1 to $val
2587 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2588 case "$val$was" in
2589 $define$undef) . ./whoa; eval "$var=\$td";;
2590 $undef$define) . ./whoa; eval "$var=\$tu";;
2591 *) eval "$var=$val";;
2592 esac'
2593
2594 cat <<EOM
2595
2596 Perl can be built to take advantage of threads, on some systems.
2597 To do so, Configure must be run with -Dusethreads.
2598
2599 Note that threading is a highly experimental feature, and
2600 some known race conditions still remain.  If you choose to try
2601 it, be very sure to not actually deploy it for production
2602 purposes.  README.threads has more details, and is required
2603 reading if you enable threads.
2604 EOM
2605 case "$usethreads" in
2606 $define|true|[yY]*)     dflt='y';;
2607 *) dflt='n';;
2608 esac
2609 rp='Build a threading Perl?'
2610 . ./myread
2611 case "$ans" in
2612 y|Y)    val="$define" ;;
2613 *)      val="$undef" ;;
2614 esac
2615 set usethreads
2616 eval $setvar
2617
2618 case "$usethreads" in
2619 $define)
2620         $cat <<EOM
2621
2622 As of 5.5.640, Perl has two different internal threading implementations,
2623 the 5.005 version (5005threads) and an interpreter-based version
2624 (ithreads) that has one interpreter per thread.  Both are very 
2625 experimental.  This arrangement exists to help developers work out
2626 which one is better.
2627 EOM
2628         : Default to ithreads unless overridden on command line or with
2629         : old config.sh
2630         dflt='y'
2631         case "$use5005threads" in
2632                 $define|true|[yY]*) dflt='n';;
2633         esac
2634         case "$useithreads" in
2635                 $undef|false|[nN]*) dflt='n';;
2636         esac
2637         rp='Use interpreter-based ithreads?'
2638         . ./myread
2639         case "$ans" in
2640         y|Y)    val="$define" ;;
2641         *)      val="$undef" ;;
2642         esac
2643         set useithreads
2644         eval $setvar
2645         : Now set use5005threads to the opposite value.
2646         case "$useithreads" in
2647         $define) val="$undef" ;;
2648         *) val="$define" ;;
2649         esac
2650         set use5005threads
2651         eval $setvar
2652         ;;
2653 *)
2654         useithreads="$undef"
2655         use5005threads="$undef"
2656         ;;
2657 esac
2658
2659 case "$d_oldpthreads" in
2660 '')     : Configure tests would be welcome here.  For now, assume undef.
2661         val="$undef" ;;
2662 *)      val="$d_oldpthreads" ;;
2663 esac
2664 set d_oldpthreads
2665 eval $setvar
2666
2667
2668 case "$usethreads" in
2669 "$define"|true|[yY]*)
2670 : Look for a hint-file generated 'call-back-unit'.  If the
2671 : user has specified that a threading perl is to be built,
2672 : we may need to set or change some other defaults.
2673         if $test -f usethreads.cbu; then
2674                 echo "Your platform has some specific hints for threaded builds, using them..."
2675                 . ./usethreads.cbu
2676         else
2677                 $cat <<EOM
2678 (Your platform doesn't have any specific hints for threaded builds.
2679  Assuming POSIX threads, then.)
2680 EOM
2681         fi
2682         ;;
2683 esac
2684
2685 cat <<EOM
2686
2687 Perl can be built so that multiple Perl interpreters can coexist
2688 within the same Perl executable.
2689 EOM
2690
2691 case "$useithreads" in
2692 $define)
2693         cat <<EOM
2694 This multiple interpreter support is required for interpreter-based threads.
2695 EOM
2696         val="$define"
2697         ;;
2698 *)
2699         echo 'Normally you do not need this and you should answer no.'
2700         case "$usemultiplicity" in
2701         $define|true|[yY]*)     dflt='y';;
2702         *) dflt='n';;
2703         esac
2704         rp='Build Perl for multiplicity?'
2705         . ./myread
2706         case "$ans" in
2707         y|Y)    val="$define" ;;
2708         *)      val="$undef" ;;
2709         esac
2710         ;;
2711 esac
2712 set usemultiplicity
2713 eval $setvar
2714
2715 : determine where manual pages are on this system
2716 echo " "
2717 case "$sysman" in
2718 '') 
2719         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2720         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2721         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2722         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2723         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2724         sysman=`./loc . /usr/man/man1 $syspath`
2725         ;;
2726 esac
2727 if $test -d "$sysman"; then
2728         echo "System manual is in $sysman." >&4
2729 else
2730         echo "Could not find manual pages in source form." >&4
2731 fi
2732
2733 : see what memory models we can support
2734 case "$models" in
2735 '')
2736         $cat >pdp11.c <<'EOP'
2737 int main() {
2738 #ifdef pdp11
2739         exit(0);
2740 #else
2741         exit(1);
2742 #endif
2743 }
2744 EOP
2745         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2746         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2747                 dflt='unsplit split'
2748         else
2749                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2750                 case "$tans" in
2751                 X) dflt='none';;
2752                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2753                                 dflt='small'
2754                         else
2755                                 dflt=''
2756                         fi
2757                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2758                                 dflt="$dflt medium"
2759                         fi
2760                         if $test -d /lib/large || $test -d /usr/lib/large; then
2761                                 dflt="$dflt large"
2762                         fi
2763                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2764                                 dflt="$dflt huge"
2765                         fi
2766                 esac
2767         fi;;
2768 *) dflt="$models";;
2769 esac
2770 $cat <<EOM
2771  
2772 Some systems have different model sizes.  On most systems they are called
2773 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2774 split.  If your system doesn't support different memory models, say "none".
2775 If you wish to force everything to one memory model, say "none" here and
2776 put the appropriate flags later when it asks you for other cc and ld flags.
2777 Venix systems may wish to put "none" and let the compiler figure things out.
2778 (In the following question multiple model names should be space separated.)
2779
2780 The default for most systems is "none".
2781
2782 EOM
2783 rp="Which memory models are supported?"
2784 . ./myread
2785 models="$ans"
2786
2787 case "$models" in
2788 none)
2789         small=''
2790         medium=''
2791         large=''
2792         huge=''
2793         unsplit=''
2794         split=''
2795         ;;
2796 *split)
2797         case "$split" in
2798         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2799                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2800                         dflt='-i'
2801                 else
2802                         dflt='none'
2803                 fi;;
2804         *) dflt="$split";;
2805         esac
2806         rp="What flag indicates separate I and D space?"
2807         . ./myread
2808         tans="$ans"
2809         case "$tans" in
2810         none) tans='';;
2811         esac
2812         split="$tans"
2813         unsplit='';;
2814 *large*|*small*|*medium*|*huge*)
2815         case "$models" in
2816         *large*)
2817                 case "$large" in
2818                 '') dflt='-Ml';;
2819                 *) dflt="$large";;
2820                 esac
2821         rp="What flag indicates large model?"
2822         . ./myread
2823         tans="$ans"
2824         case "$tans" in
2825         none) tans='';
2826         esac
2827         large="$tans";;
2828         *) large='';;
2829         esac
2830         case "$models" in
2831         *huge*) case "$huge" in
2832                 '') dflt='-Mh';;
2833                 *) dflt="$huge";;
2834                 esac
2835                 rp="What flag indicates huge model?"
2836                 . ./myread
2837                 tans="$ans"
2838                 case "$tans" in
2839                 none) tans='';
2840                 esac
2841                 huge="$tans";;
2842         *) huge="$large";;
2843         esac
2844         case "$models" in
2845         *medium*) case "$medium" in
2846                 '') dflt='-Mm';;
2847                 *) dflt="$medium";;
2848                 esac
2849                 rp="What flag indicates medium model?"
2850                 . ./myread
2851                 tans="$ans"
2852                 case "$tans" in
2853                 none) tans='';
2854                 esac
2855                 medium="$tans";;
2856         *) medium="$large";;
2857         esac
2858         case "$models" in
2859         *small*) case "$small" in
2860                 '') dflt='none';;
2861                 *) dflt="$small";;
2862                 esac
2863                 rp="What flag indicates small model?"
2864                 . ./myread
2865                 tans="$ans"
2866                 case "$tans" in
2867                 none) tans='';
2868                 esac
2869                 small="$tans";;
2870         *) small='';;
2871         esac
2872         ;;
2873 *)
2874         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2875         ;;
2876 esac
2877 $rm -f pdp11.* pdp11
2878
2879 : make some quick guesses about what we are up against
2880 echo " "
2881 $echo $n "Hmm...  $c"
2882 echo exit 1 >bsd
2883 echo exit 1 >usg
2884 echo exit 1 >v7
2885 echo exit 1 >osf1
2886 echo exit 1 >eunice
2887 echo exit 1 >xenix
2888 echo exit 1 >venix
2889 echo exit 1 >os2
2890 d_bsd="$undef"
2891 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2892 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2893 then
2894         echo "Looks kind of like an OSF/1 system, but we'll see..."
2895         echo exit 0 >osf1
2896 elif test `echo abc | tr a-z A-Z` = Abc ; then
2897         xxx=`./loc addbib blurfl $pth`
2898         if $test -f $xxx; then
2899         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2900                 echo exit 0 >bsd
2901                 echo exit 0 >usg
2902         else
2903                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2904                         echo "Looks kind of like an extended USG system, but we'll see..."
2905                 else
2906                         echo "Looks kind of like a USG system, but we'll see..."
2907                 fi
2908                 echo exit 0 >usg
2909         fi
2910 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2911         echo "Looks kind of like a BSD system, but we'll see..."
2912         d_bsd="$define"
2913         echo exit 0 >bsd
2914 else
2915         echo "Looks kind of like a Version 7 system, but we'll see..."
2916         echo exit 0 >v7
2917 fi
2918 case "$eunicefix" in
2919 *unixtovms*)
2920         $cat <<'EOI'
2921 There is, however, a strange, musty smell in the air that reminds me of
2922 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2923 EOI
2924         echo exit 0 >eunice
2925         d_eunice="$define"
2926 : it so happens the Eunice I know will not run shell scripts in Unix format
2927         ;;
2928 *)
2929         echo " "
2930         echo "Congratulations.  You aren't running Eunice."
2931         d_eunice="$undef"
2932         ;;
2933 esac
2934 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2935 case "$p_" in
2936 :) ;;
2937 *)
2938         $cat <<'EOI'
2939 I have the feeling something is not exactly right, however...don't tell me...
2940 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2941 EOI
2942         echo exit 0 >os2
2943         ;;
2944 esac
2945 if test -f /xenix; then
2946         echo "Actually, this looks more like a XENIX system..."
2947         echo exit 0 >xenix
2948         d_xenix="$define"
2949 else
2950         echo " "
2951         echo "It's not Xenix..."
2952         d_xenix="$undef"
2953 fi
2954 chmod +x xenix
2955 $eunicefix xenix
2956 if test -f /venix; then
2957         echo "Actually, this looks more like a VENIX system..."
2958         echo exit 0 >venix
2959 else
2960         echo " "
2961         if ./xenix; then
2962                 : null
2963         else
2964                 echo "Nor is it Venix..."
2965         fi
2966 fi
2967 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2968 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2969 $rm -f foo
2970
2971 : see if we need a special compiler
2972 echo " "
2973 if ./usg; then
2974         case "$cc" in
2975         '') case "$Mcc" in
2976                 /*) dflt='Mcc';;
2977                 *) case "$large" in
2978                         -M*) dflt='cc';;
2979                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2980                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2981                                                 dflt='cc'
2982                                         else
2983                                                 dflt='cc -M'
2984                                         fi
2985                                 else
2986                                         dflt='cc'
2987                                 fi;;
2988                         esac;;
2989                 esac;;
2990         *)  dflt="$cc";;
2991         esac
2992         case "$dflt" in
2993         *M*)    $cat <<'EOM'
2994 On some older systems the default C compiler will not resolve multiple global
2995 references that happen to have the same name.  On some such systems the "Mcc"
2996 command may be used to force these to be resolved.  On other systems a "cc -M"
2997 command is required.  (Note that the -M flag on other systems indicates a
2998 memory model to use!) If you have the Gnu C compiler, you might wish to use
2999 that instead.
3000
3001 EOM
3002         ;;
3003         esac
3004         rp="Use which C compiler?"
3005         . ./myread
3006         cc="$ans"
3007 else
3008         case "$cc" in
3009         '') dflt=cc;;
3010         *) dflt="$cc";;
3011         esac
3012         rp="Use which C compiler?"
3013         . ./myread
3014         cc="$ans"
3015 fi
3016 : Look for a hint-file generated 'call-back-unit'.  Now that the
3017 : user has specified the compiler, we may need to set or change some
3018 : other defaults.
3019 if $test -f cc.cbu; then
3020     . ./cc.cbu
3021 fi
3022 echo " "
3023 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3024 $cat >gccvers.c <<EOM
3025 #include <stdio.h>
3026 int main() {
3027 #ifdef __GNUC__
3028 #ifdef __VERSION__
3029         printf("%s\n", __VERSION__);
3030 #else
3031         printf("%s\n", "1");
3032 #endif
3033 #endif
3034         exit(0);
3035 }
3036 EOM
3037 if $cc -o gccvers gccvers.c; then
3038         gccversion=`./gccvers`
3039         case "$gccversion" in
3040         '') echo "You are not using GNU cc." ;;
3041         *)  echo "You are using GNU cc $gccversion."
3042             ;;
3043         esac
3044 else
3045         echo " "
3046         echo "*** WHOA THERE!!! ***" >&4
3047         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3048         case "$knowitall" in
3049         '')
3050         echo "    You'd better start hunting for one and let me know about it." >&4
3051                 exit 1
3052                 ;;
3053         esac
3054 fi
3055 $rm -f gccvers*
3056 case "$gccversion" in
3057 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3058 esac
3059
3060 : decide how portable to be.  Allow command line overrides.
3061 case "$d_portable" in
3062 "$undef") ;;
3063 *)      d_portable="$define" ;;
3064 esac
3065
3066 : set up shell script to do ~ expansion
3067 cat >filexp <<EOSS
3068 $startsh
3069 : expand filename
3070 case "\$1" in
3071  ~/*|~)
3072         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3073         ;;
3074  ~*)
3075         if $test -f /bin/csh; then
3076                 /bin/csh -f -c "glob \$1"
3077                 failed=\$?
3078                 echo ""
3079                 exit \$failed
3080         else
3081                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3082                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3083                 if $test ! -d "\$dir"; then
3084                         me=\`basename \$0\`
3085                         echo "\$me: can't locate home directory for: \$name" >&2
3086                         exit 1
3087                 fi
3088                 case "\$1" in
3089                 */*)
3090                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3091                         ;;
3092                 *)
3093                         echo \$dir
3094                         ;;
3095                 esac
3096         fi
3097         ;;
3098 *)
3099         echo \$1
3100         ;;
3101 esac
3102 EOSS
3103 chmod +x filexp
3104 $eunicefix filexp
3105
3106 : now set up to get a file name
3107 cat <<EOS >getfile
3108 $startsh
3109 EOS
3110 cat <<'EOSC' >>getfile
3111 tilde=''
3112 fullpath=''
3113 already=''
3114 skip=''
3115 none_ok=''
3116 exp_file=''
3117 nopath_ok=''
3118 orig_rp="$rp"
3119 orig_dflt="$dflt"
3120 case "$gfpth" in
3121 '') gfpth='.' ;;
3122 esac
3123
3124 case "$fn" in
3125 *\(*)
3126         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3127         fn=`echo $fn | sed 's/(.*)//'`
3128         ;;
3129 esac
3130
3131 case "$fn" in
3132 *:*)
3133         loc_file=`expr $fn : '.*:\(.*\)'`
3134         fn=`expr $fn : '\(.*\):.*'`
3135         ;;
3136 esac
3137
3138 case "$fn" in
3139 *~*) tilde=true;;
3140 esac
3141 case "$fn" in
3142 */*) fullpath=true;;
3143 esac
3144 case "$fn" in
3145 *+*) skip=true;;
3146 esac
3147 case "$fn" in
3148 *n*) none_ok=true;;
3149 esac
3150 case "$fn" in
3151 *e*) exp_file=true;;
3152 esac
3153 case "$fn" in
3154 *p*) nopath_ok=true;;
3155 esac
3156
3157 case "$fn" in
3158 *f*) type='File';;
3159 *d*) type='Directory';;
3160 *l*) type='Locate';;
3161 esac
3162
3163 what="$type"
3164 case "$what" in
3165 Locate) what='File';;
3166 esac
3167
3168 case "$exp_file" in
3169 '')
3170         case "$d_portable" in
3171         "$define") ;;
3172         *) exp_file=true;;
3173         esac
3174         ;;
3175 esac
3176
3177 cd ..
3178 while test "$type"; do
3179         redo=''
3180         rp="$orig_rp"
3181         dflt="$orig_dflt"
3182         case "$tilde" in
3183         true) rp="$rp (~name ok)";;
3184         esac
3185         . UU/myread
3186         if test -f UU/getfile.ok && \
3187                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3188         then
3189                 value="$ans"
3190                 ansexp="$ans"
3191                 break
3192         fi
3193         case "$ans" in
3194         none)
3195                 value=''
3196                 ansexp=''
3197                 case "$none_ok" in
3198                 true) type='';;
3199                 esac
3200                 ;;
3201         *)
3202                 case "$tilde" in
3203                 '') value="$ans"
3204                         ansexp="$ans";;
3205                 *)
3206                         value=`UU/filexp $ans`
3207                         case $? in
3208                         0)
3209                                 if test "$ans" != "$value"; then
3210                                         echo "(That expands to $value on this system.)"
3211                                 fi
3212                                 ;;
3213                         *) value="$ans";;
3214                         esac
3215                         ansexp="$value"
3216                         case "$exp_file" in
3217                         '') value="$ans";;
3218                         esac
3219                         ;;
3220                 esac
3221                 case "$fullpath" in
3222                 true)
3223                         case "$ansexp" in
3224                         /*) value="$ansexp" ;;
3225                         *)
3226                                 redo=true
3227                                 case "$already" in
3228                                 true)
3229                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3230                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3231                                         ;;
3232                                 *)
3233                                 echo "Please give a full path name, starting with slash." >&4
3234                                         case "$tilde" in
3235                                         true)
3236                                 echo "Note that using ~name is ok provided it expands well." >&4
3237                                                 already=true
3238                                                 ;;
3239                                         esac
3240                                 esac
3241                                 ;;
3242                         esac
3243                         ;;
3244                 esac
3245                 case "$redo" in
3246                 '')
3247                         case "$type" in
3248                         File)
3249                                 for fp in $gfpth; do
3250                                         if test "X$fp" = X.; then
3251                                             pf="$ansexp"
3252                                         else    
3253                                             pf="$fp/$ansexp"
3254                                         fi
3255                                         if test -f "$pf"; then
3256                                                 type=''
3257                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3258                                         then
3259                                                 echo "($value is not a plain file, but that's ok.)"
3260                                                 type=''
3261                                         fi
3262                                         if test X"$type" = X; then
3263                                             value="$pf"
3264                                             break
3265                                         fi
3266                                 done
3267                                 ;;
3268                         Directory)
3269                                 for fp in $gfpth; do
3270                                         if test "X$fp" = X.; then
3271                                             pf="$ansexp"
3272                                         else    
3273                                             pf="$fp/$ansexp"
3274                                         fi
3275                                         if test -d "$pf"; then
3276                                                 type=''
3277                                                 value="$pf"
3278                                                 break
3279                                         fi
3280                                 done
3281                                 ;;
3282                         Locate)
3283                                 if test -d "$ansexp"; then
3284                                         echo "(Looking for $loc_file in directory $value.)"
3285                                         value="$value/$loc_file"
3286                                         ansexp="$ansexp/$loc_file"
3287                                 fi
3288                                 if test -f "$ansexp"; then
3289                                         type=''
3290                                 fi
3291                                 case "$nopath_ok" in
3292                                 true)   case "$value" in
3293                                         */*) ;;
3294                                         *)      echo "Assuming $value will be in people's path."
3295                                                 type=''
3296                                                 ;;
3297                                         esac
3298                                         ;;
3299                                 esac
3300                                 ;;
3301                         esac
3302
3303                         case "$skip" in
3304                         true) type='';
3305                         esac
3306
3307                         case "$type" in
3308                         '') ;;
3309                         *)
3310                                 if test "$fastread" = yes; then
3311                                         dflt=y
3312                                 else
3313                                         dflt=n
3314                                 fi
3315                                 rp="$what $value doesn't exist.  Use that name anyway?"
3316                                 . UU/myread
3317                                 dflt=''
3318                                 case "$ans" in
3319                                 y*) type='';;
3320                                 *) echo " ";;
3321                                 esac
3322                                 ;;
3323                         esac
3324                         ;;
3325                 esac
3326                 ;;
3327         esac
3328 done
3329 cd UU
3330 ans="$value"
3331 rp="$orig_rp"
3332 dflt="$orig_dflt"
3333 rm -f getfile.ok
3334 test "X$gfpthkeep" != Xy && gfpth=""
3335 EOSC
3336
3337 : What should the include directory be ?
3338 echo " "
3339 $echo $n "Hmm...  $c"
3340 dflt='/usr/include'
3341 incpath=''
3342 mips_type=''
3343 if $test -f /bin/mips && /bin/mips; then
3344         echo "Looks like a MIPS system..."
3345         $cat >usr.c <<'EOCP'
3346 #ifdef SYSTYPE_BSD43
3347 /bsd43
3348 #endif
3349 EOCP
3350         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3351                 dflt='/bsd43/usr/include'
3352                 incpath='/bsd43'
3353                 mips_type='BSD 4.3'
3354         else
3355                 mips_type='System V'
3356         fi
3357         $rm -f usr.c usr.out
3358         echo "and you're compiling with the $mips_type compiler and libraries."
3359         xxx_prompt=y
3360         echo "exit 0" >mips
3361 else
3362         echo "Doesn't look like a MIPS system."
3363         xxx_prompt=n
3364         echo "exit 1" >mips
3365 fi
3366 chmod +x mips
3367 $eunicefix mips
3368 case "$usrinc" in
3369 '') ;;
3370 *) dflt="$usrinc";;
3371 esac
3372 case "$xxx_prompt" in
3373 y)      fn=d/
3374         echo " "
3375         rp='Where are the include files you want to use?'
3376         . ./getfile
3377         usrinc="$ans"
3378         ;;
3379 *)      usrinc="$dflt"
3380         ;;
3381 esac
3382
3383 : see how we invoke the C preprocessor
3384 echo " "
3385 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3386 cat <<'EOT' >testcpp.c
3387 #define ABC abc
3388 #define XYZ xyz
3389 ABC.XYZ
3390 EOT
3391 cd ..
3392 if test ! -f cppstdin; then
3393         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3394                 # AIX cc -E doesn't show the absolute headerfile
3395                 # locations but we'll cheat by using the -M flag.
3396                 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
3397         else
3398                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3399         fi
3400 else
3401         echo "Keeping your $hint cppstdin wrapper."
3402 fi
3403 chmod 755 cppstdin
3404 wrapper=`pwd`/cppstdin
3405 ok='false'
3406 cd UU
3407
3408 if $test "X$cppstdin" != "X" && \
3409         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3410         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3411 then
3412         echo "You used to use $cppstdin $cppminus so we'll use that again."
3413         case "$cpprun" in
3414         '') echo "But let's see if we can live without a wrapper..." ;;
3415         *)
3416                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3417                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3418                 then
3419                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3420                         ok='true'
3421                 else
3422                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3423                 fi
3424                 ;;
3425         esac
3426 else
3427         case "$cppstdin" in
3428         '') ;;
3429         *)
3430                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3431                 ;;
3432         esac
3433 fi
3434
3435 if $ok; then
3436         : nothing
3437 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3438         $cc -E <testcpp.c >testcpp.out 2>&1; \
3439         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3440         echo "Yup, it does."
3441         x_cpp="$cc -E"
3442         x_minus='';
3443 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3444         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3445         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3446         echo "Yup, it does."
3447         x_cpp="$cc -E"
3448         x_minus='-';
3449 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3450         $cc -P <testcpp.c >testcpp.out 2>&1; \
3451         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3452         echo "Yipee, that works!"
3453         x_cpp="$cc -P"
3454         x_minus='';
3455 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3456         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3457         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3458         echo "At long last!"
3459         x_cpp="$cc -P"
3460         x_minus='-';
3461 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3462         $cpp <testcpp.c >testcpp.out 2>&1; \
3463         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3464         echo "It works!"
3465         x_cpp="$cpp"
3466         x_minus='';
3467 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3468         $cpp - <testcpp.c >testcpp.out 2>&1; \
3469         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3470         echo "Hooray, it works!  I was beginning to wonder."
3471         x_cpp="$cpp"
3472         x_minus='-';
3473 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3474         $wrapper <testcpp.c >testcpp.out 2>&1; \
3475         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3476         x_cpp="$wrapper"
3477         x_minus=''
3478         echo "Eureka!"
3479 else
3480         dflt=''
3481         rp="No dice.  I can't find a C preprocessor.  Name one:"
3482         . ./myread
3483         x_cpp="$ans"
3484         x_minus=''
3485         $x_cpp <testcpp.c >testcpp.out 2>&1
3486         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3487                 echo "OK, that will do." >&4
3488         else
3489 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3490                 exit 1
3491         fi
3492 fi
3493
3494 case "$ok" in
3495 false)
3496         cppstdin="$x_cpp"
3497         cppminus="$x_minus"
3498         cpprun="$x_cpp"
3499         cpplast="$x_minus"
3500         set X $x_cpp
3501         shift
3502         case "$1" in
3503         "$cpp")
3504                 echo "Perhaps can we force $cc -E using a wrapper..."
3505                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3506                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3507                 then
3508                         echo "Yup, we can."
3509                         cppstdin="$wrapper"
3510                         cppminus='';
3511                 else
3512                         echo "Nope, we'll have to live without it..."
3513                 fi
3514                 ;;
3515         esac
3516         case "$cpprun" in
3517         "$wrapper")
3518                 cpprun=''
3519                 cpplast=''
3520                 ;;
3521         esac
3522         ;;
3523 esac
3524
3525 case "$cppstdin" in
3526 "$wrapper"|'cppstdin') ;;
3527 *) $rm -f $wrapper;;
3528 esac
3529 $rm -f testcpp.c testcpp.out
3530
3531 : Set private lib path
3532 case "$plibpth" in
3533 '') if ./mips; then
3534                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3535         fi;;
3536 esac
3537 case "$libpth" in
3538 ' ') dlist='';;
3539 '') dlist="$loclibpth $plibpth $glibpth";;
3540 *) dlist="$libpth";;
3541 esac
3542
3543 : Now check and see which directories actually exist, avoiding duplicates
3544 libpth=''
3545 for xxx in $dlist
3546 do
3547     if $test -d $xxx; then
3548                 case " $libpth " in
3549                 *" $xxx "*) ;;
3550                 *) libpth="$libpth $xxx";;
3551                 esac
3552     fi
3553 done
3554 $cat <<'EOM'
3555
3556 Some systems have incompatible or broken versions of libraries.  Among
3557 the directories listed in the question below, please remove any you
3558 know not to be holding relevant libraries, and add any that are needed.
3559 Say "none" for none.
3560
3561 EOM
3562 case "$libpth" in
3563 '') dflt='none';;
3564 *)
3565         set X $libpth
3566         shift
3567         dflt=${1+"$@"}
3568         ;;
3569 esac
3570 rp="Directories to use for library searches?"
3571 . ./myread
3572 case "$ans" in
3573 none) libpth=' ';;
3574 *) libpth="$ans";;
3575 esac
3576
3577 : compute shared library extension
3578 case "$so" in
3579 '')
3580         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3581                 dflt='sl'
3582         else
3583                 dflt='so'
3584         fi
3585         ;;
3586 *) dflt="$so";;
3587 esac
3588 $cat <<EOM
3589
3590 On some systems, shared libraries may be available.  Answer 'none' if
3591 you want to suppress searching of shared libraries for the remainder
3592 of this configuration.
3593
3594 EOM
3595 rp='What is the file extension used for shared libraries?'
3596 . ./myread
3597 so="$ans"
3598
3599 : Define several unixisms.
3600 : Hints files or command line option can be used to override them.
3601 : The convoluted testing is in case hints files set either the old
3602 : or the new name.
3603 case "$_exe" in
3604 '')     case "$exe_ext" in
3605     '') ;;
3606         *)      _exe="$exe_ext" ;;
3607         esac
3608         ;;
3609 esac
3610 case "$_a" in
3611 '')     case "$lib_ext" in
3612     '') _a='.a';;
3613         *)      _a="$lib_ext" ;;
3614         esac
3615         ;;
3616 esac
3617 case "$_o" in
3618 '') case "$obj_ext" in
3619         '')     _o='.o';;
3620         *)      _o="$obj_ext";;
3621         esac
3622         ;;
3623 esac
3624 case "$p_" in
3625 '') case "$path_sep" in
3626         '')     p_=':';;
3627         *)      p_="$path_sep";;
3628         esac
3629         ;;
3630 esac
3631 exe_ext=$_exe
3632 lib_ext=$_a
3633 obj_ext=$_o
3634 path_sep=$p_
3635
3636 : Which makefile gets called first.  This is used by make depend.
3637 case "$firstmakefile" in
3638 '') firstmakefile='makefile';;
3639 esac
3640
3641 cat <<EOM
3642
3643 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3644 Configure must be run with -Dusesocks.
3645
3646 Normally you do not need this and you should answer no.
3647
3648 EOM
3649 case "$usesocks" in
3650 $define|true|[yY]*)     dflt='y';;
3651 *) dflt='n';;
3652 esac
3653 rp='Build Perl for SOCKS?'
3654 . ./myread
3655 case "$ans" in
3656 y|Y)    val="$define" ;;     
3657 *)      val="$undef" ;;
3658 esac
3659 set usesocks
3660 eval $setvar
3661
3662 : Looking for optional libraries
3663 echo " "
3664 echo "Checking for optional libraries..." >&4
3665 case "$libs" in
3666 ' '|'') dflt='';;
3667 *) dflt="$libs";;
3668 esac
3669 case "$libswanted" in
3670 '') libswanted='c_s';;
3671 esac
3672 case "$usesocks" in
3673 $define)
3674         libswanted="$libswanted socks5 socks5_sh"
3675         ;;
3676 esac
3677 for thislib in $libswanted; do
3678         
3679         libname="$thislib"
3680         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3681                 if $test -a "X$ignore_versioned_solibs" = "X"; then
3682                         xxx=/ignored/$xxx
3683                 else
3684                         libstyle=shared
3685                 fi
3686         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3687                 libstyle=shared
3688         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3689                 libstyle=static
3690         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3691                 libstyle=static
3692         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3693                 libstyle=static
3694                 libname=${thislib}_s
3695         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3696                 libstyle="static"
3697         fi
3698         if $test -f "$xxx"; then
3699                 if test X"$osname" = Xhpux -a -f /lib/pa20_64/libc.sl; then
3700                         case "`file $xxx`" in
3701                         *LP64*) ;;
3702                         *) xxx=/non/64/bit/$xxx ;;
3703                         esac
3704                 fi
3705         fi
3706         if $test -f "$xxx"; then
3707                 case "$libstyle" in
3708                 shared) echo "Found -l$libname (shared)." ;;
3709                 static) echo "Found -l$libname." ;;
3710                 *)      echo "Found -l$libname ($libstyle)." ;;
3711                 esac
3712                 case " $dflt " in
3713                 *"-l$thislib "*);;
3714                 *) dflt="$dflt -l$libname";;
3715                 esac
3716         else
3717                 echo "No -l$thislib."
3718         fi
3719 done
3720 set X $dflt
3721 shift
3722 dflt="$*"
3723 case "$libs" in
3724 '') dflt="$dflt";;
3725 *) dflt="$libs";;
3726 esac
3727 case "$dflt" in
3728 ' '|'') dflt='none';;
3729 esac
3730
3731 $cat <<EOM
3732
3733 In order to compile $package on your machine, a number of libraries
3734 are usually needed.  Include any other special libraries here as well.
3735 Say "none" for none.  The default list is almost always right.
3736 EOM
3737
3738 echo " "
3739 rp="What libraries to use?"
3740 . ./myread
3741 case "$ans" in
3742 none) libs=' ';;
3743 *) libs="$ans";;
3744 esac
3745
3746 : determine optimization, if desired, or use for debug flag also
3747 case "$optimize" in
3748 ' '|$undef) dflt='none';;
3749 '') dflt='-O';;
3750 *) dflt="$optimize";;
3751 esac
3752 $cat <<EOH
3753
3754 By default, $package compiles with the -O flag to use the optimizer.
3755 Alternately, you might want to use the symbolic debugger, which uses
3756 the -g flag (on traditional Unix systems).  Either flag can be
3757 specified here.  To use neither flag, specify the word "none".
3758
3759 EOH
3760 rp="What optimizer/debugger flag should be used?"
3761 . ./myread
3762 optimize="$ans"
3763 case "$optimize" in
3764 'none') optimize=" ";;
3765 esac
3766
3767 dflt=''
3768 : We will not override a previous value, but we might want to
3769 : augment a hint file
3770 case "$hint" in
3771 default|recommended)
3772         case "$gccversion" in
3773         1*) dflt='-fpcc-struct-return' ;;
3774         esac
3775         case "$optimize" in
3776         *-g*) dflt="$dflt -DDEBUGGING";;
3777         esac
3778         case "$gccversion" in
3779         2*) if test -d /etc/conf/kconfig.d &&
3780                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3781                 then
3782                         dflt="$dflt -posix"
3783                 fi
3784                 ;;
3785         esac
3786         case "$gccversion" in
3787         1*) ;;
3788         2.[0-8]*) ;;
3789         ?*)     echo " "
3790                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3791                 echo 'int main(void) { return 0; }' > gcctest.c
3792                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3793                         echo "Yes, it does." 2>&1
3794                         case "$ccflags" in
3795                         *strict-aliasing*) 
3796                                 echo "Leaving current flags $ccflags alone." 2>&1
3797                                 ;;
3798                         *) dflt="$dflt -fno-strict-aliasing" ;;
3799                         esac
3800                 else
3801                         echo "Nope, it doesn't, but that's ok." 2>&1
3802                 fi
3803                 ;;
3804         esac
3805         ;;
3806 esac
3807
3808 case "$mips_type" in
3809 *BSD*|'') inclwanted="$locincpth $usrinc";;
3810 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3811 esac
3812 for thisincl in $inclwanted; do
3813         if $test -d $thisincl; then
3814                 if $test x$thisincl != x$usrinc; then
3815                         case "$dflt" in
3816                         *$thisincl*);;
3817                         *) dflt="$dflt -I$thisincl";;
3818                         esac
3819                 fi
3820         fi
3821 done
3822
3823 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3824         xxx=true;
3825 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3826         xxx=true;
3827 else
3828         xxx=false;
3829 fi;
3830 if $xxx; then
3831         case "$dflt" in
3832         *$2*);;
3833         *) dflt="$dflt -D$2";;
3834         esac;
3835 fi'
3836
3837 set signal.h LANGUAGE_C; eval $inctest
3838
3839 case "$usesocks" in
3840 $define)
3841         ccflags="$ccflags -DSOCKS"
3842         ;;
3843 esac
3844
3845 case "$hint" in
3846 default|recommended) dflt="$ccflags $dflt" ;;
3847 *) dflt="$ccflags";;
3848 esac
3849
3850 case "$dflt" in
3851 ''|' ') dflt=none;;
3852 esac
3853 $cat <<EOH
3854
3855 Your C compiler may want other flags.  For this question you should include
3856 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3857 but you should NOT include libraries or ld flags like -lwhatever.  If you
3858 want $package to honor its debug switch, you should include -DDEBUGGING here.
3859 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3860
3861 To use no flags, specify the word "none".
3862
3863 EOH
3864 set X $dflt
3865 shift
3866 dflt=${1+"$@"}
3867 rp="Any additional cc flags?"
3868 . ./myread
3869 case "$ans" in
3870 none) ccflags='';;
3871 *) ccflags="$ans";;
3872 esac
3873
3874 : the following weeds options from ccflags that are of no interest to cpp
3875 cppflags="$ccflags"
3876 case "$gccversion" in
3877 1*) cppflags="$cppflags -D__GNUC__"
3878 esac
3879 case "$mips_type" in
3880 '');;
3881 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3882 esac
3883 case "$cppflags" in
3884 '');;
3885 *)
3886         echo " "
3887         echo "Let me guess what the preprocessor flags are..." >&4
3888         set X $cppflags
3889         shift
3890         cppflags=''
3891         $cat >cpp.c <<'EOM'
3892 #define BLURFL foo
3893
3894 BLURFL xx LFRULB
3895 EOM
3896         previous=''
3897         for flag in $*
3898         do
3899                 case "$flag" in
3900                 -*) ftry="$flag";;
3901                 *) ftry="$previous $flag";;
3902                 esac
3903                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3904                         >cpp1.out 2>/dev/null && \
3905                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3906                         >cpp2.out 2>/dev/null && \
3907                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3908                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3909                 then
3910                         cppflags="$cppflags $ftry"
3911                         previous=''
3912                 else
3913                         previous="$flag"
3914                 fi
3915         done
3916         set X $cppflags
3917         shift
3918         cppflags=${1+"$@"}
3919         case "$cppflags" in
3920         *-*)  echo "They appear to be: $cppflags";;
3921         esac
3922         $rm -f cpp.c cpp?.out
3923         ;;
3924 esac
3925
3926 : flags used in final linking phase
3927 case "$ldflags" in
3928 '') if ./venix; then
3929                 dflt='-i -z'
3930         else
3931                 dflt=''
3932         fi
3933         case "$ccflags" in
3934         *-posix*) dflt="$dflt -posix" ;;
3935         esac
3936         ;;
3937 *) dflt="$ldflags";;
3938 esac
3939
3940 : Try to guess additional flags to pick up local libraries.
3941 for thislibdir in $libpth; do
3942         case " $loclibpth " in
3943         *" $thislibdir "*)
3944                 case "$dflt " in 
3945                 *"-L$thislibdir "*) ;;
3946                 *)  dflt="$dflt -L$thislibdir" ;;
3947                 esac
3948                 ;;
3949         esac
3950 done
3951
3952 case "$dflt" in
3953 '') dflt='none' ;;
3954 esac
3955
3956 $cat <<EOH
3957
3958 Your C linker may need flags.  For this question you should
3959 include -L/whatever and any other flags used by the C linker, but you
3960 should NOT include libraries like -lwhatever.
3961
3962 Make sure you include the appropriate -L/path flags if your C linker
3963 does not normally search all of the directories you specified above,
3964 namely
3965         $libpth
3966 To use no flags, specify the word "none".
3967
3968 EOH
3969
3970 rp="Any additional ld flags (NOT including libraries)?"
3971 . ./myread
3972 case "$ans" in
3973 none) ldflags='';;
3974 *) ldflags="$ans";;
3975 esac
3976 rmlist="$rmlist pdp11"
3977
3978 : coherency check
3979 echo " "
3980 echo "Checking your choice of C compiler and flags for coherency..." >&4
3981 $cat > try.c <<'EOF'
3982 #include <stdio.h>
3983 int main() { printf("Ok\n"); exit(0); }
3984 EOF
3985 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3986 shift
3987 $cat >try.msg <<'EOM'
3988 I've tried to compile and run the following simple program:
3989
3990 EOM
3991 $cat try.c >> try.msg
3992
3993 $cat >> try.msg <<EOM
3994
3995 I used the command:
3996
3997         $*
3998         ./try
3999
4000 and I got the following output:
4001
4002 EOM
4003 dflt=y
4004 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4005         if sh -c './try' >>try.msg 2>&1; then
4006                 xxx=`./try`
4007                 case "$xxx" in
4008                 "Ok") dflt=n ;;
4009                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4010                         case " $libs " in
4011                         *" -lsfio "*)
4012                                 cat >> try.msg <<'EOQS'
4013 If $libs contains -lsfio, and sfio is mis-configured, then it
4014 sometimes (apparently) runs and exits with a 0 status, but with no
4015 output!  It may have to do with sfio's use of _exit vs. exit.
4016
4017 EOQS
4018                                 rp="You have a big problem.  Shall I abort Configure"
4019                                 dflt=y
4020                                 ;;
4021                         esac
4022                         ;;
4023                 esac
4024         else
4025                 echo "The program compiled OK, but exited with status $?." >>try.msg
4026                 rp="You have a problem.  Shall I abort Configure"
4027                 dflt=y
4028         fi
4029 else
4030         echo "I can't compile the test program." >>try.msg
4031         rp="You have a BIG problem.  Shall I abort Configure"
4032         dflt=y
4033 fi
4034 case "$dflt" in
4035 y)
4036         $cat try.msg >&4
4037         case "$knowitall" in
4038         '')
4039                 echo "(The supplied flags or libraries might be incorrect.)"
4040                 ;;
4041         *) dflt=n;;
4042         esac
4043         echo " "
4044         . ./myread
4045         case "$ans" in
4046         n*|N*) ;;
4047         *)      echo "Ok.  Stopping Configure." >&4
4048                 exit 1
4049                 ;;
4050         esac
4051         ;;
4052 n) echo "OK, that should do.";;
4053 esac
4054 $rm -f try try.* core
4055
4056 : define an is-a-typedef? function
4057 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4058 case "$inclist" in
4059 "") inclist="sys/types.h";;
4060 esac;
4061 eval "varval=\$$var";
4062 case "$varval" in
4063 "")
4064         $rm -f temp.c;
4065         for inc in $inclist; do
4066                 echo "#include <$inc>" >>temp.c;
4067         done;
4068         echo "#ifdef $type" >> temp.c;
4069         echo "printf(\"We have $type\");" >> temp.c;
4070         echo "#endif" >> temp.c;
4071         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4072         if $contains $type temp.E >/dev/null 2>&1; then
4073                 eval "$var=\$type";
4074         else
4075                 eval "$var=\$def";
4076         fi;
4077         $rm -f temp.?;;
4078 *) eval "$var=\$varval";;
4079 esac'
4080
4081 : define an is-a-typedef? function that prompts if the type is not available.
4082 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4083 case "$inclist" in
4084 "") inclist="sys/types.h";;
4085 esac;
4086 eval "varval=\$$var";
4087 case "$varval" in
4088 "")
4089         $rm -f temp.c;
4090         for inc in $inclist; do
4091                 echo "#include <$inc>" >>temp.c;
4092         done;
4093         echo "#ifdef $type" >> temp.c;
4094         echo "printf(\"We have $type\");" >> temp.c;
4095         echo "#endif" >> temp.c;
4096         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4097         echo " " ;
4098         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4099         if $contains $type temp.E >/dev/null 2>&1; then
4100                 echo "$type found." >&4;
4101                 eval "$var=\$type";
4102         else
4103                 echo "$type NOT found." >&4;
4104                 dflt="$def";
4105                 . ./myread ;
4106                 eval "$var=\$ans";
4107         fi;
4108         $rm -f temp.?;;
4109 *) eval "$var=\$varval";;
4110 esac'
4111
4112 : define a shorthand compile call
4113 compile='
4114 mc_file=$1;
4115 shift;
4116 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4117 : define a shorthand compile call for compilations that should be ok.
4118 compile_ok='
4119 mc_file=$1;
4120 shift;
4121 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4122
4123 : check for lengths of integral types
4124 echo " "
4125 case "$intsize" in
4126 '')
4127         echo "Checking to see how big your integers are..." >&4
4128         $cat >intsize.c <<'EOCP'
4129 #include <stdio.h>
4130 int main()
4131 {
4132         printf("intsize=%d;\n", (int)sizeof(int));
4133         printf("longsize=%d;\n", (int)sizeof(long));
4134         printf("shortsize=%d;\n", (int)sizeof(short));
4135         exit(0);
4136 }
4137 EOCP
4138         set intsize
4139         if eval $compile_ok && ./intsize > /dev/null; then
4140                 eval `./intsize`
4141                 echo "Your integers are $intsize bytes long."
4142                 echo "Your long integers are $longsize bytes long."
4143                 echo "Your short integers are $shortsize bytes long."
4144         else
4145                 $cat >&4 <<EOM
4146 !
4147 Help! I can't compile and run the intsize test program: please enlighten me!
4148 (This is probably a misconfiguration in your system or libraries, and
4149 you really ought to fix it.  Still, I'll try anyway.)
4150 !
4151 EOM
4152                 dflt=4
4153                 rp="What is the size of an integer (in bytes)?"
4154                 . ./myread
4155                 intsize="$ans"
4156                 dflt=$intsize
4157                 rp="What is the size of a long integer (in bytes)?"
4158                 . ./myread
4159                 longsize="$ans"
4160                 dflt=2
4161                 rp="What is the size of a short integer (in bytes)?"
4162                 . ./myread
4163                 shortsize="$ans"
4164         fi
4165         ;;
4166 esac
4167 $rm -f intsize intsize.*
4168
4169 : see what type lseek is declared as in the kernel
4170 rp="What is the type used for lseek's offset on this system?"
4171 set off_t lseektype long stdio.h sys/types.h
4172 eval $typedef_ask
4173
4174 echo " "
4175 $echo $n "Checking to see how big your file offsets are...$c" >&4
4176 $cat >try.c <<EOCP
4177 #include <sys/types.h>
4178 #include <stdio.h>
4179 int main()
4180 {
4181     printf("%d\n", (int)sizeof($lseektype));
4182     return(0); 
4183 }
4184 EOCP
4185 set try
4186 if eval $compile_ok; then
4187         lseeksize=`./try`
4188         $echo " $lseeksize bytes." >&4
4189 else
4190         dflt=$longsize
4191         echo " "
4192         echo "(I can't seem to compile the test program.  Guessing...)"
4193         rp="What is the size of your file offsets (in bytes)?"
4194         . ./myread
4195         lseeksize="$ans"
4196 fi
4197 $rm -f try.c try
4198
4199 : see what type file positions are declared as in the library
4200 rp="What is the type for file position used by fsetpos()?"
4201 set fpos_t fpostype long stdio.h sys/types.h
4202 eval $typedef_ask
4203
4204 echo " "
4205 case "$fpostype" in
4206 *_t) zzz="$fpostype"    ;;
4207 *)   zzz="fpos_t"       ;;
4208 esac
4209 $echo $n "Checking the size of $zzz...$c" >&4 
4210 cat > try.c <<EOCP
4211 #include <sys/types.h>
4212 #include <stdio.h>
4213 int main() {
4214     printf("%d\n", (int)sizeof($fpostype));
4215     exit(0);
4216 }
4217 EOCP
4218 set try
4219 if eval $compile_ok; then
4220         yyy=`./try`
4221         case "$yyy" in
4222         '')     fpossize=4
4223                 echo " "
4224                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4225                 ;;
4226         *)      fpossize=$yyy
4227                 echo " $fpossize bytes."
4228                 ;;
4229         esac
4230 else
4231         dflt="$longsize"
4232         echo " "
4233         echo "(I can't compile the test program.  Guessing...)" >&4
4234         rp="What is the size of your file positions (in bytes)?"
4235         . ./myread
4236         fpossize="$ans"
4237 fi
4238
4239
4240
4241 case "$lseeksize:$fpossize" in
4242 8:8) cat <<EOM
4243
4244 You can have files larger than 2 gigabytes.
4245 EOM
4246    val="$define" ;;
4247 *) cat <<EOM
4248
4249 Perl can be built to understand large files (files larger than 2 gigabytes)
4250 on some systems.  To do so, Configure must be run with -Duselargefiles.
4251
4252 If this doesn't make any sense to you, just accept the default 'y'.
4253 EOM
4254    case "$uselargefiles" in
4255    "$undef"|false|[nN]*) dflt='n' ;;
4256    *)   dflt='y' ;;
4257    esac
4258    rp='Try to understand large files, if available?'
4259    . ./myread
4260    case "$ans" in
4261    y|Y)         val="$define" ;;
4262    *)           val="$undef"  ;;
4263    esac
4264    ;;
4265 esac
4266 set uselargefiles
4267 eval $setvar
4268 case "$uselargefiles" in
4269 "$define")
4270 : Look for a hint-file generated 'call-back-unit'.  If the
4271 : user has specified that a large files perl is to be built,
4272 : we may need to set or change some other defaults.
4273         if $test -f uselfs.cbu; then
4274                 echo "Your platform has some specific hints for large file builds, using them..."
4275                 . ./uselfs.cbu
4276                 echo " "
4277                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4278                 $cat >try.c <<EOCP
4279 #include <sys/types.h>
4280 #include <stdio.h>
4281 int main()
4282 {
4283     printf("%d\n", (int)sizeof($lseektype));
4284     return(0); 
4285 }
4286 EOCP
4287                 set try
4288                 if eval $compile_ok; then
4289                         lseeksize=`./try`
4290                         $echo " $lseeksize bytes." >&4
4291                 else
4292                         dflt="$lseeksize"
4293                         echo " "
4294                         echo "(I can't seem to compile the test program.  Guessing...)"
4295                         rp="What is the size of your file offsets (in bytes)?"
4296                         . ./myread
4297                         lseeksize="$ans"
4298                 fi
4299                 case "$fpostype" in
4300                 *_t) zzz="$fpostype"    ;;
4301                 *)   zzz="fpos_t"       ;;
4302                 esac
4303                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4304                 $cat > try.c <<EOCP
4305 #include <sys/types.h>
4306 #include <stdio.h>
4307 int main() {
4308     printf("%d\n", (int)sizeof($fpostype));
4309     exit(0);
4310 }
4311 EOCP
4312                 set try
4313                 if eval $compile_ok; then
4314                         yyy=`./try`
4315                         dflt="$lseeksize"
4316                         case "$yyy" in
4317                         '')     echo " "
4318                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4319                                 ;;
4320                         *)      fpossize=$yyy
4321                                 echo " $fpossize bytes."
4322                                 ;;
4323                         esac
4324                 else
4325                         dflt="$fpossize"
4326                         echo " "
4327                         echo "(I can't compile the test program.  Guessing...)" >&4
4328                         rp="What is the size of your file positions (in bytes)?"
4329                         . ./myread
4330                         fpossize="$ans"
4331                 fi
4332                 $rm -f try.c try
4333         fi
4334         ;;
4335 esac
4336
4337
4338 case "$usemorebits" in
4339 "$define"|true|[yY]*)
4340         use64bits="$define"
4341         uselongdouble="$define"
4342         usemorebits="$define"
4343         ;;
4344 *)      usemorebits="$undef"
4345         ;;
4346 esac
4347
4348
4349 case "$intsize:$longsize" in
4350 8:*|*:8) cat <<EOM
4351
4352 You have natively 64-bit integers.
4353 EOM
4354    val="$define" ;;
4355 *) cat <<EOM
4356
4357 Perl can be built to take advantage of 64-bit integer types
4358 on some systems.  To do so, Configure must be run with -Duse64bits.
4359
4360 If this doesn't make any sense to you, just accept the default.
4361 EOM
4362   case "$use64bits" in
4363   $define|true|[yY]*)   dflt='y';;
4364   *) dflt='n';;
4365   esac
4366   rp='Try to use 64-bit integers, if available?'
4367   . ./myread
4368   case "$ans" in
4369   y|Y) val="$define" ;;
4370   *)   val="$undef"  ;;
4371   esac
4372   ;;
4373 esac
4374 set use64bits
4375 eval $setvar
4376
4377 case "$archname64" in
4378 '') archname64='' ;;    # not a typo
4379 esac
4380
4381 case "$use64bits" in
4382 "$define"|true|[yY]*)
4383 : Look for a hint-file generated 'call-back-unit'.  If the
4384 : user has specified that a 64-bit perl is to be built,
4385 : we may need to set or change some other defaults.
4386         if $test -f use64bits.cbu; then
4387                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4388                 . ./use64bits.cbu
4389         else
4390                 $cat <<EOM
4391 (Your platform doesn't have any specific hints for 64-bit builds.)
4392 EOM
4393                 case "$intsize:$longsize" in
4394 8:*|*:8) cat <<EOM
4395 (This is probably okay, as your system is a natively 64-bit system.)
4396 EOM
4397                   ;;
4398                 esac
4399                 case "$gccversion" in
4400                 '')     ;;
4401                 *)      case "$ccflags" in
4402                         *-DUSE_LONG_LONG*) ;;
4403                         *) $cat <<EOM
4404 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4405 to the compilation flags.
4406 EOM
4407                            ccflags="$ccflags -DUSE_LONG_LONG"
4408                            ;;
4409                         esac
4410                         ;;
4411                 esac
4412         fi
4413         ;;
4414 esac
4415
4416 : determine the architecture name
4417 echo " "
4418 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4419         tarch=`arch`"-$osname"
4420 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4421         if uname -m > tmparch 2>&1 ; then
4422                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4423                         -e 's/$/'"-$osname/" tmparch`
4424         else
4425                 tarch="$osname"
4426         fi
4427         $rm -f tmparch
4428 else
4429         tarch="$osname"
4430 fi
4431 case "$myarchname" in
4432 ''|"$tarch") ;;
4433 *)
4434         echo "(Your architecture name used to be $myarchname.)"
4435         archname=''
4436         ;;
4437 esac
4438 myarchname="$tarch"
4439 case "$archname" in
4440 '') dflt="$tarch";;
4441 *) dflt="$archname";;
4442 esac
4443 rp='What is your architecture name'
4444 . ./myread
4445 archname="$ans"
4446 case "$usethreads" in
4447 $define)
4448         echo "Threads selected." >&4
4449         case "$archname" in
4450         *-thread*) echo "...and architecture name already has -thread." >&4
4451                 ;;
4452         *)      archname="$archname-thread"
4453                 echo "...setting architecture name to $archname." >&4
4454                 ;;
4455         esac
4456         ;;
4457 esac
4458 case "$usemultiplicity" in
4459 $define)
4460         echo "Multiplicity selected." >&4
4461         case "$archname" in
4462         *-multi*) echo "...and architecture name already has -multi." >&4
4463                 ;;
4464         *)      archname="$archname-multi"
4465                 echo "...setting architecture name to $archname." >&4
4466                 ;;
4467         esac
4468         ;;
4469 esac
4470 case "$use64bits" in
4471 $define)
4472         case "$archname64" in
4473         '')
4474                 ;;
4475         *)
4476                 case "$archname" in
4477                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4478                         ;;
4479                 *)      archname="$archname-$archname64"
4480                         echo "...setting architecture name to $archname." >&4
4481                         ;;
4482                 esac
4483                 ;;
4484         esac
4485 esac
4486
4487 : determine root of directory hierarchy where package will be installed.
4488 case "$prefix" in
4489 '')
4490         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4491         ;;
4492 *)
4493         dflt="$prefix"
4494         ;;
4495 esac
4496 $cat <<EOM
4497
4498 By default, $package will be installed in $dflt/bin, manual pages
4499 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4500 installation directories. Typically this is something like /usr/local.
4501 If you wish to have binaries under /usr/bin but other parts of the
4502 installation under /usr/local, that's ok: you will be prompted
4503 separately for each of the installation directories, the prefix being
4504 only used to set the defaults.
4505
4506 EOM
4507 fn=d~
4508 rp='Installation prefix to use?'
4509 . ./getfile
4510 oldprefix=''
4511 case "$prefix" in
4512 '') ;;
4513 *)
4514         case "$ans" in
4515         "$prefix") ;;
4516         *) oldprefix="$prefix";;
4517         esac
4518         ;;
4519 esac
4520 prefix="$ans"
4521 prefixexp="$ansexp"
4522
4523 : is AFS running?
4524 echo " "
4525 case "$afs" in
4526 $define|true)   afs=true ;;
4527 $undef|false)   afs=false ;;
4528 *)      if test -d /afs; then
4529                 afs=true
4530         else
4531                 afs=false
4532         fi
4533         ;;
4534 esac
4535 if $afs; then
4536         echo "AFS may be running... I'll be extra cautious then..." >&4
4537 else
4538         echo "AFS does not seem to be running..." >&4
4539 fi
4540
4541 : determine installation prefix for where package is to be installed.
4542 if $afs; then 
4543 $cat <<EOM
4544
4545 Since you are running AFS, I need to distinguish the directory in which
4546 files will reside from the directory in which they are installed (and from
4547 which they are presumably copied to the former directory by occult means).
4548
4549 EOM
4550         case "$installprefix" in
4551         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4552         *) dflt="$installprefix";;
4553         esac
4554 else
4555 $cat <<EOM
4556
4557 In some special cases, particularly when building $package for distribution,
4558 it is convenient to distinguish between the directory in which files should 
4559 be installed from the directory ($prefix) in which they 
4560 will eventually reside.  For most users, these two directories are the same.
4561
4562 EOM
4563         case "$installprefix" in
4564         '') dflt=$prefix ;;
4565         *) dflt=$installprefix;;
4566         esac
4567 fi
4568 fn=d~
4569 rp='What installation prefix should I use for installing files?'
4570 . ./getfile
4571 installprefix="$ans"
4572 installprefixexp="$ansexp"
4573
4574 : set the prefixit variable, to compute a suitable default value
4575 prefixit='case "$3" in
4576 ""|none)
4577         case "$oldprefix" in
4578         "") eval "$1=\"\$$2\"";;
4579         *)
4580                 case "$3" in
4581                 "") eval "$1=";;
4582                 none)
4583                         eval "tp=\"\$$2\"";
4584                         case "$tp" in
4585                         ""|" ") eval "$1=\"\$$2\"";;
4586                         *) eval "$1=";;
4587                         esac;;
4588                 esac;;
4589         esac;;
4590 *)
4591         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4592         case "$tp" in
4593         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4594         /*-$oldprefix/*|\~*-$oldprefix/*)
4595                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4596         *) eval "$1=\"\$$2\"";;
4597         esac;;
4598 esac'
4599
4600 : set the base revision
4601 baserev=5.0
4602
4603
4604 : get the patchlevel
4605 echo " "
4606 echo "Getting the current patchlevel..." >&4
4607 if $test -r $rsrc/patchlevel.h;then
4608         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4609         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4610         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4611         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4612         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4613 else
4614         patchlevel=0
4615         subversion=0
4616         api_revision=0
4617         api_version=0
4618         api_subversion=0
4619 fi
4620 $echo $n "(You have $package" $c
4621 case "$package" in
4622 "*$baserev")    ;;
4623 *)              $echo $n " $baserev" $c ;;
4624 esac
4625 $echo $n " patchlevel $patchlevel" $c
4626 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4627 echo ".)"
4628 case "$osname" in
4629 dos|cygwin|vms|win32)
4630         : XXX Should be a Configure test for double-dots in filenames.
4631         version=`echo $baserev $patchlevel $subversion | \
4632                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4633         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4634                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4635         ;;
4636 *)
4637         version=`echo $baserev $patchlevel $subversion | \
4638                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4639         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4640                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4641         ;;
4642 esac
4643 : Special case the 5.005_xx maintenance series, which used 5.005
4644 : without any subversion label as a subdirectory in $sitelib
4645 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4646         api_versionstring='5.005'
4647 fi
4648
4649 : determine installation style
4650 : For now, try to deduce it from prefix unless it is already set.
4651 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4652 case "$installstyle" in
4653 '')     case "$prefix" in
4654                 *perl*) dflt='lib';;
4655                 *) dflt='lib/perl5' ;;
4656         esac
4657         ;;
4658 *)      dflt='lib/perl5' ;;
4659 esac
4660 : Probably not worth prompting for this since we prompt for all
4661 : the directories individually, and the prompt would be too long and
4662 : confusing anyway.
4663 installstyle=$dflt
4664
4665 : determine where private library files go
4666 : Usual default is /usr/local/lib/perl5/$version.
4667 : Also allow things like /opt/perl/lib/$version, since 
4668 : /opt/perl/lib/perl5... would be redundant.
4669 : The default "style" setting is made in installstyle.U
4670 case "$installstyle" in
4671 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4672 *)       set dflt privlib lib/$version ;;
4673 esac
4674 eval $prefixit
4675 $cat <<EOM
4676
4677 There are some auxiliary files for $package that need to be put into a
4678 private library directory that is accessible by everyone.
4679
4680 EOM
4681 fn=d~+
4682 rp='Pathname where the private library files will reside?'
4683 . ./getfile
4684 privlib="$ans"
4685 privlibexp="$ansexp"
4686 : Change installation prefix, if necessary.
4687 if $test X"$prefix" != X"$installprefix"; then
4688         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4689 else
4690         installprivlib="$privlibexp"
4691 fi
4692
4693 : set the prefixup variable, to restore leading tilda escape
4694 prefixup='case "$prefixexp" in
4695 "$prefix") ;;
4696 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4697 esac'
4698
4699 : determine where public architecture dependent libraries go
4700 set archlib archlib
4701 eval $prefixit
4702 : privlib default is /usr/local/lib/$package/$version
4703 : archlib default is /usr/local/lib/$package/$version/$archname
4704 : privlib may have an optional trailing /share.
4705 tdflt=`echo $privlib | $sed 's,/share$,,'`
4706 tdflt=$tdflt/$archname
4707 case "$archlib" in
4708 '')     dflt=$tdflt
4709         ;;
4710 *)      dflt="$archlib"
4711     ;;
4712 esac
4713 $cat <<EOM
4714
4715 $spackage contains architecture-dependent library files.  If you are
4716 sharing libraries in a heterogeneous environment, you might store
4717 these files in a separate location.  Otherwise, you can just include
4718 them with the rest of the public library files.
4719
4720 EOM
4721 fn=d+~
4722 rp='Where do you want to put the public architecture-dependent libraries?'
4723 . ./getfile
4724 archlib="$ans"
4725 archlibexp="$ansexp"
4726 if $test X"$archlib" = X"$privlib"; then
4727         d_archlib="$undef"
4728 else
4729         d_archlib="$define"
4730 fi
4731 : Change installation prefix, if necessary.
4732 if $test X"$prefix" != X"$installprefix"; then
4733         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4734 else
4735         installarchlib="$archlibexp"
4736 fi
4737
4738
4739 : Binary compatibility with 5.005 is not possible for builds
4740 : with advanced features
4741 case "$usethreads$usemultiplicity" in
4742 *define*)
4743         bincompat5005="$undef"
4744         d_bincompat5005="$undef"
4745         ;;
4746 *)      $cat <<EOM
4747
4748 Perl 5.006 can be compiled for binary compatibility with 5.005.
4749 If you decide to do so, you will be able to continue using most
4750 of the extensions that were compiled for Perl 5.005.
4751
4752 EOM
4753         case "$bincompat5005$d_bincompat5005" in
4754         *"$undef"*) dflt=n ;;
4755         *) dflt=y ;;
4756         esac
4757         rp='Binary compatibility with Perl 5.005?'
4758         . ./myread
4759         case "$ans" in
4760         y*) val="$define" ;;
4761         *)  val="$undef" ;;
4762         esac
4763         set d_bincompat5005
4764         eval $setvar
4765         case "$d_bincompat5005" in
4766         "$define")
4767                 bincompat5005="$define"
4768                 ;;
4769         *)      bincompat5005="$undef"
4770                 d_bincompat5005="$undef"
4771                 ;;
4772         esac
4773         ;;
4774 esac
4775
4776
4777 : see if setuid scripts can be secure
4778 $cat <<EOM
4779
4780 Some kernels have a bug that prevents setuid #! scripts from being
4781 secure.  Some sites have disabled setuid #! scripts because of this.
4782
4783 First let's decide if your kernel supports secure setuid #! scripts.
4784 (If setuid #! scripts would be secure but have been disabled anyway,
4785 don't say that they are secure if asked.)
4786
4787 EOM
4788
4789 val="$undef"
4790 if $test -d /dev/fd; then
4791         echo "#!$ls" >reflect
4792         chmod +x,u+s reflect
4793         ./reflect >flect 2>&1
4794         if $contains "/dev/fd" flect >/dev/null; then
4795                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4796                 val="$define"
4797         else
4798                 $cat <<EOM
4799 If you are not sure if they are secure, I can check but I'll need a
4800 username and password different from the one you are using right now.
4801 If you don't have such a username or don't want me to test, simply
4802 enter 'none'.
4803
4804 EOM
4805                 rp='Other username to test security of setuid scripts with?'
4806                 dflt='none'
4807                 . ./myread
4808                 case "$ans" in
4809                 n|none)
4810                         case "$d_suidsafe" in
4811                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4812                                 dflt=n;;
4813                         "$undef")
4814                                 echo "Well, the $hint value is *not* secure." >&4
4815                                 dflt=n;;
4816                         *)      echo "Well, the $hint value *is* secure." >&4
4817                                 dflt=y;;
4818                         esac
4819                         ;;
4820                 *)
4821                         $rm -f reflect flect
4822                         echo "#!$ls" >reflect
4823                         chmod +x,u+s reflect
4824                         echo >flect
4825                         chmod a+w flect
4826                         echo '"su" will (probably) prompt you for '"$ans's password."
4827                         su $ans -c './reflect >flect'
4828                         if $contains "/dev/fd" flect >/dev/null; then
4829                                 echo "Okay, it looks like setuid scripts are secure." >&4
4830                                 dflt=y
4831                         else
4832                                 echo "I don't think setuid scripts are secure." >&4
4833                                 dflt=n
4834                         fi
4835                         ;;
4836                 esac
4837                 rp='Does your kernel have *secure* setuid scripts?'
4838                 . ./myread
4839                 case "$ans" in
4840                 [yY]*)  val="$define";;
4841                 *)      val="$undef";;
4842                 esac
4843         fi
4844 else
4845         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4846         echo "(That's for file descriptors, not floppy disks.)"
4847         val="$undef"
4848 fi
4849 set d_suidsafe
4850 eval $setvar
4851
4852 $rm -f reflect flect
4853
4854 : now see if they want to do setuid emulation
4855 echo " "
4856 val="$undef"
4857 case "$d_suidsafe" in
4858 "$define")
4859         val="$undef"
4860         echo "No need to emulate SUID scripts since they are secure here." >& 4
4861         ;;
4862 *)
4863         $cat <<EOM
4864 Some systems have disabled setuid scripts, especially systems where
4865 setuid scripts cannot be secure.  On systems where setuid scripts have
4866 been disabled, the setuid/setgid bits on scripts are currently
4867 useless.  It is possible for $package to detect those bits and emulate
4868 setuid/setgid in a secure fashion.  This emulation will only work if
4869 setuid scripts have been disabled in your kernel.
4870
4871 EOM
4872         case "$d_dosuid" in
4873         "$define") dflt=y ;;
4874         *) dflt=n ;;
4875         esac
4876         rp="Do you want to do setuid/setgid emulation?"
4877         . ./myread
4878         case "$ans" in
4879         [yY]*)  val="$define";;
4880         *)      val="$undef";;
4881         esac
4882         ;;
4883 esac
4884 set d_dosuid
4885 eval $setvar
4886
4887 : determine filename position in cpp output
4888 echo " "
4889 echo "Computing filename position in cpp output for #include directives..." >&4
4890 echo '#include <stdio.h>' > foo.c
4891 $cat >fieldn <<EOF
4892 $startsh
4893 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4894 $grep '^[       ]*#.*stdio\.h' | \
4895 while read cline; do
4896         pos=1
4897         set \$cline
4898         while $test \$# -gt 0; do
4899                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4900                         echo "\$pos"
4901                         exit 0
4902                 fi
4903                 shift
4904                 pos=\`expr \$pos + 1\`
4905         done
4906 done
4907 EOF
4908 chmod +x fieldn
4909 fieldn=`./fieldn`
4910 $rm -f foo.c fieldn
4911 case $fieldn in
4912 '') pos='???';;
4913 1) pos=first;;
4914 2) pos=second;;
4915 3) pos=third;;
4916 *) pos="${fieldn}th";;
4917 esac
4918 echo "Your cpp writes the filename in the $pos field of the line."
4919
4920 : locate header file
4921 $cat >findhdr <<EOF
4922 $startsh
4923 wanted=\$1
4924 name=''
4925 for usrincdir in $usrinc
4926 do
4927         if test -f \$usrincdir/\$wanted; then
4928                 echo "\$usrincdir/\$wanted"
4929                 exit 0
4930         fi
4931 done
4932 awkprg='{ print \$$fieldn }'
4933 echo "#include <\$wanted>" > foo\$\$.c
4934 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4935 $grep "^[       ]*#.*\$wanted" | \
4936 while read cline; do
4937         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4938         case "\$name" in
4939         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4940         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4941         *) exit 2;;
4942         esac;
4943 done;
4944 #
4945 # status = 0: grep returned 0 lines, case statement not executed
4946 # status = 1: headerfile found
4947 # status = 2: while loop executed, no headerfile found
4948 #
4949 status=\$?
4950 $rm -f foo\$\$.c;
4951 if test \$status -eq 1; then
4952         exit 0;
4953 fi
4954 exit 1
4955 EOF
4956 chmod +x findhdr
4957
4958 : define an alternate in-header-list? function
4959 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4960 cont=true; xxf="echo \"<\$1> found.\" >&4";
4961 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4962 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4963 esac;
4964 case $# in 4) instead=instead;; *) instead="at last";; esac;
4965 while $test "$cont"; do
4966         xxx=`./findhdr $1`
4967         var=$2; eval "was=\$$2";
4968         if $test "$xxx" && $test -r "$xxx";
4969         then eval $xxf;
4970         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4971                 cont="";
4972         else eval $xxnf;
4973         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4974         set $yyy; shift; shift; yyy=$@;
4975         case $# in 0) cont="";;
4976         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4977                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4978         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4979                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4980         esac;
4981 done;
4982 while $test "$yyy";
4983 do set $yyy; var=$2; eval "was=\$$2";
4984         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4985         set $yyy; shift; shift; yyy=$@;
4986 done'
4987
4988 : see if this is a malloc.h system
4989 set malloc.h i_malloc
4990 eval $inhdr
4991
4992 : see if stdlib is available
4993 set stdlib.h i_stdlib
4994 eval $inhdr
4995
4996 : determine which malloc to compile in
4997 echo " "
4998 case "$usemymalloc" in
4999 ''|[yY]*|true|$define)  dflt='y' ;;
5000 *)      dflt='n' ;;
5001 esac
5002 rp="Do you wish to attempt to use the malloc that comes with $package?"
5003 . ./myread
5004 usemymalloc="$ans"
5005 case "$ans" in
5006 y*|true)
5007         usemymalloc='y'
5008         mallocsrc='malloc.c'
5009         mallocobj="malloc$_o"
5010         d_mymalloc="$define"
5011         case "$libs" in
5012         *-lmalloc*)
5013                 : Remove malloc from list of libraries to use
5014                 echo "Removing unneeded -lmalloc from library list" >&4
5015                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5016                 shift
5017                 libs="$*"
5018                 echo "libs = $libs" >&4
5019                 ;;
5020         esac
5021         ;;
5022 *)
5023         usemymalloc='n'
5024         mallocsrc=''
5025         mallocobj=''
5026         d_mymalloc="$undef"
5027         ;;
5028 esac
5029
5030 : compute the return types of malloc and free
5031 echo " "
5032 $cat >malloc.c <<END
5033 #$i_malloc I_MALLOC
5034 #$i_stdlib I_STDLIB
5035 #include <stdio.h>
5036 #include <sys/types.h>
5037 #ifdef I_MALLOC
5038 #include <malloc.h>
5039 #endif
5040 #ifdef I_STDLIB
5041 #include <stdlib.h>
5042 #endif
5043 #ifdef TRY_MALLOC
5044 void *malloc();
5045 #endif
5046 #ifdef TRY_FREE
5047 void free();
5048 #endif
5049 END
5050 case "$malloctype" in
5051 '')
5052         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5053                 malloctype='void *'
5054         else
5055                 malloctype='char *'
5056         fi
5057         ;;
5058 esac
5059 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5060
5061 case "$freetype" in
5062 '')
5063         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5064                 freetype='void'
5065         else
5066                 freetype='int'
5067         fi
5068         ;;
5069 esac
5070 echo "Your system uses $freetype free(), it would seem." >&4
5071 $rm -f malloc.[co]
5072 $cat <<EOM
5073
5074 The installation process will also create a directory for
5075 vendor-supplied add-ons.  Vendors who supply perl with their system
5076 may find it convenient to place all vendor-supplied files in this
5077 directory rather than in the main distribution directory.  This will
5078 ease upgrades between binary-compatible maintenance versions of perl.
5079
5080 Of course you may also use these directories in whatever way you see
5081 fit.  For example, you might use them to access modules shared over a
5082 company-wide network.
5083
5084 The default answer should be fine for most people.
5085 This causes further questions about vendor add-ons to be skipped
5086 and no vendor-specific directories will be configured for perl.
5087
5088 EOM
5089 rp='Do you want to configure vendor-specific add-on directories?'
5090 case "$usevendorprefix" in
5091 define|true|[yY]*) dflt=y ;;
5092 *) dflt=n ;;
5093 esac
5094 . ./myread
5095 case "$ans" in
5096 [yY]*)  fn=d~+
5097         rp='Installation prefix to use for vendor-supplied add-ons?'
5098         case "$vendorprefix" in
5099         '') dflt='' ;;
5100         *)  dflt=$vendorprefix ;;
5101         esac
5102         . ./getfile
5103         oldvendorprefix=''
5104         case "$vendorprefix" in
5105         '') ;;
5106         *)      case "$ans" in
5107                 "$prefix") ;;
5108                 *) oldvendorprefix="$prefix";;
5109                 esac
5110                 ;;
5111         esac
5112         usevendorprefix="$define"
5113         vendorprefix="$ans"
5114         vendorprefixexp="$ansexp"
5115         ;;
5116 *)      usevendorprefix="$undef"
5117         vendorprefix=''
5118         vendorprefixexp=''
5119         ;;
5120 esac
5121
5122 case "$vendorprefix" in
5123 '')     d_vendorlib="$undef"
5124         vendorlib=''
5125         vendorlibexp=''
5126         ;;
5127 *)      d_vendorlib="$define"
5128         : determine where vendor-supplied modules go.
5129         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5130         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5131         case "$installstyle" in
5132         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5133         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5134         esac
5135         fn=d~+
5136         rp='Pathname for the vendor-supplied library files?'
5137         . ./getfile
5138         vendorlib="$ans"
5139         vendorlibexp="$ansexp"
5140         : Change installation prefix, if necessary.
5141         if $test X"$prefix" != X"$installprefix"; then
5142                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5143         else
5144                 installvendorlib="$vendorlibexp"
5145         fi
5146         ;;
5147 esac
5148
5149 : Cruising for prototypes
5150 echo " "
5151 echo "Checking out function prototypes..." >&4
5152 $cat >prototype.c <<'EOCP'
5153 int main(int argc, char *argv[]) {
5154         exit(0);}
5155 EOCP
5156 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5157         echo "Your C compiler appears to support function prototypes."
5158         val="$define"
5159 else
5160         echo "Your C compiler doesn't seem to understand function prototypes."
5161         val="$undef"
5162 fi
5163 set prototype
5164 eval $setvar
5165 $rm -f prototype*
5166
5167 case "$prototype" in
5168 "$define") ;;
5169 *)      ansi2knr='ansi2knr'
5170         echo " "
5171         cat <<EOM >&4
5172
5173 $me:  FATAL ERROR:
5174 This version of $package can only be compiled by a compiler that 
5175 understands function prototypes.  Unfortunately, your C compiler 
5176         $cc $ccflags
5177 doesn't seem to understand them.  Sorry about that.
5178
5179 If GNU cc is available for your system, perhaps you could try that instead.  
5180
5181 Eventually, we hope to support building Perl with pre-ANSI compilers.
5182 If you would like to help in that effort, please contact <perlbug@perl.org>.
5183
5184 Aborting Configure now.
5185 EOM
5186         exit 2
5187         ;;
5188 esac
5189
5190 : determine where public executables go
5191 echo " "
5192 set dflt bin bin
5193 eval $prefixit
5194 fn=d~
5195 rp='Pathname where the public executables will reside?'
5196 . ./getfile
5197 if $test "X$ansexp" != "X$binexp"; then
5198         installbin=''
5199 fi
5200 bin="$ans"
5201 binexp="$ansexp"
5202 : Change installation prefix, if necessary.
5203 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5204 if $test X"$prefix" != X"$installprefix"; then
5205         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5206 else
5207         installbin="$binexp"
5208 fi
5209
5210 $cat <<EOM
5211
5212 After $package is installed, you may wish to install various
5213 add-on modules and utilities.  Typically, these add-ons will
5214 be installed under $prefix with the rest
5215 of this package.  However, you may wish to install such add-ons
5216 elsewhere under a different prefix.
5217
5218 If you do not wish to put everything under a single prefix, that's
5219 ok.  You will be prompted for the individual locations; this siteprefix
5220 is only used to suggest the defaults.
5221
5222 The default should be fine for most people.
5223
5224 EOM
5225 fn=d~+
5226 rp='Installation prefix to use for add-on modules and utilities?'
5227 : XXX Here might be another good place for an installstyle setting.
5228 case "$siteprefix" in
5229 '') dflt=$prefix ;;
5230 *)  dflt=$siteprefix ;;
5231 esac
5232 . ./getfile
5233 oldsiteprefix=''
5234 case "$siteprefix" in
5235 '') ;;
5236 *)
5237         case "$ans" in
5238         "$prefix") ;;
5239         *) oldsiteprefix="$prefix";;
5240         esac
5241         ;;
5242 esac
5243 siteprefix="$ans"
5244 siteprefixexp="$ansexp"
5245
5246 : determine where site specific libraries go.
5247 : Usual default is /usr/local/lib/perl5/site_perl/$version
5248 : The default "style" setting is made in installstyle.U
5249 : XXX No longer works with Prefixit stuff.
5250 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5251 case "$installstyle" in
5252 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5253 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5254 esac
5255 $cat <<EOM
5256
5257 The installation process will create a directory for
5258 site-specific extensions and modules.  Most users find it convenient
5259 to place all site-specific files in this directory rather than in the
5260 main distribution directory.
5261
5262 EOM
5263 fn=d~+
5264 rp='Pathname for the site-specific library files?'
5265 . ./getfile
5266 sitelib="$ans"
5267 sitelibexp="$ansexp"
5268 : Change installation prefix, if necessary.
5269 if $test X"$prefix" != X"$installprefix"; then
5270         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5271 else
5272         installsitelib="$sitelibexp"
5273 fi
5274
5275 : Determine list of previous versions to include in @INC
5276 $cat > getverlist <<EOPL
5277 #!$perl -w
5278 use File::Basename;
5279 \$api_versionstring = "$api_versionstring";
5280 \$version = "$version";
5281 \$sitelib = "$sitelib";
5282 \$archname = "$archname";
5283 EOPL
5284         $cat >> getverlist <<'EOPL'
5285 # Can't have leading @ because metaconfig interprets it as a command!
5286 ;@inc_version_list=();
5287 $stem=dirname($sitelib);
5288 # Redo to do opendir/readdir? 
5289 if (-d $stem) {
5290     chdir($stem);
5291     ;@candidates = glob("5.*");
5292 }
5293 else {
5294     ;@candidates = ();
5295 }
5296
5297 # XXX ToDo:  These comparisons must be reworked when two-digit
5298 # subversions come along, so that 5.7.10 compares as greater than
5299 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5300 # widespread that we can use the built-in version vectors rather
5301 # than reinventing them here.  For 5.6.0, however, we must
5302 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5303 foreach $d (@candidates) {
5304     if ($d lt $version) {
5305         if ($d ge $api_versionstring) {
5306             unshift(@inc_version_list, "$d/$archname", $d);
5307         }
5308         elsif ($d ge "5.005") {
5309             unshift(@inc_version_list, $d);
5310         }
5311     }
5312     else {
5313         # Skip newer version.  I.e. don't look in
5314         # 5.7.0 if we're installing 5.6.1.
5315     }
5316 }
5317
5318 if (@inc_version_list) {
5319     print join(' ', @inc_version_list);
5320 }
5321 else {
5322     # Blank space to preserve value for next Configure run.
5323     print " ";
5324 }
5325 EOPL
5326 chmod +x getverlist
5327 case "$inc_version_list" in
5328 '')     if test -x $perl; then
5329                 dflt=`$perl getverlist`
5330         else
5331                 dflt='none'
5332         fi
5333         ;;
5334 $undef) dflt='none' ;;
5335 *)  dflt="$inc_version_list" ;;
5336 esac
5337 $cat <<'EOM'
5338
5339 In order to ease the process of upgrading, this version of perl 
5340 can be configured to use modules built and installed with earlier 
5341 versions of perl that were installed under $prefix.  Specify here
5342 the list of earlier versions that this version of perl should check.
5343 If Configure detected no earlier versions of perl installed under
5344 $prefix, then the list will be empty.  Answer 'none' to tell perl
5345 to not search earlier versions.
5346
5347 The default should almost always be sensible, so if you're not sure,
5348 just accept the default.
5349 EOM
5350
5351 rp='List of earlier versions to include in @INC?'
5352 . ./myread
5353 case "$ans" in
5354 [Nn]one) inc_version_list=' ' ;;
5355 *) inc_version_list="$ans" ;;
5356 esac
5357 case "$inc_version_list" in
5358 ''|' ') 
5359         inc_version_list_init='""';;
5360 *)      inc_version_list_init=`echo $inc_version_list |
5361                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/"/'`
5362         ;;
5363 esac
5364 $rm -f getverlist
5365
5366 : determine whether to install perl also as /usr/bin/perl
5367
5368 echo " "
5369 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5370         $cat <<EOM
5371 Many scripts expect to perl to be installed as /usr/bin/perl.
5372 I can install the perl you are about to compile also as /usr/bin/perl
5373 (in addition to $installbin/perl).
5374 EOM
5375         case "$installusrbinperl" in
5376         "$undef"|[nN]*) dflt='n';;
5377         *)              dflt='y';;
5378         esac
5379         rp="Do you want to install perl as /usr/bin/perl?"
5380         . ./myread
5381         case "$ans" in
5382         [yY]*)  val="$define";;
5383         *)      val="$undef" ;;
5384         esac
5385 else
5386         val="$undef"
5387 fi
5388 set installusrbinperl
5389 eval $setvar
5390
5391 echo " "
5392 echo "Checking for GNU C Library..." >&4
5393 cat >gnulibc.c <<EOM
5394 #include <stdio.h>
5395 int main()
5396 {
5397 #ifdef __GLIBC__
5398     exit(0);
5399 #else
5400     exit(1);
5401 #endif
5402 }
5403 EOM
5404 set gnulibc
5405 if eval $compile_ok && ./gnulibc; then
5406         val="$define"
5407         echo "You are using the GNU C Library"
5408 else
5409         val="$undef"
5410         echo "You are not using the GNU C Library"
5411 fi
5412 $rm -f gnulibc*
5413 set d_gnulibc
5414 eval $setvar
5415
5416 : see if nm is to be used to determine whether a symbol is defined or not
5417 case "$usenm" in
5418 '')
5419         dflt=''
5420         case "$d_gnulibc" in
5421         "$define")
5422                 echo " "
5423                 echo "nm probably won't work on the GNU C Library." >&4
5424                 dflt=n
5425                 ;;
5426         esac
5427         case "$dflt" in
5428         '') 
5429                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5430                         echo " "
5431                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5432                         echo "'nm' won't be sufficient on this sytem." >&4
5433                         dflt=n
5434                 fi
5435                 ;;
5436         esac
5437         case "$dflt" in
5438         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5439                 if $test $dflt -gt 20; then
5440                         dflt=y
5441                 else
5442                         dflt=n
5443                 fi
5444                 ;;
5445         esac
5446         ;;
5447 *)
5448         case "$usenm" in
5449         true|$define) dflt=y;;
5450         *) dflt=n;;
5451         esac
5452         ;;
5453 esac
5454 $cat <<EOM
5455
5456 I can use $nm to extract the symbols from your C libraries. This
5457 is a time consuming task which may generate huge output on the disk (up
5458 to 3 megabytes) but that should make the symbols extraction faster. The
5459 alternative is to skip the 'nm' extraction part and to compile a small
5460 test program instead to determine whether each symbol is present. If
5461 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5462 this may be the best solution.
5463
5464 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5465
5466 EOM
5467 rp="Shall I use $nm to extract C symbols from the libraries?"
5468 . ./myread
5469 case "$ans" in
5470 [Nn]*) usenm=false;;
5471 *) usenm=true;;
5472 esac
5473
5474 runnm=$usenm
5475 case "$reuseval" in
5476 true) runnm=false;;
5477 esac
5478
5479 : nm options which may be necessary
5480 case "$nm_opt" in
5481 '') if $test -f /mach_boot; then
5482                 nm_opt=''       # Mach
5483         elif $test -d /usr/ccs/lib; then
5484                 nm_opt='-p'     # Solaris (and SunOS?)
5485         elif $test -f /dgux; then
5486                 nm_opt='-p'     # DG-UX
5487         elif $test -f /lib64/rld; then
5488                 nm_opt='-p'     # 64-bit Irix
5489         else
5490                 nm_opt=''
5491         fi;;
5492 esac
5493
5494 : nm options which may be necessary for shared libraries but illegal
5495 : for archive libraries.  Thank you, Linux.
5496 case "$nm_so_opt" in
5497 '')     case "$myuname" in
5498         *linux*)
5499                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5500                         nm_so_opt='--dynamic'
5501                 fi
5502                 ;;
5503         esac
5504         ;;
5505 esac
5506
5507 case "$runnm" in
5508 true)
5509 : get list of predefined functions in a handy place
5510 echo " "
5511 case "$libc" in
5512 '') libc=unknown
5513         case "$libs" in
5514         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5515         esac
5516         ;;
5517 esac
5518 libnames='';
5519 case "$libs" in
5520 '') ;;
5521 *)  for thislib in $libs; do
5522         case "$thislib" in
5523         -lc|-lc_s)
5524                 : Handle C library specially below.
5525                 ;;
5526         -l*)
5527                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5528                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5529                         :
5530                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5531                         :
5532                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5533                         :
5534                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5535                         :
5536                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5537                         :
5538                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5539                         :
5540                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5541                         :
5542                 else
5543                         try=''
5544                 fi
5545                 libnames="$libnames $try"
5546                 ;;
5547         *) libnames="$libnames $thislib" ;;
5548         esac
5549         done
5550         ;;
5551 esac
5552 xxx=normal
5553 case "$libc" in
5554 unknown)
5555         set /lib/libc.$so
5556         for xxx in $libpth; do
5557                 $test -r $1 || set $xxx/libc.$so
5558                 : The messy sed command sorts on library version numbers.
5559                 $test -r $1 || \
5560                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5561                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5562                                 h
5563                                 s/[0-9][0-9]*/0000&/g
5564                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5565                                 G
5566                                 s/\n/ /' | \
5567                          sort | $sed -e 's/^.* //'`
5568                 eval set \$$#
5569         done
5570         $test -r $1 || set /usr/ccs/lib/libc.$so
5571         $test -r $1 || set /lib/libsys_s$_a
5572         ;;
5573 *)
5574         set blurfl
5575         ;;
5576 esac
5577 if $test -r "$1"; then
5578         echo "Your (shared) C library seems to be in $1."
5579         libc="$1"
5580 elif $test -r /lib/libc && $test -r /lib/clib; then
5581         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5582         xxx=apollo
5583         libc='/lib/clib /lib/libc'
5584         if $test -r /lib/syslib; then
5585                 echo "(Your math library is in /lib/syslib.)"
5586                 libc="$libc /lib/syslib"
5587         fi
5588 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5589         echo "Your C library seems to be in $libc, as you said before."
5590 elif $test -r $incpath/usr/lib/libc$_a; then
5591         libc=$incpath/usr/lib/libc$_a;
5592         echo "Your C library seems to be in $libc.  That's fine."
5593 elif $test -r /lib/libc$_a; then
5594         libc=/lib/libc$_a;
5595         echo "Your C library seems to be in $libc.  You're normal."
5596 else
5597         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5598                 :
5599         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5600                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5601         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5602                 :
5603         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5604                 :
5605         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5606                 :
5607         else
5608                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5609         fi
5610         if $test -r "$tans"; then
5611                 echo "Your C library seems to be in $tans, of all places."
5612                 libc=$tans
5613         else
5614                 libc='blurfl'
5615         fi
5616 fi
5617 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5618         dflt="$libc"
5619         cat <<EOM
5620
5621 If the guess above is wrong (which it might be if you're using a strange
5622 compiler, or your machine supports multiple models), you can override it here.
5623
5624 EOM
5625 else
5626         dflt=''
5627         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5628         cat >&4 <<EOM
5629 I can't seem to find your C library.  I've looked in the following places:
5630
5631 EOM
5632         $sed 's/^/      /' libpath
5633         cat <<EOM
5634
5635 None of these seems to contain your C library. I need to get its name...
5636
5637 EOM
5638 fi
5639 fn=f
5640 rp='Where is your C library?'
5641 . ./getfile
5642 libc="$ans"
5643
5644 echo " "
5645 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5646 set X `cat libnames`
5647 shift
5648 xxx=files
5649 case $# in 1) xxx=file; esac
5650 echo "Extracting names from the following $xxx for later perusal:" >&4
5651 echo " "
5652 $sed 's/^/      /' libnames >&4
5653 echo " "
5654 $echo $n "This may take a while...$c" >&4
5655
5656 for file in $*; do
5657         case $file in
5658         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5659         *) $nm $nm_opt $file 2>/dev/null;;
5660         esac
5661 done >libc.tmp
5662
5663 $echo $n ".$c"
5664 $grep fprintf libc.tmp > libc.ptf
5665 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5666 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5667 xxx='[ADTSIW]'
5668 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5669         eval $xscan;\
5670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5671                 eval $xrun
5672 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5673         eval $xscan;\
5674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5675                 eval $xrun
5676 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5677         eval $xscan;\
5678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5679                 eval $xrun
5680 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5681         eval $xscan;\
5682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5683                 eval $xrun
5684 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5685         eval $xscan;\
5686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5687                 eval $xrun
5688 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5689         eval $xscan;\
5690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5691                 eval $xrun
5692 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5693                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5694         eval $xscan;\
5695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5696                 eval $xrun
5697 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5698         eval $xscan;\
5699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5700                 eval $xrun
5701 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5702         eval $xscan;\
5703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5704                 eval $xrun
5705 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5706         eval $xscan;\
5707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5708                 eval $xrun
5709 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5710         eval $xscan;\
5711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5712                 eval $xrun
5713 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5714         eval $xscan;\
5715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5716                 eval $xrun
5717 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5718         eval $xscan;\
5719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720                 eval $xrun
5721 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5722         eval $xscan;\
5723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724                 eval $xrun
5725 else
5726         $nm -p $* 2>/dev/null >libc.tmp
5727         $grep fprintf libc.tmp > libc.ptf
5728         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5729                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5730         then
5731                 nm_opt='-p'
5732                 eval $xrun
5733         else
5734                 echo " "
5735                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5736                 com=''
5737                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5738                         for thisname in $libnames $libc; do
5739                                 $ar t $thisname >>libc.tmp
5740                         done
5741                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5742                         echo "Ok." >&4
5743                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5744                         # Repeat libc to extract forwarders to DLL entries too
5745                         for thisname in $libnames $libc; do
5746                                 $ar tv $thisname >>libc.tmp
5747                                 # Revision 50 of EMX has bug in $ar.
5748                                 # it will not extract forwarders to DLL entries
5749                                 # Use emximp which will extract exactly them.
5750                                 emximp -o tmp.imp $thisname \
5751                                     2>/dev/null && \
5752                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5753                                     < tmp.imp >>libc.tmp
5754                                 $rm tmp.imp
5755                         done
5756                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5757                         echo "Ok." >&4
5758                 else
5759                         echo "$ar didn't seem to work right." >&4
5760                         echo "Maybe this is a Cray...trying bld instead..." >&4
5761                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5762                         then
5763                                 for thisname in $libnames; do
5764                                         bld t $libnames | \
5765                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5766                                         $ar t $thisname >>libc.tmp
5767                                 done
5768                                 echo "Ok." >&4
5769                         else
5770                                 echo "That didn't work either.  Giving up." >&4
5771                                 exit 1
5772                         fi
5773                 fi
5774         fi
5775 fi
5776 nm_extract="$com"
5777 if $test -f /lib/syscalls.exp; then
5778         echo " "
5779         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5780         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5781 fi
5782 ;;
5783 esac
5784 $rm -f libnames libpath
5785
5786 : see if dld is available
5787 set dld.h i_dld
5788 eval $inhdr
5789
5790 : is a C symbol defined?
5791 csym='tlook=$1;
5792 case "$3" in
5793 -v) tf=libc.tmp; tc=""; tdc="";;
5794 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5795 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5796 esac;
5797 tx=yes;
5798 case "$reuseval-$4" in
5799 true-) ;;
5800 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5801 esac;
5802 case "$tx" in
5803 yes)
5804         case "$runnm" in
5805         true)
5806                 if $contains $tlook $tf >/dev/null 2>&1;
5807                 then tval=true;
5808                 else tval=false;
5809                 fi;;
5810         *)
5811                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5812                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5813                 then tval=true;
5814                 else tval=false;
5815                 fi;
5816                 $rm -f t t.c;;
5817         esac;;
5818 *)
5819         case "$tval" in
5820         $define) tval=true;;
5821         *) tval=false;;
5822         esac;;
5823 esac;
5824 eval "$2=$tval"'
5825
5826 : define an is-in-libc? function
5827 inlibc='echo " "; td=$define; tu=$undef;
5828 sym=$1; var=$2; eval "was=\$$2";
5829 tx=yes;
5830 case "$reuseval$was" in
5831 true) ;;
5832 true*) tx=no;;
5833 esac;
5834 case "$tx" in
5835 yes)
5836         set $sym tres -f;
5837         eval $csym;
5838         case "$tres" in
5839         true)
5840                 echo "$sym() found." >&4;
5841                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5842         *)
5843                 echo "$sym() NOT found." >&4;
5844                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5845         esac;;
5846 *)
5847         case "$was" in
5848         $define) echo "$sym() found." >&4;;
5849         *) echo "$sym() NOT found." >&4;;
5850         esac;;
5851 esac'
5852
5853 : see if dlopen exists
5854 xxx_runnm="$runnm"
5855 runnm=false
5856 set dlopen d_dlopen
5857 eval $inlibc
5858 runnm="$xxx_runnm"
5859
5860 : determine which dynamic loading, if any, to compile in
5861 echo " "
5862 dldir="ext/DynaLoader"
5863 case "$usedl" in
5864 $define|y|true)
5865         dflt='y'
5866         usedl="$define"
5867         ;;
5868 $undef|n|false)
5869         dflt='n'
5870         usedl="$undef"
5871         ;;
5872 *) 
5873         dflt='n'
5874         case "$d_dlopen" in
5875             $define) dflt='y' ;;
5876         esac
5877         case "$i_dld" in
5878             $define) dflt='y' ;;
5879         esac
5880         : Does a dl_xxx.xs file exist for this operating system
5881         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5882         ;;
5883 esac
5884 rp="Do you wish to use dynamic loading?"
5885 . ./myread
5886 usedl="$ans"
5887 case "$ans" in
5888 y*) usedl="$define"
5889         case "$dlsrc" in
5890         '')
5891                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5892                         dflt="$dldir/dl_${osname}.xs"
5893                 elif $test "$d_dlopen" = "$define" ; then
5894                         dflt="$dldir/dl_dlopen.xs"
5895                 elif $test "$i_dld" = "$define" ; then
5896                         dflt="$dldir/dl_dld.xs"
5897                 else
5898                         dflt=''
5899                 fi
5900                 ;;
5901         *)      dflt="$dldir/$dlsrc"
5902                 ;;
5903         esac
5904     echo "The following dynamic loading files are available:"
5905         : Can not go over to $dldir because getfile has path hard-coded in.
5906         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5907         rp="Source file to use for dynamic loading"
5908         fn="fne"
5909         gfpth="$src"
5910         . ./getfile
5911         usedl="$define"
5912         : emulate basename
5913         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5914
5915         $cat << EOM
5916
5917 Some systems may require passing special flags to $cc -c to
5918 compile modules that will be used to create a shared library.
5919 To use no flags, say "none".
5920
5921 EOM
5922     case "$cccdlflags" in
5923     '') case "$gccversion" in
5924                 '') case "$osname" in
5925                         hpux)   dflt='+z' ;;
5926                         next)   dflt='none' ;;
5927                         irix*)  dflt='-KPIC' ;;
5928                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5929                         sunos)  dflt='-pic' ;;
5930                         *)      dflt='none' ;;
5931                     esac
5932                         ;;
5933                 *)  case "$osname" in
5934                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5935                         *)      dflt='-fpic' ;;
5936                     esac ;;
5937             esac ;;
5938         ' ') dflt='none' ;;
5939     *)  dflt="$cccdlflags" ;;
5940     esac
5941     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5942     . ./myread
5943     case "$ans" in
5944     none) cccdlflags=' ' ;;
5945     *) cccdlflags="$ans" ;;
5946     esac
5947
5948     cat << EOM
5949
5950 Some systems use ld to create libraries that can be dynamically loaded,
5951 while other systems (such as those using ELF) use $cc.
5952
5953 EOM
5954         case "$ld" in
5955         '')     $cat >try.c <<'EOM'
5956 /* Test for whether ELF binaries are produced */
5957 #include <fcntl.h>
5958 #include <stdlib.h>
5959 int main() {
5960         char b[4];
5961         int i = open("a.out",O_RDONLY);
5962         if(i == -1) 
5963                 exit(1); /* fail */
5964         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5965                 exit(0); /* succeed (yes, it's ELF) */
5966         else
5967                 exit(1); /* fail */
5968 }
5969 EOM
5970                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5971                         cat <<EOM
5972 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5973 EOM
5974                         dflt="$cc"
5975                 else
5976                         echo "I'll use ld to build dynamic libraries."
5977                         dflt='ld'
5978                 fi
5979                 rm -f try.c a.out
5980                 ;;
5981         *)      dflt="$ld"
5982                 ;;
5983         esac
5984
5985     rp="What command should be used to create dynamic libraries?"
5986     . ./myread
5987         ld="$ans"
5988
5989     cat << EOM
5990
5991 Some systems may require passing special flags to $ld to create a
5992 library that can be dynamically loaded.  If your ld flags include
5993 -L/other/path options to locate libraries outside your loader's normal
5994 search path, you may need to specify those -L options here as well.  To
5995 use no flags, say "none".
5996
5997 EOM
5998     case "$lddlflags" in
5999     '') case "$osname" in
6000                         beos) dflt='-nostart' ;;
6001                         hpux)  dflt='-b' ;;
6002                         linux|irix*)    dflt='-shared' ;;
6003                         next)  dflt='none' ;;
6004                         solaris) dflt='-G' ;;
6005                         sunos) dflt='-assert nodefinitions' ;;
6006                         svr4*|esix*) dflt="-G $ldflags" ;;
6007                 *)     dflt='none' ;;
6008                         esac
6009                         ;;
6010     *) dflt="$lddlflags" ;;
6011     esac
6012
6013         : Try to guess additional flags to pick up local libraries.
6014         : Be careful not to append to a plain 'none'
6015         case "$dflt" in
6016         none) dflt='' ;;
6017         esac
6018         for thisflag in $ldflags; do
6019                 case "$thisflag" in
6020                 -L*)
6021                         case " $dflt " in
6022                         *" $thisflag "*) ;;
6023                         *) dflt="$dflt $thisflag" ;;
6024                         esac
6025                         ;;
6026                 esac
6027         done
6028
6029         case "$dflt" in
6030         ''|' ') dflt='none' ;;
6031         esac
6032
6033     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6034     . ./myread
6035     case "$ans" in
6036     none) lddlflags=' ' ;;
6037     *) lddlflags="$ans" ;;
6038     esac
6039
6040         cat <<EOM
6041
6042 Some systems may require passing special flags to $cc to indicate that
6043 the resulting executable will use dynamic linking.  To use no flags,
6044 say "none".
6045
6046 EOM
6047     case "$ccdlflags" in
6048     '') case "$osname" in
6049                 hpux)   dflt='-Wl,-E' ;;
6050                 linux)  dflt='-rdynamic' ;;
6051                 next)   dflt='none' ;;
6052                 sunos)  dflt='none' ;;
6053                 *)      dflt='none' ;;
6054             esac ;;
6055     ' ')  dflt='none' ;;
6056     *)  dflt="$ccdlflags" ;;
6057     esac
6058     rp="Any special flags to pass to $cc to use dynamic linking?"
6059     . ./myread
6060     case "$ans" in
6061     none) ccdlflags=' ' ;;
6062     *) ccdlflags="$ans" ;;
6063     esac
6064     ;;
6065 *)  usedl="$undef"
6066         ld='ld'
6067     dlsrc='dl_none.xs'
6068     lddlflags=''
6069     ccdlflags=''
6070     ;;
6071 esac
6072
6073 also=''
6074 case "$usedl" in
6075 $undef)
6076         # No dynamic loading being used, so don't bother even to prompt.
6077         useshrplib='false'
6078         ;;
6079 *)      case "$useshrplib" in
6080         '')     case "$osname" in
6081                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6082                         dflt=y
6083                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6084                         ;;
6085                 next*)
6086                         case "$osvers" in
6087                         4*)     dflt=y
6088                                 also='Building a shared libperl is needed for MAB support.'
6089                                 ;;
6090                         *)      dflt=n
6091                                 ;;
6092                         esac
6093                         ;;
6094                 *)      dflt=n
6095                         ;;
6096                 esac
6097                 ;;
6098         $define|true|[Yy]*)
6099                 dflt=y
6100                 ;;
6101         *)      dflt=n
6102                 ;;
6103         esac
6104         $cat << EOM
6105
6106 The perl executable is normally obtained by linking perlmain.c with
6107 libperl${_a}, any static extensions (usually just DynaLoader), and
6108 any other libraries needed on this system (such as -lm, etc.).  Since
6109 your system supports dynamic loading, it is probably possible to build
6110 a shared libperl.$so.  If you will have more than one executable linked
6111 to libperl.$so, this will significantly reduce the size of each
6112 executable, but it may have a noticeable affect on performance.  The
6113 default is probably sensible for your system.
6114 $also
6115
6116 EOM
6117         rp="Build a shared libperl.$so (y/n)"
6118         . ./myread
6119         case "$ans" in
6120         true|$define|[Yy]*)
6121                 useshrplib='true'  ;;
6122         *)      useshrplib='false' ;;
6123         esac
6124         ;;
6125 esac
6126
6127 case "$useshrplib" in
6128 true)
6129         case "$libperl" in
6130         '')
6131                 # Figure out a good name for libperl.so.  Since it gets stored in
6132                 # a version-specific architecture-dependent library, the version
6133                 # number isn't really that important, except for making cc/ld happy.
6134                 #
6135                 # A name such as libperl.so.3.1
6136                 majmin="libperl.$so.$patchlevel.$subversion"
6137                 # A name such as libperl.so.301
6138                 majonly=`echo $patchlevel $subversion |
6139                         $awk '{printf "%d%02d", $1, $2}'`
6140                 majonly=libperl.$so.$majonly
6141                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6142                 # rely on figuring it out from the naming of libc.
6143                 case "${osname}${osvers}" in
6144                 next4*)
6145                         dflt=libperl.5.$so
6146                         # XXX How handle the --version stuff for MAB?
6147                         ;;
6148                 linux*)  # ld won't link with a bare -lperl otherwise.
6149                         dflt=libperl.$so
6150                         ;;
6151                 cygwin*) # include version
6152                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6153                         ;;
6154                 *)      # Try to guess based on whether libc has major.minor.
6155                         case "$libc" in
6156                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6157                         *libc.$so.[0-9]*) dflt=$majonly ;;
6158                         *)      dflt=libperl.$so ;;
6159                         esac
6160                         ;;
6161                 esac
6162                 ;;
6163         *)      dflt=$libperl
6164                 ;;
6165         esac
6166         cat << EOM
6167
6168 I need to select a good name for the shared libperl.  If your system uses
6169 library names with major and minor numbers, then you might want something
6170 like $majmin.  Alternatively, if your system uses a single version
6171 number for shared libraries, then you might want to use $majonly.
6172 Or, your system might be quite happy with a simple libperl.$so.
6173
6174 Since the shared libperl will get installed into a version-specific
6175 architecture-dependent directory, the version number of the shared perl
6176 library probably isn't important, so the default should be o.k.
6177
6178 EOM
6179         rp='What name do you want to give to the shared libperl?'
6180         . ./myread
6181         libperl=$ans
6182         echo "Ok, I'll use $libperl"
6183         ;;
6184 *)
6185         libperl="libperl${_a}"
6186         ;;
6187 esac
6188
6189 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6190 case "$shrpdir" in
6191 '') ;;
6192 *)      $cat >&4 <<EOM
6193 WARNING:  Use of the shrpdir variable for the installation location of
6194 the shared $libperl is not supported.  It was never documented and
6195 will not work in this version.  Let me (perlbug@perl.com)
6196 know of any problems this may cause.
6197
6198 EOM
6199         case "$shrpdir" in
6200         "$archlibexp/CORE")
6201                 $cat >&4 <<EOM
6202 But your current setting of $shrpdir is
6203 the default anyway, so it's harmless.
6204 EOM
6205                 ;;
6206         *)
6207                 $cat >&4 <<EOM
6208 Further, your current attempted setting of $shrpdir
6209 conflicts with the value of $archlibexp/CORE
6210 that installperl will use.
6211 EOM
6212                 ;;
6213         esac
6214         ;;
6215 esac
6216
6217 # How will the perl executable find the installed shared $libperl?
6218 # Add $xxx to ccdlflags.
6219 # If we can't figure out a command-line option, use $shrpenv to
6220 # set env LD_RUN_PATH.  The main perl makefile uses this.
6221 shrpdir=$archlibexp/CORE
6222 xxx=''
6223 tmp_shrpenv=''
6224 if "$useshrplib"; then
6225     case "$osname" in 
6226         aix)
6227                 # We'll set it in Makefile.SH...
6228                 ;;
6229         solaris|netbsd)
6230                 xxx="-R $shrpdir"
6231                 ;;
6232         freebsd)
6233                 xxx="-Wl,-R$shrpdir"
6234                 ;;
6235         linux|irix*|dec_osf)
6236                 xxx="-Wl,-rpath,$shrpdir"
6237                 ;;
6238         next)
6239                 # next doesn't like the default...
6240                 ;;
6241         beos)
6242                 # beos doesn't like the default, either.
6243                 ;;
6244         hpux*)
6245                 # hpux doesn't like the default, either.
6246                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6247                 ;;
6248         *)
6249                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6250                 ;;
6251         esac
6252         case "$xxx" in
6253         '') ;;
6254         *)      
6255                 # Only add $xxx if it isn't already in ccdlflags.
6256                 case " $ccdlflags " in
6257                 *" $xxx "*)     ;;
6258                 *)      ccdlflags="$ccdlflags $xxx"
6259                         cat <<EOM >&4
6260
6261 Adding $xxx to the flags
6262 passed to $ld so that the perl executable will find the 
6263 installed shared $libperl.
6264
6265 EOM
6266                         ;;
6267                 esac
6268                 ;;
6269         esac
6270 fi
6271 # Fix ccdlflags in AIX for building external extensions.
6272 # (For building Perl itself bare -bE:perl.exp is needed,
6273 #  Makefile.SH takes care of this.)
6274 case "$osname" in
6275 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6276 esac
6277 # Respect a hint or command-line value.
6278 case "$shrpenv" in
6279 '') shrpenv="$tmp_shrpenv" ;;
6280 esac
6281 case "$ldlibpthname" in
6282 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6283 none)   ldlibpthname='' ;;
6284 esac
6285
6286 : determine where manual pages go
6287 set man1dir man1dir none
6288 eval $prefixit
6289 $cat <<EOM
6290
6291 $spackage has manual pages available in source form.
6292 EOM
6293 case "$nroff" in
6294 nroff)
6295         echo "However, you don't have nroff, so they're probably useless to you."
6296         case "$man1dir" in
6297         '') man1dir="none";;
6298         esac;;
6299 esac
6300 echo "If you don't want the manual sources installed, answer 'none'."
6301 case "$man1dir" in
6302 ' ') dflt=none
6303         ;;
6304 '')
6305         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6306         lookpath="$lookpath $prefixexp/man/p_man/man1"
6307         lookpath="$lookpath $prefixexp/man/u_man/man1"
6308         lookpath="$lookpath $prefixexp/man/man.1"
6309         case "$sysman" in
6310         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6311         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6312         esac
6313         set dflt
6314         eval $prefixup
6315         ;;
6316 *)  dflt="$man1dir"
6317         ;;
6318 esac
6319 echo " "
6320 fn=dn+~
6321 rp="Where do the main $spackage manual pages (source) go?"
6322 . ./getfile
6323 if $test "X$man1direxp" != "X$ansexp"; then
6324         installman1dir=''
6325 fi
6326 man1dir="$ans"
6327 man1direxp="$ansexp"
6328 case "$man1dir" in
6329 '')     man1dir=' '
6330         installman1dir='';;
6331 esac
6332
6333 : Change installation prefix, if necessary.
6334 if $test X"$prefix" != X"$installprefix"; then
6335         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6336 else
6337         installman1dir="$man1direxp"
6338 fi
6339
6340 : What suffix to use on installed man pages
6341
6342 case "$man1dir" in
6343 ' ')
6344         man1ext='0'
6345         ;;
6346 *)
6347         rp="What suffix should be used for the main $spackage man pages?"
6348         case "$man1ext" in
6349         '')     case "$man1dir" in
6350                 *1)  dflt=1 ;;
6351                 *1p) dflt=1p ;;
6352                 *1pm) dflt=1pm ;;
6353                 *l) dflt=l;;
6354                 *n) dflt=n;;
6355                 *o) dflt=o;;
6356                 *p) dflt=p;;
6357                 *C) dflt=C;;
6358                 *L) dflt=L;;
6359                 *L1) dflt=L1;;
6360                 *) dflt=1;;
6361                 esac
6362                 ;;
6363         *)      dflt="$man1ext";;
6364         esac
6365         . ./myread
6366         man1ext="$ans"
6367         ;;
6368 esac
6369
6370 : see if we can have long filenames
6371 echo " "
6372 rmlist="$rmlist /tmp/cf$$"
6373 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6374 first=123456789abcdef
6375 second=/tmp/cf$$/$first
6376 $rm -f $first $second
6377 if (echo hi >$first) 2>/dev/null; then
6378         if $test -f 123456789abcde; then
6379                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6380                 val="$undef"
6381         else
6382                 if (echo hi >$second) 2>/dev/null; then
6383                         if $test -f /tmp/cf$$/123456789abcde; then
6384                                 $cat <<'EOM'
6385 That's peculiar... You can have filenames longer than 14 characters, but only
6386 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6387 I shall consider your system cannot support long filenames at all.
6388 EOM
6389                                 val="$undef"
6390                         else
6391                                 echo 'You can have filenames longer than 14 characters.' >&4
6392                                 val="$define"
6393                         fi
6394                 else
6395                         $cat <<'EOM'
6396 How confusing! Some of your filesystems are sane enough to allow filenames
6397 longer than 14 characters but some others like /tmp can't even think about them.
6398 So, for now on, I shall assume your kernel does not allow them at all.
6399 EOM
6400                         val="$undef"
6401                 fi
6402         fi
6403 else
6404         $cat <<'EOM'
6405 You can't have filenames longer than 14 chars.  You can't even think about them!
6406 EOM
6407         val="$undef"
6408 fi 
6409 set d_flexfnam
6410 eval $setvar
6411 $rm -rf /tmp/cf$$ 123456789abcde*
6412
6413 : determine where library module manual pages go
6414 set man3dir man3dir none
6415 eval $prefixit
6416 $cat <<EOM
6417
6418 $spackage has manual pages for many of the library modules.
6419 EOM
6420
6421 case "$nroff" in
6422 nroff)
6423         $cat <<'EOM'
6424 However, you don't have nroff, so they're probably useless to you.
6425 EOM
6426         case "$man3dir" in
6427         '') man3dir="none";;
6428         esac;;
6429 esac
6430
6431 case "$d_flexfnam" in
6432 undef)
6433         $cat <<'EOM'
6434 However, your system can't handle the long file names like File::Basename.3. 
6435 EOM
6436         case "$man3dir" in
6437         '') man3dir="none";;
6438         esac;;
6439 esac
6440
6441 echo "If you don't want the manual sources installed, answer 'none'."
6442 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6443 case "$man3dir" in
6444 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6445         if $test -d "$privlib/man/man3"; then
6446                 cat <<EOM >&4
6447
6448 WARNING:  Previous versions of perl installed man3 pages into
6449 $privlib/man/man3.  This version will suggest a 
6450 new default of $dflt.  
6451 EOM
6452                 tdflt=$dflt
6453                 dflt='n'
6454                 rp='Do you wish to preserve the old behavior?(y/n)'
6455                 . ./myread
6456                 case "$ans" in
6457                 y*) dflt="$privlib/man/man3" ;;
6458                 *)  dflt=$tdflt ;;
6459                 esac
6460     fi
6461         ;;
6462 ' ') dflt=none;;
6463 *)      dflt="$man3dir" ;;
6464 esac
6465 echo " "
6466 fn=dn+~
6467 rp="Where do the $package library man pages (source) go?"
6468 . ./getfile
6469 man3dir="$ans"
6470 man3direxp="$ansexp"
6471 case "$man1dir" in
6472 '')     man3dir=' '
6473         installman3dir='';;
6474 esac
6475
6476 : Change installation prefix, if necessary.
6477 if $test X"$prefix" != X"$installprefix"; then
6478         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6479 else
6480         installman3dir="$man3direxp"
6481 fi
6482
6483 : What suffix to use on installed man pages
6484 case "$man3dir" in
6485 ' ')
6486         man3ext='0'
6487         ;;
6488 *)
6489         rp="What suffix should be used for the $package library man pages?"
6490         case "$man3ext" in
6491         '')     case "$man3dir" in
6492                 *3)  dflt=3 ;;
6493                 *3p) dflt=3p ;;
6494                 *3pm) dflt=3pm ;;
6495                 *l) dflt=l;;
6496                 *n) dflt=n;;
6497                 *o) dflt=o;;
6498                 *p) dflt=p;;
6499                 *C) dflt=C;;
6500                 *L) dflt=L;;
6501                 *L3) dflt=L3;;
6502                 *) dflt=3;;
6503                 esac
6504                 ;;
6505         *)      dflt="$man3ext";;
6506         esac
6507         . ./myread
6508         man3ext="$ans"
6509         ;;
6510 esac
6511
6512 : see if we have to deal with yellow pages, now NIS.
6513 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6514         if $test -f /usr/etc/nibindd; then
6515                 echo " "
6516                 echo "I'm fairly confident you're on a NeXT."
6517                 echo " "
6518                 rp='Do you get the hosts file via NetInfo?'
6519                 dflt=y
6520                 case "$hostcat" in
6521                 nidump*) ;;
6522                 '') ;;
6523                 *) dflt=n;;
6524                 esac
6525                 . ./myread
6526                 case "$ans" in
6527                 y*) hostcat='nidump hosts .';;
6528                 *)      case "$hostcat" in
6529                         nidump*) hostcat='';;
6530                         esac
6531                         ;;
6532                 esac
6533         fi
6534         case "$hostcat" in
6535         nidump*) ;;
6536         *)
6537                 case "$hostcat" in
6538                 *ypcat*) dflt=y;;
6539                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6540                                 dflt=y
6541                         else
6542                                 dflt=n
6543                         fi;;
6544                 *) dflt=n;;
6545                 esac
6546                 echo " "
6547                 rp='Are you getting the hosts file via yellow pages?'
6548                 . ./myread
6549                 case "$ans" in
6550                 y*) hostcat='ypcat hosts';;
6551                 *) hostcat='cat /etc/hosts';;
6552                 esac
6553                 ;;
6554         esac
6555 fi
6556 case "$hostcat" in
6557 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6558 esac
6559 case "$groupcat" in
6560 '') test -f /etc/group && groupcat='cat /etc/group';;
6561 esac
6562 case "$passcat" in
6563 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6564 esac
6565
6566 : now get the host name
6567 echo " "
6568 echo "Figuring out host name..." >&4
6569 case "$myhostname" in
6570 '') cont=true
6571         echo 'Maybe "hostname" will work...'
6572         if tans=`sh -c hostname 2>&1` ; then
6573                 myhostname=$tans
6574                 phostname=hostname
6575                 cont=''
6576         fi
6577         ;;
6578 *) cont='';;
6579 esac
6580 if $test "$cont"; then
6581         if ./xenix; then
6582                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6583                 if tans=`cat /etc/systemid 2>&1` ; then
6584                         myhostname=$tans
6585                         phostname='cat /etc/systemid'
6586                         echo "Whadyaknow.  Xenix always was a bit strange..."
6587                         cont=''
6588                 fi
6589         elif $test -r /etc/systemid; then
6590                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6591         fi
6592 fi
6593 if $test "$cont"; then
6594         echo 'No, maybe "uuname -l" will work...'
6595         if tans=`sh -c 'uuname -l' 2>&1` ; then
6596                 myhostname=$tans
6597                 phostname='uuname -l'
6598         else
6599                 echo 'Strange.  Maybe "uname -n" will work...'
6600                 if tans=`sh -c 'uname -n' 2>&1` ; then
6601                         myhostname=$tans
6602                         phostname='uname -n'
6603                 else
6604                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6605                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6606                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6607                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6608                         else
6609                                 case "$myhostname" in
6610                                 '') echo "Does this machine have an identity crisis or something?"
6611                                         phostname='';;
6612                                 *)
6613                                         echo "Well, you said $myhostname before..."
6614                                         phostname='echo $myhostname';;
6615                                 esac
6616                         fi
6617                 fi
6618         fi
6619 fi
6620 : you do not want to know about this
6621 set $myhostname
6622 myhostname=$1
6623
6624 : verify guess
6625 if $test "$myhostname" ; then
6626         dflt=y
6627         rp='Your host name appears to be "'$myhostname'".'" Right?"
6628         . ./myread
6629         case "$ans" in
6630         y*) ;;
6631         *) myhostname='';;
6632         esac
6633 fi
6634
6635 : bad guess or no guess
6636 while $test "X$myhostname" = X ; do
6637         dflt=''
6638         rp="Please type the (one word) name of your host:"
6639         . ./myread
6640         myhostname="$ans"
6641 done
6642
6643 : translate upper to lower if necessary
6644 case "$myhostname" in
6645 *[A-Z]*)
6646         echo "(Normalizing case in your host name)"
6647         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6648         ;;
6649 esac
6650
6651 case "$myhostname" in
6652 *.*)
6653         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6654         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6655         echo "(Trimming domain name from host name--host name is now $myhostname)"
6656         ;;
6657 *) case "$mydomain" in
6658         '')
6659                 {
6660                         test "X$hostcat" = "Xypcat hosts" &&
6661                         ypmatch "$myhostname" hosts 2>/dev/null |\
6662                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6663                         $test -s hosts
6664                 } || {
6665                         test "X$hostcat" != "X" &&
6666                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6667                                         /[       ]$myhostname[  . ]/p" > hosts
6668                 }
6669                 tmp_re="[       . ]"
6670                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6671                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6672                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6673                         hosts | $sort | $uniq | \
6674                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6675                 case `$echo X$dflt` in
6676                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6677                         dflt=.
6678                         ;;
6679                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6680                         ;;
6681                 esac
6682                 case "$dflt" in
6683                 .)
6684                         tans=`./loc resolv.conf X /etc /usr/etc`
6685                         if $test -f "$tans"; then
6686                                 echo "(Attempting domain name extraction from $tans)"
6687                                 dflt=.`$sed -n -e 's/   / /g' \
6688                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6689                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6690                                 case "$dflt" in
6691                                 .) dflt=.`$sed -n -e 's/        / /g' \
6692                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6693                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6694                                         ;;
6695                                 esac
6696                         fi
6697                         ;;
6698                 esac
6699                 case "$dflt" in
6700                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6701                         dflt=.`sh -c domainname 2>/dev/null`
6702                         case "$dflt" in
6703                         '') dflt='.';;
6704                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6705                         esac
6706                         ;;
6707                 esac
6708                 case "$dflt" in
6709                 .) echo "(Lost all hope -- silly guess then)"
6710                         dflt='.uucp'
6711                         ;;
6712                 esac
6713                 $rm -f hosts
6714                 ;;
6715         *) dflt="$mydomain";;
6716         esac;;
6717 esac
6718 echo " "
6719 rp="What is your domain name?"
6720 . ./myread
6721 tans="$ans"
6722 case "$ans" in
6723 '') ;;
6724 .*) ;;
6725 *) tans=".$tans";;
6726 esac
6727 mydomain="$tans"
6728
6729 : translate upper to lower if necessary
6730 case "$mydomain" in
6731 *[A-Z]*)
6732         echo "(Normalizing case in your domain name)"
6733         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6734         ;;
6735 esac
6736
6737 : a little sanity check here
6738 case "$phostname" in
6739 '') ;;
6740 *)
6741         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6742         $myhostname$mydomain|$myhostname) ;;
6743         *)
6744                 case "$phostname" in
6745                 sed*)
6746                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6747                         ;;
6748                 *)
6749                         echo "(That doesn't agree with your $phostname command, by the way.)"
6750                         ;;
6751                 esac
6752         ;;
6753         esac
6754         ;;
6755 esac
6756
6757 $cat <<EOM
6758
6759 I need to get your e-mail address in Internet format if possible, i.e.
6760 something like user@host.domain. Please answer accurately since I have
6761 no easy means to double check it. The default value provided below
6762 is most probably close to reality but may not be valid from outside
6763 your organization...
6764
6765 EOM
6766 cont=x
6767 while test "$cont"; do
6768         case "$cf_email" in
6769         '') dflt="$cf_by@$myhostname$mydomain";;
6770         *) dflt="$cf_email";;
6771         esac
6772         rp='What is your e-mail address?'
6773         . ./myread
6774         cf_email="$ans"
6775         case "$cf_email" in
6776         *@*.*) cont='' ;;
6777         *)
6778                 rp='Address does not look like an Internet one.  Use it anyway?'
6779                 case "$fastread" in
6780                 yes) dflt=y ;;
6781                 *) dflt=n ;;
6782                 esac
6783                 . ./myread
6784                 case "$ans" in
6785                 y*) cont='' ;;
6786                 *) echo " " ;;
6787                 esac
6788                 ;;
6789         esac
6790 done
6791
6792 $cat <<EOM
6793
6794 If you or somebody else will be maintaining perl at your site, please
6795 fill in the correct e-mail address here so that they may be contacted
6796 if necessary. Currently, the "perlbug" program included with perl
6797 will send mail to this address in addition to perlbug@perl.com. You may
6798 enter "none" for no administrator.
6799
6800 EOM
6801 case "$perladmin" in
6802 '') dflt="$cf_email";;
6803 *) dflt="$perladmin";;
6804 esac
6805 rp='Perl administrator e-mail address'
6806 . ./myread
6807 perladmin="$ans"
6808
6809 : figure out how to guarantee perl startup
6810 case "$startperl" in
6811 '')
6812         case "$sharpbang" in
6813         *!)
6814                 $cat <<EOH
6815
6816 I can use the #! construct to start perl on your system. This will
6817 make startup of perl scripts faster, but may cause problems if you
6818 want to share those scripts and perl is not in a standard place
6819 ($binexp/perl) on all your platforms. The alternative is to force
6820 a shell by starting the script with a single ':' character.
6821
6822 EOH
6823                 dflt="$binexp/perl"
6824                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6825                 . ./myread
6826                 case "$ans" in
6827                 none)   startperl=": # use perl";;
6828                 *)      startperl="#!$ans"
6829                         if $test 30 -lt `echo "$ans" | wc -c`; then
6830                                 $cat >&4 <<EOM
6831
6832 WARNING:  Some systems limit the #! command to 32 characters.
6833 If you experience difficulty running Perl scripts with #!, try
6834 installing Perl in a directory with a shorter pathname.
6835
6836 EOM
6837                         fi ;;
6838                 esac
6839                 ;;
6840         *) startperl=": # use perl"
6841                 ;;
6842         esac
6843         ;;
6844 esac
6845 echo "I'll use $startperl to start perl scripts."
6846
6847 : figure best path for perl in scripts
6848 case "$perlpath" in
6849 '')
6850         perlpath="$binexp/perl"
6851         case "$startperl" in
6852         *!*) ;;
6853         *)
6854                 $cat <<EOH
6855
6856 I will use the "eval 'exec'" idiom to start Perl on your system.
6857 I can use the full path of your Perl binary for this purpose, but
6858 doing so may cause problems if you want to share those scripts and
6859 Perl is not always in a standard place ($binexp/perl).
6860
6861 EOH
6862                 dflt="$binexp/perl"
6863                 rp="What path shall I use in \"eval 'exec'\"?"
6864                 . ./myread
6865                 perlpath="$ans"
6866                 ;;
6867         esac
6868         ;;
6869 esac
6870 case "$startperl" in
6871 *!*)    ;;
6872 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6873 esac
6874
6875 : determine where public executable scripts go
6876 set scriptdir scriptdir
6877 eval $prefixit
6878 case "$scriptdir" in
6879 '')
6880         dflt="$bin"
6881         : guess some guesses
6882         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6883         $test -d /usr/share/bin     && dflt=/usr/share/bin
6884         $test -d /usr/local/script  && dflt=/usr/local/script
6885         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6886         $test -d $prefixexp/script  && dflt=$prefixexp/script
6887         set dflt
6888         eval $prefixup
6889         ;;
6890 *)  dflt="$scriptdir"
6891         ;;
6892 esac
6893 $cat <<EOM
6894  
6895 Some installations have a separate directory just for executable scripts so
6896 that they can mount it across multiple architectures but keep the scripts in
6897 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6898 Or you might just lump your scripts in with all your other executables.
6899  
6900 EOM
6901 fn=d~
6902 rp='Where do you keep publicly executable scripts?'
6903 . ./getfile
6904 if $test "X$ansexp" != "X$scriptdirexp"; then
6905         installscript=''
6906 fi
6907 scriptdir="$ans"
6908 scriptdirexp="$ansexp"
6909 : Change installation prefix, if necessary.
6910 if $test X"$prefix" != X"$installprefix"; then
6911         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6912 else
6913         installscript="$scriptdirexp"
6914 fi
6915
6916 : determine where site specific architecture-dependent libraries go.
6917 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6918 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6919 : sitelib may have an optional trailing /share.
6920 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6921 tdflt="$tdflt/$archname"
6922 set sitearch sitearch none
6923 eval $prefixit
6924 case "$sitearch" in
6925 '')     dflt="$tdflt" ;;
6926 *)      dflt="$sitearch" ;;
6927 esac
6928 $cat <<EOM
6929
6930 The installation process will also create a directory for
6931 architecture-dependent site-specific extensions and modules.
6932
6933 EOM
6934 fn=nd~+
6935 rp='Pathname for the site-specific architecture-dependent library files?'
6936 . ./getfile
6937 sitearch="$ans"
6938 sitearchexp="$ansexp"
6939 : Change installation prefix, if necessary.
6940 if $test X"$prefix" != X"$installprefix"; then
6941         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6942 else
6943         installsitearch="$sitearchexp"
6944 fi
6945
6946 : determine where add-on public executables go
6947 case "$sitebin" in
6948 '')     dflt=$siteprefix/bin ;;
6949 *)      dflt=$sitebin ;;
6950 esac
6951 fn=d~
6952 rp='Pathname where the add-on public executables should be installed?'
6953 . ./getfile
6954 sitebin="$ans"
6955 sitebinexp="$ansexp"
6956 : Change installation prefix, if necessary.
6957 if $test X"$prefix" != X"$installprefix"; then
6958         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6959 else
6960         installsitebin="$sitebinexp"
6961 fi
6962
6963 cat <<EOM
6964
6965 Perl can be built to take advantage of long doubles which
6966 (if available) may give more accuracy and range for floating point numbers.
6967
6968 If this doesn't make any sense to you, just accept the default 'n'.
6969 EOM
6970
6971 case "$ccflags" in
6972 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6973 esac
6974
6975 case "$uselongdouble" in
6976 $define|true|[yY]*)     dflt='y';;
6977 *) dflt='n';;
6978 esac
6979 rp='Try to use long doubles if available?'
6980 . ./myread
6981 case "$ans" in
6982 y|Y)    val="$define"   ;;
6983 *)      val="$undef"    ;;
6984 esac
6985 set uselongdouble
6986 eval $setvar
6987
6988 case "$uselongdouble" in
6989 true|[yY]*) uselongdouble="$define" ;;
6990 esac
6991
6992 case "$uselongdouble" in
6993 $define)
6994 : Look for a hint-file generated 'call-back-unit'.  If the
6995 : user has specified that long doubles should be used,
6996 : we may need to set or change some other defaults.
6997         if $test -f uselongdouble.cbu; then
6998                 echo "Your platform has some specific hints for long doubles, using them..."
6999                 . ./uselongdouble.cbu
7000         else
7001                 $cat <<EOM
7002 (Your platform doesn't have any specific hints for long doubles.)
7003 EOM
7004         fi
7005         ;;
7006 esac
7007
7008 cat <<EOM
7009
7010 Perl can be built to take advantage of long longs which
7011 (if available) may give more range for integer numbers.
7012
7013 If this doesn't make any sense to you, just accept the default 'n'.
7014 EOM
7015
7016 case "$ccflags" in
7017 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7018 esac
7019
7020 case "$uselonglong" in
7021 $define|true|[yY]*)     dflt='y';;
7022 *) dflt='n';;
7023 esac
7024 rp='Try to use long longs if available?'
7025 . ./myread
7026 case "$ans" in
7027 y|Y)    val="$define"   ;;
7028 *)      val="$undef"    ;;
7029 esac
7030 set uselonglong
7031 eval $setvar
7032
7033 case "$uselonglong" in
7034 true|[yY]*) uselonglong="$define" ;;
7035 esac
7036
7037 case "$uselonglong" in
7038 $define)
7039 : Look for a hint-file generated 'call-back-unit'.  If the
7040 : user has specified that long longs should be used,
7041 : we may need to set or change some other defaults.
7042         if $test -f uselonglong.cbu; then
7043                 echo "Your platform has some specific hints for long longs, using them..."
7044                 . ./uselonglong.cbu
7045         else
7046                 $cat <<EOM
7047 (Your platform doesn't have any specific hints for long longs.)
7048 EOM
7049         fi
7050         ;;
7051 esac
7052
7053 cat <<EOM
7054
7055 Previous version of $package used the standard IO mechanisms as defined
7056 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7057 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7058 the default.  This abstraction layer can use AT&T's sfio (if you already
7059 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7060 problems with some extension modules.  Using PerlIO with stdio is safe,
7061 but it is slower than plain stdio and therefore is not the default.
7062
7063 If this doesn't make any sense to you, just accept the default 'n'.
7064 EOM
7065 case "$useperlio" in
7066 $define|true|[yY]*)     dflt='y';;
7067 *) dflt='n';;
7068 esac
7069 rp='Use the experimental PerlIO abstraction layer?'
7070 . ./myread
7071 case "$ans" in
7072 y|Y) 
7073         val="$define"
7074         ;;     
7075 *)      
7076         echo "Ok, doing things the stdio way"
7077         val="$undef"
7078         ;;
7079 esac
7080 set useperlio
7081 eval $setvar 
7082
7083 case "$vendorprefix" in
7084 '')     d_vendorbin="$undef"
7085         vendorbin=''
7086         vendorbinexp=''
7087         ;;
7088 *)      d_vendorbin="$define"
7089         : determine where vendor-supplied executables go.
7090         dflt=$vendorprefix/bin
7091         fn=d~+
7092         rp='Pathname for the vendor-supplied executables directory?'
7093         . ./getfile
7094         vendorbin="$ans"
7095         vendorbinexp="$ansexp"
7096         : Change installation prefix, if necessary.
7097         if $test X"$prefix" != X"$installprefix"; then
7098                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7099         else
7100                 installvendorbin="$vendorbinexp"
7101         fi
7102         ;;
7103 esac
7104
7105 : check for length of double
7106 echo " "
7107 case "$doublesize" in
7108 '')
7109         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7110         $cat >try.c <<'EOCP'
7111 #include <stdio.h>
7112 int main()
7113 {
7114     printf("%d\n", (int)sizeof(double));
7115     exit(0);
7116 }
7117 EOCP
7118         set try
7119         if eval $compile_ok; then
7120                 doublesize=`./try`
7121                 $echo " $doublesize bytes." >&4
7122         else
7123                 dflt='8'
7124                 echo "(I can't seem to compile the test program.  Guessing...)"
7125                 rp="What is the size of a double precision number (in bytes)?"
7126                 . ./myread
7127                 doublesize="$ans"
7128         fi
7129         ;;
7130 esac
7131 $rm -f try.c try
7132
7133 : check for long doubles
7134 echo " "
7135 $echo $n "Checking to see if your system supports long double..." $c >&4
7136 echo 'int main() { long double x = 7.0; }' > try.c
7137 set try
7138 if eval $compile; then
7139         val="$define"
7140         echo " Yes, it does." >&4
7141 else
7142         val="$undef"
7143         echo " No, it doesn't." >&4
7144 fi
7145 $rm try.*
7146 set d_longdbl
7147 eval $setvar
7148
7149 : check for length of long double
7150 case "${d_longdbl}${longdblsize}" in
7151 $define)
7152         echo " "
7153         $echo $n "Checking to see how big your long doubles are..." $c >&4
7154         $cat >try.c <<'EOCP'
7155 #include <stdio.h>
7156 int main()
7157 {
7158         printf("%d\n", sizeof(long double));
7159 }
7160 EOCP
7161         set try
7162         set try
7163         if eval $compile; then
7164                 longdblsize=`./try$exe_ext`
7165                 $echo " $longdblsize bytes." >&4
7166         else
7167                 dflt='8'
7168                 echo " "
7169                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7170                 rp="What is the size of a long double (in bytes)?"
7171                 . ./myread
7172                 longdblsize="$ans"
7173         fi
7174         if $test "X$doublesize" = "X$longdblsize"; then
7175                 echo "(That isn't any different from an ordinary double.)"
7176         fi      
7177         ;;
7178 esac
7179 $rm -f try.* try
7180
7181 : Check how to convert floats to strings.
7182 if test "X$d_Gconvert" = X; then
7183         echo " "
7184         echo "Checking for an efficient way to convert floats to strings."
7185         $cat >try.c <<EOP
7186 #ifdef TRY_gconvert
7187 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7188 char *myname = "gconvert";
7189 #endif
7190 #ifdef TRY_gcvt
7191 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7192 char *myname = "gcvt";
7193 #endif
7194 #ifdef TRY_qgcvt
7195 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7196 char *myname = "qgcvt";
7197 #define DOUBLETYPE long double
7198 #endif
7199 #ifdef TRY_sprintf
7200 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7201 char *myname = "sprintf";
7202 #endif
7203
7204 #ifndef DOUBLETYPE
7205 #define DOUBLETYPE double
7206 #endif
7207
7208 #include <stdio.h>
7209
7210 #define I_STDLIB $i_stdlib
7211 #ifdef I_STDLIB
7212 #include <stdlib.h>
7213 #endif
7214
7215 int
7216 checkit(expect, got)
7217 char *expect;
7218 char *got;
7219 {
7220     if (strcmp(expect, got)) {
7221                 printf("%s oddity:  Expected %s, got %s\n",
7222                         myname, expect, got);
7223                 exit(1);
7224         }
7225 }
7226
7227 int main()
7228
7229         char buf[64]; 
7230         buf[63] = '\0';
7231
7232         /* This must be 1st test on (which?) platform */
7233         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7234         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7235         checkit("0.1", buf);
7236
7237         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7238         checkit("1", buf);
7239
7240         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7241         checkit("0", buf);
7242
7243         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7244         checkit("-1", buf);
7245
7246         /* Some Linux gcvt's give 1.e+5 here. */
7247         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7248         checkit("100000", buf);
7249         
7250         /* Some Linux gcvt's give -1.e+5 here. */
7251         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7252         checkit("-100000", buf);
7253
7254         exit(0);
7255 }
7256 EOP
7257         case "$d_Gconvert" in
7258         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7259         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7260         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7261         *) xxx_list='gconvert gcvt sprintf' ;;
7262         esac
7263
7264         case "$d_longdbl$uselongdouble" in
7265         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7266         esac
7267
7268         for xxx_convert in $xxx_list; do
7269                 echo "Trying $xxx_convert..."
7270                 $rm -f try try$_o
7271                 set try -DTRY_$xxx_convert
7272                 if eval $compile; then
7273                         echo "$xxx_convert() found." >&4
7274                         if ./try; then
7275                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7276                                 break;
7277                         else
7278                                 echo "...But $xxx_convert didn't work as I expected."
7279                         fi
7280                 else
7281                         echo "$xxx_convert NOT found." >&4
7282                 fi
7283         done
7284                 
7285         case "$xxx_convert" in
7286         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7287         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7288         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7289         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7290         esac
7291 fi
7292
7293 echo " "
7294
7295 if $test X"$d_longdbl" = X"$define"; then
7296
7297 echo "Checking how to print long doubles..." >&4
7298
7299 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7300         $cat >try.c <<'EOCP'
7301 #include <sys/types.h>
7302 #include <stdio.h>
7303 int main() {
7304   double d = 123.456;
7305   printf("%.3f\n", d);
7306 }
7307 EOCP
7308         set try
7309         if eval $compile; then
7310                 yyy=`./try$exe_ext`
7311                 case "$yyy" in
7312                 123.456)
7313                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7314                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7315                         echo "We will use %f."
7316                         ;;
7317                 esac
7318         fi
7319 fi
7320
7321 if $test X"$sPRIfldbl" = X; then
7322         $cat >try.c <<'EOCP'
7323 #include <sys/types.h>
7324 #include <stdio.h>
7325 int main() {
7326   long double d = 123.456;
7327   printf("%.3llf\n", d);
7328 }
7329 EOCP
7330         set try
7331         if eval $compile; then
7332                 yyy=`./try$exe_ext`
7333                 case "$yyy" in
7334                 123.456)
7335                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7336                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7337                         echo "We will use %llf."
7338                         ;;
7339                 esac
7340         fi
7341 fi
7342
7343 if $test X"$sPRIfldbl" = X; then
7344         $cat >try.c <<'EOCP'
7345 #include <sys/types.h>
7346 #include <stdio.h>
7347 int main() {
7348   long double d = 123.456;
7349   printf("%.3Lf\n", d);
7350 }
7351 EOCP
7352         set try
7353         if eval $compile; then
7354                 yyy=`./try$exe_ext`
7355                 case "$yyy" in
7356                 123.456)
7357                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7358                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7359                         echo "We will use %Lf."
7360                         ;;
7361                 esac
7362         fi
7363 fi
7364
7365 if $test X"$sPRIfldbl" = X; then
7366         $cat >try.c <<'EOCP'
7367 #include <sys/types.h>
7368 #include <stdio.h>
7369 int main() {
7370   long double d = 123.456;
7371   printf("%.3lf\n", d);
7372 }
7373 EOCP
7374         set try
7375         if eval $compile; then
7376                 yyy=`./try$exe_ext`
7377                 case "$yyy" in
7378                 123.456)
7379                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7380                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7381                         echo "We will use %lf."
7382                         ;;
7383                 esac
7384         fi
7385 fi
7386
7387 if $test X"$sPRIfldbl" = X; then
7388         echo "Cannot figure out how to print long doubles." >&4
7389 fi
7390
7391 $rm -f try try.*
7392
7393 fi # d_longdbl
7394
7395 case "$sPRIfldbl" in
7396 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7397         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7398         ;;
7399 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7400         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7401         ;;
7402 esac
7403
7404 : Initialize h_fcntl
7405 h_fcntl=false
7406
7407 : Initialize h_sysfile
7408 h_sysfile=false
7409
7410 : access call always available on UNIX
7411 set access d_access
7412 eval $inlibc
7413
7414 : locate the flags for 'access()'
7415 case "$d_access" in
7416 "$define")
7417         echo " "
7418         $cat >access.c <<'EOCP'
7419 #include <sys/types.h>
7420 #ifdef I_FCNTL
7421 #include <fcntl.h>
7422 #endif
7423 #ifdef I_SYS_FILE
7424 #include <sys/file.h>
7425 #endif
7426 #ifdef I_UNISTD
7427 #include <unistd.h>
7428 #endif
7429 int main() {
7430         exit(R_OK);
7431 }
7432 EOCP
7433         : check sys/file.h first, no particular reason here
7434         if $test `./findhdr sys/file.h` && \
7435                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7436                 h_sysfile=true;
7437                 echo "<sys/file.h> defines the *_OK access constants." >&4
7438         elif $test `./findhdr fcntl.h` && \
7439                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7440                 h_fcntl=true;
7441                 echo "<fcntl.h> defines the *_OK access constants." >&4
7442         elif $test `./findhdr unistd.h` && \
7443                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7444                 echo "<unistd.h> defines the *_OK access constants." >&4
7445         else
7446                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7447         fi
7448         ;;
7449 esac
7450 $rm -f access*
7451
7452 : see if accessx exists
7453 set accessx d_accessx
7454 eval $inlibc
7455
7456 : see if alarm exists
7457 set alarm d_alarm
7458 eval $inlibc
7459
7460 : see if atolf exists
7461 set atolf d_atolf
7462 eval $inlibc
7463
7464 : see if atoll exists
7465 set atoll d_atoll
7466 eval $inlibc
7467
7468 : Look for GNU-cc style attribute checking
7469 echo " "
7470 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7471 $cat >attrib.c <<'EOCP'
7472 #include <stdio.h>
7473 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7474 EOCP
7475 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7476         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7477                 echo "Your C compiler doesn't fully support __attribute__."
7478                 val="$undef"
7479         else
7480                 echo "Your C compiler supports __attribute__."
7481                 val="$define"
7482         fi
7483 else
7484         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7485         val="$undef"
7486 fi
7487 set d_attribut
7488 eval $setvar
7489 $rm -f attrib*
7490
7491 : see if bcmp exists
7492 set bcmp d_bcmp
7493 eval $inlibc
7494
7495 : see if bcopy exists
7496 set bcopy d_bcopy
7497 eval $inlibc
7498
7499 : see if this is a unistd.h system
7500 set unistd.h i_unistd
7501 eval $inhdr
7502
7503 : see if getpgrp exists
7504 set getpgrp d_getpgrp
7505 eval $inlibc
7506
7507 case "$d_getpgrp" in
7508 "$define")
7509         echo " "
7510         echo "Checking to see which flavor of getpgrp is in use..."
7511         $cat >set.c <<EOP
7512 #$i_unistd I_UNISTD
7513 #include <sys/types.h>
7514 #ifdef I_UNISTD
7515 #  include <unistd.h>
7516 #endif
7517 int main()
7518 {
7519         if (getuid() == 0) {
7520                 printf("(I see you are running Configure as super-user...)\n");
7521                 setuid(1);
7522         }
7523 #ifdef TRY_BSD_PGRP
7524         if (getpgrp(1) == 0)
7525                 exit(0);
7526 #else
7527         if (getpgrp() > 0)
7528                 exit(0);
7529 #endif
7530         exit(1);
7531 }
7532 EOP
7533         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7534                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7535                 val="$define"
7536         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7537                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7538                 val="$undef"
7539         else
7540                 echo "I can't seem to compile and run the test program."
7541                 if ./usg; then
7542                         xxx="a USG one, i.e. you use getpgrp()."
7543                 else
7544                         # SVR4 systems can appear rather BSD-ish.
7545                         case "$i_unistd" in
7546                         $undef)
7547                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7548                                 val="$define"
7549                                 ;;
7550                         $define)
7551                                 xxx="probably a USG one, i.e. you use getpgrp()."
7552                                 val="$undef"
7553                                 ;;
7554                         esac
7555                 fi
7556                 echo "Assuming your getpgrp is $xxx" >&4
7557         fi
7558         ;;
7559 *) val="$undef";;
7560 esac
7561 set d_bsdgetpgrp
7562 eval $setvar
7563 $rm -f set set.c
7564
7565 : see if setpgrp exists
7566 set setpgrp d_setpgrp
7567 eval $inlibc
7568
7569 case "$d_setpgrp" in
7570 "$define")
7571         echo " "
7572         echo "Checking to see which flavor of setpgrp is in use..."
7573         $cat >set.c <<EOP
7574 #$i_unistd I_UNISTD
7575 #include <sys/types.h>
7576 #ifdef I_UNISTD
7577 #  include <unistd.h>
7578 #endif
7579 int main()
7580 {
7581         if (getuid() == 0) {
7582                 printf("(I see you are running Configure as super-user...)\n");
7583                 setuid(1);
7584         }
7585 #ifdef TRY_BSD_PGRP
7586         if (-1 == setpgrp(1, 1))
7587                 exit(0);
7588 #else
7589         if (setpgrp() != -1)
7590                 exit(0);
7591 #endif
7592         exit(1);
7593 }
7594 EOP
7595         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7596                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7597                 val="$define"
7598         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7599                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7600                 val="$undef"
7601         else
7602                 echo "(I can't seem to compile and run the test program.)"
7603                 if ./usg; then
7604                         xxx="a USG one, i.e. you use setpgrp()."
7605                 else
7606                         # SVR4 systems can appear rather BSD-ish.
7607                         case "$i_unistd" in
7608                         $undef)
7609                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7610                                 val="$define"
7611                                 ;;
7612                         $define)
7613                                 xxx="probably a USG one, i.e. you use setpgrp()."
7614                                 val="$undef"
7615                                 ;;
7616                         esac
7617                 fi
7618                 echo "Assuming your setpgrp is $xxx" >&4
7619         fi
7620         ;;
7621 *) val="$undef";;
7622 esac
7623 set d_bsdsetpgrp
7624 eval $setvar
7625 $rm -f set set.c
7626 : see if bzero exists
7627 set bzero d_bzero
7628 eval $inlibc
7629
7630 : see if signal is declared as pointer to function returning int or void
7631 echo " "
7632 xxx=`./findhdr signal.h`
7633 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7634 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7635         echo "You have int (*signal())() instead of void." >&4
7636         val="$undef"
7637 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7638         echo "You have void (*signal())()." >&4
7639         val="$define"
7640 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7641         echo "You have int (*signal())() instead of void." >&4
7642         val="$undef"
7643 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7644         echo "You have void (*signal())()." >&4
7645         val="$define"
7646 else
7647         case "$d_voidsig" in
7648         '')
7649         echo "I can't determine whether signal handler returns void or int..." >&4
7650                 dflt=void
7651                 rp="What type does your signal handler return?"
7652                 . ./myread
7653                 case "$ans" in
7654                 v*) val="$define";;
7655                 *) val="$undef";;
7656                 esac;;
7657         "$define")
7658                 echo "As you already told me, signal handler returns void." >&4
7659                 val="$define"
7660                 ;;
7661         *)      echo "As you already told me, signal handler returns int." >&4
7662                 val="$undef"
7663                 ;;
7664         esac
7665 fi
7666 set d_voidsig
7667 eval $setvar
7668 case "$d_voidsig" in
7669 "$define") signal_t="void";;
7670 *) signal_t="int";;
7671 esac
7672 $rm -f $$.tmp
7673
7674 : check for ability to cast large floats to 32-bit ints.
7675 echo " "
7676 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7677 if $test "$intsize" -ge 4; then
7678         xxx=int
7679 else
7680         xxx=long
7681 fi
7682 $cat >try.c <<EOCP
7683 #include <stdio.h>
7684 #include <sys/types.h>
7685 #include <signal.h>
7686 $signal_t blech(s) int s; { exit(3); }
7687 int main()
7688 {
7689         $xxx i32;
7690         double f, g;
7691         int result = 0;
7692         char str[16];
7693         signal(SIGFPE, blech);
7694
7695         /* Don't let compiler optimize the test away.  Store the number 
7696            in a writable string for gcc to pass to sscanf under HP/UX.
7697         */
7698         sprintf(str, "2147483647");
7699         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7700         g = 10 * f;
7701         i32  = ($xxx) g;
7702
7703         /* x86 processors will probably give 0x8000 0000, which is a
7704        sign change.  We don't want that.  We want to mimic SPARC
7705            behavior here, which is to preserve the sign and give
7706            back 0x7fff ffff.
7707         */
7708         if (i32 != ($xxx) f)
7709                 result |= 1;
7710         exit(result);
7711 }
7712 EOCP
7713 set try
7714 if eval $compile_ok; then
7715         ./try
7716         yyy=$?
7717 else
7718         echo "(I can't seem to compile the test program--assuming it can't)"
7719         yyy=1
7720 fi
7721 case "$yyy" in
7722 0)      val="$define"
7723         echo "Yup, it can."
7724         ;;
7725 *)      val="$undef"
7726         echo "Nope, it can't."
7727         ;;
7728 esac
7729 set d_casti32
7730 eval $setvar
7731 $rm -f try try.*
7732
7733 : check for ability to cast negative floats to unsigned
7734 echo " "
7735 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7736 $cat >try.c <<EOCP
7737 #include <stdio.h>
7738 #include <sys/types.h>
7739 #include <signal.h>
7740 $signal_t blech(s) int s; { exit(7); }
7741 $signal_t blech_in_list(s) int s; { exit(4); }
7742 unsigned long dummy_long(p) unsigned long p; { return p; }
7743 unsigned int dummy_int(p) unsigned int p; { return p; }
7744 unsigned short dummy_short(p) unsigned short p; { return p; }
7745 int main()
7746 {
7747         double f;
7748         unsigned long along;
7749         unsigned int aint;
7750         unsigned short ashort;
7751         int result = 0;
7752         char str[16];
7753         
7754         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7755            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7756            optimized the whole file away
7757         */
7758         /* Store the number in a writable string for gcc to pass to 
7759            sscanf under HP/UX.
7760         */
7761         sprintf(str, "-123");
7762         sscanf(str, "%lf", &f);  /* f = -123.; */
7763
7764         signal(SIGFPE, blech);
7765         along = (unsigned long)f;
7766         aint = (unsigned int)f;
7767         ashort = (unsigned short)f;
7768         if (along != (unsigned long)-123)
7769                 result |= 1;
7770         if (aint != (unsigned int)-123)
7771                 result |= 1;
7772         if (ashort != (unsigned short)-123)
7773                 result |= 1;
7774         sprintf(str, "1073741824.");
7775         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7776         f = f + f;
7777         along = 0;
7778         along = (unsigned long)f;
7779         if (along != 0x80000000)
7780                 result |= 2;
7781         f -= 1.;
7782         along = 0;
7783         along = (unsigned long)f;
7784         if (along != 0x7fffffff)
7785                 result |= 1;
7786         f += 2.;
7787         along = 0;
7788         along = (unsigned long)f;
7789         if (along != 0x80000001)
7790                 result |= 2;
7791         if (result)
7792                 exit(result);
7793         signal(SIGFPE, blech_in_list);
7794         sprintf(str, "123.");
7795         sscanf(str, "%lf", &f);  /* f = 123.; */
7796         along = dummy_long((unsigned long)f);
7797         aint = dummy_int((unsigned int)f);
7798         ashort = dummy_short((unsigned short)f);
7799         if (along != (unsigned long)123)
7800                 result |= 4;
7801         if (aint != (unsigned int)123)
7802                 result |= 4;
7803         if (ashort != (unsigned short)123)
7804                 result |= 4;
7805         exit(result);
7806
7807 }
7808 EOCP
7809 set try
7810 if eval $compile_ok; then
7811         ./try
7812         castflags=$?
7813 else
7814         echo "(I can't seem to compile the test program--assuming it can't)"
7815         castflags=7
7816 fi
7817 case "$castflags" in
7818 0)      val="$define"
7819         echo "Yup, it can."
7820         ;;
7821 *)      val="$undef"
7822         echo "Nope, it can't."
7823         ;;
7824 esac
7825 set d_castneg
7826 eval $setvar
7827 $rm -f try.*
7828
7829 : see if vprintf exists
7830 echo " "
7831 if set vprintf val -f d_vprintf; eval $csym; $val; then
7832         echo 'vprintf() found.' >&4
7833         val="$define"
7834         $cat >vprintf.c <<'EOF'
7835 #include <varargs.h>
7836
7837 int main() { xxx("foo"); }
7838
7839 xxx(va_alist)
7840 va_dcl
7841 {
7842         va_list args;
7843         char buf[10];
7844
7845         va_start(args);
7846         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7847 }
7848 EOF
7849         set vprintf
7850         if eval $compile && ./vprintf; then
7851                 echo "Your vsprintf() returns (int)." >&4
7852                 val2="$undef"
7853         else
7854                 echo "Your vsprintf() returns (char*)." >&4
7855                 val2="$define"
7856         fi
7857 else
7858         echo 'vprintf() NOT found.' >&4
7859                 val="$undef"
7860                 val2="$undef"
7861 fi
7862 set d_vprintf
7863 eval $setvar
7864 val=$val2
7865 set d_charvspr
7866 eval $setvar
7867
7868 : see if chown exists
7869 set chown d_chown
7870 eval $inlibc
7871
7872 : see if chroot exists
7873 set chroot d_chroot
7874 eval $inlibc
7875
7876 : see if chsize exists
7877 set chsize d_chsize
7878 eval $inlibc
7879
7880 : check for const keyword
7881 echo " "
7882 echo 'Checking to see if your C compiler knows about "const"...' >&4
7883 $cat >const.c <<'EOCP'
7884 typedef struct spug { int drokk; } spug;
7885 int main()
7886 {
7887         const char *foo;
7888         const spug y;
7889 }
7890 EOCP
7891 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7892         val="$define"
7893         echo "Yup, it does."
7894 else
7895         val="$undef"
7896         echo "Nope, it doesn't."
7897 fi
7898 set d_const
7899 eval $setvar
7900
7901 : see if crypt exists
7902 echo " "
7903 if set crypt val -f d_crypt; eval $csym; $val; then
7904         echo 'crypt() found.' >&4
7905         val="$define"
7906         cryptlib=''
7907 else
7908         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7909         if $test -z "$cryptlib"; then
7910                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7911         else
7912                 cryptlib=-lcrypt
7913         fi
7914         if $test -z "$cryptlib"; then
7915                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7916         else
7917                 cryptlib=-lcrypt
7918         fi
7919         if $test -z "$cryptlib"; then
7920                 cryptlib=`./loc libcrypt$_a "" $libpth`
7921         else
7922                 cryptlib=-lcrypt
7923         fi
7924         if $test -z "$cryptlib"; then
7925                 echo 'crypt() NOT found.' >&4
7926                 val="$undef"
7927         else
7928                 val="$define"
7929         fi
7930 fi
7931 set d_crypt
7932 eval $setvar
7933
7934 : get csh whereabouts
7935 case "$csh" in
7936 'csh') val="$undef" ;;
7937 *) val="$define" ;;
7938 esac
7939 set d_csh
7940 eval $setvar
7941 : Respect a hint or command line value for full_csh.
7942 case "$full_csh" in
7943 '') full_csh=$csh ;;
7944 esac
7945
7946 : see if cuserid exists
7947 set cuserid d_cuserid
7948 eval $inlibc
7949
7950 : see if this is a limits.h system
7951 set limits.h i_limits
7952 eval $inhdr
7953
7954 : see if this is a float.h system
7955 set float.h i_float
7956 eval $inhdr
7957
7958 : See if number of significant digits in a double precision number is known
7959 echo " "
7960 $cat >dbl_dig.c <<EOM
7961 #$i_limits I_LIMITS
7962 #$i_float I_FLOAT
7963 #ifdef I_LIMITS
7964 #include <limits.h>
7965 #endif
7966 #ifdef I_FLOAT
7967 #include <float.h>
7968 #endif
7969 #ifdef DBL_DIG
7970 printf("Contains DBL_DIG");
7971 #endif
7972 EOM
7973 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7974 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7975         echo "DBL_DIG found." >&4
7976         val="$define"
7977 else
7978         echo "DBL_DIG NOT found." >&4
7979         val="$undef"
7980 fi
7981 $rm -f dbl_dig.?
7982 set d_dbl_dig
7983 eval $setvar
7984
7985 : see if difftime exists
7986 set difftime d_difftime
7987 eval $inlibc
7988
7989 : see if this is a dirent system
7990 echo " "
7991 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7992         val="$define"
7993         echo "<dirent.h> found." >&4
7994 else
7995         val="$undef"
7996         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7997                 echo "<sys/dir.h> found." >&4
7998                 echo " "
7999         else
8000                 xinc=`./findhdr sys/ndir.h`
8001         fi
8002         echo "<dirent.h> NOT found." >&4
8003 fi
8004 set i_dirent
8005 eval $setvar
8006
8007 : Look for type of directory structure.
8008 echo " "
8009 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8010
8011 case "$direntrytype" in
8012 ''|' ')
8013         case "$i_dirent" in
8014         $define) guess1='struct dirent' ;;
8015         *) guess1='struct direct'  ;;
8016         esac
8017         ;;
8018 *)      guess1="$direntrytype"
8019         ;;
8020 esac
8021
8022 case "$guess1" in
8023 'struct dirent') guess2='struct direct' ;;
8024 *) guess2='struct dirent' ;;
8025 esac
8026                 
8027 if $contains "$guess1" try.c >/dev/null 2>&1; then
8028         direntrytype="$guess1"
8029         echo "Your directory entries are $direntrytype." >&4
8030 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8031         direntrytype="$guess2"
8032         echo "Your directory entries seem to be $direntrytype." >&4
8033 else
8034         echo "I don't recognize your system's directory entries." >&4
8035         rp="What type is used for directory entries on this system?"
8036         dflt="$guess1"
8037         . ./myread
8038         direntrytype="$ans"
8039 fi
8040 $rm -f try.c
8041
8042
8043 : see if the directory entry stores field length
8044 echo " "
8045 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8046 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8047         echo "Good, your directory entry keeps length information in d_namlen." >&4
8048         val="$define"
8049 else
8050         echo "Your directory entry does not know about the d_namlen field." >&4
8051         val="$undef"
8052 fi
8053 set d_dirnamlen
8054 eval $setvar
8055 $rm -f try.c
8056
8057 : see if dlerror exists
8058 xxx_runnm="$runnm"
8059 runnm=false
8060 set dlerror d_dlerror
8061 eval $inlibc
8062 runnm="$xxx_runnm"
8063
8064 : see if dlfcn is available
8065 set dlfcn.h i_dlfcn
8066 eval $inhdr
8067
8068 case "$usedl" in
8069 $define|y|true)
8070         $cat << EOM
8071
8072 On a few systems, the dynamically loaded modules that perl generates and uses
8073 will need a different extension than shared libs. The default will probably
8074 be appropriate.
8075
8076 EOM
8077         case "$dlext" in
8078         '')     dflt="$so" ;;
8079         *)      dflt="$dlext" ;;
8080         esac
8081         rp='What is the extension of dynamically loaded modules'
8082         . ./myread
8083         dlext="$ans"
8084         ;;
8085 *)
8086         dlext="none"
8087         ;;
8088 esac
8089
8090 : Check if dlsym need a leading underscore
8091 echo " "
8092 val="$undef"
8093
8094 case "$dlsrc" in
8095 dl_dlopen.xs)
8096         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8097         $cat >dyna.c <<'EOM'
8098 fred () { }
8099 EOM
8100
8101 $cat >fred.c<<EOM
8102
8103 #include <stdio.h>
8104 #$i_dlfcn I_DLFCN
8105 #ifdef I_DLFCN
8106 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8107 #else
8108 #include <sys/types.h>
8109 #include <nlist.h>
8110 #include <link.h>
8111 #endif
8112
8113 extern int fred() ;
8114
8115 int main()
8116 {
8117     void * handle ;
8118     void * symbol ;
8119 #ifndef RTLD_LAZY
8120     int mode = 1 ;
8121 #else
8122     int mode = RTLD_LAZY ;
8123 #endif
8124     handle = dlopen("./dyna.$dlext", mode) ;
8125     if (handle == NULL) {
8126         printf ("1\n") ;
8127         fflush (stdout) ;
8128         exit(0);
8129     }
8130     symbol = dlsym(handle, "fred") ;
8131     if (symbol == NULL) {
8132         /* try putting a leading underscore */
8133         symbol = dlsym(handle, "_fred") ;
8134         if (symbol == NULL) {
8135             printf ("2\n") ;
8136             fflush (stdout) ;
8137             exit(0);
8138         }
8139         printf ("3\n") ;
8140     }
8141     else
8142         printf ("4\n") ;
8143     fflush (stdout) ;
8144     exit(0);
8145 }
8146 EOM
8147         : Call the object file tmp-dyna.o in case dlext=o.
8148         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8149                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8150                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8151                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8152                 xxx=`./fred`
8153                 case $xxx in
8154                 1)      echo "Test program failed using dlopen." >&4
8155                         echo "Perhaps you should not use dynamic loading." >&4;;
8156                 2)      echo "Test program failed using dlsym." >&4
8157                         echo "Perhaps you should not use dynamic loading." >&4;;
8158                 3)      echo "dlsym needs a leading underscore" >&4
8159                         val="$define" ;;
8160                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8161                 esac
8162         else
8163                 echo "I can't compile and run the test program." >&4
8164                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8165         fi
8166         ;;
8167 esac
8168                 
8169 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8170
8171 set d_dlsymun
8172 eval $setvar
8173
8174 hasproto='varname=$1; func=$2; shift; shift;
8175 while $test $# -ge 2; do
8176         case "$1" in
8177         $define) echo "#include <$2>";;
8178         esac ;
8179     shift 2;
8180 done > try.c;
8181 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8182 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8183         echo "$func() prototype found.";
8184         val="$define";
8185 else
8186         echo "$func() prototype NOT found.";
8187         val="$undef";
8188 fi;
8189 set $varname;
8190 eval $setvar;
8191 $rm -f try.c tryout.c'
8192
8193 : see if prototype for drand48 is available
8194 echo " "
8195 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8196 eval $hasproto
8197
8198 : see if dup2 exists
8199 set dup2 d_dup2
8200 eval $inlibc
8201
8202 : see if eaccess exists
8203 set eaccess d_eaccess
8204 eval $inlibc
8205
8206 : see if endgrent exists
8207 set endgrent d_endgrent
8208 eval $inlibc
8209
8210 : see if endhostent exists
8211 set endhostent d_endhent
8212 eval $inlibc
8213
8214 : see if endnetent exists
8215 set endnetent d_endnent
8216 eval $inlibc
8217
8218 : see if endprotoent exists
8219 set endprotoent d_endpent
8220 eval $inlibc
8221
8222 : see if endpwent exists
8223 set endpwent d_endpwent
8224 eval $inlibc
8225
8226 : see if endservent exists
8227 set endservent d_endsent
8228 eval $inlibc
8229
8230 : see if endspent exists
8231 set endspent d_endspent
8232 eval $inlibc
8233
8234 : Locate the flags for 'open()'
8235 echo " "
8236 $cat >open3.c <<'EOCP'
8237 #include <sys/types.h>
8238 #ifdef I_FCNTL
8239 #include <fcntl.h>
8240 #endif
8241 #ifdef I_SYS_FILE
8242 #include <sys/file.h>
8243 #endif
8244 int main() {
8245         if(O_RDONLY);
8246 #ifdef O_TRUNC
8247         exit(0);
8248 #else
8249         exit(1);
8250 #endif
8251 }
8252 EOCP
8253 : check sys/file.h first to get FREAD on Sun
8254 if $test `./findhdr sys/file.h` && \
8255                 set open3 -DI_SYS_FILE && eval $compile; then
8256         h_sysfile=true;
8257         echo "<sys/file.h> defines the O_* constants..." >&4
8258         if ./open3; then
8259                 echo "and you have the 3 argument form of open()." >&4
8260                 val="$define"
8261         else
8262                 echo "but not the 3 argument form of open().  Oh, well." >&4
8263                 val="$undef"
8264         fi
8265 elif $test `./findhdr fcntl.h` && \
8266                 set open3 -DI_FCNTL && eval $compile; then
8267         h_fcntl=true;
8268         echo "<fcntl.h> defines the O_* constants..." >&4
8269         if ./open3; then
8270                 echo "and you have the 3 argument form of open()." >&4
8271                 val="$define"
8272         else
8273                 echo "but not the 3 argument form of open().  Oh, well." >&4
8274                 val="$undef"
8275         fi
8276 else
8277         val="$undef"
8278         echo "I can't find the O_* constant definitions!  You got problems." >&4
8279 fi
8280 set d_open3
8281 eval $setvar
8282 $rm -f open3*
8283
8284 : see which of string.h or strings.h is needed
8285 echo " "
8286 strings=`./findhdr string.h`
8287 if $test "$strings" && $test -r "$strings"; then
8288         echo "Using <string.h> instead of <strings.h>." >&4
8289         val="$define"
8290 else
8291         val="$undef"
8292         strings=`./findhdr strings.h`
8293         if $test "$strings" && $test -r "$strings"; then
8294                 echo "Using <strings.h> instead of <string.h>." >&4
8295         else
8296                 echo "No string header found -- You'll surely have problems." >&4
8297         fi
8298 fi
8299 set i_string
8300 eval $setvar
8301 case "$i_string" in
8302 "$undef") strings=`./findhdr strings.h`;;
8303 *)        strings=`./findhdr string.h`;;
8304 esac
8305
8306 : check for non-blocking I/O stuff
8307 case "$h_sysfile" in
8308 true) echo "#include <sys/file.h>" > head.c;;
8309 *)
8310         case "$h_fcntl" in
8311         true) echo "#include <fcntl.h>" > head.c;;
8312         *) echo "#include <sys/fcntl.h>" > head.c;;
8313         esac
8314         ;;
8315 esac
8316 echo " "
8317 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8318 case "$o_nonblock" in
8319 '')
8320         $cat head.c > try.c
8321         $cat >>try.c <<'EOCP'
8322 #include <stdio.h>
8323 int main() {
8324 #ifdef O_NONBLOCK
8325         printf("O_NONBLOCK\n");
8326         exit(0);
8327 #endif
8328 #ifdef O_NDELAY
8329         printf("O_NDELAY\n");
8330         exit(0);
8331 #endif
8332 #ifdef FNDELAY
8333         printf("FNDELAY\n");
8334         exit(0);
8335 #endif
8336         exit(0);
8337 }
8338 EOCP
8339         set try
8340         if eval $compile_ok; then
8341                 o_nonblock=`./try`
8342                 case "$o_nonblock" in
8343                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8344                 *) echo "Seems like we can use $o_nonblock.";;
8345                 esac
8346         else
8347                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8348         fi
8349         ;;
8350 *) echo "Using $hint value $o_nonblock.";;
8351 esac
8352 $rm -f try try.* .out core
8353
8354 echo " "
8355 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8356 case "$eagain" in
8357 '')
8358         $cat head.c > try.c
8359         $cat >>try.c <<EOCP
8360 #include <errno.h>
8361 #include <sys/types.h>
8362 #include <signal.h>
8363 #include <stdio.h> 
8364 #define MY_O_NONBLOCK $o_nonblock
8365 #ifndef errno  /* XXX need better Configure test */
8366 extern int errno;
8367 #endif
8368 #$i_unistd I_UNISTD
8369 #ifdef I_UNISTD
8370 #include <unistd.h>
8371 #endif
8372 #ifdef $i_string
8373 #include <string.h>
8374 #else
8375 #include <strings.h>
8376 #endif
8377 $signal_t blech(x) int x; { exit(3); }
8378 EOCP
8379         $cat >> try.c <<'EOCP'
8380 int main()
8381 {
8382         int pd[2];
8383         int pu[2];
8384         char buf[1];
8385         char string[100];
8386
8387         pipe(pd);       /* Down: child -> parent */
8388         pipe(pu);       /* Up: parent -> child */
8389         if (0 != fork()) {
8390                 int ret;
8391                 close(pd[1]);   /* Parent reads from pd[0] */
8392                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8393                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8394                         exit(1);
8395                 signal(SIGALRM, blech);
8396                 alarm(5);
8397                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8398                         exit(2);
8399                 sprintf(string, "%d\n", ret);
8400                 write(2, string, strlen(string));
8401                 alarm(0);
8402 #ifdef EAGAIN
8403                 if (errno == EAGAIN) {
8404                         printf("EAGAIN\n");
8405                         goto ok;
8406                 }
8407 #endif
8408 #ifdef EWOULDBLOCK
8409                 if (errno == EWOULDBLOCK)
8410                         printf("EWOULDBLOCK\n");
8411 #endif
8412         ok:
8413                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8414                 sleep(2);                               /* Give it time to close our pipe */
8415                 alarm(5);
8416                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8417                 alarm(0);
8418                 sprintf(string, "%d\n", ret);
8419                 write(3, string, strlen(string));
8420                 exit(0);
8421         }
8422
8423         close(pd[0]);                   /* We write to pd[1] */
8424         close(pu[1]);                   /* We read from pu[0] */
8425         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8426         close(pd[1]);                   /* Pipe pd is now fully closed! */
8427         exit(0);                                /* Bye bye, thank you for playing! */
8428 }
8429 EOCP
8430         set try
8431         if eval $compile_ok; then
8432                 echo "$startsh" >mtry
8433                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8434                 chmod +x mtry
8435                 ./mtry >/dev/null 2>&1
8436                 case $? in
8437                 0) eagain=`$cat try.out`;;
8438                 1) echo "Could not perform non-blocking setting!";;
8439                 2) echo "I did a successful read() for something that was not there!";;
8440                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8441                 *) echo "Something terribly wrong happened during testing.";;
8442                 esac
8443                 rd_nodata=`$cat try.ret`
8444                 echo "A read() system call with no data present returns $rd_nodata."
8445                 case "$rd_nodata" in
8446                 0|-1) ;;
8447                 *)
8448                         echo "(That's peculiar, fixing that to be -1.)"
8449                         rd_nodata=-1
8450                         ;;
8451                 esac
8452                 case "$eagain" in
8453                 '')
8454                         echo "Forcing errno EAGAIN on read() with no data available."
8455                         eagain=EAGAIN
8456                         ;;
8457                 *)
8458                         echo "Your read() sets errno to $eagain when no data is available."
8459                         ;;
8460                 esac
8461                 status=`$cat try.err`
8462                 case "$status" in
8463                 0) echo "And it correctly returns 0 to signal EOF.";;
8464                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8465                 *) echo "However, your read() returns '$status' on EOF??";;
8466                 esac
8467                 val="$define"
8468                 if test "$status" = "$rd_nodata"; then
8469                         echo "WARNING: you can't distinguish between EOF and no data!"
8470                         val="$undef"
8471                 fi
8472         else
8473                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8474                 eagain=EAGAIN
8475         fi
8476         set d_eofnblk
8477         eval $setvar
8478         ;;
8479 *)
8480         echo "Using $hint value $eagain."
8481         echo "Your read() returns $rd_nodata when no data is present."
8482         case "$d_eofnblk" in
8483         "$define") echo "And you can see EOF because read() returns 0.";;
8484         "$undef") echo "But you can't see EOF status from read() returned value.";;
8485         *)
8486                 echo "(Assuming you can't see EOF status from read anyway.)"
8487                 d_eofnblk=$undef
8488                 ;;
8489         esac
8490         ;;
8491 esac
8492 $rm -f try try.* .out core head.c mtry
8493
8494 : see if fchmod exists
8495 set fchmod d_fchmod
8496 eval $inlibc
8497
8498 : see if fchown exists
8499 set fchown d_fchown
8500 eval $inlibc
8501
8502 : see if this is an fcntl system
8503 set fcntl d_fcntl
8504 eval $inlibc
8505
8506 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8507 while $test $# -ge 2; do
8508         case "$1" in
8509         $define) echo "#include <$2>";;
8510         esac ;
8511     shift 2;
8512 done > try.c;
8513 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8514 set try;
8515 if eval $compile; then
8516         val="$define";
8517 else
8518         val="$undef";
8519 fi;
8520 set $varname;
8521 eval $setvar;
8522 $rm -f try.c try.o'
8523
8524 socketlib=''
8525 sockethdr=''
8526 : see whether socket exists
8527 echo " "
8528 $echo $n "Hmm... $c" >&4
8529 if set socket val -f d_socket; eval $csym; $val; then
8530         echo "Looks like you have Berkeley networking support." >&4
8531         d_socket="$define"
8532         if set setsockopt val -f; eval $csym; $val; then
8533                 d_oldsock="$undef"
8534         else
8535                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8536                 d_oldsock="$define"
8537         fi
8538 else
8539         if $contains socklib libc.list >/dev/null 2>&1; then
8540                 echo "Looks like you have Berkeley networking support." >&4
8541                 d_socket="$define"
8542                 : we will have to assume that it supports the 4.2 BSD interface
8543                 d_oldsock="$undef"
8544         else
8545                 echo "You don't have Berkeley networking in libc$_a..." >&4
8546                 if test "X$d_socket" = "X$define"; then
8547                    echo "...but you seem to believe that you have sockets." >&4
8548                 else
8549                         for net in net socket
8550                         do
8551                                 if test -f /usr/lib/lib$net$_a; then
8552                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8553                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8554                                         if $contains socket libc.list >/dev/null 2>&1; then
8555                                                 d_socket="$define"
8556                                                 socketlib="-l$net"
8557                                                 case "$net" in
8558                                                 net)
8559                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8560                                                         sockethdr="-I/usr/netinclude"
8561                                                         ;;
8562                                                 esac
8563                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8564                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8565                                                         d_oldsock="$undef"
8566                                                 else
8567                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8568                                                         d_oldsock="$define"
8569                                                 fi
8570                                                 break
8571                                         fi
8572                                 fi
8573                         done
8574                         if test "X$d_socket" != "X$define"; then
8575                            echo "or anywhere else I see." >&4
8576                            d_socket="$undef"
8577                            d_oldsock="$undef"
8578                         fi
8579                 fi
8580         fi
8581 fi
8582
8583 : see if socketpair exists
8584 set socketpair d_sockpair
8585 eval $inlibc
8586
8587
8588 echo " "
8589 echo "Checking the availability of certain socket constants..." >& 4
8590 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8591         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8592         $cat >try.c <<EOF
8593 #include <sys/types.h>
8594 #include <sys/socket.h>
8595 int main() {
8596     int i = $ENUM;
8597 }
8598 EOF
8599         val="$undef"
8600         set try; if eval $compile; then
8601                 val="$define"
8602         fi
8603         set d_${enum}; eval $setvar
8604         $rm -f try.c try
8605 done
8606
8607 : see if sys/select.h has to be included
8608 set sys/select.h i_sysselct
8609 eval $inhdr
8610
8611 : see if we should include time.h, sys/time.h, or both
8612 echo " "
8613 if test "X$timeincl" = X; then
8614         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8615         $echo $n "I'm now running the test program...$c"
8616         $cat >try.c <<'EOCP'
8617 #include <sys/types.h>
8618 #ifdef I_TIME
8619 #include <time.h>
8620 #endif
8621 #ifdef I_SYSTIME
8622 #ifdef SYSTIMEKERNEL
8623 #define KERNEL
8624 #endif
8625 #include <sys/time.h>
8626 #endif
8627 #ifdef I_SYSSELECT
8628 #include <sys/select.h>
8629 #endif
8630 int main()
8631 {
8632         struct tm foo;
8633 #ifdef S_TIMEVAL
8634         struct timeval bar;
8635 #endif
8636 #ifdef S_TIMEZONE
8637         struct timezone tzp;
8638 #endif
8639         if (foo.tm_sec == foo.tm_sec)
8640                 exit(0);
8641 #ifdef S_TIMEVAL
8642         if (bar.tv_sec == bar.tv_sec)
8643                 exit(0);
8644 #endif
8645         exit(1);
8646 }
8647 EOCP
8648         flags=''
8649         for s_timezone in '-DS_TIMEZONE' ''; do
8650         sysselect=''
8651         for s_timeval in '-DS_TIMEVAL' ''; do
8652         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8653         for i_time in '' '-DI_TIME'; do
8654         for i_systime in '-DI_SYSTIME' ''; do
8655                 case "$flags" in
8656                 '') $echo $n ".$c"
8657                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8658                         if eval $compile; then
8659                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8660                                 shift
8661                                 flags="$*"
8662                                 echo " "
8663                                 $echo $n "Succeeded with $flags$c"
8664                         fi
8665                         ;;
8666                 esac
8667         done
8668         done
8669         done
8670         done
8671         done
8672         timeincl=''
8673         echo " "
8674         case "$flags" in
8675         *SYSTIMEKERNEL*) i_systimek="$define"
8676                 timeincl=`./findhdr sys/time.h`
8677                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8678         *) i_systimek="$undef";;
8679         esac
8680         case "$flags" in
8681         *I_TIME*) i_time="$define"
8682                 timeincl=`./findhdr time.h`" $timeincl"
8683                 echo "We'll include <time.h>." >&4;;
8684         *) i_time="$undef";;
8685         esac
8686         case "$flags" in
8687         *I_SYSTIME*) i_systime="$define"
8688                 timeincl=`./findhdr sys/time.h`" $timeincl"
8689                 echo "We'll include <sys/time.h>." >&4;;
8690         *) i_systime="$undef";;
8691         esac
8692         $rm -f try.c try
8693 fi
8694
8695 : check for fd_set items
8696 $cat <<EOM
8697
8698 Checking to see how well your C compiler handles fd_set and friends ...
8699 EOM
8700 $cat >fd_set.c <<EOCP
8701 #$i_systime I_SYS_TIME
8702 #$i_sysselct I_SYS_SELECT
8703 #$d_socket HAS_SOCKET
8704 #include <sys/types.h>
8705 #ifdef HAS_SOCKET
8706 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8707 #endif
8708 #ifdef I_SYS_TIME
8709 #include <sys/time.h>
8710 #endif
8711 #ifdef I_SYS_SELECT
8712 #include <sys/select.h>
8713 #endif
8714 int main() {
8715         fd_set fds;
8716
8717 #ifdef TRYBITS
8718         if(fds.fds_bits);
8719 #endif
8720
8721 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8722         exit(0);
8723 #else
8724         exit(1);
8725 #endif
8726 }
8727 EOCP
8728 set fd_set -DTRYBITS
8729 if eval $compile; then
8730         d_fds_bits="$define"
8731         d_fd_set="$define"
8732         echo "Well, your system knows about the normal fd_set typedef..." >&4
8733         if ./fd_set; then
8734                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8735                 d_fd_macros="$define"
8736         else
8737                 $cat >&4 <<'EOM'
8738 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8739 EOM
8740                 d_fd_macros="$undef"
8741         fi
8742 else
8743         $cat <<'EOM'
8744 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8745 EOM
8746         set fd_set
8747         if eval $compile; then
8748                 d_fds_bits="$undef"
8749                 d_fd_set="$define"
8750                 echo "Well, your system has some sort of fd_set available..." >&4
8751                 if ./fd_set; then
8752                         echo "and you have the normal fd_set macros." >&4
8753                         d_fd_macros="$define"
8754                 else
8755                         $cat <<'EOM'
8756 but not the normal fd_set macros!  Gross!  More work for me...
8757 EOM
8758                         d_fd_macros="$undef"
8759                 fi
8760         else
8761         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8762                 d_fd_set="$undef"
8763                 d_fds_bits="$undef"
8764                 d_fd_macros="$undef"
8765         fi
8766 fi
8767 $rm -f fd_set*
8768
8769 : see if fgetpos exists
8770 set fgetpos d_fgetpos
8771 eval $inlibc
8772
8773 : see if flock exists
8774 set flock d_flock
8775 eval $inlibc
8776
8777 : see if fork exists
8778 set fork d_fork
8779 eval $inlibc
8780
8781 : see if pathconf exists
8782 set pathconf d_pathconf
8783 eval $inlibc
8784
8785 : see if fpathconf exists
8786 set fpathconf d_fpathconf
8787 eval $inlibc
8788
8789
8790 : check for off64_t
8791 echo " "
8792 echo "Checking to see if your system supports off64_t..." >&4
8793 $cat >try.c <<EOCP
8794 #include <sys/types.h>
8795 #include <unistd.h>
8796 int main() { off64_t x = 7; }'
8797 EOCP
8798 set try
8799 if eval $compile; then
8800         val="$define"
8801         echo "Yes, it does."
8802 else
8803         val="$undef"
8804         echo "No, it doesn't."
8805         case "$lseeksize" in
8806         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8807         esac
8808 fi
8809 $rm -f try.* try
8810 set d_off64_t
8811 eval $setvar
8812
8813 : check for fpos64_t
8814 echo " "
8815 echo "Checking to see if your system supports fpos64_t..." >&4
8816 $cat >try.c <<EOCP
8817 #include <sys/stdio.h>
8818 int main() { fpos64_t x x = 7; }'
8819 EOCP
8820 set try
8821 if eval $compile; then
8822         val="$define"
8823         echo "Yes, it does."
8824 else
8825         val="$undef"
8826         echo "No, it doesn't."
8827         case "$fpossize" in
8828         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8829         esac
8830 fi
8831 $rm -f try.* try
8832 set d_fpos64_t
8833 eval $setvar
8834
8835 hasstruct='varname=$1; struct=$2; shift; shift;
8836 while $test $# -ge 2; do
8837         case "$1" in
8838         $define) echo "#include <$2>";;
8839         esac ;
8840     shift 2;
8841 done > try.c;
8842 echo "int main () { struct $struct foo; }" >> try.c;
8843 set try;
8844 if eval $compile; then
8845         val="$define";
8846 else
8847         val="$undef";
8848 fi;
8849 set $varname;
8850 eval $setvar;
8851 $rm -f try.c try.o'
8852
8853 : see if this is a sys/param system
8854 set sys/param.h i_sysparam
8855 eval $inhdr
8856
8857 : see if this is a sys/mount.h system
8858 set sys/mount.h i_sysmount
8859 eval $inhdr
8860
8861 : see if sys/types.h has to be included
8862 set sys/types.h i_systypes
8863 eval $inhdr
8864
8865
8866 echo " "
8867 echo "Checking to see if your system supports struct fs_data..." >&4
8868 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8869 eval $hasstruct
8870 case "$d_fs_data_s" in
8871 "$define")      echo "Yes, it does."   ;;
8872 *)              echo "No, it doesn't." ;;
8873 esac
8874
8875 : see if fseeko exists
8876 set fseeko d_fseeko
8877 eval $inlibc
8878 case "$longsize" in
8879 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8880 esac
8881
8882 : see if fsetpos exists
8883 set fsetpos d_fsetpos
8884 eval $inlibc
8885
8886
8887 : see if fstatfs exists
8888 set fstatfs d_fstatfs
8889 eval $inlibc
8890
8891
8892 : see if statvfs exists
8893 set statvfs d_statvfs
8894 eval $inlibc
8895
8896 : see if fstatvfs exists
8897 set fstatvfs d_fstatvfs
8898 eval $inlibc
8899
8900
8901 : see if ftello exists
8902 set ftello d_ftello
8903 eval $inlibc
8904 case "$longsize" in
8905 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8906 esac
8907
8908 : see if getgrent exists
8909 set getgrent d_getgrent
8910 eval $inlibc
8911
8912 : see if gethostbyaddr exists
8913 set gethostbyaddr d_gethbyaddr
8914 eval $inlibc
8915
8916 : see if gethostbyname exists
8917 set gethostbyname d_gethbyname
8918 eval $inlibc
8919
8920 : see if gethostent exists
8921 set gethostent d_gethent
8922 eval $inlibc
8923
8924 : see how we will look up host name
8925 echo " "
8926 call=''
8927 if set gethostname val -f d_gethname; eval $csym; $val; then
8928         echo 'gethostname() found.' >&4
8929         d_gethname="$define"
8930         call=gethostname
8931 fi
8932 if set uname val -f d_uname; eval $csym; $val; then
8933         if ./xenix; then
8934                 $cat <<'EOM'
8935 uname() was found, but you're running xenix, and older versions of xenix
8936 have a broken uname(). If you don't really know whether your xenix is old
8937 enough to have a broken system call, use the default answer.
8938
8939 EOM
8940                 dflt=y
8941                 case "$d_uname" in
8942                 "$define") dflt=n;;
8943                 esac
8944                 rp='Is your uname() broken?'
8945                 . ./myread
8946                 case "$ans" in
8947                 n*) d_uname="$define"; call=uname;;
8948                 esac
8949         else
8950                 echo 'uname() found.' >&4
8951                 d_uname="$define"
8952                 case "$call" in
8953                 '') call=uname ;;
8954                 esac
8955         fi
8956 fi
8957 case "$d_gethname" in
8958 '') d_gethname="$undef";;
8959 esac
8960 case "$d_uname" in
8961 '') d_uname="$undef";;
8962 esac
8963 case "$d_uname$d_gethname" in
8964 *define*)
8965         dflt=n
8966         cat <<EOM
8967  
8968 Every now and then someone has a $call() that lies about the hostname
8969 but can't be fixed for political or economic reasons.  If you wish, I can
8970 pretend $call() isn't there and maybe compute hostname at run-time
8971 thanks to the '$phostname' command.
8972
8973 EOM
8974         rp="Shall I ignore $call() from now on?"
8975         . ./myread
8976         case "$ans" in
8977         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8978         esac;;
8979 esac
8980 case "$phostname" in
8981 '') aphostname='';;
8982 *) case "$aphostname" in
8983         /*) ;;
8984         *) set X $phostname
8985                 shift
8986                 file=$1
8987                 shift
8988                 file=`./loc $file $file $pth`
8989                 aphostname=`echo $file $*`
8990                 ;;
8991         esac
8992         ;;
8993 esac
8994 case "$d_uname$d_gethname" in
8995 *define*) ;;
8996 *)
8997         case "$phostname" in
8998         '')
8999                 echo "There will be no way for $package to get your hostname." >&4;;
9000         *)
9001         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9002                 ;;
9003         esac;;
9004 esac
9005 case "$d_phostname" in
9006 '') d_phostname="$undef";;
9007 esac
9008
9009 : see if this is a netdb.h system
9010 set netdb.h i_netdb
9011 eval $inhdr
9012
9013 : see if prototypes for various gethostxxx netdb.h functions are available
9014 echo " "
9015 set d_gethostprotos gethostent $i_netdb netdb.h
9016 eval $hasproto
9017
9018 : see if getlogin exists
9019 set getlogin d_getlogin
9020 eval $inlibc
9021
9022 : see if getmnt exists
9023 set getmnt d_getmnt
9024 eval $inlibc
9025
9026 : see if getmntent exists
9027 set getmntent d_getmntent
9028 eval $inlibc
9029
9030 : see if getnetbyaddr exists
9031 set getnetbyaddr d_getnbyaddr
9032 eval $inlibc
9033
9034 : see if getnetbyname exists
9035 set getnetbyname d_getnbyname
9036 eval $inlibc
9037
9038 : see if getnetent exists
9039 set getnetent d_getnent
9040 eval $inlibc
9041
9042 : see if prototypes for various getnetxxx netdb.h functions are available
9043 echo " "
9044 set d_getnetprotos getnetent $i_netdb netdb.h
9045 eval $hasproto
9046
9047
9048 : see if getprotobyname exists
9049 set getprotobyname d_getpbyname
9050 eval $inlibc
9051
9052 : see if getprotobynumber exists
9053 set getprotobynumber d_getpbynumber
9054 eval $inlibc
9055
9056 : see if getprotoent exists
9057 set getprotoent d_getpent
9058 eval $inlibc
9059
9060 : see if getpgid exists
9061 set getpgid d_getpgid
9062 eval $inlibc
9063
9064 : see if getpgrp2 exists
9065 set getpgrp2 d_getpgrp2
9066 eval $inlibc
9067
9068 : see if getppid exists
9069 set getppid d_getppid
9070 eval $inlibc
9071
9072 : see if getpriority exists
9073 set getpriority d_getprior
9074 eval $inlibc
9075
9076 : see if prototypes for various getprotoxxx netdb.h functions are available
9077 echo " "
9078 set d_getprotoprotos getprotoent $i_netdb netdb.h
9079 eval $hasproto
9080
9081 : see if getpwent exists
9082 set getpwent d_getpwent
9083 eval $inlibc
9084
9085
9086 : see if getservbyname exists
9087 set getservbyname d_getsbyname
9088 eval $inlibc
9089
9090 : see if getservbyport exists
9091 set getservbyport d_getsbyport
9092 eval $inlibc
9093
9094 : see if getservent exists
9095 set getservent d_getsent
9096 eval $inlibc
9097
9098 : see if prototypes for various getservxxx netdb.h functions are available
9099 echo " "
9100 set d_getservprotos getservent $i_netdb netdb.h
9101 eval $hasproto
9102
9103 : see if getspent exists
9104 set getspent d_getspent
9105 eval $inlibc
9106
9107 : see if getspnam exists
9108 set getspnam d_getspnam
9109 eval $inlibc
9110
9111 : see if gettimeofday or ftime exists
9112 set gettimeofday d_gettimeod
9113 eval $inlibc
9114 case "$d_gettimeod" in
9115 "$undef")
9116         set ftime d_ftime 
9117         eval $inlibc
9118         ;;
9119 *)
9120         val="$undef"; set d_ftime; eval $setvar
9121         ;;
9122 esac
9123 case "$d_gettimeod$d_ftime" in
9124 "$undef$undef")
9125         echo " "
9126         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9127         ;;
9128 esac
9129
9130 : see if this is an grp system
9131 set grp.h i_grp
9132 eval $inhdr
9133
9134 case "$i_grp" in
9135 $define)
9136         xxx=`./findhdr grp.h`
9137         $cppstdin $cppflags $cppminus < $xxx >$$.h
9138
9139         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9140                 val="$define"
9141         else
9142                 val="$undef"
9143         fi
9144         set d_grpasswd
9145         eval $setvar
9146
9147         $rm -f $$.h
9148         ;;
9149 *)
9150         val="$undef";
9151         set d_grpasswd; eval $setvar
9152         ;;
9153 esac
9154
9155 : see if hasmntopt exists
9156 set hasmntopt d_hasmntopt
9157 eval $inlibc
9158
9159 : see if this is a netinet/in.h or sys/in.h system
9160 set netinet/in.h i_niin sys/in.h i_sysin
9161 eval $inhdr
9162
9163 : see if arpa/inet.h has to be included
9164 set arpa/inet.h i_arpainet
9165 eval $inhdr
9166
9167 : see if htonl --and friends-- exists
9168 val=''
9169 set htonl val
9170 eval $inlibc
9171
9172 : Maybe they are macros.
9173 case "$val" in
9174 $undef)
9175         $cat >htonl.c <<EOM
9176 #include <stdio.h>
9177 #include <sys/types.h>
9178 #$i_niin I_NETINET_IN
9179 #$i_sysin I_SYS_IN
9180 #$i_arpainet I_ARPA_INET
9181 #ifdef I_NETINET_IN
9182 #include <netinet/in.h>
9183 #endif
9184 #ifdef I_SYS_IN
9185 #include <sys/in.h>
9186 #endif
9187 #ifdef I_ARPA_INET
9188 #include <arpa/inet.h>
9189 #endif
9190 #ifdef htonl
9191 printf("Defined as a macro.");
9192 #endif
9193 EOM
9194         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9195         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9196                 val="$define"
9197                 echo "But it seems to be defined as a macro." >&4
9198         fi
9199         $rm -f htonl.?
9200         ;;
9201 esac
9202 set d_htonl
9203 eval $setvar
9204
9205 : index or strchr
9206 echo " "
9207 if set index val -f; eval $csym; $val; then
9208         if set strchr val -f d_strchr; eval $csym; $val; then
9209                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9210                         val="$define"
9211                         vali="$undef"
9212                         echo "strchr() found." >&4
9213                 else
9214                         val="$undef"
9215                         vali="$define"
9216                         echo "index() found." >&4
9217                 fi
9218         else
9219                 val="$undef"
9220                 vali="$define"
9221                 echo "index() found." >&4
9222         fi
9223 else
9224         if set strchr val -f d_strchr; eval $csym; $val; then
9225                 val="$define"
9226                 vali="$undef"
9227                 echo "strchr() found." >&4
9228         else
9229                 echo "No index() or strchr() found!" >&4
9230                 val="$undef"
9231                 vali="$undef"
9232         fi
9233 fi
9234 set d_strchr; eval $setvar
9235 val="$vali"
9236 set d_index; eval $setvar
9237
9238 : check whether inet_aton exists
9239 set inet_aton d_inetaton
9240 eval $inlibc
9241
9242 : Look for isascii
9243 echo " "
9244 $cat >isascii.c <<'EOCP'
9245 #include <stdio.h>
9246 #include <ctype.h>
9247 int main() {
9248         int c = 'A';
9249         if (isascii(c))
9250                 exit(0);
9251         else
9252                 exit(1);
9253 }
9254 EOCP
9255 set isascii
9256 if eval $compile; then
9257         echo "isascii() found." >&4
9258         val="$define"
9259 else
9260         echo "isascii() NOT found." >&4
9261         val="$undef"
9262 fi
9263 set d_isascii
9264 eval $setvar
9265 $rm -f isascii*
9266
9267 : see if killpg exists
9268 set killpg d_killpg
9269 eval $inlibc
9270
9271 : see if lchown exists
9272 echo " "
9273 $cat > try.c <<'EOCP'
9274 /* System header to define __stub macros and hopefully few prototypes,
9275     which can conflict with char lchown(); below.  */
9276 #include <assert.h>
9277 /* Override any gcc2 internal prototype to avoid an error.  */
9278 /* We use char because int might match the return type of a gcc2
9279    builtin and then its argument prototype would still apply.  */
9280 char lchown();
9281 int main() {
9282     /*  The GNU C library defines this for functions which it implements
9283         to always fail with ENOSYS.  Some functions are actually named
9284         something starting with __ and the normal name is an alias.  */
9285 #if defined (__stub_lchown) || defined (__stub___lchown)
9286 choke me
9287 #else
9288 lchown();
9289 #endif
9290 ; return 0; }
9291 EOCP
9292 set try
9293 if eval $compile; then
9294     $echo "lchown() found." >&4
9295     val="$define"
9296 else
9297     $echo "lchown() NOT found." >&4
9298     val="$undef"
9299 fi
9300 set d_lchown
9301 eval $setvar
9302
9303 : See if number of significant digits in a double precision number is known
9304 echo " "
9305 $cat >ldbl_dig.c <<EOM
9306 #$i_limits I_LIMITS
9307 #$i_float I_FLOAT
9308 #ifdef I_LIMITS
9309 #include <limits.h>
9310 #endif
9311 #ifdef I_FLOAT
9312 #include <float.h>
9313 #endif
9314 #ifdef LDBL_DIG
9315 printf("Contains LDBL_DIG");
9316 #endif
9317 EOM
9318 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9319 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9320         echo "LDBL_DIG found." >&4
9321         val="$define"
9322 else
9323         echo "LDBL_DIG NOT found." >&4
9324         val="$undef"
9325 fi
9326 $rm -f ldbl_dig.?
9327 set d_ldbl_dig
9328 eval $setvar
9329
9330 : see if link exists
9331 set link d_link
9332 eval $inlibc
9333
9334 : see if localeconv exists
9335 set localeconv d_locconv
9336 eval $inlibc
9337
9338 : see if lockf exists
9339 set lockf d_lockf
9340 eval $inlibc
9341
9342 : check for long long
9343 echo " "
9344 $echo $n "Checking to see if your system supports long long..." $c >&4
9345 echo 'int main() { long long x = 7; return 0; }' > try.c
9346 set try
9347 if eval $compile; then
9348         val="$define"
9349         echo " Yes, it does." >&4
9350 else
9351         val="$undef"
9352         echo " No, it doesn't." >&4
9353 fi
9354 $rm try.*
9355 set d_longlong
9356 eval $setvar
9357
9358 : check for length of long long
9359 case "${d_longlong}${longlongsize}" in
9360 $define)
9361         echo " "
9362         $echo $n "Checking to see how big your long longs are..." $c >&4
9363         $cat >try.c <<'EOCP'
9364 #include <stdio.h>
9365 int main()
9366 {
9367     printf("%d\n", (int)sizeof(long long));
9368     return(0);
9369 }
9370 EOCP
9371         set try
9372         if eval $compile_ok; then
9373                 longlongsize=`./try$exe_ext`
9374                 $echo " $longlongsize bytes." >&4
9375         else
9376                 dflt='8'
9377                 echo " "
9378                 echo "(I can't seem to compile the test program.  Guessing...)"
9379                 rp="What is the size of a long long (in bytes)?"
9380                 . ./myread
9381                 longlongsize="$ans"
9382         fi
9383         if $test "X$longsize" = "X$longlongsize"; then
9384                 echo "(That isn't any different from an ordinary long.)"
9385         fi      
9386         ;;
9387 esac
9388 $rm -f try.* try
9389
9390 : see if lstat exists
9391 set lstat d_lstat
9392 eval $inlibc
9393
9394 : see if mblen exists
9395 set mblen d_mblen
9396 eval $inlibc
9397
9398 : see if mbstowcs exists
9399 set mbstowcs d_mbstowcs
9400 eval $inlibc
9401
9402 : see if mbtowc exists
9403 set mbtowc d_mbtowc
9404 eval $inlibc
9405
9406 : see if memchr exists
9407 set memchr d_memchr
9408 eval $inlibc
9409
9410 : see if memcmp exists
9411 set memcmp d_memcmp
9412 eval $inlibc
9413
9414 : see if memcpy exists
9415 set memcpy d_memcpy
9416 eval $inlibc
9417
9418 : see if memmove exists
9419 set memmove d_memmove
9420 eval $inlibc
9421
9422 : see if memset exists
9423 set memset d_memset
9424 eval $inlibc
9425
9426 : see if mkdir exists
9427 set mkdir d_mkdir
9428 eval $inlibc
9429
9430 : see if mkfifo exists
9431 set mkfifo d_mkfifo
9432 eval $inlibc
9433
9434 : see if mktime exists
9435 set mktime d_mktime
9436 eval $inlibc
9437
9438 : see if msgctl exists
9439 set msgctl d_msgctl
9440 eval $inlibc
9441
9442 : see if msgget exists
9443 set msgget d_msgget
9444 eval $inlibc
9445
9446 : see if msgsnd exists
9447 set msgsnd d_msgsnd
9448 eval $inlibc
9449
9450 : see if msgrcv exists
9451 set msgrcv d_msgrcv
9452 eval $inlibc
9453
9454 : see how much of the 'msg*(2)' library is present.
9455 h_msg=true
9456 echo " "
9457 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9458 *"$undef"*) h_msg=false;;
9459 esac
9460 case "$osname" in
9461 freebsd)
9462     case "`ipcs 2>&1`" in
9463     "SVID messages"*"not configured"*)
9464         echo "Your $osname does not have the msg*(2) configured." >&4
9465         h_msg=false
9466         val="$undef"
9467         set msgctl d_msgctl
9468         eval $setvar
9469         set msgget d_msgget
9470         eval $setvar
9471         set msgsnd d_msgsnd
9472         eval $setvar
9473         set msgrcv d_msgrcv
9474         eval $setvar
9475         ;;
9476     esac
9477     ;;
9478 esac
9479 : we could also check for sys/ipc.h ...
9480 if $h_msg && $test `./findhdr sys/msg.h`; then
9481         echo "You have the full msg*(2) library." >&4
9482         val="$define"
9483 else
9484         echo "You don't have the full msg*(2) library." >&4
9485         val="$undef"
9486 fi
9487 set d_msg
9488 eval $setvar
9489
9490 : see if nice exists
9491 set nice d_nice
9492 eval $inlibc
9493
9494 : see if inttypes.h is available
9495 : we want a real compile instead of Inhdr because some systems
9496 : have an inttypes.h which includes non-existent headers
9497 echo " "
9498 $cat >try.c <<EOCP
9499 #include <inttypes.h>
9500 int main() {
9501         static int32_t foo32 = 0x12345678;
9502 }
9503 EOCP
9504 set try
9505 if eval $compile; then
9506         echo "<inttypes.h> found." >&4
9507         val="$define"
9508 else
9509         echo "<inttypes.h> NOT found." >&4
9510         val="$undef"
9511 fi
9512 $rm -f try.c try
9513 set i_inttypes
9514 eval $setvar
9515
9516 : check for int64_t
9517 echo " "
9518 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9519 $cat >try.c <<EOCP
9520 #include <sys/types.h>
9521 #$i_inttypes I_INTTYPES
9522 #ifdef I_INTTYPES
9523 #include <inttypes.h>
9524 #endif
9525 int main() { int64_t x = 7; }
9526 EOCP
9527 set try
9528 if eval $compile; then
9529         val="$define"
9530         echo " Yes, it does." >&4
9531 else
9532         val="$undef"
9533         echo " No, it doesn't." >&4
9534 fi
9535 $rm -f try try.*
9536 set d_int64t
9537 eval $setvar
9538
9539
9540 echo " "
9541 echo "Checking which 64-bit integer type we could use..." >&4
9542
9543 case "$intsize" in
9544 8) val=int
9545    set quadtype
9546    eval $setvar
9547    val='"unsigned int"'
9548    set uquadtype
9549    eval $setvar
9550    quadkind=1
9551    ;;
9552 *) case "$longsize" in
9553    8) val=long
9554       set quadtype
9555       eval $setvar
9556       val='"unsigned long"'
9557       set uquadtype
9558       eval $setvar
9559       quadkind=2
9560       ;;
9561    *) case "$uselonglong:$d_longlong:$longlongsize" in
9562       define:define:8)
9563         val='"long long"'
9564         set quadtype
9565         eval $setvar
9566         val='"unsigned long long"'
9567         set uquadtype
9568         eval $setvar
9569         quadkind=3
9570         ;;
9571       *) case "$d_int64t" in
9572          define)
9573            val=int64_t
9574            set quadtype
9575            eval $setvar
9576            val=uint64_t
9577            set uquadtype
9578            eval $setvar
9579            quadkind=4
9580            ;;
9581          esac
9582          ;;
9583       esac
9584       ;;
9585    esac
9586    ;;
9587 esac
9588
9589 case "$quadtype" in
9590 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9591         undef:define:8)
9592            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9593         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9594         esac
9595         d_quad="$undef"
9596         ;;
9597 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9598             verb="will"
9599         else
9600             verb="could"
9601         fi
9602         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9603         d_quad="$define"
9604         ;;
9605 esac
9606
9607 : check for length of character
9608 echo " "
9609 case "$charsize" in
9610 '')
9611         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9612         $cat >try.c <<'EOCP'
9613 #include <stdio.h>
9614 int main()
9615 {
9616     printf("%d\n", (int)sizeof(char));
9617     exit(0);
9618 }
9619 EOCP
9620         set try
9621         if eval $compile_ok; then
9622                 dflt=`./try`
9623         else
9624                 dflt='1'
9625                 echo "(I can't seem to compile the test program.  Guessing...)"
9626         fi
9627         ;;
9628 *)
9629         dflt="$charsize"
9630         ;;
9631 esac
9632 rp="What is the size of a character (in bytes)?"
9633 . ./myread
9634 charsize="$ans"
9635 $rm -f try.c try
9636
9637
9638 echo " "
9639 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9640
9641 case "$use64bits:$d_quad:$quadtype" in
9642 define:define:?*)
9643         ivtype="$quadtype"
9644         uvtype="$uquadtype"
9645         ivsize=8
9646         uvsize=8
9647         ;;
9648 *)      ivtype="long"
9649         uvtype="unsigned long"
9650         ivsize=$longsize
9651         uvsize=$longsize
9652         ;;
9653 esac
9654
9655 case "$uselongdouble:$d_longdbl" in
9656 define:define)
9657         nvtype="long double"
9658         nvsize=$longdblsize
9659         ;;
9660 *)      nvtype=double
9661         nvsize=$doublesize
9662         ;;
9663 esac
9664
9665 $echo "(IV will be "$ivtype", $ivsize bytes)"
9666 $echo "(UV will be "$uvtype", $uvsize bytes)"
9667 $echo "(NV will be "$nvtype", $nvsize bytes)"
9668
9669 $cat >try.c <<EOCP
9670 #$i_inttypes I_INTTYPES
9671 #ifdef I_INTTYPES
9672 #include <inttypes.h>
9673 #endif
9674 #include <stdio.h>
9675 int main() {
9676 #ifdef INT8
9677    int8_t i =  INT8_MAX;
9678   uint8_t u = UINT8_MAX;
9679   printf("int8_t\n");
9680 #endif
9681 #ifdef INT16
9682    int16_t i =  INT16_MAX;
9683   uint16_t i = UINT16_MAX;
9684   printf("int16_t\n");
9685 #endif
9686 #ifdef INT32
9687    int32_t i =  INT32_MAX;
9688   uint32_t u = UINT32_MAX;
9689   printf("int32_t\n");
9690 #endif
9691 }
9692 EOCP
9693
9694 case "$i8type" in
9695 '')     case "$charsize" in
9696         1)      i8type=char
9697                 u8type="unsigned char"
9698                 i8size=$charsize
9699                 u8size=$charsize
9700                 ;;
9701         esac
9702         ;;
9703 esac
9704 case "$i8type" in
9705 '')     set try -DINT8
9706         if eval $compile; then
9707                 case "`./try$exe_ext`" in
9708                 int8_t) i8type=int8_t
9709                         u8type=uint8_t
9710                         i8size=1
9711                         u8size=1
9712                         ;;
9713                 esac
9714         fi
9715         ;;
9716 esac
9717 case "$i8type" in
9718 '')     if $test $charsize -ge 1; then
9719                 i8type=char
9720                 u8type="unsigned char"
9721                 i8size=$charsize
9722                 u8size=$charsize
9723         fi
9724         ;;
9725 esac
9726
9727 case "$i16type" in
9728 '')     case "$shortsize" in
9729         2)      i16type=short
9730                 u16type="unsigned short"
9731                 i16size=$shortsize
9732                 u16size=$shortsize
9733                 ;;
9734         esac
9735         ;;
9736 esac
9737 case "$i16type" in
9738 '')     set try -DINT16
9739         if eval $compile; then
9740                 case "`./try$exe_ext`" in
9741                 int16_t)
9742                         i16type=int16_t
9743                         u16type=uint16_t
9744                         i16size=2
9745                         u16size=2
9746                         ;;
9747                 esac
9748         fi
9749         ;;
9750 esac
9751 case "$i16type" in
9752 '')     if $test $shortsize -ge 2; then
9753                 i16type=short
9754                 u16type="unsigned short"
9755                 i16size=$shortsize
9756                 u16size=$shortsize
9757         fi
9758         ;;
9759 esac
9760
9761 case "$i32type" in
9762 '')     case "$longsize" in
9763         4)      i32type=long
9764                 u32type="unsigned long"
9765                 i32size=$longsize
9766                 u32size=$longsize
9767                 ;;
9768         *)      case "$intsize" in
9769                 4)      i32type=int
9770                         u32type="unsigned int"
9771                         i32size=$intsize
9772                         u32size=$intsize
9773                         ;;
9774                 esac
9775                 ;;
9776         esac
9777         ;;
9778 esac
9779 case "$i32type" in
9780 '')     set try -DINT32
9781         if eval $compile; then
9782                 case "`./try$exe_ext`" in
9783                 int32_t)
9784                         i32type=int32_t
9785                         u32type=uint32_t
9786                         i32size=4
9787                         u32size=4
9788                         ;;
9789                 esac
9790         fi
9791         ;;
9792 esac
9793 case "$i32type" in
9794 '')     if $test $intsize -ge 4; then
9795                 i32type=int
9796                 u32type="unsigned int"
9797                 i32size=$intsize
9798                 u32size=$intsize
9799         fi
9800         ;;
9801 esac
9802
9803 case "$i64type" in
9804 '')     case "$d_quad:$quadtype" in
9805         define:?*)
9806                 i64type="$quadtype"
9807                 u64type="$uquadtype"
9808                 i64size=8
9809                 u64size=8
9810                 ;;
9811         esac
9812         ;;
9813 esac
9814
9815 $echo "Checking whether your NVs can preserve your UVs..." >&4
9816 $cat <<EOP >try.c
9817 #include <stdio.h>
9818 int main() {
9819     $uvtype k = ($uvtype)~0, l;
9820     $nvtype d;
9821     l = k;
9822     d = ($nvtype)l;
9823     l = ($uvtype)d;
9824     if (l == k)
9825        printf("preserve\n");
9826     exit(0);
9827 }
9828 EOP
9829 set try
9830 if eval $compile; then
9831         case "`./try$exe_ext`" in
9832         preserve) d_nv_preserves_uv="$define" ;;
9833         esac
9834 fi      
9835 case "$d_nv_preserves_uv" in
9836 $define) $echo "Yes, they can."  2>&1 ;;
9837 *)       $echo "No, they can't." 2>&1
9838          d_nv_preserves_uv="$undef"
9839          ;;
9840 esac
9841
9842 $rm -f try.* try
9843
9844 : see if POSIX threads are available
9845 set pthread.h i_pthread
9846 eval $inhdr
9847
9848
9849
9850
9851 : how to create joinable pthreads
9852 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9853         echo " "
9854         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9855         $cat >try.c <<'EOCP'
9856 #include <pthread.h>
9857 int main() {
9858     int detachstate = JOINABLE;
9859 }
9860 EOCP
9861         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9862         if eval $compile; then
9863                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9864                 val="$undef" # Yes, undef.
9865                 set d_old_pthread_create_joinable
9866                 eval $setvar
9867                 val=""
9868                 set old_pthread_create_joinable
9869                 eval $setvar
9870         else
9871                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9872                 if eval $compile; then
9873                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9874                         val="$define"
9875                         set d_old_pthread_create_joinable
9876                         eval $setvar
9877                         val=PTHREAD_CREATE_UNDETACHED
9878                         set old_pthread_create_joinable
9879                         eval $setvar
9880                 else            
9881                         set try -DJOINABLE=__UNDETACHED
9882                         if eval $compile; then
9883                                 echo "You seem to use __UNDETACHED." >&4
9884                                 val="$define"
9885                                 set d_old_pthread_create_joinable
9886                                 eval $setvar
9887                                 val=__UNDETACHED
9888                                 set old_pthread_create_joinable
9889                                 eval $setvar
9890                         else
9891                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9892                                 val="$define"
9893                                 set d_old_pthread_create_joinable
9894                                 eval $setvar
9895                                 val=0
9896                                 set old_pthread_create_joinable
9897                                 eval $setvar
9898                         fi
9899                 fi
9900         fi
9901         $rm -f try try.*
9902 else
9903     d_old_pthread_create_joinable="$undef"
9904     old_pthread_create_joinable=""
9905 fi
9906
9907 : see if pause exists
9908 set pause d_pause
9909 eval $inlibc
9910
9911 : see if pipe exists
9912 set pipe d_pipe
9913 eval $inlibc
9914
9915 : see if poll exists
9916 set poll d_poll
9917 eval $inlibc
9918
9919
9920 : see whether the various POSIXish _yields exist
9921 $cat >try.c <<EOP
9922 #include <pthread.h>
9923 #include <stdio.h>
9924 int main() {
9925 #ifdef SCHED_YIELD
9926         sched_yield();
9927 #else
9928 #ifdef PTHREAD_YIELD
9929         pthread_yield();
9930 #else
9931 #ifdef PTHREAD_YIELD_NULL
9932         pthread_yield(NULL);
9933 #endif
9934 #endif
9935 #endif
9936 }
9937 EOP
9938 : see if sched_yield exists
9939 set try -DSCHED_YIELD
9940 if eval $compile; then
9941     val="$define"
9942     sched_yield='sched_yield()'
9943 else
9944     val="$undef"
9945 fi
9946 case "$usethreads" in
9947 $define)
9948         case "$val" in
9949         $define) echo 'sched_yield() found.' >&4        ;;
9950         *)       echo 'sched_yield() NOT found.' >&4    ;;
9951         esac
9952 esac
9953 set d_sched_yield
9954 eval $setvar
9955
9956 : see if pthread_yield exists
9957 set try -DPTHREAD_YIELD
9958 if eval $compile; then
9959     val="$define"
9960     case "$sched_yield" in
9961     '') sched_yield='pthread_yield()' ;;
9962     esac
9963 else
9964     set try -DPTHREAD_YIELD_NULL
9965     if eval $compile; then
9966         val="$define"
9967         case "$sched_yield" in
9968         '') sched_yield='pthread_yield(NULL)' ;;
9969         esac
9970     else
9971         val="$undef"
9972     fi
9973 fi
9974 case "$usethreads" in
9975 $define)
9976         case "$val" in
9977         $define) echo 'pthread_yield() found.' >&4      ;;
9978         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9979         esac
9980         ;;
9981 esac
9982 set d_pthread_yield
9983 eval $setvar
9984
9985 case "$sched_yield" in
9986 '') sched_yield=undef ;;
9987 esac
9988
9989 $rm -f try try.*
9990
9991 : see if this is a pwd.h system
9992 set pwd.h i_pwd
9993 eval $inhdr
9994
9995 case "$i_pwd" in
9996 $define)
9997         xxx=`./findhdr pwd.h`
9998         $cppstdin $cppflags $cppminus < $xxx >$$.h
9999
10000         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10001                 val="$define"
10002         else
10003                 val="$undef"
10004         fi
10005         set d_pwquota
10006         eval $setvar
10007
10008         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10009                 val="$define"
10010         else
10011                 val="$undef"
10012         fi
10013         set d_pwage
10014         eval $setvar
10015
10016         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10017                 val="$define"
10018         else
10019                 val="$undef"
10020         fi
10021         set d_pwchange
10022         eval $setvar
10023
10024         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10025                 val="$define"
10026         else
10027                 val="$undef"
10028         fi
10029         set d_pwclass
10030         eval $setvar
10031
10032         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10033                 val="$define"
10034         else
10035                 val="$undef"
10036         fi
10037         set d_pwexpire
10038         eval $setvar
10039
10040         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10041                 val="$define"
10042         else
10043                 val="$undef"
10044         fi
10045         set d_pwcomment
10046         eval $setvar
10047
10048         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10049                 val="$define"
10050         else
10051                 val="$undef"
10052         fi
10053         set d_pwgecos
10054         eval $setvar
10055
10056         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10057                 val="$define"
10058         else
10059                 val="$undef"
10060         fi
10061         set d_pwpasswd
10062         eval $setvar
10063
10064         $rm -f $$.h
10065         ;;
10066 *)
10067         val="$undef"; 
10068         set d_pwquota; eval $setvar
10069         set d_pwage; eval $setvar
10070         set d_pwchange; eval $setvar
10071         set d_pwclass; eval $setvar
10072         set d_pwexpire; eval $setvar
10073         set d_pwcomment; eval $setvar
10074         set d_pwgecos; eval $setvar
10075         set d_pwpasswd; eval $setvar
10076         ;;
10077 esac
10078
10079 : see if readdir and friends exist
10080 set readdir d_readdir
10081 eval $inlibc
10082 set seekdir d_seekdir
10083 eval $inlibc
10084 set telldir d_telldir
10085 eval $inlibc
10086 set rewinddir d_rewinddir
10087 eval $inlibc
10088
10089 : see if readlink exists
10090 set readlink d_readlink
10091 eval $inlibc
10092
10093 : see if rename exists
10094 set rename d_rename
10095 eval $inlibc
10096
10097 : see if rmdir exists
10098 set rmdir d_rmdir
10099 eval $inlibc
10100
10101 : see if memory.h is available.
10102 val=''
10103 set memory.h val
10104 eval $inhdr
10105
10106 : See if it conflicts with string.h
10107 case "$val" in
10108 $define)
10109         case "$strings" in
10110         '') ;;
10111         *)
10112                 $cppstdin $cppflags $cppminus < $strings > mem.h
10113                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10114                         echo " "
10115                         echo "We won't be including <memory.h>."
10116                         val="$undef"
10117                 fi
10118                 $rm -f mem.h
10119                 ;;
10120         esac
10121 esac
10122 set i_memory
10123 eval $setvar
10124
10125 : can bcopy handle overlapping blocks?
10126 val="$undef"
10127 case "$d_bcopy" in
10128 "$define")
10129         echo " "
10130         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10131         $cat >try.c <<EOCP
10132 #$i_memory I_MEMORY
10133 #$i_stdlib I_STDLIB
10134 #$i_string I_STRING
10135 #$i_unistd I_UNISTD
10136 EOCP
10137         $cat >>try.c <<'EOCP'
10138 #include <stdio.h>
10139 #ifdef I_MEMORY
10140 #  include <memory.h>
10141 #endif
10142 #ifdef I_STDLIB
10143 #  include <stdlib.h>
10144 #endif
10145 #ifdef I_STRING
10146 #  include <string.h>
10147 #else
10148 #  include <strings.h>
10149 #endif
10150 #ifdef I_UNISTD
10151 #  include <unistd.h>  /* Needed for NetBSD */
10152 #endif
10153 int main()
10154 {
10155 char buf[128], abc[128];
10156 char *b;
10157 int len;
10158 int off;
10159 int align;
10160
10161 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10162
10163 for (align = 7; align >= 0; align--) {
10164         for (len = 36; len; len--) {
10165                 b = buf+align;
10166                 bcopy(abc, b, len);
10167                 for (off = 1; off <= len; off++) {
10168                         bcopy(b, b+off, len);
10169                         bcopy(b+off, b, len);
10170                         if (bcmp(b, abc, len))
10171                                 exit(1);
10172                 }
10173         }
10174 }
10175 exit(0);
10176 }
10177 EOCP
10178         set try
10179         if eval $compile_ok; then
10180                 if ./try 2>/dev/null; then
10181                         echo "Yes, it can."
10182                         val="$define"
10183                 else
10184                         echo "It can't, sorry."
10185                         case "$d_memmove" in
10186                         "$define") echo "But that's Ok since you have memmove()." ;;
10187                         esac
10188                 fi
10189         else
10190                 echo "(I can't compile the test program, so we'll assume not...)"
10191                 case "$d_memmove" in
10192                 "$define") echo "But that's Ok since you have memmove()." ;;
10193                 esac
10194         fi
10195         ;;
10196 esac
10197 $rm -f try.* try core
10198 set d_safebcpy
10199 eval $setvar
10200
10201 : can memcpy handle overlapping blocks?
10202 val="$undef"
10203 case "$d_memcpy" in
10204 "$define")
10205         echo " "
10206         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10207         $cat >try.c <<EOCP
10208 #$i_memory I_MEMORY
10209 #$i_stdlib I_STDLIB
10210 #$i_string I_STRING
10211 #$i_unistd I_UNISTD
10212 EOCP
10213         $cat >>try.c <<'EOCP'
10214 #include <stdio.h>
10215 #ifdef I_MEMORY
10216 #  include <memory.h>
10217 #endif
10218 #ifdef I_STDLIB
10219 #  include <stdlib.h>
10220 #endif
10221 #ifdef I_STRING
10222 #  include <string.h>
10223 #else
10224 #  include <strings.h>
10225 #endif
10226 #ifdef I_UNISTD
10227 #  include <unistd.h>  /* Needed for NetBSD */
10228 #endif
10229 int main()
10230 {
10231 char buf[128], abc[128];
10232 char *b;
10233 int len;
10234 int off;
10235 int align;
10236
10237 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10238    try to store the string in read-only memory. */
10239 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10240
10241 for (align = 7; align >= 0; align--) {
10242         for (len = 36; len; len--) {
10243                 b = buf+align;
10244                 memcpy(b, abc, len);
10245                 for (off = 1; off <= len; off++) {
10246                         memcpy(b+off, b, len);
10247                         memcpy(b, b+off, len);
10248                         if (memcmp(b, abc, len))
10249                                 exit(1);
10250                 }
10251         }
10252 }
10253 exit(0);
10254 }
10255 EOCP
10256         set try
10257         if eval $compile_ok; then
10258                 if ./try 2>/dev/null; then
10259                         echo "Yes, it can."
10260                         val="$define"
10261                 else
10262                         echo "It can't, sorry."
10263                         case "$d_memmove" in
10264                         "$define") echo "But that's Ok since you have memmove()." ;;
10265                         esac
10266                 fi
10267         else
10268                 echo "(I can't compile the test program, so we'll assume not...)"
10269                 case "$d_memmove" in
10270                 "$define") echo "But that's Ok since you have memmove()." ;;
10271                 esac
10272         fi
10273         ;;
10274 esac
10275 $rm -f try.* try core
10276 set d_safemcpy
10277 eval $setvar
10278
10279 : can memcmp be trusted to compare relative magnitude?
10280 val="$undef"
10281 case "$d_memcmp" in
10282 "$define")
10283         echo " "
10284         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10285         $cat >try.c <<EOCP
10286 #$i_memory I_MEMORY
10287 #$i_stdlib I_STDLIB
10288 #$i_string I_STRING
10289 #$i_unistd I_UNISTD
10290 EOCP
10291         $cat >>try.c <<'EOCP'
10292 #include <stdio.h>
10293 #ifdef I_MEMORY
10294 #  include <memory.h>
10295 #endif
10296 #ifdef I_STDLIB
10297 #  include <stdlib.h>
10298 #endif
10299 #ifdef I_STRING
10300 #  include <string.h>
10301 #else
10302 #  include <strings.h>
10303 #endif
10304 #ifdef I_UNISTD
10305 #  include <unistd.h>  /* Needed for NetBSD */
10306 #endif
10307 int main()
10308 {
10309 char a = -1;
10310 char b = 0;
10311 if ((a < b) && memcmp(&a, &b, 1) < 0)
10312         exit(1);
10313 exit(0);
10314 }
10315 EOCP
10316         set try
10317         if eval $compile_ok; then
10318                 if ./try 2>/dev/null; then
10319                         echo "Yes, it can."
10320                         val="$define"
10321                 else
10322                         echo "No, it can't (it uses signed chars)."
10323                 fi
10324         else
10325                 echo "(I can't compile the test program, so we'll assume not...)"
10326         fi
10327         ;;
10328 esac
10329 $rm -f try.* try core
10330 set d_sanemcmp
10331 eval $setvar
10332
10333 : see if select exists
10334 set select d_select
10335 eval $inlibc
10336
10337 : see if semctl exists
10338 set semctl d_semctl
10339 eval $inlibc
10340
10341 : see if semget exists
10342 set semget d_semget
10343 eval $inlibc
10344
10345 : see if semop exists
10346 set semop d_semop
10347 eval $inlibc
10348
10349 : see how much of the 'sem*(2)' library is present.
10350 h_sem=true
10351 echo " "
10352 case "$d_semctl$d_semget$d_semop" in
10353 *"$undef"*) h_sem=false;;
10354 esac
10355 case "$osname" in
10356 freebsd)
10357     case "`ipcs 2>&1`" in
10358     "SVID messages"*"not configured"*)
10359         echo "Your $osname does not have the sem*(2) configured." >&4
10360         h_sem=false
10361         val="$undef"
10362         set semctl d_semctl
10363         eval $setvar
10364         set semget d_semget
10365         eval $setvar
10366         set semop d_semop
10367         eval $setvar
10368         ;;
10369     esac
10370     ;;
10371 esac
10372 : we could also check for sys/ipc.h ...
10373 if $h_sem && $test `./findhdr sys/sem.h`; then
10374         echo "You have the full sem*(2) library." >&4
10375         val="$define"
10376 else
10377         echo "You don't have the full sem*(2) library." >&4
10378         val="$undef"
10379 fi
10380 set d_sem
10381 eval $setvar
10382
10383 : see whether sys/sem.h defines union semun
10384 echo " "
10385 $cat > try.c <<'END'
10386 #include <sys/types.h>
10387 #include <sys/ipc.h>
10388 #include <sys/sem.h>
10389 int main () { union semun semun; semun.buf = 0; }
10390 END
10391 set try
10392 if eval $compile; then
10393     echo "You have union semun in <sys/sem.h>." >&4
10394     val="$define"
10395 else
10396     echo "You do not have union semun in <sys/sem.h>." >&4
10397     val="$undef"
10398 fi
10399 $rm -f try try.c try.h
10400 set d_union_semun
10401 eval $setvar
10402
10403 : see how to do semctl IPC_STAT
10404 case "$d_sem" in
10405 $define)
10406     : see whether semctl IPC_STAT can use union semun
10407     echo " "
10408     $cat > try.h <<END
10409 #ifndef S_IRUSR
10410 #   ifdef S_IREAD
10411 #       define S_IRUSR S_IREAD
10412 #       define S_IWUSR S_IWRITE
10413 #       define S_IXUSR S_IEXEC
10414 #   else
10415 #       define S_IRUSR 0400
10416 #       define S_IWUSR 0200
10417 #       define S_IXUSR 0100
10418 #   endif
10419 #   define S_IRGRP (S_IRUSR>>3)
10420 #   define S_IWGRP (S_IWUSR>>3)
10421 #   define S_IXGRP (S_IXUSR>>3)
10422 #   define S_IROTH (S_IRUSR>>6)
10423 #   define S_IWOTH (S_IWUSR>>6)
10424 #   define S_IXOTH (S_IXUSR>>6)
10425 #endif
10426 #ifndef S_IRWXU
10427 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10428 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10429 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10430 #endif
10431 END
10432
10433     $cat > try.c <<END
10434 #include <sys/types.h>
10435 #include <sys/ipc.h>
10436 #include <sys/sem.h>
10437 #include <sys/stat.h>
10438 #include <stdio.h>
10439 #include <errno.h>
10440 #include "try.h"
10441 #ifndef errno
10442 extern int errno;
10443 #endif
10444 #$d_union_semun HAS_UNION_SEMUN
10445 int main() {
10446     union semun
10447 #ifndef HAS_UNION_SEMUN
10448     {
10449         int val;
10450         struct semid_ds *buf;
10451         unsigned short *array;
10452     }
10453 #endif
10454     arg;
10455     int sem, st;
10456
10457 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10458     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10459     if (sem > -1) {
10460         struct semid_ds argbuf;
10461         arg.buf = &argbuf;
10462 #       ifdef IPC_STAT
10463         st = semctl(sem, 0, IPC_STAT, arg);
10464         if (st == 0)
10465             printf("semun\n");
10466         else
10467 #       endif /* IPC_STAT */
10468             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10469 #       ifdef IPC_RMID
10470         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10471 #       endif /* IPC_RMID */
10472             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10473     } else
10474 #endif /* IPC_PRIVATE && ... */
10475         printf("semget failed: errno = %d\n", errno);
10476   return 0;
10477 }
10478 END
10479     val="$undef"
10480     set try
10481     if eval $compile; then
10482         xxx=`./try`
10483         case "$xxx" in
10484         semun) val="$define" ;;
10485         esac
10486     fi
10487     $rm -f try try.c
10488     set d_semctl_semun
10489     eval $setvar
10490     case "$d_semctl_semun" in
10491     $define)
10492         echo "You can use union semun for semctl IPC_STAT." >&4
10493         also='also'
10494         ;;
10495     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10496         also=''
10497         ;;
10498     esac
10499
10500     : see whether semctl IPC_STAT can use struct semid_ds pointer
10501     $cat > try.c <<'END'
10502 #include <sys/types.h>
10503 #include <sys/ipc.h>
10504 #include <sys/sem.h>
10505 #include <sys/stat.h>
10506 #include "try.h"
10507 #include <stdio.h>
10508 #include <errno.h>
10509 #ifndef errno
10510 extern int errno;
10511 #endif
10512 int main() {
10513     struct semid_ds arg;
10514     int sem, st;
10515
10516 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10517     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10518     if (sem > -1) {
10519 #       ifdef IPC_STAT
10520         st = semctl(sem, 0, IPC_STAT, &arg);
10521         if (st == 0)
10522             printf("semid_ds\n");
10523         else
10524 #       endif /* IPC_STAT */
10525             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10526 #       ifdef IPC_RMID
10527         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10528 #       endif /* IPC_RMID */
10529             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10530     } else
10531 #endif /* IPC_PRIVATE && ... */
10532         printf("semget failed: errno = %d\n", errno);
10533
10534     return 0;
10535 }
10536 END
10537     val="$undef"
10538     set try
10539     if eval $compile; then
10540         xxx=`./try`
10541         case "$xxx" in
10542         semid_ds) val="$define" ;;
10543         esac
10544     fi
10545     $rm -f try try.c
10546     set d_semctl_semid_ds
10547     eval $setvar
10548     case "$d_semctl_semid_ds" in
10549     $define)
10550         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10551         ;;
10552     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10553         ;;
10554     esac
10555     $rm -f try.h
10556     ;;
10557 *)  val="$undef"
10558
10559     # We do not have the full sem*(2) library, so assume we can not
10560     # use either.
10561
10562     set d_semctl_semun
10563     eval $setvar
10564
10565     set d_semctl_semid_ds
10566     eval $setvar
10567     ;;
10568 esac
10569
10570 : see if setegid exists
10571 set setegid d_setegid
10572 eval $inlibc
10573
10574 : see if seteuid exists
10575 set seteuid d_seteuid
10576 eval $inlibc
10577
10578 : see if setgrent exists
10579 set setgrent d_setgrent
10580 eval $inlibc
10581
10582 : see if sethostent exists
10583 set sethostent d_sethent
10584 eval $inlibc
10585
10586 : see if setlinebuf exists
10587 set setlinebuf d_setlinebuf
10588 eval $inlibc
10589
10590 : see if setlocale exists
10591 set setlocale d_setlocale
10592 eval $inlibc
10593
10594 : see if setnetent exists
10595 set setnetent d_setnent
10596 eval $inlibc
10597
10598 : see if setprotoent exists
10599 set setprotoent d_setpent
10600 eval $inlibc
10601
10602 : see if setpgid exists
10603 set setpgid d_setpgid
10604 eval $inlibc
10605
10606 : see if setpgrp2 exists
10607 set setpgrp2 d_setpgrp2
10608 eval $inlibc
10609
10610 : see if setpriority exists
10611 set setpriority d_setprior
10612 eval $inlibc
10613
10614 : see if setpwent exists
10615 set setpwent d_setpwent
10616 eval $inlibc
10617
10618 : see if setregid exists
10619 set setregid d_setregid
10620 eval $inlibc
10621 set setresgid d_setresgid
10622 eval $inlibc
10623
10624 : see if setreuid exists
10625 set setreuid d_setreuid
10626 eval $inlibc
10627 set setresuid d_setresuid
10628 eval $inlibc
10629
10630 : see if setrgid exists
10631 set setrgid d_setrgid
10632 eval $inlibc
10633
10634 : see if setruid exists
10635 set setruid d_setruid
10636 eval $inlibc
10637
10638 : see if setservent exists
10639 set setservent d_setsent
10640 eval $inlibc
10641
10642 : see if setsid exists
10643 set setsid d_setsid
10644 eval $inlibc
10645
10646 : see if setspent exists
10647 set setspent d_setspent
10648 eval $inlibc
10649
10650 : see if setvbuf exists
10651 set setvbuf d_setvbuf
10652 eval $inlibc
10653
10654 : see if sfio.h is available
10655 set sfio.h i_sfio
10656 eval $inhdr
10657
10658
10659 : see if sfio library is available
10660 case "$i_sfio" in
10661 $define)
10662         val=''
10663         set sfreserve val
10664         eval $inlibc
10665         ;;
10666 *)
10667         val="$undef"
10668         ;;
10669 esac
10670 : Ok, but do we want to use it.
10671 case "$val" in
10672 $define)
10673         case "$usesfio" in
10674         true|$define|[yY]*) dflt='y';;
10675         *) dflt='n';;
10676         esac
10677         echo "$package can use the sfio library, but it is experimental."
10678         rp="You seem to have sfio available, do you want to try using it?"
10679         . ./myread
10680         case "$ans" in
10681         y|Y) ;;
10682         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10683                 val="$undef"
10684                 : Remove sfio from list of libraries to use
10685                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10686                 shift
10687                 libs="$*"
10688                 echo "libs = $libs" >&4
10689                 ;;
10690         esac
10691         ;;
10692 *)      case "$usesfio" in
10693         true|$define|[yY]*)
10694                 echo "Sorry, cannot find sfio on this machine" >&4
10695                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10696                 ;;
10697         esac
10698         ;;
10699 esac
10700 set d_sfio
10701 eval $setvar
10702 case "$d_sfio" in
10703 $define) usesfio='true';;
10704 *) usesfio='false';;
10705 esac
10706
10707 : see if shmctl exists
10708 set shmctl d_shmctl
10709 eval $inlibc
10710
10711 : see if shmget exists
10712 set shmget d_shmget
10713 eval $inlibc
10714
10715 : see if shmat exists
10716 set shmat d_shmat
10717 eval $inlibc
10718 : see what shmat returns
10719 case "$d_shmat" in
10720 "$define")
10721         $cat >shmat.c <<'END'
10722 #include <sys/shm.h>
10723 void *shmat();
10724 END
10725         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10726                 shmattype='void *'
10727         else
10728                 shmattype='char *'
10729         fi
10730         echo "and it returns ($shmattype)." >&4
10731         : see if a prototype for shmat is available
10732         xxx=`./findhdr sys/shm.h`
10733         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10734         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10735                 val="$define"
10736         else
10737                 val="$undef"
10738         fi
10739         $rm -f shmat.[co]
10740         ;;
10741 *)
10742         val="$undef"
10743         ;;
10744 esac
10745 set d_shmatprototype
10746 eval $setvar
10747
10748 : see if shmdt exists
10749 set shmdt d_shmdt
10750 eval $inlibc
10751
10752 : see how much of the 'shm*(2)' library is present.
10753 h_shm=true
10754 echo " "
10755 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10756 *"$undef"*) h_shm=false;;
10757 esac
10758 case "$osname" in
10759 freebsd)
10760     case "`ipcs 2>&1`" in
10761     "SVID shared memory"*"not configured"*)
10762         echo "Your $osname does not have the shm*(2) configured." >&4
10763         h_shm=false
10764         val="$undef"
10765         set shmctl d_shmctl
10766         evat $setvar
10767         set shmget d_shmget
10768         evat $setvar
10769         set shmat d_shmat
10770         evat $setvar
10771         set shmdt d_shmdt
10772         evat $setvar
10773         ;;
10774     esac
10775     ;;
10776 esac
10777 : we could also check for sys/ipc.h ...
10778 if $h_shm && $test `./findhdr sys/shm.h`; then
10779         echo "You have the full shm*(2) library." >&4
10780         val="$define"
10781 else
10782         echo "You don't have the full shm*(2) library." >&4
10783         val="$undef"
10784 fi
10785 set d_shm
10786 eval $setvar
10787
10788 echo " "
10789 : see if we have sigaction
10790 if set sigaction val -f d_sigaction; eval $csym; $val; then
10791         echo 'sigaction() found.' >&4
10792         $cat > try.c <<'EOP'
10793 #include <stdio.h>
10794 #include <sys/types.h>
10795 #include <signal.h>
10796 int main()
10797 {
10798     struct sigaction act, oact;
10799     act.sa_flags = 0;
10800     oact.sa_handler = 0;
10801     /* so that act and oact are used */
10802     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10803 }
10804 EOP
10805         set try
10806         if eval $compile_ok; then
10807                 val="$define"
10808         else
10809                 echo "But you don't seem to have a useable struct sigaction." >&4
10810                 val="$undef"
10811         fi
10812 else
10813         echo 'sigaction NOT found.' >&4
10814         val="$undef"
10815 fi
10816 set d_sigaction; eval $setvar
10817 $rm -f try try$_o try.c
10818
10819 : see if sigsetjmp exists
10820 echo " "
10821 case "$d_sigsetjmp" in
10822 '')
10823         $cat >try.c <<'EOP'
10824 #include <setjmp.h>
10825 sigjmp_buf env;
10826 int set = 1;
10827 int main()
10828 {
10829         if (sigsetjmp(env,1))
10830                 exit(set);
10831         set = 0;
10832         siglongjmp(env, 1);
10833         exit(1);
10834 }
10835 EOP
10836         set try
10837         if eval $compile; then
10838                 if ./try >/dev/null 2>&1; then
10839                         echo "POSIX sigsetjmp found." >&4
10840                         val="$define"
10841                 else
10842                         $cat >&4 <<EOM
10843 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10844 I'll ignore them.
10845 EOM
10846                         val="$undef"
10847                 fi
10848         else
10849                 echo "sigsetjmp not found." >&4
10850                 val="$undef"
10851         fi
10852         ;;
10853 *) val="$d_sigsetjmp"
10854         case "$d_sigsetjmp" in
10855         $define) echo "POSIX sigsetjmp found." >&4;;
10856         $undef) echo "sigsetjmp not found." >&4;;
10857         esac
10858         ;;
10859 esac
10860 set d_sigsetjmp
10861 eval $setvar
10862 $rm -f try.c try
10863
10864 : see if sqrtl exists
10865 set sqrtl d_sqrtl
10866 eval $inlibc
10867
10868 : see if sys/stat.h is available
10869 set sys/stat.h i_sysstat
10870 eval $inhdr
10871
10872
10873 : see if stat knows about block sizes
10874 echo " "
10875 echo "Checking to see if your struct stat has st_blocks field..." >&4
10876 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10877 eval $hasfield
10878
10879
10880 : see if this is a sys/vfs.h system
10881 set sys/vfs.h i_sysvfs
10882 eval $inhdr
10883
10884
10885 : see if this is a sys/statfs.h system
10886 set sys/statfs.h i_sysstatfs
10887 eval $inhdr
10888
10889
10890 echo " "
10891 echo "Checking to see if your system supports struct statfs..." >&4
10892 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
10893 eval $hasstruct
10894 case "$d_statfs_s" in
10895 "$define")      echo "Yes, it does."   ;;
10896 *)              echo "No, it doesn't." ;;
10897 esac
10898
10899
10900
10901 : see if struct statfs knows about f_flags
10902 case "$d_statfs_s" in
10903 define) 
10904         echo " "
10905         echo "Checking to see if your struct statfs has f_flags field..." >&4
10906         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
10907         eval $hasfield
10908         ;;
10909 *)      val="$undef"
10910         set d_statfs_f_flags
10911         eval $setvar
10912         ;;
10913 esac
10914 case "$d_statfs_f_flags" in
10915 "$define")      echo "Yes, it does."   ;;
10916 *)              echo "No, it doesn't." ;;
10917 esac
10918
10919 : see if _ptr and _cnt from stdio act std
10920 echo " "
10921 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10922         echo "(Looks like you have stdio.h from Linux.)"
10923         case "$stdio_ptr" in
10924         '') stdio_ptr='((fp)->_IO_read_ptr)'
10925                 ptr_lval=$define
10926                 ;;
10927         *)      ptr_lval=$d_stdio_ptr_lval;;
10928         esac
10929         case "$stdio_cnt" in
10930         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10931                 cnt_lval=$undef
10932                 ;;
10933         *)      cnt_lval=$d_stdio_cnt_lval;;
10934         esac
10935         case "$stdio_base" in
10936         '') stdio_base='((fp)->_IO_read_base)';;
10937         esac
10938         case "$stdio_bufsiz" in
10939         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10940         esac
10941 else
10942         case "$stdio_ptr" in
10943         '') stdio_ptr='((fp)->_ptr)'
10944                 ptr_lval=$define
10945                 ;;
10946         *)      ptr_lval=$d_stdio_ptr_lval;;
10947         esac
10948         case "$stdio_cnt" in
10949         '') stdio_cnt='((fp)->_cnt)'
10950                 cnt_lval=$define
10951                 ;;
10952         *)      cnt_lval=$d_stdio_cnt_lval;;
10953         esac
10954         case "$stdio_base" in
10955         '') stdio_base='((fp)->_base)';;
10956         esac
10957         case "$stdio_bufsiz" in
10958         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10959         esac
10960 fi
10961 : test whether _ptr and _cnt really work
10962 echo "Checking how std your stdio is..." >&4
10963 $cat >try.c <<EOP
10964 #include <stdio.h>
10965 #define FILE_ptr(fp)    $stdio_ptr
10966 #define FILE_cnt(fp)    $stdio_cnt
10967 int main() {
10968         FILE *fp = fopen("try.c", "r");
10969         char c = getc(fp);
10970         if (
10971                 18 <= FILE_cnt(fp) &&
10972                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10973         )
10974                 exit(0);
10975         exit(1);
10976 }
10977 EOP
10978 val="$undef"
10979 set try
10980 if eval $compile; then
10981         if ./try; then
10982                 echo "Your stdio acts pretty std."
10983                 val="$define"
10984         else
10985                 echo "Your stdio isn't very std."
10986         fi
10987 else
10988         echo "Your stdio doesn't appear very std."
10989 fi
10990 $rm -f try.c try
10991 set d_stdstdio
10992 eval $setvar
10993
10994 : Can _ptr be used as an lvalue?
10995 case "$d_stdstdio$ptr_lval" in
10996 $define$define) val=$define ;;
10997 *) val=$undef ;;
10998 esac
10999 set d_stdio_ptr_lval
11000 eval $setvar
11001
11002 : Can _cnt be used as an lvalue?
11003 case "$d_stdstdio$cnt_lval" in
11004 $define$define) val=$define ;;
11005 *) val=$undef ;;
11006 esac
11007 set d_stdio_cnt_lval
11008 eval $setvar
11009
11010 : see if _base is also standard
11011 val="$undef"
11012 case "$d_stdstdio" in
11013 $define)
11014         $cat >try.c <<EOP
11015 #include <stdio.h>
11016 #define FILE_base(fp)   $stdio_base
11017 #define FILE_bufsiz(fp) $stdio_bufsiz
11018 int main() {
11019         FILE *fp = fopen("try.c", "r");
11020         char c = getc(fp);
11021         if (
11022                 19 <= FILE_bufsiz(fp) &&
11023                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11024         )
11025                 exit(0);
11026         exit(1);
11027 }
11028 EOP
11029         set try
11030         if eval $compile; then
11031                 if ./try; then
11032                         echo "And its _base field acts std."
11033                         val="$define"
11034                 else
11035                         echo "But its _base field isn't std."
11036                 fi
11037         else
11038                 echo "However, it seems to be lacking the _base field."
11039         fi
11040         $rm -f try.c try
11041         ;;
11042 esac
11043 set d_stdiobase
11044 eval $setvar
11045
11046 $cat >&4 <<EOM
11047 Checking how to access stdio streams by file descriptor number...
11048 EOM
11049 case "$stdio_stream_array" in
11050 '')     $cat >try.c <<EOCP
11051 #include <stdio.h>
11052 int main() {
11053   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11054     printf("yes\n");
11055 }
11056 EOCP
11057         for s in _iob __iob __sF
11058         do
11059                 set try -DSTDIO_STREAM_ARRAY=$s
11060                 if eval $compile; then
11061                         case "`./try$exe_ext`" in
11062                         yes)    stdio_stream_array=$s; break ;;
11063                         esac
11064                 fi
11065         done
11066         $rm -f try.* try$exe_ext
11067 esac
11068 case "$stdio_stream_array" in
11069 '')     $cat >&4 <<EOM
11070 I can't figure out how to access stdio streams by file descriptor number.
11071 EOM
11072         d_stdio_stream_array="$undef"
11073         ;;
11074 *)      $cat >&4 <<EOM
11075 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11076 EOM
11077         d_stdio_stream_array="$define"
11078         ;;
11079 esac
11080
11081 : see if strcoll exists
11082 set strcoll d_strcoll
11083 eval $inlibc
11084
11085 : check for structure copying
11086 echo " "
11087 echo "Checking to see if your C compiler can copy structs..." >&4
11088 $cat >try.c <<'EOCP'
11089 int main()
11090 {
11091         struct blurfl {
11092                 int dyick;
11093         } foo, bar;
11094
11095         foo = bar;
11096 }
11097 EOCP
11098 if $cc -c try.c >/dev/null 2>&1 ; then
11099         val="$define"
11100         echo "Yup, it can."
11101 else
11102         val="$undef"
11103         echo "Nope, it can't."
11104 fi
11105 set d_strctcpy
11106 eval $setvar
11107 $rm -f try.*
11108
11109 : see if strerror and/or sys_errlist[] exist
11110 echo " "
11111 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11112     if set strerror val -f d_strerror; eval $csym; $val; then
11113                 echo 'strerror() found.' >&4
11114                 d_strerror="$define"
11115                 d_strerrm='strerror(e)'
11116                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11117                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11118                         d_syserrlst="$define"
11119                 else
11120                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11121                         d_syserrlst="$undef"
11122                 fi
11123     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11124                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11125                 echo 'strerror() found in string header.' >&4
11126                 d_strerror="$define"
11127                 d_strerrm='strerror(e)'
11128                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11129                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11130                                 d_syserrlst="$define"
11131                 else
11132                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11133                         d_syserrlst="$undef"
11134                 fi
11135     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11136                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11137                 d_strerror="$undef"
11138                 d_syserrlst="$define"
11139                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11140     else
11141                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11142                 d_strerror="$undef"
11143                 d_syserrlst="$undef"
11144                 d_strerrm='"unknown"'
11145     fi
11146 fi
11147
11148 : see if strtod exists
11149 set strtod d_strtod
11150 eval $inlibc
11151
11152 : see if strtol exists
11153 set strtol d_strtol
11154 eval $inlibc
11155
11156 : see if strtold exists
11157 set strtold d_strtold
11158 eval $inlibc
11159
11160 : see if strtoll exists
11161 set strtoll d_strtoll
11162 eval $inlibc
11163
11164 : see if strtoul exists
11165 set strtoul d_strtoul
11166 eval $inlibc
11167
11168 : see if strtoull exists
11169 set strtoull d_strtoull
11170 eval $inlibc
11171
11172 : see if strtouq exists
11173 set strtouq d_strtouq
11174 eval $inlibc
11175
11176 : see if strxfrm exists
11177 set strxfrm d_strxfrm
11178 eval $inlibc
11179
11180 : see if symlink exists
11181 set symlink d_symlink
11182 eval $inlibc
11183
11184 : see if syscall exists
11185 set syscall d_syscall
11186 eval $inlibc
11187
11188 : see if sysconf exists
11189 set sysconf d_sysconf
11190 eval $inlibc
11191
11192 : see if system exists
11193 set system d_system
11194 eval $inlibc
11195
11196 : see if tcgetpgrp exists
11197 set tcgetpgrp d_tcgetpgrp
11198 eval $inlibc
11199
11200 : see if tcsetpgrp exists
11201 set tcsetpgrp d_tcsetpgrp
11202 eval $inlibc
11203
11204 : see if prototype for telldir is available
11205 echo " "
11206 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11207 eval $hasproto
11208
11209 : see if this is a sys/times.h system
11210 set sys/times.h i_systimes
11211 eval $inhdr
11212
11213 : see if times exists
11214 echo " "
11215 if set times val -f d_times; eval $csym; $val; then
11216         echo 'times() found.' >&4
11217         d_times="$define"
11218         inc=''
11219         case "$i_systimes" in
11220         "$define") inc='sys/times.h';;
11221         esac
11222         rp="What is the type returned by times() on this system?"
11223         set clock_t clocktype long stdio.h sys/types.h $inc
11224         eval $typedef_ask
11225 else
11226         echo 'times() NOT found, hope that will do.' >&4
11227         d_times="$undef"
11228         clocktype='int'
11229 fi
11230
11231 : see if truncate exists
11232 set truncate d_truncate
11233 eval $inlibc
11234
11235 : see if tzname[] exists
11236 echo " "
11237 if set tzname val -a d_tzname; eval $csym; $val; then
11238         val="$define"
11239         echo 'tzname[] found.' >&4
11240 else
11241         val="$undef"
11242         echo 'tzname[] NOT found.' >&4
11243 fi
11244 set d_tzname
11245 eval $setvar
11246
11247 : see if umask exists
11248 set umask d_umask
11249 eval $inlibc
11250
11251 : see if ustat exists
11252 set ustat d_ustat
11253 eval $inlibc
11254
11255 : backward compatibility for d_hvfork
11256 if test X$d_hvfork != X; then
11257         d_vfork="$d_hvfork"
11258         d_hvfork=''
11259 fi
11260 : see if there is a vfork
11261 val=''
11262 set vfork val
11263 eval $inlibc
11264
11265 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11266 : perl on Solaris 2.x, and probably elsewhere.
11267 case "$val" in
11268 $define)
11269         echo " "
11270         case "$usevfork" in
11271         false) dflt='n';;
11272         *) dflt='y';;
11273         esac
11274         cat <<'EOM'
11275  
11276 Perl can only use a vfork() that doesn't suffer from strict
11277 restrictions on calling functions or modifying global data in
11278 the child.  For example, glibc-2.1 contains such a vfork()
11279 that is unsuitable.  If your system provides a proper fork()
11280 call, chances are that you do NOT want perl to use vfork().
11281
11282 EOM
11283         rp="Do you still want to use vfork()?"
11284         . ./myread
11285         case "$ans" in
11286         y|Y) ;;
11287         *)
11288                 echo "Ok, we won't use vfork()."
11289                 val="$undef"
11290                 ;;
11291         esac
11292         ;;
11293 esac
11294 set d_vfork
11295 eval $setvar
11296 case "$d_vfork" in
11297 $define) usevfork='true';;
11298 *) usevfork='false';;
11299 esac
11300
11301 : see if this is an sysdir system
11302 set sys/dir.h i_sysdir
11303 eval $inhdr
11304
11305 : see if this is an sysndir system
11306 set sys/ndir.h i_sysndir
11307 eval $inhdr
11308
11309 : see if closedir exists
11310 set closedir d_closedir
11311 eval $inlibc
11312
11313 case "$d_closedir" in
11314 "$define")
11315         echo " "
11316         echo "Checking whether closedir() returns a status..." >&4
11317         cat > closedir.c <<EOM
11318 #$i_dirent I_DIRENT             /**/
11319 #$i_sysdir I_SYS_DIR            /**/
11320 #$i_sysndir I_SYS_NDIR          /**/
11321 #$i_systypes I_SYS_TYPES        /**/
11322
11323 #if defined(I_SYS_TYPES)
11324 #include <sys/types.h>
11325 #endif
11326 #if defined(I_DIRENT)
11327 #include <dirent.h>
11328 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11329 #include <sys/dir.h>
11330 #endif
11331 #else
11332 #ifdef I_SYS_NDIR
11333 #include <sys/ndir.h>
11334 #else
11335 #ifdef I_SYS_DIR
11336 #ifdef hp9000s500
11337 #include <ndir.h>       /* may be wrong in the future */
11338 #else
11339 #include <sys/dir.h>
11340 #endif
11341 #endif
11342 #endif
11343 #endif 
11344 int main() { return closedir(opendir(".")); }
11345 EOM
11346         set closedir
11347         if eval $compile_ok; then
11348                 if ./closedir > /dev/null 2>&1 ; then
11349                         echo "Yes, it does."
11350                         val="$undef"
11351                 else
11352                         echo "No, it doesn't."
11353                         val="$define"
11354                 fi
11355         else
11356                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11357                 val="$define"
11358         fi
11359         ;;
11360 *)
11361         val="$undef";
11362         ;;
11363 esac
11364 set d_void_closedir
11365 eval $setvar
11366 $rm -f closedir*
11367 : check for volatile keyword
11368 echo " "
11369 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11370 $cat >try.c <<'EOCP'
11371 int main()
11372 {
11373         typedef struct _goo_struct goo_struct;
11374         goo_struct * volatile goo = ((goo_struct *)0);
11375         struct _goo_struct {
11376                 long long_int;
11377                 int reg_int;
11378                 char char_var;
11379         };
11380         typedef unsigned short foo_t;
11381         char *volatile foo;
11382         volatile int bar;
11383         volatile foo_t blech;
11384         foo = foo;
11385 }
11386 EOCP
11387 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11388         val="$define"
11389         echo "Yup, it does."
11390 else
11391         val="$undef"
11392         echo "Nope, it doesn't."
11393 fi
11394 set d_volatile
11395 eval $setvar
11396 $rm -f try.*
11397
11398 : see if there is a wait4
11399 set wait4 d_wait4
11400 eval $inlibc
11401
11402 : see if waitpid exists
11403 set waitpid d_waitpid
11404 eval $inlibc
11405
11406 : see if wcstombs exists
11407 set wcstombs d_wcstombs
11408 eval $inlibc
11409
11410 : see if wctomb exists
11411 set wctomb d_wctomb
11412 eval $inlibc
11413
11414 : preserve RCS keywords in files with variable substitution, grrr
11415 Date='$Date'
11416 Id='$Id'
11417 Log='$Log'
11418 RCSfile='$RCSfile'
11419 Revision='$Revision'
11420
11421 case "$crosscompile" in
11422 ''|[nN]*) crosscompile="$undef" ;;
11423 esac
11424
11425 case "$osname" in
11426 next|rhapsody) multiarch="$define" ;;
11427 esac
11428 case "$multiarch" in
11429 ''|[nN]*) multiarch="$undef" ;;
11430 esac
11431
11432 : check for alignment requirements
11433 echo " "
11434 case "$crosscompile$multiarch" in
11435 *$define*)
11436         $cat <<EOM
11437 You seem to be either cross-compiling or doing a multiarchitecture build,
11438 skipping the memory alignment check.
11439
11440 EOM
11441         case "$alignbytes" in
11442         '') alignbytes=8 ;;
11443         esac
11444         ;;
11445 *)
11446         case "$alignbytes" in
11447         '') echo "Checking alignment constraints..." >&4
11448                 $cat >try.c <<'EOCP'
11449 #include <stdio.h>
11450 struct foobar {
11451         char foo;
11452         double bar;
11453 } try_algn;
11454 int main()
11455 {
11456     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11457     return(0);
11458 }
11459 EOCP
11460                 set try
11461                 if eval $compile_ok; then
11462                         dflt=`./try`
11463                 else
11464                         dflt='8'
11465                         echo "(I can't seem to compile the test program...)"
11466                 fi
11467                 ;;
11468         *) dflt="$alignbytes"
11469                 ;;
11470         esac
11471         rp="Doubles must be aligned on a how-many-byte boundary?"
11472         . ./myread
11473         alignbytes="$ans"
11474         $rm -f try.c try
11475         ;;
11476 esac
11477
11478
11479 : check for ordering of bytes in a long
11480 echo " "
11481 case "$crosscompile$multiarch" in
11482 *$define*)
11483         $cat <<EOM
11484 You seem to be either cross-compiling or doing a multiarchitecture build,
11485 skipping the byteorder check.
11486
11487 EOM
11488         byteorder='0xffff'
11489         ;;
11490 *)
11491         case "$byteorder" in
11492         '')
11493                 $cat <<'EOM'
11494 In the following, larger digits indicate more significance.  A big-endian
11495 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11496 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11497 machines may have weird orders like 3412.  A Cray will report 87654321,
11498 an Alpha will report 12345678. If the test program works the default is
11499 probably right.
11500 I'm now running the test program...
11501 EOM
11502                 $cat >try.c <<'EOCP'
11503 #include <stdio.h>
11504 int main()
11505 {
11506         int i;
11507         union {
11508                 unsigned long l;
11509                 char c[sizeof(long)];
11510         } u;
11511
11512         if (sizeof(long) > 4)
11513                 u.l = (0x08070605L << 32) | 0x04030201L;
11514         else
11515                 u.l = 0x04030201L;
11516         for (i = 0; i < sizeof(long); i++)
11517                 printf("%c", u.c[i]+'0');
11518         printf("\n");
11519         exit(0);
11520 }
11521 EOCP
11522                 xxx_prompt=y
11523                 set try
11524                 if eval $compile && ./try > /dev/null; then
11525                         dflt=`./try`
11526                         case "$dflt" in
11527                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11528                                 echo "(The test program ran ok.)"
11529                                 echo "byteorder=$dflt"
11530                                 xxx_prompt=n
11531                         ;;
11532                         ????|????????) echo "(The test program ran ok.)" ;;
11533                         *) echo "(The test program didn't run right for some reason.)" ;;
11534                         esac
11535                 else
11536                         dflt='4321'
11537                         cat <<'EOM'
11538 (I can't seem to compile the test program.  Guessing big-endian...)
11539 EOM
11540                 fi
11541                 case "$xxx_prompt" in
11542                 y)
11543                         rp="What is the order of bytes in a long?"
11544                         . ./myread
11545                         byteorder="$ans"
11546                         ;;
11547                 *)      byteorder=$dflt
11548                         ;;
11549                 esac
11550                 ;;
11551         esac
11552         $rm -f try.c try
11553         ;;
11554 esac
11555
11556
11557 : how do we catenate cpp tokens here?
11558 echo " "
11559 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11560 $cat >cpp_stuff.c <<'EOCP'
11561 #define RCAT(a,b)a/**/b
11562 #define ACAT(a,b)a ## b
11563 RCAT(Rei,ser)
11564 ACAT(Cir,cus)
11565 EOCP
11566 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11567 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11568         echo "Oh!  Smells like ANSI's been here." >&4
11569         echo "We can catify or stringify, separately or together!"
11570         cpp_stuff=42
11571 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11572         echo "Ah, yes!  The good old days!" >&4
11573         echo "However, in the good old days we don't know how to stringify and"
11574         echo "catify at the same time."
11575         cpp_stuff=1
11576 else
11577         $cat >&4 <<EOM
11578 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11579 to have to edit the values of CAT[2-5] in config.h...
11580 EOM
11581         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11582 fi
11583 $rm -f cpp_stuff.*
11584
11585 : see if this is a db.h system
11586 set db.h i_db
11587 eval $inhdr
11588
11589 case "$i_db" in
11590 $define)
11591         : Check db version.
11592         echo " "
11593         echo "Checking Berkeley DB version ..." >&4
11594         $cat >try.c <<EOCP
11595 #$d_const HASCONST
11596 #ifndef HASCONST
11597 #define const
11598 #endif
11599 #include <sys/types.h>
11600 #include <stdio.h>
11601 #include <db.h>
11602 int main()
11603 {
11604 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11605     int Major, Minor, Patch ;
11606     unsigned long Version ;
11607     (void)db_version(&Major, &Minor, &Patch) ;
11608     printf("You have Berkeley DB Version 2 or greater\n");
11609
11610     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11611                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11612     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11613                 Major, Minor, Patch) ;
11614
11615     /* check that db.h & libdb are compatible */
11616     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11617         printf("db.h and libdb are incompatible\n") ;
11618         exit(3);        
11619     }
11620
11621     printf("db.h and libdb are compatible\n") ;
11622
11623     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11624                 + DB_VERSION_PATCH ;
11625
11626     /* needs to be >= 2.3.4 */
11627     if (Version < 2003004) {
11628     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11629         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11630         exit(2);        
11631     }
11632
11633     exit(0);
11634 #else
11635 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11636     printf("You have Berkeley DB Version 1\n");
11637     exit(0);    /* DB version < 2: the coast is clear. */
11638 #else
11639     exit(1);    /* <db.h> not Berkeley DB? */
11640 #endif
11641 #endif
11642 }
11643 EOCP
11644         set try
11645         if eval $compile_ok && ./try; then
11646                 echo 'Looks OK.' >&4
11647         else
11648                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11649                 i_db=$undef
11650                 case " $libs " in
11651                 *"-ldb "*)
11652                         : Remove db from list of libraries to use
11653                         echo "Removing unusable -ldb from library list" >&4
11654                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11655                         shift
11656                         libs="$*"
11657                         echo "libs = $libs" >&4
11658                         ;;
11659                 esac
11660         fi
11661         $rm -f try.*
11662         ;;
11663 esac
11664
11665 case "$i_db" in
11666 define)
11667         : Check the return type needed for hash 
11668         echo " "
11669         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11670         $cat >try.c <<EOCP
11671 #$d_const HASCONST
11672 #ifndef HASCONST
11673 #define const
11674 #endif
11675 #include <sys/types.h>
11676 #include <db.h>
11677
11678 #ifndef DB_VERSION_MAJOR
11679 u_int32_t hash_cb (ptr, size)
11680 const void *ptr;
11681 size_t size;
11682 {
11683 }
11684 HASHINFO info;
11685 int main()
11686 {
11687         info.hash = hash_cb;
11688 }
11689 #endif
11690 EOCP
11691         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11692                 if $contains warning try.out >>/dev/null 2>&1 ; then
11693                         db_hashtype='int'
11694                 else
11695                         db_hashtype='u_int32_t'
11696                 fi
11697         else
11698                 : XXX Maybe we should just give up here.
11699                 db_hashtype=u_int32_t
11700                 $cat try.out >&4
11701                 echo "Help:  I can't seem to compile the db test program." >&4
11702                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11703         fi
11704         $rm -f try.*
11705         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11706         ;;
11707 *)      db_hashtype=u_int32_t
11708         ;;
11709 esac
11710 case "$i_db" in
11711 define)
11712         : Check the return type needed for prefix 
11713         echo " "
11714         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11715         cat >try.c <<EOCP
11716 #$d_const HASCONST
11717 #ifndef HASCONST
11718 #define const
11719 #endif
11720 #include <sys/types.h>
11721 #include <db.h>
11722
11723 #ifndef DB_VERSION_MAJOR
11724 size_t prefix_cb (key1, key2)
11725 const DBT *key1;
11726 const DBT *key2;
11727 {
11728 }
11729 BTREEINFO info;
11730 int main()
11731 {
11732         info.prefix = prefix_cb;
11733 }
11734 #endif
11735 EOCP
11736         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11737                 if $contains warning try.out >>/dev/null 2>&1 ; then
11738                         db_prefixtype='int'
11739                 else
11740                         db_prefixtype='size_t'
11741                 fi
11742         else
11743                 db_prefixtype='size_t'
11744                 : XXX Maybe we should just give up here.
11745                 $cat try.out >&4
11746                 echo "Help:  I can't seem to compile the db test program." >&4
11747                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11748         fi
11749         $rm -f try.*
11750         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11751         ;;
11752 *)      db_prefixtype='size_t'
11753         ;;
11754 esac
11755
11756 : check for void type
11757 echo " "
11758 echo "Checking to see how well your C compiler groks the void type..." >&4
11759 case "$voidflags" in
11760 '')
11761         $cat >try.c <<'EOCP'
11762 #if TRY & 1
11763 void sub() {
11764 #else
11765 sub() {
11766 #endif
11767         extern void moo();      /* function returning void */
11768         void (*goo)();          /* ptr to func returning void */
11769 #if TRY & 8
11770         void *hue;              /* generic ptr */
11771 #endif
11772 #if TRY & 2
11773         void (*foo[10])();
11774 #endif
11775
11776 #if TRY & 4
11777         if(goo == moo) {
11778                 exit(0);
11779         }
11780 #endif
11781         exit(0);
11782 }
11783 int main() { sub(); }
11784 EOCP
11785         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11786                 voidflags=$defvoidused
11787         echo "Good.  It appears to support void to the level $package wants.">&4
11788                 if $contains warning .out >/dev/null 2>&1; then
11789                         echo "However, you might get some warnings that look like this:"
11790                         $cat .out
11791                 fi
11792         else
11793 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11794                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11795                         echo "It supports 1..."
11796                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11797                                 echo "It also supports 2..."
11798                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11799                                         voidflags=7
11800                                         echo "And it supports 4 but not 8 definitely."
11801                                 else
11802                                         echo "It doesn't support 4..."
11803                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11804                                                 voidflags=11
11805                                                 echo "But it supports 8."
11806                                         else
11807                                                 voidflags=3
11808                                                 echo "Neither does it support 8."
11809                                         fi
11810                                 fi
11811                         else
11812                                 echo "It does not support 2..."
11813                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11814                                         voidflags=13
11815                                         echo "But it supports 4 and 8."
11816                                 else
11817                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11818                                                 voidflags=5
11819                                                 echo "And it supports 4 but has not heard about 8."
11820                                         else
11821                                                 echo "However it supports 8 but not 4."
11822                                         fi
11823                                 fi
11824                         fi
11825                 else
11826                         echo "There is no support at all for void."
11827                         voidflags=0
11828                 fi
11829         fi
11830 esac
11831 case "$voidflags" in
11832 "$defvoidused") ;;
11833 *)      $cat >&4 <<'EOM'
11834   Support flag bits are:
11835     1: basic void declarations.
11836     2: arrays of pointers to functions returning void.
11837     4: operations between pointers to and addresses of void functions.
11838     8: generic void pointers.
11839 EOM
11840         dflt="$voidflags";
11841         rp="Your void support flags add up to what?"
11842         . ./myread
11843         voidflags="$ans"
11844         ;;
11845 esac
11846 $rm -f try.* .out
11847
11848
11849 : How can we generate normalized random numbers ?
11850 echo " "
11851 echo "Looking for a random number function..." >&4
11852 case "$randfunc" in
11853 '')
11854         if set drand48 val -f; eval $csym; $val; then
11855                 dflt="drand48"
11856                 echo "Good, found drand48()." >&4
11857         elif set random val -f; eval $csym; $val; then
11858                 dflt="random"
11859                 echo "OK, found random()." >&4
11860         else
11861                 dflt="rand"
11862                 echo "Yick, looks like I have to use rand()." >&4
11863         fi
11864         echo " "
11865         ;;
11866 *)
11867         dflt="$randfunc"
11868         ;;
11869 esac
11870 cont=true
11871
11872 case "$ccflags" in
11873 *-Dmy_rand=*|*-Dmy_srand=*)
11874         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11875         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11876         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11877         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11878         ;;
11879 esac
11880
11881 while $test "$cont"; do
11882         rp="Use which function to generate random numbers?"
11883         . ./myread
11884         if $test "$ans" = "$dflt"; then
11885                 : null
11886         else
11887                 randbits=''
11888         fi
11889         randfunc="$ans"
11890         if set $ans val -f; eval $csym; $val; then
11891                 cont=''
11892         else
11893                 dflt=y
11894                 rp="I cannot find function $ans. Use that name anyway?"
11895                 . ./myread
11896                 dflt=rand
11897                 case "$ans" in
11898                         [yY]*) cont='';;
11899                 esac
11900         fi
11901         case "$cont" in
11902         '')
11903                 case "$randfunc" in
11904                 drand48)
11905                         drand01="drand48()"
11906                         seedfunc="srand48"
11907                         randbits=48
11908                         randseedtype=long
11909                         ;;
11910                 rand|random)
11911                         case "$randbits" in
11912                         '')
11913 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11914                                 $cat >try.c <<EOCP
11915 #$i_unistd I_UNISTD
11916 #$i_stdlib I_STDLIB
11917 #include <stdio.h>
11918 #ifdef I_UNISTD
11919 #  include <unistd.h>
11920 #endif
11921 #ifdef I_STDLIB
11922 #  include <stdlib.h>
11923 #endif
11924 int main()
11925 {
11926         register int i;
11927         register unsigned long tmp;
11928         register unsigned long max = 0L;
11929
11930         for (i = 1000; i; i--) {
11931                 tmp = (unsigned long) $randfunc();
11932                 if (tmp > max) max = tmp;
11933         }
11934         for (i = 0; max; i++)
11935                 max /= 2;
11936         printf("%d\n",i);
11937 }
11938 EOCP
11939                                 set try
11940                                 if eval $compile_ok; then
11941                                         dflt=`try`
11942                                 else
11943                                         dflt='?'
11944                                         echo "(I can't seem to compile the test program...)"
11945                                 fi
11946                                 ;;
11947                         *)
11948                                 dflt="$randbits"
11949                                 ;;
11950                         esac
11951                         rp="How many bits does your $randfunc() function produce?"
11952                         . ./myread
11953                         randbits="$ans"
11954                         $rm -f try.c try
11955                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11956                         seedfunc="s$randfunc"
11957                         randseedtype=unsigned
11958                         ;;
11959                 *)
11960                         dflt="31"
11961                         rp="How many bits does your $randfunc() function produce?"
11962                         . ./myread
11963                         randbits="$ans"
11964                         seedfunc="s$randfunc"
11965                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11966                         if set $seedfunc val -f; eval $csym; $val; then
11967                                 echo "(Using $seedfunc() to seed random generator)"
11968                         else
11969                                 echo "(Warning: no $seedfunc() to seed random generator)"
11970                                 seedfunc=rand
11971                         fi
11972                         randseedtype=unsigned
11973                         ;;
11974                 esac
11975                 ;;
11976         esac
11977 done
11978
11979 echo " "
11980 echo "Determining whether or not we are on an EBCDIC system..." >&4
11981 $cat >tebcdic.c <<'EOM'
11982 int main()
11983 {
11984   if ('M'==0xd4) return 0;
11985   return 1;
11986 }
11987 EOM
11988
11989 val=$undef
11990 set tebcdic
11991 if eval $compile_ok; then
11992         if ./tebcdic; then
11993                 echo "You have EBCDIC." >&4
11994                 val="$define"
11995         else
11996                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11997         fi
11998 else
11999         echo "I'm unable to compile the test program." >&4
12000         echo "I'll assume ASCII or some ISO Latin." >&4
12001 fi
12002 $rm -f tebcdic.c tebcdic
12003 set ebcdic
12004 eval $setvar
12005
12006 echo " "
12007 $cat >&4 <<EOM
12008 Checking how to flush all pending stdio output...
12009 EOM
12010 # I only know how to find the first 32 possibly open files on SunOS.
12011 # See also hints/sunos_4_1.sh and util.c  --AD
12012 case "$osname" in
12013 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12014 esac
12015 $cat >>try.c <<EOCP
12016 #include <stdio.h>
12017 #$i_unistd I_UNISTD
12018 #ifdef I_UNISTD
12019 # include <unistd.h>
12020 #endif
12021 #$d_sysconf HAS_SYSCONF
12022 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12023 #ifdef HAS_STDIO_STREAM_ARRAY
12024 # define STDIO_STREAM_ARRAY $stdio_stream_array
12025 #endif
12026 int main() {
12027   FILE* p = fopen("try.out", "w");
12028 #ifdef TRY_FPUTC
12029   fputc('x', p);
12030 #else
12031 # ifdef TRY_FPRINTF
12032   fprintf(p, "x");
12033 # endif
12034 #endif
12035 #ifdef TRY_FFLUSH_NULL
12036   fflush(NULL);
12037 #endif
12038 #ifdef TRY_FFLUSH_ALL
12039   {
12040     long open_max = -1;
12041 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12042     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12043 # else
12044 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12045     open_max = sysconf(_SC_OPEN_MAX);
12046 #  else
12047 #   ifdef FOPEN_MAX
12048     open_max = FOPEN_MAX;
12049 #   else
12050 #    ifdef OPEN_MAX
12051     open_max = OPEN_MAX;
12052 #    else
12053 #     ifdef _NFILE
12054     open_max = _NFILE;
12055 #     endif
12056 #    endif
12057 #   endif
12058 #  endif
12059 # endif 
12060 # ifdef HAS_STDIO_STREAM_ARRAY
12061     if (open_max > 0) {
12062       long i;
12063       for (i = 0; i < open_max; i++)
12064             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12065                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12066                 STDIO_STREAM_ARRAY[i]._flag)
12067                 fflush(&STDIO_STREAM_ARRAY[i]);
12068     }   
12069   }
12070 # endif
12071 #endif
12072   _exit(42);
12073 }
12074 EOCP
12075 : first we have to find out how _not_ to flush
12076 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12077     output=''
12078     set try -DTRY_FPUTC
12079     if eval $compile; then
12080             $rm -f try.out
12081             ./try$exe_ext 2>/dev/null
12082             if $test ! -s try.out -a "X$?" = X42; then
12083                 output=-DTRY_FPUTC
12084             fi
12085     fi
12086     case "$output" in
12087     '')
12088             set try -DTRY_FPRINTF
12089             $rm -f try.out
12090             if eval $compile; then
12091                     $rm -f try.out
12092                     ./try$exe_ext 2>/dev/null
12093                     if $test ! -s try.out -a "X$?" = X42; then
12094                         output=-DTRY_FPRINTF
12095                     fi
12096             fi
12097         ;;
12098     esac
12099 fi
12100 : check for fflush NULL behaviour
12101 case "$fflushNULL" in
12102 '')     set try -DTRY_FFLUSH_NULL $output
12103         if eval $compile; then
12104                 $rm -f try.out
12105                 ./try$exe_ext 2>/dev/null
12106                 code="$?"
12107                 if $test -s try.out -a "X$code" = X42; then
12108                         fflushNULL="`$cat try.out`"
12109                 else
12110                         if $test "X$code" != X42; then
12111                                 $cat >&4 <<EOM
12112 (If this test failed, don't worry, we'll try another method shortly.)
12113 EOM
12114                         fi
12115                 fi
12116         fi
12117         $rm -f core try.core core.try.*
12118         case "$fflushNULL" in
12119         x)      $cat >&4 <<EOM
12120 Your fflush(NULL) works okay.
12121 EOM
12122                 fflushNULL="$define"
12123                 ;;
12124         '')     $cat >&4 <<EOM
12125 Your fflush(NULL) isn't working (contrary to ANSI C).
12126 EOM
12127                 fflushNULL="$undef"
12128                 ;;
12129         *)      $cat >&4 <<EOM
12130 Cannot figure out whether your fflush(NULL) works or not.
12131 I'm assuming it doesn't (contrary to ANSI C).
12132 EOM
12133                 fflushNULL="$undef"
12134                 ;;
12135         esac
12136         ;;
12137 $define|true|[yY]*)
12138         fflushNULL="$define"
12139         ;;
12140 *)
12141         fflushNULL="$undef"
12142         ;;
12143 esac
12144 : check explicit looping only if NULL did not work
12145 case "$fflushNULL" in
12146 "$undef")
12147         : check for fflush all behaviour
12148         case "$fflushall" in
12149         '')     set try -DTRY_FFLUSH_ALL $output
12150                 if eval $compile; then
12151                         $cat >&4 <<EOM
12152 (Now testing the other method--but note that also this may fail.)
12153 EOM
12154                         $rm -f try.out
12155                         ./try$exe_ext 2>/dev/null
12156                         if $test -s try.out -a "X$?" = X42; then
12157                                 fflushall="`$cat try.out`"
12158                         fi
12159                 fi
12160                 $rm -f core try.core core.try.*
12161                 case "$fflushall" in
12162                 x)      $cat >&4 <<EOM
12163 Whew. Flushing explicitly all the stdio streams works.
12164 EOM
12165                         fflushall="$define"
12166                         ;;
12167                 '')     $cat >&4 <<EOM
12168 Sigh. Flushing explicitly all the stdio streams doesn't work.
12169 EOM
12170                         fflushall="$undef"
12171                         ;;
12172                 *)      $cat >&4 <<EOM
12173 Cannot figure out whether flushing stdio streams explicitly works or not.
12174 I'm assuming it doesn't.
12175 EOM
12176                         fflushall="$undef"
12177                         ;;
12178                 esac
12179                 ;;
12180         "$define"|true|[yY]*)
12181                 fflushall="$define"
12182                 ;;
12183         *)
12184                 fflushall="$undef"
12185                 ;;
12186         esac
12187         ;;
12188 *)      fflushall="$undef"      
12189         ;;
12190 esac
12191 case "$fflushNULL$fflushall" in
12192 undefundef)
12193         $cat <<EOM
12194 I cannot figure out how to flush pending stdio output.
12195 EOM
12196         ;;
12197 esac
12198 $rm -f try.* try$exe_ext
12199
12200 : Store the full pathname to the ar program for use in the C program
12201 : Respect a hint or command line value for full_ar.
12202 case "$full_ar" in
12203 '') full_ar=$ar ;;
12204 esac
12205
12206 : Store the full pathname to the sed program for use in the C program
12207 full_sed=$sed
12208
12209 : see what type gids are declared as in the kernel
12210 echo " "
12211 echo "Looking for the type for group ids returned by getgid()."
12212 set gid_t gidtype xxx stdio.h sys/types.h
12213 eval $typedef
12214 case "$gidtype" in
12215 xxx)
12216         xxx=`./findhdr sys/user.h`
12217         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12218         case $1 in
12219         unsigned) dflt="$1 $2" ;;
12220         *) dflt="$1" ;;
12221         esac
12222         ;;
12223 *) dflt="$gidtype";;
12224 esac
12225 case "$gidtype" in
12226 gid_t) echo "gid_t found." ;;
12227 *)      rp="What is the type for group ids returned by getgid()?"
12228         . ./myread
12229         gidtype="$ans"
12230         ;;
12231 esac
12232
12233 echo " "
12234 case "$gidtype" in
12235 *_t) zzz="$gidtype"     ;;
12236 *)   zzz="gid"          ;;
12237 esac
12238 echo "Checking the size of $zzz..." >&4 
12239 cat > try.c <<EOCP
12240 #include <sys/types.h>
12241 #include <stdio.h>
12242 int main() {
12243     printf("%d\n", (int)sizeof($gidtype));
12244     exit(0);
12245 }
12246 EOCP
12247 set try
12248 if eval $compile_ok; then
12249         yyy=`./try`
12250         case "$yyy" in
12251         '')     gidsize=4
12252                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12253                 ;;
12254         *)      gidsize=$yyy
12255                 echo "Your $zzz size is $gidsize bytes."
12256                 ;;
12257         esac
12258 else
12259         gidsize=4
12260         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12261 fi
12262
12263
12264 echo " "
12265 case "$gidtype" in
12266 *_t) zzz="$gidtype"     ;;
12267 *)   zzz="gid"          ;;
12268 esac
12269 echo "Checking the sign of $zzz..." >&4 
12270 cat > try.c <<EOCP
12271 #include <sys/types.h>
12272 #include <stdio.h>
12273 int main() {
12274         $gidtype foo = -1;
12275         if (foo < 0)
12276                 printf("-1\n");
12277         else
12278                 printf("1\n");
12279 }
12280 EOCP
12281 set try
12282 if eval $compile; then
12283         yyy=`./try`
12284         case "$yyy" in
12285         '')     gidsign=1
12286                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12287                 ;;
12288         *)      gidsign=$yyy
12289                 case "$gidsign" in
12290                  1) echo "Your $zzz is unsigned." ;;
12291                 -1) echo "Your $zzz is signed."   ;;
12292                 esac
12293                 ;;
12294         esac
12295 else
12296         gidsign=1
12297         echo "(I can't compile the test program--guessing unsigned.)" >&4
12298 fi
12299
12300
12301 echo " "
12302
12303 if $test X"$quadtype" != X; then
12304
12305 echo "Checking how to print 64-bit integers..." >&4
12306
12307 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12308         $cat >try.c <<'EOCP'
12309 #include <sys/types.h>
12310 #include <stdio.h>
12311 int main() {
12312   int q = 12345678901;
12313   printf("%ld\n", q);
12314 }
12315 EOCP
12316         set try
12317         if eval $compile; then
12318                 yyy=`./try$exe_ext`
12319                 case "$yyy" in
12320                 12345678901)
12321                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12322                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12323                         echo "We will use %d."
12324                         ;;
12325                 esac
12326         fi
12327 fi
12328
12329 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12330         $cat >try.c <<'EOCP'
12331 #include <sys/types.h>
12332 #include <stdio.h>
12333 int main() {
12334   long q = 12345678901;
12335   printf("%ld\n", q);
12336 }
12337 EOCP
12338         set try
12339         if eval $compile; then
12340                 yyy=`./try$exe_ext`
12341                 case "$yyy" in
12342                 12345678901)
12343                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12344                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12345                         echo "We will use %ld."
12346                         ;;
12347                 esac
12348         fi
12349 fi
12350
12351 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12352         $cat >try.c <<'EOCP'
12353 #include <sys/types.h>
12354 #include <inttypes.h>
12355 #include <stdio.h>
12356 int main() {
12357   int64_t q = 12345678901;
12358   printf("%" PRId64 "\n", q);
12359 }
12360 EOCP
12361         set try
12362         if eval $compile; then
12363                 yyy=`./try$exe_ext`
12364                 case "$yyy" in
12365                 12345678901)
12366                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12367                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12368                         echo "We will use the C9X style."
12369                         ;;
12370                 esac
12371         fi
12372 fi
12373
12374 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12375         $cat >try.c <<'EOCP'
12376 #include <sys/types.h>
12377 #include <stdio.h>
12378 int main() {
12379   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12380   printf("%lld\n", q);
12381 }
12382 EOCP
12383         set try
12384         if eval $compile; then
12385                 yyy=`./try$exe_ext`
12386                 case "$yyy" in
12387                 12345678901)
12388                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12389                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12390                         echo "We will use the %lld style."
12391                         ;;
12392                 esac
12393         fi
12394 fi
12395
12396 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12397         $cat >try.c <<EOCP
12398 #include <sys/types.h>
12399 #include <stdio.h>
12400 int main() {
12401   $quadtype q = 12345678901;
12402   printf("%Ld\n", q);
12403 }
12404 EOCP
12405         set try
12406         if eval $compile; then
12407                 yyy=`./try$exe_ext`
12408                 case "$yyy" in
12409                 12345678901)
12410                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12411                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12412                         echo "We will use %Ld."
12413                         ;;
12414                 esac
12415         fi
12416 fi
12417
12418 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12419         $cat >try.c <<EOCP
12420 #include <sys/types.h>
12421 #include <stdio.h>
12422 int main() {
12423   $quadtype q = 12345678901;
12424   printf("%qd\n", q);
12425 }
12426 EOCP
12427         set try
12428         if eval $compile; then
12429                 yyy=`./try$exe_ext`
12430                 case "$yyy" in
12431                 12345678901)
12432                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12433                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12434                         echo "We will use %qd."
12435                         ;;
12436                 esac
12437         fi
12438 fi
12439
12440 if $test X"$sPRId64" = X; then
12441         echo "Cannot figure out how to print 64-bit integers." >&4
12442 fi
12443
12444 $rm -f try try.*
12445
12446 fi
12447
12448 case "$sPRId64" in
12449 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12450         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12451         ;;
12452 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12453         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12454         ;;
12455 esac
12456
12457
12458 echo " "
12459 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12460
12461 if $test X"$ivsize" = X8; then
12462         ivdformat="$sPRId64"
12463         uvuformat="$sPRIu64"
12464         uvoformat="$sPRIo64"
12465         uvxformat="$sPRIx64"
12466 else
12467         if $test X"$ivsize" = X"$longsize"; then
12468                 ivdformat='"ld"'
12469                 uvuformat='"lu"'
12470                 uvoformat='"lo"'
12471                 uvxformat='"lx"'
12472         else
12473                 if $test X"$ivsize" = X"$intsize"; then
12474                         ivdformat='"d"'
12475                         uvuformat='"u"'
12476                         uvoformat='"o"'
12477                         uvxformat='"x"'
12478                 else
12479                         : far out
12480                         if $test X"$ivsize" = X"$shortsize"; then
12481                                 ivdformat='"hd"'
12482                                 uvuformat='"hu"'
12483                                 uvoformat='"ho"'
12484                                 uvxformat='"hx"'
12485                         fi
12486                 fi
12487         fi
12488 fi
12489
12490 case "$ivdformat" in
12491 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12492     exit 1
12493     ;;
12494 esac
12495
12496
12497 echo " "
12498 $echo "Checking the format string to be used for gids..." >&4
12499
12500 case "$gidsign" in
12501 -1)     if $test X"$gidsize" = X"$ivsize"; then
12502                 gidformat="$ivdformat"
12503         else
12504                 if $test X"$gidsize" = X"$longsize"; then
12505                         gidformat='"ld"'
12506                 else
12507                         if $test X"$gidsize" = X"$intsize"; then
12508                                 gidformat='"d"'
12509                         else
12510                                 if $test X"$gidsize" = X"$shortsize"; then
12511                                         gidformat='"hd"'
12512                                 fi
12513                         fi
12514                 fi
12515         fi
12516         ;;
12517 *)      if $test X"$gidsize" = X"$uvsize"; then
12518                 gidformat="$uvuformat"
12519         else
12520                 if $test X"$gidsize" = X"$longsize"; then
12521                         gidformat='"lu"'
12522                 else
12523                         if $test X"$gidsize" = X"$intsize"; then
12524                                 gidformat='"u"'
12525                         else
12526                                 if $test X"$gidsize" = X"$shortsize"; then
12527                                         gidformat='"hu"'
12528                                 fi
12529                         fi
12530                 fi
12531         fi
12532         ;;
12533 esac
12534
12535 : see if getgroups exists
12536 set getgroups d_getgrps
12537 eval $inlibc
12538
12539 : see if setgroups exists
12540 set setgroups d_setgrps
12541 eval $inlibc
12542
12543
12544 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12545 echo " "
12546 case "$d_getgrps$d_setgrps" in
12547 *define*)
12548         case "$groupstype" in
12549         '') dflt="$gidtype" ;;
12550         *)  dflt="$groupstype" ;;
12551         esac
12552         $cat <<EOM
12553 What type of pointer is the second argument to getgroups() and setgroups()?
12554 Usually this is the same as group ids, $gidtype, but not always.
12555
12556 EOM
12557         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12558         . ./myread
12559         groupstype="$ans"
12560         ;;
12561 *)  groupstype="$gidtype";;
12562 esac
12563
12564 echo " "
12565 echo "Checking if your $make program sets \$(MAKE)..." >&4
12566 case "$make_set_make" in
12567 '')
12568         $sed 's/^X //' > testmake.mak << 'EOF'
12569 Xall:
12570 X       @echo 'maketemp="$(MAKE)"'
12571 EOF
12572         case "`$make -f testmake.mak 2>/dev/null`" in
12573         *maketemp=*) make_set_make='#' ;;
12574         *)      make_set_make="MAKE=$make" ;;
12575         esac
12576         $rm -f testmake.mak
12577         ;;
12578 esac
12579 case "$make_set_make" in
12580 '#') echo "Yup, it does.";;
12581 *) echo "Nope, it doesn't.";;
12582 esac
12583
12584 : see what type is used for mode_t
12585 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12586 set mode_t modetype int stdio.h sys/types.h
12587 eval $typedef_ask
12588
12589 : define a fucntion to check prototypes
12590 $cat > protochk <<EOSH
12591 $startsh
12592 cc="$cc"
12593 optimize="$optimize"
12594 ccflags="$ccflags"
12595 prototype="$prototype"
12596 define="$define"
12597 rm=$rm
12598 EOSH
12599
12600 $cat >> protochk <<'EOSH'
12601
12602 $rm -f try.c
12603 foo="$1"
12604 shift
12605 while test $# -ge 2; do
12606         case "$1" in
12607                 $define) echo "#include <$2>" >> try.c ;;
12608                 literal) echo "$2" >> try.c ;;
12609         esac
12610     shift 2
12611 done
12612 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12613 cat >> try.c <<'EOCP'
12614 #ifdef CAN_PROTOTYPE
12615 #define _(args) args
12616 #else
12617 #define _(args) ()
12618 #endif
12619 EOCP
12620 echo "$foo" >> try.c
12621 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12622 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12623 status=$?
12624 $rm -f try.[co]
12625 exit $status
12626 EOSH
12627 chmod +x protochk
12628 $eunicefix protochk
12629
12630 : see what type is used for size_t
12631 rp="What is the type used for the length parameter for string functions?"
12632 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12633 eval $typedef_ask
12634
12635 : check for type of arguments to gethostbyaddr. 
12636 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12637         case "$d_gethbyaddr" in
12638         $define)
12639                 $cat <<EOM
12640
12641 Checking to see what type of arguments are accepted by gethostbyaddr().
12642 EOM
12643                 hdrs="$define sys/types.h
12644                         $d_socket sys/socket.h 
12645                         $i_niin netinet/in.h 
12646                         $i_netdb netdb.h
12647                         $i_unistd unistd.h"
12648                 : The first arg can 'char *' or 'void *'
12649                 : The second arg is some of integral type
12650                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12651                         for yyy in size_t long int; do
12652                                 case "$netdb_host_type" in
12653                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12654                                         if ./protochk "$try" $hdrs; then
12655                                                 echo "Your system accepts $xxx for the first arg."
12656                                                 echo "...and $yyy for the second arg."
12657                                                 netdb_host_type="$xxx"
12658                                                 netdb_hlen_type="$yyy"
12659                                         fi
12660                                         ;;
12661                                 esac
12662                         done
12663                 done
12664                 : In case none of those worked, prompt the user.
12665                 case "$netdb_host_type" in
12666                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12667                         dflt='char *'
12668                         . ./myread
12669                         netdb_host_type=$ans
12670                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12671                         dflt="$sizetype"
12672                         . ./myread
12673                         netdb_hlen_type=$ans
12674                         ;;
12675                 esac
12676                 ;;
12677         *)      : no gethostbyaddr, so pick harmless defaults
12678                 netdb_host_type='char *'
12679                 netdb_hlen_type="$sizetype"
12680                 ;;
12681         esac
12682         # Remove the "const" if needed. -- but then we'll have a 
12683         # prototype clash!
12684         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12685 fi
12686
12687 : check for type of argument to gethostbyname. 
12688 if test "X$netdb_name_type" = X ; then
12689         case "$d_gethbyname" in
12690         $define)
12691                 $cat <<EOM
12692
12693 Checking to see what type of argument is accepted by gethostbyname().
12694 EOM
12695                 hdrs="$define sys/types.h
12696                         $d_socket sys/socket.h 
12697                         $i_niin netinet/in.h 
12698                         $i_netdb netdb.h
12699                         $i_unistd unistd.h"
12700                 for xxx in "const char *" "char *"; do
12701                         case "$netdb_name_type" in
12702                         '')     try="extern struct hostent *gethostbyname($xxx);"
12703                                 if ./protochk "$try" $hdrs; then
12704                                         echo "Your system accepts $xxx."
12705                                         netdb_name_type="$xxx"
12706                                 fi
12707                                 ;;
12708                         esac
12709                 done
12710                 : In case none of those worked, prompt the user.
12711                 case "$netdb_name_type" in
12712                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12713                         dflt='char *'
12714                         . ./myread
12715                         netdb_name_type=$ans
12716                         ;;
12717                 esac
12718                 ;;
12719         *)      : no gethostbyname, so pick harmless default
12720                 netdb_name_type='char *'
12721                 ;;
12722         esac
12723 fi
12724
12725 : check for type of 1st argument to getnetbyaddr. 
12726 if test "X$netdb_net_type" = X ; then
12727         case "$d_getnbyaddr" in
12728         $define)
12729                 $cat <<EOM
12730
12731 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12732 EOM
12733                 hdrs="$define sys/types.h
12734                         $d_socket sys/socket.h 
12735                         $i_niin netinet/in.h 
12736                         $i_netdb netdb.h
12737                         $i_unistd unistd.h"
12738                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12739                         case "$netdb_net_type" in
12740                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12741                                 if ./protochk "$try" $hdrs; then
12742                                         echo "Your system accepts $xxx."
12743                                         netdb_net_type="$xxx"
12744                                 fi
12745                                 ;;
12746                         esac
12747                 done
12748                 : In case none of those worked, prompt the user.
12749                 case "$netdb_net_type" in
12750                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12751                         dflt='long'
12752                         . ./myread
12753                         netdb_net_type=$ans
12754                         ;;
12755                 esac
12756                 ;;
12757         *)      : no getnetbyaddr, so pick harmless default
12758                 netdb_net_type='long'
12759                 ;;
12760         esac
12761 fi
12762 : locate the preferred pager for this system
12763 case "$pager" in
12764 '')
12765         dflt=''
12766         case "$pg" in
12767         /*) dflt=$pg;;
12768         esac
12769         case "$more" in
12770         /*) dflt=$more;;
12771         esac
12772         case "$less" in
12773         /*) dflt=$less;;
12774         esac
12775         case "$dflt" in
12776         '') dflt=/usr/ucb/more;;
12777         esac
12778         ;;
12779 *) dflt="$pager";;
12780 esac
12781 echo " "
12782 fn=f/
12783 rp='What pager is used on your system?'
12784 . ./getfile
12785 pager="$ans"
12786
12787 : see what type pids are declared as in the kernel
12788 rp="What is the type of process ids on this system?"
12789 set pid_t pidtype int stdio.h sys/types.h
12790 eval $typedef_ask
12791
12792 : check for length of pointer
12793 echo " "
12794 case "$ptrsize" in
12795 '')
12796         $echo $n "Checking to see how big your pointers are...$c" >&4
12797         if test "$voidflags" -gt 7; then
12798                 echo '#define VOID_PTR char *' > try.c
12799         else
12800                 echo '#define VOID_PTR void *' > try.c
12801         fi
12802         $cat >>try.c <<'EOCP'
12803 #include <stdio.h>
12804 int main()
12805 {
12806     printf("%d\n", (int)sizeof(VOID_PTR));
12807     exit(0);
12808 }
12809 EOCP
12810         set try
12811         if eval $compile_ok; then
12812                 ptrsize=`./try`
12813                 $echo " $ptrsize bytes." >&4
12814         else
12815                 dflt='4'
12816                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12817                 rp="What is the size of a pointer (in bytes)?"
12818                 . ./myread
12819                 ptrsize="$ans"
12820         fi
12821         ;;
12822 esac
12823 $rm -f try.c try
12824
12825 : see if ar generates random libraries by itself
12826 echo " "
12827 echo "Checking how to generate random libraries on your machine..." >&4
12828 echo 'int bar1() { return bar2(); }' > bar1.c
12829 echo 'int bar2() { return 2; }' > bar2.c
12830 $cat > foo.c <<'EOP'
12831 int main() { printf("%d\n", bar1()); exit(0); }
12832 EOP
12833 $cc $ccflags -c bar1.c >/dev/null 2>&1
12834 $cc $ccflags -c bar2.c >/dev/null 2>&1
12835 $cc $ccflags -c foo.c >/dev/null 2>&1
12836 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12837 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12838         ./foobar >/dev/null 2>&1; then
12839         echo "$ar appears to generate random libraries itself."
12840         orderlib=false
12841         ranlib=":"
12842 elif $ar ts bar$_a >/dev/null 2>&1 &&
12843         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12844         ./foobar >/dev/null 2>&1; then
12845                 echo "a table of contents needs to be added with '$ar ts'."
12846                 orderlib=false
12847                 ranlib="$ar ts"
12848 else
12849         case "$ranlib" in
12850         :) ranlib='';;
12851         '')
12852                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12853                 $test -f $ranlib || ranlib=''
12854                 ;;
12855         esac
12856         if $test -n "$ranlib"; then
12857                 echo "your system has '$ranlib'; we'll use that."
12858                 orderlib=false
12859         else
12860                 echo "your system doesn't seem to support random libraries"
12861                 echo "so we'll use lorder and tsort to order the libraries."
12862                 orderlib=true
12863                 ranlib=":"
12864         fi
12865 fi
12866 $rm -f foo* bar* 
12867
12868 : check for type of arguments to select. 
12869 case "$selecttype" in
12870 '') case "$d_select" in
12871         $define)
12872                 echo " "
12873                 $cat <<EOM
12874 Checking to see what type of arguments are accepted by select().
12875 EOM
12876                 hdrs="$define sys/types.h
12877                         $i_systime sys/time.h 
12878                         $i_sysselct sys/select.h
12879                         $d_socket sys/socket.h"
12880                 : The first arg can be int, unsigned, or size_t
12881                 : The last arg may or may not be 'const'
12882                 val=''
12883                 : void pointer has been seen but using that
12884                 : breaks the selectminbits test
12885                 for xxx in 'fd_set *' 'int *'; do
12886                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12887                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12888                                         case "$val" in
12889                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12890                                                 if ./protochk "$try" $hdrs; then
12891                                                         echo "Your system accepts $xxx."
12892                                                         val="$xxx"
12893                                                 fi
12894                                                 ;;
12895                                         esac
12896                                 done
12897                         done
12898                 done
12899                 case "$val" in
12900                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12901                         case "$d_fd_set" in
12902                                 $define) dflt="fd_set *" ;;
12903                                 *)              dflt="int *" ;;
12904                         esac
12905                         . ./myread
12906                         val=$ans
12907                         ;;
12908                 esac
12909                 selecttype="$val"
12910                 ;;
12911         *)      : no select, so pick a harmless default
12912                 selecttype='int *'
12913                 ;;
12914         esac
12915         ;;
12916 esac
12917
12918 : check for the select 'width'
12919 case "$selectminbits" in
12920 '') case "$d_select" in
12921         $define)
12922                 $cat <<EOM
12923
12924 Checking to see on how many bits at a time your select() operates...
12925 EOM
12926                 $cat >try.c <<EOCP
12927 #include <sys/types.h>
12928 #$i_time I_TIME
12929 #$i_systime I_SYS_TIME
12930 #$i_systimek I_SYS_TIME_KERNEL
12931 #ifdef I_TIME
12932 #   include <time.h>
12933 #endif
12934 #ifdef I_SYS_TIME
12935 #   ifdef I_SYS_TIME_KERNEL
12936 #       define KERNEL
12937 #   endif
12938 #   include <sys/time.h>
12939 #   ifdef I_SYS_TIME_KERNEL
12940 #       undef KERNEL
12941 #   endif
12942 #endif
12943 #$i_sysselct I_SYS_SELECT
12944 #ifdef I_SYS_SELECT
12945 #include <sys/select.h>
12946 #endif
12947 #$d_socket HAS_SOCKET
12948 #ifdef HAS_SOCKET
12949 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12950 #endif
12951 #include <stdio.h>
12952 $selecttype b;
12953 #define S sizeof(*(b))
12954 #define MINBITS 64
12955 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12956 #define NBITS  (NBYTES * 8)
12957 int main() {
12958     char s[NBYTES];
12959     struct timeval t;
12960     int i;
12961     FILE* fp;
12962     int fd;
12963
12964     fclose(stdin);
12965     fp = fopen("try.c", "r");
12966     if (fp == 0)
12967       exit(1);
12968     fd = fileno(fp);
12969     if (fd < 0)
12970       exit(2);
12971     b = ($selecttype)s;
12972     for (i = 0; i < NBITS; i++)
12973         FD_SET(i, b);
12974     t.tv_sec  = 0;
12975     t.tv_usec = 0;
12976     select(fd + 1, b, 0, 0, &t);
12977     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12978     printf("%d\n", i + 1);
12979     return 0;
12980 }
12981 EOCP
12982                 set try
12983                 if eval $compile_ok; then
12984                         selectminbits=`./try`
12985                         case "$selectminbits" in
12986                         '')     cat >&4 <<EOM
12987 Cannot figure out on how many bits at a time your select() operates.
12988 I'll play safe and guess it is 32 bits.
12989 EOM
12990                                 selectminbits=32
12991                                 bits="32 bits"
12992                                 ;;
12993                         1)      bits="1 bit" ;;
12994                         *)      bits="$selectminbits bits" ;;
12995                         esac
12996                         echo "Your select() operates on $bits at a time." >&4
12997                 else
12998                         rp='What is the minimum number of bits your select() operates on?'
12999                         case "$byteorder" in
13000                         1234|12345678)  dflt=32 ;;
13001                         *)              dflt=1  ;;
13002                         esac
13003                         . ./myread
13004                         val=$ans
13005                         selectminbits="$val"
13006                 fi
13007                 $rm -f try.* try
13008                 ;;
13009         *)      : no select, so pick a harmless default
13010                 selectminbits='32'
13011                 ;;
13012         esac
13013         ;;
13014 esac
13015
13016 : Trace out the files included by signal.h, then look for SIGxxx names.
13017 : Remove SIGARRAYSIZE used by HPUX.
13018 : Remove SIGSTKSIZE used by Linux.
13019 : Remove SIGSTKSZ used by Posix.
13020 : Remove SIGTYP void lines used by OS2.
13021 : Some cpps, like os390, dont give the file name anywhere
13022 if [ "X$fieldn" = X ]; then
13023         : Just make some guesses.  We check them later.
13024         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13025 else
13026         xxx=`echo '#include <signal.h>' |
13027         $cppstdin $cppminus $cppflags 2>/dev/null |
13028         $grep '^[       ]*#.*include' | 
13029         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13030 fi
13031 : Check this list of files to be sure we have parsed the cpp output ok.
13032 : This will also avoid potentially non-existent files, such 
13033 : as ../foo/bar.h
13034 xxxfiles=''
13035 for xx in $xxx /dev/null ; do
13036         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13037 done
13038 : If we have found no files, at least try signal.h
13039 case "$xxxfiles" in
13040 '')     xxxfiles=`./findhdr signal.h` ;;
13041 esac
13042 xxx=`awk '
13043 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13044         print substr($2, 4, 20)
13045 }
13046 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13047         print substr($3, 4, 20)
13048 }' $xxxfiles`
13049 : Append some common names just in case the awk scan failed.
13050 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13051 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13052 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13053 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13054 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13055
13056 : generate a few handy files for later
13057 $cat > signal.c <<'EOCP'
13058 #include <sys/types.h>
13059 #include <signal.h>
13060 #include <stdio.h>
13061 int main() {
13062
13063 /* Strange style to avoid deeply-nested #if/#else/#endif */
13064 #ifndef NSIG
13065 #  ifdef _NSIG
13066 #    define NSIG (_NSIG)
13067 #  endif
13068 #endif
13069
13070 #ifndef NSIG
13071 #  ifdef SIGMAX
13072 #    define NSIG (SIGMAX+1)
13073 #  endif
13074 #endif
13075
13076 #ifndef NSIG
13077 #  ifdef SIG_MAX
13078 #    define NSIG (SIG_MAX+1)
13079 #  endif
13080 #endif
13081
13082 #ifndef NSIG
13083 #  ifdef MAXSIG
13084 #    define NSIG (MAXSIG+1)
13085 #  endif
13086 #endif
13087
13088 #ifndef NSIG
13089 #  ifdef MAX_SIG
13090 #    define NSIG (MAX_SIG+1)
13091 #  endif
13092 #endif
13093
13094 #ifndef NSIG
13095 #  ifdef SIGARRAYSIZE
13096 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13097 #  endif
13098 #endif
13099
13100 #ifndef NSIG
13101 #  ifdef _sys_nsig
13102 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13103 #  endif
13104 #endif
13105
13106 /* Default to some arbitrary number that's big enough to get most
13107    of the common signals.
13108 */
13109 #ifndef NSIG
13110 #    define NSIG 50
13111 #endif
13112
13113 printf("NSIG %d\n", NSIG);
13114
13115 #ifndef JUST_NSIG
13116
13117 EOCP
13118
13119 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13120 {
13121         printf "#ifdef SIG"; printf $1; printf "\n"
13122         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13123         printf $1; printf ");\n"
13124         printf "#endif\n"
13125 }
13126 END {
13127         printf "#endif /* JUST_NSIG */\n";
13128         printf "exit(0);\n}\n";
13129 }
13130 ' >>signal.c
13131 $cat >signal.awk <<'EOP'
13132 BEGIN { ndups = 0 }
13133 $1 ~ /^NSIG$/ { nsig = $2 }
13134 ($1 !~ /^NSIG$/) && (NF == 2) {
13135     if ($2 > maxsig) { maxsig = $2 }
13136     if (sig_name[$2]) {
13137         dup_name[ndups] = $1
13138         dup_num[ndups] = $2
13139         ndups++ 
13140     }
13141     else {
13142         sig_name[$2] = $1
13143         sig_num[$2] = $2
13144     }
13145 }
13146 END { 
13147     if (nsig == 0) {
13148         nsig = maxsig + 1
13149     }
13150     printf("NSIG %d\n", nsig);
13151     for (n = 1; n < nsig; n++) {
13152         if (sig_name[n]) {
13153             printf("%s %d\n", sig_name[n], sig_num[n])
13154         }
13155         else {
13156             printf("NUM%d %d\n", n, n) 
13157         }
13158     }
13159     for (n = 0; n < ndups; n++) {
13160         printf("%s %d\n", dup_name[n], dup_num[n])
13161     }
13162 }
13163 EOP
13164 $cat >signal_cmd <<EOS
13165 $startsh
13166 if $test -s signal.lst; then
13167     echo "Using your existing signal.lst file"
13168         exit 0
13169 fi
13170 xxx="$xxx"
13171 EOS
13172 $cat >>signal_cmd <<'EOS'
13173
13174 set signal
13175 if eval $compile_ok; then
13176         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13177 else
13178         echo "(I can't seem be able to compile the whole test program)" >&4
13179         echo "(I'll try it in little pieces.)" >&4
13180         set signal -DJUST_NSIG
13181         if eval $compile_ok; then
13182                 ./signal$_exe > signal.nsg
13183                 $cat signal.nsg
13184         else
13185                 echo "I can't seem to figure out how many signals you have." >&4
13186                 echo "Guessing 50." >&4
13187                 echo 'NSIG 50' > signal.nsg
13188         fi
13189         : Now look at all the signal names, one at a time.
13190         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13191                 $cat > signal.c <<EOCP
13192 #include <sys/types.h>
13193 #include <signal.h>
13194 #include <stdio.h>
13195 int main() {
13196 printf("$xx %d\n", SIG${xx});
13197 return 0;
13198 }
13199 EOCP
13200                 set signal
13201                 if eval $compile; then
13202                         echo "SIG${xx} found."
13203                         ./signal$_exe  >> signal.ls1
13204                 else
13205                         echo "SIG${xx} NOT found."
13206                 fi
13207         done
13208         if $test -s signal.ls1; then
13209                 $cat signal.nsg signal.ls1 |
13210                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13211         fi
13212
13213 fi
13214 if $test -s signal.lst; then
13215         :
13216 else
13217         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13218         echo 'kill -l' >signal
13219         set X `csh -f <signal`
13220         $rm -f signal
13221         shift
13222         case $# in
13223         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13224         esac
13225         echo $@ | $tr ' ' $trnl | \
13226             $awk '{ printf "%s %d\n", $1, ++s; }
13227                   END { printf "NSIG %d\n", ++s }' >signal.lst
13228 fi
13229 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13230 EOS
13231 chmod a+x signal_cmd
13232 $eunicefix signal_cmd
13233
13234 : generate list of signal names
13235 echo " "
13236 case "$sig_name_init" in
13237 '') doinit=yes ;;
13238 *)  case "$sig_num_init" in
13239     ''|*,*) doinit=yes ;;
13240     esac ;;
13241 esac
13242 case "$doinit" in
13243 yes)
13244         echo "Generating a list of signal names and numbers..." >&4
13245         . ./signal_cmd
13246         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13247         sig_name=`$awk 'BEGIN { printf "ZERO " }
13248                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13249         sig_num=`$awk  'BEGIN { printf "0 " }
13250                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13251         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13252                              !/^NSIG/   { printf "\"%s\", ", $1 }
13253                              END        { printf "0\n" }' signal.lst`
13254         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13255                              !/^NSIG/   { printf "%d, ", $2}
13256                              END        { printf "0\n"}' signal.lst`
13257         ;;
13258 esac
13259 echo "The following $sig_count signals are available:"
13260 echo " "
13261 echo $sig_name | $awk \
13262 'BEGIN { linelen = 0 }
13263 {
13264         for (i = 1; i <= NF; i++) {
13265                 name = "SIG" $i " "
13266                 linelen = linelen + length(name)
13267                 if (linelen > 70) {
13268                         printf "\n"
13269                         linelen = length(name)
13270                 }
13271                 printf "%s", name
13272         }
13273         printf "\n"
13274 }'
13275 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13276
13277 : see what type is used for signed size_t
13278 set ssize_t ssizetype int stdio.h sys/types.h
13279 eval $typedef
13280 dflt="$ssizetype"
13281 $cat > ssize.c <<EOM
13282 #include <stdio.h>
13283 #include <sys/types.h>
13284 #define Size_t $sizetype
13285 #define SSize_t $dflt
13286 int main()
13287 {
13288         if (sizeof(Size_t) == sizeof(SSize_t))
13289                 printf("$dflt\n");
13290         else if (sizeof(Size_t) == sizeof(int))
13291                 printf("int\n");
13292         else 
13293                 printf("long\n");
13294         exit(0);
13295 }
13296 EOM
13297 echo " "
13298 set ssize
13299 if eval $compile_ok && ./ssize > /dev/null; then
13300         ssizetype=`./ssize`
13301         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13302 else
13303         $cat >&4 <<EOM
13304 Help! I can't compile and run the ssize_t test program: please enlighten me!
13305 (This is probably a misconfiguration in your system or libraries, and
13306 you really ought to fix it.  Still, I'll try anyway.)
13307
13308 I need a type that is the same size as $sizetype, but is guaranteed to
13309 be signed.  Common values are ssize_t, int and long.
13310
13311 EOM
13312         rp="What signed type is the same size as $sizetype?"
13313         . ./myread
13314         ssizetype="$ans"
13315 fi
13316 $rm -f ssize ssize.*
13317
13318 : see what type of char stdio uses.
13319 echo " "
13320 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13321         echo "Your stdio uses unsigned chars." >&4
13322         stdchar="unsigned char"
13323 else
13324         echo "Your stdio uses signed chars." >&4
13325         stdchar="char"
13326 fi
13327
13328 : see if time exists
13329 echo " "
13330 if test "X$d_time" = X -o X"$timetype" = X; then
13331     if set time val -f d_time; eval $csym; $val; then
13332                 echo 'time() found.' >&4
13333                 val="$define"
13334                 rp="What is the type returned by time() on this system?"
13335                 set time_t timetype long stdio.h sys/types.h
13336                 eval $typedef_ask
13337     else
13338                 echo 'time() not found, hope that will do.' >&4
13339                 val="$undef"
13340                 timetype='int';
13341     fi
13342     set d_time
13343     eval $setvar
13344 fi
13345
13346 : see what type uids are declared as in the kernel
13347 echo " "
13348 echo "Looking for the type for user ids returned by getuid()."
13349 set uid_t uidtype xxx stdio.h sys/types.h
13350 eval $typedef
13351 case "$uidtype" in
13352 xxx)
13353         xxx=`./findhdr sys/user.h`
13354         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13355         case $1 in
13356         unsigned) dflt="$1 $2" ;;
13357         *) dflt="$1" ;;
13358         esac
13359         ;;
13360 *) dflt="$uidtype";;
13361 esac
13362 case "$uidtype" in
13363 uid_t)  echo "uid_t found." ;;
13364 *)      rp="What is the type for user ids returned by getuid()?"
13365         . ./myread
13366         uidtype="$ans"
13367         ;;
13368 esac
13369
13370 echo " "
13371 case "$uidtype" in
13372 *_t) zzz="$uidtype"     ;;
13373 *)   zzz="uid"          ;;
13374 esac
13375 echo "Checking the size of $zzz..." >&4 
13376 cat > try.c <<EOCP
13377 #include <sys/types.h>
13378 #include <stdio.h>
13379 int main() {
13380     printf("%d\n", (int)sizeof($uidtype));
13381     exit(0);
13382 }
13383 EOCP
13384 set try
13385 if eval $compile_ok; then
13386         yyy=`./try`
13387         case "$yyy" in
13388         '')     uidsize=4
13389                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13390                 ;;
13391         *)      uidsize=$yyy
13392                 echo "Your $zzz size is $uidsize bytes."
13393                 ;;
13394         esac
13395 else
13396         uidsize=4
13397         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13398 fi
13399
13400 echo " "
13401 case "$uidtype" in
13402 *_t) zzz="$uidtype"     ;;
13403 *)   zzz="uid"          ;;
13404 esac
13405 echo "Checking the sign of $zzz..." >&4
13406 cat > try.c <<EOCP
13407 #include <sys/types.h>
13408 #include <stdio.h>
13409 int main() {
13410         $uidtype foo = -1;
13411         if (foo < 0)
13412                 printf("-1\n");
13413         else
13414                 printf("1\n");
13415 }
13416 EOCP
13417 set try
13418 if eval $compile; then
13419         yyy=`./try`
13420         case "$yyy" in
13421         '')     uidsign=1
13422                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13423                 ;;
13424         *)      uidsign=$yyy
13425                 case "$uidsign" in
13426                  1) echo "Your $zzz is unsigned." ;;
13427                 -1) echo "Your $zzz is signed."   ;;
13428                 esac
13429                 ;;
13430         esac
13431 else
13432         uidsign=1
13433         echo "(I can't compile the test program--guessing unsigned.)" >&4
13434 fi
13435
13436
13437
13438 echo " "
13439 $echo "Checking the format string to be used for uids..." >&4
13440
13441 case "$uidsign" in
13442 -1)     if $test X"$uidsize" = X"$ivsize"; then
13443                 uidformat="$ivdformat"
13444         else
13445                 if $test X"$uidsize" = X"$longsize"; then
13446                         uidformat='"ld"'
13447                 else
13448                         if $test X"$uidsize" = X"$intsize"; then
13449                                 uidformat='"d"'
13450                         else
13451                                 if $test X"$uidsize" = X"$shortsize"; then
13452                                         uidformat='"hd"'
13453                                 fi
13454                         fi
13455                 fi
13456         fi
13457         ;;
13458 *)      if $test X"$uidsize" = X"$uvsize"; then
13459                 uidformat="$uvuformat"
13460         else
13461                 if $test X"$uidsize" = X"$longsize"; then
13462                         uidformat='"lu"'
13463                 else
13464                         if $test X"$uidsize" = X"$intsize"; then
13465                                 uidformat='"u"'
13466                         else
13467                                 if $test X"$uidsize" = X"$shortsize"; then
13468                                         uidformat='"hu"'
13469                                 fi
13470                         fi
13471                 fi
13472         fi
13473         ;;
13474 esac
13475
13476 : see if dbm.h is available
13477 : see if dbmclose exists
13478 set dbmclose d_dbmclose
13479 eval $inlibc
13480
13481 case "$d_dbmclose" in
13482 $define)
13483         set dbm.h i_dbm
13484         eval $inhdr
13485         case "$i_dbm" in
13486         $define)
13487                 val="$undef"
13488                 set i_rpcsvcdbm
13489                 eval $setvar
13490                 ;;
13491         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13492                 eval $inhdr
13493                 ;;
13494         esac
13495         ;;
13496 *)      echo "We won't be including <dbm.h>"
13497         val="$undef"
13498         set i_dbm
13499         eval $setvar
13500         val="$undef"
13501         set i_rpcsvcdbm
13502         eval $setvar
13503         ;;
13504 esac
13505
13506 : see if this is a sys/file.h system
13507 val=''
13508 set sys/file.h val
13509 eval $inhdr
13510
13511 : do we need to include sys/file.h ?
13512 case "$val" in
13513 "$define")
13514         echo " "
13515         if $h_sysfile; then
13516                 val="$define"
13517                 echo "We'll be including <sys/file.h>." >&4
13518         else
13519                 val="$undef"
13520                 echo "We won't be including <sys/file.h>." >&4
13521         fi
13522         ;;
13523 *)
13524         h_sysfile=false
13525         ;;
13526 esac
13527 set i_sysfile
13528 eval $setvar
13529
13530 : see if fcntl.h is there
13531 val=''
13532 set fcntl.h val
13533 eval $inhdr
13534
13535 : see if we can include fcntl.h
13536 case "$val" in
13537 "$define")
13538         echo " "
13539         if $h_fcntl; then
13540                 val="$define"
13541                 echo "We'll be including <fcntl.h>." >&4
13542         else
13543                 val="$undef"
13544                 if $h_sysfile; then
13545         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13546                 else
13547                         echo "We won't be including <fcntl.h>." >&4
13548                 fi
13549         fi
13550         ;;
13551 *)
13552         h_fcntl=false
13553         val="$undef"
13554         ;;
13555 esac
13556 set i_fcntl
13557 eval $setvar
13558
13559 : see if locale.h is available
13560 set locale.h i_locale
13561 eval $inhdr
13562
13563 : see if mach cthreads are available
13564 if test "X$usethreads" = "X$define"; then
13565         set mach/cthreads.h i_machcthr
13566         eval $inhdr
13567 else
13568         i_machcthr="$undef"
13569 fi
13570
13571
13572
13573 : see if this is a math.h system
13574 set math.h i_math
13575 eval $inhdr
13576
13577 : see if this is a mntent.h system
13578 set mntent.h i_mntent
13579 eval $inhdr
13580
13581 : see if ndbm.h is available
13582 set ndbm.h t_ndbm
13583 eval $inhdr
13584 case "$t_ndbm" in
13585 $define)
13586         : see if dbm_open exists
13587         set dbm_open d_dbm_open
13588         eval $inlibc
13589         case "$d_dbm_open" in
13590         $undef)
13591                 t_ndbm="$undef"
13592                 echo "We won't be including <ndbm.h>"
13593                 ;;
13594         esac
13595         ;;
13596 esac
13597 val="$t_ndbm"
13598 set i_ndbm
13599 eval $setvar
13600
13601 : see if net/errno.h is available
13602 val=''
13603 set net/errno.h val
13604 eval $inhdr
13605
13606 : Unfortunately, it causes problems on some systems.  Arrgh.
13607 case "$val" in
13608 $define)
13609         cat > try.c <<'EOM'
13610 #include <stdio.h>
13611 #include <errno.h>
13612 #include <net/errno.h>
13613 int func()
13614 {
13615         return ENOTSOCK;
13616 }
13617 EOM
13618         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13619                 echo "We'll be including <net/errno.h>." >&4
13620         else
13621                 echo "We won't be including <net/errno.h>." >&4
13622                 val="$undef"
13623         fi
13624         $rm -f try.* try
13625         ;;
13626 esac
13627 set i_neterrno
13628 eval $setvar
13629
13630 : see if netinet/tcp.h is available
13631 set netinet/tcp.h i_netinettcp
13632 eval $inhdr
13633
13634 : see if this is a poll.h system
13635 set poll.h i_poll
13636 eval $inhdr
13637
13638 echo " "
13639 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13640 $cat <<'EOSH' > Cppsym.know
13641 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13642 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13643 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13644 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13645 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13646 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13647 bull c cadmus clipper CMU COFF COMPILER_VERSION
13648 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13649 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13650 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13651 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13652 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13653 H3050R H3050RX hbullx20 hcx host_mips
13654 hp200 hp300 hp700 HP700 hp800 hp9000
13655 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13656 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13657 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13658 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13659 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13660 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13661 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13662 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13663 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13664 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13665 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13666 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13667 MATH_HAS_NO_SIDE_EFFECTS
13668 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13669 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13670 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13671 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13672 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13673 NetBSD news1500 news1700 news1800 news1900 news3700
13674 news700 news800 news900 NeXT NLS ns16000 ns32000
13675 ns32016 ns32332 ns32k nsc32000
13676 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13677 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13678 pc532 pdp11 PGC PIC plexus PORTAR posix
13679 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13680 POSIX_C_SOURCE POSIX_SOURCE POWER
13681 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13682 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13683 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13684 sony sony_news sonyrisc sparc sparclite spectrum
13685 stardent stdc STDC_EXT stratos sun sun3 sun386
13686 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13687 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13688 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13689 sysV68 sysV88 Tek4132 Tek4300 titan
13690 tower tower32 tower32_200 tower32_600 tower32_700
13691 tower32_800 tower32_850 tss
13692 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13693 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13694 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13695 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13696 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13697 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13698 z8000
13699 EOSH
13700 # Maybe put other stuff here too.
13701 cat <<EOSH >>Cppsym.know
13702 $osname
13703 EOSH
13704 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13705 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13706 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13707 $rm -f Cppsym.a Cppsym.b
13708 cat <<EOSH > Cppsym
13709 $startsh
13710 if $test \$# -gt 0; then
13711  echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13712 else
13713   $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13714 fi
13715 $test -s Cppsym.got && exit 0
13716 exit 1
13717 EOSH
13718 chmod +x Cppsym
13719 $eunicefix Cppsym
13720 cat <<EOSH > Cppsym.try
13721 cat <<'EOCP' > try.c
13722 #include <stdio.h>
13723 int main() {
13724 EOCP
13725 $awk \\
13726 EOSH
13727 cat <<'EOSH' >> Cppsym.try
13728 'length($1) > 0 {
13729     printf "#ifdef %s\nprintf(\"%s\\n\");\n#endif\n", $1, $1
13730     printf "#ifdef _%s\nprintf(\"_%s\\n\");\n#endif\n", $1, $1
13731     printf "#ifdef __%s\nprintf(\"__%s\\n\");\n#endif\n", $1, $1
13732     printf "#ifdef __%s__\nprintf(\"__%s__\\n\");\n#endif\n", $1, $1 }' \
13733          >> try.c
13734 echo '}' >> try.c
13735 EOSH
13736 cat <<'EOSH' >> Cppsym.try
13737 set try
13738 eval $compile_ok && ./try$exe_ext
13739 EOSH
13740 chmod +x Cppsym.try
13741 $eunicefix Cppsym.try
13742 ./Cppsym < Cppsym.know > Cppsym.true
13743 : now check the C compiler for additional symbols
13744 postprocess_cc_v=''
13745 case "$osname" in
13746 aix) postprocess_cc_v="|$tr , ' '" ;;
13747 esac
13748 $cat >ccsym <<EOS
13749 $startsh
13750 $cat >tmp.c <<EOF
13751 extern int foo;
13752 EOF
13753 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13754 do
13755         case "\$i" in
13756         -D*) echo "\$i" | $sed 's/^-D//';;
13757         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13758         esac
13759 done
13760 $rm -f try.c
13761 EOS
13762 postprocess_cc_v=''
13763 chmod +x ccsym
13764 $eunicefix ccsym
13765 ./ccsym > ccsym1.raw
13766 if $test -s ccsym1.raw; then
13767        $sort ccsym1.raw | $uniq >ccsym.raw
13768 else
13769        mv ccsym1.raw ccsym.raw
13770 fi
13771
13772 $awk '/\=/ { print $0; next }
13773         { print $0"=1" }' ccsym.raw >ccsym.list
13774 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13775 $comm -13 ccsym.true ccsym.list >ccsym.own
13776 $comm -12 ccsym.true ccsym.list >ccsym.com
13777 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13778 also=''
13779 if $test -z ccsym.raw; then
13780         echo "Your C compiler doesn't seem to define any symbols!" >&4
13781         echo " "
13782         echo "However, your C preprocessor defines the following symbols:"
13783         $cat Cppsym.true
13784         ccsymbols=''
13785         cppsymbols=`$cat Cppsym.true`
13786         cppsymbols=`echo $cppsymbols`
13787         cppccsymbols="$cppsymbols"
13788 else
13789         if $test -s ccsym.com; then
13790                 echo "Your C compiler and pre-processor define these symbols:"
13791                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13792                 also='also '
13793                 symbols='ones'
13794                 cppccsymbols=`$cat ccsym.com`
13795                 cppccsymbols=`echo $cppccsymbols`
13796                 $test "$silent" || sleep 1
13797         fi
13798         if $test -s ccsym.cpp; then
13799                 $test "$also" && echo " "
13800                 echo "Your C pre-processor ${also}defines the following symbols:"
13801                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13802                 also='further '
13803                 cppsymbols=`$cat ccsym.cpp`
13804                 cppsymbols=`echo $cppsymbols`
13805                 $test "$silent" || sleep 1
13806         fi
13807         if $test -s ccsym.own; then
13808                 $test "$also" && echo " "
13809                 echo "Your C compiler ${also}defines the following cpp symbols:"
13810                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13811                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13812                 ccsymbols=`$cat ccsym.own`
13813                 ccsymbols=`echo $ccsymbols`
13814                 $test "$silent" || sleep 1
13815         fi
13816 fi
13817 $rm -f ccsym*
13818
13819 : see if this is a termio system
13820 val="$undef"
13821 val2="$undef"
13822 val3="$undef"
13823 if $test `./findhdr termios.h`; then
13824         set tcsetattr i_termios
13825         eval $inlibc
13826         val3="$i_termios"
13827 fi
13828 echo " "
13829 case "$val3" in
13830 "$define") echo "You have POSIX termios.h... good!" >&4;;
13831 *) if ./Cppsym pyr; then
13832                 case "`/bin/universe`" in
13833                 ucb) if $test `./findhdr sgtty.h`; then
13834                                 val2="$define"
13835                                 echo "<sgtty.h> found." >&4
13836                         else
13837                                 echo "System is pyramid with BSD universe."
13838                                 echo "<sgtty.h> not found--you could have problems." >&4
13839                         fi;;
13840                 *) if $test `./findhdr termio.h`; then
13841                                 val="$define"
13842                                 echo "<termio.h> found." >&4
13843                         else
13844                                 echo "System is pyramid with USG universe."
13845                                 echo "<termio.h> not found--you could have problems." >&4
13846                         fi;;
13847                 esac
13848         elif ./usg; then
13849                 if $test `./findhdr termio.h`; then
13850                         echo "<termio.h> found." >&4
13851                         val="$define"
13852                 elif $test `./findhdr sgtty.h`; then
13853                         echo "<sgtty.h> found." >&4
13854                         val2="$define"
13855                 else
13856 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13857                 fi
13858         else
13859                 if $test `./findhdr sgtty.h`; then
13860                         echo "<sgtty.h> found." >&4
13861                         val2="$define"
13862                 elif $test `./findhdr termio.h`; then
13863                         echo "<termio.h> found." >&4
13864                         val="$define"
13865                 else
13866 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13867                 fi
13868         fi;;
13869 esac
13870 set i_termio; eval $setvar
13871 val=$val2; set i_sgtty; eval $setvar
13872 val=$val3; set i_termios; eval $setvar
13873
13874 : see if this is a shadow.h system
13875 set shadow.h i_shadow
13876 eval $inhdr
13877
13878 : see if this is a socks.h system
13879 set socks.h i_socks
13880 eval $inhdr
13881
13882 : see if stdarg is available
13883 echo " "
13884 if $test `./findhdr stdarg.h`; then
13885         echo "<stdarg.h> found." >&4
13886         valstd="$define"
13887 else
13888         echo "<stdarg.h> NOT found." >&4
13889         valstd="$undef"
13890 fi
13891
13892 : see if varags is available
13893 echo " "
13894 if $test `./findhdr varargs.h`; then
13895         echo "<varargs.h> found." >&4
13896 else
13897         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13898 fi
13899
13900 : set up the varargs testing programs
13901 $cat > varargs.c <<EOP
13902 #ifdef I_STDARG
13903 #include <stdarg.h>
13904 #endif
13905 #ifdef I_VARARGS
13906 #include <varargs.h>
13907 #endif
13908
13909 #ifdef I_STDARG
13910 int f(char *p, ...)
13911 #else
13912 int f(va_alist)
13913 va_dcl
13914 #endif
13915 {
13916         va_list ap;
13917 #ifndef I_STDARG
13918         char *p;
13919 #endif
13920 #ifdef I_STDARG
13921         va_start(ap,p);
13922 #else
13923         va_start(ap);
13924         p = va_arg(ap, char *);
13925 #endif
13926         va_end(ap);
13927 }
13928 EOP
13929 $cat > varargs <<EOP
13930 $startsh
13931 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13932         echo "true"
13933 else
13934         echo "false"
13935 fi
13936 $rm -f varargs$_o
13937 EOP
13938 chmod +x varargs
13939
13940 : now check which varargs header should be included
13941 echo " "
13942 i_varhdr=''
13943 case "$valstd" in
13944 "$define")
13945         if `./varargs I_STDARG`; then
13946                 val='stdarg.h'
13947         elif `./varargs I_VARARGS`; then
13948                 val='varargs.h'
13949         fi
13950         ;;
13951 *)
13952         if `./varargs I_VARARGS`; then
13953                 val='varargs.h'
13954         fi
13955         ;;
13956 esac
13957 case "$val" in
13958 '')
13959 echo "I could not find the definition for va_dcl... You have problems..." >&4
13960         val="$undef"; set i_stdarg; eval $setvar
13961         val="$undef"; set i_varargs; eval $setvar
13962         ;;
13963 *) 
13964         set i_varhdr
13965         eval $setvar
13966         case "$i_varhdr" in
13967         stdarg.h)
13968                 val="$define"; set i_stdarg; eval $setvar
13969                 val="$undef"; set i_varargs; eval $setvar
13970                 ;;
13971         varargs.h)
13972                 val="$undef"; set i_stdarg; eval $setvar
13973                 val="$define"; set i_varargs; eval $setvar
13974                 ;;
13975         esac
13976         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13977 esac
13978 $rm -f varargs*
13979
13980 : see if stddef is available
13981 set stddef.h i_stddef
13982 eval $inhdr
13983
13984 : see if sys/access.h is available
13985 set sys/access.h i_sysaccess
13986 eval $inhdr
13987
13988 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13989 set sys/filio.h i_sysfilio
13990 eval $inhdr
13991 echo " "
13992 if $test `./findhdr sys/ioctl.h`; then
13993         val="$define"
13994         echo '<sys/ioctl.h> found.' >&4
13995 else
13996         val="$undef"
13997         if $test $i_sysfilio = "$define"; then
13998             echo '<sys/ioctl.h> NOT found.' >&4
13999         else
14000                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14001                 $test $i_termio = "$define" && xxx="termio.h"
14002                 $test $i_termios = "$define" && xxx="termios.h"
14003 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14004         fi
14005 fi
14006 set i_sysioctl
14007 eval $setvar
14008
14009 : see if sys/resource.h has to be included
14010 set sys/resource.h i_sysresrc
14011 eval $inhdr
14012
14013 : see if sys/security.h is available
14014 set sys/security.h i_syssecrt
14015 eval $inhdr
14016
14017 : see if this is a sys/statvfs.h system
14018 set sys/statvfs.h i_sysstatvfs
14019 eval $inhdr
14020
14021 : see if this is a sys/uio.h system
14022 set sys/uio.h i_sysuio
14023 eval $inhdr
14024
14025 : see if this is a sys/un.h system
14026 set sys/un.h i_sysun
14027 eval $inhdr
14028
14029 : see if this is a syswait system
14030 set sys/wait.h i_syswait
14031 eval $inhdr
14032
14033 : see if this is a ustat.h system
14034 set ustat.h i_ustat
14035 eval $inhdr
14036
14037 : see if this is an utime system
14038 set utime.h i_utime
14039 eval $inhdr
14040
14041 : see if this is a values.h system
14042 set values.h i_values
14043 eval $inhdr
14044
14045 : see if this is a vfork system
14046 case "$d_vfork" in
14047 "$define")
14048         set vfork.h i_vfork
14049         eval $inhdr
14050         ;;
14051 *)
14052         i_vfork="$undef"
14053         ;;
14054 esac
14055
14056 : see if gdbm.h is available
14057 set gdbm.h t_gdbm
14058 eval $inhdr
14059 case "$t_gdbm" in
14060 $define)
14061         : see if gdbm_open exists
14062         set gdbm_open d_gdbm_open
14063         eval $inlibc
14064         case "$d_gdbm_open" in
14065         $undef)
14066                 t_gdbm="$undef"
14067                 echo "We won't be including <gdbm.h>"
14068                 ;;
14069         esac
14070         ;;
14071 esac
14072 val="$t_gdbm"
14073 set i_gdbm
14074 eval $setvar
14075
14076 echo " "
14077 echo "Looking for extensions..." >&4
14078 : If we are using the old config.sh, known_extensions may contain
14079 : old or inaccurate or duplicate values.
14080 known_extensions=''
14081 nonxs_extensions=''
14082 : We do not use find because it might not be available.
14083 : We do not just use MANIFEST because the user may have dropped
14084 : some additional extensions into the source tree and expect them
14085 : to be built.
14086
14087 : Function to recursively find available extensions, ignoring DynaLoader
14088 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14089 find_extensions='
14090     for xxx in *; do
14091        case "$xxx" in
14092            DynaLoader|dynaload) ;;
14093            *)
14094            if $test -f $xxx/$xxx.xs; then
14095                known_extensions="$known_extensions $1$xxx";
14096            elif $test -f $xxx/Makefile.PL; then
14097                nonxs_extensions="$nonxs_extensions $1$xxx";
14098            else
14099                if $test -d $xxx -a $# -lt 10; then
14100                    set $1$xxx/ $*;
14101                    cd $xxx;
14102                    eval $find_extensions;
14103                    cd ..;
14104                    shift;
14105                fi;
14106            fi
14107            ;;
14108        esac;
14109     done'
14110 tdir=`pwd`
14111 cd $rsrc/ext
14112 set X
14113 shift
14114 eval $find_extensions
14115 set X $nonxs_extensions
14116 shift
14117 nonxs_extensions="$*"
14118 set X $known_extensions
14119 shift
14120 known_extensions="$*"
14121 cd $tdir
14122
14123 : Now see which are supported on this system.
14124 avail_ext=''
14125 for xxx in $known_extensions ; do
14126         case "$xxx" in
14127         DB_File|db_file)
14128                 case "$i_db" in
14129                 $define) avail_ext="$avail_ext $xxx" ;;
14130                 esac
14131                 ;;
14132         GDBM_File|gdbm_fil)
14133                 case "$i_gdbm" in 
14134                 $define) avail_ext="$avail_ext $xxx" ;;
14135                 esac
14136                 ;;
14137         NDBM_File|ndbm_fil)
14138                 case "$i_ndbm" in
14139                 $define) avail_ext="$avail_ext $xxx" ;;
14140                 esac
14141                 ;;
14142         ODBM_File|odbm_fil) 
14143                 case "${i_dbm}${i_rpcsvcdbm}" in
14144                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14145                 esac
14146                 ;;
14147         POSIX|posix)
14148                 case "$useposix" in
14149                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14150                 esac
14151                 ;;
14152         Opcode|opcode)
14153                 case "$useopcode" in
14154                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14155                 esac
14156                 ;;
14157         Socket|socket)
14158                 case "$d_socket" in 
14159                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14160                 esac
14161                 ;;
14162         Thread|thread)
14163                 case "$usethreads" in 
14164                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14165                 esac
14166                 ;;
14167         IPC/SysV|ipc/sysv)
14168                 : XXX Do we need a useipcsysv variable here
14169                 case "${d_msg}${d_sem}${d_shm}" in 
14170                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14171                 esac
14172                 ;;
14173         *)      avail_ext="$avail_ext $xxx"
14174                 ;;
14175         esac
14176 done
14177
14178 set X $avail_ext
14179 shift
14180 avail_ext="$*"
14181
14182 : Now see which nonxs extensions are supported on this system.
14183 : For now assume all are.
14184 nonxs_ext=''
14185 for xxx in $nonxs_extensions ; do
14186         case "$xxx" in
14187         *)      nonxs_ext="$nonxs_ext $xxx"
14188                 ;;
14189         esac
14190 done
14191
14192 set X $nonxs_ext
14193 shift
14194 nonxs_ext="$*"
14195
14196 case $usedl in
14197 $define)
14198         $cat <<EOM
14199 A number of extensions are supplied with $package.  You may choose to
14200 compile these extensions for dynamic loading (the default), compile
14201 them into the $package executable (static loading), or not include
14202 them at all.  Answer "none" to include no extensions.
14203 Note that DynaLoader is always built and need not be mentioned here.
14204
14205 EOM
14206         case "$dynamic_ext" in
14207         '') dflt="$avail_ext" ;;
14208         *)      dflt="$dynamic_ext"
14209                 # Perhaps we are reusing an old out-of-date config.sh.
14210                 case "$hint" in
14211                 previous)
14212                         if test X"$dynamic_ext" != X"$avail_ext"; then
14213                                 $cat <<EOM
14214 NOTICE:  Your previous config.sh list may be incorrect. 
14215 The extensions now available to you are 
14216         ${avail_ext}
14217 but the default list from your previous config.sh is
14218         ${dynamic_ext} 
14219
14220 EOM
14221                         fi
14222                         ;;
14223                 esac
14224                 ;;
14225         esac
14226         case "$dflt" in
14227         '')     dflt=none;;
14228         esac
14229         rp="What extensions do you wish to load dynamically?"
14230         . ./myread
14231         case "$ans" in
14232         none) dynamic_ext=' ' ;;
14233         *) dynamic_ext="$ans" ;;
14234         esac
14235
14236         case "$static_ext" in
14237         '')
14238                 : Exclude those already listed in dynamic linking
14239                 dflt=''
14240                 for xxx in $avail_ext; do
14241                         case " $dynamic_ext " in
14242                         *" $xxx "*) ;;
14243                         *) dflt="$dflt $xxx" ;;
14244                         esac
14245                 done
14246                 set X $dflt
14247                 shift
14248                 dflt="$*"
14249                 ;;
14250         *)  dflt="$static_ext" 
14251                 ;;
14252         esac
14253
14254         case "$dflt" in
14255         '')     dflt=none;;
14256         esac
14257         rp="What extensions do you wish to load statically?"
14258         . ./myread
14259         case "$ans" in
14260         none) static_ext=' ' ;;
14261         *) static_ext="$ans" ;;
14262         esac
14263         ;;
14264 *)
14265         $cat <<EOM
14266 A number of extensions are supplied with $package.  Answer "none" 
14267 to include no extensions. 
14268 Note that DynaLoader is always built and need not be mentioned here.
14269
14270 EOM
14271         case "$static_ext" in
14272         '') dflt="$avail_ext" ;;
14273         *)      dflt="$static_ext"
14274                 # Perhaps we are reusing an old out-of-date config.sh.
14275                 case "$hint" in
14276                 previous)
14277                         if test X"$static_ext" != X"$avail_ext"; then
14278                                 $cat <<EOM
14279 NOTICE:  Your previous config.sh list may be incorrect. 
14280 The extensions now available to you are 
14281         ${avail_ext}
14282 but the default list from your previous config.sh is
14283         ${static_ext} 
14284
14285 EOM
14286                         fi
14287                         ;;
14288                 esac
14289                 ;;
14290         esac
14291         : Exclude those that are not xs extensions
14292         case "$dflt" in
14293         '')     dflt=none;;
14294         esac
14295         rp="What extensions do you wish to include?"
14296         . ./myread
14297         case "$ans" in
14298         none) static_ext=' ' ;;
14299         *) static_ext="$ans" ;;
14300         esac
14301         ;;
14302 esac
14303
14304 set X $dynamic_ext $static_ext $nonxs_ext
14305 shift
14306 extensions="$*"
14307
14308 : Remove build directory name from cppstdin so it can be used from
14309 : either the present location or the final installed location.
14310 echo " "
14311 : Get out of the UU directory to get correct path name.
14312 cd ..
14313 case "$cppstdin" in
14314 `pwd`/cppstdin)
14315         echo "Stripping down cppstdin path name"
14316         cppstdin=cppstdin
14317         ;;
14318 esac
14319 cd UU
14320
14321 : end of configuration questions
14322 echo " "
14323 echo "End of configuration questions."
14324 echo " "
14325
14326 : back to where it started
14327 if test -d ../UU; then
14328         cd ..
14329 fi
14330
14331 : configuration may be patched via a 'config.over' file
14332 if $test -f config.over; then
14333         echo " "
14334         dflt=y
14335         rp='I see a config.over file.  Do you wish to load it?'
14336         . UU/myread
14337         case "$ans" in
14338         n*) echo "OK, I'll ignore it.";;
14339         *)      . ./config.over
14340                 echo "Configuration override changes have been loaded."
14341                 ;;
14342         esac
14343 fi
14344
14345 : in case they want portability, strip down executable paths
14346 case "$d_portable" in
14347 "$define")
14348         echo " "
14349         echo "Stripping down executable paths..." >&4
14350         for file in $loclist $trylist; do
14351                 eval temp=\$$file
14352                 eval $file=`basename $temp`
14353         done
14354         ;;
14355 esac
14356
14357 : create config.sh file
14358 echo " "
14359 echo "Creating config.sh..." >&4
14360 $spitshell <<EOT >config.sh
14361 $startsh
14362 #
14363 # This file was produced by running the Configure script. It holds all the
14364 # definitions figured out by Configure. Should you modify one of these values,
14365 # do not forget to propagate your changes by running "Configure -der". You may
14366 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14367 #
14368
14369 # Package name      : $package
14370 # Source directory  : $src
14371 # Configuration time: $cf_time
14372 # Configured by     : $cf_by
14373 # Target system     : $myuname
14374
14375 Author='$Author'
14376 Date='$Date'
14377 Header='$Header'
14378 Id='$Id'
14379 Locker='$Locker'
14380 Log='$Log'
14381 Mcc='$Mcc'
14382 RCSfile='$RCSfile'
14383 Revision='$Revision'
14384 Source='$Source'
14385 State='$State'
14386 _a='$_a'
14387 _exe='$_exe'
14388 _o='$_o'
14389 afs='$afs'
14390 alignbytes='$alignbytes'
14391 ansi2knr='$ansi2knr'
14392 aphostname='$aphostname'
14393 api_revision='$api_revision'
14394 api_subversion='$api_subversion'
14395 api_version='$api_version'
14396 api_versionstring='$api_versionstring'
14397 ar='$ar'
14398 archlib='$archlib'
14399 archlibexp='$archlibexp'
14400 archname64='$archname64'
14401 archname='$archname'
14402 archobjs='$archobjs'
14403 awk='$awk'
14404 baserev='$baserev'
14405 bash='$bash'
14406 bin='$bin'
14407 bincompat5005='$bincompat5005'
14408 binexp='$binexp'
14409 bison='$bison'
14410 byacc='$byacc'
14411 byteorder='$byteorder'
14412 c='$c'
14413 castflags='$castflags'
14414 cat='$cat'
14415 cc='$cc'
14416 cccdlflags='$cccdlflags'
14417 ccdlflags='$ccdlflags'
14418 ccflags='$ccflags'
14419 ccsymbols='$ccsymbols'
14420 cf_by='$cf_by'
14421 cf_email='$cf_email'
14422 cf_time='$cf_time'
14423 charsize='$charsize'
14424 chgrp='$chgrp'
14425 chmod='$chmod'
14426 chown='$chown'
14427 clocktype='$clocktype'
14428 comm='$comm'
14429 compress='$compress'
14430 contains='$contains'
14431 cp='$cp'
14432 cpio='$cpio'
14433 cpp='$cpp'
14434 cpp_stuff='$cpp_stuff'
14435 cppccsymbols='$cppccsymbols'
14436 cppflags='$cppflags'
14437 cpplast='$cpplast'
14438 cppminus='$cppminus'
14439 cpprun='$cpprun'
14440 cppstdin='$cppstdin'
14441 cppsymbols='$cppsymbols'
14442 crosscompile='$crosscompile'
14443 cryptlib='$cryptlib'
14444 csh='$csh'
14445 d_Gconvert='$d_Gconvert'
14446 d_PRIEldbl='$d_PRIEldbl'
14447 d_PRIFldbl='$d_PRIFldbl'
14448 d_PRIGldbl='$d_PRIGldbl'
14449 d_PRIX64='$d_PRIX64'
14450 d_PRId64='$d_PRId64'
14451 d_PRIeldbl='$d_PRIeldbl'
14452 d_PRIfldbl='$d_PRIfldbl'
14453 d_PRIgldbl='$d_PRIgldbl'
14454 d_PRIi64='$d_PRIi64'
14455 d_PRIo64='$d_PRIo64'
14456 d_PRIu64='$d_PRIu64'
14457 d_PRIx64='$d_PRIx64'
14458 d_access='$d_access'
14459 d_accessx='$d_accessx'
14460 d_alarm='$d_alarm'
14461 d_archlib='$d_archlib'
14462 d_atolf='$d_atolf'
14463 d_atoll='$d_atoll'
14464 d_attribut='$d_attribut'
14465 d_bcmp='$d_bcmp'
14466 d_bcopy='$d_bcopy'
14467 d_bincompat5005='$d_bincompat5005'
14468 d_bsd='$d_bsd'
14469 d_bsdgetpgrp='$d_bsdgetpgrp'
14470 d_bsdsetpgrp='$d_bsdsetpgrp'
14471 d_bzero='$d_bzero'
14472 d_casti32='$d_casti32'
14473 d_castneg='$d_castneg'
14474 d_charvspr='$d_charvspr'
14475 d_chown='$d_chown'
14476 d_chroot='$d_chroot'
14477 d_chsize='$d_chsize'
14478 d_closedir='$d_closedir'
14479 d_const='$d_const'
14480 d_crypt='$d_crypt'
14481 d_csh='$d_csh'
14482 d_cuserid='$d_cuserid'
14483 d_dbl_dig='$d_dbl_dig'
14484 d_difftime='$d_difftime'
14485 d_dirnamlen='$d_dirnamlen'
14486 d_dlerror='$d_dlerror'
14487 d_dlopen='$d_dlopen'
14488 d_dlsymun='$d_dlsymun'
14489 d_dosuid='$d_dosuid'
14490 d_drand48proto='$d_drand48proto'
14491 d_dup2='$d_dup2'
14492 d_eaccess='$d_eaccess'
14493 d_endgrent='$d_endgrent'
14494 d_endhent='$d_endhent'
14495 d_endnent='$d_endnent'
14496 d_endpent='$d_endpent'
14497 d_endpwent='$d_endpwent'
14498 d_endsent='$d_endsent'
14499 d_endspent='$d_endspent'
14500 d_eofnblk='$d_eofnblk'
14501 d_eunice='$d_eunice'
14502 d_fchmod='$d_fchmod'
14503 d_fchown='$d_fchown'
14504 d_fcntl='$d_fcntl'
14505 d_fd_macros='$d_fd_macros'
14506 d_fd_set='$d_fd_set'
14507 d_fds_bits='$d_fds_bits'
14508 d_fgetpos='$d_fgetpos'
14509 d_flexfnam='$d_flexfnam'
14510 d_flock='$d_flock'
14511 d_fork='$d_fork'
14512 d_fpathconf='$d_fpathconf'
14513 d_fpos64_t='$d_fpos64_t'
14514 d_fs_data_s='$d_fs_data_s'
14515 d_fseeko='$d_fseeko'
14516 d_fsetpos='$d_fsetpos'
14517 d_fstatfs='$d_fstatfs'
14518 d_fstatvfs='$d_fstatvfs'
14519 d_ftello='$d_ftello'
14520 d_ftime='$d_ftime'
14521 d_getgrent='$d_getgrent'
14522 d_getgrps='$d_getgrps'
14523 d_gethbyaddr='$d_gethbyaddr'
14524 d_gethbyname='$d_gethbyname'
14525 d_gethent='$d_gethent'
14526 d_gethname='$d_gethname'
14527 d_gethostprotos='$d_gethostprotos'
14528 d_getlogin='$d_getlogin'
14529 d_getmnt='$d_getmnt'
14530 d_getmntent='$d_getmntent'
14531 d_getnbyaddr='$d_getnbyaddr'
14532 d_getnbyname='$d_getnbyname'
14533 d_getnent='$d_getnent'
14534 d_getnetprotos='$d_getnetprotos'
14535 d_getpbyname='$d_getpbyname'
14536 d_getpbynumber='$d_getpbynumber'
14537 d_getpent='$d_getpent'
14538 d_getpgid='$d_getpgid'
14539 d_getpgrp2='$d_getpgrp2'
14540 d_getpgrp='$d_getpgrp'
14541 d_getppid='$d_getppid'
14542 d_getprior='$d_getprior'
14543 d_getprotoprotos='$d_getprotoprotos'
14544 d_getpwent='$d_getpwent'
14545 d_getsbyname='$d_getsbyname'
14546 d_getsbyport='$d_getsbyport'
14547 d_getsent='$d_getsent'
14548 d_getservprotos='$d_getservprotos'
14549 d_getspent='$d_getspent'
14550 d_getspnam='$d_getspnam'
14551 d_gettimeod='$d_gettimeod'
14552 d_gnulibc='$d_gnulibc'
14553 d_grpasswd='$d_grpasswd'
14554 d_hasmntopt='$d_hasmntopt'
14555 d_htonl='$d_htonl'
14556 d_index='$d_index'
14557 d_inetaton='$d_inetaton'
14558 d_int64t='$d_int64t'
14559 d_isascii='$d_isascii'
14560 d_killpg='$d_killpg'
14561 d_lchown='$d_lchown'
14562 d_ldbl_dig='$d_ldbl_dig'
14563 d_link='$d_link'
14564 d_locconv='$d_locconv'
14565 d_lockf='$d_lockf'
14566 d_longdbl='$d_longdbl'
14567 d_longlong='$d_longlong'
14568 d_lstat='$d_lstat'
14569 d_mblen='$d_mblen'
14570 d_mbstowcs='$d_mbstowcs'
14571 d_mbtowc='$d_mbtowc'
14572 d_memchr='$d_memchr'
14573 d_memcmp='$d_memcmp'
14574 d_memcpy='$d_memcpy'
14575 d_memmove='$d_memmove'
14576 d_memset='$d_memset'
14577 d_mkdir='$d_mkdir'
14578 d_mkfifo='$d_mkfifo'
14579 d_mktime='$d_mktime'
14580 d_msg='$d_msg'
14581 d_msg_ctrunc='$d_msg_ctrunc'
14582 d_msg_dontroute='$d_msg_dontroute'
14583 d_msg_oob='$d_msg_oob'
14584 d_msg_peek='$d_msg_peek'
14585 d_msg_proxy='$d_msg_proxy'
14586 d_msgctl='$d_msgctl'
14587 d_msgget='$d_msgget'
14588 d_msgrcv='$d_msgrcv'
14589 d_msgsnd='$d_msgsnd'
14590 d_mymalloc='$d_mymalloc'
14591 d_nice='$d_nice'
14592 d_nv_preserves_uv='$d_nv_preserves_uv'
14593 d_off64_t='$d_off64_t'
14594 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14595 d_oldpthreads='$d_oldpthreads'
14596 d_oldsock='$d_oldsock'
14597 d_open3='$d_open3'
14598 d_pathconf='$d_pathconf'
14599 d_pause='$d_pause'
14600 d_phostname='$d_phostname'
14601 d_pipe='$d_pipe'
14602 d_poll='$d_poll'
14603 d_portable='$d_portable'
14604 d_pthread_yield='$d_pthread_yield'
14605 d_pwage='$d_pwage'
14606 d_pwchange='$d_pwchange'
14607 d_pwclass='$d_pwclass'
14608 d_pwcomment='$d_pwcomment'
14609 d_pwexpire='$d_pwexpire'
14610 d_pwgecos='$d_pwgecos'
14611 d_pwpasswd='$d_pwpasswd'
14612 d_pwquota='$d_pwquota'
14613 d_quad='$d_quad'
14614 d_readdir='$d_readdir'
14615 d_readlink='$d_readlink'
14616 d_rename='$d_rename'
14617 d_rewinddir='$d_rewinddir'
14618 d_rmdir='$d_rmdir'
14619 d_safebcpy='$d_safebcpy'
14620 d_safemcpy='$d_safemcpy'
14621 d_sanemcmp='$d_sanemcmp'
14622 d_sched_yield='$d_sched_yield'
14623 d_scm_rights='$d_scm_rights'
14624 d_seekdir='$d_seekdir'
14625 d_select='$d_select'
14626 d_sem='$d_sem'
14627 d_semctl='$d_semctl'
14628 d_semctl_semid_ds='$d_semctl_semid_ds'
14629 d_semctl_semun='$d_semctl_semun'
14630 d_semget='$d_semget'
14631 d_semop='$d_semop'
14632 d_setegid='$d_setegid'
14633 d_seteuid='$d_seteuid'
14634 d_setgrent='$d_setgrent'
14635 d_setgrps='$d_setgrps'
14636 d_sethent='$d_sethent'
14637 d_setlinebuf='$d_setlinebuf'
14638 d_setlocale='$d_setlocale'
14639 d_setnent='$d_setnent'
14640 d_setpent='$d_setpent'
14641 d_setpgid='$d_setpgid'
14642 d_setpgrp2='$d_setpgrp2'
14643 d_setpgrp='$d_setpgrp'
14644 d_setprior='$d_setprior'
14645 d_setpwent='$d_setpwent'
14646 d_setregid='$d_setregid'
14647 d_setresgid='$d_setresgid'
14648 d_setresuid='$d_setresuid'
14649 d_setreuid='$d_setreuid'
14650 d_setrgid='$d_setrgid'
14651 d_setruid='$d_setruid'
14652 d_setsent='$d_setsent'
14653 d_setsid='$d_setsid'
14654 d_setspent='$d_setspent'
14655 d_setvbuf='$d_setvbuf'
14656 d_sfio='$d_sfio'
14657 d_shm='$d_shm'
14658 d_shmat='$d_shmat'
14659 d_shmatprototype='$d_shmatprototype'
14660 d_shmctl='$d_shmctl'
14661 d_shmdt='$d_shmdt'
14662 d_shmget='$d_shmget'
14663 d_sigaction='$d_sigaction'
14664 d_sigsetjmp='$d_sigsetjmp'
14665 d_socket='$d_socket'
14666 d_sockpair='$d_sockpair'
14667 d_sqrtl='$d_sqrtl'
14668 d_statblks='$d_statblks'
14669 d_statfs_f_flags='$d_statfs_f_flags'
14670 d_statfs_s='$d_statfs_s'
14671 d_statvfs='$d_statvfs'
14672 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14673 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14674 d_stdio_stream_array='$d_stdio_stream_array'
14675 d_stdiobase='$d_stdiobase'
14676 d_stdstdio='$d_stdstdio'
14677 d_strchr='$d_strchr'
14678 d_strcoll='$d_strcoll'
14679 d_strctcpy='$d_strctcpy'
14680 d_strerrm='$d_strerrm'
14681 d_strerror='$d_strerror'
14682 d_strtod='$d_strtod'
14683 d_strtol='$d_strtol'
14684 d_strtold='$d_strtold'
14685 d_strtoll='$d_strtoll'
14686 d_strtoul='$d_strtoul'
14687 d_strtoull='$d_strtoull'
14688 d_strtouq='$d_strtouq'
14689 d_strxfrm='$d_strxfrm'
14690 d_suidsafe='$d_suidsafe'
14691 d_symlink='$d_symlink'
14692 d_syscall='$d_syscall'
14693 d_sysconf='$d_sysconf'
14694 d_sysernlst='$d_sysernlst'
14695 d_syserrlst='$d_syserrlst'
14696 d_system='$d_system'
14697 d_tcgetpgrp='$d_tcgetpgrp'
14698 d_tcsetpgrp='$d_tcsetpgrp'
14699 d_telldir='$d_telldir'
14700 d_telldirproto='$d_telldirproto'
14701 d_time='$d_time'
14702 d_times='$d_times'
14703 d_truncate='$d_truncate'
14704 d_tzname='$d_tzname'
14705 d_umask='$d_umask'
14706 d_uname='$d_uname'
14707 d_union_semun='$d_union_semun'
14708 d_ustat='$d_ustat'
14709 d_vendorbin='$d_vendorbin'
14710 d_vendorlib='$d_vendorlib'
14711 d_vfork='$d_vfork'
14712 d_void_closedir='$d_void_closedir'
14713 d_voidsig='$d_voidsig'
14714 d_voidtty='$d_voidtty'
14715 d_volatile='$d_volatile'
14716 d_vprintf='$d_vprintf'
14717 d_wait4='$d_wait4'
14718 d_waitpid='$d_waitpid'
14719 d_wcstombs='$d_wcstombs'
14720 d_wctomb='$d_wctomb'
14721 d_xenix='$d_xenix'
14722 date='$date'
14723 db_hashtype='$db_hashtype'
14724 db_prefixtype='$db_prefixtype'
14725 defvoidused='$defvoidused'
14726 direntrytype='$direntrytype'
14727 dlext='$dlext'
14728 dlsrc='$dlsrc'
14729 doublesize='$doublesize'
14730 drand01='$drand01'
14731 dynamic_ext='$dynamic_ext'
14732 eagain='$eagain'
14733 ebcdic='$ebcdic'
14734 echo='$echo'
14735 egrep='$egrep'
14736 emacs='$emacs'
14737 eunicefix='$eunicefix'
14738 exe_ext='$exe_ext'
14739 expr='$expr'
14740 extensions='$extensions'
14741 fflushNULL='$fflushNULL'
14742 fflushall='$fflushall'
14743 find='$find'
14744 firstmakefile='$firstmakefile'
14745 flex='$flex'
14746 fpossize='$fpossize'
14747 fpostype='$fpostype'
14748 freetype='$freetype'
14749 full_ar='$full_ar'
14750 full_csh='$full_csh'
14751 full_sed='$full_sed'
14752 gccversion='$gccversion'
14753 gidformat='$gidformat'
14754 gidsign='$gidsign'
14755 gidsize='$gidsize'
14756 gidtype='$gidtype'
14757 glibpth='$glibpth'
14758 grep='$grep'
14759 groupcat='$groupcat'
14760 groupstype='$groupstype'
14761 gzip='$gzip'
14762 h_fcntl='$h_fcntl'
14763 h_sysfile='$h_sysfile'
14764 hint='$hint'
14765 hostcat='$hostcat'
14766 huge='$huge'
14767 i16size='$i16size'
14768 i16type='$i16type'
14769 i32size='$i32size'
14770 i32type='$i32type'
14771 i64size='$i64size'
14772 i64type='$i64type'
14773 i8size='$i8size'
14774 i8type='$i8type'
14775 i_arpainet='$i_arpainet'
14776 i_bsdioctl='$i_bsdioctl'
14777 i_db='$i_db'
14778 i_dbm='$i_dbm'
14779 i_dirent='$i_dirent'
14780 i_dld='$i_dld'
14781 i_dlfcn='$i_dlfcn'
14782 i_fcntl='$i_fcntl'
14783 i_float='$i_float'
14784 i_gdbm='$i_gdbm'
14785 i_grp='$i_grp'
14786 i_inttypes='$i_inttypes'
14787 i_limits='$i_limits'
14788 i_locale='$i_locale'
14789 i_machcthr='$i_machcthr'
14790 i_malloc='$i_malloc'
14791 i_math='$i_math'
14792 i_memory='$i_memory'
14793 i_mntent='$i_mntent'
14794 i_ndbm='$i_ndbm'
14795 i_netdb='$i_netdb'
14796 i_neterrno='$i_neterrno'
14797 i_netinettcp='$i_netinettcp'
14798 i_niin='$i_niin'
14799 i_poll='$i_poll'
14800 i_pthread='$i_pthread'
14801 i_pwd='$i_pwd'
14802 i_rpcsvcdbm='$i_rpcsvcdbm'
14803 i_sfio='$i_sfio'
14804 i_sgtty='$i_sgtty'
14805 i_shadow='$i_shadow'
14806 i_socks='$i_socks'
14807 i_stdarg='$i_stdarg'
14808 i_stddef='$i_stddef'
14809 i_stdlib='$i_stdlib'
14810 i_string='$i_string'
14811 i_sysaccess='$i_sysaccess'
14812 i_sysdir='$i_sysdir'
14813 i_sysfile='$i_sysfile'
14814 i_sysfilio='$i_sysfilio'
14815 i_sysin='$i_sysin'
14816 i_sysioctl='$i_sysioctl'
14817 i_sysmount='$i_sysmount'
14818 i_sysndir='$i_sysndir'
14819 i_sysparam='$i_sysparam'
14820 i_sysresrc='$i_sysresrc'
14821 i_syssecrt='$i_syssecrt'
14822 i_sysselct='$i_sysselct'
14823 i_syssockio='$i_syssockio'
14824 i_sysstat='$i_sysstat'
14825 i_sysstatfs='$i_sysstatfs'
14826 i_sysstatvfs='$i_sysstatvfs'
14827 i_systime='$i_systime'
14828 i_systimek='$i_systimek'
14829 i_systimes='$i_systimes'
14830 i_systypes='$i_systypes'
14831 i_sysuio='$i_sysuio'
14832 i_sysun='$i_sysun'
14833 i_sysvfs='$i_sysvfs'
14834 i_syswait='$i_syswait'
14835 i_termio='$i_termio'
14836 i_termios='$i_termios'
14837 i_time='$i_time'
14838 i_unistd='$i_unistd'
14839 i_ustat='$i_ustat'
14840 i_utime='$i_utime'
14841 i_values='$i_values'
14842 i_varargs='$i_varargs'
14843 i_varhdr='$i_varhdr'
14844 i_vfork='$i_vfork'
14845 ignore_versioned_solibs='$ignore_versioned_solibs'
14846 inc_version_list='$inc_version_list'
14847 inc_version_list_init='$inc_version_list_init'
14848 incpath='$incpath'
14849 inews='$inews'
14850 installarchlib='$installarchlib'
14851 installbin='$installbin'
14852 installman1dir='$installman1dir'
14853 installman3dir='$installman3dir'
14854 installprefix='$installprefix'
14855 installprefixexp='$installprefixexp'
14856 installprivlib='$installprivlib'
14857 installscript='$installscript'
14858 installsitearch='$installsitearch'
14859 installsitebin='$installsitebin'
14860 installsitelib='$installsitelib'
14861 installstyle='$installstyle'
14862 installusrbinperl='$installusrbinperl'
14863 installvendorbin='$installvendorbin'
14864 installvendorlib='$installvendorlib'
14865 intsize='$intsize'
14866 ivdformat='$ivdformat'
14867 ivsize='$ivsize'
14868 ivtype='$ivtype'
14869 known_extensions='$known_extensions'
14870 ksh='$ksh'
14871 large='$large'
14872 ld='$ld'
14873 lddlflags='$lddlflags'
14874 ldflags='$ldflags'
14875 ldlibpthname='$ldlibpthname'
14876 less='$less'
14877 lib_ext='$lib_ext'
14878 libc='$libc'
14879 libperl='$libperl'
14880 libpth='$libpth'
14881 libs='$libs'
14882 libswanted='$libswanted'
14883 line='$line'
14884 lint='$lint'
14885 lkflags='$lkflags'
14886 ln='$ln'
14887 lns='$lns'
14888 locincpth='$locincpth'
14889 loclibpth='$loclibpth'
14890 longdblsize='$longdblsize'
14891 longlongsize='$longlongsize'
14892 longsize='$longsize'
14893 lp='$lp'
14894 lpr='$lpr'
14895 ls='$ls'
14896 lseeksize='$lseeksize'
14897 lseektype='$lseektype'
14898 mail='$mail'
14899 mailx='$mailx'
14900 make='$make'
14901 make_set_make='$make_set_make'
14902 mallocobj='$mallocobj'
14903 mallocsrc='$mallocsrc'
14904 malloctype='$malloctype'
14905 man1dir='$man1dir'
14906 man1direxp='$man1direxp'
14907 man1ext='$man1ext'
14908 man3dir='$man3dir'
14909 man3direxp='$man3direxp'
14910 man3ext='$man3ext'
14911 medium='$medium'
14912 mips_type='$mips_type'
14913 mkdir='$mkdir'
14914 models='$models'
14915 modetype='$modetype'
14916 more='$more'
14917 multiarch='$multiarch'
14918 mv='$mv'
14919 myarchname='$myarchname'
14920 mydomain='$mydomain'
14921 myhostname='$myhostname'
14922 myuname='$myuname'
14923 n='$n'
14924 netdb_hlen_type='$netdb_hlen_type'
14925 netdb_host_type='$netdb_host_type'
14926 netdb_name_type='$netdb_name_type'
14927 netdb_net_type='$netdb_net_type'
14928 nm='$nm'
14929 nm_opt='$nm_opt'
14930 nm_so_opt='$nm_so_opt'
14931 nonxs_ext='$nonxs_ext'
14932 nroff='$nroff'
14933 nvsize='$nvsize'
14934 nvtype='$nvtype'
14935 o_nonblock='$o_nonblock'
14936 obj_ext='$obj_ext'
14937 old_pthread_create_joinable='$old_pthread_create_joinable'
14938 optimize='$optimize'
14939 orderlib='$orderlib'
14940 osname='$osname'
14941 osvers='$osvers'
14942 package='$package'
14943 pager='$pager'
14944 passcat='$passcat'
14945 patchlevel='$patchlevel'
14946 path_sep='$path_sep'
14947 perl='$perl'
14948 perladmin='$perladmin'
14949 perlpath='$perlpath'
14950 pg='$pg'
14951 phostname='$phostname'
14952 pidtype='$pidtype'
14953 plibpth='$plibpth'
14954 pmake='$pmake'
14955 pr='$pr'
14956 prefix='$prefix'
14957 prefixexp='$prefixexp'
14958 privlib='$privlib'
14959 privlibexp='$privlibexp'
14960 prototype='$prototype'
14961 ptrsize='$ptrsize'
14962 quadkind='$quadkind'
14963 quadtype='$quadtype'
14964 randbits='$randbits'
14965 randfunc='$randfunc'
14966 randseedtype='$randseedtype'
14967 ranlib='$ranlib'
14968 rd_nodata='$rd_nodata'
14969 rm='$rm'
14970 rmail='$rmail'
14971 runnm='$runnm'
14972 sPRIEldbl='$sPRIEldbl'
14973 sPRIFldbl='$sPRIFldbl'
14974 sPRIGldbl='$sPRIGldbl'
14975 sPRIX64='$sPRIX64'
14976 sPRId64='$sPRId64'
14977 sPRIeldbl='$sPRIeldbl'
14978 sPRIfldbl='$sPRIfldbl'
14979 sPRIgldbl='$sPRIgldbl'
14980 sPRIi64='$sPRIi64'
14981 sPRIo64='$sPRIo64'
14982 sPRIu64='$sPRIu64'
14983 sPRIx64='$sPRIx64'
14984 sched_yield='$sched_yield'
14985 scriptdir='$scriptdir'
14986 scriptdirexp='$scriptdirexp'
14987 sed='$sed'
14988 seedfunc='$seedfunc'
14989 selectminbits='$selectminbits'
14990 selecttype='$selecttype'
14991 sendmail='$sendmail'
14992 sh='$sh'
14993 shar='$shar'
14994 sharpbang='$sharpbang'
14995 shmattype='$shmattype'
14996 shortsize='$shortsize'
14997 shrpenv='$shrpenv'
14998 shsharp='$shsharp'
14999 sig_count='$sig_count'
15000 sig_name='$sig_name'
15001 sig_name_init='$sig_name_init'
15002 sig_num='$sig_num'
15003 sig_num_init='$sig_num_init'
15004 signal_t='$signal_t'
15005 sitearch='$sitearch'
15006 sitearchexp='$sitearchexp'
15007 sitebin='$sitebin'
15008 sitebinexp='$sitebinexp'
15009 sitelib='$sitelib'
15010 sitelibexp='$sitelibexp'
15011 siteprefix='$siteprefix'
15012 siteprefixexp='$siteprefixexp'
15013 sizetype='$sizetype'
15014 sleep='$sleep'
15015 smail='$smail'
15016 small='$small'
15017 so='$so'
15018 sockethdr='$sockethdr'
15019 socketlib='$socketlib'
15020 sort='$sort'
15021 spackage='$spackage'
15022 spitshell='$spitshell'
15023 split='$split'
15024 src='$src'
15025 ssizetype='$ssizetype'
15026 startperl='$startperl'
15027 startsh='$startsh'
15028 static_ext='$static_ext'
15029 stdchar='$stdchar'
15030 stdio_base='$stdio_base'
15031 stdio_bufsiz='$stdio_bufsiz'
15032 stdio_cnt='$stdio_cnt'
15033 stdio_filbuf='$stdio_filbuf'
15034 stdio_ptr='$stdio_ptr'
15035 stdio_stream_array='$stdio_stream_array'
15036 strings='$strings'
15037 submit='$submit'
15038 subversion='$subversion'
15039 sysman='$sysman'
15040 tail='$tail'
15041 tar='$tar'
15042 tbl='$tbl'
15043 tee='$tee'
15044 test='$test'
15045 timeincl='$timeincl'
15046 timetype='$timetype'
15047 touch='$touch'
15048 tr='$tr'
15049 trnl='$trnl'
15050 troff='$troff'
15051 u16size='$u16size'
15052 u16type='$u16type'
15053 u32size='$u32size'
15054 u32type='$u32type'
15055 u64size='$u64size'
15056 u64type='$u64type'
15057 u8size='$u8size'
15058 u8type='$u8type'
15059 uidformat='$uidformat'
15060 uidsign='$uidsign'
15061 uidsize='$uidsize'
15062 uidtype='$uidtype'
15063 uname='$uname'
15064 uniq='$uniq'
15065 uquadtype='$uquadtype'
15066 use5005threads='$use5005threads'
15067 use64bits='$use64bits'
15068 usedl='$usedl'
15069 useithreads='$useithreads'
15070 uselargefiles='$uselargefiles'
15071 uselongdouble='$uselongdouble'
15072 uselonglong='$uselonglong'
15073 usemorebits='$usemorebits'
15074 usemultiplicity='$usemultiplicity'
15075 usemymalloc='$usemymalloc'
15076 usenm='$usenm'
15077 useopcode='$useopcode'
15078 useperlio='$useperlio'
15079 useposix='$useposix'
15080 usesfio='$usesfio'
15081 useshrplib='$useshrplib'
15082 usesocks='$usesocks'
15083 usethreads='$usethreads'
15084 usevendorprefix='$usevendorprefix'
15085 usevfork='$usevfork'
15086 usrinc='$usrinc'
15087 uuname='$uuname'
15088 uvoformat='$uvoformat'
15089 uvsize='$uvsize'
15090 uvtype='$uvtype'
15091 uvuformat='$uvuformat'
15092 uvxformat='$uvxformat'
15093 vendorbin='$vendorbin'
15094 vendorbinexp='$vendorbinexp'
15095 vendorlib='$vendorlib'
15096 vendorlibexp='$vendorlibexp'
15097 vendorprefix='$vendorprefix'
15098 vendorprefixexp='$vendorprefixexp'
15099 version='$version'
15100 vi='$vi'
15101 voidflags='$voidflags'
15102 xlibpth='$xlibpth'
15103 zcat='$zcat'
15104 zip='$zip'
15105 EOT
15106
15107 : Add in command line options if available
15108 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15109
15110 : add special variables
15111 $test -f $src/patchlevel.h && \
15112 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15113 echo "CONFIGDOTSH=true" >>config.sh
15114
15115 : propagate old symbols
15116 if $test -f UU/config.sh; then
15117         <UU/config.sh sort | uniq >UU/oldconfig.sh
15118         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15119         sort | uniq -u >UU/oldsyms
15120         set X `cat UU/oldsyms`
15121         shift
15122         case $# in
15123         0) ;;
15124         *)
15125                 cat <<EOM
15126 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15127 EOM
15128                 echo "# Variables propagated from previous config.sh file." >>config.sh
15129                 for sym in `cat UU/oldsyms`; do
15130                         echo "    Propagating $hint variable "'$'"$sym..."
15131                         eval 'tmp="$'"${sym}"'"'
15132                         echo "$tmp" | \
15133                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15134                 done
15135                 ;;
15136         esac
15137 fi
15138
15139 : Finish up by extracting the .SH files
15140 case "$alldone" in
15141 exit)
15142         $rm -rf UU
15143         echo "Done."
15144         exit 0
15145         ;;
15146 cont)
15147         ;;
15148 '')
15149         dflt=''
15150         nostick=true
15151         $cat <<EOM
15152
15153 If you'd like to make any changes to the config.sh file before I begin
15154 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15155
15156 EOM
15157         rp="Press return or use a shell escape to edit config.sh:"
15158         . UU/myread
15159         nostick=''
15160         case "$ans" in
15161         '') ;;
15162         *) : in case they cannot read
15163                 sh 1>&4 -c "$ans";;
15164         esac
15165         ;;
15166 esac
15167
15168 : if this fails, just run all the .SH files by hand
15169 . ./config.sh
15170
15171 echo " "
15172 exec 1>&4
15173 . ./UU/extract
15174
15175 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15176         dflt=y
15177         case "$silent" in
15178         true) ;;
15179         *)
15180                 $cat <<EOM
15181
15182 Now you need to generate make dependencies by running "$make depend".
15183 You might prefer to run it in background: "$make depend > makedepend.out &"
15184 It can take a while, so you might not want to run it right now.
15185
15186 EOM
15187                 ;;
15188         esac
15189         rp="Run $make depend now?"
15190         . UU/myread
15191         case "$ans" in
15192         y*)
15193                 $make depend && echo "Now you must run a $make."
15194                 ;;
15195         *)
15196                 echo "You must run '$make depend' then '$make'."
15197                 ;;
15198         esac
15199 elif test -f [Mm]akefile; then
15200         echo " "
15201         echo "Now you must run a $make."
15202 else
15203         echo "Done."
15204 fi
15205
15206 if $test -f Policy.sh; then
15207     $cat <<EOM
15208
15209 If you compile $package on a different machine or from a different object
15210 directory, copy the Policy.sh file from this object directory to the
15211 new one before you run Configure -- this will help you with most of
15212 the policy defaults.
15213
15214 EOM
15215 fi
15216 if $test -f config.msg; then
15217     echo "Hmm.  I also noted the following information while running:"
15218     echo " "
15219     $cat config.msg >&4
15220     $rm -f config.msg
15221 fi
15222 $rm -f kit*isdone ark*isdone
15223 $rm -rf UU
15224
15225 : End of Configure
15226