This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add Configure -Duselongdouble and add a missing semicolon.
[perl5.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 Thu Aug 12 22:03:15 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 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_ftello=''
359 d_ftime=''
360 d_gettimeod=''
361 d_Gconvert=''
362 d_getgrent=''
363 d_getgrps=''
364 d_gethbyaddr=''
365 d_gethbyname=''
366 d_gethent=''
367 aphostname=''
368 d_gethname=''
369 d_phostname=''
370 d_uname=''
371 d_gethostprotos=''
372 d_getlogin=''
373 d_getmntent=''
374 d_getnbyaddr=''
375 d_getnbyname=''
376 d_getnent=''
377 d_getnetprotos=''
378 d_getpent=''
379 d_getpgid=''
380 d_getpgrp2=''
381 d_bsdgetpgrp=''
382 d_getpgrp=''
383 d_getppid=''
384 d_getprior=''
385 d_getpbyname=''
386 d_getpbynumber=''
387 d_getprotoprotos=''
388 d_getpwent=''
389 d_getsent=''
390 d_getservprotos=''
391 d_getspent=''
392 d_getspnam=''
393 d_getsbyname=''
394 d_getsbyport=''
395 d_gnulibc=''
396 d_hasmntopt=''
397 d_htonl=''
398 d_inetaton=''
399 d_isascii=''
400 d_killpg=''
401 d_lchown=''
402 d_link=''
403 d_locconv=''
404 d_lockf=''
405 d_longdbl=''
406 longdblsize=''
407 d_longlong=''
408 longlongsize=''
409 d_lstat=''
410 d_madvise=''
411 d_mblen=''
412 d_mbstowcs=''
413 d_mbtowc=''
414 d_memchr=''
415 d_memcmp=''
416 d_memcpy=''
417 d_memmove=''
418 d_memset=''
419 d_mkdir=''
420 d_mkfifo=''
421 d_mktime=''
422 d_mmap=''
423 mmaptype=''
424 d_mprotect=''
425 d_msg=''
426 d_msgctl=''
427 d_msgget=''
428 d_msgrcv=''
429 d_msgsnd=''
430 d_msync=''
431 d_munmap=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_readv=''
451 d_rename=''
452 d_rmdir=''
453 d_safebcpy=''
454 d_safemcpy=''
455 d_sanemcmp=''
456 d_select=''
457 d_sem=''
458 d_semctl=''
459 d_semget=''
460 d_semop=''
461 d_setegid=''
462 d_seteuid=''
463 d_setgrent=''
464 d_setgrps=''
465 d_sethent=''
466 d_setlinebuf=''
467 d_setlocale=''
468 d_setnent=''
469 d_setpent=''
470 d_setpgid=''
471 d_setpgrp2=''
472 d_bsdsetpgrp=''
473 d_setpgrp=''
474 d_setprior=''
475 d_setpwent=''
476 d_setregid=''
477 d_setresgid=''
478 d_setresuid=''
479 d_setreuid=''
480 d_setrgid=''
481 d_setruid=''
482 d_setsent=''
483 d_setsid=''
484 d_setspent=''
485 d_setvbuf=''
486 d_sfio=''
487 usesfio=''
488 d_shm=''
489 d_shmat=''
490 d_shmatprototype=''
491 shmattype=''
492 d_shmctl=''
493 d_shmdt=''
494 d_shmget=''
495 d_sigaction=''
496 d_sigsetjmp=''
497 d_cmsghdr_s=''
498 d_msg_ctrunc=''
499 d_msg_dontroute=''
500 d_msg_oob=''
501 d_msg_peek=''
502 d_msg_proxy=''
503 d_msghdr_s=''
504 d_oldsock=''
505 d_recvmsg=''
506 d_scm_rights=''
507 d_sendmsg=''
508 d_socket=''
509 d_sockpair=''
510 sockethdr=''
511 socketlib=''
512 d_statblks=''
513 d_fstatfs=''
514 d_statfs=''
515 d_statfsflags=''
516 d_fstatvfs=''
517 d_statvfs=''
518 d_stdio_cnt_lval=''
519 d_stdio_ptr_lval=''
520 d_stdiobase=''
521 d_stdstdio=''
522 stdio_base=''
523 stdio_bufsiz=''
524 stdio_cnt=''
525 stdio_filbuf=''
526 stdio_ptr=''
527 d_index=''
528 d_strchr=''
529 d_strcoll=''
530 d_strctcpy=''
531 d_strerrm=''
532 d_strerror=''
533 d_sysernlst=''
534 d_syserrlst=''
535 d_strtod=''
536 d_strtol=''
537 d_strtoul=''
538 d_strxfrm=''
539 d_symlink=''
540 d_syscall=''
541 d_sysconf=''
542 d_system=''
543 d_tcgetpgrp=''
544 d_tcsetpgrp=''
545 d_telldirproto=''
546 d_time=''
547 timetype=''
548 clocktype=''
549 d_times=''
550 d_truncate=''
551 d_tzname=''
552 d_umask=''
553 d_semctl_semid_ds=''
554 d_semctl_semun=''
555 d_union_semun=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 d_writev=''
568 d_dbmclose64=''
569 d_dbminit64=''
570 d_delete64=''
571 d_fetch64=''
572 d_firstkey64=''
573 d_nextkey64=''
574 d_store64=''
575 dlext=''
576 cccdlflags=''
577 ccdlflags=''
578 dlsrc=''
579 ld=''
580 lddlflags=''
581 usedl=''
582 doublesize=''
583 ebcdic=''
584 fflushNULL=''
585 fflushall=''
586 fpostype=''
587 gidtype=''
588 groupstype=''
589 h_fcntl=''
590 h_sysfile=''
591 i_arpainet=''
592 db_hashtype=''
593 db_prefixtype=''
594 i_db=''
595 i_dbm=''
596 i_rpcsvcdbm=''
597 d_dirnamlen=''
598 direntrytype=''
599 i_dirent=''
600 i_dld=''
601 i_dlfcn=''
602 i_fcntl=''
603 i_float=''
604 i_gdbm=''
605 d_grpasswd=''
606 i_grp=''
607 d_int64t=''
608 i_inttypes=''
609 i_limits=''
610 i_locale=''
611 i_machcthr=''
612 i_malloc=''
613 i_math=''
614 i_memory=''
615 i_mntent=''
616 i_ndbm=''
617 i_netdb=''
618 i_neterrno=''
619 i_netinettcp=''
620 i_niin=''
621 i_sysin=''
622 i_poll=''
623 i_pthread=''
624 d_pwage=''
625 d_pwchange=''
626 d_pwclass=''
627 d_pwcomment=''
628 d_pwexpire=''
629 d_pwgecos=''
630 d_pwpasswd=''
631 d_pwquota=''
632 i_pwd=''
633 i_sfio=''
634 i_shadow=''
635 i_socks=''
636 i_stddef=''
637 i_stdlib=''
638 i_string=''
639 strings=''
640 i_sysaccess=''
641 i_sysdir=''
642 i_sysfile=''
643 d_voidtty=''
644 i_bsdioctl=''
645 i_sysfilio=''
646 i_sysioctl=''
647 i_syssockio=''
648 i_sysmman=''
649 i_sysmount=''
650 i_sysndir=''
651 i_sysparam=''
652 i_sysresrc=''
653 i_syssecrt=''
654 i_sysselct=''
655 i_sysstat=''
656 i_sysstatvfs=''
657 i_systimes=''
658 i_systypes=''
659 d_iovec_s=''
660 i_sysuio=''
661 i_sysun=''
662 i_syswait=''
663 i_sgtty=''
664 i_termio=''
665 i_termios=''
666 i_systime=''
667 i_systimek=''
668 i_time=''
669 timeincl=''
670 i_unistd=''
671 i_utime=''
672 i_values=''
673 i_stdarg=''
674 i_varargs=''
675 i_varhdr=''
676 i_vfork=''
677 installprefix=''
678 installprefixexp=''
679 installstyle=''
680 installusrbinperl=''
681 intsize=''
682 longsize=''
683 shortsize=''
684 d_dirent64_s=''
685 d_flock64_s=''
686 d_fstat64=''
687 d_ftruncate64=''
688 d_ino64_t=''
689 d_llseek=''
690 d_lockf64=''
691 d_lseek64=''
692 d_lstat64=''
693 d_off64_t=''
694 d_offset_t=''
695 d_open64=''
696 d_opendir64=''
697 d_readdir64=''
698 d_seekdir64=''
699 d_stat64=''
700 d_telldir64=''
701 d_truncate64=''
702 libc=''
703 ldlibpthname=''
704 libperl=''
705 shrpenv=''
706 useshrplib=''
707 glibpth=''
708 libpth=''
709 loclibpth=''
710 plibpth=''
711 xlibpth=''
712 ignore_versioned_solibs=''
713 libs=''
714 lns=''
715 d_PRIEldbl=''
716 d_PRIFldbl=''
717 d_PRIGldbl=''
718 d_PRIeldbl=''
719 d_PRIfldbl=''
720 d_PRIgldbl=''
721 sPRIEldbl=''
722 sPRIFldbl=''
723 sPRIGldbl=''
724 sPRIeldbl=''
725 sPRIfldbl=''
726 sPRIgldbl=''
727 lseeksize=''
728 lseektype=''
729 make_set_make=''
730 d_mymalloc=''
731 freetype=''
732 mallocobj=''
733 mallocsrc=''
734 malloctype=''
735 usemymalloc=''
736 installman1dir=''
737 man1dir=''
738 man1direxp=''
739 man1ext=''
740 installman3dir=''
741 man3dir=''
742 man3direxp=''
743 man3ext=''
744 huge=''
745 large=''
746 medium=''
747 models=''
748 small=''
749 split=''
750 modetype=''
751 multiarch=''
752 mydomain=''
753 myhostname=''
754 phostname=''
755 c=''
756 n=''
757 d_eofnblk=''
758 eagain=''
759 o_nonblock=''
760 rd_nodata=''
761 netdb_hlen_type=''
762 netdb_host_type=''
763 netdb_name_type=''
764 netdb_net_type=''
765 groupcat=''
766 hostcat=''
767 passcat=''
768 orderlib=''
769 ranlib=''
770 package=''
771 spackage=''
772 pager=''
773 apiversion=''
774 patchlevel=''
775 subversion=''
776 version=''
777 perladmin=''
778 perlpath=''
779 pidtype=''
780 prefix=''
781 prefixexp=''
782 installprivlib=''
783 privlib=''
784 privlibexp=''
785 prototype=''
786 ptrsize=''
787 d_PRIX64=''
788 d_PRId64=''
789 d_PRIi64=''
790 d_PRIo64=''
791 d_PRIu64=''
792 d_PRIx64=''
793 sPRIX64=''
794 sPRId64=''
795 sPRIi64=''
796 sPRIo64=''
797 sPRIu64=''
798 sPRIx64=''
799 drand01=''
800 randbits=''
801 randfunc=''
802 randseedtype=''
803 seedfunc=''
804 installscript=''
805 scriptdir=''
806 scriptdirexp=''
807 selectminbits=''
808 selecttype=''
809 sh=''
810 sig_count=''
811 sig_name=''
812 sig_name_init=''
813 sig_num=''
814 sig_num_init=''
815 installsitearch=''
816 sitearch=''
817 sitearchexp=''
818 installsitelib=''
819 sitelib=''
820 sitelibexp=''
821 siteprefix=''
822 siteprefixexp=''
823 sizetype=''
824 so=''
825 sharpbang=''
826 shsharp=''
827 spitshell=''
828 src=''
829 ssizetype=''
830 startperl=''
831 startsh=''
832 stdchar=''
833 d_fgetpos64=''
834 d_fopen64=''
835 d_freopen64=''
836 d_fseek64=''
837 d_fseeko64=''
838 d_fsetpos64=''
839 d_ftell64=''
840 d_ftello64=''
841 d_tmpfile64=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidtype=''
848 archname64=''
849 use64bits=''
850 uselongdouble=''
851 usemultiplicity=''
852 nm_opt=''
853 nm_so_opt=''
854 runnm=''
855 usenm=''
856 useperlio=''
857 usesocks=''
858 d_oldpthreads=''
859 usethreads=''
860 incpath=''
861 mips=''
862 mips_type=''
863 usrinc=''
864 d_vendorlib=''
865 installvendorlib=''
866 vendorlib=''
867 vendorlibexp=''
868 usevendorprefix=''
869 vendorprefix=''
870 vendorprefixexp=''
871 defvoidused=''
872 voidflags=''
873 CONFIG=''
874
875 define='define'
876 undef='undef'
877 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
878 rmlist=''
879
880 : We must find out about Eunice early
881 eunicefix=':'
882 if test -f /etc/unixtovms; then
883         eunicefix=/etc/unixtovms
884 fi
885 if test -f /etc/unixtovms.exe; then
886         eunicefix=/etc/unixtovms.exe
887 fi
888
889 i_whoami=''
890 : Possible local include directories to search.
891 : Set locincpth to "" in a hint file to defeat local include searches.
892 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
893 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
894 :
895 : no include file wanted by default
896 inclwanted=''
897
898 : list of known cpp symbols, sorted alphabetically
899 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
900 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
901 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
902 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
903 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
904 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
905 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
906 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
907 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
908 al="$al VMS Xenix286"
909 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
910 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
911 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
912 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
913 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
914 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
915 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
916 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
917 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
918 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
919 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
920 al="$al __SVR4_2__ __UMAXV__"
921 al="$al ____386BSD____ __alpha __alpha__ __amiga"
922 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
923 al="$al __host_mips__"
924 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
925 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
926 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
927 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
928 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
929 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
930 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
931 al="$al __mc88100 __mc88100__ __mips __mips__"
932 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
933 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
934 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
935 al="$al _host_mips _mips _unix"
936 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
937 al="$al apollo ardent att386 att3b"
938 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
939 al="$al cadmus clipper concurrent convex cray ctix"
940 al="$al dmert encore gcos gcx gimpel gould"
941 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
942 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
943 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
944 al="$al i186 i286 i386 i486 i8086"
945 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
946 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
947 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
948 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
949 al="$al mc88000 mc88100 merlin mert mips mvs n16"
950 al="$al ncl_el ncl_mr"
951 al="$al news1500 news1700 news1800 news1900 news3700"
952 al="$al news700 news800 news900 ns16000 ns32000"
953 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
954 al="$al parisc pc532 pdp11 plexus posix pyr"
955 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
956 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
957 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
958 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
959 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
960 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
961 al="$al xenix z8000"
962
963 : Trailing extension.  Override this in a hint file, if needed.
964 _exe=''
965 : Extra object files, if any, needed on this platform.
966 archobjs=''
967 groupstype=''
968 : change the next line if compiling for Xenix/286 on Xenix/386
969 xlibpth='/usr/lib/386 /lib/386'
970
971 : Possible local library directories to search.
972 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
973 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
974
975 : general looking path for locating libraries
976 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
977 glibpth="$glibpth /lib /usr/lib $xlibpth"
978 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
979 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
980
981 : Private path used by Configure to find libraries.  Its value
982 : is prepended to libpth. This variable takes care of special
983 : machines, like the mips.  Usually, it should be empty.
984 plibpth=''
985
986 : default library list
987 libswanted=''
988 : some systems want to use only the non-versioned libso:s
989 ignore_versioned_solibs=''
990 : full support for void wanted by default
991 defvoidused=15
992
993 : set useposix=false in your hint file to disable the POSIX extension.
994 useposix=true
995 : set useopcode=false in your hint file to disable the Opcode extension.
996 useopcode=true
997 : set usemultiplicity on the Configure command line to enable multiplicity.
998 : set usesocks on the Configure command line to enable socks.
999 : set usethreads on the Configure command line to enable threads.
1000 : List of libraries we want.
1001 : If anyone needs -lnet, put it in a hint file.
1002 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1003 libswanted="$libswanted dld ld sun m rt c cposix posix"
1004 libswanted="$libswanted ndir dir crypt sec"
1005 libswanted="$libswanted ucb bsd BSD PW x"
1006 : We probably want to search /usr/shlib before most other libraries.
1007 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1008 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1009 glibpth="/usr/shlib $glibpth"
1010 : Do not use vfork unless overridden by a hint file.
1011 usevfork=false
1012
1013 : Find the basic shell for Bourne shell scripts
1014 case "$sh" in
1015 '')
1016         case "$SYSTYPE" in
1017         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1018         *) xxx='/bin/sh';;
1019         esac
1020         if test -f "$xxx"; then
1021                 sh="$xxx"
1022         else
1023                 : Build up a list and do a single loop so we can 'break' out.
1024                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1025                 for xxx in sh bash ksh pdksh ash; do
1026                         for p in $pth; do
1027                                 try="$try ${p}/${xxx}"
1028                         done
1029                 done
1030                 for xxx in $try; do
1031                         if test -f "$xxx"; then
1032                                 sh="$xxx";
1033                                 break
1034                         elif test -f "$xxx.exe"; then
1035                                 sh="$xxx";
1036                                 break
1037                         fi
1038                 done
1039         fi
1040         ;;
1041 esac
1042
1043 case "$sh" in
1044 '')     cat <<EOM >&2
1045 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1046
1047 Usually it's in /bin/sh.  How did you even get this far?
1048 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1049 we'll try to straighten this all out.
1050 EOM
1051         exit 1
1052         ;;
1053 esac
1054
1055 : see if sh knows # comments
1056 if `$sh -c '#' >/dev/null 2>&1`; then
1057         shsharp=true
1058         spitshell=cat
1059         xcat=/bin/cat
1060         test -f $xcat || xcat=/usr/bin/cat
1061         echo "#!$xcat" >try
1062         $eunicefix try
1063         chmod +x try
1064         ./try > today
1065         if test -s today; then
1066                 sharpbang='#!'
1067         else
1068                 echo "#! $xcat" > try
1069                 $eunicefix try
1070                 chmod +x try
1071                 ./try > today
1072                 if test -s today; then
1073                         sharpbang='#! '
1074                 else
1075                         sharpbang=': use '
1076                 fi
1077         fi
1078 else
1079         echo " "
1080         echo "Your $sh doesn't grok # comments--I will strip them later on."
1081         shsharp=false
1082         cd ..
1083         echo "exec grep -v '^[  ]*#'" >spitshell
1084         chmod +x spitshell
1085         $eunicefix spitshell
1086         spitshell=`pwd`/spitshell
1087         cd UU
1088         echo "I presume that if # doesn't work, #! won't work either!"
1089         sharpbang=': use '
1090 fi
1091 rm -f try today
1092
1093 : figure out how to guarantee sh startup
1094 case "$startsh" in
1095 '') startsh=${sharpbang}${sh} ;;
1096 *)
1097 esac
1098 cat >try <<EOSS
1099 $startsh
1100 set abc
1101 test "$?abc" != 1
1102 EOSS
1103
1104 chmod +x try
1105 $eunicefix try
1106 if ./try; then
1107         : echo "Yup, it does."
1108 else
1109         echo "Hmm... '$startsh' does not guarantee sh startup..."
1110         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1111 fi
1112 rm -f try
1113
1114
1115 : Save command line options in file UU/cmdline.opt for later use in
1116 : generating config.sh.
1117 cat > cmdline.opt <<EOSH
1118 # Configure command line arguments.
1119 config_arg0='$0'
1120 config_args='$*'
1121 config_argc=$#
1122 EOSH
1123 argn=1
1124 for arg in "$@"; do
1125         cat >>cmdline.opt <<EOSH
1126 config_arg$argn='$arg'
1127 EOSH
1128         argn=`expr $argn + 1`
1129 done
1130
1131 : produce awk script to parse command line options
1132 cat >options.awk <<'EOF'
1133 BEGIN {
1134         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1135
1136         len = length(optstr);
1137         for (i = 1; i <= len; i++) {
1138                 c = substr(optstr, i, 1);
1139                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1140                 if (a == ":") {
1141                         arg[c] = 1;
1142                         i++;
1143                 }
1144                 opt[c] = 1;
1145         }
1146 }
1147 {
1148         expect = 0;
1149         str = $0;
1150         if (substr(str, 1, 1) != "-") {
1151                 printf("'%s'\n", str);
1152                 next;
1153         }
1154         len = length($0);
1155         for (i = 2; i <= len; i++) {
1156                 c = substr(str, i, 1);
1157                 if (!opt[c]) {
1158                         printf("-%s\n", substr(str, i));
1159                         next;
1160                 }
1161                 printf("-%s\n", c);
1162                 if (arg[c]) {
1163                         if (i < len)
1164                                 printf("'%s'\n", substr(str, i + 1));
1165                         else
1166                                 expect = 1;
1167                         next;
1168                 }
1169         }
1170 }
1171 END {
1172         if (expect)
1173                 print "?";
1174 }
1175 EOF
1176
1177 : process the command line options
1178 set X `for arg in "$@"; do echo "X$arg"; done |
1179         sed -e s/X// | awk -f options.awk`
1180 eval "set $*"
1181 shift
1182 rm -f options.awk
1183
1184 : set up default values
1185 fastread=''
1186 reuseval=false
1187 config_sh=''
1188 alldone=''
1189 error=''
1190 silent=''
1191 extractsh=''
1192 override=''
1193 knowitall=''
1194 rm -f optdef.sh
1195 cat >optdef.sh <<EOS
1196 $startsh
1197 EOS
1198
1199
1200 : option parsing
1201 while test $# -gt 0; do
1202         case "$1" in
1203         -d) shift; fastread=yes;;
1204         -e) shift; alldone=cont;;
1205         -f)
1206                 shift
1207                 cd ..
1208                 if test -r "$1"; then
1209                         config_sh="$1"
1210                 else
1211                         echo "$me: cannot read config file $1." >&2
1212                         error=true
1213                 fi
1214                 cd UU
1215                 shift;;
1216         -h) shift; error=true;;
1217         -r) shift; reuseval=true;;
1218         -s) shift; silent=true; realsilent=true;;
1219         -E) shift; alldone=exit;;
1220         -K) shift; knowitall=true;;
1221         -O) shift; override=true;;
1222         -S) shift; silent=true; extractsh=true;;
1223         -D)
1224                 shift
1225                 case "$1" in
1226                 *=)
1227                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1228                         echo "$me: ignoring -D $1" >&2
1229                         ;;
1230                 *=*) echo "$1" | \
1231                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1232                 *) echo "$1='define'" >> optdef.sh;;
1233                 esac
1234                 shift
1235                 ;;
1236         -U)
1237                 shift
1238                 case "$1" in
1239                 *=) echo "$1" >> optdef.sh;;
1240                 *=*)
1241                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1242                         echo "$me: ignoring -U $1" >&2
1243                         ;;
1244                 *) echo "$1='undef'" >> optdef.sh;;
1245                 esac
1246                 shift
1247                 ;;
1248         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1249                 exit 0;;
1250         --) break;;
1251         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1252         *) break;;
1253         esac
1254 done
1255
1256 case "$error" in
1257 true)
1258         cat >&2 <<EOM
1259 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1260                  [-U symbol] [-U symbol=]
1261   -d : use defaults for all answers.
1262   -e : go on without questioning past the production of config.sh.
1263   -f : specify an alternate default configuration file.
1264   -h : print this help message and exit (with an error status).
1265   -r : reuse C symbols value if possible (skips costly nm extraction).
1266   -s : silent mode, only echoes questions and essential information.
1267   -D : define symbol to have some value:
1268          -D symbol         symbol gets the value 'define'
1269          -D symbol=value   symbol gets the value 'value'
1270   -E : stop at the end of questions, after having produced config.sh.
1271   -K : do not use unless you know what you are doing.
1272   -O : let -D and -U override definitions from loaded configuration file.
1273   -S : perform variable substitutions on all .SH files (can mix with -f)
1274   -U : undefine symbol:
1275          -U symbol    symbol gets the value 'undef'
1276          -U symbol=   symbol gets completely empty
1277   -V : print version number and exit (with a zero status).
1278 EOM
1279         exit 1
1280         ;;
1281 esac
1282
1283 : Sanity checks
1284 case "$fastread$alldone" in
1285 yescont|yesexit) ;;
1286 *)
1287         if test ! -t 0; then
1288                 echo "Say 'sh Configure', not 'sh <Configure'"
1289                 exit 1
1290         fi
1291         ;;
1292 esac
1293
1294 exec 4>&1
1295 case "$silent" in
1296 true) exec 1>/dev/null;;
1297 esac
1298
1299 : run the defines and the undefines, if any, but leave the file out there...
1300 touch optdef.sh
1301 . ./optdef.sh
1302
1303 : set package name
1304 package=perl5
1305 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1306 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1307 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1308 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1309 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1310 esac
1311
1312 : Some greps do not return status, grrr.
1313 echo "grimblepritz" >grimble
1314 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1315         contains=contains
1316 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1317         contains=grep
1318 else
1319         contains=contains
1320 fi
1321 rm -f grimble
1322 : the following should work in any shell
1323 case "$contains" in
1324 contains*)
1325         echo " "
1326         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1327         cat >contains <<'EOSS'
1328 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1329 EOSS
1330 chmod +x contains
1331 esac
1332
1333 : Find the path to the source tree
1334 case "$src" in
1335 '') case "$0" in
1336     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1337          case "$src" in
1338          /*)    ;;
1339          *)     src=`cd ../$src && pwd` ;;
1340          esac
1341          ;;
1342     *)   src='.';;
1343     esac;;
1344 esac
1345 case "$src" in
1346 '')     src=/
1347         rsrc=/
1348         ;;
1349 /*) rsrc="$src";;
1350 *) rsrc="../$src";;
1351 esac
1352 if test -f $rsrc/Configure && \
1353         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1354 then
1355    : found it, so we are ok.
1356 else
1357         rsrc=''
1358         for src in . .. ../.. ../../.. ../../../..; do
1359                 if test -f ../$src/Configure && \
1360                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1361                 then
1362                         rsrc=../$src
1363                         break
1364                 fi
1365         done
1366 fi
1367 case "$rsrc" in
1368 '')
1369         cat <<EOM >&4
1370
1371 Sorry, I can't seem to locate the source dir for $package.  Please start
1372 Configure with an explicit path -- i.e. /some/path/Configure.
1373
1374 EOM
1375         exit 1
1376         ;;
1377 ../.)   rsrc='..';;
1378 *)
1379         echo " "
1380         echo "Sources for $package found in \"$src\"." >&4
1381         ;;
1382 esac
1383
1384 : script used to extract .SH files with variable substitutions
1385 cat >extract <<'EOS'
1386 CONFIGDOTSH=true
1387 echo "Doing variable substitutions on .SH files..."
1388 if test -f $src/MANIFEST; then
1389         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1390 else
1391         echo "(Looking for .SH files under the source directory.)"
1392         set x `(cd $src; find . -name "*.SH" -print)`
1393 fi
1394 shift
1395 case $# in
1396 0) set x `(cd $src; echo *.SH)`; shift;;
1397 esac
1398 if test ! -f $src/$1; then
1399         shift
1400 fi
1401 mkdir_p='
1402 name=$1;
1403 create="";
1404 while test $name; do
1405         if test ! -d "$name"; then
1406                 create="$name $create";
1407                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1408                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1409         else
1410                 name="";
1411         fi;
1412 done;
1413 for file in $create; do
1414         mkdir $file;
1415 done
1416 '
1417 for file in $*; do
1418         case "$src" in
1419         ".")
1420                 case "$file" in
1421                 */*)
1422                         dir=`expr X$file : 'X\(.*\)/'`
1423                         file=`expr X$file : 'X.*/\(.*\)'`
1424                         (cd $dir && . ./$file)
1425                         ;;
1426                 *)
1427                         . ./$file
1428                         ;;
1429                 esac
1430                 ;;
1431         *)
1432                 case "$file" in
1433                 */*)
1434                         dir=`expr X$file : 'X\(.*\)/'`
1435                         file=`expr X$file : 'X.*/\(.*\)'`
1436                         (set x $dir; shift; eval $mkdir_p)
1437                         sh <$src/$dir/$file
1438                         ;;
1439                 *)
1440                         sh <$src/$file
1441                         ;;
1442                 esac
1443                 ;;
1444         esac
1445 done
1446 if test -f $src/config_h.SH; then
1447         if test ! -f config.h; then
1448         : oops, they left it out of MANIFEST, probably, so do it anyway.
1449         . $src/config_h.SH
1450         fi
1451 fi
1452 EOS
1453
1454 : extract files and exit if asked to do so
1455 case "$extractsh" in
1456 true)
1457         case "$realsilent" in
1458         true) ;;
1459         *) exec 1>&4;;
1460         esac
1461         case "$config_sh" in
1462         '') config_sh='config.sh';;
1463         esac
1464         echo " "
1465         echo "Fetching answers from $config_sh..."
1466         cd ..
1467         . $config_sh
1468         test "$override" && . ./optdef.sh
1469         echo " "
1470         . UU/extract
1471         rm -rf UU
1472         echo "Done."
1473         exit 0
1474         ;;
1475 esac
1476
1477 : Eunice requires " " instead of "", can you believe it
1478 echo " "
1479 : Here we go...
1480 echo "Beginning of configuration questions for $package."
1481
1482 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1483
1484 : first determine how to suppress newline on echo command
1485 echo " "
1486 echo "Checking echo to see how to suppress newlines..."
1487 (echo "hi there\c" ; echo " ") >.echotmp
1488 if $contains c .echotmp >/dev/null 2>&1 ; then
1489         echo "...using -n."
1490         n='-n'
1491         c=''
1492 else
1493         cat <<'EOM'
1494 ...using \c
1495 EOM
1496         n=''
1497         c='\c'
1498 fi
1499 echo $n "The star should be here-->$c"
1500 echo '*'
1501 rm -f .echotmp
1502
1503 : Now test for existence of everything in MANIFEST
1504 echo " "
1505 if test -f $rsrc/MANIFEST; then
1506         echo "First let's make sure your kit is complete.  Checking..." >&4
1507         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1508         rm -f missing
1509         tmppwd=`pwd`
1510         for filelist in x??; do
1511                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1512         done
1513         if test -s missing; then
1514                 cat missing >&4
1515                 cat >&4 <<'EOM'
1516
1517 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1518
1519 You have the option of continuing the configuration process, despite the
1520 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1521 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1522 and contact the author (perlbug@perl.com).
1523
1524 EOM
1525                 echo $n "Continue? [n] $c" >&4
1526                 read ans
1527                 case "$ans" in
1528                 y*)
1529                         echo "Continuing..." >&4
1530                         rm -f missing
1531                         ;;
1532                 *)
1533                         echo "ABORTING..." >&4
1534                         kill $$
1535                         ;;
1536                 esac
1537         else
1538                 echo "Looks good..."
1539         fi
1540 else
1541         echo "There is no MANIFEST file.  I hope your kit is complete !"
1542 fi
1543 rm -f missing x??
1544
1545 echo " "
1546 : Find the appropriate value for a newline for tr
1547 if test -n "$DJGPP"; then
1548        trnl='\012'
1549 fi
1550 if test X"$trnl" = X; then
1551         case "`echo foo|tr '\n' x 2>/dev/null`" in
1552         foox) trnl='\n' ;;
1553         esac
1554 fi
1555 if test X"$trnl" = X; then
1556         case "`echo foo|tr '\012' x 2>/dev/null`" in
1557         foox) trnl='\012' ;;
1558         esac
1559 fi
1560 if test X"$trnl" = X; then
1561         cat <<EOM >&2
1562
1563 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1564
1565 EOM
1566         exit 1
1567 fi
1568
1569 : compute the number of columns on the terminal for proper question formatting
1570 case "$COLUMNS" in
1571 '') COLUMNS='80';;
1572 esac
1573
1574 : set up the echo used in my read
1575 myecho="case \"\$xxxm\" in
1576 '') echo $n \"\$rp $c\" >&4;;
1577 *) case \"\$rp\" in
1578         '') echo $n \"[\$xxxm] $c\";;
1579         *)
1580                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1581                         echo \"\$rp\" >&4
1582                         echo $n \"[\$xxxm] $c\" >&4
1583                 else
1584                         echo $n \"\$rp [\$xxxm] $c\" >&4
1585                 fi
1586                 ;;
1587         esac;;
1588 esac"
1589
1590 : now set up to do reads with possible shell escape and default assignment
1591 cat <<EOSC >myread
1592 $startsh
1593 xxxm=\$dflt
1594 $myecho
1595 ans='!'
1596 case "\$fastread" in
1597 yes) case "\$dflt" in
1598         '') ;;
1599         *) ans='';
1600                 case "\$silent-\$rp" in
1601                 true-) ;;
1602                 *) echo " " >&4;;
1603                 esac;;
1604         esac;;
1605 *) case "\$silent" in
1606         true) case "\$rp" in
1607                 '') ans='';;
1608                 esac;;
1609         esac;;
1610 esac
1611 while expr "X\$ans" : "X!" >/dev/null; do
1612         read answ
1613         set x \$xxxm
1614         shift
1615         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1616         case  "\$answ" in
1617         "!")
1618                 sh 1>&4
1619                 echo " "
1620                 $myecho
1621                 ;;
1622         !*)
1623                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1624                 shift
1625                 sh 1>&4 -c "\$*"
1626                 echo " "
1627                 $myecho
1628                 ;;
1629         "\$ans")
1630                 case "\$ans" in
1631                 \\&*)
1632                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1633                         shift
1634                         case "\$1" in
1635                         -d)
1636                                 fastread=yes
1637                                 echo "(OK, I'll run with -d after this question.)" >&4
1638                                 ;;
1639                         -*)
1640                                 echo "*** Sorry, \$1 not supported yet." >&4
1641                                 ;;
1642                         esac
1643                         $myecho
1644                         ans=!
1645                         ;;
1646                 esac;;
1647         *)
1648                 case "\$aok" in
1649                 y)
1650                         echo "*** Substitution done -- please confirm."
1651                         xxxm="\$ans"
1652                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1653                         xxxm="\$ans"
1654                         ans=!
1655                         ;;
1656                 *)
1657                         echo "*** Error -- try again."
1658                         ans=!
1659                         ;;
1660                 esac
1661                 $myecho
1662                 ;;
1663         esac
1664         case "\$ans\$xxxm\$nostick" in
1665         '')
1666                 ans=!
1667                 $myecho
1668                 ;;
1669         esac
1670 done
1671 case "\$ans" in
1672 '') ans="\$xxxm";;
1673 esac
1674 EOSC
1675
1676 : create .config dir to save info across Configure sessions
1677 test -d ../.config || mkdir ../.config
1678 cat >../.config/README <<EOF
1679 This directory created by Configure to save information that should
1680 persist across sessions for $package.
1681
1682 You may safely delete it if you wish.
1683 EOF
1684
1685 : general instructions
1686 needman=true
1687 firsttime=true
1688 user=`(logname) 2>/dev/null`
1689 case "$user" in
1690 '') user=`whoami 2>&1`;;
1691 esac
1692 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1693         firsttime=false
1694         echo " "
1695         rp='Would you like to see the instructions?'
1696         dflt=n
1697         . ./myread
1698         case "$ans" in
1699         [yY]*) ;;
1700         *) needman=false;;
1701         esac
1702 fi
1703 if $needman; then
1704         cat <<EOH
1705
1706 This installation shell script will examine your system and ask you questions
1707 to determine how the perl5 package should be installed. If you get
1708 stuck on a question, you may use a ! shell escape to start a subshell or
1709 execute a command.  Many of the questions will have default answers in square
1710 brackets; typing carriage return will give you the default.
1711
1712 On some of the questions which ask for file or directory names you are allowed
1713 to use the ~name construct to specify the login directory belonging to "name",
1714 even if you don't have a shell which knows about that.  Questions where this is
1715 allowed will be marked "(~name ok)".
1716
1717 EOH
1718         rp=''
1719         dflt='Type carriage return to continue'
1720         . ./myread
1721         cat <<'EOH'
1722
1723 The prompter used in this script allows you to use shell variables and
1724 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1725 in the default answer, as if the default line was a set of arguments given to a
1726 script shell.  This means you may also use $* to repeat the whole default line,
1727 so you do not have to re-type everything to add something to the default.
1728
1729 Everytime there is a substitution, you will have to confirm.  If there is an
1730 error (e.g. an unmatched backtick), the default answer will remain unchanged
1731 and you will be prompted again.
1732
1733 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1734 the questions and use the computed defaults (or the previous answers if there
1735 was already a config.sh file). Type 'Configure -h' for a list of options.
1736 You may also start interactively and then answer '& -d' at any prompt to turn
1737 on the non-interactive behaviour for the remainder of the execution.
1738
1739 EOH
1740         . ./myread
1741         cat <<EOH
1742
1743 Much effort has been expended to ensure that this shell script will run on any
1744 Unix system.  If despite that it blows up on yours, your best bet is to edit
1745 Configure and run it again.  If you can't run Configure for some reason,
1746 you'll have to generate a config.sh file by hand.  Whatever problems you
1747 have, let me (perlbug@perl.com) know how I blew it.
1748
1749 This installation script affects things in two ways:
1750
1751 1) it may do direct variable substitutions on some of the files included
1752    in this kit.
1753 2) it builds a config.h file for inclusion in C programs.  You may edit
1754    any of these files as the need arises after running this script.
1755
1756 If you make a mistake on a question, there is no easy way to back up to it
1757 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1758 files.  Configure will offer to let you do this before it runs the SH files.
1759
1760 EOH
1761         dflt='Type carriage return to continue'
1762         . ./myread
1763         case "$firsttime" in
1764         true) echo $user >>../.config/instruct;;
1765         esac
1766 fi
1767
1768 : find out where common programs are
1769 echo " "
1770 echo "Locating common programs..." >&4
1771 cat <<EOSC >loc
1772 $startsh
1773 case \$# in
1774 0) exit 1;;
1775 esac
1776 thing=\$1
1777 shift
1778 dflt=\$1
1779 shift
1780 for dir in \$*; do
1781         case "\$thing" in
1782         .)
1783         if test -d \$dir/\$thing; then
1784                 echo \$dir
1785                 exit 0
1786         fi
1787         ;;
1788         *)
1789         for thisthing in \$dir/\$thing; do
1790                 : just loop through to pick last item
1791         done
1792         if test -f \$thisthing; then
1793                 echo \$thisthing
1794                 exit 0
1795         elif test -f \$dir/\$thing.exe; then
1796                 if test -n "$DJGPP"; then
1797                         echo \$dir/\$thing.exe
1798                 else
1799                         : on Eunice apparently
1800                         echo \$dir/\$thing
1801                 fi
1802                 exit 0
1803         fi
1804         ;;
1805         esac
1806 done
1807 echo \$dflt
1808 exit 1
1809 EOSC
1810 chmod +x loc
1811 $eunicefix loc
1812 loclist="
1813 awk
1814 cat
1815 comm
1816 cp
1817 echo
1818 expr
1819 grep
1820 ls
1821 make
1822 mkdir
1823 rm
1824 sed
1825 sort
1826 touch
1827 tr
1828 uniq
1829 "
1830 trylist="
1831 Mcc
1832 ar
1833 byacc
1834 cpp
1835 csh
1836 date
1837 egrep
1838 gzip
1839 less
1840 ln
1841 more
1842 nm
1843 nroff
1844 pg
1845 test
1846 uname
1847 zip
1848 "
1849 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1850 pth="$pth /lib /usr/lib"
1851 for file in $loclist; do
1852         eval xxx=\$$file
1853         case "$xxx" in
1854         /*|?:[\\/]*)
1855                 if test -f "$xxx"; then
1856                         : ok
1857                 else
1858                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1859                         xxx=`./loc $file $file $pth`
1860                 fi
1861                 ;;
1862         '') xxx=`./loc $file $file $pth`;;
1863         *) xxx=`./loc $xxx $xxx $pth`;;
1864         esac
1865         eval $file=$xxx
1866         eval _$file=$xxx
1867         case "$xxx" in
1868         /*)
1869                 echo $file is in $xxx.
1870                 ;;
1871         ?:[\\/]*)
1872                 echo $file is in $xxx.
1873                 ;;
1874         *)
1875                 echo "I don't know where '$file' is, and my life depends on it." >&4
1876                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1877                 exit 1
1878                 ;;
1879         esac
1880 done
1881 echo " "
1882 echo "Don't worry if any of the following aren't found..."
1883 say=offhand
1884 for file in $trylist; do
1885         eval xxx=\$$file
1886         case "$xxx" in
1887         /*|?:[\\/]*)
1888                 if test -f "$xxx"; then
1889                         : ok
1890                 else
1891                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1892                         xxx=`./loc $file $file $pth`
1893                 fi
1894                 ;;
1895         '') xxx=`./loc $file $file $pth`;;
1896         *) xxx=`./loc $xxx $xxx $pth`;;
1897         esac
1898         eval $file=$xxx
1899         eval _$file=$xxx
1900         case "$xxx" in
1901         /*)
1902                 echo $file is in $xxx.
1903                 ;;
1904         ?:[\\/]*)
1905                 echo $file is in $xxx.
1906                 ;;
1907         *)
1908                 echo "I don't see $file out there, $say."
1909                 say=either
1910                 ;;
1911         esac
1912 done
1913 case "$egrep" in
1914 egrep)
1915         echo "Substituting grep for egrep."
1916         egrep=$grep
1917         ;;
1918 esac
1919 case "$ln" in
1920 ln)
1921         echo "Substituting cp for ln."
1922         ln=$cp
1923         ;;
1924 esac
1925 case "$test" in
1926 test)
1927         echo "Hopefully test is built into your sh."
1928         ;;
1929 *)
1930         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1931                 echo "Using the test built into your sh."
1932                 test=test
1933                 _test=test
1934         fi
1935         ;;
1936 esac
1937 case "$echo" in
1938 echo)
1939         echo "Hopefully echo is built into your sh."
1940         ;;
1941 '') ;;
1942 *)
1943         echo " "
1944 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1945         $echo $n "hi there$c" >foo1
1946         echo $n "hi there$c" >foo2
1947         if cmp foo1 foo2 >/dev/null 2>&1; then
1948                 echo "They are compatible.  In fact, they may be identical."
1949         else
1950                 case "$n" in
1951                 '-n') n='' c='\c';;
1952                 *) n='-n' c='';;
1953                 esac
1954                 cat <<FOO
1955 They are not compatible!  You are probably running ksh on a non-USG system.
1956 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1957 have echo built in and we may have to run some Bourne shell scripts.  That
1958 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1959
1960 FOO
1961                 $echo $n "The star should be here-->$c"
1962                 $echo "*"
1963         fi
1964         $rm -f foo1 foo2
1965         ;;
1966 esac
1967
1968 : determine whether symbolic links are supported
1969 echo " "
1970 $touch blurfl
1971 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1972         echo "Symbolic links are supported." >&4
1973         lns="$ln -s"
1974 else
1975         echo "Symbolic links are NOT supported." >&4
1976         lns="$ln"
1977 fi
1978 $rm -f blurfl sym
1979
1980 : see whether [:lower:] and [:upper:] are supported character classes
1981 echo " "
1982 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1983 ABYZ)
1984         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1985         up='[:upper:]'
1986         low='[:lower:]'
1987         ;;
1988 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1989         # (0xc9 and 0xd1), therefore that is a nice testing point.
1990         if test "X$up" = X -o "X$low" = X; then
1991             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1992             ij) up='[A-Z]'
1993                 low='[a-z]'
1994                 ;;
1995             esac
1996         fi
1997         if test "X$up" = X -o "X$low" = X; then
1998             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1999             ij) up='A-Z'
2000                 low='a-z'
2001                 ;;
2002             esac
2003         fi
2004         if test "X$up" = X -o "X$low" = X; then
2005             case "`echo IJ | od -x 2>/dev/null`" in
2006             *C9D1*|*c9d1*)
2007                 echo "Hey, this might be EBCDIC." >&4
2008                 if test "X$up" = X -o "X$low" = X; then
2009                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2010                     ij) up='[A-IJ-RS-Z]'
2011                         low='[a-ij-rs-z]'
2012                         ;;
2013                     esac
2014                 fi
2015                 if test "X$up" = X -o "X$low" = X; then
2016                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2017                     ij) up='A-IJ-RS-Z'
2018                         low='a-ij-rs-z'
2019                         ;;
2020                     esac
2021                 fi
2022                 ;;
2023             esac
2024         fi
2025 esac
2026 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2027 ij)
2028     echo "Using $up and $low to convert case." >&4
2029     ;;
2030 *)
2031     echo "I don't know how to translate letters from upper to lower case." >&4
2032     echo "Your tr is not acting any way I know of." >&4
2033     exit 1
2034     ;;
2035 esac
2036 : set up the translation script tr, must be called with ./tr of course
2037 cat >tr <<EOSC
2038 $startsh
2039 case "\$1\$2" in
2040 '[A-Z][a-z]') exec $tr '$up' '$low';;
2041 '[a-z][A-Z]') exec $tr '$low' '$up';;
2042 esac
2043 exec $tr "\$@"
2044 EOSC
2045 chmod +x tr
2046 $eunicefix tr
2047
2048 : Try to determine whether config.sh was made on this system
2049 case "$config_sh" in
2050 '')
2051 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2052 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2053 # because the A-Z/a-z are not consecutive.
2054 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2055         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2056 newmyuname="$myuname"
2057 dflt=n
2058 case "$knowitall" in
2059 '')
2060         if test -f ../config.sh; then
2061                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2062                         eval "`grep myuname= ../config.sh`"
2063                 fi
2064                 if test "X$myuname" = "X$newmyuname"; then
2065                         dflt=y
2066                 fi
2067         fi
2068         ;;
2069 *) dflt=y;;
2070 esac
2071
2072 : Get old answers from old config file if Configure was run on the
2073 : same system, otherwise use the hints.
2074 hint=default
2075 cd ..
2076 if test -f config.sh; then
2077         echo " "
2078         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2079         . UU/myread
2080         case "$ans" in
2081         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2082         *)  echo "Fetching default answers from your old config.sh file..." >&4
2083                 tmp_n="$n"
2084                 tmp_c="$c"
2085                 tmp_sh="$sh"
2086                 . ./config.sh
2087                 cp config.sh UU
2088                 n="$tmp_n"
2089                 c="$tmp_c"
2090                 : Older versions did not always set $sh.  Catch re-use of such
2091                 : an old config.sh.
2092                 case "$sh" in
2093                 '') sh="$tmp_sh" ;;
2094                 esac
2095                 hint=previous
2096                 ;;
2097         esac
2098 fi
2099 if test ! -f config.sh; then
2100         $cat <<EOM
2101
2102 First time through, eh?  I have some defaults handy for some systems
2103 that need some extra help getting the Configure answers right:
2104
2105 EOM
2106         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2107         dflt=''
2108         : Half the following guesses are probably wrong... If you have better
2109         : tests or hints, please send them to perlbug@perl.com
2110         : The metaconfig authors would also appreciate a copy...
2111         $test -f /irix && osname=irix
2112         $test -f /xenix && osname=sco_xenix
2113         $test -f /dynix && osname=dynix
2114         $test -f /dnix && osname=dnix
2115         $test -f /lynx.os && osname=lynxos
2116         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2117         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2118         $test -f /bin/mips && /bin/mips && osname=mips
2119         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2120                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2121         $test -d /usr/apollo/bin && osname=apollo
2122         $test -f /etc/saf/_sactab && osname=svr4
2123         $test -d /usr/include/minix && osname=minix
2124         if $test -d /MachTen -o -d /MachTen_Folder; then
2125                 osname=machten
2126                 if $test -x /sbin/version; then
2127                         osvers=`/sbin/version | $awk '{print $2}' |
2128                         $sed -e 's/[A-Za-z]$//'`
2129                 elif $test -x /usr/etc/version; then
2130                         osvers=`/usr/etc/version | $awk '{print $2}' |
2131                         $sed -e 's/[A-Za-z]$//'`
2132                 else
2133                         osvers="$2.$3"
2134                 fi
2135         fi
2136        $test -f /sys/posix.dll &&
2137                $test -f /usr/bin/what &&
2138                set X `/usr/bin/what /sys/posix.dll` &&
2139                $test "$3" = UWIN &&
2140                osname=uwin &&
2141                osvers="$5"
2142         if $test -f $uname; then
2143                 set X $myuname
2144                 shift
2145
2146                 case "$5" in
2147                 fps*) osname=fps ;;
2148                 mips*)
2149                         case "$4" in
2150                         umips) osname=umips ;;
2151                         *) osname=mips ;;
2152                         esac;;
2153                 [23]100) osname=mips ;;
2154                 next*) osname=next ;;
2155                 i386*)
2156                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2157                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2158                                 osname='sco'
2159                                 osvers=$tmp
2160                         elif $test -f /etc/kconfig; then
2161                                 osname=isc
2162                                 if test "$lns" = "$ln -s"; then
2163                                         osvers=4
2164                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2165                                         osvers=3
2166                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2167                                         osvers=2
2168                                 fi
2169                         fi
2170                         tmp=''
2171                         ;;
2172                 pc*)
2173                         if test -n "$DJGPP"; then
2174                                 osname=dos
2175                                 osvers=djgpp
2176                         fi
2177                         ;;
2178                 esac
2179
2180                 case "$1" in
2181                 aix) osname=aix
2182                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2183                         case "$tmp" in
2184                         'not found') osvers="$4"."$3" ;;
2185                         '<3240'|'<>3240') osvers=3.2.0 ;;
2186                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2187                         '=3250'|'>3250') osvers=3.2.5 ;;
2188                         *) osvers=$tmp;;
2189                         esac
2190                         ;;
2191                 *dc.osx) osname=dcosx
2192                         osvers="$3"
2193                         ;;
2194                 dnix) osname=dnix
2195                         osvers="$3"
2196                         ;;
2197                 domainos) osname=apollo
2198                         osvers="$3"
2199                         ;;
2200                 dgux) osname=dgux 
2201                         osvers="$3"
2202                         ;;
2203                 dynixptx*) osname=dynixptx
2204                         osvers=`echo "$4"|sed 's/^v//'`
2205                         ;;
2206                 freebsd) osname=freebsd 
2207                         osvers="$3" ;;
2208                 genix) osname=genix ;;
2209                 hp*) osname=hpux 
2210                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2211                         ;;
2212                 irix*) osname=irix
2213                         case "$3" in
2214                         4*) osvers=4 ;;
2215                         5*) osvers=5 ;;
2216                         *)      osvers="$3" ;;
2217                         esac
2218                         ;;
2219                 linux) osname=linux
2220                         case "$3" in
2221                         *)      osvers="$3" ;;
2222                         esac
2223                         ;;
2224                 MiNT) osname=mint
2225                         ;;
2226                 netbsd*) osname=netbsd
2227                         osvers="$3"
2228                         ;;
2229                 news-os) osvers="$3"
2230                         case "$3" in
2231                         4*) osname=newsos4 ;;
2232                         *) osname=newsos ;;
2233                         esac
2234                         ;;
2235                 bsd386) osname=bsd386
2236                         osvers=`$uname -r`
2237                         ;;
2238                 POSIX-BC | posix-bc ) osname=posix-bc
2239                         osvers="$3"
2240                         ;;
2241                 powerux | power_ux | powermax_os | powermaxos | \
2242                 powerunix | power_unix) osname=powerux
2243                         osvers="$3"
2244                         ;;
2245                 next*) osname=next ;;
2246                 solaris) osname=solaris
2247                         case "$3" in
2248                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2249                         *)      osvers="$3" ;;
2250                         esac
2251                         ;;
2252                 sunos) osname=sunos
2253                         case "$3" in
2254                         5*) osname=solaris
2255                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2256                         *)      osvers="$3" ;;
2257                         esac
2258                         ;;
2259                 titanos) osname=titanos
2260                         case "$3" in
2261                         1*) osvers=1 ;;
2262                         2*) osvers=2 ;;
2263                         3*) osvers=3 ;;
2264                         4*) osvers=4 ;;
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 ultrix) osname=ultrix
2269                         osvers="$3"
2270                         ;;
2271                 osf1|mls+)      case "$5" in
2272                                 alpha)
2273                                         osname=dec_osf
2274                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2275                                         ;;
2276                         hp*)    osname=hp_osf1  ;;
2277                         mips)   osname=mips_osf1 ;;
2278                         esac
2279                         ;;
2280                 uts) osname=uts 
2281                         osvers="$3"
2282                         ;;
2283                 qnx) osname=qnx
2284                         osvers="$4"
2285                         ;;
2286                 $2) case "$osname" in
2287                         *isc*) ;;
2288                         *freebsd*) ;;
2289                         svr*)
2290                                 : svr4.x or possibly later
2291                                 case "svr$3" in 
2292                                 ${osname}*)
2293                                         osname=svr$3
2294                                         osvers=$4
2295                                         ;;
2296                                 esac
2297                                 case "$osname" in
2298                                 svr4.0)
2299                                         : Check for ESIX
2300                                         if test -f /stand/boot ; then
2301                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2302                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2303                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2304                                                         if test -n "$isesix"; then
2305                                                                 osname=esix4
2306                                                         fi
2307                                                 fi
2308                                         fi
2309                                         ;;
2310                                 esac
2311                                 ;;
2312                         *)      if test -f /etc/systemid; then
2313                                         osname=sco
2314                                         set `echo $3 | $sed 's/\./ /g'` $4
2315                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2316                                                 osvers=$1.$2.$3
2317                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2318                                                 osvers=$1.$2
2319                                         elif $test -f $src/hints/sco_$1.sh; then
2320                                                 osvers=$1
2321                                         fi
2322                                 else
2323                                         case "$osname" in
2324                                         '') : Still unknown.  Probably a generic Sys V.
2325                                                 osname="sysv"
2326                                                 osvers="$3"
2327                                                 ;;
2328                                         esac
2329                                 fi
2330                                 ;;
2331                         esac
2332                         ;;
2333                 *)      case "$osname" in
2334                         '') : Still unknown.  Probably a generic BSD.
2335                                 osname="$1"
2336                                 osvers="$3"
2337                                 ;;
2338                         esac
2339                         ;;
2340                 esac
2341         else
2342                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2343                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2344                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2345                                 osname=news_os
2346                         fi
2347                         $rm -f UU/kernel.what
2348                 elif test -d c:/.; then
2349                         set X $myuname
2350                         osname=os2
2351                         osvers="$5"
2352                 fi
2353         fi
2354         
2355         : Now look for a hint file osname_osvers, unless one has been
2356         : specified already.
2357         case "$hintfile" in
2358         ''|' ')
2359                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2360                 : Also try without trailing minor version numbers.
2361                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2362                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2363                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2364                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2365                 case "$file" in
2366                 '') dflt=none ;;
2367                 *)  case "$osvers" in
2368                         '') dflt=$file
2369                                 ;;
2370                         *)  if $test -f $src/hints/$file.sh ; then
2371                                         dflt=$file
2372                                 elif $test -f $src/hints/$xfile.sh ; then
2373                                         dflt=$xfile
2374                                 elif $test -f $src/hints/$xxfile.sh ; then
2375                                         dflt=$xxfile
2376                                 elif $test -f $src/hints/$xxxfile.sh ; then
2377                                         dflt=$xxxfile
2378                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2379                                         dflt=$xxxxfile
2380                                 elif $test -f "$src/hints/${osname}.sh" ; then
2381                                         dflt="${osname}"
2382                                 else
2383                                         dflt=none
2384                                 fi
2385                                 ;;
2386                         esac
2387                         ;;
2388                 esac
2389                 if $test -f Policy.sh ; then
2390                         case "$dflt" in
2391                         *Policy*) ;;
2392                         none) dflt="Policy" ;;
2393                         *) dflt="Policy $dflt" ;;
2394                         esac
2395                 fi
2396                 ;;
2397         *)
2398                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2399                 ;;
2400         esac
2401
2402         if $test -f Policy.sh ; then
2403                 $cat <<EOM
2404
2405 There's also a Policy hint file available, which should make the
2406 site-specific (policy) questions easier to answer.
2407 EOM
2408
2409         fi
2410
2411         $cat <<EOM
2412
2413 You may give one or more space-separated answers, or "none" if appropriate.
2414 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2415 is a good thing.  DO NOT give a wrong version or a wrong OS.
2416
2417 EOM
2418
2419         rp="Which of these apply, if any?"
2420         . UU/myread
2421         tans=$ans
2422         for file in $tans; do
2423                 if $test X$file = XPolicy -a -f Policy.sh; then
2424                         . Policy.sh
2425                         $cat Policy.sh >> UU/config.sh
2426                 elif $test -f $src/hints/$file.sh; then
2427                         . $src/hints/$file.sh
2428                         $cat $src/hints/$file.sh >> UU/config.sh
2429                 elif $test X$tans = X -o X$tans = Xnone ; then
2430                         : nothing
2431                 else
2432                         : Give one chance to correct a possible typo.
2433                         echo "$file.sh does not exist"
2434                         dflt=$file
2435                         rp="hint to use instead?"
2436                         . UU/myread
2437                         for file in $ans; do
2438                                 if $test -f "$src/hints/$file.sh"; then
2439                                         . $src/hints/$file.sh
2440                                         $cat $src/hints/$file.sh >> UU/config.sh
2441                                 elif $test X$ans = X -o X$ans = Xnone ; then
2442                                         : nothing
2443                                 else
2444                                         echo "$file.sh does not exist -- ignored."
2445                                 fi
2446                         done
2447                 fi
2448         done
2449
2450         hint=recommended
2451         : Remember our hint file for later.
2452         if $test -f "$src/hints/$file.sh" ; then
2453                 hintfile="$file"
2454         else
2455                 hintfile=''
2456         fi
2457 fi
2458 cd UU
2459 ;;
2460 *)
2461         echo " "
2462         echo "Fetching default answers from $config_sh..." >&4
2463         tmp_n="$n"
2464         tmp_c="$c"
2465         cd ..
2466         cp $config_sh config.sh 2>/dev/null
2467         chmod +w config.sh
2468         . ./config.sh
2469         cd UU
2470         cp ../config.sh .
2471         n="$tmp_n"
2472         c="$tmp_c"
2473         hint=previous
2474         ;;
2475 esac
2476 test "$override" && . ./optdef.sh
2477 myuname="$newmyuname"
2478
2479 : Restore computed paths
2480 for file in $loclist $trylist; do
2481         eval $file="\$_$file"
2482 done
2483
2484 cat << EOM
2485
2486 Configure uses the operating system name and version to set some defaults.
2487 The default value is probably right if the name rings a bell. Otherwise,
2488 since spelling matters for me, either accept the default or answer "none"
2489 to leave it blank.
2490
2491 EOM
2492 case "$osname" in
2493         ''|' ')
2494                 case "$hintfile" in
2495                 ''|' '|none) dflt=none ;;
2496                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2497                 esac
2498                 ;;
2499         *) dflt="$osname" ;;
2500 esac
2501 rp="Operating system name?"
2502 . ./myread
2503 case "$ans" in
2504 none)  osname='' ;;
2505 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2506 esac
2507 echo " "
2508 case "$osvers" in
2509         ''|' ')
2510                 case "$hintfile" in
2511                 ''|' '|none) dflt=none ;;
2512                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2513                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2514                         case "$dflt" in
2515                         ''|' ') dflt=none ;;
2516                         esac
2517                         ;;
2518                 esac
2519                 ;;
2520         *) dflt="$osvers" ;;
2521 esac
2522 rp="Operating system version?"
2523 . ./myread
2524 case "$ans" in
2525 none)  osvers='' ;;
2526 *) osvers="$ans" ;;
2527 esac
2528
2529 : who configured the system
2530 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2531 cf_by=`(logname) 2>/dev/null`
2532 case "$cf_by" in
2533 "")
2534         cf_by=`(whoami) 2>/dev/null`
2535         case "$cf_by" in
2536         "") cf_by=unknown ;;
2537         esac ;;
2538 esac
2539
2540 : set up the script used to warn in case of inconsistency
2541 cat <<EOS >whoa
2542 $startsh
2543 EOS
2544 cat <<'EOSC' >>whoa
2545 dflt=y
2546 echo " "
2547 echo "*** WHOA THERE!!! ***" >&4
2548 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2549 rp="    Keep the $hint value?"
2550 . ./myread
2551 case "$ans" in
2552 y) td=$was; tu=$was;;
2553 esac
2554 EOSC
2555
2556 : function used to set $1 to $val
2557 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2558 case "$val$was" in
2559 $define$undef) . ./whoa; eval "$var=\$td";;
2560 $undef$define) . ./whoa; eval "$var=\$tu";;
2561 *) eval "$var=$val";;
2562 esac'
2563
2564 cat <<EOM
2565
2566 Perl can be built to take advantage of threads, on some systems.
2567 To do so, Configure must be run with -Dusethreads.
2568
2569 Note that threading is a highly experimental feature, and
2570 some known race conditions still remain.  If you choose to try
2571 it, be very sure to not actually deploy it for production
2572 purposes.  README.threads has more details, and is required
2573 reading if you enable threads.
2574 EOM
2575 case "$usethreads" in
2576 $define|true|[yY]*)     dflt='y';;
2577 *) dflt='n';;
2578 esac
2579 rp='Build a threading Perl?'
2580 . ./myread
2581 case "$ans" in
2582 y|Y)    val="$define" ;;     
2583 *)      val="$undef" ;;
2584 esac
2585 set usethreads
2586 eval $setvar 
2587
2588 case "$d_oldpthreads" in
2589 '')     : Configure tests would be welcome here.  For now, assume undef.
2590         val="$undef" ;;
2591 *)      val="$d_oldpthreads" ;;
2592 esac
2593 set d_oldpthreads
2594 eval $setvar
2595
2596
2597 case "$usethreads" in
2598 "$define"|true|[yY]*)
2599 : Look for a hint-file generated 'call-back-unit'.  If the
2600 : user has specified that a threading perl is to be built,
2601 : we may need to set or change some other defaults.
2602         if $test -f usethreads.cbu; then
2603                 echo "Your platform has some specific hints for threaded builds, using them..."
2604                 . ./usethreads.cbu
2605         else
2606                 $cat <<EOM
2607 (Your platform doesn't have any specific hints for threaded builds.
2608  Assuming POSIX threads, then.)
2609 EOM
2610         fi
2611     ;;
2612 esac
2613
2614 cat <<EOM
2615
2616 Perl can be built so that multiple Perl interpreters can coexist
2617 within the same Perl executable.  To do so, Configure must be run with
2618 -Dusemultiplicity.
2619
2620 Normally you do not need this and you should answer no.
2621
2622 EOM
2623 case "$usemultiplicity" in
2624 $define|true|[yY]*)     dflt='y';;
2625 *) dflt='n';;
2626 esac
2627 rp='Build Perl for multiplicity?'
2628 . ./myread
2629 case "$ans" in
2630 y|Y)    val="$define" ;;     
2631 *)      val="$undef" ;;
2632 esac
2633 set usemultiplicity
2634 eval $setvar 
2635
2636 : determine where manual pages are on this system
2637 echo " "
2638 case "$sysman" in
2639 '') 
2640         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2641         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2642         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2643         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2644         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2645         sysman=`./loc . /usr/man/man1 $syspath`
2646         ;;
2647 esac
2648 if $test -d "$sysman"; then
2649         echo "System manual is in $sysman." >&4
2650 else
2651         echo "Could not find manual pages in source form." >&4
2652 fi
2653
2654 : see what memory models we can support
2655 case "$models" in
2656 '')
2657         $cat >pdp11.c <<'EOP'
2658 int main() {
2659 #ifdef pdp11
2660         exit(0);
2661 #else
2662         exit(1);
2663 #endif
2664 }
2665 EOP
2666         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2667         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2668                 dflt='unsplit split'
2669         else
2670                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2671                 case "$tans" in
2672                 X) dflt='none';;
2673                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2674                                 dflt='small'
2675                         else
2676                                 dflt=''
2677                         fi
2678                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2679                                 dflt="$dflt medium"
2680                         fi
2681                         if $test -d /lib/large || $test -d /usr/lib/large; then
2682                                 dflt="$dflt large"
2683                         fi
2684                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2685                                 dflt="$dflt huge"
2686                         fi
2687                 esac
2688         fi;;
2689 *) dflt="$models";;
2690 esac
2691 $cat <<EOM
2692  
2693 Some systems have different model sizes.  On most systems they are called
2694 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2695 split.  If your system doesn't support different memory models, say "none".
2696 If you wish to force everything to one memory model, say "none" here and
2697 put the appropriate flags later when it asks you for other cc and ld flags.
2698 Venix systems may wish to put "none" and let the compiler figure things out.
2699 (In the following question multiple model names should be space separated.)
2700
2701 The default for most systems is "none".
2702
2703 EOM
2704 rp="Which memory models are supported?"
2705 . ./myread
2706 models="$ans"
2707
2708 case "$models" in
2709 none)
2710         small=''
2711         medium=''
2712         large=''
2713         huge=''
2714         unsplit=''
2715         split=''
2716         ;;
2717 *split)
2718         case "$split" in
2719         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2720                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2721                         dflt='-i'
2722                 else
2723                         dflt='none'
2724                 fi;;
2725         *) dflt="$split";;
2726         esac
2727         rp="What flag indicates separate I and D space?"
2728         . ./myread
2729         tans="$ans"
2730         case "$tans" in
2731         none) tans='';;
2732         esac
2733         split="$tans"
2734         unsplit='';;
2735 *large*|*small*|*medium*|*huge*)
2736         case "$models" in
2737         *large*)
2738                 case "$large" in
2739                 '') dflt='-Ml';;
2740                 *) dflt="$large";;
2741                 esac
2742         rp="What flag indicates large model?"
2743         . ./myread
2744         tans="$ans"
2745         case "$tans" in
2746         none) tans='';
2747         esac
2748         large="$tans";;
2749         *) large='';;
2750         esac
2751         case "$models" in
2752         *huge*) case "$huge" in
2753                 '') dflt='-Mh';;
2754                 *) dflt="$huge";;
2755                 esac
2756                 rp="What flag indicates huge model?"
2757                 . ./myread
2758                 tans="$ans"
2759                 case "$tans" in
2760                 none) tans='';
2761                 esac
2762                 huge="$tans";;
2763         *) huge="$large";;
2764         esac
2765         case "$models" in
2766         *medium*) case "$medium" in
2767                 '') dflt='-Mm';;
2768                 *) dflt="$medium";;
2769                 esac
2770                 rp="What flag indicates medium model?"
2771                 . ./myread
2772                 tans="$ans"
2773                 case "$tans" in
2774                 none) tans='';
2775                 esac
2776                 medium="$tans";;
2777         *) medium="$large";;
2778         esac
2779         case "$models" in
2780         *small*) case "$small" in
2781                 '') dflt='none';;
2782                 *) dflt="$small";;
2783                 esac
2784                 rp="What flag indicates small model?"
2785                 . ./myread
2786                 tans="$ans"
2787                 case "$tans" in
2788                 none) tans='';
2789                 esac
2790                 small="$tans";;
2791         *) small='';;
2792         esac
2793         ;;
2794 *)
2795         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2796         ;;
2797 esac
2798 $rm -f pdp11.* pdp11
2799
2800 : make some quick guesses about what we are up against
2801 echo " "
2802 $echo $n "Hmm...  $c"
2803 echo exit 1 >bsd
2804 echo exit 1 >usg
2805 echo exit 1 >v7
2806 echo exit 1 >osf1
2807 echo exit 1 >eunice
2808 echo exit 1 >xenix
2809 echo exit 1 >venix
2810 echo exit 1 >os2
2811 d_bsd="$undef"
2812 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2813 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2814 then
2815         echo "Looks kind of like an OSF/1 system, but we'll see..."
2816         echo exit 0 >osf1
2817 elif test `echo abc | tr a-z A-Z` = Abc ; then
2818         xxx=`./loc addbib blurfl $pth`
2819         if $test -f $xxx; then
2820         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2821                 echo exit 0 >bsd
2822                 echo exit 0 >usg
2823         else
2824                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2825                         echo "Looks kind of like an extended USG system, but we'll see..."
2826                 else
2827                         echo "Looks kind of like a USG system, but we'll see..."
2828                 fi
2829                 echo exit 0 >usg
2830         fi
2831 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2832         echo "Looks kind of like a BSD system, but we'll see..."
2833         d_bsd="$define"
2834         echo exit 0 >bsd
2835 else
2836         echo "Looks kind of like a Version 7 system, but we'll see..."
2837         echo exit 0 >v7
2838 fi
2839 case "$eunicefix" in
2840 *unixtovms*)
2841         $cat <<'EOI'
2842 There is, however, a strange, musty smell in the air that reminds me of
2843 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2844 EOI
2845         echo exit 0 >eunice
2846         d_eunice="$define"
2847 : it so happens the Eunice I know will not run shell scripts in Unix format
2848         ;;
2849 *)
2850         echo " "
2851         echo "Congratulations.  You aren't running Eunice."
2852         d_eunice="$undef"
2853         ;;
2854 esac
2855 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2856 case "$p_" in
2857 :) ;;
2858 *)
2859         $cat <<'EOI'
2860 I have the feeling something is not exactly right, however...don't tell me...
2861 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2862 EOI
2863         echo exit 0 >os2
2864         ;;
2865 esac
2866 if test -f /xenix; then
2867         echo "Actually, this looks more like a XENIX system..."
2868         echo exit 0 >xenix
2869         d_xenix="$define"
2870 else
2871         echo " "
2872         echo "It's not Xenix..."
2873         d_xenix="$undef"
2874 fi
2875 chmod +x xenix
2876 $eunicefix xenix
2877 if test -f /venix; then
2878         echo "Actually, this looks more like a VENIX system..."
2879         echo exit 0 >venix
2880 else
2881         echo " "
2882         if ./xenix; then
2883                 : null
2884         else
2885                 echo "Nor is it Venix..."
2886         fi
2887 fi
2888 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2889 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2890 $rm -f foo
2891
2892 : see if we need a special compiler
2893 echo " "
2894 if ./usg; then
2895         case "$cc" in
2896         '') case "$Mcc" in
2897                 /*) dflt='Mcc';;
2898                 *) case "$large" in
2899                         -M*) dflt='cc';;
2900                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2901                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2902                                                 dflt='cc'
2903                                         else
2904                                                 dflt='cc -M'
2905                                         fi
2906                                 else
2907                                         dflt='cc'
2908                                 fi;;
2909                         esac;;
2910                 esac;;
2911         *)  dflt="$cc";;
2912         esac
2913         case "$dflt" in
2914         *M*)    $cat <<'EOM'
2915 On some older systems the default C compiler will not resolve multiple global
2916 references that happen to have the same name.  On some such systems the "Mcc"
2917 command may be used to force these to be resolved.  On other systems a "cc -M"
2918 command is required.  (Note that the -M flag on other systems indicates a
2919 memory model to use!) If you have the Gnu C compiler, you might wish to use
2920 that instead.
2921
2922 EOM
2923         ;;
2924         esac
2925         rp="Use which C compiler?"
2926         . ./myread
2927         cc="$ans"
2928 else
2929         case "$cc" in
2930         '') dflt=cc;;
2931         *) dflt="$cc";;
2932         esac
2933         rp="Use which C compiler?"
2934         . ./myread
2935         cc="$ans"
2936 fi
2937 : Look for a hint-file generated 'call-back-unit'.  Now that the
2938 : user has specified the compiler, we may need to set or change some
2939 : other defaults.
2940 if $test -f cc.cbu; then
2941     . ./cc.cbu
2942 fi
2943 echo " "
2944 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2945 $cat >gccvers.c <<EOM
2946 #include <stdio.h>
2947 int main() {
2948 #ifdef __GNUC__
2949 #ifdef __VERSION__
2950         printf("%s\n", __VERSION__);
2951 #else
2952         printf("%s\n", "1");
2953 #endif
2954 #endif
2955         exit(0);
2956 }
2957 EOM
2958 if $cc -o gccvers gccvers.c; then
2959         gccversion=`./gccvers`
2960         case "$gccversion" in
2961         '') echo "You are not using GNU cc." ;;
2962         *)  echo "You are using GNU cc $gccversion." ;;
2963         esac
2964 else
2965         echo " "
2966         echo "*** WHOA THERE!!! ***" >&4
2967         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2968         case "$knowitall" in
2969         '')
2970         echo "    You'd better start hunting for one and let me know about it." >&4
2971                 exit 1
2972                 ;;
2973         esac
2974 fi
2975 $rm -f gccvers*
2976 case "$gccversion" in
2977 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2978 esac
2979
2980 cat <<EOM
2981
2982 Perl can be built to take advantage of explicit 64-bit interfaces,
2983 on some systems.  To do so, Configure must be run with -Duse64bits.
2984
2985 If this doesn't make any sense to you, just accept the default 'n'.
2986 EOM
2987 case "$use64bits" in
2988 $define|true|[yY]*)     dflt='y';;
2989 *) dflt='n';;
2990 esac
2991 rp='Try to use explicit 64-bit interfaces, if available?'
2992 . ./myread
2993 case "$ans" in
2994 y|Y) 
2995         val="$define"
2996         ;;     
2997 *)      
2998         val="$undef"
2999         ;;
3000 esac
3001 set use64bits
3002 eval $setvar
3003
3004 case "$archname64" in
3005 '') archname64='' ;;    # not a typo
3006 esac
3007
3008 case "$use64bits" in
3009 "$define"|true|[yY]*)
3010 : Look for a hint-file generated 'call-back-unit'.  If the
3011 : user has specified that a 64 bit perl is to be built,
3012 : we may need to set or change some other defaults.
3013         if $test -f use64bits.cbu; then
3014                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3015                 . ./use64bits.cbu
3016         else
3017                 $cat <<EOM
3018 (Your platform doesn't have any specific hints for 64-bit builds.
3019  This is probably okay, especially if your system is a true 64-bit system.)
3020 EOM
3021                 case "$gccversion" in
3022                 '')     ;;
3023                 *)      $cat <<EOM
3024 But since you seem to be using gcc,
3025 I will now add -DUSE_LONG_LONG to the compilation flags.
3026 EOM
3027                         ccflags="$ccflags -DUSE_LONG_LONG"
3028                         ;;
3029                 esac
3030         fi
3031         ;;
3032 esac
3033
3034 : determine the architecture name
3035 echo " "
3036 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3037         tarch=`arch`"-$osname"
3038 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3039         if uname -m > tmparch 2>&1 ; then
3040                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3041                         -e 's/$/'"-$osname/" tmparch`
3042         else
3043                 tarch="$osname"
3044         fi
3045         $rm -f tmparch
3046 else
3047         tarch="$osname"
3048 fi
3049 case "$myarchname" in
3050 ''|"$tarch") ;;
3051 *)
3052         echo "(Your architecture name used to be $myarchname.)"
3053         archname=''
3054         ;;
3055 esac
3056 myarchname="$tarch"
3057 case "$archname" in
3058 '') dflt="$tarch";;
3059 *) dflt="$archname";;
3060 esac
3061 rp='What is your architecture name'
3062 . ./myread
3063 archname="$ans"
3064 case "$usethreads" in
3065 $define)
3066         echo "Threads selected." >&4
3067         case "$archname" in
3068         *-thread*) echo "...and architecture name already has -thread." >&4
3069                 ;;
3070         *)      archname="$archname-thread"
3071                 echo "...setting architecture name to $archname." >&4
3072                 ;;
3073         esac
3074         ;;
3075 esac
3076 case "$usemultiplicity" in
3077 $define)
3078         echo "Multiplicity selected." >&4
3079         case "$archname" in
3080         *-multi*) echo "...and architecture name already has -multi." >&4
3081                 ;;
3082         *)      archname="$archname-multi"
3083                 echo "...setting architecture name to $archname." >&4
3084                 ;;
3085         esac
3086         ;;
3087 esac
3088 case "$use64bits" in
3089 $define)
3090         echo "Explicit 64-bitness selected." >&4
3091         case "$archname64" in
3092         '')
3093                 ;;
3094         *)
3095                 case "$archname" in
3096                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3097                         ;;
3098                 *)      archname="$archname-$archname64"
3099                         echo "...setting architecture name to $archname." >&4
3100                         ;;
3101                 esac
3102                 ;;
3103         esac
3104 esac
3105
3106 : decide how portable to be.  Allow command line overrides.
3107 case "$d_portable" in
3108 "$undef") ;;
3109 *)      d_portable="$define" ;;
3110 esac
3111
3112 : set up shell script to do ~ expansion
3113 cat >filexp <<EOSS
3114 $startsh
3115 : expand filename
3116 case "\$1" in
3117  ~/*|~)
3118         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3119         ;;
3120  ~*)
3121         if $test -f /bin/csh; then
3122                 /bin/csh -f -c "glob \$1"
3123                 failed=\$?
3124                 echo ""
3125                 exit \$failed
3126         else
3127                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3128                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3129                 if $test ! -d "\$dir"; then
3130                         me=\`basename \$0\`
3131                         echo "\$me: can't locate home directory for: \$name" >&2
3132                         exit 1
3133                 fi
3134                 case "\$1" in
3135                 */*)
3136                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3137                         ;;
3138                 *)
3139                         echo \$dir
3140                         ;;
3141                 esac
3142         fi
3143         ;;
3144 *)
3145         echo \$1
3146         ;;
3147 esac
3148 EOSS
3149 chmod +x filexp
3150 $eunicefix filexp
3151
3152 : now set up to get a file name
3153 cat <<EOS >getfile
3154 $startsh
3155 EOS
3156 cat <<'EOSC' >>getfile
3157 tilde=''
3158 fullpath=''
3159 already=''
3160 skip=''
3161 none_ok=''
3162 exp_file=''
3163 nopath_ok=''
3164 orig_rp="$rp"
3165 orig_dflt="$dflt"
3166 case "$gfpth" in
3167 '') gfpth='.' ;;
3168 esac
3169
3170 case "$fn" in
3171 *\(*)
3172         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3173         fn=`echo $fn | sed 's/(.*)//'`
3174         ;;
3175 esac
3176
3177 case "$fn" in
3178 *:*)
3179         loc_file=`expr $fn : '.*:\(.*\)'`
3180         fn=`expr $fn : '\(.*\):.*'`
3181         ;;
3182 esac
3183
3184 case "$fn" in
3185 *~*) tilde=true;;
3186 esac
3187 case "$fn" in
3188 */*) fullpath=true;;
3189 esac
3190 case "$fn" in
3191 *+*) skip=true;;
3192 esac
3193 case "$fn" in
3194 *n*) none_ok=true;;
3195 esac
3196 case "$fn" in
3197 *e*) exp_file=true;;
3198 esac
3199 case "$fn" in
3200 *p*) nopath_ok=true;;
3201 esac
3202
3203 case "$fn" in
3204 *f*) type='File';;
3205 *d*) type='Directory';;
3206 *l*) type='Locate';;
3207 esac
3208
3209 what="$type"
3210 case "$what" in
3211 Locate) what='File';;
3212 esac
3213
3214 case "$exp_file" in
3215 '')
3216         case "$d_portable" in
3217         "$define") ;;
3218         *) exp_file=true;;
3219         esac
3220         ;;
3221 esac
3222
3223 cd ..
3224 while test "$type"; do
3225         redo=''
3226         rp="$orig_rp"
3227         dflt="$orig_dflt"
3228         case "$tilde" in
3229         true) rp="$rp (~name ok)";;
3230         esac
3231         . UU/myread
3232         if test -f UU/getfile.ok && \
3233                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3234         then
3235                 value="$ans"
3236                 ansexp="$ans"
3237                 break
3238         fi
3239         case "$ans" in
3240         none)
3241                 value=''
3242                 ansexp=''
3243                 case "$none_ok" in
3244                 true) type='';;
3245                 esac
3246                 ;;
3247         *)
3248                 case "$tilde" in
3249                 '') value="$ans"
3250                         ansexp="$ans";;
3251                 *)
3252                         value=`UU/filexp $ans`
3253                         case $? in
3254                         0)
3255                                 if test "$ans" != "$value"; then
3256                                         echo "(That expands to $value on this system.)"
3257                                 fi
3258                                 ;;
3259                         *) value="$ans";;
3260                         esac
3261                         ansexp="$value"
3262                         case "$exp_file" in
3263                         '') value="$ans";;
3264                         esac
3265                         ;;
3266                 esac
3267                 case "$fullpath" in
3268                 true)
3269                         case "$ansexp" in
3270                         /*) value="$ansexp" ;;
3271                         *)
3272                                 redo=true
3273                                 case "$already" in
3274                                 true)
3275                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3276                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3277                                         ;;
3278                                 *)
3279                                 echo "Please give a full path name, starting with slash." >&4
3280                                         case "$tilde" in
3281                                         true)
3282                                 echo "Note that using ~name is ok provided it expands well." >&4
3283                                                 already=true
3284                                                 ;;
3285                                         esac
3286                                 esac
3287                                 ;;
3288                         esac
3289                         ;;
3290                 esac
3291                 case "$redo" in
3292                 '')
3293                         case "$type" in
3294                         File)
3295                                 for fp in $gfpth; do
3296                                         if test "X$fp" = X.; then
3297                                             pf="$ansexp"
3298                                         else    
3299                                             pf="$fp/$ansexp"
3300                                         fi
3301                                         if test -f "$pf"; then
3302                                                 type=''
3303                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3304                                         then
3305                                                 echo "($value is not a plain file, but that's ok.)"
3306                                                 type=''
3307                                         fi
3308                                         if test X"$type" = X; then
3309                                             value="$pf"
3310                                             break
3311                                         fi
3312                                 done
3313                                 ;;
3314                         Directory)
3315                                 for fp in $gfpth; do
3316                                         if test "X$fp" = X.; then
3317                                             pf="$ansexp"
3318                                         else    
3319                                             pf="$fp/$ansexp"
3320                                         fi
3321                                         if test -d "$pf"; then
3322                                                 type=''
3323                                                 value="$pf"
3324                                                 break
3325                                         fi
3326                                 done
3327                                 ;;
3328                         Locate)
3329                                 if test -d "$ansexp"; then
3330                                         echo "(Looking for $loc_file in directory $value.)"
3331                                         value="$value/$loc_file"
3332                                         ansexp="$ansexp/$loc_file"
3333                                 fi
3334                                 if test -f "$ansexp"; then
3335                                         type=''
3336                                 fi
3337                                 case "$nopath_ok" in
3338                                 true)   case "$value" in
3339                                         */*) ;;
3340                                         *)      echo "Assuming $value will be in people's path."
3341                                                 type=''
3342                                                 ;;
3343                                         esac
3344                                         ;;
3345                                 esac
3346                                 ;;
3347                         esac
3348
3349                         case "$skip" in
3350                         true) type='';
3351                         esac
3352
3353                         case "$type" in
3354                         '') ;;
3355                         *)
3356                                 if test "$fastread" = yes; then
3357                                         dflt=y
3358                                 else
3359                                         dflt=n
3360                                 fi
3361                                 rp="$what $value doesn't exist.  Use that name anyway?"
3362                                 . UU/myread
3363                                 dflt=''
3364                                 case "$ans" in
3365                                 y*) type='';;
3366                                 *) echo " ";;
3367                                 esac
3368                                 ;;
3369                         esac
3370                         ;;
3371                 esac
3372                 ;;
3373         esac
3374 done
3375 cd UU
3376 ans="$value"
3377 rp="$orig_rp"
3378 dflt="$orig_dflt"
3379 rm -f getfile.ok
3380 test "X$gfpthkeep" != Xy && gfpth=""
3381 EOSC
3382
3383 : determine root of directory hierarchy where package will be installed.
3384 case "$prefix" in
3385 '')
3386         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3387         ;;
3388 *)
3389         dflt="$prefix"
3390         ;;
3391 esac
3392 $cat <<EOM
3393
3394 By default, $package will be installed in $dflt/bin, manual pages
3395 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3396 installation directories. Typically this is something like /usr/local.
3397 If you wish to have binaries under /usr/bin but other parts of the
3398 installation under /usr/local, that's ok: you will be prompted
3399 separately for each of the installation directories, the prefix being
3400 only used to set the defaults.
3401
3402 EOM
3403 fn=d~
3404 rp='Installation prefix to use?'
3405 . ./getfile
3406 oldprefix=''
3407 case "$prefix" in
3408 '') ;;
3409 *)
3410         case "$ans" in
3411         "$prefix") ;;
3412         *) oldprefix="$prefix";;
3413         esac
3414         ;;
3415 esac
3416 prefix="$ans"
3417 prefixexp="$ansexp"
3418
3419 : is AFS running?
3420 echo " "
3421 case "$afs" in
3422 $define|true)   afs=true ;;
3423 $undef|false)   afs=false ;;
3424 *)      if test -d /afs; then
3425                 afs=true
3426         else
3427                 afs=false
3428         fi
3429         ;;
3430 esac
3431 if $afs; then
3432         echo "AFS may be running... I'll be extra cautious then..." >&4
3433 else
3434         echo "AFS does not seem to be running..." >&4
3435 fi
3436
3437 : determine installation prefix for where package is to be installed.
3438 if $afs; then 
3439 $cat <<EOM
3440
3441 Since you are running AFS, I need to distinguish the directory in which
3442 files will reside from the directory in which they are installed (and from
3443 which they are presumably copied to the former directory by occult means).
3444
3445 EOM
3446         case "$installprefix" in
3447         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3448         *) dflt="$installprefix";;
3449         esac
3450 else
3451 $cat <<EOM
3452
3453 In some special cases, particularly when building $package for distribution,
3454 it is convenient to distinguish between the directory in which files should 
3455 be installed from the directory ($prefix) in which they 
3456 will eventually reside.  For most users, these two directories are the same.
3457
3458 EOM
3459         case "$installprefix" in
3460         '') dflt=$prefix ;;
3461         *) dflt=$installprefix;;
3462         esac
3463 fi
3464 fn=d~
3465 rp='What installation prefix should I use for installing files?'
3466 . ./getfile
3467 installprefix="$ans"
3468 installprefixexp="$ansexp"
3469
3470 : set the prefixit variable, to compute a suitable default value
3471 prefixit='case "$3" in
3472 ""|none)
3473         case "$oldprefix" in
3474         "") eval "$1=\"\$$2\"";;
3475         *)
3476                 case "$3" in
3477                 "") eval "$1=";;
3478                 none)
3479                         eval "tp=\"\$$2\"";
3480                         case "$tp" in
3481                         ""|" ") eval "$1=\"\$$2\"";;
3482                         *) eval "$1=";;
3483                         esac;;
3484                 esac;;
3485         esac;;
3486 *)
3487         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3488         case "$tp" in
3489         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3490         /*-$oldprefix/*|\~*-$oldprefix/*)
3491                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3492         *) eval "$1=\"\$$2\"";;
3493         esac;;
3494 esac'
3495
3496 : set the base revision
3497 baserev=5.0
3498
3499 : get the patchlevel
3500 echo " "
3501 echo "Getting the current patchlevel..." >&4
3502 if $test -r $rsrc/patchlevel.h;then
3503         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3504         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3505 else
3506         patchlevel=0
3507         subversion=0
3508 fi
3509 $echo $n "(You have $package" $c
3510 case "$package" in
3511 "*$baserev")    ;;
3512 *)              $echo $n " $baserev" $c ;;
3513 esac
3514 $echo $n " patchlevel $patchlevel" $c
3515 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3516 echo ".)"
3517
3518 if test 0 -eq "$subversion"; then
3519         version=`LC_ALL=C; export LC_ALL; \
3520                  echo $baserev $patchlevel | \
3521                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3522 else
3523         version=`LC_ALL=C; export LC_ALL; \
3524                  echo $baserev $patchlevel $subversion | \
3525                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3526 fi
3527 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3528 if test "$subversion" -lt 50; then
3529         apiversion=`LC_ALL=C; export LC_ALL; \
3530                  LANGUAGE=C; export LANGUAGE; \
3531                  echo $baserev $patchlevel | \
3532                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3533 else
3534         apiversion="$version"
3535 fi
3536
3537 : determine installation style
3538 : For now, try to deduce it from prefix unless it is already set.
3539 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3540 case "$installstyle" in
3541 '')     case "$prefix" in
3542                 *perl*) dflt='lib';;
3543                 *) dflt='lib/perl5' ;;
3544         esac
3545         ;;
3546 *)      dflt='lib/perl5' ;;
3547 esac
3548 : Probably not worth prompting for this since we prompt for all
3549 : the directories individually, and the prompt would be too long and
3550 : confusing anyway.
3551 installstyle=$dflt
3552
3553 : determine where private library files go
3554 : Usual default is /usr/local/lib/perl5/$version.
3555 : Also allow things like /opt/perl/lib/$version, since 
3556 : /opt/perl/lib/perl5... would be redundant.
3557 : The default "style" setting is made in installstyle.U
3558 case "$installstyle" in
3559 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3560 *)       set dflt privlib lib/$version ;;
3561 esac
3562 eval $prefixit
3563 $cat <<EOM
3564
3565 There are some auxiliary files for $package that need to be put into a
3566 private library directory that is accessible by everyone.
3567
3568 EOM
3569 fn=d~+
3570 rp='Pathname where the private library files will reside?'
3571 . ./getfile
3572 privlib="$ans"
3573 privlibexp="$ansexp"
3574 : Change installation prefix, if necessary.
3575 if $test X"$prefix" != X"$installprefix"; then
3576         installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
3577 else
3578         installprivlib="$privlibexp"
3579 fi
3580
3581 : set the prefixup variable, to restore leading tilda escape
3582 prefixup='case "$prefixexp" in
3583 "$prefix") ;;
3584 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3585 esac'
3586
3587 : determine where public architecture dependent libraries go
3588 set archlib archlib
3589 eval $prefixit
3590 : privlib default is /usr/local/lib/$package/$version
3591 : archlib default is /usr/local/lib/$package/$version/$archname
3592 : privlib may have an optional trailing /share.
3593 tdflt=`echo $privlib | $sed 's,/share$,,'`
3594 tdflt=$tdflt/$archname
3595 case "$archlib" in
3596 '')     dflt=$tdflt
3597         ;;
3598 *)      dflt="$archlib"
3599     ;;
3600 esac
3601 $cat <<EOM
3602
3603 $spackage contains architecture-dependent library files.  If you are
3604 sharing libraries in a heterogeneous environment, you might store
3605 these files in a separate location.  Otherwise, you can just include
3606 them with the rest of the public library files.
3607
3608 EOM
3609 fn=d+~
3610 rp='Where do you want to put the public architecture-dependent libraries?'
3611 . ./getfile
3612 archlib="$ans"
3613 archlibexp="$ansexp"
3614 if $test X"$archlib" = X"$privlib"; then
3615         d_archlib="$undef"
3616 else
3617         d_archlib="$define"
3618 fi
3619 : Change installation prefix, if necessary.
3620 if $test X"$prefix" != X"$installprefix"; then
3621         installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
3622 else
3623         installarchlib="$archlibexp"
3624 fi
3625
3626
3627 : Binary compatibility with 5.005 is not possible for builds
3628 : with advanced features
3629 case "$usethreads$usemultiplicity" in
3630 *define*)
3631         bincompat5005="$undef"
3632         d_bincompat5005="$undef"
3633         ;;
3634 *)      $cat <<EOM
3635
3636 Perl 5.006 can be compiled for binary compatibility with 5.005.
3637 If you decide to do so, you will be able to continue using most
3638 of the extensions that were compiled for Perl 5.005.
3639
3640 EOM
3641         case "$bincompat5005$d_bincompat5005" in
3642         *"$undef"*) dflt=n ;;
3643         *) dflt=y ;;
3644         esac
3645         rp='Binary compatibility with Perl 5.005?'
3646         . ./myread
3647         case "$ans" in
3648         y*) val="$define" ;;
3649         *)  val="$undef" ;;
3650         esac
3651         set d_bincompat5005
3652         eval $setvar
3653         case "$d_bincompat5005" in
3654         "$define")
3655                 bincompat5005="$define"
3656                 ;;
3657         *)      bincompat5005="$undef"
3658                 d_bincompat5005="$undef"
3659                 ;;
3660         esac
3661         ;;
3662 esac
3663
3664
3665 : see if setuid scripts can be secure
3666 $cat <<EOM
3667
3668 Some kernels have a bug that prevents setuid #! scripts from being
3669 secure.  Some sites have disabled setuid #! scripts because of this.
3670
3671 First let's decide if your kernel supports secure setuid #! scripts.
3672 (If setuid #! scripts would be secure but have been disabled anyway,
3673 don't say that they are secure if asked.)
3674
3675 EOM
3676
3677 val="$undef"
3678 if $test -d /dev/fd; then
3679         echo "#!$ls" >reflect
3680         chmod +x,u+s reflect
3681         ./reflect >flect 2>&1
3682         if $contains "/dev/fd" flect >/dev/null; then
3683                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3684                 val="$define"
3685         else
3686                 $cat <<EOM
3687 If you are not sure if they are secure, I can check but I'll need a
3688 username and password different from the one you are using right now.
3689 If you don't have such a username or don't want me to test, simply
3690 enter 'none'.
3691
3692 EOM
3693                 rp='Other username to test security of setuid scripts with?'
3694                 dflt='none'
3695                 . ./myread
3696                 case "$ans" in
3697                 n|none)
3698                         case "$d_suidsafe" in
3699                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3700                                 dflt=n;;
3701                         "$undef")
3702                                 echo "Well, the $hint value is *not* secure." >&4
3703                                 dflt=n;;
3704                         *)      echo "Well, the $hint value *is* secure." >&4
3705                                 dflt=y;;
3706                         esac
3707                         ;;
3708                 *)
3709                         $rm -f reflect flect
3710                         echo "#!$ls" >reflect
3711                         chmod +x,u+s reflect
3712                         echo >flect
3713                         chmod a+w flect
3714                         echo '"su" will (probably) prompt you for '"$ans's password."
3715                         su $ans -c './reflect >flect'
3716                         if $contains "/dev/fd" flect >/dev/null; then
3717                                 echo "Okay, it looks like setuid scripts are secure." >&4
3718                                 dflt=y
3719                         else
3720                                 echo "I don't think setuid scripts are secure." >&4
3721                                 dflt=n
3722                         fi
3723                         ;;
3724                 esac
3725                 rp='Does your kernel have *secure* setuid scripts?'
3726                 . ./myread
3727                 case "$ans" in
3728                 [yY]*)  val="$define";;
3729                 *)      val="$undef";;
3730                 esac
3731         fi
3732 else
3733         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3734         echo "(That's for file descriptors, not floppy disks.)"
3735         val="$undef"
3736 fi
3737 set d_suidsafe
3738 eval $setvar
3739
3740 $rm -f reflect flect
3741
3742 : now see if they want to do setuid emulation
3743 echo " "
3744 val="$undef"
3745 case "$d_suidsafe" in
3746 "$define")
3747         val="$undef"
3748         echo "No need to emulate SUID scripts since they are secure here." >& 4
3749         ;;
3750 *)
3751         $cat <<EOM
3752 Some systems have disabled setuid scripts, especially systems where
3753 setuid scripts cannot be secure.  On systems where setuid scripts have
3754 been disabled, the setuid/setgid bits on scripts are currently
3755 useless.  It is possible for $package to detect those bits and emulate
3756 setuid/setgid in a secure fashion.  This emulation will only work if
3757 setuid scripts have been disabled in your kernel.
3758
3759 EOM
3760         case "$d_dosuid" in
3761         "$define") dflt=y ;;
3762         *) dflt=n ;;
3763         esac
3764         rp="Do you want to do setuid/setgid emulation?"
3765         . ./myread
3766         case "$ans" in
3767         [yY]*)  val="$define";;
3768         *)      val="$undef";;
3769         esac
3770         ;;
3771 esac
3772 set d_dosuid
3773 eval $setvar
3774
3775 : What should the include directory be ?
3776 echo " "
3777 $echo $n "Hmm...  $c"
3778 dflt='/usr/include'
3779 incpath=''
3780 mips_type=''
3781 if $test -f /bin/mips && /bin/mips; then
3782         echo "Looks like a MIPS system..."
3783         $cat >usr.c <<'EOCP'
3784 #ifdef SYSTYPE_BSD43
3785 /bsd43
3786 #endif
3787 EOCP
3788         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3789                 dflt='/bsd43/usr/include'
3790                 incpath='/bsd43'
3791                 mips_type='BSD 4.3'
3792         else
3793                 mips_type='System V'
3794         fi
3795         $rm -f usr.c usr.out
3796         echo "and you're compiling with the $mips_type compiler and libraries."
3797         xxx_prompt=y
3798         echo "exit 0" >mips
3799 else
3800         echo "Doesn't look like a MIPS system."
3801         xxx_prompt=n
3802         echo "exit 1" >mips
3803 fi
3804 chmod +x mips
3805 $eunicefix mips
3806 case "$usrinc" in
3807 '') ;;
3808 *) dflt="$usrinc";;
3809 esac
3810 case "$xxx_prompt" in
3811 y)      fn=d/
3812         echo " "
3813         rp='Where are the include files you want to use?'
3814         . ./getfile
3815         usrinc="$ans"
3816         ;;
3817 *)      usrinc="$dflt"
3818         ;;
3819 esac
3820
3821 : see how we invoke the C preprocessor
3822 echo " "
3823 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3824 cat <<'EOT' >testcpp.c
3825 #define ABC abc
3826 #define XYZ xyz
3827 ABC.XYZ
3828 EOT
3829 cd ..
3830 if test ! -f cppstdin; then
3831         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3832                 # AIX cc -E doesn't show the absolute headerfile
3833                 # locations but we'll cheat by using the -M flag.
3834                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3835         else
3836                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3837         fi
3838 else
3839         echo "Keeping your $hint cppstdin wrapper."
3840 fi
3841 chmod 755 cppstdin
3842 wrapper=`pwd`/cppstdin
3843 ok='false'
3844 cd UU
3845
3846 if $test "X$cppstdin" != "X" && \
3847         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3848         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3849 then
3850         echo "You used to use $cppstdin $cppminus so we'll use that again."
3851         case "$cpprun" in
3852         '') echo "But let's see if we can live without a wrapper..." ;;
3853         *)
3854                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3855                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3856                 then
3857                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3858                         ok='true'
3859                 else
3860                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3861                 fi
3862                 ;;
3863         esac
3864 else
3865         case "$cppstdin" in
3866         '') ;;
3867         *)
3868                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3869                 ;;
3870         esac
3871 fi
3872
3873 if $ok; then
3874         : nothing
3875 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3876         $cc -E <testcpp.c >testcpp.out 2>&1; \
3877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3878         echo "Yup, it does."
3879         x_cpp="$cc -E"
3880         x_minus='';
3881 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3882         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3884         echo "Yup, it does."
3885         x_cpp="$cc -E"
3886         x_minus='-';
3887 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3888         $cc -P <testcpp.c >testcpp.out 2>&1; \
3889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3890         echo "Yipee, that works!"
3891         x_cpp="$cc -P"
3892         x_minus='';
3893 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3894         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3895         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3896         echo "At long last!"
3897         x_cpp="$cc -P"
3898         x_minus='-';
3899 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3900         $cpp <testcpp.c >testcpp.out 2>&1; \
3901         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3902         echo "It works!"
3903         x_cpp="$cpp"
3904         x_minus='';
3905 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3906         $cpp - <testcpp.c >testcpp.out 2>&1; \
3907         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3908         echo "Hooray, it works!  I was beginning to wonder."
3909         x_cpp="$cpp"
3910         x_minus='-';
3911 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3912         $wrapper <testcpp.c >testcpp.out 2>&1; \
3913         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3914         x_cpp="$wrapper"
3915         x_minus=''
3916         echo "Eureka!"
3917 else
3918         dflt=''
3919         rp="No dice.  I can't find a C preprocessor.  Name one:"
3920         . ./myread
3921         x_cpp="$ans"
3922         x_minus=''
3923         $x_cpp <testcpp.c >testcpp.out 2>&1
3924         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3925                 echo "OK, that will do." >&4
3926         else
3927 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3928                 exit 1
3929         fi
3930 fi
3931
3932 case "$ok" in
3933 false)
3934         cppstdin="$x_cpp"
3935         cppminus="$x_minus"
3936         cpprun="$x_cpp"
3937         cpplast="$x_minus"
3938         set X $x_cpp
3939         shift
3940         case "$1" in
3941         "$cpp")
3942                 echo "Perhaps can we force $cc -E using a wrapper..."
3943                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3944                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3945                 then
3946                         echo "Yup, we can."
3947                         cppstdin="$wrapper"
3948                         cppminus='';
3949                 else
3950                         echo "Nope, we'll have to live without it..."
3951                 fi
3952                 ;;
3953         esac
3954         case "$cpprun" in
3955         "$wrapper")
3956                 cpprun=''
3957                 cpplast=''
3958                 ;;
3959         esac
3960         ;;
3961 esac
3962
3963 case "$cppstdin" in
3964 "$wrapper"|'cppstdin') ;;
3965 *) $rm -f $wrapper;;
3966 esac
3967 $rm -f testcpp.c testcpp.out
3968
3969 : Set private lib path
3970 case "$plibpth" in
3971 '') if ./mips; then
3972                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3973         fi;;
3974 esac
3975 case "$libpth" in
3976 ' ') dlist='';;
3977 '') dlist="$loclibpth $plibpth $glibpth";;
3978 *) dlist="$libpth";;
3979 esac
3980
3981 : Now check and see which directories actually exist, avoiding duplicates
3982 libpth=''
3983 for xxx in $dlist
3984 do
3985     if $test -d $xxx; then
3986                 case " $libpth " in
3987                 *" $xxx "*) ;;
3988                 *) libpth="$libpth $xxx";;
3989                 esac
3990     fi
3991 done
3992 $cat <<'EOM'
3993
3994 Some systems have incompatible or broken versions of libraries.  Among
3995 the directories listed in the question below, please remove any you
3996 know not to be holding relevant libraries, and add any that are needed.
3997 Say "none" for none.
3998
3999 EOM
4000 case "$libpth" in
4001 '') dflt='none';;
4002 *)
4003         set X $libpth
4004         shift
4005         dflt=${1+"$@"}
4006         ;;
4007 esac
4008 rp="Directories to use for library searches?"
4009 . ./myread
4010 case "$ans" in
4011 none) libpth=' ';;
4012 *) libpth="$ans";;
4013 esac
4014
4015 : compute shared library extension
4016 case "$so" in
4017 '')
4018         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4019                 dflt='sl'
4020         else
4021                 dflt='so'
4022         fi
4023         ;;
4024 *) dflt="$so";;
4025 esac
4026 $cat <<EOM
4027
4028 On some systems, shared libraries may be available.  Answer 'none' if
4029 you want to suppress searching of shared libraries for the remaining
4030 of this configuration.
4031
4032 EOM
4033 rp='What is the file extension used for shared libraries?'
4034 . ./myread
4035 so="$ans"
4036
4037 : Define several unixisms.
4038 : Hints files or command line option can be used to override them.
4039 : The convoluted testing is in case hints files set either the old
4040 : or the new name.
4041 case "$_exe" in
4042 '')     case "$exe_ext" in
4043     '') ;;
4044         *)      _exe="$exe_ext" ;;
4045         esac
4046         ;;
4047 esac
4048 case "$_a" in
4049 '')     case "$lib_ext" in
4050     '') _a='.a';;
4051         *)      _a="$lib_ext" ;;
4052         esac
4053         ;;
4054 esac
4055 case "$_o" in
4056 '') case "$obj_ext" in
4057         '')     _o='.o';;
4058         *)      _o="$obj_ext";;
4059         esac
4060         ;;
4061 esac
4062 case "$p_" in
4063 '') case "$path_sep" in
4064         '')     p_=':';;
4065         *)      p_="$path_sep";;
4066         esac
4067         ;;
4068 esac
4069 exe_ext=$_exe
4070 lib_ext=$_a
4071 obj_ext=$_o
4072 path_sep=$p_
4073
4074 : Which makefile gets called first.  This is used by make depend.
4075 case "$firstmakefile" in
4076 '') firstmakefile='makefile';;
4077 esac
4078
4079 cat <<EOM
4080
4081 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4082 Configure must be run with -Dusesocks.
4083
4084 Normally you do not need this and you should answer no.
4085
4086 EOM
4087 case "$usesocks" in
4088 $define|true|[yY]*)     dflt='y';;
4089 *) dflt='n';;
4090 esac
4091 rp='Build Perl for SOCKS?'
4092 . ./myread
4093 case "$ans" in
4094 y|Y)    val="$define" ;;     
4095 *)      val="$undef" ;;
4096 esac
4097 set usesocks
4098 eval $setvar
4099
4100 : Looking for optional libraries
4101 echo " "
4102 echo "Checking for optional libraries..." >&4
4103 case "$libs" in
4104 ' '|'') dflt='';;
4105 *) dflt="$libs";;
4106 esac
4107 case "$libswanted" in
4108 '') libswanted='c_s';;
4109 esac
4110 case "$usesocks" in
4111 $define)
4112         libswanted="$libswanted socks5 socks5_sh"
4113         ;;
4114 esac
4115 for thislib in $libswanted; do
4116         
4117         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4118                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4119                 echo "Found -l$thislib (shared)."
4120                 case " $dflt " in
4121                 *"-l$thislib "*);;
4122                 *) dflt="$dflt -l$thislib";;
4123                 esac
4124         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4125                 echo "Found -l$thislib (shared)."
4126                 case " $dflt " in
4127                 *"-l$thislib "*);;
4128                 *) dflt="$dflt -l$thislib";;
4129                 esac
4130         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4131                 echo "Found -l$thislib."
4132                 case " $dflt " in
4133                 *"-l$thislib "*);;
4134                 *) dflt="$dflt -l$thislib";;
4135                 esac
4136         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4137                 echo "Found -l$thislib."
4138                 case " $dflt " in
4139                 *"-l$thislib "*);;
4140                 *) dflt="$dflt -l$thislib";;
4141                 esac
4142         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4143                 echo "Found -l${thislib}_s."
4144                 case " $dflt " in
4145                 *"-l$thislib "*);;
4146                 *) dflt="$dflt -l${thislib}_s";;
4147                 esac
4148         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4149                 echo "Found -l$thislib."
4150                 case " $dflt " in
4151                 *"-l$thislib "*);;
4152                 *) dflt="$dflt -l$thislib";;
4153                 esac
4154         else
4155                 echo "No -l$thislib."
4156         fi
4157 done
4158 set X $dflt
4159 shift
4160 dflt="$*"
4161 case "$libs" in
4162 '') dflt="$dflt";;
4163 *) dflt="$libs";;
4164 esac
4165 case "$dflt" in
4166 ' '|'') dflt='none';;
4167 esac
4168
4169 $cat <<EOM
4170
4171 In order to compile $package on your machine, a number of libraries
4172 are usually needed.  Include any other special libraries here as well.
4173 Say "none" for none.  The default list is almost always right.
4174 EOM
4175
4176 echo " "
4177 rp="What libraries to use?"
4178 . ./myread
4179 case "$ans" in
4180 none) libs=' ';;
4181 *) libs="$ans";;
4182 esac
4183
4184 : determine optimize, if desired, or use for debug flag also
4185 case "$optimize" in
4186 ' '|$undef) dflt='none';;
4187 '') dflt='-O';;
4188 *) dflt="$optimize";;
4189 esac
4190 $cat <<EOH
4191
4192 Some C compilers have problems with their optimizers.  By default, $package
4193 compiles with the -O flag to use the optimizer.  Alternately, you might want
4194 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4195 systems).  Either flag can be specified here.  To use neither flag, specify
4196 the word "none".
4197
4198 EOH
4199 rp="What optimizer/debugger flag should be used?"
4200 . ./myread
4201 optimize="$ans"
4202 case "$optimize" in
4203 'none') optimize=" ";;
4204 esac
4205
4206 dflt=''
4207 : We will not override a previous value, but we might want to
4208 : augment a hint file
4209 case "$hint" in
4210 none|recommended)
4211         case "$gccversion" in
4212         1*) dflt='-fpcc-struct-return' ;;
4213         esac
4214         case "$optimize" in
4215         *-g*) dflt="$dflt -DDEBUGGING";;
4216         esac
4217         case "$gccversion" in
4218         2*) if test -d /etc/conf/kconfig.d &&
4219                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4220                 then
4221                         dflt="$dflt -posix"
4222                 fi
4223                 ;;
4224         esac
4225         ;;
4226 esac
4227
4228 case "$mips_type" in
4229 *BSD*|'') inclwanted="$locincpth $usrinc";;
4230 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4231 esac
4232 for thisincl in $inclwanted; do
4233         if $test -d $thisincl; then
4234                 if $test x$thisincl != x$usrinc; then
4235                         case "$dflt" in
4236                         *$thisincl*);;
4237                         *) dflt="$dflt -I$thisincl";;
4238                         esac
4239                 fi
4240         fi
4241 done
4242
4243 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4244         xxx=true;
4245 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4246         xxx=true;
4247 else
4248         xxx=false;
4249 fi;
4250 if $xxx; then
4251         case "$dflt" in
4252         *$2*);;
4253         *) dflt="$dflt -D$2";;
4254         esac;
4255 fi'
4256
4257 set signal.h LANGUAGE_C; eval $inctest
4258
4259 case "$usesocks" in
4260 $define)
4261         ccflags="$ccflags -DSOCKS"
4262         ;;
4263 esac
4264
4265 case "$hint" in
4266 none|recommended) dflt="$ccflags $dflt" ;;
4267 *) dflt="$ccflags";;
4268 esac
4269
4270 case "$dflt" in
4271 ''|' ') dflt=none;;
4272 esac
4273 $cat <<EOH
4274
4275 Your C compiler may want other flags.  For this question you should include
4276 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4277 but you should NOT include libraries or ld flags like -lwhatever.  If you
4278 want $package to honor its debug switch, you should include -DDEBUGGING here.
4279 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4280
4281 To use no flags, specify the word "none".
4282
4283 EOH
4284 set X $dflt
4285 shift
4286 dflt=${1+"$@"}
4287 rp="Any additional cc flags?"
4288 . ./myread
4289 case "$ans" in
4290 none) ccflags='';;
4291 *) ccflags="$ans";;
4292 esac
4293
4294 : the following weeds options from ccflags that are of no interest to cpp
4295 cppflags="$ccflags"
4296 case "$gccversion" in
4297 1*) cppflags="$cppflags -D__GNUC__"
4298 esac
4299 case "$mips_type" in
4300 '');;
4301 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4302 esac
4303 case "$cppflags" in
4304 '');;
4305 *)
4306         echo " "
4307         echo "Let me guess what the preprocessor flags are..." >&4
4308         set X $cppflags
4309         shift
4310         cppflags=''
4311         $cat >cpp.c <<'EOM'
4312 #define BLURFL foo
4313
4314 BLURFL xx LFRULB
4315 EOM
4316         previous=''
4317         for flag in $*
4318         do
4319                 case "$flag" in
4320                 -*) ftry="$flag";;
4321                 *) ftry="$previous $flag";;
4322                 esac
4323                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4324                         >cpp1.out 2>/dev/null && \
4325                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4326                         >cpp2.out 2>/dev/null && \
4327                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4328                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4329                 then
4330                         cppflags="$cppflags $ftry"
4331                         previous=''
4332                 else
4333                         previous="$flag"
4334                 fi
4335         done
4336         set X $cppflags
4337         shift
4338         cppflags=${1+"$@"}
4339         case "$cppflags" in
4340         *-*)  echo "They appear to be: $cppflags";;
4341         esac
4342         $rm -f cpp.c cpp?.out
4343         ;;
4344 esac
4345
4346 : flags used in final linking phase
4347 case "$ldflags" in
4348 '') if ./venix; then
4349                 dflt='-i -z'
4350         else
4351                 dflt=''
4352         fi
4353         case "$ccflags" in
4354         *-posix*) dflt="$dflt -posix" ;;
4355         esac
4356         ;;
4357 *) dflt="$ldflags";;
4358 esac
4359
4360 : Try to guess additional flags to pick up local libraries.
4361 for thislibdir in $libpth; do
4362         case " $loclibpth " in
4363         *" $thislibdir "*)
4364                 case "$dflt " in 
4365                 *"-L$thislibdir "*) ;;
4366                 *)  dflt="$dflt -L$thislibdir" ;;
4367                 esac
4368                 ;;
4369         esac
4370 done
4371
4372 case "$dflt" in
4373 '') dflt='none' ;;
4374 esac
4375
4376 $cat <<EOH
4377
4378 Your C linker may need flags.  For this question you should
4379 include -L/whatever and any other flags used by the C linker, but you
4380 should NOT include libraries like -lwhatever.
4381
4382 Make sure you include the appropriate -L/path flags if your C linker
4383 does not normally search all of the directories you specified above,
4384 namely
4385         $libpth
4386 To use no flags, specify the word "none".
4387
4388 EOH
4389
4390 rp="Any additional ld flags (NOT including libraries)?"
4391 . ./myread
4392 case "$ans" in
4393 none) ldflags='';;
4394 *) ldflags="$ans";;
4395 esac
4396 rmlist="$rmlist pdp11"
4397
4398 : coherency check
4399 echo " "
4400 echo "Checking your choice of C compiler and flags for coherency..." >&4
4401 $cat > try.c <<'EOF'
4402 #include <stdio.h>
4403 int main() { printf("Ok\n"); exit(0); }
4404 EOF
4405 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4406 shift
4407 $cat >try.msg <<'EOM'
4408 I've tried to compile and run the following simple program:
4409
4410 EOM
4411 $cat try.c >> try.msg
4412
4413 $cat >> try.msg <<EOM
4414
4415 I used the command:
4416
4417         $*
4418         ./try
4419
4420 and I got the following output:
4421
4422 EOM
4423 dflt=y
4424 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4425         if sh -c './try' >>try.msg 2>&1; then
4426                 xxx=`./try`
4427                 case "$xxx" in
4428                 "Ok") dflt=n ;;
4429                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4430                         case " $libs " in
4431                         *" -lsfio "*)
4432                                 cat >> try.msg <<'EOQS'
4433 If $libs contains -lsfio, and sfio is mis-configured, then it
4434 sometimes (apparently) runs and exits with a 0 status, but with no
4435 output!  It may have to do with sfio's use of _exit vs. exit.
4436
4437 EOQS
4438                                 rp="You have a big problem.  Shall I abort Configure"
4439                                 dflt=y
4440                                 ;;
4441                         esac
4442                         ;;
4443                 esac
4444         else
4445                 echo "The program compiled OK, but exited with status $?." >>try.msg
4446                 rp="You have a problem.  Shall I abort Configure"
4447                 dflt=y
4448         fi
4449 else
4450         echo "I can't compile the test program." >>try.msg
4451         rp="You have a BIG problem.  Shall I abort Configure"
4452         dflt=y
4453 fi
4454 case "$dflt" in
4455 y)
4456         $cat try.msg >&4
4457         case "$knowitall" in
4458         '')
4459                 echo "(The supplied flags or libraries might be incorrect.)"
4460                 ;;
4461         *) dflt=n;;
4462         esac
4463         echo " "
4464         . ./myread
4465         case "$ans" in
4466         n*|N*) ;;
4467         *)      echo "Ok.  Stopping Configure." >&4
4468                 exit 1
4469                 ;;
4470         esac
4471         ;;
4472 n) echo "OK, that should do.";;
4473 esac
4474 $rm -f try try.* core
4475
4476 : determine filename position in cpp output
4477 echo " "
4478 echo "Computing filename position in cpp output for #include directives..." >&4
4479 echo '#include <stdio.h>' > foo.c
4480 $cat >fieldn <<EOF
4481 $startsh
4482 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4483 $grep '^[       ]*#.*stdio\.h' | \
4484 while read cline; do
4485         pos=1
4486         set \$cline
4487         while $test \$# -gt 0; do
4488                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4489                         echo "\$pos"
4490                         exit 0
4491                 fi
4492                 shift
4493                 pos=\`expr \$pos + 1\`
4494         done
4495 done
4496 EOF
4497 chmod +x fieldn
4498 fieldn=`./fieldn`
4499 $rm -f foo.c fieldn
4500 case $fieldn in
4501 '') pos='???';;
4502 1) pos=first;;
4503 2) pos=second;;
4504 3) pos=third;;
4505 *) pos="${fieldn}th";;
4506 esac
4507 echo "Your cpp writes the filename in the $pos field of the line."
4508
4509 : locate header file
4510 $cat >findhdr <<EOF
4511 $startsh
4512 wanted=\$1
4513 name=''
4514 for usrincdir in $usrinc
4515 do
4516         if test -f \$usrincdir/\$wanted; then
4517                 echo "\$usrincdir/\$wanted"
4518                 exit 0
4519         fi
4520 done
4521 awkprg='{ print \$$fieldn }'
4522 echo "#include <\$wanted>" > foo\$\$.c
4523 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4524 $grep "^[       ]*#.*\$wanted" | \
4525 while read cline; do
4526         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4527         case "\$name" in
4528         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4529         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4530         *) exit 2;;
4531         esac;
4532 done;
4533 #
4534 # status = 0: grep returned 0 lines, case statement not executed
4535 # status = 1: headerfile found
4536 # status = 2: while loop executed, no headerfile found
4537 #
4538 status=\$?
4539 $rm -f foo\$\$.c;
4540 if test \$status -eq 1; then
4541         exit 0;
4542 fi
4543 exit 1
4544 EOF
4545 chmod +x findhdr
4546
4547 : define an alternate in-header-list? function
4548 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4549 cont=true; xxf="echo \"<\$1> found.\" >&4";
4550 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4551 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4552 esac;
4553 case $# in 4) instead=instead;; *) instead="at last";; esac;
4554 while $test "$cont"; do
4555         xxx=`./findhdr $1`
4556         var=$2; eval "was=\$$2";
4557         if $test "$xxx" && $test -r "$xxx";
4558         then eval $xxf;
4559         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4560                 cont="";
4561         else eval $xxnf;
4562         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4563         set $yyy; shift; shift; yyy=$@;
4564         case $# in 0) cont="";;
4565         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4566                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4567         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4568                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4569         esac;
4570 done;
4571 while $test "$yyy";
4572 do set $yyy; var=$2; eval "was=\$$2";
4573         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4574         set $yyy; shift; shift; yyy=$@;
4575 done'
4576
4577 : see if this is a malloc.h system
4578 set malloc.h i_malloc
4579 eval $inhdr
4580
4581 : see if stdlib is available
4582 set stdlib.h i_stdlib
4583 eval $inhdr
4584
4585 : determine which malloc to compile in
4586 echo " "
4587 case "$usemymalloc" in
4588 ''|[yY]*|true|$define)  dflt='y' ;;
4589 *)      dflt='n' ;;
4590 esac
4591 rp="Do you wish to attempt to use the malloc that comes with $package?"
4592 . ./myread
4593 usemymalloc="$ans"
4594 case "$ans" in
4595 y*|true)
4596         usemymalloc='y'
4597         mallocsrc='malloc.c'
4598         mallocobj="malloc$_o"
4599         d_mymalloc="$define"
4600         case "$libs" in
4601         *-lmalloc*)
4602                 : Remove malloc from list of libraries to use
4603                 echo "Removing unneeded -lmalloc from library list" >&4
4604                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4605                 shift
4606                 libs="$*"
4607                 echo "libs = $libs" >&4
4608                 ;;
4609         esac
4610         ;;
4611 *)
4612         usemymalloc='n'
4613         mallocsrc=''
4614         mallocobj=''
4615         d_mymalloc="$undef"
4616         ;;
4617 esac
4618
4619 : compute the return types of malloc and free
4620 echo " "
4621 $cat >malloc.c <<END
4622 #$i_malloc I_MALLOC
4623 #$i_stdlib I_STDLIB
4624 #include <stdio.h>
4625 #include <sys/types.h>
4626 #ifdef I_MALLOC
4627 #include <malloc.h>
4628 #endif
4629 #ifdef I_STDLIB
4630 #include <stdlib.h>
4631 #endif
4632 #ifdef TRY_MALLOC
4633 void *malloc();
4634 #endif
4635 #ifdef TRY_FREE
4636 void free();
4637 #endif
4638 END
4639 case "$malloctype" in
4640 '')
4641         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4642                 malloctype='void *'
4643         else
4644                 malloctype='char *'
4645         fi
4646         ;;
4647 esac
4648 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4649
4650 case "$freetype" in
4651 '')
4652         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4653                 freetype='void'
4654         else
4655                 freetype='int'
4656         fi
4657         ;;
4658 esac
4659 echo "Your system uses $freetype free(), it would seem." >&4
4660 $rm -f malloc.[co]
4661 $cat <<EOM
4662
4663 The installation process will also create a directory for
4664 vendor-supplied add-ons.  Vendors who supply perl with their system
4665 may find it convenient to place all vendor-supplied files in this
4666 directory rather than in the main distribution directory.  This will
4667 ease upgrades between binary-compatible maintenance versions of perl.
4668
4669 Of course you may also use these directories in whatever way you see
4670 fit.  For example, you might use them to access modules shared over a
4671 company-wide network.
4672
4673 The default answer should be fine for most people.
4674 This causes further questions about vendor add-ons to be skipped
4675 and no vendor-specific directories will be configured for perl.
4676
4677 EOM
4678 rp='Do you want to configure vendor-specific add-on directories?'
4679 case "$usevendorprefix" in
4680 define|true|[yY]*) dflt=y ;;
4681 *) dflt=n ;;
4682 esac
4683 . ./myread
4684 case "$ans" in
4685 [yY]*)  fn=d~+
4686         rp='Installation prefix to use for vendor-supplied add-ons?'
4687         case "$vendorprefix" in
4688         '') dflt='' ;;
4689         *)  dflt=$vendorprefix ;;
4690         esac
4691         . ./getfile
4692         oldvendorprefix=''
4693         case "$vendorprefix" in
4694         '') ;;
4695         *)      case "$ans" in
4696                 "$prefix") ;;
4697                 *) oldvendorprefix="$prefix";;
4698                 esac
4699                 ;;
4700         esac
4701         usevendorprefix="$define"
4702         vendorprefix="$ans"
4703         vendorprefixexp="$ansexp"
4704         ;;
4705 *)      usevendorprefix="$undef"
4706         vendorprefix=''
4707         vendorprefixexp=''
4708         ;;
4709 esac
4710
4711 case "$vendorprefix" in
4712 '')     d_vendorlib="$undef"
4713         vendorlib=''
4714         vendorlibexp=''
4715         ;;
4716 *)      d_vendorlib="$define"
4717         : determine where vendor-supplied modules go.
4718         : Usual default is /usr/local/lib/perl5/vendor_perl
4719         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4720         case "$installstyle" in
4721         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4722         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4723         esac
4724         fn=d~+
4725         rp='Pathname for the vendor-supplied library files?'
4726         . ./getfile
4727         vendorlib="$ans"
4728         vendorlibexp="$ansexp"
4729         : Change installation prefix, if necessary.
4730         if $test X"$prefix" != X"$installprefix"; then
4731                 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4732         else
4733                 installvendorlib="$vendorlibexp"
4734         fi
4735         ;;
4736 esac
4737
4738 : Cruising for prototypes
4739 echo " "
4740 echo "Checking out function prototypes..." >&4
4741 $cat >prototype.c <<'EOCP'
4742 int main(int argc, char *argv[]) {
4743         exit(0);}
4744 EOCP
4745 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4746         echo "Your C compiler appears to support function prototypes."
4747         val="$define"
4748 else
4749         echo "Your C compiler doesn't seem to understand function prototypes."
4750         val="$undef"
4751 fi
4752 set prototype
4753 eval $setvar
4754 $rm -f prototype*
4755
4756 case "$prototype" in
4757 "$define") ;;
4758 *)      ansi2knr='ansi2knr'
4759         echo " "
4760         cat <<EOM >&4
4761
4762 $me:  FATAL ERROR:
4763 This version of $package can only be compiled by a compiler that 
4764 understands function prototypes.  Unfortunately, your C compiler 
4765         $cc $ccflags
4766 doesn't seem to understand them.  Sorry about that.
4767
4768 If GNU cc is available for your system, perhaps you could try that instead.  
4769
4770 Eventually, we hope to support building Perl with pre-ANSI compilers.
4771 If you would like to help in that effort, please contact <perlbug@perl.org>.
4772
4773 Aborting Configure now.
4774 EOM
4775         exit 2
4776         ;;
4777 esac
4778
4779 : determine where public executables go
4780 echo " "
4781 set dflt bin bin
4782 eval $prefixit
4783 fn=d~
4784 rp='Pathname where the public executables will reside?'
4785 . ./getfile
4786 if $test "X$ansexp" != "X$binexp"; then
4787         installbin=''
4788 fi
4789 bin="$ans"
4790 binexp="$ansexp"
4791 : Change installation prefix, if necessary.
4792 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4793 if $test X"$prefix" != X"$installprefix"; then
4794         installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4795 else
4796         installbin="$binexp"
4797 fi
4798
4799 : determine whether to install perl also as /usr/bin/perl
4800
4801 echo " "
4802 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4803         $cat <<EOM
4804 Many scripts expect to perl to be installed as /usr/bin/perl.
4805 I can install the perl you are about to compile also as /usr/bin/perl
4806 (in addition to $installbin/perl).
4807 EOM
4808         case "$installusrbinperl" in
4809         "$undef"|[nN]*) dflt='n';;
4810         *)              dflt='y';;
4811         esac
4812         rp="Do you want to install perl as /usr/bin/perl?"
4813         . ./myread
4814         case "$ans" in
4815         [yY]*)  val="$define";;
4816         *)      val="$undef" ;;
4817         esac
4818 else
4819         val="$undef"
4820 fi
4821 set installusrbinperl
4822 eval $setvar
4823
4824 : define a shorthand compile call
4825 compile='
4826 mc_file=$1;
4827 shift;
4828 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4829 : define a shorthand compile call for compilations that should be ok.
4830 compile_ok='
4831 mc_file=$1;
4832 shift;
4833 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4834
4835 echo " "
4836 echo "Checking for GNU C Library..." >&4
4837 cat >gnulibc.c <<EOM
4838 #include <stdio.h>
4839 int main()
4840 {
4841 #ifdef __GLIBC__
4842     exit(0);
4843 #else
4844     exit(1);
4845 #endif
4846 }
4847 EOM
4848 set gnulibc
4849 if eval $compile_ok && ./gnulibc; then
4850         val="$define"
4851         echo "You are using the GNU C Library"
4852 else
4853         val="$undef"
4854         echo "You are not using the GNU C Library"
4855 fi
4856 $rm -f gnulibc*
4857 set d_gnulibc
4858 eval $setvar
4859
4860 : see if nm is to be used to determine whether a symbol is defined or not
4861 case "$usenm" in
4862 '')
4863         dflt=''
4864         case "$d_gnulibc" in
4865         "$define")
4866                 echo " "
4867                 echo "nm probably won't work on the GNU C Library." >&4
4868                 dflt=n
4869                 ;;
4870         esac
4871         case "$dflt" in
4872         '') 
4873                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4874                         echo " "
4875                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4876                         echo "'nm' won't be sufficient on this sytem." >&4
4877                         dflt=n
4878                 fi
4879                 ;;
4880         esac
4881         case "$dflt" in
4882         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4883                 if $test $dflt -gt 20; then
4884                         dflt=y
4885                 else
4886                         dflt=n
4887                 fi
4888                 ;;
4889         esac
4890         ;;
4891 *)
4892         case "$usenm" in
4893         true|$define) dflt=y;;
4894         *) dflt=n;;
4895         esac
4896         ;;
4897 esac
4898 $cat <<EOM
4899
4900 I can use $nm to extract the symbols from your C libraries. This
4901 is a time consuming task which may generate huge output on the disk (up
4902 to 3 megabytes) but that should make the symbols extraction faster. The
4903 alternative is to skip the 'nm' extraction part and to compile a small
4904 test program instead to determine whether each symbol is present. If
4905 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4906 this may be the best solution.
4907
4908 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4909
4910 EOM
4911 rp="Shall I use $nm to extract C symbols from the libraries?"
4912 . ./myread
4913 case "$ans" in
4914 [Nn]*) usenm=false;;
4915 *) usenm=true;;
4916 esac
4917
4918 runnm=$usenm
4919 case "$reuseval" in
4920 true) runnm=false;;
4921 esac
4922
4923 : nm options which may be necessary
4924 case "$nm_opt" in
4925 '') if $test -f /mach_boot; then
4926                 nm_opt=''       # Mach
4927         elif $test -d /usr/ccs/lib; then
4928                 nm_opt='-p'     # Solaris (and SunOS?)
4929         elif $test -f /dgux; then
4930                 nm_opt='-p'     # DG-UX
4931         elif $test -f /lib64/rld; then
4932                 nm_opt='-p'     # 64-bit Irix
4933         else
4934                 nm_opt=''
4935         fi;;
4936 esac
4937
4938 : nm options which may be necessary for shared libraries but illegal
4939 : for archive libraries.  Thank you, Linux.
4940 case "$nm_so_opt" in
4941 '')     case "$myuname" in
4942         *linux*)
4943                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4944                         nm_so_opt='--dynamic'
4945                 fi
4946                 ;;
4947         esac
4948         ;;
4949 esac
4950
4951 case "$runnm" in
4952 true)
4953 : get list of predefined functions in a handy place
4954 echo " "
4955 case "$libc" in
4956 '') libc=unknown
4957         case "$libs" in
4958         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4959         esac
4960         ;;
4961 esac
4962 libnames='';
4963 case "$libs" in
4964 '') ;;
4965 *)  for thislib in $libs; do
4966         case "$thislib" in
4967         -lc|-lc_s)
4968                 : Handle C library specially below.
4969                 ;;
4970         -l*)
4971                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4972                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4973                         :
4974                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4975                         :
4976                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4977                         :
4978                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4979                         :
4980                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4981                         :
4982                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4983                         :
4984                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4985                         :
4986                 else
4987                         try=''
4988                 fi
4989                 libnames="$libnames $try"
4990                 ;;
4991         *) libnames="$libnames $thislib" ;;
4992         esac
4993         done
4994         ;;
4995 esac
4996 xxx=normal
4997 case "$libc" in
4998 unknown)
4999         set /lib/libc.$so
5000         for xxx in $libpth; do
5001                 $test -r $1 || set $xxx/libc.$so
5002                 : The messy sed command sorts on library version numbers.
5003                 $test -r $1 || \
5004                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5005                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5006                                 h
5007                                 s/[0-9][0-9]*/0000&/g
5008                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5009                                 G
5010                                 s/\n/ /' | \
5011                          sort | $sed -e 's/^.* //'`
5012                 eval set \$$#
5013         done
5014         $test -r $1 || set /usr/ccs/lib/libc.$so
5015         $test -r $1 || set /lib/libsys_s$_a
5016         ;;
5017 *)
5018         set blurfl
5019         ;;
5020 esac
5021 if $test -r "$1"; then
5022         echo "Your (shared) C library seems to be in $1."
5023         libc="$1"
5024 elif $test -r /lib/libc && $test -r /lib/clib; then
5025         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5026         xxx=apollo
5027         libc='/lib/clib /lib/libc'
5028         if $test -r /lib/syslib; then
5029                 echo "(Your math library is in /lib/syslib.)"
5030                 libc="$libc /lib/syslib"
5031         fi
5032 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5033         echo "Your C library seems to be in $libc, as you said before."
5034 elif $test -r $incpath/usr/lib/libc$_a; then
5035         libc=$incpath/usr/lib/libc$_a;
5036         echo "Your C library seems to be in $libc.  That's fine."
5037 elif $test -r /lib/libc$_a; then
5038         libc=/lib/libc$_a;
5039         echo "Your C library seems to be in $libc.  You're normal."
5040 else
5041         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5042                 :
5043         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5044                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5045         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5046                 :
5047         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5048                 :
5049         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5050                 :
5051         else
5052                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5053         fi
5054         if $test -r "$tans"; then
5055                 echo "Your C library seems to be in $tans, of all places."
5056                 libc=$tans
5057         else
5058                 libc='blurfl'
5059         fi
5060 fi
5061 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5062         dflt="$libc"
5063         cat <<EOM
5064
5065 If the guess above is wrong (which it might be if you're using a strange
5066 compiler, or your machine supports multiple models), you can override it here.
5067
5068 EOM
5069 else
5070         dflt=''
5071         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5072         cat >&4 <<EOM
5073 I can't seem to find your C library.  I've looked in the following places:
5074
5075 EOM
5076         $sed 's/^/      /' libpath
5077         cat <<EOM
5078
5079 None of these seems to contain your C library. I need to get its name...
5080
5081 EOM
5082 fi
5083 fn=f
5084 rp='Where is your C library?'
5085 . ./getfile
5086 libc="$ans"
5087
5088 echo " "
5089 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5090 set X `cat libnames`
5091 shift
5092 xxx=files
5093 case $# in 1) xxx=file; esac
5094 echo "Extracting names from the following $xxx for later perusal:" >&4
5095 echo " "
5096 $sed 's/^/      /' libnames >&4
5097 echo " "
5098 $echo $n "This may take a while...$c" >&4
5099
5100 for file in $*; do
5101         case $file in
5102         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5103         *) $nm $nm_opt $file 2>/dev/null;;
5104         esac
5105 done >libc.tmp
5106
5107 $echo $n ".$c"
5108 $grep fprintf libc.tmp > libc.ptf
5109 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5110 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5111 xxx='[ADTSIW]'
5112 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5113         eval $xscan;\
5114         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5115                 eval $xrun
5116 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5117         eval $xscan;\
5118         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5119                 eval $xrun
5120 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5121         eval $xscan;\
5122         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5123                 eval $xrun
5124 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5125         eval $xscan;\
5126         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5127                 eval $xrun
5128 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5129         eval $xscan;\
5130         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5131                 eval $xrun
5132 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5133         eval $xscan;\
5134         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5135                 eval $xrun
5136 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5137                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5138         eval $xscan;\
5139         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5140                 eval $xrun
5141 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5142         eval $xscan;\
5143         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5144                 eval $xrun
5145 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5146         eval $xscan;\
5147         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5148                 eval $xrun
5149 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5150         eval $xscan;\
5151         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5152                 eval $xrun
5153 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5154         eval $xscan;\
5155         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5156                 eval $xrun
5157 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5158         eval $xscan;\
5159         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5160                 eval $xrun
5161 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5162         eval $xscan;\
5163         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5164                 eval $xrun
5165 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5166         eval $xscan;\
5167         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5168                 eval $xrun
5169 else
5170         $nm -p $* 2>/dev/null >libc.tmp
5171         $grep fprintf libc.tmp > libc.ptf
5172         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5173                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5174         then
5175                 nm_opt='-p'
5176                 eval $xrun
5177         else
5178                 echo " "
5179                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5180                 com=''
5181                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5182                         for thisname in $libnames $libc; do
5183                                 $ar t $thisname >>libc.tmp
5184                         done
5185                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5186                         echo "Ok." >&4
5187                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5188                         # Repeat libc to extract forwarders to DLL entries too
5189                         for thisname in $libnames $libc; do
5190                                 $ar tv $thisname >>libc.tmp
5191                                 # Revision 50 of EMX has bug in $ar.
5192                                 # it will not extract forwarders to DLL entries
5193                                 # Use emximp which will extract exactly them.
5194                                 emximp -o tmp.imp $thisname \
5195                                     2>/dev/null && \
5196                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5197                                     < tmp.imp >>libc.tmp
5198                                 $rm tmp.imp
5199                         done
5200                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5201                         echo "Ok." >&4
5202                 else
5203                         echo "$ar didn't seem to work right." >&4
5204                         echo "Maybe this is a Cray...trying bld instead..." >&4
5205                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5206                         then
5207                                 for thisname in $libnames; do
5208                                         bld t $libnames | \
5209                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5210                                         $ar t $thisname >>libc.tmp
5211                                 done
5212                                 echo "Ok." >&4
5213                         else
5214                                 echo "That didn't work either.  Giving up." >&4
5215                                 exit 1
5216                         fi
5217                 fi
5218         fi
5219 fi
5220 nm_extract="$com"
5221 if $test -f /lib/syscalls.exp; then
5222         echo " "
5223         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5224         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5225 fi
5226 ;;
5227 esac
5228 $rm -f libnames libpath
5229
5230 : see if dld is available
5231 set dld.h i_dld
5232 eval $inhdr
5233
5234 : is a C symbol defined?
5235 csym='tlook=$1;
5236 case "$3" in
5237 -v) tf=libc.tmp; tc=""; tdc="";;
5238 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5239 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5240 esac;
5241 tx=yes;
5242 case "$reuseval-$4" in
5243 true-) ;;
5244 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5245 esac;
5246 case "$tx" in
5247 yes)
5248         case "$runnm" in
5249         true)
5250                 if $contains $tlook $tf >/dev/null 2>&1;
5251                 then tval=true;
5252                 else tval=false;
5253                 fi;;
5254         *)
5255                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5256                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5257                 then tval=true;
5258                 else tval=false;
5259                 fi;
5260                 $rm -f t t.c;;
5261         esac;;
5262 *)
5263         case "$tval" in
5264         $define) tval=true;;
5265         *) tval=false;;
5266         esac;;
5267 esac;
5268 eval "$2=$tval"'
5269
5270 : define an is-in-libc? function
5271 inlibc='echo " "; td=$define; tu=$undef;
5272 sym=$1; var=$2; eval "was=\$$2";
5273 tx=yes;
5274 case "$reuseval$was" in
5275 true) ;;
5276 true*) tx=no;;
5277 esac;
5278 case "$tx" in
5279 yes)
5280         set $sym tres -f;
5281         eval $csym;
5282         case "$tres" in
5283         true)
5284                 echo "$sym() found." >&4;
5285                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5286         *)
5287                 echo "$sym() NOT found." >&4;
5288                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5289         esac;;
5290 *)
5291         case "$was" in
5292         $define) echo "$sym() found." >&4;;
5293         *) echo "$sym() NOT found." >&4;;
5294         esac;;
5295 esac'
5296
5297 : see if dlopen exists
5298 xxx_runnm="$runnm"
5299 runnm=false
5300 set dlopen d_dlopen
5301 eval $inlibc
5302 runnm="$xxx_runnm"
5303
5304 : determine which dynamic loading, if any, to compile in
5305 echo " "
5306 dldir="ext/DynaLoader"
5307 case "$usedl" in
5308 $define|y|true)
5309         dflt='y'
5310         usedl="$define"
5311         ;;
5312 $undef|n|false)
5313         dflt='n'
5314         usedl="$undef"
5315         ;;
5316 *) 
5317         dflt='n'
5318         case "$d_dlopen" in
5319             $define) dflt='y' ;;
5320         esac
5321         case "$i_dld" in
5322             $define) dflt='y' ;;
5323         esac
5324         : Does a dl_xxx.xs file exist for this operating system
5325         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5326         ;;
5327 esac
5328 rp="Do you wish to use dynamic loading?"
5329 . ./myread
5330 usedl="$ans"
5331 case "$ans" in
5332 y*) usedl="$define"
5333         case "$dlsrc" in
5334         '')
5335                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5336                         dflt="$dldir/dl_${osname}.xs"
5337                 elif $test "$d_dlopen" = "$define" ; then
5338                         dflt="$dldir/dl_dlopen.xs"
5339                 elif $test "$i_dld" = "$define" ; then
5340                         dflt="$dldir/dl_dld.xs"
5341                 else
5342                         dflt=''
5343                 fi
5344                 ;;
5345         *)      dflt="$dldir/$dlsrc"
5346                 ;;
5347         esac
5348     echo "The following dynamic loading files are available:"
5349         : Can not go over to $dldir because getfile has path hard-coded in.
5350         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5351         rp="Source file to use for dynamic loading"
5352         fn="fne"
5353         gfpth="$src"
5354         . ./getfile
5355         usedl="$define"
5356         : emulate basename
5357         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5358
5359         $cat << EOM
5360
5361 Some systems may require passing special flags to $cc -c to
5362 compile modules that will be used to create a shared library.
5363 To use no flags, say "none".
5364
5365 EOM
5366     case "$cccdlflags" in
5367     '') case "$gccversion" in
5368                 '') case "$osname" in
5369                         hpux)   dflt='+z' ;;
5370                         next)   dflt='none' ;;
5371                         irix*)  dflt='-KPIC' ;;
5372                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5373                         sunos)  dflt='-pic' ;;
5374                         *)      dflt='none' ;;
5375                     esac
5376                         ;;
5377                 *)  case "$osname" in
5378                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5379                         *)      dflt='-fpic' ;;
5380                     esac ;;
5381             esac ;;
5382         ' ') dflt='none' ;;
5383     *)  dflt="$cccdlflags" ;;
5384     esac
5385     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5386     . ./myread
5387     case "$ans" in
5388     none) cccdlflags=' ' ;;
5389     *) cccdlflags="$ans" ;;
5390     esac
5391
5392     cat << EOM
5393
5394 Some systems use ld to create libraries that can be dynamically loaded,
5395 while other systems (such as those using ELF) use $cc.
5396
5397 EOM
5398         case "$ld" in
5399         '')     $cat >try.c <<'EOM'
5400 /* Test for whether ELF binaries are produced */
5401 #include <fcntl.h>
5402 #include <stdlib.h>
5403 int main() {
5404         char b[4];
5405         int i = open("a.out",O_RDONLY);
5406         if(i == -1) 
5407                 exit(1); /* fail */
5408         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5409                 exit(0); /* succeed (yes, it's ELF) */
5410         else
5411                 exit(1); /* fail */
5412 }
5413 EOM
5414                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5415                         cat <<EOM
5416 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5417 EOM
5418                         dflt="$cc"
5419                 else
5420                         echo "I'll use ld to build dynamic libraries."
5421                         dflt='ld'
5422                 fi
5423                 rm -f try.c a.out
5424                 ;;
5425         *)      dflt="$ld"
5426                 ;;
5427         esac
5428
5429     rp="What command should be used to create dynamic libraries?"
5430     . ./myread
5431         ld="$ans"
5432
5433     cat << EOM
5434
5435 Some systems may require passing special flags to $ld to create a
5436 library that can be dynamically loaded.  If your ld flags include
5437 -L/other/path options to locate libraries outside your loader's normal
5438 search path, you may need to specify those -L options here as well.  To
5439 use no flags, say "none".
5440
5441 EOM
5442     case "$lddlflags" in
5443     '') case "$osname" in
5444                         beos) dflt='-nostart' ;;
5445                         hpux)  dflt='-b' ;;
5446                         linux|irix*)    dflt='-shared' ;;
5447                         next)  dflt='none' ;;
5448                         solaris) dflt='-G' ;;
5449                         sunos) dflt='-assert nodefinitions' ;;
5450                         svr4*|esix*) dflt="-G $ldflags" ;;
5451                 *)     dflt='none' ;;
5452                         esac
5453                         ;;
5454     *) dflt="$lddlflags" ;;
5455     esac
5456
5457         : Try to guess additional flags to pick up local libraries.
5458         : Be careful not to append to a plain 'none'
5459         case "$dflt" in
5460         none) dflt='' ;;
5461         esac
5462         for thisflag in $ldflags; do
5463                 case "$thisflag" in
5464                 -L*)
5465                         case " $dflt " in
5466                         *" $thisflag "*) ;;
5467                         *) dflt="$dflt $thisflag" ;;
5468                         esac
5469                         ;;
5470                 esac
5471         done
5472
5473         case "$dflt" in
5474         ''|' ') dflt='none' ;;
5475         esac
5476
5477     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5478     . ./myread
5479     case "$ans" in
5480     none) lddlflags=' ' ;;
5481     *) lddlflags="$ans" ;;
5482     esac
5483
5484         cat <<EOM
5485
5486 Some systems may require passing special flags to $cc to indicate that
5487 the resulting executable will use dynamic linking.  To use no flags,
5488 say "none".
5489
5490 EOM
5491     case "$ccdlflags" in
5492     '') case "$osname" in
5493                 hpux)   dflt='-Wl,-E' ;;
5494                 linux)  dflt='-rdynamic' ;;
5495                 next)   dflt='none' ;;
5496                 sunos)  dflt='none' ;;
5497                 *)      dflt='none' ;;
5498             esac ;;
5499     ' ')  dflt='none' ;;
5500     *)  dflt="$ccdlflags" ;;
5501     esac
5502     rp="Any special flags to pass to $cc to use dynamic loading?"
5503     . ./myread
5504     case "$ans" in
5505     none) ccdlflags=' ' ;;
5506     *) ccdlflags="$ans" ;;
5507     esac
5508     ;;
5509 *)  usedl="$undef"
5510         ld='ld'
5511     dlsrc='dl_none.xs'
5512     lddlflags=''
5513     ccdlflags=''
5514     ;;
5515 esac
5516
5517 also=''
5518 case "$usedl" in
5519 $undef)
5520         # No dynamic loading being used, so don't bother even to prompt.
5521         useshrplib='false'
5522         ;;
5523 *)      case "$useshrplib" in
5524         '')     case "$osname" in
5525                 svr4*|dgux|dynixptx|esix|powerux|beos)
5526                         dflt=y
5527                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5528                         ;;
5529                 next*)
5530                         case "$osvers" in
5531                         4*)     dflt=y
5532                                 also='Building a shared libperl is needed for MAB support.'
5533                                 ;;
5534                         *)      dflt=n
5535                                 ;;
5536                         esac
5537                         ;;
5538                 *)      dflt=n
5539                         ;;
5540                 esac
5541                 ;;
5542         $define|true|[Yy]*)
5543                 dflt=y
5544                 ;;
5545         *)      dflt=n
5546                 ;;
5547         esac
5548         $cat << EOM
5549
5550 The perl executable is normally obtained by linking perlmain.c with
5551 libperl${_a}, any static extensions (usually just DynaLoader), and
5552 any other libraries needed on this system (such as -lm, etc.).  Since
5553 your system supports dynamic loading, it is probably possible to build
5554 a shared libperl.$so.  If you will have more than one executable linked
5555 to libperl.$so, this will significantly reduce the size of each
5556 executable, but it may have a noticeable affect on performance.  The
5557 default is probably sensible for your system.
5558 $also
5559
5560 EOM
5561         rp="Build a shared libperl.$so (y/n)"
5562         . ./myread
5563         case "$ans" in
5564         true|$define|[Yy]*)
5565                 useshrplib='true'  ;;
5566         *)      useshrplib='false' ;;
5567         esac
5568         ;;
5569 esac
5570
5571 case "$useshrplib" in
5572 true)
5573         case "$libperl" in
5574         '')
5575                 # Figure out a good name for libperl.so.  Since it gets stored in
5576                 # a version-specific architecture-dependent library, the version
5577                 # number isn't really that important, except for making cc/ld happy.
5578                 #
5579                 # A name such as libperl.so.3.1
5580                 majmin="libperl.$so.$patchlevel.$subversion"
5581                 # A name such as libperl.so.301
5582                 majonly=`echo $patchlevel $subversion |
5583                         $awk '{printf "%d%02d", $1, $2}'`
5584                 majonly=libperl.$so.$majonly
5585                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5586                 # rely on figuring it out from the naming of libc.
5587                 case "${osname}${osvers}" in
5588                 next4*)
5589                         dflt=libperl.5.$so
5590                         # XXX How handle the --version stuff for MAB?
5591                         ;;
5592                 linux*)  # ld won't link with a bare -lperl otherwise.
5593                         dflt=libperl.$so
5594                         ;;
5595                 *)      # Try to guess based on whether libc has major.minor.
5596                         case "$libc" in
5597                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5598                         *libc.$so.[0-9]*) dflt=$majonly ;;
5599                         *)      dflt=libperl.$so ;;
5600                         esac
5601                         ;;
5602                 esac
5603                 ;;
5604         *)      dflt=$libperl
5605                 ;;
5606         esac
5607         cat << EOM
5608
5609 I need to select a good name for the shared libperl.  If your system uses
5610 library names with major and minor numbers, then you might want something
5611 like $majmin.  Alternatively, if your system uses a single version
5612 number for shared libraries, then you might want to use $majonly.
5613 Or, your system might be quite happy with a simple libperl.$so.
5614
5615 Since the shared libperl will get installed into a version-specific
5616 architecture-dependent directory, the version number of the shared perl
5617 library probably isn't important, so the default should be o.k.
5618
5619 EOM
5620         rp='What name do you want to give to the shared libperl?'
5621         . ./myread
5622         libperl=$ans
5623         echo "Ok, I'll use $libperl"
5624         ;;
5625 *)
5626         libperl="libperl${_a}"
5627         ;;
5628 esac
5629
5630 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5631 case "$shrpdir" in
5632 '') ;;
5633 *)      $cat >&4 <<EOM
5634 WARNING:  Use of the shrpdir variable for the installation location of
5635 the shared $libperl is not supported.  It was never documented and
5636 will not work in this version.  Let me (perlbug@perl.com)
5637 know of any problems this may cause.
5638
5639 EOM
5640         case "$shrpdir" in
5641         "$archlibexp/CORE")
5642                 $cat >&4 <<EOM
5643 But your current setting of $shrpdir is
5644 the default anyway, so it's harmless.
5645 EOM
5646                 ;;
5647         *)
5648                 $cat >&4 <<EOM
5649 Further, your current attempted setting of $shrpdir
5650 conflicts with the value of $archlibexp/CORE
5651 that installperl will use.
5652 EOM
5653                 ;;
5654         esac
5655         ;;
5656 esac
5657
5658 # How will the perl executable find the installed shared $libperl?
5659 # Add $xxx to ccdlflags.
5660 # If we can't figure out a command-line option, use $shrpenv to
5661 # set env LD_RUN_PATH.  The main perl makefile uses this.
5662 shrpdir=$archlibexp/CORE
5663 xxx=''
5664 tmp_shrpenv=''
5665 if "$useshrplib"; then
5666     case "$osname" in 
5667         aix)
5668                 # We'll set it in Makefile.SH...
5669                 ;;
5670         solaris|netbsd)
5671                 xxx="-R $shrpdir"
5672                 ;;
5673         freebsd)
5674                 xxx="-Wl,-R$shrpdir"
5675                 ;;
5676         linux|irix*|dec_osf)
5677                 xxx="-Wl,-rpath,$shrpdir"
5678                 ;;
5679         next)
5680                 # next doesn't like the default...
5681                 ;;
5682         beos)
5683                 # beos doesn't like the default, either.
5684                 ;;
5685         hpux*)
5686                 # hpux doesn't like the default, either.
5687                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5688                 ;;
5689         *)
5690                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5691                 ;;
5692         esac
5693         case "$xxx" in
5694         '') ;;
5695         *)      
5696                 # Only add $xxx if it isn't already in ccdlflags.
5697                 case " $ccdlflags " in
5698                 *" $xxx "*)     ;;
5699                 *)      ccdlflags="$ccdlflags $xxx"
5700                         cat <<EOM >&4
5701
5702 Adding $xxx to the flags
5703 passed to $ld so that the perl executable will find the 
5704 installed shared $libperl.
5705
5706 EOM
5707                         ;;
5708                 esac
5709                 ;;
5710         esac
5711 fi
5712 # Fix ccdlflags in AIX for building external extensions.
5713 # (For building Perl itself bare -bE:perl.exp is needed,
5714 #  Makefile.SH takes care of this.)
5715 case "$osname" in
5716 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5717 esac
5718 # Respect a hint or command-line value.
5719 case "$shrpenv" in
5720 '') shrpenv="$tmp_shrpenv" ;;
5721 esac
5722 case "$ldlibpthname" in
5723 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5724 none)   ldlibpthname='' ;;
5725 esac
5726
5727 : determine where manual pages go
5728 set man1dir man1dir none
5729 eval $prefixit
5730 $cat <<EOM
5731
5732 $spackage has manual pages available in source form.
5733 EOM
5734 case "$nroff" in
5735 nroff)
5736         echo "However, you don't have nroff, so they're probably useless to you."
5737         case "$man1dir" in
5738         '') man1dir="none";;
5739         esac;;
5740 esac
5741 echo "If you don't want the manual sources installed, answer 'none'."
5742 case "$man1dir" in
5743 ' ') dflt=none
5744         ;;
5745 '')
5746         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5747         lookpath="$lookpath $prefixexp/man/p_man/man1"
5748         lookpath="$lookpath $prefixexp/man/u_man/man1"
5749         lookpath="$lookpath $prefixexp/man/man.1"
5750         case "$sysman" in
5751         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5752         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5753         esac
5754         set dflt
5755         eval $prefixup
5756         ;;
5757 *)  dflt="$man1dir"
5758         ;;
5759 esac
5760 echo " "
5761 fn=dn+~
5762 rp="Where do the main $spackage manual pages (source) go?"
5763 . ./getfile
5764 if $test "X$man1direxp" != "X$ansexp"; then
5765         installman1dir=''
5766 fi
5767 man1dir="$ans"
5768 man1direxp="$ansexp"
5769 case "$man1dir" in
5770 '')     man1dir=' '
5771         installman1dir='';;
5772 esac
5773
5774 : Change installation prefix, if necessary.
5775 if $test X"$prefix" != X"$installprefix"; then
5776         installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
5777 else
5778         installman1dir="$man1direxp"
5779 fi
5780
5781 : What suffix to use on installed man pages
5782
5783 case "$man1dir" in
5784 ' ')
5785         man1ext='0'
5786         ;;
5787 *)
5788         rp="What suffix should be used for the main $spackage man pages?"
5789         case "$man1ext" in
5790         '')     case "$man1dir" in
5791                 *1)  dflt=1 ;;
5792                 *1p) dflt=1p ;;
5793                 *1pm) dflt=1pm ;;
5794                 *l) dflt=l;;
5795                 *n) dflt=n;;
5796                 *o) dflt=o;;
5797                 *p) dflt=p;;
5798                 *C) dflt=C;;
5799                 *L) dflt=L;;
5800                 *L1) dflt=L1;;
5801                 *) dflt=1;;
5802                 esac
5803                 ;;
5804         *)      dflt="$man1ext";;
5805         esac
5806         . ./myread
5807         man1ext="$ans"
5808         ;;
5809 esac
5810
5811 : see if we can have long filenames
5812 echo " "
5813 rmlist="$rmlist /tmp/cf$$"
5814 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5815 first=123456789abcdef
5816 second=/tmp/cf$$/$first
5817 $rm -f $first $second
5818 if (echo hi >$first) 2>/dev/null; then
5819         if $test -f 123456789abcde; then
5820                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5821                 val="$undef"
5822         else
5823                 if (echo hi >$second) 2>/dev/null; then
5824                         if $test -f /tmp/cf$$/123456789abcde; then
5825                                 $cat <<'EOM'
5826 That's peculiar... You can have filenames longer than 14 characters, but only
5827 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5828 I shall consider your system cannot support long filenames at all.
5829 EOM
5830                                 val="$undef"
5831                         else
5832                                 echo 'You can have filenames longer than 14 characters.' >&4
5833                                 val="$define"
5834                         fi
5835                 else
5836                         $cat <<'EOM'
5837 How confusing! Some of your filesystems are sane enough to allow filenames
5838 longer than 14 characters but some others like /tmp can't even think about them.
5839 So, for now on, I shall assume your kernel does not allow them at all.
5840 EOM
5841                         val="$undef"
5842                 fi
5843         fi
5844 else
5845         $cat <<'EOM'
5846 You can't have filenames longer than 14 chars.  You can't even think about them!
5847 EOM
5848         val="$undef"
5849 fi 
5850 set d_flexfnam
5851 eval $setvar
5852 $rm -rf /tmp/cf$$ 123456789abcde*
5853
5854 : determine where library module manual pages go
5855 set man3dir man3dir none
5856 eval $prefixit
5857 $cat <<EOM
5858
5859 $spackage has manual pages for many of the library modules.
5860 EOM
5861
5862 case "$nroff" in
5863 nroff)
5864         $cat <<'EOM'
5865 However, you don't have nroff, so they're probably useless to you.
5866 EOM
5867         case "$man3dir" in
5868         '') man3dir="none";;
5869         esac;;
5870 esac
5871
5872 case "$d_flexfnam" in
5873 undef)
5874         $cat <<'EOM'
5875 However, your system can't handle the long file names like File::Basename.3. 
5876 EOM
5877         case "$man3dir" in
5878         '') man3dir="none";;
5879         esac;;
5880 esac
5881
5882 echo "If you don't want the manual sources installed, answer 'none'."
5883 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5884 case "$man3dir" in
5885 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5886         if $test -d "$privlib/man/man3"; then
5887                 cat <<EOM >&4
5888
5889 WARNING:  Previous versions of perl installed man3 pages into
5890 $privlib/man/man3.  This version will suggest a 
5891 new default of $dflt.  
5892 EOM
5893                 tdflt=$dflt
5894                 dflt='n'
5895                 rp='Do you wish to preserve the old behavior?(y/n)'
5896                 . ./myread
5897                 case "$ans" in
5898                 y*) dflt="$privlib/man/man3" ;;
5899                 *)  dflt=$tdflt ;;
5900                 esac
5901     fi
5902         ;;
5903 ' ') dflt=none;;
5904 *)      dflt="$man3dir" ;;
5905 esac
5906 echo " "
5907 fn=dn+~
5908 rp="Where do the $package library man pages (source) go?"
5909 . ./getfile
5910 man3dir="$ans"
5911 man3direxp="$ansexp"
5912 case "$man1dir" in
5913 '')     man3dir=' '
5914         installman3dir='';;
5915 esac
5916
5917 : Change installation prefix, if necessary.
5918 if $test X"$prefix" != X"$installprefix"; then
5919         installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
5920 else
5921         installman3dir="$man3direxp"
5922 fi
5923
5924 : What suffix to use on installed man pages
5925 case "$man3dir" in
5926 ' ')
5927         man3ext='0'
5928         ;;
5929 *)
5930         rp="What suffix should be used for the $package library man pages?"
5931         case "$man3ext" in
5932         '')     case "$man3dir" in
5933                 *3)  dflt=3 ;;
5934                 *3p) dflt=3p ;;
5935                 *3pm) dflt=3pm ;;
5936                 *l) dflt=l;;
5937                 *n) dflt=n;;
5938                 *o) dflt=o;;
5939                 *p) dflt=p;;
5940                 *C) dflt=C;;
5941                 *L) dflt=L;;
5942                 *L3) dflt=L3;;
5943                 *) dflt=3;;
5944                 esac
5945                 ;;
5946         *)      dflt="$man3ext";;
5947         esac
5948         . ./myread
5949         man3ext="$ans"
5950         ;;
5951 esac
5952
5953 : see if we have to deal with yellow pages, now NIS.
5954 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5955         if $test -f /usr/etc/nibindd; then
5956                 echo " "
5957                 echo "I'm fairly confident you're on a NeXT."
5958                 echo " "
5959                 rp='Do you get the hosts file via NetInfo?'
5960                 dflt=y
5961                 case "$hostcat" in
5962                 nidump*) ;;
5963                 '') ;;
5964                 *) dflt=n;;
5965                 esac
5966                 . ./myread
5967                 case "$ans" in
5968                 y*) hostcat='nidump hosts .';;
5969                 *)      case "$hostcat" in
5970                         nidump*) hostcat='';;
5971                         esac
5972                         ;;
5973                 esac
5974         fi
5975         case "$hostcat" in
5976         nidump*) ;;
5977         *)
5978                 case "$hostcat" in
5979                 *ypcat*) dflt=y;;
5980                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5981                                 dflt=y
5982                         else
5983                                 dflt=n
5984                         fi;;
5985                 *) dflt=n;;
5986                 esac
5987                 echo " "
5988                 rp='Are you getting the hosts file via yellow pages?'
5989                 . ./myread
5990                 case "$ans" in
5991                 y*) hostcat='ypcat hosts';;
5992                 *) hostcat='cat /etc/hosts';;
5993                 esac
5994                 ;;
5995         esac
5996 fi
5997 case "$hostcat" in
5998 '') hostcat='cat /etc/hosts';;
5999 esac
6000 case "$groupcat" in
6001 '') groupcat='cat /etc/group';;
6002 esac
6003 case "$passcat" in
6004 '') passcat='cat /etc/passwd';;
6005 esac
6006
6007 : now get the host name
6008 echo " "
6009 echo "Figuring out host name..." >&4
6010 case "$myhostname" in
6011 '') cont=true
6012         echo 'Maybe "hostname" will work...'
6013         if tans=`sh -c hostname 2>&1` ; then
6014                 myhostname=$tans
6015                 phostname=hostname
6016                 cont=''
6017         fi
6018         ;;
6019 *) cont='';;
6020 esac
6021 if $test "$cont"; then
6022         if ./xenix; then
6023                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6024                 if tans=`cat /etc/systemid 2>&1` ; then
6025                         myhostname=$tans
6026                         phostname='cat /etc/systemid'
6027                         echo "Whadyaknow.  Xenix always was a bit strange..."
6028                         cont=''
6029                 fi
6030         elif $test -r /etc/systemid; then
6031                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6032         fi
6033 fi
6034 if $test "$cont"; then
6035         echo 'No, maybe "uuname -l" will work...'
6036         if tans=`sh -c 'uuname -l' 2>&1` ; then
6037                 myhostname=$tans
6038                 phostname='uuname -l'
6039         else
6040                 echo 'Strange.  Maybe "uname -n" will work...'
6041                 if tans=`sh -c 'uname -n' 2>&1` ; then
6042                         myhostname=$tans
6043                         phostname='uname -n'
6044                 else
6045                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6046                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6047                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6048                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6049                         else
6050                                 case "$myhostname" in
6051                                 '') echo "Does this machine have an identity crisis or something?"
6052                                         phostname='';;
6053                                 *)
6054                                         echo "Well, you said $myhostname before..."
6055                                         phostname='echo $myhostname';;
6056                                 esac
6057                         fi
6058                 fi
6059         fi
6060 fi
6061 : you do not want to know about this
6062 set $myhostname
6063 myhostname=$1
6064
6065 : verify guess
6066 if $test "$myhostname" ; then
6067         dflt=y
6068         rp='Your host name appears to be "'$myhostname'".'" Right?"
6069         . ./myread
6070         case "$ans" in
6071         y*) ;;
6072         *) myhostname='';;
6073         esac
6074 fi
6075
6076 : bad guess or no guess
6077 while $test "X$myhostname" = X ; do
6078         dflt=''
6079         rp="Please type the (one word) name of your host:"
6080         . ./myread
6081         myhostname="$ans"
6082 done
6083
6084 : translate upper to lower if necessary
6085 case "$myhostname" in
6086 *[A-Z]*)
6087         echo "(Normalizing case in your host name)"
6088         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6089         ;;
6090 esac
6091
6092 case "$myhostname" in
6093 *.*)
6094         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6095         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6096         echo "(Trimming domain name from host name--host name is now $myhostname)"
6097         ;;
6098 *) case "$mydomain" in
6099         '')
6100                 {
6101                         test "X$hostcat" = "Xypcat hosts" &&
6102                         ypmatch "$myhostname" hosts 2>/dev/null |\
6103                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6104                         $test -s hosts
6105                 } || {
6106                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6107                                         /[       ]$myhostname[  . ]/p" > hosts
6108                 }
6109                 tmp_re="[       . ]"
6110                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6111                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6112                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6113                         hosts | $sort | $uniq | \
6114                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6115                 case `$echo X$dflt` in
6116                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6117                         dflt=.
6118                         ;;
6119                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6120                         ;;
6121                 esac
6122                 case "$dflt" in
6123                 .)
6124                         tans=`./loc resolv.conf X /etc /usr/etc`
6125                         if $test -f "$tans"; then
6126                                 echo "(Attempting domain name extraction from $tans)"
6127                                 dflt=.`$sed -n -e 's/   / /g' \
6128                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6129                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6130                                 case "$dflt" in
6131                                 .) dflt=.`$sed -n -e 's/        / /g' \
6132                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6133                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6134                                         ;;
6135                                 esac
6136                         fi
6137                         ;;
6138                 esac
6139                 case "$dflt" in
6140                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6141                         dflt=.`sh -c domainname 2>/dev/null`
6142                         case "$dflt" in
6143                         '') dflt='.';;
6144                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6145                         esac
6146                         ;;
6147                 esac
6148                 case "$dflt" in
6149                 .) echo "(Lost all hope -- silly guess then)"
6150                         dflt='.uucp'
6151                         ;;
6152                 esac
6153                 $rm -f hosts
6154                 ;;
6155         *) dflt="$mydomain";;
6156         esac;;
6157 esac
6158 echo " "
6159 rp="What is your domain name?"
6160 . ./myread
6161 tans="$ans"
6162 case "$ans" in
6163 '') ;;
6164 .*) ;;
6165 *) tans=".$tans";;
6166 esac
6167 mydomain="$tans"
6168
6169 : translate upper to lower if necessary
6170 case "$mydomain" in
6171 *[A-Z]*)
6172         echo "(Normalizing case in your domain name)"
6173         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6174         ;;
6175 esac
6176
6177 : a little sanity check here
6178 case "$phostname" in
6179 '') ;;
6180 *)
6181         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6182         $myhostname$mydomain|$myhostname) ;;
6183         *)
6184                 case "$phostname" in
6185                 sed*)
6186                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6187                         ;;
6188                 *)
6189                         echo "(That doesn't agree with your $phostname command, by the way.)"
6190                         ;;
6191                 esac
6192         ;;
6193         esac
6194         ;;
6195 esac
6196
6197 $cat <<EOM
6198
6199 I need to get your e-mail address in Internet format if possible, i.e.
6200 something like user@host.domain. Please answer accurately since I have
6201 no easy means to double check it. The default value provided below
6202 is most probably close to the reality but may not be valid from outside
6203 your organization...
6204
6205 EOM
6206 cont=x
6207 while test "$cont"; do
6208         case "$cf_email" in
6209         '') dflt="$cf_by@$myhostname$mydomain";;
6210         *) dflt="$cf_email";;
6211         esac
6212         rp='What is your e-mail address?'
6213         . ./myread
6214         cf_email="$ans"
6215         case "$cf_email" in
6216         *@*.*) cont='' ;;
6217         *)
6218                 rp='Address does not look like an Internet one.  Use it anyway?'
6219                 case "$fastread" in
6220                 yes) dflt=y ;;
6221                 *) dflt=n ;;
6222                 esac
6223                 . ./myread
6224                 case "$ans" in
6225                 y*) cont='' ;;
6226                 *) echo " " ;;
6227                 esac
6228                 ;;
6229         esac
6230 done
6231
6232 $cat <<EOM
6233
6234 If you or somebody else will be maintaining perl at your site, please
6235 fill in the correct e-mail address here so that they may be contacted
6236 if necessary. Currently, the "perlbug" program included with perl
6237 will send mail to this address in addition to perlbug@perl.com. You may
6238 enter "none" for no administrator.
6239
6240 EOM
6241 case "$perladmin" in
6242 '') dflt="$cf_email";;
6243 *) dflt="$perladmin";;
6244 esac
6245 rp='Perl administrator e-mail address'
6246 . ./myread
6247 perladmin="$ans"
6248
6249 : figure out how to guarantee perl startup
6250 case "$startperl" in
6251 '')
6252         case "$sharpbang" in
6253         *!)
6254                 $cat <<EOH
6255
6256 I can use the #! construct to start perl on your system. This will
6257 make startup of perl scripts faster, but may cause problems if you
6258 want to share those scripts and perl is not in a standard place
6259 ($binexp/perl) on all your platforms. The alternative is to force
6260 a shell by starting the script with a single ':' character.
6261
6262 EOH
6263                 dflt="$binexp/perl"
6264                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6265                 . ./myread
6266                 case "$ans" in
6267                 none)   startperl=": # use perl";;
6268                 *)      startperl="#!$ans"
6269                         if $test 30 -lt `echo "$ans" | wc -c`; then
6270                                 $cat >&4 <<EOM
6271
6272 WARNING:  Some systems limit the #! command to 32 characters.
6273 If you experience difficulty running Perl scripts with #!, try
6274 installing Perl in a directory with a shorter pathname.
6275
6276 EOM
6277                         fi ;;
6278                 esac
6279                 ;;
6280         *) startperl=": # use perl"
6281                 ;;
6282         esac
6283         ;;
6284 esac
6285 echo "I'll use $startperl to start perl scripts."
6286
6287 : figure best path for perl in scripts
6288 case "$perlpath" in
6289 '')
6290         perlpath="$binexp/perl"
6291         case "$startperl" in
6292         *!*) ;;
6293         *)
6294                 $cat <<EOH
6295
6296 I will use the "eval 'exec'" idiom to start Perl on your system.
6297 I can use the full path of your Perl binary for this purpose, but
6298 doing so may cause problems if you want to share those scripts and
6299 Perl is not always in a standard place ($binexp/perl).
6300
6301 EOH
6302                 dflt="$binexp/perl"
6303                 rp="What path shall I use in \"eval 'exec'\"?"
6304                 . ./myread
6305                 perlpath="$ans"
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310 case "$startperl" in
6311 *!*)    ;;
6312 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6313 esac
6314
6315 : determine where public executable scripts go
6316 set scriptdir scriptdir
6317 eval $prefixit
6318 case "$scriptdir" in
6319 '')
6320         dflt="$bin"
6321         : guess some guesses
6322         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6323         $test -d /usr/share/bin     && dflt=/usr/share/bin
6324         $test -d /usr/local/script  && dflt=/usr/local/script
6325         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6326         $test -d $prefixexp/script  && dflt=$prefixexp/script
6327         set dflt
6328         eval $prefixup
6329         ;;
6330 *)  dflt="$scriptdir"
6331         ;;
6332 esac
6333 $cat <<EOM
6334  
6335 Some installations have a separate directory just for executable scripts so
6336 that they can mount it across multiple architectures but keep the scripts in
6337 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6338 Or you might just lump your scripts in with all your other executables.
6339  
6340 EOM
6341 fn=d~
6342 rp='Where do you keep publicly executable scripts?'
6343 . ./getfile
6344 if $test "X$ansexp" != "X$scriptdirexp"; then
6345         installscript=''
6346 fi
6347 scriptdir="$ans"
6348 scriptdirexp="$ansexp"
6349 : Change installation prefix, if necessary.
6350 if $test X"$prefix" != X"$installprefix"; then
6351         installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6352 else
6353         installscript="$scriptdirexp"
6354 fi
6355
6356 $cat <<EOM
6357
6358 After $package is installed, you may wish to install various
6359 add-on modules and utilities.  Typically, these add-ons will
6360 be installed under $prefix with the rest
6361 of this package.  However, you may wish to install such add-ons
6362 elsewhere under a different prefix.
6363
6364 If you do not wish to put everything under a single prefix, that's
6365 ok.  You will be prompted for the individual locations; this siteprefix
6366 is only used to suggest the defaults.
6367
6368 The default should be fine for most people.
6369
6370 EOM
6371 fn=d~+
6372 rp='Installation prefix to use for add-on modules and utilities?'
6373 : XXX Here might be another good place for an installstyle setting.
6374 case "$siteprefix" in
6375 '') dflt=$prefix ;;
6376 *)  dflt=$siteprefix ;;
6377 esac
6378 . ./getfile
6379 oldsiteprefix=''
6380 case "$siteprefix" in
6381 '') ;;
6382 *)
6383         case "$ans" in
6384         "$prefix") ;;
6385         *) oldsiteprefix="$prefix";;
6386         esac
6387         ;;
6388 esac
6389 siteprefix="$ans"
6390 siteprefixexp="$ansexp"
6391
6392 : determine where site specific libraries go.
6393 : Usual default is /usr/local/lib/perl5/site_perl
6394 : The default "style" setting is made in installstyle.U
6395 : XXX No longer works with Prefixit stuff.
6396 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6397 case "$installstyle" in
6398 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6399 *)       dflt=$siteprefix/lib/site_$prog ;;
6400 esac
6401 $cat <<EOM
6402
6403 The installation process will create a directory for
6404 site-specific extensions and modules.  Most users find it convenient
6405 to place all site-specific files in this directory rather than in the
6406 main distribution directory.
6407
6408 EOM
6409 fn=d~+
6410 rp='Pathname for the site-specific library files?'
6411 . ./getfile
6412 sitelib="$ans"
6413 sitelibexp="$ansexp"
6414 : Change installation prefix, if necessary.
6415 if $test X"$prefix" != X"$installprefix"; then
6416         installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
6417 else
6418         installsitelib="$sitelibexp"
6419 fi
6420
6421 : determine where site specific architecture-dependent libraries go.
6422 : sitelib  default is /usr/local/lib/perl5/site_perl/
6423 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6424 : sitelib may have an optional trailing /share.
6425 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6426 tdflt="$tdflt/$apiversion/$archname"
6427 set sitearch sitearch none
6428 eval $prefixit
6429 case "$sitearch" in
6430 '')     dflt="$tdflt" ;;
6431 *)      dflt="$sitearch" ;;
6432 esac
6433 $cat <<EOM
6434
6435 The installation process will also create a directory for
6436 architecture-dependent site-specific extensions and modules.
6437
6438 EOM
6439 fn=nd~+
6440 rp='Pathname for the site-specific architecture-dependent library files?'
6441 . ./getfile
6442 sitearch="$ans"
6443 sitearchexp="$ansexp"
6444 : Change installation prefix, if necessary.
6445 if $test X"$prefix" != X"$installprefix"; then
6446         installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
6447 else
6448         installsitearch="$sitearchexp"
6449 fi
6450
6451 cat <<EOM
6452
6453 Perl can be built to take advantage of long doubles which
6454 (if available) may give more accuracy and range for floating point
6455 numbers.  To do so, Configure must be run with -Duselongdouble.
6456
6457 If this doesn't make any sense to you, just accept the default 'n'.
6458 EOM
6459 case "$uselongdouble" in
6460 $define|true|[yY]*)     dflt='y';;
6461 *) dflt='n';;
6462 esac
6463 rp='Try to use long doubles if available?'
6464 . ./myread
6465 case "$ans" in
6466 y|Y) 
6467         val="$define"
6468         ccflags="$ccflags -DUSE_LONG_DOUBLE"
6469         ;;     
6470 *)      
6471         val="$undef"
6472         ;;
6473 esac
6474 set uselongdouble
6475 eval $setvar
6476
6477
6478 cat <<EOM
6479
6480 Previous version of $package used the standard IO mechanisms as defined
6481 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6482 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6483 the default.  This abstraction layer can use AT&T's sfio (if you already
6484 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6485 problems with some extension modules.  Using PerlIO with stdio is safe,
6486 but it is slower than plain stdio and therefore is not the default.
6487
6488 If this doesn't make any sense to you, just accept the default 'n'.
6489 EOM
6490 case "$useperlio" in
6491 $define|true|[yY]*)     dflt='y';;
6492 *) dflt='n';;
6493 esac
6494 rp='Use the experimental PerlIO abstraction layer?'
6495 . ./myread
6496 case "$ans" in
6497 y|Y) 
6498         val="$define"
6499         ;;     
6500 *)      
6501         echo "Ok, doing things the stdio way"
6502         val="$undef"
6503         ;;
6504 esac
6505 set useperlio
6506 eval $setvar 
6507
6508 : Check how to convert floats to strings.
6509 if test "X$d_Gconvert" = X; then
6510         echo " "
6511         echo "Checking for an efficient way to convert floats to strings."
6512         $cat >try.c <<'EOP'
6513 #ifdef TRY_gconvert
6514 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6515 char *myname = "gconvert";
6516 #endif
6517 #ifdef TRY_gcvt
6518 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6519 char *myname = "gcvt";
6520 #endif
6521 #ifdef TRY_sprintf
6522 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6523 char *myname = "sprintf";
6524 #endif
6525
6526 #include <stdio.h>
6527
6528 int
6529 checkit(expect, got)
6530 char *expect;
6531 char *got;
6532 {
6533     if (strcmp(expect, got)) {
6534                 printf("%s oddity:  Expected %s, got %s\n",
6535                         myname, expect, got);
6536                 exit(1);
6537         }
6538 }
6539
6540 int main()
6541
6542         char buf[64]; 
6543         buf[63] = '\0';
6544
6545         /* This must be 1st test on (which?) platform */
6546         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6547         Gconvert(0.1, 8, 0, buf);
6548         checkit("0.1", buf);
6549
6550         Gconvert(1.0, 8, 0, buf); 
6551         checkit("1", buf);
6552
6553         Gconvert(0.0, 8, 0, buf); 
6554         checkit("0", buf);
6555
6556         Gconvert(-1.0, 8, 0, buf); 
6557         checkit("-1", buf);
6558
6559         /* Some Linux gcvt's give 1.e+5 here. */
6560         Gconvert(100000.0, 8, 0, buf); 
6561         checkit("100000", buf);
6562         
6563         /* Some Linux gcvt's give -1.e+5 here. */
6564         Gconvert(-100000.0, 8, 0, buf); 
6565         checkit("-100000", buf);
6566
6567         exit(0);
6568 }
6569 EOP
6570         case "$d_Gconvert" in
6571         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6572         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6573         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6574         *) xxx_list='gconvert gcvt sprintf' ;;
6575         esac
6576
6577         for xxx_convert in $xxx_list; do
6578                 echo "Trying $xxx_convert"
6579                 $rm -f try try$_o
6580                 set try -DTRY_$xxx_convert
6581                 if eval $compile; then
6582                         echo "$xxx_convert" found. >&4
6583                         if ./try; then
6584                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6585                                 break;
6586                         else
6587                                 echo "...But $xxx_convert didn't work as I expected."
6588                         fi
6589                 else
6590                         echo "$xxx_convert NOT found." >&4
6591                 fi
6592         done
6593                 
6594         case "$xxx_convert" in
6595         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6596         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6597         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6598         esac
6599 fi
6600
6601 : see if inttypes.h is available
6602 : we want a real compile instead of Inhdr because some systems
6603 : have an inttypes.h which includes non-existent headers
6604 echo " "
6605 $cat >try.c <<EOCP
6606 #include <inttypes.h>
6607 int main() {
6608         static int32_t foo32 = 0x12345678;
6609 }
6610 EOCP
6611 set try
6612 if eval $compile; then
6613         echo "<inttypes.h> found." >&4
6614         val="$define"
6615 else
6616         echo "<inttypes.h> NOT found." >&4
6617         val="$undef"
6618 fi
6619 $rm -f try.c try
6620 set i_inttypes
6621 eval $setvar
6622
6623 : check for int64_t
6624 case "$use64bits" in
6625 "$define" )
6626         echo " "
6627         echo $n "Checking to see if your system supports int64_t...$c" >&4
6628         $cat >try.c <<EOCP
6629 #include <sys/types.h>
6630 #$i_inttypes I_INTTYPES
6631 #ifdef I_INTTYPES
6632 #include <inttypes.h>
6633 #endif
6634 int64_t foo() { int64_t x; x = 7; return x; }
6635 EOCP
6636         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6637                 val="$define"
6638                 echo " Yup, it does." >&4
6639         else
6640                 val="$undef"
6641                 echo " Nope, it doesn't." >&4
6642         fi
6643         $rm -f try.*
6644         ;;
6645 *)      val="$undef"
6646         ;;
6647 esac
6648 set d_int64t
6649 eval $setvar
6650
6651
6652 : check for lengths of integral types
6653 echo " "
6654 case "$intsize" in
6655 '')
6656         echo "Checking to see how big your integers are..." >&4
6657         $cat >intsize.c <<'EOCP'
6658 #include <stdio.h>
6659 int main()
6660 {
6661         printf("intsize=%d;\n", sizeof(int));
6662         printf("longsize=%d;\n", sizeof(long));
6663         printf("shortsize=%d;\n", sizeof(short));
6664         exit(0);
6665 }
6666 EOCP
6667         set intsize
6668         if eval $compile_ok && ./intsize > /dev/null; then
6669                 eval `./intsize`
6670                 echo "Your integers are $intsize bytes long."
6671                 echo "Your long integers are $longsize bytes long."
6672                 echo "Your short integers are $shortsize bytes long."
6673         else
6674                 $cat >&4 <<EOM
6675 !
6676 Help! I can't compile and run the intsize test program: please enlighten me!
6677 (This is probably a misconfiguration in your system or libraries, and
6678 you really ought to fix it.  Still, I'll try anyway.)
6679 !
6680 EOM
6681                 dflt=4
6682                 rp="What is the size of an integer (in bytes)?"
6683                 . ./myread
6684                 intsize="$ans"
6685                 dflt=$intsize
6686                 rp="What is the size of a long integer (in bytes)?"
6687                 . ./myread
6688                 longsize="$ans"
6689                 dflt=2
6690                 rp="What is the size of a short integer (in bytes)?"
6691                 . ./myread
6692                 shortsize="$ans"
6693         fi
6694         ;;
6695 esac
6696 $rm -f intsize intsize.*
6697
6698 : check for long long
6699 echo " "
6700 echo $n "Checking to see if your system supports long long...$c" >&4
6701 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6702 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6703         val="$define"
6704         echo " Yup, it does." >&4
6705 else
6706         val="$undef"
6707         echo " Nope, it doesn't." >&4
6708 fi
6709 $rm try.*
6710 set d_longlong
6711 eval $setvar
6712
6713 : check for length of long long
6714 case "${d_longlong}${longlongsize}" in
6715 $define)
6716         echo " "
6717         $echo $n "Checking to see how big your long longs are...$c" >&4
6718         $cat >try.c <<'EOCP'
6719 #include <stdio.h>
6720 int main()
6721 {
6722         printf("%d\n", sizeof(long long));
6723 }
6724 EOCP
6725         set try
6726         if eval $compile_ok; then
6727                 longlongsize=`./try`
6728                 $echo " $longlongsize bytes." >&4
6729         else
6730                 dflt='8'
6731                 echo " "
6732                 echo "(I can't seem to compile the test program.  Guessing...)"
6733                 rp="What is the size of a long long (in bytes)?"
6734                 . ./myread
6735                 longlongsize="$ans"
6736         fi
6737         if $test "X$longsize" = "X$longlongsize"; then
6738                 echo "(That isn't any different from an ordinary long.)"
6739         fi      
6740         ;;
6741 esac
6742 $rm -f try.c try
6743
6744 echo " "
6745
6746 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6747
6748 echo "Checking how to print 64-bit integers..." >&4
6749
6750 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6751         quad=int
6752         $cat >try.c <<'EOCP'
6753 #include <sys/types.h>
6754 #include <stdio.h>
6755 int main() {
6756   int q = 12345678901;
6757   printf("%ld\n", q);
6758 }
6759 EOCP
6760         set try
6761         if eval $compile; then
6762                 yyy=`./try$exe_ext`
6763                 case "$yyy" in
6764                 12345678901)
6765                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6766                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6767                         echo "We will use %d."
6768                         ;;
6769                 esac
6770         fi
6771 fi
6772
6773 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6774         quad=long
6775         $cat >try.c <<'EOCP'
6776 #include <sys/types.h>
6777 #include <stdio.h>
6778 int main() {
6779   long q = 12345678901;
6780   printf("%ld\n", q);
6781 }
6782 EOCP
6783         set try
6784         if eval $compile; then
6785                 yyy=`./try$exe_ext`
6786                 case "$yyy" in
6787                 12345678901)
6788                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6789                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6790                         echo "We will use %ld."
6791                         ;;
6792                 esac
6793         fi
6794 fi
6795
6796 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6797         quad=int64_t
6798         $cat >try.c <<'EOCP'
6799 #include <sys/types.h>
6800 #include <inttypes.h>
6801 #include <stdio.h>
6802 int main() {
6803   int64_t q = 12345678901;
6804   printf("%" PRId64 "\n", q);
6805 }
6806 EOCP
6807         set try
6808         if eval $compile; then
6809                 yyy=`./try$exe_ext`
6810                 case "$yyy" in
6811                 12345678901)
6812                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6813                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6814                         echo "We will use the C9X style."
6815                         ;;
6816                 esac
6817         fi
6818 fi
6819
6820 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6821         quad="long long"
6822         $cat >try.c <<'EOCP'
6823 #include <sys/types.h>
6824 #include <stdio.h>
6825 int main() {
6826   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6827   printf("%lld\n", q);
6828 }
6829 EOCP
6830         set try
6831         if eval $compile; then
6832                 yyy=`./try$exe_ext`
6833                 case "$yyy" in
6834                 12345678901)
6835                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6836                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6837                         echo "We will use the %lld style."
6838                         ;;
6839                 esac
6840         fi
6841 fi
6842
6843 if $test X"$sPRId64" = X -a X"$quad" != X; then
6844         $cat >try.c <<EOCP
6845 #include <sys/types.h>
6846 #include <stdio.h>
6847 int main() {
6848   $quad q = 12345678901;
6849   printf("%Ld\n", q);
6850 }
6851 EOCP
6852         set try
6853         if eval $compile; then
6854                 yyy=`./try$exe_ext`
6855                 case "$yyy" in
6856                 12345678901)
6857                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6858                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6859                         echo "We will use %lld."
6860                         ;;
6861                 esac
6862         fi
6863 fi
6864
6865 if $test X"$sPRId64" = X -a X"$quad" != X; then
6866         $cat >try.c <<EOCP
6867 #include <sys/types.h>
6868 #include <stdio.h>
6869 int main() {
6870   $quad q = 12345678901;
6871   printf("%qd\n", q);
6872 }
6873 EOCP
6874         set try
6875         if eval $compile; then
6876                 yyy=`./try$exe_ext`
6877                 case "$yyy" in
6878                 12345678901)
6879                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6880                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6881                         echo "We will use %qd."
6882                         ;;
6883                 esac
6884         fi
6885 fi
6886
6887 if $test X"$sPRId64" = X; then
6888         echo "Cannot figure out how to print 64-bit integers." >&4
6889 fi
6890
6891 $rm -f try try.*
6892
6893 fi # intsize -o longsize -o d_int64t -o d_longlong
6894
6895 case "$sPRId64" in
6896 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6897         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6898         ;;
6899 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6900         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6901         ;;
6902 esac
6903
6904 : check for length of double
6905 echo " "
6906 case "$doublesize" in
6907 '')
6908         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6909         $cat >try.c <<'EOCP'
6910 #include <stdio.h>
6911 int main()
6912 {
6913         printf("%d\n", sizeof(double));
6914 }
6915 EOCP
6916         set try
6917         if eval $compile_ok; then
6918                 doublesize=`./try`
6919                 $echo " $doublesize bytes." >&4
6920         else
6921                 dflt='8'
6922                 echo "(I can't seem to compile the test program.  Guessing...)"
6923                 rp="What is the size of a double precision number (in bytes)?"
6924                 . ./myread
6925                 doublesize="$ans"
6926         fi
6927         ;;
6928 esac
6929 $rm -f try.c try
6930
6931 : check for long doubles
6932 echo " "
6933 echo $n "Checking to see if your system supports long doubles...$c" >&4
6934 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6935 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6936         val="$define"
6937         echo " Yup, it does." >&4
6938 else
6939         val="$undef"
6940         echo " Nope, it doesn't." >&4
6941 fi
6942 $rm try.*
6943 set d_longdbl
6944 eval $setvar
6945
6946 : check for length of long double
6947 case "${d_longdbl}${longdblsize}" in
6948 $define)
6949         echo " "
6950         $echo $n "Checking to see how big your long doubles are...$c" >&4
6951         $cat >try.c <<'EOCP'
6952 #include <stdio.h>
6953 int main()
6954 {
6955         printf("%d\n", sizeof(long double));
6956 }
6957 EOCP
6958         set try
6959         if eval $compile; then
6960                 longdblsize=`./try`
6961                 $echo " $longdblsize bytes." >&4
6962         else
6963                 dflt='8'
6964                 echo " "
6965                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6966                 rp="What is the size of a long double (in bytes)?"
6967                 . ./myread
6968                 longdblsize="$ans"
6969         fi
6970         if $test "X$doublesize" = "X$longdblsize"; then
6971                 echo "(That isn't any different from an ordinary double.)"
6972         fi      
6973         ;;
6974 esac
6975 $rm -f try.c try
6976
6977 echo " "
6978
6979 if $test X"$d_longdbl" = X"$define"; then
6980
6981 echo "Checking how to print long doubles..." >&4
6982
6983 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6984         $cat >try.c <<'EOCP'
6985 #include <sys/types.h>
6986 #include <stdio.h>
6987 int main() {
6988   double d = 123.456;
6989   printf("%.3f\n", d);
6990 }
6991 EOCP
6992         set try
6993         if eval $compile; then
6994                 yyy=`./try$exe_ext`
6995                 case "$yyy" in
6996                 123.456)
6997                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6998                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6999                         echo "We will use %f."
7000                         ;;
7001                 esac
7002         fi
7003 fi
7004
7005 if $test X"$sPRIfldbl" = X; then
7006         $cat >try.c <<'EOCP'
7007 #include <sys/types.h>
7008 #include <stdio.h>
7009 int main() {
7010   long double d = 123.456;
7011   printf("%.3llf\n", d);
7012 }
7013 EOCP
7014         set try
7015         if eval $compile; then
7016                 yyy=`./try$exe_ext`
7017                 case "$yyy" in
7018                 123.456)
7019                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7020                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7021                         echo "We will use %llf."
7022                         ;;
7023                 esac
7024         fi
7025 fi
7026
7027 if $test X"$sPRIfldbl" = X; then
7028         echo "Cannot figure out how to print long doubles." >&4
7029 fi
7030
7031 if $test X"$sPRIfldbl" = X; then
7032         $cat >try.c <<'EOCP'
7033 #include <sys/types.h>
7034 #include <stdio.h>
7035 int main() {
7036   long double d = 123.456;
7037   printf("%.3Lf\n", d);
7038 }
7039 EOCP
7040         set try
7041         if eval $compile; then
7042                 yyy=`./try$exe_ext`
7043                 case "$yyy" in
7044                 123.456)
7045                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7046                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7047                         echo "We will use %Lf."
7048                         ;;
7049                 esac
7050         fi
7051 fi
7052
7053 if $test X"$sPRIfldbl" = X; then
7054         $cat >try.c <<'EOCP'
7055 #include <sys/types.h>
7056 #include <stdio.h>
7057 int main() {
7058   long double d = 123.456;
7059   printf("%.3lf\n", d);
7060 }
7061 EOCP
7062         set try
7063         if eval $compile; then
7064                 yyy=`./try$exe_ext`
7065                 case "$yyy" in
7066                 123.456)
7067                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7068                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7069                         echo "We will use %lf."
7070                         ;;
7071                 esac
7072         fi
7073 fi
7074
7075 $rm -f try try.*
7076
7077 fi # d_longdbl
7078
7079 case "$sPRIfldbl" in
7080 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7081         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7082         ;;
7083 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7084         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7085         ;;
7086 esac
7087
7088 : Initialize h_fcntl
7089 h_fcntl=false
7090
7091 : Initialize h_sysfile
7092 h_sysfile=false
7093
7094 : access call always available on UNIX
7095 set access d_access
7096 eval $inlibc
7097
7098 : locate the flags for 'access()'
7099 case "$d_access" in
7100 "$define")
7101         echo " "
7102         $cat >access.c <<'EOCP'
7103 #include <sys/types.h>
7104 #ifdef I_FCNTL
7105 #include <fcntl.h>
7106 #endif
7107 #ifdef I_SYS_FILE
7108 #include <sys/file.h>
7109 #endif
7110 #ifdef I_UNISTD
7111 #include <unistd.h>
7112 #endif
7113 int main() {
7114         exit(R_OK);
7115 }
7116 EOCP
7117         : check sys/file.h first, no particular reason here
7118         if $test `./findhdr sys/file.h` && \
7119                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7120                 h_sysfile=true;
7121                 echo "<sys/file.h> defines the *_OK access constants." >&4
7122         elif $test `./findhdr fcntl.h` && \
7123                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7124                 h_fcntl=true;
7125                 echo "<fcntl.h> defines the *_OK access constants." >&4
7126         elif $test `./findhdr unistd.h` && \
7127                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7128                 echo "<unistd.h> defines the *_OK access constants." >&4
7129         else
7130                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7131         fi
7132         ;;
7133 esac
7134 $rm -f access*
7135
7136 : see if accessx exists
7137 set accessx d_accessx
7138 eval $inlibc
7139
7140 : see if alarm exists
7141 set alarm d_alarm
7142 eval $inlibc
7143
7144 : see if atolf exists
7145 set atolf d_atolf
7146 eval $inlibc
7147
7148 : see if atoll exists
7149 set atoll d_atoll
7150 eval $inlibc
7151
7152 : Look for GNU-cc style attribute checking
7153 echo " "
7154 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7155 $cat >attrib.c <<'EOCP'
7156 #include <stdio.h>
7157 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7158 EOCP
7159 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7160         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7161                 echo "Your C compiler doesn't fully support __attribute__."
7162                 val="$undef"
7163         else
7164                 echo "Your C compiler supports __attribute__."
7165                 val="$define"
7166         fi
7167 else
7168         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7169         val="$undef"
7170 fi
7171 set d_attribut
7172 eval $setvar
7173 $rm -f attrib*
7174
7175 : see if bcmp exists
7176 set bcmp d_bcmp
7177 eval $inlibc
7178
7179 : see if bcopy exists
7180 set bcopy d_bcopy
7181 eval $inlibc
7182
7183 : see if this is a unistd.h system
7184 set unistd.h i_unistd
7185 eval $inhdr
7186
7187 : see if getpgrp exists
7188 set getpgrp d_getpgrp
7189 eval $inlibc
7190
7191 case "$d_getpgrp" in
7192 "$define")
7193         echo " "
7194         echo "Checking to see which flavor of getpgrp is in use..."
7195         $cat >set.c <<EOP
7196 #$i_unistd I_UNISTD
7197 #include <sys/types.h>
7198 #ifdef I_UNISTD
7199 #  include <unistd.h>
7200 #endif
7201 int main()
7202 {
7203         if (getuid() == 0) {
7204                 printf("(I see you are running Configure as super-user...)\n");
7205                 setuid(1);
7206         }
7207 #ifdef TRY_BSD_PGRP
7208         if (getpgrp(1) == 0)
7209                 exit(0);
7210 #else
7211         if (getpgrp() > 0)
7212                 exit(0);
7213 #endif
7214         exit(1);
7215 }
7216 EOP
7217         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7218                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7219                 val="$define"
7220         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7221                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7222                 val="$undef"
7223         else
7224                 echo "I can't seem to compile and run the test program."
7225                 if ./usg; then
7226                         xxx="a USG one, i.e. you use getpgrp()."
7227                 else
7228                         # SVR4 systems can appear rather BSD-ish.
7229                         case "$i_unistd" in
7230                         $undef)
7231                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7232                                 val="$define"
7233                                 ;;
7234                         $define)
7235                                 xxx="probably a USG one, i.e. you use getpgrp()."
7236                                 val="$undef"
7237                                 ;;
7238                         esac
7239                 fi
7240                 echo "Assuming your getpgrp is $xxx" >&4
7241         fi
7242         ;;
7243 *) val="$undef";;
7244 esac
7245 set d_bsdgetpgrp
7246 eval $setvar
7247 $rm -f set set.c
7248
7249 : see if setpgrp exists
7250 set setpgrp d_setpgrp
7251 eval $inlibc
7252
7253 case "$d_setpgrp" in
7254 "$define")
7255         echo " "
7256         echo "Checking to see which flavor of setpgrp is in use..."
7257         $cat >set.c <<EOP
7258 #$i_unistd I_UNISTD
7259 #include <sys/types.h>
7260 #ifdef I_UNISTD
7261 #  include <unistd.h>
7262 #endif
7263 int main()
7264 {
7265         if (getuid() == 0) {
7266                 printf("(I see you are running Configure as super-user...)\n");
7267                 setuid(1);
7268         }
7269 #ifdef TRY_BSD_PGRP
7270         if (-1 == setpgrp(1, 1))
7271                 exit(0);
7272 #else
7273         if (setpgrp() != -1)
7274                 exit(0);
7275 #endif
7276         exit(1);
7277 }
7278 EOP
7279         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7280                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7281                 val="$define"
7282         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7283                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7284                 val="$undef"
7285         else
7286                 echo "(I can't seem to compile and run the test program.)"
7287                 if ./usg; then
7288                         xxx="a USG one, i.e. you use setpgrp()."
7289                 else
7290                         # SVR4 systems can appear rather BSD-ish.
7291                         case "$i_unistd" in
7292                         $undef)
7293                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7294                                 val="$define"
7295                                 ;;
7296                         $define)
7297                                 xxx="probably a USG one, i.e. you use setpgrp()."
7298                                 val="$undef"
7299                                 ;;
7300                         esac
7301                 fi
7302                 echo "Assuming your setpgrp is $xxx" >&4
7303         fi
7304         ;;
7305 *) val="$undef";;
7306 esac
7307 set d_bsdsetpgrp
7308 eval $setvar
7309 $rm -f set set.c
7310 : see if bzero exists
7311 set bzero d_bzero
7312 eval $inlibc
7313
7314 : see if signal is declared as pointer to function returning int or void
7315 echo " "
7316 xxx=`./findhdr signal.h`
7317 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7318 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7319         echo "You have int (*signal())() instead of void." >&4
7320         val="$undef"
7321 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7322         echo "You have void (*signal())()." >&4
7323         val="$define"
7324 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7325         echo "You have int (*signal())() instead of void." >&4
7326         val="$undef"
7327 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7328         echo "You have void (*signal())()." >&4
7329         val="$define"
7330 else
7331         case "$d_voidsig" in
7332         '')
7333         echo "I can't determine whether signal handler returns void or int..." >&4
7334                 dflt=void
7335                 rp="What type does your signal handler return?"
7336                 . ./myread
7337                 case "$ans" in
7338                 v*) val="$define";;
7339                 *) val="$undef";;
7340                 esac;;
7341         "$define")
7342                 echo "As you already told me, signal handler returns void." >&4
7343                 val="$define"
7344                 ;;
7345         *)      echo "As you already told me, signal handler returns int." >&4
7346                 val="$undef"
7347                 ;;
7348         esac
7349 fi
7350 set d_voidsig
7351 eval $setvar
7352 case "$d_voidsig" in
7353 "$define") signal_t="void";;
7354 *) signal_t="int";;
7355 esac
7356 $rm -f $$.tmp
7357
7358 : check for ability to cast large floats to 32-bit ints.
7359 echo " "
7360 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7361 if $test "$intsize" -ge 4; then
7362         xxx=int
7363 else
7364         xxx=long
7365 fi
7366 $cat >try.c <<EOCP
7367 #include <stdio.h>
7368 #include <sys/types.h>
7369 #include <signal.h>
7370 $signal_t blech(s) int s; { exit(3); }
7371 int main()
7372 {
7373         $xxx i32;
7374         double f, g;
7375         int result = 0;
7376         char str[16];
7377         signal(SIGFPE, blech);
7378
7379         /* Don't let compiler optimize the test away.  Store the number 
7380            in a writable string for gcc to pass to sscanf under HP/UX.
7381         */
7382         sprintf(str, "2147483647");
7383         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7384         g = 10 * f;
7385         i32  = ($xxx) g;
7386
7387         /* x86 processors will probably give 0x8000 0000, which is a
7388        sign change.  We don't want that.  We want to mimic SPARC
7389            behavior here, which is to preserve the sign and give
7390            back 0x7fff ffff.
7391         */
7392         if (i32 != ($xxx) f)
7393                 result |= 1;
7394         exit(result);
7395 }
7396 EOCP
7397 set try
7398 if eval $compile_ok; then
7399         ./try
7400         yyy=$?
7401 else
7402         echo "(I can't seem to compile the test program--assuming it can't)"
7403         yyy=1
7404 fi
7405 case "$yyy" in
7406 0)      val="$define"
7407         echo "Yup, it can."
7408         ;;
7409 *)      val="$undef"
7410         echo "Nope, it can't."
7411         ;;
7412 esac
7413 set d_casti32
7414 eval $setvar
7415 $rm -f try try.*
7416
7417 : check for ability to cast negative floats to unsigned
7418 echo " "
7419 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7420 $cat >try.c <<EOCP
7421 #include <stdio.h>
7422 #include <sys/types.h>
7423 #include <signal.h>
7424 $signal_t blech(s) int s; { exit(7); }
7425 $signal_t blech_in_list(s) int s; { exit(4); }
7426 unsigned long dummy_long(p) unsigned long p; { return p; }
7427 unsigned int dummy_int(p) unsigned int p; { return p; }
7428 unsigned short dummy_short(p) unsigned short p; { return p; }
7429 int main()
7430 {
7431         double f;
7432         unsigned long along;
7433         unsigned int aint;
7434         unsigned short ashort;
7435         int result = 0;
7436         char str[16];
7437         
7438         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7439            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7440            optimized the whole file away
7441         */
7442         /* Store the number in a writable string for gcc to pass to 
7443            sscanf under HP/UX.
7444         */
7445         sprintf(str, "-123");
7446         sscanf(str, "%lf", &f);  /* f = -123.; */
7447
7448         signal(SIGFPE, blech);
7449         along = (unsigned long)f;
7450         aint = (unsigned int)f;
7451         ashort = (unsigned short)f;
7452         if (along != (unsigned long)-123)
7453                 result |= 1;
7454         if (aint != (unsigned int)-123)
7455                 result |= 1;
7456         if (ashort != (unsigned short)-123)
7457                 result |= 1;
7458         sprintf(str, "1073741824.");
7459         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7460         f = f + f;
7461         along = 0;
7462         along = (unsigned long)f;
7463         if (along != 0x80000000)
7464                 result |= 2;
7465         f -= 1.;
7466         along = 0;
7467         along = (unsigned long)f;
7468         if (along != 0x7fffffff)
7469                 result |= 1;
7470         f += 2.;
7471         along = 0;
7472         along = (unsigned long)f;
7473         if (along != 0x80000001)
7474                 result |= 2;
7475         if (result)
7476                 exit(result);
7477         signal(SIGFPE, blech_in_list);
7478         sprintf(str, "123.");
7479         sscanf(str, "%lf", &f);  /* f = 123.; */
7480         along = dummy_long((unsigned long)f);
7481         aint = dummy_int((unsigned int)f);
7482         ashort = dummy_short((unsigned short)f);
7483         if (along != (unsigned long)123)
7484                 result |= 4;
7485         if (aint != (unsigned int)123)
7486                 result |= 4;
7487         if (ashort != (unsigned short)123)
7488                 result |= 4;
7489         exit(result);
7490
7491 }
7492 EOCP
7493 set try
7494 if eval $compile_ok; then
7495         ./try
7496         castflags=$?
7497 else
7498         echo "(I can't seem to compile the test program--assuming it can't)"
7499         castflags=7
7500 fi
7501 case "$castflags" in
7502 0)      val="$define"
7503         echo "Yup, it can."
7504         ;;
7505 *)      val="$undef"
7506         echo "Nope, it can't."
7507         ;;
7508 esac
7509 set d_castneg
7510 eval $setvar
7511 $rm -f try.*
7512
7513 : see if vprintf exists
7514 echo " "
7515 if set vprintf val -f d_vprintf; eval $csym; $val; then
7516         echo 'vprintf() found.' >&4
7517         val="$define"
7518         $cat >vprintf.c <<'EOF'
7519 #include <varargs.h>
7520
7521 int main() { xxx("foo"); }
7522
7523 xxx(va_alist)
7524 va_dcl
7525 {
7526         va_list args;
7527         char buf[10];
7528
7529         va_start(args);
7530         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7531 }
7532 EOF
7533         set vprintf
7534         if eval $compile && ./vprintf; then
7535                 echo "Your vsprintf() returns (int)." >&4
7536                 val2="$undef"
7537         else
7538                 echo "Your vsprintf() returns (char*)." >&4
7539                 val2="$define"
7540         fi
7541 else
7542         echo 'vprintf() NOT found.' >&4
7543                 val="$undef"
7544                 val2="$undef"
7545 fi
7546 set d_vprintf
7547 eval $setvar
7548 val=$val2
7549 set d_charvspr
7550 eval $setvar
7551
7552 : see if chown exists
7553 set chown d_chown
7554 eval $inlibc
7555
7556 : see if chroot exists
7557 set chroot d_chroot
7558 eval $inlibc
7559
7560 : see if chsize exists
7561 set chsize d_chsize
7562 eval $inlibc
7563
7564 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7565 while $test $# -ge 2; do
7566         case "$1" in
7567         $define) echo "#include <$2>";;
7568         esac ;
7569     shift 2;
7570 done > try.c;
7571 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7572 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7573         val="$define";
7574 else
7575         val="$undef";
7576 fi;
7577 set $varname;
7578 eval $setvar;
7579 $rm -f try.c try.o'
7580
7581 : see if this is a sys/uio.h system
7582 set sys/uio.h i_sysuio
7583 eval $inhdr
7584
7585 echo "Checking to see if your system supports struct iovec..." >&4
7586 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7587 eval $hasfield
7588 case "$d_iovec_s" in
7589 "$define")      echo "Yup, it does." >&4
7590                 ;;
7591 *)              echo "Nope, it doesn't." >&4
7592                 ;;
7593 esac
7594
7595 socketlib=''
7596 sockethdr=''
7597 : see whether socket exists
7598 echo " "
7599 $echo $n "Hmm... $c" >&4
7600 if set socket val -f d_socket; eval $csym; $val; then
7601         echo "Looks like you have Berkeley networking support." >&4
7602         d_socket="$define"
7603         if set setsockopt val -f; eval $csym; $val; then
7604                 d_oldsock="$undef"
7605         else
7606                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7607                 d_oldsock="$define"
7608         fi
7609 else
7610         if $contains socklib libc.list >/dev/null 2>&1; then
7611                 echo "Looks like you have Berkeley networking support." >&4
7612                 d_socket="$define"
7613                 : we will have to assume that it supports the 4.2 BSD interface
7614                 d_oldsock="$undef"
7615         else
7616                 echo "You don't have Berkeley networking in libc$_a..." >&4
7617                 if test "X$d_socket" = "X$define"; then
7618                    echo "...but you seem to believe that you have sockets." >&4
7619                 else
7620                         for net in net socket
7621                         do
7622                                 if test -f /usr/lib/lib$net$_a; then
7623                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7624                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7625                                         if $contains socket libc.list >/dev/null 2>&1; then
7626                                                 d_socket="$define"
7627                                                 socketlib="-l$net"
7628                                                 case "$net" in
7629                                                 net)
7630                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7631                                                         sockethdr="-I/usr/netinclude"
7632                                                         ;;
7633                                                 esac
7634                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7635                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7636                                                         d_oldsock="$undef"
7637                                                 else
7638                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7639                                                         d_oldsock="$define"
7640                                                 fi
7641                                                 break
7642                                         fi
7643                                 fi
7644                         done
7645                         if test "X$d_socket" != "X$define"; then
7646                            echo "or anywhere else I see." >&4
7647                            d_socket="$undef"
7648                            d_oldsock="$undef"
7649                         fi
7650                 fi
7651         fi
7652 fi
7653
7654 : see if socketpair exists
7655 set socketpair d_sockpair
7656 eval $inlibc
7657
7658
7659 echo " "
7660 echo "Checking the availability of certain socket constants..." >& 4
7661 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7662         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7663         $cat >try.c <<EOF
7664 #include <sys/types.h>
7665 #include <sys/socket.h>
7666 int main() {
7667     int i = $ENUM;
7668 }
7669 EOF
7670         val="$undef"
7671         set try; if eval $compile; then
7672                 val="$define"
7673         fi
7674         set d_${enum}; eval $setvar
7675         $rm -f try.c try
7676 done
7677
7678 set sendmsg d_sendmsg
7679 eval $inlibc
7680
7681 set recvmsg d_recvmsg
7682 eval $inlibc
7683
7684 echo " "
7685 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7686 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7687 eval $hasfield
7688 case "$d_msghdr_s" in
7689 "$define")      echo "Yup, it does." >&4
7690                 ;;
7691 *)              echo "Nope, it doesn't." >&4
7692                 ;;
7693 esac
7694
7695 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7696 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7697 eval $hasfield
7698 case "$d_cmsghdr_s" in
7699 "$define")      echo "Yup, it does." >&4
7700                 ;;
7701 *)              echo "Nope, it doesn't." >&4
7702                 ;;
7703 esac
7704
7705 : check for const keyword
7706 echo " "
7707 echo 'Checking to see if your C compiler knows about "const"...' >&4
7708 $cat >const.c <<'EOCP'
7709 typedef struct spug { int drokk; } spug;
7710 int main()
7711 {
7712         const char *foo;
7713         const spug y;
7714 }
7715 EOCP
7716 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7717         val="$define"
7718         echo "Yup, it does."
7719 else
7720         val="$undef"
7721         echo "Nope, it doesn't."
7722 fi
7723 set d_const
7724 eval $setvar
7725
7726 : see if crypt exists
7727 echo " "
7728 if set crypt val -f d_crypt; eval $csym; $val; then
7729         echo 'crypt() found.' >&4
7730         val="$define"
7731         cryptlib=''
7732 else
7733         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7734         if $test -z "$cryptlib"; then
7735                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7736         else
7737                 cryptlib=-lcrypt
7738         fi
7739         if $test -z "$cryptlib"; then
7740                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7741         else
7742                 cryptlib=-lcrypt
7743         fi
7744         if $test -z "$cryptlib"; then
7745                 cryptlib=`./loc libcrypt$_a "" $libpth`
7746         else
7747                 cryptlib=-lcrypt
7748         fi
7749         if $test -z "$cryptlib"; then
7750                 echo 'crypt() NOT found.' >&4
7751                 val="$undef"
7752         else
7753                 val="$define"
7754         fi
7755 fi
7756 set d_crypt
7757 eval $setvar
7758
7759 : get csh whereabouts
7760 case "$csh" in
7761 'csh') val="$undef" ;;
7762 *) val="$define" ;;
7763 esac
7764 set d_csh
7765 eval $setvar
7766 : Respect a hint or command line value for full_csh.
7767 case "$full_csh" in
7768 '') full_csh=$csh ;;
7769 esac
7770
7771 : see if cuserid exists
7772 set cuserid d_cuserid
7773 eval $inlibc
7774
7775 : see if this is a limits.h system
7776 set limits.h i_limits
7777 eval $inhdr
7778
7779 : see if this is a float.h system
7780 set float.h i_float
7781 eval $inhdr
7782
7783 : See if number of significant digits in a double precision number is known
7784 echo " "
7785 $cat >dbl_dig.c <<EOM
7786 #$i_limits I_LIMITS
7787 #$i_float I_FLOAT
7788 #ifdef I_LIMITS
7789 #include <limits.h>
7790 #endif
7791 #ifdef I_FLOAT
7792 #include <float.h>
7793 #endif
7794 #ifdef DBL_DIG
7795 printf("Contains DBL_DIG");
7796 #endif
7797 EOM
7798 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7799 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7800         echo "DBL_DIG found." >&4
7801         val="$define"
7802 else
7803         echo "DBL_DIG NOT found." >&4
7804         val="$undef"
7805 fi
7806 $rm -f dbl_dig.?
7807 set d_dbl_dig
7808 eval $setvar
7809
7810
7811 if $test X"$use64bits" = X"$define"; then
7812         : see if dbminit64 exists
7813         set dbminit64 d_dbminit64
7814         eval $inlibc
7815
7816         : see if dbmclose64 exists
7817         set dbmclose64 d_dbmclose64
7818         eval $inlibc
7819
7820         : see if fetch64 exists
7821         set fetch64 d_fetch64
7822         eval $inlibc
7823
7824         : see if store64 exists
7825         set store64 d_store64
7826         eval $inlibc
7827
7828         : see if delete64 exists
7829         set delete64 d_delete64
7830         eval $inlibc
7831
7832         : see if firstkey64 exists
7833         set firstkey64 d_firstkey64
7834         eval $inlibc
7835
7836         : see if nextkey64 exists
7837         set nextkey64 d_nextkey64
7838         eval $inlibc
7839 else
7840         val="$undef"
7841         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7842         do
7843                 set $xxx
7844                 eval $setvar
7845         done
7846 fi
7847
7848 : see if difftime exists
7849 set difftime d_difftime
7850 eval $inlibc
7851
7852 : see if sys/stat.h is available
7853 set sys/stat.h i_sysstat
7854 eval $inhdr
7855
7856 : see if this is a dirent system
7857 echo " "
7858 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7859         val="$define"
7860         echo "<dirent.h> found." >&4
7861 else
7862         val="$undef"
7863         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7864                 echo "<sys/dir.h> found." >&4
7865                 echo " "
7866         else
7867                 xinc=`./findhdr sys/ndir.h`
7868         fi
7869         echo "<dirent.h> NOT found." >&4
7870 fi
7871 set i_dirent
7872 eval $setvar
7873
7874 : Look for type of directory structure.
7875 echo " "
7876 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7877
7878 case "$direntrytype" in
7879 ''|' ')
7880         case "$i_dirent" in
7881         $define) guess1='struct dirent' ;;
7882         *) guess1='struct direct'  ;;
7883         esac
7884         ;;
7885 *)      guess1="$direntrytype"
7886         ;;
7887 esac
7888
7889 case "$guess1" in
7890 'struct dirent') guess2='struct direct' ;;
7891 *) guess2='struct dirent' ;;
7892 esac
7893                 
7894 if $contains "$guess1" try.c >/dev/null 2>&1; then
7895         direntrytype="$guess1"
7896         echo "Your directory entries are $direntrytype." >&4
7897 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7898         direntrytype="$guess2"
7899         echo "Your directory entries seem to be $direntrytype." >&4
7900 else
7901         echo "I don't recognize your system's directory entries." >&4
7902         rp="What type is used for directory entries on this system?"
7903         dflt="$guess1"
7904         . ./myread
7905         direntrytype="$ans"
7906 fi
7907 $rm -f try.c
7908
7909
7910 : see if the directory entry stores field length
7911 echo " "
7912 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7913 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7914         echo "Good, your directory entry keeps length information in d_namlen." >&4
7915         val="$define"
7916 else
7917         echo "Your directory entry does not know about the d_namlen field." >&4
7918         val="$undef"
7919 fi
7920 set d_dirnamlen
7921 eval $setvar
7922 $rm -f try.c
7923
7924
7925 if $test X"$use64bits" = X"$define"; then
7926         : see if fstat64 exists
7927         set fstat64 d_fstat64
7928         eval $inlibc
7929
7930         : see if ftruncate64 exists
7931         set ftruncate64 d_ftruncate64
7932         eval $inlibc
7933
7934         : see if lockf64 exists
7935         set lockf64 d_lockf64
7936         eval $inlibc
7937
7938         : see if llseek exists
7939         set llseek d_llseek
7940         eval $inlibc
7941
7942         : see if lseek64 exists
7943         set lseek64 d_lseek64
7944         eval $inlibc
7945
7946         : see if lstat64 exists
7947         set lstat64 d_lstat64
7948         eval $inlibc
7949
7950         : see if open64 exists
7951         set open64 d_open64
7952         eval $inlibc
7953
7954         : see if opendir64 exists
7955         set opendir64 d_opendir64
7956         eval $inlibc
7957
7958         : see if readdir64 exists
7959         set readdir64 d_readdir64
7960         eval $inlibc
7961
7962         : see if seekdir64 exists
7963         set seekdir64 d_seekdir64
7964         eval $inlibc
7965
7966         : see if stat64 exists
7967         set stat64 d_stat64
7968         eval $inlibc
7969
7970         : see if telldir64 exists
7971         set telldir64 d_telldir64
7972         eval $inlibc
7973
7974         : see if truncate64 exists
7975         set truncate64 d_truncate64
7976         eval $inlibc
7977
7978         : check for off64_t
7979         echo " "
7980         echo $n "Checking to see if your system supports off64_t...$c" >&4
7981         $cat >try.c <<EOCP
7982 #include <sys/types.h>
7983 #include <unistd.h>
7984 off64_t foo() { off64_t x; x = 7; return x; }'
7985 EOCP
7986         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7987                 val="$define"
7988                 echo " Yup, it does." >&4
7989         else
7990                 val="$undef"
7991                 echo " Nope, it doesn't." >&4
7992         fi
7993         $rm -f try.*
7994         set d_off64_t
7995         eval $setvar
7996
7997         : check for offset_t
7998         echo " "
7999         echo $n "Checking to see if your system supports offset_t...$c" >&4
8000         $cat >try.c <<EOCP
8001 #include <sys/types.h>
8002 #include <unistd.h>
8003 offset_t foo() { offset_t x; x = 7; return x; }'
8004 EOCP
8005         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8006                 val="$define"
8007                 echo " Yup, it does." >&4
8008         else
8009                 val="$undef"
8010                 echo " Nope, it doesn't." >&4
8011         fi
8012         $rm -f try.*
8013         set d_offset_t
8014         eval $setvar
8015
8016         : check for ino64_t
8017         echo " "
8018         echo $n "Checking to see if your system supports ino64_t...$c" >&4
8019         val="$undef"
8020         case "$i_sysstat" in
8021         "$define" )
8022                 $cat >try.c <<EOCP
8023 #include <sys/types.h>
8024 #include <sys/stat.h>
8025 ino64_t foo() { ino64_t x; x = 7; return x; }'
8026 EOCP
8027                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8028                         val="$define"
8029                 fi
8030                 $rm -f try.*
8031                 ;;
8032         esac
8033         if $test "X$val" = X"$define"; then
8034                 echo " Yup, it does." >&4
8035         else
8036                 echo " Nope, it doesn't." >&4
8037         fi
8038         set d_ino64_t
8039         eval $setvar
8040
8041         : check for struct flock64
8042         echo " "
8043         echo "Checking to see if your system supports struct flock64..." >&4
8044         if $h_fcntl; then
8045                 set d_flock64_s flock64 l_len define fcntl.h
8046                 eval $hasfield
8047         else
8048                 val="$undef"
8049                 set d_flock64_s
8050                 eval $setvar
8051         fi
8052         case "$d_flock64_s" in
8053         "$define")      echo "Yup, it does." >&4
8054                         ;;
8055         *)              echo "Nope, it doesn't." >&4
8056                         ;;
8057         esac
8058
8059         : check for struct dirent64
8060         echo " "
8061         echo "Checking to see if your system supports struct dirent64..." >&4
8062         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
8063         eval $hasfield
8064         case "$d_dirent64_s" in
8065         "$define")      echo "Yup, it does." >&4
8066                         ;;
8067         *)              echo "Nope, it doesn't." >&4
8068                         ;;
8069         esac
8070
8071 else
8072         val="$undef"
8073         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
8074         do
8075                 set $xxx
8076                 eval $setvar
8077         done
8078 fi
8079
8080 : see if dlerror exists
8081 xxx_runnm="$runnm"
8082 runnm=false
8083 set dlerror d_dlerror
8084 eval $inlibc
8085 runnm="$xxx_runnm"
8086
8087 : see if dlfcn is available
8088 set dlfcn.h i_dlfcn
8089 eval $inhdr
8090
8091 case "$usedl" in
8092 $define|y|true)
8093         $cat << EOM
8094
8095 On a few systems, the dynamically loaded modules that perl generates and uses
8096 will need a different extension than shared libs. The default will probably
8097 be appropriate.
8098
8099 EOM
8100         case "$dlext" in
8101         '')     dflt="$so" ;;
8102         *)      dflt="$dlext" ;;
8103         esac
8104         rp='What is the extension of dynamically loaded modules'
8105         . ./myread
8106         dlext="$ans"
8107         ;;
8108 *)
8109         dlext="none"
8110         ;;
8111 esac
8112
8113 : Check if dlsym need a leading underscore
8114 echo " "
8115 val="$undef"
8116
8117 case "$dlsrc" in
8118 dl_dlopen.xs)
8119         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8120         $cat >dyna.c <<'EOM'
8121 fred () { }
8122 EOM
8123
8124 $cat >fred.c<<EOM
8125
8126 #include <stdio.h>
8127 #$i_dlfcn I_DLFCN
8128 #ifdef I_DLFCN
8129 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8130 #else
8131 #include <sys/types.h>
8132 #include <nlist.h>
8133 #include <link.h>
8134 #endif
8135
8136 extern int fred() ;
8137
8138 int main()
8139 {
8140     void * handle ;
8141     void * symbol ;
8142 #ifndef RTLD_LAZY
8143     int mode = 1 ;
8144 #else
8145     int mode = RTLD_LAZY ;
8146 #endif
8147     handle = dlopen("./dyna.$dlext", mode) ;
8148     if (handle == NULL) {
8149         printf ("1\n") ;
8150         fflush (stdout) ;
8151         exit(0);
8152     }
8153     symbol = dlsym(handle, "fred") ;
8154     if (symbol == NULL) {
8155         /* try putting a leading underscore */
8156         symbol = dlsym(handle, "_fred") ;
8157         if (symbol == NULL) {
8158             printf ("2\n") ;
8159             fflush (stdout) ;
8160             exit(0);
8161         }
8162         printf ("3\n") ;
8163     }
8164     else
8165         printf ("4\n") ;
8166     fflush (stdout) ;
8167     exit(0);
8168 }
8169 EOM
8170         : Call the object file tmp-dyna.o in case dlext=o.
8171         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8172                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8173                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8174                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8175                 xxx=`./fred`
8176                 case $xxx in
8177                 1)      echo "Test program failed using dlopen." >&4
8178                         echo "Perhaps you should not use dynamic loading." >&4;;
8179                 2)      echo "Test program failed using dlsym." >&4
8180                         echo "Perhaps you should not use dynamic loading." >&4;;
8181                 3)      echo "dlsym needs a leading underscore" >&4
8182                         val="$define" ;;
8183                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8184                 esac
8185         else
8186                 echo "I can't compile and run the test program." >&4
8187         fi
8188         ;;
8189 esac
8190                 
8191 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8192
8193 set d_dlsymun
8194 eval $setvar
8195
8196 hasproto='varname=$1; func=$2; shift; shift;
8197 while $test $# -ge 2; do
8198         case "$1" in
8199         $define) echo "#include <$2>";;
8200         esac ;
8201     shift 2;
8202 done > try.c;
8203 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8204 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8205         echo "$func() prototype found.";
8206         val="$define";
8207 else
8208         echo "$func() prototype NOT found.";
8209         val="$undef";
8210 fi;
8211 set $varname;
8212 eval $setvar;
8213 $rm -f try.c tryout.c'
8214
8215 : see if prototype for drand48 is available
8216 echo " "
8217 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8218 eval $hasproto
8219
8220 : see if dup2 exists
8221 set dup2 d_dup2
8222 eval $inlibc
8223
8224 : see if eaccess exists
8225 set eaccess d_eaccess
8226 eval $inlibc
8227
8228 : see if endgrent exists
8229 set endgrent d_endgrent
8230 eval $inlibc
8231
8232 : see if endhostent exists
8233 set endhostent d_endhent
8234 eval $inlibc
8235
8236 : see if endnetent exists
8237 set endnetent d_endnent
8238 eval $inlibc
8239
8240 : see if endprotoent exists
8241 set endprotoent d_endpent
8242 eval $inlibc
8243
8244 : see if endpwent exists
8245 set endpwent d_endpwent
8246 eval $inlibc
8247
8248 : see if endservent exists
8249 set endservent d_endsent
8250 eval $inlibc
8251
8252 : see if endspent exists
8253 set endspent d_endspent
8254 eval $inlibc
8255
8256 : Locate the flags for 'open()'
8257 echo " "
8258 $cat >open3.c <<'EOCP'
8259 #include <sys/types.h>
8260 #ifdef I_FCNTL
8261 #include <fcntl.h>
8262 #endif
8263 #ifdef I_SYS_FILE
8264 #include <sys/file.h>
8265 #endif
8266 int main() {
8267         if(O_RDONLY);
8268 #ifdef O_TRUNC
8269         exit(0);
8270 #else
8271         exit(1);
8272 #endif
8273 }
8274 EOCP
8275 : check sys/file.h first to get FREAD on Sun
8276 if $test `./findhdr sys/file.h` && \
8277                 set open3 -DI_SYS_FILE && eval $compile; then
8278         h_sysfile=true;
8279         echo "<sys/file.h> defines the O_* constants..." >&4
8280         if ./open3; then
8281                 echo "and you have the 3 argument form of open()." >&4
8282                 val="$define"
8283         else
8284                 echo "but not the 3 argument form of open().  Oh, well." >&4
8285                 val="$undef"
8286         fi
8287 elif $test `./findhdr fcntl.h` && \
8288                 set open3 -DI_FCNTL && eval $compile; then
8289         h_fcntl=true;
8290         echo "<fcntl.h> defines the O_* constants..." >&4
8291         if ./open3; then
8292                 echo "and you have the 3 argument form of open()." >&4
8293                 val="$define"
8294         else
8295                 echo "but not the 3 argument form of open().  Oh, well." >&4
8296                 val="$undef"
8297         fi
8298 else
8299         val="$undef"
8300         echo "I can't find the O_* constant definitions!  You got problems." >&4
8301 fi
8302 set d_open3
8303 eval $setvar
8304 $rm -f open3*
8305
8306 : check for non-blocking I/O stuff
8307 case "$h_sysfile" in
8308 true) echo "#include <sys/file.h>" > head.c;;
8309 *)
8310         case "$h_fcntl" in
8311         true) echo "#include <fcntl.h>" > head.c;;
8312         *) echo "#include <sys/fcntl.h>" > head.c;;
8313         esac
8314         ;;
8315 esac
8316 echo " "
8317 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8318 case "$o_nonblock" in
8319 '')
8320         $cat head.c > try.c
8321         $cat >>try.c <<'EOCP'
8322 int main() {
8323 #ifdef O_NONBLOCK
8324         printf("O_NONBLOCK\n");
8325         exit(0);
8326 #endif
8327 #ifdef O_NDELAY
8328         printf("O_NDELAY\n");
8329         exit(0);
8330 #endif
8331 #ifdef FNDELAY
8332         printf("FNDELAY\n");
8333         exit(0);
8334 #endif
8335         exit(0);
8336 }
8337 EOCP
8338         set try
8339         if eval $compile_ok; then
8340                 o_nonblock=`./try`
8341                 case "$o_nonblock" in
8342                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8343                 *) echo "Seems like we can use $o_nonblock.";;
8344                 esac
8345         else
8346                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8347         fi
8348         ;;
8349 *) echo "Using $hint value $o_nonblock.";;
8350 esac
8351 $rm -f try try.* .out core
8352
8353 echo " "
8354 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8355 case "$eagain" in
8356 '')
8357         $cat head.c > try.c
8358         $cat >>try.c <<EOCP
8359 #include <errno.h>
8360 #include <sys/types.h>
8361 #include <signal.h>
8362 #define MY_O_NONBLOCK $o_nonblock
8363 #ifndef errno  /* XXX need better Configure test */
8364 extern int errno;
8365 #endif
8366 $signal_t blech(x) int x; { exit(3); }
8367 EOCP
8368         $cat >> try.c <<'EOCP'
8369 int main()
8370 {
8371         int pd[2];
8372         int pu[2];
8373         char buf[1];
8374         char string[100];
8375
8376         pipe(pd);       /* Down: child -> parent */
8377         pipe(pu);       /* Up: parent -> child */
8378         if (0 != fork()) {
8379                 int ret;
8380                 close(pd[1]);   /* Parent reads from pd[0] */
8381                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8382                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8383                         exit(1);
8384                 signal(SIGALRM, blech);
8385                 alarm(5);
8386                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8387                         exit(2);
8388                 sprintf(string, "%d\n", ret);
8389                 write(2, string, strlen(string));
8390                 alarm(0);
8391 #ifdef EAGAIN
8392                 if (errno == EAGAIN) {
8393                         printf("EAGAIN\n");
8394                         goto ok;
8395                 }
8396 #endif
8397 #ifdef EWOULDBLOCK
8398                 if (errno == EWOULDBLOCK)
8399                         printf("EWOULDBLOCK\n");
8400 #endif
8401         ok:
8402                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8403                 sleep(2);                               /* Give it time to close our pipe */
8404                 alarm(5);
8405                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8406                 alarm(0);
8407                 sprintf(string, "%d\n", ret);
8408                 write(3, string, strlen(string));
8409                 exit(0);
8410         }
8411
8412         close(pd[0]);                   /* We write to pd[1] */
8413         close(pu[1]);                   /* We read from pu[0] */
8414         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8415         close(pd[1]);                   /* Pipe pd is now fully closed! */
8416         exit(0);                                /* Bye bye, thank you for playing! */
8417 }
8418 EOCP
8419         set try
8420         if eval $compile_ok; then
8421                 echo "$startsh" >mtry
8422                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8423                 chmod +x mtry
8424                 ./mtry >/dev/null 2>&1
8425                 case $? in
8426                 0) eagain=`$cat try.out`;;
8427                 1) echo "Could not perform non-blocking setting!";;
8428                 2) echo "I did a successful read() for something that was not there!";;
8429                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8430                 *) echo "Something terribly wrong happened during testing.";;
8431                 esac
8432                 rd_nodata=`$cat try.ret`
8433                 echo "A read() system call with no data present returns $rd_nodata."
8434                 case "$rd_nodata" in
8435                 0|-1) ;;
8436                 *)
8437                         echo "(That's peculiar, fixing that to be -1.)"
8438                         rd_nodata=-1
8439                         ;;
8440                 esac
8441                 case "$eagain" in
8442                 '')
8443                         echo "Forcing errno EAGAIN on read() with no data available."
8444                         eagain=EAGAIN
8445                         ;;
8446                 *)
8447                         echo "Your read() sets errno to $eagain when no data is available."
8448                         ;;
8449                 esac
8450                 status=`$cat try.err`
8451                 case "$status" in
8452                 0) echo "And it correctly returns 0 to signal EOF.";;
8453                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8454                 *) echo "However, your read() returns '$status' on EOF??";;
8455                 esac
8456                 val="$define"
8457                 if test "$status" = "$rd_nodata"; then
8458                         echo "WARNING: you can't distinguish between EOF and no data!"
8459                         val="$undef"
8460                 fi
8461         else
8462                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8463                 eagain=EAGAIN
8464         fi
8465         set d_eofnblk
8466         eval $setvar
8467         ;;
8468 *)
8469         echo "Using $hint value $eagain."
8470         echo "Your read() returns $rd_nodata when no data is present."
8471         case "$d_eofnblk" in
8472         "$define") echo "And you can see EOF because read() returns 0.";;
8473         "$undef") echo "But you can't see EOF status from read() returned value.";;
8474         *)
8475                 echo "(Assuming you can't see EOF status from read anyway.)"
8476                 d_eofnblk=$undef
8477                 ;;
8478         esac
8479         ;;
8480 esac
8481 $rm -f try try.* .out core head.c mtry
8482
8483 : see if fchmod exists
8484 set fchmod d_fchmod
8485 eval $inlibc
8486
8487 : see if fchown exists
8488 set fchown d_fchown
8489 eval $inlibc
8490
8491 : see if this is an fcntl system
8492 set fcntl d_fcntl
8493 eval $inlibc
8494
8495 : see if sys/select.h has to be included
8496 set sys/select.h i_sysselct
8497 eval $inhdr
8498
8499 : see if we should include time.h, sys/time.h, or both
8500 echo " "
8501 if test "X$timeincl" = X; then
8502         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8503         $echo $n "I'm now running the test program...$c"
8504         $cat >try.c <<'EOCP'
8505 #include <sys/types.h>
8506 #ifdef I_TIME
8507 #include <time.h>
8508 #endif
8509 #ifdef I_SYSTIME
8510 #ifdef SYSTIMEKERNEL
8511 #define KERNEL
8512 #endif
8513 #include <sys/time.h>
8514 #endif
8515 #ifdef I_SYSSELECT
8516 #include <sys/select.h>
8517 #endif
8518 int main()
8519 {
8520         struct tm foo;
8521 #ifdef S_TIMEVAL
8522         struct timeval bar;
8523 #endif
8524 #ifdef S_TIMEZONE
8525         struct timezone tzp;
8526 #endif
8527         if (foo.tm_sec == foo.tm_sec)
8528                 exit(0);
8529 #ifdef S_TIMEVAL
8530         if (bar.tv_sec == bar.tv_sec)
8531                 exit(0);
8532 #endif
8533         exit(1);
8534 }
8535 EOCP
8536         flags=''
8537         for s_timezone in '-DS_TIMEZONE' ''; do
8538         sysselect=''
8539         for s_timeval in '-DS_TIMEVAL' ''; do
8540         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8541         for i_time in '' '-DI_TIME'; do
8542         for i_systime in '-DI_SYSTIME' ''; do
8543                 case "$flags" in
8544                 '') $echo $n ".$c"
8545                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8546                         if eval $compile; then
8547                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8548                                 shift
8549                                 flags="$*"
8550                                 echo " "
8551                                 $echo $n "Succeeded with $flags$c"
8552                         fi
8553                         ;;
8554                 esac
8555         done
8556         done
8557         done
8558         done
8559         done
8560         timeincl=''
8561         echo " "
8562         case "$flags" in
8563         *SYSTIMEKERNEL*) i_systimek="$define"
8564                 timeincl=`./findhdr sys/time.h`
8565                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8566         *) i_systimek="$undef";;
8567         esac
8568         case "$flags" in
8569         *I_TIME*) i_time="$define"
8570                 timeincl=`./findhdr time.h`" $timeincl"
8571                 echo "We'll include <time.h>." >&4;;
8572         *) i_time="$undef";;
8573         esac
8574         case "$flags" in
8575         *I_SYSTIME*) i_systime="$define"
8576                 timeincl=`./findhdr sys/time.h`" $timeincl"
8577                 echo "We'll include <sys/time.h>." >&4;;
8578         *) i_systime="$undef";;
8579         esac
8580         $rm -f try.c try
8581 fi
8582
8583 : check for fd_set items
8584 $cat <<EOM
8585
8586 Checking to see how well your C compiler handles fd_set and friends ...
8587 EOM
8588 $cat >fd_set.c <<EOCP
8589 #$i_systime I_SYS_TIME
8590 #$i_sysselct I_SYS_SELECT
8591 #$d_socket HAS_SOCKET
8592 #include <sys/types.h>
8593 #ifdef HAS_SOCKET
8594 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8595 #endif
8596 #ifdef I_SYS_TIME
8597 #include <sys/time.h>
8598 #endif
8599 #ifdef I_SYS_SELECT
8600 #include <sys/select.h>
8601 #endif
8602 int main() {
8603         fd_set fds;
8604
8605 #ifdef TRYBITS
8606         if(fds.fds_bits);
8607 #endif
8608
8609 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8610         exit(0);
8611 #else
8612         exit(1);
8613 #endif
8614 }
8615 EOCP
8616 set fd_set -DTRYBITS
8617 if eval $compile; then
8618         d_fds_bits="$define"
8619         d_fd_set="$define"
8620         echo "Well, your system knows about the normal fd_set typedef..." >&4
8621         if ./fd_set; then
8622                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8623                 d_fd_macros="$define"
8624         else
8625                 $cat >&4 <<'EOM'
8626 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8627 EOM
8628                 d_fd_macros="$undef"
8629         fi
8630 else
8631         $cat <<'EOM'
8632 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8633 EOM
8634         set fd_set
8635         if eval $compile; then
8636                 d_fds_bits="$undef"
8637                 d_fd_set="$define"
8638                 echo "Well, your system has some sort of fd_set available..." >&4
8639                 if ./fd_set; then
8640                         echo "and you have the normal fd_set macros." >&4
8641                         d_fd_macros="$define"
8642                 else
8643                         $cat <<'EOM'
8644 but not the normal fd_set macros!  Gross!  More work for me...
8645 EOM
8646                         d_fd_macros="$undef"
8647                 fi
8648         else
8649         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8650                 d_fd_set="$undef"
8651                 d_fds_bits="$undef"
8652                 d_fd_macros="$undef"
8653         fi
8654 fi
8655 $rm -f fd_set*
8656
8657 : see if fgetpos exists
8658 set fgetpos d_fgetpos
8659 eval $inlibc
8660
8661
8662 if $test X"$use64bits" = X"$define"; then
8663         : see if fgetpos64 exists
8664         set fgetpos64 d_fgetpos64
8665         eval $inlibc
8666
8667         : see if fopen64 exists
8668         set freopen64 d_fopen64
8669         eval $inlibc
8670
8671         : see if freopen64 exists
8672         set freopen64 d_freopen64
8673         eval $inlibc
8674
8675         : see if fseek64 exists
8676         set fseek64 d_fseek64
8677         eval $inlibc
8678
8679         : see if fseeko64 exists
8680         set fseeko64 d_fseeko64
8681         eval $inlibc
8682
8683         : see if fsetpos64 exists
8684         set fsetpos64 d_fsetpos64
8685         eval $inlibc
8686
8687         : see if ftell64 exists
8688         set ftell64 d_ftell64
8689         eval $inlibc
8690
8691         : see if ftello64 exists
8692         set ftello64 d_ftello64
8693         eval $inlibc
8694
8695         : see if tmpfile64 exists
8696         set tmpfile64 d_tmpfile64
8697         eval $inlibc
8698 else
8699         val="$undef"
8700         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8701         do
8702                 set $xxx
8703                 eval $setvar
8704         done
8705 fi
8706
8707 : see if flock exists
8708 set flock d_flock
8709 eval $inlibc
8710
8711 : see if fork exists
8712 set fork d_fork
8713 eval $inlibc
8714
8715 : see if pathconf exists
8716 set pathconf d_pathconf
8717 eval $inlibc
8718
8719 : see if fpathconf exists
8720 set fpathconf d_fpathconf
8721 eval $inlibc
8722
8723 : see if fseeko exists
8724 set fseeko d_fseeko
8725 eval $inlibc
8726
8727 : see if fsetpos exists
8728 set fsetpos d_fsetpos
8729 eval $inlibc
8730
8731 : see if this is a sys/param system
8732 set sys/param.h i_sysparam
8733 eval $inhdr
8734
8735 : see if this is a sys/mount.h system
8736 set sys/mount.h i_sysmount
8737 eval $inhdr
8738
8739
8740 : see if statfs exists
8741 set statfs d_statfs
8742 eval $inlibc
8743
8744 : see if fstatfs exists
8745 set fstatfs d_fstatfs
8746 eval $inlibc
8747
8748 : see if statfs knows about mount flags
8749 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8750 eval $hasfield
8751
8752
8753 : see if statvfs exists
8754 set statvfs d_statvfs
8755 eval $inlibc
8756
8757 : see if fstatvfs exists
8758 set fstatvfs d_fstatvfs
8759 eval $inlibc
8760
8761
8762 : see if ftello exists
8763 set ftello d_ftello
8764 eval $inlibc
8765
8766 : see if getgrent exists
8767 set getgrent d_getgrent
8768 eval $inlibc
8769
8770 : see if gethostbyaddr exists
8771 set gethostbyaddr d_gethbyaddr
8772 eval $inlibc
8773
8774 : see if gethostbyname exists
8775 set gethostbyname d_gethbyname
8776 eval $inlibc
8777
8778 : see if gethostent exists
8779 set gethostent d_gethent
8780 eval $inlibc
8781
8782 : see how we will look up host name
8783 echo " "
8784 call=''
8785 if set gethostname val -f d_gethname; eval $csym; $val; then
8786         echo 'gethostname() found.' >&4
8787         d_gethname="$define"
8788         call=gethostname
8789 fi
8790 if set uname val -f d_uname; eval $csym; $val; then
8791         if ./xenix; then
8792                 $cat <<'EOM'
8793 uname() was found, but you're running xenix, and older versions of xenix
8794 have a broken uname(). If you don't really know whether your xenix is old
8795 enough to have a broken system call, use the default answer.
8796
8797 EOM
8798                 dflt=y
8799                 case "$d_uname" in
8800                 "$define") dflt=n;;
8801                 esac
8802                 rp='Is your uname() broken?'
8803                 . ./myread
8804                 case "$ans" in
8805                 n*) d_uname="$define"; call=uname;;
8806                 esac
8807         else
8808                 echo 'uname() found.' >&4
8809                 d_uname="$define"
8810                 case "$call" in
8811                 '') call=uname ;;
8812                 esac
8813         fi
8814 fi
8815 case "$d_gethname" in
8816 '') d_gethname="$undef";;
8817 esac
8818 case "$d_uname" in
8819 '') d_uname="$undef";;
8820 esac
8821 case "$d_uname$d_gethname" in
8822 *define*)
8823         dflt=n
8824         cat <<EOM
8825  
8826 Every now and then someone has a $call() that lies about the hostname
8827 but can't be fixed for political or economic reasons.  If you wish, I can
8828 pretend $call() isn't there and maybe compute hostname at run-time
8829 thanks to the '$phostname' command.
8830
8831 EOM
8832         rp="Shall I ignore $call() from now on?"
8833         . ./myread
8834         case "$ans" in
8835         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8836         esac;;
8837 esac
8838 case "$phostname" in
8839 '') aphostname='';;
8840 *) case "$aphostname" in
8841         /*) ;;
8842         *) set X $phostname
8843                 shift
8844                 file=$1
8845                 shift
8846                 file=`./loc $file $file $pth`
8847                 aphostname=`echo $file $*`
8848                 ;;
8849         esac
8850         ;;
8851 esac
8852 case "$d_uname$d_gethname" in
8853 *define*) ;;
8854 *)
8855         case "$phostname" in
8856         '')
8857                 echo "There will be no way for $package to get your hostname." >&4;;
8858         *)
8859         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8860                 ;;
8861         esac;;
8862 esac
8863 case "$d_phostname" in
8864 '') d_phostname="$undef";;
8865 esac
8866
8867 : see if this is a netdb.h system
8868 set netdb.h i_netdb
8869 eval $inhdr
8870
8871 : see if prototypes for various gethostxxx netdb.h functions are available
8872 echo " "
8873 set d_gethostprotos gethostent $i_netdb netdb.h
8874 eval $hasproto
8875
8876 : see if getlogin exists
8877 set getlogin d_getlogin
8878 eval $inlibc
8879
8880 : see if getmntent exists
8881 set getmntent d_getmntent
8882 eval $inlibc
8883
8884 : see if getnetbyaddr exists
8885 set getnetbyaddr d_getnbyaddr
8886 eval $inlibc
8887
8888 : see if getnetbyname exists
8889 set getnetbyname d_getnbyname
8890 eval $inlibc
8891
8892 : see if getnetent exists
8893 set getnetent d_getnent
8894 eval $inlibc
8895
8896 : see if prototypes for various getnetxxx netdb.h functions are available
8897 echo " "
8898 set d_getnetprotos getnetent $i_netdb netdb.h
8899 eval $hasproto
8900
8901
8902 : see if getprotobyname exists
8903 set getprotobyname d_getpbyname
8904 eval $inlibc
8905
8906 : see if getprotobynumber exists
8907 set getprotobynumber d_getpbynumber
8908 eval $inlibc
8909
8910 : see if getprotoent exists
8911 set getprotoent d_getpent
8912 eval $inlibc
8913
8914 : see if getpgid exists
8915 set getpgid d_getpgid
8916 eval $inlibc
8917
8918 : see if getpgrp2 exists
8919 set getpgrp2 d_getpgrp2
8920 eval $inlibc
8921
8922 : see if getppid exists
8923 set getppid d_getppid
8924 eval $inlibc
8925
8926 : see if getpriority exists
8927 set getpriority d_getprior
8928 eval $inlibc
8929
8930 : see if prototypes for various getprotoxxx netdb.h functions are available
8931 echo " "
8932 set d_getprotoprotos getprotoent $i_netdb netdb.h
8933 eval $hasproto
8934
8935 : see if getpwent exists
8936 set getpwent d_getpwent
8937 eval $inlibc
8938
8939
8940 : see if getservbyname exists
8941 set getservbyname d_getsbyname
8942 eval $inlibc
8943
8944 : see if getservbyport exists
8945 set getservbyport d_getsbyport
8946 eval $inlibc
8947
8948 : see if getservent exists
8949 set getservent d_getsent
8950 eval $inlibc
8951
8952 : see if prototypes for various getservxxx netdb.h functions are available
8953 echo " "
8954 set d_getservprotos getservent $i_netdb netdb.h
8955 eval $hasproto
8956
8957 : see if getspent exists
8958 set getspent d_getspent
8959 eval $inlibc
8960
8961 : see if getspnam exists
8962 set getspnam d_getspnam
8963 eval $inlibc
8964
8965 : see if gettimeofday or ftime exists
8966 set gettimeofday d_gettimeod
8967 eval $inlibc
8968 case "$d_gettimeod" in
8969 "$undef")
8970         set ftime d_ftime 
8971         eval $inlibc
8972         ;;
8973 *)
8974         val="$undef"; set d_ftime; eval $setvar
8975         ;;
8976 esac
8977 case "$d_gettimeod$d_ftime" in
8978 "$undef$undef")
8979         echo " "
8980         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8981         ;;
8982 esac
8983
8984 : see if this is an grp system
8985 set grp.h i_grp
8986 eval $inhdr
8987
8988 case "$i_grp" in
8989 $define)
8990         xxx=`./findhdr grp.h`
8991         $cppstdin $cppflags $cppminus < $xxx >$$.h
8992
8993         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8994                 val="$define"
8995         else
8996                 val="$undef"
8997         fi
8998         set d_grpasswd
8999         eval $setvar
9000
9001         $rm -f $$.h
9002         ;;
9003 *)
9004         val="$undef";
9005         set d_grpasswd; eval $setvar
9006         ;;
9007 esac
9008
9009 : see if hasmntopt exists
9010 set hasmntopt d_hasmntopt
9011 eval $inlibc
9012
9013 : see if this is a netinet/in.h or sys/in.h system
9014 set netinet/in.h i_niin sys/in.h i_sysin
9015 eval $inhdr
9016
9017 : see if arpa/inet.h has to be included
9018 set arpa/inet.h i_arpainet
9019 eval $inhdr
9020
9021 : see if htonl --and friends-- exists
9022 val=''
9023 set htonl val
9024 eval $inlibc
9025
9026 : Maybe they are macros.
9027 case "$val" in
9028 $undef)
9029         $cat >htonl.c <<EOM
9030 #include <stdio.h>
9031 #include <sys/types.h>
9032 #$i_niin I_NETINET_IN
9033 #$i_sysin I_SYS_IN
9034 #$i_arpainet I_ARPA_INET
9035 #ifdef I_NETINET_IN
9036 #include <netinet/in.h>
9037 #endif
9038 #ifdef I_SYS_IN
9039 #include <sys/in.h>
9040 #endif
9041 #ifdef I_ARPA_INET
9042 #include <arpa/inet.h>
9043 #endif
9044 #ifdef htonl
9045 printf("Defined as a macro.");
9046 #endif
9047 EOM
9048         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9049         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9050                 val="$define"
9051                 echo "But it seems to be defined as a macro." >&4
9052         fi
9053         $rm -f htonl.?
9054         ;;
9055 esac
9056 set d_htonl
9057 eval $setvar
9058
9059 : see which of string.h or strings.h is needed
9060 echo " "
9061 strings=`./findhdr string.h`
9062 if $test "$strings" && $test -r "$strings"; then
9063         echo "Using <string.h> instead of <strings.h>." >&4
9064         val="$define"
9065 else
9066         val="$undef"
9067         strings=`./findhdr strings.h`
9068         if $test "$strings" && $test -r "$strings"; then
9069                 echo "Using <strings.h> instead of <string.h>." >&4
9070         else
9071                 echo "No string header found -- You'll surely have problems." >&4
9072         fi
9073 fi
9074 set i_string
9075 eval $setvar
9076 case "$i_string" in
9077 "$undef") strings=`./findhdr strings.h`;;
9078 *)        strings=`./findhdr string.h`;;
9079 esac
9080
9081 : index or strchr
9082 echo " "
9083 if set index val -f; eval $csym; $val; then
9084         if set strchr val -f d_strchr; eval $csym; $val; then
9085                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9086                         val="$define"
9087                         vali="$undef"
9088                         echo "strchr() found." >&4
9089                 else
9090                         val="$undef"
9091                         vali="$define"
9092                         echo "index() found." >&4
9093                 fi
9094         else
9095                 val="$undef"
9096                 vali="$define"
9097                 echo "index() found." >&4
9098         fi
9099 else
9100         if set strchr val -f d_strchr; eval $csym; $val; then
9101                 val="$define"
9102                 vali="$undef"
9103                 echo "strchr() found." >&4
9104         else
9105                 echo "No index() or strchr() found!" >&4
9106                 val="$undef"
9107                 vali="$undef"
9108         fi
9109 fi
9110 set d_strchr; eval $setvar
9111 val="$vali"
9112 set d_index; eval $setvar
9113
9114 : check whether inet_aton exists
9115 set inet_aton d_inetaton
9116 eval $inlibc
9117
9118 : Look for isascii
9119 echo " "
9120 $cat >isascii.c <<'EOCP'
9121 #include <stdio.h>
9122 #include <ctype.h>
9123 int main() {
9124         int c = 'A';
9125         if (isascii(c))
9126                 exit(0);
9127         else
9128                 exit(1);
9129 }
9130 EOCP
9131 set isascii
9132 if eval $compile; then
9133         echo "isascii() found." >&4
9134         val="$define"
9135 else
9136         echo "isascii() NOT found." >&4
9137         val="$undef"
9138 fi
9139 set d_isascii
9140 eval $setvar
9141 $rm -f isascii*
9142
9143 : see if killpg exists
9144 set killpg d_killpg
9145 eval $inlibc
9146
9147 : see if lchown exists
9148 echo " "
9149 $cat > try.c <<'EOCP'
9150 /* System header to define __stub macros and hopefully few prototypes,
9151     which can conflict with char lchown(); below.  */
9152 #include <assert.h>
9153 /* Override any gcc2 internal prototype to avoid an error.  */
9154 /* We use char because int might match the return type of a gcc2
9155    builtin and then its argument prototype would still apply.  */
9156 char lchown();
9157 int main() {
9158     /*  The GNU C library defines this for functions which it implements
9159         to always fail with ENOSYS.  Some functions are actually named
9160         something starting with __ and the normal name is an alias.  */
9161 #if defined (__stub_lchown) || defined (__stub___lchown)
9162 choke me
9163 #else
9164 lchown();
9165 #endif
9166 ; return 0; }
9167 EOCP
9168 set try
9169 if eval $compile; then
9170     $echo "lchown() found." >&4
9171     val="$define"
9172 else
9173     $echo "lchown() NOT found." >&4
9174     val="$undef"
9175 fi
9176 set d_lchown
9177 eval $setvar
9178
9179 : see if link exists
9180 set link d_link
9181 eval $inlibc
9182
9183 : see if localeconv exists
9184 set localeconv d_locconv
9185 eval $inlibc
9186
9187 : see if lockf exists
9188 set lockf d_lockf
9189 eval $inlibc
9190
9191 : see if lstat exists
9192 set lstat d_lstat
9193 eval $inlibc
9194
9195 : see if madvise exists
9196 set madvise d_madvise
9197 eval $inlibc
9198
9199 : see if mblen exists
9200 set mblen d_mblen
9201 eval $inlibc
9202
9203 : see if mbstowcs exists
9204 set mbstowcs d_mbstowcs
9205 eval $inlibc
9206
9207 : see if mbtowc exists
9208 set mbtowc d_mbtowc
9209 eval $inlibc
9210
9211 : see if memchr exists
9212 set memchr d_memchr
9213 eval $inlibc
9214
9215 : see if memcmp exists
9216 set memcmp d_memcmp
9217 eval $inlibc
9218
9219 : see if memcpy exists
9220 set memcpy d_memcpy
9221 eval $inlibc
9222
9223 : see if memmove exists
9224 set memmove d_memmove
9225 eval $inlibc
9226
9227 : see if memset exists
9228 set memset d_memset
9229 eval $inlibc
9230
9231 : see if mkdir exists
9232 set mkdir d_mkdir
9233 eval $inlibc
9234
9235 : see if mkfifo exists
9236 set mkfifo d_mkfifo
9237 eval $inlibc
9238
9239 : see if mktime exists
9240 set mktime d_mktime
9241 eval $inlibc
9242
9243 : see if this is a sys/mman.h system
9244 set sys/mman.h i_sysmman
9245 eval $inhdr
9246
9247 : see if mmap exists
9248 set mmap d_mmap
9249 eval $inlibc
9250 : see what shmat returns
9251 : default to something harmless
9252 mmaptype='void *'
9253 case "$i_sysmman$d_mmap" in
9254 "$define$define")
9255         $cat >mmap.c <<'END'
9256 #include <sys/mman.h>
9257 void *mmap();
9258 END
9259         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9260                 mmaptype='void *'
9261         else
9262                 mmaptype='caddr_t'
9263         fi
9264         echo "and it returns ($mmaptype)." >&4
9265         ;;
9266 esac
9267
9268
9269
9270 : see if mprotect exists
9271 set mprotect d_mprotect
9272 eval $inlibc
9273
9274 : see if msgctl exists
9275 set msgctl d_msgctl
9276 eval $inlibc
9277
9278 : see if msgget exists
9279 set msgget d_msgget
9280 eval $inlibc
9281
9282 : see if msgsnd exists
9283 set msgsnd d_msgsnd
9284 eval $inlibc
9285
9286 : see if msgrcv exists
9287 set msgrcv d_msgrcv
9288 eval $inlibc
9289
9290 : see how much of the 'msg*(2)' library is present.
9291 h_msg=true
9292 echo " "
9293 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9294 *"$undef"*) h_msg=false;;
9295 esac
9296 case "$osname" in
9297 freebsd)
9298     case "`ipcs 2>&1`" in
9299     "SVID messages"*"not configured"*)
9300         echo "Your $osname does not have the msg*(2) configured." >&4
9301         h_msg=false
9302         val="$undef"
9303         set msgctl d_msgctl
9304         eval $setvar
9305         set msgget d_msgget
9306         eval $setvar
9307         set msgsnd d_msgsnd
9308         eval $setvar
9309         set msgrcv d_msgrcv
9310         eval $setvar
9311         ;;
9312     esac
9313     ;;
9314 esac
9315 : we could also check for sys/ipc.h ...
9316 if $h_msg && $test `./findhdr sys/msg.h`; then
9317         echo "You have the full msg*(2) library." >&4
9318         val="$define"
9319 else
9320         echo "You don't have the full msg*(2) library." >&4
9321         val="$undef"
9322 fi
9323 set d_msg
9324 eval $setvar
9325
9326 : see if msync exists
9327 set msync d_msync
9328 eval $inlibc
9329
9330 : see if munmap exists
9331 set munmap d_munmap
9332 eval $inlibc
9333
9334 : see if nice exists
9335 set nice d_nice
9336 eval $inlibc
9337
9338 : see if POSIX threads are available
9339 if test "X$usethreads" = "X$define"; then
9340         set pthread.h i_pthread
9341         eval $inhdr
9342 else
9343         i_pthread="$undef"
9344 fi
9345
9346
9347
9348 : how to create joinable pthreads
9349 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9350         echo " "
9351         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9352         $cat >try.c <<'EOCP'
9353 #include <pthread.h>
9354 int main() {
9355     int detachstate = JOINABLE;
9356 }
9357 EOCP
9358         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9359         if eval $compile; then
9360                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9361                 val="$undef" # Yes, undef.
9362                 set d_old_pthread_create_joinable
9363                 eval $setvar
9364                 val=""
9365                 set old_pthread_create_joinable
9366                 eval $setvar
9367         else
9368                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9369                 if eval $compile; then
9370                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9371                         val="$define"
9372                         set d_old_pthread_create_joinable
9373                         eval $setvar
9374                         val=PTHREAD_CREATE_UNDETACHED
9375                         set old_pthread_create_joinable
9376                         eval $setvar
9377                 else            
9378                         set try -DJOINABLE=__UNDETACHED
9379                         if eval $compile; then
9380                                 echo "You seem to use __UNDETACHED." >&4
9381                                 val="$define"
9382                                 set d_old_pthread_create_joinable
9383                                 eval $setvar
9384                                 val=__UNDETACHED
9385                                 set old_pthread_create_joinable
9386                                 eval $setvar
9387                         else
9388                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9389                                 val="$define"
9390                                 set d_old_pthread_create_joinable
9391                                 eval $setvar
9392                                 val=0
9393                                 set old_pthread_create_joinable
9394                                 eval $setvar
9395                         fi
9396                 fi
9397         fi
9398         $rm -f try try.*
9399 else
9400     d_old_pthread_create_joinable="$undef"
9401     old_pthread_create_joinable=""
9402 fi
9403
9404 : see if pause exists
9405 set pause d_pause
9406 eval $inlibc
9407
9408 : see if pipe exists
9409 set pipe d_pipe
9410 eval $inlibc
9411
9412 : see if poll exists
9413 set poll d_poll
9414 eval $inlibc
9415
9416
9417 : see whether the various POSIXish _yields exist
9418 $cat >try.c <<EOP
9419 #include <pthread.h>
9420 #include <stdio.h>
9421 int main() {
9422 #ifdef SCHED_YIELD
9423         sched_yield();
9424 #else
9425 #ifdef PTHREAD_YIELD
9426         pthread_yield();
9427 #else
9428 #ifdef PTHREAD_YIELD_NULL
9429         pthread_yield(NULL);
9430 #endif
9431 #endif
9432 #endif
9433 }
9434 EOP
9435 : see if sched_yield exists
9436 set try -DSCHED_YIELD
9437 if eval $compile; then
9438     val="$define"
9439     sched_yield='sched_yield()'
9440 else
9441     val="$undef"
9442 fi
9443 case "$usethreads" in
9444 $define)
9445         case "$val" in
9446         $define) echo 'sched_yield() found.' >&4        ;;
9447         *)       echo 'sched_yield() NOT found.' >&4    ;;
9448         esac
9449 esac
9450 set d_sched_yield
9451 eval $setvar
9452
9453 : see if pthread_yield exists
9454 set try -DPTHREAD_YIELD
9455 if eval $compile; then
9456     val="$define"
9457     case "$sched_yield" in
9458     '') sched_yield='pthread_yield()' ;;
9459     esac
9460 else
9461     set try -DPTHREAD_YIELD_NULL
9462     if eval $compile; then
9463         val="$define"
9464         case "$sched_yield" in
9465         '') sched_yield='pthread_yield(NULL)' ;;
9466         esac
9467     else
9468         val="$undef"
9469     fi
9470 fi
9471 case "$usethreads" in
9472 $define)
9473         case "$val" in
9474         $define) echo 'pthread_yield() found.' >&4      ;;
9475         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9476         esac
9477         ;;
9478 esac
9479 set d_pthread_yield
9480 eval $setvar
9481
9482 case "$sched_yield" in
9483 '') sched_yield=undef ;;
9484 esac
9485
9486 $rm -f try try.*
9487
9488 : see if this is a pwd.h system
9489 set pwd.h i_pwd
9490 eval $inhdr
9491
9492 case "$i_pwd" in
9493 $define)
9494         xxx=`./findhdr pwd.h`
9495         $cppstdin $cppflags $cppminus < $xxx >$$.h
9496
9497         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9498                 val="$define"
9499         else
9500                 val="$undef"
9501         fi
9502         set d_pwquota
9503         eval $setvar
9504
9505         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9506                 val="$define"
9507         else
9508                 val="$undef"
9509         fi
9510         set d_pwage
9511         eval $setvar
9512
9513         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9514                 val="$define"
9515         else
9516                 val="$undef"
9517         fi
9518         set d_pwchange
9519         eval $setvar
9520
9521         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9522                 val="$define"
9523         else
9524                 val="$undef"
9525         fi
9526         set d_pwclass
9527         eval $setvar
9528
9529         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9530                 val="$define"
9531         else
9532                 val="$undef"
9533         fi
9534         set d_pwexpire
9535         eval $setvar
9536
9537         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9538                 val="$define"
9539         else
9540                 val="$undef"
9541         fi
9542         set d_pwcomment
9543         eval $setvar
9544
9545         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9546                 val="$define"
9547         else
9548                 val="$undef"
9549         fi
9550         set d_pwgecos
9551         eval $setvar
9552
9553         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9554                 val="$define"
9555         else
9556                 val="$undef"
9557         fi
9558         set d_pwpasswd
9559         eval $setvar
9560
9561         $rm -f $$.h
9562         ;;
9563 *)
9564         val="$undef"; 
9565         set d_pwquota; eval $setvar
9566         set d_pwage; eval $setvar
9567         set d_pwchange; eval $setvar
9568         set d_pwclass; eval $setvar
9569         set d_pwexpire; eval $setvar
9570         set d_pwcomment; eval $setvar
9571         set d_pwgecos; eval $setvar
9572         set d_pwpasswd; eval $setvar
9573         ;;
9574 esac
9575
9576 : see if readdir and friends exist
9577 set readdir d_readdir
9578 eval $inlibc
9579 set seekdir d_seekdir
9580 eval $inlibc
9581 set telldir d_telldir
9582 eval $inlibc
9583 set rewinddir d_rewinddir
9584 eval $inlibc
9585
9586 : see if readlink exists
9587 set readlink d_readlink
9588 eval $inlibc
9589
9590 : see if readv exists
9591 set readv d_readv
9592 eval $inlibc
9593
9594 : see if rename exists
9595 set rename d_rename
9596 eval $inlibc
9597
9598 : see if rmdir exists
9599 set rmdir d_rmdir
9600 eval $inlibc
9601
9602 : see if memory.h is available.
9603 val=''
9604 set memory.h val
9605 eval $inhdr
9606
9607 : See if it conflicts with string.h
9608 case "$val" in
9609 $define)
9610         case "$strings" in
9611         '') ;;
9612         *)
9613                 $cppstdin $cppflags $cppminus < $strings > mem.h
9614                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9615                         echo " "
9616                         echo "We won't be including <memory.h>."
9617                         val="$undef"
9618                 fi
9619                 $rm -f mem.h
9620                 ;;
9621         esac
9622 esac
9623 set i_memory
9624 eval $setvar
9625
9626 : can bcopy handle overlapping blocks?
9627 val="$undef"
9628 case "$d_bcopy" in
9629 "$define")
9630         echo " "
9631         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9632         $cat >try.c <<EOCP
9633 #$i_memory I_MEMORY
9634 #$i_stdlib I_STDLIB
9635 #$i_string I_STRING
9636 #$i_unistd I_UNISTD
9637 EOCP
9638         $cat >>try.c <<'EOCP'
9639 #include <stdio.h>
9640 #ifdef I_MEMORY
9641 #  include <memory.h>
9642 #endif
9643 #ifdef I_STDLIB
9644 #  include <stdlib.h>
9645 #endif
9646 #ifdef I_STRING
9647 #  include <string.h>
9648 #else
9649 #  include <strings.h>
9650 #endif
9651 #ifdef I_UNISTD
9652 #  include <unistd.h>  /* Needed for NetBSD */
9653 #endif
9654 int main()
9655 {
9656 char buf[128], abc[128];
9657 char *b;
9658 int len;
9659 int off;
9660 int align;
9661
9662 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9663
9664 for (align = 7; align >= 0; align--) {
9665         for (len = 36; len; len--) {
9666                 b = buf+align;
9667                 bcopy(abc, b, len);
9668                 for (off = 1; off <= len; off++) {
9669                         bcopy(b, b+off, len);
9670                         bcopy(b+off, b, len);
9671                         if (bcmp(b, abc, len))
9672                                 exit(1);
9673                 }
9674         }
9675 }
9676 exit(0);
9677 }
9678 EOCP
9679         set try
9680         if eval $compile_ok; then
9681                 if ./try 2>/dev/null; then
9682                         echo "Yes, it can."
9683                         val="$define"
9684                 else
9685                         echo "It can't, sorry."
9686                         case "$d_memmove" in
9687                         "$define") echo "But that's Ok since you have memmove()." ;;
9688                         esac
9689                 fi
9690         else
9691                 echo "(I can't compile the test program, so we'll assume not...)"
9692                 case "$d_memmove" in
9693                 "$define") echo "But that's Ok since you have memmove()." ;;
9694                 esac
9695         fi
9696         ;;
9697 esac
9698 $rm -f try.* try core
9699 set d_safebcpy
9700 eval $setvar
9701
9702 : can memcpy handle overlapping blocks?
9703 val="$undef"
9704 case "$d_memcpy" in
9705 "$define")
9706         echo " "
9707         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9708         $cat >try.c <<EOCP
9709 #$i_memory I_MEMORY
9710 #$i_stdlib I_STDLIB
9711 #$i_string I_STRING
9712 #$i_unistd I_UNISTD
9713 EOCP
9714         $cat >>try.c <<'EOCP'
9715 #include <stdio.h>
9716 #ifdef I_MEMORY
9717 #  include <memory.h>
9718 #endif
9719 #ifdef I_STDLIB
9720 #  include <stdlib.h>
9721 #endif
9722 #ifdef I_STRING
9723 #  include <string.h>
9724 #else
9725 #  include <strings.h>
9726 #endif
9727 #ifdef I_UNISTD
9728 #  include <unistd.h>  /* Needed for NetBSD */
9729 #endif
9730 int main()
9731 {
9732 char buf[128], abc[128];
9733 char *b;
9734 int len;
9735 int off;
9736 int align;
9737
9738 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9739    try to store the string in read-only memory. */
9740 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9741
9742 for (align = 7; align >= 0; align--) {
9743         for (len = 36; len; len--) {
9744                 b = buf+align;
9745                 memcpy(b, abc, len);
9746                 for (off = 1; off <= len; off++) {
9747                         memcpy(b+off, b, len);
9748                         memcpy(b, b+off, len);
9749                         if (memcmp(b, abc, len))
9750                                 exit(1);
9751                 }
9752         }
9753 }
9754 exit(0);
9755 }
9756 EOCP
9757         set try
9758         if eval $compile_ok; then
9759                 if ./try 2>/dev/null; then
9760                         echo "Yes, it can."
9761                         val="$define"
9762                 else
9763                         echo "It can't, sorry."
9764                         case "$d_memmove" in
9765                         "$define") echo "But that's Ok since you have memmove()." ;;
9766                         esac
9767                 fi
9768         else
9769                 echo "(I can't compile the test program, so we'll assume not...)"
9770                 case "$d_memmove" in
9771                 "$define") echo "But that's Ok since you have memmove()." ;;
9772                 esac
9773         fi
9774         ;;
9775 esac
9776 $rm -f try.* try core
9777 set d_safemcpy
9778 eval $setvar
9779
9780 : can memcmp be trusted to compare relative magnitude?
9781 val="$undef"
9782 case "$d_memcmp" in
9783 "$define")
9784         echo " "
9785         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9786         $cat >try.c <<EOCP
9787 #$i_memory I_MEMORY
9788 #$i_stdlib I_STDLIB
9789 #$i_string I_STRING
9790 #$i_unistd I_UNISTD
9791 EOCP
9792         $cat >>try.c <<'EOCP'
9793 #include <stdio.h>
9794 #ifdef I_MEMORY
9795 #  include <memory.h>
9796 #endif
9797 #ifdef I_STDLIB
9798 #  include <stdlib.h>
9799 #endif
9800 #ifdef I_STRING
9801 #  include <string.h>
9802 #else
9803 #  include <strings.h>
9804 #endif
9805 #ifdef I_UNISTD
9806 #  include <unistd.h>  /* Needed for NetBSD */
9807 #endif
9808 int main()
9809 {
9810 char a = -1;
9811 char b = 0;
9812 if ((a < b) && memcmp(&a, &b, 1) < 0)
9813         exit(1);
9814 exit(0);
9815 }
9816 EOCP
9817         set try
9818         if eval $compile_ok; then
9819                 if ./try 2>/dev/null; then
9820                         echo "Yes, it can."
9821                         val="$define"
9822                 else
9823                         echo "No, it can't (it uses signed chars)."
9824                 fi
9825         else
9826                 echo "(I can't compile the test program, so we'll assume not...)"
9827         fi
9828         ;;
9829 esac
9830 $rm -f try.* try core
9831 set d_sanemcmp
9832 eval $setvar
9833
9834 : see if select exists
9835 set select d_select
9836 eval $inlibc
9837
9838 : see if semctl exists
9839 set semctl d_semctl
9840 eval $inlibc
9841
9842 : see if semget exists
9843 set semget d_semget
9844 eval $inlibc
9845
9846 : see if semop exists
9847 set semop d_semop
9848 eval $inlibc
9849
9850 : see how much of the 'sem*(2)' library is present.
9851 h_sem=true
9852 echo " "
9853 case "$d_semctl$d_semget$d_semop" in
9854 *"$undef"*) h_sem=false;;
9855 esac
9856 case "$osname" in
9857 freebsd)
9858     case "`ipcs 2>&1`" in
9859     "SVID messages"*"not configured"*)
9860         echo "Your $osname does not have the sem*(2) configured." >&4
9861         h_sem=false
9862         val="$undef"
9863         set semctl d_semctl
9864         eval $setvar
9865         set semget d_semget
9866         eval $setvar
9867         set semop d_semop
9868         eval $setvar
9869         ;;
9870     esac
9871     ;;
9872 esac
9873 : we could also check for sys/ipc.h ...
9874 if $h_sem && $test `./findhdr sys/sem.h`; then
9875         echo "You have the full sem*(2) library." >&4
9876         val="$define"
9877 else
9878         echo "You don't have the full sem*(2) library." >&4
9879         val="$undef"
9880 fi
9881 set d_sem
9882 eval $setvar
9883
9884 : see whether sys/sem.h defines union semun
9885 echo " "
9886 $cat > try.c <<'END'
9887 #include <sys/types.h>
9888 #include <sys/ipc.h>
9889 #include <sys/sem.h>
9890 int main () { union semun semun; semun.buf = 0; }
9891 END
9892 set try
9893 if eval $compile; then
9894     echo "You have union semun in <sys/sem.h>." >&4
9895     val="$define"
9896 else
9897     echo "You do not have union semun in <sys/sem.h>." >&4
9898     val="$undef"
9899 fi
9900 $rm -f try try.c try.h
9901 set d_union_semun
9902 eval $setvar
9903
9904 : see how to do semctl IPC_STAT
9905 case "$d_sem" in
9906 $define)
9907     : see whether semctl IPC_STAT can use union semun
9908     echo " "
9909     $cat > try.h <<END
9910 #ifndef S_IRUSR
9911 #   ifdef S_IREAD
9912 #       define S_IRUSR S_IREAD
9913 #       define S_IWUSR S_IWRITE
9914 #       define S_IXUSR S_IEXEC
9915 #   else
9916 #       define S_IRUSR 0400
9917 #       define S_IWUSR 0200
9918 #       define S_IXUSR 0100
9919 #   endif
9920 #   define S_IRGRP (S_IRUSR>>3)
9921 #   define S_IWGRP (S_IWUSR>>3)
9922 #   define S_IXGRP (S_IXUSR>>3)
9923 #   define S_IROTH (S_IRUSR>>6)
9924 #   define S_IWOTH (S_IWUSR>>6)
9925 #   define S_IXOTH (S_IXUSR>>6)
9926 #endif
9927 #ifndef S_IRWXU
9928 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9929 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9930 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9931 #endif
9932 END
9933
9934     $cat > try.c <<END
9935 #include <sys/types.h>
9936 #include <sys/ipc.h>
9937 #include <sys/sem.h>
9938 #include <sys/stat.h>
9939 #include <stdio.h>
9940 #include <errno.h>
9941 #include "try.h"
9942 #ifndef errno
9943 extern int errno;
9944 #endif
9945 #$d_union_semun HAS_UNION_SEMUN
9946 int main() {
9947     union semun
9948 #ifndef HAS_UNION_SEMUN
9949     {
9950         int val;
9951         struct semid_ds *buf;
9952         unsigned short *array;
9953     }
9954 #endif
9955     arg;
9956     int sem, st;
9957
9958 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9959     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9960     if (sem > -1) {
9961         struct semid_ds argbuf;
9962         arg.buf = &argbuf;
9963 #       ifdef IPC_STAT
9964         st = semctl(sem, 0, IPC_STAT, arg);
9965         if (st == 0)
9966             printf("semun\n");
9967         else
9968 #       endif /* IPC_STAT */
9969             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9970 #       ifdef IPC_RMID
9971         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9972 #       endif /* IPC_RMID */
9973             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9974     } else
9975 #endif /* IPC_PRIVATE && ... */
9976         printf("semget failed: errno = %d\n", errno);
9977   return 0;
9978 }
9979 END
9980     val="$undef"
9981     set try
9982     if eval $compile; then
9983         xxx=`./try`
9984         case "$xxx" in
9985         semun) val="$define" ;;
9986         esac
9987     fi
9988     $rm -f try try.c
9989     set d_semctl_semun
9990     eval $setvar
9991     case "$d_semctl_semun" in
9992     $define)
9993         echo "You can use union semun for semctl IPC_STAT." >&4
9994         also='also'
9995         ;;
9996     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9997         also=''
9998         ;;
9999     esac
10000
10001     : see whether semctl IPC_STAT can use struct semid_ds pointer
10002     $cat > try.c <<'END'
10003 #include <sys/types.h>
10004 #include <sys/ipc.h>
10005 #include <sys/sem.h>
10006 #include <sys/stat.h>
10007 #include "try.h"
10008 #include <stdio.h>
10009 #include <errno.h>
10010 #ifndef errno
10011 extern int errno;
10012 #endif
10013 int main() {
10014     struct semid_ds arg;
10015     int sem, st;
10016
10017 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10018     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10019     if (sem > -1) {
10020 #       ifdef IPC_STAT
10021         st = semctl(sem, 0, IPC_STAT, &arg);
10022         if (st == 0)
10023             printf("semid_ds\n");
10024         else
10025 #       endif /* IPC_STAT */
10026             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10027 #       ifdef IPC_RMID
10028         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10029 #       endif /* IPC_RMID */
10030             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10031     } else
10032 #endif /* IPC_PRIVATE && ... */
10033         printf("semget failed: errno = %d\n", errno);
10034
10035     return 0;
10036 }
10037 END
10038     val="$undef"
10039     set try
10040     if eval $compile; then
10041         xxx=`./try`
10042         case "$xxx" in
10043         semid_ds) val="$define" ;;
10044         esac
10045     fi
10046     $rm -f try try.c
10047     set d_semctl_semid_ds
10048     eval $setvar
10049     case "$d_semctl_semid_ds" in
10050     $define)
10051         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10052         ;;
10053     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10054         ;;
10055     esac
10056     $rm -f try.h
10057     ;;
10058 *)  val="$undef"
10059
10060     # We do not have the full sem*(2) library, so assume we can not
10061     # use either.
10062
10063     set d_semctl_semun
10064     eval $setvar
10065
10066     set d_semctl_semid_ds
10067     eval $setvar
10068     ;;
10069 esac
10070
10071 : see if setegid exists
10072 set setegid d_setegid
10073 eval $inlibc
10074
10075 : see if seteuid exists
10076 set seteuid d_seteuid
10077 eval $inlibc
10078
10079 : see if setgrent exists
10080 set setgrent d_setgrent
10081 eval $inlibc
10082
10083 : see if sethostent exists
10084 set sethostent d_sethent
10085 eval $inlibc
10086
10087 : see if setlinebuf exists
10088 set setlinebuf d_setlinebuf
10089 eval $inlibc
10090
10091 : see if setlocale exists
10092 set setlocale d_setlocale
10093 eval $inlibc
10094
10095 : see if setnetent exists
10096 set setnetent d_setnent
10097 eval $inlibc
10098
10099 : see if setprotoent exists
10100 set setprotoent d_setpent
10101 eval $inlibc
10102
10103 : see if setpgid exists
10104 set setpgid d_setpgid
10105 eval $inlibc
10106
10107 : see if setpgrp2 exists
10108 set setpgrp2 d_setpgrp2
10109 eval $inlibc
10110
10111 : see if setpriority exists
10112 set setpriority d_setprior
10113 eval $inlibc
10114
10115 : see if setpwent exists
10116 set setpwent d_setpwent
10117 eval $inlibc
10118
10119 : see if setregid exists
10120 set setregid d_setregid
10121 eval $inlibc
10122 set setresgid d_setresgid
10123 eval $inlibc
10124
10125 : see if setreuid exists
10126 set setreuid d_setreuid
10127 eval $inlibc
10128 set setresuid d_setresuid
10129 eval $inlibc
10130
10131 : see if setrgid exists
10132 set setrgid d_setrgid
10133 eval $inlibc
10134
10135 : see if setruid exists
10136 set setruid d_setruid
10137 eval $inlibc
10138
10139 : see if setservent exists
10140 set setservent d_setsent
10141 eval $inlibc
10142
10143 : see if setsid exists
10144 set setsid d_setsid
10145 eval $inlibc
10146
10147 : see if setspent exists
10148 set setspent d_setspent
10149 eval $inlibc
10150
10151 : see if setvbuf exists
10152 set setvbuf d_setvbuf
10153 eval $inlibc
10154
10155 : see if sfio.h is available
10156 set sfio.h i_sfio
10157 eval $inhdr
10158
10159
10160 : see if sfio library is available
10161 case "$i_sfio" in
10162 $define)
10163         val=''
10164         set sfreserve val
10165         eval $inlibc
10166         ;;
10167 *)
10168         val="$undef"
10169         ;;
10170 esac
10171 : Ok, but do we want to use it.
10172 case "$val" in
10173 $define)
10174         case "$usesfio" in
10175         true|$define|[yY]*) dflt='y';;
10176         *) dflt='n';;
10177         esac
10178         echo "$package can use the sfio library, but it is experimental."
10179         rp="You seem to have sfio available, do you want to try using it?"
10180         . ./myread
10181         case "$ans" in
10182         y|Y) ;;
10183         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10184                 val="$undef"
10185                 : Remove sfio from list of libraries to use
10186                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10187                 shift
10188                 libs="$*"
10189                 echo "libs = $libs" >&4
10190                 ;;
10191         esac
10192         ;;
10193 *)      case "$usesfio" in
10194         true|$define|[yY]*)
10195                 echo "Sorry, cannot find sfio on this machine" >&4
10196                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10197                 ;;
10198         esac
10199         ;;
10200 esac
10201 set d_sfio
10202 eval $setvar
10203 case "$d_sfio" in
10204 $define) usesfio='true';;
10205 *) usesfio='false';;
10206 esac
10207
10208 : see if shmctl exists
10209 set shmctl d_shmctl
10210 eval $inlibc
10211
10212 : see if shmget exists
10213 set shmget d_shmget
10214 eval $inlibc
10215
10216 : see if shmat exists
10217 set shmat d_shmat
10218 eval $inlibc
10219 : see what shmat returns
10220 case "$d_shmat" in
10221 "$define")
10222         $cat >shmat.c <<'END'
10223 #include <sys/shm.h>
10224 void *shmat();
10225 END
10226         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10227                 shmattype='void *'
10228         else
10229                 shmattype='char *'
10230         fi
10231         echo "and it returns ($shmattype)." >&4
10232         : see if a prototype for shmat is available
10233         xxx=`./findhdr sys/shm.h`
10234         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10235         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10236                 val="$define"
10237         else
10238                 val="$undef"
10239         fi
10240         $rm -f shmat.[co]
10241         ;;
10242 *)
10243         val="$undef"
10244         ;;
10245 esac
10246 set d_shmatprototype
10247 eval $setvar
10248
10249 : see if shmdt exists
10250 set shmdt d_shmdt
10251 eval $inlibc
10252
10253 : see how much of the 'shm*(2)' library is present.
10254 h_shm=true
10255 echo " "
10256 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10257 *"$undef"*) h_shm=false;;
10258 esac
10259 case "$osname" in
10260 freebsd)
10261     case "`ipcs 2>&1`" in
10262     "SVID shared memory"*"not configured"*)
10263         echo "Your $osname does not have the shm*(2) configured." >&4
10264         h_shm=false
10265         val="$undef"
10266         set shmctl d_shmctl
10267         evat $setvar
10268         set shmget d_shmget
10269         evat $setvar
10270         set shmat d_shmat
10271         evat $setvar
10272         set shmdt d_shmdt
10273         evat $setvar
10274         ;;
10275     esac
10276     ;;
10277 esac
10278 : we could also check for sys/ipc.h ...
10279 if $h_shm && $test `./findhdr sys/shm.h`; then
10280         echo "You have the full shm*(2) library." >&4
10281         val="$define"
10282 else
10283         echo "You don't have the full shm*(2) library." >&4
10284         val="$undef"
10285 fi
10286 set d_shm
10287 eval $setvar
10288
10289 echo " "
10290 : see if we have sigaction
10291 if set sigaction val -f d_sigaction; eval $csym; $val; then
10292         echo 'sigaction() found.' >&4
10293         $cat > try.c <<'EOP'
10294 #include <stdio.h>
10295 #include <sys/types.h>
10296 #include <signal.h>
10297 int main()
10298 {
10299     struct sigaction act, oact;
10300 }
10301 EOP
10302         set try
10303         if eval $compile_ok; then
10304                 val="$define"
10305         else
10306                 echo "But you don't seem to have a useable struct sigaction." >&4
10307                 val="$undef"
10308         fi
10309 else
10310         echo 'sigaction NOT found.' >&4
10311         val="$undef"
10312 fi
10313 set d_sigaction; eval $setvar
10314 $rm -f try try$_o try.c
10315
10316 : see if sigsetjmp exists
10317 echo " "
10318 case "$d_sigsetjmp" in
10319 '')
10320         $cat >try.c <<'EOP'
10321 #include <setjmp.h>
10322 sigjmp_buf env;
10323 int set = 1;
10324 int main()
10325 {
10326         if (sigsetjmp(env,1))
10327                 exit(set);
10328         set = 0;
10329         siglongjmp(env, 1);
10330         exit(1);
10331 }
10332 EOP
10333         set try
10334         if eval $compile; then
10335                 if ./try >/dev/null 2>&1; then
10336                         echo "POSIX sigsetjmp found." >&4
10337                         val="$define"
10338                 else
10339                         $cat >&4 <<EOM
10340 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10341 I'll ignore them.
10342 EOM
10343                         val="$undef"
10344                 fi
10345         else
10346                 echo "sigsetjmp not found." >&4
10347                 val="$undef"
10348         fi
10349         ;;
10350 *) val="$d_sigsetjmp"
10351         case "$d_sigsetjmp" in
10352         $define) echo "POSIX sigsetjmp found." >&4;;
10353         $undef) echo "sigsetjmp not found." >&4;;
10354         esac
10355         ;;
10356 esac
10357 set d_sigsetjmp
10358 eval $setvar
10359 $rm -f try.c try
10360
10361 : see if stat knows about block sizes
10362 echo " "
10363 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10364 eval $hasfield
10365
10366 : see if _ptr and _cnt from stdio act std
10367 echo " "
10368 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10369         echo "(Looks like you have stdio.h from Linux.)"
10370         case "$stdio_ptr" in
10371         '') stdio_ptr='((fp)->_IO_read_ptr)'
10372                 ptr_lval=$define
10373                 ;;
10374         *)      ptr_lval=$d_stdio_ptr_lval;;
10375         esac
10376         case "$stdio_cnt" in
10377         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10378                 cnt_lval=$undef
10379                 ;;
10380         *)      cnt_lval=$d_stdio_cnt_lval;;
10381         esac
10382         case "$stdio_base" in
10383         '') stdio_base='((fp)->_IO_read_base)';;
10384         esac
10385         case "$stdio_bufsiz" in
10386         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10387         esac
10388 else
10389         case "$stdio_ptr" in
10390         '') stdio_ptr='((fp)->_ptr)'
10391                 ptr_lval=$define
10392                 ;;
10393         *)      ptr_lval=$d_stdio_ptr_lval;;
10394         esac
10395         case "$stdio_cnt" in
10396         '') stdio_cnt='((fp)->_cnt)'
10397                 cnt_lval=$define
10398                 ;;
10399         *)      cnt_lval=$d_stdio_cnt_lval;;
10400         esac
10401         case "$stdio_base" in
10402         '') stdio_base='((fp)->_base)';;
10403         esac
10404         case "$stdio_bufsiz" in
10405         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10406         esac
10407 fi
10408 : test whether _ptr and _cnt really work
10409 echo "Checking how std your stdio is..." >&4
10410 $cat >try.c <<EOP
10411 #include <stdio.h>
10412 #define FILE_ptr(fp)    $stdio_ptr
10413 #define FILE_cnt(fp)    $stdio_cnt
10414 int main() {
10415         FILE *fp = fopen("try.c", "r");
10416         char c = getc(fp);
10417         if (
10418                 18 <= FILE_cnt(fp) &&
10419                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10420         )
10421                 exit(0);
10422         exit(1);
10423 }
10424 EOP
10425 val="$undef"
10426 set try
10427 if eval $compile; then
10428         if ./try; then
10429                 echo "Your stdio acts pretty std."
10430                 val="$define"
10431         else
10432                 echo "Your stdio isn't very std."
10433         fi
10434 else
10435         echo "Your stdio doesn't appear very std."
10436 fi
10437 $rm -f try.c try
10438 set d_stdstdio
10439 eval $setvar
10440
10441 : Can _ptr be used as an lvalue?
10442 case "$d_stdstdio$ptr_lval" in
10443 $define$define) val=$define ;;
10444 *) val=$undef ;;
10445 esac
10446 set d_stdio_ptr_lval
10447 eval $setvar
10448
10449 : Can _cnt be used as an lvalue?
10450 case "$d_stdstdio$cnt_lval" in
10451 $define$define) val=$define ;;
10452 *) val=$undef ;;
10453 esac
10454 set d_stdio_cnt_lval
10455 eval $setvar
10456
10457 : see if _base is also standard
10458 val="$undef"
10459 case "$d_stdstdio" in
10460 $define)
10461         $cat >try.c <<EOP
10462 #include <stdio.h>
10463 #define FILE_base(fp)   $stdio_base
10464 #define FILE_bufsiz(fp) $stdio_bufsiz
10465 int main() {
10466         FILE *fp = fopen("try.c", "r");
10467         char c = getc(fp);
10468         if (
10469                 19 <= FILE_bufsiz(fp) &&
10470                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10471         )
10472                 exit(0);
10473         exit(1);
10474 }
10475 EOP
10476         set try
10477         if eval $compile; then
10478                 if ./try; then
10479                         echo "And its _base field acts std."
10480                         val="$define"
10481                 else
10482                         echo "But its _base field isn't std."
10483                 fi
10484         else
10485                 echo "However, it seems to be lacking the _base field."
10486         fi
10487         $rm -f try.c try
10488         ;;
10489 esac
10490 set d_stdiobase
10491 eval $setvar
10492
10493 $cat >&4 <<EOM
10494 Checking how to access stdio streams by file descriptor number...
10495 EOM
10496 case "$stdio_stream_array" in
10497 '')     $cat >try.c <<EOCP
10498 #include <stdio.h>
10499 int main() {
10500   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10501     printf("yes\n");
10502 }
10503 EOCP
10504         for s in _iob __iob __sF
10505         do
10506                 set try -DSTDIO_STREAM_ARRAY=$s
10507                 if eval $compile; then
10508                         case "`./try$exe_ext`" in
10509                         yes)    stdio_stream_array=$s; break ;;
10510                         esac
10511                 fi
10512         done
10513         $rm -f try.* try$exe_ext
10514 esac
10515 case "$stdio_stream_array" in
10516 '')     $cat >&4 <<EOM
10517 I can't figure out how to access stdio streams by file descriptor number.
10518 EOM
10519         d_stdio_stream_array="$undef"
10520         ;;
10521 *)      $cat >&4 <<EOM
10522 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10523 EOM
10524         d_stdio_stream_array="$define"
10525         ;;
10526 esac
10527
10528 : see if strcoll exists
10529 set strcoll d_strcoll
10530 eval $inlibc
10531
10532 : check for structure copying
10533 echo " "
10534 echo "Checking to see if your C compiler can copy structs..." >&4
10535 $cat >try.c <<'EOCP'
10536 int main()
10537 {
10538         struct blurfl {
10539                 int dyick;
10540         } foo, bar;
10541
10542         foo = bar;
10543 }
10544 EOCP
10545 if $cc -c try.c >/dev/null 2>&1 ; then
10546         val="$define"
10547         echo "Yup, it can."
10548 else
10549         val="$undef"
10550         echo "Nope, it can't."
10551 fi
10552 set d_strctcpy
10553 eval $setvar
10554 $rm -f try.*
10555
10556 : see if strerror and/or sys_errlist[] exist
10557 echo " "
10558 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10559     if set strerror val -f d_strerror; eval $csym; $val; then
10560                 echo 'strerror() found.' >&4
10561                 d_strerror="$define"
10562                 d_strerrm='strerror(e)'
10563                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10564                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10565                         d_syserrlst="$define"
10566                 else
10567                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10568                         d_syserrlst="$undef"
10569                 fi
10570     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10571                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10572                 echo 'strerror() found in string header.' >&4
10573                 d_strerror="$define"
10574                 d_strerrm='strerror(e)'
10575                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10576                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10577                                 d_syserrlst="$define"
10578                 else
10579                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10580                         d_syserrlst="$undef"
10581                 fi
10582     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10583                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10584                 d_strerror="$undef"
10585                 d_syserrlst="$define"
10586                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10587     else
10588                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10589                 d_strerror="$undef"
10590                 d_syserrlst="$undef"
10591                 d_strerrm='"unknown"'
10592     fi
10593 fi
10594
10595 : see if strtod exists
10596 set strtod d_strtod
10597 eval $inlibc
10598
10599 : see if strtol exists
10600 set strtol d_strtol
10601 eval $inlibc
10602
10603 : see if strtoul exists
10604 set strtoul d_strtoul
10605 eval $inlibc
10606
10607 : see if strtoull exists
10608 set strtoull d_strtoull
10609 eval $inlibc
10610
10611 : see if strxfrm exists
10612 set strxfrm d_strxfrm
10613 eval $inlibc
10614
10615 : see if symlink exists
10616 set symlink d_symlink
10617 eval $inlibc
10618
10619 : see if syscall exists
10620 set syscall d_syscall
10621 eval $inlibc
10622
10623 : see if sysconf exists
10624 set sysconf d_sysconf
10625 eval $inlibc
10626
10627 : see if system exists
10628 set system d_system
10629 eval $inlibc
10630
10631 : see if tcgetpgrp exists
10632 set tcgetpgrp d_tcgetpgrp
10633 eval $inlibc
10634
10635 : see if tcsetpgrp exists
10636 set tcsetpgrp d_tcsetpgrp
10637 eval $inlibc
10638
10639 : see if sys/types.h has to be included
10640 set sys/types.h i_systypes
10641 eval $inhdr
10642
10643 : see if prototype for telldir is available
10644 echo " "
10645 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10646 eval $hasproto
10647
10648 : define an is-a-typedef? function
10649 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10650 case "$inclist" in
10651 "") inclist="sys/types.h";;
10652 esac;
10653 eval "varval=\$$var";
10654 case "$varval" in
10655 "")
10656         $rm -f temp.c;
10657         for inc in $inclist; do
10658                 echo "#include <$inc>" >>temp.c;
10659         done;
10660         echo "#ifdef $type" >> temp.c;
10661         echo "printf(\"We have $type\");" >> temp.c;
10662         echo "#endif" >> temp.c;
10663         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10664         if $contains $type temp.E >/dev/null 2>&1; then
10665                 eval "$var=\$type";
10666         else
10667                 eval "$var=\$def";
10668         fi;
10669         $rm -f temp.?;;
10670 *) eval "$var=\$varval";;
10671 esac'
10672
10673 : define an is-a-typedef? function that prompts if the type is not available.
10674 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10675 case "$inclist" in
10676 "") inclist="sys/types.h";;
10677 esac;
10678 eval "varval=\$$var";
10679 case "$varval" in
10680 "")
10681         $rm -f temp.c;
10682         for inc in $inclist; do
10683                 echo "#include <$inc>" >>temp.c;
10684         done;
10685         echo "#ifdef $type" >> temp.c;
10686         echo "printf(\"We have $type\");" >> temp.c;
10687         echo "#endif" >> temp.c;
10688         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10689         echo " " ;
10690         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10691         if $contains $type temp.E >/dev/null 2>&1; then
10692                 echo "$type found." >&4;
10693                 eval "$var=\$type";
10694         else
10695                 echo "$type NOT found." >&4;
10696                 dflt="$def";
10697                 . ./myread ;
10698                 eval "$var=\$ans";
10699         fi;
10700         $rm -f temp.?;;
10701 *) eval "$var=\$varval";;
10702 esac'
10703
10704 : see if this is a sys/times.h system
10705 set sys/times.h i_systimes
10706 eval $inhdr
10707
10708 : see if times exists
10709 echo " "
10710 if set times val -f d_times; eval $csym; $val; then
10711         echo 'times() found.' >&4
10712         d_times="$define"
10713         inc=''
10714         case "$i_systimes" in
10715         "$define") inc='sys/times.h';;
10716         esac
10717         rp="What is the type returned by times() on this system?"
10718         set clock_t clocktype long stdio.h sys/types.h $inc
10719         eval $typedef_ask
10720 else
10721         echo 'times() NOT found, hope that will do.' >&4
10722         d_times="$undef"
10723         clocktype='int'
10724 fi
10725
10726 : see if truncate exists
10727 set truncate d_truncate
10728 eval $inlibc
10729
10730 : see if tzname[] exists
10731 echo " "
10732 if set tzname val -a d_tzname; eval $csym; $val; then
10733         val="$define"
10734         echo 'tzname[] found.' >&4
10735 else
10736         val="$undef"
10737         echo 'tzname[] NOT found.' >&4
10738 fi
10739 set d_tzname
10740 eval $setvar
10741
10742 : see if umask exists
10743 set umask d_umask
10744 eval $inlibc
10745
10746 : backward compatibility for d_hvfork
10747 if test X$d_hvfork != X; then
10748         d_vfork="$d_hvfork"
10749         d_hvfork=''
10750 fi
10751 : see if there is a vfork
10752 val=''
10753 set vfork val
10754 eval $inlibc
10755
10756 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10757 : perl on Solaris 2.x, and probably elsewhere.
10758 case "$val" in
10759 $define)
10760         echo " "
10761         case "$usevfork" in
10762         false) dflt='n';;
10763         *) dflt='y';;
10764         esac
10765         cat <<'EOM'
10766  
10767 Perl can only use a vfork() that doesn't suffer from strict
10768 restrictions on calling functions or modifying global data in
10769 the child.  For example, glibc-2.1 contains such a vfork()
10770 that is unsuitable.  If your system provides a proper fork()
10771 call, chances are that you do NOT want perl to use vfork().
10772
10773 EOM
10774         rp="Do you still want to use vfork()?"
10775         . ./myread
10776         case "$ans" in
10777         y|Y) ;;
10778         *)
10779                 echo "Ok, we won't use vfork()."
10780                 val="$undef"
10781                 ;;
10782         esac
10783         ;;
10784 esac
10785 set d_vfork
10786 eval $setvar
10787 case "$d_vfork" in
10788 $define) usevfork='true';;
10789 *) usevfork='false';;
10790 esac
10791
10792 : see if this is an sysdir system
10793 set sys/dir.h i_sysdir
10794 eval $inhdr
10795
10796 : see if this is an sysndir system
10797 set sys/ndir.h i_sysndir
10798 eval $inhdr
10799
10800 : see if closedir exists
10801 set closedir d_closedir
10802 eval $inlibc
10803
10804 case "$d_closedir" in
10805 "$define")
10806         echo " "
10807         echo "Checking whether closedir() returns a status..." >&4
10808         cat > closedir.c <<EOM
10809 #$i_dirent I_DIRENT             /**/
10810 #$i_sysdir I_SYS_DIR            /**/
10811 #$i_sysndir I_SYS_NDIR          /**/
10812 #$i_systypes I_SYS_TYPES        /**/
10813
10814 #if defined(I_SYS_TYPES)
10815 #include <sys/types.h>
10816 #endif
10817 #if defined(I_DIRENT)
10818 #include <dirent.h>
10819 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10820 #include <sys/dir.h>
10821 #endif
10822 #else
10823 #ifdef I_SYS_NDIR
10824 #include <sys/ndir.h>
10825 #else
10826 #ifdef I_SYS_DIR
10827 #ifdef hp9000s500
10828 #include <ndir.h>       /* may be wrong in the future */
10829 #else
10830 #include <sys/dir.h>
10831 #endif
10832 #endif
10833 #endif
10834 #endif 
10835 int main() { return closedir(opendir(".")); }
10836 EOM
10837         set closedir
10838         if eval $compile_ok; then
10839                 if ./closedir > /dev/null 2>&1 ; then
10840                         echo "Yes, it does."
10841                         val="$undef"
10842                 else
10843                         echo "No, it doesn't."
10844                         val="$define"
10845                 fi
10846         else
10847                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10848                 val="$define"
10849         fi
10850         ;;
10851 *)
10852         val="$undef";
10853         ;;
10854 esac
10855 set d_void_closedir
10856 eval $setvar
10857 $rm -f closedir*
10858 : check for volatile keyword
10859 echo " "
10860 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10861 $cat >try.c <<'EOCP'
10862 int main()
10863 {
10864         typedef struct _goo_struct goo_struct;
10865         goo_struct * volatile goo = ((goo_struct *)0);
10866         struct _goo_struct {
10867                 long long_int;
10868                 int reg_int;
10869                 char char_var;
10870         };
10871         typedef unsigned short foo_t;
10872         char *volatile foo;
10873         volatile int bar;
10874         volatile foo_t blech;
10875         foo = foo;
10876 }
10877 EOCP
10878 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10879         val="$define"
10880         echo "Yup, it does."
10881 else
10882         val="$undef"
10883         echo "Nope, it doesn't."
10884 fi
10885 set d_volatile
10886 eval $setvar
10887 $rm -f try.*
10888
10889 : see if there is a wait4
10890 set wait4 d_wait4
10891 eval $inlibc
10892
10893 : see if waitpid exists
10894 set waitpid d_waitpid
10895 eval $inlibc
10896
10897 : see if wcstombs exists
10898 set wcstombs d_wcstombs
10899 eval $inlibc
10900
10901 : see if wctomb exists
10902 set wctomb d_wctomb
10903 eval $inlibc
10904
10905 : see if writev exists
10906 set writev d_writev
10907 eval $inlibc
10908
10909 : preserve RCS keywords in files with variable substitution, grrr
10910 Date='$Date'
10911 Id='$Id'
10912 Log='$Log'
10913 RCSfile='$RCSfile'
10914 Revision='$Revision'
10915
10916 case "$crosscompile" in
10917 ''|[nN]*) crosscompile="$undef" ;;
10918 esac
10919
10920 case "$osname" in
10921 next|rhapsody) multiarch="$define" ;;
10922 esac
10923 case "$multiarch" in
10924 ''|[nN]*) multiarch="$undef" ;;
10925 esac
10926
10927 : check for alignment requirements
10928 echo " "
10929 case "$crosscompile$multiarch" in
10930 *$define*)
10931         $cat <<EOM
10932 You seem to be either cross-compiling or doing a multiarchitecture build,
10933 skipping the memory alignment check.
10934
10935 EOM
10936         case "$alignbytes" in
10937         '') alignbytes=8 ;;
10938         esac
10939         ;;
10940 *)
10941         case "$alignbytes" in
10942         '') echo "Checking alignment constraints..." >&4
10943                 $cat >try.c <<'EOCP'
10944 struct foobar {
10945         char foo;
10946         double bar;
10947 } try_algn;
10948 int main()
10949 {
10950         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10951 }
10952 EOCP
10953                 set try
10954                 if eval $compile_ok; then
10955                         dflt=`./try`
10956                 else
10957                         dflt='8'
10958                         echo "(I can't seem to compile the test program...)"
10959                 fi
10960                 ;;
10961         *) dflt="$alignbytes"
10962                 ;;
10963         esac
10964         rp="Doubles must be aligned on a how-many-byte boundary?"
10965         . ./myread
10966         alignbytes="$ans"
10967         $rm -f try.c try
10968         ;;
10969 esac
10970
10971
10972 : check for ordering of bytes in a long
10973 echo " "
10974 case "$crosscompile$multiarch" in
10975 *$define*)
10976         $cat <<EOM
10977 You seem to be either cross-compiling or doing a multiarchitecture build,
10978 skipping the byteorder check.
10979
10980 EOM
10981         byteorder=''
10982         ;;
10983 *)
10984         case "$byteorder" in
10985         '')
10986                 $cat <<'EOM'
10987 In the following, larger digits indicate more significance.  A big-endian
10988 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10989 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10990 machines may have weird orders like 3412.  A Cray will report 87654321. If
10991 the test program works the default is probably right.
10992 I'm now running the test program...
10993 EOM
10994                 $cat >try.c <<'EOCP'
10995 #include <stdio.h>
10996 int main()
10997 {
10998         int i;
10999         union {
11000                 unsigned long l;
11001                 char c[sizeof(long)];
11002         } u;
11003
11004         if (sizeof(long) > 4)
11005                 u.l = (0x08070605L << 32) | 0x04030201L;
11006         else
11007                 u.l = 0x04030201L;
11008         for (i = 0; i < sizeof(long); i++)
11009                 printf("%c", u.c[i]+'0');
11010         printf("\n");
11011         exit(0);
11012 }
11013 EOCP
11014                 xxx_prompt=y
11015                 set try
11016                 if eval $compile && ./try > /dev/null; then
11017                         dflt=`./try`
11018                         case "$dflt" in
11019                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11020                                 echo "(The test program ran ok.)"
11021                                 echo "byteorder=$dflt"
11022                                 xxx_prompt=n
11023                         ;;
11024                         ????|????????) echo "(The test program ran ok.)" ;;
11025                         *) echo "(The test program didn't run right for some reason.)" ;;
11026                         esac
11027                 else
11028                         dflt='4321'
11029                         cat <<'EOM'
11030 (I can't seem to compile the test program.  Guessing big-endian...)
11031 EOM
11032                 fi
11033                 case "$xxx_prompt" in
11034                 y)
11035                         rp="What is the order of bytes in a long?"
11036                         . ./myread
11037                         byteorder="$ans"
11038                         ;;
11039                 *)      byteorder=$dflt
11040                         ;;
11041                 esac
11042                 ;;
11043         esac
11044         $rm -f try.c try
11045         ;;
11046 esac
11047
11048
11049 : how do we catenate cpp tokens here?
11050 echo " "
11051 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11052 $cat >cpp_stuff.c <<'EOCP'
11053 #define RCAT(a,b)a/**/b
11054 #define ACAT(a,b)a ## b
11055 RCAT(Rei,ser)
11056 ACAT(Cir,cus)
11057 EOCP
11058 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11059 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11060         echo "Oh!  Smells like ANSI's been here." >&4
11061         echo "We can catify or stringify, separately or together!"
11062         cpp_stuff=42
11063 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11064         echo "Ah, yes!  The good old days!" >&4
11065         echo "However, in the good old days we don't know how to stringify and"
11066         echo "catify at the same time."
11067         cpp_stuff=1
11068 else
11069         $cat >&4 <<EOM
11070 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11071 to have to edit the values of CAT[2-5] in config.h...
11072 EOM
11073         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11074 fi
11075 $rm -f cpp_stuff.*
11076
11077 : see if this is a db.h system
11078 set db.h i_db
11079 eval $inhdr
11080
11081 case "$i_db" in
11082 $define)
11083         : Check db version.
11084         echo " "
11085         echo "Checking Berkeley DB version ..." >&4
11086         $cat >try.c <<EOCP
11087 #$d_const HASCONST
11088 #ifndef HASCONST
11089 #define const
11090 #endif
11091 #include <sys/types.h>
11092 #include <stdio.h>
11093 #include <db.h>
11094 int main()
11095 {
11096 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11097     int Major, Minor, Patch ;
11098     unsigned long Version ;
11099     (void)db_version(&Major, &Minor, &Patch) ;
11100     printf("You have Berkeley DB Version 2 or greater\n");
11101
11102     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11103                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11104     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11105                 Major, Minor, Patch) ;
11106
11107     /* check that db.h & libdb are compatible */
11108     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11109         printf("db.h and libdb are incompatible\n") ;
11110         exit(3);        
11111     }
11112
11113     printf("db.h and libdb are compatible\n") ;
11114
11115     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11116                 + DB_VERSION_PATCH ;
11117
11118     /* needs to be >= 2.3.4 */
11119     if (Version < 2003004) {
11120     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11121         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11122         exit(2);        
11123     }
11124
11125     exit(0);
11126 #else
11127 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11128     printf("You have Berkeley DB Version 1\n");
11129     exit(0);    /* DB version < 2: the coast is clear. */
11130 #else
11131     exit(1);    /* <db.h> not Berkeley DB? */
11132 #endif
11133 #endif
11134 }
11135 EOCP
11136         set try
11137         if eval $compile && ./try; then
11138                 echo 'Looks OK.' >&4
11139         else
11140                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11141                 i_db=$undef
11142                 case " $libs " in
11143                 *"-ldb "*)
11144                         : Remove db from list of libraries to use
11145                         echo "Removing unusable -ldb from library list" >&4
11146                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11147                         shift
11148                         libs="$*"
11149                         echo "libs = $libs" >&4
11150                         ;;
11151                 esac
11152         fi
11153         $rm -f try.*
11154         ;;
11155 esac
11156
11157 case "$i_db" in
11158 define)
11159         : Check the return type needed for hash 
11160         echo " "
11161         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11162         $cat >try.c <<EOCP
11163 #$d_const HASCONST
11164 #ifndef HASCONST
11165 #define const
11166 #endif
11167 #include <sys/types.h>
11168 #include <db.h>
11169
11170 #ifndef DB_VERSION_MAJOR
11171 u_int32_t hash_cb (ptr, size)
11172 const void *ptr;
11173 size_t size;
11174 {
11175 }
11176 HASHINFO info;
11177 int main()
11178 {
11179         info.hash = hash_cb;
11180 }
11181 #endif
11182 EOCP
11183         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11184                 if $contains warning try.out >>/dev/null 2>&1 ; then
11185                         db_hashtype='int'
11186                 else
11187                         db_hashtype='u_int32_t'
11188                 fi
11189         else
11190                 : XXX Maybe we should just give up here.
11191                 db_hashtype=u_int32_t
11192                 $cat try.out >&4
11193                 echo "Help:  I can't seem to compile the db test program." >&4
11194                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11195         fi
11196         $rm -f try.*
11197         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11198         ;;
11199 *)      db_hashtype=u_int32_t
11200         ;;
11201 esac
11202 case "$i_db" in
11203 define)
11204         : Check the return type needed for prefix 
11205         echo " "
11206         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11207         cat >try.c <<EOCP
11208 #$d_const HASCONST
11209 #ifndef HASCONST
11210 #define const
11211 #endif
11212 #include <sys/types.h>
11213 #include <db.h>
11214
11215 #ifndef DB_VERSION_MAJOR
11216 size_t prefix_cb (key1, key2)
11217 const DBT *key1;
11218 const DBT *key2;
11219 {
11220 }
11221 BTREEINFO info;
11222 int main()
11223 {
11224         info.prefix = prefix_cb;
11225 }
11226 #endif
11227 EOCP
11228         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11229                 if $contains warning try.out >>/dev/null 2>&1 ; then
11230                         db_prefixtype='int'
11231                 else
11232                         db_prefixtype='size_t'
11233                 fi
11234         else
11235                 db_prefixtype='size_t'
11236                 : XXX Maybe we should just give up here.
11237                 $cat try.out >&4
11238                 echo "Help:  I can't seem to compile the db test program." >&4
11239                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11240         fi
11241         $rm -f try.*
11242         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11243         ;;
11244 *)      db_prefixtype='size_t'
11245         ;;
11246 esac
11247
11248 : check for void type
11249 echo " "
11250 echo "Checking to see how well your C compiler groks the void type..." >&4
11251 case "$voidflags" in
11252 '')
11253         $cat >try.c <<'EOCP'
11254 #if TRY & 1
11255 void sub() {
11256 #else
11257 sub() {
11258 #endif
11259         extern void moo();      /* function returning void */
11260         void (*goo)();          /* ptr to func returning void */
11261 #if TRY & 8
11262         void *hue;              /* generic ptr */
11263 #endif
11264 #if TRY & 2
11265         void (*foo[10])();
11266 #endif
11267
11268 #if TRY & 4
11269         if(goo == moo) {
11270                 exit(0);
11271         }
11272 #endif
11273         exit(0);
11274 }
11275 int main() { sub(); }
11276 EOCP
11277         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11278                 voidflags=$defvoidused
11279         echo "Good.  It appears to support void to the level $package wants.">&4
11280                 if $contains warning .out >/dev/null 2>&1; then
11281                         echo "However, you might get some warnings that look like this:"
11282                         $cat .out
11283                 fi
11284         else
11285 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11286                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11287                         echo "It supports 1..."
11288                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11289                                 echo "It also supports 2..."
11290                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11291                                         voidflags=7
11292                                         echo "And it supports 4 but not 8 definitely."
11293                                 else
11294                                         echo "It doesn't support 4..."
11295                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11296                                                 voidflags=11
11297                                                 echo "But it supports 8."
11298                                         else
11299                                                 voidflags=3
11300                                                 echo "Neither does it support 8."
11301                                         fi
11302                                 fi
11303                         else
11304                                 echo "It does not support 2..."
11305                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11306                                         voidflags=13
11307                                         echo "But it supports 4 and 8."
11308                                 else
11309                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11310                                                 voidflags=5
11311                                                 echo "And it supports 4 but has not heard about 8."
11312                                         else
11313                                                 echo "However it supports 8 but not 4."
11314                                         fi
11315                                 fi
11316                         fi
11317                 else
11318                         echo "There is no support at all for void."
11319                         voidflags=0
11320                 fi
11321         fi
11322 esac
11323 case "$voidflags" in
11324 "$defvoidused") ;;
11325 *)      $cat >&4 <<'EOM'
11326   Support flag bits are:
11327     1: basic void declarations.
11328     2: arrays of pointers to functions returning void.
11329     4: operations between pointers to and addresses of void functions.
11330     8: generic void pointers.
11331 EOM
11332         dflt="$voidflags";
11333         rp="Your void support flags add up to what?"
11334         . ./myread
11335         voidflags="$ans"
11336         ;;
11337 esac
11338 $rm -f try.* .out
11339
11340
11341 : How can we generate normalized random numbers ?
11342 echo " "
11343 echo "Looking for a random number function..." >&4
11344 case "$randfunc" in
11345 '')
11346         if set drand48 val -f; eval $csym; $val; then
11347                 dflt="drand48"
11348                 echo "Good, found drand48()." >&4
11349         elif set random val -f; eval $csym; $val; then
11350                 dflt="random"
11351                 echo "OK, found random()." >&4
11352         else
11353                 dflt="rand"
11354                 echo "Yick, looks like I have to use rand()." >&4
11355         fi
11356         echo " "
11357         ;;
11358 *)
11359         dflt="$randfunc"
11360         ;;
11361 esac
11362 cont=true
11363
11364 case "$ccflags" in
11365 *-Dmy_rand=*|*-Dmy_srand=*)
11366         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11367         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11368         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11369         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11370         ;;
11371 esac
11372
11373 while $test "$cont"; do
11374         rp="Use which function to generate random numbers?"
11375         . ./myread
11376         if $test "$ans" = "$dflt"; then
11377                 : null
11378         else
11379                 randbits=''
11380         fi
11381         randfunc="$ans"
11382         if set $ans val -f; eval $csym; $val; then
11383                 cont=''
11384         else
11385                 dflt=y
11386                 rp="I cannot find function $ans. Use that name anyway?"
11387                 . ./myread
11388                 dflt=rand
11389                 case "$ans" in
11390                         [yY]*) cont='';;
11391                 esac
11392         fi
11393         case "$cont" in
11394         '')
11395                 case "$randfunc" in
11396                 drand48)
11397                         drand01="drand48()"
11398                         seedfunc="srand48"
11399                         randbits=48
11400                         randseedtype=long
11401                         ;;
11402                 rand|random)
11403                         case "$randbits" in
11404                         '')
11405 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11406                                 $cat >try.c <<EOCP
11407 #$i_unistd I_UNISTD
11408 #$i_stdlib I_STDLIB
11409 #include <stdio.h>
11410 #ifdef I_UNISTD
11411 #  include <unistd.h>
11412 #endif
11413 #ifdef I_STDLIB
11414 #  include <stdlib.h>
11415 #endif
11416 int main()
11417 {
11418         register int i;
11419         register unsigned long tmp;
11420         register unsigned long max = 0L;
11421
11422         for (i = 1000; i; i--) {
11423                 tmp = (unsigned long) $randfunc();
11424                 if (tmp > max) max = tmp;
11425         }
11426         for (i = 0; max; i++)
11427                 max /= 2;
11428         printf("%d\n",i);
11429 }
11430 EOCP
11431                                 set try
11432                                 if eval $compile_ok; then
11433                                         dflt=`try`
11434                                 else
11435                                         dflt='?'
11436                                         echo "(I can't seem to compile the test program...)"
11437                                 fi
11438                                 ;;
11439                         *)
11440                                 dflt="$randbits"
11441                                 ;;
11442                         esac
11443                         rp="How many bits does your $randfunc() function produce?"
11444                         . ./myread
11445                         randbits="$ans"
11446                         $rm -f try.c try
11447                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11448                         seedfunc="s$randfunc"
11449                         randseedtype=unsigned
11450                         ;;
11451                 *)
11452                         dflt="31"
11453                         rp="How many bits does your $randfunc() function produce?"
11454                         . ./myread
11455                         randbits="$ans"
11456                         seedfunc="s$randfunc"
11457                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11458                         if set $seedfunc val -f; eval $csym; $val; then
11459                                 echo "(Using $seedfunc() to seed random generator)"
11460                         else
11461                                 echo "(Warning: no $seedfunc() to seed random generator)"
11462                                 seedfunc=rand
11463                         fi
11464                         randseedtype=unsigned
11465                         ;;
11466                 esac
11467                 ;;
11468         esac
11469 done
11470
11471 echo " "
11472 echo "Determining whether or not we are on an EBCDIC system..." >&4
11473 $cat >tebcdic.c <<'EOM'
11474 int main()
11475 {
11476   if ('M'==0xd4) return 0;
11477   return 1;
11478 }
11479 EOM
11480
11481 val=$undef
11482 set tebcdic
11483 if eval $compile_ok; then
11484         if ./tebcdic; then
11485                 echo "You have EBCDIC." >&4
11486                 val="$define"
11487         else
11488                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11489         fi
11490 else
11491         echo "I'm unable to compile the test program." >&4
11492         echo "I'll assume ASCII or some ISO Latin." >&4
11493 fi
11494 $rm -f tebcdic.c tebcdic
11495 set ebcdic
11496 eval $setvar
11497
11498 echo " "
11499 $cat >&4 <<EOM
11500 Checking how to flush all pending stdio output...
11501 EOM
11502 # I only know how to find the first 32 possibly open files on SunOS.
11503 # See also hints/sunos_4_1.sh and util.c  --AD
11504 case "$osname" in
11505 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11506 esac
11507 $cat >>try.c <<EOCP
11508 #include <stdio.h>
11509 #$i_unistd I_UNISTD
11510 #ifdef I_UNISTD
11511 # include <unistd.h>
11512 #endif
11513 #$d_sysconf HAS_SYSCONF
11514 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11515 #ifdef HAS_STDIO_STREAM_ARRAY
11516 # define STDIO_STREAM_ARRAY $stdio_stream_array
11517 #endif
11518 int main() {
11519   FILE* p = fopen("try.out", "w");
11520 #ifdef TRY_FPUTC
11521   fputc('x', p);
11522 #else
11523 # ifdef TRY_FPRINTF
11524   fprintf(p, "x");
11525 # endif
11526 #endif
11527 #ifdef TRY_FFLUSH_NULL
11528   fflush(NULL);
11529 #endif
11530 #ifdef TRY_FFLUSH_ALL
11531   {
11532     long open_max = -1;
11533 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11534     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11535 # else
11536 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11537     open_max = sysconf(_SC_OPEN_MAX);
11538 #  else
11539 #   ifdef FOPEN_MAX
11540     open_max = FOPEN_MAX;
11541 #   else
11542 #    ifdef OPEN_MAX
11543     open_max = OPEN_MAX;
11544 #    else
11545 #     ifdef _NFILE
11546     open_max = _NFILE;
11547 #     endif
11548 #    endif
11549 #   endif
11550 #  endif
11551 # endif 
11552 # ifdef HAS_STDIO_STREAM_ARRAY
11553     if (open_max > 0) {
11554       long i;
11555       for (i = 0; i < open_max; i++)
11556             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11557                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11558                 STDIO_STREAM_ARRAY[i]._flag)
11559                 fflush(&STDIO_STREAM_ARRAY[i]);
11560     }   
11561   }
11562 # endif
11563 #endif
11564   _exit(42);
11565 }
11566 EOCP
11567 : first we have to find out how _not_ to flush
11568 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11569     output=''
11570     set try -DTRY_FPUTC
11571     if eval $compile; then
11572             $rm -f try.out
11573             ./try$exe_ext 2>/dev/null
11574             if $test ! -s try.out -a "X$?" = X42; then
11575                 output=-DTRY_FPUTC
11576             fi
11577     fi
11578     case "$output" in
11579     '')
11580             set try -DTRY_FPRINTF
11581             $rm -f try.out
11582             if eval $compile; then
11583                     $rm -f try.out
11584                     ./try$exe_ext 2>/dev/null
11585                     if $test ! -s try.out -a "X$?" = X42; then
11586                         output=-DTRY_FPRINTF
11587                     fi
11588             fi
11589         ;;
11590     esac
11591 fi
11592 : check for fflush NULL behaviour
11593 case "$fflushNULL" in
11594 '')     set try -DTRY_FFLUSH_NULL $output
11595         if eval $compile; then
11596                 $rm -f try.out
11597                 ./try$exe_ext 2>/dev/null
11598                 code="$?"
11599                 if $test -s try.out -a "X$code" = X42; then
11600                         fflushNULL="`$cat try.out`"
11601                 else
11602                         if $test "X$code" != X42; then
11603                                 $cat >&4 <<EOM
11604 (If this test failed, don't worry, we'll try another method shortly.)
11605 EOM
11606                         fi
11607                 fi
11608         fi
11609         $rm -f core try.core core.try.*
11610         case "$fflushNULL" in
11611         x)      $cat >&4 <<EOM
11612 Your fflush(NULL) works okay.
11613 EOM
11614                 fflushNULL="$define"
11615                 ;;
11616         '')     $cat >&4 <<EOM
11617 Your fflush(NULL) isn't working (contrary to ANSI C).
11618 EOM
11619                 fflushNULL="$undef"
11620                 ;;
11621         *)      $cat >&4 <<EOM
11622 Cannot figure out whether your fflush(NULL) works or not.
11623 I'm assuming it doesn't (contrary to ANSI C).
11624 EOM
11625                 fflushNULL="$undef"
11626                 ;;
11627         esac
11628         ;;
11629 $define|true|[yY]*)
11630         fflushNULL="$define"
11631         ;;
11632 *)
11633         fflushNULL="$undef"
11634         ;;
11635 esac
11636 : check explicit looping only if NULL did not work
11637 case "$fflushNULL" in
11638 "$undef")
11639         : check for fflush all behaviour
11640         case "$fflushall" in
11641         '')     set try -DTRY_FFLUSH_ALL $output
11642                 if eval $compile; then
11643                         $cat >&4 <<EOM
11644 (Now testing the other method--but note that also this may fail.)
11645 EOM
11646                         $rm -f try.out
11647                         ./try$exe_ext 2>/dev/null
11648                         if $test -s try.out -a "X$?" = X42; then
11649                                 fflushall="`$cat try.out`"
11650                         fi
11651                 fi
11652                 $rm -f core try.core core.try.*
11653                 case "$fflushall" in
11654                 x)      $cat >&4 <<EOM
11655 Whew. Flushing explicitly all the stdio streams works.
11656 EOM
11657                         fflushall="$define"
11658                         ;;
11659                 '')     $cat >&4 <<EOM
11660 Sigh. Flushing explicitly all the stdio streams doesn't work.
11661 EOM
11662                         fflushall="$undef"
11663                         ;;
11664                 *)      $cat >&4 <<EOM
11665 Cannot figure out whether flushing stdio streams explicitly works or not.
11666 I'm assuming it doesn't.
11667 EOM
11668                         fflushall="$undef"
11669                         ;;
11670                 esac
11671                 ;;
11672         "$define"|true|[yY]*)
11673                 fflushall="$define"
11674                 ;;
11675         *)
11676                 fflushall="$undef"
11677                 ;;
11678         esac
11679         ;;
11680 *)      fflushall="$undef"      
11681         ;;
11682 esac
11683 case "$fflushNULL$fflushall" in
11684 undefundef)
11685         $cat <<EOM
11686 I cannot figure out how to flush pending stdio output.
11687 EOM
11688         ;;
11689 esac
11690 $rm -f try.* try$exe_ext
11691
11692 : see what type file positions are declared as in the library
11693 rp="What is the type for file position used by fsetpos()?"
11694 set fpos_t fpostype long stdio.h sys/types.h
11695 eval $typedef_ask
11696
11697 : Store the full pathname to the ar program for use in the C program
11698 : Respect a hint or command line value for full_ar.
11699 case "$full_ar" in
11700 '') full_ar=$ar ;;
11701 esac
11702
11703 : Store the full pathname to the sed program for use in the C program
11704 full_sed=$sed
11705
11706 : see what type gids are declared as in the kernel
11707 echo " "
11708 echo "Looking for the type for group ids returned by getgid()."
11709 set gid_t gidtype xxx stdio.h sys/types.h
11710 eval $typedef
11711 case "$gidtype" in
11712 xxx)
11713         xxx=`./findhdr sys/user.h`
11714         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11715         case $1 in
11716         unsigned) dflt="$1 $2" ;;
11717         *) dflt="$1" ;;
11718         esac
11719         ;;
11720 *) dflt="$gidtype";;
11721 esac
11722 case "$gidtype" in
11723 gid_t) echo "gid_t found." ;;
11724 *)      rp="What is the type for group ids returned by getgid()?"
11725         . ./myread
11726         gidtype="$ans"
11727         ;;
11728 esac
11729
11730 : see if getgroups exists
11731 set getgroups d_getgrps
11732 eval $inlibc
11733
11734 : see if setgroups exists
11735 set setgroups d_setgrps
11736 eval $inlibc
11737
11738
11739 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11740 echo " "
11741 case "$d_getgrps$d_setgrps" in
11742 *define*)
11743         case "$groupstype" in
11744         '') dflt="$gidtype" ;;
11745         *)  dflt="$groupstype" ;;
11746         esac
11747         $cat <<EOM
11748 What type of pointer is the second argument to getgroups() and setgroups()?
11749 Usually this is the same as group ids, $gidtype, but not always.
11750
11751 EOM
11752         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11753         . ./myread
11754         groupstype="$ans"
11755         ;;
11756 *)  groupstype="$gidtype";;
11757 esac
11758
11759 : see what type lseek is declared as in the kernel
11760 rp="What is the type used for lseek's offset on this system?"
11761 set off_t lseektype long stdio.h sys/types.h
11762 eval $typedef_ask
11763
11764 echo " "
11765 $echo $n "Checking to see how big your file offsets are...$c" >&4
11766 $cat >try.c <<EOCP
11767 #include <sys/types.h>
11768 #include <stdio.h>
11769 int main()
11770 {
11771         printf("%d\n", sizeof($lseektype));
11772 }
11773 EOCP
11774 set try
11775 if eval $compile_ok; then
11776         lseeksize=`./try`
11777         $echo " $lseeksize bytes." >&4
11778 else
11779         dflt='4'
11780         echo " "
11781         echo "(I can't seem to compile the test program.  Guessing...)"
11782         rp="What is the size of your file offsets (in bytes)?"
11783         . ./myread
11784         lseeksize="$ans"
11785 fi
11786 $rm -f try.c try
11787
11788 echo " "
11789 echo "Checking if your $make program sets \$(MAKE)..." >&4
11790 case "$make_set_make" in
11791 '')
11792         $sed 's/^X //' > testmake.mak << 'EOF'
11793 Xall:
11794 X       @echo 'maketemp="$(MAKE)"'
11795 EOF
11796         case "`$make -f testmake.mak 2>/dev/null`" in
11797         *maketemp=*) make_set_make='#' ;;
11798         *)      make_set_make="MAKE=$make" ;;
11799         esac
11800         $rm -f testmake.mak
11801         ;;
11802 esac
11803 case "$make_set_make" in
11804 '#') echo "Yup, it does.";;
11805 *) echo "Nope, it doesn't.";;
11806 esac
11807
11808 : see what type is used for mode_t
11809 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11810 set mode_t modetype int stdio.h sys/types.h
11811 eval $typedef_ask
11812
11813 : define a fucntion to check prototypes
11814 $cat > protochk <<EOSH
11815 $startsh
11816 cc="$cc"
11817 optimize="$optimize"
11818 ccflags="$ccflags"
11819 prototype="$prototype"
11820 define="$define"
11821 rm=$rm
11822 EOSH
11823
11824 $cat >> protochk <<'EOSH'
11825
11826 $rm -f try.c
11827 foo="$1"
11828 shift
11829 while test $# -ge 2; do
11830         case "$1" in
11831                 $define) echo "#include <$2>" >> try.c ;;
11832                 literal) echo "$2" >> try.c ;;
11833         esac
11834     shift 2
11835 done
11836 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11837 cat >> try.c <<'EOCP'
11838 #ifdef CAN_PROTOTYPE
11839 #define _(args) args
11840 #else
11841 #define _(args) ()
11842 #endif
11843 EOCP
11844 echo "$foo" >> try.c
11845 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11846 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11847 status=$?
11848 $rm -f try.[co]
11849 exit $status
11850 EOSH
11851 chmod +x protochk
11852 $eunicefix protochk
11853
11854 : see what type is used for size_t
11855 rp="What is the type used for the length parameter for string functions?"
11856 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11857 eval $typedef_ask
11858
11859 : check for type of arguments to gethostbyaddr. 
11860 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11861         case "$d_gethbyaddr" in
11862         $define)
11863                 $cat <<EOM
11864
11865 Checking to see what type of arguments are accepted by gethostbyaddr().
11866 EOM
11867                 hdrs="$define sys/types.h
11868                         $d_socket sys/socket.h 
11869                         $i_niin netinet/in.h 
11870                         $i_netdb netdb.h
11871                         $i_unistd unistd.h"
11872                 : The first arg can 'char *' or 'void *'
11873                 : The second arg is some of integral type
11874                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11875                         for yyy in size_t long int; do
11876                                 case "$netdb_host_type" in
11877                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11878                                         if ./protochk "$try" $hdrs; then
11879                                                 echo "Your system accepts $xxx for the first arg."
11880                                                 echo "...and $yyy for the second arg."
11881                                                 netdb_host_type="$xxx"
11882                                                 netdb_hlen_type="$yyy"
11883                                         fi
11884                                         ;;
11885                                 esac
11886                         done
11887                 done
11888                 : In case none of those worked, prompt the user.
11889                 case "$netdb_host_type" in
11890                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11891                         dflt='char *'
11892                         . ./myread
11893                         netdb_host_type=$ans
11894                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11895                         dflt="$sizetype"
11896                         . ./myread
11897                         netdb_hlen_type=$ans
11898                         ;;
11899                 esac
11900                 ;;
11901         *)      : no gethostbyaddr, so pick harmless defaults
11902                 netdb_host_type='char *'
11903                 netdb_hlen_type="$sizetype"
11904                 ;;
11905         esac
11906         # Remove the "const" if needed. -- but then we'll have a 
11907         # prototype clash!
11908         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11909 fi
11910
11911 : check for type of argument to gethostbyname. 
11912 if test "X$netdb_name_type" = X ; then
11913         case "$d_gethbyname" in
11914         $define)
11915                 $cat <<EOM
11916
11917 Checking to see what type of argument is accepted by gethostbyname().
11918 EOM
11919                 hdrs="$define sys/types.h
11920                         $d_socket sys/socket.h 
11921                         $i_niin netinet/in.h 
11922                         $i_netdb netdb.h
11923                         $i_unistd unistd.h"
11924                 for xxx in "const char *" "char *"; do
11925                         case "$netdb_name_type" in
11926                         '')     try="extern struct hostent *gethostbyname($xxx);"
11927                                 if ./protochk "$try" $hdrs; then
11928                                         echo "Your system accepts $xxx."
11929                                         netdb_name_type="$xxx"
11930                                 fi
11931                                 ;;
11932                         esac
11933                 done
11934                 : In case none of those worked, prompt the user.
11935                 case "$netdb_name_type" in
11936                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11937                         dflt='char *'
11938                         . ./myread
11939                         netdb_name_type=$ans
11940                         ;;
11941                 esac
11942                 ;;
11943         *)      : no gethostbyname, so pick harmless default
11944                 netdb_name_type='char *'
11945                 ;;
11946         esac
11947 fi
11948
11949 : check for type of 1st argument to getnetbyaddr. 
11950 if test "X$netdb_net_type" = X ; then
11951         case "$d_getnbyaddr" in
11952         $define)
11953                 $cat <<EOM
11954
11955 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11956 EOM
11957                 hdrs="$define sys/types.h
11958                         $d_socket sys/socket.h 
11959                         $i_niin netinet/in.h 
11960                         $i_netdb netdb.h
11961                         $i_unistd unistd.h"
11962                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11963                         case "$netdb_net_type" in
11964                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11965                                 if ./protochk "$try" $hdrs; then
11966                                         echo "Your system accepts $xxx."
11967                                         netdb_net_type="$xxx"
11968                                 fi
11969                                 ;;
11970                         esac
11971                 done
11972                 : In case none of those worked, prompt the user.
11973                 case "$netdb_net_type" in
11974                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11975                         dflt='long'
11976                         . ./myread
11977                         netdb_net_type=$ans
11978                         ;;
11979                 esac
11980                 ;;
11981         *)      : no getnetbyaddr, so pick harmless default
11982                 netdb_net_type='long'
11983                 ;;
11984         esac
11985 fi
11986 : locate the preferred pager for this system
11987 case "$pager" in
11988 '')
11989         dflt=''
11990         case "$pg" in
11991         /*) dflt=$pg;;
11992         esac
11993         case "$more" in
11994         /*) dflt=$more;;
11995         esac
11996         case "$less" in
11997         /*) dflt=$less;;
11998         esac
11999         case "$dflt" in
12000         '') dflt=/usr/ucb/more;;
12001         esac
12002         ;;
12003 *) dflt="$pager";;
12004 esac
12005 echo " "
12006 fn=f/
12007 rp='What pager is used on your system?'
12008 . ./getfile
12009 pager="$ans"
12010
12011 : see what type pids are declared as in the kernel
12012 rp="What is the type of process ids on this system?"
12013 set pid_t pidtype int stdio.h sys/types.h
12014 eval $typedef_ask
12015
12016 : check for length of pointer
12017 echo " "
12018 case "$ptrsize" in
12019 '')
12020         $echo $n "Checking to see how big your pointers are...$c" >&4
12021         if test "$voidflags" -gt 7; then
12022                 echo '#define VOID_PTR char *' > try.c
12023         else
12024                 echo '#define VOID_PTR void *' > try.c
12025         fi
12026         $cat >>try.c <<'EOCP'
12027 #include <stdio.h>
12028 int main()
12029 {
12030         printf("%d\n", sizeof(VOID_PTR));
12031         exit(0);
12032 }
12033 EOCP
12034         set try
12035         if eval $compile_ok; then
12036                 ptrsize=`./try`
12037                 $echo " $ptrsize bytes." >&4
12038         else
12039                 dflt='4'
12040                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12041                 rp="What is the size of a pointer (in bytes)?"
12042                 . ./myread
12043                 ptrsize="$ans"
12044         fi
12045         ;;
12046 esac
12047 $rm -f try.c try
12048
12049 : see if ar generates random libraries by itself
12050 echo " "
12051 echo "Checking how to generate random libraries on your machine..." >&4
12052 echo 'int bar1() { return bar2(); }' > bar1.c
12053 echo 'int bar2() { return 2; }' > bar2.c
12054 $cat > foo.c <<'EOP'
12055 int main() { printf("%d\n", bar1()); exit(0); }
12056 EOP
12057 $cc $ccflags -c bar1.c >/dev/null 2>&1
12058 $cc $ccflags -c bar2.c >/dev/null 2>&1
12059 $cc $ccflags -c foo.c >/dev/null 2>&1
12060 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12061 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12062         ./foobar >/dev/null 2>&1; then
12063         echo "$ar appears to generate random libraries itself."
12064         orderlib=false
12065         ranlib=":"
12066 elif $ar ts bar$_a >/dev/null 2>&1 &&
12067         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12068         ./foobar >/dev/null 2>&1; then
12069                 echo "a table of contents needs to be added with '$ar ts'."
12070                 orderlib=false
12071                 ranlib="$ar ts"
12072 else
12073         case "$ranlib" in
12074         :) ranlib='';;
12075         '')
12076                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12077                 $test -f $ranlib || ranlib=''
12078                 ;;
12079         esac
12080         if $test -n "$ranlib"; then
12081                 echo "your system has '$ranlib'; we'll use that."
12082                 orderlib=false
12083         else
12084                 echo "your system doesn't seem to support random libraries"
12085                 echo "so we'll use lorder and tsort to order the libraries."
12086                 orderlib=true
12087                 ranlib=":"
12088         fi
12089 fi
12090 $rm -f foo* bar* 
12091
12092 : check for type of arguments to select. 
12093 case "$selecttype" in
12094 '') case "$d_select" in
12095         $define)
12096                 $cat <<EOM
12097 Checking to see what type of arguments are accepted by select().
12098 EOM
12099                 hdrs="$define sys/types.h
12100                         $i_systime sys/time.h 
12101                         $i_sysselct sys/select.h
12102                         $d_socket sys/socket.h"
12103                 : The first arg can be int, unsigned, or size_t
12104                 : The last arg may or may not be 'const'
12105                 val=''
12106                 : void pointer has been seen but using that
12107                 : breaks the selectminbits test
12108                 for xxx in 'fd_set *' 'int *'; do
12109                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12110                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12111                                         case "$val" in
12112                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12113                                                 if ./protochk "$try" $hdrs; then
12114                                                         echo "Your system accepts $xxx."
12115                                                         val="$xxx"
12116                                                 fi
12117                                                 ;;
12118                                         esac
12119                                 done
12120                         done
12121                 done
12122                 case "$val" in
12123                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12124                         case "$d_fd_set" in
12125                                 $define) dflt="fd_set *" ;;
12126                                 *)              dflt="int *" ;;
12127                         esac
12128                         . ./myread
12129                         val=$ans
12130                         ;;
12131                 esac
12132                 selecttype="$val"
12133                 ;;
12134         *)      : no select, so pick a harmless default
12135                 selecttype='int *'
12136                 ;;
12137         esac
12138         ;;
12139 esac
12140
12141 : check for the select 'width'
12142 case "$selectminbits" in
12143 '') case "$d_select" in
12144         $define)
12145                 $cat <<EOM
12146
12147 Checking to see on how many bits at a time your select() operates...
12148 EOM
12149                 $cat >try.c <<EOCP
12150 #include <sys/types.h>
12151 #$i_time I_TIME
12152 #$i_systime I_SYS_TIME
12153 #$i_systimek I_SYS_TIME_KERNEL
12154 #ifdef I_TIME
12155 #   include <time.h>
12156 #endif
12157 #ifdef I_SYS_TIME
12158 #   ifdef I_SYS_TIME_KERNEL
12159 #       define KERNEL
12160 #   endif
12161 #   include <sys/time.h>
12162 #   ifdef I_SYS_TIME_KERNEL
12163 #       undef KERNEL
12164 #   endif
12165 #endif
12166 #$i_sysselct I_SYS_SELECT
12167 #ifdef I_SYS_SELECT
12168 #include <sys/select.h>
12169 #endif
12170 #$d_socket HAS_SOCKET
12171 #ifdef HAS_SOCKET
12172 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12173 #endif
12174 #include <stdio.h>
12175 $selecttype b;
12176 #define S sizeof(*(b))
12177 #define MINBITS 64
12178 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12179 #define NBITS  (NBYTES * 8)
12180 int main() {
12181     char s[NBYTES];
12182     struct timeval t;
12183     int i;
12184     FILE* fp;
12185     int fd;
12186
12187     fclose(stdin);
12188     fp = fopen("try.c", "r");
12189     if (fp == 0)
12190       exit(1);
12191     fd = fileno(fp);
12192     if (fd < 0)
12193       exit(2);
12194     b = ($selecttype)s;
12195     for (i = 0; i < NBITS; i++)
12196         FD_SET(i, b);
12197     t.tv_sec  = 0;
12198     t.tv_usec = 0;
12199     select(fd + 1, b, 0, 0, &t);
12200     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12201     printf("%d\n", i + 1);
12202     return 0;
12203 }
12204 EOCP
12205                 set try
12206                 if eval $compile_ok; then
12207                         selectminbits=`./try`
12208                         case "$selectminbits" in
12209                         '')     cat >&4 <<EOM
12210 Cannot figure out on how many bits at a time your select() operates.
12211 I'll play safe and guess it is 32 bits.
12212 EOM
12213                                 selectminbits=32
12214                                 bits="32 bits"
12215                                 ;;
12216                         1)      bits="1 bit" ;;
12217                         *)      bits="$selectminbits bits" ;;
12218                         esac
12219                         echo "Your select() operates on $bits at a time." >&4
12220                 else
12221                         rp='What is the minimum number of bits your select() operates on?'
12222                         case "$byteorder" in
12223                         1234|12345678)  dflt=32 ;;
12224                         *)              dflt=1  ;;
12225                         esac
12226                         . ./myread
12227                         val=$ans
12228                         selectminbits="$val"
12229                 fi
12230                 $rm -f try.* try
12231                 ;;
12232         *)      : no select, so pick a harmless default
12233                 selectminbits='32'
12234                 ;;
12235         esac
12236         ;;
12237 esac
12238
12239 : Trace out the files included by signal.h, then look for SIGxxx names.
12240 : Remove SIGARRAYSIZE used by HPUX.
12241 : Remove SIGSTKSIZE used by Linux.
12242 : Remove SIGSTKSZ used by Posix.
12243 : Remove SIGTYP void lines used by OS2.
12244 xxx=`echo '#include <signal.h>' |
12245         $cppstdin $cppminus $cppflags 2>/dev/null |
12246         $grep '^[       ]*#.*include' | 
12247         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12248 : Check this list of files to be sure we have parsed the cpp output ok.
12249 : This will also avoid potentially non-existent files, such 
12250 : as ../foo/bar.h
12251 xxxfiles=''
12252 for xx in $xxx /dev/null ; do
12253         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12254 done
12255 : If we have found no files, at least try signal.h
12256 case "$xxxfiles" in
12257 '')     xxxfiles=`./findhdr signal.h` ;;
12258 esac
12259 xxx=`awk '
12260 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12261         print substr($2, 4, 20)
12262 }
12263 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12264         print substr($3, 4, 20)
12265 }' $xxxfiles`
12266 : Append some common names just in case the awk scan failed.
12267 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12268 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12269 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12270 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12271 : generate a few handy files for later
12272 $cat > signal.c <<'EOCP'
12273 #include <sys/types.h>
12274 #include <signal.h>
12275 #include <stdio.h>
12276 int main() {
12277
12278 /* Strange style to avoid deeply-nested #if/#else/#endif */
12279 #ifndef NSIG
12280 #  ifdef _NSIG
12281 #    define NSIG (_NSIG)
12282 #  endif
12283 #endif
12284
12285 #ifndef NSIG
12286 #  ifdef SIGMAX
12287 #    define NSIG (SIGMAX+1)
12288 #  endif
12289 #endif
12290
12291 #ifndef NSIG
12292 #  ifdef SIG_MAX
12293 #    define NSIG (SIG_MAX+1)
12294 #  endif
12295 #endif
12296
12297 #ifndef NSIG
12298 #  ifdef MAXSIG
12299 #    define NSIG (MAXSIG+1)
12300 #  endif
12301 #endif
12302
12303 #ifndef NSIG
12304 #  ifdef MAX_SIG
12305 #    define NSIG (MAX_SIG+1)
12306 #  endif
12307 #endif
12308
12309 #ifndef NSIG
12310 #  ifdef SIGARRAYSIZE
12311 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12312 #  endif
12313 #endif
12314
12315 #ifndef NSIG
12316 #  ifdef _sys_nsig
12317 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12318 #  endif
12319 #endif
12320
12321 /* Default to some arbitrary number that's big enough to get most
12322    of the common signals.
12323 */
12324 #ifndef NSIG
12325 #    define NSIG 50
12326 #endif
12327
12328 printf("NSIG %d\n", NSIG);
12329
12330 #ifndef JUST_NSIG
12331
12332 EOCP
12333
12334 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12335 {
12336         printf "#ifdef SIG"; printf $1; printf "\n"
12337         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12338         printf $1; printf ");\n"
12339         printf "#endif\n"
12340 }
12341 END {
12342         printf "#endif /* JUST_NSIG */\n";
12343         printf "}\n";
12344 }
12345 ' >>signal.c
12346 $cat >signal.awk <<'EOP'
12347 BEGIN { ndups = 0 }
12348 $1 ~ /^NSIG$/ { nsig = $2 }
12349 ($1 !~ /^NSIG$/) && (NF == 2) {
12350     if ($2 > maxsig) { maxsig = $2 }
12351     if (sig_name[$2]) {
12352         dup_name[ndups] = $1
12353         dup_num[ndups] = $2
12354         ndups++ 
12355     }
12356     else {
12357         sig_name[$2] = $1
12358         sig_num[$2] = $2
12359     }
12360 }
12361 END { 
12362     if (nsig == 0) {
12363         nsig = maxsig + 1
12364     }
12365     printf("NSIG %d\n", nsig);
12366     for (n = 1; n < nsig; n++) {
12367         if (sig_name[n]) {
12368             printf("%s %d\n", sig_name[n], sig_num[n])
12369         }
12370         else {
12371             printf("NUM%d %d\n", n, n) 
12372         }
12373     }
12374     for (n = 0; n < ndups; n++) {
12375         printf("%s %d\n", dup_name[n], dup_num[n])
12376     }
12377 }
12378 EOP
12379 $cat >signal_cmd <<EOS
12380 $startsh
12381 if $test -s signal.lst; then
12382     echo "Using your existing signal.lst file"
12383         exit 0
12384 fi
12385 xxx="$xxx"
12386 EOS
12387 $cat >>signal_cmd <<'EOS'
12388
12389 set signal
12390 if eval $compile_ok; then
12391         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12392 else
12393         echo "(I can't seem be able to compile the whole test program)" >&4
12394         echo "(I'll try it in little pieces.)" >&4
12395         set signal -DJUST_NSIG
12396         if eval $compile_ok; then
12397                 ./signal$_exe > signal.nsg
12398                 $cat signal.nsg
12399         else
12400                 echo "I can't seem to figure out how many signals you have." >&4
12401                 echo "Guessing 50." >&4
12402                 echo 'NSIG 50' > signal.nsg
12403         fi
12404         : Now look at all the signal names, one at a time.
12405         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12406                 $cat > signal.c <<EOCP
12407 #include <sys/types.h>
12408 #include <signal.h>
12409 #include <stdio.h>
12410 int main() {
12411 printf("$xx %d\n", SIG${xx});
12412 return 0;
12413 }
12414 EOCP
12415                 set signal
12416                 if eval $compile; then
12417                         echo "SIG${xx} found."
12418                         ./signal$_exe  >> signal.ls1
12419                 else
12420                         echo "SIG${xx} NOT found."
12421                 fi
12422         done
12423         if $test -s signal.ls1; then
12424                 $cat signal.nsg signal.ls1 |
12425                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12426         fi
12427
12428 fi
12429 if $test -s signal.lst; then
12430         :
12431 else
12432         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12433         echo 'kill -l' >signal
12434         set X `csh -f <signal`
12435         $rm -f signal
12436         shift
12437         case $# in
12438         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12439         esac
12440         echo $@ | $tr ' ' $trnl | \
12441             $awk '{ printf "%s %d\n", $1, ++s; }
12442                   END { printf "NSIG %d\n", ++s }' >signal.lst
12443 fi
12444 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12445 EOS
12446 chmod a+x signal_cmd
12447 $eunicefix signal_cmd
12448
12449 : generate list of signal names
12450 echo " "
12451 case "$sig_name_init" in
12452 '') doinit=yes ;;
12453 *)  case "$sig_num_init" in
12454     ''|*,*) doinit=yes ;;
12455     esac ;;
12456 esac
12457 case "$doinit" in
12458 yes)
12459         echo "Generating a list of signal names and numbers..." >&4
12460         . ./signal_cmd
12461         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12462         sig_name=`$awk 'BEGIN { printf "ZERO " }
12463                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12464         sig_num=`$awk  'BEGIN { printf "0 " }
12465                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12466         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12467                              !/^NSIG/   { printf "\"%s\", ", $1 }
12468                              END        { printf "0\n" }' signal.lst`
12469         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12470                              !/^NSIG/   { printf "%d, ", $2}
12471                              END        { printf "0\n"}' signal.lst`
12472         ;;
12473 esac
12474 echo "The following $sig_count signals are available:"
12475 echo " "
12476 echo $sig_name | $awk \
12477 'BEGIN { linelen = 0 }
12478 {
12479         for (i = 1; i <= NF; i++) {
12480                 name = "SIG" $i " "
12481                 linelen = linelen + length(name)
12482                 if (linelen > 70) {
12483                         printf "\n"
12484                         linelen = length(name)
12485                 }
12486                 printf "%s", name
12487         }
12488         printf "\n"
12489 }'
12490 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12491
12492 : see what type is used for signed size_t
12493 set ssize_t ssizetype int stdio.h sys/types.h
12494 eval $typedef
12495 dflt="$ssizetype"
12496 $cat > ssize.c <<EOM
12497 #include <stdio.h>
12498 #include <sys/types.h>
12499 #define Size_t $sizetype
12500 #define SSize_t $dflt
12501 int main()
12502 {
12503         if (sizeof(Size_t) == sizeof(SSize_t))
12504                 printf("$dflt\n");
12505         else if (sizeof(Size_t) == sizeof(int))
12506                 printf("int\n");
12507         else 
12508                 printf("long\n");
12509         exit(0);
12510 }
12511 EOM
12512 echo " "
12513 set ssize
12514 if eval $compile_ok && ./ssize > /dev/null; then
12515         ssizetype=`./ssize`
12516         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12517 else
12518         $cat >&4 <<EOM
12519 Help! I can't compile and run the ssize_t test program: please enlighten me!
12520 (This is probably a misconfiguration in your system or libraries, and
12521 you really ought to fix it.  Still, I'll try anyway.)
12522
12523 I need a type that is the same size as $sizetype, but is guaranteed to
12524 be signed.  Common values are ssize_t, int and long.
12525
12526 EOM
12527         rp="What signed type is the same size as $sizetype?"
12528         . ./myread
12529         ssizetype="$ans"
12530 fi
12531 $rm -f ssize ssize.*
12532
12533 : see what type of char stdio uses.
12534 echo " "
12535 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12536         echo "Your stdio uses unsigned chars." >&4
12537         stdchar="unsigned char"
12538 else
12539         echo "Your stdio uses signed chars." >&4
12540         stdchar="char"
12541 fi
12542
12543 : see if time exists
12544 echo " "
12545 if test "X$d_time" = X -o X"$timetype" = X; then
12546     if set time val -f d_time; eval $csym; $val; then
12547                 echo 'time() found.' >&4
12548                 val="$define"
12549                 rp="What is the type returned by time() on this system?"
12550                 set time_t timetype long stdio.h sys/types.h
12551                 eval $typedef_ask
12552     else
12553                 echo 'time() not found, hope that will do.' >&4
12554                 val="$undef"
12555                 timetype='int';
12556     fi
12557     set d_time
12558     eval $setvar
12559 fi
12560
12561 : see what type uids are declared as in the kernel
12562 echo " "
12563 echo "Looking for the type for user ids returned by getuid()."
12564 set uid_t uidtype xxx stdio.h sys/types.h
12565 eval $typedef
12566 case "$uidtype" in
12567 xxx)
12568         xxx=`./findhdr sys/user.h`
12569         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12570         case $1 in
12571         unsigned) dflt="$1 $2" ;;
12572         *) dflt="$1" ;;
12573         esac
12574         ;;
12575 *) dflt="$uidtype";;
12576 esac
12577 case "$uidtype" in
12578 uid_t)  echo "uid_t found." ;;
12579 *)      rp="What is the type for user ids returned by getuid()?"
12580         . ./myread
12581         uidtype="$ans"
12582         ;;
12583 esac
12584
12585 : see if dbm.h is available
12586 : see if dbmclose exists
12587 set dbmclose d_dbmclose
12588 eval $inlibc
12589
12590 case "$d_dbmclose" in
12591 $define)
12592         set dbm.h i_dbm
12593         eval $inhdr
12594         case "$i_dbm" in
12595         $define)
12596                 val="$undef"
12597                 set i_rpcsvcdbm
12598                 eval $setvar
12599                 ;;
12600         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12601                 eval $inhdr
12602                 ;;
12603         esac
12604         ;;
12605 *)      echo "We won't be including <dbm.h>"
12606         val="$undef"
12607         set i_dbm
12608         eval $setvar
12609         val="$undef"
12610         set i_rpcsvcdbm
12611         eval $setvar
12612         ;;
12613 esac
12614
12615 : see if this is a sys/file.h system
12616 val=''
12617 set sys/file.h val
12618 eval $inhdr
12619
12620 : do we need to include sys/file.h ?
12621 case "$val" in
12622 "$define")
12623         echo " "
12624         if $h_sysfile; then
12625                 val="$define"
12626                 echo "We'll be including <sys/file.h>." >&4
12627         else
12628                 val="$undef"
12629                 echo "We won't be including <sys/file.h>." >&4
12630         fi
12631         ;;
12632 *)
12633         h_sysfile=false
12634         ;;
12635 esac
12636 set i_sysfile
12637 eval $setvar
12638
12639 : see if fcntl.h is there
12640 val=''
12641 set fcntl.h val
12642 eval $inhdr
12643
12644 : see if we can include fcntl.h
12645 case "$val" in
12646 "$define")
12647         echo " "
12648         if $h_fcntl; then
12649                 val="$define"
12650                 echo "We'll be including <fcntl.h>." >&4
12651         else
12652                 val="$undef"
12653                 if $h_sysfile; then
12654         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12655                 else
12656                         echo "We won't be including <fcntl.h>." >&4
12657                 fi
12658         fi
12659         ;;
12660 *)
12661         h_fcntl=false
12662         val="$undef"
12663         ;;
12664 esac
12665 set i_fcntl
12666 eval $setvar
12667
12668 : see if locale.h is available
12669 set locale.h i_locale
12670 eval $inhdr
12671
12672 : see if mach cthreads are available
12673 if test "X$usethreads" = "X$define"; then
12674         set mach/cthreads.h i_machcthr
12675         eval $inhdr
12676 else
12677         i_machcthr="$undef"
12678 fi
12679
12680
12681
12682 : see if this is a math.h system
12683 set math.h i_math
12684 eval $inhdr
12685
12686 : see if this is a mntent.h system
12687 set mntent.h i_mntent
12688 eval $inhdr
12689
12690 : see if ndbm.h is available
12691 set ndbm.h t_ndbm
12692 eval $inhdr
12693 case "$t_ndbm" in
12694 $define)
12695         : see if dbm_open exists
12696         set dbm_open d_dbm_open
12697         eval $inlibc
12698         case "$d_dbm_open" in
12699         $undef)
12700                 t_ndbm="$undef"
12701                 echo "We won't be including <ndbm.h>"
12702                 ;;
12703         esac
12704         ;;
12705 esac
12706 val="$t_ndbm"
12707 set i_ndbm
12708 eval $setvar
12709
12710 : see if net/errno.h is available
12711 val=''
12712 set net/errno.h val
12713 eval $inhdr
12714
12715 : Unfortunately, it causes problems on some systems.  Arrgh.
12716 case "$val" in
12717 $define)
12718         cat > try.c <<'EOM'
12719 #include <stdio.h>
12720 #include <errno.h>
12721 #include <net/errno.h>
12722 int func()
12723 {
12724         return ENOTSOCK;
12725 }
12726 EOM
12727         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12728                 echo "We'll be including <net/errno.h>." >&4
12729         else
12730                 echo "We won't be including <net/errno.h>." >&4
12731                 val="$undef"
12732         fi
12733         $rm -f try.* try
12734         ;;
12735 esac
12736 set i_neterrno
12737 eval $setvar
12738
12739 : see if netinet/tcp.h is available
12740 set netinet/tcp.h i_netinettcp
12741 eval $inhdr
12742
12743 : see if this is a poll.h system
12744 set poll.h i_poll
12745 eval $inhdr
12746
12747 : get C preprocessor symbols handy
12748 echo " "
12749 $echo $n "Hmm... $c"
12750 echo $al | $tr ' ' $trnl >Cppsym.know
12751 $cat <<EOSS >Cppsym
12752 $startsh
12753 case "\$1" in
12754 -l) list=true
12755         shift
12756         ;;
12757 esac
12758 unknown=''
12759 case "\$list\$#" in
12760 1|2)
12761         for sym do
12762                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12763                         exit 0
12764                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12765                         :
12766                 else
12767                         unknown="\$unknown \$sym"
12768                 fi
12769         done
12770         set X \$unknown
12771         shift
12772         ;;
12773 esac
12774 case \$# in
12775 0) exit 1;;
12776 esac
12777 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12778 #ifdef \1\\
12779 exit 0; _ _ _ _\1\\      \1\\
12780 #endif\\
12781 /' >Cppsym\$\$
12782 echo "exit 1; _ _ _" >>Cppsym\$\$
12783 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12784 case "\$list" in
12785 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12786 *)
12787         sh Cppsym2\$\$
12788         status=\$?
12789         ;;
12790 esac
12791 $rm -f Cppsym\$\$ Cppsym2\$\$
12792 exit \$status
12793 EOSS
12794 chmod +x Cppsym
12795 $eunicefix Cppsym
12796 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12797
12798 : now check the C compiler for additional symbols
12799 postprocess_cc_v=''
12800 case "$osname" in
12801 aix) postprocess_cc_v="|$tr , ' '" ;;
12802 esac
12803 $cat >ccsym <<EOS
12804 $startsh
12805 $cat >tmp.c <<EOF
12806 extern int foo;
12807 EOF
12808 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12809 do
12810         case "\$i" in
12811         -D*) echo "\$i" | $sed 's/^-D//';;
12812         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12813         esac
12814 done
12815 $rm -f try.c
12816 EOS
12817 postprocess_cc_v=''
12818 chmod +x ccsym
12819 $eunicefix ccsym
12820 ./ccsym > ccsym1.raw
12821 if $test -s ccsym1.raw; then
12822        $sort ccsym1.raw | $uniq >ccsym.raw
12823 else
12824        mv ccsym1.raw ccsym.raw
12825 fi
12826
12827 $awk '/\=/ { print $0; next }
12828         { print $0"=1" }' ccsym.raw >ccsym.list
12829 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12830 $comm -13 ccsym.true ccsym.list >ccsym.own
12831 $comm -12 ccsym.true ccsym.list >ccsym.com
12832 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12833 also=''
12834 if $test -z ccsym.raw; then
12835         echo "Your C compiler doesn't seem to define any symbols!" >&4
12836         echo " "
12837         echo "However, your C preprocessor defines the following symbols:"
12838         $cat Cppsym.true
12839         ccsymbols=''
12840         cppsymbols=`$cat Cppsym.true`
12841         cppsymbols=`echo $cppsymbols`
12842         cppccsymbols="$cppsymbols"
12843 else
12844         if $test -s ccsym.com; then
12845                 echo "Your C compiler and pre-processor define these symbols:"
12846                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12847                 also='also '
12848                 symbols='ones'
12849                 cppccsymbols=`$cat ccsym.com`
12850                 cppccsymbols=`echo $cppccsymbols`
12851                 $test "$silent" || sleep 1
12852         fi
12853         if $test -s ccsym.cpp; then
12854                 $test "$also" && echo " "
12855                 echo "Your C pre-processor ${also}defines the following symbols:"
12856                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12857                 also='further '
12858                 cppsymbols=`$cat ccsym.cpp`
12859                 cppsymbols=`echo $cppsymbols`
12860                 $test "$silent" || sleep 1
12861         fi
12862         if $test -s ccsym.own; then
12863                 $test "$also" && echo " "
12864                 echo "Your C compiler ${also}defines the following cpp symbols:"
12865                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12866                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12867                 ccsymbols=`$cat ccsym.own`
12868                 ccsymbols=`echo $ccsymbols`
12869                 $test "$silent" || sleep 1
12870         fi
12871 fi
12872 $rm -f ccsym*
12873
12874 : see if this is a termio system
12875 val="$undef"
12876 val2="$undef"
12877 val3="$undef"
12878 if $test `./findhdr termios.h`; then
12879         set tcsetattr i_termios
12880         eval $inlibc
12881         val3="$i_termios"
12882 fi
12883 echo " "
12884 case "$val3" in
12885 "$define") echo "You have POSIX termios.h... good!" >&4;;
12886 *) if ./Cppsym pyr; then
12887                 case "`/bin/universe`" in
12888                 ucb) if $test `./findhdr sgtty.h`; then
12889                                 val2="$define"
12890                                 echo "<sgtty.h> found." >&4
12891                         else
12892                                 echo "System is pyramid with BSD universe."
12893                                 echo "<sgtty.h> not found--you could have problems." >&4
12894                         fi;;
12895                 *) if $test `./findhdr termio.h`; then
12896                                 val="$define"
12897                                 echo "<termio.h> found." >&4
12898                         else
12899                                 echo "System is pyramid with USG universe."
12900                                 echo "<termio.h> not found--you could have problems." >&4
12901                         fi;;
12902                 esac
12903         elif ./usg; then
12904                 if $test `./findhdr termio.h`; then
12905                         echo "<termio.h> found." >&4
12906                         val="$define"
12907                 elif $test `./findhdr sgtty.h`; then
12908                         echo "<sgtty.h> found." >&4
12909                         val2="$define"
12910                 else
12911 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12912                 fi
12913         else
12914                 if $test `./findhdr sgtty.h`; then
12915                         echo "<sgtty.h> found." >&4
12916                         val2="$define"
12917                 elif $test `./findhdr termio.h`; then
12918                         echo "<termio.h> found." >&4
12919                         val="$define"
12920                 else
12921 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12922                 fi
12923         fi;;
12924 esac
12925 set i_termio; eval $setvar
12926 val=$val2; set i_sgtty; eval $setvar
12927 val=$val3; set i_termios; eval $setvar
12928
12929 : see if this is a shadow.h system
12930 set shadow.h i_shadow
12931 eval $inhdr
12932
12933 : see if this is a socks.h system
12934 set socks.h i_socks
12935 eval $inhdr
12936
12937 : see if stdarg is available
12938 echo " "
12939 if $test `./findhdr stdarg.h`; then
12940         echo "<stdarg.h> found." >&4
12941         valstd="$define"
12942 else
12943         echo "<stdarg.h> NOT found." >&4
12944         valstd="$undef"
12945 fi
12946
12947 : see if varags is available
12948 echo " "
12949 if $test `./findhdr varargs.h`; then
12950         echo "<varargs.h> found." >&4
12951 else
12952         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12953 fi
12954
12955 : set up the varargs testing programs
12956 $cat > varargs.c <<EOP
12957 #ifdef I_STDARG
12958 #include <stdarg.h>
12959 #endif
12960 #ifdef I_VARARGS
12961 #include <varargs.h>
12962 #endif
12963
12964 #ifdef I_STDARG
12965 int f(char *p, ...)
12966 #else
12967 int f(va_alist)
12968 va_dcl
12969 #endif
12970 {
12971         va_list ap;
12972 #ifndef I_STDARG
12973         char *p;
12974 #endif
12975 #ifdef I_STDARG
12976         va_start(ap,p);
12977 #else
12978         va_start(ap);
12979         p = va_arg(ap, char *);
12980 #endif
12981         va_end(ap);
12982 }
12983 EOP
12984 $cat > varargs <<EOP
12985 $startsh
12986 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12987         echo "true"
12988 else
12989         echo "false"
12990 fi
12991 $rm -f varargs$_o
12992 EOP
12993 chmod +x varargs
12994
12995 : now check which varargs header should be included
12996 echo " "
12997 i_varhdr=''
12998 case "$valstd" in
12999 "$define")
13000         if `./varargs I_STDARG`; then
13001                 val='stdarg.h'
13002         elif `./varargs I_VARARGS`; then
13003                 val='varargs.h'
13004         fi
13005         ;;
13006 *)
13007         if `./varargs I_VARARGS`; then
13008                 val='varargs.h'
13009         fi
13010         ;;
13011 esac
13012 case "$val" in
13013 '')
13014 echo "I could not find the definition for va_dcl... You have problems..." >&4
13015         val="$undef"; set i_stdarg; eval $setvar
13016         val="$undef"; set i_varargs; eval $setvar
13017         ;;
13018 *) 
13019         set i_varhdr
13020         eval $setvar
13021         case "$i_varhdr" in
13022         stdarg.h)
13023                 val="$define"; set i_stdarg; eval $setvar
13024                 val="$undef"; set i_varargs; eval $setvar
13025                 ;;
13026         varargs.h)
13027                 val="$undef"; set i_stdarg; eval $setvar
13028                 val="$define"; set i_varargs; eval $setvar
13029                 ;;
13030         esac
13031         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13032 esac
13033 $rm -f varargs*
13034
13035 : see if stddef is available
13036 set stddef.h i_stddef
13037 eval $inhdr
13038
13039 : see if sys/access.h is available
13040 set sys/access.h i_sysaccess
13041 eval $inhdr
13042
13043 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13044 set sys/filio.h i_sysfilio
13045 eval $inhdr
13046 echo " "
13047 if $test `./findhdr sys/ioctl.h`; then
13048         val="$define"
13049         echo '<sys/ioctl.h> found.' >&4
13050 else
13051         val="$undef"
13052         if $test $i_sysfilio = "$define"; then
13053             echo '<sys/ioctl.h> NOT found.' >&4
13054         else
13055                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13056                 $test $i_termio = "$define" && xxx="termio.h"
13057                 $test $i_termios = "$define" && xxx="termios.h"
13058 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13059         fi
13060 fi
13061 set i_sysioctl
13062 eval $setvar
13063
13064 : see if sys/resource.h has to be included
13065 set sys/resource.h i_sysresrc
13066 eval $inhdr
13067
13068 : see if sys/security.h is available
13069 set sys/security.h i_syssecrt
13070 eval $inhdr
13071
13072 : see if this is a sys/statvfs.h system
13073 set sys/statvfs.h i_sysstatvfs
13074 eval $inhdr
13075
13076 : see if this is a sys/un.h system
13077 set sys/un.h i_sysun
13078 eval $inhdr
13079
13080 : see if this is a syswait system
13081 set sys/wait.h i_syswait
13082 eval $inhdr
13083
13084 : see if this is an utime system
13085 set utime.h i_utime
13086 eval $inhdr
13087
13088 : see if this is a values.h system
13089 set values.h i_values
13090 eval $inhdr
13091
13092 : see if this is a vfork system
13093 case "$d_vfork" in
13094 "$define")
13095         set vfork.h i_vfork
13096         eval $inhdr
13097         ;;
13098 *)
13099         i_vfork="$undef"
13100         ;;
13101 esac
13102
13103 : see if gdbm.h is available
13104 set gdbm.h t_gdbm
13105 eval $inhdr
13106 case "$t_gdbm" in
13107 $define)
13108         : see if gdbm_open exists
13109         set gdbm_open d_gdbm_open
13110         eval $inlibc
13111         case "$d_gdbm_open" in
13112         $undef)
13113                 t_gdbm="$undef"
13114                 echo "We won't be including <gdbm.h>"
13115                 ;;
13116         esac
13117         ;;
13118 esac
13119 val="$t_gdbm"
13120 set i_gdbm
13121 eval $setvar
13122
13123 echo " "
13124 echo "Looking for extensions..." >&4
13125 : If we are using the old config.sh, known_extensions may contain
13126 : old or inaccurate or duplicate values.
13127 known_extensions=''
13128 nonxs_extensions=''
13129 : We do not use find because it might not be available.
13130 : We do not just use MANIFEST because the user may have dropped
13131 : some additional extensions into the source tree and expect them
13132 : to be built.
13133
13134 : Function to recursively find available extensions, ignoring DynaLoader
13135 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13136 find_extensions='
13137     for xxx in *; do
13138        case "$xxx" in
13139            DynaLoader|dynaload) ;;
13140            *)
13141            if $test -f $xxx/$xxx.xs; then
13142                known_extensions="$known_extensions $1$xxx";
13143            elif $test -f $xxx/Makefile.PL; then
13144                nonxs_extensions="$nonxs_extensions $1$xxx";
13145            else
13146                if $test -d $xxx -a $# -lt 10; then
13147                    set $1$xxx/ $*;
13148                    cd $xxx;
13149                    eval $find_extensions;
13150                    cd ..;
13151                    shift;
13152                fi;
13153            fi
13154            ;;
13155        esac;
13156     done'
13157 tdir=`pwd`
13158 cd $rsrc/ext
13159 set X
13160 shift
13161 eval $find_extensions
13162 set X $nonxs_extensions
13163 shift
13164 nonxs_extensions="$*"
13165 set X $known_extensions
13166 shift
13167 known_extensions="$*"
13168 cd $tdir
13169
13170 : Now see which are supported on this system.
13171 avail_ext=''
13172 for xxx in $known_extensions ; do
13173         case "$xxx" in
13174         DB_File|db_file)
13175                 case "$i_db" in
13176                 $define) avail_ext="$avail_ext $xxx" ;;
13177                 esac
13178                 ;;
13179         GDBM_File|gdbm_fil)
13180                 case "$i_gdbm" in 
13181                 $define) avail_ext="$avail_ext $xxx" ;;
13182                 esac
13183                 ;;
13184         NDBM_File|ndbm_fil)
13185                 case "$i_ndbm" in
13186                 $define) avail_ext="$avail_ext $xxx" ;;
13187                 esac
13188                 ;;
13189         ODBM_File|odbm_fil) 
13190                 case "${i_dbm}${i_rpcsvcdbm}" in
13191                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13192                 esac
13193                 ;;
13194         POSIX|posix)
13195                 case "$useposix" in
13196                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13197                 esac
13198                 ;;
13199         Opcode|opcode)
13200                 case "$useopcode" in
13201                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13202                 esac
13203                 ;;
13204         Socket|socket)
13205                 case "$d_socket" in 
13206                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13207                 esac
13208                 ;;
13209         Thread|thread)
13210                 case "$usethreads" in 
13211                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13212                 esac
13213                 ;;
13214         IPC/SysV|ipc/sysv)
13215                 : XXX Do we need a useipcsysv variable here
13216                 case "${d_msg}${d_sem}${d_shm}" in 
13217                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13218                 esac
13219                 ;;
13220         *)      avail_ext="$avail_ext $xxx"
13221                 ;;
13222         esac
13223 done
13224
13225 set X $avail_ext
13226 shift
13227 avail_ext="$*"
13228
13229 : Now see which nonxs extensions are supported on this system.
13230 : For now assume all are.
13231 nonxs_ext=''
13232 for xxx in $nonxs_extensions ; do
13233         case "$xxx" in
13234         *)      nonxs_ext="$nonxs_ext $xxx"
13235                 ;;
13236         esac
13237 done
13238
13239 set X $nonxs_ext
13240 shift
13241 nonxs_ext="$*"
13242
13243 case $usedl in
13244 $define)
13245         $cat <<EOM
13246 A number of extensions are supplied with $package.  You may choose to
13247 compile these extensions for dynamic loading (the default), compile
13248 them into the $package executable (static loading), or not include
13249 them at all.  Answer "none" to include no extensions.
13250 Note that DynaLoader is always built and need not be mentioned here.
13251
13252 EOM
13253         case "$dynamic_ext" in
13254         '') dflt="$avail_ext" ;;
13255         *)      dflt="$dynamic_ext"
13256                 # Perhaps we are reusing an old out-of-date config.sh.
13257                 case "$hint" in
13258                 previous)
13259                         if test X"$dynamic_ext" != X"$avail_ext"; then
13260                                 $cat <<EOM
13261 NOTICE:  Your previous config.sh list may be incorrect. 
13262 The extensions now available to you are 
13263         ${avail_ext}
13264 but the default list from your previous config.sh is
13265         ${dynamic_ext} 
13266
13267 EOM
13268                         fi
13269                         ;;
13270                 esac
13271                 ;;
13272         esac
13273         case "$dflt" in
13274         '')     dflt=none;;
13275         esac
13276         rp="What extensions do you wish to load dynamically?"
13277         . ./myread
13278         case "$ans" in
13279         none) dynamic_ext=' ' ;;
13280         *) dynamic_ext="$ans" ;;
13281         esac
13282
13283         case "$static_ext" in
13284         '')
13285                 : Exclude those already listed in dynamic linking
13286                 dflt=''
13287                 for xxx in $avail_ext; do
13288                         case " $dynamic_ext " in
13289                         *" $xxx "*) ;;
13290                         *) dflt="$dflt $xxx" ;;
13291                         esac
13292                 done
13293                 set X $dflt
13294                 shift
13295                 dflt="$*"
13296                 ;;
13297         *)  dflt="$static_ext" 
13298                 ;;
13299         esac
13300
13301         case "$dflt" in
13302         '')     dflt=none;;
13303         esac
13304         rp="What extensions do you wish to load statically?"
13305         . ./myread
13306         case "$ans" in
13307         none) static_ext=' ' ;;
13308         *) static_ext="$ans" ;;
13309         esac
13310         ;;
13311 *)
13312         $cat <<EOM
13313 A number of extensions are supplied with $package.  Answer "none" 
13314 to include no extensions. 
13315 Note that DynaLoader is always built and need not be mentioned here.
13316
13317 EOM
13318         case "$static_ext" in
13319         '') dflt="$avail_ext" ;;
13320         *)      dflt="$static_ext"
13321                 # Perhaps we are reusing an old out-of-date config.sh.
13322                 case "$hint" in
13323                 previous)
13324                         if test X"$static_ext" != X"$avail_ext"; then
13325                                 $cat <<EOM
13326 NOTICE:  Your previous config.sh list may be incorrect. 
13327 The extensions now available to you are 
13328         ${avail_ext}
13329 but the default list from your previous config.sh is
13330         ${static_ext} 
13331
13332 EOM
13333                         fi
13334                         ;;
13335                 esac
13336                 ;;
13337         esac
13338         : Exclude those that are not xs extensions
13339         case "$dflt" in
13340         '')     dflt=none;;
13341         esac
13342         rp="What extensions do you wish to include?"
13343         . ./myread
13344         case "$ans" in
13345         none) static_ext=' ' ;;
13346         *) static_ext="$ans" ;;
13347         esac
13348         ;;
13349 esac
13350
13351 set X $dynamic_ext $static_ext $nonxs_ext
13352 shift
13353 extensions="$*"
13354
13355 : Remove build directory name from cppstdin so it can be used from
13356 : either the present location or the final installed location.
13357 echo " "
13358 : Get out of the UU directory to get correct path name.
13359 cd ..
13360 case "$cppstdin" in
13361 `pwd`/cppstdin)
13362         echo "Stripping down cppstdin path name"
13363         cppstdin=cppstdin
13364         ;;
13365 esac
13366 cd UU
13367
13368 : end of configuration questions
13369 echo " "
13370 echo "End of configuration questions."
13371 echo " "
13372
13373 : back to where it started
13374 if test -d ../UU; then
13375         cd ..
13376 fi
13377
13378 : configuration may be patched via a 'config.over' file
13379 if $test -f config.over; then
13380         echo " "
13381         dflt=y
13382         rp='I see a config.over file.  Do you wish to load it?'
13383         . UU/myread
13384         case "$ans" in
13385         n*) echo "OK, I'll ignore it.";;
13386         *)      . ./config.over
13387                 echo "Configuration override changes have been loaded."
13388                 ;;
13389         esac
13390 fi
13391
13392 : in case they want portability, strip down executable paths
13393 case "$d_portable" in
13394 "$define")
13395         echo " "
13396         echo "Stripping down executable paths..." >&4
13397         for file in $loclist $trylist; do
13398                 eval temp=\$$file
13399                 eval $file=`basename $temp`
13400         done
13401         ;;
13402 esac
13403
13404 : create config.sh file
13405 echo " "
13406 echo "Creating config.sh..." >&4
13407 $spitshell <<EOT >config.sh
13408 $startsh
13409 #
13410 # This file was produced by running the Configure script. It holds all the
13411 # definitions figured out by Configure. Should you modify one of these values,
13412 # do not forget to propagate your changes by running "Configure -der". You may
13413 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13414 #
13415
13416 # Package name      : $package
13417 # Source directory  : $src
13418 # Configuration time: $cf_time
13419 # Configured by     : $cf_by
13420 # Target system     : $myuname
13421
13422 Author='$Author'
13423 Date='$Date'
13424 Header='$Header'
13425 Id='$Id'
13426 Locker='$Locker'
13427 Log='$Log'
13428 Mcc='$Mcc'
13429 RCSfile='$RCSfile'
13430 Revision='$Revision'
13431 Source='$Source'
13432 State='$State'
13433 _a='$_a'
13434 _exe='$_exe'
13435 _o='$_o'
13436 afs='$afs'
13437 alignbytes='$alignbytes'
13438 ansi2knr='$ansi2knr'
13439 aphostname='$aphostname'
13440 apiversion='$apiversion'
13441 ar='$ar'
13442 archlib='$archlib'
13443 archlibexp='$archlibexp'
13444 archname64='$archname64'
13445 archname='$archname'
13446 archobjs='$archobjs'
13447 awk='$awk'
13448 baserev='$baserev'
13449 bash='$bash'
13450 bin='$bin'
13451 bincompat5005='$bincompat5005'
13452 binexp='$binexp'
13453 bison='$bison'
13454 byacc='$byacc'
13455 byteorder='$byteorder'
13456 c='$c'
13457 castflags='$castflags'
13458 cat='$cat'
13459 cc='$cc'
13460 cccdlflags='$cccdlflags'
13461 ccdlflags='$ccdlflags'
13462 ccflags='$ccflags'
13463 ccsymbols='$ccsymbols'
13464 cf_by='$cf_by'
13465 cf_email='$cf_email'
13466 cf_time='$cf_time'
13467 chgrp='$chgrp'
13468 chmod='$chmod'
13469 chown='$chown'
13470 clocktype='$clocktype'
13471 comm='$comm'
13472 compress='$compress'
13473 contains='$contains'
13474 cp='$cp'
13475 cpio='$cpio'
13476 cpp='$cpp'
13477 cpp_stuff='$cpp_stuff'
13478 cppccsymbols='$cppccsymbols'
13479 cppflags='$cppflags'
13480 cpplast='$cpplast'
13481 cppminus='$cppminus'
13482 cpprun='$cpprun'
13483 cppstdin='$cppstdin'
13484 cppsymbols='$cppsymbols'
13485 crosscompile='$crosscompile'
13486 cryptlib='$cryptlib'
13487 csh='$csh'
13488 d_Gconvert='$d_Gconvert'
13489 d_PRIEldbl='$d_PRIEldbl'
13490 d_PRIFldbl='$d_PRIFldbl'
13491 d_PRIGldbl='$d_PRIGldbl'
13492 d_PRIX64='$d_PRIX64'
13493 d_PRId64='$d_PRId64'
13494 d_PRIeldbl='$d_PRIeldbl'
13495 d_PRIfldbl='$d_PRIfldbl'
13496 d_PRIgldbl='$d_PRIgldbl'
13497 d_PRIi64='$d_PRIi64'
13498 d_PRIo64='$d_PRIo64'
13499 d_PRIu64='$d_PRIu64'
13500 d_PRIx64='$d_PRIx64'
13501 d_access='$d_access'
13502 d_accessx='$d_accessx'
13503 d_alarm='$d_alarm'
13504 d_archlib='$d_archlib'
13505 d_atolf='$d_atolf'
13506 d_atoll='$d_atoll'
13507 d_attribut='$d_attribut'
13508 d_bcmp='$d_bcmp'
13509 d_bcopy='$d_bcopy'
13510 d_bincompat5005='$d_bincompat5005'
13511 d_bsd='$d_bsd'
13512 d_bsdgetpgrp='$d_bsdgetpgrp'
13513 d_bsdsetpgrp='$d_bsdsetpgrp'
13514 d_bzero='$d_bzero'
13515 d_casti32='$d_casti32'
13516 d_castneg='$d_castneg'
13517 d_charvspr='$d_charvspr'
13518 d_chown='$d_chown'
13519 d_chroot='$d_chroot'
13520 d_chsize='$d_chsize'
13521 d_closedir='$d_closedir'
13522 d_cmsghdr_s='$d_cmsghdr_s'
13523 d_const='$d_const'
13524 d_crypt='$d_crypt'
13525 d_csh='$d_csh'
13526 d_cuserid='$d_cuserid'
13527 d_dbl_dig='$d_dbl_dig'
13528 d_dbmclose64='$d_dbmclose64'
13529 d_dbminit64='$d_dbminit64'
13530 d_delete64='$d_delete64'
13531 d_difftime='$d_difftime'
13532 d_dirent64_s='$d_dirent64_s'
13533 d_dirnamlen='$d_dirnamlen'
13534 d_dlerror='$d_dlerror'
13535 d_dlopen='$d_dlopen'
13536 d_dlsymun='$d_dlsymun'
13537 d_dosuid='$d_dosuid'
13538 d_drand48proto='$d_drand48proto'
13539 d_dup2='$d_dup2'
13540 d_eaccess='$d_eaccess'
13541 d_endgrent='$d_endgrent'
13542 d_endhent='$d_endhent'
13543 d_endnent='$d_endnent'
13544 d_endpent='$d_endpent'
13545 d_endpwent='$d_endpwent'
13546 d_endsent='$d_endsent'
13547 d_endspent='$d_endspent'
13548 d_eofnblk='$d_eofnblk'
13549 d_eunice='$d_eunice'
13550 d_fchmod='$d_fchmod'
13551 d_fchown='$d_fchown'
13552 d_fcntl='$d_fcntl'
13553 d_fd_macros='$d_fd_macros'
13554 d_fd_set='$d_fd_set'
13555 d_fds_bits='$d_fds_bits'
13556 d_fetch64='$d_fetch64'
13557 d_fgetpos64='$d_fgetpos64'
13558 d_fgetpos='$d_fgetpos'
13559 d_firstkey64='$d_firstkey64'
13560 d_flexfnam='$d_flexfnam'
13561 d_flock64_s='$d_flock64_s'
13562 d_flock='$d_flock'
13563 d_fopen64='$d_fopen64'
13564 d_fork='$d_fork'
13565 d_fpathconf='$d_fpathconf'
13566 d_freopen64='$d_freopen64'
13567 d_fseek64='$d_fseek64'
13568 d_fseeko64='$d_fseeko64'
13569 d_fseeko='$d_fseeko'
13570 d_fsetpos64='$d_fsetpos64'
13571 d_fsetpos='$d_fsetpos'
13572 d_fstat64='$d_fstat64'
13573 d_fstatfs='$d_fstatfs'
13574 d_fstatvfs='$d_fstatvfs'
13575 d_ftell64='$d_ftell64'
13576 d_ftello64='$d_ftello64'
13577 d_ftello='$d_ftello'
13578 d_ftime='$d_ftime'
13579 d_ftruncate64='$d_ftruncate64'
13580 d_getgrent='$d_getgrent'
13581 d_getgrps='$d_getgrps'
13582 d_gethbyaddr='$d_gethbyaddr'
13583 d_gethbyname='$d_gethbyname'
13584 d_gethent='$d_gethent'
13585 d_gethname='$d_gethname'
13586 d_gethostprotos='$d_gethostprotos'
13587 d_getlogin='$d_getlogin'
13588 d_getmntent='$d_getmntent'
13589 d_getnbyaddr='$d_getnbyaddr'
13590 d_getnbyname='$d_getnbyname'
13591 d_getnent='$d_getnent'
13592 d_getnetprotos='$d_getnetprotos'
13593 d_getpbyname='$d_getpbyname'
13594 d_getpbynumber='$d_getpbynumber'
13595 d_getpent='$d_getpent'
13596 d_getpgid='$d_getpgid'
13597 d_getpgrp2='$d_getpgrp2'
13598 d_getpgrp='$d_getpgrp'
13599 d_getppid='$d_getppid'
13600 d_getprior='$d_getprior'
13601 d_getprotoprotos='$d_getprotoprotos'
13602 d_getpwent='$d_getpwent'
13603 d_getsbyname='$d_getsbyname'
13604 d_getsbyport='$d_getsbyport'
13605 d_getsent='$d_getsent'
13606 d_getservprotos='$d_getservprotos'
13607 d_getspent='$d_getspent'
13608 d_getspnam='$d_getspnam'
13609 d_gettimeod='$d_gettimeod'
13610 d_gnulibc='$d_gnulibc'
13611 d_grpasswd='$d_grpasswd'
13612 d_hasmntopt='$d_hasmntopt'
13613 d_htonl='$d_htonl'
13614 d_index='$d_index'
13615 d_inetaton='$d_inetaton'
13616 d_ino64_t='$d_ino64_t'
13617 d_int64t='$d_int64t'
13618 d_iovec_s='$d_iovec_s'
13619 d_isascii='$d_isascii'
13620 d_killpg='$d_killpg'
13621 d_lchown='$d_lchown'
13622 d_link='$d_link'
13623 d_llseek='$d_llseek'
13624 d_locconv='$d_locconv'
13625 d_lockf64='$d_lockf64'
13626 d_lockf='$d_lockf'
13627 d_longdbl='$d_longdbl'
13628 d_longlong='$d_longlong'
13629 d_lseek64='$d_lseek64'
13630 d_lstat64='$d_lstat64'
13631 d_lstat='$d_lstat'
13632 d_madvise='$d_madvise'
13633 d_mblen='$d_mblen'
13634 d_mbstowcs='$d_mbstowcs'
13635 d_mbtowc='$d_mbtowc'
13636 d_memchr='$d_memchr'
13637 d_memcmp='$d_memcmp'
13638 d_memcpy='$d_memcpy'
13639 d_memmove='$d_memmove'
13640 d_memset='$d_memset'
13641 d_mkdir='$d_mkdir'
13642 d_mkfifo='$d_mkfifo'
13643 d_mktime='$d_mktime'
13644 d_mmap='$d_mmap'
13645 d_mprotect='$d_mprotect'
13646 d_msg='$d_msg'
13647 d_msg_ctrunc='$d_msg_ctrunc'
13648 d_msg_dontroute='$d_msg_dontroute'
13649 d_msg_oob='$d_msg_oob'
13650 d_msg_peek='$d_msg_peek'
13651 d_msg_proxy='$d_msg_proxy'
13652 d_msgctl='$d_msgctl'
13653 d_msgget='$d_msgget'
13654 d_msghdr_s='$d_msghdr_s'
13655 d_msgrcv='$d_msgrcv'
13656 d_msgsnd='$d_msgsnd'
13657 d_msync='$d_msync'
13658 d_munmap='$d_munmap'
13659 d_mymalloc='$d_mymalloc'
13660 d_nextkey64='$d_nextkey64'
13661 d_nice='$d_nice'
13662 d_off64_t='$d_off64_t'
13663 d_offset_t='$d_offset_t'
13664 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13665 d_oldpthreads='$d_oldpthreads'
13666 d_oldsock='$d_oldsock'
13667 d_open3='$d_open3'
13668 d_open64='$d_open64'
13669 d_opendir64='$d_opendir64'
13670 d_pathconf='$d_pathconf'
13671 d_pause='$d_pause'
13672 d_phostname='$d_phostname'
13673 d_pipe='$d_pipe'
13674 d_poll='$d_poll'
13675 d_portable='$d_portable'
13676 d_pthread_yield='$d_pthread_yield'
13677 d_pwage='$d_pwage'
13678 d_pwchange='$d_pwchange'
13679 d_pwclass='$d_pwclass'
13680 d_pwcomment='$d_pwcomment'
13681 d_pwexpire='$d_pwexpire'
13682 d_pwgecos='$d_pwgecos'
13683 d_pwpasswd='$d_pwpasswd'
13684 d_pwquota='$d_pwquota'
13685 d_readdir64='$d_readdir64'
13686 d_readdir='$d_readdir'
13687 d_readlink='$d_readlink'
13688 d_readv='$d_readv'
13689 d_recvmsg='$d_recvmsg'
13690 d_rename='$d_rename'
13691 d_rewinddir='$d_rewinddir'
13692 d_rmdir='$d_rmdir'
13693 d_safebcpy='$d_safebcpy'
13694 d_safemcpy='$d_safemcpy'
13695 d_sanemcmp='$d_sanemcmp'
13696 d_sched_yield='$d_sched_yield'
13697 d_scm_rights='$d_scm_rights'
13698 d_seekdir64='$d_seekdir64'
13699 d_seekdir='$d_seekdir'
13700 d_select='$d_select'
13701 d_sem='$d_sem'
13702 d_semctl='$d_semctl'
13703 d_semctl_semid_ds='$d_semctl_semid_ds'
13704 d_semctl_semun='$d_semctl_semun'
13705 d_semget='$d_semget'
13706 d_semop='$d_semop'
13707 d_sendmsg='$d_sendmsg'
13708 d_setegid='$d_setegid'
13709 d_seteuid='$d_seteuid'
13710 d_setgrent='$d_setgrent'
13711 d_setgrps='$d_setgrps'
13712 d_sethent='$d_sethent'
13713 d_setlinebuf='$d_setlinebuf'
13714 d_setlocale='$d_setlocale'
13715 d_setnent='$d_setnent'
13716 d_setpent='$d_setpent'
13717 d_setpgid='$d_setpgid'
13718 d_setpgrp2='$d_setpgrp2'
13719 d_setpgrp='$d_setpgrp'
13720 d_setprior='$d_setprior'
13721 d_setpwent='$d_setpwent'
13722 d_setregid='$d_setregid'
13723 d_setresgid='$d_setresgid'
13724 d_setresuid='$d_setresuid'
13725 d_setreuid='$d_setreuid'
13726 d_setrgid='$d_setrgid'
13727 d_setruid='$d_setruid'
13728 d_setsent='$d_setsent'
13729 d_setsid='$d_setsid'
13730 d_setspent='$d_setspent'
13731 d_setvbuf='$d_setvbuf'
13732 d_sfio='$d_sfio'
13733 d_shm='$d_shm'
13734 d_shmat='$d_shmat'
13735 d_shmatprototype='$d_shmatprototype'
13736 d_shmctl='$d_shmctl'
13737 d_shmdt='$d_shmdt'
13738 d_shmget='$d_shmget'
13739 d_sigaction='$d_sigaction'
13740 d_sigsetjmp='$d_sigsetjmp'
13741 d_socket='$d_socket'
13742 d_sockpair='$d_sockpair'
13743 d_stat64='$d_stat64'
13744 d_statblks='$d_statblks'
13745 d_statfs='$d_statfs'
13746 d_statfsflags='$d_statfsflags'
13747 d_statvfs='$d_statvfs'
13748 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13749 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13750 d_stdio_stream_array='$d_stdio_stream_array'
13751 d_stdiobase='$d_stdiobase'
13752 d_stdstdio='$d_stdstdio'
13753 d_store64='$d_store64'
13754 d_strchr='$d_strchr'
13755 d_strcoll='$d_strcoll'
13756 d_strctcpy='$d_strctcpy'
13757 d_strerrm='$d_strerrm'
13758 d_strerror='$d_strerror'
13759 d_strtod='$d_strtod'
13760 d_strtol='$d_strtol'
13761 d_strtoul='$d_strtoul'
13762 d_strtoull='$d_strtoull'
13763 d_strxfrm='$d_strxfrm'
13764 d_suidsafe='$d_suidsafe'
13765 d_symlink='$d_symlink'
13766 d_syscall='$d_syscall'
13767 d_sysconf='$d_sysconf'
13768 d_sysernlst='$d_sysernlst'
13769 d_syserrlst='$d_syserrlst'
13770 d_system='$d_system'
13771 d_tcgetpgrp='$d_tcgetpgrp'
13772 d_tcsetpgrp='$d_tcsetpgrp'
13773 d_telldir64='$d_telldir64'
13774 d_telldir='$d_telldir'
13775 d_telldirproto='$d_telldirproto'
13776 d_time='$d_time'
13777 d_times='$d_times'
13778 d_tmpfile64='$d_tmpfile64'
13779 d_truncate64='$d_truncate64'
13780 d_truncate='$d_truncate'
13781 d_tzname='$d_tzname'
13782 d_umask='$d_umask'
13783 d_uname='$d_uname'
13784 d_union_semun='$d_union_semun'
13785 d_vendorlib='$d_vendorlib'
13786 d_vfork='$d_vfork'
13787 d_void_closedir='$d_void_closedir'
13788 d_voidsig='$d_voidsig'
13789 d_voidtty='$d_voidtty'
13790 d_volatile='$d_volatile'
13791 d_vprintf='$d_vprintf'
13792 d_wait4='$d_wait4'
13793 d_waitpid='$d_waitpid'
13794 d_wcstombs='$d_wcstombs'
13795 d_wctomb='$d_wctomb'
13796 d_writev='$d_writev'
13797 d_xenix='$d_xenix'
13798 date='$date'
13799 db_hashtype='$db_hashtype'
13800 db_prefixtype='$db_prefixtype'
13801 defvoidused='$defvoidused'
13802 direntrytype='$direntrytype'
13803 dlext='$dlext'
13804 dlsrc='$dlsrc'
13805 doublesize='$doublesize'
13806 drand01='$drand01'
13807 dynamic_ext='$dynamic_ext'
13808 eagain='$eagain'
13809 ebcdic='$ebcdic'
13810 echo='$echo'
13811 egrep='$egrep'
13812 emacs='$emacs'
13813 eunicefix='$eunicefix'
13814 exe_ext='$exe_ext'
13815 expr='$expr'
13816 extensions='$extensions'
13817 fflushNULL='$fflushNULL'
13818 fflushall='$fflushall'
13819 find='$find'
13820 firstmakefile='$firstmakefile'
13821 flex='$flex'
13822 fpostype='$fpostype'
13823 freetype='$freetype'
13824 full_ar='$full_ar'
13825 full_csh='$full_csh'
13826 full_sed='$full_sed'
13827 gccversion='$gccversion'
13828 gidtype='$gidtype'
13829 glibpth='$glibpth'
13830 grep='$grep'
13831 groupcat='$groupcat'
13832 groupstype='$groupstype'
13833 gzip='$gzip'
13834 h_fcntl='$h_fcntl'
13835 h_sysfile='$h_sysfile'
13836 hint='$hint'
13837 hostcat='$hostcat'
13838 huge='$huge'
13839 i_arpainet='$i_arpainet'
13840 i_bsdioctl='$i_bsdioctl'
13841 i_db='$i_db'
13842 i_dbm='$i_dbm'
13843 i_dirent='$i_dirent'
13844 i_dld='$i_dld'
13845 i_dlfcn='$i_dlfcn'
13846 i_fcntl='$i_fcntl'
13847 i_float='$i_float'
13848 i_gdbm='$i_gdbm'
13849 i_grp='$i_grp'
13850 i_inttypes='$i_inttypes'
13851 i_limits='$i_limits'
13852 i_locale='$i_locale'
13853 i_machcthr='$i_machcthr'
13854 i_malloc='$i_malloc'
13855 i_math='$i_math'
13856 i_memory='$i_memory'
13857 i_mntent='$i_mntent'
13858 i_ndbm='$i_ndbm'
13859 i_netdb='$i_netdb'
13860 i_neterrno='$i_neterrno'
13861 i_netinettcp='$i_netinettcp'
13862 i_niin='$i_niin'
13863 i_poll='$i_poll'
13864 i_pthread='$i_pthread'
13865 i_pwd='$i_pwd'
13866 i_rpcsvcdbm='$i_rpcsvcdbm'
13867 i_sfio='$i_sfio'
13868 i_sgtty='$i_sgtty'
13869 i_shadow='$i_shadow'
13870 i_socks='$i_socks'
13871 i_stdarg='$i_stdarg'
13872 i_stddef='$i_stddef'
13873 i_stdlib='$i_stdlib'
13874 i_string='$i_string'
13875 i_sysaccess='$i_sysaccess'
13876 i_sysdir='$i_sysdir'
13877 i_sysfile='$i_sysfile'
13878 i_sysfilio='$i_sysfilio'
13879 i_sysin='$i_sysin'
13880 i_sysioctl='$i_sysioctl'
13881 i_sysmman='$i_sysmman'
13882 i_sysmount='$i_sysmount'
13883 i_sysndir='$i_sysndir'
13884 i_sysparam='$i_sysparam'
13885 i_sysresrc='$i_sysresrc'
13886 i_syssecrt='$i_syssecrt'
13887 i_sysselct='$i_sysselct'
13888 i_syssockio='$i_syssockio'
13889 i_sysstat='$i_sysstat'
13890 i_sysstatvfs='$i_sysstatvfs'
13891 i_systime='$i_systime'
13892 i_systimek='$i_systimek'
13893 i_systimes='$i_systimes'
13894 i_systypes='$i_systypes'
13895 i_sysuio='$i_sysuio'
13896 i_sysun='$i_sysun'
13897 i_syswait='$i_syswait'
13898 i_termio='$i_termio'
13899 i_termios='$i_termios'
13900 i_time='$i_time'
13901 i_unistd='$i_unistd'
13902 i_utime='$i_utime'
13903 i_values='$i_values'
13904 i_varargs='$i_varargs'
13905 i_varhdr='$i_varhdr'
13906 i_vfork='$i_vfork'
13907 ignore_versioned_solibs='$ignore_versioned_solibs'
13908 incpath='$incpath'
13909 inews='$inews'
13910 installarchlib='$installarchlib'
13911 installbin='$installbin'
13912 installman1dir='$installman1dir'
13913 installman3dir='$installman3dir'
13914 installprefix='$installprefix'
13915 installprefixexp='$installprefixexp'
13916 installprivlib='$installprivlib'
13917 installscript='$installscript'
13918 installsitearch='$installsitearch'
13919 installsitelib='$installsitelib'
13920 installstyle='$installstyle'
13921 installusrbinperl='$installusrbinperl'
13922 installvendorlib='$installvendorlib'
13923 intsize='$intsize'
13924 known_extensions='$known_extensions'
13925 ksh='$ksh'
13926 large='$large'
13927 ld='$ld'
13928 lddlflags='$lddlflags'
13929 ldflags='$ldflags'
13930 ldlibpthname='$ldlibpthname'
13931 less='$less'
13932 lib_ext='$lib_ext'
13933 libc='$libc'
13934 libperl='$libperl'
13935 libpth='$libpth'
13936 libs='$libs'
13937 libswanted='$libswanted'
13938 line='$line'
13939 lint='$lint'
13940 lkflags='$lkflags'
13941 ln='$ln'
13942 lns='$lns'
13943 locincpth='$locincpth'
13944 loclibpth='$loclibpth'
13945 longdblsize='$longdblsize'
13946 longlongsize='$longlongsize'
13947 longsize='$longsize'
13948 lp='$lp'
13949 lpr='$lpr'
13950 ls='$ls'
13951 lseeksize='$lseeksize'
13952 lseektype='$lseektype'
13953 mail='$mail'
13954 mailx='$mailx'
13955 make='$make'
13956 make_set_make='$make_set_make'
13957 mallocobj='$mallocobj'
13958 mallocsrc='$mallocsrc'
13959 malloctype='$malloctype'
13960 man1dir='$man1dir'
13961 man1direxp='$man1direxp'
13962 man1ext='$man1ext'
13963 man3dir='$man3dir'
13964 man3direxp='$man3direxp'
13965 man3ext='$man3ext'
13966 medium='$medium'
13967 mips='$mips'
13968 mips_type='$mips_type'
13969 mkdir='$mkdir'
13970 mmaptype='$mmaptype'
13971 models='$models'
13972 modetype='$modetype'
13973 more='$more'
13974 multiarch='$multiarch'
13975 mv='$mv'
13976 myarchname='$myarchname'
13977 mydomain='$mydomain'
13978 myhostname='$myhostname'
13979 myuname='$myuname'
13980 n='$n'
13981 netdb_hlen_type='$netdb_hlen_type'
13982 netdb_host_type='$netdb_host_type'
13983 netdb_name_type='$netdb_name_type'
13984 netdb_net_type='$netdb_net_type'
13985 nm='$nm'
13986 nm_opt='$nm_opt'
13987 nm_so_opt='$nm_so_opt'
13988 nonxs_ext='$nonxs_ext'
13989 nroff='$nroff'
13990 o_nonblock='$o_nonblock'
13991 obj_ext='$obj_ext'
13992 old_pthread_create_joinable='$old_pthread_create_joinable'
13993 optimize='$optimize'
13994 orderlib='$orderlib'
13995 osname='$osname'
13996 osvers='$osvers'
13997 package='$package'
13998 pager='$pager'
13999 passcat='$passcat'
14000 patchlevel='$patchlevel'
14001 path_sep='$path_sep'
14002 perl='$perl'
14003 perladmin='$perladmin'
14004 perlpath='$perlpath'
14005 pg='$pg'
14006 phostname='$phostname'
14007 pidtype='$pidtype'
14008 plibpth='$plibpth'
14009 pmake='$pmake'
14010 pr='$pr'
14011 prefix='$prefix'
14012 prefixexp='$prefixexp'
14013 privlib='$privlib'
14014 privlibexp='$privlibexp'
14015 prototype='$prototype'
14016 ptrsize='$ptrsize'
14017 randbits='$randbits'
14018 randfunc='$randfunc'
14019 randseedtype='$randseedtype'
14020 ranlib='$ranlib'
14021 rd_nodata='$rd_nodata'
14022 rm='$rm'
14023 rmail='$rmail'
14024 runnm='$runnm'
14025 sPRIEldbl='$sPRIEldbl'
14026 sPRIFldbl='$sPRIFldbl'
14027 sPRIGldbl='$sPRIGldbl'
14028 sPRIX64='$sPRIX64'
14029 sPRId64='$sPRId64'
14030 sPRIeldbl='$sPRIeldbl'
14031 sPRIfldbl='$sPRIfldbl'
14032 sPRIgldbl='$sPRIgldbl'
14033 sPRIi64='$sPRIi64'
14034 sPRIo64='$sPRIo64'
14035 sPRIu64='$sPRIu64'
14036 sPRIx64='$sPRIx64'
14037 sched_yield='$sched_yield'
14038 scriptdir='$scriptdir'
14039 scriptdirexp='$scriptdirexp'
14040 sed='$sed'
14041 seedfunc='$seedfunc'
14042 selectminbits='$selectminbits'
14043 selecttype='$selecttype'
14044 sendmail='$sendmail'
14045 sh='$sh'
14046 shar='$shar'
14047 sharpbang='$sharpbang'
14048 shmattype='$shmattype'
14049 shortsize='$shortsize'
14050 shrpenv='$shrpenv'
14051 shsharp='$shsharp'
14052 sig_count='$sig_count'
14053 sig_name='$sig_name'
14054 sig_name_init='$sig_name_init'
14055 sig_num='$sig_num'
14056 sig_num_init='$sig_num_init'
14057 signal_t='$signal_t'
14058 sitearch='$sitearch'
14059 sitearchexp='$sitearchexp'
14060 sitelib='$sitelib'
14061 sitelibexp='$sitelibexp'
14062 siteprefix='$siteprefix'
14063 siteprefixexp='$siteprefixexp'
14064 sizetype='$sizetype'
14065 sleep='$sleep'
14066 smail='$smail'
14067 small='$small'
14068 so='$so'
14069 sockethdr='$sockethdr'
14070 socketlib='$socketlib'
14071 sort='$sort'
14072 spackage='$spackage'
14073 spitshell='$spitshell'
14074 split='$split'
14075 src='$src'
14076 ssizetype='$ssizetype'
14077 startperl='$startperl'
14078 startsh='$startsh'
14079 static_ext='$static_ext'
14080 stdchar='$stdchar'
14081 stdio_base='$stdio_base'
14082 stdio_bufsiz='$stdio_bufsiz'
14083 stdio_cnt='$stdio_cnt'
14084 stdio_filbuf='$stdio_filbuf'
14085 stdio_ptr='$stdio_ptr'
14086 stdio_stream_array='$stdio_stream_array'
14087 strings='$strings'
14088 submit='$submit'
14089 subversion='$subversion'
14090 sysman='$sysman'
14091 tail='$tail'
14092 tar='$tar'
14093 tbl='$tbl'
14094 tee='$tee'
14095 test='$test'
14096 timeincl='$timeincl'
14097 timetype='$timetype'
14098 touch='$touch'
14099 tr='$tr'
14100 trnl='$trnl'
14101 troff='$troff'
14102 uidtype='$uidtype'
14103 uname='$uname'
14104 uniq='$uniq'
14105 use64bits='$use64bits'
14106 usedl='$usedl'
14107 uselongdouble='$uselongdouble'
14108 usemultiplicity='$usemultiplicity'
14109 usemymalloc='$usemymalloc'
14110 usenm='$usenm'
14111 useopcode='$useopcode'
14112 useperlio='$useperlio'
14113 useposix='$useposix'
14114 usesfio='$usesfio'
14115 useshrplib='$useshrplib'
14116 usesocks='$usesocks'
14117 usethreads='$usethreads'
14118 usevendorprefix='$usevendorprefix'
14119 usevfork='$usevfork'
14120 usrinc='$usrinc'
14121 uuname='$uuname'
14122 vendorlib='$vendorlib'
14123 vendorlibexp='$vendorlibexp'
14124 vendorprefix='$vendorprefix'
14125 vendorprefixexp='$vendorprefixexp'
14126 version='$version'
14127 vi='$vi'
14128 voidflags='$voidflags'
14129 xlibpth='$xlibpth'
14130 zcat='$zcat'
14131 zip='$zip'
14132 EOT
14133
14134 : Add in command line options if available
14135 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14136
14137 : add special variables
14138 $test -f $src/patchlevel.h && \
14139 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14140 echo "CONFIGDOTSH=true" >>config.sh
14141
14142 : propagate old symbols
14143 if $test -f UU/config.sh; then
14144         <UU/config.sh sort | uniq >UU/oldconfig.sh
14145         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14146         sort | uniq -u >UU/oldsyms
14147         set X `cat UU/oldsyms`
14148         shift
14149         case $# in
14150         0) ;;
14151         *)
14152                 cat <<EOM
14153 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14154 EOM
14155                 echo "# Variables propagated from previous config.sh file." >>config.sh
14156                 for sym in `cat UU/oldsyms`; do
14157                         echo "    Propagating $hint variable "'$'"$sym..."
14158                         eval 'tmp="$'"${sym}"'"'
14159                         echo "$tmp" | \
14160                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14161                 done
14162                 ;;
14163         esac
14164 fi
14165
14166 : Finish up by extracting the .SH files
14167 case "$alldone" in
14168 exit)
14169         $rm -rf UU
14170         echo "Done."
14171         exit 0
14172         ;;
14173 cont)
14174         ;;
14175 '')
14176         dflt=''
14177         nostick=true
14178         $cat <<EOM
14179
14180 If you'd like to make any changes to the config.sh file before I begin
14181 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14182
14183 EOM
14184         rp="Press return or use a shell escape to edit config.sh:"
14185         . UU/myread
14186         nostick=''
14187         case "$ans" in
14188         '') ;;
14189         *) : in case they cannot read
14190                 sh 1>&4 -c "$ans";;
14191         esac
14192         ;;
14193 esac
14194
14195 : if this fails, just run all the .SH files by hand
14196 . ./config.sh
14197
14198 echo " "
14199 exec 1>&4
14200 . ./UU/extract
14201
14202 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14203         dflt=y
14204         case "$silent" in
14205         true) ;;
14206         *)
14207                 $cat <<EOM
14208
14209 Now you need to generate make dependencies by running "$make depend".
14210 You might prefer to run it in background: "$make depend > makedepend.out &"
14211 It can take a while, so you might not want to run it right now.
14212
14213 EOM
14214                 ;;
14215         esac
14216         rp="Run $make depend now?"
14217         . UU/myread
14218         case "$ans" in
14219         y*)
14220                 $make depend && echo "Now you must run a $make."
14221                 ;;
14222         *)
14223                 echo "You must run '$make depend' then '$make'."
14224                 ;;
14225         esac
14226 elif test -f [Mm]akefile; then
14227         echo " "
14228         echo "Now you must run a $make."
14229 else
14230         echo "Done."
14231 fi
14232
14233 if $test -f Policy.sh; then
14234     $cat <<EOM
14235
14236 If you compile $package on a different machine or from a different object
14237 directory, copy the Policy.sh file from this object directory to the
14238 new one before you run Configure -- this will help you with most of
14239 the policy defaults.
14240
14241 EOM
14242 fi
14243 if $test -f config.msg; then
14244     echo "Hmm.  I also noted the following information while running:"
14245     echo " "
14246     $cat config.msg >&4
14247     $rm -f config.msg
14248 fi
14249 $rm -f kit*isdone ark*isdone
14250 $rm -rf UU
14251
14252 : End of Configure
14253