8fd2a8d598001f895e850cff369887a489a3aa08
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Sep 30 19:41:54 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_ldbl_dig=''
403 d_link=''
404 d_locconv=''
405 d_lockf=''
406 d_longdbl=''
407 longdblsize=''
408 d_longlong=''
409 longlongsize=''
410 d_lstat=''
411 d_madvise=''
412 d_mblen=''
413 d_mbstowcs=''
414 d_mbtowc=''
415 d_memchr=''
416 d_memcmp=''
417 d_memcpy=''
418 d_memmove=''
419 d_memset=''
420 d_mkdir=''
421 d_mkfifo=''
422 d_mktime=''
423 d_mmap=''
424 mmaptype=''
425 d_mprotect=''
426 d_msg=''
427 d_msgctl=''
428 d_msgget=''
429 d_msgrcv=''
430 d_msgsnd=''
431 d_msync=''
432 d_munmap=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_readv=''
452 d_rename=''
453 d_rmdir=''
454 d_safebcpy=''
455 d_safemcpy=''
456 d_sanemcmp=''
457 d_select=''
458 d_sem=''
459 d_semctl=''
460 d_semget=''
461 d_semop=''
462 d_setegid=''
463 d_seteuid=''
464 d_setgrent=''
465 d_setgrps=''
466 d_sethent=''
467 d_setlinebuf=''
468 d_setlocale=''
469 d_setnent=''
470 d_setpent=''
471 d_setpgid=''
472 d_setpgrp2=''
473 d_bsdsetpgrp=''
474 d_setpgrp=''
475 d_setprior=''
476 d_setpwent=''
477 d_setregid=''
478 d_setresgid=''
479 d_setresuid=''
480 d_setreuid=''
481 d_setrgid=''
482 d_setruid=''
483 d_setsent=''
484 d_setsid=''
485 d_setspent=''
486 d_setvbuf=''
487 d_sfio=''
488 usesfio=''
489 d_shm=''
490 d_shmat=''
491 d_shmatprototype=''
492 shmattype=''
493 d_shmctl=''
494 d_shmdt=''
495 d_shmget=''
496 d_sigaction=''
497 d_sigsetjmp=''
498 d_cmsghdr_s=''
499 d_msg_ctrunc=''
500 d_msg_dontroute=''
501 d_msg_oob=''
502 d_msg_peek=''
503 d_msg_proxy=''
504 d_msghdr_s=''
505 d_oldsock=''
506 d_recvmsg=''
507 d_scm_rights=''
508 d_sendmsg=''
509 d_socket=''
510 d_sockpair=''
511 sockethdr=''
512 socketlib=''
513 d_statblks=''
514 d_fstatfs=''
515 d_statfs=''
516 d_statfsflags=''
517 d_fstatvfs=''
518 d_statvfs=''
519 d_stdio_cnt_lval=''
520 d_stdio_ptr_lval=''
521 d_stdiobase=''
522 d_stdstdio=''
523 stdio_base=''
524 stdio_bufsiz=''
525 stdio_cnt=''
526 stdio_filbuf=''
527 stdio_ptr=''
528 d_index=''
529 d_strchr=''
530 d_strcoll=''
531 d_strctcpy=''
532 d_strerrm=''
533 d_strerror=''
534 d_sysernlst=''
535 d_syserrlst=''
536 d_strtod=''
537 d_strtol=''
538 d_strtoul=''
539 d_strxfrm=''
540 d_symlink=''
541 d_syscall=''
542 d_sysconf=''
543 d_system=''
544 d_tcgetpgrp=''
545 d_tcsetpgrp=''
546 d_telldirproto=''
547 d_time=''
548 timetype=''
549 clocktype=''
550 d_times=''
551 d_truncate=''
552 d_tzname=''
553 d_umask=''
554 d_semctl_semid_ds=''
555 d_semctl_semun=''
556 d_union_semun=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 d_writev=''
569 dlext=''
570 cccdlflags=''
571 ccdlflags=''
572 dlsrc=''
573 ld=''
574 lddlflags=''
575 usedl=''
576 doublesize=''
577 ebcdic=''
578 fflushNULL=''
579 fflushall=''
580 fpostype=''
581 gidtype=''
582 groupstype=''
583 h_fcntl=''
584 h_sysfile=''
585 i_arpainet=''
586 db_hashtype=''
587 db_prefixtype=''
588 i_db=''
589 i_dbm=''
590 i_rpcsvcdbm=''
591 d_dirnamlen=''
592 direntrytype=''
593 i_dirent=''
594 i_dld=''
595 i_dlfcn=''
596 i_fcntl=''
597 i_float=''
598 i_gdbm=''
599 d_grpasswd=''
600 i_grp=''
601 d_int64t=''
602 i_inttypes=''
603 i_limits=''
604 i_locale=''
605 i_machcthr=''
606 i_malloc=''
607 i_math=''
608 i_memory=''
609 i_mntent=''
610 i_ndbm=''
611 i_netdb=''
612 i_neterrno=''
613 i_netinettcp=''
614 i_niin=''
615 i_sysin=''
616 i_poll=''
617 i_pthread=''
618 d_pwage=''
619 d_pwchange=''
620 d_pwclass=''
621 d_pwcomment=''
622 d_pwexpire=''
623 d_pwgecos=''
624 d_pwpasswd=''
625 d_pwquota=''
626 i_pwd=''
627 i_sfio=''
628 i_shadow=''
629 i_socks=''
630 i_stddef=''
631 i_stdlib=''
632 i_string=''
633 strings=''
634 i_sysaccess=''
635 i_sysdir=''
636 i_sysfile=''
637 d_voidtty=''
638 i_bsdioctl=''
639 i_sysfilio=''
640 i_sysioctl=''
641 i_syssockio=''
642 i_sysmman=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatvfs=''
651 i_systimes=''
652 i_systypes=''
653 d_iovec_s=''
654 i_sysuio=''
655 i_sysun=''
656 i_syswait=''
657 i_sgtty=''
658 i_termio=''
659 i_termios=''
660 i_systime=''
661 i_systimek=''
662 i_time=''
663 timeincl=''
664 i_unistd=''
665 i_utime=''
666 i_values=''
667 i_stdarg=''
668 i_varargs=''
669 i_varhdr=''
670 i_vfork=''
671 installprefix=''
672 installprefixexp=''
673 installstyle=''
674 installusrbinperl=''
675 intsize=''
676 longsize=''
677 shortsize=''
678 d_fpos64_t=''
679 d_llseek=''
680 d_off64_t=''
681 libc=''
682 ldlibpthname=''
683 libperl=''
684 shrpenv=''
685 useshrplib=''
686 glibpth=''
687 libpth=''
688 loclibpth=''
689 plibpth=''
690 xlibpth=''
691 ignore_versioned_solibs=''
692 libs=''
693 lns=''
694 d_PRIEldbl=''
695 d_PRIFldbl=''
696 d_PRIGldbl=''
697 d_PRIeldbl=''
698 d_PRIfldbl=''
699 d_PRIgldbl=''
700 sPRIEldbl=''
701 sPRIFldbl=''
702 sPRIGldbl=''
703 sPRIeldbl=''
704 sPRIfldbl=''
705 sPRIgldbl=''
706 lseeksize=''
707 lseektype=''
708 make_set_make=''
709 d_mymalloc=''
710 freetype=''
711 mallocobj=''
712 mallocsrc=''
713 malloctype=''
714 usemymalloc=''
715 installman1dir=''
716 man1dir=''
717 man1direxp=''
718 man1ext=''
719 installman3dir=''
720 man3dir=''
721 man3direxp=''
722 man3ext=''
723 huge=''
724 large=''
725 medium=''
726 models=''
727 small=''
728 split=''
729 modetype=''
730 multiarch=''
731 mydomain=''
732 myhostname=''
733 phostname=''
734 c=''
735 n=''
736 d_eofnblk=''
737 eagain=''
738 o_nonblock=''
739 rd_nodata=''
740 netdb_hlen_type=''
741 netdb_host_type=''
742 netdb_name_type=''
743 netdb_net_type=''
744 groupcat=''
745 hostcat=''
746 passcat=''
747 orderlib=''
748 ranlib=''
749 package=''
750 spackage=''
751 pager=''
752 apiversion=''
753 patchlevel=''
754 subversion=''
755 version=''
756 perladmin=''
757 perlpath=''
758 pidtype=''
759 prefix=''
760 prefixexp=''
761 installprivlib=''
762 privlib=''
763 privlibexp=''
764 prototype=''
765 ptrsize=''
766 d_PRIX64=''
767 d_PRId64=''
768 d_PRIi64=''
769 d_PRIo64=''
770 d_PRIu64=''
771 d_PRIx64=''
772 sPRIX64=''
773 sPRId64=''
774 sPRIi64=''
775 sPRIo64=''
776 sPRIu64=''
777 sPRIx64=''
778 drand01=''
779 randbits=''
780 randfunc=''
781 randseedtype=''
782 seedfunc=''
783 installscript=''
784 scriptdir=''
785 scriptdirexp=''
786 selectminbits=''
787 selecttype=''
788 sh=''
789 sig_count=''
790 sig_name=''
791 sig_name_init=''
792 sig_num=''
793 sig_num_init=''
794 installsitearch=''
795 sitearch=''
796 sitearchexp=''
797 installsitelib=''
798 sitelib=''
799 sitelibexp=''
800 siteprefix=''
801 siteprefixexp=''
802 sizetype=''
803 so=''
804 sharpbang=''
805 shsharp=''
806 spitshell=''
807 src=''
808 ssizetype=''
809 startperl=''
810 startsh=''
811 stdchar=''
812 d_stdio_stream_array=''
813 stdio_stream_array=''
814 d_strtoull=''
815 sysman=''
816 trnl=''
817 uidtype=''
818 archname64=''
819 use64bits=''
820 uselargefiles=''
821 uselongdouble=''
822 usemorebits=''
823 usemultiplicity=''
824 nm_opt=''
825 nm_so_opt=''
826 runnm=''
827 usenm=''
828 useperlio=''
829 usesocks=''
830 d_oldpthreads=''
831 usethreads=''
832 incpath=''
833 mips=''
834 mips_type=''
835 usrinc=''
836 d_vendorlib=''
837 installvendorlib=''
838 vendorlib=''
839 vendorlibexp=''
840 usevendorprefix=''
841 vendorprefix=''
842 vendorprefixexp=''
843 defvoidused=''
844 voidflags=''
845 CONFIG=''
846
847 define='define'
848 undef='undef'
849 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
850 rmlist=''
851
852 : We must find out about Eunice early
853 eunicefix=':'
854 if test -f /etc/unixtovms; then
855         eunicefix=/etc/unixtovms
856 fi
857 if test -f /etc/unixtovms.exe; then
858         eunicefix=/etc/unixtovms.exe
859 fi
860
861 i_whoami=''
862 : Possible local include directories to search.
863 : Set locincpth to "" in a hint file to defeat local include searches.
864 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
865 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
866 :
867 : no include file wanted by default
868 inclwanted=''
869
870 : list of known cpp symbols, sorted alphabetically
871 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
872 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
873 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
874 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
875 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
876 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
877 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
878 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
879 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
880 al="$al VMS Xenix286"
881 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
882 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
883 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
884 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
885 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
886 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
887 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
888 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
889 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
890 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
891 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
892 al="$al __SVR4_2__ __UMAXV__"
893 al="$al ____386BSD____ __alpha __alpha__ __amiga"
894 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
895 al="$al __host_mips__"
896 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
897 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
898 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
899 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
900 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
901 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
902 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
903 al="$al __mc88100 __mc88100__ __mips __mips__"
904 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
905 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
906 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
907 al="$al _host_mips _mips _unix"
908 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
909 al="$al apollo ardent att386 att3b"
910 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
911 al="$al cadmus clipper concurrent convex cray ctix"
912 al="$al dmert encore gcos gcx gimpel gould"
913 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
914 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
915 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
916 al="$al i186 i286 i386 i486 i8086"
917 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
918 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
919 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
920 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
921 al="$al mc88000 mc88100 merlin mert mips mvs n16"
922 al="$al ncl_el ncl_mr"
923 al="$al news1500 news1700 news1800 news1900 news3700"
924 al="$al news700 news800 news900 ns16000 ns32000"
925 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
926 al="$al parisc pc532 pdp11 plexus posix pyr"
927 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
928 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
929 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
930 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
931 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
932 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
933 al="$al xenix z8000"
934
935 : Trailing extension.  Override this in a hint file, if needed.
936 _exe=''
937 : Extra object files, if any, needed on this platform.
938 archobjs=''
939 groupstype=''
940 : change the next line if compiling for Xenix/286 on Xenix/386
941 xlibpth='/usr/lib/386 /lib/386'
942
943 : Possible local library directories to search.
944 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
945 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
946
947 : general looking path for locating libraries
948 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
949 glibpth="$glibpth /lib /usr/lib $xlibpth"
950 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
951 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
952
953 : Private path used by Configure to find libraries.  Its value
954 : is prepended to libpth. This variable takes care of special
955 : machines, like the mips.  Usually, it should be empty.
956 plibpth=''
957
958 : default library list
959 libswanted=''
960 : some systems want to use only the non-versioned libso:s
961 ignore_versioned_solibs=''
962 : full support for void wanted by default
963 defvoidused=15
964
965 : set useposix=false in your hint file to disable the POSIX extension.
966 useposix=true
967 : set useopcode=false in your hint file to disable the Opcode extension.
968 useopcode=true
969 : set usemultiplicity on the Configure command line to enable multiplicity.
970 : set usesocks on the Configure command line to enable socks.
971 : set usethreads on the Configure command line to enable threads.
972 : List of libraries we want.
973 : If anyone needs -lnet, put it in a hint file.
974 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
975 libswanted="$libswanted dld ld sun m c cposix posix"
976 libswanted="$libswanted ndir dir crypt sec"
977 libswanted="$libswanted ucb bsd BSD PW x"
978 : We probably want to search /usr/shlib before most other libraries.
979 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
980 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
981 glibpth="/usr/shlib $glibpth"
982 : Do not use vfork unless overridden by a hint file.
983 usevfork=false
984
985 : Find the basic shell for Bourne shell scripts
986 case "$sh" in
987 '')
988         case "$SYSTYPE" in
989         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
990         *) xxx='/bin/sh';;
991         esac
992         if test -f "$xxx"; then
993                 sh="$xxx"
994         else
995                 : Build up a list and do a single loop so we can 'break' out.
996                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
997                 for xxx in sh bash ksh pdksh ash; do
998                         for p in $pth; do
999                                 try="$try ${p}/${xxx}"
1000                         done
1001                 done
1002                 for xxx in $try; do
1003                         if test -f "$xxx"; then
1004                                 sh="$xxx";
1005                                 break
1006                         elif test -f "$xxx.exe"; then
1007                                 sh="$xxx";
1008                                 break
1009                         fi
1010                 done
1011         fi
1012         ;;
1013 esac
1014
1015 case "$sh" in
1016 '')     cat <<EOM >&2
1017 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1018
1019 Usually it's in /bin/sh.  How did you even get this far?
1020 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1021 we'll try to straighten this all out.
1022 EOM
1023         exit 1
1024         ;;
1025 esac
1026
1027 : see if sh knows # comments
1028 if `$sh -c '#' >/dev/null 2>&1`; then
1029         shsharp=true
1030         spitshell=cat
1031         xcat=/bin/cat
1032         test -f $xcat || xcat=/usr/bin/cat
1033         echo "#!$xcat" >try
1034         $eunicefix try
1035         chmod +x try
1036         ./try > today
1037         if test -s today; then
1038                 sharpbang='#!'
1039         else
1040                 echo "#! $xcat" > try
1041                 $eunicefix try
1042                 chmod +x try
1043                 ./try > today
1044                 if test -s today; then
1045                         sharpbang='#! '
1046                 else
1047                         sharpbang=': use '
1048                 fi
1049         fi
1050 else
1051         echo " "
1052         echo "Your $sh doesn't grok # comments--I will strip them later on."
1053         shsharp=false
1054         cd ..
1055         echo "exec grep -v '^[  ]*#'" >spitshell
1056         chmod +x spitshell
1057         $eunicefix spitshell
1058         spitshell=`pwd`/spitshell
1059         cd UU
1060         echo "I presume that if # doesn't work, #! won't work either!"
1061         sharpbang=': use '
1062 fi
1063 rm -f try today
1064
1065 : figure out how to guarantee sh startup
1066 case "$startsh" in
1067 '') startsh=${sharpbang}${sh} ;;
1068 *)
1069 esac
1070 cat >try <<EOSS
1071 $startsh
1072 set abc
1073 test "$?abc" != 1
1074 EOSS
1075
1076 chmod +x try
1077 $eunicefix try
1078 if ./try; then
1079         : echo "Yup, it does."
1080 else
1081         echo "Hmm... '$startsh' does not guarantee sh startup..."
1082         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1083 fi
1084 rm -f try
1085
1086
1087 : Save command line options in file UU/cmdline.opt for later use in
1088 : generating config.sh.
1089 cat > cmdline.opt <<EOSH
1090 # Configure command line arguments.
1091 config_arg0='$0'
1092 config_args='$*'
1093 config_argc=$#
1094 EOSH
1095 argn=1
1096 for arg in "$@"; do
1097         cat >>cmdline.opt <<EOSH
1098 config_arg$argn='$arg'
1099 EOSH
1100         argn=`expr $argn + 1`
1101 done
1102
1103 : produce awk script to parse command line options
1104 cat >options.awk <<'EOF'
1105 BEGIN {
1106         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1107
1108         len = length(optstr);
1109         for (i = 1; i <= len; i++) {
1110                 c = substr(optstr, i, 1);
1111                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1112                 if (a == ":") {
1113                         arg[c] = 1;
1114                         i++;
1115                 }
1116                 opt[c] = 1;
1117         }
1118 }
1119 {
1120         expect = 0;
1121         str = $0;
1122         if (substr(str, 1, 1) != "-") {
1123                 printf("'%s'\n", str);
1124                 next;
1125         }
1126         len = length($0);
1127         for (i = 2; i <= len; i++) {
1128                 c = substr(str, i, 1);
1129                 if (!opt[c]) {
1130                         printf("-%s\n", substr(str, i));
1131                         next;
1132                 }
1133                 printf("-%s\n", c);
1134                 if (arg[c]) {
1135                         if (i < len)
1136                                 printf("'%s'\n", substr(str, i + 1));
1137                         else
1138                                 expect = 1;
1139                         next;
1140                 }
1141         }
1142 }
1143 END {
1144         if (expect)
1145                 print "?";
1146 }
1147 EOF
1148
1149 : process the command line options
1150 set X `for arg in "$@"; do echo "X$arg"; done |
1151         sed -e s/X// | awk -f options.awk`
1152 eval "set $*"
1153 shift
1154 rm -f options.awk
1155
1156 : set up default values
1157 fastread=''
1158 reuseval=false
1159 config_sh=''
1160 alldone=''
1161 error=''
1162 silent=''
1163 extractsh=''
1164 override=''
1165 knowitall=''
1166 rm -f optdef.sh posthint.sh
1167 cat >optdef.sh <<EOS
1168 $startsh
1169 EOS
1170
1171
1172 : option parsing
1173 while test $# -gt 0; do
1174         case "$1" in
1175         -d) shift; fastread=yes;;
1176         -e) shift; alldone=cont;;
1177         -f)
1178                 shift
1179                 cd ..
1180                 if test -r "$1"; then
1181                         config_sh="$1"
1182                 else
1183                         echo "$me: cannot read config file $1." >&2
1184                         error=true
1185                 fi
1186                 cd UU
1187                 shift;;
1188         -h) shift; error=true;;
1189         -r) shift; reuseval=true;;
1190         -s) shift; silent=true; realsilent=true;;
1191         -E) shift; alldone=exit;;
1192         -K) shift; knowitall=true;;
1193         -O) shift; override=true;;
1194         -S) shift; silent=true; extractsh=true;;
1195         -D)
1196                 shift
1197                 case "$1" in
1198                 *=)
1199                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1200                         echo "$me: ignoring -D $1" >&2
1201                         ;;
1202                 *=*) echo "$1" | \
1203                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1204                 *) echo "$1='define'" >> optdef.sh;;
1205                 esac
1206                 shift
1207                 ;;
1208         -U)
1209                 shift
1210                 case "$1" in
1211                 *=) echo "$1" >> optdef.sh;;
1212                 *=*)
1213                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1214                         echo "$me: ignoring -U $1" >&2
1215                         ;;
1216                 *) echo "$1='undef'" >> optdef.sh;;
1217                 esac
1218                 shift
1219                 ;;
1220         -A)
1221             shift
1222             xxx=''
1223             yyy="$1"
1224             zzz=''
1225             uuu=undef
1226             case "$yyy" in
1227             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1228                  case "$zzz" in
1229                  *:*) zzz='' ;;
1230                  *)   xxx=append
1231                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1232                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1233                  esac
1234                  ;;
1235             esac
1236             case "$xxx" in
1237             '')  case "$yyy" in
1238                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1239                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1240                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1241                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1242                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1243                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1244                  esac
1245                  ;;       
1246             esac
1247             case "$xxx" in
1248             append)
1249                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1250             clear)
1251                 echo "$yyy=''"                  >> posthint.sh ;;
1252             define)
1253                 case "$zzz" in
1254                 '') zzz=define ;;
1255                 esac
1256                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1257             eval)
1258                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1259             prepend)
1260                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1261             undef)
1262                 case "$zzz" in
1263                 '') zzz="$uuu" ;;
1264                 esac
1265                 echo "$yyy=$zzz"                >> posthint.sh ;;
1266             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1267             esac
1268             ;;
1269         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1270             exit 0;;
1271         --) break;;
1272         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1273         *) break;;
1274         esac
1275 done
1276
1277 case "$error" in
1278 true)
1279         cat >&2 <<EOM
1280 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1281                  [-U symbol] [-U symbol=] [-A command:symbol...]
1282   -d : use defaults for all answers.
1283   -e : go on without questioning past the production of config.sh.
1284   -f : specify an alternate default configuration file.
1285   -h : print this help message and exit (with an error status).
1286   -r : reuse C symbols value if possible (skips costly nm extraction).
1287   -s : silent mode, only echoes questions and essential information.
1288   -D : define symbol to have some value:
1289          -D symbol         symbol gets the value 'define'
1290          -D symbol=value   symbol gets the value 'value'
1291   -E : stop at the end of questions, after having produced config.sh.
1292   -K : do not use unless you know what you are doing.
1293   -O : let -D and -U override definitions from loaded configuration file.
1294   -S : perform variable substitutions on all .SH files (can mix with -f)
1295   -U : undefine symbol:
1296          -U symbol    symbol gets the value 'undef'
1297          -U symbol=   symbol gets completely empty
1298   -A : manipulate symbol after the platform specific hints have been applied:
1299          -A symbol=value                append " "value to symbol
1300          -A append:symbol=value         append value to symbol
1301          -A define:symbol=value         define symbol to have value
1302          -A clear:symbol                define symbol to be ''
1303          -A define:symbol               define symbol to be 'define'
1304          -A eval:symbol=value           define symbol to be eval of value
1305          -A prepend:symbol=value        prepend value to symbol
1306          -A undef:symbol                define symbol to be 'undef'
1307          -A undef:symbol=               define symbol to be ''
1308   -V : print version number and exit (with a zero status).
1309 EOM
1310         exit 1
1311         ;;
1312 esac
1313
1314 : Sanity checks
1315 case "$fastread$alldone" in
1316 yescont|yesexit) ;;
1317 *)
1318         if test ! -t 0; then
1319                 echo "Say 'sh Configure', not 'sh <Configure'"
1320                 exit 1
1321         fi
1322         ;;
1323 esac
1324
1325 exec 4>&1
1326 case "$silent" in
1327 true) exec 1>/dev/null;;
1328 esac
1329
1330 : run the defines and the undefines, if any, but leave the file out there...
1331 touch optdef.sh
1332 . ./optdef.sh
1333 : create the posthint manipulation script and leave the file out there...
1334 touch posthint.sh
1335
1336 : set package name
1337 package=perl5
1338 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1339 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1340 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1341 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1342 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1343 esac
1344
1345 : Some greps do not return status, grrr.
1346 echo "grimblepritz" >grimble
1347 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1348         contains=contains
1349 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1350         contains=grep
1351 else
1352         contains=contains
1353 fi
1354 rm -f grimble
1355 : the following should work in any shell
1356 case "$contains" in
1357 contains*)
1358         echo " "
1359         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1360         cat >contains <<'EOSS'
1361 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1362 EOSS
1363 chmod +x contains
1364 esac
1365
1366 : Find the path to the source tree
1367 case "$src" in
1368 '') case "$0" in
1369     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1370          case "$src" in
1371          /*)    ;;
1372          *)     src=`cd ../$src && pwd` ;;
1373          esac
1374          ;;
1375     *)   src='.';;
1376     esac;;
1377 esac
1378 case "$src" in
1379 '')     src=/
1380         rsrc=/
1381         ;;
1382 /*) rsrc="$src";;
1383 *) rsrc="../$src";;
1384 esac
1385 if test -f $rsrc/Configure && \
1386         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1387 then
1388    : found it, so we are ok.
1389 else
1390         rsrc=''
1391         for src in . .. ../.. ../../.. ../../../..; do
1392                 if test -f ../$src/Configure && \
1393                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1394                 then
1395                         rsrc=../$src
1396                         break
1397                 fi
1398         done
1399 fi
1400 case "$rsrc" in
1401 '')
1402         cat <<EOM >&4
1403
1404 Sorry, I can't seem to locate the source dir for $package.  Please start
1405 Configure with an explicit path -- i.e. /some/path/Configure.
1406
1407 EOM
1408         exit 1
1409         ;;
1410 ../.)   rsrc='..';;
1411 *)
1412         echo " "
1413         echo "Sources for $package found in \"$src\"." >&4
1414         ;;
1415 esac
1416
1417 : script used to extract .SH files with variable substitutions
1418 cat >extract <<'EOS'
1419 CONFIGDOTSH=true
1420 echo "Doing variable substitutions on .SH files..."
1421 if test -f $src/MANIFEST; then
1422         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1423 else
1424         echo "(Looking for .SH files under the source directory.)"
1425         set x `(cd $src; find . -name "*.SH" -print)`
1426 fi
1427 shift
1428 case $# in
1429 0) set x `(cd $src; echo *.SH)`; shift;;
1430 esac
1431 if test ! -f $src/$1; then
1432         shift
1433 fi
1434 mkdir_p='
1435 name=$1;
1436 create="";
1437 while test $name; do
1438         if test ! -d "$name"; then
1439                 create="$name $create";
1440                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1441                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1442         else
1443                 name="";
1444         fi;
1445 done;
1446 for file in $create; do
1447         mkdir $file;
1448 done
1449 '
1450 for file in $*; do
1451         case "$src" in
1452         ".")
1453                 case "$file" in
1454                 */*)
1455                         dir=`expr X$file : 'X\(.*\)/'`
1456                         file=`expr X$file : 'X.*/\(.*\)'`
1457                         (cd $dir && . ./$file)
1458                         ;;
1459                 *)
1460                         . ./$file
1461                         ;;
1462                 esac
1463                 ;;
1464         *)
1465                 case "$file" in
1466                 */*)
1467                         dir=`expr X$file : 'X\(.*\)/'`
1468                         file=`expr X$file : 'X.*/\(.*\)'`
1469                         (set x $dir; shift; eval $mkdir_p)
1470                         sh <$src/$dir/$file
1471                         ;;
1472                 *)
1473                         sh <$src/$file
1474                         ;;
1475                 esac
1476                 ;;
1477         esac
1478 done
1479 if test -f $src/config_h.SH; then
1480         if test ! -f config.h; then
1481         : oops, they left it out of MANIFEST, probably, so do it anyway.
1482         . $src/config_h.SH
1483         fi
1484 fi
1485 EOS
1486
1487 : extract files and exit if asked to do so
1488 case "$extractsh" in
1489 true)
1490         case "$realsilent" in
1491         true) ;;
1492         *) exec 1>&4;;
1493         esac
1494         case "$config_sh" in
1495         '') config_sh='config.sh';;
1496         esac
1497         echo " "
1498         echo "Fetching answers from $config_sh..."
1499         cd ..
1500         . $config_sh
1501         test "$override" && . ./optdef.sh
1502         echo " "
1503         . UU/extract
1504         rm -rf UU
1505         echo "Done."
1506         exit 0
1507         ;;
1508 esac
1509
1510 : Eunice requires " " instead of "", can you believe it
1511 echo " "
1512 : Here we go...
1513 echo "Beginning of configuration questions for $package."
1514
1515 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1516
1517 : first determine how to suppress newline on echo command
1518 echo " "
1519 echo "Checking echo to see how to suppress newlines..."
1520 (echo "hi there\c" ; echo " ") >.echotmp
1521 if $contains c .echotmp >/dev/null 2>&1 ; then
1522         echo "...using -n."
1523         n='-n'
1524         c=''
1525 else
1526         cat <<'EOM'
1527 ...using \c
1528 EOM
1529         n=''
1530         c='\c'
1531 fi
1532 echo $n "The star should be here-->$c"
1533 echo '*'
1534 rm -f .echotmp
1535
1536 : Now test for existence of everything in MANIFEST
1537 echo " "
1538 if test -f $rsrc/MANIFEST; then
1539         echo "First let's make sure your kit is complete.  Checking..." >&4
1540         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1541         rm -f missing
1542         tmppwd=`pwd`
1543         for filelist in x??; do
1544                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1545         done
1546         if test -s missing; then
1547                 cat missing >&4
1548                 cat >&4 <<'EOM'
1549
1550 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1551
1552 You have the option of continuing the configuration process, despite the
1553 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1554 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1555 and contact the author (perlbug@perl.com).
1556
1557 EOM
1558                 echo $n "Continue? [n] $c" >&4
1559                 read ans
1560                 case "$ans" in
1561                 y*)
1562                         echo "Continuing..." >&4
1563                         rm -f missing
1564                         ;;
1565                 *)
1566                         echo "ABORTING..." >&4
1567                         kill $$
1568                         ;;
1569                 esac
1570         else
1571                 echo "Looks good..."
1572         fi
1573 else
1574         echo "There is no MANIFEST file.  I hope your kit is complete !"
1575 fi
1576 rm -f missing x??
1577
1578 echo " "
1579 : Find the appropriate value for a newline for tr
1580 if test -n "$DJGPP"; then
1581        trnl='\012'
1582 fi
1583 if test X"$trnl" = X; then
1584         case "`echo foo|tr '\n' x 2>/dev/null`" in
1585         foox) trnl='\n' ;;
1586         esac
1587 fi
1588 if test X"$trnl" = X; then
1589         case "`echo foo|tr '\012' x 2>/dev/null`" in
1590         foox) trnl='\012' ;;
1591         esac
1592 fi
1593 if test X"$trnl" = X; then
1594         cat <<EOM >&2
1595
1596 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1597
1598 EOM
1599         exit 1
1600 fi
1601
1602 : compute the number of columns on the terminal for proper question formatting
1603 case "$COLUMNS" in
1604 '') COLUMNS='80';;
1605 esac
1606
1607 : set up the echo used in my read
1608 myecho="case \"\$xxxm\" in
1609 '') echo $n \"\$rp $c\" >&4;;
1610 *) case \"\$rp\" in
1611         '') echo $n \"[\$xxxm] $c\";;
1612         *)
1613                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1614                         echo \"\$rp\" >&4
1615                         echo $n \"[\$xxxm] $c\" >&4
1616                 else
1617                         echo $n \"\$rp [\$xxxm] $c\" >&4
1618                 fi
1619                 ;;
1620         esac;;
1621 esac"
1622
1623 : now set up to do reads with possible shell escape and default assignment
1624 cat <<EOSC >myread
1625 $startsh
1626 xxxm=\$dflt
1627 $myecho
1628 ans='!'
1629 case "\$fastread" in
1630 yes) case "\$dflt" in
1631         '') ;;
1632         *) ans='';
1633                 case "\$silent-\$rp" in
1634                 true-) ;;
1635                 *) echo " " >&4;;
1636                 esac;;
1637         esac;;
1638 *) case "\$silent" in
1639         true) case "\$rp" in
1640                 '') ans='';;
1641                 esac;;
1642         esac;;
1643 esac
1644 while expr "X\$ans" : "X!" >/dev/null; do
1645         read answ
1646         set x \$xxxm
1647         shift
1648         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1649         case  "\$answ" in
1650         "!")
1651                 sh 1>&4
1652                 echo " "
1653                 $myecho
1654                 ;;
1655         !*)
1656                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1657                 shift
1658                 sh 1>&4 -c "\$*"
1659                 echo " "
1660                 $myecho
1661                 ;;
1662         "\$ans")
1663                 case "\$ans" in
1664                 \\&*)
1665                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1666                         shift
1667                         case "\$1" in
1668                         -d)
1669                                 fastread=yes
1670                                 echo "(OK, I'll run with -d after this question.)" >&4
1671                                 ;;
1672                         -*)
1673                                 echo "*** Sorry, \$1 not supported yet." >&4
1674                                 ;;
1675                         esac
1676                         $myecho
1677                         ans=!
1678                         ;;
1679                 esac;;
1680         *)
1681                 case "\$aok" in
1682                 y)
1683                         echo "*** Substitution done -- please confirm."
1684                         xxxm="\$ans"
1685                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1686                         xxxm="\$ans"
1687                         ans=!
1688                         ;;
1689                 *)
1690                         echo "*** Error -- try again."
1691                         ans=!
1692                         ;;
1693                 esac
1694                 $myecho
1695                 ;;
1696         esac
1697         case "\$ans\$xxxm\$nostick" in
1698         '')
1699                 ans=!
1700                 $myecho
1701                 ;;
1702         esac
1703 done
1704 case "\$ans" in
1705 '') ans="\$xxxm";;
1706 esac
1707 EOSC
1708
1709 : create .config dir to save info across Configure sessions
1710 test -d ../.config || mkdir ../.config
1711 cat >../.config/README <<EOF
1712 This directory created by Configure to save information that should
1713 persist across sessions for $package.
1714
1715 You may safely delete it if you wish.
1716 EOF
1717
1718 : general instructions
1719 needman=true
1720 firsttime=true
1721 user=`(logname) 2>/dev/null`
1722 case "$user" in
1723 '') user=`whoami 2>&1`;;
1724 esac
1725 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1726         firsttime=false
1727         echo " "
1728         rp='Would you like to see the instructions?'
1729         dflt=n
1730         . ./myread
1731         case "$ans" in
1732         [yY]*) ;;
1733         *) needman=false;;
1734         esac
1735 fi
1736 if $needman; then
1737         cat <<EOH
1738
1739 This installation shell script will examine your system and ask you questions
1740 to determine how the perl5 package should be installed. If you get
1741 stuck on a question, you may use a ! shell escape to start a subshell or
1742 execute a command.  Many of the questions will have default answers in square
1743 brackets; typing carriage return will give you the default.
1744
1745 On some of the questions which ask for file or directory names you are allowed
1746 to use the ~name construct to specify the login directory belonging to "name",
1747 even if you don't have a shell which knows about that.  Questions where this is
1748 allowed will be marked "(~name ok)".
1749
1750 EOH
1751         rp=''
1752         dflt='Type carriage return to continue'
1753         . ./myread
1754         cat <<'EOH'
1755
1756 The prompter used in this script allows you to use shell variables and
1757 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1758 in the default answer, as if the default line was a set of arguments given to a
1759 script shell.  This means you may also use $* to repeat the whole default line,
1760 so you do not have to re-type everything to add something to the default.
1761
1762 Everytime there is a substitution, you will have to confirm.  If there is an
1763 error (e.g. an unmatched backtick), the default answer will remain unchanged
1764 and you will be prompted again.
1765
1766 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1767 the questions and use the computed defaults (or the previous answers if there
1768 was already a config.sh file). Type 'Configure -h' for a list of options.
1769 You may also start interactively and then answer '& -d' at any prompt to turn
1770 on the non-interactive behaviour for the remainder of the execution.
1771
1772 EOH
1773         . ./myread
1774         cat <<EOH
1775
1776 Much effort has been expended to ensure that this shell script will run on any
1777 Unix system.  If despite that it blows up on yours, your best bet is to edit
1778 Configure and run it again.  If you can't run Configure for some reason,
1779 you'll have to generate a config.sh file by hand.  Whatever problems you
1780 have, let me (perlbug@perl.com) know how I blew it.
1781
1782 This installation script affects things in two ways:
1783
1784 1) it may do direct variable substitutions on some of the files included
1785    in this kit.
1786 2) it builds a config.h file for inclusion in C programs.  You may edit
1787    any of these files as the need arises after running this script.
1788
1789 If you make a mistake on a question, there is no easy way to back up to it
1790 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1791 files.  Configure will offer to let you do this before it runs the SH files.
1792
1793 EOH
1794         dflt='Type carriage return to continue'
1795         . ./myread
1796         case "$firsttime" in
1797         true) echo $user >>../.config/instruct;;
1798         esac
1799 fi
1800
1801 : find out where common programs are
1802 echo " "
1803 echo "Locating common programs..." >&4
1804 cat <<EOSC >loc
1805 $startsh
1806 case \$# in
1807 0) exit 1;;
1808 esac
1809 thing=\$1
1810 shift
1811 dflt=\$1
1812 shift
1813 for dir in \$*; do
1814         case "\$thing" in
1815         .)
1816         if test -d \$dir/\$thing; then
1817                 echo \$dir
1818                 exit 0
1819         fi
1820         ;;
1821         *)
1822         for thisthing in \$dir/\$thing; do
1823                 : just loop through to pick last item
1824         done
1825         if test -f \$thisthing; then
1826                 echo \$thisthing
1827                 exit 0
1828         elif test -f \$dir/\$thing.exe; then
1829                 if test -n "$DJGPP"; then
1830                         echo \$dir/\$thing.exe
1831                 else
1832                         : on Eunice apparently
1833                         echo \$dir/\$thing
1834                 fi
1835                 exit 0
1836         fi
1837         ;;
1838         esac
1839 done
1840 echo \$dflt
1841 exit 1
1842 EOSC
1843 chmod +x loc
1844 $eunicefix loc
1845 loclist="
1846 awk
1847 cat
1848 comm
1849 cp
1850 echo
1851 expr
1852 grep
1853 ls
1854 make
1855 mkdir
1856 rm
1857 sed
1858 sort
1859 touch
1860 tr
1861 uniq
1862 "
1863 trylist="
1864 Mcc
1865 ar
1866 byacc
1867 cpp
1868 csh
1869 date
1870 egrep
1871 gzip
1872 less
1873 ln
1874 more
1875 nm
1876 nroff
1877 pg
1878 test
1879 uname
1880 zip
1881 "
1882 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1883 pth="$pth /lib /usr/lib"
1884 for file in $loclist; 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 know where '$file' is, and my life depends on it." >&4
1909                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1910                 exit 1
1911                 ;;
1912         esac
1913 done
1914 echo " "
1915 echo "Don't worry if any of the following aren't found..."
1916 say=offhand
1917 for file in $trylist; do
1918         eval xxx=\$$file
1919         case "$xxx" in
1920         /*|?:[\\/]*)
1921                 if test -f "$xxx"; then
1922                         : ok
1923                 else
1924                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1925                         xxx=`./loc $file $file $pth`
1926                 fi
1927                 ;;
1928         '') xxx=`./loc $file $file $pth`;;
1929         *) xxx=`./loc $xxx $xxx $pth`;;
1930         esac
1931         eval $file=$xxx
1932         eval _$file=$xxx
1933         case "$xxx" in
1934         /*)
1935                 echo $file is in $xxx.
1936                 ;;
1937         ?:[\\/]*)
1938                 echo $file is in $xxx.
1939                 ;;
1940         *)
1941                 echo "I don't see $file out there, $say."
1942                 say=either
1943                 ;;
1944         esac
1945 done
1946 case "$egrep" in
1947 egrep)
1948         echo "Substituting grep for egrep."
1949         egrep=$grep
1950         ;;
1951 esac
1952 case "$ln" in
1953 ln)
1954         echo "Substituting cp for ln."
1955         ln=$cp
1956         ;;
1957 esac
1958 case "$test" in
1959 test)
1960         echo "Hopefully test is built into your sh."
1961         ;;
1962 *)
1963         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1964                 echo "Using the test built into your sh."
1965                 test=test
1966                 _test=test
1967         fi
1968         ;;
1969 esac
1970 case "$echo" in
1971 echo)
1972         echo "Hopefully echo is built into your sh."
1973         ;;
1974 '') ;;
1975 *)
1976         echo " "
1977 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1978         $echo $n "hi there$c" >foo1
1979         echo $n "hi there$c" >foo2
1980         if cmp foo1 foo2 >/dev/null 2>&1; then
1981                 echo "They are compatible.  In fact, they may be identical."
1982         else
1983                 case "$n" in
1984                 '-n') n='' c='\c';;
1985                 *) n='-n' c='';;
1986                 esac
1987                 cat <<FOO
1988 They are not compatible!  You are probably running ksh on a non-USG system.
1989 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1990 have echo built in and we may have to run some Bourne shell scripts.  That
1991 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1992
1993 FOO
1994                 $echo $n "The star should be here-->$c"
1995                 $echo "*"
1996         fi
1997         $rm -f foo1 foo2
1998         ;;
1999 esac
2000
2001 : determine whether symbolic links are supported
2002 echo " "
2003 $touch blurfl
2004 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2005         echo "Symbolic links are supported." >&4
2006         lns="$ln -s"
2007 else
2008         echo "Symbolic links are NOT supported." >&4
2009         lns="$ln"
2010 fi
2011 $rm -f blurfl sym
2012
2013 : see whether [:lower:] and [:upper:] are supported character classes
2014 echo " "
2015 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2016 ABYZ)
2017         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2018         up='[:upper:]'
2019         low='[:lower:]'
2020         ;;
2021 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2022         # (0xc9 and 0xd1), therefore that is a nice testing point.
2023         if test "X$up" = X -o "X$low" = X; then
2024             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2025             ij) up='[A-Z]'
2026                 low='[a-z]'
2027                 ;;
2028             esac
2029         fi
2030         if test "X$up" = X -o "X$low" = X; then
2031             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2032             ij) up='A-Z'
2033                 low='a-z'
2034                 ;;
2035             esac
2036         fi
2037         if test "X$up" = X -o "X$low" = X; then
2038             case "`echo IJ | od -x 2>/dev/null`" in
2039             *C9D1*|*c9d1*)
2040                 echo "Hey, this might be EBCDIC." >&4
2041                 if test "X$up" = X -o "X$low" = X; then
2042                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2043                     ij) up='[A-IJ-RS-Z]'
2044                         low='[a-ij-rs-z]'
2045                         ;;
2046                     esac
2047                 fi
2048                 if test "X$up" = X -o "X$low" = X; then
2049                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2050                     ij) up='A-IJ-RS-Z'
2051                         low='a-ij-rs-z'
2052                         ;;
2053                     esac
2054                 fi
2055                 ;;
2056             esac
2057         fi
2058 esac
2059 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2060 ij)
2061     echo "Using $up and $low to convert case." >&4
2062     ;;
2063 *)
2064     echo "I don't know how to translate letters from upper to lower case." >&4
2065     echo "Your tr is not acting any way I know of." >&4
2066     exit 1
2067     ;;
2068 esac
2069 : set up the translation script tr, must be called with ./tr of course
2070 cat >tr <<EOSC
2071 $startsh
2072 case "\$1\$2" in
2073 '[A-Z][a-z]') exec $tr '$up' '$low';;
2074 '[a-z][A-Z]') exec $tr '$low' '$up';;
2075 esac
2076 exec $tr "\$@"
2077 EOSC
2078 chmod +x tr
2079 $eunicefix tr
2080
2081 : Try to determine whether config.sh was made on this system
2082 case "$config_sh" in
2083 '')
2084 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2085 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2086 # because the A-Z/a-z are not consecutive.
2087 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2088         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2089 newmyuname="$myuname"
2090 dflt=n
2091 case "$knowitall" in
2092 '')
2093         if test -f ../config.sh; then
2094                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2095                         eval "`grep myuname= ../config.sh`"
2096                 fi
2097                 if test "X$myuname" = "X$newmyuname"; then
2098                         dflt=y
2099                 fi
2100         fi
2101         ;;
2102 *) dflt=y;;
2103 esac
2104
2105 : Get old answers from old config file if Configure was run on the
2106 : same system, otherwise use the hints.
2107 hint=default
2108 cd ..
2109 if test -f config.sh; then
2110         echo " "
2111         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2112         . UU/myread
2113         case "$ans" in
2114         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2115         *)  echo "Fetching default answers from your old config.sh file..." >&4
2116                 tmp_n="$n"
2117                 tmp_c="$c"
2118                 tmp_sh="$sh"
2119                 . ./config.sh
2120                 cp config.sh UU
2121                 n="$tmp_n"
2122                 c="$tmp_c"
2123                 : Older versions did not always set $sh.  Catch re-use of such
2124                 : an old config.sh.
2125                 case "$sh" in
2126                 '') sh="$tmp_sh" ;;
2127                 esac
2128                 hint=previous
2129                 ;;
2130         esac
2131 fi
2132 if test ! -f config.sh; then
2133         $cat <<EOM
2134
2135 First time through, eh?  I have some defaults handy for some systems
2136 that need some extra help getting the Configure answers right:
2137
2138 EOM
2139         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2140         dflt=''
2141         : Half the following guesses are probably wrong... If you have better
2142         : tests or hints, please send them to perlbug@perl.com
2143         : The metaconfig authors would also appreciate a copy...
2144         $test -f /irix && osname=irix
2145         $test -f /xenix && osname=sco_xenix
2146         $test -f /dynix && osname=dynix
2147         $test -f /dnix && osname=dnix
2148         $test -f /lynx.os && osname=lynxos
2149         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2150         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2151         $test -f /bin/mips && /bin/mips && osname=mips
2152         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2153                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2154         $test -d /usr/apollo/bin && osname=apollo
2155         $test -f /etc/saf/_sactab && osname=svr4
2156         $test -d /usr/include/minix && osname=minix
2157         if $test -d /MachTen -o -d /MachTen_Folder; then
2158                 osname=machten
2159                 if $test -x /sbin/version; then
2160                         osvers=`/sbin/version | $awk '{print $2}' |
2161                         $sed -e 's/[A-Za-z]$//'`
2162                 elif $test -x /usr/etc/version; then
2163                         osvers=`/usr/etc/version | $awk '{print $2}' |
2164                         $sed -e 's/[A-Za-z]$//'`
2165                 else
2166                         osvers="$2.$3"
2167                 fi
2168         fi
2169        $test -f /sys/posix.dll &&
2170                $test -f /usr/bin/what &&
2171                set X `/usr/bin/what /sys/posix.dll` &&
2172                $test "$3" = UWIN &&
2173                osname=uwin &&
2174                osvers="$5"
2175         if $test -f $uname; then
2176                 set X $myuname
2177                 shift
2178
2179                 case "$5" in
2180                 fps*) osname=fps ;;
2181                 mips*)
2182                         case "$4" in
2183                         umips) osname=umips ;;
2184                         *) osname=mips ;;
2185                         esac;;
2186                 [23]100) osname=mips ;;
2187                 next*) osname=next ;;
2188                 i386*)
2189                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2190                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2191                                 osname='sco'
2192                                 osvers=$tmp
2193                         elif $test -f /etc/kconfig; then
2194                                 osname=isc
2195                                 if test "$lns" = "$ln -s"; then
2196                                         osvers=4
2197                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2198                                         osvers=3
2199                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2200                                         osvers=2
2201                                 fi
2202                         fi
2203                         tmp=''
2204                         ;;
2205                 pc*)
2206                         if test -n "$DJGPP"; then
2207                                 osname=dos
2208                                 osvers=djgpp
2209                         fi
2210                         ;;
2211                 esac
2212
2213                 case "$1" in
2214                 aix) osname=aix
2215                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2216                         case "$tmp" in
2217                         'not found') osvers="$4"."$3" ;;
2218                         '<3240'|'<>3240') osvers=3.2.0 ;;
2219                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2220                         '=3250'|'>3250') osvers=3.2.5 ;;
2221                         *) osvers=$tmp;;
2222                         esac
2223                         ;;
2224                 *dc.osx) osname=dcosx
2225                         osvers="$3"
2226                         ;;
2227                 dnix) osname=dnix
2228                         osvers="$3"
2229                         ;;
2230                 domainos) osname=apollo
2231                         osvers="$3"
2232                         ;;
2233                 dgux) osname=dgux 
2234                         osvers="$3"
2235                         ;;
2236                 dynixptx*) osname=dynixptx
2237                         osvers=`echo "$4"|sed 's/^v//'`
2238                         ;;
2239                 freebsd) osname=freebsd 
2240                         osvers="$3" ;;
2241                 genix) osname=genix ;;
2242                 hp*) osname=hpux 
2243                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2244                         ;;
2245                 irix*) osname=irix
2246                         case "$3" in
2247                         4*) osvers=4 ;;
2248                         5*) osvers=5 ;;
2249                         *)      osvers="$3" ;;
2250                         esac
2251                         ;;
2252                 linux) osname=linux
2253                         case "$3" in
2254                         *)      osvers="$3" ;;
2255                         esac
2256                         ;;
2257                 MiNT) osname=mint
2258                         ;;
2259                 netbsd*) osname=netbsd
2260                         osvers="$3"
2261                         ;;
2262                 news-os) osvers="$3"
2263                         case "$3" in
2264                         4*) osname=newsos4 ;;
2265                         *) osname=newsos ;;
2266                         esac
2267                         ;;
2268                 bsd386) osname=bsd386
2269                         osvers=`$uname -r`
2270                         ;;
2271                 POSIX-BC | posix-bc ) osname=posix-bc
2272                         osvers="$3"
2273                         ;;
2274                 powerux | power_ux | powermax_os | powermaxos | \
2275                 powerunix | power_unix) osname=powerux
2276                         osvers="$3"
2277                         ;;
2278                 next*) osname=next ;;
2279                 solaris) osname=solaris
2280                         case "$3" in
2281                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2282                         *)      osvers="$3" ;;
2283                         esac
2284                         ;;
2285                 sunos) osname=sunos
2286                         case "$3" in
2287                         5*) osname=solaris
2288                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2289                         *)      osvers="$3" ;;
2290                         esac
2291                         ;;
2292                 titanos) osname=titanos
2293                         case "$3" in
2294                         1*) osvers=1 ;;
2295                         2*) osvers=2 ;;
2296                         3*) osvers=3 ;;
2297                         4*) osvers=4 ;;
2298                         *)      osvers="$3" ;;
2299                         esac
2300                         ;;
2301                 ultrix) osname=ultrix
2302                         osvers="$3"
2303                         ;;
2304                 osf1|mls+)      case "$5" in
2305                                 alpha)
2306                                         osname=dec_osf
2307                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2308                                         ;;
2309                         hp*)    osname=hp_osf1  ;;
2310                         mips)   osname=mips_osf1 ;;
2311                         esac
2312                         ;;
2313                 unixware) osname=svr5
2314                         osvers="$4"
2315                         ;;
2316                 uts) osname=uts
2317                         osvers="$3"
2318                         ;;
2319                 qnx) osname=qnx
2320                         osvers="$4"
2321                         ;;
2322                 $2) case "$osname" in
2323                         *isc*) ;;
2324                         *freebsd*) ;;
2325                         svr*)
2326                                 : svr4.x or possibly later
2327                                 case "svr$3" in 
2328                                 ${osname}*)
2329                                         osname=svr$3
2330                                         osvers=$4
2331                                         ;;
2332                                 esac
2333                                 case "$osname" in
2334                                 svr4.0)
2335                                         : Check for ESIX
2336                                         if test -f /stand/boot ; then
2337                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2338                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2339                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2340                                                         if test -n "$isesix"; then
2341                                                                 osname=esix4
2342                                                         fi
2343                                                 fi
2344                                         fi
2345                                         ;;
2346                                 esac
2347                                 ;;
2348                         *)      if test -f /etc/systemid; then
2349                                         osname=sco
2350                                         set `echo $3 | $sed 's/\./ /g'` $4
2351                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2352                                                 osvers=$1.$2.$3
2353                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2354                                                 osvers=$1.$2
2355                                         elif $test -f $src/hints/sco_$1.sh; then
2356                                                 osvers=$1
2357                                         fi
2358                                 else
2359                                         case "$osname" in
2360                                         '') : Still unknown.  Probably a generic Sys V.
2361                                                 osname="sysv"
2362                                                 osvers="$3"
2363                                                 ;;
2364                                         esac
2365                                 fi
2366                                 ;;
2367                         esac
2368                         ;;
2369                 *)      case "$osname" in
2370                         '') : Still unknown.  Probably a generic BSD.
2371                                 osname="$1"
2372                                 osvers="$3"
2373                                 ;;
2374                         esac
2375                         ;;
2376                 esac
2377         else
2378                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2379                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2380                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2381                                 osname=news_os
2382                         fi
2383                         $rm -f UU/kernel.what
2384                 elif test -d c:/.; then
2385                         set X $myuname
2386                         osname=os2
2387                         osvers="$5"
2388                 fi
2389         fi
2390         
2391         : Now look for a hint file osname_osvers, unless one has been
2392         : specified already.
2393         case "$hintfile" in
2394         ''|' ')
2395                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2396                 : Also try without trailing minor version numbers.
2397                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2398                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2399                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2400                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2401                 case "$file" in
2402                 '') dflt=none ;;
2403                 *)  case "$osvers" in
2404                         '') dflt=$file
2405                                 ;;
2406                         *)  if $test -f $src/hints/$file.sh ; then
2407                                         dflt=$file
2408                                 elif $test -f $src/hints/$xfile.sh ; then
2409                                         dflt=$xfile
2410                                 elif $test -f $src/hints/$xxfile.sh ; then
2411                                         dflt=$xxfile
2412                                 elif $test -f $src/hints/$xxxfile.sh ; then
2413                                         dflt=$xxxfile
2414                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2415                                         dflt=$xxxxfile
2416                                 elif $test -f "$src/hints/${osname}.sh" ; then
2417                                         dflt="${osname}"
2418                                 else
2419                                         dflt=none
2420                                 fi
2421                                 ;;
2422                         esac
2423                         ;;
2424                 esac
2425                 if $test -f Policy.sh ; then
2426                         case "$dflt" in
2427                         *Policy*) ;;
2428                         none) dflt="Policy" ;;
2429                         *) dflt="Policy $dflt" ;;
2430                         esac
2431                 fi
2432                 ;;
2433         *)
2434                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2435                 ;;
2436         esac
2437
2438         if $test -f Policy.sh ; then
2439                 $cat <<EOM
2440
2441 There's also a Policy hint file available, which should make the
2442 site-specific (policy) questions easier to answer.
2443 EOM
2444
2445         fi
2446
2447         $cat <<EOM
2448
2449 You may give one or more space-separated answers, or "none" if appropriate.
2450 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2451 is a good thing.  DO NOT give a wrong version or a wrong OS.
2452
2453 EOM
2454
2455         rp="Which of these apply, if any?"
2456         . UU/myread
2457         tans=$ans
2458         for file in $tans; do
2459                 if $test X$file = XPolicy -a -f Policy.sh; then
2460                         . Policy.sh
2461                         $cat Policy.sh >> UU/config.sh
2462                 elif $test -f $src/hints/$file.sh; then
2463                         . $src/hints/$file.sh
2464                         $cat $src/hints/$file.sh >> UU/config.sh
2465                 elif $test X$tans = X -o X$tans = Xnone ; then
2466                         : nothing
2467                 else
2468                         : Give one chance to correct a possible typo.
2469                         echo "$file.sh does not exist"
2470                         dflt=$file
2471                         rp="hint to use instead?"
2472                         . UU/myread
2473                         for file in $ans; do
2474                                 if $test -f "$src/hints/$file.sh"; then
2475                                         . $src/hints/$file.sh
2476                                         $cat $src/hints/$file.sh >> UU/config.sh
2477                                 elif $test X$ans = X -o X$ans = Xnone ; then
2478                                         : nothing
2479                                 else
2480                                         echo "$file.sh does not exist -- ignored."
2481                                 fi
2482                         done
2483                 fi
2484         done
2485
2486         hint=recommended
2487         : Remember our hint file for later.
2488         if $test -f "$src/hints/$file.sh" ; then
2489                 hintfile="$file"
2490         else
2491                 hintfile=''
2492         fi
2493 fi
2494 cd UU
2495 ;;
2496 *)
2497         echo " "
2498         echo "Fetching default answers from $config_sh..." >&4
2499         tmp_n="$n"
2500         tmp_c="$c"
2501         cd ..
2502         cp $config_sh config.sh 2>/dev/null
2503         chmod +w config.sh
2504         . ./config.sh
2505         cd UU
2506         cp ../config.sh .
2507         n="$tmp_n"
2508         c="$tmp_c"
2509         hint=previous
2510         ;;
2511 esac
2512 test "$override" && . ./optdef.sh
2513 myuname="$newmyuname"
2514
2515 : Restore computed paths
2516 for file in $loclist $trylist; do
2517         eval $file="\$_$file"
2518 done
2519
2520 cat << EOM
2521
2522 Configure uses the operating system name and version to set some defaults.
2523 The default value is probably right if the name rings a bell. Otherwise,
2524 since spelling matters for me, either accept the default or answer "none"
2525 to leave it blank.
2526
2527 EOM
2528 case "$osname" in
2529         ''|' ')
2530                 case "$hintfile" in
2531                 ''|' '|none) dflt=none ;;
2532                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2533                 esac
2534                 ;;
2535         *) dflt="$osname" ;;
2536 esac
2537 rp="Operating system name?"
2538 . ./myread
2539 case "$ans" in
2540 none)  osname='' ;;
2541 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2542 esac
2543 echo " "
2544 case "$osvers" in
2545         ''|' ')
2546                 case "$hintfile" in
2547                 ''|' '|none) dflt=none ;;
2548                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2549                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2550                         case "$dflt" in
2551                         ''|' ') dflt=none ;;
2552                         esac
2553                         ;;
2554                 esac
2555                 ;;
2556         *) dflt="$osvers" ;;
2557 esac
2558 rp="Operating system version?"
2559 . ./myread
2560 case "$ans" in
2561 none)  osvers='' ;;
2562 *) osvers="$ans" ;;
2563 esac
2564
2565
2566 . ./posthint.sh
2567
2568 : who configured the system
2569 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2570 cf_by=`(logname) 2>/dev/null`
2571 case "$cf_by" in
2572 "")
2573         cf_by=`(whoami) 2>/dev/null`
2574         case "$cf_by" in
2575         "") cf_by=unknown ;;
2576         esac ;;
2577 esac
2578
2579 : set up the script used to warn in case of inconsistency
2580 cat <<EOS >whoa
2581 $startsh
2582 EOS
2583 cat <<'EOSC' >>whoa
2584 dflt=y
2585 echo " "
2586 echo "*** WHOA THERE!!! ***" >&4
2587 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2588 rp="    Keep the $hint value?"
2589 . ./myread
2590 case "$ans" in
2591 y) td=$was; tu=$was;;
2592 esac
2593 EOSC
2594
2595 : function used to set $1 to $val
2596 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2597 case "$val$was" in
2598 $define$undef) . ./whoa; eval "$var=\$td";;
2599 $undef$define) . ./whoa; eval "$var=\$tu";;
2600 *) eval "$var=$val";;
2601 esac'
2602
2603 cat <<EOM
2604
2605 Perl can be built to take advantage of threads, on some systems.
2606 To do so, Configure must be run with -Dusethreads.
2607
2608 Note that threading is a highly experimental feature, and
2609 some known race conditions still remain.  If you choose to try
2610 it, be very sure to not actually deploy it for production
2611 purposes.  README.threads has more details, and is required
2612 reading if you enable threads.
2613 EOM
2614 case "$usethreads" in
2615 $define|true|[yY]*)     dflt='y';;
2616 *) dflt='n';;
2617 esac
2618 rp='Build a threading Perl?'
2619 . ./myread
2620 case "$ans" in
2621 y|Y)    val="$define" ;;     
2622 *)      val="$undef" ;;
2623 esac
2624 set usethreads
2625 eval $setvar 
2626
2627 case "$d_oldpthreads" in
2628 '')     : Configure tests would be welcome here.  For now, assume undef.
2629         val="$undef" ;;
2630 *)      val="$d_oldpthreads" ;;
2631 esac
2632 set d_oldpthreads
2633 eval $setvar
2634
2635
2636 case "$usethreads" in
2637 "$define"|true|[yY]*)
2638 : Look for a hint-file generated 'call-back-unit'.  If the
2639 : user has specified that a threading perl is to be built,
2640 : we may need to set or change some other defaults.
2641         if $test -f usethreads.cbu; then
2642                 echo "Your platform has some specific hints for threaded builds, using them..."
2643                 . ./usethreads.cbu
2644         else
2645                 $cat <<EOM
2646 (Your platform doesn't have any specific hints for threaded builds.
2647  Assuming POSIX threads, then.)
2648 EOM
2649         fi
2650     ;;
2651 esac
2652
2653 cat <<EOM
2654
2655 Perl can be built so that multiple Perl interpreters can coexist
2656 within the same Perl executable.  To do so, Configure must be run with
2657 -Dusemultiplicity.
2658
2659 Normally you do not need this and you should answer no.
2660
2661 EOM
2662 case "$usemultiplicity" in
2663 $define|true|[yY]*)     dflt='y';;
2664 *) dflt='n';;
2665 esac
2666 rp='Build Perl for multiplicity?'
2667 . ./myread
2668 case "$ans" in
2669 y|Y)    val="$define" ;;     
2670 *)      val="$undef" ;;
2671 esac
2672 set usemultiplicity
2673 eval $setvar 
2674
2675 : determine where manual pages are on this system
2676 echo " "
2677 case "$sysman" in
2678 '') 
2679         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2680         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2681         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2682         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2683         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2684         sysman=`./loc . /usr/man/man1 $syspath`
2685         ;;
2686 esac
2687 if $test -d "$sysman"; then
2688         echo "System manual is in $sysman." >&4
2689 else
2690         echo "Could not find manual pages in source form." >&4
2691 fi
2692
2693 : see what memory models we can support
2694 case "$models" in
2695 '')
2696         $cat >pdp11.c <<'EOP'
2697 int main() {
2698 #ifdef pdp11
2699         exit(0);
2700 #else
2701         exit(1);
2702 #endif
2703 }
2704 EOP
2705         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2706         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2707                 dflt='unsplit split'
2708         else
2709                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2710                 case "$tans" in
2711                 X) dflt='none';;
2712                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2713                                 dflt='small'
2714                         else
2715                                 dflt=''
2716                         fi
2717                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2718                                 dflt="$dflt medium"
2719                         fi
2720                         if $test -d /lib/large || $test -d /usr/lib/large; then
2721                                 dflt="$dflt large"
2722                         fi
2723                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2724                                 dflt="$dflt huge"
2725                         fi
2726                 esac
2727         fi;;
2728 *) dflt="$models";;
2729 esac
2730 $cat <<EOM
2731  
2732 Some systems have different model sizes.  On most systems they are called
2733 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2734 split.  If your system doesn't support different memory models, say "none".
2735 If you wish to force everything to one memory model, say "none" here and
2736 put the appropriate flags later when it asks you for other cc and ld flags.
2737 Venix systems may wish to put "none" and let the compiler figure things out.
2738 (In the following question multiple model names should be space separated.)
2739
2740 The default for most systems is "none".
2741
2742 EOM
2743 rp="Which memory models are supported?"
2744 . ./myread
2745 models="$ans"
2746
2747 case "$models" in
2748 none)
2749         small=''
2750         medium=''
2751         large=''
2752         huge=''
2753         unsplit=''
2754         split=''
2755         ;;
2756 *split)
2757         case "$split" in
2758         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2759                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2760                         dflt='-i'
2761                 else
2762                         dflt='none'
2763                 fi;;
2764         *) dflt="$split";;
2765         esac
2766         rp="What flag indicates separate I and D space?"
2767         . ./myread
2768         tans="$ans"
2769         case "$tans" in
2770         none) tans='';;
2771         esac
2772         split="$tans"
2773         unsplit='';;
2774 *large*|*small*|*medium*|*huge*)
2775         case "$models" in
2776         *large*)
2777                 case "$large" in
2778                 '') dflt='-Ml';;
2779                 *) dflt="$large";;
2780                 esac
2781         rp="What flag indicates large model?"
2782         . ./myread
2783         tans="$ans"
2784         case "$tans" in
2785         none) tans='';
2786         esac
2787         large="$tans";;
2788         *) large='';;
2789         esac
2790         case "$models" in
2791         *huge*) case "$huge" in
2792                 '') dflt='-Mh';;
2793                 *) dflt="$huge";;
2794                 esac
2795                 rp="What flag indicates huge model?"
2796                 . ./myread
2797                 tans="$ans"
2798                 case "$tans" in
2799                 none) tans='';
2800                 esac
2801                 huge="$tans";;
2802         *) huge="$large";;
2803         esac
2804         case "$models" in
2805         *medium*) case "$medium" in
2806                 '') dflt='-Mm';;
2807                 *) dflt="$medium";;
2808                 esac
2809                 rp="What flag indicates medium model?"
2810                 . ./myread
2811                 tans="$ans"
2812                 case "$tans" in
2813                 none) tans='';
2814                 esac
2815                 medium="$tans";;
2816         *) medium="$large";;
2817         esac
2818         case "$models" in
2819         *small*) case "$small" in
2820                 '') dflt='none';;
2821                 *) dflt="$small";;
2822                 esac
2823                 rp="What flag indicates small model?"
2824                 . ./myread
2825                 tans="$ans"
2826                 case "$tans" in
2827                 none) tans='';
2828                 esac
2829                 small="$tans";;
2830         *) small='';;
2831         esac
2832         ;;
2833 *)
2834         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2835         ;;
2836 esac
2837 $rm -f pdp11.* pdp11
2838
2839 : make some quick guesses about what we are up against
2840 echo " "
2841 $echo $n "Hmm...  $c"
2842 echo exit 1 >bsd
2843 echo exit 1 >usg
2844 echo exit 1 >v7
2845 echo exit 1 >osf1
2846 echo exit 1 >eunice
2847 echo exit 1 >xenix
2848 echo exit 1 >venix
2849 echo exit 1 >os2
2850 d_bsd="$undef"
2851 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2852 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2853 then
2854         echo "Looks kind of like an OSF/1 system, but we'll see..."
2855         echo exit 0 >osf1
2856 elif test `echo abc | tr a-z A-Z` = Abc ; then
2857         xxx=`./loc addbib blurfl $pth`
2858         if $test -f $xxx; then
2859         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2860                 echo exit 0 >bsd
2861                 echo exit 0 >usg
2862         else
2863                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2864                         echo "Looks kind of like an extended USG system, but we'll see..."
2865                 else
2866                         echo "Looks kind of like a USG system, but we'll see..."
2867                 fi
2868                 echo exit 0 >usg
2869         fi
2870 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2871         echo "Looks kind of like a BSD system, but we'll see..."
2872         d_bsd="$define"
2873         echo exit 0 >bsd
2874 else
2875         echo "Looks kind of like a Version 7 system, but we'll see..."
2876         echo exit 0 >v7
2877 fi
2878 case "$eunicefix" in
2879 *unixtovms*)
2880         $cat <<'EOI'
2881 There is, however, a strange, musty smell in the air that reminds me of
2882 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2883 EOI
2884         echo exit 0 >eunice
2885         d_eunice="$define"
2886 : it so happens the Eunice I know will not run shell scripts in Unix format
2887         ;;
2888 *)
2889         echo " "
2890         echo "Congratulations.  You aren't running Eunice."
2891         d_eunice="$undef"
2892         ;;
2893 esac
2894 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2895 case "$p_" in
2896 :) ;;
2897 *)
2898         $cat <<'EOI'
2899 I have the feeling something is not exactly right, however...don't tell me...
2900 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2901 EOI
2902         echo exit 0 >os2
2903         ;;
2904 esac
2905 if test -f /xenix; then
2906         echo "Actually, this looks more like a XENIX system..."
2907         echo exit 0 >xenix
2908         d_xenix="$define"
2909 else
2910         echo " "
2911         echo "It's not Xenix..."
2912         d_xenix="$undef"
2913 fi
2914 chmod +x xenix
2915 $eunicefix xenix
2916 if test -f /venix; then
2917         echo "Actually, this looks more like a VENIX system..."
2918         echo exit 0 >venix
2919 else
2920         echo " "
2921         if ./xenix; then
2922                 : null
2923         else
2924                 echo "Nor is it Venix..."
2925         fi
2926 fi
2927 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2928 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2929 $rm -f foo
2930
2931 : see if we need a special compiler
2932 echo " "
2933 if ./usg; then
2934         case "$cc" in
2935         '') case "$Mcc" in
2936                 /*) dflt='Mcc';;
2937                 *) case "$large" in
2938                         -M*) dflt='cc';;
2939                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2940                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2941                                                 dflt='cc'
2942                                         else
2943                                                 dflt='cc -M'
2944                                         fi
2945                                 else
2946                                         dflt='cc'
2947                                 fi;;
2948                         esac;;
2949                 esac;;
2950         *)  dflt="$cc";;
2951         esac
2952         case "$dflt" in
2953         *M*)    $cat <<'EOM'
2954 On some older systems the default C compiler will not resolve multiple global
2955 references that happen to have the same name.  On some such systems the "Mcc"
2956 command may be used to force these to be resolved.  On other systems a "cc -M"
2957 command is required.  (Note that the -M flag on other systems indicates a
2958 memory model to use!) If you have the Gnu C compiler, you might wish to use
2959 that instead.
2960
2961 EOM
2962         ;;
2963         esac
2964         rp="Use which C compiler?"
2965         . ./myread
2966         cc="$ans"
2967 else
2968         case "$cc" in
2969         '') dflt=cc;;
2970         *) dflt="$cc";;
2971         esac
2972         rp="Use which C compiler?"
2973         . ./myread
2974         cc="$ans"
2975 fi
2976 : Look for a hint-file generated 'call-back-unit'.  Now that the
2977 : user has specified the compiler, we may need to set or change some
2978 : other defaults.
2979 if $test -f cc.cbu; then
2980     . ./cc.cbu
2981 fi
2982 echo " "
2983 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2984 $cat >gccvers.c <<EOM
2985 #include <stdio.h>
2986 int main() {
2987 #ifdef __GNUC__
2988 #ifdef __VERSION__
2989         printf("%s\n", __VERSION__);
2990 #else
2991         printf("%s\n", "1");
2992 #endif
2993 #endif
2994         exit(0);
2995 }
2996 EOM
2997 if $cc -o gccvers gccvers.c; then
2998         gccversion=`./gccvers`
2999         case "$gccversion" in
3000         '') echo "You are not using GNU cc." ;;
3001         *)  echo "You are using GNU cc $gccversion." ;;
3002         esac
3003 else
3004         echo " "
3005         echo "*** WHOA THERE!!! ***" >&4
3006         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3007         case "$knowitall" in
3008         '')
3009         echo "    You'd better start hunting for one and let me know about it." >&4
3010                 exit 1
3011                 ;;
3012         esac
3013 fi
3014 $rm -f gccvers*
3015 case "$gccversion" in
3016 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3017 esac
3018
3019
3020 case "$usemorebits" in
3021 "$define"|true|[yY]*)
3022         use64bits="$define"
3023         uselongdouble="$define"
3024         usemorebits="$define"
3025         ;;
3026 *)      usemorebits="$undef"
3027         ;;
3028 esac
3029
3030
3031 cat <<EOM
3032
3033 Perl can be built to understand large files (files larger than 2 gigabytes)
3034 on some systems.  To do so, Configure must be run with -Duselargefiles.
3035
3036 If this doesn't make any sense to you, just accept the default.
3037 EOM
3038 case "$uselargefiles" in
3039 "$define"|true|[yY]*) dflt='y' ;;
3040 *)      dflt='n' ;;
3041 esac
3042 rp='Try to understand large files?'
3043 . ./myread
3044 case "$ans" in
3045 y|Y)    val="$define" ;;
3046 *)      val="$undef"  ;;
3047 esac
3048 set uselargefiles
3049 eval $setvar
3050 case "$uselargefiles" in
3051 "$define") use64bits="$define" ;;
3052 esac
3053
3054 cat <<EOM
3055
3056 Perl can be built to take advantage of explicit 64-bit interfaces,
3057 on some systems.  To do so, Configure must be run with -Duse64bits.
3058
3059 If this doesn't make any sense to you, just accept the default.
3060 EOM
3061 case "$use64bits" in
3062 $define|true|[yY]*)     dflt='y';;
3063 *) dflt='n';;
3064 esac
3065 rp='Try to use explicit 64-bit interfaces, if available?'
3066 . ./myread
3067 case "$ans" in
3068 y|Y) 
3069         val="$define"
3070         ;;     
3071 *)      
3072         val="$undef"
3073         ;;
3074 esac
3075 set use64bits
3076 eval $setvar
3077
3078 case "$archname64" in
3079 '') archname64='' ;;    # not a typo
3080 esac
3081
3082 case "$use64bits" in
3083 "$define"|true|[yY]*)
3084 : Look for a hint-file generated 'call-back-unit'.  If the
3085 : user has specified that a 64 bit perl is to be built,
3086 : we may need to set or change some other defaults.
3087         if $test -f use64bits.cbu; then
3088                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3089                 . ./use64bits.cbu
3090         else
3091                 $cat <<EOM
3092 (Your platform doesn't have any specific hints for 64-bit builds.
3093  This is probably okay, especially if your system is a true 64-bit system.)
3094 EOM
3095                 case "$gccversion" in
3096                 '')     ;;
3097                 *)      $cat <<EOM
3098 But since you seem to be using gcc,
3099 I will now add -DUSE_LONG_LONG to the compilation flags.
3100 EOM
3101                         ccflags="$ccflags -DUSE_LONG_LONG"
3102                         ;;
3103                 esac
3104         fi
3105         ;;
3106 esac
3107
3108 : determine the architecture name
3109 echo " "
3110 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3111         tarch=`arch`"-$osname"
3112 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3113         if uname -m > tmparch 2>&1 ; then
3114                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3115                         -e 's/$/'"-$osname/" tmparch`
3116         else
3117                 tarch="$osname"
3118         fi
3119         $rm -f tmparch
3120 else
3121         tarch="$osname"
3122 fi
3123 case "$myarchname" in
3124 ''|"$tarch") ;;
3125 *)
3126         echo "(Your architecture name used to be $myarchname.)"
3127         archname=''
3128         ;;
3129 esac
3130 myarchname="$tarch"
3131 case "$archname" in
3132 '') dflt="$tarch";;
3133 *) dflt="$archname";;
3134 esac
3135 rp='What is your architecture name'
3136 . ./myread
3137 archname="$ans"
3138 case "$usethreads" in
3139 $define)
3140         echo "Threads selected." >&4
3141         case "$archname" in
3142         *-thread*) echo "...and architecture name already has -thread." >&4
3143                 ;;
3144         *)      archname="$archname-thread"
3145                 echo "...setting architecture name to $archname." >&4
3146                 ;;
3147         esac
3148         ;;
3149 esac
3150 case "$usemultiplicity" in
3151 $define)
3152         echo "Multiplicity selected." >&4
3153         case "$archname" in
3154         *-multi*) echo "...and architecture name already has -multi." >&4
3155                 ;;
3156         *)      archname="$archname-multi"
3157                 echo "...setting architecture name to $archname." >&4
3158                 ;;
3159         esac
3160         ;;
3161 esac
3162 case "$use64bits" in
3163 $define)
3164         echo "Explicit 64-bitness selected." >&4
3165         case "$archname64" in
3166         '')
3167                 ;;
3168         *)
3169                 case "$archname" in
3170                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3171                         ;;
3172                 *)      archname="$archname-$archname64"
3173                         echo "...setting architecture name to $archname." >&4
3174                         ;;
3175                 esac
3176                 ;;
3177         esac
3178 esac
3179
3180 : decide how portable to be.  Allow command line overrides.
3181 case "$d_portable" in
3182 "$undef") ;;
3183 *)      d_portable="$define" ;;
3184 esac
3185
3186 : set up shell script to do ~ expansion
3187 cat >filexp <<EOSS
3188 $startsh
3189 : expand filename
3190 case "\$1" in
3191  ~/*|~)
3192         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3193         ;;
3194  ~*)
3195         if $test -f /bin/csh; then
3196                 /bin/csh -f -c "glob \$1"
3197                 failed=\$?
3198                 echo ""
3199                 exit \$failed
3200         else
3201                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3202                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3203                 if $test ! -d "\$dir"; then
3204                         me=\`basename \$0\`
3205                         echo "\$me: can't locate home directory for: \$name" >&2
3206                         exit 1
3207                 fi
3208                 case "\$1" in
3209                 */*)
3210                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3211                         ;;
3212                 *)
3213                         echo \$dir
3214                         ;;
3215                 esac
3216         fi
3217         ;;
3218 *)
3219         echo \$1
3220         ;;
3221 esac
3222 EOSS
3223 chmod +x filexp
3224 $eunicefix filexp
3225
3226 : now set up to get a file name
3227 cat <<EOS >getfile
3228 $startsh
3229 EOS
3230 cat <<'EOSC' >>getfile
3231 tilde=''
3232 fullpath=''
3233 already=''
3234 skip=''
3235 none_ok=''
3236 exp_file=''
3237 nopath_ok=''
3238 orig_rp="$rp"
3239 orig_dflt="$dflt"
3240 case "$gfpth" in
3241 '') gfpth='.' ;;
3242 esac
3243
3244 case "$fn" in
3245 *\(*)
3246         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3247         fn=`echo $fn | sed 's/(.*)//'`
3248         ;;
3249 esac
3250
3251 case "$fn" in
3252 *:*)
3253         loc_file=`expr $fn : '.*:\(.*\)'`
3254         fn=`expr $fn : '\(.*\):.*'`
3255         ;;
3256 esac
3257
3258 case "$fn" in
3259 *~*) tilde=true;;
3260 esac
3261 case "$fn" in
3262 */*) fullpath=true;;
3263 esac
3264 case "$fn" in
3265 *+*) skip=true;;
3266 esac
3267 case "$fn" in
3268 *n*) none_ok=true;;
3269 esac
3270 case "$fn" in
3271 *e*) exp_file=true;;
3272 esac
3273 case "$fn" in
3274 *p*) nopath_ok=true;;
3275 esac
3276
3277 case "$fn" in
3278 *f*) type='File';;
3279 *d*) type='Directory';;
3280 *l*) type='Locate';;
3281 esac
3282
3283 what="$type"
3284 case "$what" in
3285 Locate) what='File';;
3286 esac
3287
3288 case "$exp_file" in
3289 '')
3290         case "$d_portable" in
3291         "$define") ;;
3292         *) exp_file=true;;
3293         esac
3294         ;;
3295 esac
3296
3297 cd ..
3298 while test "$type"; do
3299         redo=''
3300         rp="$orig_rp"
3301         dflt="$orig_dflt"
3302         case "$tilde" in
3303         true) rp="$rp (~name ok)";;
3304         esac
3305         . UU/myread
3306         if test -f UU/getfile.ok && \
3307                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3308         then
3309                 value="$ans"
3310                 ansexp="$ans"
3311                 break
3312         fi
3313         case "$ans" in
3314         none)
3315                 value=''
3316                 ansexp=''
3317                 case "$none_ok" in
3318                 true) type='';;
3319                 esac
3320                 ;;
3321         *)
3322                 case "$tilde" in
3323                 '') value="$ans"
3324                         ansexp="$ans";;
3325                 *)
3326                         value=`UU/filexp $ans`
3327                         case $? in
3328                         0)
3329                                 if test "$ans" != "$value"; then
3330                                         echo "(That expands to $value on this system.)"
3331                                 fi
3332                                 ;;
3333                         *) value="$ans";;
3334                         esac
3335                         ansexp="$value"
3336                         case "$exp_file" in
3337                         '') value="$ans";;
3338                         esac
3339                         ;;
3340                 esac
3341                 case "$fullpath" in
3342                 true)
3343                         case "$ansexp" in
3344                         /*) value="$ansexp" ;;
3345                         *)
3346                                 redo=true
3347                                 case "$already" in
3348                                 true)
3349                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3350                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3351                                         ;;
3352                                 *)
3353                                 echo "Please give a full path name, starting with slash." >&4
3354                                         case "$tilde" in
3355                                         true)
3356                                 echo "Note that using ~name is ok provided it expands well." >&4
3357                                                 already=true
3358                                                 ;;
3359                                         esac
3360                                 esac
3361                                 ;;
3362                         esac
3363                         ;;
3364                 esac
3365                 case "$redo" in
3366                 '')
3367                         case "$type" in
3368                         File)
3369                                 for fp in $gfpth; do
3370                                         if test "X$fp" = X.; then
3371                                             pf="$ansexp"
3372                                         else    
3373                                             pf="$fp/$ansexp"
3374                                         fi
3375                                         if test -f "$pf"; then
3376                                                 type=''
3377                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3378                                         then
3379                                                 echo "($value is not a plain file, but that's ok.)"
3380                                                 type=''
3381                                         fi
3382                                         if test X"$type" = X; then
3383                                             value="$pf"
3384                                             break
3385                                         fi
3386                                 done
3387                                 ;;
3388                         Directory)
3389                                 for fp in $gfpth; do
3390                                         if test "X$fp" = X.; then
3391                                             pf="$ansexp"
3392                                         else    
3393                                             pf="$fp/$ansexp"
3394                                         fi
3395                                         if test -d "$pf"; then
3396                                                 type=''
3397                                                 value="$pf"
3398                                                 break
3399                                         fi
3400                                 done
3401                                 ;;
3402                         Locate)
3403                                 if test -d "$ansexp"; then
3404                                         echo "(Looking for $loc_file in directory $value.)"
3405                                         value="$value/$loc_file"
3406                                         ansexp="$ansexp/$loc_file"
3407                                 fi
3408                                 if test -f "$ansexp"; then
3409                                         type=''
3410                                 fi
3411                                 case "$nopath_ok" in
3412                                 true)   case "$value" in
3413                                         */*) ;;
3414                                         *)      echo "Assuming $value will be in people's path."
3415                                                 type=''
3416                                                 ;;
3417                                         esac
3418                                         ;;
3419                                 esac
3420                                 ;;
3421                         esac
3422
3423                         case "$skip" in
3424                         true) type='';
3425                         esac
3426
3427                         case "$type" in
3428                         '') ;;
3429                         *)
3430                                 if test "$fastread" = yes; then
3431                                         dflt=y
3432                                 else
3433                                         dflt=n
3434                                 fi
3435                                 rp="$what $value doesn't exist.  Use that name anyway?"
3436                                 . UU/myread
3437                                 dflt=''
3438                                 case "$ans" in
3439                                 y*) type='';;
3440                                 *) echo " ";;
3441                                 esac
3442                                 ;;
3443                         esac
3444                         ;;
3445                 esac
3446                 ;;
3447         esac
3448 done
3449 cd UU
3450 ans="$value"
3451 rp="$orig_rp"
3452 dflt="$orig_dflt"
3453 rm -f getfile.ok
3454 test "X$gfpthkeep" != Xy && gfpth=""
3455 EOSC
3456
3457 : determine root of directory hierarchy where package will be installed.
3458 case "$prefix" in
3459 '')
3460         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3461         ;;
3462 *)
3463         dflt="$prefix"
3464         ;;
3465 esac
3466 $cat <<EOM
3467
3468 By default, $package will be installed in $dflt/bin, manual pages
3469 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3470 installation directories. Typically this is something like /usr/local.
3471 If you wish to have binaries under /usr/bin but other parts of the
3472 installation under /usr/local, that's ok: you will be prompted
3473 separately for each of the installation directories, the prefix being
3474 only used to set the defaults.
3475
3476 EOM
3477 fn=d~
3478 rp='Installation prefix to use?'
3479 . ./getfile
3480 oldprefix=''
3481 case "$prefix" in
3482 '') ;;
3483 *)
3484         case "$ans" in
3485         "$prefix") ;;
3486         *) oldprefix="$prefix";;
3487         esac
3488         ;;
3489 esac
3490 prefix="$ans"
3491 prefixexp="$ansexp"
3492
3493 : is AFS running?
3494 echo " "
3495 case "$afs" in
3496 $define|true)   afs=true ;;
3497 $undef|false)   afs=false ;;
3498 *)      if test -d /afs; then
3499                 afs=true
3500         else
3501                 afs=false
3502         fi
3503         ;;
3504 esac
3505 if $afs; then
3506         echo "AFS may be running... I'll be extra cautious then..." >&4
3507 else
3508         echo "AFS does not seem to be running..." >&4
3509 fi
3510
3511 : determine installation prefix for where package is to be installed.
3512 if $afs; then 
3513 $cat <<EOM
3514
3515 Since you are running AFS, I need to distinguish the directory in which
3516 files will reside from the directory in which they are installed (and from
3517 which they are presumably copied to the former directory by occult means).
3518
3519 EOM
3520         case "$installprefix" in
3521         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3522         *) dflt="$installprefix";;
3523         esac
3524 else
3525 $cat <<EOM
3526
3527 In some special cases, particularly when building $package for distribution,
3528 it is convenient to distinguish between the directory in which files should 
3529 be installed from the directory ($prefix) in which they 
3530 will eventually reside.  For most users, these two directories are the same.
3531
3532 EOM
3533         case "$installprefix" in
3534         '') dflt=$prefix ;;
3535         *) dflt=$installprefix;;
3536         esac
3537 fi
3538 fn=d~
3539 rp='What installation prefix should I use for installing files?'
3540 . ./getfile
3541 installprefix="$ans"
3542 installprefixexp="$ansexp"
3543
3544 : set the prefixit variable, to compute a suitable default value
3545 prefixit='case "$3" in
3546 ""|none)
3547         case "$oldprefix" in
3548         "") eval "$1=\"\$$2\"";;
3549         *)
3550                 case "$3" in
3551                 "") eval "$1=";;
3552                 none)
3553                         eval "tp=\"\$$2\"";
3554                         case "$tp" in
3555                         ""|" ") eval "$1=\"\$$2\"";;
3556                         *) eval "$1=";;
3557                         esac;;
3558                 esac;;
3559         esac;;
3560 *)
3561         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3562         case "$tp" in
3563         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3564         /*-$oldprefix/*|\~*-$oldprefix/*)
3565                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3566         *) eval "$1=\"\$$2\"";;
3567         esac;;
3568 esac'
3569
3570 : set the base revision
3571 baserev=5.0
3572
3573 : get the patchlevel
3574 echo " "
3575 echo "Getting the current patchlevel..." >&4
3576 if $test -r $rsrc/patchlevel.h;then
3577         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3578         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3579         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3580 else
3581         patchlevel=0
3582         subversion=0
3583         apiversion=0
3584 fi
3585 $echo $n "(You have $package" $c
3586 case "$package" in
3587 "*$baserev")    ;;
3588 *)              $echo $n " $baserev" $c ;;
3589 esac
3590 $echo $n " patchlevel $patchlevel" $c
3591 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3592 echo ".)"
3593
3594 if test 0 -eq "$subversion"; then
3595         version=`LC_ALL=C; export LC_ALL; \
3596                  echo $baserev $patchlevel | \
3597                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3598 else
3599         version=`LC_ALL=C; export LC_ALL; \
3600                  echo $baserev $patchlevel $subversion | \
3601                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3602 fi
3603
3604 : determine installation style
3605 : For now, try to deduce it from prefix unless it is already set.
3606 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3607 case "$installstyle" in
3608 '')     case "$prefix" in
3609                 *perl*) dflt='lib';;
3610                 *) dflt='lib/perl5' ;;
3611         esac
3612         ;;
3613 *)      dflt='lib/perl5' ;;
3614 esac
3615 : Probably not worth prompting for this since we prompt for all
3616 : the directories individually, and the prompt would be too long and
3617 : confusing anyway.
3618 installstyle=$dflt
3619
3620 : determine where private library files go
3621 : Usual default is /usr/local/lib/perl5/$version.
3622 : Also allow things like /opt/perl/lib/$version, since 
3623 : /opt/perl/lib/perl5... would be redundant.
3624 : The default "style" setting is made in installstyle.U
3625 case "$installstyle" in
3626 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3627 *)       set dflt privlib lib/$version ;;
3628 esac
3629 eval $prefixit
3630 $cat <<EOM
3631
3632 There are some auxiliary files for $package that need to be put into a
3633 private library directory that is accessible by everyone.
3634
3635 EOM
3636 fn=d~+
3637 rp='Pathname where the private library files will reside?'
3638 . ./getfile
3639 privlib="$ans"
3640 privlibexp="$ansexp"
3641 : Change installation prefix, if necessary.
3642 if $test X"$prefix" != X"$installprefix"; then
3643         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3644 else
3645         installprivlib="$privlibexp"
3646 fi
3647
3648 : set the prefixup variable, to restore leading tilda escape
3649 prefixup='case "$prefixexp" in
3650 "$prefix") ;;
3651 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3652 esac'
3653
3654 : determine where public architecture dependent libraries go
3655 set archlib archlib
3656 eval $prefixit
3657 : privlib default is /usr/local/lib/$package/$version
3658 : archlib default is /usr/local/lib/$package/$version/$archname
3659 : privlib may have an optional trailing /share.
3660 tdflt=`echo $privlib | $sed 's,/share$,,'`
3661 tdflt=$tdflt/$archname
3662 case "$archlib" in
3663 '')     dflt=$tdflt
3664         ;;
3665 *)      dflt="$archlib"
3666     ;;
3667 esac
3668 $cat <<EOM
3669
3670 $spackage contains architecture-dependent library files.  If you are
3671 sharing libraries in a heterogeneous environment, you might store
3672 these files in a separate location.  Otherwise, you can just include
3673 them with the rest of the public library files.
3674
3675 EOM
3676 fn=d+~
3677 rp='Where do you want to put the public architecture-dependent libraries?'
3678 . ./getfile
3679 archlib="$ans"
3680 archlibexp="$ansexp"
3681 if $test X"$archlib" = X"$privlib"; then
3682         d_archlib="$undef"
3683 else
3684         d_archlib="$define"
3685 fi
3686 : Change installation prefix, if necessary.
3687 if $test X"$prefix" != X"$installprefix"; then
3688         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3689 else
3690         installarchlib="$archlibexp"
3691 fi
3692
3693
3694 : Binary compatibility with 5.005 is not possible for builds
3695 : with advanced features
3696 case "$usethreads$usemultiplicity" in
3697 *define*)
3698         bincompat5005="$undef"
3699         d_bincompat5005="$undef"
3700         ;;
3701 *)      $cat <<EOM
3702
3703 Perl 5.006 can be compiled for binary compatibility with 5.005.
3704 If you decide to do so, you will be able to continue using most
3705 of the extensions that were compiled for Perl 5.005.
3706
3707 EOM
3708         case "$bincompat5005$d_bincompat5005" in
3709         *"$undef"*) dflt=n ;;
3710         *) dflt=y ;;
3711         esac
3712         rp='Binary compatibility with Perl 5.005?'
3713         . ./myread
3714         case "$ans" in
3715         y*) val="$define" ;;
3716         *)  val="$undef" ;;
3717         esac
3718         set d_bincompat5005
3719         eval $setvar
3720         case "$d_bincompat5005" in
3721         "$define")
3722                 bincompat5005="$define"
3723                 ;;
3724         *)      bincompat5005="$undef"
3725                 d_bincompat5005="$undef"
3726                 ;;
3727         esac
3728         ;;
3729 esac
3730
3731
3732 : see if setuid scripts can be secure
3733 $cat <<EOM
3734
3735 Some kernels have a bug that prevents setuid #! scripts from being
3736 secure.  Some sites have disabled setuid #! scripts because of this.
3737
3738 First let's decide if your kernel supports secure setuid #! scripts.
3739 (If setuid #! scripts would be secure but have been disabled anyway,
3740 don't say that they are secure if asked.)
3741
3742 EOM
3743
3744 val="$undef"
3745 if $test -d /dev/fd; then
3746         echo "#!$ls" >reflect
3747         chmod +x,u+s reflect
3748         ./reflect >flect 2>&1
3749         if $contains "/dev/fd" flect >/dev/null; then
3750                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3751                 val="$define"
3752         else
3753                 $cat <<EOM
3754 If you are not sure if they are secure, I can check but I'll need a
3755 username and password different from the one you are using right now.
3756 If you don't have such a username or don't want me to test, simply
3757 enter 'none'.
3758
3759 EOM
3760                 rp='Other username to test security of setuid scripts with?'
3761                 dflt='none'
3762                 . ./myread
3763                 case "$ans" in
3764                 n|none)
3765                         case "$d_suidsafe" in
3766                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3767                                 dflt=n;;
3768                         "$undef")
3769                                 echo "Well, the $hint value is *not* secure." >&4
3770                                 dflt=n;;
3771                         *)      echo "Well, the $hint value *is* secure." >&4
3772                                 dflt=y;;
3773                         esac
3774                         ;;
3775                 *)
3776                         $rm -f reflect flect
3777                         echo "#!$ls" >reflect
3778                         chmod +x,u+s reflect
3779                         echo >flect
3780                         chmod a+w flect
3781                         echo '"su" will (probably) prompt you for '"$ans's password."
3782                         su $ans -c './reflect >flect'
3783                         if $contains "/dev/fd" flect >/dev/null; then
3784                                 echo "Okay, it looks like setuid scripts are secure." >&4
3785                                 dflt=y
3786                         else
3787                                 echo "I don't think setuid scripts are secure." >&4
3788                                 dflt=n
3789                         fi
3790                         ;;
3791                 esac
3792                 rp='Does your kernel have *secure* setuid scripts?'
3793                 . ./myread
3794                 case "$ans" in
3795                 [yY]*)  val="$define";;
3796                 *)      val="$undef";;
3797                 esac
3798         fi
3799 else
3800         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3801         echo "(That's for file descriptors, not floppy disks.)"
3802         val="$undef"
3803 fi
3804 set d_suidsafe
3805 eval $setvar
3806
3807 $rm -f reflect flect
3808
3809 : now see if they want to do setuid emulation
3810 echo " "
3811 val="$undef"
3812 case "$d_suidsafe" in
3813 "$define")
3814         val="$undef"
3815         echo "No need to emulate SUID scripts since they are secure here." >& 4
3816         ;;
3817 *)
3818         $cat <<EOM
3819 Some systems have disabled setuid scripts, especially systems where
3820 setuid scripts cannot be secure.  On systems where setuid scripts have
3821 been disabled, the setuid/setgid bits on scripts are currently
3822 useless.  It is possible for $package to detect those bits and emulate
3823 setuid/setgid in a secure fashion.  This emulation will only work if
3824 setuid scripts have been disabled in your kernel.
3825
3826 EOM
3827         case "$d_dosuid" in
3828         "$define") dflt=y ;;
3829         *) dflt=n ;;
3830         esac
3831         rp="Do you want to do setuid/setgid emulation?"
3832         . ./myread
3833         case "$ans" in
3834         [yY]*)  val="$define";;
3835         *)      val="$undef";;
3836         esac
3837         ;;
3838 esac
3839 set d_dosuid
3840 eval $setvar
3841
3842 : What should the include directory be ?
3843 echo " "
3844 $echo $n "Hmm...  $c"
3845 dflt='/usr/include'
3846 incpath=''
3847 mips_type=''
3848 if $test -f /bin/mips && /bin/mips; then
3849         echo "Looks like a MIPS system..."
3850         $cat >usr.c <<'EOCP'
3851 #ifdef SYSTYPE_BSD43
3852 /bsd43
3853 #endif
3854 EOCP
3855         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3856                 dflt='/bsd43/usr/include'
3857                 incpath='/bsd43'
3858                 mips_type='BSD 4.3'
3859         else
3860                 mips_type='System V'
3861         fi
3862         $rm -f usr.c usr.out
3863         echo "and you're compiling with the $mips_type compiler and libraries."
3864         xxx_prompt=y
3865         echo "exit 0" >mips
3866 else
3867         echo "Doesn't look like a MIPS system."
3868         xxx_prompt=n
3869         echo "exit 1" >mips
3870 fi
3871 chmod +x mips
3872 $eunicefix mips
3873 case "$usrinc" in
3874 '') ;;
3875 *) dflt="$usrinc";;
3876 esac
3877 case "$xxx_prompt" in
3878 y)      fn=d/
3879         echo " "
3880         rp='Where are the include files you want to use?'
3881         . ./getfile
3882         usrinc="$ans"
3883         ;;
3884 *)      usrinc="$dflt"
3885         ;;
3886 esac
3887
3888 : see how we invoke the C preprocessor
3889 echo " "
3890 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3891 cat <<'EOT' >testcpp.c
3892 #define ABC abc
3893 #define XYZ xyz
3894 ABC.XYZ
3895 EOT
3896 cd ..
3897 if test ! -f cppstdin; then
3898         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3899                 # AIX cc -E doesn't show the absolute headerfile
3900                 # locations but we'll cheat by using the -M flag.
3901                 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
3902         else
3903                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3904         fi
3905 else
3906         echo "Keeping your $hint cppstdin wrapper."
3907 fi
3908 chmod 755 cppstdin
3909 wrapper=`pwd`/cppstdin
3910 ok='false'
3911 cd UU
3912
3913 if $test "X$cppstdin" != "X" && \
3914         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3915         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3916 then
3917         echo "You used to use $cppstdin $cppminus so we'll use that again."
3918         case "$cpprun" in
3919         '') echo "But let's see if we can live without a wrapper..." ;;
3920         *)
3921                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3922                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3923                 then
3924                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3925                         ok='true'
3926                 else
3927                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3928                 fi
3929                 ;;
3930         esac
3931 else
3932         case "$cppstdin" in
3933         '') ;;
3934         *)
3935                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3936                 ;;
3937         esac
3938 fi
3939
3940 if $ok; then
3941         : nothing
3942 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3943         $cc -E <testcpp.c >testcpp.out 2>&1; \
3944         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3945         echo "Yup, it does."
3946         x_cpp="$cc -E"
3947         x_minus='';
3948 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3949         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3950         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3951         echo "Yup, it does."
3952         x_cpp="$cc -E"
3953         x_minus='-';
3954 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3955         $cc -P <testcpp.c >testcpp.out 2>&1; \
3956         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3957         echo "Yipee, that works!"
3958         x_cpp="$cc -P"
3959         x_minus='';
3960 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3961         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3962         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3963         echo "At long last!"
3964         x_cpp="$cc -P"
3965         x_minus='-';
3966 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3967         $cpp <testcpp.c >testcpp.out 2>&1; \
3968         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3969         echo "It works!"
3970         x_cpp="$cpp"
3971         x_minus='';
3972 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3973         $cpp - <testcpp.c >testcpp.out 2>&1; \
3974         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3975         echo "Hooray, it works!  I was beginning to wonder."
3976         x_cpp="$cpp"
3977         x_minus='-';
3978 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3979         $wrapper <testcpp.c >testcpp.out 2>&1; \
3980         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3981         x_cpp="$wrapper"
3982         x_minus=''
3983         echo "Eureka!"
3984 else
3985         dflt=''
3986         rp="No dice.  I can't find a C preprocessor.  Name one:"
3987         . ./myread
3988         x_cpp="$ans"
3989         x_minus=''
3990         $x_cpp <testcpp.c >testcpp.out 2>&1
3991         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3992                 echo "OK, that will do." >&4
3993         else
3994 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3995                 exit 1
3996         fi
3997 fi
3998
3999 case "$ok" in
4000 false)
4001         cppstdin="$x_cpp"
4002         cppminus="$x_minus"
4003         cpprun="$x_cpp"
4004         cpplast="$x_minus"
4005         set X $x_cpp
4006         shift
4007         case "$1" in
4008         "$cpp")
4009                 echo "Perhaps can we force $cc -E using a wrapper..."
4010                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4011                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4012                 then
4013                         echo "Yup, we can."
4014                         cppstdin="$wrapper"
4015                         cppminus='';
4016                 else
4017                         echo "Nope, we'll have to live without it..."
4018                 fi
4019                 ;;
4020         esac
4021         case "$cpprun" in
4022         "$wrapper")
4023                 cpprun=''
4024                 cpplast=''
4025                 ;;
4026         esac
4027         ;;
4028 esac
4029
4030 case "$cppstdin" in
4031 "$wrapper"|'cppstdin') ;;
4032 *) $rm -f $wrapper;;
4033 esac
4034 $rm -f testcpp.c testcpp.out
4035
4036 : Set private lib path
4037 case "$plibpth" in
4038 '') if ./mips; then
4039                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4040         fi;;
4041 esac
4042 case "$libpth" in
4043 ' ') dlist='';;
4044 '') dlist="$loclibpth $plibpth $glibpth";;
4045 *) dlist="$libpth";;
4046 esac
4047
4048 : Now check and see which directories actually exist, avoiding duplicates
4049 libpth=''
4050 for xxx in $dlist
4051 do
4052     if $test -d $xxx; then
4053                 case " $libpth " in
4054                 *" $xxx "*) ;;
4055                 *) libpth="$libpth $xxx";;
4056                 esac
4057     fi
4058 done
4059 $cat <<'EOM'
4060
4061 Some systems have incompatible or broken versions of libraries.  Among
4062 the directories listed in the question below, please remove any you
4063 know not to be holding relevant libraries, and add any that are needed.
4064 Say "none" for none.
4065
4066 EOM
4067 case "$libpth" in
4068 '') dflt='none';;
4069 *)
4070         set X $libpth
4071         shift
4072         dflt=${1+"$@"}
4073         ;;
4074 esac
4075 rp="Directories to use for library searches?"
4076 . ./myread
4077 case "$ans" in
4078 none) libpth=' ';;
4079 *) libpth="$ans";;
4080 esac
4081
4082 : compute shared library extension
4083 case "$so" in
4084 '')
4085         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4086                 dflt='sl'
4087         else
4088                 dflt='so'
4089         fi
4090         ;;
4091 *) dflt="$so";;
4092 esac
4093 $cat <<EOM
4094
4095 On some systems, shared libraries may be available.  Answer 'none' if
4096 you want to suppress searching of shared libraries for the remaining
4097 of this configuration.
4098
4099 EOM
4100 rp='What is the file extension used for shared libraries?'
4101 . ./myread
4102 so="$ans"
4103
4104 : Define several unixisms.
4105 : Hints files or command line option can be used to override them.
4106 : The convoluted testing is in case hints files set either the old
4107 : or the new name.
4108 case "$_exe" in
4109 '')     case "$exe_ext" in
4110     '') ;;
4111         *)      _exe="$exe_ext" ;;
4112         esac
4113         ;;
4114 esac
4115 case "$_a" in
4116 '')     case "$lib_ext" in
4117     '') _a='.a';;
4118         *)      _a="$lib_ext" ;;
4119         esac
4120         ;;
4121 esac
4122 case "$_o" in
4123 '') case "$obj_ext" in
4124         '')     _o='.o';;
4125         *)      _o="$obj_ext";;
4126         esac
4127         ;;
4128 esac
4129 case "$p_" in
4130 '') case "$path_sep" in
4131         '')     p_=':';;
4132         *)      p_="$path_sep";;
4133         esac
4134         ;;
4135 esac
4136 exe_ext=$_exe
4137 lib_ext=$_a
4138 obj_ext=$_o
4139 path_sep=$p_
4140
4141 : Which makefile gets called first.  This is used by make depend.
4142 case "$firstmakefile" in
4143 '') firstmakefile='makefile';;
4144 esac
4145
4146 cat <<EOM
4147
4148 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4149 Configure must be run with -Dusesocks.
4150
4151 Normally you do not need this and you should answer no.
4152
4153 EOM
4154 case "$usesocks" in
4155 $define|true|[yY]*)     dflt='y';;
4156 *) dflt='n';;
4157 esac
4158 rp='Build Perl for SOCKS?'
4159 . ./myread
4160 case "$ans" in
4161 y|Y)    val="$define" ;;     
4162 *)      val="$undef" ;;
4163 esac
4164 set usesocks
4165 eval $setvar
4166
4167 : Looking for optional libraries
4168 echo " "
4169 echo "Checking for optional libraries..." >&4
4170 case "$libs" in
4171 ' '|'') dflt='';;
4172 *) dflt="$libs";;
4173 esac
4174 case "$libswanted" in
4175 '') libswanted='c_s';;
4176 esac
4177 case "$usesocks" in
4178 $define)
4179         libswanted="$libswanted socks5 socks5_sh"
4180         ;;
4181 esac
4182 for thislib in $libswanted; do
4183         
4184         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4185                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4186                 echo "Found -l$thislib (shared)."
4187                 case " $dflt " in
4188                 *"-l$thislib "*);;
4189                 *) dflt="$dflt -l$thislib";;
4190                 esac
4191         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4192                 echo "Found -l$thislib (shared)."
4193                 case " $dflt " in
4194                 *"-l$thislib "*);;
4195                 *) dflt="$dflt -l$thislib";;
4196                 esac
4197         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4198                 echo "Found -l$thislib."
4199                 case " $dflt " in
4200                 *"-l$thislib "*);;
4201                 *) dflt="$dflt -l$thislib";;
4202                 esac
4203         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4204                 echo "Found -l$thislib."
4205                 case " $dflt " in
4206                 *"-l$thislib "*);;
4207                 *) dflt="$dflt -l$thislib";;
4208                 esac
4209         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4210                 echo "Found -l${thislib}_s."
4211                 case " $dflt " in
4212                 *"-l$thislib "*);;
4213                 *) dflt="$dflt -l${thislib}_s";;
4214                 esac
4215         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4216                 echo "Found -l$thislib."
4217                 case " $dflt " in
4218                 *"-l$thislib "*);;
4219                 *) dflt="$dflt -l$thislib";;
4220                 esac
4221         else
4222                 echo "No -l$thislib."
4223         fi
4224 done
4225 set X $dflt
4226 shift
4227 dflt="$*"
4228 case "$libs" in
4229 '') dflt="$dflt";;
4230 *) dflt="$libs";;
4231 esac
4232 case "$dflt" in
4233 ' '|'') dflt='none';;
4234 esac
4235
4236 $cat <<EOM
4237
4238 In order to compile $package on your machine, a number of libraries
4239 are usually needed.  Include any other special libraries here as well.
4240 Say "none" for none.  The default list is almost always right.
4241 EOM
4242
4243 echo " "
4244 rp="What libraries to use?"
4245 . ./myread
4246 case "$ans" in
4247 none) libs=' ';;
4248 *) libs="$ans";;
4249 esac
4250
4251 : determine optimization, if desired, or use for debug flag also
4252 case "$optimize" in
4253 ' '|$undef) dflt='none';;
4254 '') dflt='-O';;
4255 *) dflt="$optimize";;
4256 esac
4257 $cat <<EOH
4258
4259 By default, $package compiles with the -O flag to use the optimizer.
4260 Alternately, you might want to use the symbolic debugger, which uses
4261 the -g flag (on traditional Unix systems).  Either flag can be
4262 specified here.  To use neither flag, specify the word "none".
4263
4264 EOH
4265 rp="What optimizer/debugger flag should be used?"
4266 . ./myread
4267 optimize="$ans"
4268 case "$optimize" in
4269 'none') optimize=" ";;
4270 esac
4271
4272 dflt=''
4273 : We will not override a previous value, but we might want to
4274 : augment a hint file
4275 case "$hint" in
4276 default|recommended)
4277         case "$gccversion" in
4278         1*) dflt='-fpcc-struct-return' ;;
4279         esac
4280         case "$optimize" in
4281         *-g*) dflt="$dflt -DDEBUGGING";;
4282         esac
4283         case "$gccversion" in
4284         2*) if test -d /etc/conf/kconfig.d &&
4285                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4286                 then
4287                         dflt="$dflt -posix"
4288                 fi
4289                 ;;
4290         esac
4291         case "$gccversion" in
4292         1*) ;;
4293         2.[0-8]*) ;;
4294         ?*)     echo " "
4295                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4296                 echo 'int main(void) { return 0; }' > gcctest.c
4297                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4298                         echo "Yes, it does." 2>&1
4299                         case "$ccflags" in
4300                         *strict-aliasing*) 
4301                                 echo "Leaving current flags $ccflags alone." 2>&1
4302                                 ;;
4303                         *) dflt="$dflt -fno-strict-aliasing" ;;
4304                         esac
4305                 else
4306                         echo "Nope, it doesn't, but that's ok." 2>&1
4307                 fi
4308                 ;;
4309         esac
4310         ;;
4311 esac
4312
4313 case "$mips_type" in
4314 *BSD*|'') inclwanted="$locincpth $usrinc";;
4315 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4316 esac
4317 for thisincl in $inclwanted; do
4318         if $test -d $thisincl; then
4319                 if $test x$thisincl != x$usrinc; then
4320                         case "$dflt" in
4321                         *$thisincl*);;
4322                         *) dflt="$dflt -I$thisincl";;
4323                         esac
4324                 fi
4325         fi
4326 done
4327
4328 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4329         xxx=true;
4330 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4331         xxx=true;
4332 else
4333         xxx=false;
4334 fi;
4335 if $xxx; then
4336         case "$dflt" in
4337         *$2*);;
4338         *) dflt="$dflt -D$2";;
4339         esac;
4340 fi'
4341
4342 set signal.h LANGUAGE_C; eval $inctest
4343
4344 case "$usesocks" in
4345 $define)
4346         ccflags="$ccflags -DSOCKS"
4347         ;;
4348 esac
4349
4350 case "$hint" in
4351 default|recommended) dflt="$ccflags $dflt" ;;
4352 *) dflt="$ccflags";;
4353 esac
4354
4355 case "$dflt" in
4356 ''|' ') dflt=none;;
4357 esac
4358 $cat <<EOH
4359
4360 Your C compiler may want other flags.  For this question you should include
4361 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4362 but you should NOT include libraries or ld flags like -lwhatever.  If you
4363 want $package to honor its debug switch, you should include -DDEBUGGING here.
4364 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4365
4366 To use no flags, specify the word "none".
4367
4368 EOH
4369 set X $dflt
4370 shift
4371 dflt=${1+"$@"}
4372 rp="Any additional cc flags?"
4373 . ./myread
4374 case "$ans" in
4375 none) ccflags='';;
4376 *) ccflags="$ans";;
4377 esac
4378
4379 : the following weeds options from ccflags that are of no interest to cpp
4380 cppflags="$ccflags"
4381 case "$gccversion" in
4382 1*) cppflags="$cppflags -D__GNUC__"
4383 esac
4384 case "$mips_type" in
4385 '');;
4386 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4387 esac
4388 case "$cppflags" in
4389 '');;
4390 *)
4391         echo " "
4392         echo "Let me guess what the preprocessor flags are..." >&4
4393         set X $cppflags
4394         shift
4395         cppflags=''
4396         $cat >cpp.c <<'EOM'
4397 #define BLURFL foo
4398
4399 BLURFL xx LFRULB
4400 EOM
4401         previous=''
4402         for flag in $*
4403         do
4404                 case "$flag" in
4405                 -*) ftry="$flag";;
4406                 *) ftry="$previous $flag";;
4407                 esac
4408                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4409                         >cpp1.out 2>/dev/null && \
4410                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4411                         >cpp2.out 2>/dev/null && \
4412                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4413                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4414                 then
4415                         cppflags="$cppflags $ftry"
4416                         previous=''
4417                 else
4418                         previous="$flag"
4419                 fi
4420         done
4421         set X $cppflags
4422         shift
4423         cppflags=${1+"$@"}
4424         case "$cppflags" in
4425         *-*)  echo "They appear to be: $cppflags";;
4426         esac
4427         $rm -f cpp.c cpp?.out
4428         ;;
4429 esac
4430
4431 : flags used in final linking phase
4432 case "$ldflags" in
4433 '') if ./venix; then
4434                 dflt='-i -z'
4435         else
4436                 dflt=''
4437         fi
4438         case "$ccflags" in
4439         *-posix*) dflt="$dflt -posix" ;;
4440         esac
4441         ;;
4442 *) dflt="$ldflags";;
4443 esac
4444
4445 : Try to guess additional flags to pick up local libraries.
4446 for thislibdir in $libpth; do
4447         case " $loclibpth " in
4448         *" $thislibdir "*)
4449                 case "$dflt " in 
4450                 *"-L$thislibdir "*) ;;
4451                 *)  dflt="$dflt -L$thislibdir" ;;
4452                 esac
4453                 ;;
4454         esac
4455 done
4456
4457 case "$dflt" in
4458 '') dflt='none' ;;
4459 esac
4460
4461 $cat <<EOH
4462
4463 Your C linker may need flags.  For this question you should
4464 include -L/whatever and any other flags used by the C linker, but you
4465 should NOT include libraries like -lwhatever.
4466
4467 Make sure you include the appropriate -L/path flags if your C linker
4468 does not normally search all of the directories you specified above,
4469 namely
4470         $libpth
4471 To use no flags, specify the word "none".
4472
4473 EOH
4474
4475 rp="Any additional ld flags (NOT including libraries)?"
4476 . ./myread
4477 case "$ans" in
4478 none) ldflags='';;
4479 *) ldflags="$ans";;
4480 esac
4481 rmlist="$rmlist pdp11"
4482
4483 : coherency check
4484 echo " "
4485 echo "Checking your choice of C compiler and flags for coherency..." >&4
4486 $cat > try.c <<'EOF'
4487 #include <stdio.h>
4488 int main() { printf("Ok\n"); exit(0); }
4489 EOF
4490 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4491 shift
4492 $cat >try.msg <<'EOM'
4493 I've tried to compile and run the following simple program:
4494
4495 EOM
4496 $cat try.c >> try.msg
4497
4498 $cat >> try.msg <<EOM
4499
4500 I used the command:
4501
4502         $*
4503         ./try
4504
4505 and I got the following output:
4506
4507 EOM
4508 dflt=y
4509 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4510         if sh -c './try' >>try.msg 2>&1; then
4511                 xxx=`./try`
4512                 case "$xxx" in
4513                 "Ok") dflt=n ;;
4514                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4515                         case " $libs " in
4516                         *" -lsfio "*)
4517                                 cat >> try.msg <<'EOQS'
4518 If $libs contains -lsfio, and sfio is mis-configured, then it
4519 sometimes (apparently) runs and exits with a 0 status, but with no
4520 output!  It may have to do with sfio's use of _exit vs. exit.
4521
4522 EOQS
4523                                 rp="You have a big problem.  Shall I abort Configure"
4524                                 dflt=y
4525                                 ;;
4526                         esac
4527                         ;;
4528                 esac
4529         else
4530                 echo "The program compiled OK, but exited with status $?." >>try.msg
4531                 rp="You have a problem.  Shall I abort Configure"
4532                 dflt=y
4533         fi
4534 else
4535         echo "I can't compile the test program." >>try.msg
4536         rp="You have a BIG problem.  Shall I abort Configure"
4537         dflt=y
4538 fi
4539 case "$dflt" in
4540 y)
4541         $cat try.msg >&4
4542         case "$knowitall" in
4543         '')
4544                 echo "(The supplied flags or libraries might be incorrect.)"
4545                 ;;
4546         *) dflt=n;;
4547         esac
4548         echo " "
4549         . ./myread
4550         case "$ans" in
4551         n*|N*) ;;
4552         *)      echo "Ok.  Stopping Configure." >&4
4553                 exit 1
4554                 ;;
4555         esac
4556         ;;
4557 n) echo "OK, that should do.";;
4558 esac
4559 $rm -f try try.* core
4560
4561 : determine filename position in cpp output
4562 echo " "
4563 echo "Computing filename position in cpp output for #include directives..." >&4
4564 echo '#include <stdio.h>' > foo.c
4565 $cat >fieldn <<EOF
4566 $startsh
4567 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4568 $grep '^[       ]*#.*stdio\.h' | \
4569 while read cline; do
4570         pos=1
4571         set \$cline
4572         while $test \$# -gt 0; do
4573                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4574                         echo "\$pos"
4575                         exit 0
4576                 fi
4577                 shift
4578                 pos=\`expr \$pos + 1\`
4579         done
4580 done
4581 EOF
4582 chmod +x fieldn
4583 fieldn=`./fieldn`
4584 $rm -f foo.c fieldn
4585 case $fieldn in
4586 '') pos='???';;
4587 1) pos=first;;
4588 2) pos=second;;
4589 3) pos=third;;
4590 *) pos="${fieldn}th";;
4591 esac
4592 echo "Your cpp writes the filename in the $pos field of the line."
4593
4594 : locate header file
4595 $cat >findhdr <<EOF
4596 $startsh
4597 wanted=\$1
4598 name=''
4599 for usrincdir in $usrinc
4600 do
4601         if test -f \$usrincdir/\$wanted; then
4602                 echo "\$usrincdir/\$wanted"
4603                 exit 0
4604         fi
4605 done
4606 awkprg='{ print \$$fieldn }'
4607 echo "#include <\$wanted>" > foo\$\$.c
4608 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4609 $grep "^[       ]*#.*\$wanted" | \
4610 while read cline; do
4611         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4612         case "\$name" in
4613         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4614         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4615         *) exit 2;;
4616         esac;
4617 done;
4618 #
4619 # status = 0: grep returned 0 lines, case statement not executed
4620 # status = 1: headerfile found
4621 # status = 2: while loop executed, no headerfile found
4622 #
4623 status=\$?
4624 $rm -f foo\$\$.c;
4625 if test \$status -eq 1; then
4626         exit 0;
4627 fi
4628 exit 1
4629 EOF
4630 chmod +x findhdr
4631
4632 : define an alternate in-header-list? function
4633 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4634 cont=true; xxf="echo \"<\$1> found.\" >&4";
4635 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4636 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4637 esac;
4638 case $# in 4) instead=instead;; *) instead="at last";; esac;
4639 while $test "$cont"; do
4640         xxx=`./findhdr $1`
4641         var=$2; eval "was=\$$2";
4642         if $test "$xxx" && $test -r "$xxx";
4643         then eval $xxf;
4644         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4645                 cont="";
4646         else eval $xxnf;
4647         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4648         set $yyy; shift; shift; yyy=$@;
4649         case $# in 0) cont="";;
4650         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4651                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4652         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4653                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4654         esac;
4655 done;
4656 while $test "$yyy";
4657 do set $yyy; var=$2; eval "was=\$$2";
4658         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4659         set $yyy; shift; shift; yyy=$@;
4660 done'
4661
4662 : see if this is a malloc.h system
4663 set malloc.h i_malloc
4664 eval $inhdr
4665
4666 : see if stdlib is available
4667 set stdlib.h i_stdlib
4668 eval $inhdr
4669
4670 : determine which malloc to compile in
4671 echo " "
4672 case "$usemymalloc" in
4673 ''|[yY]*|true|$define)  dflt='y' ;;
4674 *)      dflt='n' ;;
4675 esac
4676 rp="Do you wish to attempt to use the malloc that comes with $package?"
4677 . ./myread
4678 usemymalloc="$ans"
4679 case "$ans" in
4680 y*|true)
4681         usemymalloc='y'
4682         mallocsrc='malloc.c'
4683         mallocobj="malloc$_o"
4684         d_mymalloc="$define"
4685         case "$libs" in
4686         *-lmalloc*)
4687                 : Remove malloc from list of libraries to use
4688                 echo "Removing unneeded -lmalloc from library list" >&4
4689                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4690                 shift
4691                 libs="$*"
4692                 echo "libs = $libs" >&4
4693                 ;;
4694         esac
4695         ;;
4696 *)
4697         usemymalloc='n'
4698         mallocsrc=''
4699         mallocobj=''
4700         d_mymalloc="$undef"
4701         ;;
4702 esac
4703
4704 : compute the return types of malloc and free
4705 echo " "
4706 $cat >malloc.c <<END
4707 #$i_malloc I_MALLOC
4708 #$i_stdlib I_STDLIB
4709 #include <stdio.h>
4710 #include <sys/types.h>
4711 #ifdef I_MALLOC
4712 #include <malloc.h>
4713 #endif
4714 #ifdef I_STDLIB
4715 #include <stdlib.h>
4716 #endif
4717 #ifdef TRY_MALLOC
4718 void *malloc();
4719 #endif
4720 #ifdef TRY_FREE
4721 void free();
4722 #endif
4723 END
4724 case "$malloctype" in
4725 '')
4726         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4727                 malloctype='void *'
4728         else
4729                 malloctype='char *'
4730         fi
4731         ;;
4732 esac
4733 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4734
4735 case "$freetype" in
4736 '')
4737         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4738                 freetype='void'
4739         else
4740                 freetype='int'
4741         fi
4742         ;;
4743 esac
4744 echo "Your system uses $freetype free(), it would seem." >&4
4745 $rm -f malloc.[co]
4746 $cat <<EOM
4747
4748 The installation process will also create a directory for
4749 vendor-supplied add-ons.  Vendors who supply perl with their system
4750 may find it convenient to place all vendor-supplied files in this
4751 directory rather than in the main distribution directory.  This will
4752 ease upgrades between binary-compatible maintenance versions of perl.
4753
4754 Of course you may also use these directories in whatever way you see
4755 fit.  For example, you might use them to access modules shared over a
4756 company-wide network.
4757
4758 The default answer should be fine for most people.
4759 This causes further questions about vendor add-ons to be skipped
4760 and no vendor-specific directories will be configured for perl.
4761
4762 EOM
4763 rp='Do you want to configure vendor-specific add-on directories?'
4764 case "$usevendorprefix" in
4765 define|true|[yY]*) dflt=y ;;
4766 *) dflt=n ;;
4767 esac
4768 . ./myread
4769 case "$ans" in
4770 [yY]*)  fn=d~+
4771         rp='Installation prefix to use for vendor-supplied add-ons?'
4772         case "$vendorprefix" in
4773         '') dflt='' ;;
4774         *)  dflt=$vendorprefix ;;
4775         esac
4776         . ./getfile
4777         oldvendorprefix=''
4778         case "$vendorprefix" in
4779         '') ;;
4780         *)      case "$ans" in
4781                 "$prefix") ;;
4782                 *) oldvendorprefix="$prefix";;
4783                 esac
4784                 ;;
4785         esac
4786         usevendorprefix="$define"
4787         vendorprefix="$ans"
4788         vendorprefixexp="$ansexp"
4789         ;;
4790 *)      usevendorprefix="$undef"
4791         vendorprefix=''
4792         vendorprefixexp=''
4793         ;;
4794 esac
4795
4796 case "$vendorprefix" in
4797 '')     d_vendorlib="$undef"
4798         vendorlib=''
4799         vendorlibexp=''
4800         ;;
4801 *)      d_vendorlib="$define"
4802         : determine where vendor-supplied modules go.
4803         : Usual default is /usr/local/lib/perl5/vendor_perl
4804         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4805         case "$installstyle" in
4806         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4807         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4808         esac
4809         fn=d~+
4810         rp='Pathname for the vendor-supplied library files?'
4811         . ./getfile
4812         vendorlib="$ans"
4813         vendorlibexp="$ansexp"
4814         : Change installation prefix, if necessary.
4815         if $test X"$prefix" != X"$installprefix"; then
4816                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4817         else
4818                 installvendorlib="$vendorlibexp"
4819         fi
4820         ;;
4821 esac
4822
4823 : Cruising for prototypes
4824 echo " "
4825 echo "Checking out function prototypes..." >&4
4826 $cat >prototype.c <<'EOCP'
4827 int main(int argc, char *argv[]) {
4828         exit(0);}
4829 EOCP
4830 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4831         echo "Your C compiler appears to support function prototypes."
4832         val="$define"
4833 else
4834         echo "Your C compiler doesn't seem to understand function prototypes."
4835         val="$undef"
4836 fi
4837 set prototype
4838 eval $setvar
4839 $rm -f prototype*
4840
4841 case "$prototype" in
4842 "$define") ;;
4843 *)      ansi2knr='ansi2knr'
4844         echo " "
4845         cat <<EOM >&4
4846
4847 $me:  FATAL ERROR:
4848 This version of $package can only be compiled by a compiler that 
4849 understands function prototypes.  Unfortunately, your C compiler 
4850         $cc $ccflags
4851 doesn't seem to understand them.  Sorry about that.
4852
4853 If GNU cc is available for your system, perhaps you could try that instead.  
4854
4855 Eventually, we hope to support building Perl with pre-ANSI compilers.
4856 If you would like to help in that effort, please contact <perlbug@perl.org>.
4857
4858 Aborting Configure now.
4859 EOM
4860         exit 2
4861         ;;
4862 esac
4863
4864 : determine where public executables go
4865 echo " "
4866 set dflt bin bin
4867 eval $prefixit
4868 fn=d~
4869 rp='Pathname where the public executables will reside?'
4870 . ./getfile
4871 if $test "X$ansexp" != "X$binexp"; then
4872         installbin=''
4873 fi
4874 bin="$ans"
4875 binexp="$ansexp"
4876 : Change installation prefix, if necessary.
4877 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4878 if $test X"$prefix" != X"$installprefix"; then
4879         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4880 else
4881         installbin="$binexp"
4882 fi
4883
4884 : determine whether to install perl also as /usr/bin/perl
4885
4886 echo " "
4887 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4888         $cat <<EOM
4889 Many scripts expect to perl to be installed as /usr/bin/perl.
4890 I can install the perl you are about to compile also as /usr/bin/perl
4891 (in addition to $installbin/perl).
4892 EOM
4893         case "$installusrbinperl" in
4894         "$undef"|[nN]*) dflt='n';;
4895         *)              dflt='y';;
4896         esac
4897         rp="Do you want to install perl as /usr/bin/perl?"
4898         . ./myread
4899         case "$ans" in
4900         [yY]*)  val="$define";;
4901         *)      val="$undef" ;;
4902         esac
4903 else
4904         val="$undef"
4905 fi
4906 set installusrbinperl
4907 eval $setvar
4908
4909 : define a shorthand compile call
4910 compile='
4911 mc_file=$1;
4912 shift;
4913 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4914 : define a shorthand compile call for compilations that should be ok.
4915 compile_ok='
4916 mc_file=$1;
4917 shift;
4918 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4919
4920 echo " "
4921 echo "Checking for GNU C Library..." >&4
4922 cat >gnulibc.c <<EOM
4923 #include <stdio.h>
4924 int main()
4925 {
4926 #ifdef __GLIBC__
4927     exit(0);
4928 #else
4929     exit(1);
4930 #endif
4931 }
4932 EOM
4933 set gnulibc
4934 if eval $compile_ok && ./gnulibc; then
4935         val="$define"
4936         echo "You are using the GNU C Library"
4937 else
4938         val="$undef"
4939         echo "You are not using the GNU C Library"
4940 fi
4941 $rm -f gnulibc*
4942 set d_gnulibc
4943 eval $setvar
4944
4945 : see if nm is to be used to determine whether a symbol is defined or not
4946 case "$usenm" in
4947 '')
4948         dflt=''
4949         case "$d_gnulibc" in
4950         "$define")
4951                 echo " "
4952                 echo "nm probably won't work on the GNU C Library." >&4
4953                 dflt=n
4954                 ;;
4955         esac
4956         case "$dflt" in
4957         '') 
4958                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4959                         echo " "
4960                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4961                         echo "'nm' won't be sufficient on this sytem." >&4
4962                         dflt=n
4963                 fi
4964                 ;;
4965         esac
4966         case "$dflt" in
4967         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4968                 if $test $dflt -gt 20; then
4969                         dflt=y
4970                 else
4971                         dflt=n
4972                 fi
4973                 ;;
4974         esac
4975         ;;
4976 *)
4977         case "$usenm" in
4978         true|$define) dflt=y;;
4979         *) dflt=n;;
4980         esac
4981         ;;
4982 esac
4983 $cat <<EOM
4984
4985 I can use $nm to extract the symbols from your C libraries. This
4986 is a time consuming task which may generate huge output on the disk (up
4987 to 3 megabytes) but that should make the symbols extraction faster. The
4988 alternative is to skip the 'nm' extraction part and to compile a small
4989 test program instead to determine whether each symbol is present. If
4990 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4991 this may be the best solution.
4992
4993 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4994
4995 EOM
4996 rp="Shall I use $nm to extract C symbols from the libraries?"
4997 . ./myread
4998 case "$ans" in
4999 [Nn]*) usenm=false;;
5000 *) usenm=true;;
5001 esac
5002
5003 runnm=$usenm
5004 case "$reuseval" in
5005 true) runnm=false;;
5006 esac
5007
5008 : nm options which may be necessary
5009 case "$nm_opt" in
5010 '') if $test -f /mach_boot; then
5011                 nm_opt=''       # Mach
5012         elif $test -d /usr/ccs/lib; then
5013                 nm_opt='-p'     # Solaris (and SunOS?)
5014         elif $test -f /dgux; then
5015                 nm_opt='-p'     # DG-UX
5016         elif $test -f /lib64/rld; then
5017                 nm_opt='-p'     # 64-bit Irix
5018         else
5019                 nm_opt=''
5020         fi;;
5021 esac
5022
5023 : nm options which may be necessary for shared libraries but illegal
5024 : for archive libraries.  Thank you, Linux.
5025 case "$nm_so_opt" in
5026 '')     case "$myuname" in
5027         *linux*)
5028                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5029                         nm_so_opt='--dynamic'
5030                 fi
5031                 ;;
5032         esac
5033         ;;
5034 esac
5035
5036 case "$runnm" in
5037 true)
5038 : get list of predefined functions in a handy place
5039 echo " "
5040 case "$libc" in
5041 '') libc=unknown
5042         case "$libs" in
5043         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5044         esac
5045         ;;
5046 esac
5047 libnames='';
5048 case "$libs" in
5049 '') ;;
5050 *)  for thislib in $libs; do
5051         case "$thislib" in
5052         -lc|-lc_s)
5053                 : Handle C library specially below.
5054                 ;;
5055         -l*)
5056                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5057                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5058                         :
5059                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5060                         :
5061                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5062                         :
5063                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5064                         :
5065                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5066                         :
5067                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5068                         :
5069                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5070                         :
5071                 else
5072                         try=''
5073                 fi
5074                 libnames="$libnames $try"
5075                 ;;
5076         *) libnames="$libnames $thislib" ;;
5077         esac
5078         done
5079         ;;
5080 esac
5081 xxx=normal
5082 case "$libc" in
5083 unknown)
5084         set /lib/libc.$so
5085         for xxx in $libpth; do
5086                 $test -r $1 || set $xxx/libc.$so
5087                 : The messy sed command sorts on library version numbers.
5088                 $test -r $1 || \
5089                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5090                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5091                                 h
5092                                 s/[0-9][0-9]*/0000&/g
5093                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5094                                 G
5095                                 s/\n/ /' | \
5096                          sort | $sed -e 's/^.* //'`
5097                 eval set \$$#
5098         done
5099         $test -r $1 || set /usr/ccs/lib/libc.$so
5100         $test -r $1 || set /lib/libsys_s$_a
5101         ;;
5102 *)
5103         set blurfl
5104         ;;
5105 esac
5106 if $test -r "$1"; then
5107         echo "Your (shared) C library seems to be in $1."
5108         libc="$1"
5109 elif $test -r /lib/libc && $test -r /lib/clib; then
5110         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5111         xxx=apollo
5112         libc='/lib/clib /lib/libc'
5113         if $test -r /lib/syslib; then
5114                 echo "(Your math library is in /lib/syslib.)"
5115                 libc="$libc /lib/syslib"
5116         fi
5117 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5118         echo "Your C library seems to be in $libc, as you said before."
5119 elif $test -r $incpath/usr/lib/libc$_a; then
5120         libc=$incpath/usr/lib/libc$_a;
5121         echo "Your C library seems to be in $libc.  That's fine."
5122 elif $test -r /lib/libc$_a; then
5123         libc=/lib/libc$_a;
5124         echo "Your C library seems to be in $libc.  You're normal."
5125 else
5126         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5127                 :
5128         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5129                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5130         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5131                 :
5132         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5133                 :
5134         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5135                 :
5136         else
5137                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5138         fi
5139         if $test -r "$tans"; then
5140                 echo "Your C library seems to be in $tans, of all places."
5141                 libc=$tans
5142         else
5143                 libc='blurfl'
5144         fi
5145 fi
5146 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5147         dflt="$libc"
5148         cat <<EOM
5149
5150 If the guess above is wrong (which it might be if you're using a strange
5151 compiler, or your machine supports multiple models), you can override it here.
5152
5153 EOM
5154 else
5155         dflt=''
5156         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5157         cat >&4 <<EOM
5158 I can't seem to find your C library.  I've looked in the following places:
5159
5160 EOM
5161         $sed 's/^/      /' libpath
5162         cat <<EOM
5163
5164 None of these seems to contain your C library. I need to get its name...
5165
5166 EOM
5167 fi
5168 fn=f
5169 rp='Where is your C library?'
5170 . ./getfile
5171 libc="$ans"
5172
5173 echo " "
5174 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5175 set X `cat libnames`
5176 shift
5177 xxx=files
5178 case $# in 1) xxx=file; esac
5179 echo "Extracting names from the following $xxx for later perusal:" >&4
5180 echo " "
5181 $sed 's/^/      /' libnames >&4
5182 echo " "
5183 $echo $n "This may take a while...$c" >&4
5184
5185 for file in $*; do
5186         case $file in
5187         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5188         *) $nm $nm_opt $file 2>/dev/null;;
5189         esac
5190 done >libc.tmp
5191
5192 $echo $n ".$c"
5193 $grep fprintf libc.tmp > libc.ptf
5194 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5195 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5196 xxx='[ADTSIW]'
5197 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5198         eval $xscan;\
5199         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5200                 eval $xrun
5201 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5202         eval $xscan;\
5203         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5204                 eval $xrun
5205 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5206         eval $xscan;\
5207         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5208                 eval $xrun
5209 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5210         eval $xscan;\
5211         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5212                 eval $xrun
5213 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5214         eval $xscan;\
5215         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5216                 eval $xrun
5217 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5218         eval $xscan;\
5219         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5220                 eval $xrun
5221 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5222                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5223         eval $xscan;\
5224         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5225                 eval $xrun
5226 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5227         eval $xscan;\
5228         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5229                 eval $xrun
5230 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5231         eval $xscan;\
5232         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5233                 eval $xrun
5234 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5235         eval $xscan;\
5236         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5237                 eval $xrun
5238 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5239         eval $xscan;\
5240         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5241                 eval $xrun
5242 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5243         eval $xscan;\
5244         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5245                 eval $xrun
5246 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5247         eval $xscan;\
5248         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5249                 eval $xrun
5250 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5251         eval $xscan;\
5252         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5253                 eval $xrun
5254 else
5255         $nm -p $* 2>/dev/null >libc.tmp
5256         $grep fprintf libc.tmp > libc.ptf
5257         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5258                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5259         then
5260                 nm_opt='-p'
5261                 eval $xrun
5262         else
5263                 echo " "
5264                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5265                 com=''
5266                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5267                         for thisname in $libnames $libc; do
5268                                 $ar t $thisname >>libc.tmp
5269                         done
5270                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5271                         echo "Ok." >&4
5272                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5273                         # Repeat libc to extract forwarders to DLL entries too
5274                         for thisname in $libnames $libc; do
5275                                 $ar tv $thisname >>libc.tmp
5276                                 # Revision 50 of EMX has bug in $ar.
5277                                 # it will not extract forwarders to DLL entries
5278                                 # Use emximp which will extract exactly them.
5279                                 emximp -o tmp.imp $thisname \
5280                                     2>/dev/null && \
5281                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5282                                     < tmp.imp >>libc.tmp
5283                                 $rm tmp.imp
5284                         done
5285                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5286                         echo "Ok." >&4
5287                 else
5288                         echo "$ar didn't seem to work right." >&4
5289                         echo "Maybe this is a Cray...trying bld instead..." >&4
5290                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5291                         then
5292                                 for thisname in $libnames; do
5293                                         bld t $libnames | \
5294                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5295                                         $ar t $thisname >>libc.tmp
5296                                 done
5297                                 echo "Ok." >&4
5298                         else
5299                                 echo "That didn't work either.  Giving up." >&4
5300                                 exit 1
5301                         fi
5302                 fi
5303         fi
5304 fi
5305 nm_extract="$com"
5306 if $test -f /lib/syscalls.exp; then
5307         echo " "
5308         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5309         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5310 fi
5311 ;;
5312 esac
5313 $rm -f libnames libpath
5314
5315 : see if dld is available
5316 set dld.h i_dld
5317 eval $inhdr
5318
5319 : is a C symbol defined?
5320 csym='tlook=$1;
5321 case "$3" in
5322 -v) tf=libc.tmp; tc=""; tdc="";;
5323 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5324 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5325 esac;
5326 tx=yes;
5327 case "$reuseval-$4" in
5328 true-) ;;
5329 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5330 esac;
5331 case "$tx" in
5332 yes)
5333         case "$runnm" in
5334         true)
5335                 if $contains $tlook $tf >/dev/null 2>&1;
5336                 then tval=true;
5337                 else tval=false;
5338                 fi;;
5339         *)
5340                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5341                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5342                 then tval=true;
5343                 else tval=false;
5344                 fi;
5345                 $rm -f t t.c;;
5346         esac;;
5347 *)
5348         case "$tval" in
5349         $define) tval=true;;
5350         *) tval=false;;
5351         esac;;
5352 esac;
5353 eval "$2=$tval"'
5354
5355 : define an is-in-libc? function
5356 inlibc='echo " "; td=$define; tu=$undef;
5357 sym=$1; var=$2; eval "was=\$$2";
5358 tx=yes;
5359 case "$reuseval$was" in
5360 true) ;;
5361 true*) tx=no;;
5362 esac;
5363 case "$tx" in
5364 yes)
5365         set $sym tres -f;
5366         eval $csym;
5367         case "$tres" in
5368         true)
5369                 echo "$sym() found." >&4;
5370                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5371         *)
5372                 echo "$sym() NOT found." >&4;
5373                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5374         esac;;
5375 *)
5376         case "$was" in
5377         $define) echo "$sym() found." >&4;;
5378         *) echo "$sym() NOT found." >&4;;
5379         esac;;
5380 esac'
5381
5382 : see if dlopen exists
5383 xxx_runnm="$runnm"
5384 runnm=false
5385 set dlopen d_dlopen
5386 eval $inlibc
5387 runnm="$xxx_runnm"
5388
5389 : determine which dynamic loading, if any, to compile in
5390 echo " "
5391 dldir="ext/DynaLoader"
5392 case "$usedl" in
5393 $define|y|true)
5394         dflt='y'
5395         usedl="$define"
5396         ;;
5397 $undef|n|false)
5398         dflt='n'
5399         usedl="$undef"
5400         ;;
5401 *) 
5402         dflt='n'
5403         case "$d_dlopen" in
5404             $define) dflt='y' ;;
5405         esac
5406         case "$i_dld" in
5407             $define) dflt='y' ;;
5408         esac
5409         : Does a dl_xxx.xs file exist for this operating system
5410         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5411         ;;
5412 esac
5413 rp="Do you wish to use dynamic loading?"
5414 . ./myread
5415 usedl="$ans"
5416 case "$ans" in
5417 y*) usedl="$define"
5418         case "$dlsrc" in
5419         '')
5420                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5421                         dflt="$dldir/dl_${osname}.xs"
5422                 elif $test "$d_dlopen" = "$define" ; then
5423                         dflt="$dldir/dl_dlopen.xs"
5424                 elif $test "$i_dld" = "$define" ; then
5425                         dflt="$dldir/dl_dld.xs"
5426                 else
5427                         dflt=''
5428                 fi
5429                 ;;
5430         *)      dflt="$dldir/$dlsrc"
5431                 ;;
5432         esac
5433     echo "The following dynamic loading files are available:"
5434         : Can not go over to $dldir because getfile has path hard-coded in.
5435         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5436         rp="Source file to use for dynamic loading"
5437         fn="fne"
5438         gfpth="$src"
5439         . ./getfile
5440         usedl="$define"
5441         : emulate basename
5442         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5443
5444         $cat << EOM
5445
5446 Some systems may require passing special flags to $cc -c to
5447 compile modules that will be used to create a shared library.
5448 To use no flags, say "none".
5449
5450 EOM
5451     case "$cccdlflags" in
5452     '') case "$gccversion" in
5453                 '') case "$osname" in
5454                         hpux)   dflt='+z' ;;
5455                         next)   dflt='none' ;;
5456                         irix*)  dflt='-KPIC' ;;
5457                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5458                         sunos)  dflt='-pic' ;;
5459                         *)      dflt='none' ;;
5460                     esac
5461                         ;;
5462                 *)  case "$osname" in
5463                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5464                         *)      dflt='-fpic' ;;
5465                     esac ;;
5466             esac ;;
5467         ' ') dflt='none' ;;
5468     *)  dflt="$cccdlflags" ;;
5469     esac
5470     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5471     . ./myread
5472     case "$ans" in
5473     none) cccdlflags=' ' ;;
5474     *) cccdlflags="$ans" ;;
5475     esac
5476
5477     cat << EOM
5478
5479 Some systems use ld to create libraries that can be dynamically loaded,
5480 while other systems (such as those using ELF) use $cc.
5481
5482 EOM
5483         case "$ld" in
5484         '')     $cat >try.c <<'EOM'
5485 /* Test for whether ELF binaries are produced */
5486 #include <fcntl.h>
5487 #include <stdlib.h>
5488 int main() {
5489         char b[4];
5490         int i = open("a.out",O_RDONLY);
5491         if(i == -1) 
5492                 exit(1); /* fail */
5493         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5494                 exit(0); /* succeed (yes, it's ELF) */
5495         else
5496                 exit(1); /* fail */
5497 }
5498 EOM
5499                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5500                         cat <<EOM
5501 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5502 EOM
5503                         dflt="$cc"
5504                 else
5505                         echo "I'll use ld to build dynamic libraries."
5506                         dflt='ld'
5507                 fi
5508                 rm -f try.c a.out
5509                 ;;
5510         *)      dflt="$ld"
5511                 ;;
5512         esac
5513
5514     rp="What command should be used to create dynamic libraries?"
5515     . ./myread
5516         ld="$ans"
5517
5518     cat << EOM
5519
5520 Some systems may require passing special flags to $ld to create a
5521 library that can be dynamically loaded.  If your ld flags include
5522 -L/other/path options to locate libraries outside your loader's normal
5523 search path, you may need to specify those -L options here as well.  To
5524 use no flags, say "none".
5525
5526 EOM
5527     case "$lddlflags" in
5528     '') case "$osname" in
5529                         beos) dflt='-nostart' ;;
5530                         hpux)  dflt='-b' ;;
5531                         linux|irix*)    dflt='-shared' ;;
5532                         next)  dflt='none' ;;
5533                         solaris) dflt='-G' ;;
5534                         sunos) dflt='-assert nodefinitions' ;;
5535                         svr4*|esix*) dflt="-G $ldflags" ;;
5536                 *)     dflt='none' ;;
5537                         esac
5538                         ;;
5539     *) dflt="$lddlflags" ;;
5540     esac
5541
5542         : Try to guess additional flags to pick up local libraries.
5543         : Be careful not to append to a plain 'none'
5544         case "$dflt" in
5545         none) dflt='' ;;
5546         esac
5547         for thisflag in $ldflags; do
5548                 case "$thisflag" in
5549                 -L*)
5550                         case " $dflt " in
5551                         *" $thisflag "*) ;;
5552                         *) dflt="$dflt $thisflag" ;;
5553                         esac
5554                         ;;
5555                 esac
5556         done
5557
5558         case "$dflt" in
5559         ''|' ') dflt='none' ;;
5560         esac
5561
5562     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5563     . ./myread
5564     case "$ans" in
5565     none) lddlflags=' ' ;;
5566     *) lddlflags="$ans" ;;
5567     esac
5568
5569         cat <<EOM
5570
5571 Some systems may require passing special flags to $cc to indicate that
5572 the resulting executable will use dynamic linking.  To use no flags,
5573 say "none".
5574
5575 EOM
5576     case "$ccdlflags" in
5577     '') case "$osname" in
5578                 hpux)   dflt='-Wl,-E' ;;
5579                 linux)  dflt='-rdynamic' ;;
5580                 next)   dflt='none' ;;
5581                 sunos)  dflt='none' ;;
5582                 *)      dflt='none' ;;
5583             esac ;;
5584     ' ')  dflt='none' ;;
5585     *)  dflt="$ccdlflags" ;;
5586     esac
5587     rp="Any special flags to pass to $cc to use dynamic loading?"
5588     . ./myread
5589     case "$ans" in
5590     none) ccdlflags=' ' ;;
5591     *) ccdlflags="$ans" ;;
5592     esac
5593     ;;
5594 *)  usedl="$undef"
5595         ld='ld'
5596     dlsrc='dl_none.xs'
5597     lddlflags=''
5598     ccdlflags=''
5599     ;;
5600 esac
5601
5602 also=''
5603 case "$usedl" in
5604 $undef)
5605         # No dynamic loading being used, so don't bother even to prompt.
5606         useshrplib='false'
5607         ;;
5608 *)      case "$useshrplib" in
5609         '')     case "$osname" in
5610                 svr4*|dgux|dynixptx|esix|powerux|beos)
5611                         dflt=y
5612                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5613                         ;;
5614                 next*)
5615                         case "$osvers" in
5616                         4*)     dflt=y
5617                                 also='Building a shared libperl is needed for MAB support.'
5618                                 ;;
5619                         *)      dflt=n
5620                                 ;;
5621                         esac
5622                         ;;
5623                 *)      dflt=n
5624                         ;;
5625                 esac
5626                 ;;
5627         $define|true|[Yy]*)
5628                 dflt=y
5629                 ;;
5630         *)      dflt=n
5631                 ;;
5632         esac
5633         $cat << EOM
5634
5635 The perl executable is normally obtained by linking perlmain.c with
5636 libperl${_a}, any static extensions (usually just DynaLoader), and
5637 any other libraries needed on this system (such as -lm, etc.).  Since
5638 your system supports dynamic loading, it is probably possible to build
5639 a shared libperl.$so.  If you will have more than one executable linked
5640 to libperl.$so, this will significantly reduce the size of each
5641 executable, but it may have a noticeable affect on performance.  The
5642 default is probably sensible for your system.
5643 $also
5644
5645 EOM
5646         rp="Build a shared libperl.$so (y/n)"
5647         . ./myread
5648         case "$ans" in
5649         true|$define|[Yy]*)
5650                 useshrplib='true'  ;;
5651         *)      useshrplib='false' ;;
5652         esac
5653         ;;
5654 esac
5655
5656 case "$useshrplib" in
5657 true)
5658         case "$libperl" in
5659         '')
5660                 # Figure out a good name for libperl.so.  Since it gets stored in
5661                 # a version-specific architecture-dependent library, the version
5662                 # number isn't really that important, except for making cc/ld happy.
5663                 #
5664                 # A name such as libperl.so.3.1
5665                 majmin="libperl.$so.$patchlevel.$subversion"
5666                 # A name such as libperl.so.301
5667                 majonly=`echo $patchlevel $subversion |
5668                         $awk '{printf "%d%02d", $1, $2}'`
5669                 majonly=libperl.$so.$majonly
5670                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5671                 # rely on figuring it out from the naming of libc.
5672                 case "${osname}${osvers}" in
5673                 next4*)
5674                         dflt=libperl.5.$so
5675                         # XXX How handle the --version stuff for MAB?
5676                         ;;
5677                 linux*)  # ld won't link with a bare -lperl otherwise.
5678                         dflt=libperl.$so
5679                         ;;
5680                 *)      # Try to guess based on whether libc has major.minor.
5681                         case "$libc" in
5682                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5683                         *libc.$so.[0-9]*) dflt=$majonly ;;
5684                         *)      dflt=libperl.$so ;;
5685                         esac
5686                         ;;
5687                 esac
5688                 ;;
5689         *)      dflt=$libperl
5690                 ;;
5691         esac
5692         cat << EOM
5693
5694 I need to select a good name for the shared libperl.  If your system uses
5695 library names with major and minor numbers, then you might want something
5696 like $majmin.  Alternatively, if your system uses a single version
5697 number for shared libraries, then you might want to use $majonly.
5698 Or, your system might be quite happy with a simple libperl.$so.
5699
5700 Since the shared libperl will get installed into a version-specific
5701 architecture-dependent directory, the version number of the shared perl
5702 library probably isn't important, so the default should be o.k.
5703
5704 EOM
5705         rp='What name do you want to give to the shared libperl?'
5706         . ./myread
5707         libperl=$ans
5708         echo "Ok, I'll use $libperl"
5709         ;;
5710 *)
5711         libperl="libperl${_a}"
5712         ;;
5713 esac
5714
5715 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5716 case "$shrpdir" in
5717 '') ;;
5718 *)      $cat >&4 <<EOM
5719 WARNING:  Use of the shrpdir variable for the installation location of
5720 the shared $libperl is not supported.  It was never documented and
5721 will not work in this version.  Let me (perlbug@perl.com)
5722 know of any problems this may cause.
5723
5724 EOM
5725         case "$shrpdir" in
5726         "$archlibexp/CORE")
5727                 $cat >&4 <<EOM
5728 But your current setting of $shrpdir is
5729 the default anyway, so it's harmless.
5730 EOM
5731                 ;;
5732         *)
5733                 $cat >&4 <<EOM
5734 Further, your current attempted setting of $shrpdir
5735 conflicts with the value of $archlibexp/CORE
5736 that installperl will use.
5737 EOM
5738                 ;;
5739         esac
5740         ;;
5741 esac
5742
5743 # How will the perl executable find the installed shared $libperl?
5744 # Add $xxx to ccdlflags.
5745 # If we can't figure out a command-line option, use $shrpenv to
5746 # set env LD_RUN_PATH.  The main perl makefile uses this.
5747 shrpdir=$archlibexp/CORE
5748 xxx=''
5749 tmp_shrpenv=''
5750 if "$useshrplib"; then
5751     case "$osname" in 
5752         aix)
5753                 # We'll set it in Makefile.SH...
5754                 ;;
5755         solaris|netbsd)
5756                 xxx="-R $shrpdir"
5757                 ;;
5758         freebsd)
5759                 xxx="-Wl,-R$shrpdir"
5760                 ;;
5761         linux|irix*|dec_osf)
5762                 xxx="-Wl,-rpath,$shrpdir"
5763                 ;;
5764         next)
5765                 # next doesn't like the default...
5766                 ;;
5767         beos)
5768                 # beos doesn't like the default, either.
5769                 ;;
5770         hpux*)
5771                 # hpux doesn't like the default, either.
5772                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5773                 ;;
5774         *)
5775                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5776                 ;;
5777         esac
5778         case "$xxx" in
5779         '') ;;
5780         *)      
5781                 # Only add $xxx if it isn't already in ccdlflags.
5782                 case " $ccdlflags " in
5783                 *" $xxx "*)     ;;
5784                 *)      ccdlflags="$ccdlflags $xxx"
5785                         cat <<EOM >&4
5786
5787 Adding $xxx to the flags
5788 passed to $ld so that the perl executable will find the 
5789 installed shared $libperl.
5790
5791 EOM
5792                         ;;
5793                 esac
5794                 ;;
5795         esac
5796 fi
5797 # Fix ccdlflags in AIX for building external extensions.
5798 # (For building Perl itself bare -bE:perl.exp is needed,
5799 #  Makefile.SH takes care of this.)
5800 case "$osname" in
5801 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5802 esac
5803 # Respect a hint or command-line value.
5804 case "$shrpenv" in
5805 '') shrpenv="$tmp_shrpenv" ;;
5806 esac
5807 case "$ldlibpthname" in
5808 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5809 none)   ldlibpthname='' ;;
5810 esac
5811
5812 : determine where manual pages go
5813 set man1dir man1dir none
5814 eval $prefixit
5815 $cat <<EOM
5816
5817 $spackage has manual pages available in source form.
5818 EOM
5819 case "$nroff" in
5820 nroff)
5821         echo "However, you don't have nroff, so they're probably useless to you."
5822         case "$man1dir" in
5823         '') man1dir="none";;
5824         esac;;
5825 esac
5826 echo "If you don't want the manual sources installed, answer 'none'."
5827 case "$man1dir" in
5828 ' ') dflt=none
5829         ;;
5830 '')
5831         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5832         lookpath="$lookpath $prefixexp/man/p_man/man1"
5833         lookpath="$lookpath $prefixexp/man/u_man/man1"
5834         lookpath="$lookpath $prefixexp/man/man.1"
5835         case "$sysman" in
5836         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5837         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5838         esac
5839         set dflt
5840         eval $prefixup
5841         ;;
5842 *)  dflt="$man1dir"
5843         ;;
5844 esac
5845 echo " "
5846 fn=dn+~
5847 rp="Where do the main $spackage manual pages (source) go?"
5848 . ./getfile
5849 if $test "X$man1direxp" != "X$ansexp"; then
5850         installman1dir=''
5851 fi
5852 man1dir="$ans"
5853 man1direxp="$ansexp"
5854 case "$man1dir" in
5855 '')     man1dir=' '
5856         installman1dir='';;
5857 esac
5858
5859 : Change installation prefix, if necessary.
5860 if $test X"$prefix" != X"$installprefix"; then
5861         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5862 else
5863         installman1dir="$man1direxp"
5864 fi
5865
5866 : What suffix to use on installed man pages
5867
5868 case "$man1dir" in
5869 ' ')
5870         man1ext='0'
5871         ;;
5872 *)
5873         rp="What suffix should be used for the main $spackage man pages?"
5874         case "$man1ext" in
5875         '')     case "$man1dir" in
5876                 *1)  dflt=1 ;;
5877                 *1p) dflt=1p ;;
5878                 *1pm) dflt=1pm ;;
5879                 *l) dflt=l;;
5880                 *n) dflt=n;;
5881                 *o) dflt=o;;
5882                 *p) dflt=p;;
5883                 *C) dflt=C;;
5884                 *L) dflt=L;;
5885                 *L1) dflt=L1;;
5886                 *) dflt=1;;
5887                 esac
5888                 ;;
5889         *)      dflt="$man1ext";;
5890         esac
5891         . ./myread
5892         man1ext="$ans"
5893         ;;
5894 esac
5895
5896 : see if we can have long filenames
5897 echo " "
5898 rmlist="$rmlist /tmp/cf$$"
5899 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5900 first=123456789abcdef
5901 second=/tmp/cf$$/$first
5902 $rm -f $first $second
5903 if (echo hi >$first) 2>/dev/null; then
5904         if $test -f 123456789abcde; then
5905                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5906                 val="$undef"
5907         else
5908                 if (echo hi >$second) 2>/dev/null; then
5909                         if $test -f /tmp/cf$$/123456789abcde; then
5910                                 $cat <<'EOM'
5911 That's peculiar... You can have filenames longer than 14 characters, but only
5912 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5913 I shall consider your system cannot support long filenames at all.
5914 EOM
5915                                 val="$undef"
5916                         else
5917                                 echo 'You can have filenames longer than 14 characters.' >&4
5918                                 val="$define"
5919                         fi
5920                 else
5921                         $cat <<'EOM'
5922 How confusing! Some of your filesystems are sane enough to allow filenames
5923 longer than 14 characters but some others like /tmp can't even think about them.
5924 So, for now on, I shall assume your kernel does not allow them at all.
5925 EOM
5926                         val="$undef"
5927                 fi
5928         fi
5929 else
5930         $cat <<'EOM'
5931 You can't have filenames longer than 14 chars.  You can't even think about them!
5932 EOM
5933         val="$undef"
5934 fi 
5935 set d_flexfnam
5936 eval $setvar
5937 $rm -rf /tmp/cf$$ 123456789abcde*
5938
5939 : determine where library module manual pages go
5940 set man3dir man3dir none
5941 eval $prefixit
5942 $cat <<EOM
5943
5944 $spackage has manual pages for many of the library modules.
5945 EOM
5946
5947 case "$nroff" in
5948 nroff)
5949         $cat <<'EOM'
5950 However, you don't have nroff, so they're probably useless to you.
5951 EOM
5952         case "$man3dir" in
5953         '') man3dir="none";;
5954         esac;;
5955 esac
5956
5957 case "$d_flexfnam" in
5958 undef)
5959         $cat <<'EOM'
5960 However, your system can't handle the long file names like File::Basename.3. 
5961 EOM
5962         case "$man3dir" in
5963         '') man3dir="none";;
5964         esac;;
5965 esac
5966
5967 echo "If you don't want the manual sources installed, answer 'none'."
5968 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5969 case "$man3dir" in
5970 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5971         if $test -d "$privlib/man/man3"; then
5972                 cat <<EOM >&4
5973
5974 WARNING:  Previous versions of perl installed man3 pages into
5975 $privlib/man/man3.  This version will suggest a 
5976 new default of $dflt.  
5977 EOM
5978                 tdflt=$dflt
5979                 dflt='n'
5980                 rp='Do you wish to preserve the old behavior?(y/n)'
5981                 . ./myread
5982                 case "$ans" in
5983                 y*) dflt="$privlib/man/man3" ;;
5984                 *)  dflt=$tdflt ;;
5985                 esac
5986     fi
5987         ;;
5988 ' ') dflt=none;;
5989 *)      dflt="$man3dir" ;;
5990 esac
5991 echo " "
5992 fn=dn+~
5993 rp="Where do the $package library man pages (source) go?"
5994 . ./getfile
5995 man3dir="$ans"
5996 man3direxp="$ansexp"
5997 case "$man1dir" in
5998 '')     man3dir=' '
5999         installman3dir='';;
6000 esac
6001
6002 : Change installation prefix, if necessary.
6003 if $test X"$prefix" != X"$installprefix"; then
6004         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6005 else
6006         installman3dir="$man3direxp"
6007 fi
6008
6009 : What suffix to use on installed man pages
6010 case "$man3dir" in
6011 ' ')
6012         man3ext='0'
6013         ;;
6014 *)
6015         rp="What suffix should be used for the $package library man pages?"
6016         case "$man3ext" in
6017         '')     case "$man3dir" in
6018                 *3)  dflt=3 ;;
6019                 *3p) dflt=3p ;;
6020                 *3pm) dflt=3pm ;;
6021                 *l) dflt=l;;
6022                 *n) dflt=n;;
6023                 *o) dflt=o;;
6024                 *p) dflt=p;;
6025                 *C) dflt=C;;
6026                 *L) dflt=L;;
6027                 *L3) dflt=L3;;
6028                 *) dflt=3;;
6029                 esac
6030                 ;;
6031         *)      dflt="$man3ext";;
6032         esac
6033         . ./myread
6034         man3ext="$ans"
6035         ;;
6036 esac
6037
6038 : see if we have to deal with yellow pages, now NIS.
6039 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6040         if $test -f /usr/etc/nibindd; then
6041                 echo " "
6042                 echo "I'm fairly confident you're on a NeXT."
6043                 echo " "
6044                 rp='Do you get the hosts file via NetInfo?'
6045                 dflt=y
6046                 case "$hostcat" in
6047                 nidump*) ;;
6048                 '') ;;
6049                 *) dflt=n;;
6050                 esac
6051                 . ./myread
6052                 case "$ans" in
6053                 y*) hostcat='nidump hosts .';;
6054                 *)      case "$hostcat" in
6055                         nidump*) hostcat='';;
6056                         esac
6057                         ;;
6058                 esac
6059         fi
6060         case "$hostcat" in
6061         nidump*) ;;
6062         *)
6063                 case "$hostcat" in
6064                 *ypcat*) dflt=y;;
6065                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6066                                 dflt=y
6067                         else
6068                                 dflt=n
6069                         fi;;
6070                 *) dflt=n;;
6071                 esac
6072                 echo " "
6073                 rp='Are you getting the hosts file via yellow pages?'
6074                 . ./myread
6075                 case "$ans" in
6076                 y*) hostcat='ypcat hosts';;
6077                 *) hostcat='cat /etc/hosts';;
6078                 esac
6079                 ;;
6080         esac
6081 fi
6082 case "$hostcat" in
6083 '') hostcat='cat /etc/hosts';;
6084 esac
6085 case "$groupcat" in
6086 '') groupcat='cat /etc/group';;
6087 esac
6088 case "$passcat" in
6089 '') passcat='cat /etc/passwd';;
6090 esac
6091
6092 : now get the host name
6093 echo " "
6094 echo "Figuring out host name..." >&4
6095 case "$myhostname" in
6096 '') cont=true
6097         echo 'Maybe "hostname" will work...'
6098         if tans=`sh -c hostname 2>&1` ; then
6099                 myhostname=$tans
6100                 phostname=hostname
6101                 cont=''
6102         fi
6103         ;;
6104 *) cont='';;
6105 esac
6106 if $test "$cont"; then
6107         if ./xenix; then
6108                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6109                 if tans=`cat /etc/systemid 2>&1` ; then
6110                         myhostname=$tans
6111                         phostname='cat /etc/systemid'
6112                         echo "Whadyaknow.  Xenix always was a bit strange..."
6113                         cont=''
6114                 fi
6115         elif $test -r /etc/systemid; then
6116                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6117         fi
6118 fi
6119 if $test "$cont"; then
6120         echo 'No, maybe "uuname -l" will work...'
6121         if tans=`sh -c 'uuname -l' 2>&1` ; then
6122                 myhostname=$tans
6123                 phostname='uuname -l'
6124         else
6125                 echo 'Strange.  Maybe "uname -n" will work...'
6126                 if tans=`sh -c 'uname -n' 2>&1` ; then
6127                         myhostname=$tans
6128                         phostname='uname -n'
6129                 else
6130                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6131                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6132                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6133                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6134                         else
6135                                 case "$myhostname" in
6136                                 '') echo "Does this machine have an identity crisis or something?"
6137                                         phostname='';;
6138                                 *)
6139                                         echo "Well, you said $myhostname before..."
6140                                         phostname='echo $myhostname';;
6141                                 esac
6142                         fi
6143                 fi
6144         fi
6145 fi
6146 : you do not want to know about this
6147 set $myhostname
6148 myhostname=$1
6149
6150 : verify guess
6151 if $test "$myhostname" ; then
6152         dflt=y
6153         rp='Your host name appears to be "'$myhostname'".'" Right?"
6154         . ./myread
6155         case "$ans" in
6156         y*) ;;
6157         *) myhostname='';;
6158         esac
6159 fi
6160
6161 : bad guess or no guess
6162 while $test "X$myhostname" = X ; do
6163         dflt=''
6164         rp="Please type the (one word) name of your host:"
6165         . ./myread
6166         myhostname="$ans"
6167 done
6168
6169 : translate upper to lower if necessary
6170 case "$myhostname" in
6171 *[A-Z]*)
6172         echo "(Normalizing case in your host name)"
6173         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6174         ;;
6175 esac
6176
6177 case "$myhostname" in
6178 *.*)
6179         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6180         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6181         echo "(Trimming domain name from host name--host name is now $myhostname)"
6182         ;;
6183 *) case "$mydomain" in
6184         '')
6185                 {
6186                         test "X$hostcat" = "Xypcat hosts" &&
6187                         ypmatch "$myhostname" hosts 2>/dev/null |\
6188                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6189                         $test -s hosts
6190                 } || {
6191                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6192                                         /[       ]$myhostname[  . ]/p" > hosts
6193                 }
6194                 tmp_re="[       . ]"
6195                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6196                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6197                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6198                         hosts | $sort | $uniq | \
6199                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6200                 case `$echo X$dflt` in
6201                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6202                         dflt=.
6203                         ;;
6204                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6205                         ;;
6206                 esac
6207                 case "$dflt" in
6208                 .)
6209                         tans=`./loc resolv.conf X /etc /usr/etc`
6210                         if $test -f "$tans"; then
6211                                 echo "(Attempting domain name extraction from $tans)"
6212                                 dflt=.`$sed -n -e 's/   / /g' \
6213                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6214                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6215                                 case "$dflt" in
6216                                 .) dflt=.`$sed -n -e 's/        / /g' \
6217                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6218                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6219                                         ;;
6220                                 esac
6221                         fi
6222                         ;;
6223                 esac
6224                 case "$dflt" in
6225                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6226                         dflt=.`sh -c domainname 2>/dev/null`
6227                         case "$dflt" in
6228                         '') dflt='.';;
6229                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6230                         esac
6231                         ;;
6232                 esac
6233                 case "$dflt" in
6234                 .) echo "(Lost all hope -- silly guess then)"
6235                         dflt='.uucp'
6236                         ;;
6237                 esac
6238                 $rm -f hosts
6239                 ;;
6240         *) dflt="$mydomain";;
6241         esac;;
6242 esac
6243 echo " "
6244 rp="What is your domain name?"
6245 . ./myread
6246 tans="$ans"
6247 case "$ans" in
6248 '') ;;
6249 .*) ;;
6250 *) tans=".$tans";;
6251 esac
6252 mydomain="$tans"
6253
6254 : translate upper to lower if necessary
6255 case "$mydomain" in
6256 *[A-Z]*)
6257         echo "(Normalizing case in your domain name)"
6258         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6259         ;;
6260 esac
6261
6262 : a little sanity check here
6263 case "$phostname" in
6264 '') ;;
6265 *)
6266         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6267         $myhostname$mydomain|$myhostname) ;;
6268         *)
6269                 case "$phostname" in
6270                 sed*)
6271                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6272                         ;;
6273                 *)
6274                         echo "(That doesn't agree with your $phostname command, by the way.)"
6275                         ;;
6276                 esac
6277         ;;
6278         esac
6279         ;;
6280 esac
6281
6282 $cat <<EOM
6283
6284 I need to get your e-mail address in Internet format if possible, i.e.
6285 something like user@host.domain. Please answer accurately since I have
6286 no easy means to double check it. The default value provided below
6287 is most probably close to the reality but may not be valid from outside
6288 your organization...
6289
6290 EOM
6291 cont=x
6292 while test "$cont"; do
6293         case "$cf_email" in
6294         '') dflt="$cf_by@$myhostname$mydomain";;
6295         *) dflt="$cf_email";;
6296         esac
6297         rp='What is your e-mail address?'
6298         . ./myread
6299         cf_email="$ans"
6300         case "$cf_email" in
6301         *@*.*) cont='' ;;
6302         *)
6303                 rp='Address does not look like an Internet one.  Use it anyway?'
6304                 case "$fastread" in
6305                 yes) dflt=y ;;
6306                 *) dflt=n ;;
6307                 esac
6308                 . ./myread
6309                 case "$ans" in
6310                 y*) cont='' ;;
6311                 *) echo " " ;;
6312                 esac
6313                 ;;
6314         esac
6315 done
6316
6317 $cat <<EOM
6318
6319 If you or somebody else will be maintaining perl at your site, please
6320 fill in the correct e-mail address here so that they may be contacted
6321 if necessary. Currently, the "perlbug" program included with perl
6322 will send mail to this address in addition to perlbug@perl.com. You may
6323 enter "none" for no administrator.
6324
6325 EOM
6326 case "$perladmin" in
6327 '') dflt="$cf_email";;
6328 *) dflt="$perladmin";;
6329 esac
6330 rp='Perl administrator e-mail address'
6331 . ./myread
6332 perladmin="$ans"
6333
6334 : figure out how to guarantee perl startup
6335 case "$startperl" in
6336 '')
6337         case "$sharpbang" in
6338         *!)
6339                 $cat <<EOH
6340
6341 I can use the #! construct to start perl on your system. This will
6342 make startup of perl scripts faster, but may cause problems if you
6343 want to share those scripts and perl is not in a standard place
6344 ($binexp/perl) on all your platforms. The alternative is to force
6345 a shell by starting the script with a single ':' character.
6346
6347 EOH
6348                 dflt="$binexp/perl"
6349                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6350                 . ./myread
6351                 case "$ans" in
6352                 none)   startperl=": # use perl";;
6353                 *)      startperl="#!$ans"
6354                         if $test 30 -lt `echo "$ans" | wc -c`; then
6355                                 $cat >&4 <<EOM
6356
6357 WARNING:  Some systems limit the #! command to 32 characters.
6358 If you experience difficulty running Perl scripts with #!, try
6359 installing Perl in a directory with a shorter pathname.
6360
6361 EOM
6362                         fi ;;
6363                 esac
6364                 ;;
6365         *) startperl=": # use perl"
6366                 ;;
6367         esac
6368         ;;
6369 esac
6370 echo "I'll use $startperl to start perl scripts."
6371
6372 : figure best path for perl in scripts
6373 case "$perlpath" in
6374 '')
6375         perlpath="$binexp/perl"
6376         case "$startperl" in
6377         *!*) ;;
6378         *)
6379                 $cat <<EOH
6380
6381 I will use the "eval 'exec'" idiom to start Perl on your system.
6382 I can use the full path of your Perl binary for this purpose, but
6383 doing so may cause problems if you want to share those scripts and
6384 Perl is not always in a standard place ($binexp/perl).
6385
6386 EOH
6387                 dflt="$binexp/perl"
6388                 rp="What path shall I use in \"eval 'exec'\"?"
6389                 . ./myread
6390                 perlpath="$ans"
6391                 ;;
6392         esac
6393         ;;
6394 esac
6395 case "$startperl" in
6396 *!*)    ;;
6397 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6398 esac
6399
6400 : determine where public executable scripts go
6401 set scriptdir scriptdir
6402 eval $prefixit
6403 case "$scriptdir" in
6404 '')
6405         dflt="$bin"
6406         : guess some guesses
6407         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6408         $test -d /usr/share/bin     && dflt=/usr/share/bin
6409         $test -d /usr/local/script  && dflt=/usr/local/script
6410         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6411         $test -d $prefixexp/script  && dflt=$prefixexp/script
6412         set dflt
6413         eval $prefixup
6414         ;;
6415 *)  dflt="$scriptdir"
6416         ;;
6417 esac
6418 $cat <<EOM
6419  
6420 Some installations have a separate directory just for executable scripts so
6421 that they can mount it across multiple architectures but keep the scripts in
6422 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6423 Or you might just lump your scripts in with all your other executables.
6424  
6425 EOM
6426 fn=d~
6427 rp='Where do you keep publicly executable scripts?'
6428 . ./getfile
6429 if $test "X$ansexp" != "X$scriptdirexp"; then
6430         installscript=''
6431 fi
6432 scriptdir="$ans"
6433 scriptdirexp="$ansexp"
6434 : Change installation prefix, if necessary.
6435 if $test X"$prefix" != X"$installprefix"; then
6436         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6437 else
6438         installscript="$scriptdirexp"
6439 fi
6440
6441 $cat <<EOM
6442
6443 After $package is installed, you may wish to install various
6444 add-on modules and utilities.  Typically, these add-ons will
6445 be installed under $prefix with the rest
6446 of this package.  However, you may wish to install such add-ons
6447 elsewhere under a different prefix.
6448
6449 If you do not wish to put everything under a single prefix, that's
6450 ok.  You will be prompted for the individual locations; this siteprefix
6451 is only used to suggest the defaults.
6452
6453 The default should be fine for most people.
6454
6455 EOM
6456 fn=d~+
6457 rp='Installation prefix to use for add-on modules and utilities?'
6458 : XXX Here might be another good place for an installstyle setting.
6459 case "$siteprefix" in
6460 '') dflt=$prefix ;;
6461 *)  dflt=$siteprefix ;;
6462 esac
6463 . ./getfile
6464 oldsiteprefix=''
6465 case "$siteprefix" in
6466 '') ;;
6467 *)
6468         case "$ans" in
6469         "$prefix") ;;
6470         *) oldsiteprefix="$prefix";;
6471         esac
6472         ;;
6473 esac
6474 siteprefix="$ans"
6475 siteprefixexp="$ansexp"
6476
6477 : determine where site specific libraries go.
6478 : Usual default is /usr/local/lib/perl5/site_perl
6479 : The default "style" setting is made in installstyle.U
6480 : XXX No longer works with Prefixit stuff.
6481 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6482 case "$installstyle" in
6483 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6484 *)       dflt=$siteprefix/lib/site_$prog ;;
6485 esac
6486 $cat <<EOM
6487
6488 The installation process will create a directory for
6489 site-specific extensions and modules.  Most users find it convenient
6490 to place all site-specific files in this directory rather than in the
6491 main distribution directory.
6492
6493 EOM
6494 fn=d~+
6495 rp='Pathname for the site-specific library files?'
6496 . ./getfile
6497 sitelib="$ans"
6498 sitelibexp="$ansexp"
6499 : Change installation prefix, if necessary.
6500 if $test X"$prefix" != X"$installprefix"; then
6501         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6502 else
6503         installsitelib="$sitelibexp"
6504 fi
6505
6506 : determine where site specific architecture-dependent libraries go.
6507 : sitelib  default is /usr/local/lib/perl5/site_perl/
6508 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6509 : sitelib may have an optional trailing /share.
6510 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6511 tdflt="$tdflt/$apiversion/$archname"
6512 set sitearch sitearch none
6513 eval $prefixit
6514 case "$sitearch" in
6515 '')     dflt="$tdflt" ;;
6516 *)      dflt="$sitearch" ;;
6517 esac
6518 $cat <<EOM
6519
6520 The installation process will also create a directory for
6521 architecture-dependent site-specific extensions and modules.
6522
6523 EOM
6524 fn=nd~+
6525 rp='Pathname for the site-specific architecture-dependent library files?'
6526 . ./getfile
6527 sitearch="$ans"
6528 sitearchexp="$ansexp"
6529 : Change installation prefix, if necessary.
6530 if $test X"$prefix" != X"$installprefix"; then
6531         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6532 else
6533         installsitearch="$sitearchexp"
6534 fi
6535
6536 cat <<EOM
6537
6538 Perl can be built to take advantage of long doubles which
6539 (if available) may give more accuracy and range for floating point
6540 numbers.  To do so, Configure must be run with -Duselongdouble.
6541
6542 If this doesn't make any sense to you, just accept the default 'n'.
6543 EOM
6544 case "$uselongdouble" in
6545 $define|true|[yY]*)     dflt='y';;
6546 *) dflt='n';;
6547 esac
6548 rp='Try to use long doubles if available?'
6549 . ./myread
6550 case "$ans" in
6551 y|Y)    val="$define"   ;;
6552 *)      val="$undef"    ;;
6553 esac
6554 set uselongdouble
6555 eval $setvar
6556
6557 case "$uselongdouble" in
6558 "$define"|true|[yY]*)
6559 : Look for a hint-file generated 'call-back-unit'.  If the
6560 : user has specified that long doubles should be used,
6561 : we may need to set or change some other defaults.
6562         if $test -f uselongdouble.cbu; then
6563                 echo "Your platform has some specific hints for long doubles, using them..."
6564                 . ./uselongdouble.cbu
6565         else
6566                 $cat <<EOM
6567 (Your platform doesn't have any specific hints for long doubles.)
6568 EOM
6569         fi
6570         ;;
6571 esac
6572
6573 cat <<EOM
6574
6575 Previous version of $package used the standard IO mechanisms as defined
6576 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6577 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6578 the default.  This abstraction layer can use AT&T's sfio (if you already
6579 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6580 problems with some extension modules.  Using PerlIO with stdio is safe,
6581 but it is slower than plain stdio and therefore is not the default.
6582
6583 If this doesn't make any sense to you, just accept the default 'n'.
6584 EOM
6585 case "$useperlio" in
6586 $define|true|[yY]*)     dflt='y';;
6587 *) dflt='n';;
6588 esac
6589 rp='Use the experimental PerlIO abstraction layer?'
6590 . ./myread
6591 case "$ans" in
6592 y|Y) 
6593         val="$define"
6594         ;;     
6595 *)      
6596         echo "Ok, doing things the stdio way"
6597         val="$undef"
6598         ;;
6599 esac
6600 set useperlio
6601 eval $setvar 
6602
6603 : Check how to convert floats to strings.
6604 if test "X$d_Gconvert" = X; then
6605         echo " "
6606         echo "Checking for an efficient way to convert floats to strings."
6607         $cat >try.c <<'EOP'
6608 #ifdef TRY_gconvert
6609 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6610 char *myname = "gconvert";
6611 #endif
6612 #ifdef TRY_gcvt
6613 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6614 char *myname = "gcvt";
6615 #endif
6616 #ifdef TRY_sprintf
6617 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6618 char *myname = "sprintf";
6619 #endif
6620
6621 #include <stdio.h>
6622
6623 int
6624 checkit(expect, got)
6625 char *expect;
6626 char *got;
6627 {
6628     if (strcmp(expect, got)) {
6629                 printf("%s oddity:  Expected %s, got %s\n",
6630                         myname, expect, got);
6631                 exit(1);
6632         }
6633 }
6634
6635 int main()
6636
6637         char buf[64]; 
6638         buf[63] = '\0';
6639
6640         /* This must be 1st test on (which?) platform */
6641         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6642         Gconvert(0.1, 8, 0, buf);
6643         checkit("0.1", buf);
6644
6645         Gconvert(1.0, 8, 0, buf); 
6646         checkit("1", buf);
6647
6648         Gconvert(0.0, 8, 0, buf); 
6649         checkit("0", buf);
6650
6651         Gconvert(-1.0, 8, 0, buf); 
6652         checkit("-1", buf);
6653
6654         /* Some Linux gcvt's give 1.e+5 here. */
6655         Gconvert(100000.0, 8, 0, buf); 
6656         checkit("100000", buf);
6657         
6658         /* Some Linux gcvt's give -1.e+5 here. */
6659         Gconvert(-100000.0, 8, 0, buf); 
6660         checkit("-100000", buf);
6661
6662         exit(0);
6663 }
6664 EOP
6665         case "$d_Gconvert" in
6666         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6667         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6668         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6669         *) xxx_list='gconvert gcvt sprintf' ;;
6670         esac
6671
6672         for xxx_convert in $xxx_list; do
6673                 echo "Trying $xxx_convert"
6674                 $rm -f try try$_o
6675                 set try -DTRY_$xxx_convert
6676                 if eval $compile; then
6677                         echo "$xxx_convert" found. >&4
6678                         if ./try; then
6679                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6680                                 break;
6681                         else
6682                                 echo "...But $xxx_convert didn't work as I expected."
6683                         fi
6684                 else
6685                         echo "$xxx_convert NOT found." >&4
6686                 fi
6687         done
6688                 
6689         case "$xxx_convert" in
6690         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6691         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6692         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6693         esac
6694 fi
6695
6696 : see if inttypes.h is available
6697 : we want a real compile instead of Inhdr because some systems
6698 : have an inttypes.h which includes non-existent headers
6699 echo " "
6700 $cat >try.c <<EOCP
6701 #include <inttypes.h>
6702 int main() {
6703         static int32_t foo32 = 0x12345678;
6704 }
6705 EOCP
6706 set try
6707 if eval $compile; then
6708         echo "<inttypes.h> found." >&4
6709         val="$define"
6710 else
6711         echo "<inttypes.h> NOT found." >&4
6712         val="$undef"
6713 fi
6714 $rm -f try.c try
6715 set i_inttypes
6716 eval $setvar
6717
6718 : check for int64_t
6719 case "$use64bits" in
6720 "$define" )
6721         echo " "
6722         echo $n "Checking to see if your system supports int64_t...$c" >&4
6723         $cat >try.c <<EOCP
6724 #include <sys/types.h>
6725 #$i_inttypes I_INTTYPES
6726 #ifdef I_INTTYPES
6727 #include <inttypes.h>
6728 #endif
6729 int64_t foo() { int64_t x; x = 7; return x; }
6730 EOCP
6731         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6732                 val="$define"
6733                 echo " Yup, it does." >&4
6734         else
6735                 val="$undef"
6736                 echo " Nope, it doesn't." >&4
6737         fi
6738         $rm -f try.*
6739         ;;
6740 *)      val="$undef"
6741         ;;
6742 esac
6743 set d_int64t
6744 eval $setvar
6745
6746
6747 : check for lengths of integral types
6748 echo " "
6749 case "$intsize" in
6750 '')
6751         echo "Checking to see how big your integers are..." >&4
6752         $cat >intsize.c <<'EOCP'
6753 #include <stdio.h>
6754 int main()
6755 {
6756         printf("intsize=%d;\n", sizeof(int));
6757         printf("longsize=%d;\n", sizeof(long));
6758         printf("shortsize=%d;\n", sizeof(short));
6759         exit(0);
6760 }
6761 EOCP
6762         set intsize
6763         if eval $compile_ok && ./intsize > /dev/null; then
6764                 eval `./intsize`
6765                 echo "Your integers are $intsize bytes long."
6766                 echo "Your long integers are $longsize bytes long."
6767                 echo "Your short integers are $shortsize bytes long."
6768         else
6769                 $cat >&4 <<EOM
6770 !
6771 Help! I can't compile and run the intsize test program: please enlighten me!
6772 (This is probably a misconfiguration in your system or libraries, and
6773 you really ought to fix it.  Still, I'll try anyway.)
6774 !
6775 EOM
6776                 dflt=4
6777                 rp="What is the size of an integer (in bytes)?"
6778                 . ./myread
6779                 intsize="$ans"
6780                 dflt=$intsize
6781                 rp="What is the size of a long integer (in bytes)?"
6782                 . ./myread
6783                 longsize="$ans"
6784                 dflt=2
6785                 rp="What is the size of a short integer (in bytes)?"
6786                 . ./myread
6787                 shortsize="$ans"
6788         fi
6789         ;;
6790 esac
6791 $rm -f intsize intsize.*
6792
6793 : check for long long
6794 echo " "
6795 echo $n "Checking to see if your system supports long long...$c" >&4
6796 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6797 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6798         val="$define"
6799         echo " Yup, it does." >&4
6800 else
6801         val="$undef"
6802         echo " Nope, it doesn't." >&4
6803 fi
6804 $rm try.*
6805 set d_longlong
6806 eval $setvar
6807
6808 : check for length of long long
6809 case "${d_longlong}${longlongsize}" in
6810 $define)
6811         echo " "
6812         $echo $n "Checking to see how big your long longs are...$c" >&4
6813         $cat >try.c <<'EOCP'
6814 #include <stdio.h>
6815 int main()
6816 {
6817         printf("%d\n", sizeof(long long));
6818 }
6819 EOCP
6820         set try
6821         if eval $compile_ok; then
6822                 longlongsize=`./try`
6823                 $echo " $longlongsize bytes." >&4
6824         else
6825                 dflt='8'
6826                 echo " "
6827                 echo "(I can't seem to compile the test program.  Guessing...)"
6828                 rp="What is the size of a long long (in bytes)?"
6829                 . ./myread
6830                 longlongsize="$ans"
6831         fi
6832         if $test "X$longsize" = "X$longlongsize"; then
6833                 echo "(That isn't any different from an ordinary long.)"
6834         fi      
6835         ;;
6836 esac
6837 $rm -f try.c try
6838
6839 echo " "
6840
6841 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6842
6843 echo "Checking how to print 64-bit integers..." >&4
6844
6845 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6846         quad=int
6847         $cat >try.c <<'EOCP'
6848 #include <sys/types.h>
6849 #include <stdio.h>
6850 int main() {
6851   int q = 12345678901;
6852   printf("%ld\n", q);
6853 }
6854 EOCP
6855         set try
6856         if eval $compile; then
6857                 yyy=`./try$exe_ext`
6858                 case "$yyy" in
6859                 12345678901)
6860                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6861                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6862                         echo "We will use %d."
6863                         ;;
6864                 esac
6865         fi
6866 fi
6867
6868 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6869         quad=long
6870         $cat >try.c <<'EOCP'
6871 #include <sys/types.h>
6872 #include <stdio.h>
6873 int main() {
6874   long q = 12345678901;
6875   printf("%ld\n", q);
6876 }
6877 EOCP
6878         set try
6879         if eval $compile; then
6880                 yyy=`./try$exe_ext`
6881                 case "$yyy" in
6882                 12345678901)
6883                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6884                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6885                         echo "We will use %ld."
6886                         ;;
6887                 esac
6888         fi
6889 fi
6890
6891 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6892         quad=int64_t
6893         $cat >try.c <<'EOCP'
6894 #include <sys/types.h>
6895 #include <inttypes.h>
6896 #include <stdio.h>
6897 int main() {
6898   int64_t q = 12345678901;
6899   printf("%" PRId64 "\n", q);
6900 }
6901 EOCP
6902         set try
6903         if eval $compile; then
6904                 yyy=`./try$exe_ext`
6905                 case "$yyy" in
6906                 12345678901)
6907                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6908                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6909                         echo "We will use the C9X style."
6910                         ;;
6911                 esac
6912         fi
6913 fi
6914
6915 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6916         quad="long long"
6917         $cat >try.c <<'EOCP'
6918 #include <sys/types.h>
6919 #include <stdio.h>
6920 int main() {
6921   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6922   printf("%lld\n", q);
6923 }
6924 EOCP
6925         set try
6926         if eval $compile; then
6927                 yyy=`./try$exe_ext`
6928                 case "$yyy" in
6929                 12345678901)
6930                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6931                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6932                         echo "We will use the %lld style."
6933                         ;;
6934                 esac
6935         fi
6936 fi
6937
6938 if $test X"$sPRId64" = X -a X"$quad" != X; then
6939         $cat >try.c <<EOCP
6940 #include <sys/types.h>
6941 #include <stdio.h>
6942 int main() {
6943   $quad q = 12345678901;
6944   printf("%Ld\n", q);
6945 }
6946 EOCP
6947         set try
6948         if eval $compile; then
6949                 yyy=`./try$exe_ext`
6950                 case "$yyy" in
6951                 12345678901)
6952                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6953                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6954                         echo "We will use %lld."
6955                         ;;
6956                 esac
6957         fi
6958 fi
6959
6960 if $test X"$sPRId64" = X -a X"$quad" != X; then
6961         $cat >try.c <<EOCP
6962 #include <sys/types.h>
6963 #include <stdio.h>
6964 int main() {
6965   $quad q = 12345678901;
6966   printf("%qd\n", q);
6967 }
6968 EOCP
6969         set try
6970         if eval $compile; then
6971                 yyy=`./try$exe_ext`
6972                 case "$yyy" in
6973                 12345678901)
6974                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6975                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6976                         echo "We will use %qd."
6977                         ;;
6978                 esac
6979         fi
6980 fi
6981
6982 if $test X"$sPRId64" = X; then
6983         echo "Cannot figure out how to print 64-bit integers." >&4
6984 fi
6985
6986 $rm -f try try.*
6987
6988 fi # intsize -o longsize -o d_int64t -o d_longlong
6989
6990 case "$sPRId64" in
6991 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6992         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6993         ;;
6994 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6995         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6996         ;;
6997 esac
6998
6999 : check for length of double
7000 echo " "
7001 case "$doublesize" in
7002 '')
7003         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7004         $cat >try.c <<'EOCP'
7005 #include <stdio.h>
7006 int main()
7007 {
7008         printf("%d\n", sizeof(double));
7009 }
7010 EOCP
7011         set try
7012         if eval $compile_ok; then
7013                 doublesize=`./try`
7014                 $echo " $doublesize bytes." >&4
7015         else
7016                 dflt='8'
7017                 echo "(I can't seem to compile the test program.  Guessing...)"
7018                 rp="What is the size of a double precision number (in bytes)?"
7019                 . ./myread
7020                 doublesize="$ans"
7021         fi
7022         ;;
7023 esac
7024 $rm -f try.c try
7025
7026 : check for long doubles
7027 echo " "
7028 echo $n "Checking to see if your system supports long double...$c" >&4
7029 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7030 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7031         val="$define"
7032         echo " Yup, it does." >&4
7033 else
7034         val="$undef"
7035         echo " Nope, it doesn't." >&4
7036 fi
7037 $rm try.*
7038 set d_longdbl
7039 eval $setvar
7040
7041 : check for length of long double
7042 case "${d_longdbl}${longdblsize}" in
7043 $define)
7044         echo " "
7045         $echo $n "Checking to see how big your long doubles are...$c" >&4
7046         $cat >try.c <<'EOCP'
7047 #include <stdio.h>
7048 int main()
7049 {
7050         printf("%d\n", sizeof(long double));
7051 }
7052 EOCP
7053         set try
7054         if eval $compile; then
7055                 longdblsize=`./try`
7056                 $echo " $longdblsize bytes." >&4
7057         else
7058                 dflt='8'
7059                 echo " "
7060                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7061                 rp="What is the size of a long double (in bytes)?"
7062                 . ./myread
7063                 longdblsize="$ans"
7064         fi
7065         if $test "X$doublesize" = "X$longdblsize"; then
7066                 echo "(That isn't any different from an ordinary double.)"
7067         fi      
7068         ;;
7069 esac
7070 $rm -f try.c try
7071
7072 echo " "
7073
7074 if $test X"$d_longdbl" = X"$define"; then
7075
7076 echo "Checking how to print long doubles..." >&4
7077
7078 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7079         $cat >try.c <<'EOCP'
7080 #include <sys/types.h>
7081 #include <stdio.h>
7082 int main() {
7083   double d = 123.456;
7084   printf("%.3f\n", d);
7085 }
7086 EOCP
7087         set try
7088         if eval $compile; then
7089                 yyy=`./try$exe_ext`
7090                 case "$yyy" in
7091                 123.456)
7092                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7093                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7094                         echo "We will use %f."
7095                         ;;
7096                 esac
7097         fi
7098 fi
7099
7100 if $test X"$sPRIfldbl" = X; then
7101         $cat >try.c <<'EOCP'
7102 #include <sys/types.h>
7103 #include <stdio.h>
7104 int main() {
7105   long double d = 123.456;
7106   printf("%.3llf\n", d);
7107 }
7108 EOCP
7109         set try
7110         if eval $compile; then
7111                 yyy=`./try$exe_ext`
7112                 case "$yyy" in
7113                 123.456)
7114                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7115                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7116                         echo "We will use %llf."
7117                         ;;
7118                 esac
7119         fi
7120 fi
7121
7122 if $test X"$sPRIfldbl" = X; then
7123         $cat >try.c <<'EOCP'
7124 #include <sys/types.h>
7125 #include <stdio.h>
7126 int main() {
7127   long double d = 123.456;
7128   printf("%.3Lf\n", d);
7129 }
7130 EOCP
7131         set try
7132         if eval $compile; then
7133                 yyy=`./try$exe_ext`
7134                 case "$yyy" in
7135                 123.456)
7136                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7137                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7138                         echo "We will use %Lf."
7139                         ;;
7140                 esac
7141         fi
7142 fi
7143
7144 if $test X"$sPRIfldbl" = X; then
7145         $cat >try.c <<'EOCP'
7146 #include <sys/types.h>
7147 #include <stdio.h>
7148 int main() {
7149   long double d = 123.456;
7150   printf("%.3lf\n", d);
7151 }
7152 EOCP
7153         set try
7154         if eval $compile; then
7155                 yyy=`./try$exe_ext`
7156                 case "$yyy" in
7157                 123.456)
7158                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7159                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7160                         echo "We will use %lf."
7161                         ;;
7162                 esac
7163         fi
7164 fi
7165
7166 if $test X"$sPRIfldbl" = X; then
7167         echo "Cannot figure out how to print long doubles." >&4
7168 fi
7169
7170 $rm -f try try.*
7171
7172 fi # d_longdbl
7173
7174 case "$sPRIfldbl" in
7175 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7176         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7177         ;;
7178 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7179         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7180         ;;
7181 esac
7182
7183 : Initialize h_fcntl
7184 h_fcntl=false
7185
7186 : Initialize h_sysfile
7187 h_sysfile=false
7188
7189 : access call always available on UNIX
7190 set access d_access
7191 eval $inlibc
7192
7193 : locate the flags for 'access()'
7194 case "$d_access" in
7195 "$define")
7196         echo " "
7197         $cat >access.c <<'EOCP'
7198 #include <sys/types.h>
7199 #ifdef I_FCNTL
7200 #include <fcntl.h>
7201 #endif
7202 #ifdef I_SYS_FILE
7203 #include <sys/file.h>
7204 #endif
7205 #ifdef I_UNISTD
7206 #include <unistd.h>
7207 #endif
7208 int main() {
7209         exit(R_OK);
7210 }
7211 EOCP
7212         : check sys/file.h first, no particular reason here
7213         if $test `./findhdr sys/file.h` && \
7214                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7215                 h_sysfile=true;
7216                 echo "<sys/file.h> defines the *_OK access constants." >&4
7217         elif $test `./findhdr fcntl.h` && \
7218                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7219                 h_fcntl=true;
7220                 echo "<fcntl.h> defines the *_OK access constants." >&4
7221         elif $test `./findhdr unistd.h` && \
7222                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7223                 echo "<unistd.h> defines the *_OK access constants." >&4
7224         else
7225                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7226         fi
7227         ;;
7228 esac
7229 $rm -f access*
7230
7231 : see if accessx exists
7232 set accessx d_accessx
7233 eval $inlibc
7234
7235 : see if alarm exists
7236 set alarm d_alarm
7237 eval $inlibc
7238
7239 : see if atolf exists
7240 set atolf d_atolf
7241 eval $inlibc
7242
7243 : see if atoll exists
7244 set atoll d_atoll
7245 eval $inlibc
7246
7247 : Look for GNU-cc style attribute checking
7248 echo " "
7249 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7250 $cat >attrib.c <<'EOCP'
7251 #include <stdio.h>
7252 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7253 EOCP
7254 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7255         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7256                 echo "Your C compiler doesn't fully support __attribute__."
7257                 val="$undef"
7258         else
7259                 echo "Your C compiler supports __attribute__."
7260                 val="$define"
7261         fi
7262 else
7263         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7264         val="$undef"
7265 fi
7266 set d_attribut
7267 eval $setvar
7268 $rm -f attrib*
7269
7270 : see if bcmp exists
7271 set bcmp d_bcmp
7272 eval $inlibc
7273
7274 : see if bcopy exists
7275 set bcopy d_bcopy
7276 eval $inlibc
7277
7278 : see if this is a unistd.h system
7279 set unistd.h i_unistd
7280 eval $inhdr
7281
7282 : see if getpgrp exists
7283 set getpgrp d_getpgrp
7284 eval $inlibc
7285
7286 case "$d_getpgrp" in
7287 "$define")
7288         echo " "
7289         echo "Checking to see which flavor of getpgrp is in use..."
7290         $cat >set.c <<EOP
7291 #$i_unistd I_UNISTD
7292 #include <sys/types.h>
7293 #ifdef I_UNISTD
7294 #  include <unistd.h>
7295 #endif
7296 int main()
7297 {
7298         if (getuid() == 0) {
7299                 printf("(I see you are running Configure as super-user...)\n");
7300                 setuid(1);
7301         }
7302 #ifdef TRY_BSD_PGRP
7303         if (getpgrp(1) == 0)
7304                 exit(0);
7305 #else
7306         if (getpgrp() > 0)
7307                 exit(0);
7308 #endif
7309         exit(1);
7310 }
7311 EOP
7312         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7313                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7314                 val="$define"
7315         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7316                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7317                 val="$undef"
7318         else
7319                 echo "I can't seem to compile and run the test program."
7320                 if ./usg; then
7321                         xxx="a USG one, i.e. you use getpgrp()."
7322                 else
7323                         # SVR4 systems can appear rather BSD-ish.
7324                         case "$i_unistd" in
7325                         $undef)
7326                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7327                                 val="$define"
7328                                 ;;
7329                         $define)
7330                                 xxx="probably a USG one, i.e. you use getpgrp()."
7331                                 val="$undef"
7332                                 ;;
7333                         esac
7334                 fi
7335                 echo "Assuming your getpgrp is $xxx" >&4
7336         fi
7337         ;;
7338 *) val="$undef";;
7339 esac
7340 set d_bsdgetpgrp
7341 eval $setvar
7342 $rm -f set set.c
7343
7344 : see if setpgrp exists
7345 set setpgrp d_setpgrp
7346 eval $inlibc
7347
7348 case "$d_setpgrp" in
7349 "$define")
7350         echo " "
7351         echo "Checking to see which flavor of setpgrp is in use..."
7352         $cat >set.c <<EOP
7353 #$i_unistd I_UNISTD
7354 #include <sys/types.h>
7355 #ifdef I_UNISTD
7356 #  include <unistd.h>
7357 #endif
7358 int main()
7359 {
7360         if (getuid() == 0) {
7361                 printf("(I see you are running Configure as super-user...)\n");
7362                 setuid(1);
7363         }
7364 #ifdef TRY_BSD_PGRP
7365         if (-1 == setpgrp(1, 1))
7366                 exit(0);
7367 #else
7368         if (setpgrp() != -1)
7369                 exit(0);
7370 #endif
7371         exit(1);
7372 }
7373 EOP
7374         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7375                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7376                 val="$define"
7377         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7378                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7379                 val="$undef"
7380         else
7381                 echo "(I can't seem to compile and run the test program.)"
7382                 if ./usg; then
7383                         xxx="a USG one, i.e. you use setpgrp()."
7384                 else
7385                         # SVR4 systems can appear rather BSD-ish.
7386                         case "$i_unistd" in
7387                         $undef)
7388                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7389                                 val="$define"
7390                                 ;;
7391                         $define)
7392                                 xxx="probably a USG one, i.e. you use setpgrp()."
7393                                 val="$undef"
7394                                 ;;
7395                         esac
7396                 fi
7397                 echo "Assuming your setpgrp is $xxx" >&4
7398         fi
7399         ;;
7400 *) val="$undef";;
7401 esac
7402 set d_bsdsetpgrp
7403 eval $setvar
7404 $rm -f set set.c
7405 : see if bzero exists
7406 set bzero d_bzero
7407 eval $inlibc
7408
7409 : see if signal is declared as pointer to function returning int or void
7410 echo " "
7411 xxx=`./findhdr signal.h`
7412 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7413 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7414         echo "You have int (*signal())() instead of void." >&4
7415         val="$undef"
7416 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7417         echo "You have void (*signal())()." >&4
7418         val="$define"
7419 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7420         echo "You have int (*signal())() instead of void." >&4
7421         val="$undef"
7422 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7423         echo "You have void (*signal())()." >&4
7424         val="$define"
7425 else
7426         case "$d_voidsig" in
7427         '')
7428         echo "I can't determine whether signal handler returns void or int..." >&4
7429                 dflt=void
7430                 rp="What type does your signal handler return?"
7431                 . ./myread
7432                 case "$ans" in
7433                 v*) val="$define";;
7434                 *) val="$undef";;
7435                 esac;;
7436         "$define")
7437                 echo "As you already told me, signal handler returns void." >&4
7438                 val="$define"
7439                 ;;
7440         *)      echo "As you already told me, signal handler returns int." >&4
7441                 val="$undef"
7442                 ;;
7443         esac
7444 fi
7445 set d_voidsig
7446 eval $setvar
7447 case "$d_voidsig" in
7448 "$define") signal_t="void";;
7449 *) signal_t="int";;
7450 esac
7451 $rm -f $$.tmp
7452
7453 : check for ability to cast large floats to 32-bit ints.
7454 echo " "
7455 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7456 if $test "$intsize" -ge 4; then
7457         xxx=int
7458 else
7459         xxx=long
7460 fi
7461 $cat >try.c <<EOCP
7462 #include <stdio.h>
7463 #include <sys/types.h>
7464 #include <signal.h>
7465 $signal_t blech(s) int s; { exit(3); }
7466 int main()
7467 {
7468         $xxx i32;
7469         double f, g;
7470         int result = 0;
7471         char str[16];
7472         signal(SIGFPE, blech);
7473
7474         /* Don't let compiler optimize the test away.  Store the number 
7475            in a writable string for gcc to pass to sscanf under HP/UX.
7476         */
7477         sprintf(str, "2147483647");
7478         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7479         g = 10 * f;
7480         i32  = ($xxx) g;
7481
7482         /* x86 processors will probably give 0x8000 0000, which is a
7483        sign change.  We don't want that.  We want to mimic SPARC
7484            behavior here, which is to preserve the sign and give
7485            back 0x7fff ffff.
7486         */
7487         if (i32 != ($xxx) f)
7488                 result |= 1;
7489         exit(result);
7490 }
7491 EOCP
7492 set try
7493 if eval $compile_ok; then
7494         ./try
7495         yyy=$?
7496 else
7497         echo "(I can't seem to compile the test program--assuming it can't)"
7498         yyy=1
7499 fi
7500 case "$yyy" in
7501 0)      val="$define"
7502         echo "Yup, it can."
7503         ;;
7504 *)      val="$undef"
7505         echo "Nope, it can't."
7506         ;;
7507 esac
7508 set d_casti32
7509 eval $setvar
7510 $rm -f try try.*
7511
7512 : check for ability to cast negative floats to unsigned
7513 echo " "
7514 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7515 $cat >try.c <<EOCP
7516 #include <stdio.h>
7517 #include <sys/types.h>
7518 #include <signal.h>
7519 $signal_t blech(s) int s; { exit(7); }
7520 $signal_t blech_in_list(s) int s; { exit(4); }
7521 unsigned long dummy_long(p) unsigned long p; { return p; }
7522 unsigned int dummy_int(p) unsigned int p; { return p; }
7523 unsigned short dummy_short(p) unsigned short p; { return p; }
7524 int main()
7525 {
7526         double f;
7527         unsigned long along;
7528         unsigned int aint;
7529         unsigned short ashort;
7530         int result = 0;
7531         char str[16];
7532         
7533         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7534            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7535            optimized the whole file away
7536         */
7537         /* Store the number in a writable string for gcc to pass to 
7538            sscanf under HP/UX.
7539         */
7540         sprintf(str, "-123");
7541         sscanf(str, "%lf", &f);  /* f = -123.; */
7542
7543         signal(SIGFPE, blech);
7544         along = (unsigned long)f;
7545         aint = (unsigned int)f;
7546         ashort = (unsigned short)f;
7547         if (along != (unsigned long)-123)
7548                 result |= 1;
7549         if (aint != (unsigned int)-123)
7550                 result |= 1;
7551         if (ashort != (unsigned short)-123)
7552                 result |= 1;
7553         sprintf(str, "1073741824.");
7554         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7555         f = f + f;
7556         along = 0;
7557         along = (unsigned long)f;
7558         if (along != 0x80000000)
7559                 result |= 2;
7560         f -= 1.;
7561         along = 0;
7562         along = (unsigned long)f;
7563         if (along != 0x7fffffff)
7564                 result |= 1;
7565         f += 2.;
7566         along = 0;
7567         along = (unsigned long)f;
7568         if (along != 0x80000001)
7569                 result |= 2;
7570         if (result)
7571                 exit(result);
7572         signal(SIGFPE, blech_in_list);
7573         sprintf(str, "123.");
7574         sscanf(str, "%lf", &f);  /* f = 123.; */
7575         along = dummy_long((unsigned long)f);
7576         aint = dummy_int((unsigned int)f);
7577         ashort = dummy_short((unsigned short)f);
7578         if (along != (unsigned long)123)
7579                 result |= 4;
7580         if (aint != (unsigned int)123)
7581                 result |= 4;
7582         if (ashort != (unsigned short)123)
7583                 result |= 4;
7584         exit(result);
7585
7586 }
7587 EOCP
7588 set try
7589 if eval $compile_ok; then
7590         ./try
7591         castflags=$?
7592 else
7593         echo "(I can't seem to compile the test program--assuming it can't)"
7594         castflags=7
7595 fi
7596 case "$castflags" in
7597 0)      val="$define"
7598         echo "Yup, it can."
7599         ;;
7600 *)      val="$undef"
7601         echo "Nope, it can't."
7602         ;;
7603 esac
7604 set d_castneg
7605 eval $setvar
7606 $rm -f try.*
7607
7608 : see if vprintf exists
7609 echo " "
7610 if set vprintf val -f d_vprintf; eval $csym; $val; then
7611         echo 'vprintf() found.' >&4
7612         val="$define"
7613         $cat >vprintf.c <<'EOF'
7614 #include <varargs.h>
7615
7616 int main() { xxx("foo"); }
7617
7618 xxx(va_alist)
7619 va_dcl
7620 {
7621         va_list args;
7622         char buf[10];
7623
7624         va_start(args);
7625         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7626 }
7627 EOF
7628         set vprintf
7629         if eval $compile && ./vprintf; then
7630                 echo "Your vsprintf() returns (int)." >&4
7631                 val2="$undef"
7632         else
7633                 echo "Your vsprintf() returns (char*)." >&4
7634                 val2="$define"
7635         fi
7636 else
7637         echo 'vprintf() NOT found.' >&4
7638                 val="$undef"
7639                 val2="$undef"
7640 fi
7641 set d_vprintf
7642 eval $setvar
7643 val=$val2
7644 set d_charvspr
7645 eval $setvar
7646
7647 : see if chown exists
7648 set chown d_chown
7649 eval $inlibc
7650
7651 : see if chroot exists
7652 set chroot d_chroot
7653 eval $inlibc
7654
7655 : see if chsize exists
7656 set chsize d_chsize
7657 eval $inlibc
7658
7659 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7660 while $test $# -ge 2; do
7661         case "$1" in
7662         $define) echo "#include <$2>";;
7663         esac ;
7664     shift 2;
7665 done > try.c;
7666 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7667 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7668         val="$define";
7669 else
7670         val="$undef";
7671 fi;
7672 set $varname;
7673 eval $setvar;
7674 $rm -f try.c try.o'
7675
7676 : see if this is a sys/uio.h system
7677 set sys/uio.h i_sysuio
7678 eval $inhdr
7679
7680 echo "Checking to see if your system supports struct iovec..." >&4
7681 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7682 eval $hasfield
7683 case "$d_iovec_s" in
7684 "$define")      echo "Yup, it does." >&4
7685                 ;;
7686 *)              echo "Nope, it doesn't." >&4
7687                 ;;
7688 esac
7689
7690 socketlib=''
7691 sockethdr=''
7692 : see whether socket exists
7693 echo " "
7694 $echo $n "Hmm... $c" >&4
7695 if set socket val -f d_socket; eval $csym; $val; then
7696         echo "Looks like you have Berkeley networking support." >&4
7697         d_socket="$define"
7698         if set setsockopt val -f; eval $csym; $val; then
7699                 d_oldsock="$undef"
7700         else
7701                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7702                 d_oldsock="$define"
7703         fi
7704 else
7705         if $contains socklib libc.list >/dev/null 2>&1; then
7706                 echo "Looks like you have Berkeley networking support." >&4
7707                 d_socket="$define"
7708                 : we will have to assume that it supports the 4.2 BSD interface
7709                 d_oldsock="$undef"
7710         else
7711                 echo "You don't have Berkeley networking in libc$_a..." >&4
7712                 if test "X$d_socket" = "X$define"; then
7713                    echo "...but you seem to believe that you have sockets." >&4
7714                 else
7715                         for net in net socket
7716                         do
7717                                 if test -f /usr/lib/lib$net$_a; then
7718                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7719                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7720                                         if $contains socket libc.list >/dev/null 2>&1; then
7721                                                 d_socket="$define"
7722                                                 socketlib="-l$net"
7723                                                 case "$net" in
7724                                                 net)
7725                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7726                                                         sockethdr="-I/usr/netinclude"
7727                                                         ;;
7728                                                 esac
7729                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7730                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7731                                                         d_oldsock="$undef"
7732                                                 else
7733                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7734                                                         d_oldsock="$define"
7735                                                 fi
7736                                                 break
7737                                         fi
7738                                 fi
7739                         done
7740                         if test "X$d_socket" != "X$define"; then
7741                            echo "or anywhere else I see." >&4
7742                            d_socket="$undef"
7743                            d_oldsock="$undef"
7744                         fi
7745                 fi
7746         fi
7747 fi
7748
7749 : see if socketpair exists
7750 set socketpair d_sockpair
7751 eval $inlibc
7752
7753
7754 echo " "
7755 echo "Checking the availability of certain socket constants..." >& 4
7756 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7757         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7758         $cat >try.c <<EOF
7759 #include <sys/types.h>
7760 #include <sys/socket.h>
7761 int main() {
7762     int i = $ENUM;
7763 }
7764 EOF
7765         val="$undef"
7766         set try; if eval $compile; then
7767                 val="$define"
7768         fi
7769         set d_${enum}; eval $setvar
7770         $rm -f try.c try
7771 done
7772
7773 set sendmsg d_sendmsg
7774 eval $inlibc
7775
7776 set recvmsg d_recvmsg
7777 eval $inlibc
7778
7779 echo " "
7780 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7781 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7782 eval $hasfield
7783 case "$d_msghdr_s" in
7784 "$define")      echo "Yup, it does." >&4
7785                 ;;
7786 *)              echo "Nope, it doesn't." >&4
7787                 ;;
7788 esac
7789
7790 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7791 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7792 eval $hasfield
7793 case "$d_cmsghdr_s" in
7794 "$define")      echo "Yup, it does." >&4
7795                 ;;
7796 *)              echo "Nope, it doesn't." >&4
7797                 ;;
7798 esac
7799
7800 : check for const keyword
7801 echo " "
7802 echo 'Checking to see if your C compiler knows about "const"...' >&4
7803 $cat >const.c <<'EOCP'
7804 typedef struct spug { int drokk; } spug;
7805 int main()
7806 {
7807         const char *foo;
7808         const spug y;
7809 }
7810 EOCP
7811 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7812         val="$define"
7813         echo "Yup, it does."
7814 else
7815         val="$undef"
7816         echo "Nope, it doesn't."
7817 fi
7818 set d_const
7819 eval $setvar
7820
7821 : see if crypt exists
7822 echo " "
7823 if set crypt val -f d_crypt; eval $csym; $val; then
7824         echo 'crypt() found.' >&4
7825         val="$define"
7826         cryptlib=''
7827 else
7828         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7829         if $test -z "$cryptlib"; then
7830                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7831         else
7832                 cryptlib=-lcrypt
7833         fi
7834         if $test -z "$cryptlib"; then
7835                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7836         else
7837                 cryptlib=-lcrypt
7838         fi
7839         if $test -z "$cryptlib"; then
7840                 cryptlib=`./loc libcrypt$_a "" $libpth`
7841         else
7842                 cryptlib=-lcrypt
7843         fi
7844         if $test -z "$cryptlib"; then
7845                 echo 'crypt() NOT found.' >&4
7846                 val="$undef"
7847         else
7848                 val="$define"
7849         fi
7850 fi
7851 set d_crypt
7852 eval $setvar
7853
7854 : get csh whereabouts
7855 case "$csh" in
7856 'csh') val="$undef" ;;
7857 *) val="$define" ;;
7858 esac
7859 set d_csh
7860 eval $setvar
7861 : Respect a hint or command line value for full_csh.
7862 case "$full_csh" in
7863 '') full_csh=$csh ;;
7864 esac
7865
7866 : see if cuserid exists
7867 set cuserid d_cuserid
7868 eval $inlibc
7869
7870 : see if this is a limits.h system
7871 set limits.h i_limits
7872 eval $inhdr
7873
7874 : see if this is a float.h system
7875 set float.h i_float
7876 eval $inhdr
7877
7878 : See if number of significant digits in a double precision number is known
7879 echo " "
7880 $cat >dbl_dig.c <<EOM
7881 #$i_limits I_LIMITS
7882 #$i_float I_FLOAT
7883 #ifdef I_LIMITS
7884 #include <limits.h>
7885 #endif
7886 #ifdef I_FLOAT
7887 #include <float.h>
7888 #endif
7889 #ifdef DBL_DIG
7890 printf("Contains DBL_DIG");
7891 #endif
7892 EOM
7893 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7894 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7895         echo "DBL_DIG found." >&4
7896         val="$define"
7897 else
7898         echo "DBL_DIG NOT found." >&4
7899         val="$undef"
7900 fi
7901 $rm -f dbl_dig.?
7902 set d_dbl_dig
7903 eval $setvar
7904
7905 : see if difftime exists
7906 set difftime d_difftime
7907 eval $inlibc
7908
7909 : see if this is a dirent system
7910 echo " "
7911 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7912         val="$define"
7913         echo "<dirent.h> found." >&4
7914 else
7915         val="$undef"
7916         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7917                 echo "<sys/dir.h> found." >&4
7918                 echo " "
7919         else
7920                 xinc=`./findhdr sys/ndir.h`
7921         fi
7922         echo "<dirent.h> NOT found." >&4
7923 fi
7924 set i_dirent
7925 eval $setvar
7926
7927 : Look for type of directory structure.
7928 echo " "
7929 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7930
7931 case "$direntrytype" in
7932 ''|' ')
7933         case "$i_dirent" in
7934         $define) guess1='struct dirent' ;;
7935         *) guess1='struct direct'  ;;
7936         esac
7937         ;;
7938 *)      guess1="$direntrytype"
7939         ;;
7940 esac
7941
7942 case "$guess1" in
7943 'struct dirent') guess2='struct direct' ;;
7944 *) guess2='struct dirent' ;;
7945 esac
7946                 
7947 if $contains "$guess1" try.c >/dev/null 2>&1; then
7948         direntrytype="$guess1"
7949         echo "Your directory entries are $direntrytype." >&4
7950 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7951         direntrytype="$guess2"
7952         echo "Your directory entries seem to be $direntrytype." >&4
7953 else
7954         echo "I don't recognize your system's directory entries." >&4
7955         rp="What type is used for directory entries on this system?"
7956         dflt="$guess1"
7957         . ./myread
7958         direntrytype="$ans"
7959 fi
7960 $rm -f try.c
7961
7962
7963 : see if the directory entry stores field length
7964 echo " "
7965 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7966 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7967         echo "Good, your directory entry keeps length information in d_namlen." >&4
7968         val="$define"
7969 else
7970         echo "Your directory entry does not know about the d_namlen field." >&4
7971         val="$undef"
7972 fi
7973 set d_dirnamlen
7974 eval $setvar
7975 $rm -f try.c
7976
7977 : see if dlerror exists
7978 xxx_runnm="$runnm"
7979 runnm=false
7980 set dlerror d_dlerror
7981 eval $inlibc
7982 runnm="$xxx_runnm"
7983
7984 : see if dlfcn is available
7985 set dlfcn.h i_dlfcn
7986 eval $inhdr
7987
7988 case "$usedl" in
7989 $define|y|true)
7990         $cat << EOM
7991
7992 On a few systems, the dynamically loaded modules that perl generates and uses
7993 will need a different extension than shared libs. The default will probably
7994 be appropriate.
7995
7996 EOM
7997         case "$dlext" in
7998         '')     dflt="$so" ;;
7999         *)      dflt="$dlext" ;;
8000         esac
8001         rp='What is the extension of dynamically loaded modules'
8002         . ./myread
8003         dlext="$ans"
8004         ;;
8005 *)
8006         dlext="none"
8007         ;;
8008 esac
8009
8010 : Check if dlsym need a leading underscore
8011 echo " "
8012 val="$undef"
8013
8014 case "$dlsrc" in
8015 dl_dlopen.xs)
8016         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8017         $cat >dyna.c <<'EOM'
8018 fred () { }
8019 EOM
8020
8021 $cat >fred.c<<EOM
8022
8023 #include <stdio.h>
8024 #$i_dlfcn I_DLFCN
8025 #ifdef I_DLFCN
8026 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8027 #else
8028 #include <sys/types.h>
8029 #include <nlist.h>
8030 #include <link.h>
8031 #endif
8032
8033 extern int fred() ;
8034
8035 int main()
8036 {
8037     void * handle ;
8038     void * symbol ;
8039 #ifndef RTLD_LAZY
8040     int mode = 1 ;
8041 #else
8042     int mode = RTLD_LAZY ;
8043 #endif
8044     handle = dlopen("./dyna.$dlext", mode) ;
8045     if (handle == NULL) {
8046         printf ("1\n") ;
8047         fflush (stdout) ;
8048         exit(0);
8049     }
8050     symbol = dlsym(handle, "fred") ;
8051     if (symbol == NULL) {
8052         /* try putting a leading underscore */
8053         symbol = dlsym(handle, "_fred") ;
8054         if (symbol == NULL) {
8055             printf ("2\n") ;
8056             fflush (stdout) ;
8057             exit(0);
8058         }
8059         printf ("3\n") ;
8060     }
8061     else
8062         printf ("4\n") ;
8063     fflush (stdout) ;
8064     exit(0);
8065 }
8066 EOM
8067         : Call the object file tmp-dyna.o in case dlext=o.
8068         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8069                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8070                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8071                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8072                 xxx=`./fred`
8073                 case $xxx in
8074                 1)      echo "Test program failed using dlopen." >&4
8075                         echo "Perhaps you should not use dynamic loading." >&4;;
8076                 2)      echo "Test program failed using dlsym." >&4
8077                         echo "Perhaps you should not use dynamic loading." >&4;;
8078                 3)      echo "dlsym needs a leading underscore" >&4
8079                         val="$define" ;;
8080                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8081                 esac
8082         else
8083                 echo "I can't compile and run the test program." >&4
8084                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8085         fi
8086         ;;
8087 esac
8088                 
8089 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8090
8091 set d_dlsymun
8092 eval $setvar
8093
8094 hasproto='varname=$1; func=$2; shift; shift;
8095 while $test $# -ge 2; do
8096         case "$1" in
8097         $define) echo "#include <$2>";;
8098         esac ;
8099     shift 2;
8100 done > try.c;
8101 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8102 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8103         echo "$func() prototype found.";
8104         val="$define";
8105 else
8106         echo "$func() prototype NOT found.";
8107         val="$undef";
8108 fi;
8109 set $varname;
8110 eval $setvar;
8111 $rm -f try.c tryout.c'
8112
8113 : see if prototype for drand48 is available
8114 echo " "
8115 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8116 eval $hasproto
8117
8118 : see if dup2 exists
8119 set dup2 d_dup2
8120 eval $inlibc
8121
8122 : see if eaccess exists
8123 set eaccess d_eaccess
8124 eval $inlibc
8125
8126 : see if endgrent exists
8127 set endgrent d_endgrent
8128 eval $inlibc
8129
8130 : see if endhostent exists
8131 set endhostent d_endhent
8132 eval $inlibc
8133
8134 : see if endnetent exists
8135 set endnetent d_endnent
8136 eval $inlibc
8137
8138 : see if endprotoent exists
8139 set endprotoent d_endpent
8140 eval $inlibc
8141
8142 : see if endpwent exists
8143 set endpwent d_endpwent
8144 eval $inlibc
8145
8146 : see if endservent exists
8147 set endservent d_endsent
8148 eval $inlibc
8149
8150 : see if endspent exists
8151 set endspent d_endspent
8152 eval $inlibc
8153
8154 : Locate the flags for 'open()'
8155 echo " "
8156 $cat >open3.c <<'EOCP'
8157 #include <sys/types.h>
8158 #ifdef I_FCNTL
8159 #include <fcntl.h>
8160 #endif
8161 #ifdef I_SYS_FILE
8162 #include <sys/file.h>
8163 #endif
8164 int main() {
8165         if(O_RDONLY);
8166 #ifdef O_TRUNC
8167         exit(0);
8168 #else
8169         exit(1);
8170 #endif
8171 }
8172 EOCP
8173 : check sys/file.h first to get FREAD on Sun
8174 if $test `./findhdr sys/file.h` && \
8175                 set open3 -DI_SYS_FILE && eval $compile; then
8176         h_sysfile=true;
8177         echo "<sys/file.h> defines the O_* constants..." >&4
8178         if ./open3; then
8179                 echo "and you have the 3 argument form of open()." >&4
8180                 val="$define"
8181         else
8182                 echo "but not the 3 argument form of open().  Oh, well." >&4
8183                 val="$undef"
8184         fi
8185 elif $test `./findhdr fcntl.h` && \
8186                 set open3 -DI_FCNTL && eval $compile; then
8187         h_fcntl=true;
8188         echo "<fcntl.h> defines the O_* constants..." >&4
8189         if ./open3; then
8190                 echo "and you have the 3 argument form of open()." >&4
8191                 val="$define"
8192         else
8193                 echo "but not the 3 argument form of open().  Oh, well." >&4
8194                 val="$undef"
8195         fi
8196 else
8197         val="$undef"
8198         echo "I can't find the O_* constant definitions!  You got problems." >&4
8199 fi
8200 set d_open3
8201 eval $setvar
8202 $rm -f open3*
8203
8204 : check for non-blocking I/O stuff
8205 case "$h_sysfile" in
8206 true) echo "#include <sys/file.h>" > head.c;;
8207 *)
8208         case "$h_fcntl" in
8209         true) echo "#include <fcntl.h>" > head.c;;
8210         *) echo "#include <sys/fcntl.h>" > head.c;;
8211         esac
8212         ;;
8213 esac
8214 echo " "
8215 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8216 case "$o_nonblock" in
8217 '')
8218         $cat head.c > try.c
8219         $cat >>try.c <<'EOCP'
8220 int main() {
8221 #ifdef O_NONBLOCK
8222         printf("O_NONBLOCK\n");
8223         exit(0);
8224 #endif
8225 #ifdef O_NDELAY
8226         printf("O_NDELAY\n");
8227         exit(0);
8228 #endif
8229 #ifdef FNDELAY
8230         printf("FNDELAY\n");
8231         exit(0);
8232 #endif
8233         exit(0);
8234 }
8235 EOCP
8236         set try
8237         if eval $compile_ok; then
8238                 o_nonblock=`./try`
8239                 case "$o_nonblock" in
8240                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8241                 *) echo "Seems like we can use $o_nonblock.";;
8242                 esac
8243         else
8244                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8245         fi
8246         ;;
8247 *) echo "Using $hint value $o_nonblock.";;
8248 esac
8249 $rm -f try try.* .out core
8250
8251 echo " "
8252 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8253 case "$eagain" in
8254 '')
8255         $cat head.c > try.c
8256         $cat >>try.c <<EOCP
8257 #include <errno.h>
8258 #include <sys/types.h>
8259 #include <signal.h>
8260 #define MY_O_NONBLOCK $o_nonblock
8261 #ifndef errno  /* XXX need better Configure test */
8262 extern int errno;
8263 #endif
8264 $signal_t blech(x) int x; { exit(3); }
8265 EOCP
8266         $cat >> try.c <<'EOCP'
8267 int main()
8268 {
8269         int pd[2];
8270         int pu[2];
8271         char buf[1];
8272         char string[100];
8273
8274         pipe(pd);       /* Down: child -> parent */
8275         pipe(pu);       /* Up: parent -> child */
8276         if (0 != fork()) {
8277                 int ret;
8278                 close(pd[1]);   /* Parent reads from pd[0] */
8279                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8280                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8281                         exit(1);
8282                 signal(SIGALRM, blech);
8283                 alarm(5);
8284                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8285                         exit(2);
8286                 sprintf(string, "%d\n", ret);
8287                 write(2, string, strlen(string));
8288                 alarm(0);
8289 #ifdef EAGAIN
8290                 if (errno == EAGAIN) {
8291                         printf("EAGAIN\n");
8292                         goto ok;
8293                 }
8294 #endif
8295 #ifdef EWOULDBLOCK
8296                 if (errno == EWOULDBLOCK)
8297                         printf("EWOULDBLOCK\n");
8298 #endif
8299         ok:
8300                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8301                 sleep(2);                               /* Give it time to close our pipe */
8302                 alarm(5);
8303                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8304                 alarm(0);
8305                 sprintf(string, "%d\n", ret);
8306                 write(3, string, strlen(string));
8307                 exit(0);
8308         }
8309
8310         close(pd[0]);                   /* We write to pd[1] */
8311         close(pu[1]);                   /* We read from pu[0] */
8312         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8313         close(pd[1]);                   /* Pipe pd is now fully closed! */
8314         exit(0);                                /* Bye bye, thank you for playing! */
8315 }
8316 EOCP
8317         set try
8318         if eval $compile_ok; then
8319                 echo "$startsh" >mtry
8320                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8321                 chmod +x mtry
8322                 ./mtry >/dev/null 2>&1
8323                 case $? in
8324                 0) eagain=`$cat try.out`;;
8325                 1) echo "Could not perform non-blocking setting!";;
8326                 2) echo "I did a successful read() for something that was not there!";;
8327                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8328                 *) echo "Something terribly wrong happened during testing.";;
8329                 esac
8330                 rd_nodata=`$cat try.ret`
8331                 echo "A read() system call with no data present returns $rd_nodata."
8332                 case "$rd_nodata" in
8333                 0|-1) ;;
8334                 *)
8335                         echo "(That's peculiar, fixing that to be -1.)"
8336                         rd_nodata=-1
8337                         ;;
8338                 esac
8339                 case "$eagain" in
8340                 '')
8341                         echo "Forcing errno EAGAIN on read() with no data available."
8342                         eagain=EAGAIN
8343                         ;;
8344                 *)
8345                         echo "Your read() sets errno to $eagain when no data is available."
8346                         ;;
8347                 esac
8348                 status=`$cat try.err`
8349                 case "$status" in
8350                 0) echo "And it correctly returns 0 to signal EOF.";;
8351                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8352                 *) echo "However, your read() returns '$status' on EOF??";;
8353                 esac
8354                 val="$define"
8355                 if test "$status" = "$rd_nodata"; then
8356                         echo "WARNING: you can't distinguish between EOF and no data!"
8357                         val="$undef"
8358                 fi
8359         else
8360                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8361                 eagain=EAGAIN
8362         fi
8363         set d_eofnblk
8364         eval $setvar
8365         ;;
8366 *)
8367         echo "Using $hint value $eagain."
8368         echo "Your read() returns $rd_nodata when no data is present."
8369         case "$d_eofnblk" in
8370         "$define") echo "And you can see EOF because read() returns 0.";;
8371         "$undef") echo "But you can't see EOF status from read() returned value.";;
8372         *)
8373                 echo "(Assuming you can't see EOF status from read anyway.)"
8374                 d_eofnblk=$undef
8375                 ;;
8376         esac
8377         ;;
8378 esac
8379 $rm -f try try.* .out core head.c mtry
8380
8381 : see if fchmod exists
8382 set fchmod d_fchmod
8383 eval $inlibc
8384
8385 : see if fchown exists
8386 set fchown d_fchown
8387 eval $inlibc
8388
8389 : see if this is an fcntl system
8390 set fcntl d_fcntl
8391 eval $inlibc
8392
8393 : see if sys/select.h has to be included
8394 set sys/select.h i_sysselct
8395 eval $inhdr
8396
8397 : see if we should include time.h, sys/time.h, or both
8398 echo " "
8399 if test "X$timeincl" = X; then
8400         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8401         $echo $n "I'm now running the test program...$c"
8402         $cat >try.c <<'EOCP'
8403 #include <sys/types.h>
8404 #ifdef I_TIME
8405 #include <time.h>
8406 #endif
8407 #ifdef I_SYSTIME
8408 #ifdef SYSTIMEKERNEL
8409 #define KERNEL
8410 #endif
8411 #include <sys/time.h>
8412 #endif
8413 #ifdef I_SYSSELECT
8414 #include <sys/select.h>
8415 #endif
8416 int main()
8417 {
8418         struct tm foo;
8419 #ifdef S_TIMEVAL
8420         struct timeval bar;
8421 #endif
8422 #ifdef S_TIMEZONE
8423         struct timezone tzp;
8424 #endif
8425         if (foo.tm_sec == foo.tm_sec)
8426                 exit(0);
8427 #ifdef S_TIMEVAL
8428         if (bar.tv_sec == bar.tv_sec)
8429                 exit(0);
8430 #endif
8431         exit(1);
8432 }
8433 EOCP
8434         flags=''
8435         for s_timezone in '-DS_TIMEZONE' ''; do
8436         sysselect=''
8437         for s_timeval in '-DS_TIMEVAL' ''; do
8438         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8439         for i_time in '' '-DI_TIME'; do
8440         for i_systime in '-DI_SYSTIME' ''; do
8441                 case "$flags" in
8442                 '') $echo $n ".$c"
8443                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8444                         if eval $compile; then
8445                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8446                                 shift
8447                                 flags="$*"
8448                                 echo " "
8449                                 $echo $n "Succeeded with $flags$c"
8450                         fi
8451                         ;;
8452                 esac
8453         done
8454         done
8455         done
8456         done
8457         done
8458         timeincl=''
8459         echo " "
8460         case "$flags" in
8461         *SYSTIMEKERNEL*) i_systimek="$define"
8462                 timeincl=`./findhdr sys/time.h`
8463                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8464         *) i_systimek="$undef";;
8465         esac
8466         case "$flags" in
8467         *I_TIME*) i_time="$define"
8468                 timeincl=`./findhdr time.h`" $timeincl"
8469                 echo "We'll include <time.h>." >&4;;
8470         *) i_time="$undef";;
8471         esac
8472         case "$flags" in
8473         *I_SYSTIME*) i_systime="$define"
8474                 timeincl=`./findhdr sys/time.h`" $timeincl"
8475                 echo "We'll include <sys/time.h>." >&4;;
8476         *) i_systime="$undef";;
8477         esac
8478         $rm -f try.c try
8479 fi
8480
8481 : check for fd_set items
8482 $cat <<EOM
8483
8484 Checking to see how well your C compiler handles fd_set and friends ...
8485 EOM
8486 $cat >fd_set.c <<EOCP
8487 #$i_systime I_SYS_TIME
8488 #$i_sysselct I_SYS_SELECT
8489 #$d_socket HAS_SOCKET
8490 #include <sys/types.h>
8491 #ifdef HAS_SOCKET
8492 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8493 #endif
8494 #ifdef I_SYS_TIME
8495 #include <sys/time.h>
8496 #endif
8497 #ifdef I_SYS_SELECT
8498 #include <sys/select.h>
8499 #endif
8500 int main() {
8501         fd_set fds;
8502
8503 #ifdef TRYBITS
8504         if(fds.fds_bits);
8505 #endif
8506
8507 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8508         exit(0);
8509 #else
8510         exit(1);
8511 #endif
8512 }
8513 EOCP
8514 set fd_set -DTRYBITS
8515 if eval $compile; then
8516         d_fds_bits="$define"
8517         d_fd_set="$define"
8518         echo "Well, your system knows about the normal fd_set typedef..." >&4
8519         if ./fd_set; then
8520                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8521                 d_fd_macros="$define"
8522         else
8523                 $cat >&4 <<'EOM'
8524 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8525 EOM
8526                 d_fd_macros="$undef"
8527         fi
8528 else
8529         $cat <<'EOM'
8530 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8531 EOM
8532         set fd_set
8533         if eval $compile; then
8534                 d_fds_bits="$undef"
8535                 d_fd_set="$define"
8536                 echo "Well, your system has some sort of fd_set available..." >&4
8537                 if ./fd_set; then
8538                         echo "and you have the normal fd_set macros." >&4
8539                         d_fd_macros="$define"
8540                 else
8541                         $cat <<'EOM'
8542 but not the normal fd_set macros!  Gross!  More work for me...
8543 EOM
8544                         d_fd_macros="$undef"
8545                 fi
8546         else
8547         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8548                 d_fd_set="$undef"
8549                 d_fds_bits="$undef"
8550                 d_fd_macros="$undef"
8551         fi
8552 fi
8553 $rm -f fd_set*
8554
8555 : see if fgetpos exists
8556 set fgetpos d_fgetpos
8557 eval $inlibc
8558
8559 : see if flock exists
8560 set flock d_flock
8561 eval $inlibc
8562
8563 : see if fork exists
8564 set fork d_fork
8565 eval $inlibc
8566
8567 : see if pathconf exists
8568 set pathconf d_pathconf
8569 eval $inlibc
8570
8571 : see if fpathconf exists
8572 set fpathconf d_fpathconf
8573 eval $inlibc
8574
8575
8576 : see if llseek exists
8577 set llseek d_llseek
8578 eval $inlibc
8579
8580 : check for off64_t
8581 echo " "
8582 echo $n "Checking to see if your system supports off64_t...$c" >&4
8583 $cat >try.c <<EOCP
8584 #include <sys/types.h>
8585 #include <unistd.h>
8586 off64_t foo() { off64_t x; x = 7; return x; }'
8587 EOCP
8588 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8589         val="$define"
8590         echo " Yup, it does." >&4
8591 else
8592         val="$undef"
8593         echo " Nope, it doesn't." >&4
8594 fi
8595 $rm -f try.*
8596 set d_off64_t
8597 eval $setvar
8598
8599 : check for fpos64_t
8600 echo " "
8601 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8602 $cat >try.c <<EOCP
8603 #include <sys/stdio.h>
8604 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8605 EOCP
8606 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8607         val="$define"
8608         echo " Yup, it does." >&4
8609 else
8610         val="$undef"
8611         echo " Nope, it doesn't." >&4
8612 fi
8613 $rm -f try.*
8614 set d_fpos64_t
8615 eval $setvar
8616
8617 : see if fseeko exists
8618 set fseeko d_fseeko
8619 eval $inlibc
8620
8621 : see if fsetpos exists
8622 set fsetpos d_fsetpos
8623 eval $inlibc
8624
8625 : see if this is a sys/param system
8626 set sys/param.h i_sysparam
8627 eval $inhdr
8628
8629 : see if this is a sys/mount.h system
8630 set sys/mount.h i_sysmount
8631 eval $inhdr
8632
8633
8634 : see if statfs exists
8635 set statfs d_statfs
8636 eval $inlibc
8637
8638 : see if fstatfs exists
8639 set fstatfs d_fstatfs
8640 eval $inlibc
8641
8642 : see if statfs knows about mount flags
8643 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8644 eval $hasfield
8645
8646
8647 : see if statvfs exists
8648 set statvfs d_statvfs
8649 eval $inlibc
8650
8651 : see if fstatvfs exists
8652 set fstatvfs d_fstatvfs
8653 eval $inlibc
8654
8655
8656 : see if ftello exists
8657 set ftello d_ftello
8658 eval $inlibc
8659
8660 : see if getgrent exists
8661 set getgrent d_getgrent
8662 eval $inlibc
8663
8664 : see if gethostbyaddr exists
8665 set gethostbyaddr d_gethbyaddr
8666 eval $inlibc
8667
8668 : see if gethostbyname exists
8669 set gethostbyname d_gethbyname
8670 eval $inlibc
8671
8672 : see if gethostent exists
8673 set gethostent d_gethent
8674 eval $inlibc
8675
8676 : see how we will look up host name
8677 echo " "
8678 call=''
8679 if set gethostname val -f d_gethname; eval $csym; $val; then
8680         echo 'gethostname() found.' >&4
8681         d_gethname="$define"
8682         call=gethostname
8683 fi
8684 if set uname val -f d_uname; eval $csym; $val; then
8685         if ./xenix; then
8686                 $cat <<'EOM'
8687 uname() was found, but you're running xenix, and older versions of xenix
8688 have a broken uname(). If you don't really know whether your xenix is old
8689 enough to have a broken system call, use the default answer.
8690
8691 EOM
8692                 dflt=y
8693                 case "$d_uname" in
8694                 "$define") dflt=n;;
8695                 esac
8696                 rp='Is your uname() broken?'
8697                 . ./myread
8698                 case "$ans" in
8699                 n*) d_uname="$define"; call=uname;;
8700                 esac
8701         else
8702                 echo 'uname() found.' >&4
8703                 d_uname="$define"
8704                 case "$call" in
8705                 '') call=uname ;;
8706                 esac
8707         fi
8708 fi
8709 case "$d_gethname" in
8710 '') d_gethname="$undef";;
8711 esac
8712 case "$d_uname" in
8713 '') d_uname="$undef";;
8714 esac
8715 case "$d_uname$d_gethname" in
8716 *define*)
8717         dflt=n
8718         cat <<EOM
8719  
8720 Every now and then someone has a $call() that lies about the hostname
8721 but can't be fixed for political or economic reasons.  If you wish, I can
8722 pretend $call() isn't there and maybe compute hostname at run-time
8723 thanks to the '$phostname' command.
8724
8725 EOM
8726         rp="Shall I ignore $call() from now on?"
8727         . ./myread
8728         case "$ans" in
8729         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8730         esac;;
8731 esac
8732 case "$phostname" in
8733 '') aphostname='';;
8734 *) case "$aphostname" in
8735         /*) ;;
8736         *) set X $phostname
8737                 shift
8738                 file=$1
8739                 shift
8740                 file=`./loc $file $file $pth`
8741                 aphostname=`echo $file $*`
8742                 ;;
8743         esac
8744         ;;
8745 esac
8746 case "$d_uname$d_gethname" in
8747 *define*) ;;
8748 *)
8749         case "$phostname" in
8750         '')
8751                 echo "There will be no way for $package to get your hostname." >&4;;
8752         *)
8753         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8754                 ;;
8755         esac;;
8756 esac
8757 case "$d_phostname" in
8758 '') d_phostname="$undef";;
8759 esac
8760
8761 : see if this is a netdb.h system
8762 set netdb.h i_netdb
8763 eval $inhdr
8764
8765 : see if prototypes for various gethostxxx netdb.h functions are available
8766 echo " "
8767 set d_gethostprotos gethostent $i_netdb netdb.h
8768 eval $hasproto
8769
8770 : see if getlogin exists
8771 set getlogin d_getlogin
8772 eval $inlibc
8773
8774 : see if getmntent exists
8775 set getmntent d_getmntent
8776 eval $inlibc
8777
8778 : see if getnetbyaddr exists
8779 set getnetbyaddr d_getnbyaddr
8780 eval $inlibc
8781
8782 : see if getnetbyname exists
8783 set getnetbyname d_getnbyname
8784 eval $inlibc
8785
8786 : see if getnetent exists
8787 set getnetent d_getnent
8788 eval $inlibc
8789
8790 : see if prototypes for various getnetxxx netdb.h functions are available
8791 echo " "
8792 set d_getnetprotos getnetent $i_netdb netdb.h
8793 eval $hasproto
8794
8795
8796 : see if getprotobyname exists
8797 set getprotobyname d_getpbyname
8798 eval $inlibc
8799
8800 : see if getprotobynumber exists
8801 set getprotobynumber d_getpbynumber
8802 eval $inlibc
8803
8804 : see if getprotoent exists
8805 set getprotoent d_getpent
8806 eval $inlibc
8807
8808 : see if getpgid exists
8809 set getpgid d_getpgid
8810 eval $inlibc
8811
8812 : see if getpgrp2 exists
8813 set getpgrp2 d_getpgrp2
8814 eval $inlibc
8815
8816 : see if getppid exists
8817 set getppid d_getppid
8818 eval $inlibc
8819
8820 : see if getpriority exists
8821 set getpriority d_getprior
8822 eval $inlibc
8823
8824 : see if prototypes for various getprotoxxx netdb.h functions are available
8825 echo " "
8826 set d_getprotoprotos getprotoent $i_netdb netdb.h
8827 eval $hasproto
8828
8829 : see if getpwent exists
8830 set getpwent d_getpwent
8831 eval $inlibc
8832
8833
8834 : see if getservbyname exists
8835 set getservbyname d_getsbyname
8836 eval $inlibc
8837
8838 : see if getservbyport exists
8839 set getservbyport d_getsbyport
8840 eval $inlibc
8841
8842 : see if getservent exists
8843 set getservent d_getsent
8844 eval $inlibc
8845
8846 : see if prototypes for various getservxxx netdb.h functions are available
8847 echo " "
8848 set d_getservprotos getservent $i_netdb netdb.h
8849 eval $hasproto
8850
8851 : see if getspent exists
8852 set getspent d_getspent
8853 eval $inlibc
8854
8855 : see if getspnam exists
8856 set getspnam d_getspnam
8857 eval $inlibc
8858
8859 : see if gettimeofday or ftime exists
8860 set gettimeofday d_gettimeod
8861 eval $inlibc
8862 case "$d_gettimeod" in
8863 "$undef")
8864         set ftime d_ftime 
8865         eval $inlibc
8866         ;;
8867 *)
8868         val="$undef"; set d_ftime; eval $setvar
8869         ;;
8870 esac
8871 case "$d_gettimeod$d_ftime" in
8872 "$undef$undef")
8873         echo " "
8874         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8875         ;;
8876 esac
8877
8878 : see if this is an grp system
8879 set grp.h i_grp
8880 eval $inhdr
8881
8882 case "$i_grp" in
8883 $define)
8884         xxx=`./findhdr grp.h`
8885         $cppstdin $cppflags $cppminus < $xxx >$$.h
8886
8887         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8888                 val="$define"
8889         else
8890                 val="$undef"
8891         fi
8892         set d_grpasswd
8893         eval $setvar
8894
8895         $rm -f $$.h
8896         ;;
8897 *)
8898         val="$undef";
8899         set d_grpasswd; eval $setvar
8900         ;;
8901 esac
8902
8903 : see if hasmntopt exists
8904 set hasmntopt d_hasmntopt
8905 eval $inlibc
8906
8907 : see if this is a netinet/in.h or sys/in.h system
8908 set netinet/in.h i_niin sys/in.h i_sysin
8909 eval $inhdr
8910
8911 : see if arpa/inet.h has to be included
8912 set arpa/inet.h i_arpainet
8913 eval $inhdr
8914
8915 : see if htonl --and friends-- exists
8916 val=''
8917 set htonl val
8918 eval $inlibc
8919
8920 : Maybe they are macros.
8921 case "$val" in
8922 $undef)
8923         $cat >htonl.c <<EOM
8924 #include <stdio.h>
8925 #include <sys/types.h>
8926 #$i_niin I_NETINET_IN
8927 #$i_sysin I_SYS_IN
8928 #$i_arpainet I_ARPA_INET
8929 #ifdef I_NETINET_IN
8930 #include <netinet/in.h>
8931 #endif
8932 #ifdef I_SYS_IN
8933 #include <sys/in.h>
8934 #endif
8935 #ifdef I_ARPA_INET
8936 #include <arpa/inet.h>
8937 #endif
8938 #ifdef htonl
8939 printf("Defined as a macro.");
8940 #endif
8941 EOM
8942         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8943         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8944                 val="$define"
8945                 echo "But it seems to be defined as a macro." >&4
8946         fi
8947         $rm -f htonl.?
8948         ;;
8949 esac
8950 set d_htonl
8951 eval $setvar
8952
8953 : see which of string.h or strings.h is needed
8954 echo " "
8955 strings=`./findhdr string.h`
8956 if $test "$strings" && $test -r "$strings"; then
8957         echo "Using <string.h> instead of <strings.h>." >&4
8958         val="$define"
8959 else
8960         val="$undef"
8961         strings=`./findhdr strings.h`
8962         if $test "$strings" && $test -r "$strings"; then
8963                 echo "Using <strings.h> instead of <string.h>." >&4
8964         else
8965                 echo "No string header found -- You'll surely have problems." >&4
8966         fi
8967 fi
8968 set i_string
8969 eval $setvar
8970 case "$i_string" in
8971 "$undef") strings=`./findhdr strings.h`;;
8972 *)        strings=`./findhdr string.h`;;
8973 esac
8974
8975 : index or strchr
8976 echo " "
8977 if set index val -f; eval $csym; $val; then
8978         if set strchr val -f d_strchr; eval $csym; $val; then
8979                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8980                         val="$define"
8981                         vali="$undef"
8982                         echo "strchr() found." >&4
8983                 else
8984                         val="$undef"
8985                         vali="$define"
8986                         echo "index() found." >&4
8987                 fi
8988         else
8989                 val="$undef"
8990                 vali="$define"
8991                 echo "index() found." >&4
8992         fi
8993 else
8994         if set strchr val -f d_strchr; eval $csym; $val; then
8995                 val="$define"
8996                 vali="$undef"
8997                 echo "strchr() found." >&4
8998         else
8999                 echo "No index() or strchr() found!" >&4
9000                 val="$undef"
9001                 vali="$undef"
9002         fi
9003 fi
9004 set d_strchr; eval $setvar
9005 val="$vali"
9006 set d_index; eval $setvar
9007
9008 : check whether inet_aton exists
9009 set inet_aton d_inetaton
9010 eval $inlibc
9011
9012 : Look for isascii
9013 echo " "
9014 $cat >isascii.c <<'EOCP'
9015 #include <stdio.h>
9016 #include <ctype.h>
9017 int main() {
9018         int c = 'A';
9019         if (isascii(c))
9020                 exit(0);
9021         else
9022                 exit(1);
9023 }
9024 EOCP
9025 set isascii
9026 if eval $compile; then
9027         echo "isascii() found." >&4
9028         val="$define"
9029 else
9030         echo "isascii() NOT found." >&4
9031         val="$undef"
9032 fi
9033 set d_isascii
9034 eval $setvar
9035 $rm -f isascii*
9036
9037 : see if killpg exists
9038 set killpg d_killpg
9039 eval $inlibc
9040
9041 : see if lchown exists
9042 echo " "
9043 $cat > try.c <<'EOCP'
9044 /* System header to define __stub macros and hopefully few prototypes,
9045     which can conflict with char lchown(); below.  */
9046 #include <assert.h>
9047 /* Override any gcc2 internal prototype to avoid an error.  */
9048 /* We use char because int might match the return type of a gcc2
9049    builtin and then its argument prototype would still apply.  */
9050 char lchown();
9051 int main() {
9052     /*  The GNU C library defines this for functions which it implements
9053         to always fail with ENOSYS.  Some functions are actually named
9054         something starting with __ and the normal name is an alias.  */
9055 #if defined (__stub_lchown) || defined (__stub___lchown)
9056 choke me
9057 #else
9058 lchown();
9059 #endif
9060 ; return 0; }
9061 EOCP
9062 set try
9063 if eval $compile; then
9064     $echo "lchown() found." >&4
9065     val="$define"
9066 else
9067     $echo "lchown() NOT found." >&4
9068     val="$undef"
9069 fi
9070 set d_lchown
9071 eval $setvar
9072
9073 : See if number of significant digits in a double precision number is known
9074 echo " "
9075 $cat >ldbl_dig.c <<EOM
9076 #$i_limits I_LIMITS
9077 #$i_float I_FLOAT
9078 #ifdef I_LIMITS
9079 #include <limits.h>
9080 #endif
9081 #ifdef I_FLOAT
9082 #include <float.h>
9083 #endif
9084 #ifdef LDBL_DIG
9085 printf("Contains LDBL_DIG");
9086 #endif
9087 EOM
9088 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9089 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9090         echo "LDBL_DIG found." >&4
9091         val="$define"
9092 else
9093         echo "LDBL_DIG NOT found." >&4
9094         val="$undef"
9095 fi
9096 $rm -f ldbl_dig.?
9097 set d_ldbl_dig
9098 eval $setvar
9099
9100 : see if link exists
9101 set link d_link
9102 eval $inlibc
9103
9104 : see if localeconv exists
9105 set localeconv d_locconv
9106 eval $inlibc
9107
9108 : see if lockf exists
9109 set lockf d_lockf
9110 eval $inlibc
9111
9112 : see if lstat exists
9113 set lstat d_lstat
9114 eval $inlibc
9115
9116 : see if madvise exists
9117 set madvise d_madvise
9118 eval $inlibc
9119
9120 : see if mblen exists
9121 set mblen d_mblen
9122 eval $inlibc
9123
9124 : see if mbstowcs exists
9125 set mbstowcs d_mbstowcs
9126 eval $inlibc
9127
9128 : see if mbtowc exists
9129 set mbtowc d_mbtowc
9130 eval $inlibc
9131
9132 : see if memchr exists
9133 set memchr d_memchr
9134 eval $inlibc
9135
9136 : see if memcmp exists
9137 set memcmp d_memcmp
9138 eval $inlibc
9139
9140 : see if memcpy exists
9141 set memcpy d_memcpy
9142 eval $inlibc
9143
9144 : see if memmove exists
9145 set memmove d_memmove
9146 eval $inlibc
9147
9148 : see if memset exists
9149 set memset d_memset
9150 eval $inlibc
9151
9152 : see if mkdir exists
9153 set mkdir d_mkdir
9154 eval $inlibc
9155
9156 : see if mkfifo exists
9157 set mkfifo d_mkfifo
9158 eval $inlibc
9159
9160 : see if mktime exists
9161 set mktime d_mktime
9162 eval $inlibc
9163
9164 : see if this is a sys/mman.h system
9165 set sys/mman.h i_sysmman
9166 eval $inhdr
9167
9168 : see if mmap exists
9169 set mmap d_mmap
9170 eval $inlibc
9171 : see what shmat returns
9172 : default to something harmless
9173 mmaptype='void *'
9174 case "$i_sysmman$d_mmap" in
9175 "$define$define")
9176         $cat >mmap.c <<'END'
9177 #include <sys/mman.h>
9178 void *mmap();
9179 END
9180         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9181                 mmaptype='void *'
9182         else
9183                 mmaptype='caddr_t'
9184         fi
9185         echo "and it returns ($mmaptype)." >&4
9186         ;;
9187 esac
9188
9189
9190
9191 : see if mprotect exists
9192 set mprotect d_mprotect
9193 eval $inlibc
9194
9195 : see if msgctl exists
9196 set msgctl d_msgctl
9197 eval $inlibc
9198
9199 : see if msgget exists
9200 set msgget d_msgget
9201 eval $inlibc
9202
9203 : see if msgsnd exists
9204 set msgsnd d_msgsnd
9205 eval $inlibc
9206
9207 : see if msgrcv exists
9208 set msgrcv d_msgrcv
9209 eval $inlibc
9210
9211 : see how much of the 'msg*(2)' library is present.
9212 h_msg=true
9213 echo " "
9214 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9215 *"$undef"*) h_msg=false;;
9216 esac
9217 case "$osname" in
9218 freebsd)
9219     case "`ipcs 2>&1`" in
9220     "SVID messages"*"not configured"*)
9221         echo "Your $osname does not have the msg*(2) configured." >&4
9222         h_msg=false
9223         val="$undef"
9224         set msgctl d_msgctl
9225         eval $setvar
9226         set msgget d_msgget
9227         eval $setvar
9228         set msgsnd d_msgsnd
9229         eval $setvar
9230         set msgrcv d_msgrcv
9231         eval $setvar
9232         ;;
9233     esac
9234     ;;
9235 esac
9236 : we could also check for sys/ipc.h ...
9237 if $h_msg && $test `./findhdr sys/msg.h`; then
9238         echo "You have the full msg*(2) library." >&4
9239         val="$define"
9240 else
9241         echo "You don't have the full msg*(2) library." >&4
9242         val="$undef"
9243 fi
9244 set d_msg
9245 eval $setvar
9246
9247 : see if msync exists
9248 set msync d_msync
9249 eval $inlibc
9250
9251 : see if munmap exists
9252 set munmap d_munmap
9253 eval $inlibc
9254
9255 : see if nice exists
9256 set nice d_nice
9257 eval $inlibc
9258
9259 : see if POSIX threads are available
9260 set pthread.h i_pthread
9261 eval $inhdr
9262
9263
9264
9265
9266 : how to create joinable pthreads
9267 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9268         echo " "
9269         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9270         $cat >try.c <<'EOCP'
9271 #include <pthread.h>
9272 int main() {
9273     int detachstate = JOINABLE;
9274 }
9275 EOCP
9276         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9277         if eval $compile; then
9278                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9279                 val="$undef" # Yes, undef.
9280                 set d_old_pthread_create_joinable
9281                 eval $setvar
9282                 val=""
9283                 set old_pthread_create_joinable
9284                 eval $setvar
9285         else
9286                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9287                 if eval $compile; then
9288                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9289                         val="$define"
9290                         set d_old_pthread_create_joinable
9291                         eval $setvar
9292                         val=PTHREAD_CREATE_UNDETACHED
9293                         set old_pthread_create_joinable
9294                         eval $setvar
9295                 else            
9296                         set try -DJOINABLE=__UNDETACHED
9297                         if eval $compile; then
9298                                 echo "You seem to use __UNDETACHED." >&4
9299                                 val="$define"
9300                                 set d_old_pthread_create_joinable
9301                                 eval $setvar
9302                                 val=__UNDETACHED
9303                                 set old_pthread_create_joinable
9304                                 eval $setvar
9305                         else
9306                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9307                                 val="$define"
9308                                 set d_old_pthread_create_joinable
9309                                 eval $setvar
9310                                 val=0
9311                                 set old_pthread_create_joinable
9312                                 eval $setvar
9313                         fi
9314                 fi
9315         fi
9316         $rm -f try try.*
9317 else
9318     d_old_pthread_create_joinable="$undef"
9319     old_pthread_create_joinable=""
9320 fi
9321
9322 : see if pause exists
9323 set pause d_pause
9324 eval $inlibc
9325
9326 : see if pipe exists
9327 set pipe d_pipe
9328 eval $inlibc
9329
9330 : see if poll exists
9331 set poll d_poll
9332 eval $inlibc
9333
9334
9335 : see whether the various POSIXish _yields exist
9336 $cat >try.c <<EOP
9337 #include <pthread.h>
9338 #include <stdio.h>
9339 int main() {
9340 #ifdef SCHED_YIELD
9341         sched_yield();
9342 #else
9343 #ifdef PTHREAD_YIELD
9344         pthread_yield();
9345 #else
9346 #ifdef PTHREAD_YIELD_NULL
9347         pthread_yield(NULL);
9348 #endif
9349 #endif
9350 #endif
9351 }
9352 EOP
9353 : see if sched_yield exists
9354 set try -DSCHED_YIELD
9355 if eval $compile; then
9356     val="$define"
9357     sched_yield='sched_yield()'
9358 else
9359     val="$undef"
9360 fi
9361 case "$usethreads" in
9362 $define)
9363         case "$val" in
9364         $define) echo 'sched_yield() found.' >&4        ;;
9365         *)       echo 'sched_yield() NOT found.' >&4    ;;
9366         esac
9367 esac
9368 set d_sched_yield
9369 eval $setvar
9370
9371 : see if pthread_yield exists
9372 set try -DPTHREAD_YIELD
9373 if eval $compile; then
9374     val="$define"
9375     case "$sched_yield" in
9376     '') sched_yield='pthread_yield()' ;;
9377     esac
9378 else
9379     set try -DPTHREAD_YIELD_NULL
9380     if eval $compile; then
9381         val="$define"
9382         case "$sched_yield" in
9383         '') sched_yield='pthread_yield(NULL)' ;;
9384         esac
9385     else
9386         val="$undef"
9387     fi
9388 fi
9389 case "$usethreads" in
9390 $define)
9391         case "$val" in
9392         $define) echo 'pthread_yield() found.' >&4      ;;
9393         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9394         esac
9395         ;;
9396 esac
9397 set d_pthread_yield
9398 eval $setvar
9399
9400 case "$sched_yield" in
9401 '') sched_yield=undef ;;
9402 esac
9403
9404 $rm -f try try.*
9405
9406 : see if this is a pwd.h system
9407 set pwd.h i_pwd
9408 eval $inhdr
9409
9410 case "$i_pwd" in
9411 $define)
9412         xxx=`./findhdr pwd.h`
9413         $cppstdin $cppflags $cppminus < $xxx >$$.h
9414
9415         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9416                 val="$define"
9417         else
9418                 val="$undef"
9419         fi
9420         set d_pwquota
9421         eval $setvar
9422
9423         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9424                 val="$define"
9425         else
9426                 val="$undef"
9427         fi
9428         set d_pwage
9429         eval $setvar
9430
9431         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9432                 val="$define"
9433         else
9434                 val="$undef"
9435         fi
9436         set d_pwchange
9437         eval $setvar
9438
9439         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9440                 val="$define"
9441         else
9442                 val="$undef"
9443         fi
9444         set d_pwclass
9445         eval $setvar
9446
9447         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9448                 val="$define"
9449         else
9450                 val="$undef"
9451         fi
9452         set d_pwexpire
9453         eval $setvar
9454
9455         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9456                 val="$define"
9457         else
9458                 val="$undef"
9459         fi
9460         set d_pwcomment
9461         eval $setvar
9462
9463         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9464                 val="$define"
9465         else
9466                 val="$undef"
9467         fi
9468         set d_pwgecos
9469         eval $setvar
9470
9471         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9472                 val="$define"
9473         else
9474                 val="$undef"
9475         fi
9476         set d_pwpasswd
9477         eval $setvar
9478
9479         $rm -f $$.h
9480         ;;
9481 *)
9482         val="$undef"; 
9483         set d_pwquota; eval $setvar
9484         set d_pwage; eval $setvar
9485         set d_pwchange; eval $setvar
9486         set d_pwclass; eval $setvar
9487         set d_pwexpire; eval $setvar
9488         set d_pwcomment; eval $setvar
9489         set d_pwgecos; eval $setvar
9490         set d_pwpasswd; eval $setvar
9491         ;;
9492 esac
9493
9494 : see if readdir and friends exist
9495 set readdir d_readdir
9496 eval $inlibc
9497 set seekdir d_seekdir
9498 eval $inlibc
9499 set telldir d_telldir
9500 eval $inlibc
9501 set rewinddir d_rewinddir
9502 eval $inlibc
9503
9504 : see if readlink exists
9505 set readlink d_readlink
9506 eval $inlibc
9507
9508 : see if readv exists
9509 set readv d_readv
9510 eval $inlibc
9511
9512 : see if rename exists
9513 set rename d_rename
9514 eval $inlibc
9515
9516 : see if rmdir exists
9517 set rmdir d_rmdir
9518 eval $inlibc
9519
9520 : see if memory.h is available.
9521 val=''
9522 set memory.h val
9523 eval $inhdr
9524
9525 : See if it conflicts with string.h
9526 case "$val" in
9527 $define)
9528         case "$strings" in
9529         '') ;;
9530         *)
9531                 $cppstdin $cppflags $cppminus < $strings > mem.h
9532                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9533                         echo " "
9534                         echo "We won't be including <memory.h>."
9535                         val="$undef"
9536                 fi
9537                 $rm -f mem.h
9538                 ;;
9539         esac
9540 esac
9541 set i_memory
9542 eval $setvar
9543
9544 : can bcopy handle overlapping blocks?
9545 val="$undef"
9546 case "$d_bcopy" in
9547 "$define")
9548         echo " "
9549         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9550         $cat >try.c <<EOCP
9551 #$i_memory I_MEMORY
9552 #$i_stdlib I_STDLIB
9553 #$i_string I_STRING
9554 #$i_unistd I_UNISTD
9555 EOCP
9556         $cat >>try.c <<'EOCP'
9557 #include <stdio.h>
9558 #ifdef I_MEMORY
9559 #  include <memory.h>
9560 #endif
9561 #ifdef I_STDLIB
9562 #  include <stdlib.h>
9563 #endif
9564 #ifdef I_STRING
9565 #  include <string.h>
9566 #else
9567 #  include <strings.h>
9568 #endif
9569 #ifdef I_UNISTD
9570 #  include <unistd.h>  /* Needed for NetBSD */
9571 #endif
9572 int main()
9573 {
9574 char buf[128], abc[128];
9575 char *b;
9576 int len;
9577 int off;
9578 int align;
9579
9580 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9581
9582 for (align = 7; align >= 0; align--) {
9583         for (len = 36; len; len--) {
9584                 b = buf+align;
9585                 bcopy(abc, b, len);
9586                 for (off = 1; off <= len; off++) {
9587                         bcopy(b, b+off, len);
9588                         bcopy(b+off, b, len);
9589                         if (bcmp(b, abc, len))
9590                                 exit(1);
9591                 }
9592         }
9593 }
9594 exit(0);
9595 }
9596 EOCP
9597         set try
9598         if eval $compile_ok; then
9599                 if ./try 2>/dev/null; then
9600                         echo "Yes, it can."
9601                         val="$define"
9602                 else
9603                         echo "It can't, sorry."
9604                         case "$d_memmove" in
9605                         "$define") echo "But that's Ok since you have memmove()." ;;
9606                         esac
9607                 fi
9608         else
9609                 echo "(I can't compile the test program, so we'll assume not...)"
9610                 case "$d_memmove" in
9611                 "$define") echo "But that's Ok since you have memmove()." ;;
9612                 esac
9613         fi
9614         ;;
9615 esac
9616 $rm -f try.* try core
9617 set d_safebcpy
9618 eval $setvar
9619
9620 : can memcpy handle overlapping blocks?
9621 val="$undef"
9622 case "$d_memcpy" in
9623 "$define")
9624         echo " "
9625         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9626         $cat >try.c <<EOCP
9627 #$i_memory I_MEMORY
9628 #$i_stdlib I_STDLIB
9629 #$i_string I_STRING
9630 #$i_unistd I_UNISTD
9631 EOCP
9632         $cat >>try.c <<'EOCP'
9633 #include <stdio.h>
9634 #ifdef I_MEMORY
9635 #  include <memory.h>
9636 #endif
9637 #ifdef I_STDLIB
9638 #  include <stdlib.h>
9639 #endif
9640 #ifdef I_STRING
9641 #  include <string.h>
9642 #else
9643 #  include <strings.h>
9644 #endif
9645 #ifdef I_UNISTD
9646 #  include <unistd.h>  /* Needed for NetBSD */
9647 #endif
9648 int main()
9649 {
9650 char buf[128], abc[128];
9651 char *b;
9652 int len;
9653 int off;
9654 int align;
9655
9656 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9657    try to store the string in read-only memory. */
9658 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9659
9660 for (align = 7; align >= 0; align--) {
9661         for (len = 36; len; len--) {
9662                 b = buf+align;
9663                 memcpy(b, abc, len);
9664                 for (off = 1; off <= len; off++) {
9665                         memcpy(b+off, b, len);
9666                         memcpy(b, b+off, len);
9667                         if (memcmp(b, abc, len))
9668                                 exit(1);
9669                 }
9670         }
9671 }
9672 exit(0);
9673 }
9674 EOCP
9675         set try
9676         if eval $compile_ok; then
9677                 if ./try 2>/dev/null; then
9678                         echo "Yes, it can."
9679                         val="$define"
9680                 else
9681                         echo "It can't, sorry."
9682                         case "$d_memmove" in
9683                         "$define") echo "But that's Ok since you have memmove()." ;;
9684                         esac
9685                 fi
9686         else
9687                 echo "(I can't compile the test program, so we'll assume not...)"
9688                 case "$d_memmove" in
9689                 "$define") echo "But that's Ok since you have memmove()." ;;
9690                 esac
9691         fi
9692         ;;
9693 esac
9694 $rm -f try.* try core
9695 set d_safemcpy
9696 eval $setvar
9697
9698 : can memcmp be trusted to compare relative magnitude?
9699 val="$undef"
9700 case "$d_memcmp" in
9701 "$define")
9702         echo " "
9703         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9704         $cat >try.c <<EOCP
9705 #$i_memory I_MEMORY
9706 #$i_stdlib I_STDLIB
9707 #$i_string I_STRING
9708 #$i_unistd I_UNISTD
9709 EOCP
9710         $cat >>try.c <<'EOCP'
9711 #include <stdio.h>
9712 #ifdef I_MEMORY
9713 #  include <memory.h>
9714 #endif
9715 #ifdef I_STDLIB
9716 #  include <stdlib.h>
9717 #endif
9718 #ifdef I_STRING
9719 #  include <string.h>
9720 #else
9721 #  include <strings.h>
9722 #endif
9723 #ifdef I_UNISTD
9724 #  include <unistd.h>  /* Needed for NetBSD */
9725 #endif
9726 int main()
9727 {
9728 char a = -1;
9729 char b = 0;
9730 if ((a < b) && memcmp(&a, &b, 1) < 0)
9731         exit(1);
9732 exit(0);
9733 }
9734 EOCP
9735         set try
9736         if eval $compile_ok; then
9737                 if ./try 2>/dev/null; then
9738                         echo "Yes, it can."
9739                         val="$define"
9740                 else
9741                         echo "No, it can't (it uses signed chars)."
9742                 fi
9743         else
9744                 echo "(I can't compile the test program, so we'll assume not...)"
9745         fi
9746         ;;
9747 esac
9748 $rm -f try.* try core
9749 set d_sanemcmp
9750 eval $setvar
9751
9752 : see if select exists
9753 set select d_select
9754 eval $inlibc
9755
9756 : see if semctl exists
9757 set semctl d_semctl
9758 eval $inlibc
9759
9760 : see if semget exists
9761 set semget d_semget
9762 eval $inlibc
9763
9764 : see if semop exists
9765 set semop d_semop
9766 eval $inlibc
9767
9768 : see how much of the 'sem*(2)' library is present.
9769 h_sem=true
9770 echo " "
9771 case "$d_semctl$d_semget$d_semop" in
9772 *"$undef"*) h_sem=false;;
9773 esac
9774 case "$osname" in
9775 freebsd)
9776     case "`ipcs 2>&1`" in
9777     "SVID messages"*"not configured"*)
9778         echo "Your $osname does not have the sem*(2) configured." >&4
9779         h_sem=false
9780         val="$undef"
9781         set semctl d_semctl
9782         eval $setvar
9783         set semget d_semget
9784         eval $setvar
9785         set semop d_semop
9786         eval $setvar
9787         ;;
9788     esac
9789     ;;
9790 esac
9791 : we could also check for sys/ipc.h ...
9792 if $h_sem && $test `./findhdr sys/sem.h`; then
9793         echo "You have the full sem*(2) library." >&4
9794         val="$define"
9795 else
9796         echo "You don't have the full sem*(2) library." >&4
9797         val="$undef"
9798 fi
9799 set d_sem
9800 eval $setvar
9801
9802 : see whether sys/sem.h defines union semun
9803 echo " "
9804 $cat > try.c <<'END'
9805 #include <sys/types.h>
9806 #include <sys/ipc.h>
9807 #include <sys/sem.h>
9808 int main () { union semun semun; semun.buf = 0; }
9809 END
9810 set try
9811 if eval $compile; then
9812     echo "You have union semun in <sys/sem.h>." >&4
9813     val="$define"
9814 else
9815     echo "You do not have union semun in <sys/sem.h>." >&4
9816     val="$undef"
9817 fi
9818 $rm -f try try.c try.h
9819 set d_union_semun
9820 eval $setvar
9821
9822 : see how to do semctl IPC_STAT
9823 case "$d_sem" in
9824 $define)
9825     : see whether semctl IPC_STAT can use union semun
9826     echo " "
9827     $cat > try.h <<END
9828 #ifndef S_IRUSR
9829 #   ifdef S_IREAD
9830 #       define S_IRUSR S_IREAD
9831 #       define S_IWUSR S_IWRITE
9832 #       define S_IXUSR S_IEXEC
9833 #   else
9834 #       define S_IRUSR 0400
9835 #       define S_IWUSR 0200
9836 #       define S_IXUSR 0100
9837 #   endif
9838 #   define S_IRGRP (S_IRUSR>>3)
9839 #   define S_IWGRP (S_IWUSR>>3)
9840 #   define S_IXGRP (S_IXUSR>>3)
9841 #   define S_IROTH (S_IRUSR>>6)
9842 #   define S_IWOTH (S_IWUSR>>6)
9843 #   define S_IXOTH (S_IXUSR>>6)
9844 #endif
9845 #ifndef S_IRWXU
9846 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9847 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9848 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9849 #endif
9850 END
9851
9852     $cat > try.c <<END
9853 #include <sys/types.h>
9854 #include <sys/ipc.h>
9855 #include <sys/sem.h>
9856 #include <sys/stat.h>
9857 #include <stdio.h>
9858 #include <errno.h>
9859 #include "try.h"
9860 #ifndef errno
9861 extern int errno;
9862 #endif
9863 #$d_union_semun HAS_UNION_SEMUN
9864 int main() {
9865     union semun
9866 #ifndef HAS_UNION_SEMUN
9867     {
9868         int val;
9869         struct semid_ds *buf;
9870         unsigned short *array;
9871     }
9872 #endif
9873     arg;
9874     int sem, st;
9875
9876 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9877     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9878     if (sem > -1) {
9879         struct semid_ds argbuf;
9880         arg.buf = &argbuf;
9881 #       ifdef IPC_STAT
9882         st = semctl(sem, 0, IPC_STAT, arg);
9883         if (st == 0)
9884             printf("semun\n");
9885         else
9886 #       endif /* IPC_STAT */
9887             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9888 #       ifdef IPC_RMID
9889         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9890 #       endif /* IPC_RMID */
9891             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9892     } else
9893 #endif /* IPC_PRIVATE && ... */
9894         printf("semget failed: errno = %d\n", errno);
9895   return 0;
9896 }
9897 END
9898     val="$undef"
9899     set try
9900     if eval $compile; then
9901         xxx=`./try`
9902         case "$xxx" in
9903         semun) val="$define" ;;
9904         esac
9905     fi
9906     $rm -f try try.c
9907     set d_semctl_semun
9908     eval $setvar
9909     case "$d_semctl_semun" in
9910     $define)
9911         echo "You can use union semun for semctl IPC_STAT." >&4
9912         also='also'
9913         ;;
9914     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9915         also=''
9916         ;;
9917     esac
9918
9919     : see whether semctl IPC_STAT can use struct semid_ds pointer
9920     $cat > try.c <<'END'
9921 #include <sys/types.h>
9922 #include <sys/ipc.h>
9923 #include <sys/sem.h>
9924 #include <sys/stat.h>
9925 #include "try.h"
9926 #include <stdio.h>
9927 #include <errno.h>
9928 #ifndef errno
9929 extern int errno;
9930 #endif
9931 int main() {
9932     struct semid_ds arg;
9933     int sem, st;
9934
9935 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9936     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9937     if (sem > -1) {
9938 #       ifdef IPC_STAT
9939         st = semctl(sem, 0, IPC_STAT, &arg);
9940         if (st == 0)
9941             printf("semid_ds\n");
9942         else
9943 #       endif /* IPC_STAT */
9944             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9945 #       ifdef IPC_RMID
9946         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9947 #       endif /* IPC_RMID */
9948             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9949     } else
9950 #endif /* IPC_PRIVATE && ... */
9951         printf("semget failed: errno = %d\n", errno);
9952
9953     return 0;
9954 }
9955 END
9956     val="$undef"
9957     set try
9958     if eval $compile; then
9959         xxx=`./try`
9960         case "$xxx" in
9961         semid_ds) val="$define" ;;
9962         esac
9963     fi
9964     $rm -f try try.c
9965     set d_semctl_semid_ds
9966     eval $setvar
9967     case "$d_semctl_semid_ds" in
9968     $define)
9969         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9970         ;;
9971     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9972         ;;
9973     esac
9974     $rm -f try.h
9975     ;;
9976 *)  val="$undef"
9977
9978     # We do not have the full sem*(2) library, so assume we can not
9979     # use either.
9980
9981     set d_semctl_semun
9982     eval $setvar
9983
9984     set d_semctl_semid_ds
9985     eval $setvar
9986     ;;
9987 esac
9988
9989 : see if setegid exists
9990 set setegid d_setegid
9991 eval $inlibc
9992
9993 : see if seteuid exists
9994 set seteuid d_seteuid
9995 eval $inlibc
9996
9997 : see if setgrent exists
9998 set setgrent d_setgrent
9999 eval $inlibc
10000
10001 : see if sethostent exists
10002 set sethostent d_sethent
10003 eval $inlibc
10004
10005 : see if setlinebuf exists
10006 set setlinebuf d_setlinebuf
10007 eval $inlibc
10008
10009 : see if setlocale exists
10010 set setlocale d_setlocale
10011 eval $inlibc
10012
10013 : see if setnetent exists
10014 set setnetent d_setnent
10015 eval $inlibc
10016
10017 : see if setprotoent exists
10018 set setprotoent d_setpent
10019 eval $inlibc
10020
10021 : see if setpgid exists
10022 set setpgid d_setpgid
10023 eval $inlibc
10024
10025 : see if setpgrp2 exists
10026 set setpgrp2 d_setpgrp2
10027 eval $inlibc
10028
10029 : see if setpriority exists
10030 set setpriority d_setprior
10031 eval $inlibc
10032
10033 : see if setpwent exists
10034 set setpwent d_setpwent
10035 eval $inlibc
10036
10037 : see if setregid exists
10038 set setregid d_setregid
10039 eval $inlibc
10040 set setresgid d_setresgid
10041 eval $inlibc
10042
10043 : see if setreuid exists
10044 set setreuid d_setreuid
10045 eval $inlibc
10046 set setresuid d_setresuid
10047 eval $inlibc
10048
10049 : see if setrgid exists
10050 set setrgid d_setrgid
10051 eval $inlibc
10052
10053 : see if setruid exists
10054 set setruid d_setruid
10055 eval $inlibc
10056
10057 : see if setservent exists
10058 set setservent d_setsent
10059 eval $inlibc
10060
10061 : see if setsid exists
10062 set setsid d_setsid
10063 eval $inlibc
10064
10065 : see if setspent exists
10066 set setspent d_setspent
10067 eval $inlibc
10068
10069 : see if setvbuf exists
10070 set setvbuf d_setvbuf
10071 eval $inlibc
10072
10073 : see if sfio.h is available
10074 set sfio.h i_sfio
10075 eval $inhdr
10076
10077
10078 : see if sfio library is available
10079 case "$i_sfio" in
10080 $define)
10081         val=''
10082         set sfreserve val
10083         eval $inlibc
10084         ;;
10085 *)
10086         val="$undef"
10087         ;;
10088 esac
10089 : Ok, but do we want to use it.
10090 case "$val" in
10091 $define)
10092         case "$usesfio" in
10093         true|$define|[yY]*) dflt='y';;
10094         *) dflt='n';;
10095         esac
10096         echo "$package can use the sfio library, but it is experimental."
10097         rp="You seem to have sfio available, do you want to try using it?"
10098         . ./myread
10099         case "$ans" in
10100         y|Y) ;;
10101         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10102                 val="$undef"
10103                 : Remove sfio from list of libraries to use
10104                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10105                 shift
10106                 libs="$*"
10107                 echo "libs = $libs" >&4
10108                 ;;
10109         esac
10110         ;;
10111 *)      case "$usesfio" in
10112         true|$define|[yY]*)
10113                 echo "Sorry, cannot find sfio on this machine" >&4
10114                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10115                 ;;
10116         esac
10117         ;;
10118 esac
10119 set d_sfio
10120 eval $setvar
10121 case "$d_sfio" in
10122 $define) usesfio='true';;
10123 *) usesfio='false';;
10124 esac
10125
10126 : see if shmctl exists
10127 set shmctl d_shmctl
10128 eval $inlibc
10129
10130 : see if shmget exists
10131 set shmget d_shmget
10132 eval $inlibc
10133
10134 : see if shmat exists
10135 set shmat d_shmat
10136 eval $inlibc
10137 : see what shmat returns
10138 case "$d_shmat" in
10139 "$define")
10140         $cat >shmat.c <<'END'
10141 #include <sys/shm.h>
10142 void *shmat();
10143 END
10144         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10145                 shmattype='void *'
10146         else
10147                 shmattype='char *'
10148         fi
10149         echo "and it returns ($shmattype)." >&4
10150         : see if a prototype for shmat is available
10151         xxx=`./findhdr sys/shm.h`
10152         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10153         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10154                 val="$define"
10155         else
10156                 val="$undef"
10157         fi
10158         $rm -f shmat.[co]
10159         ;;
10160 *)
10161         val="$undef"
10162         ;;
10163 esac
10164 set d_shmatprototype
10165 eval $setvar
10166
10167 : see if shmdt exists
10168 set shmdt d_shmdt
10169 eval $inlibc
10170
10171 : see how much of the 'shm*(2)' library is present.
10172 h_shm=true
10173 echo " "
10174 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10175 *"$undef"*) h_shm=false;;
10176 esac
10177 case "$osname" in
10178 freebsd)
10179     case "`ipcs 2>&1`" in
10180     "SVID shared memory"*"not configured"*)
10181         echo "Your $osname does not have the shm*(2) configured." >&4
10182         h_shm=false
10183         val="$undef"
10184         set shmctl d_shmctl
10185         evat $setvar
10186         set shmget d_shmget
10187         evat $setvar
10188         set shmat d_shmat
10189         evat $setvar
10190         set shmdt d_shmdt
10191         evat $setvar
10192         ;;
10193     esac
10194     ;;
10195 esac
10196 : we could also check for sys/ipc.h ...
10197 if $h_shm && $test `./findhdr sys/shm.h`; then
10198         echo "You have the full shm*(2) library." >&4
10199         val="$define"
10200 else
10201         echo "You don't have the full shm*(2) library." >&4
10202         val="$undef"
10203 fi
10204 set d_shm
10205 eval $setvar
10206
10207 echo " "
10208 : see if we have sigaction
10209 if set sigaction val -f d_sigaction; eval $csym; $val; then
10210         echo 'sigaction() found.' >&4
10211         $cat > try.c <<'EOP'
10212 #include <stdio.h>
10213 #include <sys/types.h>
10214 #include <signal.h>
10215 int main()
10216 {
10217     struct sigaction act, oact;
10218     act.sa_flags = 0;
10219     oact.sa_handler = 0;
10220 }
10221 EOP
10222         set try
10223         if eval $compile_ok; then
10224                 val="$define"
10225         else
10226                 echo "But you don't seem to have a useable struct sigaction." >&4
10227                 val="$undef"
10228         fi
10229 else
10230         echo 'sigaction NOT found.' >&4
10231         val="$undef"
10232 fi
10233 set d_sigaction; eval $setvar
10234 $rm -f try try$_o try.c
10235
10236 : see if sigsetjmp exists
10237 echo " "
10238 case "$d_sigsetjmp" in
10239 '')
10240         $cat >try.c <<'EOP'
10241 #include <setjmp.h>
10242 sigjmp_buf env;
10243 int set = 1;
10244 int main()
10245 {
10246         if (sigsetjmp(env,1))
10247                 exit(set);
10248         set = 0;
10249         siglongjmp(env, 1);
10250         exit(1);
10251 }
10252 EOP
10253         set try
10254         if eval $compile; then
10255                 if ./try >/dev/null 2>&1; then
10256                         echo "POSIX sigsetjmp found." >&4
10257                         val="$define"
10258                 else
10259                         $cat >&4 <<EOM
10260 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10261 I'll ignore them.
10262 EOM
10263                         val="$undef"
10264                 fi
10265         else
10266                 echo "sigsetjmp not found." >&4
10267                 val="$undef"
10268         fi
10269         ;;
10270 *) val="$d_sigsetjmp"
10271         case "$d_sigsetjmp" in
10272         $define) echo "POSIX sigsetjmp found." >&4;;
10273         $undef) echo "sigsetjmp not found." >&4;;
10274         esac
10275         ;;
10276 esac
10277 set d_sigsetjmp
10278 eval $setvar
10279 $rm -f try.c try
10280
10281 : see if sys/stat.h is available
10282 set sys/stat.h i_sysstat
10283 eval $inhdr
10284
10285 : see if stat knows about block sizes
10286 echo " "
10287 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10288 eval $hasfield
10289
10290 : see if _ptr and _cnt from stdio act std
10291 echo " "
10292 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10293         echo "(Looks like you have stdio.h from Linux.)"
10294         case "$stdio_ptr" in
10295         '') stdio_ptr='((fp)->_IO_read_ptr)'
10296                 ptr_lval=$define
10297                 ;;
10298         *)      ptr_lval=$d_stdio_ptr_lval;;
10299         esac
10300         case "$stdio_cnt" in
10301         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10302                 cnt_lval=$undef
10303                 ;;
10304         *)      cnt_lval=$d_stdio_cnt_lval;;
10305         esac
10306         case "$stdio_base" in
10307         '') stdio_base='((fp)->_IO_read_base)';;
10308         esac
10309         case "$stdio_bufsiz" in
10310         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10311         esac
10312 else
10313         case "$stdio_ptr" in
10314         '') stdio_ptr='((fp)->_ptr)'
10315                 ptr_lval=$define
10316                 ;;
10317         *)      ptr_lval=$d_stdio_ptr_lval;;
10318         esac
10319         case "$stdio_cnt" in
10320         '') stdio_cnt='((fp)->_cnt)'
10321                 cnt_lval=$define
10322                 ;;
10323         *)      cnt_lval=$d_stdio_cnt_lval;;
10324         esac
10325         case "$stdio_base" in
10326         '') stdio_base='((fp)->_base)';;
10327         esac
10328         case "$stdio_bufsiz" in
10329         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10330         esac
10331 fi
10332 : test whether _ptr and _cnt really work
10333 echo "Checking how std your stdio is..." >&4
10334 $cat >try.c <<EOP
10335 #include <stdio.h>
10336 #define FILE_ptr(fp)    $stdio_ptr
10337 #define FILE_cnt(fp)    $stdio_cnt
10338 int main() {
10339         FILE *fp = fopen("try.c", "r");
10340         char c = getc(fp);
10341         if (
10342                 18 <= FILE_cnt(fp) &&
10343                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10344         )
10345                 exit(0);
10346         exit(1);
10347 }
10348 EOP
10349 val="$undef"
10350 set try
10351 if eval $compile; then
10352         if ./try; then
10353                 echo "Your stdio acts pretty std."
10354                 val="$define"
10355         else
10356                 echo "Your stdio isn't very std."
10357         fi
10358 else
10359         echo "Your stdio doesn't appear very std."
10360 fi
10361 $rm -f try.c try
10362 set d_stdstdio
10363 eval $setvar
10364
10365 : Can _ptr be used as an lvalue?
10366 case "$d_stdstdio$ptr_lval" in
10367 $define$define) val=$define ;;
10368 *) val=$undef ;;
10369 esac
10370 set d_stdio_ptr_lval
10371 eval $setvar
10372
10373 : Can _cnt be used as an lvalue?
10374 case "$d_stdstdio$cnt_lval" in
10375 $define$define) val=$define ;;
10376 *) val=$undef ;;
10377 esac
10378 set d_stdio_cnt_lval
10379 eval $setvar
10380
10381 : see if _base is also standard
10382 val="$undef"
10383 case "$d_stdstdio" in
10384 $define)
10385         $cat >try.c <<EOP
10386 #include <stdio.h>
10387 #define FILE_base(fp)   $stdio_base
10388 #define FILE_bufsiz(fp) $stdio_bufsiz
10389 int main() {
10390         FILE *fp = fopen("try.c", "r");
10391         char c = getc(fp);
10392         if (
10393                 19 <= FILE_bufsiz(fp) &&
10394                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10395         )
10396                 exit(0);
10397         exit(1);
10398 }
10399 EOP
10400         set try
10401         if eval $compile; then
10402                 if ./try; then
10403                         echo "And its _base field acts std."
10404                         val="$define"
10405                 else
10406                         echo "But its _base field isn't std."
10407                 fi
10408         else
10409                 echo "However, it seems to be lacking the _base field."
10410         fi
10411         $rm -f try.c try
10412         ;;
10413 esac
10414 set d_stdiobase
10415 eval $setvar
10416
10417 $cat >&4 <<EOM
10418 Checking how to access stdio streams by file descriptor number...
10419 EOM
10420 case "$stdio_stream_array" in
10421 '')     $cat >try.c <<EOCP
10422 #include <stdio.h>
10423 int main() {
10424   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10425     printf("yes\n");
10426 }
10427 EOCP
10428         for s in _iob __iob __sF
10429         do
10430                 set try -DSTDIO_STREAM_ARRAY=$s
10431                 if eval $compile; then
10432                         case "`./try$exe_ext`" in
10433                         yes)    stdio_stream_array=$s; break ;;
10434                         esac
10435                 fi
10436         done
10437         $rm -f try.* try$exe_ext
10438 esac
10439 case "$stdio_stream_array" in
10440 '')     $cat >&4 <<EOM
10441 I can't figure out how to access stdio streams by file descriptor number.
10442 EOM
10443         d_stdio_stream_array="$undef"
10444         ;;
10445 *)      $cat >&4 <<EOM
10446 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10447 EOM
10448         d_stdio_stream_array="$define"
10449         ;;
10450 esac
10451
10452 : see if strcoll exists
10453 set strcoll d_strcoll
10454 eval $inlibc
10455
10456 : check for structure copying
10457 echo " "
10458 echo "Checking to see if your C compiler can copy structs..." >&4
10459 $cat >try.c <<'EOCP'
10460 int main()
10461 {
10462         struct blurfl {
10463                 int dyick;
10464         } foo, bar;
10465
10466         foo = bar;
10467 }
10468 EOCP
10469 if $cc -c try.c >/dev/null 2>&1 ; then
10470         val="$define"
10471         echo "Yup, it can."
10472 else
10473         val="$undef"
10474         echo "Nope, it can't."
10475 fi
10476 set d_strctcpy
10477 eval $setvar
10478 $rm -f try.*
10479
10480 : see if strerror and/or sys_errlist[] exist
10481 echo " "
10482 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10483     if set strerror val -f d_strerror; eval $csym; $val; then
10484                 echo 'strerror() found.' >&4
10485                 d_strerror="$define"
10486                 d_strerrm='strerror(e)'
10487                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10488                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10489                         d_syserrlst="$define"
10490                 else
10491                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10492                         d_syserrlst="$undef"
10493                 fi
10494     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10495                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10496                 echo 'strerror() found in string header.' >&4
10497                 d_strerror="$define"
10498                 d_strerrm='strerror(e)'
10499                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10500                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10501                                 d_syserrlst="$define"
10502                 else
10503                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10504                         d_syserrlst="$undef"
10505                 fi
10506     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10507                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10508                 d_strerror="$undef"
10509                 d_syserrlst="$define"
10510                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10511     else
10512                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10513                 d_strerror="$undef"
10514                 d_syserrlst="$undef"
10515                 d_strerrm='"unknown"'
10516     fi
10517 fi
10518
10519 : see if strtod exists
10520 set strtod d_strtod
10521 eval $inlibc
10522
10523 : see if strtol exists
10524 set strtol d_strtol
10525 eval $inlibc
10526
10527 : see if strtoul exists
10528 set strtoul d_strtoul
10529 eval $inlibc
10530
10531 : see if strtoull exists
10532 set strtoull d_strtoull
10533 eval $inlibc
10534
10535 : see if strxfrm exists
10536 set strxfrm d_strxfrm
10537 eval $inlibc
10538
10539 : see if symlink exists
10540 set symlink d_symlink
10541 eval $inlibc
10542
10543 : see if syscall exists
10544 set syscall d_syscall
10545 eval $inlibc
10546
10547 : see if sysconf exists
10548 set sysconf d_sysconf
10549 eval $inlibc
10550
10551 : see if system exists
10552 set system d_system
10553 eval $inlibc
10554
10555 : see if tcgetpgrp exists
10556 set tcgetpgrp d_tcgetpgrp
10557 eval $inlibc
10558
10559 : see if tcsetpgrp exists
10560 set tcsetpgrp d_tcsetpgrp
10561 eval $inlibc
10562
10563 : see if sys/types.h has to be included
10564 set sys/types.h i_systypes
10565 eval $inhdr
10566
10567 : see if prototype for telldir is available
10568 echo " "
10569 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10570 eval $hasproto
10571
10572 : define an is-a-typedef? function
10573 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10574 case "$inclist" in
10575 "") inclist="sys/types.h";;
10576 esac;
10577 eval "varval=\$$var";
10578 case "$varval" in
10579 "")
10580         $rm -f temp.c;
10581         for inc in $inclist; do
10582                 echo "#include <$inc>" >>temp.c;
10583         done;
10584         echo "#ifdef $type" >> temp.c;
10585         echo "printf(\"We have $type\");" >> temp.c;
10586         echo "#endif" >> temp.c;
10587         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10588         if $contains $type temp.E >/dev/null 2>&1; then
10589                 eval "$var=\$type";
10590         else
10591                 eval "$var=\$def";
10592         fi;
10593         $rm -f temp.?;;
10594 *) eval "$var=\$varval";;
10595 esac'
10596
10597 : define an is-a-typedef? function that prompts if the type is not available.
10598 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10599 case "$inclist" in
10600 "") inclist="sys/types.h";;
10601 esac;
10602 eval "varval=\$$var";
10603 case "$varval" in
10604 "")
10605         $rm -f temp.c;
10606         for inc in $inclist; do
10607                 echo "#include <$inc>" >>temp.c;
10608         done;
10609         echo "#ifdef $type" >> temp.c;
10610         echo "printf(\"We have $type\");" >> temp.c;
10611         echo "#endif" >> temp.c;
10612         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10613         echo " " ;
10614         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10615         if $contains $type temp.E >/dev/null 2>&1; then
10616                 echo "$type found." >&4;
10617                 eval "$var=\$type";
10618         else
10619                 echo "$type NOT found." >&4;
10620                 dflt="$def";
10621                 . ./myread ;
10622                 eval "$var=\$ans";
10623         fi;
10624         $rm -f temp.?;;
10625 *) eval "$var=\$varval";;
10626 esac'
10627
10628 : see if this is a sys/times.h system
10629 set sys/times.h i_systimes
10630 eval $inhdr
10631
10632 : see if times exists
10633 echo " "
10634 if set times val -f d_times; eval $csym; $val; then
10635         echo 'times() found.' >&4
10636         d_times="$define"
10637         inc=''
10638         case "$i_systimes" in
10639         "$define") inc='sys/times.h';;
10640         esac
10641         rp="What is the type returned by times() on this system?"
10642         set clock_t clocktype long stdio.h sys/types.h $inc
10643         eval $typedef_ask
10644 else
10645         echo 'times() NOT found, hope that will do.' >&4
10646         d_times="$undef"
10647         clocktype='int'
10648 fi
10649
10650 : see if truncate exists
10651 set truncate d_truncate
10652 eval $inlibc
10653
10654 : see if tzname[] exists
10655 echo " "
10656 if set tzname val -a d_tzname; eval $csym; $val; then
10657         val="$define"
10658         echo 'tzname[] found.' >&4
10659 else
10660         val="$undef"
10661         echo 'tzname[] NOT found.' >&4
10662 fi
10663 set d_tzname
10664 eval $setvar
10665
10666 : see if umask exists
10667 set umask d_umask
10668 eval $inlibc
10669
10670 : backward compatibility for d_hvfork
10671 if test X$d_hvfork != X; then
10672         d_vfork="$d_hvfork"
10673         d_hvfork=''
10674 fi
10675 : see if there is a vfork
10676 val=''
10677 set vfork val
10678 eval $inlibc
10679
10680 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10681 : perl on Solaris 2.x, and probably elsewhere.
10682 case "$val" in
10683 $define)
10684         echo " "
10685         case "$usevfork" in
10686         false) dflt='n';;
10687         *) dflt='y';;
10688         esac
10689         cat <<'EOM'
10690  
10691 Perl can only use a vfork() that doesn't suffer from strict
10692 restrictions on calling functions or modifying global data in
10693 the child.  For example, glibc-2.1 contains such a vfork()
10694 that is unsuitable.  If your system provides a proper fork()
10695 call, chances are that you do NOT want perl to use vfork().
10696
10697 EOM
10698         rp="Do you still want to use vfork()?"
10699         . ./myread
10700         case "$ans" in
10701         y|Y) ;;
10702         *)
10703                 echo "Ok, we won't use vfork()."
10704                 val="$undef"
10705                 ;;
10706         esac
10707         ;;
10708 esac
10709 set d_vfork
10710 eval $setvar
10711 case "$d_vfork" in
10712 $define) usevfork='true';;
10713 *) usevfork='false';;
10714 esac
10715
10716 : see if this is an sysdir system
10717 set sys/dir.h i_sysdir
10718 eval $inhdr
10719
10720 : see if this is an sysndir system
10721 set sys/ndir.h i_sysndir
10722 eval $inhdr
10723
10724 : see if closedir exists
10725 set closedir d_closedir
10726 eval $inlibc
10727
10728 case "$d_closedir" in
10729 "$define")
10730         echo " "
10731         echo "Checking whether closedir() returns a status..." >&4
10732         cat > closedir.c <<EOM
10733 #$i_dirent I_DIRENT             /**/
10734 #$i_sysdir I_SYS_DIR            /**/
10735 #$i_sysndir I_SYS_NDIR          /**/
10736 #$i_systypes I_SYS_TYPES        /**/
10737
10738 #if defined(I_SYS_TYPES)
10739 #include <sys/types.h>
10740 #endif
10741 #if defined(I_DIRENT)
10742 #include <dirent.h>
10743 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10744 #include <sys/dir.h>
10745 #endif
10746 #else
10747 #ifdef I_SYS_NDIR
10748 #include <sys/ndir.h>
10749 #else
10750 #ifdef I_SYS_DIR
10751 #ifdef hp9000s500
10752 #include <ndir.h>       /* may be wrong in the future */
10753 #else
10754 #include <sys/dir.h>
10755 #endif
10756 #endif
10757 #endif
10758 #endif 
10759 int main() { return closedir(opendir(".")); }
10760 EOM
10761         set closedir
10762         if eval $compile_ok; then
10763                 if ./closedir > /dev/null 2>&1 ; then
10764                         echo "Yes, it does."
10765                         val="$undef"
10766                 else
10767                         echo "No, it doesn't."
10768                         val="$define"
10769                 fi
10770         else
10771                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10772                 val="$define"
10773         fi
10774         ;;
10775 *)
10776         val="$undef";
10777         ;;
10778 esac
10779 set d_void_closedir
10780 eval $setvar
10781 $rm -f closedir*
10782 : check for volatile keyword
10783 echo " "
10784 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10785 $cat >try.c <<'EOCP'
10786 int main()
10787 {
10788         typedef struct _goo_struct goo_struct;
10789         goo_struct * volatile goo = ((goo_struct *)0);
10790         struct _goo_struct {
10791                 long long_int;
10792                 int reg_int;
10793                 char char_var;
10794         };
10795         typedef unsigned short foo_t;
10796         char *volatile foo;
10797         volatile int bar;
10798         volatile foo_t blech;
10799         foo = foo;
10800 }
10801 EOCP
10802 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10803         val="$define"
10804         echo "Yup, it does."
10805 else
10806         val="$undef"
10807         echo "Nope, it doesn't."
10808 fi
10809 set d_volatile
10810 eval $setvar
10811 $rm -f try.*
10812
10813 : see if there is a wait4
10814 set wait4 d_wait4
10815 eval $inlibc
10816
10817 : see if waitpid exists
10818 set waitpid d_waitpid
10819 eval $inlibc
10820
10821 : see if wcstombs exists
10822 set wcstombs d_wcstombs
10823 eval $inlibc
10824
10825 : see if wctomb exists
10826 set wctomb d_wctomb
10827 eval $inlibc
10828
10829 : see if writev exists
10830 set writev d_writev
10831 eval $inlibc
10832
10833 : preserve RCS keywords in files with variable substitution, grrr
10834 Date='$Date'
10835 Id='$Id'
10836 Log='$Log'
10837 RCSfile='$RCSfile'
10838 Revision='$Revision'
10839
10840 case "$crosscompile" in
10841 ''|[nN]*) crosscompile="$undef" ;;
10842 esac
10843
10844 case "$osname" in
10845 next|rhapsody) multiarch="$define" ;;
10846 esac
10847 case "$multiarch" in
10848 ''|[nN]*) multiarch="$undef" ;;
10849 esac
10850
10851 : check for alignment requirements
10852 echo " "
10853 case "$crosscompile$multiarch" in
10854 *$define*)
10855         $cat <<EOM
10856 You seem to be either cross-compiling or doing a multiarchitecture build,
10857 skipping the memory alignment check.
10858
10859 EOM
10860         case "$alignbytes" in
10861         '') alignbytes=8 ;;
10862         esac
10863         ;;
10864 *)
10865         case "$alignbytes" in
10866         '') echo "Checking alignment constraints..." >&4
10867                 $cat >try.c <<'EOCP'
10868 struct foobar {
10869         char foo;
10870         double bar;
10871 } try_algn;
10872 int main()
10873 {
10874         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10875 }
10876 EOCP
10877                 set try
10878                 if eval $compile_ok; then
10879                         dflt=`./try`
10880                 else
10881                         dflt='8'
10882                         echo "(I can't seem to compile the test program...)"
10883                 fi
10884                 ;;
10885         *) dflt="$alignbytes"
10886                 ;;
10887         esac
10888         rp="Doubles must be aligned on a how-many-byte boundary?"
10889         . ./myread
10890         alignbytes="$ans"
10891         $rm -f try.c try
10892         ;;
10893 esac
10894
10895
10896 : check for ordering of bytes in a long
10897 echo " "
10898 case "$crosscompile$multiarch" in
10899 *$define*)
10900         $cat <<EOM
10901 You seem to be either cross-compiling or doing a multiarchitecture build,
10902 skipping the byteorder check.
10903
10904 EOM
10905         byteorder='0xffff'
10906         ;;
10907 *)
10908         case "$byteorder" in
10909         '')
10910                 $cat <<'EOM'
10911 In the following, larger digits indicate more significance.  A big-endian
10912 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10913 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10914 machines may have weird orders like 3412.  A Cray will report 87654321,
10915 an Alpha will report 12345678. If the test program works the default is
10916 probably right.
10917 I'm now running the test program...
10918 EOM
10919                 $cat >try.c <<'EOCP'
10920 #include <stdio.h>
10921 int main()
10922 {
10923         int i;
10924         union {
10925                 unsigned long l;
10926                 char c[sizeof(long)];
10927         } u;
10928
10929         if (sizeof(long) > 4)
10930                 u.l = (0x08070605L << 32) | 0x04030201L;
10931         else
10932                 u.l = 0x04030201L;
10933         for (i = 0; i < sizeof(long); i++)
10934                 printf("%c", u.c[i]+'0');
10935         printf("\n");
10936         exit(0);
10937 }
10938 EOCP
10939                 xxx_prompt=y
10940                 set try
10941                 if eval $compile && ./try > /dev/null; then
10942                         dflt=`./try`
10943                         case "$dflt" in
10944                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10945                                 echo "(The test program ran ok.)"
10946                                 echo "byteorder=$dflt"
10947                                 xxx_prompt=n
10948                         ;;
10949                         ????|????????) echo "(The test program ran ok.)" ;;
10950                         *) echo "(The test program didn't run right for some reason.)" ;;
10951                         esac
10952                 else
10953                         dflt='4321'
10954                         cat <<'EOM'
10955 (I can't seem to compile the test program.  Guessing big-endian...)
10956 EOM
10957                 fi
10958                 case "$xxx_prompt" in
10959                 y)
10960                         rp="What is the order of bytes in a long?"
10961                         . ./myread
10962                         byteorder="$ans"
10963                         ;;
10964                 *)      byteorder=$dflt
10965                         ;;
10966                 esac
10967                 ;;
10968         esac
10969         $rm -f try.c try
10970         ;;
10971 esac
10972
10973
10974 : how do we catenate cpp tokens here?
10975 echo " "
10976 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10977 $cat >cpp_stuff.c <<'EOCP'
10978 #define RCAT(a,b)a/**/b
10979 #define ACAT(a,b)a ## b
10980 RCAT(Rei,ser)
10981 ACAT(Cir,cus)
10982 EOCP
10983 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10984 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10985         echo "Oh!  Smells like ANSI's been here." >&4
10986         echo "We can catify or stringify, separately or together!"
10987         cpp_stuff=42
10988 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10989         echo "Ah, yes!  The good old days!" >&4
10990         echo "However, in the good old days we don't know how to stringify and"
10991         echo "catify at the same time."
10992         cpp_stuff=1
10993 else
10994         $cat >&4 <<EOM
10995 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10996 to have to edit the values of CAT[2-5] in config.h...
10997 EOM
10998         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10999 fi
11000 $rm -f cpp_stuff.*
11001
11002 : see if this is a db.h system
11003 set db.h i_db
11004 eval $inhdr
11005
11006 case "$i_db" in
11007 $define)
11008         : Check db version.
11009         echo " "
11010         echo "Checking Berkeley DB version ..." >&4
11011         $cat >try.c <<EOCP
11012 #$d_const HASCONST
11013 #ifndef HASCONST
11014 #define const
11015 #endif
11016 #include <sys/types.h>
11017 #include <stdio.h>
11018 #include <db.h>
11019 int main()
11020 {
11021 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11022     int Major, Minor, Patch ;
11023     unsigned long Version ;
11024     (void)db_version(&Major, &Minor, &Patch) ;
11025     printf("You have Berkeley DB Version 2 or greater\n");
11026
11027     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11028                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11029     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11030                 Major, Minor, Patch) ;
11031
11032     /* check that db.h & libdb are compatible */
11033     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11034         printf("db.h and libdb are incompatible\n") ;
11035         exit(3);        
11036     }
11037
11038     printf("db.h and libdb are compatible\n") ;
11039
11040     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11041                 + DB_VERSION_PATCH ;
11042
11043     /* needs to be >= 2.3.4 */
11044     if (Version < 2003004) {
11045     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11046         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11047         exit(2);        
11048     }
11049
11050     exit(0);
11051 #else
11052 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11053     printf("You have Berkeley DB Version 1\n");
11054     exit(0);    /* DB version < 2: the coast is clear. */
11055 #else
11056     exit(1);    /* <db.h> not Berkeley DB? */
11057 #endif
11058 #endif
11059 }
11060 EOCP
11061         set try
11062         if eval $compile && ./try; then
11063                 echo 'Looks OK.' >&4
11064         else
11065                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11066                 i_db=$undef
11067                 case " $libs " in
11068                 *"-ldb "*)
11069                         : Remove db from list of libraries to use
11070                         echo "Removing unusable -ldb from library list" >&4
11071                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11072                         shift
11073                         libs="$*"
11074                         echo "libs = $libs" >&4
11075                         ;;
11076                 esac
11077         fi
11078         $rm -f try.*
11079         ;;
11080 esac
11081
11082 case "$i_db" in
11083 define)
11084         : Check the return type needed for hash 
11085         echo " "
11086         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11087         $cat >try.c <<EOCP
11088 #$d_const HASCONST
11089 #ifndef HASCONST
11090 #define const
11091 #endif
11092 #include <sys/types.h>
11093 #include <db.h>
11094
11095 #ifndef DB_VERSION_MAJOR
11096 u_int32_t hash_cb (ptr, size)
11097 const void *ptr;
11098 size_t size;
11099 {
11100 }
11101 HASHINFO info;
11102 int main()
11103 {
11104         info.hash = hash_cb;
11105 }
11106 #endif
11107 EOCP
11108         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11109                 if $contains warning try.out >>/dev/null 2>&1 ; then
11110                         db_hashtype='int'
11111                 else
11112                         db_hashtype='u_int32_t'
11113                 fi
11114         else
11115                 : XXX Maybe we should just give up here.
11116                 db_hashtype=u_int32_t
11117                 $cat try.out >&4
11118                 echo "Help:  I can't seem to compile the db test program." >&4
11119                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11120         fi
11121         $rm -f try.*
11122         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11123         ;;
11124 *)      db_hashtype=u_int32_t
11125         ;;
11126 esac
11127 case "$i_db" in
11128 define)
11129         : Check the return type needed for prefix 
11130         echo " "
11131         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11132         cat >try.c <<EOCP
11133 #$d_const HASCONST
11134 #ifndef HASCONST
11135 #define const
11136 #endif
11137 #include <sys/types.h>
11138 #include <db.h>
11139
11140 #ifndef DB_VERSION_MAJOR
11141 size_t prefix_cb (key1, key2)
11142 const DBT *key1;
11143 const DBT *key2;
11144 {
11145 }
11146 BTREEINFO info;
11147 int main()
11148 {
11149         info.prefix = prefix_cb;
11150 }
11151 #endif
11152 EOCP
11153         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11154                 if $contains warning try.out >>/dev/null 2>&1 ; then
11155                         db_prefixtype='int'
11156                 else
11157                         db_prefixtype='size_t'
11158                 fi
11159         else
11160                 db_prefixtype='size_t'
11161                 : XXX Maybe we should just give up here.
11162                 $cat try.out >&4
11163                 echo "Help:  I can't seem to compile the db test program." >&4
11164                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11165         fi
11166         $rm -f try.*
11167         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11168         ;;
11169 *)      db_prefixtype='size_t'
11170         ;;
11171 esac
11172
11173 : check for void type
11174 echo " "
11175 echo "Checking to see how well your C compiler groks the void type..." >&4
11176 case "$voidflags" in
11177 '')
11178         $cat >try.c <<'EOCP'
11179 #if TRY & 1
11180 void sub() {
11181 #else
11182 sub() {
11183 #endif
11184         extern void moo();      /* function returning void */
11185         void (*goo)();          /* ptr to func returning void */
11186 #if TRY & 8
11187         void *hue;              /* generic ptr */
11188 #endif
11189 #if TRY & 2
11190         void (*foo[10])();
11191 #endif
11192
11193 #if TRY & 4
11194         if(goo == moo) {
11195                 exit(0);
11196         }
11197 #endif
11198         exit(0);
11199 }
11200 int main() { sub(); }
11201 EOCP
11202         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11203                 voidflags=$defvoidused
11204         echo "Good.  It appears to support void to the level $package wants.">&4
11205                 if $contains warning .out >/dev/null 2>&1; then
11206                         echo "However, you might get some warnings that look like this:"
11207                         $cat .out
11208                 fi
11209         else
11210 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11211                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11212                         echo "It supports 1..."
11213                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11214                                 echo "It also supports 2..."
11215                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11216                                         voidflags=7
11217                                         echo "And it supports 4 but not 8 definitely."
11218                                 else
11219                                         echo "It doesn't support 4..."
11220                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11221                                                 voidflags=11
11222                                                 echo "But it supports 8."
11223                                         else
11224                                                 voidflags=3
11225                                                 echo "Neither does it support 8."
11226                                         fi
11227                                 fi
11228                         else
11229                                 echo "It does not support 2..."
11230                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11231                                         voidflags=13
11232                                         echo "But it supports 4 and 8."
11233                                 else
11234                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11235                                                 voidflags=5
11236                                                 echo "And it supports 4 but has not heard about 8."
11237                                         else
11238                                                 echo "However it supports 8 but not 4."
11239                                         fi
11240                                 fi
11241                         fi
11242                 else
11243                         echo "There is no support at all for void."
11244                         voidflags=0
11245                 fi
11246         fi
11247 esac
11248 case "$voidflags" in
11249 "$defvoidused") ;;
11250 *)      $cat >&4 <<'EOM'
11251   Support flag bits are:
11252     1: basic void declarations.
11253     2: arrays of pointers to functions returning void.
11254     4: operations between pointers to and addresses of void functions.
11255     8: generic void pointers.
11256 EOM
11257         dflt="$voidflags";
11258         rp="Your void support flags add up to what?"
11259         . ./myread
11260         voidflags="$ans"
11261         ;;
11262 esac
11263 $rm -f try.* .out
11264
11265
11266 : How can we generate normalized random numbers ?
11267 echo " "
11268 echo "Looking for a random number function..." >&4
11269 case "$randfunc" in
11270 '')
11271         if set drand48 val -f; eval $csym; $val; then
11272                 dflt="drand48"
11273                 echo "Good, found drand48()." >&4
11274         elif set random val -f; eval $csym; $val; then
11275                 dflt="random"
11276                 echo "OK, found random()." >&4
11277         else
11278                 dflt="rand"
11279                 echo "Yick, looks like I have to use rand()." >&4
11280         fi
11281         echo " "
11282         ;;
11283 *)
11284         dflt="$randfunc"
11285         ;;
11286 esac
11287 cont=true
11288
11289 case "$ccflags" in
11290 *-Dmy_rand=*|*-Dmy_srand=*)
11291         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11292         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11293         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11294         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11295         ;;
11296 esac
11297
11298 while $test "$cont"; do
11299         rp="Use which function to generate random numbers?"
11300         . ./myread
11301         if $test "$ans" = "$dflt"; then
11302                 : null
11303         else
11304                 randbits=''
11305         fi
11306         randfunc="$ans"
11307         if set $ans val -f; eval $csym; $val; then
11308                 cont=''
11309         else
11310                 dflt=y
11311                 rp="I cannot find function $ans. Use that name anyway?"
11312                 . ./myread
11313                 dflt=rand
11314                 case "$ans" in
11315                         [yY]*) cont='';;
11316                 esac
11317         fi
11318         case "$cont" in
11319         '')
11320                 case "$randfunc" in
11321                 drand48)
11322                         drand01="drand48()"
11323                         seedfunc="srand48"
11324                         randbits=48
11325                         randseedtype=long
11326                         ;;
11327                 rand|random)
11328                         case "$randbits" in
11329                         '')
11330 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11331                                 $cat >try.c <<EOCP
11332 #$i_unistd I_UNISTD
11333 #$i_stdlib I_STDLIB
11334 #include <stdio.h>
11335 #ifdef I_UNISTD
11336 #  include <unistd.h>
11337 #endif
11338 #ifdef I_STDLIB
11339 #  include <stdlib.h>
11340 #endif
11341 int main()
11342 {
11343         register int i;
11344         register unsigned long tmp;
11345         register unsigned long max = 0L;
11346
11347         for (i = 1000; i; i--) {
11348                 tmp = (unsigned long) $randfunc();
11349                 if (tmp > max) max = tmp;
11350         }
11351         for (i = 0; max; i++)
11352                 max /= 2;
11353         printf("%d\n",i);
11354 }
11355 EOCP
11356                                 set try
11357                                 if eval $compile_ok; then
11358                                         dflt=`try`
11359                                 else
11360                                         dflt='?'
11361                                         echo "(I can't seem to compile the test program...)"
11362                                 fi
11363                                 ;;
11364                         *)
11365                                 dflt="$randbits"
11366                                 ;;
11367                         esac
11368                         rp="How many bits does your $randfunc() function produce?"
11369                         . ./myread
11370                         randbits="$ans"
11371                         $rm -f try.c try
11372                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11373                         seedfunc="s$randfunc"
11374                         randseedtype=unsigned
11375                         ;;
11376                 *)
11377                         dflt="31"
11378                         rp="How many bits does your $randfunc() function produce?"
11379                         . ./myread
11380                         randbits="$ans"
11381                         seedfunc="s$randfunc"
11382                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11383                         if set $seedfunc val -f; eval $csym; $val; then
11384                                 echo "(Using $seedfunc() to seed random generator)"
11385                         else
11386                                 echo "(Warning: no $seedfunc() to seed random generator)"
11387                                 seedfunc=rand
11388                         fi
11389                         randseedtype=unsigned
11390                         ;;
11391                 esac
11392                 ;;
11393         esac
11394 done
11395
11396 echo " "
11397 echo "Determining whether or not we are on an EBCDIC system..." >&4
11398 $cat >tebcdic.c <<'EOM'
11399 int main()
11400 {
11401   if ('M'==0xd4) return 0;
11402   return 1;
11403 }
11404 EOM
11405
11406 val=$undef
11407 set tebcdic
11408 if eval $compile_ok; then
11409         if ./tebcdic; then
11410                 echo "You have EBCDIC." >&4
11411                 val="$define"
11412         else
11413                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11414         fi
11415 else
11416         echo "I'm unable to compile the test program." >&4
11417         echo "I'll assume ASCII or some ISO Latin." >&4
11418 fi
11419 $rm -f tebcdic.c tebcdic
11420 set ebcdic
11421 eval $setvar
11422
11423 echo " "
11424 $cat >&4 <<EOM
11425 Checking how to flush all pending stdio output...
11426 EOM
11427 # I only know how to find the first 32 possibly open files on SunOS.
11428 # See also hints/sunos_4_1.sh and util.c  --AD
11429 case "$osname" in
11430 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11431 esac
11432 $cat >>try.c <<EOCP
11433 #include <stdio.h>
11434 #$i_unistd I_UNISTD
11435 #ifdef I_UNISTD
11436 # include <unistd.h>
11437 #endif
11438 #$d_sysconf HAS_SYSCONF
11439 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11440 #ifdef HAS_STDIO_STREAM_ARRAY
11441 # define STDIO_STREAM_ARRAY $stdio_stream_array
11442 #endif
11443 int main() {
11444   FILE* p = fopen("try.out", "w");
11445 #ifdef TRY_FPUTC
11446   fputc('x', p);
11447 #else
11448 # ifdef TRY_FPRINTF
11449   fprintf(p, "x");
11450 # endif
11451 #endif
11452 #ifdef TRY_FFLUSH_NULL
11453   fflush(NULL);
11454 #endif
11455 #ifdef TRY_FFLUSH_ALL
11456   {
11457     long open_max = -1;
11458 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11459     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11460 # else
11461 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11462     open_max = sysconf(_SC_OPEN_MAX);
11463 #  else
11464 #   ifdef FOPEN_MAX
11465     open_max = FOPEN_MAX;
11466 #   else
11467 #    ifdef OPEN_MAX
11468     open_max = OPEN_MAX;
11469 #    else
11470 #     ifdef _NFILE
11471     open_max = _NFILE;
11472 #     endif
11473 #    endif
11474 #   endif
11475 #  endif
11476 # endif 
11477 # ifdef HAS_STDIO_STREAM_ARRAY
11478     if (open_max > 0) {
11479       long i;
11480       for (i = 0; i < open_max; i++)
11481             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11482                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11483                 STDIO_STREAM_ARRAY[i]._flag)
11484                 fflush(&STDIO_STREAM_ARRAY[i]);
11485     }   
11486   }
11487 # endif
11488 #endif
11489   _exit(42);
11490 }
11491 EOCP
11492 : first we have to find out how _not_ to flush
11493 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11494     output=''
11495     set try -DTRY_FPUTC
11496     if eval $compile; then
11497             $rm -f try.out
11498             ./try$exe_ext 2>/dev/null
11499             if $test ! -s try.out -a "X$?" = X42; then
11500                 output=-DTRY_FPUTC
11501             fi
11502     fi
11503     case "$output" in
11504     '')
11505             set try -DTRY_FPRINTF
11506             $rm -f try.out
11507             if eval $compile; then
11508                     $rm -f try.out
11509                     ./try$exe_ext 2>/dev/null
11510                     if $test ! -s try.out -a "X$?" = X42; then
11511                         output=-DTRY_FPRINTF
11512                     fi
11513             fi
11514         ;;
11515     esac
11516 fi
11517 : check for fflush NULL behaviour
11518 case "$fflushNULL" in
11519 '')     set try -DTRY_FFLUSH_NULL $output
11520         if eval $compile; then
11521                 $rm -f try.out
11522                 ./try$exe_ext 2>/dev/null
11523                 code="$?"
11524                 if $test -s try.out -a "X$code" = X42; then
11525                         fflushNULL="`$cat try.out`"
11526                 else
11527                         if $test "X$code" != X42; then
11528                                 $cat >&4 <<EOM
11529 (If this test failed, don't worry, we'll try another method shortly.)
11530 EOM
11531                         fi
11532                 fi
11533         fi
11534         $rm -f core try.core core.try.*
11535         case "$fflushNULL" in
11536         x)      $cat >&4 <<EOM
11537 Your fflush(NULL) works okay.
11538 EOM
11539                 fflushNULL="$define"
11540                 ;;
11541         '')     $cat >&4 <<EOM
11542 Your fflush(NULL) isn't working (contrary to ANSI C).
11543 EOM
11544                 fflushNULL="$undef"
11545                 ;;
11546         *)      $cat >&4 <<EOM
11547 Cannot figure out whether your fflush(NULL) works or not.
11548 I'm assuming it doesn't (contrary to ANSI C).
11549 EOM
11550                 fflushNULL="$undef"
11551                 ;;
11552         esac
11553         ;;
11554 $define|true|[yY]*)
11555         fflushNULL="$define"
11556         ;;
11557 *)
11558         fflushNULL="$undef"
11559         ;;
11560 esac
11561 : check explicit looping only if NULL did not work
11562 case "$fflushNULL" in
11563 "$undef")
11564         : check for fflush all behaviour
11565         case "$fflushall" in
11566         '')     set try -DTRY_FFLUSH_ALL $output
11567                 if eval $compile; then
11568                         $cat >&4 <<EOM
11569 (Now testing the other method--but note that also this may fail.)
11570 EOM
11571                         $rm -f try.out
11572                         ./try$exe_ext 2>/dev/null
11573                         if $test -s try.out -a "X$?" = X42; then
11574                                 fflushall="`$cat try.out`"
11575                         fi
11576                 fi
11577                 $rm -f core try.core core.try.*
11578                 case "$fflushall" in
11579                 x)      $cat >&4 <<EOM
11580 Whew. Flushing explicitly all the stdio streams works.
11581 EOM
11582                         fflushall="$define"
11583                         ;;
11584                 '')     $cat >&4 <<EOM
11585 Sigh. Flushing explicitly all the stdio streams doesn't work.
11586 EOM
11587                         fflushall="$undef"
11588                         ;;
11589                 *)      $cat >&4 <<EOM
11590 Cannot figure out whether flushing stdio streams explicitly works or not.
11591 I'm assuming it doesn't.
11592 EOM
11593                         fflushall="$undef"
11594                         ;;
11595                 esac
11596                 ;;
11597         "$define"|true|[yY]*)
11598                 fflushall="$define"
11599                 ;;
11600         *)
11601                 fflushall="$undef"
11602                 ;;
11603         esac
11604         ;;
11605 *)      fflushall="$undef"      
11606         ;;
11607 esac
11608 case "$fflushNULL$fflushall" in
11609 undefundef)
11610         $cat <<EOM
11611 I cannot figure out how to flush pending stdio output.
11612 EOM
11613         ;;
11614 esac
11615 $rm -f try.* try$exe_ext
11616
11617 : see what type file positions are declared as in the library
11618 rp="What is the type for file position used by fsetpos()?"
11619 set fpos_t fpostype long stdio.h sys/types.h
11620 eval $typedef_ask
11621
11622 : Store the full pathname to the ar program for use in the C program
11623 : Respect a hint or command line value for full_ar.
11624 case "$full_ar" in
11625 '') full_ar=$ar ;;
11626 esac
11627
11628 : Store the full pathname to the sed program for use in the C program
11629 full_sed=$sed
11630
11631 : see what type gids are declared as in the kernel
11632 echo " "
11633 echo "Looking for the type for group ids returned by getgid()."
11634 set gid_t gidtype xxx stdio.h sys/types.h
11635 eval $typedef
11636 case "$gidtype" in
11637 xxx)
11638         xxx=`./findhdr sys/user.h`
11639         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11640         case $1 in
11641         unsigned) dflt="$1 $2" ;;
11642         *) dflt="$1" ;;
11643         esac
11644         ;;
11645 *) dflt="$gidtype";;
11646 esac
11647 case "$gidtype" in
11648 gid_t) echo "gid_t found." ;;
11649 *)      rp="What is the type for group ids returned by getgid()?"
11650         . ./myread
11651         gidtype="$ans"
11652         ;;
11653 esac
11654
11655 : see if getgroups exists
11656 set getgroups d_getgrps
11657 eval $inlibc
11658
11659 : see if setgroups exists
11660 set setgroups d_setgrps
11661 eval $inlibc
11662
11663
11664 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11665 echo " "
11666 case "$d_getgrps$d_setgrps" in
11667 *define*)
11668         case "$groupstype" in
11669         '') dflt="$gidtype" ;;
11670         *)  dflt="$groupstype" ;;
11671         esac
11672         $cat <<EOM
11673 What type of pointer is the second argument to getgroups() and setgroups()?
11674 Usually this is the same as group ids, $gidtype, but not always.
11675
11676 EOM
11677         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11678         . ./myread
11679         groupstype="$ans"
11680         ;;
11681 *)  groupstype="$gidtype";;
11682 esac
11683
11684 : see what type lseek is declared as in the kernel
11685 rp="What is the type used for lseek's offset on this system?"
11686 set off_t lseektype long stdio.h sys/types.h
11687 eval $typedef_ask
11688
11689 echo " "
11690 $echo $n "Checking to see how big your file offsets are...$c" >&4
11691 $cat >try.c <<EOCP
11692 #include <sys/types.h>
11693 #include <stdio.h>
11694 int main()
11695 {
11696         printf("%d\n", sizeof($lseektype));
11697 }
11698 EOCP
11699 set try
11700 if eval $compile_ok; then
11701         lseeksize=`./try`
11702         $echo " $lseeksize bytes." >&4
11703 else
11704         dflt='4'
11705         echo " "
11706         echo "(I can't seem to compile the test program.  Guessing...)"
11707         rp="What is the size of your file offsets (in bytes)?"
11708         . ./myread
11709         lseeksize="$ans"
11710 fi
11711 $rm -f try.c try
11712
11713 echo " "
11714 echo "Checking if your $make program sets \$(MAKE)..." >&4
11715 case "$make_set_make" in
11716 '')
11717         $sed 's/^X //' > testmake.mak << 'EOF'
11718 Xall:
11719 X       @echo 'maketemp="$(MAKE)"'
11720 EOF
11721         case "`$make -f testmake.mak 2>/dev/null`" in
11722         *maketemp=*) make_set_make='#' ;;
11723         *)      make_set_make="MAKE=$make" ;;
11724         esac
11725         $rm -f testmake.mak
11726         ;;
11727 esac
11728 case "$make_set_make" in
11729 '#') echo "Yup, it does.";;
11730 *) echo "Nope, it doesn't.";;
11731 esac
11732
11733 : see what type is used for mode_t
11734 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11735 set mode_t modetype int stdio.h sys/types.h
11736 eval $typedef_ask
11737
11738 : define a fucntion to check prototypes
11739 $cat > protochk <<EOSH
11740 $startsh
11741 cc="$cc"
11742 optimize="$optimize"
11743 ccflags="$ccflags"
11744 prototype="$prototype"
11745 define="$define"
11746 rm=$rm
11747 EOSH
11748
11749 $cat >> protochk <<'EOSH'
11750
11751 $rm -f try.c
11752 foo="$1"
11753 shift
11754 while test $# -ge 2; do
11755         case "$1" in
11756                 $define) echo "#include <$2>" >> try.c ;;
11757                 literal) echo "$2" >> try.c ;;
11758         esac
11759     shift 2
11760 done
11761 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11762 cat >> try.c <<'EOCP'
11763 #ifdef CAN_PROTOTYPE
11764 #define _(args) args
11765 #else
11766 #define _(args) ()
11767 #endif
11768 EOCP
11769 echo "$foo" >> try.c
11770 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11771 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11772 status=$?
11773 $rm -f try.[co]
11774 exit $status
11775 EOSH
11776 chmod +x protochk
11777 $eunicefix protochk
11778
11779 : see what type is used for size_t
11780 rp="What is the type used for the length parameter for string functions?"
11781 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11782 eval $typedef_ask
11783
11784 : check for type of arguments to gethostbyaddr. 
11785 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11786         case "$d_gethbyaddr" in
11787         $define)
11788                 $cat <<EOM
11789
11790 Checking to see what type of arguments are accepted by gethostbyaddr().
11791 EOM
11792                 hdrs="$define sys/types.h
11793                         $d_socket sys/socket.h 
11794                         $i_niin netinet/in.h 
11795                         $i_netdb netdb.h
11796                         $i_unistd unistd.h"
11797                 : The first arg can 'char *' or 'void *'
11798                 : The second arg is some of integral type
11799                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11800                         for yyy in size_t long int; do
11801                                 case "$netdb_host_type" in
11802                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11803                                         if ./protochk "$try" $hdrs; then
11804                                                 echo "Your system accepts $xxx for the first arg."
11805                                                 echo "...and $yyy for the second arg."
11806                                                 netdb_host_type="$xxx"
11807                                                 netdb_hlen_type="$yyy"
11808                                         fi
11809                                         ;;
11810                                 esac
11811                         done
11812                 done
11813                 : In case none of those worked, prompt the user.
11814                 case "$netdb_host_type" in
11815                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11816                         dflt='char *'
11817                         . ./myread
11818                         netdb_host_type=$ans
11819                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11820                         dflt="$sizetype"
11821                         . ./myread
11822                         netdb_hlen_type=$ans
11823                         ;;
11824                 esac
11825                 ;;
11826         *)      : no gethostbyaddr, so pick harmless defaults
11827                 netdb_host_type='char *'
11828                 netdb_hlen_type="$sizetype"
11829                 ;;
11830         esac
11831         # Remove the "const" if needed. -- but then we'll have a 
11832         # prototype clash!
11833         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11834 fi
11835
11836 : check for type of argument to gethostbyname. 
11837 if test "X$netdb_name_type" = X ; then
11838         case "$d_gethbyname" in
11839         $define)
11840                 $cat <<EOM
11841
11842 Checking to see what type of argument is accepted by gethostbyname().
11843 EOM
11844                 hdrs="$define sys/types.h
11845                         $d_socket sys/socket.h 
11846                         $i_niin netinet/in.h 
11847                         $i_netdb netdb.h
11848                         $i_unistd unistd.h"
11849                 for xxx in "const char *" "char *"; do
11850                         case "$netdb_name_type" in
11851                         '')     try="extern struct hostent *gethostbyname($xxx);"
11852                                 if ./protochk "$try" $hdrs; then
11853                                         echo "Your system accepts $xxx."
11854                                         netdb_name_type="$xxx"
11855                                 fi
11856                                 ;;
11857                         esac
11858                 done
11859                 : In case none of those worked, prompt the user.
11860                 case "$netdb_name_type" in
11861                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11862                         dflt='char *'
11863                         . ./myread
11864                         netdb_name_type=$ans
11865                         ;;
11866                 esac
11867                 ;;
11868         *)      : no gethostbyname, so pick harmless default
11869                 netdb_name_type='char *'
11870                 ;;
11871         esac
11872 fi
11873
11874 : check for type of 1st argument to getnetbyaddr. 
11875 if test "X$netdb_net_type" = X ; then
11876         case "$d_getnbyaddr" in
11877         $define)
11878                 $cat <<EOM
11879
11880 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11881 EOM
11882                 hdrs="$define sys/types.h
11883                         $d_socket sys/socket.h 
11884                         $i_niin netinet/in.h 
11885                         $i_netdb netdb.h
11886                         $i_unistd unistd.h"
11887                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11888                         case "$netdb_net_type" in
11889                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11890                                 if ./protochk "$try" $hdrs; then
11891                                         echo "Your system accepts $xxx."
11892                                         netdb_net_type="$xxx"
11893                                 fi
11894                                 ;;
11895                         esac
11896                 done
11897                 : In case none of those worked, prompt the user.
11898                 case "$netdb_net_type" in
11899                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11900                         dflt='long'
11901                         . ./myread
11902                         netdb_net_type=$ans
11903                         ;;
11904                 esac
11905                 ;;
11906         *)      : no getnetbyaddr, so pick harmless default
11907                 netdb_net_type='long'
11908                 ;;
11909         esac
11910 fi
11911 : locate the preferred pager for this system
11912 case "$pager" in
11913 '')
11914         dflt=''
11915         case "$pg" in
11916         /*) dflt=$pg;;
11917         esac
11918         case "$more" in
11919         /*) dflt=$more;;
11920         esac
11921         case "$less" in
11922         /*) dflt=$less;;
11923         esac
11924         case "$dflt" in
11925         '') dflt=/usr/ucb/more;;
11926         esac
11927         ;;
11928 *) dflt="$pager";;
11929 esac
11930 echo " "
11931 fn=f/
11932 rp='What pager is used on your system?'
11933 . ./getfile
11934 pager="$ans"
11935
11936 : see what type pids are declared as in the kernel
11937 rp="What is the type of process ids on this system?"
11938 set pid_t pidtype int stdio.h sys/types.h
11939 eval $typedef_ask
11940
11941 : check for length of pointer
11942 echo " "
11943 case "$ptrsize" in
11944 '')
11945         $echo $n "Checking to see how big your pointers are...$c" >&4
11946         if test "$voidflags" -gt 7; then
11947                 echo '#define VOID_PTR char *' > try.c
11948         else
11949                 echo '#define VOID_PTR void *' > try.c
11950         fi
11951         $cat >>try.c <<'EOCP'
11952 #include <stdio.h>
11953 int main()
11954 {
11955         printf("%d\n", sizeof(VOID_PTR));
11956         exit(0);
11957 }
11958 EOCP
11959         set try
11960         if eval $compile_ok; then
11961                 ptrsize=`./try`
11962                 $echo " $ptrsize bytes." >&4
11963         else
11964                 dflt='4'
11965                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11966                 rp="What is the size of a pointer (in bytes)?"
11967                 . ./myread
11968                 ptrsize="$ans"
11969         fi
11970         ;;
11971 esac
11972 $rm -f try.c try
11973
11974 : see if ar generates random libraries by itself
11975 echo " "
11976 echo "Checking how to generate random libraries on your machine..." >&4
11977 echo 'int bar1() { return bar2(); }' > bar1.c
11978 echo 'int bar2() { return 2; }' > bar2.c
11979 $cat > foo.c <<'EOP'
11980 int main() { printf("%d\n", bar1()); exit(0); }
11981 EOP
11982 $cc $ccflags -c bar1.c >/dev/null 2>&1
11983 $cc $ccflags -c bar2.c >/dev/null 2>&1
11984 $cc $ccflags -c foo.c >/dev/null 2>&1
11985 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11986 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11987         ./foobar >/dev/null 2>&1; then
11988         echo "$ar appears to generate random libraries itself."
11989         orderlib=false
11990         ranlib=":"
11991 elif $ar ts bar$_a >/dev/null 2>&1 &&
11992         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11993         ./foobar >/dev/null 2>&1; then
11994                 echo "a table of contents needs to be added with '$ar ts'."
11995                 orderlib=false
11996                 ranlib="$ar ts"
11997 else
11998         case "$ranlib" in
11999         :) ranlib='';;
12000         '')
12001                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12002                 $test -f $ranlib || ranlib=''
12003                 ;;
12004         esac
12005         if $test -n "$ranlib"; then
12006                 echo "your system has '$ranlib'; we'll use that."
12007                 orderlib=false
12008         else
12009                 echo "your system doesn't seem to support random libraries"
12010                 echo "so we'll use lorder and tsort to order the libraries."
12011                 orderlib=true
12012                 ranlib=":"
12013         fi
12014 fi
12015 $rm -f foo* bar* 
12016
12017 : check for type of arguments to select. 
12018 case "$selecttype" in
12019 '') case "$d_select" in
12020         $define)
12021                 $cat <<EOM
12022 Checking to see what type of arguments are accepted by select().
12023 EOM
12024                 hdrs="$define sys/types.h
12025                         $i_systime sys/time.h 
12026                         $i_sysselct sys/select.h
12027                         $d_socket sys/socket.h"
12028                 : The first arg can be int, unsigned, or size_t
12029                 : The last arg may or may not be 'const'
12030                 val=''
12031                 : void pointer has been seen but using that
12032                 : breaks the selectminbits test
12033                 for xxx in 'fd_set *' 'int *'; do
12034                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12035                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12036                                         case "$val" in
12037                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12038                                                 if ./protochk "$try" $hdrs; then
12039                                                         echo "Your system accepts $xxx."
12040                                                         val="$xxx"
12041                                                 fi
12042                                                 ;;
12043                                         esac
12044                                 done
12045                         done
12046                 done
12047                 case "$val" in
12048                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12049                         case "$d_fd_set" in
12050                                 $define) dflt="fd_set *" ;;
12051                                 *)              dflt="int *" ;;
12052                         esac
12053                         . ./myread
12054                         val=$ans
12055                         ;;
12056                 esac
12057                 selecttype="$val"
12058                 ;;
12059         *)      : no select, so pick a harmless default
12060                 selecttype='int *'
12061                 ;;
12062         esac
12063         ;;
12064 esac
12065
12066 : check for the select 'width'
12067 case "$selectminbits" in
12068 '') case "$d_select" in
12069         $define)
12070                 $cat <<EOM
12071
12072 Checking to see on how many bits at a time your select() operates...
12073 EOM
12074                 $cat >try.c <<EOCP
12075 #include <sys/types.h>
12076 #$i_time I_TIME
12077 #$i_systime I_SYS_TIME
12078 #$i_systimek I_SYS_TIME_KERNEL
12079 #ifdef I_TIME
12080 #   include <time.h>
12081 #endif
12082 #ifdef I_SYS_TIME
12083 #   ifdef I_SYS_TIME_KERNEL
12084 #       define KERNEL
12085 #   endif
12086 #   include <sys/time.h>
12087 #   ifdef I_SYS_TIME_KERNEL
12088 #       undef KERNEL
12089 #   endif
12090 #endif
12091 #$i_sysselct I_SYS_SELECT
12092 #ifdef I_SYS_SELECT
12093 #include <sys/select.h>
12094 #endif
12095 #$d_socket HAS_SOCKET
12096 #ifdef HAS_SOCKET
12097 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12098 #endif
12099 #include <stdio.h>
12100 $selecttype b;
12101 #define S sizeof(*(b))
12102 #define MINBITS 64
12103 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12104 #define NBITS  (NBYTES * 8)
12105 int main() {
12106     char s[NBYTES];
12107     struct timeval t;
12108     int i;
12109     FILE* fp;
12110     int fd;
12111
12112     fclose(stdin);
12113     fp = fopen("try.c", "r");
12114     if (fp == 0)
12115       exit(1);
12116     fd = fileno(fp);
12117     if (fd < 0)
12118       exit(2);
12119     b = ($selecttype)s;
12120     for (i = 0; i < NBITS; i++)
12121         FD_SET(i, b);
12122     t.tv_sec  = 0;
12123     t.tv_usec = 0;
12124     select(fd + 1, b, 0, 0, &t);
12125     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12126     printf("%d\n", i + 1);
12127     return 0;
12128 }
12129 EOCP
12130                 set try
12131                 if eval $compile_ok; then
12132                         selectminbits=`./try`
12133                         case "$selectminbits" in
12134                         '')     cat >&4 <<EOM
12135 Cannot figure out on how many bits at a time your select() operates.
12136 I'll play safe and guess it is 32 bits.
12137 EOM
12138                                 selectminbits=32
12139                                 bits="32 bits"
12140                                 ;;
12141                         1)      bits="1 bit" ;;
12142                         *)      bits="$selectminbits bits" ;;
12143                         esac
12144                         echo "Your select() operates on $bits at a time." >&4
12145                 else
12146                         rp='What is the minimum number of bits your select() operates on?'
12147                         case "$byteorder" in
12148                         1234|12345678)  dflt=32 ;;
12149                         *)              dflt=1  ;;
12150                         esac
12151                         . ./myread
12152                         val=$ans
12153                         selectminbits="$val"
12154                 fi
12155                 $rm -f try.* try
12156                 ;;
12157         *)      : no select, so pick a harmless default
12158                 selectminbits='32'
12159                 ;;
12160         esac
12161         ;;
12162 esac
12163
12164 : Trace out the files included by signal.h, then look for SIGxxx names.
12165 : Remove SIGARRAYSIZE used by HPUX.
12166 : Remove SIGSTKSIZE used by Linux.
12167 : Remove SIGSTKSZ used by Posix.
12168 : Remove SIGTYP void lines used by OS2.
12169 xxx=`echo '#include <signal.h>' |
12170         $cppstdin $cppminus $cppflags 2>/dev/null |
12171         $grep '^[       ]*#.*include' | 
12172         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12173 : Check this list of files to be sure we have parsed the cpp output ok.
12174 : This will also avoid potentially non-existent files, such 
12175 : as ../foo/bar.h
12176 xxxfiles=''
12177 for xx in $xxx /dev/null ; do
12178         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12179 done
12180 : If we have found no files, at least try signal.h
12181 case "$xxxfiles" in
12182 '')     xxxfiles=`./findhdr signal.h` ;;
12183 esac
12184 xxx=`awk '
12185 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12186         print substr($2, 4, 20)
12187 }
12188 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12189         print substr($3, 4, 20)
12190 }' $xxxfiles`
12191 : Append some common names just in case the awk scan failed.
12192 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12193 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12194 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12195 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12196 : generate a few handy files for later
12197 $cat > signal.c <<'EOCP'
12198 #include <sys/types.h>
12199 #include <signal.h>
12200 #include <stdio.h>
12201 int main() {
12202
12203 /* Strange style to avoid deeply-nested #if/#else/#endif */
12204 #ifndef NSIG
12205 #  ifdef _NSIG
12206 #    define NSIG (_NSIG)
12207 #  endif
12208 #endif
12209
12210 #ifndef NSIG
12211 #  ifdef SIGMAX
12212 #    define NSIG (SIGMAX+1)
12213 #  endif
12214 #endif
12215
12216 #ifndef NSIG
12217 #  ifdef SIG_MAX
12218 #    define NSIG (SIG_MAX+1)
12219 #  endif
12220 #endif
12221
12222 #ifndef NSIG
12223 #  ifdef MAXSIG
12224 #    define NSIG (MAXSIG+1)
12225 #  endif
12226 #endif
12227
12228 #ifndef NSIG
12229 #  ifdef MAX_SIG
12230 #    define NSIG (MAX_SIG+1)
12231 #  endif
12232 #endif
12233
12234 #ifndef NSIG
12235 #  ifdef SIGARRAYSIZE
12236 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12237 #  endif
12238 #endif
12239
12240 #ifndef NSIG
12241 #  ifdef _sys_nsig
12242 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12243 #  endif
12244 #endif
12245
12246 /* Default to some arbitrary number that's big enough to get most
12247    of the common signals.
12248 */
12249 #ifndef NSIG
12250 #    define NSIG 50
12251 #endif
12252
12253 printf("NSIG %d\n", NSIG);
12254
12255 #ifndef JUST_NSIG
12256
12257 EOCP
12258
12259 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12260 {
12261         printf "#ifdef SIG"; printf $1; printf "\n"
12262         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12263         printf $1; printf ");\n"
12264         printf "#endif\n"
12265 }
12266 END {
12267         printf "#endif /* JUST_NSIG */\n";
12268         printf "}\n";
12269 }
12270 ' >>signal.c
12271 $cat >signal.awk <<'EOP'
12272 BEGIN { ndups = 0 }
12273 $1 ~ /^NSIG$/ { nsig = $2 }
12274 ($1 !~ /^NSIG$/) && (NF == 2) {
12275     if ($2 > maxsig) { maxsig = $2 }
12276     if (sig_name[$2]) {
12277         dup_name[ndups] = $1
12278         dup_num[ndups] = $2
12279         ndups++ 
12280     }
12281     else {
12282         sig_name[$2] = $1
12283         sig_num[$2] = $2
12284     }
12285 }
12286 END { 
12287     if (nsig == 0) {
12288         nsig = maxsig + 1
12289     }
12290     printf("NSIG %d\n", nsig);
12291     for (n = 1; n < nsig; n++) {
12292         if (sig_name[n]) {
12293             printf("%s %d\n", sig_name[n], sig_num[n])
12294         }
12295         else {
12296             printf("NUM%d %d\n", n, n) 
12297         }
12298     }
12299     for (n = 0; n < ndups; n++) {
12300         printf("%s %d\n", dup_name[n], dup_num[n])
12301     }
12302 }
12303 EOP
12304 $cat >signal_cmd <<EOS
12305 $startsh
12306 if $test -s signal.lst; then
12307     echo "Using your existing signal.lst file"
12308         exit 0
12309 fi
12310 xxx="$xxx"
12311 EOS
12312 $cat >>signal_cmd <<'EOS'
12313
12314 set signal
12315 if eval $compile_ok; then
12316         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12317 else
12318         echo "(I can't seem be able to compile the whole test program)" >&4
12319         echo "(I'll try it in little pieces.)" >&4
12320         set signal -DJUST_NSIG
12321         if eval $compile_ok; then
12322                 ./signal$_exe > signal.nsg
12323                 $cat signal.nsg
12324         else
12325                 echo "I can't seem to figure out how many signals you have." >&4
12326                 echo "Guessing 50." >&4
12327                 echo 'NSIG 50' > signal.nsg
12328         fi
12329         : Now look at all the signal names, one at a time.
12330         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12331                 $cat > signal.c <<EOCP
12332 #include <sys/types.h>
12333 #include <signal.h>
12334 #include <stdio.h>
12335 int main() {
12336 printf("$xx %d\n", SIG${xx});
12337 return 0;
12338 }
12339 EOCP
12340                 set signal
12341                 if eval $compile; then
12342                         echo "SIG${xx} found."
12343                         ./signal$_exe  >> signal.ls1
12344                 else
12345                         echo "SIG${xx} NOT found."
12346                 fi
12347         done
12348         if $test -s signal.ls1; then
12349                 $cat signal.nsg signal.ls1 |
12350                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12351         fi
12352
12353 fi
12354 if $test -s signal.lst; then
12355         :
12356 else
12357         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12358         echo 'kill -l' >signal
12359         set X `csh -f <signal`
12360         $rm -f signal
12361         shift
12362         case $# in
12363         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12364         esac
12365         echo $@ | $tr ' ' $trnl | \
12366             $awk '{ printf "%s %d\n", $1, ++s; }
12367                   END { printf "NSIG %d\n", ++s }' >signal.lst
12368 fi
12369 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12370 EOS
12371 chmod a+x signal_cmd
12372 $eunicefix signal_cmd
12373
12374 : generate list of signal names
12375 echo " "
12376 case "$sig_name_init" in
12377 '') doinit=yes ;;
12378 *)  case "$sig_num_init" in
12379     ''|*,*) doinit=yes ;;
12380     esac ;;
12381 esac
12382 case "$doinit" in
12383 yes)
12384         echo "Generating a list of signal names and numbers..." >&4
12385         . ./signal_cmd
12386         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12387         sig_name=`$awk 'BEGIN { printf "ZERO " }
12388                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12389         sig_num=`$awk  'BEGIN { printf "0 " }
12390                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12391         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12392                              !/^NSIG/   { printf "\"%s\", ", $1 }
12393                              END        { printf "0\n" }' signal.lst`
12394         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12395                              !/^NSIG/   { printf "%d, ", $2}
12396                              END        { printf "0\n"}' signal.lst`
12397         ;;
12398 esac
12399 echo "The following $sig_count signals are available:"
12400 echo " "
12401 echo $sig_name | $awk \
12402 'BEGIN { linelen = 0 }
12403 {
12404         for (i = 1; i <= NF; i++) {
12405                 name = "SIG" $i " "
12406                 linelen = linelen + length(name)
12407                 if (linelen > 70) {
12408                         printf "\n"
12409                         linelen = length(name)
12410                 }
12411                 printf "%s", name
12412         }
12413         printf "\n"
12414 }'
12415 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12416
12417 : see what type is used for signed size_t
12418 set ssize_t ssizetype int stdio.h sys/types.h
12419 eval $typedef
12420 dflt="$ssizetype"
12421 $cat > ssize.c <<EOM
12422 #include <stdio.h>
12423 #include <sys/types.h>
12424 #define Size_t $sizetype
12425 #define SSize_t $dflt
12426 int main()
12427 {
12428         if (sizeof(Size_t) == sizeof(SSize_t))
12429                 printf("$dflt\n");
12430         else if (sizeof(Size_t) == sizeof(int))
12431                 printf("int\n");
12432         else 
12433                 printf("long\n");
12434         exit(0);
12435 }
12436 EOM
12437 echo " "
12438 set ssize
12439 if eval $compile_ok && ./ssize > /dev/null; then
12440         ssizetype=`./ssize`
12441         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12442 else
12443         $cat >&4 <<EOM
12444 Help! I can't compile and run the ssize_t test program: please enlighten me!
12445 (This is probably a misconfiguration in your system or libraries, and
12446 you really ought to fix it.  Still, I'll try anyway.)
12447
12448 I need a type that is the same size as $sizetype, but is guaranteed to
12449 be signed.  Common values are ssize_t, int and long.
12450
12451 EOM
12452         rp="What signed type is the same size as $sizetype?"
12453         . ./myread
12454         ssizetype="$ans"
12455 fi
12456 $rm -f ssize ssize.*
12457
12458 : see what type of char stdio uses.
12459 echo " "
12460 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12461         echo "Your stdio uses unsigned chars." >&4
12462         stdchar="unsigned char"
12463 else
12464         echo "Your stdio uses signed chars." >&4
12465         stdchar="char"
12466 fi
12467
12468 : see if time exists
12469 echo " "
12470 if test "X$d_time" = X -o X"$timetype" = X; then
12471     if set time val -f d_time; eval $csym; $val; then
12472                 echo 'time() found.' >&4
12473                 val="$define"
12474                 rp="What is the type returned by time() on this system?"
12475                 set time_t timetype long stdio.h sys/types.h
12476                 eval $typedef_ask
12477     else
12478                 echo 'time() not found, hope that will do.' >&4
12479                 val="$undef"
12480                 timetype='int';
12481     fi
12482     set d_time
12483     eval $setvar
12484 fi
12485
12486 : see what type uids are declared as in the kernel
12487 echo " "
12488 echo "Looking for the type for user ids returned by getuid()."
12489 set uid_t uidtype xxx stdio.h sys/types.h
12490 eval $typedef
12491 case "$uidtype" in
12492 xxx)
12493         xxx=`./findhdr sys/user.h`
12494         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12495         case $1 in
12496         unsigned) dflt="$1 $2" ;;
12497         *) dflt="$1" ;;
12498         esac
12499         ;;
12500 *) dflt="$uidtype";;
12501 esac
12502 case "$uidtype" in
12503 uid_t)  echo "uid_t found." ;;
12504 *)      rp="What is the type for user ids returned by getuid()?"
12505         . ./myread
12506         uidtype="$ans"
12507         ;;
12508 esac
12509
12510 : see if dbm.h is available
12511 : see if dbmclose exists
12512 set dbmclose d_dbmclose
12513 eval $inlibc
12514
12515 case "$d_dbmclose" in
12516 $define)
12517         set dbm.h i_dbm
12518         eval $inhdr
12519         case "$i_dbm" in
12520         $define)
12521                 val="$undef"
12522                 set i_rpcsvcdbm
12523                 eval $setvar
12524                 ;;
12525         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12526                 eval $inhdr
12527                 ;;
12528         esac
12529         ;;
12530 *)      echo "We won't be including <dbm.h>"
12531         val="$undef"
12532         set i_dbm
12533         eval $setvar
12534         val="$undef"
12535         set i_rpcsvcdbm
12536         eval $setvar
12537         ;;
12538 esac
12539
12540 : see if this is a sys/file.h system
12541 val=''
12542 set sys/file.h val
12543 eval $inhdr
12544
12545 : do we need to include sys/file.h ?
12546 case "$val" in
12547 "$define")
12548         echo " "
12549         if $h_sysfile; then
12550                 val="$define"
12551                 echo "We'll be including <sys/file.h>." >&4
12552         else
12553                 val="$undef"
12554                 echo "We won't be including <sys/file.h>." >&4
12555         fi
12556         ;;
12557 *)
12558         h_sysfile=false
12559         ;;
12560 esac
12561 set i_sysfile
12562 eval $setvar
12563
12564 : see if fcntl.h is there
12565 val=''
12566 set fcntl.h val
12567 eval $inhdr
12568
12569 : see if we can include fcntl.h
12570 case "$val" in
12571 "$define")
12572         echo " "
12573         if $h_fcntl; then
12574                 val="$define"
12575                 echo "We'll be including <fcntl.h>." >&4
12576         else
12577                 val="$undef"
12578                 if $h_sysfile; then
12579         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12580                 else
12581                         echo "We won't be including <fcntl.h>." >&4
12582                 fi
12583         fi
12584         ;;
12585 *)
12586         h_fcntl=false
12587         val="$undef"
12588         ;;
12589 esac
12590 set i_fcntl
12591 eval $setvar
12592
12593 : see if locale.h is available
12594 set locale.h i_locale
12595 eval $inhdr
12596
12597 : see if mach cthreads are available
12598 if test "X$usethreads" = "X$define"; then
12599         set mach/cthreads.h i_machcthr
12600         eval $inhdr
12601 else
12602         i_machcthr="$undef"
12603 fi
12604
12605
12606
12607 : see if this is a math.h system
12608 set math.h i_math
12609 eval $inhdr
12610
12611 : see if this is a mntent.h system
12612 set mntent.h i_mntent
12613 eval $inhdr
12614
12615 : see if ndbm.h is available
12616 set ndbm.h t_ndbm
12617 eval $inhdr
12618 case "$t_ndbm" in
12619 $define)
12620         : see if dbm_open exists
12621         set dbm_open d_dbm_open
12622         eval $inlibc
12623         case "$d_dbm_open" in
12624         $undef)
12625                 t_ndbm="$undef"
12626                 echo "We won't be including <ndbm.h>"
12627                 ;;
12628         esac
12629         ;;
12630 esac
12631 val="$t_ndbm"
12632 set i_ndbm
12633 eval $setvar
12634
12635 : see if net/errno.h is available
12636 val=''
12637 set net/errno.h val
12638 eval $inhdr
12639
12640 : Unfortunately, it causes problems on some systems.  Arrgh.
12641 case "$val" in
12642 $define)
12643         cat > try.c <<'EOM'
12644 #include <stdio.h>
12645 #include <errno.h>
12646 #include <net/errno.h>
12647 int func()
12648 {
12649         return ENOTSOCK;
12650 }
12651 EOM
12652         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12653                 echo "We'll be including <net/errno.h>." >&4
12654         else
12655                 echo "We won't be including <net/errno.h>." >&4
12656                 val="$undef"
12657         fi
12658         $rm -f try.* try
12659         ;;
12660 esac
12661 set i_neterrno
12662 eval $setvar
12663
12664 : see if netinet/tcp.h is available
12665 set netinet/tcp.h i_netinettcp
12666 eval $inhdr
12667
12668 : see if this is a poll.h system
12669 set poll.h i_poll
12670 eval $inhdr
12671
12672 : get C preprocessor symbols handy
12673 echo " "
12674 $echo $n "Hmm... $c"
12675 echo $al | $tr ' ' $trnl >Cppsym.know
12676 $cat <<EOSS >Cppsym
12677 $startsh
12678 case "\$1" in
12679 -l) list=true
12680         shift
12681         ;;
12682 esac
12683 unknown=''
12684 case "\$list\$#" in
12685 1|2)
12686         for sym do
12687                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12688                         exit 0
12689                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12690                         :
12691                 else
12692                         unknown="\$unknown \$sym"
12693                 fi
12694         done
12695         set X \$unknown
12696         shift
12697         ;;
12698 esac
12699 case \$# in
12700 0) exit 1;;
12701 esac
12702 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12703 #ifdef \1\\
12704 exit 0; _ _ _ _\1\\      \1\\
12705 #endif\\
12706 /' >Cppsym\$\$
12707 echo "exit 1; _ _ _" >>Cppsym\$\$
12708 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12709 case "\$list" in
12710 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12711 *)
12712         sh Cppsym2\$\$
12713         status=\$?
12714         ;;
12715 esac
12716 $rm -f Cppsym\$\$ Cppsym2\$\$
12717 exit \$status
12718 EOSS
12719 chmod +x Cppsym
12720 $eunicefix Cppsym
12721 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12722
12723 : now check the C compiler for additional symbols
12724 postprocess_cc_v=''
12725 case "$osname" in
12726 aix) postprocess_cc_v="|$tr , ' '" ;;
12727 esac
12728 $cat >ccsym <<EOS
12729 $startsh
12730 $cat >tmp.c <<EOF
12731 extern int foo;
12732 EOF
12733 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12734 do
12735         case "\$i" in
12736         -D*) echo "\$i" | $sed 's/^-D//';;
12737         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12738         esac
12739 done
12740 $rm -f try.c
12741 EOS
12742 postprocess_cc_v=''
12743 chmod +x ccsym
12744 $eunicefix ccsym
12745 ./ccsym > ccsym1.raw
12746 if $test -s ccsym1.raw; then
12747        $sort ccsym1.raw | $uniq >ccsym.raw
12748 else
12749        mv ccsym1.raw ccsym.raw
12750 fi
12751
12752 $awk '/\=/ { print $0; next }
12753         { print $0"=1" }' ccsym.raw >ccsym.list
12754 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12755 $comm -13 ccsym.true ccsym.list >ccsym.own
12756 $comm -12 ccsym.true ccsym.list >ccsym.com
12757 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12758 also=''
12759 if $test -z ccsym.raw; then
12760         echo "Your C compiler doesn't seem to define any symbols!" >&4
12761         echo " "
12762         echo "However, your C preprocessor defines the following symbols:"
12763         $cat Cppsym.true
12764         ccsymbols=''
12765         cppsymbols=`$cat Cppsym.true`
12766         cppsymbols=`echo $cppsymbols`
12767         cppccsymbols="$cppsymbols"
12768 else
12769         if $test -s ccsym.com; then
12770                 echo "Your C compiler and pre-processor define these symbols:"
12771                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12772                 also='also '
12773                 symbols='ones'
12774                 cppccsymbols=`$cat ccsym.com`
12775                 cppccsymbols=`echo $cppccsymbols`
12776                 $test "$silent" || sleep 1
12777         fi
12778         if $test -s ccsym.cpp; then
12779                 $test "$also" && echo " "
12780                 echo "Your C pre-processor ${also}defines the following symbols:"
12781                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12782                 also='further '
12783                 cppsymbols=`$cat ccsym.cpp`
12784                 cppsymbols=`echo $cppsymbols`
12785                 $test "$silent" || sleep 1
12786         fi
12787         if $test -s ccsym.own; then
12788                 $test "$also" && echo " "
12789                 echo "Your C compiler ${also}defines the following cpp symbols:"
12790                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12791                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12792                 ccsymbols=`$cat ccsym.own`
12793                 ccsymbols=`echo $ccsymbols`
12794                 $test "$silent" || sleep 1
12795         fi
12796 fi
12797 $rm -f ccsym*
12798
12799 : see if this is a termio system
12800 val="$undef"
12801 val2="$undef"
12802 val3="$undef"
12803 if $test `./findhdr termios.h`; then
12804         set tcsetattr i_termios
12805         eval $inlibc
12806         val3="$i_termios"
12807 fi
12808 echo " "
12809 case "$val3" in
12810 "$define") echo "You have POSIX termios.h... good!" >&4;;
12811 *) if ./Cppsym pyr; then
12812                 case "`/bin/universe`" in
12813                 ucb) if $test `./findhdr sgtty.h`; then
12814                                 val2="$define"
12815                                 echo "<sgtty.h> found." >&4
12816                         else
12817                                 echo "System is pyramid with BSD universe."
12818                                 echo "<sgtty.h> not found--you could have problems." >&4
12819                         fi;;
12820                 *) if $test `./findhdr termio.h`; then
12821                                 val="$define"
12822                                 echo "<termio.h> found." >&4
12823                         else
12824                                 echo "System is pyramid with USG universe."
12825                                 echo "<termio.h> not found--you could have problems." >&4
12826                         fi;;
12827                 esac
12828         elif ./usg; then
12829                 if $test `./findhdr termio.h`; then
12830                         echo "<termio.h> found." >&4
12831                         val="$define"
12832                 elif $test `./findhdr sgtty.h`; then
12833                         echo "<sgtty.h> found." >&4
12834                         val2="$define"
12835                 else
12836 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12837                 fi
12838         else
12839                 if $test `./findhdr sgtty.h`; then
12840                         echo "<sgtty.h> found." >&4
12841                         val2="$define"
12842                 elif $test `./findhdr termio.h`; then
12843                         echo "<termio.h> found." >&4
12844                         val="$define"
12845                 else
12846 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12847                 fi
12848         fi;;
12849 esac
12850 set i_termio; eval $setvar
12851 val=$val2; set i_sgtty; eval $setvar
12852 val=$val3; set i_termios; eval $setvar
12853
12854 : see if this is a shadow.h system
12855 set shadow.h i_shadow
12856 eval $inhdr
12857
12858 : see if this is a socks.h system
12859 set socks.h i_socks
12860 eval $inhdr
12861
12862 : see if stdarg is available
12863 echo " "
12864 if $test `./findhdr stdarg.h`; then
12865         echo "<stdarg.h> found." >&4
12866         valstd="$define"
12867 else
12868         echo "<stdarg.h> NOT found." >&4
12869         valstd="$undef"
12870 fi
12871
12872 : see if varags is available
12873 echo " "
12874 if $test `./findhdr varargs.h`; then
12875         echo "<varargs.h> found." >&4
12876 else
12877         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12878 fi
12879
12880 : set up the varargs testing programs
12881 $cat > varargs.c <<EOP
12882 #ifdef I_STDARG
12883 #include <stdarg.h>
12884 #endif
12885 #ifdef I_VARARGS
12886 #include <varargs.h>
12887 #endif
12888
12889 #ifdef I_STDARG
12890 int f(char *p, ...)
12891 #else
12892 int f(va_alist)
12893 va_dcl
12894 #endif
12895 {
12896         va_list ap;
12897 #ifndef I_STDARG
12898         char *p;
12899 #endif
12900 #ifdef I_STDARG
12901         va_start(ap,p);
12902 #else
12903         va_start(ap);
12904         p = va_arg(ap, char *);
12905 #endif
12906         va_end(ap);
12907 }
12908 EOP
12909 $cat > varargs <<EOP
12910 $startsh
12911 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12912         echo "true"
12913 else
12914         echo "false"
12915 fi
12916 $rm -f varargs$_o
12917 EOP
12918 chmod +x varargs
12919
12920 : now check which varargs header should be included
12921 echo " "
12922 i_varhdr=''
12923 case "$valstd" in
12924 "$define")
12925         if `./varargs I_STDARG`; then
12926                 val='stdarg.h'
12927         elif `./varargs I_VARARGS`; then
12928                 val='varargs.h'
12929         fi
12930         ;;
12931 *)
12932         if `./varargs I_VARARGS`; then
12933                 val='varargs.h'
12934         fi
12935         ;;
12936 esac
12937 case "$val" in
12938 '')
12939 echo "I could not find the definition for va_dcl... You have problems..." >&4
12940         val="$undef"; set i_stdarg; eval $setvar
12941         val="$undef"; set i_varargs; eval $setvar
12942         ;;
12943 *) 
12944         set i_varhdr
12945         eval $setvar
12946         case "$i_varhdr" in
12947         stdarg.h)
12948                 val="$define"; set i_stdarg; eval $setvar
12949                 val="$undef"; set i_varargs; eval $setvar
12950                 ;;
12951         varargs.h)
12952                 val="$undef"; set i_stdarg; eval $setvar
12953                 val="$define"; set i_varargs; eval $setvar
12954                 ;;
12955         esac
12956         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12957 esac
12958 $rm -f varargs*
12959
12960 : see if stddef is available
12961 set stddef.h i_stddef
12962 eval $inhdr
12963
12964 : see if sys/access.h is available
12965 set sys/access.h i_sysaccess
12966 eval $inhdr
12967
12968 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12969 set sys/filio.h i_sysfilio
12970 eval $inhdr
12971 echo " "
12972 if $test `./findhdr sys/ioctl.h`; then
12973         val="$define"
12974         echo '<sys/ioctl.h> found.' >&4
12975 else
12976         val="$undef"
12977         if $test $i_sysfilio = "$define"; then
12978             echo '<sys/ioctl.h> NOT found.' >&4
12979         else
12980                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12981                 $test $i_termio = "$define" && xxx="termio.h"
12982                 $test $i_termios = "$define" && xxx="termios.h"
12983 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12984         fi
12985 fi
12986 set i_sysioctl
12987 eval $setvar
12988
12989 : see if sys/resource.h has to be included
12990 set sys/resource.h i_sysresrc
12991 eval $inhdr
12992
12993 : see if sys/security.h is available
12994 set sys/security.h i_syssecrt
12995 eval $inhdr
12996
12997 : see if this is a sys/statvfs.h system
12998 set sys/statvfs.h i_sysstatvfs
12999 eval $inhdr
13000
13001 : see if this is a sys/un.h system
13002 set sys/un.h i_sysun
13003 eval $inhdr
13004
13005 : see if this is a syswait system
13006 set sys/wait.h i_syswait
13007 eval $inhdr
13008
13009 : see if this is an utime system
13010 set utime.h i_utime
13011 eval $inhdr
13012
13013 : see if this is a values.h system
13014 set values.h i_values
13015 eval $inhdr
13016
13017 : see if this is a vfork system
13018 case "$d_vfork" in
13019 "$define")
13020         set vfork.h i_vfork
13021         eval $inhdr
13022         ;;
13023 *)
13024         i_vfork="$undef"
13025         ;;
13026 esac
13027
13028 : see if gdbm.h is available
13029 set gdbm.h t_gdbm
13030 eval $inhdr
13031 case "$t_gdbm" in
13032 $define)
13033         : see if gdbm_open exists
13034         set gdbm_open d_gdbm_open
13035         eval $inlibc
13036         case "$d_gdbm_open" in
13037         $undef)
13038                 t_gdbm="$undef"
13039                 echo "We won't be including <gdbm.h>"
13040                 ;;
13041         esac
13042         ;;
13043 esac
13044 val="$t_gdbm"
13045 set i_gdbm
13046 eval $setvar
13047
13048 echo " "
13049 echo "Looking for extensions..." >&4
13050 : If we are using the old config.sh, known_extensions may contain
13051 : old or inaccurate or duplicate values.
13052 known_extensions=''
13053 nonxs_extensions=''
13054 : We do not use find because it might not be available.
13055 : We do not just use MANIFEST because the user may have dropped
13056 : some additional extensions into the source tree and expect them
13057 : to be built.
13058
13059 : Function to recursively find available extensions, ignoring DynaLoader
13060 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13061 find_extensions='
13062     for xxx in *; do
13063        case "$xxx" in
13064            DynaLoader|dynaload) ;;
13065            *)
13066            if $test -f $xxx/$xxx.xs; then
13067                known_extensions="$known_extensions $1$xxx";
13068            elif $test -f $xxx/Makefile.PL; then
13069                nonxs_extensions="$nonxs_extensions $1$xxx";
13070            else
13071                if $test -d $xxx -a $# -lt 10; then
13072                    set $1$xxx/ $*;
13073                    cd $xxx;
13074                    eval $find_extensions;
13075                    cd ..;
13076                    shift;
13077                fi;
13078            fi
13079            ;;
13080        esac;
13081     done'
13082 tdir=`pwd`
13083 cd $rsrc/ext
13084 set X
13085 shift
13086 eval $find_extensions
13087 set X $nonxs_extensions
13088 shift
13089 nonxs_extensions="$*"
13090 set X $known_extensions
13091 shift
13092 known_extensions="$*"
13093 cd $tdir
13094
13095 : Now see which are supported on this system.
13096 avail_ext=''
13097 for xxx in $known_extensions ; do
13098         case "$xxx" in
13099         DB_File|db_file)
13100                 case "$i_db" in
13101                 $define) avail_ext="$avail_ext $xxx" ;;
13102                 esac
13103                 ;;
13104         GDBM_File|gdbm_fil)
13105                 case "$i_gdbm" in 
13106                 $define) avail_ext="$avail_ext $xxx" ;;
13107                 esac
13108                 ;;
13109         NDBM_File|ndbm_fil)
13110                 case "$i_ndbm" in
13111                 $define) avail_ext="$avail_ext $xxx" ;;
13112                 esac
13113                 ;;
13114         ODBM_File|odbm_fil) 
13115                 case "${i_dbm}${i_rpcsvcdbm}" in
13116                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13117                 esac
13118                 ;;
13119         POSIX|posix)
13120                 case "$useposix" in
13121                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13122                 esac
13123                 ;;
13124         Opcode|opcode)
13125                 case "$useopcode" in
13126                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13127                 esac
13128                 ;;
13129         Socket|socket)
13130                 case "$d_socket" in 
13131                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13132                 esac
13133                 ;;
13134         Thread|thread)
13135                 case "$usethreads" in 
13136                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13137                 esac
13138                 ;;
13139         IPC/SysV|ipc/sysv)
13140                 : XXX Do we need a useipcsysv variable here
13141                 case "${d_msg}${d_sem}${d_shm}" in 
13142                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13143                 esac
13144                 ;;
13145         *)      avail_ext="$avail_ext $xxx"
13146                 ;;
13147         esac
13148 done
13149
13150 set X $avail_ext
13151 shift
13152 avail_ext="$*"
13153
13154 : Now see which nonxs extensions are supported on this system.
13155 : For now assume all are.
13156 nonxs_ext=''
13157 for xxx in $nonxs_extensions ; do
13158         case "$xxx" in
13159         *)      nonxs_ext="$nonxs_ext $xxx"
13160                 ;;
13161         esac
13162 done
13163
13164 set X $nonxs_ext
13165 shift
13166 nonxs_ext="$*"
13167
13168 case $usedl in
13169 $define)
13170         $cat <<EOM
13171 A number of extensions are supplied with $package.  You may choose to
13172 compile these extensions for dynamic loading (the default), compile
13173 them into the $package executable (static loading), or not include
13174 them at all.  Answer "none" to include no extensions.
13175 Note that DynaLoader is always built and need not be mentioned here.
13176
13177 EOM
13178         case "$dynamic_ext" in
13179         '') dflt="$avail_ext" ;;
13180         *)      dflt="$dynamic_ext"
13181                 # Perhaps we are reusing an old out-of-date config.sh.
13182                 case "$hint" in
13183                 previous)
13184                         if test X"$dynamic_ext" != X"$avail_ext"; then
13185                                 $cat <<EOM
13186 NOTICE:  Your previous config.sh list may be incorrect. 
13187 The extensions now available to you are 
13188         ${avail_ext}
13189 but the default list from your previous config.sh is
13190         ${dynamic_ext} 
13191
13192 EOM
13193                         fi
13194                         ;;
13195                 esac
13196                 ;;
13197         esac
13198         case "$dflt" in
13199         '')     dflt=none;;
13200         esac
13201         rp="What extensions do you wish to load dynamically?"
13202         . ./myread
13203         case "$ans" in
13204         none) dynamic_ext=' ' ;;
13205         *) dynamic_ext="$ans" ;;
13206         esac
13207
13208         case "$static_ext" in
13209         '')
13210                 : Exclude those already listed in dynamic linking
13211                 dflt=''
13212                 for xxx in $avail_ext; do
13213                         case " $dynamic_ext " in
13214                         *" $xxx "*) ;;
13215                         *) dflt="$dflt $xxx" ;;
13216                         esac
13217                 done
13218                 set X $dflt
13219                 shift
13220                 dflt="$*"
13221                 ;;
13222         *)  dflt="$static_ext" 
13223                 ;;
13224         esac
13225
13226         case "$dflt" in
13227         '')     dflt=none;;
13228         esac
13229         rp="What extensions do you wish to load statically?"
13230         . ./myread
13231         case "$ans" in
13232         none) static_ext=' ' ;;
13233         *) static_ext="$ans" ;;
13234         esac
13235         ;;
13236 *)
13237         $cat <<EOM
13238 A number of extensions are supplied with $package.  Answer "none" 
13239 to include no extensions. 
13240 Note that DynaLoader is always built and need not be mentioned here.
13241
13242 EOM
13243         case "$static_ext" in
13244         '') dflt="$avail_ext" ;;
13245         *)      dflt="$static_ext"
13246                 # Perhaps we are reusing an old out-of-date config.sh.
13247                 case "$hint" in
13248                 previous)
13249                         if test X"$static_ext" != X"$avail_ext"; then
13250                                 $cat <<EOM
13251 NOTICE:  Your previous config.sh list may be incorrect. 
13252 The extensions now available to you are 
13253         ${avail_ext}
13254 but the default list from your previous config.sh is
13255         ${static_ext} 
13256
13257 EOM
13258                         fi
13259                         ;;
13260                 esac
13261                 ;;
13262         esac
13263         : Exclude those that are not xs extensions
13264         case "$dflt" in
13265         '')     dflt=none;;
13266         esac
13267         rp="What extensions do you wish to include?"
13268         . ./myread
13269         case "$ans" in
13270         none) static_ext=' ' ;;
13271         *) static_ext="$ans" ;;
13272         esac
13273         ;;
13274 esac
13275
13276 set X $dynamic_ext $static_ext $nonxs_ext
13277 shift
13278 extensions="$*"
13279
13280 : Remove build directory name from cppstdin so it can be used from
13281 : either the present location or the final installed location.
13282 echo " "
13283 : Get out of the UU directory to get correct path name.
13284 cd ..
13285 case "$cppstdin" in
13286 `pwd`/cppstdin)
13287         echo "Stripping down cppstdin path name"
13288         cppstdin=cppstdin
13289         ;;
13290 esac
13291 cd UU
13292
13293 : end of configuration questions
13294 echo " "
13295 echo "End of configuration questions."
13296 echo " "
13297
13298 : back to where it started
13299 if test -d ../UU; then
13300         cd ..
13301 fi
13302
13303 : configuration may be patched via a 'config.over' file
13304 if $test -f config.over; then
13305         echo " "
13306         dflt=y
13307         rp='I see a config.over file.  Do you wish to load it?'
13308         . UU/myread
13309         case "$ans" in
13310         n*) echo "OK, I'll ignore it.";;
13311         *)      . ./config.over
13312                 echo "Configuration override changes have been loaded."
13313                 ;;
13314         esac
13315 fi
13316
13317 : in case they want portability, strip down executable paths
13318 case "$d_portable" in
13319 "$define")
13320         echo " "
13321         echo "Stripping down executable paths..." >&4
13322         for file in $loclist $trylist; do
13323                 eval temp=\$$file
13324                 eval $file=`basename $temp`
13325         done
13326         ;;
13327 esac
13328
13329 : create config.sh file
13330 echo " "
13331 echo "Creating config.sh..." >&4
13332 $spitshell <<EOT >config.sh
13333 $startsh
13334 #
13335 # This file was produced by running the Configure script. It holds all the
13336 # definitions figured out by Configure. Should you modify one of these values,
13337 # do not forget to propagate your changes by running "Configure -der". You may
13338 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13339 #
13340
13341 # Package name      : $package
13342 # Source directory  : $src
13343 # Configuration time: $cf_time
13344 # Configured by     : $cf_by
13345 # Target system     : $myuname
13346
13347 Author='$Author'
13348 Date='$Date'
13349 Header='$Header'
13350 Id='$Id'
13351 Locker='$Locker'
13352 Log='$Log'
13353 Mcc='$Mcc'
13354 RCSfile='$RCSfile'
13355 Revision='$Revision'
13356 Source='$Source'
13357 State='$State'
13358 _a='$_a'
13359 _exe='$_exe'
13360 _o='$_o'
13361 afs='$afs'
13362 alignbytes='$alignbytes'
13363 ansi2knr='$ansi2knr'
13364 aphostname='$aphostname'
13365 apiversion='$apiversion'
13366 ar='$ar'
13367 archlib='$archlib'
13368 archlibexp='$archlibexp'
13369 archname64='$archname64'
13370 archname='$archname'
13371 archobjs='$archobjs'
13372 awk='$awk'
13373 baserev='$baserev'
13374 bash='$bash'
13375 bin='$bin'
13376 bincompat5005='$bincompat5005'
13377 binexp='$binexp'
13378 bison='$bison'
13379 byacc='$byacc'
13380 byteorder='$byteorder'
13381 c='$c'
13382 castflags='$castflags'
13383 cat='$cat'
13384 cc='$cc'
13385 cccdlflags='$cccdlflags'
13386 ccdlflags='$ccdlflags'
13387 ccflags='$ccflags'
13388 ccsymbols='$ccsymbols'
13389 cf_by='$cf_by'
13390 cf_email='$cf_email'
13391 cf_time='$cf_time'
13392 chgrp='$chgrp'
13393 chmod='$chmod'
13394 chown='$chown'
13395 clocktype='$clocktype'
13396 comm='$comm'
13397 compress='$compress'
13398 contains='$contains'
13399 cp='$cp'
13400 cpio='$cpio'
13401 cpp='$cpp'
13402 cpp_stuff='$cpp_stuff'
13403 cppccsymbols='$cppccsymbols'
13404 cppflags='$cppflags'
13405 cpplast='$cpplast'
13406 cppminus='$cppminus'
13407 cpprun='$cpprun'
13408 cppstdin='$cppstdin'
13409 cppsymbols='$cppsymbols'
13410 crosscompile='$crosscompile'
13411 cryptlib='$cryptlib'
13412 csh='$csh'
13413 d_Gconvert='$d_Gconvert'
13414 d_PRIEldbl='$d_PRIEldbl'
13415 d_PRIFldbl='$d_PRIFldbl'
13416 d_PRIGldbl='$d_PRIGldbl'
13417 d_PRIX64='$d_PRIX64'
13418 d_PRId64='$d_PRId64'
13419 d_PRIeldbl='$d_PRIeldbl'
13420 d_PRIfldbl='$d_PRIfldbl'
13421 d_PRIgldbl='$d_PRIgldbl'
13422 d_PRIi64='$d_PRIi64'
13423 d_PRIo64='$d_PRIo64'
13424 d_PRIu64='$d_PRIu64'
13425 d_PRIx64='$d_PRIx64'
13426 d_access='$d_access'
13427 d_accessx='$d_accessx'
13428 d_alarm='$d_alarm'
13429 d_archlib='$d_archlib'
13430 d_atolf='$d_atolf'
13431 d_atoll='$d_atoll'
13432 d_attribut='$d_attribut'
13433 d_bcmp='$d_bcmp'
13434 d_bcopy='$d_bcopy'
13435 d_bincompat5005='$d_bincompat5005'
13436 d_bsd='$d_bsd'
13437 d_bsdgetpgrp='$d_bsdgetpgrp'
13438 d_bsdsetpgrp='$d_bsdsetpgrp'
13439 d_bzero='$d_bzero'
13440 d_casti32='$d_casti32'
13441 d_castneg='$d_castneg'
13442 d_charvspr='$d_charvspr'
13443 d_chown='$d_chown'
13444 d_chroot='$d_chroot'
13445 d_chsize='$d_chsize'
13446 d_closedir='$d_closedir'
13447 d_cmsghdr_s='$d_cmsghdr_s'
13448 d_const='$d_const'
13449 d_crypt='$d_crypt'
13450 d_csh='$d_csh'
13451 d_cuserid='$d_cuserid'
13452 d_dbl_dig='$d_dbl_dig'
13453 d_difftime='$d_difftime'
13454 d_dirnamlen='$d_dirnamlen'
13455 d_dlerror='$d_dlerror'
13456 d_dlopen='$d_dlopen'
13457 d_dlsymun='$d_dlsymun'
13458 d_dosuid='$d_dosuid'
13459 d_drand48proto='$d_drand48proto'
13460 d_dup2='$d_dup2'
13461 d_eaccess='$d_eaccess'
13462 d_endgrent='$d_endgrent'
13463 d_endhent='$d_endhent'
13464 d_endnent='$d_endnent'
13465 d_endpent='$d_endpent'
13466 d_endpwent='$d_endpwent'
13467 d_endsent='$d_endsent'
13468 d_endspent='$d_endspent'
13469 d_eofnblk='$d_eofnblk'
13470 d_eunice='$d_eunice'
13471 d_fchmod='$d_fchmod'
13472 d_fchown='$d_fchown'
13473 d_fcntl='$d_fcntl'
13474 d_fd_macros='$d_fd_macros'
13475 d_fd_set='$d_fd_set'
13476 d_fds_bits='$d_fds_bits'
13477 d_fgetpos='$d_fgetpos'
13478 d_flexfnam='$d_flexfnam'
13479 d_flock='$d_flock'
13480 d_fork='$d_fork'
13481 d_fpathconf='$d_fpathconf'
13482 d_fpos64_t='$d_fpos64_t'
13483 d_fseeko='$d_fseeko'
13484 d_fsetpos='$d_fsetpos'
13485 d_fstatfs='$d_fstatfs'
13486 d_fstatvfs='$d_fstatvfs'
13487 d_ftello='$d_ftello'
13488 d_ftime='$d_ftime'
13489 d_getgrent='$d_getgrent'
13490 d_getgrps='$d_getgrps'
13491 d_gethbyaddr='$d_gethbyaddr'
13492 d_gethbyname='$d_gethbyname'
13493 d_gethent='$d_gethent'
13494 d_gethname='$d_gethname'
13495 d_gethostprotos='$d_gethostprotos'
13496 d_getlogin='$d_getlogin'
13497 d_getmntent='$d_getmntent'
13498 d_getnbyaddr='$d_getnbyaddr'
13499 d_getnbyname='$d_getnbyname'
13500 d_getnent='$d_getnent'
13501 d_getnetprotos='$d_getnetprotos'
13502 d_getpbyname='$d_getpbyname'
13503 d_getpbynumber='$d_getpbynumber'
13504 d_getpent='$d_getpent'
13505 d_getpgid='$d_getpgid'
13506 d_getpgrp2='$d_getpgrp2'
13507 d_getpgrp='$d_getpgrp'
13508 d_getppid='$d_getppid'
13509 d_getprior='$d_getprior'
13510 d_getprotoprotos='$d_getprotoprotos'
13511 d_getpwent='$d_getpwent'
13512 d_getsbyname='$d_getsbyname'
13513 d_getsbyport='$d_getsbyport'
13514 d_getsent='$d_getsent'
13515 d_getservprotos='$d_getservprotos'
13516 d_getspent='$d_getspent'
13517 d_getspnam='$d_getspnam'
13518 d_gettimeod='$d_gettimeod'
13519 d_gnulibc='$d_gnulibc'
13520 d_grpasswd='$d_grpasswd'
13521 d_hasmntopt='$d_hasmntopt'
13522 d_htonl='$d_htonl'
13523 d_index='$d_index'
13524 d_inetaton='$d_inetaton'
13525 d_int64t='$d_int64t'
13526 d_iovec_s='$d_iovec_s'
13527 d_isascii='$d_isascii'
13528 d_killpg='$d_killpg'
13529 d_lchown='$d_lchown'
13530 d_ldbl_dig='$d_ldbl_dig'
13531 d_link='$d_link'
13532 d_llseek='$d_llseek'
13533 d_locconv='$d_locconv'
13534 d_lockf='$d_lockf'
13535 d_longdbl='$d_longdbl'
13536 d_longlong='$d_longlong'
13537 d_lstat='$d_lstat'
13538 d_madvise='$d_madvise'
13539 d_mblen='$d_mblen'
13540 d_mbstowcs='$d_mbstowcs'
13541 d_mbtowc='$d_mbtowc'
13542 d_memchr='$d_memchr'
13543 d_memcmp='$d_memcmp'
13544 d_memcpy='$d_memcpy'
13545 d_memmove='$d_memmove'
13546 d_memset='$d_memset'
13547 d_mkdir='$d_mkdir'
13548 d_mkfifo='$d_mkfifo'
13549 d_mktime='$d_mktime'
13550 d_mmap='$d_mmap'
13551 d_mprotect='$d_mprotect'
13552 d_msg='$d_msg'
13553 d_msg_ctrunc='$d_msg_ctrunc'
13554 d_msg_dontroute='$d_msg_dontroute'
13555 d_msg_oob='$d_msg_oob'
13556 d_msg_peek='$d_msg_peek'
13557 d_msg_proxy='$d_msg_proxy'
13558 d_msgctl='$d_msgctl'
13559 d_msgget='$d_msgget'
13560 d_msghdr_s='$d_msghdr_s'
13561 d_msgrcv='$d_msgrcv'
13562 d_msgsnd='$d_msgsnd'
13563 d_msync='$d_msync'
13564 d_munmap='$d_munmap'
13565 d_mymalloc='$d_mymalloc'
13566 d_nice='$d_nice'
13567 d_off64_t='$d_off64_t'
13568 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13569 d_oldpthreads='$d_oldpthreads'
13570 d_oldsock='$d_oldsock'
13571 d_open3='$d_open3'
13572 d_pathconf='$d_pathconf'
13573 d_pause='$d_pause'
13574 d_phostname='$d_phostname'
13575 d_pipe='$d_pipe'
13576 d_poll='$d_poll'
13577 d_portable='$d_portable'
13578 d_pthread_yield='$d_pthread_yield'
13579 d_pwage='$d_pwage'
13580 d_pwchange='$d_pwchange'
13581 d_pwclass='$d_pwclass'
13582 d_pwcomment='$d_pwcomment'
13583 d_pwexpire='$d_pwexpire'
13584 d_pwgecos='$d_pwgecos'
13585 d_pwpasswd='$d_pwpasswd'
13586 d_pwquota='$d_pwquota'
13587 d_readdir='$d_readdir'
13588 d_readlink='$d_readlink'
13589 d_readv='$d_readv'
13590 d_recvmsg='$d_recvmsg'
13591 d_rename='$d_rename'
13592 d_rewinddir='$d_rewinddir'
13593 d_rmdir='$d_rmdir'
13594 d_safebcpy='$d_safebcpy'
13595 d_safemcpy='$d_safemcpy'
13596 d_sanemcmp='$d_sanemcmp'
13597 d_sched_yield='$d_sched_yield'
13598 d_scm_rights='$d_scm_rights'
13599 d_seekdir='$d_seekdir'
13600 d_select='$d_select'
13601 d_sem='$d_sem'
13602 d_semctl='$d_semctl'
13603 d_semctl_semid_ds='$d_semctl_semid_ds'
13604 d_semctl_semun='$d_semctl_semun'
13605 d_semget='$d_semget'
13606 d_semop='$d_semop'
13607 d_sendmsg='$d_sendmsg'
13608 d_setegid='$d_setegid'
13609 d_seteuid='$d_seteuid'
13610 d_setgrent='$d_setgrent'
13611 d_setgrps='$d_setgrps'
13612 d_sethent='$d_sethent'
13613 d_setlinebuf='$d_setlinebuf'
13614 d_setlocale='$d_setlocale'
13615 d_setnent='$d_setnent'
13616 d_setpent='$d_setpent'
13617 d_setpgid='$d_setpgid'
13618 d_setpgrp2='$d_setpgrp2'
13619 d_setpgrp='$d_setpgrp'
13620 d_setprior='$d_setprior'
13621 d_setpwent='$d_setpwent'
13622 d_setregid='$d_setregid'
13623 d_setresgid='$d_setresgid'
13624 d_setresuid='$d_setresuid'
13625 d_setreuid='$d_setreuid'
13626 d_setrgid='$d_setrgid'
13627 d_setruid='$d_setruid'
13628 d_setsent='$d_setsent'
13629 d_setsid='$d_setsid'
13630 d_setspent='$d_setspent'
13631 d_setvbuf='$d_setvbuf'
13632 d_sfio='$d_sfio'
13633 d_shm='$d_shm'
13634 d_shmat='$d_shmat'
13635 d_shmatprototype='$d_shmatprototype'
13636 d_shmctl='$d_shmctl'
13637 d_shmdt='$d_shmdt'
13638 d_shmget='$d_shmget'
13639 d_sigaction='$d_sigaction'
13640 d_sigsetjmp='$d_sigsetjmp'
13641 d_socket='$d_socket'
13642 d_sockpair='$d_sockpair'
13643 d_statblks='$d_statblks'
13644 d_statfs='$d_statfs'
13645 d_statfsflags='$d_statfsflags'
13646 d_statvfs='$d_statvfs'
13647 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13648 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13649 d_stdio_stream_array='$d_stdio_stream_array'
13650 d_stdiobase='$d_stdiobase'
13651 d_stdstdio='$d_stdstdio'
13652 d_strchr='$d_strchr'
13653 d_strcoll='$d_strcoll'
13654 d_strctcpy='$d_strctcpy'
13655 d_strerrm='$d_strerrm'
13656 d_strerror='$d_strerror'
13657 d_strtod='$d_strtod'
13658 d_strtol='$d_strtol'
13659 d_strtoul='$d_strtoul'
13660 d_strtoull='$d_strtoull'
13661 d_strxfrm='$d_strxfrm'
13662 d_suidsafe='$d_suidsafe'
13663 d_symlink='$d_symlink'
13664 d_syscall='$d_syscall'
13665 d_sysconf='$d_sysconf'
13666 d_sysernlst='$d_sysernlst'
13667 d_syserrlst='$d_syserrlst'
13668 d_system='$d_system'
13669 d_tcgetpgrp='$d_tcgetpgrp'
13670 d_tcsetpgrp='$d_tcsetpgrp'
13671 d_telldir='$d_telldir'
13672 d_telldirproto='$d_telldirproto'
13673 d_time='$d_time'
13674 d_times='$d_times'
13675 d_truncate='$d_truncate'
13676 d_tzname='$d_tzname'
13677 d_umask='$d_umask'
13678 d_uname='$d_uname'
13679 d_union_semun='$d_union_semun'
13680 d_vendorlib='$d_vendorlib'
13681 d_vfork='$d_vfork'
13682 d_void_closedir='$d_void_closedir'
13683 d_voidsig='$d_voidsig'
13684 d_voidtty='$d_voidtty'
13685 d_volatile='$d_volatile'
13686 d_vprintf='$d_vprintf'
13687 d_wait4='$d_wait4'
13688 d_waitpid='$d_waitpid'
13689 d_wcstombs='$d_wcstombs'
13690 d_wctomb='$d_wctomb'
13691 d_writev='$d_writev'
13692 d_xenix='$d_xenix'
13693 date='$date'
13694 db_hashtype='$db_hashtype'
13695 db_prefixtype='$db_prefixtype'
13696 defvoidused='$defvoidused'
13697 direntrytype='$direntrytype'
13698 dlext='$dlext'
13699 dlsrc='$dlsrc'
13700 doublesize='$doublesize'
13701 drand01='$drand01'
13702 dynamic_ext='$dynamic_ext'
13703 eagain='$eagain'
13704 ebcdic='$ebcdic'
13705 echo='$echo'
13706 egrep='$egrep'
13707 emacs='$emacs'
13708 eunicefix='$eunicefix'
13709 exe_ext='$exe_ext'
13710 expr='$expr'
13711 extensions='$extensions'
13712 fflushNULL='$fflushNULL'
13713 fflushall='$fflushall'
13714 find='$find'
13715 firstmakefile='$firstmakefile'
13716 flex='$flex'
13717 fpostype='$fpostype'
13718 freetype='$freetype'
13719 full_ar='$full_ar'
13720 full_csh='$full_csh'
13721 full_sed='$full_sed'
13722 gccversion='$gccversion'
13723 gidtype='$gidtype'
13724 glibpth='$glibpth'
13725 grep='$grep'
13726 groupcat='$groupcat'
13727 groupstype='$groupstype'
13728 gzip='$gzip'
13729 h_fcntl='$h_fcntl'
13730 h_sysfile='$h_sysfile'
13731 hint='$hint'
13732 hostcat='$hostcat'
13733 huge='$huge'
13734 i_arpainet='$i_arpainet'
13735 i_bsdioctl='$i_bsdioctl'
13736 i_db='$i_db'
13737 i_dbm='$i_dbm'
13738 i_dirent='$i_dirent'
13739 i_dld='$i_dld'
13740 i_dlfcn='$i_dlfcn'
13741 i_fcntl='$i_fcntl'
13742 i_float='$i_float'
13743 i_gdbm='$i_gdbm'
13744 i_grp='$i_grp'
13745 i_inttypes='$i_inttypes'
13746 i_limits='$i_limits'
13747 i_locale='$i_locale'
13748 i_machcthr='$i_machcthr'
13749 i_malloc='$i_malloc'
13750 i_math='$i_math'
13751 i_memory='$i_memory'
13752 i_mntent='$i_mntent'
13753 i_ndbm='$i_ndbm'
13754 i_netdb='$i_netdb'
13755 i_neterrno='$i_neterrno'
13756 i_netinettcp='$i_netinettcp'
13757 i_niin='$i_niin'
13758 i_poll='$i_poll'
13759 i_pthread='$i_pthread'
13760 i_pwd='$i_pwd'
13761 i_rpcsvcdbm='$i_rpcsvcdbm'
13762 i_sfio='$i_sfio'
13763 i_sgtty='$i_sgtty'
13764 i_shadow='$i_shadow'
13765 i_socks='$i_socks'
13766 i_stdarg='$i_stdarg'
13767 i_stddef='$i_stddef'
13768 i_stdlib='$i_stdlib'
13769 i_string='$i_string'
13770 i_sysaccess='$i_sysaccess'
13771 i_sysdir='$i_sysdir'
13772 i_sysfile='$i_sysfile'
13773 i_sysfilio='$i_sysfilio'
13774 i_sysin='$i_sysin'
13775 i_sysioctl='$i_sysioctl'
13776 i_sysmman='$i_sysmman'
13777 i_sysmount='$i_sysmount'
13778 i_sysndir='$i_sysndir'
13779 i_sysparam='$i_sysparam'
13780 i_sysresrc='$i_sysresrc'
13781 i_syssecrt='$i_syssecrt'
13782 i_sysselct='$i_sysselct'
13783 i_syssockio='$i_syssockio'
13784 i_sysstat='$i_sysstat'
13785 i_sysstatvfs='$i_sysstatvfs'
13786 i_systime='$i_systime'
13787 i_systimek='$i_systimek'
13788 i_systimes='$i_systimes'
13789 i_systypes='$i_systypes'
13790 i_sysuio='$i_sysuio'
13791 i_sysun='$i_sysun'
13792 i_syswait='$i_syswait'
13793 i_termio='$i_termio'
13794 i_termios='$i_termios'
13795 i_time='$i_time'
13796 i_unistd='$i_unistd'
13797 i_utime='$i_utime'
13798 i_values='$i_values'
13799 i_varargs='$i_varargs'
13800 i_varhdr='$i_varhdr'
13801 i_vfork='$i_vfork'
13802 ignore_versioned_solibs='$ignore_versioned_solibs'
13803 incpath='$incpath'
13804 inews='$inews'
13805 installarchlib='$installarchlib'
13806 installbin='$installbin'
13807 installman1dir='$installman1dir'
13808 installman3dir='$installman3dir'
13809 installprefix='$installprefix'
13810 installprefixexp='$installprefixexp'
13811 installprivlib='$installprivlib'
13812 installscript='$installscript'
13813 installsitearch='$installsitearch'
13814 installsitelib='$installsitelib'
13815 installstyle='$installstyle'
13816 installusrbinperl='$installusrbinperl'
13817 installvendorlib='$installvendorlib'
13818 intsize='$intsize'
13819 known_extensions='$known_extensions'
13820 ksh='$ksh'
13821 large='$large'
13822 ld='$ld'
13823 lddlflags='$lddlflags'
13824 ldflags='$ldflags'
13825 ldlibpthname='$ldlibpthname'
13826 less='$less'
13827 lib_ext='$lib_ext'
13828 libc='$libc'
13829 libperl='$libperl'
13830 libpth='$libpth'
13831 libs='$libs'
13832 libswanted='$libswanted'
13833 line='$line'
13834 lint='$lint'
13835 lkflags='$lkflags'
13836 ln='$ln'
13837 lns='$lns'
13838 locincpth='$locincpth'
13839 loclibpth='$loclibpth'
13840 longdblsize='$longdblsize'
13841 longlongsize='$longlongsize'
13842 longsize='$longsize'
13843 lp='$lp'
13844 lpr='$lpr'
13845 ls='$ls'
13846 lseeksize='$lseeksize'
13847 lseektype='$lseektype'
13848 mail='$mail'
13849 mailx='$mailx'
13850 make='$make'
13851 make_set_make='$make_set_make'
13852 mallocobj='$mallocobj'
13853 mallocsrc='$mallocsrc'
13854 malloctype='$malloctype'
13855 man1dir='$man1dir'
13856 man1direxp='$man1direxp'
13857 man1ext='$man1ext'
13858 man3dir='$man3dir'
13859 man3direxp='$man3direxp'
13860 man3ext='$man3ext'
13861 medium='$medium'
13862 mips='$mips'
13863 mips_type='$mips_type'
13864 mkdir='$mkdir'
13865 mmaptype='$mmaptype'
13866 models='$models'
13867 modetype='$modetype'
13868 more='$more'
13869 multiarch='$multiarch'
13870 mv='$mv'
13871 myarchname='$myarchname'
13872 mydomain='$mydomain'
13873 myhostname='$myhostname'
13874 myuname='$myuname'
13875 n='$n'
13876 netdb_hlen_type='$netdb_hlen_type'
13877 netdb_host_type='$netdb_host_type'
13878 netdb_name_type='$netdb_name_type'
13879 netdb_net_type='$netdb_net_type'
13880 nm='$nm'
13881 nm_opt='$nm_opt'
13882 nm_so_opt='$nm_so_opt'
13883 nonxs_ext='$nonxs_ext'
13884 nroff='$nroff'
13885 o_nonblock='$o_nonblock'
13886 obj_ext='$obj_ext'
13887 old_pthread_create_joinable='$old_pthread_create_joinable'
13888 optimize='$optimize'
13889 orderlib='$orderlib'
13890 osname='$osname'
13891 osvers='$osvers'
13892 package='$package'
13893 pager='$pager'
13894 passcat='$passcat'
13895 patchlevel='$patchlevel'
13896 path_sep='$path_sep'
13897 perl='$perl'
13898 perladmin='$perladmin'
13899 perlpath='$perlpath'
13900 pg='$pg'
13901 phostname='$phostname'
13902 pidtype='$pidtype'
13903 plibpth='$plibpth'
13904 pmake='$pmake'
13905 pr='$pr'
13906 prefix='$prefix'
13907 prefixexp='$prefixexp'
13908 privlib='$privlib'
13909 privlibexp='$privlibexp'
13910 prototype='$prototype'
13911 ptrsize='$ptrsize'
13912 randbits='$randbits'
13913 randfunc='$randfunc'
13914 randseedtype='$randseedtype'
13915 ranlib='$ranlib'
13916 rd_nodata='$rd_nodata'
13917 rm='$rm'
13918 rmail='$rmail'
13919 runnm='$runnm'
13920 sPRIEldbl='$sPRIEldbl'
13921 sPRIFldbl='$sPRIFldbl'
13922 sPRIGldbl='$sPRIGldbl'
13923 sPRIX64='$sPRIX64'
13924 sPRId64='$sPRId64'
13925 sPRIeldbl='$sPRIeldbl'
13926 sPRIfldbl='$sPRIfldbl'
13927 sPRIgldbl='$sPRIgldbl'
13928 sPRIi64='$sPRIi64'
13929 sPRIo64='$sPRIo64'
13930 sPRIu64='$sPRIu64'
13931 sPRIx64='$sPRIx64'
13932 sched_yield='$sched_yield'
13933 scriptdir='$scriptdir'
13934 scriptdirexp='$scriptdirexp'
13935 sed='$sed'
13936 seedfunc='$seedfunc'
13937 selectminbits='$selectminbits'
13938 selecttype='$selecttype'
13939 sendmail='$sendmail'
13940 sh='$sh'
13941 shar='$shar'
13942 sharpbang='$sharpbang'
13943 shmattype='$shmattype'
13944 shortsize='$shortsize'
13945 shrpenv='$shrpenv'
13946 shsharp='$shsharp'
13947 sig_count='$sig_count'
13948 sig_name='$sig_name'
13949 sig_name_init='$sig_name_init'
13950 sig_num='$sig_num'
13951 sig_num_init='$sig_num_init'
13952 signal_t='$signal_t'
13953 sitearch='$sitearch'
13954 sitearchexp='$sitearchexp'
13955 sitelib='$sitelib'
13956 sitelibexp='$sitelibexp'
13957 siteprefix='$siteprefix'
13958 siteprefixexp='$siteprefixexp'
13959 sizetype='$sizetype'
13960 sleep='$sleep'
13961 smail='$smail'
13962 small='$small'
13963 so='$so'
13964 sockethdr='$sockethdr'
13965 socketlib='$socketlib'
13966 sort='$sort'
13967 spackage='$spackage'
13968 spitshell='$spitshell'
13969 split='$split'
13970 src='$src'
13971 ssizetype='$ssizetype'
13972 startperl='$startperl'
13973 startsh='$startsh'
13974 static_ext='$static_ext'
13975 stdchar='$stdchar'
13976 stdio_base='$stdio_base'
13977 stdio_bufsiz='$stdio_bufsiz'
13978 stdio_cnt='$stdio_cnt'
13979 stdio_filbuf='$stdio_filbuf'
13980 stdio_ptr='$stdio_ptr'
13981 stdio_stream_array='$stdio_stream_array'
13982 strings='$strings'
13983 submit='$submit'
13984 subversion='$subversion'
13985 sysman='$sysman'
13986 tail='$tail'
13987 tar='$tar'
13988 tbl='$tbl'
13989 tee='$tee'
13990 test='$test'
13991 timeincl='$timeincl'
13992 timetype='$timetype'
13993 touch='$touch'
13994 tr='$tr'
13995 trnl='$trnl'
13996 troff='$troff'
13997 uidtype='$uidtype'
13998 uname='$uname'
13999 uniq='$uniq'
14000 use64bits='$use64bits'
14001 usedl='$usedl'
14002 uselargefiles='$uselargefiles'
14003 uselongdouble='$uselongdouble'
14004 usemorebits='$usemorebits'
14005 usemultiplicity='$usemultiplicity'
14006 usemymalloc='$usemymalloc'
14007 usenm='$usenm'
14008 useopcode='$useopcode'
14009 useperlio='$useperlio'
14010 useposix='$useposix'
14011 usesfio='$usesfio'
14012 useshrplib='$useshrplib'
14013 usesocks='$usesocks'
14014 usethreads='$usethreads'
14015 usevendorprefix='$usevendorprefix'
14016 usevfork='$usevfork'
14017 usrinc='$usrinc'
14018 uuname='$uuname'
14019 vendorlib='$vendorlib'
14020 vendorlibexp='$vendorlibexp'
14021 vendorprefix='$vendorprefix'
14022 vendorprefixexp='$vendorprefixexp'
14023 version='$version'
14024 vi='$vi'
14025 voidflags='$voidflags'
14026 xlibpth='$xlibpth'
14027 zcat='$zcat'
14028 zip='$zip'
14029 EOT
14030
14031 : Add in command line options if available
14032 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14033
14034 : add special variables
14035 $test -f $src/patchlevel.h && \
14036 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14037 echo "CONFIGDOTSH=true" >>config.sh
14038
14039 : propagate old symbols
14040 if $test -f UU/config.sh; then
14041         <UU/config.sh sort | uniq >UU/oldconfig.sh
14042         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14043         sort | uniq -u >UU/oldsyms
14044         set X `cat UU/oldsyms`
14045         shift
14046         case $# in
14047         0) ;;
14048         *)
14049                 cat <<EOM
14050 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14051 EOM
14052                 echo "# Variables propagated from previous config.sh file." >>config.sh
14053                 for sym in `cat UU/oldsyms`; do
14054                         echo "    Propagating $hint variable "'$'"$sym..."
14055                         eval 'tmp="$'"${sym}"'"'
14056                         echo "$tmp" | \
14057                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14058                 done
14059                 ;;
14060         esac
14061 fi
14062
14063 : Finish up by extracting the .SH files
14064 case "$alldone" in
14065 exit)
14066         $rm -rf UU
14067         echo "Done."
14068         exit 0
14069         ;;
14070 cont)
14071         ;;
14072 '')
14073         dflt=''
14074         nostick=true
14075         $cat <<EOM
14076
14077 If you'd like to make any changes to the config.sh file before I begin
14078 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14079
14080 EOM
14081         rp="Press return or use a shell escape to edit config.sh:"
14082         . UU/myread
14083         nostick=''
14084         case "$ans" in
14085         '') ;;
14086         *) : in case they cannot read
14087                 sh 1>&4 -c "$ans";;
14088         esac
14089         ;;
14090 esac
14091
14092 : if this fails, just run all the .SH files by hand
14093 . ./config.sh
14094
14095 echo " "
14096 exec 1>&4
14097 . ./UU/extract
14098
14099 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14100         dflt=y
14101         case "$silent" in
14102         true) ;;
14103         *)
14104                 $cat <<EOM
14105
14106 Now you need to generate make dependencies by running "$make depend".
14107 You might prefer to run it in background: "$make depend > makedepend.out &"
14108 It can take a while, so you might not want to run it right now.
14109
14110 EOM
14111                 ;;
14112         esac
14113         rp="Run $make depend now?"
14114         . UU/myread
14115         case "$ans" in
14116         y*)
14117                 $make depend && echo "Now you must run a $make."
14118                 ;;
14119         *)
14120                 echo "You must run '$make depend' then '$make'."
14121                 ;;
14122         esac
14123 elif test -f [Mm]akefile; then
14124         echo " "
14125         echo "Now you must run a $make."
14126 else
14127         echo "Done."
14128 fi
14129
14130 if $test -f Policy.sh; then
14131     $cat <<EOM
14132
14133 If you compile $package on a different machine or from a different object
14134 directory, copy the Policy.sh file from this object directory to the
14135 new one before you run Configure -- this will help you with most of
14136 the policy defaults.
14137
14138 EOM
14139 fi
14140 if $test -f config.msg; then
14141     echo "Hmm.  I also noted the following information while running:"
14142     echo " "
14143     $cat config.msg >&4
14144     $rm -f config.msg
14145 fi
14146 $rm -f kit*isdone ark*isdone
14147 $rm -rf UU
14148
14149 : End of Configure
14150