Allow option to treat barewords at start of Unix paths as simple words rather than...
[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 Sun Aug  1 00:18:49 EET DST 1999 [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 baserev=''
282 bin=''
283 binexp=''
284 installbin=''
285 bincompat5005=''
286 d_bincompat5005=''
287 byteorder=''
288 cc=''
289 gccversion=''
290 ccflags=''
291 cppflags=''
292 ldflags=''
293 lkflags=''
294 locincpth=''
295 optimize=''
296 cf_email=''
297 cf_by=''
298 cf_time=''
299 contains=''
300 cpp_stuff=''
301 cpplast=''
302 cppminus=''
303 cpprun=''
304 cppstdin=''
305 crosscompile=''
306 d_access=''
307 d_accessx=''
308 d_alarm=''
309 d_attribut=''
310 d_bcmp=''
311 d_bcopy=''
312 d_bzero=''
313 d_casti32=''
314 castflags=''
315 d_castneg=''
316 d_chown=''
317 d_chroot=''
318 d_chsize=''
319 d_closedir=''
320 d_void_closedir=''
321 d_const=''
322 cryptlib=''
323 d_crypt=''
324 d_csh=''
325 full_csh=''
326 d_cuserid=''
327 d_dbl_dig=''
328 d_difftime=''
329 d_dlerror=''
330 d_dlopen=''
331 d_dlsymun=''
332 d_dosuid=''
333 d_suidsafe=''
334 d_drand48proto=''
335 d_dup2=''
336 d_eaccess=''
337 d_endgrent=''
338 d_endhent=''
339 d_endnent=''
340 d_endpent=''
341 d_endpwent=''
342 d_endsent=''
343 d_endspent=''
344 d_fchmod=''
345 d_fchown=''
346 d_fcntl=''
347 d_fd_macros=''
348 d_fd_set=''
349 d_fds_bits=''
350 d_fgetpos=''
351 d_flexfnam=''
352 d_flock=''
353 d_fork=''
354 d_fseeko=''
355 d_fsetpos=''
356 d_ftello=''
357 d_ftime=''
358 d_gettimeod=''
359 d_Gconvert=''
360 d_getgrent=''
361 d_getgrps=''
362 d_gethbyaddr=''
363 d_gethbyname=''
364 d_gethent=''
365 aphostname=''
366 d_gethname=''
367 d_phostname=''
368 d_uname=''
369 d_gethostprotos=''
370 d_getlogin=''
371 d_getmntent=''
372 d_getnbyaddr=''
373 d_getnbyname=''
374 d_getnent=''
375 d_getnetprotos=''
376 d_getpent=''
377 d_getpgid=''
378 d_getpgrp2=''
379 d_bsdgetpgrp=''
380 d_getpgrp=''
381 d_getppid=''
382 d_getprior=''
383 d_getpbyname=''
384 d_getpbynumber=''
385 d_getprotoprotos=''
386 d_getpwent=''
387 d_getsent=''
388 d_getservprotos=''
389 d_getspent=''
390 d_getspnam=''
391 d_getsbyname=''
392 d_getsbyport=''
393 d_gnulibc=''
394 d_hasmntopt=''
395 d_htonl=''
396 d_inetaton=''
397 d_isascii=''
398 d_killpg=''
399 d_lchown=''
400 d_link=''
401 d_locconv=''
402 d_lockf=''
403 d_longdbl=''
404 longdblsize=''
405 d_longlong=''
406 longlongsize=''
407 d_lstat=''
408 d_madvise=''
409 d_mblen=''
410 d_mbstowcs=''
411 d_mbtowc=''
412 d_memchr=''
413 d_memcmp=''
414 d_memcpy=''
415 d_memmove=''
416 d_memset=''
417 d_mkdir=''
418 d_mkfifo=''
419 d_mktime=''
420 d_mmap=''
421 mmaptype=''
422 d_mprotect=''
423 d_msg=''
424 d_msgctl=''
425 d_msgget=''
426 d_msgrcv=''
427 d_msgsnd=''
428 d_msync=''
429 d_munmap=''
430 d_nice=''
431 d_open3=''
432 d_fpathconf=''
433 d_pathconf=''
434 d_pause=''
435 d_pipe=''
436 d_poll=''
437 d_portable=''
438 d_old_pthread_create_joinable=''
439 old_pthread_create_joinable=''
440 d_pthread_yield=''
441 d_sched_yield=''
442 sched_yield=''
443 d_readdir=''
444 d_rewinddir=''
445 d_seekdir=''
446 d_telldir=''
447 d_readlink=''
448 d_readv=''
449 d_rename=''
450 d_rmdir=''
451 d_safebcpy=''
452 d_safemcpy=''
453 d_sanemcmp=''
454 d_select=''
455 d_sem=''
456 d_semctl=''
457 d_semget=''
458 d_semop=''
459 d_setegid=''
460 d_seteuid=''
461 d_setgrent=''
462 d_setgrps=''
463 d_sethent=''
464 d_setlinebuf=''
465 d_setlocale=''
466 d_setnent=''
467 d_setpent=''
468 d_setpgid=''
469 d_setpgrp2=''
470 d_bsdsetpgrp=''
471 d_setpgrp=''
472 d_setprior=''
473 d_setpwent=''
474 d_setregid=''
475 d_setresgid=''
476 d_setresuid=''
477 d_setreuid=''
478 d_setrgid=''
479 d_setruid=''
480 d_setsent=''
481 d_setsid=''
482 d_setspent=''
483 d_setvbuf=''
484 d_sfio=''
485 usesfio=''
486 d_shm=''
487 d_shmat=''
488 d_shmatprototype=''
489 shmattype=''
490 d_shmctl=''
491 d_shmdt=''
492 d_shmget=''
493 d_sigaction=''
494 d_sigsetjmp=''
495 d_cmsghdr_s=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_msghdr_s=''
502 d_oldsock=''
503 d_recvmsg=''
504 d_scm_rights=''
505 d_sendmsg=''
506 d_socket=''
507 d_sockpair=''
508 sockethdr=''
509 socketlib=''
510 d_statblks=''
511 d_fstatfs=''
512 d_statfs=''
513 d_statfsflags=''
514 d_fstatvfs=''
515 d_statvfs=''
516 d_stdio_cnt_lval=''
517 d_stdio_ptr_lval=''
518 d_stdiobase=''
519 d_stdstdio=''
520 stdio_base=''
521 stdio_bufsiz=''
522 stdio_cnt=''
523 stdio_filbuf=''
524 stdio_ptr=''
525 d_index=''
526 d_strchr=''
527 d_strcoll=''
528 d_strctcpy=''
529 d_strerrm=''
530 d_strerror=''
531 d_sysernlst=''
532 d_syserrlst=''
533 d_strtod=''
534 d_strtol=''
535 d_strtoul=''
536 d_strxfrm=''
537 d_symlink=''
538 d_syscall=''
539 d_sysconf=''
540 d_system=''
541 d_tcgetpgrp=''
542 d_tcsetpgrp=''
543 d_telldirproto=''
544 d_time=''
545 timetype=''
546 clocktype=''
547 d_times=''
548 d_truncate=''
549 d_tzname=''
550 d_umask=''
551 d_semctl_semid_ds=''
552 d_semctl_semun=''
553 d_union_semun=''
554 d_vfork=''
555 usevfork=''
556 d_voidsig=''
557 signal_t=''
558 d_volatile=''
559 d_charvspr=''
560 d_vprintf=''
561 d_wait4=''
562 d_waitpid=''
563 d_wcstombs=''
564 d_wctomb=''
565 d_writev=''
566 d_dbmclose64=''
567 d_dbminit64=''
568 d_delete64=''
569 d_fetch64=''
570 d_firstkey64=''
571 d_nextkey64=''
572 d_store64=''
573 dlext=''
574 cccdlflags=''
575 ccdlflags=''
576 dlsrc=''
577 ld=''
578 lddlflags=''
579 usedl=''
580 doublesize=''
581 ebcdic=''
582 fflushNULL=''
583 fflushall=''
584 fpostype=''
585 gidtype=''
586 groupstype=''
587 h_fcntl=''
588 h_sysfile=''
589 i_arpainet=''
590 db_hashtype=''
591 db_prefixtype=''
592 i_db=''
593 i_dbm=''
594 i_rpcsvcdbm=''
595 d_dirnamlen=''
596 direntrytype=''
597 i_dirent=''
598 i_dld=''
599 i_dlfcn=''
600 i_fcntl=''
601 i_float=''
602 i_gdbm=''
603 d_grpasswd=''
604 i_grp=''
605 d_int64t=''
606 i_inttypes=''
607 i_limits=''
608 i_locale=''
609 i_machcthr=''
610 i_malloc=''
611 i_math=''
612 i_memory=''
613 i_mntent=''
614 i_ndbm=''
615 i_netdb=''
616 i_neterrno=''
617 i_netinettcp=''
618 i_niin=''
619 i_sysin=''
620 i_poll=''
621 i_pthread=''
622 d_pwage=''
623 d_pwchange=''
624 d_pwclass=''
625 d_pwcomment=''
626 d_pwexpire=''
627 d_pwgecos=''
628 d_pwpasswd=''
629 d_pwquota=''
630 i_pwd=''
631 i_sfio=''
632 i_shadow=''
633 i_socks=''
634 i_stddef=''
635 i_stdlib=''
636 i_string=''
637 strings=''
638 i_sysaccess=''
639 i_sysdir=''
640 i_sysfile=''
641 d_voidtty=''
642 i_bsdioctl=''
643 i_sysfilio=''
644 i_sysioctl=''
645 i_syssockio=''
646 i_sysmman=''
647 i_sysmount=''
648 i_sysndir=''
649 i_sysparam=''
650 i_sysresrc=''
651 i_syssecrt=''
652 i_sysselct=''
653 i_sysstat=''
654 i_sysstatvfs=''
655 i_systimes=''
656 i_systypes=''
657 d_iovec_s=''
658 i_sysuio=''
659 i_sysun=''
660 i_syswait=''
661 i_sgtty=''
662 i_termio=''
663 i_termios=''
664 i_systime=''
665 i_systimek=''
666 i_time=''
667 timeincl=''
668 i_unistd=''
669 i_utime=''
670 i_values=''
671 i_stdarg=''
672 i_varargs=''
673 i_varhdr=''
674 i_vfork=''
675 installprefix=''
676 installprefixexp=''
677 installstyle=''
678 installusrbinperl=''
679 intsize=''
680 longsize=''
681 shortsize=''
682 d_dirent64_s=''
683 d_flock64_s=''
684 d_fstat64=''
685 d_ftruncate64=''
686 d_ino64_t=''
687 d_llseek=''
688 d_lockf64=''
689 d_lseek64=''
690 d_lstat64=''
691 d_off64_t=''
692 d_offset_t=''
693 d_open64=''
694 d_opendir64=''
695 d_readdir64=''
696 d_seekdir64=''
697 d_stat64=''
698 d_telldir64=''
699 d_truncate64=''
700 libc=''
701 ldlibpthname=''
702 libperl=''
703 shrpenv=''
704 useshrplib=''
705 glibpth=''
706 libpth=''
707 loclibpth=''
708 plibpth=''
709 xlibpth=''
710 ignore_versioned_solibs=''
711 libs=''
712 lns=''
713 lseeksize=''
714 lseektype=''
715 make_set_make=''
716 d_mymalloc=''
717 freetype=''
718 mallocobj=''
719 mallocsrc=''
720 malloctype=''
721 usemymalloc=''
722 installman1dir=''
723 man1dir=''
724 man1direxp=''
725 man1ext=''
726 installman3dir=''
727 man3dir=''
728 man3direxp=''
729 man3ext=''
730 huge=''
731 large=''
732 medium=''
733 models=''
734 small=''
735 split=''
736 modetype=''
737 multiarch=''
738 mydomain=''
739 myhostname=''
740 phostname=''
741 c=''
742 n=''
743 d_eofnblk=''
744 eagain=''
745 o_nonblock=''
746 rd_nodata=''
747 netdb_hlen_type=''
748 netdb_host_type=''
749 netdb_name_type=''
750 netdb_net_type=''
751 groupcat=''
752 hostcat=''
753 passcat=''
754 orderlib=''
755 ranlib=''
756 package=''
757 spackage=''
758 pager=''
759 apiversion=''
760 patchlevel=''
761 subversion=''
762 version=''
763 perladmin=''
764 perlpath=''
765 pidtype=''
766 prefix=''
767 prefixexp=''
768 installprivlib=''
769 privlib=''
770 privlibexp=''
771 prototype=''
772 ptrsize=''
773 drand01=''
774 randbits=''
775 randfunc=''
776 randseedtype=''
777 seedfunc=''
778 installscript=''
779 scriptdir=''
780 scriptdirexp=''
781 selectminbits=''
782 selecttype=''
783 sh=''
784 sig_count=''
785 sig_name=''
786 sig_name_init=''
787 sig_num=''
788 sig_num_init=''
789 installsitearch=''
790 sitearch=''
791 sitearchexp=''
792 installsitelib=''
793 sitelib=''
794 sitelibexp=''
795 siteprefix=''
796 siteprefixexp=''
797 sizetype=''
798 so=''
799 sharpbang=''
800 shsharp=''
801 spitshell=''
802 src=''
803 ssizetype=''
804 startperl=''
805 startsh=''
806 stdchar=''
807 d_fgetpos64=''
808 d_fopen64=''
809 d_freopen64=''
810 d_fseek64=''
811 d_fseeko64=''
812 d_fsetpos64=''
813 d_ftell64=''
814 d_ftello64=''
815 d_tmpfile64=''
816 d_stdio_stream_array=''
817 stdio_stream_array=''
818 sysman=''
819 trnl=''
820 uidtype=''
821 archname64=''
822 use64bits=''
823 usemultiplicity=''
824 nm_opt=''
825 nm_so_opt=''
826 runnm=''
827 usenm=''
828 useperlio=''
829 usesocks=''
830 d_oldpthreads=''
831 usethreads=''
832 incpath=''
833 mips=''
834 mips_type=''
835 usrinc=''
836 d_vendorlib=''
837 installvendorlib=''
838 vendorlib=''
839 vendorlibexp=''
840 usevendorprefix=''
841 vendorprefix=''
842 vendorprefixexp=''
843 defvoidused=''
844 voidflags=''
845 CONFIG=''
846
847 define='define'
848 undef='undef'
849 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
850 rmlist=''
851
852 : We must find out about Eunice early
853 eunicefix=':'
854 if test -f /etc/unixtovms; then
855         eunicefix=/etc/unixtovms
856 fi
857 if test -f /etc/unixtovms.exe; then
858         eunicefix=/etc/unixtovms.exe
859 fi
860
861 i_whoami=''
862 : Possible local include directories to search.
863 : Set locincpth to "" in a hint file to defeat local include searches.
864 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
865 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
866 :
867 : no include file wanted by default
868 inclwanted=''
869
870 : list of known cpp symbols, sorted alphabetically
871 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
872 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
873 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
874 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
875 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
876 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
877 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
878 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
879 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
880 al="$al VMS Xenix286"
881 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
882 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
883 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
884 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
885 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
886 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
887 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
888 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
889 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
890 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
891 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
892 al="$al __SVR4_2__ __UMAXV__"
893 al="$al ____386BSD____ __alpha __alpha__ __amiga"
894 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
895 al="$al __host_mips__"
896 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
897 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
898 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
899 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
900 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
901 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
902 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
903 al="$al __mc88100 __mc88100__ __mips __mips__"
904 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
905 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
906 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
907 al="$al _host_mips _mips _unix"
908 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
909 al="$al apollo ardent att386 att3b"
910 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
911 al="$al cadmus clipper concurrent convex cray ctix"
912 al="$al dmert encore gcos gcx gimpel gould"
913 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
914 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
915 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
916 al="$al i186 i286 i386 i486 i8086"
917 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
918 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
919 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
920 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
921 al="$al mc88000 mc88100 merlin mert mips mvs n16"
922 al="$al ncl_el ncl_mr"
923 al="$al news1500 news1700 news1800 news1900 news3700"
924 al="$al news700 news800 news900 ns16000 ns32000"
925 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
926 al="$al parisc pc532 pdp11 plexus posix pyr"
927 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
928 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
929 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
930 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
931 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
932 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
933 al="$al xenix z8000"
934
935 : Trailing extension.  Override this in a hint file, if needed.
936 _exe=''
937 : Extra object files, if any, needed on this platform.
938 archobjs=''
939 groupstype=''
940 : change the next line if compiling for Xenix/286 on Xenix/386
941 xlibpth='/usr/lib/386 /lib/386'
942
943 : Possible local library directories to search.
944 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
945 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
946
947 : general looking path for locating libraries
948 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
949 glibpth="$glibpth /lib /usr/lib $xlibpth"
950 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
951 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
952
953 : Private path used by Configure to find libraries.  Its value
954 : is prepended to libpth. This variable takes care of special
955 : machines, like the mips.  Usually, it should be empty.
956 plibpth=''
957
958 : default library list
959 libswanted=''
960 : some systems want to use only the non-versioned libso:s
961 ignore_versioned_solibs=''
962 : full support for void wanted by default
963 defvoidused=15
964
965 : set useposix=false in your hint file to disable the POSIX extension.
966 useposix=true
967 : set useopcode=false in your hint file to disable the Opcode extension.
968 useopcode=true
969 : set usemultiplicity on the Configure command line to enable multiplicity.
970 : set usesocks on the Configure command line to enable socks.
971 : set usethreads on the Configure command line to enable threads.
972 : List of libraries we want.
973 : If anyone needs -lnet, put it in a hint file.
974 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
975 libswanted="$libswanted dld ld sun m rt c cposix posix"
976 libswanted="$libswanted ndir dir crypt sec"
977 libswanted="$libswanted ucb bsd BSD PW x"
978 : We probably want to search /usr/shlib before most other libraries.
979 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
980 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
981 glibpth="/usr/shlib $glibpth"
982 : Do not use vfork unless overridden by a hint file.
983 usevfork=false
984
985 : Find the basic shell for Bourne shell scripts
986 case "$sh" in
987 '')
988         case "$SYSTYPE" in
989         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
990         *) xxx='/bin/sh';;
991         esac
992         if test -f "$xxx"; then
993                 sh="$xxx"
994         else
995                 : Build up a list and do a single loop so we can 'break' out.
996                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
997                 for xxx in sh bash ksh pdksh ash; do
998                         for p in $pth; do
999                                 try="$try ${p}/${xxx}"
1000                         done
1001                 done
1002                 for xxx in $try; do
1003                         if test -f "$xxx"; then
1004                                 sh="$xxx";
1005                                 break
1006                         elif test -f "$xxx.exe"; then
1007                                 sh="$xxx";
1008                                 break
1009                         fi
1010                 done
1011         fi
1012         ;;
1013 esac
1014
1015 case "$sh" in
1016 '')     cat <<EOM >&2
1017 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1018
1019 Usually it's in /bin/sh.  How did you even get this far?
1020 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1021 we'll try to straighten this all out.
1022 EOM
1023         exit 1
1024         ;;
1025 esac
1026
1027 : see if sh knows # comments
1028 if `$sh -c '#' >/dev/null 2>&1`; then
1029         shsharp=true
1030         spitshell=cat
1031         xcat=/bin/cat
1032         test -f $xcat || xcat=/usr/bin/cat
1033         echo "#!$xcat" >try
1034         $eunicefix try
1035         chmod +x try
1036         ./try > today
1037         if test -s today; then
1038                 sharpbang='#!'
1039         else
1040                 echo "#! $xcat" > try
1041                 $eunicefix try
1042                 chmod +x try
1043                 ./try > today
1044                 if test -s today; then
1045                         sharpbang='#! '
1046                 else
1047                         sharpbang=': use '
1048                 fi
1049         fi
1050 else
1051         echo " "
1052         echo "Your $sh doesn't grok # comments--I will strip them later on."
1053         shsharp=false
1054         cd ..
1055         echo "exec grep -v '^[  ]*#'" >spitshell
1056         chmod +x spitshell
1057         $eunicefix spitshell
1058         spitshell=`pwd`/spitshell
1059         cd UU
1060         echo "I presume that if # doesn't work, #! won't work either!"
1061         sharpbang=': use '
1062 fi
1063 rm -f try today
1064
1065 : figure out how to guarantee sh startup
1066 case "$startsh" in
1067 '') startsh=${sharpbang}${sh} ;;
1068 *)
1069 esac
1070 cat >try <<EOSS
1071 $startsh
1072 set abc
1073 test "$?abc" != 1
1074 EOSS
1075
1076 chmod +x try
1077 $eunicefix try
1078 if ./try; then
1079         : echo "Yup, it does."
1080 else
1081         echo "Hmm... '$startsh' does not guarantee sh startup..."
1082         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1083 fi
1084 rm -f try
1085
1086
1087 : Save command line options in file UU/cmdline.opt for later use in
1088 : generating config.sh.
1089 cat > cmdline.opt <<EOSH
1090 # Configure command line arguments.
1091 config_arg0='$0'
1092 config_args='$*'
1093 config_argc=$#
1094 EOSH
1095 argn=1
1096 for arg in "$@"; do
1097         cat >>cmdline.opt <<EOSH
1098 config_arg$argn='$arg'
1099 EOSH
1100         argn=`expr $argn + 1`
1101 done
1102
1103 : produce awk script to parse command line options
1104 cat >options.awk <<'EOF'
1105 BEGIN {
1106         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1107
1108         len = length(optstr);
1109         for (i = 1; i <= len; i++) {
1110                 c = substr(optstr, i, 1);
1111                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1112                 if (a == ":") {
1113                         arg[c] = 1;
1114                         i++;
1115                 }
1116                 opt[c] = 1;
1117         }
1118 }
1119 {
1120         expect = 0;
1121         str = $0;
1122         if (substr(str, 1, 1) != "-") {
1123                 printf("'%s'\n", str);
1124                 next;
1125         }
1126         len = length($0);
1127         for (i = 2; i <= len; i++) {
1128                 c = substr(str, i, 1);
1129                 if (!opt[c]) {
1130                         printf("-%s\n", substr(str, i));
1131                         next;
1132                 }
1133                 printf("-%s\n", c);
1134                 if (arg[c]) {
1135                         if (i < len)
1136                                 printf("'%s'\n", substr(str, i + 1));
1137                         else
1138                                 expect = 1;
1139                         next;
1140                 }
1141         }
1142 }
1143 END {
1144         if (expect)
1145                 print "?";
1146 }
1147 EOF
1148
1149 : process the command line options
1150 set X `for arg in "$@"; do echo "X$arg"; done |
1151         sed -e s/X// | awk -f options.awk`
1152 eval "set $*"
1153 shift
1154 rm -f options.awk
1155
1156 : set up default values
1157 fastread=''
1158 reuseval=false
1159 config_sh=''
1160 alldone=''
1161 error=''
1162 silent=''
1163 extractsh=''
1164 override=''
1165 knowitall=''
1166 rm -f optdef.sh
1167 cat >optdef.sh <<EOS
1168 $startsh
1169 EOS
1170
1171
1172 : option parsing
1173 while test $# -gt 0; do
1174         case "$1" in
1175         -d) shift; fastread=yes;;
1176         -e) shift; alldone=cont;;
1177         -f)
1178                 shift
1179                 cd ..
1180                 if test -r "$1"; then
1181                         config_sh="$1"
1182                 else
1183                         echo "$me: cannot read config file $1." >&2
1184                         error=true
1185                 fi
1186                 cd UU
1187                 shift;;
1188         -h) shift; error=true;;
1189         -r) shift; reuseval=true;;
1190         -s) shift; silent=true; realsilent=true;;
1191         -E) shift; alldone=exit;;
1192         -K) shift; knowitall=true;;
1193         -O) shift; override=true;;
1194         -S) shift; silent=true; extractsh=true;;
1195         -D)
1196                 shift
1197                 case "$1" in
1198                 *=)
1199                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1200                         echo "$me: ignoring -D $1" >&2
1201                         ;;
1202                 *=*) echo "$1" | \
1203                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1204                 *) echo "$1='define'" >> optdef.sh;;
1205                 esac
1206                 shift
1207                 ;;
1208         -U)
1209                 shift
1210                 case "$1" in
1211                 *=) echo "$1" >> optdef.sh;;
1212                 *=*)
1213                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1214                         echo "$me: ignoring -U $1" >&2
1215                         ;;
1216                 *) echo "$1='undef'" >> optdef.sh;;
1217                 esac
1218                 shift
1219                 ;;
1220         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1221                 exit 0;;
1222         --) break;;
1223         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1224         *) break;;
1225         esac
1226 done
1227
1228 case "$error" in
1229 true)
1230         cat >&2 <<EOM
1231 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1232                  [-U symbol] [-U symbol=]
1233   -d : use defaults for all answers.
1234   -e : go on without questioning past the production of config.sh.
1235   -f : specify an alternate default configuration file.
1236   -h : print this help message and exit (with an error status).
1237   -r : reuse C symbols value if possible (skips costly nm extraction).
1238   -s : silent mode, only echoes questions and essential information.
1239   -D : define symbol to have some value:
1240          -D symbol         symbol gets the value 'define'
1241          -D symbol=value   symbol gets the value 'value'
1242   -E : stop at the end of questions, after having produced config.sh.
1243   -K : do not use unless you know what you are doing.
1244   -O : let -D and -U override definitions from loaded configuration file.
1245   -S : perform variable substitutions on all .SH files (can mix with -f)
1246   -U : undefine symbol:
1247          -U symbol    symbol gets the value 'undef'
1248          -U symbol=   symbol gets completely empty
1249   -V : print version number and exit (with a zero status).
1250 EOM
1251         exit 1
1252         ;;
1253 esac
1254
1255 : Sanity checks
1256 case "$fastread$alldone" in
1257 yescont|yesexit) ;;
1258 *)
1259         if test ! -t 0; then
1260                 echo "Say 'sh Configure', not 'sh <Configure'"
1261                 exit 1
1262         fi
1263         ;;
1264 esac
1265
1266 exec 4>&1
1267 case "$silent" in
1268 true) exec 1>/dev/null;;
1269 esac
1270
1271 : run the defines and the undefines, if any, but leave the file out there...
1272 touch optdef.sh
1273 . ./optdef.sh
1274
1275 : set package name
1276 package=perl5
1277 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1278 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1279 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1280 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1281 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1282 esac
1283
1284 : Some greps do not return status, grrr.
1285 echo "grimblepritz" >grimble
1286 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1287         contains=contains
1288 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1289         contains=grep
1290 else
1291         contains=contains
1292 fi
1293 rm -f grimble
1294 : the following should work in any shell
1295 case "$contains" in
1296 contains*)
1297         echo " "
1298         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1299         cat >contains <<'EOSS'
1300 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1301 EOSS
1302 chmod +x contains
1303 esac
1304
1305 : Find the path to the source tree
1306 case "$src" in
1307 '') case "$0" in
1308     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1309          case "$src" in
1310          /*)    ;;
1311          *)     src=`cd ../$src && pwd` ;;
1312          esac
1313          ;;
1314     *)   src='.';;
1315     esac;;
1316 esac
1317 case "$src" in
1318 '')     src=/
1319         rsrc=/
1320         ;;
1321 /*) rsrc="$src";;
1322 *) rsrc="../$src";;
1323 esac
1324 if test -f $rsrc/Configure && \
1325         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1326 then
1327    : found it, so we are ok.
1328 else
1329         rsrc=''
1330         for src in . .. ../.. ../../.. ../../../..; do
1331                 if test -f ../$src/Configure && \
1332                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1333                 then
1334                         rsrc=../$src
1335                         break
1336                 fi
1337         done
1338 fi
1339 case "$rsrc" in
1340 '')
1341         cat <<EOM >&4
1342
1343 Sorry, I can't seem to locate the source dir for $package.  Please start
1344 Configure with an explicit path -- i.e. /some/path/Configure.
1345
1346 EOM
1347         exit 1
1348         ;;
1349 ../.)   rsrc='..';;
1350 *)
1351         echo " "
1352         echo "Sources for $package found in \"$src\"." >&4
1353         ;;
1354 esac
1355
1356 : script used to extract .SH files with variable substitutions
1357 cat >extract <<'EOS'
1358 CONFIGDOTSH=true
1359 echo "Doing variable substitutions on .SH files..."
1360 if test -f $src/MANIFEST; then
1361         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1362 else
1363         echo "(Looking for .SH files under the source directory.)"
1364         set x `(cd $src; find . -name "*.SH" -print)`
1365 fi
1366 shift
1367 case $# in
1368 0) set x `(cd $src; echo *.SH)`; shift;;
1369 esac
1370 if test ! -f $src/$1; then
1371         shift
1372 fi
1373 mkdir_p='
1374 name=$1;
1375 create="";
1376 while test $name; do
1377         if test ! -d "$name"; then
1378                 create="$name $create";
1379                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1380                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1381         else
1382                 name="";
1383         fi;
1384 done;
1385 for file in $create; do
1386         mkdir $file;
1387 done
1388 '
1389 for file in $*; do
1390         case "$src" in
1391         ".")
1392                 case "$file" in
1393                 */*)
1394                         dir=`expr X$file : 'X\(.*\)/'`
1395                         file=`expr X$file : 'X.*/\(.*\)'`
1396                         (cd $dir && . ./$file)
1397                         ;;
1398                 *)
1399                         . ./$file
1400                         ;;
1401                 esac
1402                 ;;
1403         *)
1404                 case "$file" in
1405                 */*)
1406                         dir=`expr X$file : 'X\(.*\)/'`
1407                         file=`expr X$file : 'X.*/\(.*\)'`
1408                         (set x $dir; shift; eval $mkdir_p)
1409                         sh <$src/$dir/$file
1410                         ;;
1411                 *)
1412                         sh <$src/$file
1413                         ;;
1414                 esac
1415                 ;;
1416         esac
1417 done
1418 if test -f $src/config_h.SH; then
1419         if test ! -f config.h; then
1420         : oops, they left it out of MANIFEST, probably, so do it anyway.
1421         . $src/config_h.SH
1422         fi
1423 fi
1424 EOS
1425
1426 : extract files and exit if asked to do so
1427 case "$extractsh" in
1428 true)
1429         case "$realsilent" in
1430         true) ;;
1431         *) exec 1>&4;;
1432         esac
1433         case "$config_sh" in
1434         '') config_sh='config.sh';;
1435         esac
1436         echo " "
1437         echo "Fetching answers from $config_sh..."
1438         cd ..
1439         . $config_sh
1440         test "$override" && . ./optdef.sh
1441         echo " "
1442         . UU/extract
1443         rm -rf UU
1444         echo "Done."
1445         exit 0
1446         ;;
1447 esac
1448
1449 : Eunice requires " " instead of "", can you believe it
1450 echo " "
1451 : Here we go...
1452 echo "Beginning of configuration questions for $package."
1453
1454 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1455
1456 : first determine how to suppress newline on echo command
1457 echo " "
1458 echo "Checking echo to see how to suppress newlines..."
1459 (echo "hi there\c" ; echo " ") >.echotmp
1460 if $contains c .echotmp >/dev/null 2>&1 ; then
1461         echo "...using -n."
1462         n='-n'
1463         c=''
1464 else
1465         cat <<'EOM'
1466 ...using \c
1467 EOM
1468         n=''
1469         c='\c'
1470 fi
1471 echo $n "The star should be here-->$c"
1472 echo '*'
1473 rm -f .echotmp
1474
1475 : Now test for existence of everything in MANIFEST
1476 echo " "
1477 if test -f $rsrc/MANIFEST; then
1478         echo "First let's make sure your kit is complete.  Checking..." >&4
1479         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1480         rm -f missing
1481         tmppwd=`pwd`
1482         for filelist in x??; do
1483                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1484         done
1485         if test -s missing; then
1486                 cat missing >&4
1487                 cat >&4 <<'EOM'
1488
1489 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1490
1491 You have the option of continuing the configuration process, despite the
1492 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1493 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1494 and contact the author (perlbug@perl.com).
1495
1496 EOM
1497                 echo $n "Continue? [n] $c" >&4
1498                 read ans
1499                 case "$ans" in
1500                 y*)
1501                         echo "Continuing..." >&4
1502                         rm -f missing
1503                         ;;
1504                 *)
1505                         echo "ABORTING..." >&4
1506                         kill $$
1507                         ;;
1508                 esac
1509         else
1510                 echo "Looks good..."
1511         fi
1512 else
1513         echo "There is no MANIFEST file.  I hope your kit is complete !"
1514 fi
1515 rm -f missing x??
1516
1517 echo " "
1518 : Find the appropriate value for a newline for tr
1519 if test -n "$DJGPP"; then
1520        trnl='\012'
1521 fi
1522 if test X"$trnl" = X; then
1523         case "`echo foo|tr '\n' x 2>/dev/null`" in
1524         foox) trnl='\n' ;;
1525         esac
1526 fi
1527 if test X"$trnl" = X; then
1528         case "`echo foo|tr '\012' x 2>/dev/null`" in
1529         foox) trnl='\012' ;;
1530         esac
1531 fi
1532 if test X"$trnl" = X; then
1533         cat <<EOM >&2
1534
1535 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1536
1537 EOM
1538         exit 1
1539 fi
1540
1541 : compute the number of columns on the terminal for proper question formatting
1542 case "$COLUMNS" in
1543 '') COLUMNS='80';;
1544 esac
1545
1546 : set up the echo used in my read
1547 myecho="case \"\$xxxm\" in
1548 '') echo $n \"\$rp $c\" >&4;;
1549 *) case \"\$rp\" in
1550         '') echo $n \"[\$xxxm] $c\";;
1551         *)
1552                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1553                         echo \"\$rp\" >&4
1554                         echo $n \"[\$xxxm] $c\" >&4
1555                 else
1556                         echo $n \"\$rp [\$xxxm] $c\" >&4
1557                 fi
1558                 ;;
1559         esac;;
1560 esac"
1561
1562 : now set up to do reads with possible shell escape and default assignment
1563 cat <<EOSC >myread
1564 $startsh
1565 xxxm=\$dflt
1566 $myecho
1567 ans='!'
1568 case "\$fastread" in
1569 yes) case "\$dflt" in
1570         '') ;;
1571         *) ans='';
1572                 case "\$silent-\$rp" in
1573                 true-) ;;
1574                 *) echo " " >&4;;
1575                 esac;;
1576         esac;;
1577 *) case "\$silent" in
1578         true) case "\$rp" in
1579                 '') ans='';;
1580                 esac;;
1581         esac;;
1582 esac
1583 while expr "X\$ans" : "X!" >/dev/null; do
1584         read answ
1585         set x \$xxxm
1586         shift
1587         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1588         case  "\$answ" in
1589         "!")
1590                 sh 1>&4
1591                 echo " "
1592                 $myecho
1593                 ;;
1594         !*)
1595                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1596                 shift
1597                 sh 1>&4 -c "\$*"
1598                 echo " "
1599                 $myecho
1600                 ;;
1601         "\$ans")
1602                 case "\$ans" in
1603                 \\&*)
1604                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1605                         shift
1606                         case "\$1" in
1607                         -d)
1608                                 fastread=yes
1609                                 echo "(OK, I'll run with -d after this question.)" >&4
1610                                 ;;
1611                         -*)
1612                                 echo "*** Sorry, \$1 not supported yet." >&4
1613                                 ;;
1614                         esac
1615                         $myecho
1616                         ans=!
1617                         ;;
1618                 esac;;
1619         *)
1620                 case "\$aok" in
1621                 y)
1622                         echo "*** Substitution done -- please confirm."
1623                         xxxm="\$ans"
1624                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1625                         xxxm="\$ans"
1626                         ans=!
1627                         ;;
1628                 *)
1629                         echo "*** Error -- try again."
1630                         ans=!
1631                         ;;
1632                 esac
1633                 $myecho
1634                 ;;
1635         esac
1636         case "\$ans\$xxxm\$nostick" in
1637         '')
1638                 ans=!
1639                 $myecho
1640                 ;;
1641         esac
1642 done
1643 case "\$ans" in
1644 '') ans="\$xxxm";;
1645 esac
1646 EOSC
1647
1648 : create .config dir to save info across Configure sessions
1649 test -d ../.config || mkdir ../.config
1650 cat >../.config/README <<EOF
1651 This directory created by Configure to save information that should
1652 persist across sessions for $package.
1653
1654 You may safely delete it if you wish.
1655 EOF
1656
1657 : general instructions
1658 needman=true
1659 firsttime=true
1660 user=`(logname) 2>/dev/null`
1661 case "$user" in
1662 '') user=`whoami 2>&1`;;
1663 esac
1664 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1665         firsttime=false
1666         echo " "
1667         rp='Would you like to see the instructions?'
1668         dflt=n
1669         . ./myread
1670         case "$ans" in
1671         [yY]*) ;;
1672         *) needman=false;;
1673         esac
1674 fi
1675 if $needman; then
1676         cat <<EOH
1677
1678 This installation shell script will examine your system and ask you questions
1679 to determine how the perl5 package should be installed. If you get
1680 stuck on a question, you may use a ! shell escape to start a subshell or
1681 execute a command.  Many of the questions will have default answers in square
1682 brackets; typing carriage return will give you the default.
1683
1684 On some of the questions which ask for file or directory names you are allowed
1685 to use the ~name construct to specify the login directory belonging to "name",
1686 even if you don't have a shell which knows about that.  Questions where this is
1687 allowed will be marked "(~name ok)".
1688
1689 EOH
1690         rp=''
1691         dflt='Type carriage return to continue'
1692         . ./myread
1693         cat <<'EOH'
1694
1695 The prompter used in this script allows you to use shell variables and
1696 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1697 in the default answer, as if the default line was a set of arguments given to a
1698 script shell.  This means you may also use $* to repeat the whole default line,
1699 so you do not have to re-type everything to add something to the default.
1700
1701 Everytime there is a substitution, you will have to confirm.  If there is an
1702 error (e.g. an unmatched backtick), the default answer will remain unchanged
1703 and you will be prompted again.
1704
1705 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1706 the questions and use the computed defaults (or the previous answers if there
1707 was already a config.sh file). Type 'Configure -h' for a list of options.
1708 You may also start interactively and then answer '& -d' at any prompt to turn
1709 on the non-interactive behaviour for the remainder of the execution.
1710
1711 EOH
1712         . ./myread
1713         cat <<EOH
1714
1715 Much effort has been expended to ensure that this shell script will run on any
1716 Unix system.  If despite that it blows up on yours, your best bet is to edit
1717 Configure and run it again.  If you can't run Configure for some reason,
1718 you'll have to generate a config.sh file by hand.  Whatever problems you
1719 have, let me (perlbug@perl.com) know how I blew it.
1720
1721 This installation script affects things in two ways:
1722
1723 1) it may do direct variable substitutions on some of the files included
1724    in this kit.
1725 2) it builds a config.h file for inclusion in C programs.  You may edit
1726    any of these files as the need arises after running this script.
1727
1728 If you make a mistake on a question, there is no easy way to back up to it
1729 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1730 files.  Configure will offer to let you do this before it runs the SH files.
1731
1732 EOH
1733         dflt='Type carriage return to continue'
1734         . ./myread
1735         case "$firsttime" in
1736         true) echo $user >>../.config/instruct;;
1737         esac
1738 fi
1739
1740 : find out where common programs are
1741 echo " "
1742 echo "Locating common programs..." >&4
1743 cat <<EOSC >loc
1744 $startsh
1745 case \$# in
1746 0) exit 1;;
1747 esac
1748 thing=\$1
1749 shift
1750 dflt=\$1
1751 shift
1752 for dir in \$*; do
1753         case "\$thing" in
1754         .)
1755         if test -d \$dir/\$thing; then
1756                 echo \$dir
1757                 exit 0
1758         fi
1759         ;;
1760         *)
1761         for thisthing in \$dir/\$thing; do
1762                 : just loop through to pick last item
1763         done
1764         if test -f \$thisthing; then
1765                 echo \$thisthing
1766                 exit 0
1767         elif test -f \$dir/\$thing.exe; then
1768                 if test -n "$DJGPP"; then
1769                         echo \$dir/\$thing.exe
1770                 else
1771                         : on Eunice apparently
1772                         echo \$dir/\$thing
1773                 fi
1774                 exit 0
1775         fi
1776         ;;
1777         esac
1778 done
1779 echo \$dflt
1780 exit 1
1781 EOSC
1782 chmod +x loc
1783 $eunicefix loc
1784 loclist="
1785 awk
1786 cat
1787 comm
1788 cp
1789 echo
1790 expr
1791 grep
1792 ls
1793 make
1794 mkdir
1795 rm
1796 sed
1797 sort
1798 touch
1799 tr
1800 uniq
1801 "
1802 trylist="
1803 Mcc
1804 ar
1805 byacc
1806 cpp
1807 csh
1808 date
1809 egrep
1810 gzip
1811 less
1812 ln
1813 more
1814 nm
1815 nroff
1816 pg
1817 test
1818 uname
1819 zip
1820 "
1821 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1822 pth="$pth /lib /usr/lib"
1823 for file in $loclist; do
1824         eval xxx=\$$file
1825         case "$xxx" in
1826         /*|?:[\\/]*)
1827                 if test -f "$xxx"; then
1828                         : ok
1829                 else
1830                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1831                         xxx=`./loc $file $file $pth`
1832                 fi
1833                 ;;
1834         '') xxx=`./loc $file $file $pth`;;
1835         *) xxx=`./loc $xxx $xxx $pth`;;
1836         esac
1837         eval $file=$xxx
1838         eval _$file=$xxx
1839         case "$xxx" in
1840         /*)
1841                 echo $file is in $xxx.
1842                 ;;
1843         ?:[\\/]*)
1844                 echo $file is in $xxx.
1845                 ;;
1846         *)
1847                 echo "I don't know where '$file' is, and my life depends on it." >&4
1848                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1849                 exit 1
1850                 ;;
1851         esac
1852 done
1853 echo " "
1854 echo "Don't worry if any of the following aren't found..."
1855 say=offhand
1856 for file in $trylist; do
1857         eval xxx=\$$file
1858         case "$xxx" in
1859         /*|?:[\\/]*)
1860                 if test -f "$xxx"; then
1861                         : ok
1862                 else
1863                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1864                         xxx=`./loc $file $file $pth`
1865                 fi
1866                 ;;
1867         '') xxx=`./loc $file $file $pth`;;
1868         *) xxx=`./loc $xxx $xxx $pth`;;
1869         esac
1870         eval $file=$xxx
1871         eval _$file=$xxx
1872         case "$xxx" in
1873         /*)
1874                 echo $file is in $xxx.
1875                 ;;
1876         ?:[\\/]*)
1877                 echo $file is in $xxx.
1878                 ;;
1879         *)
1880                 echo "I don't see $file out there, $say."
1881                 say=either
1882                 ;;
1883         esac
1884 done
1885 case "$egrep" in
1886 egrep)
1887         echo "Substituting grep for egrep."
1888         egrep=$grep
1889         ;;
1890 esac
1891 case "$ln" in
1892 ln)
1893         echo "Substituting cp for ln."
1894         ln=$cp
1895         ;;
1896 esac
1897 case "$test" in
1898 test)
1899         echo "Hopefully test is built into your sh."
1900         ;;
1901 *)
1902         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1903                 echo "Using the test built into your sh."
1904                 test=test
1905                 _test=test
1906         fi
1907         ;;
1908 esac
1909 case "$echo" in
1910 echo)
1911         echo "Hopefully echo is built into your sh."
1912         ;;
1913 '') ;;
1914 *)
1915         echo " "
1916 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1917         $echo $n "hi there$c" >foo1
1918         echo $n "hi there$c" >foo2
1919         if cmp foo1 foo2 >/dev/null 2>&1; then
1920                 echo "They are compatible.  In fact, they may be identical."
1921         else
1922                 case "$n" in
1923                 '-n') n='' c='\c';;
1924                 *) n='-n' c='';;
1925                 esac
1926                 cat <<FOO
1927 They are not compatible!  You are probably running ksh on a non-USG system.
1928 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1929 have echo built in and we may have to run some Bourne shell scripts.  That
1930 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1931
1932 FOO
1933                 $echo $n "The star should be here-->$c"
1934                 $echo "*"
1935         fi
1936         $rm -f foo1 foo2
1937         ;;
1938 esac
1939
1940 : determine whether symbolic links are supported
1941 echo " "
1942 $touch blurfl
1943 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1944         echo "Symbolic links are supported." >&4
1945         lns="$ln -s"
1946 else
1947         echo "Symbolic links are NOT supported." >&4
1948         lns="$ln"
1949 fi
1950 $rm -f blurfl sym
1951
1952 : see whether [:lower:] and [:upper:] are supported character classes
1953 echo " "
1954 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1955 ABYZ)
1956         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1957         up='[:upper:]'
1958         low='[:lower:]'
1959         ;;
1960 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1961         # (0xc9 and 0xd1), therefore that is a nice testing point.
1962         if test "X$up" = X -o "X$low" = X; then
1963             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1964             ij) up='[A-Z]'
1965                 low='[a-z]'
1966                 ;;
1967             esac
1968         fi
1969         if test "X$up" = X -o "X$low" = X; then
1970             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1971             ij) up='A-Z'
1972                 low='a-z'
1973                 ;;
1974             esac
1975         fi
1976         if test "X$up" = X -o "X$low" = X; then
1977             case "`echo IJ | od -x 2>/dev/null`" in
1978             *C9D1*|*c9d1*)
1979                 echo "Hey, this might be EBCDIC." >&4
1980                 if test "X$up" = X -o "X$low" = X; then
1981                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1982                     ij) up='[A-IJ-RS-Z]'
1983                         low='[a-ij-rs-z]'
1984                         ;;
1985                     esac
1986                 fi
1987                 if test "X$up" = X -o "X$low" = X; then
1988                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1989                     ij) up='A-IJ-RS-Z'
1990                         low='a-ij-rs-z'
1991                         ;;
1992                     esac
1993                 fi
1994                 ;;
1995             esac
1996         fi
1997 esac
1998 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1999 ij)
2000     echo "Using $up and $low to convert case." >&4
2001     ;;
2002 *)
2003     echo "I don't know how to translate letters from upper to lower case." >&4
2004     echo "Your tr is not acting any way I know of." >&4
2005     exit 1
2006     ;;
2007 esac
2008 : set up the translation script tr, must be called with ./tr of course
2009 cat >tr <<EOSC
2010 $startsh
2011 case "\$1\$2" in
2012 '[A-Z][a-z]') exec $tr '$up' '$low';;
2013 '[a-z][A-Z]') exec $tr '$low' '$up';;
2014 esac
2015 exec $tr "\$@"
2016 EOSC
2017 chmod +x tr
2018 $eunicefix tr
2019
2020 : Try to determine whether config.sh was made on this system
2021 case "$config_sh" in
2022 '')
2023 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2024 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2025 # because the A-Z/a-z are not consecutive.
2026 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2027         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2028 newmyuname="$myuname"
2029 dflt=n
2030 case "$knowitall" in
2031 '')
2032         if test -f ../config.sh; then
2033                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2034                         eval "`grep myuname= ../config.sh`"
2035                 fi
2036                 if test "X$myuname" = "X$newmyuname"; then
2037                         dflt=y
2038                 fi
2039         fi
2040         ;;
2041 *) dflt=y;;
2042 esac
2043
2044 : Get old answers from old config file if Configure was run on the
2045 : same system, otherwise use the hints.
2046 hint=default
2047 cd ..
2048 if test -f config.sh; then
2049         echo " "
2050         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2051         . UU/myread
2052         case "$ans" in
2053         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2054         *)  echo "Fetching default answers from your old config.sh file..." >&4
2055                 tmp_n="$n"
2056                 tmp_c="$c"
2057                 tmp_sh="$sh"
2058                 . ./config.sh
2059                 cp config.sh UU
2060                 n="$tmp_n"
2061                 c="$tmp_c"
2062                 : Older versions did not always set $sh.  Catch re-use of such
2063                 : an old config.sh.
2064                 case "$sh" in
2065                 '') sh="$tmp_sh" ;;
2066                 esac
2067                 hint=previous
2068                 ;;
2069         esac
2070 fi
2071 if test ! -f config.sh; then
2072         $cat <<EOM
2073
2074 First time through, eh?  I have some defaults handy for some systems
2075 that need some extra help getting the Configure answers right:
2076
2077 EOM
2078         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2079         dflt=''
2080         : Half the following guesses are probably wrong... If you have better
2081         : tests or hints, please send them to perlbug@perl.com
2082         : The metaconfig authors would also appreciate a copy...
2083         $test -f /irix && osname=irix
2084         $test -f /xenix && osname=sco_xenix
2085         $test -f /dynix && osname=dynix
2086         $test -f /dnix && osname=dnix
2087         $test -f /lynx.os && osname=lynxos
2088         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2089         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2090         $test -f /bin/mips && /bin/mips && osname=mips
2091         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2092                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2093         $test -d /usr/apollo/bin && osname=apollo
2094         $test -f /etc/saf/_sactab && osname=svr4
2095         $test -d /usr/include/minix && osname=minix
2096         if $test -d /MachTen -o -d /MachTen_Folder; then
2097                 osname=machten
2098                 if $test -x /sbin/version; then
2099                         osvers=`/sbin/version | $awk '{print $2}' |
2100                         $sed -e 's/[A-Za-z]$//'`
2101                 elif $test -x /usr/etc/version; then
2102                         osvers=`/usr/etc/version | $awk '{print $2}' |
2103                         $sed -e 's/[A-Za-z]$//'`
2104                 else
2105                         osvers="$2.$3"
2106                 fi
2107         fi
2108        $test -f /sys/posix.dll &&
2109                $test -f /usr/bin/what &&
2110                set X `/usr/bin/what /sys/posix.dll` &&
2111                $test "$3" = UWIN &&
2112                osname=uwin &&
2113                osvers="$5"
2114         if $test -f $uname; then
2115                 set X $myuname
2116                 shift
2117
2118                 case "$5" in
2119                 fps*) osname=fps ;;
2120                 mips*)
2121                         case "$4" in
2122                         umips) osname=umips ;;
2123                         *) osname=mips ;;
2124                         esac;;
2125                 [23]100) osname=mips ;;
2126                 next*) osname=next ;;
2127                 i386*)
2128                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2129                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2130                                 osname='sco'
2131                                 osvers=$tmp
2132                         elif $test -f /etc/kconfig; then
2133                                 osname=isc
2134                                 if test "$lns" = "$ln -s"; then
2135                                         osvers=4
2136                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2137                                         osvers=3
2138                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2139                                         osvers=2
2140                                 fi
2141                         fi
2142                         tmp=''
2143                         ;;
2144                 pc*)
2145                         if test -n "$DJGPP"; then
2146                                 osname=dos
2147                                 osvers=djgpp
2148                         fi
2149                         ;;
2150                 esac
2151
2152                 case "$1" in
2153                 aix) osname=aix
2154                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2155                         case "$tmp" in
2156                         'not found') osvers="$4"."$3" ;;
2157                         '<3240'|'<>3240') osvers=3.2.0 ;;
2158                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2159                         '=3250'|'>3250') osvers=3.2.5 ;;
2160                         *) osvers=$tmp;;
2161                         esac
2162                         ;;
2163                 *dc.osx) osname=dcosx
2164                         osvers="$3"
2165                         ;;
2166                 dnix) osname=dnix
2167                         osvers="$3"
2168                         ;;
2169                 domainos) osname=apollo
2170                         osvers="$3"
2171                         ;;
2172                 dgux) osname=dgux 
2173                         osvers="$3"
2174                         ;;
2175                 dynixptx*) osname=dynixptx
2176                         osvers=`echo "$4"|sed 's/^v//'`
2177                         ;;
2178                 freebsd) osname=freebsd 
2179                         osvers="$3" ;;
2180                 genix) osname=genix ;;
2181                 hp*) osname=hpux 
2182                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2183                         ;;
2184                 irix*) osname=irix
2185                         case "$3" in
2186                         4*) osvers=4 ;;
2187                         5*) osvers=5 ;;
2188                         *)      osvers="$3" ;;
2189                         esac
2190                         ;;
2191                 linux) osname=linux
2192                         case "$3" in
2193                         *)      osvers="$3" ;;
2194                         esac
2195                         ;;
2196                 MiNT) osname=mint
2197                         ;;
2198                 netbsd*) osname=netbsd
2199                         osvers="$3"
2200                         ;;
2201                 news-os) osvers="$3"
2202                         case "$3" in
2203                         4*) osname=newsos4 ;;
2204                         *) osname=newsos ;;
2205                         esac
2206                         ;;
2207                 bsd386) osname=bsd386
2208                         osvers=`$uname -r`
2209                         ;;
2210                 POSIX-BC | posix-bc ) osname=posix-bc
2211                         osvers="$3"
2212                         ;;
2213                 powerux | power_ux | powermax_os | powermaxos | \
2214                 powerunix | power_unix) osname=powerux
2215                         osvers="$3"
2216                         ;;
2217                 next*) osname=next ;;
2218                 solaris) osname=solaris
2219                         case "$3" in
2220                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2221                         *)      osvers="$3" ;;
2222                         esac
2223                         ;;
2224                 sunos) osname=sunos
2225                         case "$3" in
2226                         5*) osname=solaris
2227                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2228                         *)      osvers="$3" ;;
2229                         esac
2230                         ;;
2231                 titanos) osname=titanos
2232                         case "$3" in
2233                         1*) osvers=1 ;;
2234                         2*) osvers=2 ;;
2235                         3*) osvers=3 ;;
2236                         4*) osvers=4 ;;
2237                         *)      osvers="$3" ;;
2238                         esac
2239                         ;;
2240                 ultrix) osname=ultrix
2241                         osvers="$3"
2242                         ;;
2243                 osf1|mls+)      case "$5" in
2244                                 alpha)
2245                                         osname=dec_osf
2246                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2247                                         ;;
2248                         hp*)    osname=hp_osf1  ;;
2249                         mips)   osname=mips_osf1 ;;
2250                         esac
2251                         ;;
2252                 uts) osname=uts 
2253                         osvers="$3"
2254                         ;;
2255                 qnx) osname=qnx
2256                         osvers="$4"
2257                         ;;
2258                 $2) case "$osname" in
2259                         *isc*) ;;
2260                         *freebsd*) ;;
2261                         svr*)
2262                                 : svr4.x or possibly later
2263                                 case "svr$3" in 
2264                                 ${osname}*)
2265                                         osname=svr$3
2266                                         osvers=$4
2267                                         ;;
2268                                 esac
2269                                 case "$osname" in
2270                                 svr4.0)
2271                                         : Check for ESIX
2272                                         if test -f /stand/boot ; then
2273                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2274                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2275                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2276                                                         if test -n "$isesix"; then
2277                                                                 osname=esix4
2278                                                         fi
2279                                                 fi
2280                                         fi
2281                                         ;;
2282                                 esac
2283                                 ;;
2284                         *)      if test -f /etc/systemid; then
2285                                         osname=sco
2286                                         set `echo $3 | $sed 's/\./ /g'` $4
2287                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2288                                                 osvers=$1.$2.$3
2289                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2290                                                 osvers=$1.$2
2291                                         elif $test -f $src/hints/sco_$1.sh; then
2292                                                 osvers=$1
2293                                         fi
2294                                 else
2295                                         case "$osname" in
2296                                         '') : Still unknown.  Probably a generic Sys V.
2297                                                 osname="sysv"
2298                                                 osvers="$3"
2299                                                 ;;
2300                                         esac
2301                                 fi
2302                                 ;;
2303                         esac
2304                         ;;
2305                 *)      case "$osname" in
2306                         '') : Still unknown.  Probably a generic BSD.
2307                                 osname="$1"
2308                                 osvers="$3"
2309                                 ;;
2310                         esac
2311                         ;;
2312                 esac
2313         else
2314                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2315                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2316                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2317                                 osname=news_os
2318                         fi
2319                         $rm -f UU/kernel.what
2320                 elif test -d c:/.; then
2321                         set X $myuname
2322                         osname=os2
2323                         osvers="$5"
2324                 fi
2325         fi
2326         
2327         : Now look for a hint file osname_osvers, unless one has been
2328         : specified already.
2329         case "$hintfile" in
2330         ''|' ')
2331                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2332                 : Also try without trailing minor version numbers.
2333                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2334                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2335                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2336                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2337                 case "$file" in
2338                 '') dflt=none ;;
2339                 *)  case "$osvers" in
2340                         '') dflt=$file
2341                                 ;;
2342                         *)  if $test -f $src/hints/$file.sh ; then
2343                                         dflt=$file
2344                                 elif $test -f $src/hints/$xfile.sh ; then
2345                                         dflt=$xfile
2346                                 elif $test -f $src/hints/$xxfile.sh ; then
2347                                         dflt=$xxfile
2348                                 elif $test -f $src/hints/$xxxfile.sh ; then
2349                                         dflt=$xxxfile
2350                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2351                                         dflt=$xxxxfile
2352                                 elif $test -f "$src/hints/${osname}.sh" ; then
2353                                         dflt="${osname}"
2354                                 else
2355                                         dflt=none
2356                                 fi
2357                                 ;;
2358                         esac
2359                         ;;
2360                 esac
2361                 if $test -f Policy.sh ; then
2362                         case "$dflt" in
2363                         *Policy*) ;;
2364                         none) dflt="Policy" ;;
2365                         *) dflt="Policy $dflt" ;;
2366                         esac
2367                 fi
2368                 ;;
2369         *)
2370                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2371                 ;;
2372         esac
2373
2374         if $test -f Policy.sh ; then
2375                 $cat <<EOM
2376
2377 There's also a Policy hint file available, which should make the
2378 site-specific (policy) questions easier to answer.
2379 EOM
2380
2381         fi
2382
2383         $cat <<EOM
2384
2385 You may give one or more space-separated answers, or "none" if appropriate.
2386 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2387 is a good thing.  DO NOT give a wrong version or a wrong OS.
2388
2389 EOM
2390
2391         rp="Which of these apply, if any?"
2392         . UU/myread
2393         tans=$ans
2394         for file in $tans; do
2395                 if $test X$file = XPolicy -a -f Policy.sh; then
2396                         . Policy.sh
2397                         $cat Policy.sh >> UU/config.sh
2398                 elif $test -f $src/hints/$file.sh; then
2399                         . $src/hints/$file.sh
2400                         $cat $src/hints/$file.sh >> UU/config.sh
2401                 elif $test X$tans = X -o X$tans = Xnone ; then
2402                         : nothing
2403                 else
2404                         : Give one chance to correct a possible typo.
2405                         echo "$file.sh does not exist"
2406                         dflt=$file
2407                         rp="hint to use instead?"
2408                         . UU/myread
2409                         for file in $ans; do
2410                                 if $test -f "$src/hints/$file.sh"; then
2411                                         . $src/hints/$file.sh
2412                                         $cat $src/hints/$file.sh >> UU/config.sh
2413                                 elif $test X$ans = X -o X$ans = Xnone ; then
2414                                         : nothing
2415                                 else
2416                                         echo "$file.sh does not exist -- ignored."
2417                                 fi
2418                         done
2419                 fi
2420         done
2421
2422         hint=recommended
2423         : Remember our hint file for later.
2424         if $test -f "$src/hints/$file.sh" ; then
2425                 hintfile="$file"
2426         else
2427                 hintfile=''
2428         fi
2429 fi
2430 cd UU
2431 ;;
2432 *)
2433         echo " "
2434         echo "Fetching default answers from $config_sh..." >&4
2435         tmp_n="$n"
2436         tmp_c="$c"
2437         cd ..
2438         cp $config_sh config.sh 2>/dev/null
2439         chmod +w config.sh
2440         . ./config.sh
2441         cd UU
2442         cp ../config.sh .
2443         n="$tmp_n"
2444         c="$tmp_c"
2445         hint=previous
2446         ;;
2447 esac
2448 test "$override" && . ./optdef.sh
2449 myuname="$newmyuname"
2450
2451 : Restore computed paths
2452 for file in $loclist $trylist; do
2453         eval $file="\$_$file"
2454 done
2455
2456 cat << EOM
2457
2458 Configure uses the operating system name and version to set some defaults.
2459 The default value is probably right if the name rings a bell. Otherwise,
2460 since spelling matters for me, either accept the default or answer "none"
2461 to leave it blank.
2462
2463 EOM
2464 case "$osname" in
2465         ''|' ')
2466                 case "$hintfile" in
2467                 ''|' '|none) dflt=none ;;
2468                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2469                 esac
2470                 ;;
2471         *) dflt="$osname" ;;
2472 esac
2473 rp="Operating system name?"
2474 . ./myread
2475 case "$ans" in
2476 none)  osname='' ;;
2477 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2478 esac
2479 echo " "
2480 case "$osvers" in
2481         ''|' ')
2482                 case "$hintfile" in
2483                 ''|' '|none) dflt=none ;;
2484                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2485                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2486                         case "$dflt" in
2487                         ''|' ') dflt=none ;;
2488                         esac
2489                         ;;
2490                 esac
2491                 ;;
2492         *) dflt="$osvers" ;;
2493 esac
2494 rp="Operating system version?"
2495 . ./myread
2496 case "$ans" in
2497 none)  osvers='' ;;
2498 *) osvers="$ans" ;;
2499 esac
2500
2501 : who configured the system
2502 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2503 cf_by=`(logname) 2>/dev/null`
2504 case "$cf_by" in
2505 "")
2506         cf_by=`(whoami) 2>/dev/null`
2507         case "$cf_by" in
2508         "") cf_by=unknown ;;
2509         esac ;;
2510 esac
2511
2512 : set up the script used to warn in case of inconsistency
2513 cat <<EOS >whoa
2514 $startsh
2515 EOS
2516 cat <<'EOSC' >>whoa
2517 dflt=y
2518 echo " "
2519 echo "*** WHOA THERE!!! ***" >&4
2520 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2521 rp="    Keep the $hint value?"
2522 . ./myread
2523 case "$ans" in
2524 y) td=$was; tu=$was;;
2525 esac
2526 EOSC
2527
2528 : function used to set $1 to $val
2529 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2530 case "$val$was" in
2531 $define$undef) . ./whoa; eval "$var=\$td";;
2532 $undef$define) . ./whoa; eval "$var=\$tu";;
2533 *) eval "$var=$val";;
2534 esac'
2535
2536 cat <<EOM
2537
2538 Perl can be built to take advantage of threads, on some systems.
2539 To do so, Configure must be run with -Dusethreads.
2540
2541 Note that threading is a highly experimental feature, and
2542 some known race conditions still remain.  If you choose to try
2543 it, be very sure to not actually deploy it for production
2544 purposes.  README.threads has more details, and is required
2545 reading if you enable threads.
2546 EOM
2547 case "$usethreads" in
2548 $define|true|[yY]*)     dflt='y';;
2549 *) dflt='n';;
2550 esac
2551 rp='Build a threading Perl?'
2552 . ./myread
2553 case "$ans" in
2554 y|Y)    val="$define" ;;     
2555 *)      val="$undef" ;;
2556 esac
2557 set usethreads
2558 eval $setvar 
2559
2560 case "$d_oldpthreads" in
2561 '')     : Configure tests would be welcome here.  For now, assume undef.
2562         val="$undef" ;;
2563 *)      val="$d_oldpthreads" ;;
2564 esac
2565 set d_oldpthreads
2566 eval $setvar
2567
2568
2569 case "$usethreads" in
2570 "$define"|true|[yY]*)
2571 : Look for a hint-file generated 'call-back-unit'.  If the
2572 : user has specified that a threading perl is to be built,
2573 : we may need to set or change some other defaults.
2574         if $test -f usethreads.cbu; then
2575                 echo "Your platform has some specific hints for threaded builds, using them..."
2576                 . ./usethreads.cbu
2577         else
2578                 $cat <<EOM
2579 (Your platform doesn't have any specific hints for threaded builds.
2580  Assuming POSIX threads, then.)
2581 EOM
2582         fi
2583     ;;
2584 esac
2585
2586 cat <<EOM
2587
2588 Perl can be built so that multiple Perl interpreters can coexist
2589 within the same Perl executable.  To do so, Configure must be run with
2590 -Dusemultiplicity.
2591
2592 Normally you do not need this and you should answer no.
2593
2594 EOM
2595 case "$usemultiplicity" in
2596 $define|true|[yY]*)     dflt='y';;
2597 *) dflt='n';;
2598 esac
2599 rp='Build Perl for multiplicity?'
2600 . ./myread
2601 case "$ans" in
2602 y|Y)    val="$define" ;;     
2603 *)      val="$undef" ;;
2604 esac
2605 set usemultiplicity
2606 eval $setvar 
2607
2608 : determine where manual pages are on this system
2609 echo " "
2610 case "$sysman" in
2611 '') 
2612         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2613         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2614         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2615         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2616         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2617         sysman=`./loc . /usr/man/man1 $syspath`
2618         ;;
2619 esac
2620 if $test -d "$sysman"; then
2621         echo "System manual is in $sysman." >&4
2622 else
2623         echo "Could not find manual pages in source form." >&4
2624 fi
2625
2626 : see what memory models we can support
2627 case "$models" in
2628 '')
2629         $cat >pdp11.c <<'EOP'
2630 int main() {
2631 #ifdef pdp11
2632         exit(0);
2633 #else
2634         exit(1);
2635 #endif
2636 }
2637 EOP
2638         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2639         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2640                 dflt='unsplit split'
2641         else
2642                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2643                 case "$tans" in
2644                 X) dflt='none';;
2645                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2646                                 dflt='small'
2647                         else
2648                                 dflt=''
2649                         fi
2650                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2651                                 dflt="$dflt medium"
2652                         fi
2653                         if $test -d /lib/large || $test -d /usr/lib/large; then
2654                                 dflt="$dflt large"
2655                         fi
2656                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2657                                 dflt="$dflt huge"
2658                         fi
2659                 esac
2660         fi;;
2661 *) dflt="$models";;
2662 esac
2663 $cat <<EOM
2664  
2665 Some systems have different model sizes.  On most systems they are called
2666 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2667 split.  If your system doesn't support different memory models, say "none".
2668 If you wish to force everything to one memory model, say "none" here and
2669 put the appropriate flags later when it asks you for other cc and ld flags.
2670 Venix systems may wish to put "none" and let the compiler figure things out.
2671 (In the following question multiple model names should be space separated.)
2672
2673 The default for most systems is "none".
2674
2675 EOM
2676 rp="Which memory models are supported?"
2677 . ./myread
2678 models="$ans"
2679
2680 case "$models" in
2681 none)
2682         small=''
2683         medium=''
2684         large=''
2685         huge=''
2686         unsplit=''
2687         split=''
2688         ;;
2689 *split)
2690         case "$split" in
2691         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2692                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2693                         dflt='-i'
2694                 else
2695                         dflt='none'
2696                 fi;;
2697         *) dflt="$split";;
2698         esac
2699         rp="What flag indicates separate I and D space?"
2700         . ./myread
2701         tans="$ans"
2702         case "$tans" in
2703         none) tans='';;
2704         esac
2705         split="$tans"
2706         unsplit='';;
2707 *large*|*small*|*medium*|*huge*)
2708         case "$models" in
2709         *large*)
2710                 case "$large" in
2711                 '') dflt='-Ml';;
2712                 *) dflt="$large";;
2713                 esac
2714         rp="What flag indicates large model?"
2715         . ./myread
2716         tans="$ans"
2717         case "$tans" in
2718         none) tans='';
2719         esac
2720         large="$tans";;
2721         *) large='';;
2722         esac
2723         case "$models" in
2724         *huge*) case "$huge" in
2725                 '') dflt='-Mh';;
2726                 *) dflt="$huge";;
2727                 esac
2728                 rp="What flag indicates huge model?"
2729                 . ./myread
2730                 tans="$ans"
2731                 case "$tans" in
2732                 none) tans='';
2733                 esac
2734                 huge="$tans";;
2735         *) huge="$large";;
2736         esac
2737         case "$models" in
2738         *medium*) case "$medium" in
2739                 '') dflt='-Mm';;
2740                 *) dflt="$medium";;
2741                 esac
2742                 rp="What flag indicates medium model?"
2743                 . ./myread
2744                 tans="$ans"
2745                 case "$tans" in
2746                 none) tans='';
2747                 esac
2748                 medium="$tans";;
2749         *) medium="$large";;
2750         esac
2751         case "$models" in
2752         *small*) case "$small" in
2753                 '') dflt='none';;
2754                 *) dflt="$small";;
2755                 esac
2756                 rp="What flag indicates small model?"
2757                 . ./myread
2758                 tans="$ans"
2759                 case "$tans" in
2760                 none) tans='';
2761                 esac
2762                 small="$tans";;
2763         *) small='';;
2764         esac
2765         ;;
2766 *)
2767         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2768         ;;
2769 esac
2770 $rm -f pdp11.* pdp11
2771
2772 : make some quick guesses about what we are up against
2773 echo " "
2774 $echo $n "Hmm...  $c"
2775 echo exit 1 >bsd
2776 echo exit 1 >usg
2777 echo exit 1 >v7
2778 echo exit 1 >osf1
2779 echo exit 1 >eunice
2780 echo exit 1 >xenix
2781 echo exit 1 >venix
2782 echo exit 1 >os2
2783 d_bsd="$undef"
2784 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2785 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2786 then
2787         echo "Looks kind of like an OSF/1 system, but we'll see..."
2788         echo exit 0 >osf1
2789 elif test `echo abc | tr a-z A-Z` = Abc ; then
2790         xxx=`./loc addbib blurfl $pth`
2791         if $test -f $xxx; then
2792         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2793                 echo exit 0 >bsd
2794                 echo exit 0 >usg
2795         else
2796                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2797                         echo "Looks kind of like an extended USG system, but we'll see..."
2798                 else
2799                         echo "Looks kind of like a USG system, but we'll see..."
2800                 fi
2801                 echo exit 0 >usg
2802         fi
2803 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2804         echo "Looks kind of like a BSD system, but we'll see..."
2805         d_bsd="$define"
2806         echo exit 0 >bsd
2807 else
2808         echo "Looks kind of like a Version 7 system, but we'll see..."
2809         echo exit 0 >v7
2810 fi
2811 case "$eunicefix" in
2812 *unixtovms*)
2813         $cat <<'EOI'
2814 There is, however, a strange, musty smell in the air that reminds me of
2815 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2816 EOI
2817         echo exit 0 >eunice
2818         d_eunice="$define"
2819 : it so happens the Eunice I know will not run shell scripts in Unix format
2820         ;;
2821 *)
2822         echo " "
2823         echo "Congratulations.  You aren't running Eunice."
2824         d_eunice="$undef"
2825         ;;
2826 esac
2827 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2828 case "$p_" in
2829 :) ;;
2830 *)
2831         $cat <<'EOI'
2832 I have the feeling something is not exactly right, however...don't tell me...
2833 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2834 EOI
2835         echo exit 0 >os2
2836         ;;
2837 esac
2838 if test -f /xenix; then
2839         echo "Actually, this looks more like a XENIX system..."
2840         echo exit 0 >xenix
2841         d_xenix="$define"
2842 else
2843         echo " "
2844         echo "It's not Xenix..."
2845         d_xenix="$undef"
2846 fi
2847 chmod +x xenix
2848 $eunicefix xenix
2849 if test -f /venix; then
2850         echo "Actually, this looks more like a VENIX system..."
2851         echo exit 0 >venix
2852 else
2853         echo " "
2854         if ./xenix; then
2855                 : null
2856         else
2857                 echo "Nor is it Venix..."
2858         fi
2859 fi
2860 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2861 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2862 $rm -f foo
2863
2864 : see if we need a special compiler
2865 echo " "
2866 if ./usg; then
2867         case "$cc" in
2868         '') case "$Mcc" in
2869                 /*) dflt='Mcc';;
2870                 *) case "$large" in
2871                         -M*) dflt='cc';;
2872                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2873                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2874                                                 dflt='cc'
2875                                         else
2876                                                 dflt='cc -M'
2877                                         fi
2878                                 else
2879                                         dflt='cc'
2880                                 fi;;
2881                         esac;;
2882                 esac;;
2883         *)  dflt="$cc";;
2884         esac
2885         case "$dflt" in
2886         *M*)    $cat <<'EOM'
2887 On some older systems the default C compiler will not resolve multiple global
2888 references that happen to have the same name.  On some such systems the "Mcc"
2889 command may be used to force these to be resolved.  On other systems a "cc -M"
2890 command is required.  (Note that the -M flag on other systems indicates a
2891 memory model to use!) If you have the Gnu C compiler, you might wish to use
2892 that instead.
2893
2894 EOM
2895         ;;
2896         esac
2897         rp="Use which C compiler?"
2898         . ./myread
2899         cc="$ans"
2900 else
2901         case "$cc" in
2902         '') dflt=cc;;
2903         *) dflt="$cc";;
2904         esac
2905         rp="Use which C compiler?"
2906         . ./myread
2907         cc="$ans"
2908 fi
2909 : Look for a hint-file generated 'call-back-unit'.  Now that the
2910 : user has specified the compiler, we may need to set or change some
2911 : other defaults.
2912 if $test -f cc.cbu; then
2913     . ./cc.cbu
2914 fi
2915 echo " "
2916 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2917 $cat >gccvers.c <<EOM
2918 #include <stdio.h>
2919 int main() {
2920 #ifdef __GNUC__
2921 #ifdef __VERSION__
2922         printf("%s\n", __VERSION__);
2923 #else
2924         printf("%s\n", "1");
2925 #endif
2926 #endif
2927         exit(0);
2928 }
2929 EOM
2930 if $cc -o gccvers gccvers.c; then
2931         gccversion=`./gccvers`
2932         case "$gccversion" in
2933         '') echo "You are not using GNU cc." ;;
2934         *)  echo "You are using GNU cc $gccversion." ;;
2935         esac
2936 else
2937         echo " "
2938         echo "*** WHOA THERE!!! ***" >&4
2939         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2940         case "$knowitall" in
2941         '')
2942         echo "    You'd better start hunting for one and let me know about it." >&4
2943                 exit 1
2944                 ;;
2945         esac
2946 fi
2947 $rm -f gccvers*
2948 case "$gccversion" in
2949 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2950 esac
2951
2952 cat <<EOM
2953
2954 Perl can be built to take advantage of explicit 64-bit interfaces,
2955 on some systems.  To do so, Configure must be run with -Duse64bits.
2956
2957 If this doesn't make any sense to you, just accept the default 'n'.
2958 EOM
2959 case "$use64bits" in
2960 $define|true|[yY]*)     dflt='y';;
2961 *) dflt='n';;
2962 esac
2963 rp='Try to use explicit 64-bit interfaces, if available?'
2964 . ./myread
2965 case "$ans" in
2966 y|Y) 
2967         val="$define"
2968         ;;     
2969 *)      
2970         val="$undef"
2971         ;;
2972 esac
2973 set use64bits
2974 eval $setvar
2975
2976 case "$archname64" in
2977 '') archname64='' ;;    # not a typo
2978 esac
2979
2980 case "$use64bits" in
2981 "$define"|true|[yY]*)
2982 : Look for a hint-file generated 'call-back-unit'.  If the
2983 : user has specified that a 64 bit perl is to be built,
2984 : we may need to set or change some other defaults.
2985         if $test -f use64bits.cbu; then
2986                 echo "Your platform has some specific hints for 64-bit builds, using them..."
2987                 . ./use64bits.cbu
2988         else
2989                 $cat <<EOM
2990 (Your platform doesn't have any specific hints for 64-bit builds.
2991  This is probably okay, especially if your system is a true 64-bit system.)
2992 EOM
2993                 case "$gccversion" in
2994                 '')     ;;
2995                 *)      $cat <<EOM
2996 But since you seem to be using gcc,
2997 I will now add -DUSE_LONG_LONG to the compilation flags.
2998 EOM
2999                         ccflags="$ccflags -DUSE_LONG_LONG"
3000                         ;;
3001                 esac
3002         fi
3003         ;;
3004 esac
3005
3006 : determine the architecture name
3007 echo " "
3008 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3009         tarch=`arch`"-$osname"
3010 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3011         if uname -m > tmparch 2>&1 ; then
3012                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3013                         -e 's/$/'"-$osname/" tmparch`
3014         else
3015                 tarch="$osname"
3016         fi
3017         $rm -f tmparch
3018 else
3019         tarch="$osname"
3020 fi
3021 case "$myarchname" in
3022 ''|"$tarch") ;;
3023 *)
3024         echo "(Your architecture name used to be $myarchname.)"
3025         archname=''
3026         ;;
3027 esac
3028 myarchname="$tarch"
3029 case "$archname" in
3030 '') dflt="$tarch";;
3031 *) dflt="$archname";;
3032 esac
3033 rp='What is your architecture name'
3034 . ./myread
3035 archname="$ans"
3036 case "$usethreads" in
3037 $define)
3038         echo "Threads selected." >&4
3039         case "$archname" in
3040         *-thread*) echo "...and architecture name already has -thread." >&4
3041                 ;;
3042         *)      archname="$archname-thread"
3043                 echo "...setting architecture name to $archname." >&4
3044                 ;;
3045         esac
3046         ;;
3047 esac
3048 case "$usemultiplicity" in
3049 $define)
3050         echo "Multiplicity selected." >&4
3051         case "$archname" in
3052         *-multi*) echo "...and architecture name already has -multi." >&4
3053                 ;;
3054         *)      archname="$archname-multi"
3055                 echo "...setting architecture name to $archname." >&4
3056                 ;;
3057         esac
3058         ;;
3059 esac
3060 case "$use64bits" in
3061 $define)
3062         echo "Explicit 64-bitness selected." >&4
3063         case "$archname64" in
3064         '')
3065                 ;;
3066         *)
3067                 case "$archname" in
3068                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3069                         ;;
3070                 *)      archname="$archname-$archname64"
3071                         echo "...setting architecture name to $archname." >&4
3072                         ;;
3073                 esac
3074                 ;;
3075         esac
3076 esac
3077
3078 : decide how portable to be.  Allow command line overrides.
3079 case "$d_portable" in
3080 "$undef") ;;
3081 *)      d_portable="$define" ;;
3082 esac
3083
3084 : set up shell script to do ~ expansion
3085 cat >filexp <<EOSS
3086 $startsh
3087 : expand filename
3088 case "\$1" in
3089  ~/*|~)
3090         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3091         ;;
3092  ~*)
3093         if $test -f /bin/csh; then
3094                 /bin/csh -f -c "glob \$1"
3095                 failed=\$?
3096                 echo ""
3097                 exit \$failed
3098         else
3099                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3100                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3101                 if $test ! -d "\$dir"; then
3102                         me=\`basename \$0\`
3103                         echo "\$me: can't locate home directory for: \$name" >&2
3104                         exit 1
3105                 fi
3106                 case "\$1" in
3107                 */*)
3108                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3109                         ;;
3110                 *)
3111                         echo \$dir
3112                         ;;
3113                 esac
3114         fi
3115         ;;
3116 *)
3117         echo \$1
3118         ;;
3119 esac
3120 EOSS
3121 chmod +x filexp
3122 $eunicefix filexp
3123
3124 : now set up to get a file name
3125 cat <<EOS >getfile
3126 $startsh
3127 EOS
3128 cat <<'EOSC' >>getfile
3129 tilde=''
3130 fullpath=''
3131 already=''
3132 skip=''
3133 none_ok=''
3134 exp_file=''
3135 nopath_ok=''
3136 orig_rp="$rp"
3137 orig_dflt="$dflt"
3138 case "$gfpth" in
3139 '') gfpth='.' ;;
3140 esac
3141
3142 case "$fn" in
3143 *\(*)
3144         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3145         fn=`echo $fn | sed 's/(.*)//'`
3146         ;;
3147 esac
3148
3149 case "$fn" in
3150 *:*)
3151         loc_file=`expr $fn : '.*:\(.*\)'`
3152         fn=`expr $fn : '\(.*\):.*'`
3153         ;;
3154 esac
3155
3156 case "$fn" in
3157 *~*) tilde=true;;
3158 esac
3159 case "$fn" in
3160 */*) fullpath=true;;
3161 esac
3162 case "$fn" in
3163 *+*) skip=true;;
3164 esac
3165 case "$fn" in
3166 *n*) none_ok=true;;
3167 esac
3168 case "$fn" in
3169 *e*) exp_file=true;;
3170 esac
3171 case "$fn" in
3172 *p*) nopath_ok=true;;
3173 esac
3174
3175 case "$fn" in
3176 *f*) type='File';;
3177 *d*) type='Directory';;
3178 *l*) type='Locate';;
3179 esac
3180
3181 what="$type"
3182 case "$what" in
3183 Locate) what='File';;
3184 esac
3185
3186 case "$exp_file" in
3187 '')
3188         case "$d_portable" in
3189         "$define") ;;
3190         *) exp_file=true;;
3191         esac
3192         ;;
3193 esac
3194
3195 cd ..
3196 while test "$type"; do
3197         redo=''
3198         rp="$orig_rp"
3199         dflt="$orig_dflt"
3200         case "$tilde" in
3201         true) rp="$rp (~name ok)";;
3202         esac
3203         . UU/myread
3204         if test -f UU/getfile.ok && \
3205                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3206         then
3207                 value="$ans"
3208                 ansexp="$ans"
3209                 break
3210         fi
3211         case "$ans" in
3212         none)
3213                 value=''
3214                 ansexp=''
3215                 case "$none_ok" in
3216                 true) type='';;
3217                 esac
3218                 ;;
3219         *)
3220                 case "$tilde" in
3221                 '') value="$ans"
3222                         ansexp="$ans";;
3223                 *)
3224                         value=`UU/filexp $ans`
3225                         case $? in
3226                         0)
3227                                 if test "$ans" != "$value"; then
3228                                         echo "(That expands to $value on this system.)"
3229                                 fi
3230                                 ;;
3231                         *) value="$ans";;
3232                         esac
3233                         ansexp="$value"
3234                         case "$exp_file" in
3235                         '') value="$ans";;
3236                         esac
3237                         ;;
3238                 esac
3239                 case "$fullpath" in
3240                 true)
3241                         case "$ansexp" in
3242                         /*) value="$ansexp" ;;
3243                         *)
3244                                 redo=true
3245                                 case "$already" in
3246                                 true)
3247                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3248                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3249                                         ;;
3250                                 *)
3251                                 echo "Please give a full path name, starting with slash." >&4
3252                                         case "$tilde" in
3253                                         true)
3254                                 echo "Note that using ~name is ok provided it expands well." >&4
3255                                                 already=true
3256                                                 ;;
3257                                         esac
3258                                 esac
3259                                 ;;
3260                         esac
3261                         ;;
3262                 esac
3263                 case "$redo" in
3264                 '')
3265                         case "$type" in
3266                         File)
3267                                 for fp in $gfpth; do
3268                                         if test "X$fp" = X.; then
3269                                             pf="$ansexp"
3270                                         else    
3271                                             pf="$fp/$ansexp"
3272                                         fi
3273                                         if test -f "$pf"; then
3274                                                 type=''
3275                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3276                                         then
3277                                                 echo "($value is not a plain file, but that's ok.)"
3278                                                 type=''
3279                                         fi
3280                                         if test X"$type" = X; then
3281                                             value="$pf"
3282                                             break
3283                                         fi
3284                                 done
3285                                 ;;
3286                         Directory)
3287                                 for fp in $gfpth; do
3288                                         if test "X$fp" = X.; then
3289                                             pf="$ansexp"
3290                                         else    
3291                                             pf="$fp/$ansexp"
3292                                         fi
3293                                         if test -d "$pf"; then
3294                                                 type=''
3295                                                 value="$pf"
3296                                                 break
3297                                         fi
3298                                 done
3299                                 ;;
3300                         Locate)
3301                                 if test -d "$ansexp"; then
3302                                         echo "(Looking for $loc_file in directory $value.)"
3303                                         value="$value/$loc_file"
3304                                         ansexp="$ansexp/$loc_file"
3305                                 fi
3306                                 if test -f "$ansexp"; then
3307                                         type=''
3308                                 fi
3309                                 case "$nopath_ok" in
3310                                 true)   case "$value" in
3311                                         */*) ;;
3312                                         *)      echo "Assuming $value will be in people's path."
3313                                                 type=''
3314                                                 ;;
3315                                         esac
3316                                         ;;
3317                                 esac
3318                                 ;;
3319                         esac
3320
3321                         case "$skip" in
3322                         true) type='';
3323                         esac
3324
3325                         case "$type" in
3326                         '') ;;
3327                         *)
3328                                 if test "$fastread" = yes; then
3329                                         dflt=y
3330                                 else
3331                                         dflt=n
3332                                 fi
3333                                 rp="$what $value doesn't exist.  Use that name anyway?"
3334                                 . UU/myread
3335                                 dflt=''
3336                                 case "$ans" in
3337                                 y*) type='';;
3338                                 *) echo " ";;
3339                                 esac
3340                                 ;;
3341                         esac
3342                         ;;
3343                 esac
3344                 ;;
3345         esac
3346 done
3347 cd UU
3348 ans="$value"
3349 rp="$orig_rp"
3350 dflt="$orig_dflt"
3351 rm -f getfile.ok
3352 test "X$gfpthkeep" != Xy && gfpth=""
3353 EOSC
3354
3355 : determine root of directory hierarchy where package will be installed.
3356 case "$prefix" in
3357 '')
3358         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3359         ;;
3360 *)
3361         dflt="$prefix"
3362         ;;
3363 esac
3364 $cat <<EOM
3365
3366 By default, $package will be installed in $dflt/bin, manual pages
3367 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3368 installation directories. Typically this is something like /usr/local.
3369 If you wish to have binaries under /usr/bin but other parts of the
3370 installation under /usr/local, that's ok: you will be prompted
3371 separately for each of the installation directories, the prefix being
3372 only used to set the defaults.
3373
3374 EOM
3375 fn=d~
3376 rp='Installation prefix to use?'
3377 . ./getfile
3378 oldprefix=''
3379 case "$prefix" in
3380 '') ;;
3381 *)
3382         case "$ans" in
3383         "$prefix") ;;
3384         *) oldprefix="$prefix";;
3385         esac
3386         ;;
3387 esac
3388 prefix="$ans"
3389 prefixexp="$ansexp"
3390
3391 : is AFS running?
3392 echo " "
3393 case "$afs" in
3394 $define|true)   afs=true ;;
3395 $undef|false)   afs=false ;;
3396 *)      if test -d /afs; then
3397                 afs=true
3398         else
3399                 afs=false
3400         fi
3401         ;;
3402 esac
3403 if $afs; then
3404         echo "AFS may be running... I'll be extra cautious then..." >&4
3405 else
3406         echo "AFS does not seem to be running..." >&4
3407 fi
3408
3409 : determine installation prefix for where package is to be installed.
3410 if $afs; then 
3411 $cat <<EOM
3412
3413 Since you are running AFS, I need to distinguish the directory in which
3414 files will reside from the directory in which they are installed (and from
3415 which they are presumably copied to the former directory by occult means).
3416
3417 EOM
3418         case "$installprefix" in
3419         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3420         *) dflt="$installprefix";;
3421         esac
3422 else
3423 $cat <<EOM
3424
3425 In some special cases, particularly when building $package for distribution,
3426 it is convenient to distinguish between the directory in which files should 
3427 be installed from the directory ($prefix) in which they 
3428 will eventually reside.  For most users, these two directories are the same.
3429
3430 EOM
3431         case "$installprefix" in
3432         '') dflt=$prefix ;;
3433         *) dflt=$installprefix;;
3434         esac
3435 fi
3436 fn=d~
3437 rp='What installation prefix should I use for installing files?'
3438 . ./getfile
3439 installprefix="$ans"
3440 installprefixexp="$ansexp"
3441
3442 : set the prefixit variable, to compute a suitable default value
3443 prefixit='case "$3" in
3444 ""|none)
3445         case "$oldprefix" in
3446         "") eval "$1=\"\$$2\"";;
3447         *)
3448                 case "$3" in
3449                 "") eval "$1=";;
3450                 none)
3451                         eval "tp=\"\$$2\"";
3452                         case "$tp" in
3453                         ""|" ") eval "$1=\"\$$2\"";;
3454                         *) eval "$1=";;
3455                         esac;;
3456                 esac;;
3457         esac;;
3458 *)
3459         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3460         case "$tp" in
3461         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3462         /*-$oldprefix/*|\~*-$oldprefix/*)
3463                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3464         *) eval "$1=\"\$$2\"";;
3465         esac;;
3466 esac'
3467
3468 : set the base revision
3469 baserev=5.0
3470
3471 : get the patchlevel
3472 echo " "
3473 echo "Getting the current patchlevel..." >&4
3474 if $test -r $rsrc/patchlevel.h;then
3475         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3476         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3477 else
3478         patchlevel=0
3479         subversion=0
3480 fi
3481 $echo $n "(You have $package" $c
3482 case "$package" in
3483 "*$baserev")    ;;
3484 *)              $echo $n " $baserev" $c ;;
3485 esac
3486 $echo $n " patchlevel $patchlevel" $c
3487 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3488 echo ".)"
3489
3490 if test 0 -eq "$subversion"; then
3491         version=`LC_ALL=C; export LC_ALL; \
3492                  echo $baserev $patchlevel | \
3493                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3494 else
3495         version=`LC_ALL=C; export LC_ALL; \
3496                  echo $baserev $patchlevel $subversion | \
3497                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3498 fi
3499 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3500 if test "$subversion" -lt 50; then
3501         apiversion=`LC_ALL=C; export LC_ALL; \
3502                  LANGUAGE=C; export LANGUAGE; \
3503                  echo $baserev $patchlevel | \
3504                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3505 else
3506         apiversion="$version"
3507 fi
3508
3509 : determine installation style
3510 : For now, try to deduce it from prefix unless it is already set.
3511 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3512 case "$installstyle" in
3513 '')     case "$prefix" in
3514                 *perl*) dflt='lib';;
3515                 *) dflt='lib/perl5' ;;
3516         esac
3517         ;;
3518 *)      dflt='lib/perl5' ;;
3519 esac
3520 : Probably not worth prompting for this since we prompt for all
3521 : the directories individually, and the prompt would be too long and
3522 : confusing anyway.
3523 installstyle=$dflt
3524
3525 : determine where private library files go
3526 : Usual default is /usr/local/lib/perl5/$version.
3527 : Also allow things like /opt/perl/lib/$version, since 
3528 : /opt/perl/lib/perl5... would be redundant.
3529 : The default "style" setting is made in installstyle.U
3530 case "$installstyle" in
3531 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3532 *)       set dflt privlib lib/$version ;;
3533 esac
3534 eval $prefixit
3535 $cat <<EOM
3536
3537 There are some auxiliary files for $package that need to be put into a
3538 private library directory that is accessible by everyone.
3539
3540 EOM
3541 fn=d~+
3542 rp='Pathname where the private library files will reside?'
3543 . ./getfile
3544 privlib="$ans"
3545 privlibexp="$ansexp"
3546 : Change installation prefix, if necessary.
3547 if $test X"$prefix" != X"$installprefix"; then
3548         installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
3549 else
3550         installprivlib="$privlibexp"
3551 fi
3552
3553 : set the prefixup variable, to restore leading tilda escape
3554 prefixup='case "$prefixexp" in
3555 "$prefix") ;;
3556 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3557 esac'
3558
3559 : determine where public architecture dependent libraries go
3560 set archlib archlib
3561 eval $prefixit
3562 : privlib default is /usr/local/lib/$package/$version
3563 : archlib default is /usr/local/lib/$package/$version/$archname
3564 : privlib may have an optional trailing /share.
3565 tdflt=`echo $privlib | $sed 's,/share$,,'`
3566 tdflt=$tdflt/$archname
3567 case "$archlib" in
3568 '')     dflt=$tdflt
3569         ;;
3570 *)      dflt="$archlib"
3571     ;;
3572 esac
3573 $cat <<EOM
3574
3575 $spackage contains architecture-dependent library files.  If you are
3576 sharing libraries in a heterogeneous environment, you might store
3577 these files in a separate location.  Otherwise, you can just include
3578 them with the rest of the public library files.
3579
3580 EOM
3581 fn=d+~
3582 rp='Where do you want to put the public architecture-dependent libraries?'
3583 . ./getfile
3584 archlib="$ans"
3585 archlibexp="$ansexp"
3586 if $test X"$archlib" = X"$privlib"; then
3587         d_archlib="$undef"
3588 else
3589         d_archlib="$define"
3590 fi
3591 : Change installation prefix, if necessary.
3592 if $test X"$prefix" != X"$installprefix"; then
3593         installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
3594 else
3595         installarchlib="$archlibexp"
3596 fi
3597
3598
3599 : Binary compatibility with 5.005 is not possible for builds
3600 : with advanced features
3601 case "$usethreads$usemultiplicity" in
3602 *define*) bincompat5005="$undef" ;;
3603 *)      $cat <<EOM
3604
3605 Perl 5.006 can be compiled for binary compatibility with 5.005.
3606 If you decide to do so, you will be able to continue using most
3607 of the extensions that were compiled for Perl 5.005.
3608
3609 EOM
3610         case "$bincompat5005$d_bincompat5005" in
3611         *"$undef"*) dflt=n ;;
3612         *) dflt=y ;;
3613         esac
3614         rp='Binary compatibility with Perl 5.005?'
3615         . ./myread
3616         case "$ans" in
3617         y*) val="$define" ;;
3618         *)  val="$undef" ;;
3619         esac
3620         set d_bincompat5005
3621         eval $setvar
3622         case "$d_bincompat5005" in
3623         "$define") bincompat5005="$define" ;;
3624         *) bincompat5005="$undef" ;;
3625         esac
3626         ;;
3627 esac
3628
3629
3630 : see if setuid scripts can be secure
3631 $cat <<EOM
3632
3633 Some kernels have a bug that prevents setuid #! scripts from being
3634 secure.  Some sites have disabled setuid #! scripts because of this.
3635
3636 First let's decide if your kernel supports secure setuid #! scripts.
3637 (If setuid #! scripts would be secure but have been disabled anyway,
3638 don't say that they are secure if asked.)
3639
3640 EOM
3641
3642 val="$undef"
3643 if $test -d /dev/fd; then
3644         echo "#!$ls" >reflect
3645         chmod +x,u+s reflect
3646         ./reflect >flect 2>&1
3647         if $contains "/dev/fd" flect >/dev/null; then
3648                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3649                 val="$define"
3650         else
3651                 $cat <<EOM
3652 If you are not sure if they are secure, I can check but I'll need a
3653 username and password different from the one you are using right now.
3654 If you don't have such a username or don't want me to test, simply
3655 enter 'none'.
3656
3657 EOM
3658                 rp='Other username to test security of setuid scripts with?'
3659                 dflt='none'
3660                 . ./myread
3661                 case "$ans" in
3662                 n|none)
3663                         case "$d_suidsafe" in
3664                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3665                                 dflt=n;;
3666                         "$undef")
3667                                 echo "Well, the $hint value is *not* secure." >&4
3668                                 dflt=n;;
3669                         *)      echo "Well, the $hint value *is* secure." >&4
3670                                 dflt=y;;
3671                         esac
3672                         ;;
3673                 *)
3674                         $rm -f reflect flect
3675                         echo "#!$ls" >reflect
3676                         chmod +x,u+s reflect
3677                         echo >flect
3678                         chmod a+w flect
3679                         echo '"su" will (probably) prompt you for '"$ans's password."
3680                         su $ans -c './reflect >flect'
3681                         if $contains "/dev/fd" flect >/dev/null; then
3682                                 echo "Okay, it looks like setuid scripts are secure." >&4
3683                                 dflt=y
3684                         else
3685                                 echo "I don't think setuid scripts are secure." >&4
3686                                 dflt=n
3687                         fi
3688                         ;;
3689                 esac
3690                 rp='Does your kernel have *secure* setuid scripts?'
3691                 . ./myread
3692                 case "$ans" in
3693                 [yY]*)  val="$define";;
3694                 *)      val="$undef";;
3695                 esac
3696         fi
3697 else
3698         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3699         echo "(That's for file descriptors, not floppy disks.)"
3700         val="$undef"
3701 fi
3702 set d_suidsafe
3703 eval $setvar
3704
3705 $rm -f reflect flect
3706
3707 : now see if they want to do setuid emulation
3708 echo " "
3709 val="$undef"
3710 case "$d_suidsafe" in
3711 "$define")
3712         val="$undef"
3713         echo "No need to emulate SUID scripts since they are secure here." >& 4
3714         ;;
3715 *)
3716         $cat <<EOM
3717 Some systems have disabled setuid scripts, especially systems where
3718 setuid scripts cannot be secure.  On systems where setuid scripts have
3719 been disabled, the setuid/setgid bits on scripts are currently
3720 useless.  It is possible for $package to detect those bits and emulate
3721 setuid/setgid in a secure fashion.  This emulation will only work if
3722 setuid scripts have been disabled in your kernel.
3723
3724 EOM
3725         case "$d_dosuid" in
3726         "$define") dflt=y ;;
3727         *) dflt=n ;;
3728         esac
3729         rp="Do you want to do setuid/setgid emulation?"
3730         . ./myread
3731         case "$ans" in
3732         [yY]*)  val="$define";;
3733         *)      val="$undef";;
3734         esac
3735         ;;
3736 esac
3737 set d_dosuid
3738 eval $setvar
3739
3740 : What should the include directory be ?
3741 echo " "
3742 $echo $n "Hmm...  $c"
3743 dflt='/usr/include'
3744 incpath=''
3745 mips_type=''
3746 if $test -f /bin/mips && /bin/mips; then
3747         echo "Looks like a MIPS system..."
3748         $cat >usr.c <<'EOCP'
3749 #ifdef SYSTYPE_BSD43
3750 /bsd43
3751 #endif
3752 EOCP
3753         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3754                 dflt='/bsd43/usr/include'
3755                 incpath='/bsd43'
3756                 mips_type='BSD 4.3'
3757         else
3758                 mips_type='System V'
3759         fi
3760         $rm -f usr.c usr.out
3761         echo "and you're compiling with the $mips_type compiler and libraries."
3762         xxx_prompt=y
3763         echo "exit 0" >mips
3764 else
3765         echo "Doesn't look like a MIPS system."
3766         xxx_prompt=n
3767         echo "exit 1" >mips
3768 fi
3769 chmod +x mips
3770 $eunicefix mips
3771 case "$usrinc" in
3772 '') ;;
3773 *) dflt="$usrinc";;
3774 esac
3775 case "$xxx_prompt" in
3776 y)      fn=d/
3777         echo " "
3778         rp='Where are the include files you want to use?'
3779         . ./getfile
3780         usrinc="$ans"
3781         ;;
3782 *)      usrinc="$dflt"
3783         ;;
3784 esac
3785
3786 : see how we invoke the C preprocessor
3787 echo " "
3788 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3789 cat <<'EOT' >testcpp.c
3790 #define ABC abc
3791 #define XYZ xyz
3792 ABC.XYZ
3793 EOT
3794 cd ..
3795 if test ! -f cppstdin; then
3796         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3797 else
3798         echo "Keeping your $hint cppstdin wrapper."
3799 fi
3800 chmod 755 cppstdin
3801 wrapper=`pwd`/cppstdin
3802 ok='false'
3803 cd UU
3804
3805 if $test "X$cppstdin" != "X" && \
3806         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3807         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3808 then
3809         echo "You used to use $cppstdin $cppminus so we'll use that again."
3810         case "$cpprun" in
3811         '') echo "But let's see if we can live without a wrapper..." ;;
3812         *)
3813                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3814                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3815                 then
3816                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3817                         ok='true'
3818                 else
3819                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3820                 fi
3821                 ;;
3822         esac
3823 else
3824         case "$cppstdin" in
3825         '') ;;
3826         *)
3827                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3828                 ;;
3829         esac
3830 fi
3831
3832 if $ok; then
3833         : nothing
3834 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3835         $cc -E <testcpp.c >testcpp.out 2>&1; \
3836         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3837         echo "Yup, it does."
3838         x_cpp="$cc -E"
3839         x_minus='';
3840 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3841         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3842         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3843         echo "Yup, it does."
3844         x_cpp="$cc -E"
3845         x_minus='-';
3846 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3847         $cc -P <testcpp.c >testcpp.out 2>&1; \
3848         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3849         echo "Yipee, that works!"
3850         x_cpp="$cc -P"
3851         x_minus='';
3852 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3853         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3854         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3855         echo "At long last!"
3856         x_cpp="$cc -P"
3857         x_minus='-';
3858 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3859         $cpp <testcpp.c >testcpp.out 2>&1; \
3860         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3861         echo "It works!"
3862         x_cpp="$cpp"
3863         x_minus='';
3864 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3865         $cpp - <testcpp.c >testcpp.out 2>&1; \
3866         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3867         echo "Hooray, it works!  I was beginning to wonder."
3868         x_cpp="$cpp"
3869         x_minus='-';
3870 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3871         $wrapper <testcpp.c >testcpp.out 2>&1; \
3872         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3873         x_cpp="$wrapper"
3874         x_minus=''
3875         echo "Eureka!"
3876 else
3877         dflt=''
3878         rp="No dice.  I can't find a C preprocessor.  Name one:"
3879         . ./myread
3880         x_cpp="$ans"
3881         x_minus=''
3882         $x_cpp <testcpp.c >testcpp.out 2>&1
3883         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3884                 echo "OK, that will do." >&4
3885         else
3886 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3887                 exit 1
3888         fi
3889 fi
3890
3891 case "$ok" in
3892 false)
3893         cppstdin="$x_cpp"
3894         cppminus="$x_minus"
3895         cpprun="$x_cpp"
3896         cpplast="$x_minus"
3897         set X $x_cpp
3898         shift
3899         case "$1" in
3900         "$cpp")
3901                 echo "Perhaps can we force $cc -E using a wrapper..."
3902                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3903                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3904                 then
3905                         echo "Yup, we can."
3906                         cppstdin="$wrapper"
3907                         cppminus='';
3908                 else
3909                         echo "Nope, we'll have to live without it..."
3910                 fi
3911                 ;;
3912         esac
3913         case "$cpprun" in
3914         "$wrapper")
3915                 cpprun=''
3916                 cpplast=''
3917                 ;;
3918         esac
3919         ;;
3920 esac
3921
3922 case "$cppstdin" in
3923 "$wrapper"|'cppstdin') ;;
3924 *) $rm -f $wrapper;;
3925 esac
3926 $rm -f testcpp.c testcpp.out
3927
3928 : Set private lib path
3929 case "$plibpth" in
3930 '') if ./mips; then
3931                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3932         fi;;
3933 esac
3934 case "$libpth" in
3935 ' ') dlist='';;
3936 '') dlist="$loclibpth $plibpth $glibpth";;
3937 *) dlist="$libpth";;
3938 esac
3939
3940 : Now check and see which directories actually exist, avoiding duplicates
3941 libpth=''
3942 for xxx in $dlist
3943 do
3944     if $test -d $xxx; then
3945                 case " $libpth " in
3946                 *" $xxx "*) ;;
3947                 *) libpth="$libpth $xxx";;
3948                 esac
3949     fi
3950 done
3951 $cat <<'EOM'
3952
3953 Some systems have incompatible or broken versions of libraries.  Among
3954 the directories listed in the question below, please remove any you
3955 know not to be holding relevant libraries, and add any that are needed.
3956 Say "none" for none.
3957
3958 EOM
3959 case "$libpth" in
3960 '') dflt='none';;
3961 *)
3962         set X $libpth
3963         shift
3964         dflt=${1+"$@"}
3965         ;;
3966 esac
3967 rp="Directories to use for library searches?"
3968 . ./myread
3969 case "$ans" in
3970 none) libpth=' ';;
3971 *) libpth="$ans";;
3972 esac
3973
3974 : compute shared library extension
3975 case "$so" in
3976 '')
3977         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3978                 dflt='sl'
3979         else
3980                 dflt='so'
3981         fi
3982         ;;
3983 *) dflt="$so";;
3984 esac
3985 $cat <<EOM
3986
3987 On some systems, shared libraries may be available.  Answer 'none' if
3988 you want to suppress searching of shared libraries for the remaining
3989 of this configuration.
3990
3991 EOM
3992 rp='What is the file extension used for shared libraries?'
3993 . ./myread
3994 so="$ans"
3995
3996 : Define several unixisms.
3997 : Hints files or command line option can be used to override them.
3998 : The convoluted testing is in case hints files set either the old
3999 : or the new name.
4000 case "$_exe" in
4001 '')     case "$exe_ext" in
4002     '') ;;
4003         *)      _exe="$exe_ext" ;;
4004         esac
4005         ;;
4006 esac
4007 case "$_a" in
4008 '')     case "$lib_ext" in
4009     '') _a='.a';;
4010         *)      _a="$lib_ext" ;;
4011         esac
4012         ;;
4013 esac
4014 case "$_o" in
4015 '') case "$obj_ext" in
4016         '')     _o='.o';;
4017         *)      _o="$obj_ext";;
4018         esac
4019         ;;
4020 esac
4021 case "$p_" in
4022 '') case "$path_sep" in
4023         '')     p_=':';;
4024         *)      p_="$path_sep";;
4025         esac
4026         ;;
4027 esac
4028 exe_ext=$_exe
4029 lib_ext=$_a
4030 obj_ext=$_o
4031 path_sep=$p_
4032
4033 : Which makefile gets called first.  This is used by make depend.
4034 case "$firstmakefile" in
4035 '') firstmakefile='makefile';;
4036 esac
4037
4038 cat <<EOM
4039
4040 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4041 Configure must be run with -Dusesocks.
4042
4043 Normally you do not need this and you should answer no.
4044
4045 EOM
4046 case "$usesocks" in
4047 $define|true|[yY]*)     dflt='y';;
4048 *) dflt='n';;
4049 esac
4050 rp='Build Perl for SOCKS?'
4051 . ./myread
4052 case "$ans" in
4053 y|Y)    val="$define" ;;     
4054 *)      val="$undef" ;;
4055 esac
4056 set usesocks
4057 eval $setvar
4058
4059 : Looking for optional libraries
4060 echo " "
4061 echo "Checking for optional libraries..." >&4
4062 case "$libs" in
4063 ' '|'') dflt='';;
4064 *) dflt="$libs";;
4065 esac
4066 case "$libswanted" in
4067 '') libswanted='c_s';;
4068 esac
4069 case "$usesocks" in
4070 $define)
4071         libswanted="$libswanted socks5 socks5_sh"
4072         ;;
4073 esac
4074 for thislib in $libswanted; do
4075         
4076         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4077                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4078                 echo "Found -l$thislib (shared)."
4079                 case " $dflt " in
4080                 *"-l$thislib "*);;
4081                 *) dflt="$dflt -l$thislib";;
4082                 esac
4083         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4084                 echo "Found -l$thislib (shared)."
4085                 case " $dflt " in
4086                 *"-l$thislib "*);;
4087                 *) dflt="$dflt -l$thislib";;
4088                 esac
4089         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4090                 echo "Found -l$thislib."
4091                 case " $dflt " in
4092                 *"-l$thislib "*);;
4093                 *) dflt="$dflt -l$thislib";;
4094                 esac
4095         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4096                 echo "Found -l$thislib."
4097                 case " $dflt " in
4098                 *"-l$thislib "*);;
4099                 *) dflt="$dflt -l$thislib";;
4100                 esac
4101         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4102                 echo "Found -l${thislib}_s."
4103                 case " $dflt " in
4104                 *"-l$thislib "*);;
4105                 *) dflt="$dflt -l${thislib}_s";;
4106                 esac
4107         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4108                 echo "Found -l$thislib."
4109                 case " $dflt " in
4110                 *"-l$thislib "*);;
4111                 *) dflt="$dflt -l$thislib";;
4112                 esac
4113         else
4114                 echo "No -l$thislib."
4115         fi
4116 done
4117 set X $dflt
4118 shift
4119 dflt="$*"
4120 case "$libs" in
4121 '') dflt="$dflt";;
4122 *) dflt="$libs";;
4123 esac
4124 case "$dflt" in
4125 ' '|'') dflt='none';;
4126 esac
4127
4128 $cat <<EOM
4129
4130 In order to compile $package on your machine, a number of libraries
4131 are usually needed.  Include any other special libraries here as well.
4132 Say "none" for none.  The default list is almost always right.
4133 EOM
4134
4135 echo " "
4136 rp="What libraries to use?"
4137 . ./myread
4138 case "$ans" in
4139 none) libs=' ';;
4140 *) libs="$ans";;
4141 esac
4142
4143 : determine optimize, if desired, or use for debug flag also
4144 case "$optimize" in
4145 ' '|$undef) dflt='none';;
4146 '') dflt='-O';;
4147 *) dflt="$optimize";;
4148 esac
4149 $cat <<EOH
4150
4151 Some C compilers have problems with their optimizers.  By default, $package
4152 compiles with the -O flag to use the optimizer.  Alternately, you might want
4153 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4154 systems).  Either flag can be specified here.  To use neither flag, specify
4155 the word "none".
4156
4157 EOH
4158 rp="What optimizer/debugger flag should be used?"
4159 . ./myread
4160 optimize="$ans"
4161 case "$optimize" in
4162 'none') optimize=" ";;
4163 esac
4164
4165 dflt=''
4166 : We will not override a previous value, but we might want to
4167 : augment a hint file
4168 case "$hint" in
4169 none|recommended)
4170         case "$gccversion" in
4171         1*) dflt='-fpcc-struct-return' ;;
4172         esac
4173         case "$optimize" in
4174         *-g*) dflt="$dflt -DDEBUGGING";;
4175         esac
4176         case "$gccversion" in
4177         2*) if test -d /etc/conf/kconfig.d &&
4178                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4179                 then
4180                         dflt="$dflt -posix"
4181                 fi
4182                 ;;
4183         esac
4184         ;;
4185 esac
4186
4187 case "$mips_type" in
4188 *BSD*|'') inclwanted="$locincpth $usrinc";;
4189 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4190 esac
4191 for thisincl in $inclwanted; do
4192         if $test -d $thisincl; then
4193                 if $test x$thisincl != x$usrinc; then
4194                         case "$dflt" in
4195                         *$thisincl*);;
4196                         *) dflt="$dflt -I$thisincl";;
4197                         esac
4198                 fi
4199         fi
4200 done
4201
4202 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4203         xxx=true;
4204 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4205         xxx=true;
4206 else
4207         xxx=false;
4208 fi;
4209 if $xxx; then
4210         case "$dflt" in
4211         *$2*);;
4212         *) dflt="$dflt -D$2";;
4213         esac;
4214 fi'
4215
4216 set signal.h LANGUAGE_C; eval $inctest
4217
4218 case "$usesocks" in
4219 $define)
4220         ccflags="$ccflags -DSOCKS"
4221         ;;
4222 esac
4223
4224 case "$hint" in
4225 none|recommended) dflt="$ccflags $dflt" ;;
4226 *) dflt="$ccflags";;
4227 esac
4228
4229 case "$dflt" in
4230 ''|' ') dflt=none;;
4231 esac
4232 $cat <<EOH
4233
4234 Your C compiler may want other flags.  For this question you should include
4235 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4236 but you should NOT include libraries or ld flags like -lwhatever.  If you
4237 want $package to honor its debug switch, you should include -DDEBUGGING here.
4238 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4239
4240 To use no flags, specify the word "none".
4241
4242 EOH
4243 set X $dflt
4244 shift
4245 dflt=${1+"$@"}
4246 rp="Any additional cc flags?"
4247 . ./myread
4248 case "$ans" in
4249 none) ccflags='';;
4250 *) ccflags="$ans";;
4251 esac
4252
4253 : the following weeds options from ccflags that are of no interest to cpp
4254 cppflags="$ccflags"
4255 case "$gccversion" in
4256 1*) cppflags="$cppflags -D__GNUC__"
4257 esac
4258 case "$mips_type" in
4259 '');;
4260 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4261 esac
4262 case "$cppflags" in
4263 '');;
4264 *)
4265         echo " "
4266         echo "Let me guess what the preprocessor flags are..." >&4
4267         set X $cppflags
4268         shift
4269         cppflags=''
4270         $cat >cpp.c <<'EOM'
4271 #define BLURFL foo
4272
4273 BLURFL xx LFRULB
4274 EOM
4275         previous=''
4276         for flag in $*
4277         do
4278                 case "$flag" in
4279                 -*) ftry="$flag";;
4280                 *) ftry="$previous $flag";;
4281                 esac
4282                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4283                         >cpp1.out 2>/dev/null && \
4284                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4285                         >cpp2.out 2>/dev/null && \
4286                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4287                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4288                 then
4289                         cppflags="$cppflags $ftry"
4290                         previous=''
4291                 else
4292                         previous="$flag"
4293                 fi
4294         done
4295         set X $cppflags
4296         shift
4297         cppflags=${1+"$@"}
4298         case "$cppflags" in
4299         *-*)  echo "They appear to be: $cppflags";;
4300         esac
4301         $rm -f cpp.c cpp?.out
4302         ;;
4303 esac
4304
4305 : flags used in final linking phase
4306 case "$ldflags" in
4307 '') if ./venix; then
4308                 dflt='-i -z'
4309         else
4310                 dflt=''
4311         fi
4312         case "$ccflags" in
4313         *-posix*) dflt="$dflt -posix" ;;
4314         esac
4315         ;;
4316 *) dflt="$ldflags";;
4317 esac
4318
4319 : Try to guess additional flags to pick up local libraries.
4320 for thislibdir in $libpth; do
4321         case " $loclibpth " in
4322         *" $thislibdir "*)
4323                 case "$dflt " in 
4324                 *"-L$thislibdir "*) ;;
4325                 *)  dflt="$dflt -L$thislibdir" ;;
4326                 esac
4327                 ;;
4328         esac
4329 done
4330
4331 case "$dflt" in
4332 '') dflt='none' ;;
4333 esac
4334
4335 $cat <<EOH
4336
4337 Your C linker may need flags.  For this question you should
4338 include -L/whatever and any other flags used by the C linker, but you
4339 should NOT include libraries like -lwhatever.
4340
4341 Make sure you include the appropriate -L/path flags if your C linker
4342 does not normally search all of the directories you specified above,
4343 namely
4344         $libpth
4345 To use no flags, specify the word "none".
4346
4347 EOH
4348
4349 rp="Any additional ld flags (NOT including libraries)?"
4350 . ./myread
4351 case "$ans" in
4352 none) ldflags='';;
4353 *) ldflags="$ans";;
4354 esac
4355 rmlist="$rmlist pdp11"
4356
4357 : coherency check
4358 echo " "
4359 echo "Checking your choice of C compiler and flags for coherency..." >&4
4360 $cat > try.c <<'EOF'
4361 #include <stdio.h>
4362 int main() { printf("Ok\n"); exit(0); }
4363 EOF
4364 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4365 shift
4366 $cat >try.msg <<'EOM'
4367 I've tried to compile and run the following simple program:
4368
4369 EOM
4370 $cat try.c >> try.msg
4371
4372 $cat >> try.msg <<EOM
4373
4374 I used the command:
4375
4376         $*
4377         ./try
4378
4379 and I got the following output:
4380
4381 EOM
4382 dflt=y
4383 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4384         if sh -c './try' >>try.msg 2>&1; then
4385                 xxx=`./try`
4386                 case "$xxx" in
4387                 "Ok") dflt=n ;;
4388                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4389                         case " $libs " in
4390                         *" -lsfio "*)
4391                                 cat >> try.msg <<'EOQS'
4392 If $libs contains -lsfio, and sfio is mis-configured, then it
4393 sometimes (apparently) runs and exits with a 0 status, but with no
4394 output!  It may have to do with sfio's use of _exit vs. exit.
4395
4396 EOQS
4397                                 rp="You have a big problem.  Shall I abort Configure"
4398                                 dflt=y
4399                                 ;;
4400                         esac
4401                         ;;
4402                 esac
4403         else
4404                 echo "The program compiled OK, but exited with status $?." >>try.msg
4405                 rp="You have a problem.  Shall I abort Configure"
4406                 dflt=y
4407         fi
4408 else
4409         echo "I can't compile the test program." >>try.msg
4410         rp="You have a BIG problem.  Shall I abort Configure"
4411         dflt=y
4412 fi
4413 case "$dflt" in
4414 y)
4415         $cat try.msg >&4
4416         case "$knowitall" in
4417         '')
4418                 echo "(The supplied flags or libraries might be incorrect.)"
4419                 ;;
4420         *) dflt=n;;
4421         esac
4422         echo " "
4423         . ./myread
4424         case "$ans" in
4425         n*|N*) ;;
4426         *)      echo "Ok.  Stopping Configure." >&4
4427                 exit 1
4428                 ;;
4429         esac
4430         ;;
4431 n) echo "OK, that should do.";;
4432 esac
4433 $rm -f try try.* core
4434
4435 : determine filename position in cpp output
4436 echo " "
4437 echo "Computing filename position in cpp output for #include directives..." >&4
4438 echo '#include <stdio.h>' > foo.c
4439 $cat >fieldn <<EOF
4440 $startsh
4441 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4442 $grep '^[       ]*#.*stdio\.h' | \
4443 while read cline; do
4444         pos=1
4445         set \$cline
4446         while $test \$# -gt 0; do
4447                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4448                         echo "\$pos"
4449                         exit 0
4450                 fi
4451                 shift
4452                 pos=\`expr \$pos + 1\`
4453         done
4454 done
4455 EOF
4456 chmod +x fieldn
4457 fieldn=`./fieldn`
4458 $rm -f foo.c fieldn
4459 case $fieldn in
4460 '') pos='???';;
4461 1) pos=first;;
4462 2) pos=second;;
4463 3) pos=third;;
4464 *) pos="${fieldn}th";;
4465 esac
4466 echo "Your cpp writes the filename in the $pos field of the line."
4467
4468 : locate header file
4469 $cat >findhdr <<EOF
4470 $startsh
4471 wanted=\$1
4472 name=''
4473 for usrincdir in $usrinc
4474 do
4475         if test -f \$usrincdir/\$wanted; then
4476                 echo "\$usrincdir/\$wanted"
4477                 exit 0
4478         fi
4479 done
4480 awkprg='{ print \$$fieldn }'
4481 echo "#include <\$wanted>" > foo\$\$.c
4482 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4483 $grep "^[       ]*#.*\$wanted" | \
4484 while read cline; do
4485         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4486         case "\$name" in
4487         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4488         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4489         *) exit 2;;
4490         esac;
4491 done;
4492 #
4493 # status = 0: grep returned 0 lines, case statement not executed
4494 # status = 1: headerfile found
4495 # status = 2: while loop executed, no headerfile found
4496 #
4497 status=\$?
4498 $rm -f foo\$\$.c;
4499 if test \$status -eq 1; then
4500         exit 0;
4501 fi
4502 exit 1
4503 EOF
4504 chmod +x findhdr
4505
4506
4507 : define an alternate in-header-list? function
4508 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4509 cont=true; xxf="echo \"<\$1> found.\" >&4";
4510 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4511 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4512 esac;
4513 case $# in 4) instead=instead;; *) instead="at last";; esac;
4514 while $test "$cont"; do
4515         xxx=`./findhdr $1`
4516         var=$2; eval "was=\$$2";
4517         if $test "$xxx" && $test -r "$xxx";
4518         then eval $xxf;
4519         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4520                 cont="";
4521         else eval $xxnf;
4522         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4523         set $yyy; shift; shift; yyy=$@;
4524         case $# in 0) cont="";;
4525         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4526                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4527         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4528                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4529         esac;
4530 done;
4531 while $test "$yyy";
4532 do set $yyy; var=$2; eval "was=\$$2";
4533         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4534         set $yyy; shift; shift; yyy=$@;
4535 done'
4536
4537 : see if this is a malloc.h system
4538 set malloc.h i_malloc
4539 eval $inhdr
4540
4541 : see if stdlib is available
4542 set stdlib.h i_stdlib
4543 eval $inhdr
4544
4545 : determine which malloc to compile in
4546 echo " "
4547 case "$usemymalloc" in
4548 ''|[yY]*|true|$define)  dflt='y' ;;
4549 *)      dflt='n' ;;
4550 esac
4551 rp="Do you wish to attempt to use the malloc that comes with $package?"
4552 . ./myread
4553 usemymalloc="$ans"
4554 case "$ans" in
4555 y*|true)
4556         usemymalloc='y'
4557         mallocsrc='malloc.c'
4558         mallocobj="malloc$_o"
4559         d_mymalloc="$define"
4560         case "$libs" in
4561         *-lmalloc*)
4562                 : Remove malloc from list of libraries to use
4563                 echo "Removing unneeded -lmalloc from library list" >&4
4564                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4565                 shift
4566                 libs="$*"
4567                 echo "libs = $libs" >&4
4568                 ;;
4569         esac
4570         ;;
4571 *)
4572         usemymalloc='n'
4573         mallocsrc=''
4574         mallocobj=''
4575         d_mymalloc="$undef"
4576         ;;
4577 esac
4578
4579 : compute the return types of malloc and free
4580 echo " "
4581 $cat >malloc.c <<END
4582 #$i_malloc I_MALLOC
4583 #$i_stdlib I_STDLIB
4584 #include <stdio.h>
4585 #include <sys/types.h>
4586 #ifdef I_MALLOC
4587 #include <malloc.h>
4588 #endif
4589 #ifdef I_STDLIB
4590 #include <stdlib.h>
4591 #endif
4592 #ifdef TRY_MALLOC
4593 void *malloc();
4594 #endif
4595 #ifdef TRY_FREE
4596 void free();
4597 #endif
4598 END
4599 case "$malloctype" in
4600 '')
4601         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4602                 malloctype='void *'
4603         else
4604                 malloctype='char *'
4605         fi
4606         ;;
4607 esac
4608 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4609
4610 case "$freetype" in
4611 '')
4612         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4613                 freetype='void'
4614         else
4615                 freetype='int'
4616         fi
4617         ;;
4618 esac
4619 echo "Your system uses $freetype free(), it would seem." >&4
4620 $rm -f malloc.[co]
4621 $cat <<EOM
4622
4623 The installation process will also create a directory for
4624 vendor-supplied add-ons.  Vendors who supply perl with their system
4625 may find it convenient to place all vendor-supplied files in this
4626 directory rather than in the main distribution directory.  This will
4627 ease upgrades between binary-compatible maintenance versions of perl.
4628
4629 Of course you may also use these directories in whatever way you see
4630 fit.  For example, you might use them to access modules shared over a
4631 company-wide network.
4632
4633 The default answer should be fine for most people.
4634 This causes further questions about vendor add-ons to be skipped
4635 and no vendor-specific directories will be configured for perl.
4636
4637 EOM
4638 rp='Do you want to configure vendor-specific add-on directories?'
4639 case "$usevendorprefix" in
4640 define|true|[yY]*) dflt=y ;;
4641 *) dflt=n ;;
4642 esac
4643 . ./myread
4644 case "$ans" in
4645 [yY]*)  fn=d~+
4646         rp='Installation prefix to use for vendor-supplied add-ons?'
4647         case "$vendorprefix" in
4648         '') dflt='' ;;
4649         *)  dflt=$vendorprefix ;;
4650         esac
4651         . ./getfile
4652         oldvendorprefix=''
4653         case "$vendorprefix" in
4654         '') ;;
4655         *)      case "$ans" in
4656                 "$prefix") ;;
4657                 *) oldvendorprefix="$prefix";;
4658                 esac
4659                 ;;
4660         esac
4661         usevendorprefix="$define"
4662         vendorprefix="$ans"
4663         vendorprefixexp="$ansexp"
4664         ;;
4665 *)      usevendorprefix="$undef"
4666         vendorprefix=''
4667         vendorprefixexp=''
4668         ;;
4669 esac
4670
4671 case "$vendorprefix" in
4672 '')     d_vendorlib="$undef"
4673         vendorlib=''
4674         vendorlibexp=''
4675         ;;
4676 *)      d_vendorlib="$define"
4677         : determine where vendor-supplied modules go.
4678         : Usual default is /usr/local/lib/perl5/vendor_perl
4679         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4680         case "$installstyle" in
4681         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4682         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4683         esac
4684         fn=d~+
4685         rp='Pathname for the vendor-supplied library files?'
4686         . ./getfile
4687         vendorlib="$ans"
4688         vendorlibexp="$ansexp"
4689         : Change installation prefix, if necessary.
4690         if $test X"$prefix" != X"$installprefix"; then
4691                 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4692         else
4693                 installvendorlib="$vendorlibexp"
4694         fi
4695         ;;
4696 esac
4697
4698 : Cruising for prototypes
4699 echo " "
4700 echo "Checking out function prototypes..." >&4
4701 $cat >prototype.c <<'EOCP'
4702 int main(int argc, char *argv[]) {
4703         exit(0);}
4704 EOCP
4705 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4706         echo "Your C compiler appears to support function prototypes."
4707         val="$define"
4708 else
4709         echo "Your C compiler doesn't seem to understand function prototypes."
4710         val="$undef"
4711 fi
4712 set prototype
4713 eval $setvar
4714 $rm -f prototype*
4715
4716 case "$prototype" in
4717 "$define") ;;
4718 *)      ansi2knr='ansi2knr'
4719         echo " "
4720         cat <<EOM >&4
4721
4722 $me:  FATAL ERROR:
4723 This version of $package can only be compiled by a compiler that 
4724 understands function prototypes.  Unfortunately, your C compiler 
4725         $cc $ccflags
4726 doesn't seem to understand them.  Sorry about that.
4727
4728 If GNU cc is available for your system, perhaps you could try that instead.  
4729
4730 Eventually, we hope to support building Perl with pre-ANSI compilers.
4731 If you would like to help in that effort, please contact <perlbug@perl.org>.
4732
4733 Aborting Configure now.
4734 EOM
4735         exit 2
4736         ;;
4737 esac
4738
4739 : determine where public executables go
4740 echo " "
4741 set dflt bin bin
4742 eval $prefixit
4743 fn=d~
4744 rp='Pathname where the public executables will reside?'
4745 . ./getfile
4746 if $test "X$ansexp" != "X$binexp"; then
4747         installbin=''
4748 fi
4749 bin="$ans"
4750 binexp="$ansexp"
4751 : Change installation prefix, if necessary.
4752 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4753 if $test X"$prefix" != X"$installprefix"; then
4754         installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4755 else
4756         installbin="$binexp"
4757 fi
4758
4759 : determine whether to install perl also as /usr/bin/perl
4760
4761 echo " "
4762 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4763         $cat <<EOM
4764 Many scripts expect to perl to be installed as /usr/bin/perl.
4765 I can install the perl you are about to compile also as /usr/bin/perl
4766 (in addition to $installbin/perl).
4767 EOM
4768         case "$installusrbinperl" in
4769         "$undef"|[nN]*) dflt='n';;
4770         *)              dflt='y';;
4771         esac
4772         rp="Do you want to install perl as /usr/bin/perl?"
4773         . ./myread
4774         case "$ans" in
4775         [yY]*)  val="$define";;
4776         *)      val="$undef" ;;
4777         esac
4778 else
4779         val="$undef"
4780 fi
4781 set installusrbinperl
4782 eval $setvar
4783
4784 : define a shorthand compile call
4785 compile='
4786 mc_file=$1;
4787 shift;
4788 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4789 : define a shorthand compile call for compilations that should be ok.
4790 compile_ok='
4791 mc_file=$1;
4792 shift;
4793 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4794
4795 echo " "
4796 echo "Checking for GNU C Library..." >&4
4797 cat >gnulibc.c <<EOM
4798 #include <stdio.h>
4799 int main()
4800 {
4801 #ifdef __GLIBC__
4802     exit(0);
4803 #else
4804     exit(1);
4805 #endif
4806 }
4807 EOM
4808 set gnulibc
4809 if eval $compile_ok && ./gnulibc; then
4810         val="$define"
4811         echo "You are using the GNU C Library"
4812 else
4813         val="$undef"
4814         echo "You are not using the GNU C Library"
4815 fi
4816 $rm -f gnulibc*
4817 set d_gnulibc
4818 eval $setvar
4819
4820 : see if nm is to be used to determine whether a symbol is defined or not
4821 case "$usenm" in
4822 '')
4823         dflt=''
4824         case "$d_gnulibc" in
4825         "$define")
4826                 echo " "
4827                 echo "nm probably won't work on the GNU C Library." >&4
4828                 dflt=n
4829                 ;;
4830         esac
4831         case "$dflt" in
4832         '') 
4833                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4834                         echo " "
4835                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4836                         echo "'nm' won't be sufficient on this sytem." >&4
4837                         dflt=n
4838                 fi
4839                 ;;
4840         esac
4841         case "$dflt" in
4842         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4843                 if $test $dflt -gt 20; then
4844                         dflt=y
4845                 else
4846                         dflt=n
4847                 fi
4848                 ;;
4849         esac
4850         ;;
4851 *)
4852         case "$usenm" in
4853         true|$define) dflt=y;;
4854         *) dflt=n;;
4855         esac
4856         ;;
4857 esac
4858 $cat <<EOM
4859
4860 I can use $nm to extract the symbols from your C libraries. This
4861 is a time consuming task which may generate huge output on the disk (up
4862 to 3 megabytes) but that should make the symbols extraction faster. The
4863 alternative is to skip the 'nm' extraction part and to compile a small
4864 test program instead to determine whether each symbol is present. If
4865 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4866 this may be the best solution.
4867
4868 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4869
4870 EOM
4871 rp="Shall I use $nm to extract C symbols from the libraries?"
4872 . ./myread
4873 case "$ans" in
4874 [Nn]*) usenm=false;;
4875 *) usenm=true;;
4876 esac
4877
4878 runnm=$usenm
4879 case "$reuseval" in
4880 true) runnm=false;;
4881 esac
4882
4883 : nm options which may be necessary
4884 case "$nm_opt" in
4885 '') if $test -f /mach_boot; then
4886                 nm_opt=''       # Mach
4887         elif $test -d /usr/ccs/lib; then
4888                 nm_opt='-p'     # Solaris (and SunOS?)
4889         elif $test -f /dgux; then
4890                 nm_opt='-p'     # DG-UX
4891         elif $test -f /lib64/rld; then
4892                 nm_opt='-p'     # 64-bit Irix
4893         else
4894                 nm_opt=''
4895         fi;;
4896 esac
4897
4898 : nm options which may be necessary for shared libraries but illegal
4899 : for archive libraries.  Thank you, Linux.
4900 case "$nm_so_opt" in
4901 '')     case "$myuname" in
4902         *linux*)
4903                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4904                         nm_so_opt='--dynamic'
4905                 fi
4906                 ;;
4907         esac
4908         ;;
4909 esac
4910
4911 case "$runnm" in
4912 true)
4913 : get list of predefined functions in a handy place
4914 echo " "
4915 case "$libc" in
4916 '') libc=unknown
4917         case "$libs" in
4918         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4919         esac
4920         ;;
4921 esac
4922 libnames='';
4923 case "$libs" in
4924 '') ;;
4925 *)  for thislib in $libs; do
4926         case "$thislib" in
4927         -lc|-lc_s)
4928                 : Handle C library specially below.
4929                 ;;
4930         -l*)
4931                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4932                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4933                         :
4934                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4935                         :
4936                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4937                         :
4938                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4939                         :
4940                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4941                         :
4942                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4943                         :
4944                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4945                         :
4946                 else
4947                         try=''
4948                 fi
4949                 libnames="$libnames $try"
4950                 ;;
4951         *) libnames="$libnames $thislib" ;;
4952         esac
4953         done
4954         ;;
4955 esac
4956 xxx=normal
4957 case "$libc" in
4958 unknown)
4959         set /lib/libc.$so
4960         for xxx in $libpth; do
4961                 $test -r $1 || set $xxx/libc.$so
4962                 : The messy sed command sorts on library version numbers.
4963                 $test -r $1 || \
4964                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4965                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4966                                 h
4967                                 s/[0-9][0-9]*/0000&/g
4968                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4969                                 G
4970                                 s/\n/ /' | \
4971                          sort | $sed -e 's/^.* //'`
4972                 eval set \$$#
4973         done
4974         $test -r $1 || set /usr/ccs/lib/libc.$so
4975         $test -r $1 || set /lib/libsys_s$_a
4976         ;;
4977 *)
4978         set blurfl
4979         ;;
4980 esac
4981 if $test -r "$1"; then
4982         echo "Your (shared) C library seems to be in $1."
4983         libc="$1"
4984 elif $test -r /lib/libc && $test -r /lib/clib; then
4985         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4986         xxx=apollo
4987         libc='/lib/clib /lib/libc'
4988         if $test -r /lib/syslib; then
4989                 echo "(Your math library is in /lib/syslib.)"
4990                 libc="$libc /lib/syslib"
4991         fi
4992 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4993         echo "Your C library seems to be in $libc, as you said before."
4994 elif $test -r $incpath/usr/lib/libc$_a; then
4995         libc=$incpath/usr/lib/libc$_a;
4996         echo "Your C library seems to be in $libc.  That's fine."
4997 elif $test -r /lib/libc$_a; then
4998         libc=/lib/libc$_a;
4999         echo "Your C library seems to be in $libc.  You're normal."
5000 else
5001         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5002                 :
5003         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5004                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5005         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5006                 :
5007         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5008                 :
5009         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5010                 :
5011         else
5012                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5013         fi
5014         if $test -r "$tans"; then
5015                 echo "Your C library seems to be in $tans, of all places."
5016                 libc=$tans
5017         else
5018                 libc='blurfl'
5019         fi
5020 fi
5021 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5022         dflt="$libc"
5023         cat <<EOM
5024
5025 If the guess above is wrong (which it might be if you're using a strange
5026 compiler, or your machine supports multiple models), you can override it here.
5027
5028 EOM
5029 else
5030         dflt=''
5031         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5032         cat >&4 <<EOM
5033 I can't seem to find your C library.  I've looked in the following places:
5034
5035 EOM
5036         $sed 's/^/      /' libpath
5037         cat <<EOM
5038
5039 None of these seems to contain your C library. I need to get its name...
5040
5041 EOM
5042 fi
5043 fn=f
5044 rp='Where is your C library?'
5045 . ./getfile
5046 libc="$ans"
5047
5048 echo " "
5049 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5050 set X `cat libnames`
5051 shift
5052 xxx=files
5053 case $# in 1) xxx=file; esac
5054 echo "Extracting names from the following $xxx for later perusal:" >&4
5055 echo " "
5056 $sed 's/^/      /' libnames >&4
5057 echo " "
5058 $echo $n "This may take a while...$c" >&4
5059
5060 for file in $*; do
5061         case $file in
5062         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5063         *) $nm $nm_opt $file 2>/dev/null;;
5064         esac
5065 done >libc.tmp
5066
5067 $echo $n ".$c"
5068 $grep fprintf libc.tmp > libc.ptf
5069 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5070 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5071 xxx='[ADTSIW]'
5072 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5073         eval $xscan;\
5074         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5075                 eval $xrun
5076 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5077         eval $xscan;\
5078         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5079                 eval $xrun
5080 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5081         eval $xscan;\
5082         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5083                 eval $xrun
5084 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5085         eval $xscan;\
5086         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5087                 eval $xrun
5088 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5089         eval $xscan;\
5090         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5091                 eval $xrun
5092 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5093         eval $xscan;\
5094         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5095                 eval $xrun
5096 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5097                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5098         eval $xscan;\
5099         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5100                 eval $xrun
5101 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5102         eval $xscan;\
5103         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5104                 eval $xrun
5105 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5106         eval $xscan;\
5107         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5108                 eval $xrun
5109 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5110         eval $xscan;\
5111         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5112                 eval $xrun
5113 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5114         eval $xscan;\
5115         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5116                 eval $xrun
5117 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5118         eval $xscan;\
5119         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5120                 eval $xrun
5121 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5122         eval $xscan;\
5123         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5124                 eval $xrun
5125 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5126         eval $xscan;\
5127         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5128                 eval $xrun
5129 else
5130         $nm -p $* 2>/dev/null >libc.tmp
5131         $grep fprintf libc.tmp > libc.ptf
5132         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5133                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5134         then
5135                 nm_opt='-p'
5136                 eval $xrun
5137         else
5138                 echo " "
5139                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5140                 com=''
5141                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5142                         for thisname in $libnames $libc; do
5143                                 $ar t $thisname >>libc.tmp
5144                         done
5145                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5146                         echo "Ok." >&4
5147                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5148                         # Repeat libc to extract forwarders to DLL entries too
5149                         for thisname in $libnames $libc; do
5150                                 $ar tv $thisname >>libc.tmp
5151                                 # Revision 50 of EMX has bug in $ar.
5152                                 # it will not extract forwarders to DLL entries
5153                                 # Use emximp which will extract exactly them.
5154                                 emximp -o tmp.imp $thisname \
5155                                     2>/dev/null && \
5156                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5157                                     < tmp.imp >>libc.tmp
5158                                 $rm tmp.imp
5159                         done
5160                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5161                         echo "Ok." >&4
5162                 else
5163                         echo "$ar didn't seem to work right." >&4
5164                         echo "Maybe this is a Cray...trying bld instead..." >&4
5165                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5166                         then
5167                                 for thisname in $libnames; do
5168                                         bld t $libnames | \
5169                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5170                                         $ar t $thisname >>libc.tmp
5171                                 done
5172                                 echo "Ok." >&4
5173                         else
5174                                 echo "That didn't work either.  Giving up." >&4
5175                                 exit 1
5176                         fi
5177                 fi
5178         fi
5179 fi
5180 nm_extract="$com"
5181 if $test -f /lib/syscalls.exp; then
5182         echo " "
5183         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5184         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5185 fi
5186 ;;
5187 esac
5188 $rm -f libnames libpath
5189
5190 : see if dld is available
5191 set dld.h i_dld
5192 eval $inhdr
5193
5194 : is a C symbol defined?
5195 csym='tlook=$1;
5196 case "$3" in
5197 -v) tf=libc.tmp; tc=""; tdc="";;
5198 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5199 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5200 esac;
5201 tx=yes;
5202 case "$reuseval-$4" in
5203 true-) ;;
5204 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5205 esac;
5206 case "$tx" in
5207 yes)
5208         case "$runnm" in
5209         true)
5210                 if $contains $tlook $tf >/dev/null 2>&1;
5211                 then tval=true;
5212                 else tval=false;
5213                 fi;;
5214         *)
5215                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5216                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5217                 then tval=true;
5218                 else tval=false;
5219                 fi;
5220                 $rm -f t t.c;;
5221         esac;;
5222 *)
5223         case "$tval" in
5224         $define) tval=true;;
5225         *) tval=false;;
5226         esac;;
5227 esac;
5228 eval "$2=$tval"'
5229
5230 : define an is-in-libc? function
5231 inlibc='echo " "; td=$define; tu=$undef;
5232 sym=$1; var=$2; eval "was=\$$2";
5233 tx=yes;
5234 case "$reuseval$was" in
5235 true) ;;
5236 true*) tx=no;;
5237 esac;
5238 case "$tx" in
5239 yes)
5240         set $sym tres -f;
5241         eval $csym;
5242         case "$tres" in
5243         true)
5244                 echo "$sym() found." >&4;
5245                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5246         *)
5247                 echo "$sym() NOT found." >&4;
5248                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5249         esac;;
5250 *)
5251         case "$was" in
5252         $define) echo "$sym() found." >&4;;
5253         *) echo "$sym() NOT found." >&4;;
5254         esac;;
5255 esac'
5256
5257 : see if dlopen exists
5258 xxx_runnm="$runnm"
5259 runnm=false
5260 set dlopen d_dlopen
5261 eval $inlibc
5262 runnm="$xxx_runnm"
5263
5264 : determine which dynamic loading, if any, to compile in
5265 echo " "
5266 dldir="ext/DynaLoader"
5267 case "$usedl" in
5268 $define|y|true)
5269         dflt='y'
5270         usedl="$define"
5271         ;;
5272 $undef|n|false)
5273         dflt='n'
5274         usedl="$undef"
5275         ;;
5276 *) 
5277         dflt='n'
5278         case "$d_dlopen" in
5279             $define) dflt='y' ;;
5280         esac
5281         case "$i_dld" in
5282             $define) dflt='y' ;;
5283         esac
5284         : Does a dl_xxx.xs file exist for this operating system
5285         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5286         ;;
5287 esac
5288 rp="Do you wish to use dynamic loading?"
5289 . ./myread
5290 usedl="$ans"
5291 case "$ans" in
5292 y*) usedl="$define"
5293         case "$dlsrc" in
5294         '')
5295                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5296                         dflt="$dldir/dl_${osname}.xs"
5297                 elif $test "$d_dlopen" = "$define" ; then
5298                         dflt="$dldir/dl_dlopen.xs"
5299                 elif $test "$i_dld" = "$define" ; then
5300                         dflt="$dldir/dl_dld.xs"
5301                 else
5302                         dflt=''
5303                 fi
5304                 ;;
5305         *)      dflt="$dldir/$dlsrc"
5306                 ;;
5307         esac
5308     echo "The following dynamic loading files are available:"
5309         : Can not go over to $dldir because getfile has path hard-coded in.
5310         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5311         rp="Source file to use for dynamic loading"
5312         fn="fne"
5313         gfpth="$src"
5314         . ./getfile
5315         usedl="$define"
5316         : emulate basename
5317         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5318
5319         $cat << EOM
5320
5321 Some systems may require passing special flags to $cc -c to
5322 compile modules that will be used to create a shared library.
5323 To use no flags, say "none".
5324
5325 EOM
5326     case "$cccdlflags" in
5327     '') case "$gccversion" in
5328                 '') case "$osname" in
5329                         hpux)   dflt='+z' ;;
5330                         next)   dflt='none' ;;
5331                         irix*)  dflt='-KPIC' ;;
5332                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5333                         sunos)  dflt='-pic' ;;
5334                         *)      dflt='none' ;;
5335                     esac
5336                         ;;
5337                 *)  case "$osname" in
5338                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5339                         *)      dflt='-fpic' ;;
5340                     esac ;;
5341             esac ;;
5342         ' ') dflt='none' ;;
5343     *)  dflt="$cccdlflags" ;;
5344     esac
5345     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5346     . ./myread
5347     case "$ans" in
5348     none) cccdlflags=' ' ;;
5349     *) cccdlflags="$ans" ;;
5350     esac
5351
5352     cat << EOM
5353
5354 Some systems use ld to create libraries that can be dynamically loaded,
5355 while other systems (such as those using ELF) use $cc.
5356
5357 EOM
5358         case "$ld" in
5359         '')     $cat >try.c <<'EOM'
5360 /* Test for whether ELF binaries are produced */
5361 #include <fcntl.h>
5362 #include <stdlib.h>
5363 int main() {
5364         char b[4];
5365         int i = open("a.out",O_RDONLY);
5366         if(i == -1) 
5367                 exit(1); /* fail */
5368         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5369                 exit(0); /* succeed (yes, it's ELF) */
5370         else
5371                 exit(1); /* fail */
5372 }
5373 EOM
5374                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5375                         cat <<EOM
5376 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5377 EOM
5378                         dflt="$cc"
5379                 else
5380                         echo "I'll use ld to build dynamic libraries."
5381                         dflt='ld'
5382                 fi
5383                 rm -f try.c a.out
5384                 ;;
5385         *)      dflt="$ld"
5386                 ;;
5387         esac
5388
5389     rp="What command should be used to create dynamic libraries?"
5390     . ./myread
5391         ld="$ans"
5392
5393     cat << EOM
5394
5395 Some systems may require passing special flags to $ld to create a
5396 library that can be dynamically loaded.  If your ld flags include
5397 -L/other/path options to locate libraries outside your loader's normal
5398 search path, you may need to specify those -L options here as well.  To
5399 use no flags, say "none".
5400
5401 EOM
5402     case "$lddlflags" in
5403     '') case "$osname" in
5404                         beos) dflt='-nostart' ;;
5405                         hpux)  dflt='-b' ;;
5406                         linux|irix*)    dflt='-shared' ;;
5407                         next)  dflt='none' ;;
5408                         solaris) dflt='-G' ;;
5409                         sunos) dflt='-assert nodefinitions' ;;
5410                         svr4*|esix*) dflt="-G $ldflags" ;;
5411                 *)     dflt='none' ;;
5412                         esac
5413                         ;;
5414     *) dflt="$lddlflags" ;;
5415     esac
5416
5417         : Try to guess additional flags to pick up local libraries.
5418         : Be careful not to append to a plain 'none'
5419         case "$dflt" in
5420         none) dflt='' ;;
5421         esac
5422         for thisflag in $ldflags; do
5423                 case "$thisflag" in
5424                 -L*)
5425                         case " $dflt " in
5426                         *" $thisflag "*) ;;
5427                         *) dflt="$dflt $thisflag" ;;
5428                         esac
5429                         ;;
5430                 esac
5431         done
5432
5433         case "$dflt" in
5434         ''|' ') dflt='none' ;;
5435         esac
5436
5437     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5438     . ./myread
5439     case "$ans" in
5440     none) lddlflags=' ' ;;
5441     *) lddlflags="$ans" ;;
5442     esac
5443
5444         cat <<EOM
5445
5446 Some systems may require passing special flags to $cc to indicate that
5447 the resulting executable will use dynamic linking.  To use no flags,
5448 say "none".
5449
5450 EOM
5451     case "$ccdlflags" in
5452     '') case "$osname" in
5453                 hpux)   dflt='-Wl,-E' ;;
5454                 linux)  dflt='-rdynamic' ;;
5455                 next)   dflt='none' ;;
5456                 sunos)  dflt='none' ;;
5457                 *)      dflt='none' ;;
5458             esac ;;
5459     ' ')  dflt='none' ;;
5460     *)  dflt="$ccdlflags" ;;
5461     esac
5462     rp="Any special flags to pass to $cc to use dynamic loading?"
5463     . ./myread
5464     case "$ans" in
5465     none) ccdlflags=' ' ;;
5466     *) ccdlflags="$ans" ;;
5467     esac
5468     ;;
5469 *)  usedl="$undef"
5470         ld='ld'
5471     dlsrc='dl_none.xs'
5472     lddlflags=''
5473     ccdlflags=''
5474     ;;
5475 esac
5476
5477 also=''
5478 case "$usedl" in
5479 $undef)
5480         # No dynamic loading being used, so don't bother even to prompt.
5481         useshrplib='false'
5482         ;;
5483 *)      case "$useshrplib" in
5484         '')     case "$osname" in
5485                 svr4*|dgux|dynixptx|esix|powerux|beos)
5486                         dflt=y
5487                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5488                         ;;
5489                 next*)
5490                         case "$osvers" in
5491                         4*)     dflt=y
5492                                 also='Building a shared libperl is needed for MAB support.'
5493                                 ;;
5494                         *)      dflt=n
5495                                 ;;
5496                         esac
5497                         ;;
5498                 *)      dflt=n
5499                         ;;
5500                 esac
5501                 ;;
5502         $define|true|[Yy]*)
5503                 dflt=y
5504                 ;;
5505         *)      dflt=n
5506                 ;;
5507         esac
5508         $cat << EOM
5509
5510 The perl executable is normally obtained by linking perlmain.c with
5511 libperl${_a}, any static extensions (usually just DynaLoader), and
5512 any other libraries needed on this system (such as -lm, etc.).  Since
5513 your system supports dynamic loading, it is probably possible to build
5514 a shared libperl.$so.  If you will have more than one executable linked
5515 to libperl.$so, this will significantly reduce the size of each
5516 executable, but it may have a noticeable affect on performance.  The
5517 default is probably sensible for your system.
5518 $also
5519
5520 EOM
5521         rp="Build a shared libperl.$so (y/n)"
5522         . ./myread
5523         case "$ans" in
5524         true|$define|[Yy]*)
5525                 useshrplib='true'  ;;
5526         *)      useshrplib='false' ;;
5527         esac
5528         ;;
5529 esac
5530
5531 case "$useshrplib" in
5532 true)
5533         case "$libperl" in
5534         '')
5535                 # Figure out a good name for libperl.so.  Since it gets stored in
5536                 # a version-specific architecture-dependent library, the version
5537                 # number isn't really that important, except for making cc/ld happy.
5538                 #
5539                 # A name such as libperl.so.3.1
5540                 majmin="libperl.$so.$patchlevel.$subversion"
5541                 # A name such as libperl.so.301
5542                 majonly=`echo $patchlevel $subversion |
5543                         $awk '{printf "%d%02d", $1, $2}'`
5544                 majonly=libperl.$so.$majonly
5545                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5546                 # rely on figuring it out from the naming of libc.
5547                 case "${osname}${osvers}" in
5548                 next4*)
5549                         dflt=libperl.5.$so
5550                         # XXX How handle the --version stuff for MAB?
5551                         ;;
5552                 linux*)  # ld won't link with a bare -lperl otherwise.
5553                         dflt=libperl.$so
5554                         ;;
5555                 *)      # Try to guess based on whether libc has major.minor.
5556                         case "$libc" in
5557                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5558                         *libc.$so.[0-9]*) dflt=$majonly ;;
5559                         *)      dflt=libperl.$so ;;
5560                         esac
5561                         ;;
5562                 esac
5563                 ;;
5564         *)      dflt=$libperl
5565                 ;;
5566         esac
5567         cat << EOM
5568
5569 I need to select a good name for the shared libperl.  If your system uses
5570 library names with major and minor numbers, then you might want something
5571 like $majmin.  Alternatively, if your system uses a single version
5572 number for shared libraries, then you might want to use $majonly.
5573 Or, your system might be quite happy with a simple libperl.$so.
5574
5575 Since the shared libperl will get installed into a version-specific
5576 architecture-dependent directory, the version number of the shared perl
5577 library probably isn't important, so the default should be o.k.
5578
5579 EOM
5580         rp='What name do you want to give to the shared libperl?'
5581         . ./myread
5582         libperl=$ans
5583         echo "Ok, I'll use $libperl"
5584         ;;
5585 *)
5586         libperl="libperl${_a}"
5587         ;;
5588 esac
5589
5590 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5591 case "$shrpdir" in
5592 '') ;;
5593 *)      $cat >&4 <<EOM
5594 WARNING:  Use of the shrpdir variable for the installation location of
5595 the shared $libperl is not supported.  It was never documented and
5596 will not work in this version.  Let me (perlbug@perl.com)
5597 know of any problems this may cause.
5598
5599 EOM
5600         case "$shrpdir" in
5601         "$archlibexp/CORE")
5602                 $cat >&4 <<EOM
5603 But your current setting of $shrpdir is
5604 the default anyway, so it's harmless.
5605 EOM
5606                 ;;
5607         *)
5608                 $cat >&4 <<EOM
5609 Further, your current attempted setting of $shrpdir
5610 conflicts with the value of $archlibexp/CORE
5611 that installperl will use.
5612 EOM
5613                 ;;
5614         esac
5615         ;;
5616 esac
5617
5618 # How will the perl executable find the installed shared $libperl?
5619 # Add $xxx to ccdlflags.
5620 # If we can't figure out a command-line option, use $shrpenv to
5621 # set env LD_RUN_PATH.  The main perl makefile uses this.
5622 shrpdir=$archlibexp/CORE
5623 xxx=''
5624 tmp_shrpenv=''
5625 if "$useshrplib"; then
5626     case "$osname" in 
5627         aix)
5628                 # We'll set it in Makefile.SH...
5629                 ;;
5630         solaris|netbsd)
5631                 xxx="-R $shrpdir"
5632                 ;;
5633         freebsd)
5634                 xxx="-Wl,-R$shrpdir"
5635                 ;;
5636         linux|irix*|dec_osf)
5637                 xxx="-Wl,-rpath,$shrpdir"
5638                 ;;
5639         next)
5640                 # next doesn't like the default...
5641                 ;;
5642         beos)
5643                 # beos doesn't like the default, either.
5644                 ;;
5645         hpux*)
5646                 # hpux doesn't like the default, either.
5647                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5648                 ;;
5649         *)
5650                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5651                 ;;
5652         esac
5653         case "$xxx" in
5654         '') ;;
5655         *)      
5656                 # Only add $xxx if it isn't already in ccdlflags.
5657                 case " $ccdlflags " in
5658                 *" $xxx "*)     ;;
5659                 *)      ccdlflags="$ccdlflags $xxx"
5660                         cat <<EOM >&4
5661
5662 Adding $xxx to the flags
5663 passed to $ld so that the perl executable will find the 
5664 installed shared $libperl.
5665
5666 EOM
5667                         ;;
5668                 esac
5669                 ;;
5670         esac
5671 fi
5672 # Fix ccdlflags in AIX for building external extensions.
5673 # (For building Perl itself bare -bE:perl.exp is needed,
5674 #  Makefile.SH takes care of this.)
5675 case "$osname" in
5676 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5677 esac
5678 # Respect a hint or command-line value.
5679 case "$shrpenv" in
5680 '') shrpenv="$tmp_shrpenv" ;;
5681 esac
5682 case "$ldlibpthname" in
5683 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5684 none)   ldlibpthname='' ;;
5685 esac
5686
5687 : determine where manual pages go
5688 set man1dir man1dir none
5689 eval $prefixit
5690 $cat <<EOM
5691
5692 $spackage has manual pages available in source form.
5693 EOM
5694 case "$nroff" in
5695 nroff)
5696         echo "However, you don't have nroff, so they're probably useless to you."
5697         case "$man1dir" in
5698         '') man1dir="none";;
5699         esac;;
5700 esac
5701 echo "If you don't want the manual sources installed, answer 'none'."
5702 case "$man1dir" in
5703 ' ') dflt=none
5704         ;;
5705 '')
5706         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5707         lookpath="$lookpath $prefixexp/man/p_man/man1"
5708         lookpath="$lookpath $prefixexp/man/u_man/man1"
5709         lookpath="$lookpath $prefixexp/man/man.1"
5710         case "$sysman" in
5711         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5712         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5713         esac
5714         set dflt
5715         eval $prefixup
5716         ;;
5717 *)  dflt="$man1dir"
5718         ;;
5719 esac
5720 echo " "
5721 fn=dn+~
5722 rp="Where do the main $spackage manual pages (source) go?"
5723 . ./getfile
5724 if $test "X$man1direxp" != "X$ansexp"; then
5725         installman1dir=''
5726 fi
5727 man1dir="$ans"
5728 man1direxp="$ansexp"
5729 case "$man1dir" in
5730 '')     man1dir=' '
5731         installman1dir='';;
5732 esac
5733
5734 : Change installation prefix, if necessary.
5735 if $test X"$prefix" != X"$installprefix"; then
5736         installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
5737 else
5738         installman1dir="$man1direxp"
5739 fi
5740
5741 : What suffix to use on installed man pages
5742
5743 case "$man1dir" in
5744 ' ')
5745         man1ext='0'
5746         ;;
5747 *)
5748         rp="What suffix should be used for the main $spackage man pages?"
5749         case "$man1ext" in
5750         '')     case "$man1dir" in
5751                 *1)  dflt=1 ;;
5752                 *1p) dflt=1p ;;
5753                 *1pm) dflt=1pm ;;
5754                 *l) dflt=l;;
5755                 *n) dflt=n;;
5756                 *o) dflt=o;;
5757                 *p) dflt=p;;
5758                 *C) dflt=C;;
5759                 *L) dflt=L;;
5760                 *L1) dflt=L1;;
5761                 *) dflt=1;;
5762                 esac
5763                 ;;
5764         *)      dflt="$man1ext";;
5765         esac
5766         . ./myread
5767         man1ext="$ans"
5768         ;;
5769 esac
5770
5771 : see if we can have long filenames
5772 echo " "
5773 rmlist="$rmlist /tmp/cf$$"
5774 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5775 first=123456789abcdef
5776 second=/tmp/cf$$/$first
5777 $rm -f $first $second
5778 if (echo hi >$first) 2>/dev/null; then
5779         if $test -f 123456789abcde; then
5780                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5781                 val="$undef"
5782         else
5783                 if (echo hi >$second) 2>/dev/null; then
5784                         if $test -f /tmp/cf$$/123456789abcde; then
5785                                 $cat <<'EOM'
5786 That's peculiar... You can have filenames longer than 14 characters, but only
5787 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5788 I shall consider your system cannot support long filenames at all.
5789 EOM
5790                                 val="$undef"
5791                         else
5792                                 echo 'You can have filenames longer than 14 characters.' >&4
5793                                 val="$define"
5794                         fi
5795                 else
5796                         $cat <<'EOM'
5797 How confusing! Some of your filesystems are sane enough to allow filenames
5798 longer than 14 characters but some others like /tmp can't even think about them.
5799 So, for now on, I shall assume your kernel does not allow them at all.
5800 EOM
5801                         val="$undef"
5802                 fi
5803         fi
5804 else
5805         $cat <<'EOM'
5806 You can't have filenames longer than 14 chars.  You can't even think about them!
5807 EOM
5808         val="$undef"
5809 fi 
5810 set d_flexfnam
5811 eval $setvar
5812 $rm -rf /tmp/cf$$ 123456789abcde*
5813
5814 : determine where library module manual pages go
5815 set man3dir man3dir none
5816 eval $prefixit
5817 $cat <<EOM
5818
5819 $spackage has manual pages for many of the library modules.
5820 EOM
5821
5822 case "$nroff" in
5823 nroff)
5824         $cat <<'EOM'
5825 However, you don't have nroff, so they're probably useless to you.
5826 EOM
5827         case "$man3dir" in
5828         '') man3dir="none";;
5829         esac;;
5830 esac
5831
5832 case "$d_flexfnam" in
5833 undef)
5834         $cat <<'EOM'
5835 However, your system can't handle the long file names like File::Basename.3. 
5836 EOM
5837         case "$man3dir" in
5838         '') man3dir="none";;
5839         esac;;
5840 esac
5841
5842 echo "If you don't want the manual sources installed, answer 'none'."
5843 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5844 case "$man3dir" in
5845 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5846         if $test -d "$privlib/man/man3"; then
5847                 cat <<EOM >&4
5848
5849 WARNING:  Previous versions of perl installed man3 pages into
5850 $privlib/man/man3.  This version will suggest a 
5851 new default of $dflt.  
5852 EOM
5853                 tdflt=$dflt
5854                 dflt='n'
5855                 rp='Do you wish to preserve the old behavior?(y/n)'
5856                 . ./myread
5857                 case "$ans" in
5858                 y*) dflt="$privlib/man/man3" ;;
5859                 *)  dflt=$tdflt ;;
5860                 esac
5861     fi
5862         ;;
5863 ' ') dflt=none;;
5864 *)      dflt="$man3dir" ;;
5865 esac
5866 echo " "
5867 fn=dn+~
5868 rp="Where do the $package library man pages (source) go?"
5869 . ./getfile
5870 man3dir="$ans"
5871 man3direxp="$ansexp"
5872 case "$man1dir" in
5873 '')     man3dir=' '
5874         installman3dir='';;
5875 esac
5876
5877 : Change installation prefix, if necessary.
5878 if $test X"$prefix" != X"$installprefix"; then
5879         installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
5880 else
5881         installman3dir="$man3direxp"
5882 fi
5883
5884 : What suffix to use on installed man pages
5885 case "$man3dir" in
5886 ' ')
5887         man3ext='0'
5888         ;;
5889 *)
5890         rp="What suffix should be used for the $package library man pages?"
5891         case "$man3ext" in
5892         '')     case "$man3dir" in
5893                 *3)  dflt=3 ;;
5894                 *3p) dflt=3p ;;
5895                 *3pm) dflt=3pm ;;
5896                 *l) dflt=l;;
5897                 *n) dflt=n;;
5898                 *o) dflt=o;;
5899                 *p) dflt=p;;
5900                 *C) dflt=C;;
5901                 *L) dflt=L;;
5902                 *L3) dflt=L3;;
5903                 *) dflt=3;;
5904                 esac
5905                 ;;
5906         *)      dflt="$man3ext";;
5907         esac
5908         . ./myread
5909         man3ext="$ans"
5910         ;;
5911 esac
5912
5913 : see if we have to deal with yellow pages, now NIS.
5914 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5915         if $test -f /usr/etc/nibindd; then
5916                 echo " "
5917                 echo "I'm fairly confident you're on a NeXT."
5918                 echo " "
5919                 rp='Do you get the hosts file via NetInfo?'
5920                 dflt=y
5921                 case "$hostcat" in
5922                 nidump*) ;;
5923                 '') ;;
5924                 *) dflt=n;;
5925                 esac
5926                 . ./myread
5927                 case "$ans" in
5928                 y*) hostcat='nidump hosts .';;
5929                 *)      case "$hostcat" in
5930                         nidump*) hostcat='';;
5931                         esac
5932                         ;;
5933                 esac
5934         fi
5935         case "$hostcat" in
5936         nidump*) ;;
5937         *)
5938                 case "$hostcat" in
5939                 *ypcat*) dflt=y;;
5940                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5941                                 dflt=y
5942                         else
5943                                 dflt=n
5944                         fi;;
5945                 *) dflt=n;;
5946                 esac
5947                 echo " "
5948                 rp='Are you getting the hosts file via yellow pages?'
5949                 . ./myread
5950                 case "$ans" in
5951                 y*) hostcat='ypcat hosts';;
5952                 *) hostcat='cat /etc/hosts';;
5953                 esac
5954                 ;;
5955         esac
5956 fi
5957 case "$hostcat" in
5958 '') hostcat='cat /etc/hosts';;
5959 esac
5960 case "$groupcat" in
5961 '') groupcat='cat /etc/group';;
5962 esac
5963 case "$passcat" in
5964 '') passcat='cat /etc/passwd';;
5965 esac
5966
5967 : now get the host name
5968 echo " "
5969 echo "Figuring out host name..." >&4
5970 case "$myhostname" in
5971 '') cont=true
5972         echo 'Maybe "hostname" will work...'
5973         if tans=`sh -c hostname 2>&1` ; then
5974                 myhostname=$tans
5975                 phostname=hostname
5976                 cont=''
5977         fi
5978         ;;
5979 *) cont='';;
5980 esac
5981 if $test "$cont"; then
5982         if ./xenix; then
5983                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5984                 if tans=`cat /etc/systemid 2>&1` ; then
5985                         myhostname=$tans
5986                         phostname='cat /etc/systemid'
5987                         echo "Whadyaknow.  Xenix always was a bit strange..."
5988                         cont=''
5989                 fi
5990         elif $test -r /etc/systemid; then
5991                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5992         fi
5993 fi
5994 if $test "$cont"; then
5995         echo 'No, maybe "uuname -l" will work...'
5996         if tans=`sh -c 'uuname -l' 2>&1` ; then
5997                 myhostname=$tans
5998                 phostname='uuname -l'
5999         else
6000                 echo 'Strange.  Maybe "uname -n" will work...'
6001                 if tans=`sh -c 'uname -n' 2>&1` ; then
6002                         myhostname=$tans
6003                         phostname='uname -n'
6004                 else
6005                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6006                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6007                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6008                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6009                         else
6010                                 case "$myhostname" in
6011                                 '') echo "Does this machine have an identity crisis or something?"
6012                                         phostname='';;
6013                                 *)
6014                                         echo "Well, you said $myhostname before..."
6015                                         phostname='echo $myhostname';;
6016                                 esac
6017                         fi
6018                 fi
6019         fi
6020 fi
6021 : you do not want to know about this
6022 set $myhostname
6023 myhostname=$1
6024
6025 : verify guess
6026 if $test "$myhostname" ; then
6027         dflt=y
6028         rp='Your host name appears to be "'$myhostname'".'" Right?"
6029         . ./myread
6030         case "$ans" in
6031         y*) ;;
6032         *) myhostname='';;
6033         esac
6034 fi
6035
6036 : bad guess or no guess
6037 while $test "X$myhostname" = X ; do
6038         dflt=''
6039         rp="Please type the (one word) name of your host:"
6040         . ./myread
6041         myhostname="$ans"
6042 done
6043
6044 : translate upper to lower if necessary
6045 case "$myhostname" in
6046 *[A-Z]*)
6047         echo "(Normalizing case in your host name)"
6048         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6049         ;;
6050 esac
6051
6052 case "$myhostname" in
6053 *.*)
6054         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6055         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6056         echo "(Trimming domain name from host name--host name is now $myhostname)"
6057         ;;
6058 *) case "$mydomain" in
6059         '')
6060                 {
6061                         test "X$hostcat" = "Xypcat hosts" &&
6062                         ypmatch "$myhostname" hosts 2>/dev/null |\
6063                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6064                         $test -s hosts
6065                 } || {
6066                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6067                                         /[       ]$myhostname[  . ]/p" > hosts
6068                 }
6069                 tmp_re="[       . ]"
6070                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6071                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6072                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6073                         hosts | $sort | $uniq | \
6074                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6075                 case `$echo X$dflt` in
6076                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6077                         dflt=.
6078                         ;;
6079                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6080                         ;;
6081                 esac
6082                 case "$dflt" in
6083                 .)
6084                         tans=`./loc resolv.conf X /etc /usr/etc`
6085                         if $test -f "$tans"; then
6086                                 echo "(Attempting domain name extraction from $tans)"
6087                                 dflt=.`$sed -n -e 's/   / /g' \
6088                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6089                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6090                                 case "$dflt" in
6091                                 .) dflt=.`$sed -n -e 's/        / /g' \
6092                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6093                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6094                                         ;;
6095                                 esac
6096                         fi
6097                         ;;
6098                 esac
6099                 case "$dflt" in
6100                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6101                         dflt=.`sh -c domainname 2>/dev/null`
6102                         case "$dflt" in
6103                         '') dflt='.';;
6104                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6105                         esac
6106                         ;;
6107                 esac
6108                 case "$dflt" in
6109                 .) echo "(Lost all hope -- silly guess then)"
6110                         dflt='.uucp'
6111                         ;;
6112                 esac
6113                 $rm -f hosts
6114                 ;;
6115         *) dflt="$mydomain";;
6116         esac;;
6117 esac
6118 echo " "
6119 rp="What is your domain name?"
6120 . ./myread
6121 tans="$ans"
6122 case "$ans" in
6123 '') ;;
6124 .*) ;;
6125 *) tans=".$tans";;
6126 esac
6127 mydomain="$tans"
6128
6129 : translate upper to lower if necessary
6130 case "$mydomain" in
6131 *[A-Z]*)
6132         echo "(Normalizing case in your domain name)"
6133         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6134         ;;
6135 esac
6136
6137 : a little sanity check here
6138 case "$phostname" in
6139 '') ;;
6140 *)
6141         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6142         $myhostname$mydomain|$myhostname) ;;
6143         *)
6144                 case "$phostname" in
6145                 sed*)
6146                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6147                         ;;
6148                 *)
6149                         echo "(That doesn't agree with your $phostname command, by the way.)"
6150                         ;;
6151                 esac
6152         ;;
6153         esac
6154         ;;
6155 esac
6156
6157 $cat <<EOM
6158
6159 I need to get your e-mail address in Internet format if possible, i.e.
6160 something like user@host.domain. Please answer accurately since I have
6161 no easy means to double check it. The default value provided below
6162 is most probably close to the reality but may not be valid from outside
6163 your organization...
6164
6165 EOM
6166 cont=x
6167 while test "$cont"; do
6168         case "$cf_email" in
6169         '') dflt="$cf_by@$myhostname$mydomain";;
6170         *) dflt="$cf_email";;
6171         esac
6172         rp='What is your e-mail address?'
6173         . ./myread
6174         cf_email="$ans"
6175         case "$cf_email" in
6176         *@*.*) cont='' ;;
6177         *)
6178                 rp='Address does not look like an Internet one.  Use it anyway?'
6179                 case "$fastread" in
6180                 yes) dflt=y ;;
6181                 *) dflt=n ;;
6182                 esac
6183                 . ./myread
6184                 case "$ans" in
6185                 y*) cont='' ;;
6186                 *) echo " " ;;
6187                 esac
6188                 ;;
6189         esac
6190 done
6191
6192 $cat <<EOM
6193
6194 If you or somebody else will be maintaining perl at your site, please
6195 fill in the correct e-mail address here so that they may be contacted
6196 if necessary. Currently, the "perlbug" program included with perl
6197 will send mail to this address in addition to perlbug@perl.com. You may
6198 enter "none" for no administrator.
6199
6200 EOM
6201 case "$perladmin" in
6202 '') dflt="$cf_email";;
6203 *) dflt="$perladmin";;
6204 esac
6205 rp='Perl administrator e-mail address'
6206 . ./myread
6207 perladmin="$ans"
6208
6209 : figure out how to guarantee perl startup
6210 case "$startperl" in
6211 '')
6212         case "$sharpbang" in
6213         *!)
6214                 $cat <<EOH
6215
6216 I can use the #! construct to start perl on your system. This will
6217 make startup of perl scripts faster, but may cause problems if you
6218 want to share those scripts and perl is not in a standard place
6219 ($binexp/perl) on all your platforms. The alternative is to force
6220 a shell by starting the script with a single ':' character.
6221
6222 EOH
6223                 dflt="$binexp/perl"
6224                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6225                 . ./myread
6226                 case "$ans" in
6227                 none)   startperl=": # use perl";;
6228                 *)      startperl="#!$ans"
6229                         if $test 30 -lt `echo "$ans" | wc -c`; then
6230                                 $cat >&4 <<EOM
6231
6232 WARNING:  Some systems limit the #! command to 32 characters.
6233 If you experience difficulty running Perl scripts with #!, try
6234 installing Perl in a directory with a shorter pathname.
6235
6236 EOM
6237                         fi ;;
6238                 esac
6239                 ;;
6240         *) startperl=": # use perl"
6241                 ;;
6242         esac
6243         ;;
6244 esac
6245 echo "I'll use $startperl to start perl scripts."
6246
6247 : figure best path for perl in scripts
6248 case "$perlpath" in
6249 '')
6250         perlpath="$binexp/perl"
6251         case "$startperl" in
6252         *!*) ;;
6253         *)
6254                 $cat <<EOH
6255
6256 I will use the "eval 'exec'" idiom to start Perl on your system.
6257 I can use the full path of your Perl binary for this purpose, but
6258 doing so may cause problems if you want to share those scripts and
6259 Perl is not always in a standard place ($binexp/perl).
6260
6261 EOH
6262                 dflt="$binexp/perl"
6263                 rp="What path shall I use in \"eval 'exec'\"?"
6264                 . ./myread
6265                 perlpath="$ans"
6266                 ;;
6267         esac
6268         ;;
6269 esac
6270 case "$startperl" in
6271 *!*)    ;;
6272 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6273 esac
6274
6275 : determine where public executable scripts go
6276 set scriptdir scriptdir
6277 eval $prefixit
6278 case "$scriptdir" in
6279 '')
6280         dflt="$bin"
6281         : guess some guesses
6282         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6283         $test -d /usr/share/bin     && dflt=/usr/share/bin
6284         $test -d /usr/local/script  && dflt=/usr/local/script
6285         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6286         $test -d $prefixexp/script  && dflt=$prefixexp/script
6287         set dflt
6288         eval $prefixup
6289         ;;
6290 *)  dflt="$scriptdir"
6291         ;;
6292 esac
6293 $cat <<EOM
6294  
6295 Some installations have a separate directory just for executable scripts so
6296 that they can mount it across multiple architectures but keep the scripts in
6297 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6298 Or you might just lump your scripts in with all your other executables.
6299  
6300 EOM
6301 fn=d~
6302 rp='Where do you keep publicly executable scripts?'
6303 . ./getfile
6304 if $test "X$ansexp" != "X$scriptdirexp"; then
6305         installscript=''
6306 fi
6307 scriptdir="$ans"
6308 scriptdirexp="$ansexp"
6309 : Change installation prefix, if necessary.
6310 if $test X"$prefix" != X"$installprefix"; then
6311         installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6312 else
6313         installscript="$scriptdirexp"
6314 fi
6315
6316 $cat <<EOM
6317
6318 After $package is installed, you may wish to install various
6319 add-on modules and utilities.  Typically, these add-ons will
6320 be installed under $prefix with the rest
6321 of this package.  However, you may wish to install such add-ons
6322 elsewhere under a different prefix.
6323
6324 If you do not wish to put everything under a single prefix, that's
6325 ok.  You will be prompted for the individual locations; this siteprefix
6326 is only used to suggest the defaults.
6327
6328 The default should be fine for most people.
6329
6330 EOM
6331 fn=d~+
6332 rp='Installation prefix to use for add-on modules and utilities?'
6333 : XXX Here might be another good place for an installstyle setting.
6334 case "$siteprefix" in
6335 '') dflt=$prefix ;;
6336 *)  dflt=$siteprefix ;;
6337 esac
6338 . ./getfile
6339 oldsiteprefix=''
6340 case "$siteprefix" in
6341 '') ;;
6342 *)
6343         case "$ans" in
6344         "$prefix") ;;
6345         *) oldsiteprefix="$prefix";;
6346         esac
6347         ;;
6348 esac
6349 siteprefix="$ans"
6350 siteprefixexp="$ansexp"
6351
6352 : determine where site specific libraries go.
6353 : Usual default is /usr/local/lib/perl5/site_perl
6354 : The default "style" setting is made in installstyle.U
6355 : XXX No longer works with Prefixit stuff.
6356 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6357 case "$installstyle" in
6358 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6359 *)       dflt=$siteprefix/lib/site_$prog ;;
6360 esac
6361 $cat <<EOM
6362
6363 The installation process will create a directory for
6364 site-specific extensions and modules.  Most users find it convenient
6365 to place all site-specific files in this directory rather than in the
6366 main distribution directory.
6367
6368 EOM
6369 fn=d~+
6370 rp='Pathname for the site-specific library files?'
6371 . ./getfile
6372 sitelib="$ans"
6373 sitelibexp="$ansexp"
6374 : Change installation prefix, if necessary.
6375 if $test X"$prefix" != X"$installprefix"; then
6376         installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
6377 else
6378         installsitelib="$sitelibexp"
6379 fi
6380
6381 : determine where site specific architecture-dependent libraries go.
6382 : sitelib  default is /usr/local/lib/perl5/site_perl/
6383 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6384 : sitelib may have an optional trailing /share.
6385 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6386 tdflt="$tdflt/$apiversion/$archname"
6387 set sitearch sitearch none
6388 eval $prefixit
6389 case "$sitearch" in
6390 '')     dflt="$tdflt" ;;
6391 *)      dflt="$sitearch" ;;
6392 esac
6393 $cat <<EOM
6394
6395 The installation process will also create a directory for
6396 architecture-dependent site-specific extensions and modules.
6397
6398 EOM
6399 fn=nd~+
6400 rp='Pathname for the site-specific architecture-dependent library files?'
6401 . ./getfile
6402 sitearch="$ans"
6403 sitearchexp="$ansexp"
6404 : Change installation prefix, if necessary.
6405 if $test X"$prefix" != X"$installprefix"; then
6406         installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
6407 else
6408         installsitearch="$sitearchexp"
6409 fi
6410
6411 cat <<EOM
6412
6413 Previous version of $package used the standard IO mechanisms as defined
6414 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6415 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6416 the default.  This abstraction layer can use AT&T's sfio (if you already
6417 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6418 problems with some extension modules.  Using PerlIO with stdio is safe,
6419 but it is slower than plain stdio and therefore is not the default.
6420
6421 If this doesn't make any sense to you, just accept the default 'n'.
6422 EOM
6423 case "$useperlio" in
6424 $define|true|[yY]*)     dflt='y';;
6425 *) dflt='n';;
6426 esac
6427 rp='Use the experimental PerlIO abstraction layer?'
6428 . ./myread
6429 case "$ans" in
6430 y|Y) 
6431         val="$define"
6432         ;;     
6433 *)      
6434         echo "Ok, doing things the stdio way"
6435         val="$undef"
6436         ;;
6437 esac
6438 set useperlio
6439 eval $setvar 
6440
6441 : Check how to convert floats to strings.
6442 if test "X$d_Gconvert" = X; then
6443         echo " "
6444         echo "Checking for an efficient way to convert floats to strings."
6445         $cat >try.c <<'EOP'
6446 #ifdef TRY_gconvert
6447 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6448 char *myname = "gconvert";
6449 #endif
6450 #ifdef TRY_gcvt
6451 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6452 char *myname = "gcvt";
6453 #endif
6454 #ifdef TRY_sprintf
6455 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6456 char *myname = "sprintf";
6457 #endif
6458
6459 #include <stdio.h>
6460
6461 int
6462 checkit(expect, got)
6463 char *expect;
6464 char *got;
6465 {
6466     if (strcmp(expect, got)) {
6467                 printf("%s oddity:  Expected %s, got %s\n",
6468                         myname, expect, got);
6469                 exit(1);
6470         }
6471 }
6472
6473 int main()
6474
6475         char buf[64]; 
6476         buf[63] = '\0';
6477
6478         /* This must be 1st test on (which?) platform */
6479         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6480         Gconvert(0.1, 8, 0, buf);
6481         checkit("0.1", buf);
6482
6483         Gconvert(1.0, 8, 0, buf); 
6484         checkit("1", buf);
6485
6486         Gconvert(0.0, 8, 0, buf); 
6487         checkit("0", buf);
6488
6489         Gconvert(-1.0, 8, 0, buf); 
6490         checkit("-1", buf);
6491
6492         /* Some Linux gcvt's give 1.e+5 here. */
6493         Gconvert(100000.0, 8, 0, buf); 
6494         checkit("100000", buf);
6495         
6496         /* Some Linux gcvt's give -1.e+5 here. */
6497         Gconvert(-100000.0, 8, 0, buf); 
6498         checkit("-100000", buf);
6499
6500         exit(0);
6501 }
6502 EOP
6503         case "$d_Gconvert" in
6504         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6505         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6506         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6507         *) xxx_list='gconvert gcvt sprintf' ;;
6508         esac
6509
6510         for xxx_convert in $xxx_list; do
6511                 echo "Trying $xxx_convert"
6512                 $rm -f try try$_o
6513                 set try -DTRY_$xxx_convert
6514                 if eval $compile; then
6515                         echo "$xxx_convert" found. >&4
6516                         if ./try; then
6517                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6518                                 break;
6519                         else
6520                                 echo "...But $xxx_convert didn't work as I expected."
6521                         fi
6522                 else
6523                         echo "$xxx_convert NOT found." >&4
6524                 fi
6525         done
6526                 
6527         case "$xxx_convert" in
6528         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6529         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6530         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6531         esac
6532 fi
6533
6534 : Initialize h_fcntl
6535 h_fcntl=false
6536
6537 : Initialize h_sysfile
6538 h_sysfile=false
6539
6540 : access call always available on UNIX
6541 set access d_access
6542 eval $inlibc
6543
6544 : locate the flags for 'access()'
6545 case "$d_access" in
6546 "$define")
6547         echo " "
6548         $cat >access.c <<'EOCP'
6549 #include <sys/types.h>
6550 #ifdef I_FCNTL
6551 #include <fcntl.h>
6552 #endif
6553 #ifdef I_SYS_FILE
6554 #include <sys/file.h>
6555 #endif
6556 #ifdef I_UNISTD
6557 #include <unistd.h>
6558 #endif
6559 int main() {
6560         exit(R_OK);
6561 }
6562 EOCP
6563         : check sys/file.h first, no particular reason here
6564         if $test `./findhdr sys/file.h` && \
6565                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
6566                 h_sysfile=true;
6567                 echo "<sys/file.h> defines the *_OK access constants." >&4
6568         elif $test `./findhdr fcntl.h` && \
6569                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
6570                 h_fcntl=true;
6571                 echo "<fcntl.h> defines the *_OK access constants." >&4
6572         elif $test `./findhdr unistd.h` && \
6573                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
6574                 echo "<unistd.h> defines the *_OK access constants." >&4
6575         else
6576                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6577         fi
6578         ;;
6579 esac
6580 $rm -f access*
6581
6582 : see if accessx exists
6583 set accessx d_accessx
6584 eval $inlibc
6585
6586 : see if alarm exists
6587 set alarm d_alarm
6588 eval $inlibc
6589
6590 : Look for GNU-cc style attribute checking
6591 echo " "
6592 echo "Checking whether your compiler can handle __attribute__ ..." >&4
6593 $cat >attrib.c <<'EOCP'
6594 #include <stdio.h>
6595 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
6596 EOCP
6597 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6598         if $contains 'warning' attrib.out >/dev/null 2>&1; then
6599                 echo "Your C compiler doesn't fully support __attribute__."
6600                 val="$undef"
6601         else
6602                 echo "Your C compiler supports __attribute__."
6603                 val="$define"
6604         fi
6605 else
6606         echo "Your C compiler doesn't seem to understand __attribute__ at all."
6607         val="$undef"
6608 fi
6609 set d_attribut
6610 eval $setvar
6611 $rm -f attrib*
6612
6613 : see if bcmp exists
6614 set bcmp d_bcmp
6615 eval $inlibc
6616
6617 : see if bcopy exists
6618 set bcopy d_bcopy
6619 eval $inlibc
6620
6621 : see if this is a unistd.h system
6622 set unistd.h i_unistd
6623 eval $inhdr
6624
6625 : see if getpgrp exists
6626 set getpgrp d_getpgrp
6627 eval $inlibc
6628
6629 case "$d_getpgrp" in
6630 "$define")
6631         echo " "
6632         echo "Checking to see which flavor of getpgrp is in use..."
6633         $cat >set.c <<EOP
6634 #$i_unistd I_UNISTD
6635 #include <sys/types.h>
6636 #ifdef I_UNISTD
6637 #  include <unistd.h>
6638 #endif
6639 int main()
6640 {
6641         if (getuid() == 0) {
6642                 printf("(I see you are running Configure as super-user...)\n");
6643                 setuid(1);
6644         }
6645 #ifdef TRY_BSD_PGRP
6646         if (getpgrp(1) == 0)
6647                 exit(0);
6648 #else
6649         if (getpgrp() > 0)
6650                 exit(0);
6651 #endif
6652         exit(1);
6653 }
6654 EOP
6655         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6656                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6657                 val="$define"
6658         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6659                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6660                 val="$undef"
6661         else
6662                 echo "I can't seem to compile and run the test program."
6663                 if ./usg; then
6664                         xxx="a USG one, i.e. you use getpgrp()."
6665                 else
6666                         # SVR4 systems can appear rather BSD-ish.
6667                         case "$i_unistd" in
6668                         $undef)
6669                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6670                                 val="$define"
6671                                 ;;
6672                         $define)
6673                                 xxx="probably a USG one, i.e. you use getpgrp()."
6674                                 val="$undef"
6675                                 ;;
6676                         esac
6677                 fi
6678                 echo "Assuming your getpgrp is $xxx" >&4
6679         fi
6680         ;;
6681 *) val="$undef";;
6682 esac
6683 set d_bsdgetpgrp
6684 eval $setvar
6685 $rm -f set set.c
6686
6687 : see if setpgrp exists
6688 set setpgrp d_setpgrp
6689 eval $inlibc
6690
6691 case "$d_setpgrp" in
6692 "$define")
6693         echo " "
6694         echo "Checking to see which flavor of setpgrp is in use..."
6695         $cat >set.c <<EOP
6696 #$i_unistd I_UNISTD
6697 #include <sys/types.h>
6698 #ifdef I_UNISTD
6699 #  include <unistd.h>
6700 #endif
6701 int main()
6702 {
6703         if (getuid() == 0) {
6704                 printf("(I see you are running Configure as super-user...)\n");
6705                 setuid(1);
6706         }
6707 #ifdef TRY_BSD_PGRP
6708         if (-1 == setpgrp(1, 1))
6709                 exit(0);
6710 #else
6711         if (setpgrp() != -1)
6712                 exit(0);
6713 #endif
6714         exit(1);
6715 }
6716 EOP
6717         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6718                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6719                 val="$define"
6720         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6721                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6722                 val="$undef"
6723         else
6724                 echo "(I can't seem to compile and run the test program.)"
6725                 if ./usg; then
6726                         xxx="a USG one, i.e. you use setpgrp()."
6727                 else
6728                         # SVR4 systems can appear rather BSD-ish.
6729                         case "$i_unistd" in
6730                         $undef)
6731                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6732                                 val="$define"
6733                                 ;;
6734                         $define)
6735                                 xxx="probably a USG one, i.e. you use setpgrp()."
6736                                 val="$undef"
6737                                 ;;
6738                         esac
6739                 fi
6740                 echo "Assuming your setpgrp is $xxx" >&4
6741         fi
6742         ;;
6743 *) val="$undef";;
6744 esac
6745 set d_bsdsetpgrp
6746 eval $setvar
6747 $rm -f set set.c
6748 : see if bzero exists
6749 set bzero d_bzero
6750 eval $inlibc
6751
6752 : check for lengths of integral types
6753 echo " "
6754 case "$intsize" in
6755 '')
6756         echo "Checking to see how big your integers are..." >&4
6757         $cat >intsize.c <<'EOCP'
6758 #include <stdio.h>
6759 int main()
6760 {
6761         printf("intsize=%d;\n", sizeof(int));
6762         printf("longsize=%d;\n", sizeof(long));
6763         printf("shortsize=%d;\n", sizeof(short));
6764         exit(0);
6765 }
6766 EOCP
6767         set intsize
6768         if eval $compile_ok && ./intsize > /dev/null; then
6769                 eval `./intsize`
6770                 echo "Your integers are $intsize bytes long."
6771                 echo "Your long integers are $longsize bytes long."
6772                 echo "Your short integers are $shortsize bytes long."
6773         else
6774                 $cat >&4 <<EOM
6775 !
6776 Help! I can't compile and run the intsize test program: please enlighten me!
6777 (This is probably a misconfiguration in your system or libraries, and
6778 you really ought to fix it.  Still, I'll try anyway.)
6779 !
6780 EOM
6781                 dflt=4
6782                 rp="What is the size of an integer (in bytes)?"
6783                 . ./myread
6784                 intsize="$ans"
6785                 dflt=$intsize
6786                 rp="What is the size of a long integer (in bytes)?"
6787                 . ./myread
6788                 longsize="$ans"
6789                 dflt=2
6790                 rp="What is the size of a short integer (in bytes)?"
6791                 . ./myread
6792                 shortsize="$ans"
6793         fi
6794         ;;
6795 esac
6796 $rm -f intsize intsize.*
6797
6798 : see if signal is declared as pointer to function returning int or void
6799 echo " "
6800 xxx=`./findhdr signal.h`
6801 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6802 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6803         echo "You have int (*signal())() instead of void." >&4
6804         val="$undef"
6805 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6806         echo "You have void (*signal())()." >&4
6807         val="$define"
6808 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6809         echo "You have int (*signal())() instead of void." >&4
6810         val="$undef"
6811 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6812         echo "You have void (*signal())()." >&4
6813         val="$define"
6814 else
6815         case "$d_voidsig" in
6816         '')
6817         echo "I can't determine whether signal handler returns void or int..." >&4
6818                 dflt=void
6819                 rp="What type does your signal handler return?"
6820                 . ./myread
6821                 case "$ans" in
6822                 v*) val="$define";;
6823                 *) val="$undef";;
6824                 esac;;
6825         "$define")
6826                 echo "As you already told me, signal handler returns void." >&4
6827                 val="$define"
6828                 ;;
6829         *)      echo "As you already told me, signal handler returns int." >&4
6830                 val="$undef"
6831                 ;;
6832         esac
6833 fi
6834 set d_voidsig
6835 eval $setvar
6836 case "$d_voidsig" in
6837 "$define") signal_t="void";;
6838 *) signal_t="int";;
6839 esac
6840 $rm -f $$.tmp
6841
6842 : check for ability to cast large floats to 32-bit ints.
6843 echo " "
6844 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6845 if $test "$intsize" -ge 4; then
6846         xxx=int
6847 else
6848         xxx=long
6849 fi
6850 $cat >try.c <<EOCP
6851 #include <stdio.h>
6852 #include <sys/types.h>
6853 #include <signal.h>
6854 $signal_t blech(s) int s; { exit(3); }
6855 int main()
6856 {
6857         $xxx i32;
6858         double f, g;
6859         int result = 0;
6860         char str[16];
6861         signal(SIGFPE, blech);
6862
6863         /* Don't let compiler optimize the test away.  Store the number 
6864            in a writable string for gcc to pass to sscanf under HP/UX.
6865         */
6866         sprintf(str, "2147483647");
6867         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6868         g = 10 * f;
6869         i32  = ($xxx) g;
6870
6871         /* x86 processors will probably give 0x8000 0000, which is a
6872        sign change.  We don't want that.  We want to mimic SPARC
6873            behavior here, which is to preserve the sign and give
6874            back 0x7fff ffff.
6875         */
6876         if (i32 != ($xxx) f)
6877                 result |= 1;
6878         exit(result);
6879 }
6880 EOCP
6881 set try
6882 if eval $compile_ok; then
6883         ./try
6884         yyy=$?
6885 else
6886         echo "(I can't seem to compile the test program--assuming it can't)"
6887         yyy=1
6888 fi
6889 case "$yyy" in
6890 0)      val="$define"
6891         echo "Yup, it can."
6892         ;;
6893 *)      val="$undef"
6894         echo "Nope, it can't."
6895         ;;
6896 esac
6897 set d_casti32
6898 eval $setvar
6899 $rm -f try try.*
6900
6901 : check for ability to cast negative floats to unsigned
6902 echo " "
6903 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6904 $cat >try.c <<EOCP
6905 #include <stdio.h>
6906 #include <sys/types.h>
6907 #include <signal.h>
6908 $signal_t blech(s) int s; { exit(7); }
6909 $signal_t blech_in_list(s) int s; { exit(4); }
6910 unsigned long dummy_long(p) unsigned long p; { return p; }
6911 unsigned int dummy_int(p) unsigned int p; { return p; }
6912 unsigned short dummy_short(p) unsigned short p; { return p; }
6913 int main()
6914 {
6915         double f;
6916         unsigned long along;
6917         unsigned int aint;
6918         unsigned short ashort;
6919         int result = 0;
6920         char str[16];
6921         
6922         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6923            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6924            optimized the whole file away
6925         */
6926         /* Store the number in a writable string for gcc to pass to 
6927            sscanf under HP/UX.
6928         */
6929         sprintf(str, "-123");
6930         sscanf(str, "%lf", &f);  /* f = -123.; */
6931
6932         signal(SIGFPE, blech);
6933         along = (unsigned long)f;
6934         aint = (unsigned int)f;
6935         ashort = (unsigned short)f;
6936         if (along != (unsigned long)-123)
6937                 result |= 1;
6938         if (aint != (unsigned int)-123)
6939                 result |= 1;
6940         if (ashort != (unsigned short)-123)
6941                 result |= 1;
6942         sprintf(str, "1073741824.");
6943         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6944         f = f + f;
6945         along = 0;
6946         along = (unsigned long)f;
6947         if (along != 0x80000000)
6948                 result |= 2;
6949         f -= 1.;
6950         along = 0;
6951         along = (unsigned long)f;
6952         if (along != 0x7fffffff)
6953                 result |= 1;
6954         f += 2.;
6955         along = 0;
6956         along = (unsigned long)f;
6957         if (along != 0x80000001)
6958                 result |= 2;
6959         if (result)
6960                 exit(result);
6961         signal(SIGFPE, blech_in_list);
6962         sprintf(str, "123.");
6963         sscanf(str, "%lf", &f);  /* f = 123.; */
6964         along = dummy_long((unsigned long)f);
6965         aint = dummy_int((unsigned int)f);
6966         ashort = dummy_short((unsigned short)f);
6967         if (along != (unsigned long)123)
6968                 result |= 4;
6969         if (aint != (unsigned int)123)
6970                 result |= 4;
6971         if (ashort != (unsigned short)123)
6972                 result |= 4;
6973         exit(result);
6974
6975 }
6976 EOCP
6977 set try
6978 if eval $compile_ok; then
6979         ./try
6980         castflags=$?
6981 else
6982         echo "(I can't seem to compile the test program--assuming it can't)"
6983         castflags=7
6984 fi
6985 case "$castflags" in
6986 0)      val="$define"
6987         echo "Yup, it can."
6988         ;;
6989 *)      val="$undef"
6990         echo "Nope, it can't."
6991         ;;
6992 esac
6993 set d_castneg
6994 eval $setvar
6995 $rm -f try.*
6996
6997 : see if vprintf exists
6998 echo " "
6999 if set vprintf val -f d_vprintf; eval $csym; $val; then
7000         echo 'vprintf() found.' >&4
7001         val="$define"
7002         $cat >vprintf.c <<'EOF'
7003 #include <varargs.h>
7004
7005 int main() { xxx("foo"); }
7006
7007 xxx(va_alist)
7008 va_dcl
7009 {
7010         va_list args;
7011         char buf[10];
7012
7013         va_start(args);
7014         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7015 }
7016 EOF
7017         set vprintf
7018         if eval $compile && ./vprintf; then
7019                 echo "Your vsprintf() returns (int)." >&4
7020                 val2="$undef"
7021         else
7022                 echo "Your vsprintf() returns (char*)." >&4
7023                 val2="$define"
7024         fi
7025 else
7026         echo 'vprintf() NOT found.' >&4
7027                 val="$undef"
7028                 val2="$undef"
7029 fi
7030 set d_vprintf
7031 eval $setvar
7032 val=$val2
7033 set d_charvspr
7034 eval $setvar
7035
7036 : see if chown exists
7037 set chown d_chown
7038 eval $inlibc
7039
7040 : see if chroot exists
7041 set chroot d_chroot
7042 eval $inlibc
7043
7044 : see if chsize exists
7045 set chsize d_chsize
7046 eval $inlibc
7047
7048 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7049 while $test $# -ge 2; do
7050         case "$1" in
7051         $define) echo "#include <$2>";;
7052         esac ;
7053     shift 2;
7054 done > try.c;
7055 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7056 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7057         val="$define";
7058 else
7059         val="$undef";
7060 fi;
7061 set $varname;
7062 eval $setvar;
7063 $rm -f try.c try.o'
7064
7065 : see if this is a sys/uio.h system
7066 set sys/uio.h i_sysuio
7067 eval $inhdr
7068
7069 echo "Checking to see if your system supports struct iovec..." >&4
7070 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7071 eval $hasfield
7072 case "$d_iovec_s" in
7073 "$define")      echo "Yup, it does." >&4
7074                 ;;
7075 *)              echo "Nope, it doesn't." >&4
7076                 ;;
7077 esac
7078
7079 socketlib=''
7080 sockethdr=''
7081 : see whether socket exists
7082 echo " "
7083 $echo $n "Hmm... $c" >&4
7084 if set socket val -f d_socket; eval $csym; $val; then
7085         echo "Looks like you have Berkeley networking support." >&4
7086         d_socket="$define"
7087         if set setsockopt val -f; eval $csym; $val; then
7088                 d_oldsock="$undef"
7089         else
7090                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7091                 d_oldsock="$define"
7092         fi
7093 else
7094         if $contains socklib libc.list >/dev/null 2>&1; then
7095                 echo "Looks like you have Berkeley networking support." >&4
7096                 d_socket="$define"
7097                 : we will have to assume that it supports the 4.2 BSD interface
7098                 d_oldsock="$undef"
7099         else
7100                 echo "You don't have Berkeley networking in libc$_a..." >&4
7101                 if test "X$d_socket" = "X$define"; then
7102                    echo "...but you seem to believe that you have sockets." >&4
7103                 else
7104                         for net in net socket
7105                         do
7106                                 if test -f /usr/lib/lib$net$_a; then
7107                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7108                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7109                                         if $contains socket libc.list >/dev/null 2>&1; then
7110                                                 d_socket="$define"
7111                                                 socketlib="-l$net"
7112                                                 case "$net" in
7113                                                 net)
7114                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7115                                                         sockethdr="-I/usr/netinclude"
7116                                                         ;;
7117                                                 esac
7118                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7119                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7120                                                         d_oldsock="$undef"
7121                                                 else
7122                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7123                                                         d_oldsock="$define"
7124                                                 fi
7125                                                 break
7126                                         fi
7127                                 fi
7128                         done
7129                         if test "X$d_socket" != "X$define"; then
7130                            echo "or anywhere else I see." >&4
7131                            d_socket="$undef"
7132                            d_oldsock="$undef"
7133                         fi
7134                 fi
7135         fi
7136 fi
7137
7138 : see if socketpair exists
7139 set socketpair d_sockpair
7140 eval $inlibc
7141
7142
7143 echo " "
7144 echo "Checking the availability of certain socket constants..." >& 4
7145 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7146         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7147         $cat >try.c <<EOF
7148 #include <sys/types.h>
7149 #include <sys/socket.h>
7150 int main() {
7151     int i = $ENUM;
7152 }
7153 EOF
7154         val="$undef"
7155         set try; if eval $compile; then
7156                 val="$define"
7157         fi
7158         set d_${enum}; eval $setvar
7159         $rm -f try.c try
7160 done
7161
7162 set sendmsg d_sendmsg
7163 eval $inlibc
7164
7165 set recvmsg d_recvmsg
7166 eval $inlibc
7167
7168 echo " "
7169 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7170 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7171 eval $hasfield
7172 case "$d_msghdr_s" in
7173 "$define")      echo "Yup, it does." >&4
7174                 ;;
7175 *)              echo "Nope, it doesn't." >&4
7176                 ;;
7177 esac
7178
7179 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7180 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7181 eval $hasfield
7182 case "$d_cmsghdr_s" in
7183 "$define")      echo "Yup, it does." >&4
7184                 ;;
7185 *)              echo "Nope, it doesn't." >&4
7186                 ;;
7187 esac
7188
7189 : check for const keyword
7190 echo " "
7191 echo 'Checking to see if your C compiler knows about "const"...' >&4
7192 $cat >const.c <<'EOCP'
7193 typedef struct spug { int drokk; } spug;
7194 int main()
7195 {
7196         const char *foo;
7197         const spug y;
7198 }
7199 EOCP
7200 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7201         val="$define"
7202         echo "Yup, it does."
7203 else
7204         val="$undef"
7205         echo "Nope, it doesn't."
7206 fi
7207 set d_const
7208 eval $setvar
7209
7210 : see if crypt exists
7211 echo " "
7212 if set crypt val -f d_crypt; eval $csym; $val; then
7213         echo 'crypt() found.' >&4
7214         val="$define"
7215         cryptlib=''
7216 else
7217         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7218         if $test -z "$cryptlib"; then
7219                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7220         else
7221                 cryptlib=-lcrypt
7222         fi
7223         if $test -z "$cryptlib"; then
7224                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7225         else
7226                 cryptlib=-lcrypt
7227         fi
7228         if $test -z "$cryptlib"; then
7229                 cryptlib=`./loc libcrypt$_a "" $libpth`
7230         else
7231                 cryptlib=-lcrypt
7232         fi
7233         if $test -z "$cryptlib"; then
7234                 echo 'crypt() NOT found.' >&4
7235                 val="$undef"
7236         else
7237                 val="$define"
7238         fi
7239 fi
7240 set d_crypt
7241 eval $setvar
7242
7243 : get csh whereabouts
7244 case "$csh" in
7245 'csh') val="$undef" ;;
7246 *) val="$define" ;;
7247 esac
7248 set d_csh
7249 eval $setvar
7250 : Respect a hint or command line value for full_csh.
7251 case "$full_csh" in
7252 '') full_csh=$csh ;;
7253 esac
7254
7255 : see if cuserid exists
7256 set cuserid d_cuserid
7257 eval $inlibc
7258
7259 : see if this is a limits.h system
7260 set limits.h i_limits
7261 eval $inhdr
7262
7263 : see if this is a float.h system
7264 set float.h i_float
7265 eval $inhdr
7266
7267 : See if number of significant digits in a double precision number is known
7268 echo " "
7269 $cat >dbl_dig.c <<EOM
7270 #$i_limits I_LIMITS
7271 #$i_float I_FLOAT
7272 #ifdef I_LIMITS
7273 #include <limits.h>
7274 #endif
7275 #ifdef I_FLOAT
7276 #include <float.h>
7277 #endif
7278 #ifdef DBL_DIG
7279 printf("Contains DBL_DIG");
7280 #endif
7281 EOM
7282 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7283 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7284         echo "DBL_DIG found." >&4
7285         val="$define"
7286 else
7287         echo "DBL_DIG NOT found." >&4
7288         val="$undef"
7289 fi
7290 $rm -f dbl_dig.?
7291 set d_dbl_dig
7292 eval $setvar
7293
7294
7295 if $test X"$use64bits" = X"$define"; then
7296         : see if dbminit64 exists
7297         set dbminit64 d_dbminit64
7298         eval $inlibc
7299
7300         : see if dbmclose64 exists
7301         set dbmclose64 d_dbmclose64
7302         eval $inlibc
7303
7304         : see if fetch64 exists
7305         set fetch64 d_fetch64
7306         eval $inlibc
7307
7308         : see if store64 exists
7309         set store64 d_store64
7310         eval $inlibc
7311
7312         : see if delete64 exists
7313         set delete64 d_delete64
7314         eval $inlibc
7315
7316         : see if firstkey64 exists
7317         set firstkey64 d_firstkey64
7318         eval $inlibc
7319
7320         : see if nextkey64 exists
7321         set nextkey64 d_nextkey64
7322         eval $inlibc
7323 else
7324         val="$undef"
7325         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7326         do
7327                 set $xxx
7328                 eval $setvar
7329         done
7330 fi
7331
7332 : see if difftime exists
7333 set difftime d_difftime
7334 eval $inlibc
7335
7336 : see if sys/stat.h is available
7337 set sys/stat.h i_sysstat
7338 eval $inhdr
7339
7340 : see if this is a dirent system
7341 echo " "
7342 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7343         val="$define"
7344         echo "<dirent.h> found." >&4
7345 else
7346         val="$undef"
7347         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7348                 echo "<sys/dir.h> found." >&4
7349                 echo " "
7350         else
7351                 xinc=`./findhdr sys/ndir.h`
7352         fi
7353         echo "<dirent.h> NOT found." >&4
7354 fi
7355 set i_dirent
7356 eval $setvar
7357
7358 : Look for type of directory structure.
7359 echo " "
7360 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7361
7362 case "$direntrytype" in
7363 ''|' ')
7364         case "$i_dirent" in
7365         $define) guess1='struct dirent' ;;
7366         *) guess1='struct direct'  ;;
7367         esac
7368         ;;
7369 *)      guess1="$direntrytype"
7370         ;;
7371 esac
7372
7373 case "$guess1" in
7374 'struct dirent') guess2='struct direct' ;;
7375 *) guess2='struct dirent' ;;
7376 esac
7377                 
7378 if $contains "$guess1" try.c >/dev/null 2>&1; then
7379         direntrytype="$guess1"
7380         echo "Your directory entries are $direntrytype." >&4
7381 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7382         direntrytype="$guess2"
7383         echo "Your directory entries seem to be $direntrytype." >&4
7384 else
7385         echo "I don't recognize your system's directory entries." >&4
7386         rp="What type is used for directory entries on this system?"
7387         dflt="$guess1"
7388         . ./myread
7389         direntrytype="$ans"
7390 fi
7391 $rm -f try.c
7392
7393
7394 : see if the directory entry stores field length
7395 echo " "
7396 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7397 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7398         echo "Good, your directory entry keeps length information in d_namlen." >&4
7399         val="$define"
7400 else
7401         echo "Your directory entry does not know about the d_namlen field." >&4
7402         val="$undef"
7403 fi
7404 set d_dirnamlen
7405 eval $setvar
7406 $rm -f try.c
7407
7408
7409 if $test X"$use64bits" = X"$define"; then
7410         : see if fstat64 exists
7411         set fstat64 d_fstat64
7412         eval $inlibc
7413
7414         : see if ftruncate64 exists
7415         set ftruncate64 d_ftruncate64
7416         eval $inlibc
7417
7418         : see if lockf64 exists
7419         set lockf64 d_lockf64
7420         eval $inlibc
7421
7422         : see if llseek exists
7423         set llseek d_llseek
7424         eval $inlibc
7425
7426         : see if lseek64 exists
7427         set lseek64 d_lseek64
7428         eval $inlibc
7429
7430         : see if lstat64 exists
7431         set lstat64 d_lstat64
7432         eval $inlibc
7433
7434         : see if open64 exists
7435         set open64 d_open64
7436         eval $inlibc
7437
7438         : see if opendir64 exists
7439         set opendir64 d_opendir64
7440         eval $inlibc
7441
7442         : see if readdir64 exists
7443         set readdir64 d_readdir64
7444         eval $inlibc
7445
7446         : see if seekdir64 exists
7447         set seekdir64 d_seekdir64
7448         eval $inlibc
7449
7450         : see if stat64 exists
7451         set stat64 d_stat64
7452         eval $inlibc
7453
7454         : see if telldir64 exists
7455         set telldir64 d_telldir64
7456         eval $inlibc
7457
7458         : see if truncate64 exists
7459         set truncate64 d_truncate64
7460         eval $inlibc
7461
7462         : check for off64_t
7463         echo " "
7464         echo $n "Checking to see if your system supports off64_t...$c" >&4
7465         $cat >try.c <<EOCP
7466 #include <sys/types.h>
7467 #include <unistd.h>
7468 off64_t foo() { off64_t x; x = 7; return x; }'
7469 EOCP
7470         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7471                 val="$define"
7472                 echo " Yup, it does." >&4
7473         else
7474                 val="$undef"
7475                 echo " Nope, it doesn't." >&4
7476         fi
7477         $rm -f try.*
7478         set d_off64_t
7479         eval $setvar
7480
7481         : check for offset_t
7482         echo " "
7483         echo $n "Checking to see if your system supports offset_t...$c" >&4
7484         $cat >try.c <<EOCP
7485 #include <sys/types.h>
7486 #include <unistd.h>
7487 offset_t foo() { offset_t x; x = 7; return x; }'
7488 EOCP
7489         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7490                 val="$define"
7491                 echo " Yup, it does." >&4
7492         else
7493                 val="$undef"
7494                 echo " Nope, it doesn't." >&4
7495         fi
7496         $rm -f try.*
7497         set d_offset_t
7498         eval $setvar
7499
7500         : check for ino64_t
7501         echo " "
7502         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7503         val="$undef"
7504         case "$i_sysstat" in
7505         "$define" )
7506                 $cat >try.c <<EOCP
7507 #include <sys/types.h>
7508 #include <sys/stat.h>
7509 ino64_t foo() { ino64_t x; x = 7; return x; }'
7510 EOCP
7511                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7512                         val="$define"
7513                 fi
7514                 $rm -f try.*
7515                 ;;
7516         esac
7517         if $test "X$val" = X"$define"; then
7518                 echo " Yup, it does." >&4
7519         else
7520                 echo " Nope, it doesn't." >&4
7521         fi
7522         set d_ino64_t
7523         eval $setvar
7524
7525         : check for struct flock64
7526         echo " "
7527         echo "Checking to see if your system supports struct flock64..." >&4
7528         if $h_fcntl; then
7529                 set d_flock64_s flock64 l_len define fcntl.h
7530                 eval $hasfield
7531         else
7532                 val="$undef"
7533                 set d_flock64_s
7534                 eval $setvar
7535         fi
7536         case "$d_flock64_s" in
7537         "$define")      echo "Yup, it does." >&4
7538                         ;;
7539         *)              echo "Nope, it doesn't." >&4
7540                         ;;
7541         esac
7542
7543         : check for struct dirent64
7544         echo " "
7545         echo "Checking to see if your system supports struct dirent64..." >&4
7546         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
7547         eval $hasfield
7548         case "$d_dirent64_s" in
7549         "$define")      echo "Yup, it does." >&4
7550                         ;;
7551         *)              echo "Nope, it doesn't." >&4
7552                         ;;
7553         esac
7554
7555 else
7556         val="$undef"
7557         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
7558         do
7559                 set $xxx
7560                 eval $setvar
7561         done
7562 fi
7563
7564 : see if dlerror exists
7565 xxx_runnm="$runnm"
7566 runnm=false
7567 set dlerror d_dlerror
7568 eval $inlibc
7569 runnm="$xxx_runnm"
7570
7571 : see if dlfcn is available
7572 set dlfcn.h i_dlfcn
7573 eval $inhdr
7574
7575 case "$usedl" in
7576 $define|y|true)
7577         $cat << EOM
7578
7579 On a few systems, the dynamically loaded modules that perl generates and uses
7580 will need a different extension than shared libs. The default will probably
7581 be appropriate.
7582
7583 EOM
7584         case "$dlext" in
7585         '')     dflt="$so" ;;
7586         *)      dflt="$dlext" ;;
7587         esac
7588         rp='What is the extension of dynamically loaded modules'
7589         . ./myread
7590         dlext="$ans"
7591         ;;
7592 *)
7593         dlext="none"
7594         ;;
7595 esac
7596
7597 : Check if dlsym need a leading underscore
7598 echo " "
7599 val="$undef"
7600
7601 case "$dlsrc" in
7602 dl_dlopen.xs)
7603         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7604         $cat >dyna.c <<'EOM'
7605 fred () { }
7606 EOM
7607
7608 $cat >fred.c<<EOM
7609
7610 #include <stdio.h>
7611 #$i_dlfcn I_DLFCN
7612 #ifdef I_DLFCN
7613 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7614 #else
7615 #include <sys/types.h>
7616 #include <nlist.h>
7617 #include <link.h>
7618 #endif
7619
7620 extern int fred() ;
7621
7622 int main()
7623 {
7624     void * handle ;
7625     void * symbol ;
7626 #ifndef RTLD_LAZY
7627     int mode = 1 ;
7628 #else
7629     int mode = RTLD_LAZY ;
7630 #endif
7631     handle = dlopen("./dyna.$dlext", mode) ;
7632     if (handle == NULL) {
7633         printf ("1\n") ;
7634         fflush (stdout) ;
7635         exit(0);
7636     }
7637     symbol = dlsym(handle, "fred") ;
7638     if (symbol == NULL) {
7639         /* try putting a leading underscore */
7640         symbol = dlsym(handle, "_fred") ;
7641         if (symbol == NULL) {
7642             printf ("2\n") ;
7643             fflush (stdout) ;
7644             exit(0);
7645         }
7646         printf ("3\n") ;
7647     }
7648     else
7649         printf ("4\n") ;
7650     fflush (stdout) ;
7651     exit(0);
7652 }
7653 EOM
7654         : Call the object file tmp-dyna.o in case dlext=o.
7655         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7656                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7657                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7658                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7659                 xxx=`./fred`
7660                 case $xxx in
7661                 1)      echo "Test program failed using dlopen." >&4
7662                         echo "Perhaps you should not use dynamic loading." >&4;;
7663                 2)      echo "Test program failed using dlsym." >&4
7664                         echo "Perhaps you should not use dynamic loading." >&4;;
7665                 3)      echo "dlsym needs a leading underscore" >&4
7666                         val="$define" ;;
7667                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7668                 esac
7669         else
7670                 echo "I can't compile and run the test program." >&4
7671         fi
7672         ;;
7673 esac
7674                 
7675 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7676
7677 set d_dlsymun
7678 eval $setvar
7679
7680 hasproto='varname=$1; func=$2; shift; shift;
7681 while $test $# -ge 2; do
7682         case "$1" in
7683         $define) echo "#include <$2>";;
7684         esac ;
7685     shift 2;
7686 done > try.c;
7687 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7688 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7689         echo "$func() prototype found.";
7690         val="$define";
7691 else
7692         echo "$func() prototype NOT found.";
7693         val="$undef";
7694 fi;
7695 set $varname;
7696 eval $setvar;
7697 $rm -f try.c tryout.c'
7698
7699 : see if prototype for drand48 is available
7700 echo " "
7701 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7702 eval $hasproto
7703
7704 : see if dup2 exists
7705 set dup2 d_dup2
7706 eval $inlibc
7707
7708 : see if eaccess exists
7709 set eaccess d_eaccess
7710 eval $inlibc
7711
7712 : see if endgrent exists
7713 set endgrent d_endgrent
7714 eval $inlibc
7715
7716 : see if endhostent exists
7717 set endhostent d_endhent
7718 eval $inlibc
7719
7720 : see if endnetent exists
7721 set endnetent d_endnent
7722 eval $inlibc
7723
7724 : see if endprotoent exists
7725 set endprotoent d_endpent
7726 eval $inlibc
7727
7728 : see if endpwent exists
7729 set endpwent d_endpwent
7730 eval $inlibc
7731
7732 : see if endservent exists
7733 set endservent d_endsent
7734 eval $inlibc
7735
7736 : see if endspent exists
7737 set endspent d_endspent
7738 eval $inlibc
7739
7740 : Locate the flags for 'open()'
7741 echo " "
7742 $cat >open3.c <<'EOCP'
7743 #include <sys/types.h>
7744 #ifdef I_FCNTL
7745 #include <fcntl.h>
7746 #endif
7747 #ifdef I_SYS_FILE
7748 #include <sys/file.h>
7749 #endif
7750 int main() {
7751         if(O_RDONLY);
7752 #ifdef O_TRUNC
7753         exit(0);
7754 #else
7755         exit(1);
7756 #endif
7757 }
7758 EOCP
7759 : check sys/file.h first to get FREAD on Sun
7760 if $test `./findhdr sys/file.h` && \
7761                 set open3 -DI_SYS_FILE && eval $compile; then
7762         h_sysfile=true;
7763         echo "<sys/file.h> defines the O_* constants..." >&4
7764         if ./open3; then
7765                 echo "and you have the 3 argument form of open()." >&4
7766                 val="$define"
7767         else
7768                 echo "but not the 3 argument form of open().  Oh, well." >&4
7769                 val="$undef"
7770         fi
7771 elif $test `./findhdr fcntl.h` && \
7772                 set open3 -DI_FCNTL && eval $compile; then
7773         h_fcntl=true;
7774         echo "<fcntl.h> defines the O_* constants..." >&4
7775         if ./open3; then
7776                 echo "and you have the 3 argument form of open()." >&4
7777                 val="$define"
7778         else
7779                 echo "but not the 3 argument form of open().  Oh, well." >&4
7780                 val="$undef"
7781         fi
7782 else
7783         val="$undef"
7784         echo "I can't find the O_* constant definitions!  You got problems." >&4
7785 fi
7786 set d_open3
7787 eval $setvar
7788 $rm -f open3*
7789
7790 : check for non-blocking I/O stuff
7791 case "$h_sysfile" in
7792 true) echo "#include <sys/file.h>" > head.c;;
7793 *)
7794         case "$h_fcntl" in
7795         true) echo "#include <fcntl.h>" > head.c;;
7796         *) echo "#include <sys/fcntl.h>" > head.c;;
7797         esac
7798         ;;
7799 esac
7800 echo " "
7801 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7802 case "$o_nonblock" in
7803 '')
7804         $cat head.c > try.c
7805         $cat >>try.c <<'EOCP'
7806 int main() {
7807 #ifdef O_NONBLOCK
7808         printf("O_NONBLOCK\n");
7809         exit(0);
7810 #endif
7811 #ifdef O_NDELAY
7812         printf("O_NDELAY\n");
7813         exit(0);
7814 #endif
7815 #ifdef FNDELAY
7816         printf("FNDELAY\n");
7817         exit(0);
7818 #endif
7819         exit(0);
7820 }
7821 EOCP
7822         set try
7823         if eval $compile_ok; then
7824                 o_nonblock=`./try`
7825                 case "$o_nonblock" in
7826                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7827                 *) echo "Seems like we can use $o_nonblock.";;
7828                 esac
7829         else
7830                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7831         fi
7832         ;;
7833 *) echo "Using $hint value $o_nonblock.";;
7834 esac
7835 $rm -f try try.* .out core
7836
7837 echo " "
7838 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7839 case "$eagain" in
7840 '')
7841         $cat head.c > try.c
7842         $cat >>try.c <<EOCP
7843 #include <errno.h>
7844 #include <sys/types.h>
7845 #include <signal.h>
7846 #define MY_O_NONBLOCK $o_nonblock
7847 #ifndef errno  /* XXX need better Configure test */
7848 extern int errno;
7849 #endif
7850 $signal_t blech(x) int x; { exit(3); }
7851 EOCP
7852         $cat >> try.c <<'EOCP'
7853 int main()
7854 {
7855         int pd[2];
7856         int pu[2];
7857         char buf[1];
7858         char string[100];
7859
7860         pipe(pd);       /* Down: child -> parent */
7861         pipe(pu);       /* Up: parent -> child */
7862         if (0 != fork()) {
7863                 int ret;
7864                 close(pd[1]);   /* Parent reads from pd[0] */
7865                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
7866                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
7867                         exit(1);
7868                 signal(SIGALRM, blech);
7869                 alarm(5);
7870                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
7871                         exit(2);
7872                 sprintf(string, "%d\n", ret);
7873                 write(2, string, strlen(string));
7874                 alarm(0);
7875 #ifdef EAGAIN
7876                 if (errno == EAGAIN) {
7877                         printf("EAGAIN\n");
7878                         goto ok;
7879                 }
7880 #endif
7881 #ifdef EWOULDBLOCK
7882                 if (errno == EWOULDBLOCK)
7883                         printf("EWOULDBLOCK\n");
7884 #endif
7885         ok:
7886                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
7887                 sleep(2);                               /* Give it time to close our pipe */
7888                 alarm(5);
7889                 ret = read(pd[0], buf, 1);      /* Should read EOF */
7890                 alarm(0);
7891                 sprintf(string, "%d\n", ret);
7892                 write(3, string, strlen(string));
7893                 exit(0);
7894         }
7895
7896         close(pd[0]);                   /* We write to pd[1] */
7897         close(pu[1]);                   /* We read from pu[0] */
7898         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
7899         close(pd[1]);                   /* Pipe pd is now fully closed! */
7900         exit(0);                                /* Bye bye, thank you for playing! */
7901 }
7902 EOCP
7903         set try
7904         if eval $compile_ok; then
7905                 echo "$startsh" >mtry
7906                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
7907                 chmod +x mtry
7908                 ./mtry >/dev/null 2>&1
7909                 case $? in
7910                 0) eagain=`$cat try.out`;;
7911                 1) echo "Could not perform non-blocking setting!";;
7912                 2) echo "I did a successful read() for something that was not there!";;
7913                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7914                 *) echo "Something terribly wrong happened during testing.";;
7915                 esac
7916                 rd_nodata=`$cat try.ret`
7917                 echo "A read() system call with no data present returns $rd_nodata."
7918                 case "$rd_nodata" in
7919                 0|-1) ;;
7920                 *)
7921                         echo "(That's peculiar, fixing that to be -1.)"
7922                         rd_nodata=-1
7923                         ;;
7924                 esac
7925                 case "$eagain" in
7926                 '')
7927                         echo "Forcing errno EAGAIN on read() with no data available."
7928                         eagain=EAGAIN
7929                         ;;
7930                 *)
7931                         echo "Your read() sets errno to $eagain when no data is available."
7932                         ;;
7933                 esac
7934                 status=`$cat try.err`
7935                 case "$status" in
7936                 0) echo "And it correctly returns 0 to signal EOF.";;
7937                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7938                 *) echo "However, your read() returns '$status' on EOF??";;
7939                 esac
7940                 val="$define"
7941                 if test "$status" = "$rd_nodata"; then
7942                         echo "WARNING: you can't distinguish between EOF and no data!"
7943                         val="$undef"
7944                 fi
7945         else
7946                 echo "I can't compile the test program--assuming errno EAGAIN will do."
7947                 eagain=EAGAIN
7948         fi
7949         set d_eofnblk
7950         eval $setvar
7951         ;;
7952 *)
7953         echo "Using $hint value $eagain."
7954         echo "Your read() returns $rd_nodata when no data is present."
7955         case "$d_eofnblk" in
7956         "$define") echo "And you can see EOF because read() returns 0.";;
7957         "$undef") echo "But you can't see EOF status from read() returned value.";;
7958         *)
7959                 echo "(Assuming you can't see EOF status from read anyway.)"
7960                 d_eofnblk=$undef
7961                 ;;
7962         esac
7963         ;;
7964 esac
7965 $rm -f try try.* .out core head.c mtry
7966
7967 : see if fchmod exists
7968 set fchmod d_fchmod
7969 eval $inlibc
7970
7971 : see if fchown exists
7972 set fchown d_fchown
7973 eval $inlibc
7974
7975 : see if this is an fcntl system
7976 set fcntl d_fcntl
7977 eval $inlibc
7978
7979 : see if sys/select.h has to be included
7980 set sys/select.h i_sysselct
7981 eval $inhdr
7982
7983 : see if we should include time.h, sys/time.h, or both
7984 echo " "
7985 if test "X$timeincl" = X; then
7986         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7987         $echo $n "I'm now running the test program...$c"
7988         $cat >try.c <<'EOCP'
7989 #include <sys/types.h>
7990 #ifdef I_TIME
7991 #include <time.h>
7992 #endif
7993 #ifdef I_SYSTIME
7994 #ifdef SYSTIMEKERNEL
7995 #define KERNEL
7996 #endif
7997 #include <sys/time.h>
7998 #endif
7999 #ifdef I_SYSSELECT
8000 #include <sys/select.h>
8001 #endif
8002 int main()
8003 {
8004         struct tm foo;
8005 #ifdef S_TIMEVAL
8006         struct timeval bar;
8007 #endif
8008 #ifdef S_TIMEZONE
8009         struct timezone tzp;
8010 #endif
8011         if (foo.tm_sec == foo.tm_sec)
8012                 exit(0);
8013 #ifdef S_TIMEVAL
8014         if (bar.tv_sec == bar.tv_sec)
8015                 exit(0);
8016 #endif
8017         exit(1);
8018 }
8019 EOCP
8020         flags=''
8021         for s_timezone in '-DS_TIMEZONE' ''; do
8022         sysselect=''
8023         for s_timeval in '-DS_TIMEVAL' ''; do
8024         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8025         for i_time in '' '-DI_TIME'; do
8026         for i_systime in '-DI_SYSTIME' ''; do
8027                 case "$flags" in
8028                 '') $echo $n ".$c"
8029                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8030                         if eval $compile; then
8031                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8032                                 shift
8033                                 flags="$*"
8034                                 echo " "
8035                                 $echo $n "Succeeded with $flags$c"
8036                         fi
8037                         ;;
8038                 esac
8039         done
8040         done
8041         done
8042         done
8043         done
8044         timeincl=''
8045         echo " "
8046         case "$flags" in
8047         *SYSTIMEKERNEL*) i_systimek="$define"
8048                 timeincl=`./findhdr sys/time.h`
8049                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8050         *) i_systimek="$undef";;
8051         esac
8052         case "$flags" in
8053         *I_TIME*) i_time="$define"
8054                 timeincl=`./findhdr time.h`" $timeincl"
8055                 echo "We'll include <time.h>." >&4;;
8056         *) i_time="$undef";;
8057         esac
8058         case "$flags" in
8059         *I_SYSTIME*) i_systime="$define"
8060                 timeincl=`./findhdr sys/time.h`" $timeincl"
8061                 echo "We'll include <sys/time.h>." >&4;;
8062         *) i_systime="$undef";;
8063         esac
8064         $rm -f try.c try
8065 fi
8066
8067 : check for fd_set items
8068 $cat <<EOM
8069
8070 Checking to see how well your C compiler handles fd_set and friends ...
8071 EOM
8072 $cat >fd_set.c <<EOCP
8073 #$i_systime I_SYS_TIME
8074 #$i_sysselct I_SYS_SELECT
8075 #$d_socket HAS_SOCKET
8076 #include <sys/types.h>
8077 #ifdef HAS_SOCKET
8078 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8079 #endif
8080 #ifdef I_SYS_TIME
8081 #include <sys/time.h>
8082 #endif
8083 #ifdef I_SYS_SELECT
8084 #include <sys/select.h>
8085 #endif
8086 int main() {
8087         fd_set fds;
8088
8089 #ifdef TRYBITS
8090         if(fds.fds_bits);
8091 #endif
8092
8093 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8094         exit(0);
8095 #else
8096         exit(1);
8097 #endif
8098 }
8099 EOCP
8100 set fd_set -DTRYBITS
8101 if eval $compile; then
8102         d_fds_bits="$define"
8103         d_fd_set="$define"
8104         echo "Well, your system knows about the normal fd_set typedef..." >&4
8105         if ./fd_set; then
8106                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8107                 d_fd_macros="$define"
8108         else
8109                 $cat >&4 <<'EOM'
8110 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8111 EOM
8112                 d_fd_macros="$undef"
8113         fi
8114 else
8115         $cat <<'EOM'
8116 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8117 EOM
8118         set fd_set
8119         if eval $compile; then
8120                 d_fds_bits="$undef"
8121                 d_fd_set="$define"
8122                 echo "Well, your system has some sort of fd_set available..." >&4
8123                 if ./fd_set; then
8124                         echo "and you have the normal fd_set macros." >&4
8125                         d_fd_macros="$define"
8126                 else
8127                         $cat <<'EOM'
8128 but not the normal fd_set macros!  Gross!  More work for me...
8129 EOM
8130                         d_fd_macros="$undef"
8131                 fi
8132         else
8133         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8134                 d_fd_set="$undef"
8135                 d_fds_bits="$undef"
8136                 d_fd_macros="$undef"
8137         fi
8138 fi
8139 $rm -f fd_set*
8140
8141 : see if fgetpos exists
8142 set fgetpos d_fgetpos
8143 eval $inlibc
8144
8145
8146 if $test X"$use64bits" = X"$define"; then
8147         : see if fgetpos64 exists
8148         set fgetpos64 d_fgetpos64
8149         eval $inlibc
8150
8151         : see if fopen64 exists
8152         set freopen64 d_fopen64
8153         eval $inlibc
8154
8155         : see if freopen64 exists
8156         set freopen64 d_freopen64
8157         eval $inlibc
8158
8159         : see if fseek64 exists
8160         set fseek64 d_fseek64
8161         eval $inlibc
8162
8163         : see if fseeko64 exists
8164         set fseeko64 d_fseeko64
8165         eval $inlibc
8166
8167         : see if fsetpos64 exists
8168         set fsetpos64 d_fsetpos64
8169         eval $inlibc
8170
8171         : see if ftell64 exists
8172         set ftell64 d_ftell64
8173         eval $inlibc
8174
8175         : see if ftello64 exists
8176         set ftello64 d_ftello64
8177         eval $inlibc
8178
8179         : see if tmpfile64 exists
8180         set tmpfile64 d_tmpfile64
8181         eval $inlibc
8182 else
8183         val="$undef"
8184         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8185         do
8186                 set $xxx
8187                 eval $setvar
8188         done
8189 fi
8190
8191 : see if flock exists
8192 set flock d_flock
8193 eval $inlibc
8194
8195 : see if fork exists
8196 set fork d_fork
8197 eval $inlibc
8198
8199 : see if pathconf exists
8200 set pathconf d_pathconf
8201 eval $inlibc
8202
8203 : see if fpathconf exists
8204 set fpathconf d_fpathconf
8205 eval $inlibc
8206
8207 : see if fseeko exists
8208 set fseeko d_fseeko
8209 eval $inlibc
8210
8211 : see if fsetpos exists
8212 set fsetpos d_fsetpos
8213 eval $inlibc
8214
8215 : see if this is a sys/param system
8216 set sys/param.h i_sysparam
8217 eval $inhdr
8218
8219 : see if this is a sys/mount.h system
8220 set sys/mount.h i_sysmount
8221 eval $inhdr
8222
8223
8224 : see if statfs exists
8225 set statfs d_statfs
8226 eval $inlibc
8227
8228 : see if fstatfs exists
8229 set fstatfs d_fstatfs
8230 eval $inlibc
8231
8232 : see if statfs knows about mount flags
8233 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8234 eval $hasfield
8235
8236
8237 : see if statvfs exists
8238 set statvfs d_statvfs
8239 eval $inlibc
8240
8241 : see if fstatvfs exists
8242 set fstatvfs d_fstatvfs
8243 eval $inlibc
8244
8245
8246 : see if ftello exists
8247 set ftello d_ftello
8248 eval $inlibc
8249
8250 : see if getgrent exists
8251 set getgrent d_getgrent
8252 eval $inlibc
8253
8254 : see if gethostbyaddr exists
8255 set gethostbyaddr d_gethbyaddr
8256 eval $inlibc
8257
8258 : see if gethostbyname exists
8259 set gethostbyname d_gethbyname
8260 eval $inlibc
8261
8262 : see if gethostent exists
8263 set gethostent d_gethent
8264 eval $inlibc
8265
8266 : see how we will look up host name
8267 echo " "
8268 call=''
8269 if set gethostname val -f d_gethname; eval $csym; $val; then
8270         echo 'gethostname() found.' >&4
8271         d_gethname="$define"
8272         call=gethostname
8273 fi
8274 if set uname val -f d_uname; eval $csym; $val; then
8275         if ./xenix; then
8276                 $cat <<'EOM'
8277 uname() was found, but you're running xenix, and older versions of xenix
8278 have a broken uname(). If you don't really know whether your xenix is old
8279 enough to have a broken system call, use the default answer.
8280
8281 EOM
8282                 dflt=y
8283                 case "$d_uname" in
8284                 "$define") dflt=n;;
8285                 esac
8286                 rp='Is your uname() broken?'
8287                 . ./myread
8288                 case "$ans" in
8289                 n*) d_uname="$define"; call=uname;;
8290                 esac
8291         else
8292                 echo 'uname() found.' >&4
8293                 d_uname="$define"
8294                 case "$call" in
8295                 '') call=uname ;;
8296                 esac
8297         fi
8298 fi
8299 case "$d_gethname" in
8300 '') d_gethname="$undef";;
8301 esac
8302 case "$d_uname" in
8303 '') d_uname="$undef";;
8304 esac
8305 case "$d_uname$d_gethname" in
8306 *define*)
8307         dflt=n
8308         cat <<EOM
8309  
8310 Every now and then someone has a $call() that lies about the hostname
8311 but can't be fixed for political or economic reasons.  If you wish, I can
8312 pretend $call() isn't there and maybe compute hostname at run-time
8313 thanks to the '$phostname' command.
8314
8315 EOM
8316         rp="Shall I ignore $call() from now on?"
8317         . ./myread
8318         case "$ans" in
8319         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8320         esac;;
8321 esac
8322 case "$phostname" in
8323 '') aphostname='';;
8324 *) case "$aphostname" in
8325         /*) ;;
8326         *) set X $phostname
8327                 shift
8328                 file=$1
8329                 shift
8330                 file=`./loc $file $file $pth`
8331                 aphostname=`echo $file $*`
8332                 ;;
8333         esac
8334         ;;
8335 esac
8336 case "$d_uname$d_gethname" in
8337 *define*) ;;
8338 *)
8339         case "$phostname" in
8340         '')
8341                 echo "There will be no way for $package to get your hostname." >&4;;
8342         *)
8343         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8344                 ;;
8345         esac;;
8346 esac
8347 case "$d_phostname" in
8348 '') d_phostname="$undef";;
8349 esac
8350
8351 : see if this is a netdb.h system
8352 set netdb.h i_netdb
8353 eval $inhdr
8354
8355 : see if prototypes for various gethostxxx netdb.h functions are available
8356 echo " "
8357 set d_gethostprotos gethostent $i_netdb netdb.h
8358 eval $hasproto
8359
8360 : see if getlogin exists
8361 set getlogin d_getlogin
8362 eval $inlibc
8363
8364 : see if getmntent exists
8365 set getmntent d_getmntent
8366 eval $inlibc
8367
8368 : see if getnetbyaddr exists
8369 set getnetbyaddr d_getnbyaddr
8370 eval $inlibc
8371
8372 : see if getnetbyname exists
8373 set getnetbyname d_getnbyname
8374 eval $inlibc
8375
8376 : see if getnetent exists
8377 set getnetent d_getnent
8378 eval $inlibc
8379
8380 : see if prototypes for various getnetxxx netdb.h functions are available
8381 echo " "
8382 set d_getnetprotos getnetent $i_netdb netdb.h
8383 eval $hasproto
8384
8385
8386 : see if getprotobyname exists
8387 set getprotobyname d_getpbyname
8388 eval $inlibc
8389
8390 : see if getprotobynumber exists
8391 set getprotobynumber d_getpbynumber
8392 eval $inlibc
8393
8394 : see if getprotoent exists
8395 set getprotoent d_getpent
8396 eval $inlibc
8397
8398 : see if getpgid exists
8399 set getpgid d_getpgid
8400 eval $inlibc
8401
8402 : see if getpgrp2 exists
8403 set getpgrp2 d_getpgrp2
8404 eval $inlibc
8405
8406 : see if getppid exists
8407 set getppid d_getppid
8408 eval $inlibc
8409
8410 : see if getpriority exists
8411 set getpriority d_getprior
8412 eval $inlibc
8413
8414 : see if prototypes for various getprotoxxx netdb.h functions are available
8415 echo " "
8416 set d_getprotoprotos getprotoent $i_netdb netdb.h
8417 eval $hasproto
8418
8419 : see if getpwent exists
8420 set getpwent d_getpwent
8421 eval $inlibc
8422
8423
8424 : see if getservbyname exists
8425 set getservbyname d_getsbyname
8426 eval $inlibc
8427
8428 : see if getservbyport exists
8429 set getservbyport d_getsbyport
8430 eval $inlibc
8431
8432 : see if getservent exists
8433 set getservent d_getsent
8434 eval $inlibc
8435
8436 : see if prototypes for various getservxxx netdb.h functions are available
8437 echo " "
8438 set d_getservprotos getservent $i_netdb netdb.h
8439 eval $hasproto
8440
8441 : see if getspent exists
8442 set getspent d_getspent
8443 eval $inlibc
8444
8445 : see if getspnam exists
8446 set getspnam d_getspnam
8447 eval $inlibc
8448
8449 : see if gettimeofday or ftime exists
8450 set gettimeofday d_gettimeod
8451 eval $inlibc
8452 case "$d_gettimeod" in
8453 "$undef")
8454         set ftime d_ftime 
8455         eval $inlibc
8456         ;;
8457 *)
8458         val="$undef"; set d_ftime; eval $setvar
8459         ;;
8460 esac
8461 case "$d_gettimeod$d_ftime" in
8462 "$undef$undef")
8463         echo " "
8464         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8465         ;;
8466 esac
8467
8468 : see if this is an grp system
8469 set grp.h i_grp
8470 eval $inhdr
8471
8472 case "$i_grp" in
8473 $define)
8474         xxx=`./findhdr grp.h`
8475         $cppstdin $cppflags $cppminus < $xxx >$$.h
8476
8477         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8478                 val="$define"
8479         else
8480                 val="$undef"
8481         fi
8482         set d_grpasswd
8483         eval $setvar
8484
8485         $rm -f $$.h
8486         ;;
8487 *)
8488         val="$undef";
8489         set d_grpasswd; eval $setvar
8490         ;;
8491 esac
8492
8493 : see if hasmntopt exists
8494 set hasmntopt d_hasmntopt
8495 eval $inlibc
8496
8497 : see if this is a netinet/in.h or sys/in.h system
8498 set netinet/in.h i_niin sys/in.h i_sysin
8499 eval $inhdr
8500
8501 : see if arpa/inet.h has to be included
8502 set arpa/inet.h i_arpainet
8503 eval $inhdr
8504
8505 : see if htonl --and friends-- exists
8506 val=''
8507 set htonl val
8508 eval $inlibc
8509
8510 : Maybe they are macros.
8511 case "$val" in
8512 $undef)
8513         $cat >htonl.c <<EOM
8514 #include <stdio.h>
8515 #include <sys/types.h>
8516 #$i_niin I_NETINET_IN
8517 #$i_sysin I_SYS_IN
8518 #$i_arpainet I_ARPA_INET
8519 #ifdef I_NETINET_IN
8520 #include <netinet/in.h>
8521 #endif
8522 #ifdef I_SYS_IN
8523 #include <sys/in.h>
8524 #endif
8525 #ifdef I_ARPA_INET
8526 #include <arpa/inet.h>
8527 #endif
8528 #ifdef htonl
8529 printf("Defined as a macro.");
8530 #endif
8531 EOM
8532         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8533         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8534                 val="$define"
8535                 echo "But it seems to be defined as a macro." >&4
8536         fi
8537         $rm -f htonl.?
8538         ;;
8539 esac
8540 set d_htonl
8541 eval $setvar
8542
8543 : see which of string.h or strings.h is needed
8544 echo " "
8545 strings=`./findhdr string.h`
8546 if $test "$strings" && $test -r "$strings"; then
8547         echo "Using <string.h> instead of <strings.h>." >&4
8548         val="$define"
8549 else
8550         val="$undef"
8551         strings=`./findhdr strings.h`
8552         if $test "$strings" && $test -r "$strings"; then
8553                 echo "Using <strings.h> instead of <string.h>." >&4
8554         else
8555                 echo "No string header found -- You'll surely have problems." >&4
8556         fi
8557 fi
8558 set i_string
8559 eval $setvar
8560 case "$i_string" in
8561 "$undef") strings=`./findhdr strings.h`;;
8562 *)        strings=`./findhdr string.h`;;
8563 esac
8564
8565 : index or strchr
8566 echo " "
8567 if set index val -f; eval $csym; $val; then
8568         if set strchr val -f d_strchr; eval $csym; $val; then
8569                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8570                         val="$define"
8571                         vali="$undef"
8572                         echo "strchr() found." >&4
8573                 else
8574                         val="$undef"
8575                         vali="$define"
8576                         echo "index() found." >&4
8577                 fi
8578         else
8579                 val="$undef"
8580                 vali="$define"
8581                 echo "index() found." >&4
8582         fi
8583 else
8584         if set strchr val -f d_strchr; eval $csym; $val; then
8585                 val="$define"
8586                 vali="$undef"
8587                 echo "strchr() found." >&4
8588         else
8589                 echo "No index() or strchr() found!" >&4
8590                 val="$undef"
8591                 vali="$undef"
8592         fi
8593 fi
8594 set d_strchr; eval $setvar
8595 val="$vali"
8596 set d_index; eval $setvar
8597
8598 : check whether inet_aton exists
8599 set inet_aton d_inetaton
8600 eval $inlibc
8601
8602 : see if inttypes.h is available
8603 : we want a real compile instead of Inhdr because some systems
8604 : have an inttypes.h which includes non-existent headers
8605 echo " "
8606 $cat >try.c <<EOCP
8607 #include <inttypes.h>
8608 int main() {
8609         static int32_t foo32 = 0x12345678;
8610 }
8611 EOCP
8612 set try
8613 if eval $compile; then
8614         echo "<inttypes.h> found." >&4
8615         val="$define"
8616 else
8617         echo "<inttypes.h> NOT found." >&4
8618         val="$undef"
8619 fi
8620 $rm -f try.c try
8621 set i_inttypes
8622 eval $setvar
8623
8624 : check for int64_t
8625 case "$use64bits" in
8626 "$define" )
8627         echo " "
8628         echo $n "Checking to see if your system supports int64_t...$c" >&4
8629         $cat >try.c <<EOCP
8630 #include <sys/types.h>
8631 #$i_inttypes I_INTTYPES
8632 #ifdef I_INTTYPES
8633 #include <inttypes.h>
8634 #endif
8635 int64_t foo() { int64_t x; x = 7; return x; }
8636 EOCP
8637         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8638                 val="$define"
8639                 echo " Yup, it does." >&4
8640         else
8641                 val="$undef"
8642                 echo " Nope, it doesn't." >&4
8643         fi
8644         $rm -f try.*
8645         ;;
8646 *)      val="$undef"
8647         ;;
8648 esac
8649 set d_int64t
8650 eval $setvar
8651
8652
8653 : Look for isascii
8654 echo " "
8655 $cat >isascii.c <<'EOCP'
8656 #include <stdio.h>
8657 #include <ctype.h>
8658 int main() {
8659         int c = 'A';
8660         if (isascii(c))
8661                 exit(0);
8662         else
8663                 exit(1);
8664 }
8665 EOCP
8666 set isascii
8667 if eval $compile; then
8668         echo "isascii() found." >&4
8669         val="$define"
8670 else
8671         echo "isascii() NOT found." >&4
8672         val="$undef"
8673 fi
8674 set d_isascii
8675 eval $setvar
8676 $rm -f isascii*
8677
8678 : see if killpg exists
8679 set killpg d_killpg
8680 eval $inlibc
8681
8682 : see if lchown exists
8683 echo " "
8684 $cat > try.c <<'EOCP'
8685 /* System header to define __stub macros and hopefully few prototypes,
8686     which can conflict with char lchown(); below.  */
8687 #include <assert.h>
8688 /* Override any gcc2 internal prototype to avoid an error.  */
8689 /* We use char because int might match the return type of a gcc2
8690    builtin and then its argument prototype would still apply.  */
8691 char lchown();
8692 int main() {
8693     /*  The GNU C library defines this for functions which it implements
8694         to always fail with ENOSYS.  Some functions are actually named
8695         something starting with __ and the normal name is an alias.  */
8696 #if defined (__stub_lchown) || defined (__stub___lchown)
8697 choke me
8698 #else
8699 lchown();
8700 #endif
8701 ; return 0; }
8702 EOCP
8703 set try
8704 if eval $compile; then
8705     $echo "lchown() found." >&4
8706     val="$define"
8707 else
8708     $echo "lchown() NOT found." >&4
8709     val="$undef"
8710 fi
8711 set d_lchown
8712 eval $setvar
8713
8714 : see if link exists
8715 set link d_link
8716 eval $inlibc
8717
8718 : see if localeconv exists
8719 set localeconv d_locconv
8720 eval $inlibc
8721
8722 : see if lockf exists
8723 set lockf d_lockf
8724 eval $inlibc
8725
8726 : check for length of double
8727 echo " "
8728 case "$doublesize" in
8729 '')
8730         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8731         $cat >try.c <<'EOCP'
8732 #include <stdio.h>
8733 int main()
8734 {
8735         printf("%d\n", sizeof(double));
8736 }
8737 EOCP
8738         set try
8739         if eval $compile_ok; then
8740                 doublesize=`./try`
8741                 $echo " $doublesize bytes." >&4
8742         else
8743                 dflt='8'
8744                 echo "(I can't seem to compile the test program.  Guessing...)"
8745                 rp="What is the size of a double precision number (in bytes)?"
8746                 . ./myread
8747                 doublesize="$ans"
8748         fi
8749         ;;
8750 esac
8751 $rm -f try.c try
8752
8753 : check for long doubles
8754 echo " "
8755 echo $n "Checking to see if your system supports long doubles...$c" >&4
8756 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
8757 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8758         val="$define"
8759         echo " Yup, it does." >&4
8760 else
8761         val="$undef"
8762         echo " Nope, it doesn't." >&4
8763 fi
8764 $rm try.*
8765 set d_longdbl
8766 eval $setvar
8767
8768 : check for length of long double
8769 case "${d_longdbl}${longdblsize}" in
8770 $define)
8771         echo " "
8772         $echo $n "Checking to see how big your long doubles are...$c" >&4
8773         $cat >try.c <<'EOCP'
8774 #include <stdio.h>
8775 int main()
8776 {
8777         printf("%d\n", sizeof(long double));
8778 }
8779 EOCP
8780         set try
8781         if eval $compile; then
8782                 longdblsize=`./try`
8783                 $echo " $longdblsize bytes." >&4
8784         else
8785                 dflt='8'
8786                 echo " "
8787                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
8788                 rp="What is the size of a long double (in bytes)?"
8789                 . ./myread
8790                 longdblsize="$ans"
8791         fi
8792         if $test "X$doublesize" = "X$longdblsize"; then
8793                 echo "(That isn't any different from an ordinary double.)"
8794         fi      
8795         ;;
8796 esac
8797 $rm -f try.c try
8798
8799 : check for long long
8800 echo " "
8801 echo $n "Checking to see if your system supports long long...$c" >&4
8802 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8803 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8804         val="$define"
8805         echo " Yup, it does." >&4
8806 else
8807         val="$undef"
8808         echo " Nope, it doesn't." >&4
8809 fi
8810 $rm try.*
8811 set d_longlong
8812 eval $setvar
8813
8814 : check for length of long long
8815 case "${d_longlong}${longlongsize}" in
8816 $define)
8817         echo " "
8818         $echo $n "Checking to see how big your long longs are...$c" >&4
8819         $cat >try.c <<'EOCP'
8820 #include <stdio.h>
8821 int main()
8822 {
8823         printf("%d\n", sizeof(long long));
8824 }
8825 EOCP
8826         set try
8827         if eval $compile_ok; then
8828                 longlongsize=`./try`
8829                 $echo " $longlongsize bytes." >&4
8830         else
8831                 dflt='8'
8832                 echo " "
8833                 echo "(I can't seem to compile the test program.  Guessing...)"
8834                 rp="What is the size of a long long (in bytes)?"
8835                 . ./myread
8836                 longlongsize="$ans"
8837         fi
8838         if $test "X$longsize" = "X$longlongsize"; then
8839                 echo "(That isn't any different from an ordinary long.)"
8840         fi      
8841         ;;
8842 esac
8843 $rm -f try.c try
8844
8845 : see if lstat exists
8846 set lstat d_lstat
8847 eval $inlibc
8848
8849 : see if madvise exists
8850 set madvise d_madvise
8851 eval $inlibc
8852
8853 : see if mblen exists
8854 set mblen d_mblen
8855 eval $inlibc
8856
8857 : see if mbstowcs exists
8858 set mbstowcs d_mbstowcs
8859 eval $inlibc
8860
8861 : see if mbtowc exists
8862 set mbtowc d_mbtowc
8863 eval $inlibc
8864
8865 : see if memchr exists
8866 set memchr d_memchr
8867 eval $inlibc
8868
8869 : see if memcmp exists
8870 set memcmp d_memcmp
8871 eval $inlibc
8872
8873 : see if memcpy exists
8874 set memcpy d_memcpy
8875 eval $inlibc
8876
8877 : see if memmove exists
8878 set memmove d_memmove
8879 eval $inlibc
8880
8881 : see if memset exists
8882 set memset d_memset
8883 eval $inlibc
8884
8885 : see if mkdir exists
8886 set mkdir d_mkdir
8887 eval $inlibc
8888
8889 : see if mkfifo exists
8890 set mkfifo d_mkfifo
8891 eval $inlibc
8892
8893 : see if mktime exists
8894 set mktime d_mktime
8895 eval $inlibc
8896
8897 : see if this is a sys/mman.h system
8898 set sys/mman.h i_sysmman
8899 eval $inhdr
8900
8901 : see if mmap exists
8902 set mmap d_mmap
8903 eval $inlibc
8904 : see what shmat returns
8905 : default to something harmless
8906 mmaptype='void *'
8907 case "$i_sysmman$d_mmap" in
8908 "$define$define")
8909         $cat >mmap.c <<'END'
8910 #include <sys/mman.h>
8911 void *mmap();
8912 END
8913         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
8914                 mmaptype='void *'
8915         else
8916                 mmaptype='caddr_t'
8917         fi
8918         echo "and it returns ($mmaptype)." >&4
8919         ;;
8920 esac
8921
8922
8923
8924 : see if mprotect exists
8925 set mprotect d_mprotect
8926 eval $inlibc
8927
8928 : see if msgctl exists
8929 set msgctl d_msgctl
8930 eval $inlibc
8931
8932 : see if msgget exists
8933 set msgget d_msgget
8934 eval $inlibc
8935
8936 : see if msgsnd exists
8937 set msgsnd d_msgsnd
8938 eval $inlibc
8939
8940 : see if msgrcv exists
8941 set msgrcv d_msgrcv
8942 eval $inlibc
8943
8944 : see how much of the 'msg*(2)' library is present.
8945 h_msg=true
8946 echo " "
8947 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8948 *"$undef"*) h_msg=false;;
8949 esac
8950 case "$osname" in
8951 freebsd)
8952     case "`ipcs 2>&1`" in
8953     "SVID messages"*"not configured"*)
8954         echo "Your $osname does not have the msg*(2) configured." >&4
8955         h_msg=false
8956         val="$undef"
8957         set msgctl d_msgctl
8958         eval $setvar
8959         set msgget d_msgget
8960         eval $setvar
8961         set msgsnd d_msgsnd
8962         eval $setvar
8963         set msgrcv d_msgrcv
8964         eval $setvar
8965         ;;
8966     esac
8967     ;;
8968 esac
8969 : we could also check for sys/ipc.h ...
8970 if $h_msg && $test `./findhdr sys/msg.h`; then
8971         echo "You have the full msg*(2) library." >&4
8972         val="$define"
8973 else
8974         echo "You don't have the full msg*(2) library." >&4
8975         val="$undef"
8976 fi
8977 set d_msg
8978 eval $setvar
8979
8980 : see if msync exists
8981 set msync d_msync
8982 eval $inlibc
8983
8984 : see if munmap exists
8985 set munmap d_munmap
8986 eval $inlibc
8987
8988 : see if nice exists
8989 set nice d_nice
8990 eval $inlibc
8991
8992 : see if POSIX threads are available
8993 if test "X$usethreads" = "X$define"; then
8994         set pthread.h i_pthread
8995         eval $inhdr
8996 else
8997         i_pthread="$undef"
8998 fi
8999
9000
9001
9002 : how to create joinable pthreads
9003 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9004         echo " "
9005         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9006         $cat >try.c <<'EOCP'
9007 #include <pthread.h>
9008 int main() {
9009     int detachstate = JOINABLE;
9010 }
9011 EOCP
9012         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9013         if eval $compile; then
9014                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9015                 val="$undef" # Yes, undef.
9016                 set d_old_pthread_create_joinable
9017                 eval $setvar
9018                 val=""
9019                 set old_pthread_create_joinable
9020                 eval $setvar
9021         else
9022                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9023                 if eval $compile; then
9024                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9025                         val="$define"
9026                         set d_old_pthread_create_joinable
9027                         eval $setvar
9028                         val=PTHREAD_CREATE_UNDETACHED
9029                         set old_pthread_create_joinable
9030                         eval $setvar
9031                 else            
9032                         set try -DJOINABLE=__UNDETACHED
9033                         if eval $compile; then
9034                                 echo "You seem to use __UNDETACHED." >&4
9035                                 val="$define"
9036                                 set d_old_pthread_create_joinable
9037                                 eval $setvar
9038                                 val=__UNDETACHED
9039                                 set old_pthread_create_joinable
9040                                 eval $setvar
9041                         else
9042                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9043                                 val="$define"
9044                                 set d_old_pthread_create_joinable
9045                                 eval $setvar
9046                                 val=0
9047                                 set old_pthread_create_joinable
9048                                 eval $setvar
9049                         fi
9050                 fi
9051         fi
9052         $rm -f try try.*
9053 else
9054     d_old_pthread_create_joinable="$undef"
9055     old_pthread_create_joinable=""
9056 fi
9057
9058 : see if pause exists
9059 set pause d_pause
9060 eval $inlibc
9061
9062 : see if pipe exists
9063 set pipe d_pipe
9064 eval $inlibc
9065
9066 : see if poll exists
9067 set poll d_poll
9068 eval $inlibc
9069
9070
9071 : see whether the various POSIXish _yields exist
9072 $cat >try.c <<EOP
9073 #include <pthread.h>
9074 #include <stdio.h>
9075 int main() {
9076 #ifdef SCHED_YIELD
9077         sched_yield();
9078 #else
9079 #ifdef PTHREAD_YIELD
9080         pthread_yield();
9081 #else
9082 #ifdef PTHREAD_YIELD_NULL
9083         pthread_yield(NULL);
9084 #endif
9085 #endif
9086 #endif
9087 }
9088 EOP
9089 : see if sched_yield exists
9090 set try -DSCHED_YIELD
9091 if eval $compile; then
9092     val="$define"
9093     sched_yield='sched_yield()'
9094 else
9095     val="$undef"
9096 fi
9097 case "$usethreads" in
9098 $define)
9099         case "$val" in
9100         $define) echo 'sched_yield() found.' >&4        ;;
9101         *)       echo 'sched_yield() NOT found.' >&4    ;;
9102         esac
9103 esac
9104 set d_sched_yield
9105 eval $setvar
9106
9107 : see if pthread_yield exists
9108 set try -DPTHREAD_YIELD
9109 if eval $compile; then
9110     val="$define"
9111     case "$sched_yield" in
9112     '') sched_yield='pthread_yield()' ;;
9113     esac
9114 else
9115     set try -DPTHREAD_YIELD_NULL
9116     if eval $compile; then
9117         val="$define"
9118         case "$sched_yield" in
9119         '') sched_yield='pthread_yield(NULL)' ;;
9120         esac
9121     else
9122         val="$undef"
9123     fi
9124 fi
9125 case "$usethreads" in
9126 $define)
9127         case "$val" in
9128         $define) echo 'pthread_yield() found.' >&4      ;;
9129         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9130         esac
9131         ;;
9132 esac
9133 set d_pthread_yield
9134 eval $setvar
9135
9136 case "$sched_yield" in
9137 '') sched_yield=undef ;;
9138 esac
9139
9140 $rm -f try try.*
9141
9142 : see if this is a pwd.h system
9143 set pwd.h i_pwd
9144 eval $inhdr
9145
9146 case "$i_pwd" in
9147 $define)
9148         xxx=`./findhdr pwd.h`
9149         $cppstdin $cppflags $cppminus < $xxx >$$.h
9150
9151         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9152                 val="$define"
9153         else
9154                 val="$undef"
9155         fi
9156         set d_pwquota
9157         eval $setvar
9158
9159         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9160                 val="$define"
9161         else
9162                 val="$undef"
9163         fi
9164         set d_pwage
9165         eval $setvar
9166
9167         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9168                 val="$define"
9169         else
9170                 val="$undef"
9171         fi
9172         set d_pwchange
9173         eval $setvar
9174
9175         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9176                 val="$define"
9177         else
9178                 val="$undef"
9179         fi
9180         set d_pwclass
9181         eval $setvar
9182
9183         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9184                 val="$define"
9185         else
9186                 val="$undef"
9187         fi
9188         set d_pwexpire
9189         eval $setvar
9190
9191         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9192                 val="$define"
9193         else
9194                 val="$undef"
9195         fi
9196         set d_pwcomment
9197         eval $setvar
9198
9199         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9200                 val="$define"
9201         else
9202                 val="$undef"
9203         fi
9204         set d_pwgecos
9205         eval $setvar
9206
9207         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9208                 val="$define"
9209         else
9210                 val="$undef"
9211         fi
9212         set d_pwpasswd
9213         eval $setvar
9214
9215         $rm -f $$.h
9216         ;;
9217 *)
9218         val="$undef"; 
9219         set d_pwquota; eval $setvar
9220         set d_pwage; eval $setvar
9221         set d_pwchange; eval $setvar
9222         set d_pwclass; eval $setvar
9223         set d_pwexpire; eval $setvar
9224         set d_pwcomment; eval $setvar
9225         set d_pwgecos; eval $setvar
9226         set d_pwpasswd; eval $setvar
9227         ;;
9228 esac
9229
9230 : see if readdir and friends exist
9231 set readdir d_readdir
9232 eval $inlibc
9233 set seekdir d_seekdir
9234 eval $inlibc
9235 set telldir d_telldir
9236 eval $inlibc
9237 set rewinddir d_rewinddir
9238 eval $inlibc
9239
9240 : see if readlink exists
9241 set readlink d_readlink
9242 eval $inlibc
9243
9244 : see if readv exists
9245 set readv d_readv
9246 eval $inlibc
9247
9248 : see if rename exists
9249 set rename d_rename
9250 eval $inlibc
9251
9252 : see if rmdir exists
9253 set rmdir d_rmdir
9254 eval $inlibc
9255
9256 : see if memory.h is available.
9257 val=''
9258 set memory.h val
9259 eval $inhdr
9260
9261 : See if it conflicts with string.h
9262 case "$val" in
9263 $define)
9264         case "$strings" in
9265         '') ;;
9266         *)
9267                 $cppstdin $cppflags $cppminus < $strings > mem.h
9268                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9269                         echo " "
9270                         echo "We won't be including <memory.h>."
9271                         val="$undef"
9272                 fi
9273                 $rm -f mem.h
9274                 ;;
9275         esac
9276 esac
9277 set i_memory
9278 eval $setvar
9279
9280 : can bcopy handle overlapping blocks?
9281 val="$undef"
9282 case "$d_bcopy" in
9283 "$define")
9284         echo " "
9285         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9286         $cat >try.c <<EOCP
9287 #$i_memory I_MEMORY
9288 #$i_stdlib I_STDLIB
9289 #$i_string I_STRING
9290 #$i_unistd I_UNISTD
9291 EOCP
9292         $cat >>try.c <<'EOCP'
9293 #include <stdio.h>
9294 #ifdef I_MEMORY
9295 #  include <memory.h>
9296 #endif
9297 #ifdef I_STDLIB
9298 #  include <stdlib.h>
9299 #endif
9300 #ifdef I_STRING
9301 #  include <string.h>
9302 #else
9303 #  include <strings.h>
9304 #endif
9305 #ifdef I_UNISTD
9306 #  include <unistd.h>  /* Needed for NetBSD */
9307 #endif
9308 int main()
9309 {
9310 char buf[128], abc[128];
9311 char *b;
9312 int len;
9313 int off;
9314 int align;
9315
9316 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9317
9318 for (align = 7; align >= 0; align--) {
9319         for (len = 36; len; len--) {
9320                 b = buf+align;
9321                 bcopy(abc, b, len);
9322                 for (off = 1; off <= len; off++) {
9323                         bcopy(b, b+off, len);
9324                         bcopy(b+off, b, len);
9325                         if (bcmp(b, abc, len))
9326                                 exit(1);
9327                 }
9328         }
9329 }
9330 exit(0);
9331 }
9332 EOCP
9333         set try
9334         if eval $compile_ok; then
9335                 if ./try 2>/dev/null; then
9336                         echo "Yes, it can."
9337                         val="$define"
9338                 else
9339                         echo "It can't, sorry."
9340                         case "$d_memmove" in
9341                         "$define") echo "But that's Ok since you have memmove()." ;;
9342                         esac
9343                 fi
9344         else
9345                 echo "(I can't compile the test program, so we'll assume not...)"
9346                 case "$d_memmove" in
9347                 "$define") echo "But that's Ok since you have memmove()." ;;
9348                 esac
9349         fi
9350         ;;
9351 esac
9352 $rm -f try.* try core
9353 set d_safebcpy
9354 eval $setvar
9355
9356 : can memcpy handle overlapping blocks?
9357 val="$undef"
9358 case "$d_memcpy" in
9359 "$define")
9360         echo " "
9361         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9362         $cat >try.c <<EOCP
9363 #$i_memory I_MEMORY
9364 #$i_stdlib I_STDLIB
9365 #$i_string I_STRING
9366 #$i_unistd I_UNISTD
9367 EOCP
9368         $cat >>try.c <<'EOCP'
9369 #include <stdio.h>
9370 #ifdef I_MEMORY
9371 #  include <memory.h>
9372 #endif
9373 #ifdef I_STDLIB
9374 #  include <stdlib.h>
9375 #endif
9376 #ifdef I_STRING
9377 #  include <string.h>
9378 #else
9379 #  include <strings.h>
9380 #endif
9381 #ifdef I_UNISTD
9382 #  include <unistd.h>  /* Needed for NetBSD */
9383 #endif
9384 int main()
9385 {
9386 char buf[128], abc[128];
9387 char *b;
9388 int len;
9389 int off;
9390 int align;
9391
9392 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9393    try to store the string in read-only memory. */
9394 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9395
9396 for (align = 7; align >= 0; align--) {
9397         for (len = 36; len; len--) {
9398                 b = buf+align;
9399                 memcpy(b, abc, len);
9400                 for (off = 1; off <= len; off++) {
9401                         memcpy(b+off, b, len);
9402                         memcpy(b, b+off, len);
9403                         if (memcmp(b, abc, len))
9404                                 exit(1);
9405                 }
9406         }
9407 }
9408 exit(0);
9409 }
9410 EOCP
9411         set try
9412         if eval $compile_ok; then
9413                 if ./try 2>/dev/null; then
9414                         echo "Yes, it can."
9415                         val="$define"
9416                 else
9417                         echo "It can't, sorry."
9418                         case "$d_memmove" in
9419                         "$define") echo "But that's Ok since you have memmove()." ;;
9420                         esac
9421                 fi
9422         else
9423                 echo "(I can't compile the test program, so we'll assume not...)"
9424                 case "$d_memmove" in
9425                 "$define") echo "But that's Ok since you have memmove()." ;;
9426                 esac
9427         fi
9428         ;;
9429 esac
9430 $rm -f try.* try core
9431 set d_safemcpy
9432 eval $setvar
9433
9434 : can memcmp be trusted to compare relative magnitude?
9435 val="$undef"
9436 case "$d_memcmp" in
9437 "$define")
9438         echo " "
9439         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9440         $cat >try.c <<EOCP
9441 #$i_memory I_MEMORY
9442 #$i_stdlib I_STDLIB
9443 #$i_string I_STRING
9444 #$i_unistd I_UNISTD
9445 EOCP
9446         $cat >>try.c <<'EOCP'
9447 #include <stdio.h>
9448 #ifdef I_MEMORY
9449 #  include <memory.h>
9450 #endif
9451 #ifdef I_STDLIB
9452 #  include <stdlib.h>
9453 #endif
9454 #ifdef I_STRING
9455 #  include <string.h>
9456 #else
9457 #  include <strings.h>
9458 #endif
9459 #ifdef I_UNISTD
9460 #  include <unistd.h>  /* Needed for NetBSD */
9461 #endif
9462 int main()
9463 {
9464 char a = -1;
9465 char b = 0;
9466 if ((a < b) && memcmp(&a, &b, 1) < 0)
9467         exit(1);
9468 exit(0);
9469 }
9470 EOCP
9471         set try
9472         if eval $compile_ok; then
9473                 if ./try 2>/dev/null; then
9474                         echo "Yes, it can."
9475                         val="$define"
9476                 else
9477                         echo "No, it can't (it uses signed chars)."
9478                 fi
9479         else
9480                 echo "(I can't compile the test program, so we'll assume not...)"
9481         fi
9482         ;;
9483 esac
9484 $rm -f try.* try core
9485 set d_sanemcmp
9486 eval $setvar
9487
9488 : see if select exists
9489 set select d_select
9490 eval $inlibc
9491
9492 : see if semctl exists
9493 set semctl d_semctl
9494 eval $inlibc
9495
9496 : see if semget exists
9497 set semget d_semget
9498 eval $inlibc
9499
9500 : see if semop exists
9501 set semop d_semop
9502 eval $inlibc
9503
9504 : see how much of the 'sem*(2)' library is present.
9505 h_sem=true
9506 echo " "
9507 case "$d_semctl$d_semget$d_semop" in
9508 *"$undef"*) h_sem=false;;
9509 esac
9510 case "$osname" in
9511 freebsd)
9512     case "`ipcs 2>&1`" in
9513     "SVID messages"*"not configured"*)
9514         echo "Your $osname does not have the sem*(2) configured." >&4
9515         h_sem=false
9516         val="$undef"
9517         set semctl d_semctl
9518         eval $setvar
9519         set semget d_semget
9520         eval $setvar
9521         set semop d_semop
9522         eval $setvar
9523         ;;
9524     esac
9525     ;;
9526 esac
9527 : we could also check for sys/ipc.h ...
9528 if $h_sem && $test `./findhdr sys/sem.h`; then
9529         echo "You have the full sem*(2) library." >&4
9530         val="$define"
9531 else
9532         echo "You don't have the full sem*(2) library." >&4
9533         val="$undef"
9534 fi
9535 set d_sem
9536 eval $setvar
9537
9538 : see whether sys/sem.h defines union semun
9539 echo " "
9540 $cat > try.c <<'END'
9541 #include <sys/types.h>
9542 #include <sys/ipc.h>
9543 #include <sys/sem.h>
9544 int main () { union semun semun; semun.buf = 0; }
9545 END
9546 set try
9547 if eval $compile; then
9548     echo "You have union semun in <sys/sem.h>." >&4
9549     val="$define"
9550 else
9551     echo "You do not have union semun in <sys/sem.h>." >&4
9552     val="$undef"
9553 fi
9554 $rm -f try try.c try.h
9555 set d_union_semun
9556 eval $setvar
9557
9558 : see how to do semctl IPC_STAT
9559 case "$d_sem" in
9560 $define)
9561     : see whether semctl IPC_STAT can use union semun
9562     echo " "
9563     $cat > try.h <<END
9564 #ifndef S_IRUSR
9565 #   ifdef S_IREAD
9566 #       define S_IRUSR S_IREAD
9567 #       define S_IWUSR S_IWRITE
9568 #       define S_IXUSR S_IEXEC
9569 #   else
9570 #       define S_IRUSR 0400
9571 #       define S_IWUSR 0200
9572 #       define S_IXUSR 0100
9573 #   endif
9574 #   define S_IRGRP (S_IRUSR>>3)
9575 #   define S_IWGRP (S_IWUSR>>3)
9576 #   define S_IXGRP (S_IXUSR>>3)
9577 #   define S_IROTH (S_IRUSR>>6)
9578 #   define S_IWOTH (S_IWUSR>>6)
9579 #   define S_IXOTH (S_IXUSR>>6)
9580 #endif
9581 #ifndef S_IRWXU
9582 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9583 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9584 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9585 #endif
9586 END
9587
9588     $cat > try.c <<END
9589 #include <sys/types.h>
9590 #include <sys/ipc.h>
9591 #include <sys/sem.h>
9592 #include <sys/stat.h>
9593 #include <stdio.h>
9594 #include <errno.h>
9595 #include "try.h"
9596 #ifndef errno
9597 extern int errno;
9598 #endif
9599 #$d_union_semun HAS_UNION_SEMUN
9600 int main() {
9601     union semun
9602 #ifndef HAS_UNION_SEMUN
9603     {
9604         int val;
9605         struct semid_ds *buf;
9606         unsigned short *array;
9607     }
9608 #endif
9609     arg;
9610     int sem, st;
9611
9612 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9613     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9614     if (sem > -1) {
9615         struct semid_ds argbuf;
9616         arg.buf = &argbuf;
9617 #       ifdef IPC_STAT
9618         st = semctl(sem, 0, IPC_STAT, arg);
9619         if (st == 0)
9620             printf("semun\n");
9621         else
9622 #       endif /* IPC_STAT */
9623             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9624 #       ifdef IPC_RMID
9625         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9626 #       endif /* IPC_RMID */
9627             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9628     } else
9629 #endif /* IPC_PRIVATE && ... */
9630         printf("semget failed: errno = %d\n", errno);
9631   return 0;
9632 }
9633 END
9634     val="$undef"
9635     set try
9636     if eval $compile; then
9637         xxx=`./try`
9638         case "$xxx" in
9639         semun) val="$define" ;;
9640         esac
9641     fi
9642     $rm -f try try.c
9643     set d_semctl_semun
9644     eval $setvar
9645     case "$d_semctl_semun" in
9646     $define)
9647         echo "You can use union semun for semctl IPC_STAT." >&4
9648         also='also'
9649         ;;
9650     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9651         also=''
9652         ;;
9653     esac
9654
9655     : see whether semctl IPC_STAT can use struct semid_ds pointer
9656     $cat > try.c <<'END'
9657 #include <sys/types.h>
9658 #include <sys/ipc.h>
9659 #include <sys/sem.h>
9660 #include <sys/stat.h>
9661 #include "try.h"
9662 #include <stdio.h>
9663 #include <errno.h>
9664 #ifndef errno
9665 extern int errno;
9666 #endif
9667 int main() {
9668     struct semid_ds arg;
9669     int sem, st;
9670
9671 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9672     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9673     if (sem > -1) {
9674 #       ifdef IPC_STAT
9675         st = semctl(sem, 0, IPC_STAT, &arg);
9676         if (st == 0)
9677             printf("semid_ds\n");
9678         else
9679 #       endif /* IPC_STAT */
9680             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9681 #       ifdef IPC_RMID
9682         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9683 #       endif /* IPC_RMID */
9684             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9685     } else
9686 #endif /* IPC_PRIVATE && ... */
9687         printf("semget failed: errno = %d\n", errno);
9688
9689     return 0;
9690 }
9691 END
9692     val="$undef"
9693     set try
9694     if eval $compile; then
9695         xxx=`./try`
9696         case "$xxx" in
9697         semid_ds) val="$define" ;;
9698         esac
9699     fi
9700     $rm -f try try.c
9701     set d_semctl_semid_ds
9702     eval $setvar
9703     case "$d_semctl_semid_ds" in
9704     $define)
9705         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9706         ;;
9707     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9708         ;;
9709     esac
9710     $rm -f try.h
9711     ;;
9712 *)  val="$undef"
9713
9714     # We do not have the full sem*(2) library, so assume we can not
9715     # use either.
9716
9717     set d_semctl_semun
9718     eval $setvar
9719
9720     set d_semctl_semid_ds
9721     eval $setvar
9722     ;;
9723 esac
9724
9725 : see if setegid exists
9726 set setegid d_setegid
9727 eval $inlibc
9728
9729 : see if seteuid exists
9730 set seteuid d_seteuid
9731 eval $inlibc
9732
9733 : see if setgrent exists
9734 set setgrent d_setgrent
9735 eval $inlibc
9736
9737 : see if sethostent exists
9738 set sethostent d_sethent
9739 eval $inlibc
9740
9741 : see if setlinebuf exists
9742 set setlinebuf d_setlinebuf
9743 eval $inlibc
9744
9745 : see if setlocale exists
9746 set setlocale d_setlocale
9747 eval $inlibc
9748
9749 : see if setnetent exists
9750 set setnetent d_setnent
9751 eval $inlibc
9752
9753 : see if setprotoent exists
9754 set setprotoent d_setpent
9755 eval $inlibc
9756
9757 : see if setpgid exists
9758 set setpgid d_setpgid
9759 eval $inlibc
9760
9761 : see if setpgrp2 exists
9762 set setpgrp2 d_setpgrp2
9763 eval $inlibc
9764
9765 : see if setpriority exists
9766 set setpriority d_setprior
9767 eval $inlibc
9768
9769 : see if setpwent exists
9770 set setpwent d_setpwent
9771 eval $inlibc
9772
9773 : see if setregid exists
9774 set setregid d_setregid
9775 eval $inlibc
9776 set setresgid d_setresgid
9777 eval $inlibc
9778
9779 : see if setreuid exists
9780 set setreuid d_setreuid
9781 eval $inlibc
9782 set setresuid d_setresuid
9783 eval $inlibc
9784
9785 : see if setrgid exists
9786 set setrgid d_setrgid
9787 eval $inlibc
9788
9789 : see if setruid exists
9790 set setruid d_setruid
9791 eval $inlibc
9792
9793 : see if setservent exists
9794 set setservent d_setsent
9795 eval $inlibc
9796
9797 : see if setsid exists
9798 set setsid d_setsid
9799 eval $inlibc
9800
9801 : see if setspent exists
9802 set setspent d_setspent
9803 eval $inlibc
9804
9805 : see if setvbuf exists
9806 set setvbuf d_setvbuf
9807 eval $inlibc
9808
9809 : see if sfio.h is available
9810 set sfio.h i_sfio
9811 eval $inhdr
9812
9813
9814 : see if sfio library is available
9815 case "$i_sfio" in
9816 $define)
9817         val=''
9818         set sfreserve val
9819         eval $inlibc
9820         ;;
9821 *)
9822         val="$undef"
9823         ;;
9824 esac
9825 : Ok, but do we want to use it.
9826 case "$val" in
9827 $define)
9828         case "$usesfio" in
9829         true|$define|[yY]*) dflt='y';;
9830         *) dflt='n';;
9831         esac
9832         echo "$package can use the sfio library, but it is experimental."
9833         rp="You seem to have sfio available, do you want to try using it?"
9834         . ./myread
9835         case "$ans" in
9836         y|Y) ;;
9837         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
9838                 val="$undef"
9839                 : Remove sfio from list of libraries to use
9840                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9841                 shift
9842                 libs="$*"
9843                 echo "libs = $libs" >&4
9844                 ;;
9845         esac
9846         ;;
9847 *)      case "$usesfio" in
9848         true|$define|[yY]*)
9849                 echo "Sorry, cannot find sfio on this machine" >&4
9850                 echo "Ignoring your setting of usesfio=$usesfio" >&4
9851                 ;;
9852         esac
9853         ;;
9854 esac
9855 set d_sfio
9856 eval $setvar
9857 case "$d_sfio" in
9858 $define) usesfio='true';;
9859 *) usesfio='false';;
9860 esac
9861
9862 : see if shmctl exists
9863 set shmctl d_shmctl
9864 eval $inlibc
9865
9866 : see if shmget exists
9867 set shmget d_shmget
9868 eval $inlibc
9869
9870 : see if shmat exists
9871 set shmat d_shmat
9872 eval $inlibc
9873 : see what shmat returns
9874 case "$d_shmat" in
9875 "$define")
9876         $cat >shmat.c <<'END'
9877 #include <sys/shm.h>
9878 void *shmat();
9879 END
9880         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9881                 shmattype='void *'
9882         else
9883                 shmattype='char *'
9884         fi
9885         echo "and it returns ($shmattype)." >&4
9886         : see if a prototype for shmat is available
9887         xxx=`./findhdr sys/shm.h`
9888         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
9889         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9890                 val="$define"
9891         else
9892                 val="$undef"
9893         fi
9894         $rm -f shmat.[co]
9895         ;;
9896 *)
9897         val="$undef"
9898         ;;
9899 esac
9900 set d_shmatprototype
9901 eval $setvar
9902
9903 : see if shmdt exists
9904 set shmdt d_shmdt
9905 eval $inlibc
9906
9907 : see how much of the 'shm*(2)' library is present.
9908 h_shm=true
9909 echo " "
9910 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9911 *"$undef"*) h_shm=false;;
9912 esac
9913 case "$osname" in
9914 freebsd)
9915     case "`ipcs 2>&1`" in
9916     "SVID shared memory"*"not configured"*)
9917         echo "Your $osname does not have the shm*(2) configured." >&4
9918         h_shm=false
9919         val="$undef"
9920         set shmctl d_shmctl
9921         evat $setvar
9922         set shmget d_shmget
9923         evat $setvar
9924         set shmat d_shmat
9925         evat $setvar
9926         set shmdt d_shmdt
9927         evat $setvar
9928         ;;
9929     esac
9930     ;;
9931 esac
9932 : we could also check for sys/ipc.h ...
9933 if $h_shm && $test `./findhdr sys/shm.h`; then
9934         echo "You have the full shm*(2) library." >&4
9935         val="$define"
9936 else
9937         echo "You don't have the full shm*(2) library." >&4
9938         val="$undef"
9939 fi
9940 set d_shm
9941 eval $setvar
9942
9943 echo " "
9944 : see if we have sigaction
9945 if set sigaction val -f d_sigaction; eval $csym; $val; then
9946         echo 'sigaction() found.' >&4
9947         $cat > try.c <<'EOP'
9948 #include <stdio.h>
9949 #include <sys/types.h>
9950 #include <signal.h>
9951 int main()
9952 {
9953     struct sigaction act, oact;
9954 }
9955 EOP
9956         set try
9957         if eval $compile_ok; then
9958                 val="$define"
9959         else
9960                 echo "But you don't seem to have a useable struct sigaction." >&4
9961                 val="$undef"
9962         fi
9963 else
9964         echo 'sigaction NOT found.' >&4
9965         val="$undef"
9966 fi
9967 set d_sigaction; eval $setvar
9968 $rm -f try try$_o try.c
9969
9970 : see if sigsetjmp exists
9971 echo " "
9972 case "$d_sigsetjmp" in
9973 '')
9974         $cat >try.c <<'EOP'
9975 #include <setjmp.h>
9976 sigjmp_buf env;
9977 int set = 1;
9978 int main()
9979 {
9980         if (sigsetjmp(env,1))
9981                 exit(set);
9982         set = 0;
9983         siglongjmp(env, 1);
9984         exit(1);
9985 }
9986 EOP
9987         set try
9988         if eval $compile; then
9989                 if ./try >/dev/null 2>&1; then
9990                         echo "POSIX sigsetjmp found." >&4
9991                         val="$define"
9992                 else
9993                         $cat >&4 <<EOM
9994 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9995 I'll ignore them.
9996 EOM
9997                         val="$undef"
9998                 fi
9999         else
10000                 echo "sigsetjmp not found." >&4
10001                 val="$undef"
10002         fi
10003         ;;
10004 *) val="$d_sigsetjmp"
10005         case "$d_sigsetjmp" in
10006         $define) echo "POSIX sigsetjmp found." >&4;;
10007         $undef) echo "sigsetjmp not found." >&4;;
10008         esac
10009         ;;
10010 esac
10011 set d_sigsetjmp
10012 eval $setvar
10013 $rm -f try.c try
10014
10015 : see if stat knows about block sizes
10016 echo " "
10017 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10018 eval $hasfield
10019
10020 : see if _ptr and _cnt from stdio act std
10021 echo " "
10022 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10023         echo "(Looks like you have stdio.h from Linux.)"
10024         case "$stdio_ptr" in
10025         '') stdio_ptr='((fp)->_IO_read_ptr)'
10026                 ptr_lval=$define
10027                 ;;
10028         *)      ptr_lval=$d_stdio_ptr_lval;;
10029         esac
10030         case "$stdio_cnt" in
10031         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10032                 cnt_lval=$undef
10033                 ;;
10034         *)      cnt_lval=$d_stdio_cnt_lval;;
10035         esac
10036         case "$stdio_base" in
10037         '') stdio_base='((fp)->_IO_read_base)';;
10038         esac
10039         case "$stdio_bufsiz" in
10040         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10041         esac
10042 else
10043         case "$stdio_ptr" in
10044         '') stdio_ptr='((fp)->_ptr)'
10045                 ptr_lval=$define
10046                 ;;
10047         *)      ptr_lval=$d_stdio_ptr_lval;;
10048         esac
10049         case "$stdio_cnt" in
10050         '') stdio_cnt='((fp)->_cnt)'
10051                 cnt_lval=$define
10052                 ;;
10053         *)      cnt_lval=$d_stdio_cnt_lval;;
10054         esac
10055         case "$stdio_base" in
10056         '') stdio_base='((fp)->_base)';;
10057         esac
10058         case "$stdio_bufsiz" in
10059         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10060         esac
10061 fi
10062 : test whether _ptr and _cnt really work
10063 echo "Checking how std your stdio is..." >&4
10064 $cat >try.c <<EOP
10065 #include <stdio.h>
10066 #define FILE_ptr(fp)    $stdio_ptr
10067 #define FILE_cnt(fp)    $stdio_cnt
10068 int main() {
10069         FILE *fp = fopen("try.c", "r");
10070         char c = getc(fp);
10071         if (
10072                 18 <= FILE_cnt(fp) &&
10073                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10074         )
10075                 exit(0);
10076         exit(1);
10077 }
10078 EOP
10079 val="$undef"
10080 set try
10081 if eval $compile; then
10082         if ./try; then
10083                 echo "Your stdio acts pretty std."
10084                 val="$define"
10085         else
10086                 echo "Your stdio isn't very std."
10087         fi
10088 else
10089         echo "Your stdio doesn't appear very std."
10090 fi
10091 $rm -f try.c try
10092 set d_stdstdio
10093 eval $setvar
10094
10095 : Can _ptr be used as an lvalue?
10096 case "$d_stdstdio$ptr_lval" in
10097 $define$define) val=$define ;;
10098 *) val=$undef ;;
10099 esac
10100 set d_stdio_ptr_lval
10101 eval $setvar
10102
10103 : Can _cnt be used as an lvalue?
10104 case "$d_stdstdio$cnt_lval" in
10105 $define$define) val=$define ;;
10106 *) val=$undef ;;
10107 esac
10108 set d_stdio_cnt_lval
10109 eval $setvar
10110
10111 : see if _base is also standard
10112 val="$undef"
10113 case "$d_stdstdio" in
10114 $define)
10115         $cat >try.c <<EOP
10116 #include <stdio.h>
10117 #define FILE_base(fp)   $stdio_base
10118 #define FILE_bufsiz(fp) $stdio_bufsiz
10119 int main() {
10120         FILE *fp = fopen("try.c", "r");
10121         char c = getc(fp);
10122         if (
10123                 19 <= FILE_bufsiz(fp) &&
10124                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10125         )
10126                 exit(0);
10127         exit(1);
10128 }
10129 EOP
10130         set try
10131         if eval $compile; then
10132                 if ./try; then
10133                         echo "And its _base field acts std."
10134                         val="$define"
10135                 else
10136                         echo "But its _base field isn't std."
10137                 fi
10138         else
10139                 echo "However, it seems to be lacking the _base field."
10140         fi
10141         $rm -f try.c try
10142         ;;
10143 esac
10144 set d_stdiobase
10145 eval $setvar
10146
10147 $cat >&4 <<EOM
10148 Checking how to access stdio streams by file descriptor number...
10149 EOM
10150 case "$stdio_stream_array" in
10151 '')     $cat >try.c <<EOCP
10152 #include <stdio.h>
10153 int main() {
10154   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10155     printf("yes\n");
10156 }
10157 EOCP
10158         for s in _iob __iob __sF
10159         do
10160                 set try -DSTDIO_STREAM_ARRAY=$s
10161                 if eval $compile; then
10162                         case "`./try$exe_ext`" in
10163                         yes)    stdio_stream_array=$s; break ;;
10164                         esac
10165                 fi
10166         done
10167         $rm -f try.* try$exe_ext
10168 esac
10169 case "$stdio_stream_array" in
10170 '')     $cat >&4 <<EOM
10171 I can't figure out how to access stdio streams by file descriptor number.
10172 EOM
10173         d_stdio_stream_array="$undef"
10174         ;;
10175 *)      $cat >&4 <<EOM
10176 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10177 EOM
10178         d_stdio_stream_array="$define"
10179         ;;
10180 esac
10181
10182 : see if strcoll exists
10183 set strcoll d_strcoll
10184 eval $inlibc
10185
10186 : check for structure copying
10187 echo " "
10188 echo "Checking to see if your C compiler can copy structs..." >&4
10189 $cat >try.c <<'EOCP'
10190 int main()
10191 {
10192         struct blurfl {
10193                 int dyick;
10194         } foo, bar;
10195
10196         foo = bar;
10197 }
10198 EOCP
10199 if $cc -c try.c >/dev/null 2>&1 ; then
10200         val="$define"
10201         echo "Yup, it can."
10202 else
10203         val="$undef"
10204         echo "Nope, it can't."
10205 fi
10206 set d_strctcpy
10207 eval $setvar
10208 $rm -f try.*
10209
10210 : see if strerror and/or sys_errlist[] exist
10211 echo " "
10212 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10213     if set strerror val -f d_strerror; eval $csym; $val; then
10214                 echo 'strerror() found.' >&4
10215                 d_strerror="$define"
10216                 d_strerrm='strerror(e)'
10217                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10218                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10219                         d_syserrlst="$define"
10220                 else
10221                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10222                         d_syserrlst="$undef"
10223                 fi
10224     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10225                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10226                 echo 'strerror() found in string header.' >&4
10227                 d_strerror="$define"
10228                 d_strerrm='strerror(e)'
10229                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10230                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10231                                 d_syserrlst="$define"
10232                 else
10233                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10234                         d_syserrlst="$undef"
10235                 fi
10236     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10237                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10238                 d_strerror="$undef"
10239                 d_syserrlst="$define"
10240                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10241     else
10242                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10243                 d_strerror="$undef"
10244                 d_syserrlst="$undef"
10245                 d_strerrm='"unknown"'
10246     fi
10247 fi
10248
10249 : see if strtod exists
10250 set strtod d_strtod
10251 eval $inlibc
10252
10253 : see if strtol exists
10254 set strtol d_strtol
10255 eval $inlibc
10256
10257 : see if strtoul exists
10258 set strtoul d_strtoul
10259 eval $inlibc
10260
10261 : see if strxfrm exists
10262 set strxfrm d_strxfrm
10263 eval $inlibc
10264
10265 : see if symlink exists
10266 set symlink d_symlink
10267 eval $inlibc
10268
10269 : see if syscall exists
10270 set syscall d_syscall
10271 eval $inlibc
10272
10273 : see if sysconf exists
10274 set sysconf d_sysconf
10275 eval $inlibc
10276
10277 : see if system exists
10278 set system d_system
10279 eval $inlibc
10280
10281 : see if tcgetpgrp exists
10282 set tcgetpgrp d_tcgetpgrp
10283 eval $inlibc
10284
10285 : see if tcsetpgrp exists
10286 set tcsetpgrp d_tcsetpgrp
10287 eval $inlibc
10288
10289 : see if sys/types.h has to be included
10290 set sys/types.h i_systypes
10291 eval $inhdr
10292
10293 : see if prototype for telldir is available
10294 echo " "
10295 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10296 eval $hasproto
10297
10298 : define an is-a-typedef? function
10299 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10300 case "$inclist" in
10301 "") inclist="sys/types.h";;
10302 esac;
10303 eval "varval=\$$var";
10304 case "$varval" in
10305 "")
10306         $rm -f temp.c;
10307         for inc in $inclist; do
10308                 echo "#include <$inc>" >>temp.c;
10309         done;
10310         echo "#ifdef $type" >> temp.c;
10311         echo "printf(\"We have $type\");" >> temp.c;
10312         echo "#endif" >> temp.c;
10313         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10314         if $contains $type temp.E >/dev/null 2>&1; then
10315                 eval "$var=\$type";
10316         else
10317                 eval "$var=\$def";
10318         fi;
10319         $rm -f temp.?;;
10320 *) eval "$var=\$varval";;
10321 esac'
10322
10323 : define an is-a-typedef? function that prompts if the type is not available.
10324 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10325 case "$inclist" in
10326 "") inclist="sys/types.h";;
10327 esac;
10328 eval "varval=\$$var";
10329 case "$varval" in
10330 "")
10331         $rm -f temp.c;
10332         for inc in $inclist; do
10333                 echo "#include <$inc>" >>temp.c;
10334         done;
10335         echo "#ifdef $type" >> temp.c;
10336         echo "printf(\"We have $type\");" >> temp.c;
10337         echo "#endif" >> temp.c;
10338         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10339         echo " " ;
10340         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10341         if $contains $type temp.E >/dev/null 2>&1; then
10342                 echo "$type found." >&4;
10343                 eval "$var=\$type";
10344         else
10345                 echo "$type NOT found." >&4;
10346                 dflt="$def";
10347                 . ./myread ;
10348                 eval "$var=\$ans";
10349         fi;
10350         $rm -f temp.?;;
10351 *) eval "$var=\$varval";;
10352 esac'
10353
10354 : see if this is a sys/times.h system
10355 set sys/times.h i_systimes
10356 eval $inhdr
10357
10358 : see if times exists
10359 echo " "
10360 if set times val -f d_times; eval $csym; $val; then
10361         echo 'times() found.' >&4
10362         d_times="$define"
10363         inc=''
10364         case "$i_systimes" in
10365         "$define") inc='sys/times.h';;
10366         esac
10367         rp="What is the type returned by times() on this system?"
10368         set clock_t clocktype long stdio.h sys/types.h $inc
10369         eval $typedef_ask
10370 else
10371         echo 'times() NOT found, hope that will do.' >&4
10372         d_times="$undef"
10373         clocktype='int'
10374 fi
10375
10376 : see if truncate exists
10377 set truncate d_truncate
10378 eval $inlibc
10379
10380 : see if tzname[] exists
10381 echo " "
10382 if set tzname val -a d_tzname; eval $csym; $val; then
10383         val="$define"
10384         echo 'tzname[] found.' >&4
10385 else
10386         val="$undef"
10387         echo 'tzname[] NOT found.' >&4
10388 fi
10389 set d_tzname
10390 eval $setvar
10391
10392 : see if umask exists
10393 set umask d_umask
10394 eval $inlibc
10395
10396 : backward compatibility for d_hvfork
10397 if test X$d_hvfork != X; then
10398         d_vfork="$d_hvfork"
10399         d_hvfork=''
10400 fi
10401 : see if there is a vfork
10402 val=''
10403 set vfork val
10404 eval $inlibc
10405
10406 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10407 : perl on Solaris 2.x, and probably elsewhere.
10408 case "$val" in
10409 $define)
10410         echo " "
10411         case "$usevfork" in
10412         false) dflt='n';;
10413         *) dflt='y';;
10414         esac
10415         cat <<'EOM'
10416  
10417 Perl can only use a vfork() that doesn't suffer from strict
10418 restrictions on calling functions or modifying global data in
10419 the child.  For example, glibc-2.1 contains such a vfork()
10420 that is unsuitable.  If your system provides a proper fork()
10421 call, chances are that you do NOT want perl to use vfork().
10422
10423 EOM
10424         rp="Do you still want to use vfork()?"
10425         . ./myread
10426         case "$ans" in
10427         y|Y) ;;
10428         *)
10429                 echo "Ok, we won't use vfork()."
10430                 val="$undef"
10431                 ;;
10432         esac
10433         ;;
10434 esac
10435 set d_vfork
10436 eval $setvar
10437 case "$d_vfork" in
10438 $define) usevfork='true';;
10439 *) usevfork='false';;
10440 esac
10441
10442 : see if this is an sysdir system
10443 set sys/dir.h i_sysdir
10444 eval $inhdr
10445
10446 : see if this is an sysndir system
10447 set sys/ndir.h i_sysndir
10448 eval $inhdr
10449
10450 : see if closedir exists
10451 set closedir d_closedir
10452 eval $inlibc
10453
10454 case "$d_closedir" in
10455 "$define")
10456         echo " "
10457         echo "Checking whether closedir() returns a status..." >&4
10458         cat > closedir.c <<EOM
10459 #$i_dirent I_DIRENT             /**/
10460 #$i_sysdir I_SYS_DIR            /**/
10461 #$i_sysndir I_SYS_NDIR          /**/
10462 #$i_systypes I_SYS_TYPES        /**/
10463
10464 #if defined(I_SYS_TYPES)
10465 #include <sys/types.h>
10466 #endif
10467 #if defined(I_DIRENT)
10468 #include <dirent.h>
10469 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10470 #include <sys/dir.h>
10471 #endif
10472 #else
10473 #ifdef I_SYS_NDIR
10474 #include <sys/ndir.h>
10475 #else
10476 #ifdef I_SYS_DIR
10477 #ifdef hp9000s500
10478 #include <ndir.h>       /* may be wrong in the future */
10479 #else
10480 #include <sys/dir.h>
10481 #endif
10482 #endif
10483 #endif
10484 #endif 
10485 int main() { return closedir(opendir(".")); }
10486 EOM
10487         set closedir
10488         if eval $compile_ok; then
10489                 if ./closedir > /dev/null 2>&1 ; then
10490                         echo "Yes, it does."
10491                         val="$undef"
10492                 else
10493                         echo "No, it doesn't."
10494                         val="$define"
10495                 fi
10496         else
10497                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10498                 val="$define"
10499         fi
10500         ;;
10501 *)
10502         val="$undef";
10503         ;;
10504 esac
10505 set d_void_closedir
10506 eval $setvar
10507 $rm -f closedir*
10508 : check for volatile keyword
10509 echo " "
10510 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10511 $cat >try.c <<'EOCP'
10512 int main()
10513 {
10514         typedef struct _goo_struct goo_struct;
10515         goo_struct * volatile goo = ((goo_struct *)0);
10516         struct _goo_struct {
10517                 long long_int;
10518                 int reg_int;
10519                 char char_var;
10520         };
10521         typedef unsigned short foo_t;
10522         char *volatile foo;
10523         volatile int bar;
10524         volatile foo_t blech;
10525         foo = foo;
10526 }
10527 EOCP
10528 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10529         val="$define"
10530         echo "Yup, it does."
10531 else
10532         val="$undef"
10533         echo "Nope, it doesn't."
10534 fi
10535 set d_volatile
10536 eval $setvar
10537 $rm -f try.*
10538
10539 : see if there is a wait4
10540 set wait4 d_wait4
10541 eval $inlibc
10542
10543 : see if waitpid exists
10544 set waitpid d_waitpid
10545 eval $inlibc
10546
10547 : see if wcstombs exists
10548 set wcstombs d_wcstombs
10549 eval $inlibc
10550
10551 : see if wctomb exists
10552 set wctomb d_wctomb
10553 eval $inlibc
10554
10555 : see if writev exists
10556 set writev d_writev
10557 eval $inlibc
10558
10559 : preserve RCS keywords in files with variable substitution, grrr
10560 Date='$Date'
10561 Id='$Id'
10562 Log='$Log'
10563 RCSfile='$RCSfile'
10564 Revision='$Revision'
10565
10566 case "$crosscompile" in
10567 ''|[nN]*) crosscompile="$undef" ;;
10568 esac
10569
10570 case "$osname" in
10571 next|rhapsody) multiarch="$define" ;;
10572 esac
10573 case "$multiarch" in
10574 ''|[nN]*) multiarch="$undef" ;;
10575 esac
10576
10577 : check for alignment requirements
10578 echo " "
10579 case "$crosscompile$multiarch" in
10580 *$define*)
10581         $cat <<EOM
10582 You seem to be either cross-compiling or doing a multiarchitecture build,
10583 skipping the memory alignment check.
10584
10585 EOM
10586         case "$alignbytes" in
10587         '') alignbytes=8 ;;
10588         esac
10589         ;;
10590 *)
10591         case "$alignbytes" in
10592         '') echo "Checking alignment constraints..." >&4
10593                 $cat >try.c <<'EOCP'
10594 struct foobar {
10595         char foo;
10596         double bar;
10597 } try_algn;
10598 int main()
10599 {
10600         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10601 }
10602 EOCP
10603                 set try
10604                 if eval $compile_ok; then
10605                         dflt=`./try`
10606                 else
10607                         dflt='8'
10608                         echo "(I can't seem to compile the test program...)"
10609                 fi
10610                 ;;
10611         *) dflt="$alignbytes"
10612                 ;;
10613         esac
10614         rp="Doubles must be aligned on a how-many-byte boundary?"
10615         . ./myread
10616         alignbytes="$ans"
10617         $rm -f try.c try
10618         ;;
10619 esac
10620
10621
10622 : check for ordering of bytes in a long
10623 echo " "
10624 case "$crosscompile$multiarch" in
10625 *$define*)
10626         $cat <<EOM
10627 You seem to be either cross-compiling or doing a multiarchitecture build,
10628 skipping the byteorder check.
10629
10630 EOM
10631         byteorder=''
10632         ;;
10633 *)
10634         case "$byteorder" in
10635         '')
10636                 $cat <<'EOM'
10637 In the following, larger digits indicate more significance.  A big-endian
10638 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10639 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10640 machines may have weird orders like 3412.  A Cray will report 87654321. If
10641 the test program works the default is probably right.
10642 I'm now running the test program...
10643 EOM
10644                 $cat >try.c <<'EOCP'
10645 #include <stdio.h>
10646 int main()
10647 {
10648         int i;
10649         union {
10650                 unsigned long l;
10651                 char c[sizeof(long)];
10652         } u;
10653
10654         if (sizeof(long) > 4)
10655                 u.l = (0x08070605L << 32) | 0x04030201L;
10656         else
10657                 u.l = 0x04030201L;
10658         for (i = 0; i < sizeof(long); i++)
10659                 printf("%c", u.c[i]+'0');
10660         printf("\n");
10661         exit(0);
10662 }
10663 EOCP
10664                 xxx_prompt=y
10665                 set try
10666                 if eval $compile && ./try > /dev/null; then
10667                         dflt=`./try`
10668                         case "$dflt" in
10669                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10670                                 echo "(The test program ran ok.)"
10671                                 echo "byteorder=$dflt"
10672                                 xxx_prompt=n
10673                         ;;
10674                         ????|????????) echo "(The test program ran ok.)" ;;
10675                         *) echo "(The test program didn't run right for some reason.)" ;;
10676                         esac
10677                 else
10678                         dflt='4321'
10679                         cat <<'EOM'
10680 (I can't seem to compile the test program.  Guessing big-endian...)
10681 EOM
10682                 fi
10683                 case "$xxx_prompt" in
10684                 y)
10685                         rp="What is the order of bytes in a long?"
10686                         . ./myread
10687                         byteorder="$ans"
10688                         ;;
10689                 *)      byteorder=$dflt
10690                         ;;
10691                 esac
10692                 ;;
10693         esac
10694         $rm -f try.c try
10695         ;;
10696 esac
10697
10698
10699 : how do we catenate cpp tokens here?
10700 echo " "
10701 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10702 $cat >cpp_stuff.c <<'EOCP'
10703 #define RCAT(a,b)a/**/b
10704 #define ACAT(a,b)a ## b
10705 RCAT(Rei,ser)
10706 ACAT(Cir,cus)
10707 EOCP
10708 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10709 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10710         echo "Oh!  Smells like ANSI's been here." >&4
10711         echo "We can catify or stringify, separately or together!"
10712         cpp_stuff=42
10713 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10714         echo "Ah, yes!  The good old days!" >&4
10715         echo "However, in the good old days we don't know how to stringify and"
10716         echo "catify at the same time."
10717         cpp_stuff=1
10718 else
10719         $cat >&4 <<EOM
10720 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10721 to have to edit the values of CAT[2-5] in config.h...
10722 EOM
10723         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10724 fi
10725 $rm -f cpp_stuff.*
10726
10727 : see if this is a db.h system
10728 set db.h i_db
10729 eval $inhdr
10730
10731 case "$i_db" in
10732 $define)
10733         : Check db version.
10734         echo " "
10735         echo "Checking Berkeley DB version ..." >&4
10736         $cat >try.c <<EOCP
10737 #$d_const HASCONST
10738 #ifndef HASCONST
10739 #define const
10740 #endif
10741 #include <sys/types.h>
10742 #include <stdio.h>
10743 #include <db.h>
10744 int main()
10745 {
10746 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10747     int Major, Minor, Patch ;
10748     unsigned long Version ;
10749     (void)db_version(&Major, &Minor, &Patch) ;
10750     printf("You have Berkeley DB Version 2 or greater\n");
10751
10752     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10753                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10754     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10755                 Major, Minor, Patch) ;
10756
10757     /* check that db.h & libdb are compatible */
10758     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10759         printf("db.h and libdb are incompatible\n") ;
10760         exit(3);        
10761     }
10762
10763     printf("db.h and libdb are compatible\n") ;
10764
10765     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10766                 + DB_VERSION_PATCH ;
10767
10768     /* needs to be >= 2.3.4 */
10769     if (Version < 2003004) {
10770     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10771         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10772         exit(2);        
10773     }
10774
10775     exit(0);
10776 #else
10777 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10778     printf("You have Berkeley DB Version 1\n");
10779     exit(0);    /* DB version < 2: the coast is clear. */
10780 #else
10781     exit(1);    /* <db.h> not Berkeley DB? */
10782 #endif
10783 #endif
10784 }
10785 EOCP
10786         set try
10787         if eval $compile && ./try; then
10788                 echo 'Looks OK.' >&4
10789         else
10790                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10791                 i_db=$undef
10792                 case " $libs " in
10793                 *"-ldb "*)
10794                         : Remove db from list of libraries to use
10795                         echo "Removing unusable -ldb from library list" >&4
10796                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10797                         shift
10798                         libs="$*"
10799                         echo "libs = $libs" >&4
10800                         ;;
10801                 esac
10802         fi
10803         $rm -f try.*
10804         ;;
10805 esac
10806
10807 case "$i_db" in
10808 define)
10809         : Check the return type needed for hash 
10810         echo " "
10811         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10812         $cat >try.c <<EOCP
10813 #$d_const HASCONST
10814 #ifndef HASCONST
10815 #define const
10816 #endif
10817 #include <sys/types.h>
10818 #include <db.h>
10819
10820 #ifndef DB_VERSION_MAJOR
10821 u_int32_t hash_cb (ptr, size)
10822 const void *ptr;
10823 size_t size;
10824 {
10825 }
10826 HASHINFO info;
10827 int main()
10828 {
10829         info.hash = hash_cb;
10830 }
10831 #endif
10832 EOCP
10833         if $cc $ccflags -c try.c >try.out 2>&1 ; then
10834                 if $contains warning try.out >>/dev/null 2>&1 ; then
10835                         db_hashtype='int'
10836                 else
10837                         db_hashtype='u_int32_t'
10838                 fi
10839         else
10840                 : XXX Maybe we should just give up here.
10841                 db_hashtype=u_int32_t
10842                 $cat try.out >&4
10843                 echo "Help:  I can't seem to compile the db test program." >&4
10844                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10845         fi
10846         $rm -f try.*
10847         echo "Your version of Berkeley DB uses $db_hashtype for hash."
10848         ;;
10849 *)      db_hashtype=u_int32_t
10850         ;;
10851 esac
10852 case "$i_db" in
10853 define)
10854         : Check the return type needed for prefix 
10855         echo " "
10856         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10857         cat >try.c <<EOCP
10858 #$d_const HASCONST
10859 #ifndef HASCONST
10860 #define const
10861 #endif
10862 #include <sys/types.h>
10863 #include <db.h>
10864
10865 #ifndef DB_VERSION_MAJOR
10866 size_t prefix_cb (key1, key2)
10867 const DBT *key1;
10868 const DBT *key2;
10869 {
10870 }
10871 BTREEINFO info;
10872 int main()
10873 {
10874         info.prefix = prefix_cb;
10875 }
10876 #endif
10877 EOCP
10878         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
10879                 if $contains warning try.out >>/dev/null 2>&1 ; then
10880                         db_prefixtype='int'
10881                 else
10882                         db_prefixtype='size_t'
10883                 fi
10884         else
10885                 db_prefixtype='size_t'
10886                 : XXX Maybe we should just give up here.
10887                 $cat try.out >&4
10888                 echo "Help:  I can't seem to compile the db test program." >&4
10889                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
10890         fi
10891         $rm -f try.*
10892         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
10893         ;;
10894 *)      db_prefixtype='size_t'
10895         ;;
10896 esac
10897
10898 : check for void type
10899 echo " "
10900 echo "Checking to see how well your C compiler groks the void type..." >&4
10901 case "$voidflags" in
10902 '')
10903         $cat >try.c <<'EOCP'
10904 #if TRY & 1
10905 void sub() {
10906 #else
10907 sub() {
10908 #endif
10909         extern void moo();      /* function returning void */
10910         void (*goo)();          /* ptr to func returning void */
10911 #if TRY & 8
10912         void *hue;              /* generic ptr */
10913 #endif
10914 #if TRY & 2
10915         void (*foo[10])();
10916 #endif
10917
10918 #if TRY & 4
10919         if(goo == moo) {
10920                 exit(0);
10921         }
10922 #endif
10923         exit(0);
10924 }
10925 int main() { sub(); }
10926 EOCP
10927         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
10928                 voidflags=$defvoidused
10929         echo "Good.  It appears to support void to the level $package wants.">&4
10930                 if $contains warning .out >/dev/null 2>&1; then
10931                         echo "However, you might get some warnings that look like this:"
10932                         $cat .out
10933                 fi
10934         else
10935 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
10936                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
10937                         echo "It supports 1..."
10938                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
10939                                 echo "It also supports 2..."
10940                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
10941                                         voidflags=7
10942                                         echo "And it supports 4 but not 8 definitely."
10943                                 else
10944                                         echo "It doesn't support 4..."
10945                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
10946                                                 voidflags=11
10947                                                 echo "But it supports 8."
10948                                         else
10949                                                 voidflags=3
10950                                                 echo "Neither does it support 8."
10951                                         fi
10952                                 fi
10953                         else
10954                                 echo "It does not support 2..."
10955                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
10956                                         voidflags=13
10957                                         echo "But it supports 4 and 8."
10958                                 else
10959                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
10960                                                 voidflags=5
10961                                                 echo "And it supports 4 but has not heard about 8."
10962                                         else
10963                                                 echo "However it supports 8 but not 4."
10964                                         fi
10965                                 fi
10966                         fi
10967                 else
10968                         echo "There is no support at all for void."
10969                         voidflags=0
10970                 fi
10971         fi
10972 esac
10973 case "$voidflags" in
10974 "$defvoidused") ;;
10975 *)      $cat >&4 <<'EOM'
10976   Support flag bits are:
10977     1: basic void declarations.
10978     2: arrays of pointers to functions returning void.
10979     4: operations between pointers to and addresses of void functions.
10980     8: generic void pointers.
10981 EOM
10982         dflt="$voidflags";
10983         rp="Your void support flags add up to what?"
10984         . ./myread
10985         voidflags="$ans"
10986         ;;
10987 esac
10988 $rm -f try.* .out
10989
10990
10991 : How can we generate normalized random numbers ?
10992 echo " "
10993 echo "Looking for a random number function..." >&4
10994 case "$randfunc" in
10995 '')
10996         if set drand48 val -f; eval $csym; $val; then
10997                 dflt="drand48"
10998                 echo "Good, found drand48()." >&4
10999         elif set random val -f; eval $csym; $val; then
11000                 dflt="random"
11001                 echo "OK, found random()." >&4
11002         else
11003                 dflt="rand"
11004                 echo "Yick, looks like I have to use rand()." >&4
11005         fi
11006         echo " "
11007         ;;
11008 *)
11009         dflt="$randfunc"
11010         ;;
11011 esac
11012 cont=true
11013
11014 case "$ccflags" in
11015 *-Dmy_rand=*|*-Dmy_srand=*)
11016         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11017         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11018         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11019         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11020         ;;
11021 esac
11022
11023 while $test "$cont"; do
11024         rp="Use which function to generate random numbers?"
11025         . ./myread
11026         if $test "$ans" = "$dflt"; then
11027                 : null
11028         else
11029                 randbits=''
11030         fi
11031         randfunc="$ans"
11032         if set $ans val -f; eval $csym; $val; then
11033                 cont=''
11034         else
11035                 dflt=y
11036                 rp="I cannot find function $ans. Use that name anyway?"
11037                 . ./myread
11038                 dflt=rand
11039                 case "$ans" in
11040                         [yY]*) cont='';;
11041                 esac
11042         fi
11043         case "$cont" in
11044         '')
11045                 case "$randfunc" in
11046                 drand48)
11047                         drand01="drand48()"
11048                         seedfunc="srand48"
11049                         randbits=48
11050                         randseedtype=long
11051                         ;;
11052                 rand|random)
11053                         case "$randbits" in
11054                         '')
11055 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11056                                 $cat >try.c <<EOCP
11057 #$i_unistd I_UNISTD
11058 #$i_stdlib I_STDLIB
11059 #include <stdio.h>
11060 #ifdef I_UNISTD
11061 #  include <unistd.h>
11062 #endif
11063 #ifdef I_STDLIB
11064 #  include <stdlib.h>
11065 #endif
11066 int main()
11067 {
11068         register int i;
11069         register unsigned long tmp;
11070         register unsigned long max = 0L;
11071
11072         for (i = 1000; i; i--) {
11073                 tmp = (unsigned long) $randfunc();
11074                 if (tmp > max) max = tmp;
11075         }
11076         for (i = 0; max; i++)
11077                 max /= 2;
11078         printf("%d\n",i);
11079 }
11080 EOCP
11081                                 set try
11082                                 if eval $compile_ok; then
11083                                         dflt=`try`
11084                                 else
11085                                         dflt='?'
11086                                         echo "(I can't seem to compile the test program...)"
11087                                 fi
11088                                 ;;
11089                         *)
11090                                 dflt="$randbits"
11091                                 ;;
11092                         esac
11093                         rp="How many bits does your $randfunc() function produce?"
11094                         . ./myread
11095                         randbits="$ans"
11096                         $rm -f try.c try
11097                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11098                         seedfunc="s$randfunc"
11099                         randseedtype=unsigned
11100                         ;;
11101                 *)
11102                         dflt="31"
11103                         rp="How many bits does your $randfunc() function produce?"
11104                         . ./myread
11105                         randbits="$ans"
11106                         seedfunc="s$randfunc"
11107                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11108                         if set $seedfunc val -f; eval $csym; $val; then
11109                                 echo "(Using $seedfunc() to seed random generator)"
11110                         else
11111                                 echo "(Warning: no $seedfunc() to seed random generator)"
11112                                 seedfunc=rand
11113                         fi
11114                         randseedtype=unsigned
11115                         ;;
11116                 esac
11117                 ;;
11118         esac
11119 done
11120
11121 echo " "
11122 echo "Determining whether or not we are on an EBCDIC system..." >&4
11123 $cat >tebcdic.c <<'EOM'
11124 int main()
11125 {
11126   if ('M'==0xd4) return 0;
11127   return 1;
11128 }
11129 EOM
11130
11131 val=$undef
11132 set tebcdic
11133 if eval $compile_ok; then
11134         if ./tebcdic; then
11135                 echo "You have EBCDIC." >&4
11136                 val="$define"
11137         else
11138                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11139         fi
11140 else
11141         echo "I'm unable to compile the test program." >&4
11142         echo "I'll assume ASCII or some ISO Latin." >&4
11143 fi
11144 $rm -f tebcdic.c tebcdic
11145 set ebcdic
11146 eval $setvar
11147
11148 echo " "
11149 $cat >&4 <<EOM
11150 Checking how to flush all pending stdio output...
11151 EOM
11152 # I only know how to find the first 32 possibly open files on SunOS.
11153 # See also hints/sunos_4_1.sh and util.c  --AD
11154 case "$osname" in
11155 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11156 esac
11157 $cat >>try.c <<EOCP
11158 #include <stdio.h>
11159 #$i_unistd I_UNISTD
11160 #ifdef I_UNISTD
11161 # include <unistd.h>
11162 #endif
11163 #$d_sysconf HAS_SYSCONF
11164 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11165 #ifdef HAS_STDIO_STREAM_ARRAY
11166 # define STDIO_STREAM_ARRAY $stdio_stream_array
11167 #endif
11168 int main() {
11169   FILE* p = fopen("try.out", "w");
11170 #ifdef TRY_FPUTC
11171   fputc('x', p);
11172 #else
11173 # ifdef TRY_FPRINTF
11174   fprintf(p, "x");
11175 # endif
11176 #endif
11177 #ifdef TRY_FFLUSH_NULL
11178   fflush(NULL);
11179 #endif
11180 #ifdef TRY_FFLUSH_ALL
11181   {
11182     long open_max = -1;
11183 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11184     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11185 # else
11186 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11187     open_max = sysconf(_SC_OPEN_MAX);
11188 #  else
11189 #   ifdef FOPEN_MAX
11190     open_max = FOPEN_MAX;
11191 #   else
11192 #    ifdef OPEN_MAX
11193     open_max = OPEN_MAX;
11194 #    else
11195 #     ifdef _NFILE
11196     open_max = _NFILE;
11197 #     endif
11198 #    endif
11199 #   endif
11200 #  endif
11201 # endif 
11202 # ifdef HAS_STDIO_STREAM_ARRAY
11203     if (open_max > 0) {
11204       long i;
11205       for (i = 0; i < open_max; i++)
11206             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11207                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11208                 STDIO_STREAM_ARRAY[i]._flag)
11209                 fflush(&STDIO_STREAM_ARRAY[i]);
11210     }   
11211   }
11212 # endif
11213 #endif
11214   _exit(42);
11215 }
11216 EOCP
11217 : first we have to find out how _not_ to flush
11218 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11219     output=''
11220     set try -DTRY_FPUTC
11221     if eval $compile; then
11222             $rm -f try.out
11223             ./try$exe_ext 2>/dev/null
11224             if $test ! -s try.out -a "X$?" = X42; then
11225                 output=-DTRY_FPUTC
11226             fi
11227     fi
11228     case "$output" in
11229     '')
11230             set try -DTRY_FPRINTF
11231             $rm -f try.out
11232             if eval $compile; then
11233                     $rm -f try.out
11234                     ./try$exe_ext 2>/dev/null
11235                     if $test ! -s try.out -a "X$?" = X42; then
11236                         output=-DTRY_FPRINTF
11237                     fi
11238             fi
11239         ;;
11240     esac
11241 fi
11242 : check for fflush NULL behaviour
11243 case "$fflushNULL" in
11244 '')     set try -DTRY_FFLUSH_NULL $output
11245         if eval $compile; then
11246                 $rm -f try.out
11247                 ./try$exe_ext 2>/dev/null
11248                 code="$?"
11249                 if $test -s try.out -a "X$code" = X42; then
11250                         fflushNULL="`$cat try.out`"
11251                 else
11252                         if $test "X$code" != X42; then
11253                                 $cat >&4 <<EOM
11254 (If this test failed, don't worry, we'll try another method shortly.)
11255 EOM
11256                         fi
11257                 fi
11258         fi
11259         $rm -f core try.core core.try.*
11260         case "$fflushNULL" in
11261         x)      $cat >&4 <<EOM
11262 Your fflush(NULL) works okay.
11263 EOM
11264                 fflushNULL="$define"
11265                 ;;
11266         '')     $cat >&4 <<EOM
11267 Your fflush(NULL) isn't working (contrary to ANSI C).
11268 EOM
11269                 fflushNULL="$undef"
11270                 ;;
11271         *)      $cat >&4 <<EOM
11272 Cannot figure out whether your fflush(NULL) works or not.
11273 I'm assuming it doesn't (contrary to ANSI C).
11274 EOM
11275                 fflushNULL="$undef"
11276                 ;;
11277         esac
11278         ;;
11279 $define|true|[yY]*)
11280         fflushNULL="$define"
11281         ;;
11282 *)
11283         fflushNULL="$undef"
11284         ;;
11285 esac
11286 : check explicit looping only if NULL did not work
11287 case "$fflushNULL" in
11288 "$undef")
11289         : check for fflush all behaviour
11290         case "$fflushall" in
11291         '')     set try -DTRY_FFLUSH_ALL $output
11292                 if eval $compile; then
11293                         $cat >&4 <<EOM
11294 (Now testing the other method--but note that also this may fail.)
11295 EOM
11296                         $rm -f try.out
11297                         ./try$exe_ext 2>/dev/null
11298                         if $test -s try.out -a "X$?" = X42; then
11299                                 fflushall="`$cat try.out`"
11300                         fi
11301                 fi
11302                 $rm -f core try.core core.try.*
11303                 case "$fflushall" in
11304                 x)      $cat >&4 <<EOM
11305 Whew. Flushing explicitly all the stdio streams works.
11306 EOM
11307                         fflushall="$define"
11308                         ;;
11309                 '')     $cat >&4 <<EOM
11310 Sigh. Flushing explicitly all the stdio streams doesn't work.
11311 EOM
11312                         fflushall="$undef"
11313                         ;;
11314                 *)      $cat >&4 <<EOM
11315 Cannot figure out whether flushing stdio streams explicitly works or not.
11316 I'm assuming it doesn't.
11317 EOM
11318                         fflushall="$undef"
11319                         ;;
11320                 esac
11321                 ;;
11322         "$define"|true|[yY]*)
11323                 fflushall="$define"
11324                 ;;
11325         *)
11326                 fflushall="$undef"
11327                 ;;
11328         esac
11329         ;;
11330 *)      fflushall="$undef"      
11331         ;;
11332 esac
11333 case "$fflushNULL$fflushall" in
11334 undefundef)
11335         $cat <<EOM
11336 I cannot figure out how to flush pending stdio output.
11337 EOM
11338         ;;
11339 esac
11340 $rm -f try.* try$exe_ext
11341
11342 : see what type file positions are declared as in the library
11343 rp="What is the type for file position used by fsetpos()?"
11344 set fpos_t fpostype long stdio.h sys/types.h
11345 eval $typedef_ask
11346
11347 : Store the full pathname to the ar program for use in the C program
11348 : Respect a hint or command line value for full_ar.
11349 case "$full_ar" in
11350 '') full_ar=$ar ;;
11351 esac
11352
11353 : Store the full pathname to the sed program for use in the C program
11354 full_sed=$sed
11355
11356 : see what type gids are declared as in the kernel
11357 echo " "
11358 echo "Looking for the type for group ids returned by getgid()."
11359 set gid_t gidtype xxx stdio.h sys/types.h
11360 eval $typedef
11361 case "$gidtype" in
11362 xxx)
11363         xxx=`./findhdr sys/user.h`
11364         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11365         case $1 in
11366         unsigned) dflt="$1 $2" ;;
11367         *) dflt="$1" ;;
11368         esac
11369         ;;
11370 *) dflt="$gidtype";;
11371 esac
11372 case "$gidtype" in
11373 gid_t) echo "gid_t found." ;;
11374 *)      rp="What is the type for group ids returned by getgid()?"
11375         . ./myread
11376         gidtype="$ans"
11377         ;;
11378 esac
11379
11380 : see if getgroups exists
11381 set getgroups d_getgrps
11382 eval $inlibc
11383
11384 : see if setgroups exists
11385 set setgroups d_setgrps
11386 eval $inlibc
11387
11388
11389 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11390 echo " "
11391 case "$d_getgrps$d_setgrps" in
11392 *define*)
11393         case "$groupstype" in
11394         '') dflt="$gidtype" ;;
11395         *)  dflt="$groupstype" ;;
11396         esac
11397         $cat <<EOM
11398 What type of pointer is the second argument to getgroups() and setgroups()?
11399 Usually this is the same as group ids, $gidtype, but not always.
11400
11401 EOM
11402         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11403         . ./myread
11404         groupstype="$ans"
11405         ;;
11406 *)  groupstype="$gidtype";;
11407 esac
11408
11409 : see what type lseek is declared as in the kernel
11410 rp="What is the type used for lseek's offset on this system?"
11411 set off_t lseektype long stdio.h sys/types.h
11412 eval $typedef_ask
11413
11414 echo " "
11415 $echo $n "Checking to see how big your file offsets are...$c" >&4
11416 $cat >try.c <<EOCP
11417 #include <sys/types.h>
11418 #include <stdio.h>
11419 int main()
11420 {
11421         printf("%d\n", sizeof($lseektype));
11422 }
11423 EOCP
11424 set try
11425 if eval $compile_ok; then
11426         lseeksize=`./try`
11427         $echo " $lseeksize bytes." >&4
11428 else
11429         dflt='4'
11430         echo " "
11431         echo "(I can't seem to compile the test program.  Guessing...)"
11432         rp="What is the size of your file offsets (in bytes)?"
11433         . ./myread
11434         lseeksize="$ans"
11435 fi
11436 $rm -f try.c try
11437
11438 echo " "
11439 echo "Checking if your $make program sets \$(MAKE)..." >&4
11440 case "$make_set_make" in
11441 '')
11442         $sed 's/^X //' > testmake.mak << 'EOF'
11443 Xall:
11444 X       @echo 'maketemp="$(MAKE)"'
11445 EOF
11446         case "`$make -f testmake.mak 2>/dev/null`" in
11447         *maketemp=*) make_set_make='#' ;;
11448         *)      make_set_make="MAKE=$make" ;;
11449         esac
11450         $rm -f testmake.mak
11451         ;;
11452 esac
11453 case "$make_set_make" in
11454 '#') echo "Yup, it does.";;
11455 *) echo "Nope, it doesn't.";;
11456 esac
11457
11458 : see what type is used for mode_t
11459 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11460 set mode_t modetype int stdio.h sys/types.h
11461 eval $typedef_ask
11462
11463 : define a fucntion to check prototypes
11464 $cat > protochk <<EOSH
11465 $startsh
11466 cc="$cc"
11467 optimize="$optimize"
11468 ccflags="$ccflags"
11469 prototype="$prototype"
11470 define="$define"
11471 rm=$rm
11472 EOSH
11473
11474 $cat >> protochk <<'EOSH'
11475
11476 $rm -f try.c
11477 foo="$1"
11478 shift
11479 while test $# -ge 2; do
11480         case "$1" in
11481                 $define) echo "#include <$2>" >> try.c ;;
11482                 literal) echo "$2" >> try.c ;;
11483         esac
11484     shift 2
11485 done
11486 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11487 cat >> try.c <<'EOCP'
11488 #ifdef CAN_PROTOTYPE
11489 #define _(args) args
11490 #else
11491 #define _(args) ()
11492 #endif
11493 EOCP
11494 echo "$foo" >> try.c
11495 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11496 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11497 status=$?
11498 $rm -f try.[co]
11499 exit $status
11500 EOSH
11501 chmod +x protochk
11502 $eunicefix protochk
11503
11504 : see what type is used for size_t
11505 rp="What is the type used for the length parameter for string functions?"
11506 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11507 eval $typedef_ask
11508
11509 : check for type of arguments to gethostbyaddr. 
11510 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11511         case "$d_gethbyaddr" in
11512         $define)
11513                 $cat <<EOM
11514
11515 Checking to see what type of arguments are accepted by gethostbyaddr().
11516 EOM
11517                 hdrs="$define sys/types.h
11518                         $d_socket sys/socket.h 
11519                         $i_niin netinet/in.h 
11520                         $i_netdb netdb.h
11521                         $i_unistd unistd.h"
11522                 : The first arg can 'char *' or 'void *'
11523                 : The second arg is some of integral type
11524                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11525                         for yyy in size_t long int; do
11526                                 case "$netdb_host_type" in
11527                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11528                                         if ./protochk "$try" $hdrs; then
11529                                                 echo "Your system accepts $xxx for the first arg."
11530                                                 echo "...and $yyy for the second arg."
11531                                                 netdb_host_type="$xxx"
11532                                                 netdb_hlen_type="$yyy"
11533                                         fi
11534                                         ;;
11535                                 esac
11536                         done
11537                 done
11538                 : In case none of those worked, prompt the user.
11539                 case "$netdb_host_type" in
11540                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11541                         dflt='char *'
11542                         . ./myread
11543                         netdb_host_type=$ans
11544                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11545                         dflt="$sizetype"
11546                         . ./myread
11547                         netdb_hlen_type=$ans
11548                         ;;
11549                 esac
11550                 ;;
11551         *)      : no gethostbyaddr, so pick harmless defaults
11552                 netdb_host_type='char *'
11553                 netdb_hlen_type="$sizetype"
11554                 ;;
11555         esac
11556         # Remove the "const" if needed. -- but then we'll have a 
11557         # prototype clash!
11558         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11559 fi
11560
11561 : check for type of argument to gethostbyname. 
11562 if test "X$netdb_name_type" = X ; then
11563         case "$d_gethbyname" in
11564         $define)
11565                 $cat <<EOM
11566
11567 Checking to see what type of argument is accepted by gethostbyname().
11568 EOM
11569                 hdrs="$define sys/types.h
11570                         $d_socket sys/socket.h 
11571                         $i_niin netinet/in.h 
11572                         $i_netdb netdb.h
11573                         $i_unistd unistd.h"
11574                 for xxx in "const char *" "char *"; do
11575                         case "$netdb_name_type" in
11576                         '')     try="extern struct hostent *gethostbyname($xxx);"
11577                                 if ./protochk "$try" $hdrs; then
11578                                         echo "Your system accepts $xxx."
11579                                         netdb_name_type="$xxx"
11580                                 fi
11581                                 ;;
11582                         esac
11583                 done
11584                 : In case none of those worked, prompt the user.
11585                 case "$netdb_name_type" in
11586                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11587                         dflt='char *'
11588                         . ./myread
11589                         netdb_name_type=$ans
11590                         ;;
11591                 esac
11592                 ;;
11593         *)      : no gethostbyname, so pick harmless default
11594                 netdb_name_type='char *'
11595                 ;;
11596         esac
11597 fi
11598
11599 : check for type of 1st argument to getnetbyaddr. 
11600 if test "X$netdb_net_type" = X ; then
11601         case "$d_getnbyaddr" in
11602         $define)
11603                 $cat <<EOM
11604
11605 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11606 EOM
11607                 hdrs="$define sys/types.h
11608                         $d_socket sys/socket.h 
11609                         $i_niin netinet/in.h 
11610                         $i_netdb netdb.h
11611                         $i_unistd unistd.h"
11612                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11613                         case "$netdb_net_type" in
11614                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11615                                 if ./protochk "$try" $hdrs; then
11616                                         echo "Your system accepts $xxx."
11617                                         netdb_net_type="$xxx"
11618                                 fi
11619                                 ;;
11620                         esac
11621                 done
11622                 : In case none of those worked, prompt the user.
11623                 case "$netdb_net_type" in
11624                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11625                         dflt='long'
11626                         . ./myread
11627                         netdb_net_type=$ans
11628                         ;;
11629                 esac
11630                 ;;
11631         *)      : no getnetbyaddr, so pick harmless default
11632                 netdb_net_type='long'
11633                 ;;
11634         esac
11635 fi
11636 : locate the preferred pager for this system
11637 case "$pager" in
11638 '')
11639         dflt=''
11640         case "$pg" in
11641         /*) dflt=$pg;;
11642         esac
11643         case "$more" in
11644         /*) dflt=$more;;
11645         esac
11646         case "$less" in
11647         /*) dflt=$less;;
11648         esac
11649         case "$dflt" in
11650         '') dflt=/usr/ucb/more;;
11651         esac
11652         ;;
11653 *) dflt="$pager";;
11654 esac
11655 echo " "
11656 fn=f/
11657 rp='What pager is used on your system?'
11658 . ./getfile
11659 pager="$ans"
11660
11661 : see what type pids are declared as in the kernel
11662 rp="What is the type of process ids on this system?"
11663 set pid_t pidtype int stdio.h sys/types.h
11664 eval $typedef_ask
11665
11666 : check for length of pointer
11667 echo " "
11668 case "$ptrsize" in
11669 '')
11670         $echo $n "Checking to see how big your pointers are...$c" >&4
11671         if test "$voidflags" -gt 7; then
11672                 echo '#define VOID_PTR char *' > try.c
11673         else
11674                 echo '#define VOID_PTR void *' > try.c
11675         fi
11676         $cat >>try.c <<'EOCP'
11677 #include <stdio.h>
11678 int main()
11679 {
11680         printf("%d\n", sizeof(VOID_PTR));
11681         exit(0);
11682 }
11683 EOCP
11684         set try
11685         if eval $compile_ok; then
11686                 ptrsize=`./try`
11687                 $echo " $ptrsize bytes." >&4
11688         else
11689                 dflt='4'
11690                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11691                 rp="What is the size of a pointer (in bytes)?"
11692                 . ./myread
11693                 ptrsize="$ans"
11694         fi
11695         ;;
11696 esac
11697 $rm -f try.c try
11698
11699 : see if ar generates random libraries by itself
11700 echo " "
11701 echo "Checking how to generate random libraries on your machine..." >&4
11702 echo 'int bar1() { return bar2(); }' > bar1.c
11703 echo 'int bar2() { return 2; }' > bar2.c
11704 $cat > foo.c <<'EOP'
11705 int main() { printf("%d\n", bar1()); exit(0); }
11706 EOP
11707 $cc $ccflags -c bar1.c >/dev/null 2>&1
11708 $cc $ccflags -c bar2.c >/dev/null 2>&1
11709 $cc $ccflags -c foo.c >/dev/null 2>&1
11710 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11711 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11712         ./foobar >/dev/null 2>&1; then
11713         echo "$ar appears to generate random libraries itself."
11714         orderlib=false
11715         ranlib=":"
11716 elif $ar ts bar$_a >/dev/null 2>&1 &&
11717         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11718         ./foobar >/dev/null 2>&1; then
11719                 echo "a table of contents needs to be added with '$ar ts'."
11720                 orderlib=false
11721                 ranlib="$ar ts"
11722 else
11723         case "$ranlib" in
11724         :) ranlib='';;
11725         '')
11726                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11727                 $test -f $ranlib || ranlib=''
11728                 ;;
11729         esac
11730         if $test -n "$ranlib"; then
11731                 echo "your system has '$ranlib'; we'll use that."
11732                 orderlib=false
11733         else
11734                 echo "your system doesn't seem to support random libraries"
11735                 echo "so we'll use lorder and tsort to order the libraries."
11736                 orderlib=true
11737                 ranlib=":"
11738         fi
11739 fi
11740 $rm -f foo* bar* 
11741
11742 : check for type of arguments to select. 
11743 case "$selecttype" in
11744 '') case "$d_select" in
11745         $define)
11746                 $cat <<EOM
11747 Checking to see what type of arguments are accepted by select().
11748 EOM
11749                 hdrs="$define sys/types.h
11750                         $i_systime sys/time.h 
11751                         $i_sysselct sys/select.h
11752                         $d_socket sys/socket.h"
11753                 : The first arg can be int, unsigned, or size_t
11754                 : The last arg may or may not be 'const'
11755                 val=''
11756                 : void pointer has been seen but using that
11757                 : breaks the selectminbits test
11758                 for xxx in 'fd_set *' 'int *'; do
11759                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11760                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11761                                         case "$val" in
11762                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11763                                                 if ./protochk "$try" $hdrs; then
11764                                                         echo "Your system accepts $xxx."
11765                                                         val="$xxx"
11766                                                 fi
11767                                                 ;;
11768                                         esac
11769                                 done
11770                         done
11771                 done
11772                 case "$val" in
11773                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11774                         case "$d_fd_set" in
11775                                 $define) dflt="fd_set *" ;;
11776                                 *)              dflt="int *" ;;
11777                         esac
11778                         . ./myread
11779                         val=$ans
11780                         ;;
11781                 esac
11782                 selecttype="$val"
11783                 ;;
11784         *)      : no select, so pick a harmless default
11785                 selecttype='int *'
11786                 ;;
11787         esac
11788         ;;
11789 esac
11790
11791 : check for the select 'width'
11792 case "$selectminbits" in
11793 '') case "$d_select" in
11794         $define)
11795                 $cat <<EOM
11796
11797 Checking to see on how many bits at a time your select() operates...
11798 EOM
11799                 $cat >try.c <<EOCP
11800 #include <sys/types.h>
11801 #$i_time I_TIME
11802 #$i_systime I_SYS_TIME
11803 #$i_systimek I_SYS_TIME_KERNEL
11804 #ifdef I_TIME
11805 #   include <time.h>
11806 #endif
11807 #ifdef I_SYS_TIME
11808 #   ifdef I_SYS_TIME_KERNEL
11809 #       define KERNEL
11810 #   endif
11811 #   include <sys/time.h>
11812 #   ifdef I_SYS_TIME_KERNEL
11813 #       undef KERNEL
11814 #   endif
11815 #endif
11816 #$i_sysselct I_SYS_SELECT
11817 #ifdef I_SYS_SELECT
11818 #include <sys/select.h>
11819 #endif
11820 #$d_socket HAS_SOCKET
11821 #ifdef HAS_SOCKET
11822 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11823 #endif
11824 #include <stdio.h>
11825 $selecttype b;
11826 #define S sizeof(*(b))
11827 #define MINBITS 64
11828 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11829 #define NBITS  (NBYTES * 8)
11830 int main() {
11831     char s[NBYTES];
11832     struct timeval t;
11833     int i;
11834     FILE* fp;
11835     int fd;
11836
11837     fclose(stdin);
11838     fp = fopen("try.c", "r");
11839     if (fp == 0)
11840       exit(1);
11841     fd = fileno(fp);
11842     if (fd < 0)
11843       exit(2);
11844     b = ($selecttype)s;
11845     for (i = 0; i < NBITS; i++)
11846         FD_SET(i, b);
11847     t.tv_sec  = 0;
11848     t.tv_usec = 0;
11849     select(fd + 1, b, 0, 0, &t);
11850     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11851     printf("%d\n", i + 1);
11852     return 0;
11853 }
11854 EOCP
11855                 set try
11856                 if eval $compile_ok; then
11857                         selectminbits=`./try`
11858                         case "$selectminbits" in
11859                         '')     cat >&4 <<EOM
11860 Cannot figure out on how many bits at a time your select() operates.
11861 I'll play safe and guess it is 32 bits.
11862 EOM
11863                                 selectminbits=32
11864                                 bits="32 bits"
11865                                 ;;
11866                         1)      bits="1 bit" ;;
11867                         *)      bits="$selectminbits bits" ;;
11868                         esac
11869                         echo "Your select() operates on $bits at a time." >&4
11870                 else
11871                         rp='What is the minimum number of bits your select() operates on?'
11872                         case "$byteorder" in
11873                         1234|12345678)  dflt=32 ;;
11874                         *)              dflt=1  ;;
11875                         esac
11876                         . ./myread
11877                         val=$ans
11878                         selectminbits="$val"
11879                 fi
11880                 $rm -f try.* try
11881                 ;;
11882         *)      : no select, so pick a harmless default
11883                 selectminbits='32'
11884                 ;;
11885         esac
11886         ;;
11887 esac
11888
11889 : Trace out the files included by signal.h, then look for SIGxxx names.
11890 : Remove SIGARRAYSIZE used by HPUX.
11891 : Remove SIGSTKSIZE used by Linux.
11892 : Remove SIGSTKSZ used by Posix.
11893 : Remove SIGTYP void lines used by OS2.
11894 xxx=`echo '#include <signal.h>' |
11895         $cppstdin $cppminus $cppflags 2>/dev/null |
11896         $grep '^[       ]*#.*include' | 
11897         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11898 : Check this list of files to be sure we have parsed the cpp output ok.
11899 : This will also avoid potentially non-existent files, such 
11900 : as ../foo/bar.h
11901 xxxfiles=''
11902 for xx in $xxx /dev/null ; do
11903         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11904 done
11905 : If we have found no files, at least try signal.h
11906 case "$xxxfiles" in
11907 '')     xxxfiles=`./findhdr signal.h` ;;
11908 esac
11909 xxx=`awk '
11910 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
11911         print substr($2, 4, 20)
11912 }
11913 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
11914         print substr($3, 4, 20)
11915 }' $xxxfiles`
11916 : Append some common names just in case the awk scan failed.
11917 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11918 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11919 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11920 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11921 : generate a few handy files for later
11922 $cat > signal.c <<'EOCP'
11923 #include <sys/types.h>
11924 #include <signal.h>
11925 #include <stdio.h>
11926 int main() {
11927
11928 /* Strange style to avoid deeply-nested #if/#else/#endif */
11929 #ifndef NSIG
11930 #  ifdef _NSIG
11931 #    define NSIG (_NSIG)
11932 #  endif
11933 #endif
11934
11935 #ifndef NSIG
11936 #  ifdef SIGMAX
11937 #    define NSIG (SIGMAX+1)
11938 #  endif
11939 #endif
11940
11941 #ifndef NSIG
11942 #  ifdef SIG_MAX
11943 #    define NSIG (SIG_MAX+1)
11944 #  endif
11945 #endif
11946
11947 #ifndef NSIG
11948 #  ifdef MAXSIG
11949 #    define NSIG (MAXSIG+1)
11950 #  endif
11951 #endif
11952
11953 #ifndef NSIG
11954 #  ifdef MAX_SIG
11955 #    define NSIG (MAX_SIG+1)
11956 #  endif
11957 #endif
11958
11959 #ifndef NSIG
11960 #  ifdef SIGARRAYSIZE
11961 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11962 #  endif
11963 #endif
11964
11965 #ifndef NSIG
11966 #  ifdef _sys_nsig
11967 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
11968 #  endif
11969 #endif
11970
11971 /* Default to some arbitrary number that's big enough to get most
11972    of the common signals.
11973 */
11974 #ifndef NSIG
11975 #    define NSIG 50
11976 #endif
11977
11978 printf("NSIG %d\n", NSIG);
11979
11980 #ifndef JUST_NSIG
11981
11982 EOCP
11983
11984 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
11985 {
11986         printf "#ifdef SIG"; printf $1; printf "\n"
11987         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11988         printf $1; printf ");\n"
11989         printf "#endif\n"
11990 }
11991 END {
11992         printf "#endif /* JUST_NSIG */\n";
11993         printf "}\n";
11994 }
11995 ' >>signal.c
11996 $cat >signal.awk <<'EOP'
11997 BEGIN { ndups = 0 }
11998 $1 ~ /^NSIG$/ { nsig = $2 }
11999 ($1 !~ /^NSIG$/) && (NF == 2) {
12000     if ($2 > maxsig) { maxsig = $2 }
12001     if (sig_name[$2]) {
12002         dup_name[ndups] = $1
12003         dup_num[ndups] = $2
12004         ndups++ 
12005     }
12006     else {
12007         sig_name[$2] = $1
12008         sig_num[$2] = $2
12009     }
12010 }
12011 END { 
12012     if (nsig == 0) {
12013         nsig = maxsig + 1
12014     }
12015     printf("NSIG %d\n", nsig);
12016     for (n = 1; n < nsig; n++) {
12017         if (sig_name[n]) {
12018             printf("%s %d\n", sig_name[n], sig_num[n])
12019         }
12020         else {
12021             printf("NUM%d %d\n", n, n) 
12022         }
12023     }
12024     for (n = 0; n < ndups; n++) {
12025         printf("%s %d\n", dup_name[n], dup_num[n])
12026     }
12027 }
12028 EOP
12029 $cat >signal_cmd <<EOS
12030 $startsh
12031 if $test -s signal.lst; then
12032     echo "Using your existing signal.lst file"
12033         exit 0
12034 fi
12035 xxx="$xxx"
12036 EOS
12037 $cat >>signal_cmd <<'EOS'
12038
12039 set signal
12040 if eval $compile_ok; then
12041         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12042 else
12043         echo "(I can't seem be able to compile the whole test program)" >&4
12044         echo "(I'll try it in little pieces.)" >&4
12045         set signal -DJUST_NSIG
12046         if eval $compile_ok; then
12047                 ./signal$_exe > signal.nsg
12048                 $cat signal.nsg
12049         else
12050                 echo "I can't seem to figure out how many signals you have." >&4
12051                 echo "Guessing 50." >&4
12052                 echo 'NSIG 50' > signal.nsg
12053         fi
12054         : Now look at all the signal names, one at a time.
12055         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12056                 $cat > signal.c <<EOCP
12057 #include <sys/types.h>
12058 #include <signal.h>
12059 #include <stdio.h>
12060 int main() {
12061 printf("$xx %d\n", SIG${xx});
12062 return 0;
12063 }
12064 EOCP
12065                 set signal
12066                 if eval $compile; then
12067                         echo "SIG${xx} found."
12068                         ./signal$_exe  >> signal.ls1
12069                 else
12070                         echo "SIG${xx} NOT found."
12071                 fi
12072         done
12073         if $test -s signal.ls1; then
12074                 $cat signal.nsg signal.ls1 |
12075                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12076         fi
12077
12078 fi
12079 if $test -s signal.lst; then
12080         :
12081 else
12082         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12083         echo 'kill -l' >signal
12084         set X `csh -f <signal`
12085         $rm -f signal
12086         shift
12087         case $# in
12088         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12089         esac
12090         echo $@ | $tr ' ' $trnl | \
12091             $awk '{ printf "%s %d\n", $1, ++s; }
12092                   END { printf "NSIG %d\n", ++s }' >signal.lst
12093 fi
12094 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12095 EOS
12096 chmod a+x signal_cmd
12097 $eunicefix signal_cmd
12098
12099 : generate list of signal names
12100 echo " "
12101 case "$sig_name_init" in
12102 '') doinit=yes ;;
12103 *)  case "$sig_num_init" in
12104     ''|*,*) doinit=yes ;;
12105     esac ;;
12106 esac
12107 case "$doinit" in
12108 yes)
12109         echo "Generating a list of signal names and numbers..." >&4
12110         . ./signal_cmd
12111         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12112         sig_name=`$awk 'BEGIN { printf "ZERO " }
12113                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12114         sig_num=`$awk  'BEGIN { printf "0 " }
12115                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12116         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12117                              !/^NSIG/   { printf "\"%s\", ", $1 }
12118                              END        { printf "0\n" }' signal.lst`
12119         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12120                              !/^NSIG/   { printf "%d, ", $2}
12121                              END        { printf "0\n"}' signal.lst`
12122         ;;
12123 esac
12124 echo "The following $sig_count signals are available:"
12125 echo " "
12126 echo $sig_name | $awk \
12127 'BEGIN { linelen = 0 }
12128 {
12129         for (i = 1; i <= NF; i++) {
12130                 name = "SIG" $i " "
12131                 linelen = linelen + length(name)
12132                 if (linelen > 70) {
12133                         printf "\n"
12134                         linelen = length(name)
12135                 }
12136                 printf "%s", name
12137         }
12138         printf "\n"
12139 }'
12140 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12141
12142 : see what type is used for signed size_t
12143 set ssize_t ssizetype int stdio.h sys/types.h
12144 eval $typedef
12145 dflt="$ssizetype"
12146 $cat > ssize.c <<EOM
12147 #include <stdio.h>
12148 #include <sys/types.h>
12149 #define Size_t $sizetype
12150 #define SSize_t $dflt
12151 int main()
12152 {
12153         if (sizeof(Size_t) == sizeof(SSize_t))
12154                 printf("$dflt\n");
12155         else if (sizeof(Size_t) == sizeof(int))
12156                 printf("int\n");
12157         else 
12158                 printf("long\n");
12159         exit(0);
12160 }
12161 EOM
12162 echo " "
12163 set ssize
12164 if eval $compile_ok && ./ssize > /dev/null; then
12165         ssizetype=`./ssize`
12166         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12167 else
12168         $cat >&4 <<EOM
12169 Help! I can't compile and run the ssize_t test program: please enlighten me!
12170 (This is probably a misconfiguration in your system or libraries, and
12171 you really ought to fix it.  Still, I'll try anyway.)
12172
12173 I need a type that is the same size as $sizetype, but is guaranteed to
12174 be signed.  Common values are ssize_t, int and long.
12175
12176 EOM
12177         rp="What signed type is the same size as $sizetype?"
12178         . ./myread
12179         ssizetype="$ans"
12180 fi
12181 $rm -f ssize ssize.*
12182
12183 : see what type of char stdio uses.
12184 echo " "
12185 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12186         echo "Your stdio uses unsigned chars." >&4
12187         stdchar="unsigned char"
12188 else
12189         echo "Your stdio uses signed chars." >&4
12190         stdchar="char"
12191 fi
12192
12193 : see if time exists
12194 echo " "
12195 if test "X$d_time" = X -o X"$timetype" = X; then
12196     if set time val -f d_time; eval $csym; $val; then
12197                 echo 'time() found.' >&4
12198                 val="$define"
12199                 rp="What is the type returned by time() on this system?"
12200                 set time_t timetype long stdio.h sys/types.h
12201                 eval $typedef_ask
12202     else
12203                 echo 'time() not found, hope that will do.' >&4
12204                 val="$undef"
12205                 timetype='int';
12206     fi
12207     set d_time
12208     eval $setvar
12209 fi
12210
12211 : see what type uids are declared as in the kernel
12212 echo " "
12213 echo "Looking for the type for user ids returned by getuid()."
12214 set uid_t uidtype xxx stdio.h sys/types.h
12215 eval $typedef
12216 case "$uidtype" in
12217 xxx)
12218         xxx=`./findhdr sys/user.h`
12219         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12220         case $1 in
12221         unsigned) dflt="$1 $2" ;;
12222         *) dflt="$1" ;;
12223         esac
12224         ;;
12225 *) dflt="$uidtype";;
12226 esac
12227 case "$uidtype" in
12228 uid_t)  echo "uid_t found." ;;
12229 *)      rp="What is the type for user ids returned by getuid()?"
12230         . ./myread
12231         uidtype="$ans"
12232         ;;
12233 esac
12234
12235 : see if dbm.h is available
12236 : see if dbmclose exists
12237 set dbmclose d_dbmclose
12238 eval $inlibc
12239
12240 case "$d_dbmclose" in
12241 $define)
12242         set dbm.h i_dbm
12243         eval $inhdr
12244         case "$i_dbm" in
12245         $define)
12246                 val="$undef"
12247                 set i_rpcsvcdbm
12248                 eval $setvar
12249                 ;;
12250         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12251                 eval $inhdr
12252                 ;;
12253         esac
12254         ;;
12255 *)      echo "We won't be including <dbm.h>"
12256         val="$undef"
12257         set i_dbm
12258         eval $setvar
12259         val="$undef"
12260         set i_rpcsvcdbm
12261         eval $setvar
12262         ;;
12263 esac
12264
12265 : see if this is a sys/file.h system
12266 val=''
12267 set sys/file.h val
12268 eval $inhdr
12269
12270 : do we need to include sys/file.h ?
12271 case "$val" in
12272 "$define")
12273         echo " "
12274         if $h_sysfile; then
12275                 val="$define"
12276                 echo "We'll be including <sys/file.h>." >&4
12277         else
12278                 val="$undef"
12279                 echo "We won't be including <sys/file.h>." >&4
12280         fi
12281         ;;
12282 *)
12283         h_sysfile=false
12284         ;;
12285 esac
12286 set i_sysfile
12287 eval $setvar
12288
12289 : see if fcntl.h is there
12290 val=''
12291 set fcntl.h val
12292 eval $inhdr
12293
12294 : see if we can include fcntl.h
12295 case "$val" in
12296 "$define")
12297         echo " "
12298         if $h_fcntl; then
12299                 val="$define"
12300                 echo "We'll be including <fcntl.h>." >&4
12301         else
12302                 val="$undef"
12303                 if $h_sysfile; then
12304         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12305                 else
12306                         echo "We won't be including <fcntl.h>." >&4
12307                 fi
12308         fi
12309         ;;
12310 *)
12311         h_fcntl=false
12312         val="$undef"
12313         ;;
12314 esac
12315 set i_fcntl
12316 eval $setvar
12317
12318 : see if locale.h is available
12319 set locale.h i_locale
12320 eval $inhdr
12321
12322 : see if mach cthreads are available
12323 if test "X$usethreads" = "X$define"; then
12324         set mach/cthreads.h i_machcthr
12325         eval $inhdr
12326 else
12327         i_machcthr="$undef"
12328 fi
12329
12330
12331
12332 : see if this is a math.h system
12333 set math.h i_math
12334 eval $inhdr
12335
12336 : see if this is a mntent.h system
12337 set mntent.h i_mntent
12338 eval $inhdr
12339
12340 : see if ndbm.h is available
12341 set ndbm.h t_ndbm
12342 eval $inhdr
12343 case "$t_ndbm" in
12344 $define)
12345         : see if dbm_open exists
12346         set dbm_open d_dbm_open
12347         eval $inlibc
12348         case "$d_dbm_open" in
12349         $undef)
12350                 t_ndbm="$undef"
12351                 echo "We won't be including <ndbm.h>"
12352                 ;;
12353         esac
12354         ;;
12355 esac
12356 val="$t_ndbm"
12357 set i_ndbm
12358 eval $setvar
12359
12360 : see if net/errno.h is available
12361 val=''
12362 set net/errno.h val
12363 eval $inhdr
12364
12365 : Unfortunately, it causes problems on some systems.  Arrgh.
12366 case "$val" in
12367 $define)
12368         cat > try.c <<'EOM'
12369 #include <stdio.h>
12370 #include <errno.h>
12371 #include <net/errno.h>
12372 int func()
12373 {
12374         return ENOTSOCK;
12375 }
12376 EOM
12377         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12378                 echo "We'll be including <net/errno.h>." >&4
12379         else
12380                 echo "We won't be including <net/errno.h>." >&4
12381                 val="$undef"
12382         fi
12383         $rm -f try.* try
12384         ;;
12385 esac
12386 set i_neterrno
12387 eval $setvar
12388
12389 : see if netinet/tcp.h is available
12390 set netinet/tcp.h i_netinettcp
12391 eval $inhdr
12392
12393 : see if this is a poll.h system
12394 set poll.h i_poll
12395 eval $inhdr
12396
12397 : get C preprocessor symbols handy
12398 echo " "
12399 $echo $n "Hmm... $c"
12400 echo $al | $tr ' ' $trnl >Cppsym.know
12401 $cat <<EOSS >Cppsym
12402 $startsh
12403 case "\$1" in
12404 -l) list=true
12405         shift
12406         ;;
12407 esac
12408 unknown=''
12409 case "\$list\$#" in
12410 1|2)
12411         for sym do
12412                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12413                         exit 0
12414                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12415                         :
12416                 else
12417                         unknown="\$unknown \$sym"
12418                 fi
12419         done
12420         set X \$unknown
12421         shift
12422         ;;
12423 esac
12424 case \$# in
12425 0) exit 1;;
12426 esac
12427 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12428 #ifdef \1\\
12429 exit 0; _ _ _ _\1\\      \1\\
12430 #endif\\
12431 /' >Cppsym\$\$
12432 echo "exit 1; _ _ _" >>Cppsym\$\$
12433 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12434 case "\$list" in
12435 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12436 *)
12437         sh Cppsym2\$\$
12438         status=\$?
12439         ;;
12440 esac
12441 $rm -f Cppsym\$\$ Cppsym2\$\$
12442 exit \$status
12443 EOSS
12444 chmod +x Cppsym
12445 $eunicefix Cppsym
12446 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12447
12448 : now check the C compiler for additional symbols
12449 postprocess_cc_v=''
12450 case "$osname" in
12451 aix) postprocess_cc_v="|$tr , ' '" ;;
12452 esac
12453 $cat >ccsym <<EOS
12454 $startsh
12455 $cat >tmp.c <<EOF
12456 extern int foo;
12457 EOF
12458 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12459 do
12460         case "\$i" in
12461         -D*) echo "\$i" | $sed 's/^-D//';;
12462         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12463         esac
12464 done
12465 $rm -f try.c
12466 EOS
12467 postprocess_cc_v=''
12468 chmod +x ccsym
12469 $eunicefix ccsym
12470 ./ccsym > ccsym1.raw
12471 if $test -s ccsym1.raw; then
12472        $sort ccsym1.raw | $uniq >ccsym.raw
12473 else
12474        mv ccsym1.raw ccsym.raw
12475 fi
12476
12477 $awk '/\=/ { print $0; next }
12478         { print $0"=1" }' ccsym.raw >ccsym.list
12479 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12480 $comm -13 ccsym.true ccsym.list >ccsym.own
12481 $comm -12 ccsym.true ccsym.list >ccsym.com
12482 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12483 also=''
12484 if $test -z ccsym.raw; then
12485         echo "Your C compiler doesn't seem to define any symbols!" >&4
12486         echo " "
12487         echo "However, your C preprocessor defines the following symbols:"
12488         $cat Cppsym.true
12489         ccsymbols=''
12490         cppsymbols=`$cat Cppsym.true`
12491         cppsymbols=`echo $cppsymbols`
12492         cppccsymbols="$cppsymbols"
12493 else
12494         if $test -s ccsym.com; then
12495                 echo "Your C compiler and pre-processor define these symbols:"
12496                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12497                 also='also '
12498                 symbols='ones'
12499                 cppccsymbols=`$cat ccsym.com`
12500                 cppccsymbols=`echo $cppccsymbols`
12501                 $test "$silent" || sleep 1
12502         fi
12503         if $test -s ccsym.cpp; then
12504                 $test "$also" && echo " "
12505                 echo "Your C pre-processor ${also}defines the following symbols:"
12506                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12507                 also='further '
12508                 cppsymbols=`$cat ccsym.cpp`
12509                 cppsymbols=`echo $cppsymbols`
12510                 $test "$silent" || sleep 1
12511         fi
12512         if $test -s ccsym.own; then
12513                 $test "$also" && echo " "
12514                 echo "Your C compiler ${also}defines the following cpp symbols:"
12515                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12516                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12517                 ccsymbols=`$cat ccsym.own`
12518                 ccsymbols=`echo $ccsymbols`
12519                 $test "$silent" || sleep 1
12520         fi
12521 fi
12522 $rm -f ccsym*
12523
12524 : see if this is a termio system
12525 val="$undef"
12526 val2="$undef"
12527 val3="$undef"
12528 if $test `./findhdr termios.h`; then
12529         set tcsetattr i_termios
12530         eval $inlibc
12531         val3="$i_termios"
12532 fi
12533 echo " "
12534 case "$val3" in
12535 "$define") echo "You have POSIX termios.h... good!" >&4;;
12536 *) if ./Cppsym pyr; then
12537                 case "`/bin/universe`" in
12538                 ucb) if $test `./findhdr sgtty.h`; then
12539                                 val2="$define"
12540                                 echo "<sgtty.h> found." >&4
12541                         else
12542                                 echo "System is pyramid with BSD universe."
12543                                 echo "<sgtty.h> not found--you could have problems." >&4
12544                         fi;;
12545                 *) if $test `./findhdr termio.h`; then
12546                                 val="$define"
12547                                 echo "<termio.h> found." >&4
12548                         else
12549                                 echo "System is pyramid with USG universe."
12550                                 echo "<termio.h> not found--you could have problems." >&4
12551                         fi;;
12552                 esac
12553         elif ./usg; then
12554                 if $test `./findhdr termio.h`; then
12555                         echo "<termio.h> found." >&4
12556                         val="$define"
12557                 elif $test `./findhdr sgtty.h`; then
12558                         echo "<sgtty.h> found." >&4
12559                         val2="$define"
12560                 else
12561 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12562                 fi
12563         else
12564                 if $test `./findhdr sgtty.h`; then
12565                         echo "<sgtty.h> found." >&4
12566                         val2="$define"
12567                 elif $test `./findhdr termio.h`; then
12568                         echo "<termio.h> found." >&4
12569                         val="$define"
12570                 else
12571 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12572                 fi
12573         fi;;
12574 esac
12575 set i_termio; eval $setvar
12576 val=$val2; set i_sgtty; eval $setvar
12577 val=$val3; set i_termios; eval $setvar
12578
12579 : see if this is a shadow.h system
12580 set shadow.h i_shadow
12581 eval $inhdr
12582
12583 : see if this is a socks.h system
12584 set socks.h i_socks
12585 eval $inhdr
12586
12587 : see if stdarg is available
12588 echo " "
12589 if $test `./findhdr stdarg.h`; then
12590         echo "<stdarg.h> found." >&4
12591         valstd="$define"
12592 else
12593         echo "<stdarg.h> NOT found." >&4
12594         valstd="$undef"
12595 fi
12596
12597 : see if varags is available
12598 echo " "
12599 if $test `./findhdr varargs.h`; then
12600         echo "<varargs.h> found." >&4
12601 else
12602         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12603 fi
12604
12605 : set up the varargs testing programs
12606 $cat > varargs.c <<EOP
12607 #ifdef I_STDARG
12608 #include <stdarg.h>
12609 #endif
12610 #ifdef I_VARARGS
12611 #include <varargs.h>
12612 #endif
12613
12614 #ifdef I_STDARG
12615 int f(char *p, ...)
12616 #else
12617 int f(va_alist)
12618 va_dcl
12619 #endif
12620 {
12621         va_list ap;
12622 #ifndef I_STDARG
12623         char *p;
12624 #endif
12625 #ifdef I_STDARG
12626         va_start(ap,p);
12627 #else
12628         va_start(ap);
12629         p = va_arg(ap, char *);
12630 #endif
12631         va_end(ap);
12632 }
12633 EOP
12634 $cat > varargs <<EOP
12635 $startsh
12636 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12637         echo "true"
12638 else
12639         echo "false"
12640 fi
12641 $rm -f varargs$_o
12642 EOP
12643 chmod +x varargs
12644
12645 : now check which varargs header should be included
12646 echo " "
12647 i_varhdr=''
12648 case "$valstd" in
12649 "$define")
12650         if `./varargs I_STDARG`; then
12651                 val='stdarg.h'
12652         elif `./varargs I_VARARGS`; then
12653                 val='varargs.h'
12654         fi
12655         ;;
12656 *)
12657         if `./varargs I_VARARGS`; then
12658                 val='varargs.h'
12659         fi
12660         ;;
12661 esac
12662 case "$val" in
12663 '')
12664 echo "I could not find the definition for va_dcl... You have problems..." >&4
12665         val="$undef"; set i_stdarg; eval $setvar
12666         val="$undef"; set i_varargs; eval $setvar
12667         ;;
12668 *) 
12669         set i_varhdr
12670         eval $setvar
12671         case "$i_varhdr" in
12672         stdarg.h)
12673                 val="$define"; set i_stdarg; eval $setvar
12674                 val="$undef"; set i_varargs; eval $setvar
12675                 ;;
12676         varargs.h)
12677                 val="$undef"; set i_stdarg; eval $setvar
12678                 val="$define"; set i_varargs; eval $setvar
12679                 ;;
12680         esac
12681         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12682 esac
12683 $rm -f varargs*
12684
12685 : see if stddef is available
12686 set stddef.h i_stddef
12687 eval $inhdr
12688
12689 : see if sys/access.h is available
12690 set sys/access.h i_sysaccess
12691 eval $inhdr
12692
12693 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12694 set sys/filio.h i_sysfilio
12695 eval $inhdr
12696 echo " "
12697 if $test `./findhdr sys/ioctl.h`; then
12698         val="$define"
12699         echo '<sys/ioctl.h> found.' >&4
12700 else
12701         val="$undef"
12702         if $test $i_sysfilio = "$define"; then
12703             echo '<sys/ioctl.h> NOT found.' >&4
12704         else
12705                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12706                 $test $i_termio = "$define" && xxx="termio.h"
12707                 $test $i_termios = "$define" && xxx="termios.h"
12708 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12709         fi
12710 fi
12711 set i_sysioctl
12712 eval $setvar
12713
12714 : see if sys/resource.h has to be included
12715 set sys/resource.h i_sysresrc
12716 eval $inhdr
12717
12718 : see if sys/security.h is available
12719 set sys/security.h i_syssecrt
12720 eval $inhdr
12721
12722 : see if this is a sys/statvfs.h system
12723 set sys/statvfs.h i_sysstatvfs
12724 eval $inhdr
12725
12726 : see if this is a sys/un.h system
12727 set sys/un.h i_sysun
12728 eval $inhdr
12729
12730 : see if this is a syswait system
12731 set sys/wait.h i_syswait
12732 eval $inhdr
12733
12734 : see if this is an utime system
12735 set utime.h i_utime
12736 eval $inhdr
12737
12738 : see if this is a values.h system
12739 set values.h i_values
12740 eval $inhdr
12741
12742 : see if this is a vfork system
12743 case "$d_vfork" in
12744 "$define")
12745         set vfork.h i_vfork
12746         eval $inhdr
12747         ;;
12748 *)
12749         i_vfork="$undef"
12750         ;;
12751 esac
12752
12753 : see if gdbm.h is available
12754 set gdbm.h t_gdbm
12755 eval $inhdr
12756 case "$t_gdbm" in
12757 $define)
12758         : see if gdbm_open exists
12759         set gdbm_open d_gdbm_open
12760         eval $inlibc
12761         case "$d_gdbm_open" in
12762         $undef)
12763                 t_gdbm="$undef"
12764                 echo "We won't be including <gdbm.h>"
12765                 ;;
12766         esac
12767         ;;
12768 esac
12769 val="$t_gdbm"
12770 set i_gdbm
12771 eval $setvar
12772
12773 echo " "
12774 echo "Looking for extensions..." >&4
12775 : If we are using the old config.sh, known_extensions may contain
12776 : old or inaccurate or duplicate values.
12777 known_extensions=''
12778 nonxs_extensions=''
12779 : We do not use find because it might not be available.
12780 : We do not just use MANIFEST because the user may have dropped
12781 : some additional extensions into the source tree and expect them
12782 : to be built.
12783
12784 : Function to recursively find available extensions, ignoring DynaLoader
12785 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
12786 find_extensions='
12787     for xxx in *; do
12788        case "$xxx" in
12789            DynaLoader|dynaload) ;;
12790            *)
12791            if $test -f $xxx/$xxx.xs; then
12792                known_extensions="$known_extensions $1$xxx";
12793            elif $test -f $xxx/Makefile.PL; then
12794                nonxs_extensions="$nonxs_extensions $1$xxx";
12795            else
12796                if $test -d $xxx -a $# -lt 10; then
12797                    set $1$xxx/ $*;
12798                    cd $xxx;
12799                    eval $find_extensions;
12800                    cd ..;
12801                    shift;
12802                fi;
12803            fi
12804            ;;
12805        esac;
12806     done'
12807 tdir=`pwd`
12808 cd $rsrc/ext
12809 set X
12810 shift
12811 eval $find_extensions
12812 set X $nonxs_extensions
12813 shift
12814 nonxs_extensions="$*"
12815 set X $known_extensions
12816 shift
12817 known_extensions="$*"
12818 cd $tdir
12819
12820 : Now see which are supported on this system.
12821 avail_ext=''
12822 for xxx in $known_extensions ; do
12823         case "$xxx" in
12824         DB_File|db_file)
12825                 case "$i_db" in
12826                 $define) avail_ext="$avail_ext $xxx" ;;
12827                 esac
12828                 ;;
12829         GDBM_File|gdbm_fil)
12830                 case "$i_gdbm" in 
12831                 $define) avail_ext="$avail_ext $xxx" ;;
12832                 esac
12833                 ;;
12834         NDBM_File|ndbm_fil)
12835                 case "$i_ndbm" in
12836                 $define) avail_ext="$avail_ext $xxx" ;;
12837                 esac
12838                 ;;
12839         ODBM_File|odbm_fil) 
12840                 case "${i_dbm}${i_rpcsvcdbm}" in
12841                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12842                 esac
12843                 ;;
12844         POSIX|posix)
12845                 case "$useposix" in
12846                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12847                 esac
12848                 ;;
12849         Opcode|opcode)
12850                 case "$useopcode" in
12851                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12852                 esac
12853                 ;;
12854         Socket|socket)
12855                 case "$d_socket" in 
12856                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12857                 esac
12858                 ;;
12859         Thread|thread)
12860                 case "$usethreads" in 
12861                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12862                 esac
12863                 ;;
12864         IPC/SysV|ipc/sysv)
12865                 : XXX Do we need a useipcsysv variable here
12866                 case "${d_msg}${d_sem}${d_shm}" in 
12867                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12868                 esac
12869                 ;;
12870         *)      avail_ext="$avail_ext $xxx"
12871                 ;;
12872         esac
12873 done
12874
12875 set X $avail_ext
12876 shift
12877 avail_ext="$*"
12878
12879 : Now see which nonxs extensions are supported on this system.
12880 : For now assume all are.
12881 nonxs_ext=''
12882 for xxx in $nonxs_extensions ; do
12883         case "$xxx" in
12884         *)      nonxs_ext="$nonxs_ext $xxx"
12885                 ;;
12886         esac
12887 done
12888
12889 set X $nonxs_ext
12890 shift
12891 nonxs_ext="$*"
12892
12893 case $usedl in
12894 $define)
12895         $cat <<EOM
12896 A number of extensions are supplied with $package.  You may choose to
12897 compile these extensions for dynamic loading (the default), compile
12898 them into the $package executable (static loading), or not include
12899 them at all.  Answer "none" to include no extensions.
12900 Note that DynaLoader is always built and need not be mentioned here.
12901
12902 EOM
12903         case "$dynamic_ext" in
12904         '') dflt="$avail_ext" ;;
12905         *)      dflt="$dynamic_ext"
12906                 # Perhaps we are reusing an old out-of-date config.sh.
12907                 case "$hint" in
12908                 previous)
12909                         if test X"$dynamic_ext" != X"$avail_ext"; then
12910                                 $cat <<EOM
12911 NOTICE:  Your previous config.sh list may be incorrect. 
12912 The extensions now available to you are 
12913         ${avail_ext}
12914 but the default list from your previous config.sh is
12915         ${dynamic_ext} 
12916
12917 EOM
12918                         fi
12919                         ;;
12920                 esac
12921                 ;;
12922         esac
12923         case "$dflt" in
12924         '')     dflt=none;;
12925         esac
12926         rp="What extensions do you wish to load dynamically?"
12927         . ./myread
12928         case "$ans" in
12929         none) dynamic_ext=' ' ;;
12930         *) dynamic_ext="$ans" ;;
12931         esac
12932
12933         case "$static_ext" in
12934         '')
12935                 : Exclude those already listed in dynamic linking
12936                 dflt=''
12937                 for xxx in $avail_ext; do
12938                         case " $dynamic_ext " in
12939                         *" $xxx "*) ;;
12940                         *) dflt="$dflt $xxx" ;;
12941                         esac
12942                 done
12943                 set X $dflt
12944                 shift
12945                 dflt="$*"
12946                 ;;
12947         *)  dflt="$static_ext" 
12948                 ;;
12949         esac
12950
12951         case "$dflt" in
12952         '')     dflt=none;;
12953         esac
12954         rp="What extensions do you wish to load statically?"
12955         . ./myread
12956         case "$ans" in
12957         none) static_ext=' ' ;;
12958         *) static_ext="$ans" ;;
12959         esac
12960         ;;
12961 *)
12962         $cat <<EOM
12963 A number of extensions are supplied with $package.  Answer "none" 
12964 to include no extensions. 
12965 Note that DynaLoader is always built and need not be mentioned here.
12966
12967 EOM
12968         case "$static_ext" in
12969         '') dflt="$avail_ext" ;;
12970         *)      dflt="$static_ext"
12971                 # Perhaps we are reusing an old out-of-date config.sh.
12972                 case "$hint" in
12973                 previous)
12974                         if test X"$static_ext" != X"$avail_ext"; then
12975                                 $cat <<EOM
12976 NOTICE:  Your previous config.sh list may be incorrect. 
12977 The extensions now available to you are 
12978         ${avail_ext}
12979 but the default list from your previous config.sh is
12980         ${static_ext} 
12981
12982 EOM
12983                         fi
12984                         ;;
12985                 esac
12986                 ;;
12987         esac
12988         : Exclude those that are not xs extensions
12989         case "$dflt" in
12990         '')     dflt=none;;
12991         esac
12992         rp="What extensions do you wish to include?"
12993         . ./myread
12994         case "$ans" in
12995         none) static_ext=' ' ;;
12996         *) static_ext="$ans" ;;
12997         esac
12998         ;;
12999 esac
13000
13001 set X $dynamic_ext $static_ext $nonxs_ext
13002 shift
13003 extensions="$*"
13004
13005 : Remove build directory name from cppstdin so it can be used from
13006 : either the present location or the final installed location.
13007 echo " "
13008 : Get out of the UU directory to get correct path name.
13009 cd ..
13010 case "$cppstdin" in
13011 `pwd`/cppstdin)
13012         echo "Stripping down cppstdin path name"
13013         cppstdin=cppstdin
13014         ;;
13015 esac
13016 cd UU
13017
13018 : end of configuration questions
13019 echo " "
13020 echo "End of configuration questions."
13021 echo " "
13022
13023 : back to where it started
13024 if test -d ../UU; then
13025         cd ..
13026 fi
13027
13028 : configuration may be patched via a 'config.over' file
13029 if $test -f config.over; then
13030         echo " "
13031         dflt=y
13032         rp='I see a config.over file.  Do you wish to load it?'
13033         . UU/myread
13034         case "$ans" in
13035         n*) echo "OK, I'll ignore it.";;
13036         *)      . ./config.over
13037                 echo "Configuration override changes have been loaded."
13038                 ;;
13039         esac
13040 fi
13041
13042 : in case they want portability, strip down executable paths
13043 case "$d_portable" in
13044 "$define")
13045         echo " "
13046         echo "Stripping down executable paths..." >&4
13047         for file in $loclist $trylist; do
13048                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
13049                         eval $file="\$file"
13050                 fi
13051         done
13052         ;;
13053 esac
13054
13055 : create config.sh file
13056 echo " "
13057 echo "Creating config.sh..." >&4
13058 $spitshell <<EOT >config.sh
13059 $startsh
13060 #
13061 # This file was produced by running the Configure script. It holds all the
13062 # definitions figured out by Configure. Should you modify one of these values,
13063 # do not forget to propagate your changes by running "Configure -der". You may
13064 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13065 #
13066
13067 # Package name      : $package
13068 # Source directory  : $src
13069 # Configuration time: $cf_time
13070 # Configured by     : $cf_by
13071 # Target system     : $myuname
13072
13073 Author='$Author'
13074 Date='$Date'
13075 Header='$Header'
13076 Id='$Id'
13077 Locker='$Locker'
13078 Log='$Log'
13079 Mcc='$Mcc'
13080 RCSfile='$RCSfile'
13081 Revision='$Revision'
13082 Source='$Source'
13083 State='$State'
13084 _a='$_a'
13085 _exe='$_exe'
13086 _o='$_o'
13087 afs='$afs'
13088 alignbytes='$alignbytes'
13089 ansi2knr='$ansi2knr'
13090 aphostname='$aphostname'
13091 apiversion='$apiversion'
13092 ar='$ar'
13093 archlib='$archlib'
13094 archlibexp='$archlibexp'
13095 archname64='$archname64'
13096 archname='$archname'
13097 archobjs='$archobjs'
13098 awk='$awk'
13099 baserev='$baserev'
13100 bash='$bash'
13101 bin='$bin'
13102 bincompat5005='$bincompat5005'
13103 binexp='$binexp'
13104 bison='$bison'
13105 byacc='$byacc'
13106 byteorder='$byteorder'
13107 c='$c'
13108 castflags='$castflags'
13109 cat='$cat'
13110 cc='$cc'
13111 cccdlflags='$cccdlflags'
13112 ccdlflags='$ccdlflags'
13113 ccflags='$ccflags'
13114 ccsymbols='$ccsymbols'
13115 cf_by='$cf_by'
13116 cf_email='$cf_email'
13117 cf_time='$cf_time'
13118 chgrp='$chgrp'
13119 chmod='$chmod'
13120 chown='$chown'
13121 clocktype='$clocktype'
13122 comm='$comm'
13123 compress='$compress'
13124 contains='$contains'
13125 cp='$cp'
13126 cpio='$cpio'
13127 cpp='$cpp'
13128 cpp_stuff='$cpp_stuff'
13129 cppccsymbols='$cppccsymbols'
13130 cppflags='$cppflags'
13131 cpplast='$cpplast'
13132 cppminus='$cppminus'
13133 cpprun='$cpprun'
13134 cppstdin='$cppstdin'
13135 cppsymbols='$cppsymbols'
13136 crosscompile='$crosscompile'
13137 cryptlib='$cryptlib'
13138 csh='$csh'
13139 d_Gconvert='$d_Gconvert'
13140 d_access='$d_access'
13141 d_accessx='$d_accessx'
13142 d_alarm='$d_alarm'
13143 d_archlib='$d_archlib'
13144 d_attribut='$d_attribut'
13145 d_bcmp='$d_bcmp'
13146 d_bcopy='$d_bcopy'
13147 d_bincompat5005='$d_bincompat5005'
13148 d_bsd='$d_bsd'
13149 d_bsdgetpgrp='$d_bsdgetpgrp'
13150 d_bsdsetpgrp='$d_bsdsetpgrp'
13151 d_bzero='$d_bzero'
13152 d_casti32='$d_casti32'
13153 d_castneg='$d_castneg'
13154 d_charvspr='$d_charvspr'
13155 d_chown='$d_chown'
13156 d_chroot='$d_chroot'
13157 d_chsize='$d_chsize'
13158 d_closedir='$d_closedir'
13159 d_cmsghdr_s='$d_cmsghdr_s'
13160 d_const='$d_const'
13161 d_crypt='$d_crypt'
13162 d_csh='$d_csh'
13163 d_cuserid='$d_cuserid'
13164 d_dbl_dig='$d_dbl_dig'
13165 d_dbmclose64='$d_dbmclose64'
13166 d_dbminit64='$d_dbminit64'
13167 d_delete64='$d_delete64'
13168 d_difftime='$d_difftime'
13169 d_dirent64_s='$d_dirent64_s'
13170 d_dirnamlen='$d_dirnamlen'
13171 d_dlerror='$d_dlerror'
13172 d_dlopen='$d_dlopen'
13173 d_dlsymun='$d_dlsymun'
13174 d_dosuid='$d_dosuid'
13175 d_drand48proto='$d_drand48proto'
13176 d_dup2='$d_dup2'
13177 d_eaccess='$d_eaccess'
13178 d_endgrent='$d_endgrent'
13179 d_endhent='$d_endhent'
13180 d_endnent='$d_endnent'
13181 d_endpent='$d_endpent'
13182 d_endpwent='$d_endpwent'
13183 d_endsent='$d_endsent'
13184 d_endspent='$d_endspent'
13185 d_eofnblk='$d_eofnblk'
13186 d_eunice='$d_eunice'
13187 d_fchmod='$d_fchmod'
13188 d_fchown='$d_fchown'
13189 d_fcntl='$d_fcntl'
13190 d_fd_macros='$d_fd_macros'
13191 d_fd_set='$d_fd_set'
13192 d_fds_bits='$d_fds_bits'
13193 d_fetch64='$d_fetch64'
13194 d_fgetpos64='$d_fgetpos64'
13195 d_fgetpos='$d_fgetpos'
13196 d_firstkey64='$d_firstkey64'
13197 d_flexfnam='$d_flexfnam'
13198 d_flock64_s='$d_flock64_s'
13199 d_flock='$d_flock'
13200 d_fopen64='$d_fopen64'
13201 d_fork='$d_fork'
13202 d_fpathconf='$d_fpathconf'
13203 d_freopen64='$d_freopen64'
13204 d_fseek64='$d_fseek64'
13205 d_fseeko64='$d_fseeko64'
13206 d_fseeko='$d_fseeko'
13207 d_fsetpos64='$d_fsetpos64'
13208 d_fsetpos='$d_fsetpos'
13209 d_fstat64='$d_fstat64'
13210 d_fstatfs='$d_fstatfs'
13211 d_fstatvfs='$d_fstatvfs'
13212 d_ftell64='$d_ftell64'
13213 d_ftello64='$d_ftello64'
13214 d_ftello='$d_ftello'
13215 d_ftime='$d_ftime'
13216 d_ftruncate64='$d_ftruncate64'
13217 d_getgrent='$d_getgrent'
13218 d_getgrps='$d_getgrps'
13219 d_gethbyaddr='$d_gethbyaddr'
13220 d_gethbyname='$d_gethbyname'
13221 d_gethent='$d_gethent'
13222 d_gethname='$d_gethname'
13223 d_gethostprotos='$d_gethostprotos'
13224 d_getlogin='$d_getlogin'
13225 d_getmntent='$d_getmntent'
13226 d_getnbyaddr='$d_getnbyaddr'
13227 d_getnbyname='$d_getnbyname'
13228 d_getnent='$d_getnent'
13229 d_getnetprotos='$d_getnetprotos'
13230 d_getpbyname='$d_getpbyname'
13231 d_getpbynumber='$d_getpbynumber'
13232 d_getpent='$d_getpent'
13233 d_getpgid='$d_getpgid'
13234 d_getpgrp2='$d_getpgrp2'
13235 d_getpgrp='$d_getpgrp'
13236 d_getppid='$d_getppid'
13237 d_getprior='$d_getprior'
13238 d_getprotoprotos='$d_getprotoprotos'
13239 d_getpwent='$d_getpwent'
13240 d_getsbyname='$d_getsbyname'
13241 d_getsbyport='$d_getsbyport'
13242 d_getsent='$d_getsent'
13243 d_getservprotos='$d_getservprotos'
13244 d_getspent='$d_getspent'
13245 d_getspnam='$d_getspnam'
13246 d_gettimeod='$d_gettimeod'
13247 d_gnulibc='$d_gnulibc'
13248 d_grpasswd='$d_grpasswd'
13249 d_hasmntopt='$d_hasmntopt'
13250 d_htonl='$d_htonl'
13251 d_index='$d_index'
13252 d_inetaton='$d_inetaton'
13253 d_ino64_t='$d_ino64_t'
13254 d_int64t='$d_int64t'
13255 d_iovec_s='$d_iovec_s'
13256 d_isascii='$d_isascii'
13257 d_killpg='$d_killpg'
13258 d_lchown='$d_lchown'
13259 d_link='$d_link'
13260 d_llseek='$d_llseek'
13261 d_locconv='$d_locconv'
13262 d_lockf64='$d_lockf64'
13263 d_lockf='$d_lockf'
13264 d_longdbl='$d_longdbl'
13265 d_longlong='$d_longlong'
13266 d_lseek64='$d_lseek64'
13267 d_lstat64='$d_lstat64'
13268 d_lstat='$d_lstat'
13269 d_madvise='$d_madvise'
13270 d_mblen='$d_mblen'
13271 d_mbstowcs='$d_mbstowcs'
13272 d_mbtowc='$d_mbtowc'
13273 d_memchr='$d_memchr'
13274 d_memcmp='$d_memcmp'
13275 d_memcpy='$d_memcpy'
13276 d_memmove='$d_memmove'
13277 d_memset='$d_memset'
13278 d_mkdir='$d_mkdir'
13279 d_mkfifo='$d_mkfifo'
13280 d_mktime='$d_mktime'
13281 d_mmap='$d_mmap'
13282 d_mprotect='$d_mprotect'
13283 d_msg='$d_msg'
13284 d_msg_ctrunc='$d_msg_ctrunc'
13285 d_msg_dontroute='$d_msg_dontroute'
13286 d_msg_oob='$d_msg_oob'
13287 d_msg_peek='$d_msg_peek'
13288 d_msg_proxy='$d_msg_proxy'
13289 d_msgctl='$d_msgctl'
13290 d_msgget='$d_msgget'
13291 d_msghdr_s='$d_msghdr_s'
13292 d_msgrcv='$d_msgrcv'
13293 d_msgsnd='$d_msgsnd'
13294 d_msync='$d_msync'
13295 d_munmap='$d_munmap'
13296 d_mymalloc='$d_mymalloc'
13297 d_nextkey64='$d_nextkey64'
13298 d_nice='$d_nice'
13299 d_off64_t='$d_off64_t'
13300 d_offset_t='$d_offset_t'
13301 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13302 d_oldpthreads='$d_oldpthreads'
13303 d_oldsock='$d_oldsock'
13304 d_open3='$d_open3'
13305 d_open64='$d_open64'
13306 d_opendir64='$d_opendir64'
13307 d_pathconf='$d_pathconf'
13308 d_pause='$d_pause'
13309 d_phostname='$d_phostname'
13310 d_pipe='$d_pipe'
13311 d_poll='$d_poll'
13312 d_portable='$d_portable'
13313 d_pthread_yield='$d_pthread_yield'
13314 d_pwage='$d_pwage'
13315 d_pwchange='$d_pwchange'
13316 d_pwclass='$d_pwclass'
13317 d_pwcomment='$d_pwcomment'
13318 d_pwexpire='$d_pwexpire'
13319 d_pwgecos='$d_pwgecos'
13320 d_pwpasswd='$d_pwpasswd'
13321 d_pwquota='$d_pwquota'
13322 d_readdir64='$d_readdir64'
13323 d_readdir='$d_readdir'
13324 d_readlink='$d_readlink'
13325 d_readv='$d_readv'
13326 d_recvmsg='$d_recvmsg'
13327 d_rename='$d_rename'
13328 d_rewinddir='$d_rewinddir'
13329 d_rmdir='$d_rmdir'
13330 d_safebcpy='$d_safebcpy'
13331 d_safemcpy='$d_safemcpy'
13332 d_sanemcmp='$d_sanemcmp'
13333 d_sched_yield='$d_sched_yield'
13334 d_scm_rights='$d_scm_rights'
13335 d_seekdir64='$d_seekdir64'
13336 d_seekdir='$d_seekdir'
13337 d_select='$d_select'
13338 d_sem='$d_sem'
13339 d_semctl='$d_semctl'
13340 d_semctl_semid_ds='$d_semctl_semid_ds'
13341 d_semctl_semun='$d_semctl_semun'
13342 d_semget='$d_semget'
13343 d_semop='$d_semop'
13344 d_sendmsg='$d_sendmsg'
13345 d_setegid='$d_setegid'
13346 d_seteuid='$d_seteuid'
13347 d_setgrent='$d_setgrent'
13348 d_setgrps='$d_setgrps'
13349 d_sethent='$d_sethent'
13350 d_setlinebuf='$d_setlinebuf'
13351 d_setlocale='$d_setlocale'
13352 d_setnent='$d_setnent'
13353 d_setpent='$d_setpent'
13354 d_setpgid='$d_setpgid'
13355 d_setpgrp2='$d_setpgrp2'
13356 d_setpgrp='$d_setpgrp'
13357 d_setprior='$d_setprior'
13358 d_setpwent='$d_setpwent'
13359 d_setregid='$d_setregid'
13360 d_setresgid='$d_setresgid'
13361 d_setresuid='$d_setresuid'
13362 d_setreuid='$d_setreuid'
13363 d_setrgid='$d_setrgid'
13364 d_setruid='$d_setruid'
13365 d_setsent='$d_setsent'
13366 d_setsid='$d_setsid'
13367 d_setspent='$d_setspent'
13368 d_setvbuf='$d_setvbuf'
13369 d_sfio='$d_sfio'
13370 d_shm='$d_shm'
13371 d_shmat='$d_shmat'
13372 d_shmatprototype='$d_shmatprototype'
13373 d_shmctl='$d_shmctl'
13374 d_shmdt='$d_shmdt'
13375 d_shmget='$d_shmget'
13376 d_sigaction='$d_sigaction'
13377 d_sigsetjmp='$d_sigsetjmp'
13378 d_socket='$d_socket'
13379 d_sockpair='$d_sockpair'
13380 d_stat64='$d_stat64'
13381 d_statblks='$d_statblks'
13382 d_statfs='$d_statfs'
13383 d_statfsflags='$d_statfsflags'
13384 d_statvfs='$d_statvfs'
13385 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13386 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13387 d_stdio_stream_array='$d_stdio_stream_array'
13388 d_stdiobase='$d_stdiobase'
13389 d_stdstdio='$d_stdstdio'
13390 d_store64='$d_store64'
13391 d_strchr='$d_strchr'
13392 d_strcoll='$d_strcoll'
13393 d_strctcpy='$d_strctcpy'
13394 d_strerrm='$d_strerrm'
13395 d_strerror='$d_strerror'
13396 d_strtod='$d_strtod'
13397 d_strtol='$d_strtol'
13398 d_strtoul='$d_strtoul'
13399 d_strxfrm='$d_strxfrm'
13400 d_suidsafe='$d_suidsafe'
13401 d_symlink='$d_symlink'
13402 d_syscall='$d_syscall'
13403 d_sysconf='$d_sysconf'
13404 d_sysernlst='$d_sysernlst'
13405 d_syserrlst='$d_syserrlst'
13406 d_system='$d_system'
13407 d_tcgetpgrp='$d_tcgetpgrp'
13408 d_tcsetpgrp='$d_tcsetpgrp'
13409 d_telldir64='$d_telldir64'
13410 d_telldir='$d_telldir'
13411 d_telldirproto='$d_telldirproto'
13412 d_time='$d_time'
13413 d_times='$d_times'
13414 d_tmpfile64='$d_tmpfile64'
13415 d_truncate64='$d_truncate64'
13416 d_truncate='$d_truncate'
13417 d_tzname='$d_tzname'
13418 d_umask='$d_umask'
13419 d_uname='$d_uname'
13420 d_union_semun='$d_union_semun'
13421 d_vendorlib='$d_vendorlib'
13422 d_vfork='$d_vfork'
13423 d_void_closedir='$d_void_closedir'
13424 d_voidsig='$d_voidsig'
13425 d_voidtty='$d_voidtty'
13426 d_volatile='$d_volatile'
13427 d_vprintf='$d_vprintf'
13428 d_wait4='$d_wait4'
13429 d_waitpid='$d_waitpid'
13430 d_wcstombs='$d_wcstombs'
13431 d_wctomb='$d_wctomb'
13432 d_writev='$d_writev'
13433 d_xenix='$d_xenix'
13434 date='$date'
13435 db_hashtype='$db_hashtype'
13436 db_prefixtype='$db_prefixtype'
13437 defvoidused='$defvoidused'
13438 direntrytype='$direntrytype'
13439 dlext='$dlext'
13440 dlsrc='$dlsrc'
13441 doublesize='$doublesize'
13442 drand01='$drand01'
13443 dynamic_ext='$dynamic_ext'
13444 eagain='$eagain'
13445 ebcdic='$ebcdic'
13446 echo='$echo'
13447 egrep='$egrep'
13448 emacs='$emacs'
13449 eunicefix='$eunicefix'
13450 exe_ext='$exe_ext'
13451 expr='$expr'
13452 extensions='$extensions'
13453 fflushNULL='$fflushNULL'
13454 fflushall='$fflushall'
13455 find='$find'
13456 firstmakefile='$firstmakefile'
13457 flex='$flex'
13458 fpostype='$fpostype'
13459 freetype='$freetype'
13460 full_ar='$full_ar'
13461 full_csh='$full_csh'
13462 full_sed='$full_sed'
13463 gccversion='$gccversion'
13464 gidtype='$gidtype'
13465 glibpth='$glibpth'
13466 grep='$grep'
13467 groupcat='$groupcat'
13468 groupstype='$groupstype'
13469 gzip='$gzip'
13470 h_fcntl='$h_fcntl'
13471 h_sysfile='$h_sysfile'
13472 hint='$hint'
13473 hostcat='$hostcat'
13474 huge='$huge'
13475 i_arpainet='$i_arpainet'
13476 i_bsdioctl='$i_bsdioctl'
13477 i_db='$i_db'
13478 i_dbm='$i_dbm'
13479 i_dirent='$i_dirent'
13480 i_dld='$i_dld'
13481 i_dlfcn='$i_dlfcn'
13482 i_fcntl='$i_fcntl'
13483 i_float='$i_float'
13484 i_gdbm='$i_gdbm'
13485 i_grp='$i_grp'
13486 i_inttypes='$i_inttypes'
13487 i_limits='$i_limits'
13488 i_locale='$i_locale'
13489 i_machcthr='$i_machcthr'
13490 i_malloc='$i_malloc'
13491 i_math='$i_math'
13492 i_memory='$i_memory'
13493 i_mntent='$i_mntent'
13494 i_ndbm='$i_ndbm'
13495 i_netdb='$i_netdb'
13496 i_neterrno='$i_neterrno'
13497 i_netinettcp='$i_netinettcp'
13498 i_niin='$i_niin'
13499 i_poll='$i_poll'
13500 i_pthread='$i_pthread'
13501 i_pwd='$i_pwd'
13502 i_rpcsvcdbm='$i_rpcsvcdbm'
13503 i_sfio='$i_sfio'
13504 i_sgtty='$i_sgtty'
13505 i_shadow='$i_shadow'
13506 i_socks='$i_socks'
13507 i_stdarg='$i_stdarg'
13508 i_stddef='$i_stddef'
13509 i_stdlib='$i_stdlib'
13510 i_string='$i_string'
13511 i_sysaccess='$i_sysaccess'
13512 i_sysdir='$i_sysdir'
13513 i_sysfile='$i_sysfile'
13514 i_sysfilio='$i_sysfilio'
13515 i_sysin='$i_sysin'
13516 i_sysioctl='$i_sysioctl'
13517 i_sysmman='$i_sysmman'
13518 i_sysmount='$i_sysmount'
13519 i_sysndir='$i_sysndir'
13520 i_sysparam='$i_sysparam'
13521 i_sysresrc='$i_sysresrc'
13522 i_syssecrt='$i_syssecrt'
13523 i_sysselct='$i_sysselct'
13524 i_syssockio='$i_syssockio'
13525 i_sysstat='$i_sysstat'
13526 i_sysstatvfs='$i_sysstatvfs'
13527 i_systime='$i_systime'
13528 i_systimek='$i_systimek'
13529 i_systimes='$i_systimes'
13530 i_systypes='$i_systypes'
13531 i_sysuio='$i_sysuio'
13532 i_sysun='$i_sysun'
13533 i_syswait='$i_syswait'
13534 i_termio='$i_termio'
13535 i_termios='$i_termios'
13536 i_time='$i_time'
13537 i_unistd='$i_unistd'
13538 i_utime='$i_utime'
13539 i_values='$i_values'
13540 i_varargs='$i_varargs'
13541 i_varhdr='$i_varhdr'
13542 i_vfork='$i_vfork'
13543 ignore_versioned_solibs='$ignore_versioned_solibs'
13544 incpath='$incpath'
13545 inews='$inews'
13546 installarchlib='$installarchlib'
13547 installbin='$installbin'
13548 installman1dir='$installman1dir'
13549 installman3dir='$installman3dir'
13550 installprefix='$installprefix'
13551 installprefixexp='$installprefixexp'
13552 installprivlib='$installprivlib'
13553 installscript='$installscript'
13554 installsitearch='$installsitearch'
13555 installsitelib='$installsitelib'
13556 installstyle='$installstyle'
13557 installusrbinperl='$installusrbinperl'
13558 installvendorlib='$installvendorlib'
13559 intsize='$intsize'
13560 known_extensions='$known_extensions'
13561 ksh='$ksh'
13562 large='$large'
13563 ld='$ld'
13564 lddlflags='$lddlflags'
13565 ldflags='$ldflags'
13566 ldlibpthname='$ldlibpthname'
13567 less='$less'
13568 lib_ext='$lib_ext'
13569 libc='$libc'
13570 libperl='$libperl'
13571 libpth='$libpth'
13572 libs='$libs'
13573 libswanted='$libswanted'
13574 line='$line'
13575 lint='$lint'
13576 lkflags='$lkflags'
13577 ln='$ln'
13578 lns='$lns'
13579 locincpth='$locincpth'
13580 loclibpth='$loclibpth'
13581 longdblsize='$longdblsize'
13582 longlongsize='$longlongsize'
13583 longsize='$longsize'
13584 lp='$lp'
13585 lpr='$lpr'
13586 ls='$ls'
13587 lseeksize='$lseeksize'
13588 lseektype='$lseektype'
13589 mail='$mail'
13590 mailx='$mailx'
13591 make='$make'
13592 make_set_make='$make_set_make'
13593 mallocobj='$mallocobj'
13594 mallocsrc='$mallocsrc'
13595 malloctype='$malloctype'
13596 man1dir='$man1dir'
13597 man1direxp='$man1direxp'
13598 man1ext='$man1ext'
13599 man3dir='$man3dir'
13600 man3direxp='$man3direxp'
13601 man3ext='$man3ext'
13602 medium='$medium'
13603 mips='$mips'
13604 mips_type='$mips_type'
13605 mkdir='$mkdir'
13606 mmaptype='$mmaptype'
13607 models='$models'
13608 modetype='$modetype'
13609 more='$more'
13610 multiarch='$multiarch'
13611 mv='$mv'
13612 myarchname='$myarchname'
13613 mydomain='$mydomain'
13614 myhostname='$myhostname'
13615 myuname='$myuname'
13616 n='$n'
13617 netdb_hlen_type='$netdb_hlen_type'
13618 netdb_host_type='$netdb_host_type'
13619 netdb_name_type='$netdb_name_type'
13620 netdb_net_type='$netdb_net_type'
13621 nm='$nm'
13622 nm_opt='$nm_opt'
13623 nm_so_opt='$nm_so_opt'
13624 nonxs_ext='$nonxs_ext'
13625 nroff='$nroff'
13626 o_nonblock='$o_nonblock'
13627 obj_ext='$obj_ext'
13628 old_pthread_create_joinable='$old_pthread_create_joinable'
13629 optimize='$optimize'
13630 orderlib='$orderlib'
13631 osname='$osname'
13632 osvers='$osvers'
13633 package='$package'
13634 pager='$pager'
13635 passcat='$passcat'
13636 patchlevel='$patchlevel'
13637 path_sep='$path_sep'
13638 perl='$perl'
13639 perladmin='$perladmin'
13640 perlpath='$perlpath'
13641 pg='$pg'
13642 phostname='$phostname'
13643 pidtype='$pidtype'
13644 plibpth='$plibpth'
13645 pmake='$pmake'
13646 pr='$pr'
13647 prefix='$prefix'
13648 prefixexp='$prefixexp'
13649 privlib='$privlib'
13650 privlibexp='$privlibexp'
13651 prototype='$prototype'
13652 ptrsize='$ptrsize'
13653 randbits='$randbits'
13654 randfunc='$randfunc'
13655 randseedtype='$randseedtype'
13656 ranlib='$ranlib'
13657 rd_nodata='$rd_nodata'
13658 rm='$rm'
13659 rmail='$rmail'
13660 runnm='$runnm'
13661 sched_yield='$sched_yield'
13662 scriptdir='$scriptdir'
13663 scriptdirexp='$scriptdirexp'
13664 sed='$sed'
13665 seedfunc='$seedfunc'
13666 selectminbits='$selectminbits'
13667 selecttype='$selecttype'
13668 sendmail='$sendmail'
13669 sh='$sh'
13670 shar='$shar'
13671 sharpbang='$sharpbang'
13672 shmattype='$shmattype'
13673 shortsize='$shortsize'
13674 shrpenv='$shrpenv'
13675 shsharp='$shsharp'
13676 sig_count='$sig_count'
13677 sig_name='$sig_name'
13678 sig_name_init='$sig_name_init'
13679 sig_num='$sig_num'
13680 sig_num_init='$sig_num_init'
13681 signal_t='$signal_t'
13682 sitearch='$sitearch'
13683 sitearchexp='$sitearchexp'
13684 sitelib='$sitelib'
13685 sitelibexp='$sitelibexp'
13686 siteprefix='$siteprefix'
13687 siteprefixexp='$siteprefixexp'
13688 sizetype='$sizetype'
13689 sleep='$sleep'
13690 smail='$smail'
13691 small='$small'
13692 so='$so'
13693 sockethdr='$sockethdr'
13694 socketlib='$socketlib'
13695 sort='$sort'
13696 spackage='$spackage'
13697 spitshell='$spitshell'
13698 split='$split'
13699 src='$src'
13700 ssizetype='$ssizetype'
13701 startperl='$startperl'
13702 startsh='$startsh'
13703 static_ext='$static_ext'
13704 stdchar='$stdchar'
13705 stdio_base='$stdio_base'
13706 stdio_bufsiz='$stdio_bufsiz'
13707 stdio_cnt='$stdio_cnt'
13708 stdio_filbuf='$stdio_filbuf'
13709 stdio_ptr='$stdio_ptr'
13710 stdio_stream_array='$stdio_stream_array'
13711 strings='$strings'
13712 submit='$submit'
13713 subversion='$subversion'
13714 sysman='$sysman'
13715 tail='$tail'
13716 tar='$tar'
13717 tbl='$tbl'
13718 tee='$tee'
13719 test='$test'
13720 timeincl='$timeincl'
13721 timetype='$timetype'
13722 touch='$touch'
13723 tr='$tr'
13724 trnl='$trnl'
13725 troff='$troff'
13726 uidtype='$uidtype'
13727 uname='$uname'
13728 uniq='$uniq'
13729 use64bits='$use64bits'
13730 usedl='$usedl'
13731 usemultiplicity='$usemultiplicity'
13732 usemymalloc='$usemymalloc'
13733 usenm='$usenm'
13734 useopcode='$useopcode'
13735 useperlio='$useperlio'
13736 useposix='$useposix'
13737 usesfio='$usesfio'
13738 useshrplib='$useshrplib'
13739 usesocks='$usesocks'
13740 usethreads='$usethreads'
13741 usevendorprefix='$usevendorprefix'
13742 usevfork='$usevfork'
13743 usrinc='$usrinc'
13744 uuname='$uuname'
13745 vendorlib='$vendorlib'
13746 vendorlibexp='$vendorlibexp'
13747 vendorprefix='$vendorprefix'
13748 vendorprefixexp='$vendorprefixexp'
13749 version='$version'
13750 vi='$vi'
13751 voidflags='$voidflags'
13752 xlibpth='$xlibpth'
13753 zcat='$zcat'
13754 zip='$zip'
13755 EOT
13756
13757 : Add in command line options if available
13758 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13759
13760 : add special variables
13761 $test -f $src/patchlevel.h && \
13762 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13763 echo "CONFIGDOTSH=true" >>config.sh
13764
13765 : propagate old symbols
13766 if $test -f UU/config.sh; then
13767         <UU/config.sh sort | uniq >UU/oldconfig.sh
13768         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13769         sort | uniq -u >UU/oldsyms
13770         set X `cat UU/oldsyms`
13771         shift
13772         case $# in
13773         0) ;;
13774         *)
13775                 cat <<EOM
13776 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13777 EOM
13778                 echo "# Variables propagated from previous config.sh file." >>config.sh
13779                 for sym in `cat UU/oldsyms`; do
13780                         echo "    Propagating $hint variable "'$'"$sym..."
13781                         eval 'tmp="$'"${sym}"'"'
13782                         echo "$tmp" | \
13783                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13784                 done
13785                 ;;
13786         esac
13787 fi
13788
13789 : Finish up by extracting the .SH files
13790 case "$alldone" in
13791 exit)
13792         $rm -rf UU
13793         echo "Done."
13794         exit 0
13795         ;;
13796 cont)
13797         ;;
13798 '')
13799         dflt=''
13800         nostick=true
13801         $cat <<EOM
13802
13803 If you'd like to make any changes to the config.sh file before I begin
13804 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13805
13806 EOM
13807         rp="Press return or use a shell escape to edit config.sh:"
13808         . UU/myread
13809         nostick=''
13810         case "$ans" in
13811         '') ;;
13812         *) : in case they cannot read
13813                 sh 1>&4 -c "$ans";;
13814         esac
13815         ;;
13816 esac
13817
13818 : if this fails, just run all the .SH files by hand
13819 . ./config.sh
13820
13821 echo " "
13822 exec 1>&4
13823 . ./UU/extract
13824
13825 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13826         dflt=y
13827         case "$silent" in
13828         true) ;;
13829         *)
13830                 $cat <<EOM
13831
13832 Now you need to generate make dependencies by running "$make depend".
13833 You might prefer to run it in background: "$make depend > makedepend.out &"
13834 It can take a while, so you might not want to run it right now.
13835
13836 EOM
13837                 ;;
13838         esac
13839         rp="Run $make depend now?"
13840         . UU/myread
13841         case "$ans" in
13842         y*)
13843                 $make depend && echo "Now you must run a $make."
13844                 ;;
13845         *)
13846                 echo "You must run '$make depend' then '$make'."
13847                 ;;
13848         esac
13849 elif test -f [Mm]akefile; then
13850         echo " "
13851         echo "Now you must run a $make."
13852 else
13853         echo "Done."
13854 fi
13855
13856 if $test -f Policy.sh; then
13857     $cat <<EOM
13858
13859 If you compile $package on a different machine or from a different object
13860 directory, copy the Policy.sh file from this object directory to the
13861 new one before you run Configure -- this will help you with most of
13862 the policy defaults.
13863
13864 EOM
13865 fi
13866 if $test -f config.msg; then
13867     echo "Hmm.  I also noted the following information while running:"
13868     echo " "
13869     $cat config.msg >&4
13870     $rm -f config.msg
13871 fi
13872 $rm -f kit*isdone ark*isdone
13873 $rm -rf UU
13874
13875 : End of Configure
13876