This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lvalue subs patch (change#4081) breaks C<\(Foo->Bar())>;
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sun Oct  3 02:41:02 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 uidsign=''
818 uidtype=''
819 archname64=''
820 use64bits=''
821 uselargefiles=''
822 uselongdouble=''
823 usemorebits=''
824 usemultiplicity=''
825 nm_opt=''
826 nm_so_opt=''
827 runnm=''
828 usenm=''
829 useperlio=''
830 usesocks=''
831 d_oldpthreads=''
832 usethreads=''
833 incpath=''
834 mips=''
835 mips_type=''
836 usrinc=''
837 d_vendorlib=''
838 installvendorlib=''
839 vendorlib=''
840 vendorlibexp=''
841 usevendorprefix=''
842 vendorprefix=''
843 vendorprefixexp=''
844 defvoidused=''
845 voidflags=''
846 pm_apiversion=''
847 xs_apiversion=''
848 CONFIG=''
849
850 define='define'
851 undef='undef'
852 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
853 rmlist=''
854
855 : We must find out about Eunice early
856 eunicefix=':'
857 if test -f /etc/unixtovms; then
858         eunicefix=/etc/unixtovms
859 fi
860 if test -f /etc/unixtovms.exe; then
861         eunicefix=/etc/unixtovms.exe
862 fi
863
864 i_whoami=''
865 : Possible local include directories to search.
866 : Set locincpth to "" in a hint file to defeat local include searches.
867 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
868 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
869 :
870 : no include file wanted by default
871 inclwanted=''
872
873 : list of known cpp symbols, sorted alphabetically
874 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
875 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
876 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
877 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
878 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
879 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
880 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
881 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
882 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
883 al="$al VMS Xenix286"
884 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
885 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
886 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
887 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
888 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
889 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
890 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
891 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
892 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
893 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
894 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
895 al="$al __SVR4_2__ __UMAXV__"
896 al="$al ____386BSD____ __alpha __alpha__ __amiga"
897 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
898 al="$al __host_mips__"
899 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
900 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
901 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
902 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
903 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
904 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
905 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
906 al="$al __mc88100 __mc88100__ __mips __mips__"
907 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
908 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
909 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
910 al="$al _host_mips _mips _unix"
911 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
912 al="$al apollo ardent att386 att3b"
913 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
914 al="$al cadmus clipper concurrent convex cray ctix"
915 al="$al dmert encore gcos gcx gimpel gould"
916 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
917 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
918 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
919 al="$al i186 i286 i386 i486 i8086"
920 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
921 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
922 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
923 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
924 al="$al mc88000 mc88100 merlin mert mips mvs n16"
925 al="$al ncl_el ncl_mr"
926 al="$al news1500 news1700 news1800 news1900 news3700"
927 al="$al news700 news800 news900 ns16000 ns32000"
928 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
929 al="$al parisc pc532 pdp11 plexus posix pyr"
930 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
931 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
932 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
933 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
934 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
935 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
936 al="$al xenix z8000"
937
938 : Trailing extension.  Override this in a hint file, if needed.
939 _exe=''
940 : Extra object files, if any, needed on this platform.
941 archobjs=''
942 groupstype=''
943 : change the next line if compiling for Xenix/286 on Xenix/386
944 xlibpth='/usr/lib/386 /lib/386'
945
946 : Possible local library directories to search.
947 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
948 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
949
950 : general looking path for locating libraries
951 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
952 glibpth="$glibpth /lib /usr/lib $xlibpth"
953 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
954 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
955
956 : Private path used by Configure to find libraries.  Its value
957 : is prepended to libpth. This variable takes care of special
958 : machines, like the mips.  Usually, it should be empty.
959 plibpth=''
960
961 : default library list
962 libswanted=''
963 : some systems want to use only the non-versioned libso:s
964 ignore_versioned_solibs=''
965 : full support for void wanted by default
966 defvoidused=15
967
968 : set useposix=false in your hint file to disable the POSIX extension.
969 useposix=true
970 : set useopcode=false in your hint file to disable the Opcode extension.
971 useopcode=true
972 : set usemultiplicity on the Configure command line to enable multiplicity.
973 : set usesocks on the Configure command line to enable socks.
974 : set usethreads on the Configure command line to enable threads.
975 : List of libraries we want.
976 : If anyone needs -lnet, put it in a hint file.
977 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
978 libswanted="$libswanted dld ld sun m c cposix posix"
979 libswanted="$libswanted ndir dir crypt sec"
980 libswanted="$libswanted ucb bsd BSD PW x"
981 : We probably want to search /usr/shlib before most other libraries.
982 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
983 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
984 glibpth="/usr/shlib $glibpth"
985 : Do not use vfork unless overridden by a hint file.
986 usevfork=false
987
988 : Find the basic shell for Bourne shell scripts
989 case "$sh" in
990 '')
991         case "$SYSTYPE" in
992         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
993         *) xxx='/bin/sh';;
994         esac
995         if test -f "$xxx"; then
996                 sh="$xxx"
997         else
998                 : Build up a list and do a single loop so we can 'break' out.
999                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1000                 for xxx in sh bash ksh pdksh ash; do
1001                         for p in $pth; do
1002                                 try="$try ${p}/${xxx}"
1003                         done
1004                 done
1005                 for xxx in $try; do
1006                         if test -f "$xxx"; then
1007                                 sh="$xxx";
1008                                 break
1009                         elif test -f "$xxx.exe"; then
1010                                 sh="$xxx";
1011                                 break
1012                         fi
1013                 done
1014         fi
1015         ;;
1016 esac
1017
1018 case "$sh" in
1019 '')     cat <<EOM >&2
1020 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1021
1022 Usually it's in /bin/sh.  How did you even get this far?
1023 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1024 we'll try to straighten this all out.
1025 EOM
1026         exit 1
1027         ;;
1028 esac
1029
1030 : see if sh knows # comments
1031 if `$sh -c '#' >/dev/null 2>&1`; then
1032         shsharp=true
1033         spitshell=cat
1034         xcat=/bin/cat
1035         test -f $xcat || xcat=/usr/bin/cat
1036         echo "#!$xcat" >try
1037         $eunicefix try
1038         chmod +x try
1039         ./try > today
1040         if test -s today; then
1041                 sharpbang='#!'
1042         else
1043                 echo "#! $xcat" > try
1044                 $eunicefix try
1045                 chmod +x try
1046                 ./try > today
1047                 if test -s today; then
1048                         sharpbang='#! '
1049                 else
1050                         sharpbang=': use '
1051                 fi
1052         fi
1053 else
1054         echo " "
1055         echo "Your $sh doesn't grok # comments--I will strip them later on."
1056         shsharp=false
1057         cd ..
1058         echo "exec grep -v '^[  ]*#'" >spitshell
1059         chmod +x spitshell
1060         $eunicefix spitshell
1061         spitshell=`pwd`/spitshell
1062         cd UU
1063         echo "I presume that if # doesn't work, #! won't work either!"
1064         sharpbang=': use '
1065 fi
1066 rm -f try today
1067
1068 : figure out how to guarantee sh startup
1069 case "$startsh" in
1070 '') startsh=${sharpbang}${sh} ;;
1071 *)
1072 esac
1073 cat >try <<EOSS
1074 $startsh
1075 set abc
1076 test "$?abc" != 1
1077 EOSS
1078
1079 chmod +x try
1080 $eunicefix try
1081 if ./try; then
1082         : echo "Yup, it does."
1083 else
1084         echo "Hmm... '$startsh' does not guarantee sh startup..."
1085         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1086 fi
1087 rm -f try
1088
1089
1090 : Save command line options in file UU/cmdline.opt for later use in
1091 : generating config.sh.
1092 cat > cmdline.opt <<EOSH
1093 # Configure command line arguments.
1094 config_arg0='$0'
1095 config_args='$*'
1096 config_argc=$#
1097 EOSH
1098 argn=1
1099 for arg in "$@"; do
1100         cat >>cmdline.opt <<EOSH
1101 config_arg$argn='$arg'
1102 EOSH
1103         argn=`expr $argn + 1`
1104 done
1105
1106 : produce awk script to parse command line options
1107 cat >options.awk <<'EOF'
1108 BEGIN {
1109         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1110
1111         len = length(optstr);
1112         for (i = 1; i <= len; i++) {
1113                 c = substr(optstr, i, 1);
1114                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1115                 if (a == ":") {
1116                         arg[c] = 1;
1117                         i++;
1118                 }
1119                 opt[c] = 1;
1120         }
1121 }
1122 {
1123         expect = 0;
1124         str = $0;
1125         if (substr(str, 1, 1) != "-") {
1126                 printf("'%s'\n", str);
1127                 next;
1128         }
1129         len = length($0);
1130         for (i = 2; i <= len; i++) {
1131                 c = substr(str, i, 1);
1132                 if (!opt[c]) {
1133                         printf("-%s\n", substr(str, i));
1134                         next;
1135                 }
1136                 printf("-%s\n", c);
1137                 if (arg[c]) {
1138                         if (i < len)
1139                                 printf("'%s'\n", substr(str, i + 1));
1140                         else
1141                                 expect = 1;
1142                         next;
1143                 }
1144         }
1145 }
1146 END {
1147         if (expect)
1148                 print "?";
1149 }
1150 EOF
1151
1152 : process the command line options
1153 set X `for arg in "$@"; do echo "X$arg"; done |
1154         sed -e s/X// | awk -f options.awk`
1155 eval "set $*"
1156 shift
1157 rm -f options.awk
1158
1159 : set up default values
1160 fastread=''
1161 reuseval=false
1162 config_sh=''
1163 alldone=''
1164 error=''
1165 silent=''
1166 extractsh=''
1167 override=''
1168 knowitall=''
1169 rm -f optdef.sh posthint.sh
1170 cat >optdef.sh <<EOS
1171 $startsh
1172 EOS
1173
1174
1175 : option parsing
1176 while test $# -gt 0; do
1177         case "$1" in
1178         -d) shift; fastread=yes;;
1179         -e) shift; alldone=cont;;
1180         -f)
1181                 shift
1182                 cd ..
1183                 if test -r "$1"; then
1184                         config_sh="$1"
1185                 else
1186                         echo "$me: cannot read config file $1." >&2
1187                         error=true
1188                 fi
1189                 cd UU
1190                 shift;;
1191         -h) shift; error=true;;
1192         -r) shift; reuseval=true;;
1193         -s) shift; silent=true; realsilent=true;;
1194         -E) shift; alldone=exit;;
1195         -K) shift; knowitall=true;;
1196         -O) shift; override=true;;
1197         -S) shift; silent=true; extractsh=true;;
1198         -D)
1199                 shift
1200                 case "$1" in
1201                 *=)
1202                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1203                         echo "$me: ignoring -D $1" >&2
1204                         ;;
1205                 *=*) echo "$1" | \
1206                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1207                 *) echo "$1='define'" >> optdef.sh;;
1208                 esac
1209                 shift
1210                 ;;
1211         -U)
1212                 shift
1213                 case "$1" in
1214                 *=) echo "$1" >> optdef.sh;;
1215                 *=*)
1216                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1217                         echo "$me: ignoring -U $1" >&2
1218                         ;;
1219                 *) echo "$1='undef'" >> optdef.sh;;
1220                 esac
1221                 shift
1222                 ;;
1223         -A)
1224             shift
1225             xxx=''
1226             yyy="$1"
1227             zzz=''
1228             uuu=undef
1229             case "$yyy" in
1230             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1231                  case "$zzz" in
1232                  *:*) zzz='' ;;
1233                  *)   xxx=append
1234                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1235                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1236                  esac
1237                  ;;
1238             esac
1239             case "$xxx" in
1240             '')  case "$yyy" in
1241                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1242                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1243                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1244                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1245                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1246                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1247                  esac
1248                  ;;       
1249             esac
1250             case "$xxx" in
1251             append)
1252                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1253             clear)
1254                 echo "$yyy=''"                  >> posthint.sh ;;
1255             define)
1256                 case "$zzz" in
1257                 '') zzz=define ;;
1258                 esac
1259                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1260             eval)
1261                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1262             prepend)
1263                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1264             undef)
1265                 case "$zzz" in
1266                 '') zzz="$uuu" ;;
1267                 esac
1268                 echo "$yyy=$zzz"                >> posthint.sh ;;
1269             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1270             esac
1271             ;;
1272         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1273             exit 0;;
1274         --) break;;
1275         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1276         *) break;;
1277         esac
1278 done
1279
1280 case "$error" in
1281 true)
1282         cat >&2 <<EOM
1283 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1284                  [-U symbol] [-U symbol=] [-A command:symbol...]
1285   -d : use defaults for all answers.
1286   -e : go on without questioning past the production of config.sh.
1287   -f : specify an alternate default configuration file.
1288   -h : print this help message and exit (with an error status).
1289   -r : reuse C symbols value if possible (skips costly nm extraction).
1290   -s : silent mode, only echoes questions and essential information.
1291   -D : define symbol to have some value:
1292          -D symbol         symbol gets the value 'define'
1293          -D symbol=value   symbol gets the value 'value'
1294   -E : stop at the end of questions, after having produced config.sh.
1295   -K : do not use unless you know what you are doing.
1296   -O : let -D and -U override definitions from loaded configuration file.
1297   -S : perform variable substitutions on all .SH files (can mix with -f)
1298   -U : undefine symbol:
1299          -U symbol    symbol gets the value 'undef'
1300          -U symbol=   symbol gets completely empty
1301   -A : manipulate symbol after the platform specific hints have been applied:
1302          -A symbol=value                append " "value to symbol
1303          -A append:symbol=value         append value to symbol
1304          -A define:symbol=value         define symbol to have value
1305          -A clear:symbol                define symbol to be ''
1306          -A define:symbol               define symbol to be 'define'
1307          -A eval:symbol=value           define symbol to be eval of value
1308          -A prepend:symbol=value        prepend value to symbol
1309          -A undef:symbol                define symbol to be 'undef'
1310          -A undef:symbol=               define symbol to be ''
1311   -V : print version number and exit (with a zero status).
1312 EOM
1313         exit 1
1314         ;;
1315 esac
1316
1317 : Sanity checks
1318 case "$fastread$alldone" in
1319 yescont|yesexit) ;;
1320 *)
1321         if test ! -t 0; then
1322                 echo "Say 'sh Configure', not 'sh <Configure'"
1323                 exit 1
1324         fi
1325         ;;
1326 esac
1327
1328 exec 4>&1
1329 case "$silent" in
1330 true) exec 1>/dev/null;;
1331 esac
1332
1333 : run the defines and the undefines, if any, but leave the file out there...
1334 touch optdef.sh
1335 . ./optdef.sh
1336 : create the posthint manipulation script and leave the file out there...
1337 touch posthint.sh
1338
1339 : set package name
1340 package=perl5
1341 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1342 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1343 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1344 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1345 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1346 esac
1347
1348 : Some greps do not return status, grrr.
1349 echo "grimblepritz" >grimble
1350 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1351         contains=contains
1352 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1353         contains=grep
1354 else
1355         contains=contains
1356 fi
1357 rm -f grimble
1358 : the following should work in any shell
1359 case "$contains" in
1360 contains*)
1361         echo " "
1362         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1363         cat >contains <<'EOSS'
1364 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1365 EOSS
1366 chmod +x contains
1367 esac
1368
1369 : Find the path to the source tree
1370 case "$src" in
1371 '') case "$0" in
1372     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1373          case "$src" in
1374          /*)    ;;
1375          *)     src=`cd ../$src && pwd` ;;
1376          esac
1377          ;;
1378     *)   src='.';;
1379     esac;;
1380 esac
1381 case "$src" in
1382 '')     src=/
1383         rsrc=/
1384         ;;
1385 /*) rsrc="$src";;
1386 *) rsrc="../$src";;
1387 esac
1388 if test -f $rsrc/Configure && \
1389         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1390 then
1391    : found it, so we are ok.
1392 else
1393         rsrc=''
1394         for src in . .. ../.. ../../.. ../../../..; do
1395                 if test -f ../$src/Configure && \
1396                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1397                 then
1398                         rsrc=../$src
1399                         break
1400                 fi
1401         done
1402 fi
1403 case "$rsrc" in
1404 '')
1405         cat <<EOM >&4
1406
1407 Sorry, I can't seem to locate the source dir for $package.  Please start
1408 Configure with an explicit path -- i.e. /some/path/Configure.
1409
1410 EOM
1411         exit 1
1412         ;;
1413 ../.)   rsrc='..';;
1414 *)
1415         echo " "
1416         echo "Sources for $package found in \"$src\"." >&4
1417         ;;
1418 esac
1419
1420 : script used to extract .SH files with variable substitutions
1421 cat >extract <<'EOS'
1422 CONFIGDOTSH=true
1423 echo "Doing variable substitutions on .SH files..."
1424 if test -f $src/MANIFEST; then
1425         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1426 else
1427         echo "(Looking for .SH files under the source directory.)"
1428         set x `(cd $src; find . -name "*.SH" -print)`
1429 fi
1430 shift
1431 case $# in
1432 0) set x `(cd $src; echo *.SH)`; shift;;
1433 esac
1434 if test ! -f $src/$1; then
1435         shift
1436 fi
1437 mkdir_p='
1438 name=$1;
1439 create="";
1440 while test $name; do
1441         if test ! -d "$name"; then
1442                 create="$name $create";
1443                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1444                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1445         else
1446                 name="";
1447         fi;
1448 done;
1449 for file in $create; do
1450         mkdir $file;
1451 done
1452 '
1453 for file in $*; do
1454         case "$src" in
1455         ".")
1456                 case "$file" in
1457                 */*)
1458                         dir=`expr X$file : 'X\(.*\)/'`
1459                         file=`expr X$file : 'X.*/\(.*\)'`
1460                         (cd $dir && . ./$file)
1461                         ;;
1462                 *)
1463                         . ./$file
1464                         ;;
1465                 esac
1466                 ;;
1467         *)
1468                 case "$file" in
1469                 */*)
1470                         dir=`expr X$file : 'X\(.*\)/'`
1471                         file=`expr X$file : 'X.*/\(.*\)'`
1472                         (set x $dir; shift; eval $mkdir_p)
1473                         sh <$src/$dir/$file
1474                         ;;
1475                 *)
1476                         sh <$src/$file
1477                         ;;
1478                 esac
1479                 ;;
1480         esac
1481 done
1482 if test -f $src/config_h.SH; then
1483         if test ! -f config.h; then
1484         : oops, they left it out of MANIFEST, probably, so do it anyway.
1485         . $src/config_h.SH
1486         fi
1487 fi
1488 EOS
1489
1490 : extract files and exit if asked to do so
1491 case "$extractsh" in
1492 true)
1493         case "$realsilent" in
1494         true) ;;
1495         *) exec 1>&4;;
1496         esac
1497         case "$config_sh" in
1498         '') config_sh='config.sh';;
1499         esac
1500         echo " "
1501         echo "Fetching answers from $config_sh..."
1502         cd ..
1503         . $config_sh
1504         test "$override" && . ./optdef.sh
1505         echo " "
1506         . UU/extract
1507         rm -rf UU
1508         echo "Done."
1509         exit 0
1510         ;;
1511 esac
1512
1513 : Eunice requires " " instead of "", can you believe it
1514 echo " "
1515 : Here we go...
1516 echo "Beginning of configuration questions for $package."
1517
1518 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1519
1520 : first determine how to suppress newline on echo command
1521 echo " "
1522 echo "Checking echo to see how to suppress newlines..."
1523 (echo "hi there\c" ; echo " ") >.echotmp
1524 if $contains c .echotmp >/dev/null 2>&1 ; then
1525         echo "...using -n."
1526         n='-n'
1527         c=''
1528 else
1529         cat <<'EOM'
1530 ...using \c
1531 EOM
1532         n=''
1533         c='\c'
1534 fi
1535 echo $n "The star should be here-->$c"
1536 echo '*'
1537 rm -f .echotmp
1538
1539 : Now test for existence of everything in MANIFEST
1540 echo " "
1541 if test -f $rsrc/MANIFEST; then
1542         echo "First let's make sure your kit is complete.  Checking..." >&4
1543         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1544         rm -f missing
1545         tmppwd=`pwd`
1546         for filelist in x??; do
1547                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1548         done
1549         if test -s missing; then
1550                 cat missing >&4
1551                 cat >&4 <<'EOM'
1552
1553 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1554
1555 You have the option of continuing the configuration process, despite the
1556 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1557 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1558 and contact the author (perlbug@perl.com).
1559
1560 EOM
1561                 echo $n "Continue? [n] $c" >&4
1562                 read ans
1563                 case "$ans" in
1564                 y*)
1565                         echo "Continuing..." >&4
1566                         rm -f missing
1567                         ;;
1568                 *)
1569                         echo "ABORTING..." >&4
1570                         kill $$
1571                         ;;
1572                 esac
1573         else
1574                 echo "Looks good..."
1575         fi
1576 else
1577         echo "There is no MANIFEST file.  I hope your kit is complete !"
1578 fi
1579 rm -f missing x??
1580
1581 echo " "
1582 : Find the appropriate value for a newline for tr
1583 if test -n "$DJGPP"; then
1584        trnl='\012'
1585 fi
1586 if test X"$trnl" = X; then
1587         case "`echo foo|tr '\n' x 2>/dev/null`" in
1588         foox) trnl='\n' ;;
1589         esac
1590 fi
1591 if test X"$trnl" = X; then
1592         case "`echo foo|tr '\012' x 2>/dev/null`" in
1593         foox) trnl='\012' ;;
1594         esac
1595 fi
1596 if test X"$trnl" = X; then
1597         cat <<EOM >&2
1598
1599 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1600
1601 EOM
1602         exit 1
1603 fi
1604
1605 : compute the number of columns on the terminal for proper question formatting
1606 case "$COLUMNS" in
1607 '') COLUMNS='80';;
1608 esac
1609
1610 : set up the echo used in my read
1611 myecho="case \"\$xxxm\" in
1612 '') echo $n \"\$rp $c\" >&4;;
1613 *) case \"\$rp\" in
1614         '') echo $n \"[\$xxxm] $c\";;
1615         *)
1616                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1617                         echo \"\$rp\" >&4
1618                         echo $n \"[\$xxxm] $c\" >&4
1619                 else
1620                         echo $n \"\$rp [\$xxxm] $c\" >&4
1621                 fi
1622                 ;;
1623         esac;;
1624 esac"
1625
1626 : now set up to do reads with possible shell escape and default assignment
1627 cat <<EOSC >myread
1628 $startsh
1629 xxxm=\$dflt
1630 $myecho
1631 ans='!'
1632 case "\$fastread" in
1633 yes) case "\$dflt" in
1634         '') ;;
1635         *) ans='';
1636                 case "\$silent-\$rp" in
1637                 true-) ;;
1638                 *) echo " " >&4;;
1639                 esac;;
1640         esac;;
1641 *) case "\$silent" in
1642         true) case "\$rp" in
1643                 '') ans='';;
1644                 esac;;
1645         esac;;
1646 esac
1647 while expr "X\$ans" : "X!" >/dev/null; do
1648         read answ
1649         set x \$xxxm
1650         shift
1651         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1652         case  "\$answ" in
1653         "!")
1654                 sh 1>&4
1655                 echo " "
1656                 $myecho
1657                 ;;
1658         !*)
1659                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1660                 shift
1661                 sh 1>&4 -c "\$*"
1662                 echo " "
1663                 $myecho
1664                 ;;
1665         "\$ans")
1666                 case "\$ans" in
1667                 \\&*)
1668                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1669                         shift
1670                         case "\$1" in
1671                         -d)
1672                                 fastread=yes
1673                                 echo "(OK, I'll run with -d after this question.)" >&4
1674                                 ;;
1675                         -*)
1676                                 echo "*** Sorry, \$1 not supported yet." >&4
1677                                 ;;
1678                         esac
1679                         $myecho
1680                         ans=!
1681                         ;;
1682                 esac;;
1683         *)
1684                 case "\$aok" in
1685                 y)
1686                         echo "*** Substitution done -- please confirm."
1687                         xxxm="\$ans"
1688                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1689                         xxxm="\$ans"
1690                         ans=!
1691                         ;;
1692                 *)
1693                         echo "*** Error -- try again."
1694                         ans=!
1695                         ;;
1696                 esac
1697                 $myecho
1698                 ;;
1699         esac
1700         case "\$ans\$xxxm\$nostick" in
1701         '')
1702                 ans=!
1703                 $myecho
1704                 ;;
1705         esac
1706 done
1707 case "\$ans" in
1708 '') ans="\$xxxm";;
1709 esac
1710 EOSC
1711
1712 : create .config dir to save info across Configure sessions
1713 test -d ../.config || mkdir ../.config
1714 cat >../.config/README <<EOF
1715 This directory created by Configure to save information that should
1716 persist across sessions for $package.
1717
1718 You may safely delete it if you wish.
1719 EOF
1720
1721 : general instructions
1722 needman=true
1723 firsttime=true
1724 user=`(logname) 2>/dev/null`
1725 case "$user" in
1726 '') user=`whoami 2>&1`;;
1727 esac
1728 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1729         firsttime=false
1730         echo " "
1731         rp='Would you like to see the instructions?'
1732         dflt=n
1733         . ./myread
1734         case "$ans" in
1735         [yY]*) ;;
1736         *) needman=false;;
1737         esac
1738 fi
1739 if $needman; then
1740         cat <<EOH
1741
1742 This installation shell script will examine your system and ask you questions
1743 to determine how the perl5 package should be installed. If you get
1744 stuck on a question, you may use a ! shell escape to start a subshell or
1745 execute a command.  Many of the questions will have default answers in square
1746 brackets; typing carriage return will give you the default.
1747
1748 On some of the questions which ask for file or directory names you are allowed
1749 to use the ~name construct to specify the login directory belonging to "name",
1750 even if you don't have a shell which knows about that.  Questions where this is
1751 allowed will be marked "(~name ok)".
1752
1753 EOH
1754         rp=''
1755         dflt='Type carriage return to continue'
1756         . ./myread
1757         cat <<'EOH'
1758
1759 The prompter used in this script allows you to use shell variables and
1760 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1761 in the default answer, as if the default line was a set of arguments given to a
1762 script shell.  This means you may also use $* to repeat the whole default line,
1763 so you do not have to re-type everything to add something to the default.
1764
1765 Everytime there is a substitution, you will have to confirm.  If there is an
1766 error (e.g. an unmatched backtick), the default answer will remain unchanged
1767 and you will be prompted again.
1768
1769 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1770 the questions and use the computed defaults (or the previous answers if there
1771 was already a config.sh file). Type 'Configure -h' for a list of options.
1772 You may also start interactively and then answer '& -d' at any prompt to turn
1773 on the non-interactive behaviour for the remainder of the execution.
1774
1775 EOH
1776         . ./myread
1777         cat <<EOH
1778
1779 Much effort has been expended to ensure that this shell script will run on any
1780 Unix system.  If despite that it blows up on yours, your best bet is to edit
1781 Configure and run it again.  If you can't run Configure for some reason,
1782 you'll have to generate a config.sh file by hand.  Whatever problems you
1783 have, let me (perlbug@perl.com) know how I blew it.
1784
1785 This installation script affects things in two ways:
1786
1787 1) it may do direct variable substitutions on some of the files included
1788    in this kit.
1789 2) it builds a config.h file for inclusion in C programs.  You may edit
1790    any of these files as the need arises after running this script.
1791
1792 If you make a mistake on a question, there is no easy way to back up to it
1793 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1794 files.  Configure will offer to let you do this before it runs the SH files.
1795
1796 EOH
1797         dflt='Type carriage return to continue'
1798         . ./myread
1799         case "$firsttime" in
1800         true) echo $user >>../.config/instruct;;
1801         esac
1802 fi
1803
1804 : find out where common programs are
1805 echo " "
1806 echo "Locating common programs..." >&4
1807 cat <<EOSC >loc
1808 $startsh
1809 case \$# in
1810 0) exit 1;;
1811 esac
1812 thing=\$1
1813 shift
1814 dflt=\$1
1815 shift
1816 for dir in \$*; do
1817         case "\$thing" in
1818         .)
1819         if test -d \$dir/\$thing; then
1820                 echo \$dir
1821                 exit 0
1822         fi
1823         ;;
1824         *)
1825         for thisthing in \$dir/\$thing; do
1826                 : just loop through to pick last item
1827         done
1828         if test -f \$thisthing; then
1829                 echo \$thisthing
1830                 exit 0
1831         elif test -f \$dir/\$thing.exe; then
1832                 if test -n "$DJGPP"; then
1833                         echo \$dir/\$thing.exe
1834                 else
1835                         : on Eunice apparently
1836                         echo \$dir/\$thing
1837                 fi
1838                 exit 0
1839         fi
1840         ;;
1841         esac
1842 done
1843 echo \$dflt
1844 exit 1
1845 EOSC
1846 chmod +x loc
1847 $eunicefix loc
1848 loclist="
1849 awk
1850 cat
1851 comm
1852 cp
1853 echo
1854 expr
1855 grep
1856 ls
1857 make
1858 mkdir
1859 rm
1860 sed
1861 sort
1862 touch
1863 tr
1864 uniq
1865 "
1866 trylist="
1867 Mcc
1868 ar
1869 byacc
1870 cpp
1871 csh
1872 date
1873 egrep
1874 gzip
1875 less
1876 ln
1877 more
1878 nm
1879 nroff
1880 pg
1881 test
1882 uname
1883 zip
1884 "
1885 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1886 pth="$pth /lib /usr/lib"
1887 for file in $loclist; do
1888         eval xxx=\$$file
1889         case "$xxx" in
1890         /*|?:[\\/]*)
1891                 if test -f "$xxx"; then
1892                         : ok
1893                 else
1894                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1895                         xxx=`./loc $file $file $pth`
1896                 fi
1897                 ;;
1898         '') xxx=`./loc $file $file $pth`;;
1899         *) xxx=`./loc $xxx $xxx $pth`;;
1900         esac
1901         eval $file=$xxx
1902         eval _$file=$xxx
1903         case "$xxx" in
1904         /*)
1905                 echo $file is in $xxx.
1906                 ;;
1907         ?:[\\/]*)
1908                 echo $file is in $xxx.
1909                 ;;
1910         *)
1911                 echo "I don't know where '$file' is, and my life depends on it." >&4
1912                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1913                 exit 1
1914                 ;;
1915         esac
1916 done
1917 echo " "
1918 echo "Don't worry if any of the following aren't found..."
1919 say=offhand
1920 for file in $trylist; do
1921         eval xxx=\$$file
1922         case "$xxx" in
1923         /*|?:[\\/]*)
1924                 if test -f "$xxx"; then
1925                         : ok
1926                 else
1927                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1928                         xxx=`./loc $file $file $pth`
1929                 fi
1930                 ;;
1931         '') xxx=`./loc $file $file $pth`;;
1932         *) xxx=`./loc $xxx $xxx $pth`;;
1933         esac
1934         eval $file=$xxx
1935         eval _$file=$xxx
1936         case "$xxx" in
1937         /*)
1938                 echo $file is in $xxx.
1939                 ;;
1940         ?:[\\/]*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         *)
1944                 echo "I don't see $file out there, $say."
1945                 say=either
1946                 ;;
1947         esac
1948 done
1949 case "$egrep" in
1950 egrep)
1951         echo "Substituting grep for egrep."
1952         egrep=$grep
1953         ;;
1954 esac
1955 case "$ln" in
1956 ln)
1957         echo "Substituting cp for ln."
1958         ln=$cp
1959         ;;
1960 esac
1961 case "$test" in
1962 test)
1963         echo "Hopefully test is built into your sh."
1964         ;;
1965 *)
1966         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1967                 echo "Using the test built into your sh."
1968                 test=test
1969                 _test=test
1970         fi
1971         ;;
1972 esac
1973 case "$echo" in
1974 echo)
1975         echo "Hopefully echo is built into your sh."
1976         ;;
1977 '') ;;
1978 *)
1979         echo " "
1980 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1981         $echo $n "hi there$c" >foo1
1982         echo $n "hi there$c" >foo2
1983         if cmp foo1 foo2 >/dev/null 2>&1; then
1984                 echo "They are compatible.  In fact, they may be identical."
1985         else
1986                 case "$n" in
1987                 '-n') n='' c='\c';;
1988                 *) n='-n' c='';;
1989                 esac
1990                 cat <<FOO
1991 They are not compatible!  You are probably running ksh on a non-USG system.
1992 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1993 have echo built in and we may have to run some Bourne shell scripts.  That
1994 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1995
1996 FOO
1997                 $echo $n "The star should be here-->$c"
1998                 $echo "*"
1999         fi
2000         $rm -f foo1 foo2
2001         ;;
2002 esac
2003
2004 : determine whether symbolic links are supported
2005 echo " "
2006 $touch blurfl
2007 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2008         echo "Symbolic links are supported." >&4
2009         lns="$ln -s"
2010 else
2011         echo "Symbolic links are NOT supported." >&4
2012         lns="$ln"
2013 fi
2014 $rm -f blurfl sym
2015
2016 : see whether [:lower:] and [:upper:] are supported character classes
2017 echo " "
2018 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2019 ABYZ)
2020         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2021         up='[:upper:]'
2022         low='[:lower:]'
2023         ;;
2024 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2025         # (0xc9 and 0xd1), therefore that is a nice testing point.
2026         if test "X$up" = X -o "X$low" = X; then
2027             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2028             ij) up='[A-Z]'
2029                 low='[a-z]'
2030                 ;;
2031             esac
2032         fi
2033         if test "X$up" = X -o "X$low" = X; then
2034             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2035             ij) up='A-Z'
2036                 low='a-z'
2037                 ;;
2038             esac
2039         fi
2040         if test "X$up" = X -o "X$low" = X; then
2041             case "`echo IJ | od -x 2>/dev/null`" in
2042             *C9D1*|*c9d1*)
2043                 echo "Hey, this might be EBCDIC." >&4
2044                 if test "X$up" = X -o "X$low" = X; then
2045                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2046                     ij) up='[A-IJ-RS-Z]'
2047                         low='[a-ij-rs-z]'
2048                         ;;
2049                     esac
2050                 fi
2051                 if test "X$up" = X -o "X$low" = X; then
2052                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2053                     ij) up='A-IJ-RS-Z'
2054                         low='a-ij-rs-z'
2055                         ;;
2056                     esac
2057                 fi
2058                 ;;
2059             esac
2060         fi
2061 esac
2062 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2063 ij)
2064     echo "Using $up and $low to convert case." >&4
2065     ;;
2066 *)
2067     echo "I don't know how to translate letters from upper to lower case." >&4
2068     echo "Your tr is not acting any way I know of." >&4
2069     exit 1
2070     ;;
2071 esac
2072 : set up the translation script tr, must be called with ./tr of course
2073 cat >tr <<EOSC
2074 $startsh
2075 case "\$1\$2" in
2076 '[A-Z][a-z]') exec $tr '$up' '$low';;
2077 '[a-z][A-Z]') exec $tr '$low' '$up';;
2078 esac
2079 exec $tr "\$@"
2080 EOSC
2081 chmod +x tr
2082 $eunicefix tr
2083
2084 : Try to determine whether config.sh was made on this system
2085 case "$config_sh" in
2086 '')
2087 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2088 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2089 # because the A-Z/a-z are not consecutive.
2090 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2091         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2092 newmyuname="$myuname"
2093 dflt=n
2094 case "$knowitall" in
2095 '')
2096         if test -f ../config.sh; then
2097                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2098                         eval "`grep myuname= ../config.sh`"
2099                 fi
2100                 if test "X$myuname" = "X$newmyuname"; then
2101                         dflt=y
2102                 fi
2103         fi
2104         ;;
2105 *) dflt=y;;
2106 esac
2107
2108 : Get old answers from old config file if Configure was run on the
2109 : same system, otherwise use the hints.
2110 hint=default
2111 cd ..
2112 if test -f config.sh; then
2113         echo " "
2114         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2115         . UU/myread
2116         case "$ans" in
2117         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2118         *)  echo "Fetching default answers from your old config.sh file..." >&4
2119                 tmp_n="$n"
2120                 tmp_c="$c"
2121                 tmp_sh="$sh"
2122                 . ./config.sh
2123                 cp config.sh UU
2124                 n="$tmp_n"
2125                 c="$tmp_c"
2126                 : Older versions did not always set $sh.  Catch re-use of such
2127                 : an old config.sh.
2128                 case "$sh" in
2129                 '') sh="$tmp_sh" ;;
2130                 esac
2131                 hint=previous
2132                 ;;
2133         esac
2134 fi
2135 if test ! -f config.sh; then
2136         $cat <<EOM
2137
2138 First time through, eh?  I have some defaults handy for some systems
2139 that need some extra help getting the Configure answers right:
2140
2141 EOM
2142         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2143         dflt=''
2144         : Half the following guesses are probably wrong... If you have better
2145         : tests or hints, please send them to perlbug@perl.com
2146         : The metaconfig authors would also appreciate a copy...
2147         $test -f /irix && osname=irix
2148         $test -f /xenix && osname=sco_xenix
2149         $test -f /dynix && osname=dynix
2150         $test -f /dnix && osname=dnix
2151         $test -f /lynx.os && osname=lynxos
2152         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2153         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2154         $test -f /bin/mips && /bin/mips && osname=mips
2155         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2156                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2157         $test -d /usr/apollo/bin && osname=apollo
2158         $test -f /etc/saf/_sactab && osname=svr4
2159         $test -d /usr/include/minix && osname=minix
2160         if $test -d /MachTen -o -d /MachTen_Folder; then
2161                 osname=machten
2162                 if $test -x /sbin/version; then
2163                         osvers=`/sbin/version | $awk '{print $2}' |
2164                         $sed -e 's/[A-Za-z]$//'`
2165                 elif $test -x /usr/etc/version; then
2166                         osvers=`/usr/etc/version | $awk '{print $2}' |
2167                         $sed -e 's/[A-Za-z]$//'`
2168                 else
2169                         osvers="$2.$3"
2170                 fi
2171         fi
2172        $test -f /sys/posix.dll &&
2173                $test -f /usr/bin/what &&
2174                set X `/usr/bin/what /sys/posix.dll` &&
2175                $test "$3" = UWIN &&
2176                osname=uwin &&
2177                osvers="$5"
2178         if $test -f $uname; then
2179                 set X $myuname
2180                 shift
2181
2182                 case "$5" in
2183                 fps*) osname=fps ;;
2184                 mips*)
2185                         case "$4" in
2186                         umips) osname=umips ;;
2187                         *) osname=mips ;;
2188                         esac;;
2189                 [23]100) osname=mips ;;
2190                 next*) osname=next ;;
2191                 i386*)
2192                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2193                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2194                                 osname='sco'
2195                                 osvers=$tmp
2196                         elif $test -f /etc/kconfig; then
2197                                 osname=isc
2198                                 if test "$lns" = "$ln -s"; then
2199                                         osvers=4
2200                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2201                                         osvers=3
2202                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2203                                         osvers=2
2204                                 fi
2205                         fi
2206                         tmp=''
2207                         ;;
2208                 pc*)
2209                         if test -n "$DJGPP"; then
2210                                 osname=dos
2211                                 osvers=djgpp
2212                         fi
2213                         ;;
2214                 esac
2215
2216                 case "$1" in
2217                 aix) osname=aix
2218                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2219                         case "$tmp" in
2220                         'not found') osvers="$4"."$3" ;;
2221                         '<3240'|'<>3240') osvers=3.2.0 ;;
2222                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2223                         '=3250'|'>3250') osvers=3.2.5 ;;
2224                         *) osvers=$tmp;;
2225                         esac
2226                         ;;
2227                 *dc.osx) osname=dcosx
2228                         osvers="$3"
2229                         ;;
2230                 dnix) osname=dnix
2231                         osvers="$3"
2232                         ;;
2233                 domainos) osname=apollo
2234                         osvers="$3"
2235                         ;;
2236                 dgux) osname=dgux 
2237                         osvers="$3"
2238                         ;;
2239                 dynixptx*) osname=dynixptx
2240                         osvers=`echo "$4"|sed 's/^v//'`
2241                         ;;
2242                 freebsd) osname=freebsd 
2243                         osvers="$3" ;;
2244                 genix) osname=genix ;;
2245                 hp*) osname=hpux 
2246                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2247                         ;;
2248                 irix*) osname=irix
2249                         case "$3" in
2250                         4*) osvers=4 ;;
2251                         5*) osvers=5 ;;
2252                         *)      osvers="$3" ;;
2253                         esac
2254                         ;;
2255                 linux) osname=linux
2256                         case "$3" in
2257                         *)      osvers="$3" ;;
2258                         esac
2259                         ;;
2260                 MiNT) osname=mint
2261                         ;;
2262                 netbsd*) osname=netbsd
2263                         osvers="$3"
2264                         ;;
2265                 news-os) osvers="$3"
2266                         case "$3" in
2267                         4*) osname=newsos4 ;;
2268                         *) osname=newsos ;;
2269                         esac
2270                         ;;
2271                 bsd386) osname=bsd386
2272                         osvers=`$uname -r`
2273                         ;;
2274                 POSIX-BC | posix-bc ) osname=posix-bc
2275                         osvers="$3"
2276                         ;;
2277                 powerux | power_ux | powermax_os | powermaxos | \
2278                 powerunix | power_unix) osname=powerux
2279                         osvers="$3"
2280                         ;;
2281                 next*) osname=next ;;
2282                 solaris) osname=solaris
2283                         case "$3" in
2284                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2285                         *)      osvers="$3" ;;
2286                         esac
2287                         ;;
2288                 sunos) osname=sunos
2289                         case "$3" in
2290                         5*) osname=solaris
2291                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2292                         *)      osvers="$3" ;;
2293                         esac
2294                         ;;
2295                 titanos) osname=titanos
2296                         case "$3" in
2297                         1*) osvers=1 ;;
2298                         2*) osvers=2 ;;
2299                         3*) osvers=3 ;;
2300                         4*) osvers=4 ;;
2301                         *)      osvers="$3" ;;
2302                         esac
2303                         ;;
2304                 ultrix) osname=ultrix
2305                         osvers="$3"
2306                         ;;
2307                 osf1|mls+)      case "$5" in
2308                                 alpha)
2309                                         osname=dec_osf
2310                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2311                                         ;;
2312                         hp*)    osname=hp_osf1  ;;
2313                         mips)   osname=mips_osf1 ;;
2314                         esac
2315                         ;;
2316                 unixware) osname=svr5
2317                         osvers="$4"
2318                         ;;
2319                 uts) osname=uts
2320                         osvers="$3"
2321                         ;;
2322                 qnx) osname=qnx
2323                         osvers="$4"
2324                         ;;
2325                 $2) case "$osname" in
2326                         *isc*) ;;
2327                         *freebsd*) ;;
2328                         svr*)
2329                                 : svr4.x or possibly later
2330                                 case "svr$3" in 
2331                                 ${osname}*)
2332                                         osname=svr$3
2333                                         osvers=$4
2334                                         ;;
2335                                 esac
2336                                 case "$osname" in
2337                                 svr4.0)
2338                                         : Check for ESIX
2339                                         if test -f /stand/boot ; then
2340                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2341                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2342                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2343                                                         if test -n "$isesix"; then
2344                                                                 osname=esix4
2345                                                         fi
2346                                                 fi
2347                                         fi
2348                                         ;;
2349                                 esac
2350                                 ;;
2351                         *)      if test -f /etc/systemid; then
2352                                         osname=sco
2353                                         set `echo $3 | $sed 's/\./ /g'` $4
2354                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2355                                                 osvers=$1.$2.$3
2356                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2357                                                 osvers=$1.$2
2358                                         elif $test -f $src/hints/sco_$1.sh; then
2359                                                 osvers=$1
2360                                         fi
2361                                 else
2362                                         case "$osname" in
2363                                         '') : Still unknown.  Probably a generic Sys V.
2364                                                 osname="sysv"
2365                                                 osvers="$3"
2366                                                 ;;
2367                                         esac
2368                                 fi
2369                                 ;;
2370                         esac
2371                         ;;
2372                 *)      case "$osname" in
2373                         '') : Still unknown.  Probably a generic BSD.
2374                                 osname="$1"
2375                                 osvers="$3"
2376                                 ;;
2377                         esac
2378                         ;;
2379                 esac
2380         else
2381                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2382                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2383                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2384                                 osname=news_os
2385                         fi
2386                         $rm -f UU/kernel.what
2387                 elif test -d c:/.; then
2388                         set X $myuname
2389                         osname=os2
2390                         osvers="$5"
2391                 fi
2392         fi
2393         
2394         : Now look for a hint file osname_osvers, unless one has been
2395         : specified already.
2396         case "$hintfile" in
2397         ''|' ')
2398                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2399                 : Also try without trailing minor version numbers.
2400                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2401                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2402                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2403                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2404                 case "$file" in
2405                 '') dflt=none ;;
2406                 *)  case "$osvers" in
2407                         '') dflt=$file
2408                                 ;;
2409                         *)  if $test -f $src/hints/$file.sh ; then
2410                                         dflt=$file
2411                                 elif $test -f $src/hints/$xfile.sh ; then
2412                                         dflt=$xfile
2413                                 elif $test -f $src/hints/$xxfile.sh ; then
2414                                         dflt=$xxfile
2415                                 elif $test -f $src/hints/$xxxfile.sh ; then
2416                                         dflt=$xxxfile
2417                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2418                                         dflt=$xxxxfile
2419                                 elif $test -f "$src/hints/${osname}.sh" ; then
2420                                         dflt="${osname}"
2421                                 else
2422                                         dflt=none
2423                                 fi
2424                                 ;;
2425                         esac
2426                         ;;
2427                 esac
2428                 if $test -f Policy.sh ; then
2429                         case "$dflt" in
2430                         *Policy*) ;;
2431                         none) dflt="Policy" ;;
2432                         *) dflt="Policy $dflt" ;;
2433                         esac
2434                 fi
2435                 ;;
2436         *)
2437                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2438                 ;;
2439         esac
2440
2441         if $test -f Policy.sh ; then
2442                 $cat <<EOM
2443
2444 There's also a Policy hint file available, which should make the
2445 site-specific (policy) questions easier to answer.
2446 EOM
2447
2448         fi
2449
2450         $cat <<EOM
2451
2452 You may give one or more space-separated answers, or "none" if appropriate.
2453 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2454 is a good thing.  DO NOT give a wrong version or a wrong OS.
2455
2456 EOM
2457
2458         rp="Which of these apply, if any?"
2459         . UU/myread
2460         tans=$ans
2461         for file in $tans; do
2462                 if $test X$file = XPolicy -a -f Policy.sh; then
2463                         . Policy.sh
2464                         $cat Policy.sh >> UU/config.sh
2465                 elif $test -f $src/hints/$file.sh; then
2466                         . $src/hints/$file.sh
2467                         $cat $src/hints/$file.sh >> UU/config.sh
2468                 elif $test X$tans = X -o X$tans = Xnone ; then
2469                         : nothing
2470                 else
2471                         : Give one chance to correct a possible typo.
2472                         echo "$file.sh does not exist"
2473                         dflt=$file
2474                         rp="hint to use instead?"
2475                         . UU/myread
2476                         for file in $ans; do
2477                                 if $test -f "$src/hints/$file.sh"; then
2478                                         . $src/hints/$file.sh
2479                                         $cat $src/hints/$file.sh >> UU/config.sh
2480                                 elif $test X$ans = X -o X$ans = Xnone ; then
2481                                         : nothing
2482                                 else
2483                                         echo "$file.sh does not exist -- ignored."
2484                                 fi
2485                         done
2486                 fi
2487         done
2488
2489         hint=recommended
2490         : Remember our hint file for later.
2491         if $test -f "$src/hints/$file.sh" ; then
2492                 hintfile="$file"
2493         else
2494                 hintfile=''
2495         fi
2496 fi
2497 cd UU
2498 ;;
2499 *)
2500         echo " "
2501         echo "Fetching default answers from $config_sh..." >&4
2502         tmp_n="$n"
2503         tmp_c="$c"
2504         cd ..
2505         cp $config_sh config.sh 2>/dev/null
2506         chmod +w config.sh
2507         . ./config.sh
2508         cd UU
2509         cp ../config.sh .
2510         n="$tmp_n"
2511         c="$tmp_c"
2512         hint=previous
2513         ;;
2514 esac
2515 test "$override" && . ./optdef.sh
2516 myuname="$newmyuname"
2517
2518 : Restore computed paths
2519 for file in $loclist $trylist; do
2520         eval $file="\$_$file"
2521 done
2522
2523 cat << EOM
2524
2525 Configure uses the operating system name and version to set some defaults.
2526 The default value is probably right if the name rings a bell. Otherwise,
2527 since spelling matters for me, either accept the default or answer "none"
2528 to leave it blank.
2529
2530 EOM
2531 case "$osname" in
2532         ''|' ')
2533                 case "$hintfile" in
2534                 ''|' '|none) dflt=none ;;
2535                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2536                 esac
2537                 ;;
2538         *) dflt="$osname" ;;
2539 esac
2540 rp="Operating system name?"
2541 . ./myread
2542 case "$ans" in
2543 none)  osname='' ;;
2544 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2545 esac
2546 echo " "
2547 case "$osvers" in
2548         ''|' ')
2549                 case "$hintfile" in
2550                 ''|' '|none) dflt=none ;;
2551                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2552                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2553                         case "$dflt" in
2554                         ''|' ') dflt=none ;;
2555                         esac
2556                         ;;
2557                 esac
2558                 ;;
2559         *) dflt="$osvers" ;;
2560 esac
2561 rp="Operating system version?"
2562 . ./myread
2563 case "$ans" in
2564 none)  osvers='' ;;
2565 *) osvers="$ans" ;;
2566 esac
2567
2568
2569 . ./posthint.sh
2570
2571 : who configured the system
2572 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2573 cf_by=`(logname) 2>/dev/null`
2574 case "$cf_by" in
2575 "")
2576         cf_by=`(whoami) 2>/dev/null`
2577         case "$cf_by" in
2578         "") cf_by=unknown ;;
2579         esac ;;
2580 esac
2581
2582 : set up the script used to warn in case of inconsistency
2583 cat <<EOS >whoa
2584 $startsh
2585 EOS
2586 cat <<'EOSC' >>whoa
2587 dflt=y
2588 echo " "
2589 echo "*** WHOA THERE!!! ***" >&4
2590 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2591 rp="    Keep the $hint value?"
2592 . ./myread
2593 case "$ans" in
2594 y) td=$was; tu=$was;;
2595 esac
2596 EOSC
2597
2598 : function used to set $1 to $val
2599 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2600 case "$val$was" in
2601 $define$undef) . ./whoa; eval "$var=\$td";;
2602 $undef$define) . ./whoa; eval "$var=\$tu";;
2603 *) eval "$var=$val";;
2604 esac'
2605
2606 cat <<EOM
2607
2608 Perl can be built to take advantage of threads, on some systems.
2609 To do so, Configure must be run with -Dusethreads.
2610
2611 Note that threading is a highly experimental feature, and
2612 some known race conditions still remain.  If you choose to try
2613 it, be very sure to not actually deploy it for production
2614 purposes.  README.threads has more details, and is required
2615 reading if you enable threads.
2616 EOM
2617 case "$usethreads" in
2618 $define|true|[yY]*)     dflt='y';;
2619 *) dflt='n';;
2620 esac
2621 rp='Build a threading Perl?'
2622 . ./myread
2623 case "$ans" in
2624 y|Y)    val="$define" ;;     
2625 *)      val="$undef" ;;
2626 esac
2627 set usethreads
2628 eval $setvar 
2629
2630 case "$d_oldpthreads" in
2631 '')     : Configure tests would be welcome here.  For now, assume undef.
2632         val="$undef" ;;
2633 *)      val="$d_oldpthreads" ;;
2634 esac
2635 set d_oldpthreads
2636 eval $setvar
2637
2638
2639 case "$usethreads" in
2640 "$define"|true|[yY]*)
2641 : Look for a hint-file generated 'call-back-unit'.  If the
2642 : user has specified that a threading perl is to be built,
2643 : we may need to set or change some other defaults.
2644         if $test -f usethreads.cbu; then
2645                 echo "Your platform has some specific hints for threaded builds, using them..."
2646                 . ./usethreads.cbu
2647         else
2648                 $cat <<EOM
2649 (Your platform doesn't have any specific hints for threaded builds.
2650  Assuming POSIX threads, then.)
2651 EOM
2652         fi
2653     ;;
2654 esac
2655
2656 cat <<EOM
2657
2658 Perl can be built so that multiple Perl interpreters can coexist
2659 within the same Perl executable.  To do so, Configure must be run with
2660 -Dusemultiplicity.
2661
2662 Normally you do not need this and you should answer no.
2663
2664 EOM
2665 case "$usemultiplicity" in
2666 $define|true|[yY]*)     dflt='y';;
2667 *) dflt='n';;
2668 esac
2669 rp='Build Perl for multiplicity?'
2670 . ./myread
2671 case "$ans" in
2672 y|Y)    val="$define" ;;     
2673 *)      val="$undef" ;;
2674 esac
2675 set usemultiplicity
2676 eval $setvar 
2677
2678 : determine where manual pages are on this system
2679 echo " "
2680 case "$sysman" in
2681 '') 
2682         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2683         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2684         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2685         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2686         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2687         sysman=`./loc . /usr/man/man1 $syspath`
2688         ;;
2689 esac
2690 if $test -d "$sysman"; then
2691         echo "System manual is in $sysman." >&4
2692 else
2693         echo "Could not find manual pages in source form." >&4
2694 fi
2695
2696 : see what memory models we can support
2697 case "$models" in
2698 '')
2699         $cat >pdp11.c <<'EOP'
2700 int main() {
2701 #ifdef pdp11
2702         exit(0);
2703 #else
2704         exit(1);
2705 #endif
2706 }
2707 EOP
2708         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2709         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2710                 dflt='unsplit split'
2711         else
2712                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2713                 case "$tans" in
2714                 X) dflt='none';;
2715                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2716                                 dflt='small'
2717                         else
2718                                 dflt=''
2719                         fi
2720                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2721                                 dflt="$dflt medium"
2722                         fi
2723                         if $test -d /lib/large || $test -d /usr/lib/large; then
2724                                 dflt="$dflt large"
2725                         fi
2726                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2727                                 dflt="$dflt huge"
2728                         fi
2729                 esac
2730         fi;;
2731 *) dflt="$models";;
2732 esac
2733 $cat <<EOM
2734  
2735 Some systems have different model sizes.  On most systems they are called
2736 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2737 split.  If your system doesn't support different memory models, say "none".
2738 If you wish to force everything to one memory model, say "none" here and
2739 put the appropriate flags later when it asks you for other cc and ld flags.
2740 Venix systems may wish to put "none" and let the compiler figure things out.
2741 (In the following question multiple model names should be space separated.)
2742
2743 The default for most systems is "none".
2744
2745 EOM
2746 rp="Which memory models are supported?"
2747 . ./myread
2748 models="$ans"
2749
2750 case "$models" in
2751 none)
2752         small=''
2753         medium=''
2754         large=''
2755         huge=''
2756         unsplit=''
2757         split=''
2758         ;;
2759 *split)
2760         case "$split" in
2761         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2762                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2763                         dflt='-i'
2764                 else
2765                         dflt='none'
2766                 fi;;
2767         *) dflt="$split";;
2768         esac
2769         rp="What flag indicates separate I and D space?"
2770         . ./myread
2771         tans="$ans"
2772         case "$tans" in
2773         none) tans='';;
2774         esac
2775         split="$tans"
2776         unsplit='';;
2777 *large*|*small*|*medium*|*huge*)
2778         case "$models" in
2779         *large*)
2780                 case "$large" in
2781                 '') dflt='-Ml';;
2782                 *) dflt="$large";;
2783                 esac
2784         rp="What flag indicates large model?"
2785         . ./myread
2786         tans="$ans"
2787         case "$tans" in
2788         none) tans='';
2789         esac
2790         large="$tans";;
2791         *) large='';;
2792         esac
2793         case "$models" in
2794         *huge*) case "$huge" in
2795                 '') dflt='-Mh';;
2796                 *) dflt="$huge";;
2797                 esac
2798                 rp="What flag indicates huge model?"
2799                 . ./myread
2800                 tans="$ans"
2801                 case "$tans" in
2802                 none) tans='';
2803                 esac
2804                 huge="$tans";;
2805         *) huge="$large";;
2806         esac
2807         case "$models" in
2808         *medium*) case "$medium" in
2809                 '') dflt='-Mm';;
2810                 *) dflt="$medium";;
2811                 esac
2812                 rp="What flag indicates medium model?"
2813                 . ./myread
2814                 tans="$ans"
2815                 case "$tans" in
2816                 none) tans='';
2817                 esac
2818                 medium="$tans";;
2819         *) medium="$large";;
2820         esac
2821         case "$models" in
2822         *small*) case "$small" in
2823                 '') dflt='none';;
2824                 *) dflt="$small";;
2825                 esac
2826                 rp="What flag indicates small model?"
2827                 . ./myread
2828                 tans="$ans"
2829                 case "$tans" in
2830                 none) tans='';
2831                 esac
2832                 small="$tans";;
2833         *) small='';;
2834         esac
2835         ;;
2836 *)
2837         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2838         ;;
2839 esac
2840 $rm -f pdp11.* pdp11
2841
2842 : make some quick guesses about what we are up against
2843 echo " "
2844 $echo $n "Hmm...  $c"
2845 echo exit 1 >bsd
2846 echo exit 1 >usg
2847 echo exit 1 >v7
2848 echo exit 1 >osf1
2849 echo exit 1 >eunice
2850 echo exit 1 >xenix
2851 echo exit 1 >venix
2852 echo exit 1 >os2
2853 d_bsd="$undef"
2854 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2855 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2856 then
2857         echo "Looks kind of like an OSF/1 system, but we'll see..."
2858         echo exit 0 >osf1
2859 elif test `echo abc | tr a-z A-Z` = Abc ; then
2860         xxx=`./loc addbib blurfl $pth`
2861         if $test -f $xxx; then
2862         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2863                 echo exit 0 >bsd
2864                 echo exit 0 >usg
2865         else
2866                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2867                         echo "Looks kind of like an extended USG system, but we'll see..."
2868                 else
2869                         echo "Looks kind of like a USG system, but we'll see..."
2870                 fi
2871                 echo exit 0 >usg
2872         fi
2873 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2874         echo "Looks kind of like a BSD system, but we'll see..."
2875         d_bsd="$define"
2876         echo exit 0 >bsd
2877 else
2878         echo "Looks kind of like a Version 7 system, but we'll see..."
2879         echo exit 0 >v7
2880 fi
2881 case "$eunicefix" in
2882 *unixtovms*)
2883         $cat <<'EOI'
2884 There is, however, a strange, musty smell in the air that reminds me of
2885 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2886 EOI
2887         echo exit 0 >eunice
2888         d_eunice="$define"
2889 : it so happens the Eunice I know will not run shell scripts in Unix format
2890         ;;
2891 *)
2892         echo " "
2893         echo "Congratulations.  You aren't running Eunice."
2894         d_eunice="$undef"
2895         ;;
2896 esac
2897 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2898 case "$p_" in
2899 :) ;;
2900 *)
2901         $cat <<'EOI'
2902 I have the feeling something is not exactly right, however...don't tell me...
2903 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2904 EOI
2905         echo exit 0 >os2
2906         ;;
2907 esac
2908 if test -f /xenix; then
2909         echo "Actually, this looks more like a XENIX system..."
2910         echo exit 0 >xenix
2911         d_xenix="$define"
2912 else
2913         echo " "
2914         echo "It's not Xenix..."
2915         d_xenix="$undef"
2916 fi
2917 chmod +x xenix
2918 $eunicefix xenix
2919 if test -f /venix; then
2920         echo "Actually, this looks more like a VENIX system..."
2921         echo exit 0 >venix
2922 else
2923         echo " "
2924         if ./xenix; then
2925                 : null
2926         else
2927                 echo "Nor is it Venix..."
2928         fi
2929 fi
2930 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2931 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2932 $rm -f foo
2933
2934 : see if we need a special compiler
2935 echo " "
2936 if ./usg; then
2937         case "$cc" in
2938         '') case "$Mcc" in
2939                 /*) dflt='Mcc';;
2940                 *) case "$large" in
2941                         -M*) dflt='cc';;
2942                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2943                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2944                                                 dflt='cc'
2945                                         else
2946                                                 dflt='cc -M'
2947                                         fi
2948                                 else
2949                                         dflt='cc'
2950                                 fi;;
2951                         esac;;
2952                 esac;;
2953         *)  dflt="$cc";;
2954         esac
2955         case "$dflt" in
2956         *M*)    $cat <<'EOM'
2957 On some older systems the default C compiler will not resolve multiple global
2958 references that happen to have the same name.  On some such systems the "Mcc"
2959 command may be used to force these to be resolved.  On other systems a "cc -M"
2960 command is required.  (Note that the -M flag on other systems indicates a
2961 memory model to use!) If you have the Gnu C compiler, you might wish to use
2962 that instead.
2963
2964 EOM
2965         ;;
2966         esac
2967         rp="Use which C compiler?"
2968         . ./myread
2969         cc="$ans"
2970 else
2971         case "$cc" in
2972         '') dflt=cc;;
2973         *) dflt="$cc";;
2974         esac
2975         rp="Use which C compiler?"
2976         . ./myread
2977         cc="$ans"
2978 fi
2979 : Look for a hint-file generated 'call-back-unit'.  Now that the
2980 : user has specified the compiler, we may need to set or change some
2981 : other defaults.
2982 if $test -f cc.cbu; then
2983     . ./cc.cbu
2984 fi
2985 echo " "
2986 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2987 $cat >gccvers.c <<EOM
2988 #include <stdio.h>
2989 int main() {
2990 #ifdef __GNUC__
2991 #ifdef __VERSION__
2992         printf("%s\n", __VERSION__);
2993 #else
2994         printf("%s\n", "1");
2995 #endif
2996 #endif
2997         exit(0);
2998 }
2999 EOM
3000 if $cc -o gccvers gccvers.c; then
3001         gccversion=`./gccvers`
3002         case "$gccversion" in
3003         '') echo "You are not using GNU cc." ;;
3004         *)  echo "You are using GNU cc $gccversion." ;;
3005         esac
3006 else
3007         echo " "
3008         echo "*** WHOA THERE!!! ***" >&4
3009         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3010         case "$knowitall" in
3011         '')
3012         echo "    You'd better start hunting for one and let me know about it." >&4
3013                 exit 1
3014                 ;;
3015         esac
3016 fi
3017 $rm -f gccvers*
3018 case "$gccversion" in
3019 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3020 esac
3021
3022
3023 case "$usemorebits" in
3024 "$define"|true|[yY]*)
3025         use64bits="$define"
3026         uselongdouble="$define"
3027         usemorebits="$define"
3028         ;;
3029 *)      usemorebits="$undef"
3030         ;;
3031 esac
3032
3033
3034 cat <<EOM
3035
3036 Perl can be built to understand large files (files larger than 2 gigabytes)
3037 on some systems.  To do so, Configure must be run with -Duselargefiles.
3038
3039 If this doesn't make any sense to you, just accept the default.
3040 EOM
3041 case "$uselargefiles" in
3042 "$define"|true|[yY]*) dflt='y' ;;
3043 *)      dflt='n' ;;
3044 esac
3045 rp='Try to understand large files?'
3046 . ./myread
3047 case "$ans" in
3048 y|Y)    val="$define" ;;
3049 *)      val="$undef"  ;;
3050 esac
3051 set uselargefiles
3052 eval $setvar
3053 case "$uselargefiles" in
3054 "$define") use64bits="$define" ;;
3055 esac
3056
3057 cat <<EOM
3058
3059 Perl can be built to take advantage of explicit 64-bit interfaces,
3060 on some systems.  To do so, Configure must be run with -Duse64bits.
3061
3062 If this doesn't make any sense to you, just accept the default.
3063 EOM
3064 case "$use64bits" in
3065 $define|true|[yY]*)     dflt='y';;
3066 *) dflt='n';;
3067 esac
3068 rp='Try to use explicit 64-bit interfaces, if available?'
3069 . ./myread
3070 case "$ans" in
3071 y|Y) 
3072         val="$define"
3073         ;;     
3074 *)      
3075         val="$undef"
3076         ;;
3077 esac
3078 set use64bits
3079 eval $setvar
3080
3081 case "$archname64" in
3082 '') archname64='' ;;    # not a typo
3083 esac
3084
3085 case "$use64bits" in
3086 "$define"|true|[yY]*)
3087 : Look for a hint-file generated 'call-back-unit'.  If the
3088 : user has specified that a 64 bit perl is to be built,
3089 : we may need to set or change some other defaults.
3090         if $test -f use64bits.cbu; then
3091                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3092                 . ./use64bits.cbu
3093         else
3094                 $cat <<EOM
3095 (Your platform doesn't have any specific hints for 64-bit builds.
3096  This is probably okay, especially if your system is a true 64-bit system.)
3097 EOM
3098                 case "$gccversion" in
3099                 '')     ;;
3100                 *)      $cat <<EOM
3101 But since you seem to be using gcc,
3102 I will now add -DUSE_LONG_LONG to the compilation flags.
3103 EOM
3104                         ccflags="$ccflags -DUSE_LONG_LONG"
3105                         ;;
3106                 esac
3107         fi
3108         ;;
3109 esac
3110
3111 : determine the architecture name
3112 echo " "
3113 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3114         tarch=`arch`"-$osname"
3115 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3116         if uname -m > tmparch 2>&1 ; then
3117                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3118                         -e 's/$/'"-$osname/" tmparch`
3119         else
3120                 tarch="$osname"
3121         fi
3122         $rm -f tmparch
3123 else
3124         tarch="$osname"
3125 fi
3126 case "$myarchname" in
3127 ''|"$tarch") ;;
3128 *)
3129         echo "(Your architecture name used to be $myarchname.)"
3130         archname=''
3131         ;;
3132 esac
3133 myarchname="$tarch"
3134 case "$archname" in
3135 '') dflt="$tarch";;
3136 *) dflt="$archname";;
3137 esac
3138 rp='What is your architecture name'
3139 . ./myread
3140 archname="$ans"
3141 case "$usethreads" in
3142 $define)
3143         echo "Threads selected." >&4
3144         case "$archname" in
3145         *-thread*) echo "...and architecture name already has -thread." >&4
3146                 ;;
3147         *)      archname="$archname-thread"
3148                 echo "...setting architecture name to $archname." >&4
3149                 ;;
3150         esac
3151         ;;
3152 esac
3153 case "$usemultiplicity" in
3154 $define)
3155         echo "Multiplicity selected." >&4
3156         case "$archname" in
3157         *-multi*) echo "...and architecture name already has -multi." >&4
3158                 ;;
3159         *)      archname="$archname-multi"
3160                 echo "...setting architecture name to $archname." >&4
3161                 ;;
3162         esac
3163         ;;
3164 esac
3165 case "$use64bits" in
3166 $define)
3167         echo "Explicit 64-bitness selected." >&4
3168         case "$archname64" in
3169         '')
3170                 ;;
3171         *)
3172                 case "$archname" in
3173                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3174                         ;;
3175                 *)      archname="$archname-$archname64"
3176                         echo "...setting architecture name to $archname." >&4
3177                         ;;
3178                 esac
3179                 ;;
3180         esac
3181 esac
3182
3183 : decide how portable to be.  Allow command line overrides.
3184 case "$d_portable" in
3185 "$undef") ;;
3186 *)      d_portable="$define" ;;
3187 esac
3188
3189 : set up shell script to do ~ expansion
3190 cat >filexp <<EOSS
3191 $startsh
3192 : expand filename
3193 case "\$1" in
3194  ~/*|~)
3195         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3196         ;;
3197  ~*)
3198         if $test -f /bin/csh; then
3199                 /bin/csh -f -c "glob \$1"
3200                 failed=\$?
3201                 echo ""
3202                 exit \$failed
3203         else
3204                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3205                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3206                 if $test ! -d "\$dir"; then
3207                         me=\`basename \$0\`
3208                         echo "\$me: can't locate home directory for: \$name" >&2
3209                         exit 1
3210                 fi
3211                 case "\$1" in
3212                 */*)
3213                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3214                         ;;
3215                 *)
3216                         echo \$dir
3217                         ;;
3218                 esac
3219         fi
3220         ;;
3221 *)
3222         echo \$1
3223         ;;
3224 esac
3225 EOSS
3226 chmod +x filexp
3227 $eunicefix filexp
3228
3229 : now set up to get a file name
3230 cat <<EOS >getfile
3231 $startsh
3232 EOS
3233 cat <<'EOSC' >>getfile
3234 tilde=''
3235 fullpath=''
3236 already=''
3237 skip=''
3238 none_ok=''
3239 exp_file=''
3240 nopath_ok=''
3241 orig_rp="$rp"
3242 orig_dflt="$dflt"
3243 case "$gfpth" in
3244 '') gfpth='.' ;;
3245 esac
3246
3247 case "$fn" in
3248 *\(*)
3249         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3250         fn=`echo $fn | sed 's/(.*)//'`
3251         ;;
3252 esac
3253
3254 case "$fn" in
3255 *:*)
3256         loc_file=`expr $fn : '.*:\(.*\)'`
3257         fn=`expr $fn : '\(.*\):.*'`
3258         ;;
3259 esac
3260
3261 case "$fn" in
3262 *~*) tilde=true;;
3263 esac
3264 case "$fn" in
3265 */*) fullpath=true;;
3266 esac
3267 case "$fn" in
3268 *+*) skip=true;;
3269 esac
3270 case "$fn" in
3271 *n*) none_ok=true;;
3272 esac
3273 case "$fn" in
3274 *e*) exp_file=true;;
3275 esac
3276 case "$fn" in
3277 *p*) nopath_ok=true;;
3278 esac
3279
3280 case "$fn" in
3281 *f*) type='File';;
3282 *d*) type='Directory';;
3283 *l*) type='Locate';;
3284 esac
3285
3286 what="$type"
3287 case "$what" in
3288 Locate) what='File';;
3289 esac
3290
3291 case "$exp_file" in
3292 '')
3293         case "$d_portable" in
3294         "$define") ;;
3295         *) exp_file=true;;
3296         esac
3297         ;;
3298 esac
3299
3300 cd ..
3301 while test "$type"; do
3302         redo=''
3303         rp="$orig_rp"
3304         dflt="$orig_dflt"
3305         case "$tilde" in
3306         true) rp="$rp (~name ok)";;
3307         esac
3308         . UU/myread
3309         if test -f UU/getfile.ok && \
3310                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3311         then
3312                 value="$ans"
3313                 ansexp="$ans"
3314                 break
3315         fi
3316         case "$ans" in
3317         none)
3318                 value=''
3319                 ansexp=''
3320                 case "$none_ok" in
3321                 true) type='';;
3322                 esac
3323                 ;;
3324         *)
3325                 case "$tilde" in
3326                 '') value="$ans"
3327                         ansexp="$ans";;
3328                 *)
3329                         value=`UU/filexp $ans`
3330                         case $? in
3331                         0)
3332                                 if test "$ans" != "$value"; then
3333                                         echo "(That expands to $value on this system.)"
3334                                 fi
3335                                 ;;
3336                         *) value="$ans";;
3337                         esac
3338                         ansexp="$value"
3339                         case "$exp_file" in
3340                         '') value="$ans";;
3341                         esac
3342                         ;;
3343                 esac
3344                 case "$fullpath" in
3345                 true)
3346                         case "$ansexp" in
3347                         /*) value="$ansexp" ;;
3348                         *)
3349                                 redo=true
3350                                 case "$already" in
3351                                 true)
3352                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3353                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3354                                         ;;
3355                                 *)
3356                                 echo "Please give a full path name, starting with slash." >&4
3357                                         case "$tilde" in
3358                                         true)
3359                                 echo "Note that using ~name is ok provided it expands well." >&4
3360                                                 already=true
3361                                                 ;;
3362                                         esac
3363                                 esac
3364                                 ;;
3365                         esac
3366                         ;;
3367                 esac
3368                 case "$redo" in
3369                 '')
3370                         case "$type" in
3371                         File)
3372                                 for fp in $gfpth; do
3373                                         if test "X$fp" = X.; then
3374                                             pf="$ansexp"
3375                                         else    
3376                                             pf="$fp/$ansexp"
3377                                         fi
3378                                         if test -f "$pf"; then
3379                                                 type=''
3380                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3381                                         then
3382                                                 echo "($value is not a plain file, but that's ok.)"
3383                                                 type=''
3384                                         fi
3385                                         if test X"$type" = X; then
3386                                             value="$pf"
3387                                             break
3388                                         fi
3389                                 done
3390                                 ;;
3391                         Directory)
3392                                 for fp in $gfpth; do
3393                                         if test "X$fp" = X.; then
3394                                             pf="$ansexp"
3395                                         else    
3396                                             pf="$fp/$ansexp"
3397                                         fi
3398                                         if test -d "$pf"; then
3399                                                 type=''
3400                                                 value="$pf"
3401                                                 break
3402                                         fi
3403                                 done
3404                                 ;;
3405                         Locate)
3406                                 if test -d "$ansexp"; then
3407                                         echo "(Looking for $loc_file in directory $value.)"
3408                                         value="$value/$loc_file"
3409                                         ansexp="$ansexp/$loc_file"
3410                                 fi
3411                                 if test -f "$ansexp"; then
3412                                         type=''
3413                                 fi
3414                                 case "$nopath_ok" in
3415                                 true)   case "$value" in
3416                                         */*) ;;
3417                                         *)      echo "Assuming $value will be in people's path."
3418                                                 type=''
3419                                                 ;;
3420                                         esac
3421                                         ;;
3422                                 esac
3423                                 ;;
3424                         esac
3425
3426                         case "$skip" in
3427                         true) type='';
3428                         esac
3429
3430                         case "$type" in
3431                         '') ;;
3432                         *)
3433                                 if test "$fastread" = yes; then
3434                                         dflt=y
3435                                 else
3436                                         dflt=n
3437                                 fi
3438                                 rp="$what $value doesn't exist.  Use that name anyway?"
3439                                 . UU/myread
3440                                 dflt=''
3441                                 case "$ans" in
3442                                 y*) type='';;
3443                                 *) echo " ";;
3444                                 esac
3445                                 ;;
3446                         esac
3447                         ;;
3448                 esac
3449                 ;;
3450         esac
3451 done
3452 cd UU
3453 ans="$value"
3454 rp="$orig_rp"
3455 dflt="$orig_dflt"
3456 rm -f getfile.ok
3457 test "X$gfpthkeep" != Xy && gfpth=""
3458 EOSC
3459
3460 : determine root of directory hierarchy where package will be installed.
3461 case "$prefix" in
3462 '')
3463         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3464         ;;
3465 *)
3466         dflt="$prefix"
3467         ;;
3468 esac
3469 $cat <<EOM
3470
3471 By default, $package will be installed in $dflt/bin, manual pages
3472 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3473 installation directories. Typically this is something like /usr/local.
3474 If you wish to have binaries under /usr/bin but other parts of the
3475 installation under /usr/local, that's ok: you will be prompted
3476 separately for each of the installation directories, the prefix being
3477 only used to set the defaults.
3478
3479 EOM
3480 fn=d~
3481 rp='Installation prefix to use?'
3482 . ./getfile
3483 oldprefix=''
3484 case "$prefix" in
3485 '') ;;
3486 *)
3487         case "$ans" in
3488         "$prefix") ;;
3489         *) oldprefix="$prefix";;
3490         esac
3491         ;;
3492 esac
3493 prefix="$ans"
3494 prefixexp="$ansexp"
3495
3496 : is AFS running?
3497 echo " "
3498 case "$afs" in
3499 $define|true)   afs=true ;;
3500 $undef|false)   afs=false ;;
3501 *)      if test -d /afs; then
3502                 afs=true
3503         else
3504                 afs=false
3505         fi
3506         ;;
3507 esac
3508 if $afs; then
3509         echo "AFS may be running... I'll be extra cautious then..." >&4
3510 else
3511         echo "AFS does not seem to be running..." >&4
3512 fi
3513
3514 : determine installation prefix for where package is to be installed.
3515 if $afs; then 
3516 $cat <<EOM
3517
3518 Since you are running AFS, I need to distinguish the directory in which
3519 files will reside from the directory in which they are installed (and from
3520 which they are presumably copied to the former directory by occult means).
3521
3522 EOM
3523         case "$installprefix" in
3524         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3525         *) dflt="$installprefix";;
3526         esac
3527 else
3528 $cat <<EOM
3529
3530 In some special cases, particularly when building $package for distribution,
3531 it is convenient to distinguish between the directory in which files should 
3532 be installed from the directory ($prefix) in which they 
3533 will eventually reside.  For most users, these two directories are the same.
3534
3535 EOM
3536         case "$installprefix" in
3537         '') dflt=$prefix ;;
3538         *) dflt=$installprefix;;
3539         esac
3540 fi
3541 fn=d~
3542 rp='What installation prefix should I use for installing files?'
3543 . ./getfile
3544 installprefix="$ans"
3545 installprefixexp="$ansexp"
3546
3547 : set the prefixit variable, to compute a suitable default value
3548 prefixit='case "$3" in
3549 ""|none)
3550         case "$oldprefix" in
3551         "") eval "$1=\"\$$2\"";;
3552         *)
3553                 case "$3" in
3554                 "") eval "$1=";;
3555                 none)
3556                         eval "tp=\"\$$2\"";
3557                         case "$tp" in
3558                         ""|" ") eval "$1=\"\$$2\"";;
3559                         *) eval "$1=";;
3560                         esac;;
3561                 esac;;
3562         esac;;
3563 *)
3564         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3565         case "$tp" in
3566         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3567         /*-$oldprefix/*|\~*-$oldprefix/*)
3568                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3569         *) eval "$1=\"\$$2\"";;
3570         esac;;
3571 esac'
3572
3573 : set the base revision
3574 baserev=5.0
3575
3576 : get the patchlevel
3577 echo " "
3578 echo "Getting the current patchlevel..." >&4
3579 if $test -r $rsrc/patchlevel.h;then
3580         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3581         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3582         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3583 else
3584         patchlevel=0
3585         subversion=0
3586         apiversion=0
3587 fi
3588 $echo $n "(You have $package" $c
3589 case "$package" in
3590 "*$baserev")    ;;
3591 *)              $echo $n " $baserev" $c ;;
3592 esac
3593 $echo $n " patchlevel $patchlevel" $c
3594 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3595 echo ".)"
3596
3597 if test 0 -eq "$subversion"; then
3598         version=`LC_ALL=C; export LC_ALL; \
3599                  echo $baserev $patchlevel | \
3600                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3601 else
3602         version=`LC_ALL=C; export LC_ALL; \
3603                  echo $baserev $patchlevel $subversion | \
3604                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3605 fi
3606
3607 : determine installation style
3608 : For now, try to deduce it from prefix unless it is already set.
3609 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3610 case "$installstyle" in
3611 '')     case "$prefix" in
3612                 *perl*) dflt='lib';;
3613                 *) dflt='lib/perl5' ;;
3614         esac
3615         ;;
3616 *)      dflt='lib/perl5' ;;
3617 esac
3618 : Probably not worth prompting for this since we prompt for all
3619 : the directories individually, and the prompt would be too long and
3620 : confusing anyway.
3621 installstyle=$dflt
3622
3623 : determine where private library files go
3624 : Usual default is /usr/local/lib/perl5/$version.
3625 : Also allow things like /opt/perl/lib/$version, since 
3626 : /opt/perl/lib/perl5... would be redundant.
3627 : The default "style" setting is made in installstyle.U
3628 case "$installstyle" in
3629 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3630 *)       set dflt privlib lib/$version ;;
3631 esac
3632 eval $prefixit
3633 $cat <<EOM
3634
3635 There are some auxiliary files for $package that need to be put into a
3636 private library directory that is accessible by everyone.
3637
3638 EOM
3639 fn=d~+
3640 rp='Pathname where the private library files will reside?'
3641 . ./getfile
3642 privlib="$ans"
3643 privlibexp="$ansexp"
3644 : Change installation prefix, if necessary.
3645 if $test X"$prefix" != X"$installprefix"; then
3646         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3647 else
3648         installprivlib="$privlibexp"
3649 fi
3650
3651 : set the prefixup variable, to restore leading tilda escape
3652 prefixup='case "$prefixexp" in
3653 "$prefix") ;;
3654 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3655 esac'
3656
3657 : determine where public architecture dependent libraries go
3658 set archlib archlib
3659 eval $prefixit
3660 : privlib default is /usr/local/lib/$package/$version
3661 : archlib default is /usr/local/lib/$package/$version/$archname
3662 : privlib may have an optional trailing /share.
3663 tdflt=`echo $privlib | $sed 's,/share$,,'`
3664 tdflt=$tdflt/$archname
3665 case "$archlib" in
3666 '')     dflt=$tdflt
3667         ;;
3668 *)      dflt="$archlib"
3669     ;;
3670 esac
3671 $cat <<EOM
3672
3673 $spackage contains architecture-dependent library files.  If you are
3674 sharing libraries in a heterogeneous environment, you might store
3675 these files in a separate location.  Otherwise, you can just include
3676 them with the rest of the public library files.
3677
3678 EOM
3679 fn=d+~
3680 rp='Where do you want to put the public architecture-dependent libraries?'
3681 . ./getfile
3682 archlib="$ans"
3683 archlibexp="$ansexp"
3684 if $test X"$archlib" = X"$privlib"; then
3685         d_archlib="$undef"
3686 else
3687         d_archlib="$define"
3688 fi
3689 : Change installation prefix, if necessary.
3690 if $test X"$prefix" != X"$installprefix"; then
3691         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3692 else
3693         installarchlib="$archlibexp"
3694 fi
3695
3696
3697 : Binary compatibility with 5.005 is not possible for builds
3698 : with advanced features
3699 case "$usethreads$usemultiplicity" in
3700 *define*)
3701         bincompat5005="$undef"
3702         d_bincompat5005="$undef"
3703         ;;
3704 *)      $cat <<EOM
3705
3706 Perl 5.006 can be compiled for binary compatibility with 5.005.
3707 If you decide to do so, you will be able to continue using most
3708 of the extensions that were compiled for Perl 5.005.
3709
3710 EOM
3711         case "$bincompat5005$d_bincompat5005" in
3712         *"$undef"*) dflt=n ;;
3713         *) dflt=y ;;
3714         esac
3715         rp='Binary compatibility with Perl 5.005?'
3716         . ./myread
3717         case "$ans" in
3718         y*) val="$define" ;;
3719         *)  val="$undef" ;;
3720         esac
3721         set d_bincompat5005
3722         eval $setvar
3723         case "$d_bincompat5005" in
3724         "$define")
3725                 bincompat5005="$define"
3726                 ;;
3727         *)      bincompat5005="$undef"
3728                 d_bincompat5005="$undef"
3729                 ;;
3730         esac
3731         ;;
3732 esac
3733
3734
3735 : see if setuid scripts can be secure
3736 $cat <<EOM
3737
3738 Some kernels have a bug that prevents setuid #! scripts from being
3739 secure.  Some sites have disabled setuid #! scripts because of this.
3740
3741 First let's decide if your kernel supports secure setuid #! scripts.
3742 (If setuid #! scripts would be secure but have been disabled anyway,
3743 don't say that they are secure if asked.)
3744
3745 EOM
3746
3747 val="$undef"
3748 if $test -d /dev/fd; then
3749         echo "#!$ls" >reflect
3750         chmod +x,u+s reflect
3751         ./reflect >flect 2>&1
3752         if $contains "/dev/fd" flect >/dev/null; then
3753                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3754                 val="$define"
3755         else
3756                 $cat <<EOM
3757 If you are not sure if they are secure, I can check but I'll need a
3758 username and password different from the one you are using right now.
3759 If you don't have such a username or don't want me to test, simply
3760 enter 'none'.
3761
3762 EOM
3763                 rp='Other username to test security of setuid scripts with?'
3764                 dflt='none'
3765                 . ./myread
3766                 case "$ans" in
3767                 n|none)
3768                         case "$d_suidsafe" in
3769                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3770                                 dflt=n;;
3771                         "$undef")
3772                                 echo "Well, the $hint value is *not* secure." >&4
3773                                 dflt=n;;
3774                         *)      echo "Well, the $hint value *is* secure." >&4
3775                                 dflt=y;;
3776                         esac
3777                         ;;
3778                 *)
3779                         $rm -f reflect flect
3780                         echo "#!$ls" >reflect
3781                         chmod +x,u+s reflect
3782                         echo >flect
3783                         chmod a+w flect
3784                         echo '"su" will (probably) prompt you for '"$ans's password."
3785                         su $ans -c './reflect >flect'
3786                         if $contains "/dev/fd" flect >/dev/null; then
3787                                 echo "Okay, it looks like setuid scripts are secure." >&4
3788                                 dflt=y
3789                         else
3790                                 echo "I don't think setuid scripts are secure." >&4
3791                                 dflt=n
3792                         fi
3793                         ;;
3794                 esac
3795                 rp='Does your kernel have *secure* setuid scripts?'
3796                 . ./myread
3797                 case "$ans" in
3798                 [yY]*)  val="$define";;
3799                 *)      val="$undef";;
3800                 esac
3801         fi
3802 else
3803         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3804         echo "(That's for file descriptors, not floppy disks.)"
3805         val="$undef"
3806 fi
3807 set d_suidsafe
3808 eval $setvar
3809
3810 $rm -f reflect flect
3811
3812 : now see if they want to do setuid emulation
3813 echo " "
3814 val="$undef"
3815 case "$d_suidsafe" in
3816 "$define")
3817         val="$undef"
3818         echo "No need to emulate SUID scripts since they are secure here." >& 4
3819         ;;
3820 *)
3821         $cat <<EOM
3822 Some systems have disabled setuid scripts, especially systems where
3823 setuid scripts cannot be secure.  On systems where setuid scripts have
3824 been disabled, the setuid/setgid bits on scripts are currently
3825 useless.  It is possible for $package to detect those bits and emulate
3826 setuid/setgid in a secure fashion.  This emulation will only work if
3827 setuid scripts have been disabled in your kernel.
3828
3829 EOM
3830         case "$d_dosuid" in
3831         "$define") dflt=y ;;
3832         *) dflt=n ;;
3833         esac
3834         rp="Do you want to do setuid/setgid emulation?"
3835         . ./myread
3836         case "$ans" in
3837         [yY]*)  val="$define";;
3838         *)      val="$undef";;
3839         esac
3840         ;;
3841 esac
3842 set d_dosuid
3843 eval $setvar
3844
3845 : What should the include directory be ?
3846 echo " "
3847 $echo $n "Hmm...  $c"
3848 dflt='/usr/include'
3849 incpath=''
3850 mips_type=''
3851 if $test -f /bin/mips && /bin/mips; then
3852         echo "Looks like a MIPS system..."
3853         $cat >usr.c <<'EOCP'
3854 #ifdef SYSTYPE_BSD43
3855 /bsd43
3856 #endif
3857 EOCP
3858         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3859                 dflt='/bsd43/usr/include'
3860                 incpath='/bsd43'
3861                 mips_type='BSD 4.3'
3862         else
3863                 mips_type='System V'
3864         fi
3865         $rm -f usr.c usr.out
3866         echo "and you're compiling with the $mips_type compiler and libraries."
3867         xxx_prompt=y
3868         echo "exit 0" >mips
3869 else
3870         echo "Doesn't look like a MIPS system."
3871         xxx_prompt=n
3872         echo "exit 1" >mips
3873 fi
3874 chmod +x mips
3875 $eunicefix mips
3876 case "$usrinc" in
3877 '') ;;
3878 *) dflt="$usrinc";;
3879 esac
3880 case "$xxx_prompt" in
3881 y)      fn=d/
3882         echo " "
3883         rp='Where are the include files you want to use?'
3884         . ./getfile
3885         usrinc="$ans"
3886         ;;
3887 *)      usrinc="$dflt"
3888         ;;
3889 esac
3890
3891 : see how we invoke the C preprocessor
3892 echo " "
3893 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3894 cat <<'EOT' >testcpp.c
3895 #define ABC abc
3896 #define XYZ xyz
3897 ABC.XYZ
3898 EOT
3899 cd ..
3900 if test ! -f cppstdin; then
3901         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3902                 # AIX cc -E doesn't show the absolute headerfile
3903                 # locations but we'll cheat by using the -M flag.
3904                 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
3905         else
3906                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3907         fi
3908 else
3909         echo "Keeping your $hint cppstdin wrapper."
3910 fi
3911 chmod 755 cppstdin
3912 wrapper=`pwd`/cppstdin
3913 ok='false'
3914 cd UU
3915
3916 if $test "X$cppstdin" != "X" && \
3917         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3918         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3919 then
3920         echo "You used to use $cppstdin $cppminus so we'll use that again."
3921         case "$cpprun" in
3922         '') echo "But let's see if we can live without a wrapper..." ;;
3923         *)
3924                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3925                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3926                 then
3927                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3928                         ok='true'
3929                 else
3930                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3931                 fi
3932                 ;;
3933         esac
3934 else
3935         case "$cppstdin" in
3936         '') ;;
3937         *)
3938                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3939                 ;;
3940         esac
3941 fi
3942
3943 if $ok; then
3944         : nothing
3945 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3946         $cc -E <testcpp.c >testcpp.out 2>&1; \
3947         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3948         echo "Yup, it does."
3949         x_cpp="$cc -E"
3950         x_minus='';
3951 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3952         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3953         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3954         echo "Yup, it does."
3955         x_cpp="$cc -E"
3956         x_minus='-';
3957 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3958         $cc -P <testcpp.c >testcpp.out 2>&1; \
3959         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3960         echo "Yipee, that works!"
3961         x_cpp="$cc -P"
3962         x_minus='';
3963 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3964         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3965         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3966         echo "At long last!"
3967         x_cpp="$cc -P"
3968         x_minus='-';
3969 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3970         $cpp <testcpp.c >testcpp.out 2>&1; \
3971         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3972         echo "It works!"
3973         x_cpp="$cpp"
3974         x_minus='';
3975 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3976         $cpp - <testcpp.c >testcpp.out 2>&1; \
3977         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3978         echo "Hooray, it works!  I was beginning to wonder."
3979         x_cpp="$cpp"
3980         x_minus='-';
3981 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3982         $wrapper <testcpp.c >testcpp.out 2>&1; \
3983         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3984         x_cpp="$wrapper"
3985         x_minus=''
3986         echo "Eureka!"
3987 else
3988         dflt=''
3989         rp="No dice.  I can't find a C preprocessor.  Name one:"
3990         . ./myread
3991         x_cpp="$ans"
3992         x_minus=''
3993         $x_cpp <testcpp.c >testcpp.out 2>&1
3994         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3995                 echo "OK, that will do." >&4
3996         else
3997 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3998                 exit 1
3999         fi
4000 fi
4001
4002 case "$ok" in
4003 false)
4004         cppstdin="$x_cpp"
4005         cppminus="$x_minus"
4006         cpprun="$x_cpp"
4007         cpplast="$x_minus"
4008         set X $x_cpp
4009         shift
4010         case "$1" in
4011         "$cpp")
4012                 echo "Perhaps can we force $cc -E using a wrapper..."
4013                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4014                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4015                 then
4016                         echo "Yup, we can."
4017                         cppstdin="$wrapper"
4018                         cppminus='';
4019                 else
4020                         echo "Nope, we'll have to live without it..."
4021                 fi
4022                 ;;
4023         esac
4024         case "$cpprun" in
4025         "$wrapper")
4026                 cpprun=''
4027                 cpplast=''
4028                 ;;
4029         esac
4030         ;;
4031 esac
4032
4033 case "$cppstdin" in
4034 "$wrapper"|'cppstdin') ;;
4035 *) $rm -f $wrapper;;
4036 esac
4037 $rm -f testcpp.c testcpp.out
4038
4039 : Set private lib path
4040 case "$plibpth" in
4041 '') if ./mips; then
4042                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4043         fi;;
4044 esac
4045 case "$libpth" in
4046 ' ') dlist='';;
4047 '') dlist="$loclibpth $plibpth $glibpth";;
4048 *) dlist="$libpth";;
4049 esac
4050
4051 : Now check and see which directories actually exist, avoiding duplicates
4052 libpth=''
4053 for xxx in $dlist
4054 do
4055     if $test -d $xxx; then
4056                 case " $libpth " in
4057                 *" $xxx "*) ;;
4058                 *) libpth="$libpth $xxx";;
4059                 esac
4060     fi
4061 done
4062 $cat <<'EOM'
4063
4064 Some systems have incompatible or broken versions of libraries.  Among
4065 the directories listed in the question below, please remove any you
4066 know not to be holding relevant libraries, and add any that are needed.
4067 Say "none" for none.
4068
4069 EOM
4070 case "$libpth" in
4071 '') dflt='none';;
4072 *)
4073         set X $libpth
4074         shift
4075         dflt=${1+"$@"}
4076         ;;
4077 esac
4078 rp="Directories to use for library searches?"
4079 . ./myread
4080 case "$ans" in
4081 none) libpth=' ';;
4082 *) libpth="$ans";;
4083 esac
4084
4085 : compute shared library extension
4086 case "$so" in
4087 '')
4088         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4089                 dflt='sl'
4090         else
4091                 dflt='so'
4092         fi
4093         ;;
4094 *) dflt="$so";;
4095 esac
4096 $cat <<EOM
4097
4098 On some systems, shared libraries may be available.  Answer 'none' if
4099 you want to suppress searching of shared libraries for the remaining
4100 of this configuration.
4101
4102 EOM
4103 rp='What is the file extension used for shared libraries?'
4104 . ./myread
4105 so="$ans"
4106
4107 : Define several unixisms.
4108 : Hints files or command line option can be used to override them.
4109 : The convoluted testing is in case hints files set either the old
4110 : or the new name.
4111 case "$_exe" in
4112 '')     case "$exe_ext" in
4113     '') ;;
4114         *)      _exe="$exe_ext" ;;
4115         esac
4116         ;;
4117 esac
4118 case "$_a" in
4119 '')     case "$lib_ext" in
4120     '') _a='.a';;
4121         *)      _a="$lib_ext" ;;
4122         esac
4123         ;;
4124 esac
4125 case "$_o" in
4126 '') case "$obj_ext" in
4127         '')     _o='.o';;
4128         *)      _o="$obj_ext";;
4129         esac
4130         ;;
4131 esac
4132 case "$p_" in
4133 '') case "$path_sep" in
4134         '')     p_=':';;
4135         *)      p_="$path_sep";;
4136         esac
4137         ;;
4138 esac
4139 exe_ext=$_exe
4140 lib_ext=$_a
4141 obj_ext=$_o
4142 path_sep=$p_
4143
4144 : Which makefile gets called first.  This is used by make depend.
4145 case "$firstmakefile" in
4146 '') firstmakefile='makefile';;
4147 esac
4148
4149 cat <<EOM
4150
4151 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4152 Configure must be run with -Dusesocks.
4153
4154 Normally you do not need this and you should answer no.
4155
4156 EOM
4157 case "$usesocks" in
4158 $define|true|[yY]*)     dflt='y';;
4159 *) dflt='n';;
4160 esac
4161 rp='Build Perl for SOCKS?'
4162 . ./myread
4163 case "$ans" in
4164 y|Y)    val="$define" ;;     
4165 *)      val="$undef" ;;
4166 esac
4167 set usesocks
4168 eval $setvar
4169
4170 : Looking for optional libraries
4171 echo " "
4172 echo "Checking for optional libraries..." >&4
4173 case "$libs" in
4174 ' '|'') dflt='';;
4175 *) dflt="$libs";;
4176 esac
4177 case "$libswanted" in
4178 '') libswanted='c_s';;
4179 esac
4180 case "$usesocks" in
4181 $define)
4182         libswanted="$libswanted socks5 socks5_sh"
4183         ;;
4184 esac
4185 for thislib in $libswanted; do
4186         
4187         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4188                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4189                 echo "Found -l$thislib (shared)."
4190                 case " $dflt " in
4191                 *"-l$thislib "*);;
4192                 *) dflt="$dflt -l$thislib";;
4193                 esac
4194         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4195                 echo "Found -l$thislib (shared)."
4196                 case " $dflt " in
4197                 *"-l$thislib "*);;
4198                 *) dflt="$dflt -l$thislib";;
4199                 esac
4200         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4201                 echo "Found -l$thislib."
4202                 case " $dflt " in
4203                 *"-l$thislib "*);;
4204                 *) dflt="$dflt -l$thislib";;
4205                 esac
4206         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4207                 echo "Found -l$thislib."
4208                 case " $dflt " in
4209                 *"-l$thislib "*);;
4210                 *) dflt="$dflt -l$thislib";;
4211                 esac
4212         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4213                 echo "Found -l${thislib}_s."
4214                 case " $dflt " in
4215                 *"-l$thislib "*);;
4216                 *) dflt="$dflt -l${thislib}_s";;
4217                 esac
4218         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4219                 echo "Found -l$thislib."
4220                 case " $dflt " in
4221                 *"-l$thislib "*);;
4222                 *) dflt="$dflt -l$thislib";;
4223                 esac
4224         else
4225                 echo "No -l$thislib."
4226         fi
4227 done
4228 set X $dflt
4229 shift
4230 dflt="$*"
4231 case "$libs" in
4232 '') dflt="$dflt";;
4233 *) dflt="$libs";;
4234 esac
4235 case "$dflt" in
4236 ' '|'') dflt='none';;
4237 esac
4238
4239 $cat <<EOM
4240
4241 In order to compile $package on your machine, a number of libraries
4242 are usually needed.  Include any other special libraries here as well.
4243 Say "none" for none.  The default list is almost always right.
4244 EOM
4245
4246 echo " "
4247 rp="What libraries to use?"
4248 . ./myread
4249 case "$ans" in
4250 none) libs=' ';;
4251 *) libs="$ans";;
4252 esac
4253
4254 : determine optimization, if desired, or use for debug flag also
4255 case "$optimize" in
4256 ' '|$undef) dflt='none';;
4257 '') dflt='-O';;
4258 *) dflt="$optimize";;
4259 esac
4260 $cat <<EOH
4261
4262 By default, $package compiles with the -O flag to use the optimizer.
4263 Alternately, you might want to use the symbolic debugger, which uses
4264 the -g flag (on traditional Unix systems).  Either flag can be
4265 specified here.  To use neither flag, specify the word "none".
4266
4267 EOH
4268 rp="What optimizer/debugger flag should be used?"
4269 . ./myread
4270 optimize="$ans"
4271 case "$optimize" in
4272 'none') optimize=" ";;
4273 esac
4274
4275 dflt=''
4276 : We will not override a previous value, but we might want to
4277 : augment a hint file
4278 case "$hint" in
4279 default|recommended)
4280         case "$gccversion" in
4281         1*) dflt='-fpcc-struct-return' ;;
4282         esac
4283         case "$optimize" in
4284         *-g*) dflt="$dflt -DDEBUGGING";;
4285         esac
4286         case "$gccversion" in
4287         2*) if test -d /etc/conf/kconfig.d &&
4288                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4289                 then
4290                         dflt="$dflt -posix"
4291                 fi
4292                 ;;
4293         esac
4294         case "$gccversion" in
4295         1*) ;;
4296         2.[0-8]*) ;;
4297         ?*)     echo " "
4298                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4299                 echo 'int main(void) { return 0; }' > gcctest.c
4300                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4301                         echo "Yes, it does." 2>&1
4302                         case "$ccflags" in
4303                         *strict-aliasing*) 
4304                                 echo "Leaving current flags $ccflags alone." 2>&1
4305                                 ;;
4306                         *) dflt="$dflt -fno-strict-aliasing" ;;
4307                         esac
4308                 else
4309                         echo "Nope, it doesn't, but that's ok." 2>&1
4310                 fi
4311                 ;;
4312         esac
4313         ;;
4314 esac
4315
4316 case "$mips_type" in
4317 *BSD*|'') inclwanted="$locincpth $usrinc";;
4318 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4319 esac
4320 for thisincl in $inclwanted; do
4321         if $test -d $thisincl; then
4322                 if $test x$thisincl != x$usrinc; then
4323                         case "$dflt" in
4324                         *$thisincl*);;
4325                         *) dflt="$dflt -I$thisincl";;
4326                         esac
4327                 fi
4328         fi
4329 done
4330
4331 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4332         xxx=true;
4333 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4334         xxx=true;
4335 else
4336         xxx=false;
4337 fi;
4338 if $xxx; then
4339         case "$dflt" in
4340         *$2*);;
4341         *) dflt="$dflt -D$2";;
4342         esac;
4343 fi'
4344
4345 set signal.h LANGUAGE_C; eval $inctest
4346
4347 case "$usesocks" in
4348 $define)
4349         ccflags="$ccflags -DSOCKS"
4350         ;;
4351 esac
4352
4353 case "$hint" in
4354 default|recommended) dflt="$ccflags $dflt" ;;
4355 *) dflt="$ccflags";;
4356 esac
4357
4358 case "$dflt" in
4359 ''|' ') dflt=none;;
4360 esac
4361 $cat <<EOH
4362
4363 Your C compiler may want other flags.  For this question you should include
4364 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4365 but you should NOT include libraries or ld flags like -lwhatever.  If you
4366 want $package to honor its debug switch, you should include -DDEBUGGING here.
4367 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4368
4369 To use no flags, specify the word "none".
4370
4371 EOH
4372 set X $dflt
4373 shift
4374 dflt=${1+"$@"}
4375 rp="Any additional cc flags?"
4376 . ./myread
4377 case "$ans" in
4378 none) ccflags='';;
4379 *) ccflags="$ans";;
4380 esac
4381
4382 : the following weeds options from ccflags that are of no interest to cpp
4383 cppflags="$ccflags"
4384 case "$gccversion" in
4385 1*) cppflags="$cppflags -D__GNUC__"
4386 esac
4387 case "$mips_type" in
4388 '');;
4389 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4390 esac
4391 case "$cppflags" in
4392 '');;
4393 *)
4394         echo " "
4395         echo "Let me guess what the preprocessor flags are..." >&4
4396         set X $cppflags
4397         shift
4398         cppflags=''
4399         $cat >cpp.c <<'EOM'
4400 #define BLURFL foo
4401
4402 BLURFL xx LFRULB
4403 EOM
4404         previous=''
4405         for flag in $*
4406         do
4407                 case "$flag" in
4408                 -*) ftry="$flag";;
4409                 *) ftry="$previous $flag";;
4410                 esac
4411                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4412                         >cpp1.out 2>/dev/null && \
4413                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4414                         >cpp2.out 2>/dev/null && \
4415                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4416                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4417                 then
4418                         cppflags="$cppflags $ftry"
4419                         previous=''
4420                 else
4421                         previous="$flag"
4422                 fi
4423         done
4424         set X $cppflags
4425         shift
4426         cppflags=${1+"$@"}
4427         case "$cppflags" in
4428         *-*)  echo "They appear to be: $cppflags";;
4429         esac
4430         $rm -f cpp.c cpp?.out
4431         ;;
4432 esac
4433
4434 : flags used in final linking phase
4435 case "$ldflags" in
4436 '') if ./venix; then
4437                 dflt='-i -z'
4438         else
4439                 dflt=''
4440         fi
4441         case "$ccflags" in
4442         *-posix*) dflt="$dflt -posix" ;;
4443         esac
4444         ;;
4445 *) dflt="$ldflags";;
4446 esac
4447
4448 : Try to guess additional flags to pick up local libraries.
4449 for thislibdir in $libpth; do
4450         case " $loclibpth " in
4451         *" $thislibdir "*)
4452                 case "$dflt " in 
4453                 *"-L$thislibdir "*) ;;
4454                 *)  dflt="$dflt -L$thislibdir" ;;
4455                 esac
4456                 ;;
4457         esac
4458 done
4459
4460 case "$dflt" in
4461 '') dflt='none' ;;
4462 esac
4463
4464 $cat <<EOH
4465
4466 Your C linker may need flags.  For this question you should
4467 include -L/whatever and any other flags used by the C linker, but you
4468 should NOT include libraries like -lwhatever.
4469
4470 Make sure you include the appropriate -L/path flags if your C linker
4471 does not normally search all of the directories you specified above,
4472 namely
4473         $libpth
4474 To use no flags, specify the word "none".
4475
4476 EOH
4477
4478 rp="Any additional ld flags (NOT including libraries)?"
4479 . ./myread
4480 case "$ans" in
4481 none) ldflags='';;
4482 *) ldflags="$ans";;
4483 esac
4484 rmlist="$rmlist pdp11"
4485
4486 : coherency check
4487 echo " "
4488 echo "Checking your choice of C compiler and flags for coherency..." >&4
4489 $cat > try.c <<'EOF'
4490 #include <stdio.h>
4491 int main() { printf("Ok\n"); exit(0); }
4492 EOF
4493 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4494 shift
4495 $cat >try.msg <<'EOM'
4496 I've tried to compile and run the following simple program:
4497
4498 EOM
4499 $cat try.c >> try.msg
4500
4501 $cat >> try.msg <<EOM
4502
4503 I used the command:
4504
4505         $*
4506         ./try
4507
4508 and I got the following output:
4509
4510 EOM
4511 dflt=y
4512 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4513         if sh -c './try' >>try.msg 2>&1; then
4514                 xxx=`./try`
4515                 case "$xxx" in
4516                 "Ok") dflt=n ;;
4517                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4518                         case " $libs " in
4519                         *" -lsfio "*)
4520                                 cat >> try.msg <<'EOQS'
4521 If $libs contains -lsfio, and sfio is mis-configured, then it
4522 sometimes (apparently) runs and exits with a 0 status, but with no
4523 output!  It may have to do with sfio's use of _exit vs. exit.
4524
4525 EOQS
4526                                 rp="You have a big problem.  Shall I abort Configure"
4527                                 dflt=y
4528                                 ;;
4529                         esac
4530                         ;;
4531                 esac
4532         else
4533                 echo "The program compiled OK, but exited with status $?." >>try.msg
4534                 rp="You have a problem.  Shall I abort Configure"
4535                 dflt=y
4536         fi
4537 else
4538         echo "I can't compile the test program." >>try.msg
4539         rp="You have a BIG problem.  Shall I abort Configure"
4540         dflt=y
4541 fi
4542 case "$dflt" in
4543 y)
4544         $cat try.msg >&4
4545         case "$knowitall" in
4546         '')
4547                 echo "(The supplied flags or libraries might be incorrect.)"
4548                 ;;
4549         *) dflt=n;;
4550         esac
4551         echo " "
4552         . ./myread
4553         case "$ans" in
4554         n*|N*) ;;
4555         *)      echo "Ok.  Stopping Configure." >&4
4556                 exit 1
4557                 ;;
4558         esac
4559         ;;
4560 n) echo "OK, that should do.";;
4561 esac
4562 $rm -f try try.* core
4563
4564 : determine filename position in cpp output
4565 echo " "
4566 echo "Computing filename position in cpp output for #include directives..." >&4
4567 echo '#include <stdio.h>' > foo.c
4568 $cat >fieldn <<EOF
4569 $startsh
4570 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4571 $grep '^[       ]*#.*stdio\.h' | \
4572 while read cline; do
4573         pos=1
4574         set \$cline
4575         while $test \$# -gt 0; do
4576                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4577                         echo "\$pos"
4578                         exit 0
4579                 fi
4580                 shift
4581                 pos=\`expr \$pos + 1\`
4582         done
4583 done
4584 EOF
4585 chmod +x fieldn
4586 fieldn=`./fieldn`
4587 $rm -f foo.c fieldn
4588 case $fieldn in
4589 '') pos='???';;
4590 1) pos=first;;
4591 2) pos=second;;
4592 3) pos=third;;
4593 *) pos="${fieldn}th";;
4594 esac
4595 echo "Your cpp writes the filename in the $pos field of the line."
4596
4597 : locate header file
4598 $cat >findhdr <<EOF
4599 $startsh
4600 wanted=\$1
4601 name=''
4602 for usrincdir in $usrinc
4603 do
4604         if test -f \$usrincdir/\$wanted; then
4605                 echo "\$usrincdir/\$wanted"
4606                 exit 0
4607         fi
4608 done
4609 awkprg='{ print \$$fieldn }'
4610 echo "#include <\$wanted>" > foo\$\$.c
4611 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4612 $grep "^[       ]*#.*\$wanted" | \
4613 while read cline; do
4614         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4615         case "\$name" in
4616         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4617         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4618         *) exit 2;;
4619         esac;
4620 done;
4621 #
4622 # status = 0: grep returned 0 lines, case statement not executed
4623 # status = 1: headerfile found
4624 # status = 2: while loop executed, no headerfile found
4625 #
4626 status=\$?
4627 $rm -f foo\$\$.c;
4628 if test \$status -eq 1; then
4629         exit 0;
4630 fi
4631 exit 1
4632 EOF
4633 chmod +x findhdr
4634
4635 : define an alternate in-header-list? function
4636 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4637 cont=true; xxf="echo \"<\$1> found.\" >&4";
4638 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4639 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4640 esac;
4641 case $# in 4) instead=instead;; *) instead="at last";; esac;
4642 while $test "$cont"; do
4643         xxx=`./findhdr $1`
4644         var=$2; eval "was=\$$2";
4645         if $test "$xxx" && $test -r "$xxx";
4646         then eval $xxf;
4647         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4648                 cont="";
4649         else eval $xxnf;
4650         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4651         set $yyy; shift; shift; yyy=$@;
4652         case $# in 0) cont="";;
4653         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4654                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4655         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4656                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4657         esac;
4658 done;
4659 while $test "$yyy";
4660 do set $yyy; var=$2; eval "was=\$$2";
4661         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4662         set $yyy; shift; shift; yyy=$@;
4663 done'
4664
4665 : see if this is a malloc.h system
4666 set malloc.h i_malloc
4667 eval $inhdr
4668
4669 : see if stdlib is available
4670 set stdlib.h i_stdlib
4671 eval $inhdr
4672
4673 : determine which malloc to compile in
4674 echo " "
4675 case "$usemymalloc" in
4676 ''|[yY]*|true|$define)  dflt='y' ;;
4677 *)      dflt='n' ;;
4678 esac
4679 rp="Do you wish to attempt to use the malloc that comes with $package?"
4680 . ./myread
4681 usemymalloc="$ans"
4682 case "$ans" in
4683 y*|true)
4684         usemymalloc='y'
4685         mallocsrc='malloc.c'
4686         mallocobj="malloc$_o"
4687         d_mymalloc="$define"
4688         case "$libs" in
4689         *-lmalloc*)
4690                 : Remove malloc from list of libraries to use
4691                 echo "Removing unneeded -lmalloc from library list" >&4
4692                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4693                 shift
4694                 libs="$*"
4695                 echo "libs = $libs" >&4
4696                 ;;
4697         esac
4698         ;;
4699 *)
4700         usemymalloc='n'
4701         mallocsrc=''
4702         mallocobj=''
4703         d_mymalloc="$undef"
4704         ;;
4705 esac
4706
4707 : compute the return types of malloc and free
4708 echo " "
4709 $cat >malloc.c <<END
4710 #$i_malloc I_MALLOC
4711 #$i_stdlib I_STDLIB
4712 #include <stdio.h>
4713 #include <sys/types.h>
4714 #ifdef I_MALLOC
4715 #include <malloc.h>
4716 #endif
4717 #ifdef I_STDLIB
4718 #include <stdlib.h>
4719 #endif
4720 #ifdef TRY_MALLOC
4721 void *malloc();
4722 #endif
4723 #ifdef TRY_FREE
4724 void free();
4725 #endif
4726 END
4727 case "$malloctype" in
4728 '')
4729         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4730                 malloctype='void *'
4731         else
4732                 malloctype='char *'
4733         fi
4734         ;;
4735 esac
4736 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4737
4738 case "$freetype" in
4739 '')
4740         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4741                 freetype='void'
4742         else
4743                 freetype='int'
4744         fi
4745         ;;
4746 esac
4747 echo "Your system uses $freetype free(), it would seem." >&4
4748 $rm -f malloc.[co]
4749 $cat <<EOM
4750
4751 The installation process will also create a directory for
4752 vendor-supplied add-ons.  Vendors who supply perl with their system
4753 may find it convenient to place all vendor-supplied files in this
4754 directory rather than in the main distribution directory.  This will
4755 ease upgrades between binary-compatible maintenance versions of perl.
4756
4757 Of course you may also use these directories in whatever way you see
4758 fit.  For example, you might use them to access modules shared over a
4759 company-wide network.
4760
4761 The default answer should be fine for most people.
4762 This causes further questions about vendor add-ons to be skipped
4763 and no vendor-specific directories will be configured for perl.
4764
4765 EOM
4766 rp='Do you want to configure vendor-specific add-on directories?'
4767 case "$usevendorprefix" in
4768 define|true|[yY]*) dflt=y ;;
4769 *) dflt=n ;;
4770 esac
4771 . ./myread
4772 case "$ans" in
4773 [yY]*)  fn=d~+
4774         rp='Installation prefix to use for vendor-supplied add-ons?'
4775         case "$vendorprefix" in
4776         '') dflt='' ;;
4777         *)  dflt=$vendorprefix ;;
4778         esac
4779         . ./getfile
4780         oldvendorprefix=''
4781         case "$vendorprefix" in
4782         '') ;;
4783         *)      case "$ans" in
4784                 "$prefix") ;;
4785                 *) oldvendorprefix="$prefix";;
4786                 esac
4787                 ;;
4788         esac
4789         usevendorprefix="$define"
4790         vendorprefix="$ans"
4791         vendorprefixexp="$ansexp"
4792         ;;
4793 *)      usevendorprefix="$undef"
4794         vendorprefix=''
4795         vendorprefixexp=''
4796         ;;
4797 esac
4798
4799 case "$vendorprefix" in
4800 '')     d_vendorlib="$undef"
4801         vendorlib=''
4802         vendorlibexp=''
4803         ;;
4804 *)      d_vendorlib="$define"
4805         : determine where vendor-supplied modules go.
4806         : Usual default is /usr/local/lib/perl5/vendor_perl
4807         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4808         case "$installstyle" in
4809         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4810         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4811         esac
4812         fn=d~+
4813         rp='Pathname for the vendor-supplied library files?'
4814         . ./getfile
4815         vendorlib="$ans"
4816         vendorlibexp="$ansexp"
4817         : Change installation prefix, if necessary.
4818         if $test X"$prefix" != X"$installprefix"; then
4819                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4820         else
4821                 installvendorlib="$vendorlibexp"
4822         fi
4823         ;;
4824 esac
4825
4826 : Cruising for prototypes
4827 echo " "
4828 echo "Checking out function prototypes..." >&4
4829 $cat >prototype.c <<'EOCP'
4830 int main(int argc, char *argv[]) {
4831         exit(0);}
4832 EOCP
4833 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4834         echo "Your C compiler appears to support function prototypes."
4835         val="$define"
4836 else
4837         echo "Your C compiler doesn't seem to understand function prototypes."
4838         val="$undef"
4839 fi
4840 set prototype
4841 eval $setvar
4842 $rm -f prototype*
4843
4844 case "$prototype" in
4845 "$define") ;;
4846 *)      ansi2knr='ansi2knr'
4847         echo " "
4848         cat <<EOM >&4
4849
4850 $me:  FATAL ERROR:
4851 This version of $package can only be compiled by a compiler that 
4852 understands function prototypes.  Unfortunately, your C compiler 
4853         $cc $ccflags
4854 doesn't seem to understand them.  Sorry about that.
4855
4856 If GNU cc is available for your system, perhaps you could try that instead.  
4857
4858 Eventually, we hope to support building Perl with pre-ANSI compilers.
4859 If you would like to help in that effort, please contact <perlbug@perl.org>.
4860
4861 Aborting Configure now.
4862 EOM
4863         exit 2
4864         ;;
4865 esac
4866
4867 : determine where public executables go
4868 echo " "
4869 set dflt bin bin
4870 eval $prefixit
4871 fn=d~
4872 rp='Pathname where the public executables will reside?'
4873 . ./getfile
4874 if $test "X$ansexp" != "X$binexp"; then
4875         installbin=''
4876 fi
4877 bin="$ans"
4878 binexp="$ansexp"
4879 : Change installation prefix, if necessary.
4880 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4881 if $test X"$prefix" != X"$installprefix"; then
4882         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4883 else
4884         installbin="$binexp"
4885 fi
4886
4887 : determine whether to install perl also as /usr/bin/perl
4888
4889 echo " "
4890 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4891         $cat <<EOM
4892 Many scripts expect to perl to be installed as /usr/bin/perl.
4893 I can install the perl you are about to compile also as /usr/bin/perl
4894 (in addition to $installbin/perl).
4895 EOM
4896         case "$installusrbinperl" in
4897         "$undef"|[nN]*) dflt='n';;
4898         *)              dflt='y';;
4899         esac
4900         rp="Do you want to install perl as /usr/bin/perl?"
4901         . ./myread
4902         case "$ans" in
4903         [yY]*)  val="$define";;
4904         *)      val="$undef" ;;
4905         esac
4906 else
4907         val="$undef"
4908 fi
4909 set installusrbinperl
4910 eval $setvar
4911
4912 : define a shorthand compile call
4913 compile='
4914 mc_file=$1;
4915 shift;
4916 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4917 : define a shorthand compile call for compilations that should be ok.
4918 compile_ok='
4919 mc_file=$1;
4920 shift;
4921 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4922
4923 echo " "
4924 echo "Checking for GNU C Library..." >&4
4925 cat >gnulibc.c <<EOM
4926 #include <stdio.h>
4927 int main()
4928 {
4929 #ifdef __GLIBC__
4930     exit(0);
4931 #else
4932     exit(1);
4933 #endif
4934 }
4935 EOM
4936 set gnulibc
4937 if eval $compile_ok && ./gnulibc; then
4938         val="$define"
4939         echo "You are using the GNU C Library"
4940 else
4941         val="$undef"
4942         echo "You are not using the GNU C Library"
4943 fi
4944 $rm -f gnulibc*
4945 set d_gnulibc
4946 eval $setvar
4947
4948 : see if nm is to be used to determine whether a symbol is defined or not
4949 case "$usenm" in
4950 '')
4951         dflt=''
4952         case "$d_gnulibc" in
4953         "$define")
4954                 echo " "
4955                 echo "nm probably won't work on the GNU C Library." >&4
4956                 dflt=n
4957                 ;;
4958         esac
4959         case "$dflt" in
4960         '') 
4961                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4962                         echo " "
4963                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4964                         echo "'nm' won't be sufficient on this sytem." >&4
4965                         dflt=n
4966                 fi
4967                 ;;
4968         esac
4969         case "$dflt" in
4970         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4971                 if $test $dflt -gt 20; then
4972                         dflt=y
4973                 else
4974                         dflt=n
4975                 fi
4976                 ;;
4977         esac
4978         ;;
4979 *)
4980         case "$usenm" in
4981         true|$define) dflt=y;;
4982         *) dflt=n;;
4983         esac
4984         ;;
4985 esac
4986 $cat <<EOM
4987
4988 I can use $nm to extract the symbols from your C libraries. This
4989 is a time consuming task which may generate huge output on the disk (up
4990 to 3 megabytes) but that should make the symbols extraction faster. The
4991 alternative is to skip the 'nm' extraction part and to compile a small
4992 test program instead to determine whether each symbol is present. If
4993 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4994 this may be the best solution.
4995
4996 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4997
4998 EOM
4999 rp="Shall I use $nm to extract C symbols from the libraries?"
5000 . ./myread
5001 case "$ans" in
5002 [Nn]*) usenm=false;;
5003 *) usenm=true;;
5004 esac
5005
5006 runnm=$usenm
5007 case "$reuseval" in
5008 true) runnm=false;;
5009 esac
5010
5011 : nm options which may be necessary
5012 case "$nm_opt" in
5013 '') if $test -f /mach_boot; then
5014                 nm_opt=''       # Mach
5015         elif $test -d /usr/ccs/lib; then
5016                 nm_opt='-p'     # Solaris (and SunOS?)
5017         elif $test -f /dgux; then
5018                 nm_opt='-p'     # DG-UX
5019         elif $test -f /lib64/rld; then
5020                 nm_opt='-p'     # 64-bit Irix
5021         else
5022                 nm_opt=''
5023         fi;;
5024 esac
5025
5026 : nm options which may be necessary for shared libraries but illegal
5027 : for archive libraries.  Thank you, Linux.
5028 case "$nm_so_opt" in
5029 '')     case "$myuname" in
5030         *linux*)
5031                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5032                         nm_so_opt='--dynamic'
5033                 fi
5034                 ;;
5035         esac
5036         ;;
5037 esac
5038
5039 case "$runnm" in
5040 true)
5041 : get list of predefined functions in a handy place
5042 echo " "
5043 case "$libc" in
5044 '') libc=unknown
5045         case "$libs" in
5046         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5047         esac
5048         ;;
5049 esac
5050 libnames='';
5051 case "$libs" in
5052 '') ;;
5053 *)  for thislib in $libs; do
5054         case "$thislib" in
5055         -lc|-lc_s)
5056                 : Handle C library specially below.
5057                 ;;
5058         -l*)
5059                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5060                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5061                         :
5062                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5063                         :
5064                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5065                         :
5066                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5067                         :
5068                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5069                         :
5070                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5071                         :
5072                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5073                         :
5074                 else
5075                         try=''
5076                 fi
5077                 libnames="$libnames $try"
5078                 ;;
5079         *) libnames="$libnames $thislib" ;;
5080         esac
5081         done
5082         ;;
5083 esac
5084 xxx=normal
5085 case "$libc" in
5086 unknown)
5087         set /lib/libc.$so
5088         for xxx in $libpth; do
5089                 $test -r $1 || set $xxx/libc.$so
5090                 : The messy sed command sorts on library version numbers.
5091                 $test -r $1 || \
5092                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5093                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5094                                 h
5095                                 s/[0-9][0-9]*/0000&/g
5096                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5097                                 G
5098                                 s/\n/ /' | \
5099                          sort | $sed -e 's/^.* //'`
5100                 eval set \$$#
5101         done
5102         $test -r $1 || set /usr/ccs/lib/libc.$so
5103         $test -r $1 || set /lib/libsys_s$_a
5104         ;;
5105 *)
5106         set blurfl
5107         ;;
5108 esac
5109 if $test -r "$1"; then
5110         echo "Your (shared) C library seems to be in $1."
5111         libc="$1"
5112 elif $test -r /lib/libc && $test -r /lib/clib; then
5113         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5114         xxx=apollo
5115         libc='/lib/clib /lib/libc'
5116         if $test -r /lib/syslib; then
5117                 echo "(Your math library is in /lib/syslib.)"
5118                 libc="$libc /lib/syslib"
5119         fi
5120 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5121         echo "Your C library seems to be in $libc, as you said before."
5122 elif $test -r $incpath/usr/lib/libc$_a; then
5123         libc=$incpath/usr/lib/libc$_a;
5124         echo "Your C library seems to be in $libc.  That's fine."
5125 elif $test -r /lib/libc$_a; then
5126         libc=/lib/libc$_a;
5127         echo "Your C library seems to be in $libc.  You're normal."
5128 else
5129         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5130                 :
5131         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5132                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5133         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5134                 :
5135         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5136                 :
5137         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5138                 :
5139         else
5140                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5141         fi
5142         if $test -r "$tans"; then
5143                 echo "Your C library seems to be in $tans, of all places."
5144                 libc=$tans
5145         else
5146                 libc='blurfl'
5147         fi
5148 fi
5149 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5150         dflt="$libc"
5151         cat <<EOM
5152
5153 If the guess above is wrong (which it might be if you're using a strange
5154 compiler, or your machine supports multiple models), you can override it here.
5155
5156 EOM
5157 else
5158         dflt=''
5159         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5160         cat >&4 <<EOM
5161 I can't seem to find your C library.  I've looked in the following places:
5162
5163 EOM
5164         $sed 's/^/      /' libpath
5165         cat <<EOM
5166
5167 None of these seems to contain your C library. I need to get its name...
5168
5169 EOM
5170 fi
5171 fn=f
5172 rp='Where is your C library?'
5173 . ./getfile
5174 libc="$ans"
5175
5176 echo " "
5177 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5178 set X `cat libnames`
5179 shift
5180 xxx=files
5181 case $# in 1) xxx=file; esac
5182 echo "Extracting names from the following $xxx for later perusal:" >&4
5183 echo " "
5184 $sed 's/^/      /' libnames >&4
5185 echo " "
5186 $echo $n "This may take a while...$c" >&4
5187
5188 for file in $*; do
5189         case $file in
5190         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5191         *) $nm $nm_opt $file 2>/dev/null;;
5192         esac
5193 done >libc.tmp
5194
5195 $echo $n ".$c"
5196 $grep fprintf libc.tmp > libc.ptf
5197 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5198 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5199 xxx='[ADTSIW]'
5200 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5201         eval $xscan;\
5202         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5203                 eval $xrun
5204 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5205         eval $xscan;\
5206         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5207                 eval $xrun
5208 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5209         eval $xscan;\
5210         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5211                 eval $xrun
5212 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5213         eval $xscan;\
5214         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5215                 eval $xrun
5216 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5217         eval $xscan;\
5218         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5219                 eval $xrun
5220 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5221         eval $xscan;\
5222         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5223                 eval $xrun
5224 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5225                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5226         eval $xscan;\
5227         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5228                 eval $xrun
5229 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5230         eval $xscan;\
5231         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5232                 eval $xrun
5233 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5234         eval $xscan;\
5235         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5236                 eval $xrun
5237 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5238         eval $xscan;\
5239         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5240                 eval $xrun
5241 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5242         eval $xscan;\
5243         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5244                 eval $xrun
5245 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5246         eval $xscan;\
5247         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5248                 eval $xrun
5249 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5250         eval $xscan;\
5251         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5252                 eval $xrun
5253 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5254         eval $xscan;\
5255         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5256                 eval $xrun
5257 else
5258         $nm -p $* 2>/dev/null >libc.tmp
5259         $grep fprintf libc.tmp > libc.ptf
5260         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5261                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5262         then
5263                 nm_opt='-p'
5264                 eval $xrun
5265         else
5266                 echo " "
5267                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5268                 com=''
5269                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5270                         for thisname in $libnames $libc; do
5271                                 $ar t $thisname >>libc.tmp
5272                         done
5273                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5274                         echo "Ok." >&4
5275                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5276                         # Repeat libc to extract forwarders to DLL entries too
5277                         for thisname in $libnames $libc; do
5278                                 $ar tv $thisname >>libc.tmp
5279                                 # Revision 50 of EMX has bug in $ar.
5280                                 # it will not extract forwarders to DLL entries
5281                                 # Use emximp which will extract exactly them.
5282                                 emximp -o tmp.imp $thisname \
5283                                     2>/dev/null && \
5284                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5285                                     < tmp.imp >>libc.tmp
5286                                 $rm tmp.imp
5287                         done
5288                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5289                         echo "Ok." >&4
5290                 else
5291                         echo "$ar didn't seem to work right." >&4
5292                         echo "Maybe this is a Cray...trying bld instead..." >&4
5293                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5294                         then
5295                                 for thisname in $libnames; do
5296                                         bld t $libnames | \
5297                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5298                                         $ar t $thisname >>libc.tmp
5299                                 done
5300                                 echo "Ok." >&4
5301                         else
5302                                 echo "That didn't work either.  Giving up." >&4
5303                                 exit 1
5304                         fi
5305                 fi
5306         fi
5307 fi
5308 nm_extract="$com"
5309 if $test -f /lib/syscalls.exp; then
5310         echo " "
5311         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5312         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5313 fi
5314 ;;
5315 esac
5316 $rm -f libnames libpath
5317
5318 : see if dld is available
5319 set dld.h i_dld
5320 eval $inhdr
5321
5322 : is a C symbol defined?
5323 csym='tlook=$1;
5324 case "$3" in
5325 -v) tf=libc.tmp; tc=""; tdc="";;
5326 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5327 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5328 esac;
5329 tx=yes;
5330 case "$reuseval-$4" in
5331 true-) ;;
5332 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5333 esac;
5334 case "$tx" in
5335 yes)
5336         case "$runnm" in
5337         true)
5338                 if $contains $tlook $tf >/dev/null 2>&1;
5339                 then tval=true;
5340                 else tval=false;
5341                 fi;;
5342         *)
5343                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5344                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5345                 then tval=true;
5346                 else tval=false;
5347                 fi;
5348                 $rm -f t t.c;;
5349         esac;;
5350 *)
5351         case "$tval" in
5352         $define) tval=true;;
5353         *) tval=false;;
5354         esac;;
5355 esac;
5356 eval "$2=$tval"'
5357
5358 : define an is-in-libc? function
5359 inlibc='echo " "; td=$define; tu=$undef;
5360 sym=$1; var=$2; eval "was=\$$2";
5361 tx=yes;
5362 case "$reuseval$was" in
5363 true) ;;
5364 true*) tx=no;;
5365 esac;
5366 case "$tx" in
5367 yes)
5368         set $sym tres -f;
5369         eval $csym;
5370         case "$tres" in
5371         true)
5372                 echo "$sym() found." >&4;
5373                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5374         *)
5375                 echo "$sym() NOT found." >&4;
5376                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5377         esac;;
5378 *)
5379         case "$was" in
5380         $define) echo "$sym() found." >&4;;
5381         *) echo "$sym() NOT found." >&4;;
5382         esac;;
5383 esac'
5384
5385 : see if dlopen exists
5386 xxx_runnm="$runnm"
5387 runnm=false
5388 set dlopen d_dlopen
5389 eval $inlibc
5390 runnm="$xxx_runnm"
5391
5392 : determine which dynamic loading, if any, to compile in
5393 echo " "
5394 dldir="ext/DynaLoader"
5395 case "$usedl" in
5396 $define|y|true)
5397         dflt='y'
5398         usedl="$define"
5399         ;;
5400 $undef|n|false)
5401         dflt='n'
5402         usedl="$undef"
5403         ;;
5404 *) 
5405         dflt='n'
5406         case "$d_dlopen" in
5407             $define) dflt='y' ;;
5408         esac
5409         case "$i_dld" in
5410             $define) dflt='y' ;;
5411         esac
5412         : Does a dl_xxx.xs file exist for this operating system
5413         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5414         ;;
5415 esac
5416 rp="Do you wish to use dynamic loading?"
5417 . ./myread
5418 usedl="$ans"
5419 case "$ans" in
5420 y*) usedl="$define"
5421         case "$dlsrc" in
5422         '')
5423                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5424                         dflt="$dldir/dl_${osname}.xs"
5425                 elif $test "$d_dlopen" = "$define" ; then
5426                         dflt="$dldir/dl_dlopen.xs"
5427                 elif $test "$i_dld" = "$define" ; then
5428                         dflt="$dldir/dl_dld.xs"
5429                 else
5430                         dflt=''
5431                 fi
5432                 ;;
5433         *)      dflt="$dldir/$dlsrc"
5434                 ;;
5435         esac
5436     echo "The following dynamic loading files are available:"
5437         : Can not go over to $dldir because getfile has path hard-coded in.
5438         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5439         rp="Source file to use for dynamic loading"
5440         fn="fne"
5441         gfpth="$src"
5442         . ./getfile
5443         usedl="$define"
5444         : emulate basename
5445         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5446
5447         $cat << EOM
5448
5449 Some systems may require passing special flags to $cc -c to
5450 compile modules that will be used to create a shared library.
5451 To use no flags, say "none".
5452
5453 EOM
5454     case "$cccdlflags" in
5455     '') case "$gccversion" in
5456                 '') case "$osname" in
5457                         hpux)   dflt='+z' ;;
5458                         next)   dflt='none' ;;
5459                         irix*)  dflt='-KPIC' ;;
5460                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5461                         sunos)  dflt='-pic' ;;
5462                         *)      dflt='none' ;;
5463                     esac
5464                         ;;
5465                 *)  case "$osname" in
5466                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5467                         *)      dflt='-fpic' ;;
5468                     esac ;;
5469             esac ;;
5470         ' ') dflt='none' ;;
5471     *)  dflt="$cccdlflags" ;;
5472     esac
5473     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5474     . ./myread
5475     case "$ans" in
5476     none) cccdlflags=' ' ;;
5477     *) cccdlflags="$ans" ;;
5478     esac
5479
5480     cat << EOM
5481
5482 Some systems use ld to create libraries that can be dynamically loaded,
5483 while other systems (such as those using ELF) use $cc.
5484
5485 EOM
5486         case "$ld" in
5487         '')     $cat >try.c <<'EOM'
5488 /* Test for whether ELF binaries are produced */
5489 #include <fcntl.h>
5490 #include <stdlib.h>
5491 int main() {
5492         char b[4];
5493         int i = open("a.out",O_RDONLY);
5494         if(i == -1) 
5495                 exit(1); /* fail */
5496         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5497                 exit(0); /* succeed (yes, it's ELF) */
5498         else
5499                 exit(1); /* fail */
5500 }
5501 EOM
5502                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5503                         cat <<EOM
5504 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5505 EOM
5506                         dflt="$cc"
5507                 else
5508                         echo "I'll use ld to build dynamic libraries."
5509                         dflt='ld'
5510                 fi
5511                 rm -f try.c a.out
5512                 ;;
5513         *)      dflt="$ld"
5514                 ;;
5515         esac
5516
5517     rp="What command should be used to create dynamic libraries?"
5518     . ./myread
5519         ld="$ans"
5520
5521     cat << EOM
5522
5523 Some systems may require passing special flags to $ld to create a
5524 library that can be dynamically loaded.  If your ld flags include
5525 -L/other/path options to locate libraries outside your loader's normal
5526 search path, you may need to specify those -L options here as well.  To
5527 use no flags, say "none".
5528
5529 EOM
5530     case "$lddlflags" in
5531     '') case "$osname" in
5532                         beos) dflt='-nostart' ;;
5533                         hpux)  dflt='-b' ;;
5534                         linux|irix*)    dflt='-shared' ;;
5535                         next)  dflt='none' ;;
5536                         solaris) dflt='-G' ;;
5537                         sunos) dflt='-assert nodefinitions' ;;
5538                         svr4*|esix*) dflt="-G $ldflags" ;;
5539                 *)     dflt='none' ;;
5540                         esac
5541                         ;;
5542     *) dflt="$lddlflags" ;;
5543     esac
5544
5545         : Try to guess additional flags to pick up local libraries.
5546         : Be careful not to append to a plain 'none'
5547         case "$dflt" in
5548         none) dflt='' ;;
5549         esac
5550         for thisflag in $ldflags; do
5551                 case "$thisflag" in
5552                 -L*)
5553                         case " $dflt " in
5554                         *" $thisflag "*) ;;
5555                         *) dflt="$dflt $thisflag" ;;
5556                         esac
5557                         ;;
5558                 esac
5559         done
5560
5561         case "$dflt" in
5562         ''|' ') dflt='none' ;;
5563         esac
5564
5565     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5566     . ./myread
5567     case "$ans" in
5568     none) lddlflags=' ' ;;
5569     *) lddlflags="$ans" ;;
5570     esac
5571
5572         cat <<EOM
5573
5574 Some systems may require passing special flags to $cc to indicate that
5575 the resulting executable will use dynamic linking.  To use no flags,
5576 say "none".
5577
5578 EOM
5579     case "$ccdlflags" in
5580     '') case "$osname" in
5581                 hpux)   dflt='-Wl,-E' ;;
5582                 linux)  dflt='-rdynamic' ;;
5583                 next)   dflt='none' ;;
5584                 sunos)  dflt='none' ;;
5585                 *)      dflt='none' ;;
5586             esac ;;
5587     ' ')  dflt='none' ;;
5588     *)  dflt="$ccdlflags" ;;
5589     esac
5590     rp="Any special flags to pass to $cc to use dynamic loading?"
5591     . ./myread
5592     case "$ans" in
5593     none) ccdlflags=' ' ;;
5594     *) ccdlflags="$ans" ;;
5595     esac
5596     ;;
5597 *)  usedl="$undef"
5598         ld='ld'
5599     dlsrc='dl_none.xs'
5600     lddlflags=''
5601     ccdlflags=''
5602     ;;
5603 esac
5604
5605 also=''
5606 case "$usedl" in
5607 $undef)
5608         # No dynamic loading being used, so don't bother even to prompt.
5609         useshrplib='false'
5610         ;;
5611 *)      case "$useshrplib" in
5612         '')     case "$osname" in
5613                 svr4*|dgux|dynixptx|esix|powerux|beos)
5614                         dflt=y
5615                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5616                         ;;
5617                 next*)
5618                         case "$osvers" in
5619                         4*)     dflt=y
5620                                 also='Building a shared libperl is needed for MAB support.'
5621                                 ;;
5622                         *)      dflt=n
5623                                 ;;
5624                         esac
5625                         ;;
5626                 *)      dflt=n
5627                         ;;
5628                 esac
5629                 ;;
5630         $define|true|[Yy]*)
5631                 dflt=y
5632                 ;;
5633         *)      dflt=n
5634                 ;;
5635         esac
5636         $cat << EOM
5637
5638 The perl executable is normally obtained by linking perlmain.c with
5639 libperl${_a}, any static extensions (usually just DynaLoader), and
5640 any other libraries needed on this system (such as -lm, etc.).  Since
5641 your system supports dynamic loading, it is probably possible to build
5642 a shared libperl.$so.  If you will have more than one executable linked
5643 to libperl.$so, this will significantly reduce the size of each
5644 executable, but it may have a noticeable affect on performance.  The
5645 default is probably sensible for your system.
5646 $also
5647
5648 EOM
5649         rp="Build a shared libperl.$so (y/n)"
5650         . ./myread
5651         case "$ans" in
5652         true|$define|[Yy]*)
5653                 useshrplib='true'  ;;
5654         *)      useshrplib='false' ;;
5655         esac
5656         ;;
5657 esac
5658
5659 case "$useshrplib" in
5660 true)
5661         case "$libperl" in
5662         '')
5663                 # Figure out a good name for libperl.so.  Since it gets stored in
5664                 # a version-specific architecture-dependent library, the version
5665                 # number isn't really that important, except for making cc/ld happy.
5666                 #
5667                 # A name such as libperl.so.3.1
5668                 majmin="libperl.$so.$patchlevel.$subversion"
5669                 # A name such as libperl.so.301
5670                 majonly=`echo $patchlevel $subversion |
5671                         $awk '{printf "%d%02d", $1, $2}'`
5672                 majonly=libperl.$so.$majonly
5673                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5674                 # rely on figuring it out from the naming of libc.
5675                 case "${osname}${osvers}" in
5676                 next4*)
5677                         dflt=libperl.5.$so
5678                         # XXX How handle the --version stuff for MAB?
5679                         ;;
5680                 linux*)  # ld won't link with a bare -lperl otherwise.
5681                         dflt=libperl.$so
5682                         ;;
5683                 *)      # Try to guess based on whether libc has major.minor.
5684                         case "$libc" in
5685                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5686                         *libc.$so.[0-9]*) dflt=$majonly ;;
5687                         *)      dflt=libperl.$so ;;
5688                         esac
5689                         ;;
5690                 esac
5691                 ;;
5692         *)      dflt=$libperl
5693                 ;;
5694         esac
5695         cat << EOM
5696
5697 I need to select a good name for the shared libperl.  If your system uses
5698 library names with major and minor numbers, then you might want something
5699 like $majmin.  Alternatively, if your system uses a single version
5700 number for shared libraries, then you might want to use $majonly.
5701 Or, your system might be quite happy with a simple libperl.$so.
5702
5703 Since the shared libperl will get installed into a version-specific
5704 architecture-dependent directory, the version number of the shared perl
5705 library probably isn't important, so the default should be o.k.
5706
5707 EOM
5708         rp='What name do you want to give to the shared libperl?'
5709         . ./myread
5710         libperl=$ans
5711         echo "Ok, I'll use $libperl"
5712         ;;
5713 *)
5714         libperl="libperl${_a}"
5715         ;;
5716 esac
5717
5718 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5719 case "$shrpdir" in
5720 '') ;;
5721 *)      $cat >&4 <<EOM
5722 WARNING:  Use of the shrpdir variable for the installation location of
5723 the shared $libperl is not supported.  It was never documented and
5724 will not work in this version.  Let me (perlbug@perl.com)
5725 know of any problems this may cause.
5726
5727 EOM
5728         case "$shrpdir" in
5729         "$archlibexp/CORE")
5730                 $cat >&4 <<EOM
5731 But your current setting of $shrpdir is
5732 the default anyway, so it's harmless.
5733 EOM
5734                 ;;
5735         *)
5736                 $cat >&4 <<EOM
5737 Further, your current attempted setting of $shrpdir
5738 conflicts with the value of $archlibexp/CORE
5739 that installperl will use.
5740 EOM
5741                 ;;
5742         esac
5743         ;;
5744 esac
5745
5746 # How will the perl executable find the installed shared $libperl?
5747 # Add $xxx to ccdlflags.
5748 # If we can't figure out a command-line option, use $shrpenv to
5749 # set env LD_RUN_PATH.  The main perl makefile uses this.
5750 shrpdir=$archlibexp/CORE
5751 xxx=''
5752 tmp_shrpenv=''
5753 if "$useshrplib"; then
5754     case "$osname" in 
5755         aix)
5756                 # We'll set it in Makefile.SH...
5757                 ;;
5758         solaris|netbsd)
5759                 xxx="-R $shrpdir"
5760                 ;;
5761         freebsd)
5762                 xxx="-Wl,-R$shrpdir"
5763                 ;;
5764         linux|irix*|dec_osf)
5765                 xxx="-Wl,-rpath,$shrpdir"
5766                 ;;
5767         next)
5768                 # next doesn't like the default...
5769                 ;;
5770         beos)
5771                 # beos doesn't like the default, either.
5772                 ;;
5773         hpux*)
5774                 # hpux doesn't like the default, either.
5775                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5776                 ;;
5777         *)
5778                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5779                 ;;
5780         esac
5781         case "$xxx" in
5782         '') ;;
5783         *)      
5784                 # Only add $xxx if it isn't already in ccdlflags.
5785                 case " $ccdlflags " in
5786                 *" $xxx "*)     ;;
5787                 *)      ccdlflags="$ccdlflags $xxx"
5788                         cat <<EOM >&4
5789
5790 Adding $xxx to the flags
5791 passed to $ld so that the perl executable will find the 
5792 installed shared $libperl.
5793
5794 EOM
5795                         ;;
5796                 esac
5797                 ;;
5798         esac
5799 fi
5800 # Fix ccdlflags in AIX for building external extensions.
5801 # (For building Perl itself bare -bE:perl.exp is needed,
5802 #  Makefile.SH takes care of this.)
5803 case "$osname" in
5804 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5805 esac
5806 # Respect a hint or command-line value.
5807 case "$shrpenv" in
5808 '') shrpenv="$tmp_shrpenv" ;;
5809 esac
5810 case "$ldlibpthname" in
5811 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5812 none)   ldlibpthname='' ;;
5813 esac
5814
5815 : determine where manual pages go
5816 set man1dir man1dir none
5817 eval $prefixit
5818 $cat <<EOM
5819
5820 $spackage has manual pages available in source form.
5821 EOM
5822 case "$nroff" in
5823 nroff)
5824         echo "However, you don't have nroff, so they're probably useless to you."
5825         case "$man1dir" in
5826         '') man1dir="none";;
5827         esac;;
5828 esac
5829 echo "If you don't want the manual sources installed, answer 'none'."
5830 case "$man1dir" in
5831 ' ') dflt=none
5832         ;;
5833 '')
5834         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5835         lookpath="$lookpath $prefixexp/man/p_man/man1"
5836         lookpath="$lookpath $prefixexp/man/u_man/man1"
5837         lookpath="$lookpath $prefixexp/man/man.1"
5838         case "$sysman" in
5839         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5840         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5841         esac
5842         set dflt
5843         eval $prefixup
5844         ;;
5845 *)  dflt="$man1dir"
5846         ;;
5847 esac
5848 echo " "
5849 fn=dn+~
5850 rp="Where do the main $spackage manual pages (source) go?"
5851 . ./getfile
5852 if $test "X$man1direxp" != "X$ansexp"; then
5853         installman1dir=''
5854 fi
5855 man1dir="$ans"
5856 man1direxp="$ansexp"
5857 case "$man1dir" in
5858 '')     man1dir=' '
5859         installman1dir='';;
5860 esac
5861
5862 : Change installation prefix, if necessary.
5863 if $test X"$prefix" != X"$installprefix"; then
5864         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5865 else
5866         installman1dir="$man1direxp"
5867 fi
5868
5869 : What suffix to use on installed man pages
5870
5871 case "$man1dir" in
5872 ' ')
5873         man1ext='0'
5874         ;;
5875 *)
5876         rp="What suffix should be used for the main $spackage man pages?"
5877         case "$man1ext" in
5878         '')     case "$man1dir" in
5879                 *1)  dflt=1 ;;
5880                 *1p) dflt=1p ;;
5881                 *1pm) dflt=1pm ;;
5882                 *l) dflt=l;;
5883                 *n) dflt=n;;
5884                 *o) dflt=o;;
5885                 *p) dflt=p;;
5886                 *C) dflt=C;;
5887                 *L) dflt=L;;
5888                 *L1) dflt=L1;;
5889                 *) dflt=1;;
5890                 esac
5891                 ;;
5892         *)      dflt="$man1ext";;
5893         esac
5894         . ./myread
5895         man1ext="$ans"
5896         ;;
5897 esac
5898
5899 : see if we can have long filenames
5900 echo " "
5901 rmlist="$rmlist /tmp/cf$$"
5902 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5903 first=123456789abcdef
5904 second=/tmp/cf$$/$first
5905 $rm -f $first $second
5906 if (echo hi >$first) 2>/dev/null; then
5907         if $test -f 123456789abcde; then
5908                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5909                 val="$undef"
5910         else
5911                 if (echo hi >$second) 2>/dev/null; then
5912                         if $test -f /tmp/cf$$/123456789abcde; then
5913                                 $cat <<'EOM'
5914 That's peculiar... You can have filenames longer than 14 characters, but only
5915 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5916 I shall consider your system cannot support long filenames at all.
5917 EOM
5918                                 val="$undef"
5919                         else
5920                                 echo 'You can have filenames longer than 14 characters.' >&4
5921                                 val="$define"
5922                         fi
5923                 else
5924                         $cat <<'EOM'
5925 How confusing! Some of your filesystems are sane enough to allow filenames
5926 longer than 14 characters but some others like /tmp can't even think about them.
5927 So, for now on, I shall assume your kernel does not allow them at all.
5928 EOM
5929                         val="$undef"
5930                 fi
5931         fi
5932 else
5933         $cat <<'EOM'
5934 You can't have filenames longer than 14 chars.  You can't even think about them!
5935 EOM
5936         val="$undef"
5937 fi 
5938 set d_flexfnam
5939 eval $setvar
5940 $rm -rf /tmp/cf$$ 123456789abcde*
5941
5942 : determine where library module manual pages go
5943 set man3dir man3dir none
5944 eval $prefixit
5945 $cat <<EOM
5946
5947 $spackage has manual pages for many of the library modules.
5948 EOM
5949
5950 case "$nroff" in
5951 nroff)
5952         $cat <<'EOM'
5953 However, you don't have nroff, so they're probably useless to you.
5954 EOM
5955         case "$man3dir" in
5956         '') man3dir="none";;
5957         esac;;
5958 esac
5959
5960 case "$d_flexfnam" in
5961 undef)
5962         $cat <<'EOM'
5963 However, your system can't handle the long file names like File::Basename.3. 
5964 EOM
5965         case "$man3dir" in
5966         '') man3dir="none";;
5967         esac;;
5968 esac
5969
5970 echo "If you don't want the manual sources installed, answer 'none'."
5971 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5972 case "$man3dir" in
5973 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5974         if $test -d "$privlib/man/man3"; then
5975                 cat <<EOM >&4
5976
5977 WARNING:  Previous versions of perl installed man3 pages into
5978 $privlib/man/man3.  This version will suggest a 
5979 new default of $dflt.  
5980 EOM
5981                 tdflt=$dflt
5982                 dflt='n'
5983                 rp='Do you wish to preserve the old behavior?(y/n)'
5984                 . ./myread
5985                 case "$ans" in
5986                 y*) dflt="$privlib/man/man3" ;;
5987                 *)  dflt=$tdflt ;;
5988                 esac
5989     fi
5990         ;;
5991 ' ') dflt=none;;
5992 *)      dflt="$man3dir" ;;
5993 esac
5994 echo " "
5995 fn=dn+~
5996 rp="Where do the $package library man pages (source) go?"
5997 . ./getfile
5998 man3dir="$ans"
5999 man3direxp="$ansexp"
6000 case "$man1dir" in
6001 '')     man3dir=' '
6002         installman3dir='';;
6003 esac
6004
6005 : Change installation prefix, if necessary.
6006 if $test X"$prefix" != X"$installprefix"; then
6007         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6008 else
6009         installman3dir="$man3direxp"
6010 fi
6011
6012 : What suffix to use on installed man pages
6013 case "$man3dir" in
6014 ' ')
6015         man3ext='0'
6016         ;;
6017 *)
6018         rp="What suffix should be used for the $package library man pages?"
6019         case "$man3ext" in
6020         '')     case "$man3dir" in
6021                 *3)  dflt=3 ;;
6022                 *3p) dflt=3p ;;
6023                 *3pm) dflt=3pm ;;
6024                 *l) dflt=l;;
6025                 *n) dflt=n;;
6026                 *o) dflt=o;;
6027                 *p) dflt=p;;
6028                 *C) dflt=C;;
6029                 *L) dflt=L;;
6030                 *L3) dflt=L3;;
6031                 *) dflt=3;;
6032                 esac
6033                 ;;
6034         *)      dflt="$man3ext";;
6035         esac
6036         . ./myread
6037         man3ext="$ans"
6038         ;;
6039 esac
6040
6041 : see if we have to deal with yellow pages, now NIS.
6042 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6043         if $test -f /usr/etc/nibindd; then
6044                 echo " "
6045                 echo "I'm fairly confident you're on a NeXT."
6046                 echo " "
6047                 rp='Do you get the hosts file via NetInfo?'
6048                 dflt=y
6049                 case "$hostcat" in
6050                 nidump*) ;;
6051                 '') ;;
6052                 *) dflt=n;;
6053                 esac
6054                 . ./myread
6055                 case "$ans" in
6056                 y*) hostcat='nidump hosts .';;
6057                 *)      case "$hostcat" in
6058                         nidump*) hostcat='';;
6059                         esac
6060                         ;;
6061                 esac
6062         fi
6063         case "$hostcat" in
6064         nidump*) ;;
6065         *)
6066                 case "$hostcat" in
6067                 *ypcat*) dflt=y;;
6068                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6069                                 dflt=y
6070                         else
6071                                 dflt=n
6072                         fi;;
6073                 *) dflt=n;;
6074                 esac
6075                 echo " "
6076                 rp='Are you getting the hosts file via yellow pages?'
6077                 . ./myread
6078                 case "$ans" in
6079                 y*) hostcat='ypcat hosts';;
6080                 *) hostcat='cat /etc/hosts';;
6081                 esac
6082                 ;;
6083         esac
6084 fi
6085 case "$hostcat" in
6086 '') hostcat='cat /etc/hosts';;
6087 esac
6088 case "$groupcat" in
6089 '') groupcat='cat /etc/group';;
6090 esac
6091 case "$passcat" in
6092 '') passcat='cat /etc/passwd';;
6093 esac
6094
6095 : now get the host name
6096 echo " "
6097 echo "Figuring out host name..." >&4
6098 case "$myhostname" in
6099 '') cont=true
6100         echo 'Maybe "hostname" will work...'
6101         if tans=`sh -c hostname 2>&1` ; then
6102                 myhostname=$tans
6103                 phostname=hostname
6104                 cont=''
6105         fi
6106         ;;
6107 *) cont='';;
6108 esac
6109 if $test "$cont"; then
6110         if ./xenix; then
6111                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6112                 if tans=`cat /etc/systemid 2>&1` ; then
6113                         myhostname=$tans
6114                         phostname='cat /etc/systemid'
6115                         echo "Whadyaknow.  Xenix always was a bit strange..."
6116                         cont=''
6117                 fi
6118         elif $test -r /etc/systemid; then
6119                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6120         fi
6121 fi
6122 if $test "$cont"; then
6123         echo 'No, maybe "uuname -l" will work...'
6124         if tans=`sh -c 'uuname -l' 2>&1` ; then
6125                 myhostname=$tans
6126                 phostname='uuname -l'
6127         else
6128                 echo 'Strange.  Maybe "uname -n" will work...'
6129                 if tans=`sh -c 'uname -n' 2>&1` ; then
6130                         myhostname=$tans
6131                         phostname='uname -n'
6132                 else
6133                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6134                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6135                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6136                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6137                         else
6138                                 case "$myhostname" in
6139                                 '') echo "Does this machine have an identity crisis or something?"
6140                                         phostname='';;
6141                                 *)
6142                                         echo "Well, you said $myhostname before..."
6143                                         phostname='echo $myhostname';;
6144                                 esac
6145                         fi
6146                 fi
6147         fi
6148 fi
6149 : you do not want to know about this
6150 set $myhostname
6151 myhostname=$1
6152
6153 : verify guess
6154 if $test "$myhostname" ; then
6155         dflt=y
6156         rp='Your host name appears to be "'$myhostname'".'" Right?"
6157         . ./myread
6158         case "$ans" in
6159         y*) ;;
6160         *) myhostname='';;
6161         esac
6162 fi
6163
6164 : bad guess or no guess
6165 while $test "X$myhostname" = X ; do
6166         dflt=''
6167         rp="Please type the (one word) name of your host:"
6168         . ./myread
6169         myhostname="$ans"
6170 done
6171
6172 : translate upper to lower if necessary
6173 case "$myhostname" in
6174 *[A-Z]*)
6175         echo "(Normalizing case in your host name)"
6176         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6177         ;;
6178 esac
6179
6180 case "$myhostname" in
6181 *.*)
6182         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6183         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6184         echo "(Trimming domain name from host name--host name is now $myhostname)"
6185         ;;
6186 *) case "$mydomain" in
6187         '')
6188                 {
6189                         test "X$hostcat" = "Xypcat hosts" &&
6190                         ypmatch "$myhostname" hosts 2>/dev/null |\
6191                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6192                         $test -s hosts
6193                 } || {
6194                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6195                                         /[       ]$myhostname[  . ]/p" > hosts
6196                 }
6197                 tmp_re="[       . ]"
6198                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6199                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6200                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6201                         hosts | $sort | $uniq | \
6202                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6203                 case `$echo X$dflt` in
6204                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6205                         dflt=.
6206                         ;;
6207                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6208                         ;;
6209                 esac
6210                 case "$dflt" in
6211                 .)
6212                         tans=`./loc resolv.conf X /etc /usr/etc`
6213                         if $test -f "$tans"; then
6214                                 echo "(Attempting domain name extraction from $tans)"
6215                                 dflt=.`$sed -n -e 's/   / /g' \
6216                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6217                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6218                                 case "$dflt" in
6219                                 .) dflt=.`$sed -n -e 's/        / /g' \
6220                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6221                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6222                                         ;;
6223                                 esac
6224                         fi
6225                         ;;
6226                 esac
6227                 case "$dflt" in
6228                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6229                         dflt=.`sh -c domainname 2>/dev/null`
6230                         case "$dflt" in
6231                         '') dflt='.';;
6232                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6233                         esac
6234                         ;;
6235                 esac
6236                 case "$dflt" in
6237                 .) echo "(Lost all hope -- silly guess then)"
6238                         dflt='.uucp'
6239                         ;;
6240                 esac
6241                 $rm -f hosts
6242                 ;;
6243         *) dflt="$mydomain";;
6244         esac;;
6245 esac
6246 echo " "
6247 rp="What is your domain name?"
6248 . ./myread
6249 tans="$ans"
6250 case "$ans" in
6251 '') ;;
6252 .*) ;;
6253 *) tans=".$tans";;
6254 esac
6255 mydomain="$tans"
6256
6257 : translate upper to lower if necessary
6258 case "$mydomain" in
6259 *[A-Z]*)
6260         echo "(Normalizing case in your domain name)"
6261         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6262         ;;
6263 esac
6264
6265 : a little sanity check here
6266 case "$phostname" in
6267 '') ;;
6268 *)
6269         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6270         $myhostname$mydomain|$myhostname) ;;
6271         *)
6272                 case "$phostname" in
6273                 sed*)
6274                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6275                         ;;
6276                 *)
6277                         echo "(That doesn't agree with your $phostname command, by the way.)"
6278                         ;;
6279                 esac
6280         ;;
6281         esac
6282         ;;
6283 esac
6284
6285 $cat <<EOM
6286
6287 I need to get your e-mail address in Internet format if possible, i.e.
6288 something like user@host.domain. Please answer accurately since I have
6289 no easy means to double check it. The default value provided below
6290 is most probably close to the reality but may not be valid from outside
6291 your organization...
6292
6293 EOM
6294 cont=x
6295 while test "$cont"; do
6296         case "$cf_email" in
6297         '') dflt="$cf_by@$myhostname$mydomain";;
6298         *) dflt="$cf_email";;
6299         esac
6300         rp='What is your e-mail address?'
6301         . ./myread
6302         cf_email="$ans"
6303         case "$cf_email" in
6304         *@*.*) cont='' ;;
6305         *)
6306                 rp='Address does not look like an Internet one.  Use it anyway?'
6307                 case "$fastread" in
6308                 yes) dflt=y ;;
6309                 *) dflt=n ;;
6310                 esac
6311                 . ./myread
6312                 case "$ans" in
6313                 y*) cont='' ;;
6314                 *) echo " " ;;
6315                 esac
6316                 ;;
6317         esac
6318 done
6319
6320 $cat <<EOM
6321
6322 If you or somebody else will be maintaining perl at your site, please
6323 fill in the correct e-mail address here so that they may be contacted
6324 if necessary. Currently, the "perlbug" program included with perl
6325 will send mail to this address in addition to perlbug@perl.com. You may
6326 enter "none" for no administrator.
6327
6328 EOM
6329 case "$perladmin" in
6330 '') dflt="$cf_email";;
6331 *) dflt="$perladmin";;
6332 esac
6333 rp='Perl administrator e-mail address'
6334 . ./myread
6335 perladmin="$ans"
6336
6337 : figure out how to guarantee perl startup
6338 case "$startperl" in
6339 '')
6340         case "$sharpbang" in
6341         *!)
6342                 $cat <<EOH
6343
6344 I can use the #! construct to start perl on your system. This will
6345 make startup of perl scripts faster, but may cause problems if you
6346 want to share those scripts and perl is not in a standard place
6347 ($binexp/perl) on all your platforms. The alternative is to force
6348 a shell by starting the script with a single ':' character.
6349
6350 EOH
6351                 dflt="$binexp/perl"
6352                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6353                 . ./myread
6354                 case "$ans" in
6355                 none)   startperl=": # use perl";;
6356                 *)      startperl="#!$ans"
6357                         if $test 30 -lt `echo "$ans" | wc -c`; then
6358                                 $cat >&4 <<EOM
6359
6360 WARNING:  Some systems limit the #! command to 32 characters.
6361 If you experience difficulty running Perl scripts with #!, try
6362 installing Perl in a directory with a shorter pathname.
6363
6364 EOM
6365                         fi ;;
6366                 esac
6367                 ;;
6368         *) startperl=": # use perl"
6369                 ;;
6370         esac
6371         ;;
6372 esac
6373 echo "I'll use $startperl to start perl scripts."
6374
6375 : figure best path for perl in scripts
6376 case "$perlpath" in
6377 '')
6378         perlpath="$binexp/perl"
6379         case "$startperl" in
6380         *!*) ;;
6381         *)
6382                 $cat <<EOH
6383
6384 I will use the "eval 'exec'" idiom to start Perl on your system.
6385 I can use the full path of your Perl binary for this purpose, but
6386 doing so may cause problems if you want to share those scripts and
6387 Perl is not always in a standard place ($binexp/perl).
6388
6389 EOH
6390                 dflt="$binexp/perl"
6391                 rp="What path shall I use in \"eval 'exec'\"?"
6392                 . ./myread
6393                 perlpath="$ans"
6394                 ;;
6395         esac
6396         ;;
6397 esac
6398 case "$startperl" in
6399 *!*)    ;;
6400 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6401 esac
6402
6403 : determine where public executable scripts go
6404 set scriptdir scriptdir
6405 eval $prefixit
6406 case "$scriptdir" in
6407 '')
6408         dflt="$bin"
6409         : guess some guesses
6410         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6411         $test -d /usr/share/bin     && dflt=/usr/share/bin
6412         $test -d /usr/local/script  && dflt=/usr/local/script
6413         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6414         $test -d $prefixexp/script  && dflt=$prefixexp/script
6415         set dflt
6416         eval $prefixup
6417         ;;
6418 *)  dflt="$scriptdir"
6419         ;;
6420 esac
6421 $cat <<EOM
6422  
6423 Some installations have a separate directory just for executable scripts so
6424 that they can mount it across multiple architectures but keep the scripts in
6425 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6426 Or you might just lump your scripts in with all your other executables.
6427  
6428 EOM
6429 fn=d~
6430 rp='Where do you keep publicly executable scripts?'
6431 . ./getfile
6432 if $test "X$ansexp" != "X$scriptdirexp"; then
6433         installscript=''
6434 fi
6435 scriptdir="$ans"
6436 scriptdirexp="$ansexp"
6437 : Change installation prefix, if necessary.
6438 if $test X"$prefix" != X"$installprefix"; then
6439         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6440 else
6441         installscript="$scriptdirexp"
6442 fi
6443
6444 $cat <<EOM
6445
6446 After $package is installed, you may wish to install various
6447 add-on modules and utilities.  Typically, these add-ons will
6448 be installed under $prefix with the rest
6449 of this package.  However, you may wish to install such add-ons
6450 elsewhere under a different prefix.
6451
6452 If you do not wish to put everything under a single prefix, that's
6453 ok.  You will be prompted for the individual locations; this siteprefix
6454 is only used to suggest the defaults.
6455
6456 The default should be fine for most people.
6457
6458 EOM
6459 fn=d~+
6460 rp='Installation prefix to use for add-on modules and utilities?'
6461 : XXX Here might be another good place for an installstyle setting.
6462 case "$siteprefix" in
6463 '') dflt=$prefix ;;
6464 *)  dflt=$siteprefix ;;
6465 esac
6466 . ./getfile
6467 oldsiteprefix=''
6468 case "$siteprefix" in
6469 '') ;;
6470 *)
6471         case "$ans" in
6472         "$prefix") ;;
6473         *) oldsiteprefix="$prefix";;
6474         esac
6475         ;;
6476 esac
6477 siteprefix="$ans"
6478 siteprefixexp="$ansexp"
6479
6480 : determine where site specific libraries go.
6481 : Usual default is /usr/local/lib/perl5/site_perl
6482 : The default "style" setting is made in installstyle.U
6483 : XXX No longer works with Prefixit stuff.
6484 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6485 case "$installstyle" in
6486 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6487 *)       dflt=$siteprefix/lib/site_$prog ;;
6488 esac
6489 $cat <<EOM
6490
6491 The installation process will create a directory for
6492 site-specific extensions and modules.  Most users find it convenient
6493 to place all site-specific files in this directory rather than in the
6494 main distribution directory.
6495
6496 EOM
6497 fn=d~+
6498 rp='Pathname for the site-specific library files?'
6499 . ./getfile
6500 sitelib="$ans"
6501 sitelibexp="$ansexp"
6502 : Change installation prefix, if necessary.
6503 if $test X"$prefix" != X"$installprefix"; then
6504         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6505 else
6506         installsitelib="$sitelibexp"
6507 fi
6508
6509 : determine where site specific architecture-dependent libraries go.
6510 : sitelib  default is /usr/local/lib/perl5/site_perl/
6511 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6512 : sitelib may have an optional trailing /share.
6513 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6514 tdflt="$tdflt/$apiversion/$archname"
6515 set sitearch sitearch none
6516 eval $prefixit
6517 case "$sitearch" in
6518 '')     dflt="$tdflt" ;;
6519 *)      dflt="$sitearch" ;;
6520 esac
6521 $cat <<EOM
6522
6523 The installation process will also create a directory for
6524 architecture-dependent site-specific extensions and modules.
6525
6526 EOM
6527 fn=nd~+
6528 rp='Pathname for the site-specific architecture-dependent library files?'
6529 . ./getfile
6530 sitearch="$ans"
6531 sitearchexp="$ansexp"
6532 : Change installation prefix, if necessary.
6533 if $test X"$prefix" != X"$installprefix"; then
6534         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6535 else
6536         installsitearch="$sitearchexp"
6537 fi
6538
6539 cat <<EOM
6540
6541 Perl can be built to take advantage of long doubles which
6542 (if available) may give more accuracy and range for floating point
6543 numbers.  To do so, Configure must be run with -Duselongdouble.
6544
6545 If this doesn't make any sense to you, just accept the default 'n'.
6546 EOM
6547 case "$uselongdouble" in
6548 $define|true|[yY]*)     dflt='y';;
6549 *) dflt='n';;
6550 esac
6551 rp='Try to use long doubles if available?'
6552 . ./myread
6553 case "$ans" in
6554 y|Y)    val="$define"   ;;
6555 *)      val="$undef"    ;;
6556 esac
6557 set uselongdouble
6558 eval $setvar
6559
6560 case "$uselongdouble" in
6561 "$define"|true|[yY]*)
6562 : Look for a hint-file generated 'call-back-unit'.  If the
6563 : user has specified that long doubles should be used,
6564 : we may need to set or change some other defaults.
6565         if $test -f uselongdouble.cbu; then
6566                 echo "Your platform has some specific hints for long doubles, using them..."
6567                 . ./uselongdouble.cbu
6568         else
6569                 $cat <<EOM
6570 (Your platform doesn't have any specific hints for long doubles.)
6571 EOM
6572         fi
6573         ;;
6574 esac
6575
6576 cat <<EOM
6577
6578 Previous version of $package used the standard IO mechanisms as defined
6579 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6580 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6581 the default.  This abstraction layer can use AT&T's sfio (if you already
6582 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6583 problems with some extension modules.  Using PerlIO with stdio is safe,
6584 but it is slower than plain stdio and therefore is not the default.
6585
6586 If this doesn't make any sense to you, just accept the default 'n'.
6587 EOM
6588 case "$useperlio" in
6589 $define|true|[yY]*)     dflt='y';;
6590 *) dflt='n';;
6591 esac
6592 rp='Use the experimental PerlIO abstraction layer?'
6593 . ./myread
6594 case "$ans" in
6595 y|Y) 
6596         val="$define"
6597         ;;     
6598 *)      
6599         echo "Ok, doing things the stdio way"
6600         val="$undef"
6601         ;;
6602 esac
6603 set useperlio
6604 eval $setvar 
6605
6606 : Check how to convert floats to strings.
6607 if test "X$d_Gconvert" = X; then
6608         echo " "
6609         echo "Checking for an efficient way to convert floats to strings."
6610         $cat >try.c <<'EOP'
6611 #ifdef TRY_gconvert
6612 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6613 char *myname = "gconvert";
6614 #endif
6615 #ifdef TRY_gcvt
6616 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6617 char *myname = "gcvt";
6618 #endif
6619 #ifdef TRY_sprintf
6620 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6621 char *myname = "sprintf";
6622 #endif
6623
6624 #include <stdio.h>
6625
6626 int
6627 checkit(expect, got)
6628 char *expect;
6629 char *got;
6630 {
6631     if (strcmp(expect, got)) {
6632                 printf("%s oddity:  Expected %s, got %s\n",
6633                         myname, expect, got);
6634                 exit(1);
6635         }
6636 }
6637
6638 int main()
6639
6640         char buf[64]; 
6641         buf[63] = '\0';
6642
6643         /* This must be 1st test on (which?) platform */
6644         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6645         Gconvert(0.1, 8, 0, buf);
6646         checkit("0.1", buf);
6647
6648         Gconvert(1.0, 8, 0, buf); 
6649         checkit("1", buf);
6650
6651         Gconvert(0.0, 8, 0, buf); 
6652         checkit("0", buf);
6653
6654         Gconvert(-1.0, 8, 0, buf); 
6655         checkit("-1", buf);
6656
6657         /* Some Linux gcvt's give 1.e+5 here. */
6658         Gconvert(100000.0, 8, 0, buf); 
6659         checkit("100000", buf);
6660         
6661         /* Some Linux gcvt's give -1.e+5 here. */
6662         Gconvert(-100000.0, 8, 0, buf); 
6663         checkit("-100000", buf);
6664
6665         exit(0);
6666 }
6667 EOP
6668         case "$d_Gconvert" in
6669         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6670         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6671         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6672         *) xxx_list='gconvert gcvt sprintf' ;;
6673         esac
6674
6675         for xxx_convert in $xxx_list; do
6676                 echo "Trying $xxx_convert"
6677                 $rm -f try try$_o
6678                 set try -DTRY_$xxx_convert
6679                 if eval $compile; then
6680                         echo "$xxx_convert" found. >&4
6681                         if ./try; then
6682                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6683                                 break;
6684                         else
6685                                 echo "...But $xxx_convert didn't work as I expected."
6686                         fi
6687                 else
6688                         echo "$xxx_convert NOT found." >&4
6689                 fi
6690         done
6691                 
6692         case "$xxx_convert" in
6693         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6694         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6695         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6696         esac
6697 fi
6698
6699 : see if inttypes.h is available
6700 : we want a real compile instead of Inhdr because some systems
6701 : have an inttypes.h which includes non-existent headers
6702 echo " "
6703 $cat >try.c <<EOCP
6704 #include <inttypes.h>
6705 int main() {
6706         static int32_t foo32 = 0x12345678;
6707 }
6708 EOCP
6709 set try
6710 if eval $compile; then
6711         echo "<inttypes.h> found." >&4
6712         val="$define"
6713 else
6714         echo "<inttypes.h> NOT found." >&4
6715         val="$undef"
6716 fi
6717 $rm -f try.c try
6718 set i_inttypes
6719 eval $setvar
6720
6721 : check for int64_t
6722 case "$use64bits" in
6723 "$define" )
6724         echo " "
6725         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6726         $cat >try.c <<EOCP
6727 #include <sys/types.h>
6728 #$i_inttypes I_INTTYPES
6729 #ifdef I_INTTYPES
6730 #include <inttypes.h>
6731 #endif
6732 int64_t foo() { int64_t x; x = 7; return x; }
6733 EOCP
6734         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6735                 val="$define"
6736                 echo " Yup, it does." >&4
6737         else
6738                 val="$undef"
6739                 echo " Nope, it doesn't." >&4
6740         fi
6741         $rm -f try.*
6742         ;;
6743 *)      val="$undef"
6744         ;;
6745 esac
6746 set d_int64t
6747 eval $setvar
6748
6749
6750 : check for lengths of integral types
6751 echo " "
6752 case "$intsize" in
6753 '')
6754         echo "Checking to see how big your integers are..." >&4
6755         $cat >intsize.c <<'EOCP'
6756 #include <stdio.h>
6757 int main()
6758 {
6759         printf("intsize=%d;\n", sizeof(int));
6760         printf("longsize=%d;\n", sizeof(long));
6761         printf("shortsize=%d;\n", sizeof(short));
6762         exit(0);
6763 }
6764 EOCP
6765         set intsize
6766         if eval $compile_ok && ./intsize > /dev/null; then
6767                 eval `./intsize`
6768                 echo "Your integers are $intsize bytes long."
6769                 echo "Your long integers are $longsize bytes long."
6770                 echo "Your short integers are $shortsize bytes long."
6771         else
6772                 $cat >&4 <<EOM
6773 !
6774 Help! I can't compile and run the intsize test program: please enlighten me!
6775 (This is probably a misconfiguration in your system or libraries, and
6776 you really ought to fix it.  Still, I'll try anyway.)
6777 !
6778 EOM
6779                 dflt=4
6780                 rp="What is the size of an integer (in bytes)?"
6781                 . ./myread
6782                 intsize="$ans"
6783                 dflt=$intsize
6784                 rp="What is the size of a long integer (in bytes)?"
6785                 . ./myread
6786                 longsize="$ans"
6787                 dflt=2
6788                 rp="What is the size of a short integer (in bytes)?"
6789                 . ./myread
6790                 shortsize="$ans"
6791         fi
6792         ;;
6793 esac
6794 $rm -f intsize intsize.*
6795
6796 : check for long long
6797 echo " "
6798 $echo $n "Checking to see if your system supports long long...$c" >&4
6799 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6800 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6801         val="$define"
6802         echo " Yup, it does." >&4
6803 else
6804         val="$undef"
6805         echo " Nope, it doesn't." >&4
6806 fi
6807 $rm try.*
6808 set d_longlong
6809 eval $setvar
6810
6811 : check for length of long long
6812 case "${d_longlong}${longlongsize}" in
6813 $define)
6814         echo " "
6815         $echo $n "Checking to see how big your long longs are...$c" >&4
6816         $cat >try.c <<'EOCP'
6817 #include <stdio.h>
6818 int main()
6819 {
6820         printf("%d\n", sizeof(long long));
6821 }
6822 EOCP
6823         set try
6824         if eval $compile_ok; then
6825                 longlongsize=`./try`
6826                 $echo " $longlongsize bytes." >&4
6827         else
6828                 dflt='8'
6829                 echo " "
6830                 echo "(I can't seem to compile the test program.  Guessing...)"
6831                 rp="What is the size of a long long (in bytes)?"
6832                 . ./myread
6833                 longlongsize="$ans"
6834         fi
6835         if $test "X$longsize" = "X$longlongsize"; then
6836                 echo "(That isn't any different from an ordinary long.)"
6837         fi      
6838         ;;
6839 esac
6840 $rm -f try.c try
6841
6842 echo " "
6843
6844 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6845
6846 echo "Checking how to print 64-bit integers..." >&4
6847
6848 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6849         quad=int
6850         $cat >try.c <<'EOCP'
6851 #include <sys/types.h>
6852 #include <stdio.h>
6853 int main() {
6854   int q = 12345678901;
6855   printf("%ld\n", q);
6856 }
6857 EOCP
6858         set try
6859         if eval $compile; then
6860                 yyy=`./try$exe_ext`
6861                 case "$yyy" in
6862                 12345678901)
6863                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6864                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6865                         echo "We will use %d."
6866                         ;;
6867                 esac
6868         fi
6869 fi
6870
6871 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6872         quad=long
6873         $cat >try.c <<'EOCP'
6874 #include <sys/types.h>
6875 #include <stdio.h>
6876 int main() {
6877   long q = 12345678901;
6878   printf("%ld\n", q);
6879 }
6880 EOCP
6881         set try
6882         if eval $compile; then
6883                 yyy=`./try$exe_ext`
6884                 case "$yyy" in
6885                 12345678901)
6886                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6887                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6888                         echo "We will use %ld."
6889                         ;;
6890                 esac
6891         fi
6892 fi
6893
6894 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6895         quad=int64_t
6896         $cat >try.c <<'EOCP'
6897 #include <sys/types.h>
6898 #include <inttypes.h>
6899 #include <stdio.h>
6900 int main() {
6901   int64_t q = 12345678901;
6902   printf("%" PRId64 "\n", q);
6903 }
6904 EOCP
6905         set try
6906         if eval $compile; then
6907                 yyy=`./try$exe_ext`
6908                 case "$yyy" in
6909                 12345678901)
6910                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6911                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6912                         echo "We will use the C9X style."
6913                         ;;
6914                 esac
6915         fi
6916 fi
6917
6918 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6919         quad="long long"
6920         $cat >try.c <<'EOCP'
6921 #include <sys/types.h>
6922 #include <stdio.h>
6923 int main() {
6924   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6925   printf("%lld\n", q);
6926 }
6927 EOCP
6928         set try
6929         if eval $compile; then
6930                 yyy=`./try$exe_ext`
6931                 case "$yyy" in
6932                 12345678901)
6933                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6934                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6935                         echo "We will use the %lld style."
6936                         ;;
6937                 esac
6938         fi
6939 fi
6940
6941 if $test X"$sPRId64" = X -a X"$quad" != X; then
6942         $cat >try.c <<EOCP
6943 #include <sys/types.h>
6944 #include <stdio.h>
6945 int main() {
6946   $quad q = 12345678901;
6947   printf("%Ld\n", q);
6948 }
6949 EOCP
6950         set try
6951         if eval $compile; then
6952                 yyy=`./try$exe_ext`
6953                 case "$yyy" in
6954                 12345678901)
6955                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6956                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6957                         echo "We will use %lld."
6958                         ;;
6959                 esac
6960         fi
6961 fi
6962
6963 if $test X"$sPRId64" = X -a X"$quad" != X; then
6964         $cat >try.c <<EOCP
6965 #include <sys/types.h>
6966 #include <stdio.h>
6967 int main() {
6968   $quad q = 12345678901;
6969   printf("%qd\n", q);
6970 }
6971 EOCP
6972         set try
6973         if eval $compile; then
6974                 yyy=`./try$exe_ext`
6975                 case "$yyy" in
6976                 12345678901)
6977                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6978                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6979                         echo "We will use %qd."
6980                         ;;
6981                 esac
6982         fi
6983 fi
6984
6985 if $test X"$sPRId64" = X; then
6986         echo "Cannot figure out how to print 64-bit integers." >&4
6987 fi
6988
6989 $rm -f try try.*
6990
6991 fi # intsize -o longsize -o d_int64t -o d_longlong
6992
6993 case "$sPRId64" in
6994 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6995         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6996         ;;
6997 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6998         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6999         ;;
7000 esac
7001
7002 : check for length of double
7003 echo " "
7004 case "$doublesize" in
7005 '')
7006         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7007         $cat >try.c <<'EOCP'
7008 #include <stdio.h>
7009 int main()
7010 {
7011         printf("%d\n", sizeof(double));
7012 }
7013 EOCP
7014         set try
7015         if eval $compile_ok; then
7016                 doublesize=`./try`
7017                 $echo " $doublesize bytes." >&4
7018         else
7019                 dflt='8'
7020                 echo "(I can't seem to compile the test program.  Guessing...)"
7021                 rp="What is the size of a double precision number (in bytes)?"
7022                 . ./myread
7023                 doublesize="$ans"
7024         fi
7025         ;;
7026 esac
7027 $rm -f try.c try
7028
7029 : check for long doubles
7030 echo " "
7031 $echo $n "Checking to see if your system supports long double...$c" >&4
7032 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7033 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7034         val="$define"
7035         echo " Yup, it does." >&4
7036 else
7037         val="$undef"
7038         echo " Nope, it doesn't." >&4
7039 fi
7040 $rm try.*
7041 set d_longdbl
7042 eval $setvar
7043
7044 : check for length of long double
7045 case "${d_longdbl}${longdblsize}" in
7046 $define)
7047         echo " "
7048         $echo $n "Checking to see how big your long doubles are...$c" >&4
7049         $cat >try.c <<'EOCP'
7050 #include <stdio.h>
7051 int main()
7052 {
7053         printf("%d\n", sizeof(long double));
7054 }
7055 EOCP
7056         set try
7057         if eval $compile; then
7058                 longdblsize=`./try`
7059                 $echo " $longdblsize bytes." >&4
7060         else
7061                 dflt='8'
7062                 echo " "
7063                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7064                 rp="What is the size of a long double (in bytes)?"
7065                 . ./myread
7066                 longdblsize="$ans"
7067         fi
7068         if $test "X$doublesize" = "X$longdblsize"; then
7069                 echo "(That isn't any different from an ordinary double.)"
7070         fi      
7071         ;;
7072 esac
7073 $rm -f try.c try
7074
7075 echo " "
7076
7077 if $test X"$d_longdbl" = X"$define"; then
7078
7079 echo "Checking how to print long doubles..." >&4
7080
7081 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7082         $cat >try.c <<'EOCP'
7083 #include <sys/types.h>
7084 #include <stdio.h>
7085 int main() {
7086   double d = 123.456;
7087   printf("%.3f\n", d);
7088 }
7089 EOCP
7090         set try
7091         if eval $compile; then
7092                 yyy=`./try$exe_ext`
7093                 case "$yyy" in
7094                 123.456)
7095                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7096                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7097                         echo "We will use %f."
7098                         ;;
7099                 esac
7100         fi
7101 fi
7102
7103 if $test X"$sPRIfldbl" = X; then
7104         $cat >try.c <<'EOCP'
7105 #include <sys/types.h>
7106 #include <stdio.h>
7107 int main() {
7108   long double d = 123.456;
7109   printf("%.3llf\n", d);
7110 }
7111 EOCP
7112         set try
7113         if eval $compile; then
7114                 yyy=`./try$exe_ext`
7115                 case "$yyy" in
7116                 123.456)
7117                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7118                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7119                         echo "We will use %llf."
7120                         ;;
7121                 esac
7122         fi
7123 fi
7124
7125 if $test X"$sPRIfldbl" = X; then
7126         $cat >try.c <<'EOCP'
7127 #include <sys/types.h>
7128 #include <stdio.h>
7129 int main() {
7130   long double d = 123.456;
7131   printf("%.3Lf\n", d);
7132 }
7133 EOCP
7134         set try
7135         if eval $compile; then
7136                 yyy=`./try$exe_ext`
7137                 case "$yyy" in
7138                 123.456)
7139                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7140                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7141                         echo "We will use %Lf."
7142                         ;;
7143                 esac
7144         fi
7145 fi
7146
7147 if $test X"$sPRIfldbl" = X; then
7148         $cat >try.c <<'EOCP'
7149 #include <sys/types.h>
7150 #include <stdio.h>
7151 int main() {
7152   long double d = 123.456;
7153   printf("%.3lf\n", d);
7154 }
7155 EOCP
7156         set try
7157         if eval $compile; then
7158                 yyy=`./try$exe_ext`
7159                 case "$yyy" in
7160                 123.456)
7161                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7162                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7163                         echo "We will use %lf."
7164                         ;;
7165                 esac
7166         fi
7167 fi
7168
7169 if $test X"$sPRIfldbl" = X; then
7170         echo "Cannot figure out how to print long doubles." >&4
7171 fi
7172
7173 $rm -f try try.*
7174
7175 fi # d_longdbl
7176
7177 case "$sPRIfldbl" in
7178 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7179         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7180         ;;
7181 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7182         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7183         ;;
7184 esac
7185
7186 : Initialize h_fcntl
7187 h_fcntl=false
7188
7189 : Initialize h_sysfile
7190 h_sysfile=false
7191
7192 : access call always available on UNIX
7193 set access d_access
7194 eval $inlibc
7195
7196 : locate the flags for 'access()'
7197 case "$d_access" in
7198 "$define")
7199         echo " "
7200         $cat >access.c <<'EOCP'
7201 #include <sys/types.h>
7202 #ifdef I_FCNTL
7203 #include <fcntl.h>
7204 #endif
7205 #ifdef I_SYS_FILE
7206 #include <sys/file.h>
7207 #endif
7208 #ifdef I_UNISTD
7209 #include <unistd.h>
7210 #endif
7211 int main() {
7212         exit(R_OK);
7213 }
7214 EOCP
7215         : check sys/file.h first, no particular reason here
7216         if $test `./findhdr sys/file.h` && \
7217                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7218                 h_sysfile=true;
7219                 echo "<sys/file.h> defines the *_OK access constants." >&4
7220         elif $test `./findhdr fcntl.h` && \
7221                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7222                 h_fcntl=true;
7223                 echo "<fcntl.h> defines the *_OK access constants." >&4
7224         elif $test `./findhdr unistd.h` && \
7225                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7226                 echo "<unistd.h> defines the *_OK access constants." >&4
7227         else
7228                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7229         fi
7230         ;;
7231 esac
7232 $rm -f access*
7233
7234 : see if accessx exists
7235 set accessx d_accessx
7236 eval $inlibc
7237
7238 : see if alarm exists
7239 set alarm d_alarm
7240 eval $inlibc
7241
7242 : see if atolf exists
7243 set atolf d_atolf
7244 eval $inlibc
7245
7246 : see if atoll exists
7247 set atoll d_atoll
7248 eval $inlibc
7249
7250 : Look for GNU-cc style attribute checking
7251 echo " "
7252 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7253 $cat >attrib.c <<'EOCP'
7254 #include <stdio.h>
7255 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7256 EOCP
7257 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7258         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7259                 echo "Your C compiler doesn't fully support __attribute__."
7260                 val="$undef"
7261         else
7262                 echo "Your C compiler supports __attribute__."
7263                 val="$define"
7264         fi
7265 else
7266         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7267         val="$undef"
7268 fi
7269 set d_attribut
7270 eval $setvar
7271 $rm -f attrib*
7272
7273 : see if bcmp exists
7274 set bcmp d_bcmp
7275 eval $inlibc
7276
7277 : see if bcopy exists
7278 set bcopy d_bcopy
7279 eval $inlibc
7280
7281 : see if this is a unistd.h system
7282 set unistd.h i_unistd
7283 eval $inhdr
7284
7285 : see if getpgrp exists
7286 set getpgrp d_getpgrp
7287 eval $inlibc
7288
7289 case "$d_getpgrp" in
7290 "$define")
7291         echo " "
7292         echo "Checking to see which flavor of getpgrp is in use..."
7293         $cat >set.c <<EOP
7294 #$i_unistd I_UNISTD
7295 #include <sys/types.h>
7296 #ifdef I_UNISTD
7297 #  include <unistd.h>
7298 #endif
7299 int main()
7300 {
7301         if (getuid() == 0) {
7302                 printf("(I see you are running Configure as super-user...)\n");
7303                 setuid(1);
7304         }
7305 #ifdef TRY_BSD_PGRP
7306         if (getpgrp(1) == 0)
7307                 exit(0);
7308 #else
7309         if (getpgrp() > 0)
7310                 exit(0);
7311 #endif
7312         exit(1);
7313 }
7314 EOP
7315         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7316                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7317                 val="$define"
7318         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7319                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7320                 val="$undef"
7321         else
7322                 echo "I can't seem to compile and run the test program."
7323                 if ./usg; then
7324                         xxx="a USG one, i.e. you use getpgrp()."
7325                 else
7326                         # SVR4 systems can appear rather BSD-ish.
7327                         case "$i_unistd" in
7328                         $undef)
7329                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7330                                 val="$define"
7331                                 ;;
7332                         $define)
7333                                 xxx="probably a USG one, i.e. you use getpgrp()."
7334                                 val="$undef"
7335                                 ;;
7336                         esac
7337                 fi
7338                 echo "Assuming your getpgrp is $xxx" >&4
7339         fi
7340         ;;
7341 *) val="$undef";;
7342 esac
7343 set d_bsdgetpgrp
7344 eval $setvar
7345 $rm -f set set.c
7346
7347 : see if setpgrp exists
7348 set setpgrp d_setpgrp
7349 eval $inlibc
7350
7351 case "$d_setpgrp" in
7352 "$define")
7353         echo " "
7354         echo "Checking to see which flavor of setpgrp is in use..."
7355         $cat >set.c <<EOP
7356 #$i_unistd I_UNISTD
7357 #include <sys/types.h>
7358 #ifdef I_UNISTD
7359 #  include <unistd.h>
7360 #endif
7361 int main()
7362 {
7363         if (getuid() == 0) {
7364                 printf("(I see you are running Configure as super-user...)\n");
7365                 setuid(1);
7366         }
7367 #ifdef TRY_BSD_PGRP
7368         if (-1 == setpgrp(1, 1))
7369                 exit(0);
7370 #else
7371         if (setpgrp() != -1)
7372                 exit(0);
7373 #endif
7374         exit(1);
7375 }
7376 EOP
7377         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7378                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7379                 val="$define"
7380         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7381                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7382                 val="$undef"
7383         else
7384                 echo "(I can't seem to compile and run the test program.)"
7385                 if ./usg; then
7386                         xxx="a USG one, i.e. you use setpgrp()."
7387                 else
7388                         # SVR4 systems can appear rather BSD-ish.
7389                         case "$i_unistd" in
7390                         $undef)
7391                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7392                                 val="$define"
7393                                 ;;
7394                         $define)
7395                                 xxx="probably a USG one, i.e. you use setpgrp()."
7396                                 val="$undef"
7397                                 ;;
7398                         esac
7399                 fi
7400                 echo "Assuming your setpgrp is $xxx" >&4
7401         fi
7402         ;;
7403 *) val="$undef";;
7404 esac
7405 set d_bsdsetpgrp
7406 eval $setvar
7407 $rm -f set set.c
7408 : see if bzero exists
7409 set bzero d_bzero
7410 eval $inlibc
7411
7412 : see if signal is declared as pointer to function returning int or void
7413 echo " "
7414 xxx=`./findhdr signal.h`
7415 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7416 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7417         echo "You have int (*signal())() instead of void." >&4
7418         val="$undef"
7419 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7420         echo "You have void (*signal())()." >&4
7421         val="$define"
7422 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7423         echo "You have int (*signal())() instead of void." >&4
7424         val="$undef"
7425 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7426         echo "You have void (*signal())()." >&4
7427         val="$define"
7428 else
7429         case "$d_voidsig" in
7430         '')
7431         echo "I can't determine whether signal handler returns void or int..." >&4
7432                 dflt=void
7433                 rp="What type does your signal handler return?"
7434                 . ./myread
7435                 case "$ans" in
7436                 v*) val="$define";;
7437                 *) val="$undef";;
7438                 esac;;
7439         "$define")
7440                 echo "As you already told me, signal handler returns void." >&4
7441                 val="$define"
7442                 ;;
7443         *)      echo "As you already told me, signal handler returns int." >&4
7444                 val="$undef"
7445                 ;;
7446         esac
7447 fi
7448 set d_voidsig
7449 eval $setvar
7450 case "$d_voidsig" in
7451 "$define") signal_t="void";;
7452 *) signal_t="int";;
7453 esac
7454 $rm -f $$.tmp
7455
7456 : check for ability to cast large floats to 32-bit ints.
7457 echo " "
7458 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7459 if $test "$intsize" -ge 4; then
7460         xxx=int
7461 else
7462         xxx=long
7463 fi
7464 $cat >try.c <<EOCP
7465 #include <stdio.h>
7466 #include <sys/types.h>
7467 #include <signal.h>
7468 $signal_t blech(s) int s; { exit(3); }
7469 int main()
7470 {
7471         $xxx i32;
7472         double f, g;
7473         int result = 0;
7474         char str[16];
7475         signal(SIGFPE, blech);
7476
7477         /* Don't let compiler optimize the test away.  Store the number 
7478            in a writable string for gcc to pass to sscanf under HP/UX.
7479         */
7480         sprintf(str, "2147483647");
7481         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7482         g = 10 * f;
7483         i32  = ($xxx) g;
7484
7485         /* x86 processors will probably give 0x8000 0000, which is a
7486        sign change.  We don't want that.  We want to mimic SPARC
7487            behavior here, which is to preserve the sign and give
7488            back 0x7fff ffff.
7489         */
7490         if (i32 != ($xxx) f)
7491                 result |= 1;
7492         exit(result);
7493 }
7494 EOCP
7495 set try
7496 if eval $compile_ok; then
7497         ./try
7498         yyy=$?
7499 else
7500         echo "(I can't seem to compile the test program--assuming it can't)"
7501         yyy=1
7502 fi
7503 case "$yyy" in
7504 0)      val="$define"
7505         echo "Yup, it can."
7506         ;;
7507 *)      val="$undef"
7508         echo "Nope, it can't."
7509         ;;
7510 esac
7511 set d_casti32
7512 eval $setvar
7513 $rm -f try try.*
7514
7515 : check for ability to cast negative floats to unsigned
7516 echo " "
7517 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7518 $cat >try.c <<EOCP
7519 #include <stdio.h>
7520 #include <sys/types.h>
7521 #include <signal.h>
7522 $signal_t blech(s) int s; { exit(7); }
7523 $signal_t blech_in_list(s) int s; { exit(4); }
7524 unsigned long dummy_long(p) unsigned long p; { return p; }
7525 unsigned int dummy_int(p) unsigned int p; { return p; }
7526 unsigned short dummy_short(p) unsigned short p; { return p; }
7527 int main()
7528 {
7529         double f;
7530         unsigned long along;
7531         unsigned int aint;
7532         unsigned short ashort;
7533         int result = 0;
7534         char str[16];
7535         
7536         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7537            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7538            optimized the whole file away
7539         */
7540         /* Store the number in a writable string for gcc to pass to 
7541            sscanf under HP/UX.
7542         */
7543         sprintf(str, "-123");
7544         sscanf(str, "%lf", &f);  /* f = -123.; */
7545
7546         signal(SIGFPE, blech);
7547         along = (unsigned long)f;
7548         aint = (unsigned int)f;
7549         ashort = (unsigned short)f;
7550         if (along != (unsigned long)-123)
7551                 result |= 1;
7552         if (aint != (unsigned int)-123)
7553                 result |= 1;
7554         if (ashort != (unsigned short)-123)
7555                 result |= 1;
7556         sprintf(str, "1073741824.");
7557         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7558         f = f + f;
7559         along = 0;
7560         along = (unsigned long)f;
7561         if (along != 0x80000000)
7562                 result |= 2;
7563         f -= 1.;
7564         along = 0;
7565         along = (unsigned long)f;
7566         if (along != 0x7fffffff)
7567                 result |= 1;
7568         f += 2.;
7569         along = 0;
7570         along = (unsigned long)f;
7571         if (along != 0x80000001)
7572                 result |= 2;
7573         if (result)
7574                 exit(result);
7575         signal(SIGFPE, blech_in_list);
7576         sprintf(str, "123.");
7577         sscanf(str, "%lf", &f);  /* f = 123.; */
7578         along = dummy_long((unsigned long)f);
7579         aint = dummy_int((unsigned int)f);
7580         ashort = dummy_short((unsigned short)f);
7581         if (along != (unsigned long)123)
7582                 result |= 4;
7583         if (aint != (unsigned int)123)
7584                 result |= 4;
7585         if (ashort != (unsigned short)123)
7586                 result |= 4;
7587         exit(result);
7588
7589 }
7590 EOCP
7591 set try
7592 if eval $compile_ok; then
7593         ./try
7594         castflags=$?
7595 else
7596         echo "(I can't seem to compile the test program--assuming it can't)"
7597         castflags=7
7598 fi
7599 case "$castflags" in
7600 0)      val="$define"
7601         echo "Yup, it can."
7602         ;;
7603 *)      val="$undef"
7604         echo "Nope, it can't."
7605         ;;
7606 esac
7607 set d_castneg
7608 eval $setvar
7609 $rm -f try.*
7610
7611 : see if vprintf exists
7612 echo " "
7613 if set vprintf val -f d_vprintf; eval $csym; $val; then
7614         echo 'vprintf() found.' >&4
7615         val="$define"
7616         $cat >vprintf.c <<'EOF'
7617 #include <varargs.h>
7618
7619 int main() { xxx("foo"); }
7620
7621 xxx(va_alist)
7622 va_dcl
7623 {
7624         va_list args;
7625         char buf[10];
7626
7627         va_start(args);
7628         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7629 }
7630 EOF
7631         set vprintf
7632         if eval $compile && ./vprintf; then
7633                 echo "Your vsprintf() returns (int)." >&4
7634                 val2="$undef"
7635         else
7636                 echo "Your vsprintf() returns (char*)." >&4
7637                 val2="$define"
7638         fi
7639 else
7640         echo 'vprintf() NOT found.' >&4
7641                 val="$undef"
7642                 val2="$undef"
7643 fi
7644 set d_vprintf
7645 eval $setvar
7646 val=$val2
7647 set d_charvspr
7648 eval $setvar
7649
7650 : see if chown exists
7651 set chown d_chown
7652 eval $inlibc
7653
7654 : see if chroot exists
7655 set chroot d_chroot
7656 eval $inlibc
7657
7658 : see if chsize exists
7659 set chsize d_chsize
7660 eval $inlibc
7661
7662 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7663 while $test $# -ge 2; do
7664         case "$1" in
7665         $define) echo "#include <$2>";;
7666         esac ;
7667     shift 2;
7668 done > try.c;
7669 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7670 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7671         val="$define";
7672 else
7673         val="$undef";
7674 fi;
7675 set $varname;
7676 eval $setvar;
7677 $rm -f try.c try.o'
7678
7679 : see if this is a sys/uio.h system
7680 set sys/uio.h i_sysuio
7681 eval $inhdr
7682
7683 echo "Checking to see if your system supports struct iovec..." >&4
7684 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7685 eval $hasfield
7686 case "$d_iovec_s" in
7687 "$define")      echo "Yup, it does." >&4
7688                 ;;
7689 *)              echo "Nope, it doesn't." >&4
7690                 ;;
7691 esac
7692
7693 socketlib=''
7694 sockethdr=''
7695 : see whether socket exists
7696 echo " "
7697 $echo $n "Hmm... $c" >&4
7698 if set socket val -f d_socket; eval $csym; $val; then
7699         echo "Looks like you have Berkeley networking support." >&4
7700         d_socket="$define"
7701         if set setsockopt val -f; eval $csym; $val; then
7702                 d_oldsock="$undef"
7703         else
7704                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7705                 d_oldsock="$define"
7706         fi
7707 else
7708         if $contains socklib libc.list >/dev/null 2>&1; then
7709                 echo "Looks like you have Berkeley networking support." >&4
7710                 d_socket="$define"
7711                 : we will have to assume that it supports the 4.2 BSD interface
7712                 d_oldsock="$undef"
7713         else
7714                 echo "You don't have Berkeley networking in libc$_a..." >&4
7715                 if test "X$d_socket" = "X$define"; then
7716                    echo "...but you seem to believe that you have sockets." >&4
7717                 else
7718                         for net in net socket
7719                         do
7720                                 if test -f /usr/lib/lib$net$_a; then
7721                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7722                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7723                                         if $contains socket libc.list >/dev/null 2>&1; then
7724                                                 d_socket="$define"
7725                                                 socketlib="-l$net"
7726                                                 case "$net" in
7727                                                 net)
7728                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7729                                                         sockethdr="-I/usr/netinclude"
7730                                                         ;;
7731                                                 esac
7732                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7733                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7734                                                         d_oldsock="$undef"
7735                                                 else
7736                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7737                                                         d_oldsock="$define"
7738                                                 fi
7739                                                 break
7740                                         fi
7741                                 fi
7742                         done
7743                         if test "X$d_socket" != "X$define"; then
7744                            echo "or anywhere else I see." >&4
7745                            d_socket="$undef"
7746                            d_oldsock="$undef"
7747                         fi
7748                 fi
7749         fi
7750 fi
7751
7752 : see if socketpair exists
7753 set socketpair d_sockpair
7754 eval $inlibc
7755
7756
7757 echo " "
7758 echo "Checking the availability of certain socket constants..." >& 4
7759 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7760         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7761         $cat >try.c <<EOF
7762 #include <sys/types.h>
7763 #include <sys/socket.h>
7764 int main() {
7765     int i = $ENUM;
7766 }
7767 EOF
7768         val="$undef"
7769         set try; if eval $compile; then
7770                 val="$define"
7771         fi
7772         set d_${enum}; eval $setvar
7773         $rm -f try.c try
7774 done
7775
7776 set sendmsg d_sendmsg
7777 eval $inlibc
7778
7779 set recvmsg d_recvmsg
7780 eval $inlibc
7781
7782 echo " "
7783 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7784 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7785 eval $hasfield
7786 case "$d_msghdr_s" in
7787 "$define")      echo "Yup, it does." >&4
7788                 ;;
7789 *)              echo "Nope, it doesn't." >&4
7790                 ;;
7791 esac
7792
7793 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7794 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7795 eval $hasfield
7796 case "$d_cmsghdr_s" in
7797 "$define")      echo "Yup, it does." >&4
7798                 ;;
7799 *)              echo "Nope, it doesn't." >&4
7800                 ;;
7801 esac
7802
7803 : check for const keyword
7804 echo " "
7805 echo 'Checking to see if your C compiler knows about "const"...' >&4
7806 $cat >const.c <<'EOCP'
7807 typedef struct spug { int drokk; } spug;
7808 int main()
7809 {
7810         const char *foo;
7811         const spug y;
7812 }
7813 EOCP
7814 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7815         val="$define"
7816         echo "Yup, it does."
7817 else
7818         val="$undef"
7819         echo "Nope, it doesn't."
7820 fi
7821 set d_const
7822 eval $setvar
7823
7824 : see if crypt exists
7825 echo " "
7826 if set crypt val -f d_crypt; eval $csym; $val; then
7827         echo 'crypt() found.' >&4
7828         val="$define"
7829         cryptlib=''
7830 else
7831         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7832         if $test -z "$cryptlib"; then
7833                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7834         else
7835                 cryptlib=-lcrypt
7836         fi
7837         if $test -z "$cryptlib"; then
7838                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7839         else
7840                 cryptlib=-lcrypt
7841         fi
7842         if $test -z "$cryptlib"; then
7843                 cryptlib=`./loc libcrypt$_a "" $libpth`
7844         else
7845                 cryptlib=-lcrypt
7846         fi
7847         if $test -z "$cryptlib"; then
7848                 echo 'crypt() NOT found.' >&4
7849                 val="$undef"
7850         else
7851                 val="$define"
7852         fi
7853 fi
7854 set d_crypt
7855 eval $setvar
7856
7857 : get csh whereabouts
7858 case "$csh" in
7859 'csh') val="$undef" ;;
7860 *) val="$define" ;;
7861 esac
7862 set d_csh
7863 eval $setvar
7864 : Respect a hint or command line value for full_csh.
7865 case "$full_csh" in
7866 '') full_csh=$csh ;;
7867 esac
7868
7869 : see if cuserid exists
7870 set cuserid d_cuserid
7871 eval $inlibc
7872
7873 : see if this is a limits.h system
7874 set limits.h i_limits
7875 eval $inhdr
7876
7877 : see if this is a float.h system
7878 set float.h i_float
7879 eval $inhdr
7880
7881 : See if number of significant digits in a double precision number is known
7882 echo " "
7883 $cat >dbl_dig.c <<EOM
7884 #$i_limits I_LIMITS
7885 #$i_float I_FLOAT
7886 #ifdef I_LIMITS
7887 #include <limits.h>
7888 #endif
7889 #ifdef I_FLOAT
7890 #include <float.h>
7891 #endif
7892 #ifdef DBL_DIG
7893 printf("Contains DBL_DIG");
7894 #endif
7895 EOM
7896 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7897 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7898         echo "DBL_DIG found." >&4
7899         val="$define"
7900 else
7901         echo "DBL_DIG NOT found." >&4
7902         val="$undef"
7903 fi
7904 $rm -f dbl_dig.?
7905 set d_dbl_dig
7906 eval $setvar
7907
7908 : see if difftime exists
7909 set difftime d_difftime
7910 eval $inlibc
7911
7912 : see if this is a dirent system
7913 echo " "
7914 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7915         val="$define"
7916         echo "<dirent.h> found." >&4
7917 else
7918         val="$undef"
7919         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7920                 echo "<sys/dir.h> found." >&4
7921                 echo " "
7922         else
7923                 xinc=`./findhdr sys/ndir.h`
7924         fi
7925         echo "<dirent.h> NOT found." >&4
7926 fi
7927 set i_dirent
7928 eval $setvar
7929
7930 : Look for type of directory structure.
7931 echo " "
7932 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7933
7934 case "$direntrytype" in
7935 ''|' ')
7936         case "$i_dirent" in
7937         $define) guess1='struct dirent' ;;
7938         *) guess1='struct direct'  ;;
7939         esac
7940         ;;
7941 *)      guess1="$direntrytype"
7942         ;;
7943 esac
7944
7945 case "$guess1" in
7946 'struct dirent') guess2='struct direct' ;;
7947 *) guess2='struct dirent' ;;
7948 esac
7949                 
7950 if $contains "$guess1" try.c >/dev/null 2>&1; then
7951         direntrytype="$guess1"
7952         echo "Your directory entries are $direntrytype." >&4
7953 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7954         direntrytype="$guess2"
7955         echo "Your directory entries seem to be $direntrytype." >&4
7956 else
7957         echo "I don't recognize your system's directory entries." >&4
7958         rp="What type is used for directory entries on this system?"
7959         dflt="$guess1"
7960         . ./myread
7961         direntrytype="$ans"
7962 fi
7963 $rm -f try.c
7964
7965
7966 : see if the directory entry stores field length
7967 echo " "
7968 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7969 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7970         echo "Good, your directory entry keeps length information in d_namlen." >&4
7971         val="$define"
7972 else
7973         echo "Your directory entry does not know about the d_namlen field." >&4
7974         val="$undef"
7975 fi
7976 set d_dirnamlen
7977 eval $setvar
7978 $rm -f try.c
7979
7980 : see if dlerror exists
7981 xxx_runnm="$runnm"
7982 runnm=false
7983 set dlerror d_dlerror
7984 eval $inlibc
7985 runnm="$xxx_runnm"
7986
7987 : see if dlfcn is available
7988 set dlfcn.h i_dlfcn
7989 eval $inhdr
7990
7991 case "$usedl" in
7992 $define|y|true)
7993         $cat << EOM
7994
7995 On a few systems, the dynamically loaded modules that perl generates and uses
7996 will need a different extension than shared libs. The default will probably
7997 be appropriate.
7998
7999 EOM
8000         case "$dlext" in
8001         '')     dflt="$so" ;;
8002         *)      dflt="$dlext" ;;
8003         esac
8004         rp='What is the extension of dynamically loaded modules'
8005         . ./myread
8006         dlext="$ans"
8007         ;;
8008 *)
8009         dlext="none"
8010         ;;
8011 esac
8012
8013 : Check if dlsym need a leading underscore
8014 echo " "
8015 val="$undef"
8016
8017 case "$dlsrc" in
8018 dl_dlopen.xs)
8019         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8020         $cat >dyna.c <<'EOM'
8021 fred () { }
8022 EOM
8023
8024 $cat >fred.c<<EOM
8025
8026 #include <stdio.h>
8027 #$i_dlfcn I_DLFCN
8028 #ifdef I_DLFCN
8029 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8030 #else
8031 #include <sys/types.h>
8032 #include <nlist.h>
8033 #include <link.h>
8034 #endif
8035
8036 extern int fred() ;
8037
8038 int main()
8039 {
8040     void * handle ;
8041     void * symbol ;
8042 #ifndef RTLD_LAZY
8043     int mode = 1 ;
8044 #else
8045     int mode = RTLD_LAZY ;
8046 #endif
8047     handle = dlopen("./dyna.$dlext", mode) ;
8048     if (handle == NULL) {
8049         printf ("1\n") ;
8050         fflush (stdout) ;
8051         exit(0);
8052     }
8053     symbol = dlsym(handle, "fred") ;
8054     if (symbol == NULL) {
8055         /* try putting a leading underscore */
8056         symbol = dlsym(handle, "_fred") ;
8057         if (symbol == NULL) {
8058             printf ("2\n") ;
8059             fflush (stdout) ;
8060             exit(0);
8061         }
8062         printf ("3\n") ;
8063     }
8064     else
8065         printf ("4\n") ;
8066     fflush (stdout) ;
8067     exit(0);
8068 }
8069 EOM
8070         : Call the object file tmp-dyna.o in case dlext=o.
8071         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8072                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8073                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8074                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8075                 xxx=`./fred`
8076                 case $xxx in
8077                 1)      echo "Test program failed using dlopen." >&4
8078                         echo "Perhaps you should not use dynamic loading." >&4;;
8079                 2)      echo "Test program failed using dlsym." >&4
8080                         echo "Perhaps you should not use dynamic loading." >&4;;
8081                 3)      echo "dlsym needs a leading underscore" >&4
8082                         val="$define" ;;
8083                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8084                 esac
8085         else
8086                 echo "I can't compile and run the test program." >&4
8087                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8088         fi
8089         ;;
8090 esac
8091                 
8092 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8093
8094 set d_dlsymun
8095 eval $setvar
8096
8097 hasproto='varname=$1; func=$2; shift; shift;
8098 while $test $# -ge 2; do
8099         case "$1" in
8100         $define) echo "#include <$2>";;
8101         esac ;
8102     shift 2;
8103 done > try.c;
8104 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8105 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8106         echo "$func() prototype found.";
8107         val="$define";
8108 else
8109         echo "$func() prototype NOT found.";
8110         val="$undef";
8111 fi;
8112 set $varname;
8113 eval $setvar;
8114 $rm -f try.c tryout.c'
8115
8116 : see if prototype for drand48 is available
8117 echo " "
8118 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8119 eval $hasproto
8120
8121 : see if dup2 exists
8122 set dup2 d_dup2
8123 eval $inlibc
8124
8125 : see if eaccess exists
8126 set eaccess d_eaccess
8127 eval $inlibc
8128
8129 : see if endgrent exists
8130 set endgrent d_endgrent
8131 eval $inlibc
8132
8133 : see if endhostent exists
8134 set endhostent d_endhent
8135 eval $inlibc
8136
8137 : see if endnetent exists
8138 set endnetent d_endnent
8139 eval $inlibc
8140
8141 : see if endprotoent exists
8142 set endprotoent d_endpent
8143 eval $inlibc
8144
8145 : see if endpwent exists
8146 set endpwent d_endpwent
8147 eval $inlibc
8148
8149 : see if endservent exists
8150 set endservent d_endsent
8151 eval $inlibc
8152
8153 : see if endspent exists
8154 set endspent d_endspent
8155 eval $inlibc
8156
8157 : Locate the flags for 'open()'
8158 echo " "
8159 $cat >open3.c <<'EOCP'
8160 #include <sys/types.h>
8161 #ifdef I_FCNTL
8162 #include <fcntl.h>
8163 #endif
8164 #ifdef I_SYS_FILE
8165 #include <sys/file.h>
8166 #endif
8167 int main() {
8168         if(O_RDONLY);
8169 #ifdef O_TRUNC
8170         exit(0);
8171 #else
8172         exit(1);
8173 #endif
8174 }
8175 EOCP
8176 : check sys/file.h first to get FREAD on Sun
8177 if $test `./findhdr sys/file.h` && \
8178                 set open3 -DI_SYS_FILE && eval $compile; then
8179         h_sysfile=true;
8180         echo "<sys/file.h> defines the O_* constants..." >&4
8181         if ./open3; then
8182                 echo "and you have the 3 argument form of open()." >&4
8183                 val="$define"
8184         else
8185                 echo "but not the 3 argument form of open().  Oh, well." >&4
8186                 val="$undef"
8187         fi
8188 elif $test `./findhdr fcntl.h` && \
8189                 set open3 -DI_FCNTL && eval $compile; then
8190         h_fcntl=true;
8191         echo "<fcntl.h> defines the O_* constants..." >&4
8192         if ./open3; then
8193                 echo "and you have the 3 argument form of open()." >&4
8194                 val="$define"
8195         else
8196                 echo "but not the 3 argument form of open().  Oh, well." >&4
8197                 val="$undef"
8198         fi
8199 else
8200         val="$undef"
8201         echo "I can't find the O_* constant definitions!  You got problems." >&4
8202 fi
8203 set d_open3
8204 eval $setvar
8205 $rm -f open3*
8206
8207 : check for non-blocking I/O stuff
8208 case "$h_sysfile" in
8209 true) echo "#include <sys/file.h>" > head.c;;
8210 *)
8211         case "$h_fcntl" in
8212         true) echo "#include <fcntl.h>" > head.c;;
8213         *) echo "#include <sys/fcntl.h>" > head.c;;
8214         esac
8215         ;;
8216 esac
8217 echo " "
8218 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8219 case "$o_nonblock" in
8220 '')
8221         $cat head.c > try.c
8222         $cat >>try.c <<'EOCP'
8223 int main() {
8224 #ifdef O_NONBLOCK
8225         printf("O_NONBLOCK\n");
8226         exit(0);
8227 #endif
8228 #ifdef O_NDELAY
8229         printf("O_NDELAY\n");
8230         exit(0);
8231 #endif
8232 #ifdef FNDELAY
8233         printf("FNDELAY\n");
8234         exit(0);
8235 #endif
8236         exit(0);
8237 }
8238 EOCP
8239         set try
8240         if eval $compile_ok; then
8241                 o_nonblock=`./try`
8242                 case "$o_nonblock" in
8243                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8244                 *) echo "Seems like we can use $o_nonblock.";;
8245                 esac
8246         else
8247                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8248         fi
8249         ;;
8250 *) echo "Using $hint value $o_nonblock.";;
8251 esac
8252 $rm -f try try.* .out core
8253
8254 echo " "
8255 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8256 case "$eagain" in
8257 '')
8258         $cat head.c > try.c
8259         $cat >>try.c <<EOCP
8260 #include <errno.h>
8261 #include <sys/types.h>
8262 #include <signal.h>
8263 #define MY_O_NONBLOCK $o_nonblock
8264 #ifndef errno  /* XXX need better Configure test */
8265 extern int errno;
8266 #endif
8267 $signal_t blech(x) int x; { exit(3); }
8268 EOCP
8269         $cat >> try.c <<'EOCP'
8270 int main()
8271 {
8272         int pd[2];
8273         int pu[2];
8274         char buf[1];
8275         char string[100];
8276
8277         pipe(pd);       /* Down: child -> parent */
8278         pipe(pu);       /* Up: parent -> child */
8279         if (0 != fork()) {
8280                 int ret;
8281                 close(pd[1]);   /* Parent reads from pd[0] */
8282                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8283                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8284                         exit(1);
8285                 signal(SIGALRM, blech);
8286                 alarm(5);
8287                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8288                         exit(2);
8289                 sprintf(string, "%d\n", ret);
8290                 write(2, string, strlen(string));
8291                 alarm(0);
8292 #ifdef EAGAIN
8293                 if (errno == EAGAIN) {
8294                         printf("EAGAIN\n");
8295                         goto ok;
8296                 }
8297 #endif
8298 #ifdef EWOULDBLOCK
8299                 if (errno == EWOULDBLOCK)
8300                         printf("EWOULDBLOCK\n");
8301 #endif
8302         ok:
8303                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8304                 sleep(2);                               /* Give it time to close our pipe */
8305                 alarm(5);
8306                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8307                 alarm(0);
8308                 sprintf(string, "%d\n", ret);
8309                 write(3, string, strlen(string));
8310                 exit(0);
8311         }
8312
8313         close(pd[0]);                   /* We write to pd[1] */
8314         close(pu[1]);                   /* We read from pu[0] */
8315         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8316         close(pd[1]);                   /* Pipe pd is now fully closed! */
8317         exit(0);                                /* Bye bye, thank you for playing! */
8318 }
8319 EOCP
8320         set try
8321         if eval $compile_ok; then
8322                 echo "$startsh" >mtry
8323                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8324                 chmod +x mtry
8325                 ./mtry >/dev/null 2>&1
8326                 case $? in
8327                 0) eagain=`$cat try.out`;;
8328                 1) echo "Could not perform non-blocking setting!";;
8329                 2) echo "I did a successful read() for something that was not there!";;
8330                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8331                 *) echo "Something terribly wrong happened during testing.";;
8332                 esac
8333                 rd_nodata=`$cat try.ret`
8334                 echo "A read() system call with no data present returns $rd_nodata."
8335                 case "$rd_nodata" in
8336                 0|-1) ;;
8337                 *)
8338                         echo "(That's peculiar, fixing that to be -1.)"
8339                         rd_nodata=-1
8340                         ;;
8341                 esac
8342                 case "$eagain" in
8343                 '')
8344                         echo "Forcing errno EAGAIN on read() with no data available."
8345                         eagain=EAGAIN
8346                         ;;
8347                 *)
8348                         echo "Your read() sets errno to $eagain when no data is available."
8349                         ;;
8350                 esac
8351                 status=`$cat try.err`
8352                 case "$status" in
8353                 0) echo "And it correctly returns 0 to signal EOF.";;
8354                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8355                 *) echo "However, your read() returns '$status' on EOF??";;
8356                 esac
8357                 val="$define"
8358                 if test "$status" = "$rd_nodata"; then
8359                         echo "WARNING: you can't distinguish between EOF and no data!"
8360                         val="$undef"
8361                 fi
8362         else
8363                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8364                 eagain=EAGAIN
8365         fi
8366         set d_eofnblk
8367         eval $setvar
8368         ;;
8369 *)
8370         echo "Using $hint value $eagain."
8371         echo "Your read() returns $rd_nodata when no data is present."
8372         case "$d_eofnblk" in
8373         "$define") echo "And you can see EOF because read() returns 0.";;
8374         "$undef") echo "But you can't see EOF status from read() returned value.";;
8375         *)
8376                 echo "(Assuming you can't see EOF status from read anyway.)"
8377                 d_eofnblk=$undef
8378                 ;;
8379         esac
8380         ;;
8381 esac
8382 $rm -f try try.* .out core head.c mtry
8383
8384 : see if fchmod exists
8385 set fchmod d_fchmod
8386 eval $inlibc
8387
8388 : see if fchown exists
8389 set fchown d_fchown
8390 eval $inlibc
8391
8392 : see if this is an fcntl system
8393 set fcntl d_fcntl
8394 eval $inlibc
8395
8396 : see if sys/select.h has to be included
8397 set sys/select.h i_sysselct
8398 eval $inhdr
8399
8400 : see if we should include time.h, sys/time.h, or both
8401 echo " "
8402 if test "X$timeincl" = X; then
8403         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8404         $echo $n "I'm now running the test program...$c"
8405         $cat >try.c <<'EOCP'
8406 #include <sys/types.h>
8407 #ifdef I_TIME
8408 #include <time.h>
8409 #endif
8410 #ifdef I_SYSTIME
8411 #ifdef SYSTIMEKERNEL
8412 #define KERNEL
8413 #endif
8414 #include <sys/time.h>
8415 #endif
8416 #ifdef I_SYSSELECT
8417 #include <sys/select.h>
8418 #endif
8419 int main()
8420 {
8421         struct tm foo;
8422 #ifdef S_TIMEVAL
8423         struct timeval bar;
8424 #endif
8425 #ifdef S_TIMEZONE
8426         struct timezone tzp;
8427 #endif
8428         if (foo.tm_sec == foo.tm_sec)
8429                 exit(0);
8430 #ifdef S_TIMEVAL
8431         if (bar.tv_sec == bar.tv_sec)
8432                 exit(0);
8433 #endif
8434         exit(1);
8435 }
8436 EOCP
8437         flags=''
8438         for s_timezone in '-DS_TIMEZONE' ''; do
8439         sysselect=''
8440         for s_timeval in '-DS_TIMEVAL' ''; do
8441         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8442         for i_time in '' '-DI_TIME'; do
8443         for i_systime in '-DI_SYSTIME' ''; do
8444                 case "$flags" in
8445                 '') $echo $n ".$c"
8446                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8447                         if eval $compile; then
8448                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8449                                 shift
8450                                 flags="$*"
8451                                 echo " "
8452                                 $echo $n "Succeeded with $flags$c"
8453                         fi
8454                         ;;
8455                 esac
8456         done
8457         done
8458         done
8459         done
8460         done
8461         timeincl=''
8462         echo " "
8463         case "$flags" in
8464         *SYSTIMEKERNEL*) i_systimek="$define"
8465                 timeincl=`./findhdr sys/time.h`
8466                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8467         *) i_systimek="$undef";;
8468         esac
8469         case "$flags" in
8470         *I_TIME*) i_time="$define"
8471                 timeincl=`./findhdr time.h`" $timeincl"
8472                 echo "We'll include <time.h>." >&4;;
8473         *) i_time="$undef";;
8474         esac
8475         case "$flags" in
8476         *I_SYSTIME*) i_systime="$define"
8477                 timeincl=`./findhdr sys/time.h`" $timeincl"
8478                 echo "We'll include <sys/time.h>." >&4;;
8479         *) i_systime="$undef";;
8480         esac
8481         $rm -f try.c try
8482 fi
8483
8484 : check for fd_set items
8485 $cat <<EOM
8486
8487 Checking to see how well your C compiler handles fd_set and friends ...
8488 EOM
8489 $cat >fd_set.c <<EOCP
8490 #$i_systime I_SYS_TIME
8491 #$i_sysselct I_SYS_SELECT
8492 #$d_socket HAS_SOCKET
8493 #include <sys/types.h>
8494 #ifdef HAS_SOCKET
8495 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8496 #endif
8497 #ifdef I_SYS_TIME
8498 #include <sys/time.h>
8499 #endif
8500 #ifdef I_SYS_SELECT
8501 #include <sys/select.h>
8502 #endif
8503 int main() {
8504         fd_set fds;
8505
8506 #ifdef TRYBITS
8507         if(fds.fds_bits);
8508 #endif
8509
8510 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8511         exit(0);
8512 #else
8513         exit(1);
8514 #endif
8515 }
8516 EOCP
8517 set fd_set -DTRYBITS
8518 if eval $compile; then
8519         d_fds_bits="$define"
8520         d_fd_set="$define"
8521         echo "Well, your system knows about the normal fd_set typedef..." >&4
8522         if ./fd_set; then
8523                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8524                 d_fd_macros="$define"
8525         else
8526                 $cat >&4 <<'EOM'
8527 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8528 EOM
8529                 d_fd_macros="$undef"
8530         fi
8531 else
8532         $cat <<'EOM'
8533 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8534 EOM
8535         set fd_set
8536         if eval $compile; then
8537                 d_fds_bits="$undef"
8538                 d_fd_set="$define"
8539                 echo "Well, your system has some sort of fd_set available..." >&4
8540                 if ./fd_set; then
8541                         echo "and you have the normal fd_set macros." >&4
8542                         d_fd_macros="$define"
8543                 else
8544                         $cat <<'EOM'
8545 but not the normal fd_set macros!  Gross!  More work for me...
8546 EOM
8547                         d_fd_macros="$undef"
8548                 fi
8549         else
8550         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8551                 d_fd_set="$undef"
8552                 d_fds_bits="$undef"
8553                 d_fd_macros="$undef"
8554         fi
8555 fi
8556 $rm -f fd_set*
8557
8558 : see if fgetpos exists
8559 set fgetpos d_fgetpos
8560 eval $inlibc
8561
8562 : see if flock exists
8563 set flock d_flock
8564 eval $inlibc
8565
8566 : see if fork exists
8567 set fork d_fork
8568 eval $inlibc
8569
8570 : see if pathconf exists
8571 set pathconf d_pathconf
8572 eval $inlibc
8573
8574 : see if fpathconf exists
8575 set fpathconf d_fpathconf
8576 eval $inlibc
8577
8578
8579 : see if llseek exists
8580 set llseek d_llseek
8581 eval $inlibc
8582
8583 : check for off64_t
8584 echo " "
8585 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8586 $cat >try.c <<EOCP
8587 #include <sys/types.h>
8588 #include <unistd.h>
8589 off64_t foo() { off64_t x; x = 7; return x; }'
8590 EOCP
8591 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8592         val="$define"
8593         echo " Yup, it does." >&4
8594 else
8595         val="$undef"
8596         echo " Nope, it doesn't." >&4
8597 fi
8598 $rm -f try.*
8599 set d_off64_t
8600 eval $setvar
8601
8602 : check for fpos64_t
8603 echo " "
8604 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8605 $cat >try.c <<EOCP
8606 #include <sys/stdio.h>
8607 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8608 EOCP
8609 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8610         val="$define"
8611         echo " Yup, it does." >&4
8612 else
8613         val="$undef"
8614         echo " Nope, it doesn't." >&4
8615 fi
8616 $rm -f try.*
8617 set d_fpos64_t
8618 eval $setvar
8619
8620 : see if fseeko exists
8621 set fseeko d_fseeko
8622 eval $inlibc
8623
8624 : see if fsetpos exists
8625 set fsetpos d_fsetpos
8626 eval $inlibc
8627
8628 : see if this is a sys/param system
8629 set sys/param.h i_sysparam
8630 eval $inhdr
8631
8632 : see if this is a sys/mount.h system
8633 set sys/mount.h i_sysmount
8634 eval $inhdr
8635
8636
8637 : see if statfs exists
8638 set statfs d_statfs
8639 eval $inlibc
8640
8641 : see if fstatfs exists
8642 set fstatfs d_fstatfs
8643 eval $inlibc
8644
8645 : see if statfs knows about mount flags
8646 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8647 eval $hasfield
8648
8649
8650 : see if statvfs exists
8651 set statvfs d_statvfs
8652 eval $inlibc
8653
8654 : see if fstatvfs exists
8655 set fstatvfs d_fstatvfs
8656 eval $inlibc
8657
8658
8659 : see if ftello exists
8660 set ftello d_ftello
8661 eval $inlibc
8662
8663 : see if getgrent exists
8664 set getgrent d_getgrent
8665 eval $inlibc
8666
8667 : see if gethostbyaddr exists
8668 set gethostbyaddr d_gethbyaddr
8669 eval $inlibc
8670
8671 : see if gethostbyname exists
8672 set gethostbyname d_gethbyname
8673 eval $inlibc
8674
8675 : see if gethostent exists
8676 set gethostent d_gethent
8677 eval $inlibc
8678
8679 : see how we will look up host name
8680 echo " "
8681 call=''
8682 if set gethostname val -f d_gethname; eval $csym; $val; then
8683         echo 'gethostname() found.' >&4
8684         d_gethname="$define"
8685         call=gethostname
8686 fi
8687 if set uname val -f d_uname; eval $csym; $val; then
8688         if ./xenix; then
8689                 $cat <<'EOM'
8690 uname() was found, but you're running xenix, and older versions of xenix
8691 have a broken uname(). If you don't really know whether your xenix is old
8692 enough to have a broken system call, use the default answer.
8693
8694 EOM
8695                 dflt=y
8696                 case "$d_uname" in
8697                 "$define") dflt=n;;
8698                 esac
8699                 rp='Is your uname() broken?'
8700                 . ./myread
8701                 case "$ans" in
8702                 n*) d_uname="$define"; call=uname;;
8703                 esac
8704         else
8705                 echo 'uname() found.' >&4
8706                 d_uname="$define"
8707                 case "$call" in
8708                 '') call=uname ;;
8709                 esac
8710         fi
8711 fi
8712 case "$d_gethname" in
8713 '') d_gethname="$undef";;
8714 esac
8715 case "$d_uname" in
8716 '') d_uname="$undef";;
8717 esac
8718 case "$d_uname$d_gethname" in
8719 *define*)
8720         dflt=n
8721         cat <<EOM
8722  
8723 Every now and then someone has a $call() that lies about the hostname
8724 but can't be fixed for political or economic reasons.  If you wish, I can
8725 pretend $call() isn't there and maybe compute hostname at run-time
8726 thanks to the '$phostname' command.
8727
8728 EOM
8729         rp="Shall I ignore $call() from now on?"
8730         . ./myread
8731         case "$ans" in
8732         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8733         esac;;
8734 esac
8735 case "$phostname" in
8736 '') aphostname='';;
8737 *) case "$aphostname" in
8738         /*) ;;
8739         *) set X $phostname
8740                 shift
8741                 file=$1
8742                 shift
8743                 file=`./loc $file $file $pth`
8744                 aphostname=`echo $file $*`
8745                 ;;
8746         esac
8747         ;;
8748 esac
8749 case "$d_uname$d_gethname" in
8750 *define*) ;;
8751 *)
8752         case "$phostname" in
8753         '')
8754                 echo "There will be no way for $package to get your hostname." >&4;;
8755         *)
8756         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8757                 ;;
8758         esac;;
8759 esac
8760 case "$d_phostname" in
8761 '') d_phostname="$undef";;
8762 esac
8763
8764 : see if this is a netdb.h system
8765 set netdb.h i_netdb
8766 eval $inhdr
8767
8768 : see if prototypes for various gethostxxx netdb.h functions are available
8769 echo " "
8770 set d_gethostprotos gethostent $i_netdb netdb.h
8771 eval $hasproto
8772
8773 : see if getlogin exists
8774 set getlogin d_getlogin
8775 eval $inlibc
8776
8777 : see if getmntent exists
8778 set getmntent d_getmntent
8779 eval $inlibc
8780
8781 : see if getnetbyaddr exists
8782 set getnetbyaddr d_getnbyaddr
8783 eval $inlibc
8784
8785 : see if getnetbyname exists
8786 set getnetbyname d_getnbyname
8787 eval $inlibc
8788
8789 : see if getnetent exists
8790 set getnetent d_getnent
8791 eval $inlibc
8792
8793 : see if prototypes for various getnetxxx netdb.h functions are available
8794 echo " "
8795 set d_getnetprotos getnetent $i_netdb netdb.h
8796 eval $hasproto
8797
8798
8799 : see if getprotobyname exists
8800 set getprotobyname d_getpbyname
8801 eval $inlibc
8802
8803 : see if getprotobynumber exists
8804 set getprotobynumber d_getpbynumber
8805 eval $inlibc
8806
8807 : see if getprotoent exists
8808 set getprotoent d_getpent
8809 eval $inlibc
8810
8811 : see if getpgid exists
8812 set getpgid d_getpgid
8813 eval $inlibc
8814
8815 : see if getpgrp2 exists
8816 set getpgrp2 d_getpgrp2
8817 eval $inlibc
8818
8819 : see if getppid exists
8820 set getppid d_getppid
8821 eval $inlibc
8822
8823 : see if getpriority exists
8824 set getpriority d_getprior
8825 eval $inlibc
8826
8827 : see if prototypes for various getprotoxxx netdb.h functions are available
8828 echo " "
8829 set d_getprotoprotos getprotoent $i_netdb netdb.h
8830 eval $hasproto
8831
8832 : see if getpwent exists
8833 set getpwent d_getpwent
8834 eval $inlibc
8835
8836
8837 : see if getservbyname exists
8838 set getservbyname d_getsbyname
8839 eval $inlibc
8840
8841 : see if getservbyport exists
8842 set getservbyport d_getsbyport
8843 eval $inlibc
8844
8845 : see if getservent exists
8846 set getservent d_getsent
8847 eval $inlibc
8848
8849 : see if prototypes for various getservxxx netdb.h functions are available
8850 echo " "
8851 set d_getservprotos getservent $i_netdb netdb.h
8852 eval $hasproto
8853
8854 : see if getspent exists
8855 set getspent d_getspent
8856 eval $inlibc
8857
8858 : see if getspnam exists
8859 set getspnam d_getspnam
8860 eval $inlibc
8861
8862 : see if gettimeofday or ftime exists
8863 set gettimeofday d_gettimeod
8864 eval $inlibc
8865 case "$d_gettimeod" in
8866 "$undef")
8867         set ftime d_ftime 
8868         eval $inlibc
8869         ;;
8870 *)
8871         val="$undef"; set d_ftime; eval $setvar
8872         ;;
8873 esac
8874 case "$d_gettimeod$d_ftime" in
8875 "$undef$undef")
8876         echo " "
8877         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8878         ;;
8879 esac
8880
8881 : see if this is an grp system
8882 set grp.h i_grp
8883 eval $inhdr
8884
8885 case "$i_grp" in
8886 $define)
8887         xxx=`./findhdr grp.h`
8888         $cppstdin $cppflags $cppminus < $xxx >$$.h
8889
8890         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8891                 val="$define"
8892         else
8893                 val="$undef"
8894         fi
8895         set d_grpasswd
8896         eval $setvar
8897
8898         $rm -f $$.h
8899         ;;
8900 *)
8901         val="$undef";
8902         set d_grpasswd; eval $setvar
8903         ;;
8904 esac
8905
8906 : see if hasmntopt exists
8907 set hasmntopt d_hasmntopt
8908 eval $inlibc
8909
8910 : see if this is a netinet/in.h or sys/in.h system
8911 set netinet/in.h i_niin sys/in.h i_sysin
8912 eval $inhdr
8913
8914 : see if arpa/inet.h has to be included
8915 set arpa/inet.h i_arpainet
8916 eval $inhdr
8917
8918 : see if htonl --and friends-- exists
8919 val=''
8920 set htonl val
8921 eval $inlibc
8922
8923 : Maybe they are macros.
8924 case "$val" in
8925 $undef)
8926         $cat >htonl.c <<EOM
8927 #include <stdio.h>
8928 #include <sys/types.h>
8929 #$i_niin I_NETINET_IN
8930 #$i_sysin I_SYS_IN
8931 #$i_arpainet I_ARPA_INET
8932 #ifdef I_NETINET_IN
8933 #include <netinet/in.h>
8934 #endif
8935 #ifdef I_SYS_IN
8936 #include <sys/in.h>
8937 #endif
8938 #ifdef I_ARPA_INET
8939 #include <arpa/inet.h>
8940 #endif
8941 #ifdef htonl
8942 printf("Defined as a macro.");
8943 #endif
8944 EOM
8945         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8946         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8947                 val="$define"
8948                 echo "But it seems to be defined as a macro." >&4
8949         fi
8950         $rm -f htonl.?
8951         ;;
8952 esac
8953 set d_htonl
8954 eval $setvar
8955
8956 : see which of string.h or strings.h is needed
8957 echo " "
8958 strings=`./findhdr string.h`
8959 if $test "$strings" && $test -r "$strings"; then
8960         echo "Using <string.h> instead of <strings.h>." >&4
8961         val="$define"
8962 else
8963         val="$undef"
8964         strings=`./findhdr strings.h`
8965         if $test "$strings" && $test -r "$strings"; then
8966                 echo "Using <strings.h> instead of <string.h>." >&4
8967         else
8968                 echo "No string header found -- You'll surely have problems." >&4
8969         fi
8970 fi
8971 set i_string
8972 eval $setvar
8973 case "$i_string" in
8974 "$undef") strings=`./findhdr strings.h`;;
8975 *)        strings=`./findhdr string.h`;;
8976 esac
8977
8978 : index or strchr
8979 echo " "
8980 if set index val -f; eval $csym; $val; then
8981         if set strchr val -f d_strchr; eval $csym; $val; then
8982                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8983                         val="$define"
8984                         vali="$undef"
8985                         echo "strchr() found." >&4
8986                 else
8987                         val="$undef"
8988                         vali="$define"
8989                         echo "index() found." >&4
8990                 fi
8991         else
8992                 val="$undef"
8993                 vali="$define"
8994                 echo "index() found." >&4
8995         fi
8996 else
8997         if set strchr val -f d_strchr; eval $csym; $val; then
8998                 val="$define"
8999                 vali="$undef"
9000                 echo "strchr() found." >&4
9001         else
9002                 echo "No index() or strchr() found!" >&4
9003                 val="$undef"
9004                 vali="$undef"
9005         fi
9006 fi
9007 set d_strchr; eval $setvar
9008 val="$vali"
9009 set d_index; eval $setvar
9010
9011 : check whether inet_aton exists
9012 set inet_aton d_inetaton
9013 eval $inlibc
9014
9015 : Look for isascii
9016 echo " "
9017 $cat >isascii.c <<'EOCP'
9018 #include <stdio.h>
9019 #include <ctype.h>
9020 int main() {
9021         int c = 'A';
9022         if (isascii(c))
9023                 exit(0);
9024         else
9025                 exit(1);
9026 }
9027 EOCP
9028 set isascii
9029 if eval $compile; then
9030         echo "isascii() found." >&4
9031         val="$define"
9032 else
9033         echo "isascii() NOT found." >&4
9034         val="$undef"
9035 fi
9036 set d_isascii
9037 eval $setvar
9038 $rm -f isascii*
9039
9040 : see if killpg exists
9041 set killpg d_killpg
9042 eval $inlibc
9043
9044 : see if lchown exists
9045 echo " "
9046 $cat > try.c <<'EOCP'
9047 /* System header to define __stub macros and hopefully few prototypes,
9048     which can conflict with char lchown(); below.  */
9049 #include <assert.h>
9050 /* Override any gcc2 internal prototype to avoid an error.  */
9051 /* We use char because int might match the return type of a gcc2
9052    builtin and then its argument prototype would still apply.  */
9053 char lchown();
9054 int main() {
9055     /*  The GNU C library defines this for functions which it implements
9056         to always fail with ENOSYS.  Some functions are actually named
9057         something starting with __ and the normal name is an alias.  */
9058 #if defined (__stub_lchown) || defined (__stub___lchown)
9059 choke me
9060 #else
9061 lchown();
9062 #endif
9063 ; return 0; }
9064 EOCP
9065 set try
9066 if eval $compile; then
9067     $echo "lchown() found." >&4
9068     val="$define"
9069 else
9070     $echo "lchown() NOT found." >&4
9071     val="$undef"
9072 fi
9073 set d_lchown
9074 eval $setvar
9075
9076 : See if number of significant digits in a double precision number is known
9077 echo " "
9078 $cat >ldbl_dig.c <<EOM
9079 #$i_limits I_LIMITS
9080 #$i_float I_FLOAT
9081 #ifdef I_LIMITS
9082 #include <limits.h>
9083 #endif
9084 #ifdef I_FLOAT
9085 #include <float.h>
9086 #endif
9087 #ifdef LDBL_DIG
9088 printf("Contains LDBL_DIG");
9089 #endif
9090 EOM
9091 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9092 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9093         echo "LDBL_DIG found." >&4
9094         val="$define"
9095 else
9096         echo "LDBL_DIG NOT found." >&4
9097         val="$undef"
9098 fi
9099 $rm -f ldbl_dig.?
9100 set d_ldbl_dig
9101 eval $setvar
9102
9103 : see if link exists
9104 set link d_link
9105 eval $inlibc
9106
9107 : see if localeconv exists
9108 set localeconv d_locconv
9109 eval $inlibc
9110
9111 : see if lockf exists
9112 set lockf d_lockf
9113 eval $inlibc
9114
9115 : see if lstat exists
9116 set lstat d_lstat
9117 eval $inlibc
9118
9119 : see if madvise exists
9120 set madvise d_madvise
9121 eval $inlibc
9122
9123 : see if mblen exists
9124 set mblen d_mblen
9125 eval $inlibc
9126
9127 : see if mbstowcs exists
9128 set mbstowcs d_mbstowcs
9129 eval $inlibc
9130
9131 : see if mbtowc exists
9132 set mbtowc d_mbtowc
9133 eval $inlibc
9134
9135 : see if memchr exists
9136 set memchr d_memchr
9137 eval $inlibc
9138
9139 : see if memcmp exists
9140 set memcmp d_memcmp
9141 eval $inlibc
9142
9143 : see if memcpy exists
9144 set memcpy d_memcpy
9145 eval $inlibc
9146
9147 : see if memmove exists
9148 set memmove d_memmove
9149 eval $inlibc
9150
9151 : see if memset exists
9152 set memset d_memset
9153 eval $inlibc
9154
9155 : see if mkdir exists
9156 set mkdir d_mkdir
9157 eval $inlibc
9158
9159 : see if mkfifo exists
9160 set mkfifo d_mkfifo
9161 eval $inlibc
9162
9163 : see if mktime exists
9164 set mktime d_mktime
9165 eval $inlibc
9166
9167 : see if this is a sys/mman.h system
9168 set sys/mman.h i_sysmman
9169 eval $inhdr
9170
9171 : see if mmap exists
9172 set mmap d_mmap
9173 eval $inlibc
9174 : see what shmat returns
9175 : default to something harmless
9176 mmaptype='void *'
9177 case "$i_sysmman$d_mmap" in
9178 "$define$define")
9179         $cat >mmap.c <<'END'
9180 #include <sys/mman.h>
9181 void *mmap();
9182 END
9183         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9184                 mmaptype='void *'
9185         else
9186                 mmaptype='caddr_t'
9187         fi
9188         echo "and it returns ($mmaptype)." >&4
9189         ;;
9190 esac
9191
9192
9193
9194 : see if mprotect exists
9195 set mprotect d_mprotect
9196 eval $inlibc
9197
9198 : see if msgctl exists
9199 set msgctl d_msgctl
9200 eval $inlibc
9201
9202 : see if msgget exists
9203 set msgget d_msgget
9204 eval $inlibc
9205
9206 : see if msgsnd exists
9207 set msgsnd d_msgsnd
9208 eval $inlibc
9209
9210 : see if msgrcv exists
9211 set msgrcv d_msgrcv
9212 eval $inlibc
9213
9214 : see how much of the 'msg*(2)' library is present.
9215 h_msg=true
9216 echo " "
9217 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9218 *"$undef"*) h_msg=false;;
9219 esac
9220 case "$osname" in
9221 freebsd)
9222     case "`ipcs 2>&1`" in
9223     "SVID messages"*"not configured"*)
9224         echo "Your $osname does not have the msg*(2) configured." >&4
9225         h_msg=false
9226         val="$undef"
9227         set msgctl d_msgctl
9228         eval $setvar
9229         set msgget d_msgget
9230         eval $setvar
9231         set msgsnd d_msgsnd
9232         eval $setvar
9233         set msgrcv d_msgrcv
9234         eval $setvar
9235         ;;
9236     esac
9237     ;;
9238 esac
9239 : we could also check for sys/ipc.h ...
9240 if $h_msg && $test `./findhdr sys/msg.h`; then
9241         echo "You have the full msg*(2) library." >&4
9242         val="$define"
9243 else
9244         echo "You don't have the full msg*(2) library." >&4
9245         val="$undef"
9246 fi
9247 set d_msg
9248 eval $setvar
9249
9250 : see if msync exists
9251 set msync d_msync
9252 eval $inlibc
9253
9254 : see if munmap exists
9255 set munmap d_munmap
9256 eval $inlibc
9257
9258 : see if nice exists
9259 set nice d_nice
9260 eval $inlibc
9261
9262 : see if POSIX threads are available
9263 set pthread.h i_pthread
9264 eval $inhdr
9265
9266
9267
9268
9269 : how to create joinable pthreads
9270 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9271         echo " "
9272         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9273         $cat >try.c <<'EOCP'
9274 #include <pthread.h>
9275 int main() {
9276     int detachstate = JOINABLE;
9277 }
9278 EOCP
9279         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9280         if eval $compile; then
9281                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9282                 val="$undef" # Yes, undef.
9283                 set d_old_pthread_create_joinable
9284                 eval $setvar
9285                 val=""
9286                 set old_pthread_create_joinable
9287                 eval $setvar
9288         else
9289                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9290                 if eval $compile; then
9291                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9292                         val="$define"
9293                         set d_old_pthread_create_joinable
9294                         eval $setvar
9295                         val=PTHREAD_CREATE_UNDETACHED
9296                         set old_pthread_create_joinable
9297                         eval $setvar
9298                 else            
9299                         set try -DJOINABLE=__UNDETACHED
9300                         if eval $compile; then
9301                                 echo "You seem to use __UNDETACHED." >&4
9302                                 val="$define"
9303                                 set d_old_pthread_create_joinable
9304                                 eval $setvar
9305                                 val=__UNDETACHED
9306                                 set old_pthread_create_joinable
9307                                 eval $setvar
9308                         else
9309                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9310                                 val="$define"
9311                                 set d_old_pthread_create_joinable
9312                                 eval $setvar
9313                                 val=0
9314                                 set old_pthread_create_joinable
9315                                 eval $setvar
9316                         fi
9317                 fi
9318         fi
9319         $rm -f try try.*
9320 else
9321     d_old_pthread_create_joinable="$undef"
9322     old_pthread_create_joinable=""
9323 fi
9324
9325 : see if pause exists
9326 set pause d_pause
9327 eval $inlibc
9328
9329 : see if pipe exists
9330 set pipe d_pipe
9331 eval $inlibc
9332
9333 : see if poll exists
9334 set poll d_poll
9335 eval $inlibc
9336
9337
9338 : see whether the various POSIXish _yields exist
9339 $cat >try.c <<EOP
9340 #include <pthread.h>
9341 #include <stdio.h>
9342 int main() {
9343 #ifdef SCHED_YIELD
9344         sched_yield();
9345 #else
9346 #ifdef PTHREAD_YIELD
9347         pthread_yield();
9348 #else
9349 #ifdef PTHREAD_YIELD_NULL
9350         pthread_yield(NULL);
9351 #endif
9352 #endif
9353 #endif
9354 }
9355 EOP
9356 : see if sched_yield exists
9357 set try -DSCHED_YIELD
9358 if eval $compile; then
9359     val="$define"
9360     sched_yield='sched_yield()'
9361 else
9362     val="$undef"
9363 fi
9364 case "$usethreads" in
9365 $define)
9366         case "$val" in
9367         $define) echo 'sched_yield() found.' >&4        ;;
9368         *)       echo 'sched_yield() NOT found.' >&4    ;;
9369         esac
9370 esac
9371 set d_sched_yield
9372 eval $setvar
9373
9374 : see if pthread_yield exists
9375 set try -DPTHREAD_YIELD
9376 if eval $compile; then
9377     val="$define"
9378     case "$sched_yield" in
9379     '') sched_yield='pthread_yield()' ;;
9380     esac
9381 else
9382     set try -DPTHREAD_YIELD_NULL
9383     if eval $compile; then
9384         val="$define"
9385         case "$sched_yield" in
9386         '') sched_yield='pthread_yield(NULL)' ;;
9387         esac
9388     else
9389         val="$undef"
9390     fi
9391 fi
9392 case "$usethreads" in
9393 $define)
9394         case "$val" in
9395         $define) echo 'pthread_yield() found.' >&4      ;;
9396         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9397         esac
9398         ;;
9399 esac
9400 set d_pthread_yield
9401 eval $setvar
9402
9403 case "$sched_yield" in
9404 '') sched_yield=undef ;;
9405 esac
9406
9407 $rm -f try try.*
9408
9409 : see if this is a pwd.h system
9410 set pwd.h i_pwd
9411 eval $inhdr
9412
9413 case "$i_pwd" in
9414 $define)
9415         xxx=`./findhdr pwd.h`
9416         $cppstdin $cppflags $cppminus < $xxx >$$.h
9417
9418         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9419                 val="$define"
9420         else
9421                 val="$undef"
9422         fi
9423         set d_pwquota
9424         eval $setvar
9425
9426         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9427                 val="$define"
9428         else
9429                 val="$undef"
9430         fi
9431         set d_pwage
9432         eval $setvar
9433
9434         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9435                 val="$define"
9436         else
9437                 val="$undef"
9438         fi
9439         set d_pwchange
9440         eval $setvar
9441
9442         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9443                 val="$define"
9444         else
9445                 val="$undef"
9446         fi
9447         set d_pwclass
9448         eval $setvar
9449
9450         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9451                 val="$define"
9452         else
9453                 val="$undef"
9454         fi
9455         set d_pwexpire
9456         eval $setvar
9457
9458         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9459                 val="$define"
9460         else
9461                 val="$undef"
9462         fi
9463         set d_pwcomment
9464         eval $setvar
9465
9466         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9467                 val="$define"
9468         else
9469                 val="$undef"
9470         fi
9471         set d_pwgecos
9472         eval $setvar
9473
9474         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9475                 val="$define"
9476         else
9477                 val="$undef"
9478         fi
9479         set d_pwpasswd
9480         eval $setvar
9481
9482         $rm -f $$.h
9483         ;;
9484 *)
9485         val="$undef"; 
9486         set d_pwquota; eval $setvar
9487         set d_pwage; eval $setvar
9488         set d_pwchange; eval $setvar
9489         set d_pwclass; eval $setvar
9490         set d_pwexpire; eval $setvar
9491         set d_pwcomment; eval $setvar
9492         set d_pwgecos; eval $setvar
9493         set d_pwpasswd; eval $setvar
9494         ;;
9495 esac
9496
9497 : see if readdir and friends exist
9498 set readdir d_readdir
9499 eval $inlibc
9500 set seekdir d_seekdir
9501 eval $inlibc
9502 set telldir d_telldir
9503 eval $inlibc
9504 set rewinddir d_rewinddir
9505 eval $inlibc
9506
9507 : see if readlink exists
9508 set readlink d_readlink
9509 eval $inlibc
9510
9511 : see if readv exists
9512 set readv d_readv
9513 eval $inlibc
9514
9515 : see if rename exists
9516 set rename d_rename
9517 eval $inlibc
9518
9519 : see if rmdir exists
9520 set rmdir d_rmdir
9521 eval $inlibc
9522
9523 : see if memory.h is available.
9524 val=''
9525 set memory.h val
9526 eval $inhdr
9527
9528 : See if it conflicts with string.h
9529 case "$val" in
9530 $define)
9531         case "$strings" in
9532         '') ;;
9533         *)
9534                 $cppstdin $cppflags $cppminus < $strings > mem.h
9535                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9536                         echo " "
9537                         echo "We won't be including <memory.h>."
9538                         val="$undef"
9539                 fi
9540                 $rm -f mem.h
9541                 ;;
9542         esac
9543 esac
9544 set i_memory
9545 eval $setvar
9546
9547 : can bcopy handle overlapping blocks?
9548 val="$undef"
9549 case "$d_bcopy" in
9550 "$define")
9551         echo " "
9552         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9553         $cat >try.c <<EOCP
9554 #$i_memory I_MEMORY
9555 #$i_stdlib I_STDLIB
9556 #$i_string I_STRING
9557 #$i_unistd I_UNISTD
9558 EOCP
9559         $cat >>try.c <<'EOCP'
9560 #include <stdio.h>
9561 #ifdef I_MEMORY
9562 #  include <memory.h>
9563 #endif
9564 #ifdef I_STDLIB
9565 #  include <stdlib.h>
9566 #endif
9567 #ifdef I_STRING
9568 #  include <string.h>
9569 #else
9570 #  include <strings.h>
9571 #endif
9572 #ifdef I_UNISTD
9573 #  include <unistd.h>  /* Needed for NetBSD */
9574 #endif
9575 int main()
9576 {
9577 char buf[128], abc[128];
9578 char *b;
9579 int len;
9580 int off;
9581 int align;
9582
9583 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9584
9585 for (align = 7; align >= 0; align--) {
9586         for (len = 36; len; len--) {
9587                 b = buf+align;
9588                 bcopy(abc, b, len);
9589                 for (off = 1; off <= len; off++) {
9590                         bcopy(b, b+off, len);
9591                         bcopy(b+off, b, len);
9592                         if (bcmp(b, abc, len))
9593                                 exit(1);
9594                 }
9595         }
9596 }
9597 exit(0);
9598 }
9599 EOCP
9600         set try
9601         if eval $compile_ok; then
9602                 if ./try 2>/dev/null; then
9603                         echo "Yes, it can."
9604                         val="$define"
9605                 else
9606                         echo "It can't, sorry."
9607                         case "$d_memmove" in
9608                         "$define") echo "But that's Ok since you have memmove()." ;;
9609                         esac
9610                 fi
9611         else
9612                 echo "(I can't compile the test program, so we'll assume not...)"
9613                 case "$d_memmove" in
9614                 "$define") echo "But that's Ok since you have memmove()." ;;
9615                 esac
9616         fi
9617         ;;
9618 esac
9619 $rm -f try.* try core
9620 set d_safebcpy
9621 eval $setvar
9622
9623 : can memcpy handle overlapping blocks?
9624 val="$undef"
9625 case "$d_memcpy" in
9626 "$define")
9627         echo " "
9628         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9629         $cat >try.c <<EOCP
9630 #$i_memory I_MEMORY
9631 #$i_stdlib I_STDLIB
9632 #$i_string I_STRING
9633 #$i_unistd I_UNISTD
9634 EOCP
9635         $cat >>try.c <<'EOCP'
9636 #include <stdio.h>
9637 #ifdef I_MEMORY
9638 #  include <memory.h>
9639 #endif
9640 #ifdef I_STDLIB
9641 #  include <stdlib.h>
9642 #endif
9643 #ifdef I_STRING
9644 #  include <string.h>
9645 #else
9646 #  include <strings.h>
9647 #endif
9648 #ifdef I_UNISTD
9649 #  include <unistd.h>  /* Needed for NetBSD */
9650 #endif
9651 int main()
9652 {
9653 char buf[128], abc[128];
9654 char *b;
9655 int len;
9656 int off;
9657 int align;
9658
9659 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9660    try to store the string in read-only memory. */
9661 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9662
9663 for (align = 7; align >= 0; align--) {
9664         for (len = 36; len; len--) {
9665                 b = buf+align;
9666                 memcpy(b, abc, len);
9667                 for (off = 1; off <= len; off++) {
9668                         memcpy(b+off, b, len);
9669                         memcpy(b, b+off, len);
9670                         if (memcmp(b, abc, len))
9671                                 exit(1);
9672                 }
9673         }
9674 }
9675 exit(0);
9676 }
9677 EOCP
9678         set try
9679         if eval $compile_ok; then
9680                 if ./try 2>/dev/null; then
9681                         echo "Yes, it can."
9682                         val="$define"
9683                 else
9684                         echo "It can't, sorry."
9685                         case "$d_memmove" in
9686                         "$define") echo "But that's Ok since you have memmove()." ;;
9687                         esac
9688                 fi
9689         else
9690                 echo "(I can't compile the test program, so we'll assume not...)"
9691                 case "$d_memmove" in
9692                 "$define") echo "But that's Ok since you have memmove()." ;;
9693                 esac
9694         fi
9695         ;;
9696 esac
9697 $rm -f try.* try core
9698 set d_safemcpy
9699 eval $setvar
9700
9701 : can memcmp be trusted to compare relative magnitude?
9702 val="$undef"
9703 case "$d_memcmp" in
9704 "$define")
9705         echo " "
9706         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9707         $cat >try.c <<EOCP
9708 #$i_memory I_MEMORY
9709 #$i_stdlib I_STDLIB
9710 #$i_string I_STRING
9711 #$i_unistd I_UNISTD
9712 EOCP
9713         $cat >>try.c <<'EOCP'
9714 #include <stdio.h>
9715 #ifdef I_MEMORY
9716 #  include <memory.h>
9717 #endif
9718 #ifdef I_STDLIB
9719 #  include <stdlib.h>
9720 #endif
9721 #ifdef I_STRING
9722 #  include <string.h>
9723 #else
9724 #  include <strings.h>
9725 #endif
9726 #ifdef I_UNISTD
9727 #  include <unistd.h>  /* Needed for NetBSD */
9728 #endif
9729 int main()
9730 {
9731 char a = -1;
9732 char b = 0;
9733 if ((a < b) && memcmp(&a, &b, 1) < 0)
9734         exit(1);
9735 exit(0);
9736 }
9737 EOCP
9738         set try
9739         if eval $compile_ok; then
9740                 if ./try 2>/dev/null; then
9741                         echo "Yes, it can."
9742                         val="$define"
9743                 else
9744                         echo "No, it can't (it uses signed chars)."
9745                 fi
9746         else
9747                 echo "(I can't compile the test program, so we'll assume not...)"
9748         fi
9749         ;;
9750 esac
9751 $rm -f try.* try core
9752 set d_sanemcmp
9753 eval $setvar
9754
9755 : see if select exists
9756 set select d_select
9757 eval $inlibc
9758
9759 : see if semctl exists
9760 set semctl d_semctl
9761 eval $inlibc
9762
9763 : see if semget exists
9764 set semget d_semget
9765 eval $inlibc
9766
9767 : see if semop exists
9768 set semop d_semop
9769 eval $inlibc
9770
9771 : see how much of the 'sem*(2)' library is present.
9772 h_sem=true
9773 echo " "
9774 case "$d_semctl$d_semget$d_semop" in
9775 *"$undef"*) h_sem=false;;
9776 esac
9777 case "$osname" in
9778 freebsd)
9779     case "`ipcs 2>&1`" in
9780     "SVID messages"*"not configured"*)
9781         echo "Your $osname does not have the sem*(2) configured." >&4
9782         h_sem=false
9783         val="$undef"
9784         set semctl d_semctl
9785         eval $setvar
9786         set semget d_semget
9787         eval $setvar
9788         set semop d_semop
9789         eval $setvar
9790         ;;
9791     esac
9792     ;;
9793 esac
9794 : we could also check for sys/ipc.h ...
9795 if $h_sem && $test `./findhdr sys/sem.h`; then
9796         echo "You have the full sem*(2) library." >&4
9797         val="$define"
9798 else
9799         echo "You don't have the full sem*(2) library." >&4
9800         val="$undef"
9801 fi
9802 set d_sem
9803 eval $setvar
9804
9805 : see whether sys/sem.h defines union semun
9806 echo " "
9807 $cat > try.c <<'END'
9808 #include <sys/types.h>
9809 #include <sys/ipc.h>
9810 #include <sys/sem.h>
9811 int main () { union semun semun; semun.buf = 0; }
9812 END
9813 set try
9814 if eval $compile; then
9815     echo "You have union semun in <sys/sem.h>." >&4
9816     val="$define"
9817 else
9818     echo "You do not have union semun in <sys/sem.h>." >&4
9819     val="$undef"
9820 fi
9821 $rm -f try try.c try.h
9822 set d_union_semun
9823 eval $setvar
9824
9825 : see how to do semctl IPC_STAT
9826 case "$d_sem" in
9827 $define)
9828     : see whether semctl IPC_STAT can use union semun
9829     echo " "
9830     $cat > try.h <<END
9831 #ifndef S_IRUSR
9832 #   ifdef S_IREAD
9833 #       define S_IRUSR S_IREAD
9834 #       define S_IWUSR S_IWRITE
9835 #       define S_IXUSR S_IEXEC
9836 #   else
9837 #       define S_IRUSR 0400
9838 #       define S_IWUSR 0200
9839 #       define S_IXUSR 0100
9840 #   endif
9841 #   define S_IRGRP (S_IRUSR>>3)
9842 #   define S_IWGRP (S_IWUSR>>3)
9843 #   define S_IXGRP (S_IXUSR>>3)
9844 #   define S_IROTH (S_IRUSR>>6)
9845 #   define S_IWOTH (S_IWUSR>>6)
9846 #   define S_IXOTH (S_IXUSR>>6)
9847 #endif
9848 #ifndef S_IRWXU
9849 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9850 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9851 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9852 #endif
9853 END
9854
9855     $cat > try.c <<END
9856 #include <sys/types.h>
9857 #include <sys/ipc.h>
9858 #include <sys/sem.h>
9859 #include <sys/stat.h>
9860 #include <stdio.h>
9861 #include <errno.h>
9862 #include "try.h"
9863 #ifndef errno
9864 extern int errno;
9865 #endif
9866 #$d_union_semun HAS_UNION_SEMUN
9867 int main() {
9868     union semun
9869 #ifndef HAS_UNION_SEMUN
9870     {
9871         int val;
9872         struct semid_ds *buf;
9873         unsigned short *array;
9874     }
9875 #endif
9876     arg;
9877     int sem, st;
9878
9879 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9880     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9881     if (sem > -1) {
9882         struct semid_ds argbuf;
9883         arg.buf = &argbuf;
9884 #       ifdef IPC_STAT
9885         st = semctl(sem, 0, IPC_STAT, arg);
9886         if (st == 0)
9887             printf("semun\n");
9888         else
9889 #       endif /* IPC_STAT */
9890             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9891 #       ifdef IPC_RMID
9892         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9893 #       endif /* IPC_RMID */
9894             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9895     } else
9896 #endif /* IPC_PRIVATE && ... */
9897         printf("semget failed: errno = %d\n", errno);
9898   return 0;
9899 }
9900 END
9901     val="$undef"
9902     set try
9903     if eval $compile; then
9904         xxx=`./try`
9905         case "$xxx" in
9906         semun) val="$define" ;;
9907         esac
9908     fi
9909     $rm -f try try.c
9910     set d_semctl_semun
9911     eval $setvar
9912     case "$d_semctl_semun" in
9913     $define)
9914         echo "You can use union semun for semctl IPC_STAT." >&4
9915         also='also'
9916         ;;
9917     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9918         also=''
9919         ;;
9920     esac
9921
9922     : see whether semctl IPC_STAT can use struct semid_ds pointer
9923     $cat > try.c <<'END'
9924 #include <sys/types.h>
9925 #include <sys/ipc.h>
9926 #include <sys/sem.h>
9927 #include <sys/stat.h>
9928 #include "try.h"
9929 #include <stdio.h>
9930 #include <errno.h>
9931 #ifndef errno
9932 extern int errno;
9933 #endif
9934 int main() {
9935     struct semid_ds arg;
9936     int sem, st;
9937
9938 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9939     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9940     if (sem > -1) {
9941 #       ifdef IPC_STAT
9942         st = semctl(sem, 0, IPC_STAT, &arg);
9943         if (st == 0)
9944             printf("semid_ds\n");
9945         else
9946 #       endif /* IPC_STAT */
9947             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9948 #       ifdef IPC_RMID
9949         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9950 #       endif /* IPC_RMID */
9951             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9952     } else
9953 #endif /* IPC_PRIVATE && ... */
9954         printf("semget failed: errno = %d\n", errno);
9955
9956     return 0;
9957 }
9958 END
9959     val="$undef"
9960     set try
9961     if eval $compile; then
9962         xxx=`./try`
9963         case "$xxx" in
9964         semid_ds) val="$define" ;;
9965         esac
9966     fi
9967     $rm -f try try.c
9968     set d_semctl_semid_ds
9969     eval $setvar
9970     case "$d_semctl_semid_ds" in
9971     $define)
9972         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9973         ;;
9974     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9975         ;;
9976     esac
9977     $rm -f try.h
9978     ;;
9979 *)  val="$undef"
9980
9981     # We do not have the full sem*(2) library, so assume we can not
9982     # use either.
9983
9984     set d_semctl_semun
9985     eval $setvar
9986
9987     set d_semctl_semid_ds
9988     eval $setvar
9989     ;;
9990 esac
9991
9992 : see if setegid exists
9993 set setegid d_setegid
9994 eval $inlibc
9995
9996 : see if seteuid exists
9997 set seteuid d_seteuid
9998 eval $inlibc
9999
10000 : see if setgrent exists
10001 set setgrent d_setgrent
10002 eval $inlibc
10003
10004 : see if sethostent exists
10005 set sethostent d_sethent
10006 eval $inlibc
10007
10008 : see if setlinebuf exists
10009 set setlinebuf d_setlinebuf
10010 eval $inlibc
10011
10012 : see if setlocale exists
10013 set setlocale d_setlocale
10014 eval $inlibc
10015
10016 : see if setnetent exists
10017 set setnetent d_setnent
10018 eval $inlibc
10019
10020 : see if setprotoent exists
10021 set setprotoent d_setpent
10022 eval $inlibc
10023
10024 : see if setpgid exists
10025 set setpgid d_setpgid
10026 eval $inlibc
10027
10028 : see if setpgrp2 exists
10029 set setpgrp2 d_setpgrp2
10030 eval $inlibc
10031
10032 : see if setpriority exists
10033 set setpriority d_setprior
10034 eval $inlibc
10035
10036 : see if setpwent exists
10037 set setpwent d_setpwent
10038 eval $inlibc
10039
10040 : see if setregid exists
10041 set setregid d_setregid
10042 eval $inlibc
10043 set setresgid d_setresgid
10044 eval $inlibc
10045
10046 : see if setreuid exists
10047 set setreuid d_setreuid
10048 eval $inlibc
10049 set setresuid d_setresuid
10050 eval $inlibc
10051
10052 : see if setrgid exists
10053 set setrgid d_setrgid
10054 eval $inlibc
10055
10056 : see if setruid exists
10057 set setruid d_setruid
10058 eval $inlibc
10059
10060 : see if setservent exists
10061 set setservent d_setsent
10062 eval $inlibc
10063
10064 : see if setsid exists
10065 set setsid d_setsid
10066 eval $inlibc
10067
10068 : see if setspent exists
10069 set setspent d_setspent
10070 eval $inlibc
10071
10072 : see if setvbuf exists
10073 set setvbuf d_setvbuf
10074 eval $inlibc
10075
10076 : see if sfio.h is available
10077 set sfio.h i_sfio
10078 eval $inhdr
10079
10080
10081 : see if sfio library is available
10082 case "$i_sfio" in
10083 $define)
10084         val=''
10085         set sfreserve val
10086         eval $inlibc
10087         ;;
10088 *)
10089         val="$undef"
10090         ;;
10091 esac
10092 : Ok, but do we want to use it.
10093 case "$val" in
10094 $define)
10095         case "$usesfio" in
10096         true|$define|[yY]*) dflt='y';;
10097         *) dflt='n';;
10098         esac
10099         echo "$package can use the sfio library, but it is experimental."
10100         rp="You seem to have sfio available, do you want to try using it?"
10101         . ./myread
10102         case "$ans" in
10103         y|Y) ;;
10104         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10105                 val="$undef"
10106                 : Remove sfio from list of libraries to use
10107                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10108                 shift
10109                 libs="$*"
10110                 echo "libs = $libs" >&4
10111                 ;;
10112         esac
10113         ;;
10114 *)      case "$usesfio" in
10115         true|$define|[yY]*)
10116                 echo "Sorry, cannot find sfio on this machine" >&4
10117                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10118                 ;;
10119         esac
10120         ;;
10121 esac
10122 set d_sfio
10123 eval $setvar
10124 case "$d_sfio" in
10125 $define) usesfio='true';;
10126 *) usesfio='false';;
10127 esac
10128
10129 : see if shmctl exists
10130 set shmctl d_shmctl
10131 eval $inlibc
10132
10133 : see if shmget exists
10134 set shmget d_shmget
10135 eval $inlibc
10136
10137 : see if shmat exists
10138 set shmat d_shmat
10139 eval $inlibc
10140 : see what shmat returns
10141 case "$d_shmat" in
10142 "$define")
10143         $cat >shmat.c <<'END'
10144 #include <sys/shm.h>
10145 void *shmat();
10146 END
10147         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10148                 shmattype='void *'
10149         else
10150                 shmattype='char *'
10151         fi
10152         echo "and it returns ($shmattype)." >&4
10153         : see if a prototype for shmat is available
10154         xxx=`./findhdr sys/shm.h`
10155         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10156         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10157                 val="$define"
10158         else
10159                 val="$undef"
10160         fi
10161         $rm -f shmat.[co]
10162         ;;
10163 *)
10164         val="$undef"
10165         ;;
10166 esac
10167 set d_shmatprototype
10168 eval $setvar
10169
10170 : see if shmdt exists
10171 set shmdt d_shmdt
10172 eval $inlibc
10173
10174 : see how much of the 'shm*(2)' library is present.
10175 h_shm=true
10176 echo " "
10177 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10178 *"$undef"*) h_shm=false;;
10179 esac
10180 case "$osname" in
10181 freebsd)
10182     case "`ipcs 2>&1`" in
10183     "SVID shared memory"*"not configured"*)
10184         echo "Your $osname does not have the shm*(2) configured." >&4
10185         h_shm=false
10186         val="$undef"
10187         set shmctl d_shmctl
10188         evat $setvar
10189         set shmget d_shmget
10190         evat $setvar
10191         set shmat d_shmat
10192         evat $setvar
10193         set shmdt d_shmdt
10194         evat $setvar
10195         ;;
10196     esac
10197     ;;
10198 esac
10199 : we could also check for sys/ipc.h ...
10200 if $h_shm && $test `./findhdr sys/shm.h`; then
10201         echo "You have the full shm*(2) library." >&4
10202         val="$define"
10203 else
10204         echo "You don't have the full shm*(2) library." >&4
10205         val="$undef"
10206 fi
10207 set d_shm
10208 eval $setvar
10209
10210 echo " "
10211 : see if we have sigaction
10212 if set sigaction val -f d_sigaction; eval $csym; $val; then
10213         echo 'sigaction() found.' >&4
10214         $cat > try.c <<'EOP'
10215 #include <stdio.h>
10216 #include <sys/types.h>
10217 #include <signal.h>
10218 int main()
10219 {
10220     struct sigaction act, oact;
10221     act.sa_flags = 0;
10222     oact.sa_handler = 0;
10223 }
10224 EOP
10225         set try
10226         if eval $compile_ok; then
10227                 val="$define"
10228         else
10229                 echo "But you don't seem to have a useable struct sigaction." >&4
10230                 val="$undef"
10231         fi
10232 else
10233         echo 'sigaction NOT found.' >&4
10234         val="$undef"
10235 fi
10236 set d_sigaction; eval $setvar
10237 $rm -f try try$_o try.c
10238
10239 : see if sigsetjmp exists
10240 echo " "
10241 case "$d_sigsetjmp" in
10242 '')
10243         $cat >try.c <<'EOP'
10244 #include <setjmp.h>
10245 sigjmp_buf env;
10246 int set = 1;
10247 int main()
10248 {
10249         if (sigsetjmp(env,1))
10250                 exit(set);
10251         set = 0;
10252         siglongjmp(env, 1);
10253         exit(1);
10254 }
10255 EOP
10256         set try
10257         if eval $compile; then
10258                 if ./try >/dev/null 2>&1; then
10259                         echo "POSIX sigsetjmp found." >&4
10260                         val="$define"
10261                 else
10262                         $cat >&4 <<EOM
10263 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10264 I'll ignore them.
10265 EOM
10266                         val="$undef"
10267                 fi
10268         else
10269                 echo "sigsetjmp not found." >&4
10270                 val="$undef"
10271         fi
10272         ;;
10273 *) val="$d_sigsetjmp"
10274         case "$d_sigsetjmp" in
10275         $define) echo "POSIX sigsetjmp found." >&4;;
10276         $undef) echo "sigsetjmp not found." >&4;;
10277         esac
10278         ;;
10279 esac
10280 set d_sigsetjmp
10281 eval $setvar
10282 $rm -f try.c try
10283
10284 : see if sys/stat.h is available
10285 set sys/stat.h i_sysstat
10286 eval $inhdr
10287
10288 : see if stat knows about block sizes
10289 echo " "
10290 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10291 eval $hasfield
10292
10293 : see if _ptr and _cnt from stdio act std
10294 echo " "
10295 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10296         echo "(Looks like you have stdio.h from Linux.)"
10297         case "$stdio_ptr" in
10298         '') stdio_ptr='((fp)->_IO_read_ptr)'
10299                 ptr_lval=$define
10300                 ;;
10301         *)      ptr_lval=$d_stdio_ptr_lval;;
10302         esac
10303         case "$stdio_cnt" in
10304         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10305                 cnt_lval=$undef
10306                 ;;
10307         *)      cnt_lval=$d_stdio_cnt_lval;;
10308         esac
10309         case "$stdio_base" in
10310         '') stdio_base='((fp)->_IO_read_base)';;
10311         esac
10312         case "$stdio_bufsiz" in
10313         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10314         esac
10315 else
10316         case "$stdio_ptr" in
10317         '') stdio_ptr='((fp)->_ptr)'
10318                 ptr_lval=$define
10319                 ;;
10320         *)      ptr_lval=$d_stdio_ptr_lval;;
10321         esac
10322         case "$stdio_cnt" in
10323         '') stdio_cnt='((fp)->_cnt)'
10324                 cnt_lval=$define
10325                 ;;
10326         *)      cnt_lval=$d_stdio_cnt_lval;;
10327         esac
10328         case "$stdio_base" in
10329         '') stdio_base='((fp)->_base)';;
10330         esac
10331         case "$stdio_bufsiz" in
10332         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10333         esac
10334 fi
10335 : test whether _ptr and _cnt really work
10336 echo "Checking how std your stdio is..." >&4
10337 $cat >try.c <<EOP
10338 #include <stdio.h>
10339 #define FILE_ptr(fp)    $stdio_ptr
10340 #define FILE_cnt(fp)    $stdio_cnt
10341 int main() {
10342         FILE *fp = fopen("try.c", "r");
10343         char c = getc(fp);
10344         if (
10345                 18 <= FILE_cnt(fp) &&
10346                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10347         )
10348                 exit(0);
10349         exit(1);
10350 }
10351 EOP
10352 val="$undef"
10353 set try
10354 if eval $compile; then
10355         if ./try; then
10356                 echo "Your stdio acts pretty std."
10357                 val="$define"
10358         else
10359                 echo "Your stdio isn't very std."
10360         fi
10361 else
10362         echo "Your stdio doesn't appear very std."
10363 fi
10364 $rm -f try.c try
10365 set d_stdstdio
10366 eval $setvar
10367
10368 : Can _ptr be used as an lvalue?
10369 case "$d_stdstdio$ptr_lval" in
10370 $define$define) val=$define ;;
10371 *) val=$undef ;;
10372 esac
10373 set d_stdio_ptr_lval
10374 eval $setvar
10375
10376 : Can _cnt be used as an lvalue?
10377 case "$d_stdstdio$cnt_lval" in
10378 $define$define) val=$define ;;
10379 *) val=$undef ;;
10380 esac
10381 set d_stdio_cnt_lval
10382 eval $setvar
10383
10384 : see if _base is also standard
10385 val="$undef"
10386 case "$d_stdstdio" in
10387 $define)
10388         $cat >try.c <<EOP
10389 #include <stdio.h>
10390 #define FILE_base(fp)   $stdio_base
10391 #define FILE_bufsiz(fp) $stdio_bufsiz
10392 int main() {
10393         FILE *fp = fopen("try.c", "r");
10394         char c = getc(fp);
10395         if (
10396                 19 <= FILE_bufsiz(fp) &&
10397                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10398         )
10399                 exit(0);
10400         exit(1);
10401 }
10402 EOP
10403         set try
10404         if eval $compile; then
10405                 if ./try; then
10406                         echo "And its _base field acts std."
10407                         val="$define"
10408                 else
10409                         echo "But its _base field isn't std."
10410                 fi
10411         else
10412                 echo "However, it seems to be lacking the _base field."
10413         fi
10414         $rm -f try.c try
10415         ;;
10416 esac
10417 set d_stdiobase
10418 eval $setvar
10419
10420 $cat >&4 <<EOM
10421 Checking how to access stdio streams by file descriptor number...
10422 EOM
10423 case "$stdio_stream_array" in
10424 '')     $cat >try.c <<EOCP
10425 #include <stdio.h>
10426 int main() {
10427   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10428     printf("yes\n");
10429 }
10430 EOCP
10431         for s in _iob __iob __sF
10432         do
10433                 set try -DSTDIO_STREAM_ARRAY=$s
10434                 if eval $compile; then
10435                         case "`./try$exe_ext`" in
10436                         yes)    stdio_stream_array=$s; break ;;
10437                         esac
10438                 fi
10439         done
10440         $rm -f try.* try$exe_ext
10441 esac
10442 case "$stdio_stream_array" in
10443 '')     $cat >&4 <<EOM
10444 I can't figure out how to access stdio streams by file descriptor number.
10445 EOM
10446         d_stdio_stream_array="$undef"
10447         ;;
10448 *)      $cat >&4 <<EOM
10449 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10450 EOM
10451         d_stdio_stream_array="$define"
10452         ;;
10453 esac
10454
10455 : see if strcoll exists
10456 set strcoll d_strcoll
10457 eval $inlibc
10458
10459 : check for structure copying
10460 echo " "
10461 echo "Checking to see if your C compiler can copy structs..." >&4
10462 $cat >try.c <<'EOCP'
10463 int main()
10464 {
10465         struct blurfl {
10466                 int dyick;
10467         } foo, bar;
10468
10469         foo = bar;
10470 }
10471 EOCP
10472 if $cc -c try.c >/dev/null 2>&1 ; then
10473         val="$define"
10474         echo "Yup, it can."
10475 else
10476         val="$undef"
10477         echo "Nope, it can't."
10478 fi
10479 set d_strctcpy
10480 eval $setvar
10481 $rm -f try.*
10482
10483 : see if strerror and/or sys_errlist[] exist
10484 echo " "
10485 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10486     if set strerror val -f d_strerror; eval $csym; $val; then
10487                 echo 'strerror() found.' >&4
10488                 d_strerror="$define"
10489                 d_strerrm='strerror(e)'
10490                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10491                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10492                         d_syserrlst="$define"
10493                 else
10494                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10495                         d_syserrlst="$undef"
10496                 fi
10497     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10498                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10499                 echo 'strerror() found in string header.' >&4
10500                 d_strerror="$define"
10501                 d_strerrm='strerror(e)'
10502                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10503                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10504                                 d_syserrlst="$define"
10505                 else
10506                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10507                         d_syserrlst="$undef"
10508                 fi
10509     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10510                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10511                 d_strerror="$undef"
10512                 d_syserrlst="$define"
10513                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10514     else
10515                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10516                 d_strerror="$undef"
10517                 d_syserrlst="$undef"
10518                 d_strerrm='"unknown"'
10519     fi
10520 fi
10521
10522 : see if strtod exists
10523 set strtod d_strtod
10524 eval $inlibc
10525
10526 : see if strtol exists
10527 set strtol d_strtol
10528 eval $inlibc
10529
10530 : see if strtoul exists
10531 set strtoul d_strtoul
10532 eval $inlibc
10533
10534 : see if strtoull exists
10535 set strtoull d_strtoull
10536 eval $inlibc
10537
10538 : see if strxfrm exists
10539 set strxfrm d_strxfrm
10540 eval $inlibc
10541
10542 : see if symlink exists
10543 set symlink d_symlink
10544 eval $inlibc
10545
10546 : see if syscall exists
10547 set syscall d_syscall
10548 eval $inlibc
10549
10550 : see if sysconf exists
10551 set sysconf d_sysconf
10552 eval $inlibc
10553
10554 : see if system exists
10555 set system d_system
10556 eval $inlibc
10557
10558 : see if tcgetpgrp exists
10559 set tcgetpgrp d_tcgetpgrp
10560 eval $inlibc
10561
10562 : see if tcsetpgrp exists
10563 set tcsetpgrp d_tcsetpgrp
10564 eval $inlibc
10565
10566 : see if sys/types.h has to be included
10567 set sys/types.h i_systypes
10568 eval $inhdr
10569
10570 : see if prototype for telldir is available
10571 echo " "
10572 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10573 eval $hasproto
10574
10575 : define an is-a-typedef? function
10576 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10577 case "$inclist" in
10578 "") inclist="sys/types.h";;
10579 esac;
10580 eval "varval=\$$var";
10581 case "$varval" in
10582 "")
10583         $rm -f temp.c;
10584         for inc in $inclist; do
10585                 echo "#include <$inc>" >>temp.c;
10586         done;
10587         echo "#ifdef $type" >> temp.c;
10588         echo "printf(\"We have $type\");" >> temp.c;
10589         echo "#endif" >> temp.c;
10590         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10591         if $contains $type temp.E >/dev/null 2>&1; then
10592                 eval "$var=\$type";
10593         else
10594                 eval "$var=\$def";
10595         fi;
10596         $rm -f temp.?;;
10597 *) eval "$var=\$varval";;
10598 esac'
10599
10600 : define an is-a-typedef? function that prompts if the type is not available.
10601 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10602 case "$inclist" in
10603 "") inclist="sys/types.h";;
10604 esac;
10605 eval "varval=\$$var";
10606 case "$varval" in
10607 "")
10608         $rm -f temp.c;
10609         for inc in $inclist; do
10610                 echo "#include <$inc>" >>temp.c;
10611         done;
10612         echo "#ifdef $type" >> temp.c;
10613         echo "printf(\"We have $type\");" >> temp.c;
10614         echo "#endif" >> temp.c;
10615         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10616         echo " " ;
10617         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10618         if $contains $type temp.E >/dev/null 2>&1; then
10619                 echo "$type found." >&4;
10620                 eval "$var=\$type";
10621         else
10622                 echo "$type NOT found." >&4;
10623                 dflt="$def";
10624                 . ./myread ;
10625                 eval "$var=\$ans";
10626         fi;
10627         $rm -f temp.?;;
10628 *) eval "$var=\$varval";;
10629 esac'
10630
10631 : see if this is a sys/times.h system
10632 set sys/times.h i_systimes
10633 eval $inhdr
10634
10635 : see if times exists
10636 echo " "
10637 if set times val -f d_times; eval $csym; $val; then
10638         echo 'times() found.' >&4
10639         d_times="$define"
10640         inc=''
10641         case "$i_systimes" in
10642         "$define") inc='sys/times.h';;
10643         esac
10644         rp="What is the type returned by times() on this system?"
10645         set clock_t clocktype long stdio.h sys/types.h $inc
10646         eval $typedef_ask
10647 else
10648         echo 'times() NOT found, hope that will do.' >&4
10649         d_times="$undef"
10650         clocktype='int'
10651 fi
10652
10653 : see if truncate exists
10654 set truncate d_truncate
10655 eval $inlibc
10656
10657 : see if tzname[] exists
10658 echo " "
10659 if set tzname val -a d_tzname; eval $csym; $val; then
10660         val="$define"
10661         echo 'tzname[] found.' >&4
10662 else
10663         val="$undef"
10664         echo 'tzname[] NOT found.' >&4
10665 fi
10666 set d_tzname
10667 eval $setvar
10668
10669 : see if umask exists
10670 set umask d_umask
10671 eval $inlibc
10672
10673 : backward compatibility for d_hvfork
10674 if test X$d_hvfork != X; then
10675         d_vfork="$d_hvfork"
10676         d_hvfork=''
10677 fi
10678 : see if there is a vfork
10679 val=''
10680 set vfork val
10681 eval $inlibc
10682
10683 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10684 : perl on Solaris 2.x, and probably elsewhere.
10685 case "$val" in
10686 $define)
10687         echo " "
10688         case "$usevfork" in
10689         false) dflt='n';;
10690         *) dflt='y';;
10691         esac
10692         cat <<'EOM'
10693  
10694 Perl can only use a vfork() that doesn't suffer from strict
10695 restrictions on calling functions or modifying global data in
10696 the child.  For example, glibc-2.1 contains such a vfork()
10697 that is unsuitable.  If your system provides a proper fork()
10698 call, chances are that you do NOT want perl to use vfork().
10699
10700 EOM
10701         rp="Do you still want to use vfork()?"
10702         . ./myread
10703         case "$ans" in
10704         y|Y) ;;
10705         *)
10706                 echo "Ok, we won't use vfork()."
10707                 val="$undef"
10708                 ;;
10709         esac
10710         ;;
10711 esac
10712 set d_vfork
10713 eval $setvar
10714 case "$d_vfork" in
10715 $define) usevfork='true';;
10716 *) usevfork='false';;
10717 esac
10718
10719 : see if this is an sysdir system
10720 set sys/dir.h i_sysdir
10721 eval $inhdr
10722
10723 : see if this is an sysndir system
10724 set sys/ndir.h i_sysndir
10725 eval $inhdr
10726
10727 : see if closedir exists
10728 set closedir d_closedir
10729 eval $inlibc
10730
10731 case "$d_closedir" in
10732 "$define")
10733         echo " "
10734         echo "Checking whether closedir() returns a status..." >&4
10735         cat > closedir.c <<EOM
10736 #$i_dirent I_DIRENT             /**/
10737 #$i_sysdir I_SYS_DIR            /**/
10738 #$i_sysndir I_SYS_NDIR          /**/
10739 #$i_systypes I_SYS_TYPES        /**/
10740
10741 #if defined(I_SYS_TYPES)
10742 #include <sys/types.h>
10743 #endif
10744 #if defined(I_DIRENT)
10745 #include <dirent.h>
10746 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10747 #include <sys/dir.h>
10748 #endif
10749 #else
10750 #ifdef I_SYS_NDIR
10751 #include <sys/ndir.h>
10752 #else
10753 #ifdef I_SYS_DIR
10754 #ifdef hp9000s500
10755 #include <ndir.h>       /* may be wrong in the future */
10756 #else
10757 #include <sys/dir.h>
10758 #endif
10759 #endif
10760 #endif
10761 #endif 
10762 int main() { return closedir(opendir(".")); }
10763 EOM
10764         set closedir
10765         if eval $compile_ok; then
10766                 if ./closedir > /dev/null 2>&1 ; then
10767                         echo "Yes, it does."
10768                         val="$undef"
10769                 else
10770                         echo "No, it doesn't."
10771                         val="$define"
10772                 fi
10773         else
10774                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10775                 val="$define"
10776         fi
10777         ;;
10778 *)
10779         val="$undef";
10780         ;;
10781 esac
10782 set d_void_closedir
10783 eval $setvar
10784 $rm -f closedir*
10785 : check for volatile keyword
10786 echo " "
10787 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10788 $cat >try.c <<'EOCP'
10789 int main()
10790 {
10791         typedef struct _goo_struct goo_struct;
10792         goo_struct * volatile goo = ((goo_struct *)0);
10793         struct _goo_struct {
10794                 long long_int;
10795                 int reg_int;
10796                 char char_var;
10797         };
10798         typedef unsigned short foo_t;
10799         char *volatile foo;
10800         volatile int bar;
10801         volatile foo_t blech;
10802         foo = foo;
10803 }
10804 EOCP
10805 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10806         val="$define"
10807         echo "Yup, it does."
10808 else
10809         val="$undef"
10810         echo "Nope, it doesn't."
10811 fi
10812 set d_volatile
10813 eval $setvar
10814 $rm -f try.*
10815
10816 : see if there is a wait4
10817 set wait4 d_wait4
10818 eval $inlibc
10819
10820 : see if waitpid exists
10821 set waitpid d_waitpid
10822 eval $inlibc
10823
10824 : see if wcstombs exists
10825 set wcstombs d_wcstombs
10826 eval $inlibc
10827
10828 : see if wctomb exists
10829 set wctomb d_wctomb
10830 eval $inlibc
10831
10832 : see if writev exists
10833 set writev d_writev
10834 eval $inlibc
10835
10836 : preserve RCS keywords in files with variable substitution, grrr
10837 Date='$Date'
10838 Id='$Id'
10839 Log='$Log'
10840 RCSfile='$RCSfile'
10841 Revision='$Revision'
10842
10843 case "$crosscompile" in
10844 ''|[nN]*) crosscompile="$undef" ;;
10845 esac
10846
10847 case "$osname" in
10848 next|rhapsody) multiarch="$define" ;;
10849 esac
10850 case "$multiarch" in
10851 ''|[nN]*) multiarch="$undef" ;;
10852 esac
10853
10854 : check for alignment requirements
10855 echo " "
10856 case "$crosscompile$multiarch" in
10857 *$define*)
10858         $cat <<EOM
10859 You seem to be either cross-compiling or doing a multiarchitecture build,
10860 skipping the memory alignment check.
10861
10862 EOM
10863         case "$alignbytes" in
10864         '') alignbytes=8 ;;
10865         esac
10866         ;;
10867 *)
10868         case "$alignbytes" in
10869         '') echo "Checking alignment constraints..." >&4
10870                 $cat >try.c <<'EOCP'
10871 struct foobar {
10872         char foo;
10873         double bar;
10874 } try_algn;
10875 int main()
10876 {
10877         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10878 }
10879 EOCP
10880                 set try
10881                 if eval $compile_ok; then
10882                         dflt=`./try`
10883                 else
10884                         dflt='8'
10885                         echo "(I can't seem to compile the test program...)"
10886                 fi
10887                 ;;
10888         *) dflt="$alignbytes"
10889                 ;;
10890         esac
10891         rp="Doubles must be aligned on a how-many-byte boundary?"
10892         . ./myread
10893         alignbytes="$ans"
10894         $rm -f try.c try
10895         ;;
10896 esac
10897
10898
10899 : check for ordering of bytes in a long
10900 echo " "
10901 case "$crosscompile$multiarch" in
10902 *$define*)
10903         $cat <<EOM
10904 You seem to be either cross-compiling or doing a multiarchitecture build,
10905 skipping the byteorder check.
10906
10907 EOM
10908         byteorder='0xffff'
10909         ;;
10910 *)
10911         case "$byteorder" in
10912         '')
10913                 $cat <<'EOM'
10914 In the following, larger digits indicate more significance.  A big-endian
10915 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10916 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10917 machines may have weird orders like 3412.  A Cray will report 87654321,
10918 an Alpha will report 12345678. If the test program works the default is
10919 probably right.
10920 I'm now running the test program...
10921 EOM
10922                 $cat >try.c <<'EOCP'
10923 #include <stdio.h>
10924 int main()
10925 {
10926         int i;
10927         union {
10928                 unsigned long l;
10929                 char c[sizeof(long)];
10930         } u;
10931
10932         if (sizeof(long) > 4)
10933                 u.l = (0x08070605L << 32) | 0x04030201L;
10934         else
10935                 u.l = 0x04030201L;
10936         for (i = 0; i < sizeof(long); i++)
10937                 printf("%c", u.c[i]+'0');
10938         printf("\n");
10939         exit(0);
10940 }
10941 EOCP
10942                 xxx_prompt=y
10943                 set try
10944                 if eval $compile && ./try > /dev/null; then
10945                         dflt=`./try`
10946                         case "$dflt" in
10947                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10948                                 echo "(The test program ran ok.)"
10949                                 echo "byteorder=$dflt"
10950                                 xxx_prompt=n
10951                         ;;
10952                         ????|????????) echo "(The test program ran ok.)" ;;
10953                         *) echo "(The test program didn't run right for some reason.)" ;;
10954                         esac
10955                 else
10956                         dflt='4321'
10957                         cat <<'EOM'
10958 (I can't seem to compile the test program.  Guessing big-endian...)
10959 EOM
10960                 fi
10961                 case "$xxx_prompt" in
10962                 y)
10963                         rp="What is the order of bytes in a long?"
10964                         . ./myread
10965                         byteorder="$ans"
10966                         ;;
10967                 *)      byteorder=$dflt
10968                         ;;
10969                 esac
10970                 ;;
10971         esac
10972         $rm -f try.c try
10973         ;;
10974 esac
10975
10976
10977 : how do we catenate cpp tokens here?
10978 echo " "
10979 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10980 $cat >cpp_stuff.c <<'EOCP'
10981 #define RCAT(a,b)a/**/b
10982 #define ACAT(a,b)a ## b
10983 RCAT(Rei,ser)
10984 ACAT(Cir,cus)
10985 EOCP
10986 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10987 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10988         echo "Oh!  Smells like ANSI's been here." >&4
10989         echo "We can catify or stringify, separately or together!"
10990         cpp_stuff=42
10991 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10992         echo "Ah, yes!  The good old days!" >&4
10993         echo "However, in the good old days we don't know how to stringify and"
10994         echo "catify at the same time."
10995         cpp_stuff=1
10996 else
10997         $cat >&4 <<EOM
10998 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10999 to have to edit the values of CAT[2-5] in config.h...
11000 EOM
11001         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11002 fi
11003 $rm -f cpp_stuff.*
11004
11005 : see if this is a db.h system
11006 set db.h i_db
11007 eval $inhdr
11008
11009 case "$i_db" in
11010 $define)
11011         : Check db version.
11012         echo " "
11013         echo "Checking Berkeley DB version ..." >&4
11014         $cat >try.c <<EOCP
11015 #$d_const HASCONST
11016 #ifndef HASCONST
11017 #define const
11018 #endif
11019 #include <sys/types.h>
11020 #include <stdio.h>
11021 #include <db.h>
11022 int main()
11023 {
11024 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11025     int Major, Minor, Patch ;
11026     unsigned long Version ;
11027     (void)db_version(&Major, &Minor, &Patch) ;
11028     printf("You have Berkeley DB Version 2 or greater\n");
11029
11030     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11031                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11032     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11033                 Major, Minor, Patch) ;
11034
11035     /* check that db.h & libdb are compatible */
11036     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11037         printf("db.h and libdb are incompatible\n") ;
11038         exit(3);        
11039     }
11040
11041     printf("db.h and libdb are compatible\n") ;
11042
11043     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11044                 + DB_VERSION_PATCH ;
11045
11046     /* needs to be >= 2.3.4 */
11047     if (Version < 2003004) {
11048     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11049         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11050         exit(2);        
11051     }
11052
11053     exit(0);
11054 #else
11055 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11056     printf("You have Berkeley DB Version 1\n");
11057     exit(0);    /* DB version < 2: the coast is clear. */
11058 #else
11059     exit(1);    /* <db.h> not Berkeley DB? */
11060 #endif
11061 #endif
11062 }
11063 EOCP
11064         set try
11065         if eval $compile && ./try; then
11066                 echo 'Looks OK.' >&4
11067         else
11068                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11069                 i_db=$undef
11070                 case " $libs " in
11071                 *"-ldb "*)
11072                         : Remove db from list of libraries to use
11073                         echo "Removing unusable -ldb from library list" >&4
11074                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11075                         shift
11076                         libs="$*"
11077                         echo "libs = $libs" >&4
11078                         ;;
11079                 esac
11080         fi
11081         $rm -f try.*
11082         ;;
11083 esac
11084
11085 case "$i_db" in
11086 define)
11087         : Check the return type needed for hash 
11088         echo " "
11089         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11090         $cat >try.c <<EOCP
11091 #$d_const HASCONST
11092 #ifndef HASCONST
11093 #define const
11094 #endif
11095 #include <sys/types.h>
11096 #include <db.h>
11097
11098 #ifndef DB_VERSION_MAJOR
11099 u_int32_t hash_cb (ptr, size)
11100 const void *ptr;
11101 size_t size;
11102 {
11103 }
11104 HASHINFO info;
11105 int main()
11106 {
11107         info.hash = hash_cb;
11108 }
11109 #endif
11110 EOCP
11111         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11112                 if $contains warning try.out >>/dev/null 2>&1 ; then
11113                         db_hashtype='int'
11114                 else
11115                         db_hashtype='u_int32_t'
11116                 fi
11117         else
11118                 : XXX Maybe we should just give up here.
11119                 db_hashtype=u_int32_t
11120                 $cat try.out >&4
11121                 echo "Help:  I can't seem to compile the db test program." >&4
11122                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11123         fi
11124         $rm -f try.*
11125         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11126         ;;
11127 *)      db_hashtype=u_int32_t
11128         ;;
11129 esac
11130 case "$i_db" in
11131 define)
11132         : Check the return type needed for prefix 
11133         echo " "
11134         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11135         cat >try.c <<EOCP
11136 #$d_const HASCONST
11137 #ifndef HASCONST
11138 #define const
11139 #endif
11140 #include <sys/types.h>
11141 #include <db.h>
11142
11143 #ifndef DB_VERSION_MAJOR
11144 size_t prefix_cb (key1, key2)
11145 const DBT *key1;
11146 const DBT *key2;
11147 {
11148 }
11149 BTREEINFO info;
11150 int main()
11151 {
11152         info.prefix = prefix_cb;
11153 }
11154 #endif
11155 EOCP
11156         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11157                 if $contains warning try.out >>/dev/null 2>&1 ; then
11158                         db_prefixtype='int'
11159                 else
11160                         db_prefixtype='size_t'
11161                 fi
11162         else
11163                 db_prefixtype='size_t'
11164                 : XXX Maybe we should just give up here.
11165                 $cat try.out >&4
11166                 echo "Help:  I can't seem to compile the db test program." >&4
11167                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11168         fi
11169         $rm -f try.*
11170         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11171         ;;
11172 *)      db_prefixtype='size_t'
11173         ;;
11174 esac
11175
11176 : check for void type
11177 echo " "
11178 echo "Checking to see how well your C compiler groks the void type..." >&4
11179 case "$voidflags" in
11180 '')
11181         $cat >try.c <<'EOCP'
11182 #if TRY & 1
11183 void sub() {
11184 #else
11185 sub() {
11186 #endif
11187         extern void moo();      /* function returning void */
11188         void (*goo)();          /* ptr to func returning void */
11189 #if TRY & 8
11190         void *hue;              /* generic ptr */
11191 #endif
11192 #if TRY & 2
11193         void (*foo[10])();
11194 #endif
11195
11196 #if TRY & 4
11197         if(goo == moo) {
11198                 exit(0);
11199         }
11200 #endif
11201         exit(0);
11202 }
11203 int main() { sub(); }
11204 EOCP
11205         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11206                 voidflags=$defvoidused
11207         echo "Good.  It appears to support void to the level $package wants.">&4
11208                 if $contains warning .out >/dev/null 2>&1; then
11209                         echo "However, you might get some warnings that look like this:"
11210                         $cat .out
11211                 fi
11212         else
11213 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11214                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11215                         echo "It supports 1..."
11216                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11217                                 echo "It also supports 2..."
11218                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11219                                         voidflags=7
11220                                         echo "And it supports 4 but not 8 definitely."
11221                                 else
11222                                         echo "It doesn't support 4..."
11223                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11224                                                 voidflags=11
11225                                                 echo "But it supports 8."
11226                                         else
11227                                                 voidflags=3
11228                                                 echo "Neither does it support 8."
11229                                         fi
11230                                 fi
11231                         else
11232                                 echo "It does not support 2..."
11233                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11234                                         voidflags=13
11235                                         echo "But it supports 4 and 8."
11236                                 else
11237                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11238                                                 voidflags=5
11239                                                 echo "And it supports 4 but has not heard about 8."
11240                                         else
11241                                                 echo "However it supports 8 but not 4."
11242                                         fi
11243                                 fi
11244                         fi
11245                 else
11246                         echo "There is no support at all for void."
11247                         voidflags=0
11248                 fi
11249         fi
11250 esac
11251 case "$voidflags" in
11252 "$defvoidused") ;;
11253 *)      $cat >&4 <<'EOM'
11254   Support flag bits are:
11255     1: basic void declarations.
11256     2: arrays of pointers to functions returning void.
11257     4: operations between pointers to and addresses of void functions.
11258     8: generic void pointers.
11259 EOM
11260         dflt="$voidflags";
11261         rp="Your void support flags add up to what?"
11262         . ./myread
11263         voidflags="$ans"
11264         ;;
11265 esac
11266 $rm -f try.* .out
11267
11268
11269 : How can we generate normalized random numbers ?
11270 echo " "
11271 echo "Looking for a random number function..." >&4
11272 case "$randfunc" in
11273 '')
11274         if set drand48 val -f; eval $csym; $val; then
11275                 dflt="drand48"
11276                 echo "Good, found drand48()." >&4
11277         elif set random val -f; eval $csym; $val; then
11278                 dflt="random"
11279                 echo "OK, found random()." >&4
11280         else
11281                 dflt="rand"
11282                 echo "Yick, looks like I have to use rand()." >&4
11283         fi
11284         echo " "
11285         ;;
11286 *)
11287         dflt="$randfunc"
11288         ;;
11289 esac
11290 cont=true
11291
11292 case "$ccflags" in
11293 *-Dmy_rand=*|*-Dmy_srand=*)
11294         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11295         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11296         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11297         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11298         ;;
11299 esac
11300
11301 while $test "$cont"; do
11302         rp="Use which function to generate random numbers?"
11303         . ./myread
11304         if $test "$ans" = "$dflt"; then
11305                 : null
11306         else
11307                 randbits=''
11308         fi
11309         randfunc="$ans"
11310         if set $ans val -f; eval $csym; $val; then
11311                 cont=''
11312         else
11313                 dflt=y
11314                 rp="I cannot find function $ans. Use that name anyway?"
11315                 . ./myread
11316                 dflt=rand
11317                 case "$ans" in
11318                         [yY]*) cont='';;
11319                 esac
11320         fi
11321         case "$cont" in
11322         '')
11323                 case "$randfunc" in
11324                 drand48)
11325                         drand01="drand48()"
11326                         seedfunc="srand48"
11327                         randbits=48
11328                         randseedtype=long
11329                         ;;
11330                 rand|random)
11331                         case "$randbits" in
11332                         '')
11333 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11334                                 $cat >try.c <<EOCP
11335 #$i_unistd I_UNISTD
11336 #$i_stdlib I_STDLIB
11337 #include <stdio.h>
11338 #ifdef I_UNISTD
11339 #  include <unistd.h>
11340 #endif
11341 #ifdef I_STDLIB
11342 #  include <stdlib.h>
11343 #endif
11344 int main()
11345 {
11346         register int i;
11347         register unsigned long tmp;
11348         register unsigned long max = 0L;
11349
11350         for (i = 1000; i; i--) {
11351                 tmp = (unsigned long) $randfunc();
11352                 if (tmp > max) max = tmp;
11353         }
11354         for (i = 0; max; i++)
11355                 max /= 2;
11356         printf("%d\n",i);
11357 }
11358 EOCP
11359                                 set try
11360                                 if eval $compile_ok; then
11361                                         dflt=`try`
11362                                 else
11363                                         dflt='?'
11364                                         echo "(I can't seem to compile the test program...)"
11365                                 fi
11366                                 ;;
11367                         *)
11368                                 dflt="$randbits"
11369                                 ;;
11370                         esac
11371                         rp="How many bits does your $randfunc() function produce?"
11372                         . ./myread
11373                         randbits="$ans"
11374                         $rm -f try.c try
11375                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11376                         seedfunc="s$randfunc"
11377                         randseedtype=unsigned
11378                         ;;
11379                 *)
11380                         dflt="31"
11381                         rp="How many bits does your $randfunc() function produce?"
11382                         . ./myread
11383                         randbits="$ans"
11384                         seedfunc="s$randfunc"
11385                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11386                         if set $seedfunc val -f; eval $csym; $val; then
11387                                 echo "(Using $seedfunc() to seed random generator)"
11388                         else
11389                                 echo "(Warning: no $seedfunc() to seed random generator)"
11390                                 seedfunc=rand
11391                         fi
11392                         randseedtype=unsigned
11393                         ;;
11394                 esac
11395                 ;;
11396         esac
11397 done
11398
11399 echo " "
11400 echo "Determining whether or not we are on an EBCDIC system..." >&4
11401 $cat >tebcdic.c <<'EOM'
11402 int main()
11403 {
11404   if ('M'==0xd4) return 0;
11405   return 1;
11406 }
11407 EOM
11408
11409 val=$undef
11410 set tebcdic
11411 if eval $compile_ok; then
11412         if ./tebcdic; then
11413                 echo "You have EBCDIC." >&4
11414                 val="$define"
11415         else
11416                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11417         fi
11418 else
11419         echo "I'm unable to compile the test program." >&4
11420         echo "I'll assume ASCII or some ISO Latin." >&4
11421 fi
11422 $rm -f tebcdic.c tebcdic
11423 set ebcdic
11424 eval $setvar
11425
11426 echo " "
11427 $cat >&4 <<EOM
11428 Checking how to flush all pending stdio output...
11429 EOM
11430 # I only know how to find the first 32 possibly open files on SunOS.
11431 # See also hints/sunos_4_1.sh and util.c  --AD
11432 case "$osname" in
11433 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11434 esac
11435 $cat >>try.c <<EOCP
11436 #include <stdio.h>
11437 #$i_unistd I_UNISTD
11438 #ifdef I_UNISTD
11439 # include <unistd.h>
11440 #endif
11441 #$d_sysconf HAS_SYSCONF
11442 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11443 #ifdef HAS_STDIO_STREAM_ARRAY
11444 # define STDIO_STREAM_ARRAY $stdio_stream_array
11445 #endif
11446 int main() {
11447   FILE* p = fopen("try.out", "w");
11448 #ifdef TRY_FPUTC
11449   fputc('x', p);
11450 #else
11451 # ifdef TRY_FPRINTF
11452   fprintf(p, "x");
11453 # endif
11454 #endif
11455 #ifdef TRY_FFLUSH_NULL
11456   fflush(NULL);
11457 #endif
11458 #ifdef TRY_FFLUSH_ALL
11459   {
11460     long open_max = -1;
11461 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11462     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11463 # else
11464 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11465     open_max = sysconf(_SC_OPEN_MAX);
11466 #  else
11467 #   ifdef FOPEN_MAX
11468     open_max = FOPEN_MAX;
11469 #   else
11470 #    ifdef OPEN_MAX
11471     open_max = OPEN_MAX;
11472 #    else
11473 #     ifdef _NFILE
11474     open_max = _NFILE;
11475 #     endif
11476 #    endif
11477 #   endif
11478 #  endif
11479 # endif 
11480 # ifdef HAS_STDIO_STREAM_ARRAY
11481     if (open_max > 0) {
11482       long i;
11483       for (i = 0; i < open_max; i++)
11484             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11485                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11486                 STDIO_STREAM_ARRAY[i]._flag)
11487                 fflush(&STDIO_STREAM_ARRAY[i]);
11488     }   
11489   }
11490 # endif
11491 #endif
11492   _exit(42);
11493 }
11494 EOCP
11495 : first we have to find out how _not_ to flush
11496 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11497     output=''
11498     set try -DTRY_FPUTC
11499     if eval $compile; then
11500             $rm -f try.out
11501             ./try$exe_ext 2>/dev/null
11502             if $test ! -s try.out -a "X$?" = X42; then
11503                 output=-DTRY_FPUTC
11504             fi
11505     fi
11506     case "$output" in
11507     '')
11508             set try -DTRY_FPRINTF
11509             $rm -f try.out
11510             if eval $compile; then
11511                     $rm -f try.out
11512                     ./try$exe_ext 2>/dev/null
11513                     if $test ! -s try.out -a "X$?" = X42; then
11514                         output=-DTRY_FPRINTF
11515                     fi
11516             fi
11517         ;;
11518     esac
11519 fi
11520 : check for fflush NULL behaviour
11521 case "$fflushNULL" in
11522 '')     set try -DTRY_FFLUSH_NULL $output
11523         if eval $compile; then
11524                 $rm -f try.out
11525                 ./try$exe_ext 2>/dev/null
11526                 code="$?"
11527                 if $test -s try.out -a "X$code" = X42; then
11528                         fflushNULL="`$cat try.out`"
11529                 else
11530                         if $test "X$code" != X42; then
11531                                 $cat >&4 <<EOM
11532 (If this test failed, don't worry, we'll try another method shortly.)
11533 EOM
11534                         fi
11535                 fi
11536         fi
11537         $rm -f core try.core core.try.*
11538         case "$fflushNULL" in
11539         x)      $cat >&4 <<EOM
11540 Your fflush(NULL) works okay.
11541 EOM
11542                 fflushNULL="$define"
11543                 ;;
11544         '')     $cat >&4 <<EOM
11545 Your fflush(NULL) isn't working (contrary to ANSI C).
11546 EOM
11547                 fflushNULL="$undef"
11548                 ;;
11549         *)      $cat >&4 <<EOM
11550 Cannot figure out whether your fflush(NULL) works or not.
11551 I'm assuming it doesn't (contrary to ANSI C).
11552 EOM
11553                 fflushNULL="$undef"
11554                 ;;
11555         esac
11556         ;;
11557 $define|true|[yY]*)
11558         fflushNULL="$define"
11559         ;;
11560 *)
11561         fflushNULL="$undef"
11562         ;;
11563 esac
11564 : check explicit looping only if NULL did not work
11565 case "$fflushNULL" in
11566 "$undef")
11567         : check for fflush all behaviour
11568         case "$fflushall" in
11569         '')     set try -DTRY_FFLUSH_ALL $output
11570                 if eval $compile; then
11571                         $cat >&4 <<EOM
11572 (Now testing the other method--but note that also this may fail.)
11573 EOM
11574                         $rm -f try.out
11575                         ./try$exe_ext 2>/dev/null
11576                         if $test -s try.out -a "X$?" = X42; then
11577                                 fflushall="`$cat try.out`"
11578                         fi
11579                 fi
11580                 $rm -f core try.core core.try.*
11581                 case "$fflushall" in
11582                 x)      $cat >&4 <<EOM
11583 Whew. Flushing explicitly all the stdio streams works.
11584 EOM
11585                         fflushall="$define"
11586                         ;;
11587                 '')     $cat >&4 <<EOM
11588 Sigh. Flushing explicitly all the stdio streams doesn't work.
11589 EOM
11590                         fflushall="$undef"
11591                         ;;
11592                 *)      $cat >&4 <<EOM
11593 Cannot figure out whether flushing stdio streams explicitly works or not.
11594 I'm assuming it doesn't.
11595 EOM
11596                         fflushall="$undef"
11597                         ;;
11598                 esac
11599                 ;;
11600         "$define"|true|[yY]*)
11601                 fflushall="$define"
11602                 ;;
11603         *)
11604                 fflushall="$undef"
11605                 ;;
11606         esac
11607         ;;
11608 *)      fflushall="$undef"      
11609         ;;
11610 esac
11611 case "$fflushNULL$fflushall" in
11612 undefundef)
11613         $cat <<EOM
11614 I cannot figure out how to flush pending stdio output.
11615 EOM
11616         ;;
11617 esac
11618 $rm -f try.* try$exe_ext
11619
11620 : see what type file positions are declared as in the library
11621 rp="What is the type for file position used by fsetpos()?"
11622 set fpos_t fpostype long stdio.h sys/types.h
11623 eval $typedef_ask
11624
11625 : Store the full pathname to the ar program for use in the C program
11626 : Respect a hint or command line value for full_ar.
11627 case "$full_ar" in
11628 '') full_ar=$ar ;;
11629 esac
11630
11631 : Store the full pathname to the sed program for use in the C program
11632 full_sed=$sed
11633
11634 : see what type gids are declared as in the kernel
11635 echo " "
11636 echo "Looking for the type for group ids returned by getgid()."
11637 set gid_t gidtype xxx stdio.h sys/types.h
11638 eval $typedef
11639 case "$gidtype" in
11640 xxx)
11641         xxx=`./findhdr sys/user.h`
11642         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11643         case $1 in
11644         unsigned) dflt="$1 $2" ;;
11645         *) dflt="$1" ;;
11646         esac
11647         ;;
11648 *) dflt="$gidtype";;
11649 esac
11650 case "$gidtype" in
11651 gid_t) echo "gid_t found." ;;
11652 *)      rp="What is the type for group ids returned by getgid()?"
11653         . ./myread
11654         gidtype="$ans"
11655         ;;
11656 esac
11657
11658 : see if getgroups exists
11659 set getgroups d_getgrps
11660 eval $inlibc
11661
11662 : see if setgroups exists
11663 set setgroups d_setgrps
11664 eval $inlibc
11665
11666
11667 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11668 echo " "
11669 case "$d_getgrps$d_setgrps" in
11670 *define*)
11671         case "$groupstype" in
11672         '') dflt="$gidtype" ;;
11673         *)  dflt="$groupstype" ;;
11674         esac
11675         $cat <<EOM
11676 What type of pointer is the second argument to getgroups() and setgroups()?
11677 Usually this is the same as group ids, $gidtype, but not always.
11678
11679 EOM
11680         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11681         . ./myread
11682         groupstype="$ans"
11683         ;;
11684 *)  groupstype="$gidtype";;
11685 esac
11686
11687 : see what type lseek is declared as in the kernel
11688 rp="What is the type used for lseek's offset on this system?"
11689 set off_t lseektype long stdio.h sys/types.h
11690 eval $typedef_ask
11691
11692 echo " "
11693 $echo $n "Checking to see how big your file offsets are...$c" >&4
11694 $cat >try.c <<EOCP
11695 #include <sys/types.h>
11696 #include <stdio.h>
11697 int main()
11698 {
11699         printf("%d\n", sizeof($lseektype));
11700 }
11701 EOCP
11702 set try
11703 if eval $compile_ok; then
11704         lseeksize=`./try`
11705         $echo " $lseeksize bytes." >&4
11706 else
11707         dflt='4'
11708         echo " "
11709         echo "(I can't seem to compile the test program.  Guessing...)"
11710         rp="What is the size of your file offsets (in bytes)?"
11711         . ./myread
11712         lseeksize="$ans"
11713 fi
11714 $rm -f try.c try
11715
11716 echo " "
11717 echo "Checking if your $make program sets \$(MAKE)..." >&4
11718 case "$make_set_make" in
11719 '')
11720         $sed 's/^X //' > testmake.mak << 'EOF'
11721 Xall:
11722 X       @echo 'maketemp="$(MAKE)"'
11723 EOF
11724         case "`$make -f testmake.mak 2>/dev/null`" in
11725         *maketemp=*) make_set_make='#' ;;
11726         *)      make_set_make="MAKE=$make" ;;
11727         esac
11728         $rm -f testmake.mak
11729         ;;
11730 esac
11731 case "$make_set_make" in
11732 '#') echo "Yup, it does.";;
11733 *) echo "Nope, it doesn't.";;
11734 esac
11735
11736 : see what type is used for mode_t
11737 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11738 set mode_t modetype int stdio.h sys/types.h
11739 eval $typedef_ask
11740
11741 : define a fucntion to check prototypes
11742 $cat > protochk <<EOSH
11743 $startsh
11744 cc="$cc"
11745 optimize="$optimize"
11746 ccflags="$ccflags"
11747 prototype="$prototype"
11748 define="$define"
11749 rm=$rm
11750 EOSH
11751
11752 $cat >> protochk <<'EOSH'
11753
11754 $rm -f try.c
11755 foo="$1"
11756 shift
11757 while test $# -ge 2; do
11758         case "$1" in
11759                 $define) echo "#include <$2>" >> try.c ;;
11760                 literal) echo "$2" >> try.c ;;
11761         esac
11762     shift 2
11763 done
11764 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11765 cat >> try.c <<'EOCP'
11766 #ifdef CAN_PROTOTYPE
11767 #define _(args) args
11768 #else
11769 #define _(args) ()
11770 #endif
11771 EOCP
11772 echo "$foo" >> try.c
11773 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11774 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11775 status=$?
11776 $rm -f try.[co]
11777 exit $status
11778 EOSH
11779 chmod +x protochk
11780 $eunicefix protochk
11781
11782 : see what type is used for size_t
11783 rp="What is the type used for the length parameter for string functions?"
11784 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11785 eval $typedef_ask
11786
11787 : check for type of arguments to gethostbyaddr. 
11788 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11789         case "$d_gethbyaddr" in
11790         $define)
11791                 $cat <<EOM
11792
11793 Checking to see what type of arguments are accepted by gethostbyaddr().
11794 EOM
11795                 hdrs="$define sys/types.h
11796                         $d_socket sys/socket.h 
11797                         $i_niin netinet/in.h 
11798                         $i_netdb netdb.h
11799                         $i_unistd unistd.h"
11800                 : The first arg can 'char *' or 'void *'
11801                 : The second arg is some of integral type
11802                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11803                         for yyy in size_t long int; do
11804                                 case "$netdb_host_type" in
11805                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11806                                         if ./protochk "$try" $hdrs; then
11807                                                 echo "Your system accepts $xxx for the first arg."
11808                                                 echo "...and $yyy for the second arg."
11809                                                 netdb_host_type="$xxx"
11810                                                 netdb_hlen_type="$yyy"
11811                                         fi
11812                                         ;;
11813                                 esac
11814                         done
11815                 done
11816                 : In case none of those worked, prompt the user.
11817                 case "$netdb_host_type" in
11818                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11819                         dflt='char *'
11820                         . ./myread
11821                         netdb_host_type=$ans
11822                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11823                         dflt="$sizetype"
11824                         . ./myread
11825                         netdb_hlen_type=$ans
11826                         ;;
11827                 esac
11828                 ;;
11829         *)      : no gethostbyaddr, so pick harmless defaults
11830                 netdb_host_type='char *'
11831                 netdb_hlen_type="$sizetype"
11832                 ;;
11833         esac
11834         # Remove the "const" if needed. -- but then we'll have a 
11835         # prototype clash!
11836         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11837 fi
11838
11839 : check for type of argument to gethostbyname. 
11840 if test "X$netdb_name_type" = X ; then
11841         case "$d_gethbyname" in
11842         $define)
11843                 $cat <<EOM
11844
11845 Checking to see what type of argument is accepted by gethostbyname().
11846 EOM
11847                 hdrs="$define sys/types.h
11848                         $d_socket sys/socket.h 
11849                         $i_niin netinet/in.h 
11850                         $i_netdb netdb.h
11851                         $i_unistd unistd.h"
11852                 for xxx in "const char *" "char *"; do
11853                         case "$netdb_name_type" in
11854                         '')     try="extern struct hostent *gethostbyname($xxx);"
11855                                 if ./protochk "$try" $hdrs; then
11856                                         echo "Your system accepts $xxx."
11857                                         netdb_name_type="$xxx"
11858                                 fi
11859                                 ;;
11860                         esac
11861                 done
11862                 : In case none of those worked, prompt the user.
11863                 case "$netdb_name_type" in
11864                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11865                         dflt='char *'
11866                         . ./myread
11867                         netdb_name_type=$ans
11868                         ;;
11869                 esac
11870                 ;;
11871         *)      : no gethostbyname, so pick harmless default
11872                 netdb_name_type='char *'
11873                 ;;
11874         esac
11875 fi
11876
11877 : check for type of 1st argument to getnetbyaddr. 
11878 if test "X$netdb_net_type" = X ; then
11879         case "$d_getnbyaddr" in
11880         $define)
11881                 $cat <<EOM
11882
11883 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11884 EOM
11885                 hdrs="$define sys/types.h
11886                         $d_socket sys/socket.h 
11887                         $i_niin netinet/in.h 
11888                         $i_netdb netdb.h
11889                         $i_unistd unistd.h"
11890                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11891                         case "$netdb_net_type" in
11892                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11893                                 if ./protochk "$try" $hdrs; then
11894                                         echo "Your system accepts $xxx."
11895                                         netdb_net_type="$xxx"
11896                                 fi
11897                                 ;;
11898                         esac
11899                 done
11900                 : In case none of those worked, prompt the user.
11901                 case "$netdb_net_type" in
11902                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11903                         dflt='long'
11904                         . ./myread
11905                         netdb_net_type=$ans
11906                         ;;
11907                 esac
11908                 ;;
11909         *)      : no getnetbyaddr, so pick harmless default
11910                 netdb_net_type='long'
11911                 ;;
11912         esac
11913 fi
11914 : locate the preferred pager for this system
11915 case "$pager" in
11916 '')
11917         dflt=''
11918         case "$pg" in
11919         /*) dflt=$pg;;
11920         esac
11921         case "$more" in
11922         /*) dflt=$more;;
11923         esac
11924         case "$less" in
11925         /*) dflt=$less;;
11926         esac
11927         case "$dflt" in
11928         '') dflt=/usr/ucb/more;;
11929         esac
11930         ;;
11931 *) dflt="$pager";;
11932 esac
11933 echo " "
11934 fn=f/
11935 rp='What pager is used on your system?'
11936 . ./getfile
11937 pager="$ans"
11938
11939 : see what type pids are declared as in the kernel
11940 rp="What is the type of process ids on this system?"
11941 set pid_t pidtype int stdio.h sys/types.h
11942 eval $typedef_ask
11943
11944 : Find earliest binary compatible site_perl subdirectory perl can use.
11945 case "$bincompat5005" in
11946 "$define") xs_apiversion='5.005' ;;
11947 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
11948 esac
11949 : Find earliest pure perl site_perl subdirectory perl can use.
11950 : The versioned directories started at 5.005.
11951 pm_apiversion='5.005'
11952
11953 : check for length of pointer
11954 echo " "
11955 case "$ptrsize" in
11956 '')
11957         $echo $n "Checking to see how big your pointers are...$c" >&4
11958         if test "$voidflags" -gt 7; then
11959                 echo '#define VOID_PTR char *' > try.c
11960         else
11961                 echo '#define VOID_PTR void *' > try.c
11962         fi
11963         $cat >>try.c <<'EOCP'
11964 #include <stdio.h>
11965 int main()
11966 {
11967         printf("%d\n", sizeof(VOID_PTR));
11968         exit(0);
11969 }
11970 EOCP
11971         set try
11972         if eval $compile_ok; then
11973                 ptrsize=`./try`
11974                 $echo " $ptrsize bytes." >&4
11975         else
11976                 dflt='4'
11977                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11978                 rp="What is the size of a pointer (in bytes)?"
11979                 . ./myread
11980                 ptrsize="$ans"
11981         fi
11982         ;;
11983 esac
11984 $rm -f try.c try
11985
11986 : see if ar generates random libraries by itself
11987 echo " "
11988 echo "Checking how to generate random libraries on your machine..." >&4
11989 echo 'int bar1() { return bar2(); }' > bar1.c
11990 echo 'int bar2() { return 2; }' > bar2.c
11991 $cat > foo.c <<'EOP'
11992 int main() { printf("%d\n", bar1()); exit(0); }
11993 EOP
11994 $cc $ccflags -c bar1.c >/dev/null 2>&1
11995 $cc $ccflags -c bar2.c >/dev/null 2>&1
11996 $cc $ccflags -c foo.c >/dev/null 2>&1
11997 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11998 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11999         ./foobar >/dev/null 2>&1; then
12000         echo "$ar appears to generate random libraries itself."
12001         orderlib=false
12002         ranlib=":"
12003 elif $ar ts bar$_a >/dev/null 2>&1 &&
12004         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12005         ./foobar >/dev/null 2>&1; then
12006                 echo "a table of contents needs to be added with '$ar ts'."
12007                 orderlib=false
12008                 ranlib="$ar ts"
12009 else
12010         case "$ranlib" in
12011         :) ranlib='';;
12012         '')
12013                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12014                 $test -f $ranlib || ranlib=''
12015                 ;;
12016         esac
12017         if $test -n "$ranlib"; then
12018                 echo "your system has '$ranlib'; we'll use that."
12019                 orderlib=false
12020         else
12021                 echo "your system doesn't seem to support random libraries"
12022                 echo "so we'll use lorder and tsort to order the libraries."
12023                 orderlib=true
12024                 ranlib=":"
12025         fi
12026 fi
12027 $rm -f foo* bar* 
12028
12029 : check for type of arguments to select. 
12030 case "$selecttype" in
12031 '') case "$d_select" in
12032         $define)
12033                 $cat <<EOM
12034 Checking to see what type of arguments are accepted by select().
12035 EOM
12036                 hdrs="$define sys/types.h
12037                         $i_systime sys/time.h 
12038                         $i_sysselct sys/select.h
12039                         $d_socket sys/socket.h"
12040                 : The first arg can be int, unsigned, or size_t
12041                 : The last arg may or may not be 'const'
12042                 val=''
12043                 : void pointer has been seen but using that
12044                 : breaks the selectminbits test
12045                 for xxx in 'fd_set *' 'int *'; do
12046                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12047                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12048                                         case "$val" in
12049                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12050                                                 if ./protochk "$try" $hdrs; then
12051                                                         echo "Your system accepts $xxx."
12052                                                         val="$xxx"
12053                                                 fi
12054                                                 ;;
12055                                         esac
12056                                 done
12057                         done
12058                 done
12059                 case "$val" in
12060                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12061                         case "$d_fd_set" in
12062                                 $define) dflt="fd_set *" ;;
12063                                 *)              dflt="int *" ;;
12064                         esac
12065                         . ./myread
12066                         val=$ans
12067                         ;;
12068                 esac
12069                 selecttype="$val"
12070                 ;;
12071         *)      : no select, so pick a harmless default
12072                 selecttype='int *'
12073                 ;;
12074         esac
12075         ;;
12076 esac
12077
12078 : check for the select 'width'
12079 case "$selectminbits" in
12080 '') case "$d_select" in
12081         $define)
12082                 $cat <<EOM
12083
12084 Checking to see on how many bits at a time your select() operates...
12085 EOM
12086                 $cat >try.c <<EOCP
12087 #include <sys/types.h>
12088 #$i_time I_TIME
12089 #$i_systime I_SYS_TIME
12090 #$i_systimek I_SYS_TIME_KERNEL
12091 #ifdef I_TIME
12092 #   include <time.h>
12093 #endif
12094 #ifdef I_SYS_TIME
12095 #   ifdef I_SYS_TIME_KERNEL
12096 #       define KERNEL
12097 #   endif
12098 #   include <sys/time.h>
12099 #   ifdef I_SYS_TIME_KERNEL
12100 #       undef KERNEL
12101 #   endif
12102 #endif
12103 #$i_sysselct I_SYS_SELECT
12104 #ifdef I_SYS_SELECT
12105 #include <sys/select.h>
12106 #endif
12107 #$d_socket HAS_SOCKET
12108 #ifdef HAS_SOCKET
12109 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12110 #endif
12111 #include <stdio.h>
12112 $selecttype b;
12113 #define S sizeof(*(b))
12114 #define MINBITS 64
12115 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12116 #define NBITS  (NBYTES * 8)
12117 int main() {
12118     char s[NBYTES];
12119     struct timeval t;
12120     int i;
12121     FILE* fp;
12122     int fd;
12123
12124     fclose(stdin);
12125     fp = fopen("try.c", "r");
12126     if (fp == 0)
12127       exit(1);
12128     fd = fileno(fp);
12129     if (fd < 0)
12130       exit(2);
12131     b = ($selecttype)s;
12132     for (i = 0; i < NBITS; i++)
12133         FD_SET(i, b);
12134     t.tv_sec  = 0;
12135     t.tv_usec = 0;
12136     select(fd + 1, b, 0, 0, &t);
12137     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12138     printf("%d\n", i + 1);
12139     return 0;
12140 }
12141 EOCP
12142                 set try
12143                 if eval $compile_ok; then
12144                         selectminbits=`./try`
12145                         case "$selectminbits" in
12146                         '')     cat >&4 <<EOM
12147 Cannot figure out on how many bits at a time your select() operates.
12148 I'll play safe and guess it is 32 bits.
12149 EOM
12150                                 selectminbits=32
12151                                 bits="32 bits"
12152                                 ;;
12153                         1)      bits="1 bit" ;;
12154                         *)      bits="$selectminbits bits" ;;
12155                         esac
12156                         echo "Your select() operates on $bits at a time." >&4
12157                 else
12158                         rp='What is the minimum number of bits your select() operates on?'
12159                         case "$byteorder" in
12160                         1234|12345678)  dflt=32 ;;
12161                         *)              dflt=1  ;;
12162                         esac
12163                         . ./myread
12164                         val=$ans
12165                         selectminbits="$val"
12166                 fi
12167                 $rm -f try.* try
12168                 ;;
12169         *)      : no select, so pick a harmless default
12170                 selectminbits='32'
12171                 ;;
12172         esac
12173         ;;
12174 esac
12175
12176 : Trace out the files included by signal.h, then look for SIGxxx names.
12177 : Remove SIGARRAYSIZE used by HPUX.
12178 : Remove SIGSTKSIZE used by Linux.
12179 : Remove SIGSTKSZ used by Posix.
12180 : Remove SIGTYP void lines used by OS2.
12181 xxx=`echo '#include <signal.h>' |
12182         $cppstdin $cppminus $cppflags 2>/dev/null |
12183         $grep '^[       ]*#.*include' | 
12184         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12185 : Check this list of files to be sure we have parsed the cpp output ok.
12186 : This will also avoid potentially non-existent files, such 
12187 : as ../foo/bar.h
12188 xxxfiles=''
12189 for xx in $xxx /dev/null ; do
12190         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12191 done
12192 : If we have found no files, at least try signal.h
12193 case "$xxxfiles" in
12194 '')     xxxfiles=`./findhdr signal.h` ;;
12195 esac
12196 xxx=`awk '
12197 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12198         print substr($2, 4, 20)
12199 }
12200 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12201         print substr($3, 4, 20)
12202 }' $xxxfiles`
12203 : Append some common names just in case the awk scan failed.
12204 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12205 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12206 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12207 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12208 : generate a few handy files for later
12209 $cat > signal.c <<'EOCP'
12210 #include <sys/types.h>
12211 #include <signal.h>
12212 #include <stdio.h>
12213 int main() {
12214
12215 /* Strange style to avoid deeply-nested #if/#else/#endif */
12216 #ifndef NSIG
12217 #  ifdef _NSIG
12218 #    define NSIG (_NSIG)
12219 #  endif
12220 #endif
12221
12222 #ifndef NSIG
12223 #  ifdef SIGMAX
12224 #    define NSIG (SIGMAX+1)
12225 #  endif
12226 #endif
12227
12228 #ifndef NSIG
12229 #  ifdef SIG_MAX
12230 #    define NSIG (SIG_MAX+1)
12231 #  endif
12232 #endif
12233
12234 #ifndef NSIG
12235 #  ifdef MAXSIG
12236 #    define NSIG (MAXSIG+1)
12237 #  endif
12238 #endif
12239
12240 #ifndef NSIG
12241 #  ifdef MAX_SIG
12242 #    define NSIG (MAX_SIG+1)
12243 #  endif
12244 #endif
12245
12246 #ifndef NSIG
12247 #  ifdef SIGARRAYSIZE
12248 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12249 #  endif
12250 #endif
12251
12252 #ifndef NSIG
12253 #  ifdef _sys_nsig
12254 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12255 #  endif
12256 #endif
12257
12258 /* Default to some arbitrary number that's big enough to get most
12259    of the common signals.
12260 */
12261 #ifndef NSIG
12262 #    define NSIG 50
12263 #endif
12264
12265 printf("NSIG %d\n", NSIG);
12266
12267 #ifndef JUST_NSIG
12268
12269 EOCP
12270
12271 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12272 {
12273         printf "#ifdef SIG"; printf $1; printf "\n"
12274         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12275         printf $1; printf ");\n"
12276         printf "#endif\n"
12277 }
12278 END {
12279         printf "#endif /* JUST_NSIG */\n";
12280         printf "}\n";
12281 }
12282 ' >>signal.c
12283 $cat >signal.awk <<'EOP'
12284 BEGIN { ndups = 0 }
12285 $1 ~ /^NSIG$/ { nsig = $2 }
12286 ($1 !~ /^NSIG$/) && (NF == 2) {
12287     if ($2 > maxsig) { maxsig = $2 }
12288     if (sig_name[$2]) {
12289         dup_name[ndups] = $1
12290         dup_num[ndups] = $2
12291         ndups++ 
12292     }
12293     else {
12294         sig_name[$2] = $1
12295         sig_num[$2] = $2
12296     }
12297 }
12298 END { 
12299     if (nsig == 0) {
12300         nsig = maxsig + 1
12301     }
12302     printf("NSIG %d\n", nsig);
12303     for (n = 1; n < nsig; n++) {
12304         if (sig_name[n]) {
12305             printf("%s %d\n", sig_name[n], sig_num[n])
12306         }
12307         else {
12308             printf("NUM%d %d\n", n, n) 
12309         }
12310     }
12311     for (n = 0; n < ndups; n++) {
12312         printf("%s %d\n", dup_name[n], dup_num[n])
12313     }
12314 }
12315 EOP
12316 $cat >signal_cmd <<EOS
12317 $startsh
12318 if $test -s signal.lst; then
12319     echo "Using your existing signal.lst file"
12320         exit 0
12321 fi
12322 xxx="$xxx"
12323 EOS
12324 $cat >>signal_cmd <<'EOS'
12325
12326 set signal
12327 if eval $compile_ok; then
12328         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12329 else
12330         echo "(I can't seem be able to compile the whole test program)" >&4
12331         echo "(I'll try it in little pieces.)" >&4
12332         set signal -DJUST_NSIG
12333         if eval $compile_ok; then
12334                 ./signal$_exe > signal.nsg
12335                 $cat signal.nsg
12336         else
12337                 echo "I can't seem to figure out how many signals you have." >&4
12338                 echo "Guessing 50." >&4
12339                 echo 'NSIG 50' > signal.nsg
12340         fi
12341         : Now look at all the signal names, one at a time.
12342         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12343                 $cat > signal.c <<EOCP
12344 #include <sys/types.h>
12345 #include <signal.h>
12346 #include <stdio.h>
12347 int main() {
12348 printf("$xx %d\n", SIG${xx});
12349 return 0;
12350 }
12351 EOCP
12352                 set signal
12353                 if eval $compile; then
12354                         echo "SIG${xx} found."
12355                         ./signal$_exe  >> signal.ls1
12356                 else
12357                         echo "SIG${xx} NOT found."
12358                 fi
12359         done
12360         if $test -s signal.ls1; then
12361                 $cat signal.nsg signal.ls1 |
12362                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12363         fi
12364
12365 fi
12366 if $test -s signal.lst; then
12367         :
12368 else
12369         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12370         echo 'kill -l' >signal
12371         set X `csh -f <signal`
12372         $rm -f signal
12373         shift
12374         case $# in
12375         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12376         esac
12377         echo $@ | $tr ' ' $trnl | \
12378             $awk '{ printf "%s %d\n", $1, ++s; }
12379                   END { printf "NSIG %d\n", ++s }' >signal.lst
12380 fi
12381 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12382 EOS
12383 chmod a+x signal_cmd
12384 $eunicefix signal_cmd
12385
12386 : generate list of signal names
12387 echo " "
12388 case "$sig_name_init" in
12389 '') doinit=yes ;;
12390 *)  case "$sig_num_init" in
12391     ''|*,*) doinit=yes ;;
12392     esac ;;
12393 esac
12394 case "$doinit" in
12395 yes)
12396         echo "Generating a list of signal names and numbers..." >&4
12397         . ./signal_cmd
12398         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12399         sig_name=`$awk 'BEGIN { printf "ZERO " }
12400                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12401         sig_num=`$awk  'BEGIN { printf "0 " }
12402                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12403         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12404                              !/^NSIG/   { printf "\"%s\", ", $1 }
12405                              END        { printf "0\n" }' signal.lst`
12406         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12407                              !/^NSIG/   { printf "%d, ", $2}
12408                              END        { printf "0\n"}' signal.lst`
12409         ;;
12410 esac
12411 echo "The following $sig_count signals are available:"
12412 echo " "
12413 echo $sig_name | $awk \
12414 'BEGIN { linelen = 0 }
12415 {
12416         for (i = 1; i <= NF; i++) {
12417                 name = "SIG" $i " "
12418                 linelen = linelen + length(name)
12419                 if (linelen > 70) {
12420                         printf "\n"
12421                         linelen = length(name)
12422                 }
12423                 printf "%s", name
12424         }
12425         printf "\n"
12426 }'
12427 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12428
12429 : see what type is used for signed size_t
12430 set ssize_t ssizetype int stdio.h sys/types.h
12431 eval $typedef
12432 dflt="$ssizetype"
12433 $cat > ssize.c <<EOM
12434 #include <stdio.h>
12435 #include <sys/types.h>
12436 #define Size_t $sizetype
12437 #define SSize_t $dflt
12438 int main()
12439 {
12440         if (sizeof(Size_t) == sizeof(SSize_t))
12441                 printf("$dflt\n");
12442         else if (sizeof(Size_t) == sizeof(int))
12443                 printf("int\n");
12444         else 
12445                 printf("long\n");
12446         exit(0);
12447 }
12448 EOM
12449 echo " "
12450 set ssize
12451 if eval $compile_ok && ./ssize > /dev/null; then
12452         ssizetype=`./ssize`
12453         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12454 else
12455         $cat >&4 <<EOM
12456 Help! I can't compile and run the ssize_t test program: please enlighten me!
12457 (This is probably a misconfiguration in your system or libraries, and
12458 you really ought to fix it.  Still, I'll try anyway.)
12459
12460 I need a type that is the same size as $sizetype, but is guaranteed to
12461 be signed.  Common values are ssize_t, int and long.
12462
12463 EOM
12464         rp="What signed type is the same size as $sizetype?"
12465         . ./myread
12466         ssizetype="$ans"
12467 fi
12468 $rm -f ssize ssize.*
12469
12470 : see what type of char stdio uses.
12471 echo " "
12472 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12473         echo "Your stdio uses unsigned chars." >&4
12474         stdchar="unsigned char"
12475 else
12476         echo "Your stdio uses signed chars." >&4
12477         stdchar="char"
12478 fi
12479
12480 : see if time exists
12481 echo " "
12482 if test "X$d_time" = X -o X"$timetype" = X; then
12483     if set time val -f d_time; eval $csym; $val; then
12484                 echo 'time() found.' >&4
12485                 val="$define"
12486                 rp="What is the type returned by time() on this system?"
12487                 set time_t timetype long stdio.h sys/types.h
12488                 eval $typedef_ask
12489     else
12490                 echo 'time() not found, hope that will do.' >&4
12491                 val="$undef"
12492                 timetype='int';
12493     fi
12494     set d_time
12495     eval $setvar
12496 fi
12497
12498 : see what type uids are declared as in the kernel
12499 echo " "
12500 echo "Looking for the type for user ids returned by getuid()."
12501 set uid_t uidtype xxx stdio.h sys/types.h
12502 eval $typedef
12503 case "$uidtype" in
12504 xxx)
12505         xxx=`./findhdr sys/user.h`
12506         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12507         case $1 in
12508         unsigned) dflt="$1 $2" ;;
12509         *) dflt="$1" ;;
12510         esac
12511         ;;
12512 *) dflt="$uidtype";;
12513 esac
12514 case "$uidtype" in
12515 uid_t)  echo "uid_t found." ;;
12516 *)      rp="What is the type for user ids returned by getuid()?"
12517         . ./myread
12518         uidtype="$ans"
12519         ;;
12520 esac
12521
12522 echo " "
12523 case "$uidtype" in
12524 *_t) zzz="$uidtype"     ;;
12525 *)   zzz="uid"          ;;
12526 esac
12527 echo "Checking the sign of $zzz..." >&4
12528 cat > try.c <<EOCP
12529 #include <sys/types.h>
12530 #include <stdio.h>
12531 int main() {
12532         $uidtype foo = -1;
12533         if (foo < 0)
12534                 printf("-1\n");
12535         else
12536                 printf("1\n");
12537 }
12538 EOCP
12539 set try
12540 if eval $compile; then
12541         yyy=`./try`
12542         case "$yyy" in
12543         '')     uidsign=1
12544                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12545                 ;;
12546         *)      uidsign=$yyy
12547                 case "$uidsign" in
12548                  1) echo "Your $zzz is unsigned." ;;
12549                 -1) echo "Your $zzz is signed."   ;;
12550                 esac
12551                 ;;
12552         esac
12553 else
12554         uidsign=1
12555         echo "(I can't compile the test program--guessing unsigned.)" >&4
12556 fi
12557
12558
12559 : see if dbm.h is available
12560 : see if dbmclose exists
12561 set dbmclose d_dbmclose
12562 eval $inlibc
12563
12564 case "$d_dbmclose" in
12565 $define)
12566         set dbm.h i_dbm
12567         eval $inhdr
12568         case "$i_dbm" in
12569         $define)
12570                 val="$undef"
12571                 set i_rpcsvcdbm
12572                 eval $setvar
12573                 ;;
12574         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12575                 eval $inhdr
12576                 ;;
12577         esac
12578         ;;
12579 *)      echo "We won't be including <dbm.h>"
12580         val="$undef"
12581         set i_dbm
12582         eval $setvar
12583         val="$undef"
12584         set i_rpcsvcdbm
12585         eval $setvar
12586         ;;
12587 esac
12588
12589 : see if this is a sys/file.h system
12590 val=''
12591 set sys/file.h val
12592 eval $inhdr
12593
12594 : do we need to include sys/file.h ?
12595 case "$val" in
12596 "$define")
12597         echo " "
12598         if $h_sysfile; then
12599                 val="$define"
12600                 echo "We'll be including <sys/file.h>." >&4
12601         else
12602                 val="$undef"
12603                 echo "We won't be including <sys/file.h>." >&4
12604         fi
12605         ;;
12606 *)
12607         h_sysfile=false
12608         ;;
12609 esac
12610 set i_sysfile
12611 eval $setvar
12612
12613 : see if fcntl.h is there
12614 val=''
12615 set fcntl.h val
12616 eval $inhdr
12617
12618 : see if we can include fcntl.h
12619 case "$val" in
12620 "$define")
12621         echo " "
12622         if $h_fcntl; then
12623                 val="$define"
12624                 echo "We'll be including <fcntl.h>." >&4
12625         else
12626                 val="$undef"
12627                 if $h_sysfile; then
12628         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12629                 else
12630                         echo "We won't be including <fcntl.h>." >&4
12631                 fi
12632         fi
12633         ;;
12634 *)
12635         h_fcntl=false
12636         val="$undef"
12637         ;;
12638 esac
12639 set i_fcntl
12640 eval $setvar
12641
12642 : see if locale.h is available
12643 set locale.h i_locale
12644 eval $inhdr
12645
12646 : see if mach cthreads are available
12647 if test "X$usethreads" = "X$define"; then
12648         set mach/cthreads.h i_machcthr
12649         eval $inhdr
12650 else
12651         i_machcthr="$undef"
12652 fi
12653
12654
12655
12656 : see if this is a math.h system
12657 set math.h i_math
12658 eval $inhdr
12659
12660 : see if this is a mntent.h system
12661 set mntent.h i_mntent
12662 eval $inhdr
12663
12664 : see if ndbm.h is available
12665 set ndbm.h t_ndbm
12666 eval $inhdr
12667 case "$t_ndbm" in
12668 $define)
12669         : see if dbm_open exists
12670         set dbm_open d_dbm_open
12671         eval $inlibc
12672         case "$d_dbm_open" in
12673         $undef)
12674                 t_ndbm="$undef"
12675                 echo "We won't be including <ndbm.h>"
12676                 ;;
12677         esac
12678         ;;
12679 esac
12680 val="$t_ndbm"
12681 set i_ndbm
12682 eval $setvar
12683
12684 : see if net/errno.h is available
12685 val=''
12686 set net/errno.h val
12687 eval $inhdr
12688
12689 : Unfortunately, it causes problems on some systems.  Arrgh.
12690 case "$val" in
12691 $define)
12692         cat > try.c <<'EOM'
12693 #include <stdio.h>
12694 #include <errno.h>
12695 #include <net/errno.h>
12696 int func()
12697 {
12698         return ENOTSOCK;
12699 }
12700 EOM
12701         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12702                 echo "We'll be including <net/errno.h>." >&4
12703         else
12704                 echo "We won't be including <net/errno.h>." >&4
12705                 val="$undef"
12706         fi
12707         $rm -f try.* try
12708         ;;
12709 esac
12710 set i_neterrno
12711 eval $setvar
12712
12713 : see if netinet/tcp.h is available
12714 set netinet/tcp.h i_netinettcp
12715 eval $inhdr
12716
12717 : see if this is a poll.h system
12718 set poll.h i_poll
12719 eval $inhdr
12720
12721 : get C preprocessor symbols handy
12722 echo " "
12723 $echo $n "Hmm... $c"
12724 echo $al | $tr ' ' $trnl >Cppsym.know
12725 $cat <<EOSS >Cppsym
12726 $startsh
12727 case "\$1" in
12728 -l) list=true
12729         shift
12730         ;;
12731 esac
12732 unknown=''
12733 case "\$list\$#" in
12734 1|2)
12735         for sym do
12736                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12737                         exit 0
12738                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12739                         :
12740                 else
12741                         unknown="\$unknown \$sym"
12742                 fi
12743         done
12744         set X \$unknown
12745         shift
12746         ;;
12747 esac
12748 case \$# in
12749 0) exit 1;;
12750 esac
12751 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12752 #ifdef \1\\
12753 exit 0; _ _ _ _\1\\      \1\\
12754 #endif\\
12755 /' >Cppsym\$\$
12756 echo "exit 1; _ _ _" >>Cppsym\$\$
12757 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12758 case "\$list" in
12759 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12760 *)
12761         sh Cppsym2\$\$
12762         status=\$?
12763         ;;
12764 esac
12765 $rm -f Cppsym\$\$ Cppsym2\$\$
12766 exit \$status
12767 EOSS
12768 chmod +x Cppsym
12769 $eunicefix Cppsym
12770 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12771
12772 : now check the C compiler for additional symbols
12773 postprocess_cc_v=''
12774 case "$osname" in
12775 aix) postprocess_cc_v="|$tr , ' '" ;;
12776 esac
12777 $cat >ccsym <<EOS
12778 $startsh
12779 $cat >tmp.c <<EOF
12780 extern int foo;
12781 EOF
12782 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12783 do
12784         case "\$i" in
12785         -D*) echo "\$i" | $sed 's/^-D//';;
12786         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12787         esac
12788 done
12789 $rm -f try.c
12790 EOS
12791 postprocess_cc_v=''
12792 chmod +x ccsym
12793 $eunicefix ccsym
12794 ./ccsym > ccsym1.raw
12795 if $test -s ccsym1.raw; then
12796        $sort ccsym1.raw | $uniq >ccsym.raw
12797 else
12798        mv ccsym1.raw ccsym.raw
12799 fi
12800
12801 $awk '/\=/ { print $0; next }
12802         { print $0"=1" }' ccsym.raw >ccsym.list
12803 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12804 $comm -13 ccsym.true ccsym.list >ccsym.own
12805 $comm -12 ccsym.true ccsym.list >ccsym.com
12806 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12807 also=''
12808 if $test -z ccsym.raw; then
12809         echo "Your C compiler doesn't seem to define any symbols!" >&4
12810         echo " "
12811         echo "However, your C preprocessor defines the following symbols:"
12812         $cat Cppsym.true
12813         ccsymbols=''
12814         cppsymbols=`$cat Cppsym.true`
12815         cppsymbols=`echo $cppsymbols`
12816         cppccsymbols="$cppsymbols"
12817 else
12818         if $test -s ccsym.com; then
12819                 echo "Your C compiler and pre-processor define these symbols:"
12820                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12821                 also='also '
12822                 symbols='ones'
12823                 cppccsymbols=`$cat ccsym.com`
12824                 cppccsymbols=`echo $cppccsymbols`
12825                 $test "$silent" || sleep 1
12826         fi
12827         if $test -s ccsym.cpp; then
12828                 $test "$also" && echo " "
12829                 echo "Your C pre-processor ${also}defines the following symbols:"
12830                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12831                 also='further '
12832                 cppsymbols=`$cat ccsym.cpp`
12833                 cppsymbols=`echo $cppsymbols`
12834                 $test "$silent" || sleep 1
12835         fi
12836         if $test -s ccsym.own; then
12837                 $test "$also" && echo " "
12838                 echo "Your C compiler ${also}defines the following cpp symbols:"
12839                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12840                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12841                 ccsymbols=`$cat ccsym.own`
12842                 ccsymbols=`echo $ccsymbols`
12843                 $test "$silent" || sleep 1
12844         fi
12845 fi
12846 $rm -f ccsym*
12847
12848 : see if this is a termio system
12849 val="$undef"
12850 val2="$undef"
12851 val3="$undef"
12852 if $test `./findhdr termios.h`; then
12853         set tcsetattr i_termios
12854         eval $inlibc
12855         val3="$i_termios"
12856 fi
12857 echo " "
12858 case "$val3" in
12859 "$define") echo "You have POSIX termios.h... good!" >&4;;
12860 *) if ./Cppsym pyr; then
12861                 case "`/bin/universe`" in
12862                 ucb) if $test `./findhdr sgtty.h`; then
12863                                 val2="$define"
12864                                 echo "<sgtty.h> found." >&4
12865                         else
12866                                 echo "System is pyramid with BSD universe."
12867                                 echo "<sgtty.h> not found--you could have problems." >&4
12868                         fi;;
12869                 *) if $test `./findhdr termio.h`; then
12870                                 val="$define"
12871                                 echo "<termio.h> found." >&4
12872                         else
12873                                 echo "System is pyramid with USG universe."
12874                                 echo "<termio.h> not found--you could have problems." >&4
12875                         fi;;
12876                 esac
12877         elif ./usg; then
12878                 if $test `./findhdr termio.h`; then
12879                         echo "<termio.h> found." >&4
12880                         val="$define"
12881                 elif $test `./findhdr sgtty.h`; then
12882                         echo "<sgtty.h> found." >&4
12883                         val2="$define"
12884                 else
12885 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12886                 fi
12887         else
12888                 if $test `./findhdr sgtty.h`; then
12889                         echo "<sgtty.h> found." >&4
12890                         val2="$define"
12891                 elif $test `./findhdr termio.h`; then
12892                         echo "<termio.h> found." >&4
12893                         val="$define"
12894                 else
12895 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12896                 fi
12897         fi;;
12898 esac
12899 set i_termio; eval $setvar
12900 val=$val2; set i_sgtty; eval $setvar
12901 val=$val3; set i_termios; eval $setvar
12902
12903 : see if this is a shadow.h system
12904 set shadow.h i_shadow
12905 eval $inhdr
12906
12907 : see if this is a socks.h system
12908 set socks.h i_socks
12909 eval $inhdr
12910
12911 : see if stdarg is available
12912 echo " "
12913 if $test `./findhdr stdarg.h`; then
12914         echo "<stdarg.h> found." >&4
12915         valstd="$define"
12916 else
12917         echo "<stdarg.h> NOT found." >&4
12918         valstd="$undef"
12919 fi
12920
12921 : see if varags is available
12922 echo " "
12923 if $test `./findhdr varargs.h`; then
12924         echo "<varargs.h> found." >&4
12925 else
12926         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12927 fi
12928
12929 : set up the varargs testing programs
12930 $cat > varargs.c <<EOP
12931 #ifdef I_STDARG
12932 #include <stdarg.h>
12933 #endif
12934 #ifdef I_VARARGS
12935 #include <varargs.h>
12936 #endif
12937
12938 #ifdef I_STDARG
12939 int f(char *p, ...)
12940 #else
12941 int f(va_alist)
12942 va_dcl
12943 #endif
12944 {
12945         va_list ap;
12946 #ifndef I_STDARG
12947         char *p;
12948 #endif
12949 #ifdef I_STDARG
12950         va_start(ap,p);
12951 #else
12952         va_start(ap);
12953         p = va_arg(ap, char *);
12954 #endif
12955         va_end(ap);
12956 }
12957 EOP
12958 $cat > varargs <<EOP
12959 $startsh
12960 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12961         echo "true"
12962 else
12963         echo "false"
12964 fi
12965 $rm -f varargs$_o
12966 EOP
12967 chmod +x varargs
12968
12969 : now check which varargs header should be included
12970 echo " "
12971 i_varhdr=''
12972 case "$valstd" in
12973 "$define")
12974         if `./varargs I_STDARG`; then
12975                 val='stdarg.h'
12976         elif `./varargs I_VARARGS`; then
12977                 val='varargs.h'
12978         fi
12979         ;;
12980 *)
12981         if `./varargs I_VARARGS`; then
12982                 val='varargs.h'
12983         fi
12984         ;;
12985 esac
12986 case "$val" in
12987 '')
12988 echo "I could not find the definition for va_dcl... You have problems..." >&4
12989         val="$undef"; set i_stdarg; eval $setvar
12990         val="$undef"; set i_varargs; eval $setvar
12991         ;;
12992 *) 
12993         set i_varhdr
12994         eval $setvar
12995         case "$i_varhdr" in
12996         stdarg.h)
12997                 val="$define"; set i_stdarg; eval $setvar
12998                 val="$undef"; set i_varargs; eval $setvar
12999                 ;;
13000         varargs.h)
13001                 val="$undef"; set i_stdarg; eval $setvar
13002                 val="$define"; set i_varargs; eval $setvar
13003                 ;;
13004         esac
13005         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13006 esac
13007 $rm -f varargs*
13008
13009 : see if stddef is available
13010 set stddef.h i_stddef
13011 eval $inhdr
13012
13013 : see if sys/access.h is available
13014 set sys/access.h i_sysaccess
13015 eval $inhdr
13016
13017 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13018 set sys/filio.h i_sysfilio
13019 eval $inhdr
13020 echo " "
13021 if $test `./findhdr sys/ioctl.h`; then
13022         val="$define"
13023         echo '<sys/ioctl.h> found.' >&4
13024 else
13025         val="$undef"
13026         if $test $i_sysfilio = "$define"; then
13027             echo '<sys/ioctl.h> NOT found.' >&4
13028         else
13029                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13030                 $test $i_termio = "$define" && xxx="termio.h"
13031                 $test $i_termios = "$define" && xxx="termios.h"
13032 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13033         fi
13034 fi
13035 set i_sysioctl
13036 eval $setvar
13037
13038 : see if sys/resource.h has to be included
13039 set sys/resource.h i_sysresrc
13040 eval $inhdr
13041
13042 : see if sys/security.h is available
13043 set sys/security.h i_syssecrt
13044 eval $inhdr
13045
13046 : see if this is a sys/statvfs.h system
13047 set sys/statvfs.h i_sysstatvfs
13048 eval $inhdr
13049
13050 : see if this is a sys/un.h system
13051 set sys/un.h i_sysun
13052 eval $inhdr
13053
13054 : see if this is a syswait system
13055 set sys/wait.h i_syswait
13056 eval $inhdr
13057
13058 : see if this is an utime system
13059 set utime.h i_utime
13060 eval $inhdr
13061
13062 : see if this is a values.h system
13063 set values.h i_values
13064 eval $inhdr
13065
13066 : see if this is a vfork system
13067 case "$d_vfork" in
13068 "$define")
13069         set vfork.h i_vfork
13070         eval $inhdr
13071         ;;
13072 *)
13073         i_vfork="$undef"
13074         ;;
13075 esac
13076
13077 : see if gdbm.h is available
13078 set gdbm.h t_gdbm
13079 eval $inhdr
13080 case "$t_gdbm" in
13081 $define)
13082         : see if gdbm_open exists
13083         set gdbm_open d_gdbm_open
13084         eval $inlibc
13085         case "$d_gdbm_open" in
13086         $undef)
13087                 t_gdbm="$undef"
13088                 echo "We won't be including <gdbm.h>"
13089                 ;;
13090         esac
13091         ;;
13092 esac
13093 val="$t_gdbm"
13094 set i_gdbm
13095 eval $setvar
13096
13097 echo " "
13098 echo "Looking for extensions..." >&4
13099 : If we are using the old config.sh, known_extensions may contain
13100 : old or inaccurate or duplicate values.
13101 known_extensions=''
13102 nonxs_extensions=''
13103 : We do not use find because it might not be available.
13104 : We do not just use MANIFEST because the user may have dropped
13105 : some additional extensions into the source tree and expect them
13106 : to be built.
13107
13108 : Function to recursively find available extensions, ignoring DynaLoader
13109 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13110 find_extensions='
13111     for xxx in *; do
13112        case "$xxx" in
13113            DynaLoader|dynaload) ;;
13114            *)
13115            if $test -f $xxx/$xxx.xs; then
13116                known_extensions="$known_extensions $1$xxx";
13117            elif $test -f $xxx/Makefile.PL; then
13118                nonxs_extensions="$nonxs_extensions $1$xxx";
13119            else
13120                if $test -d $xxx -a $# -lt 10; then
13121                    set $1$xxx/ $*;
13122                    cd $xxx;
13123                    eval $find_extensions;
13124                    cd ..;
13125                    shift;
13126                fi;
13127            fi
13128            ;;
13129        esac;
13130     done'
13131 tdir=`pwd`
13132 cd $rsrc/ext
13133 set X
13134 shift
13135 eval $find_extensions
13136 set X $nonxs_extensions
13137 shift
13138 nonxs_extensions="$*"
13139 set X $known_extensions
13140 shift
13141 known_extensions="$*"
13142 cd $tdir
13143
13144 : Now see which are supported on this system.
13145 avail_ext=''
13146 for xxx in $known_extensions ; do
13147         case "$xxx" in
13148         DB_File|db_file)
13149                 case "$i_db" in
13150                 $define) avail_ext="$avail_ext $xxx" ;;
13151                 esac
13152                 ;;
13153         GDBM_File|gdbm_fil)
13154                 case "$i_gdbm" in 
13155                 $define) avail_ext="$avail_ext $xxx" ;;
13156                 esac
13157                 ;;
13158         NDBM_File|ndbm_fil)
13159                 case "$i_ndbm" in
13160                 $define) avail_ext="$avail_ext $xxx" ;;
13161                 esac
13162                 ;;
13163         ODBM_File|odbm_fil) 
13164                 case "${i_dbm}${i_rpcsvcdbm}" in
13165                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13166                 esac
13167                 ;;
13168         POSIX|posix)
13169                 case "$useposix" in
13170                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13171                 esac
13172                 ;;
13173         Opcode|opcode)
13174                 case "$useopcode" in
13175                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13176                 esac
13177                 ;;
13178         Socket|socket)
13179                 case "$d_socket" in 
13180                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13181                 esac
13182                 ;;
13183         Thread|thread)
13184                 case "$usethreads" in 
13185                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13186                 esac
13187                 ;;
13188         IPC/SysV|ipc/sysv)
13189                 : XXX Do we need a useipcsysv variable here
13190                 case "${d_msg}${d_sem}${d_shm}" in 
13191                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13192                 esac
13193                 ;;
13194         *)      avail_ext="$avail_ext $xxx"
13195                 ;;
13196         esac
13197 done
13198
13199 set X $avail_ext
13200 shift
13201 avail_ext="$*"
13202
13203 : Now see which nonxs extensions are supported on this system.
13204 : For now assume all are.
13205 nonxs_ext=''
13206 for xxx in $nonxs_extensions ; do
13207         case "$xxx" in
13208         *)      nonxs_ext="$nonxs_ext $xxx"
13209                 ;;
13210         esac
13211 done
13212
13213 set X $nonxs_ext
13214 shift
13215 nonxs_ext="$*"
13216
13217 case $usedl in
13218 $define)
13219         $cat <<EOM
13220 A number of extensions are supplied with $package.  You may choose to
13221 compile these extensions for dynamic loading (the default), compile
13222 them into the $package executable (static loading), or not include
13223 them at all.  Answer "none" to include no extensions.
13224 Note that DynaLoader is always built and need not be mentioned here.
13225
13226 EOM
13227         case "$dynamic_ext" in
13228         '') dflt="$avail_ext" ;;
13229         *)      dflt="$dynamic_ext"
13230                 # Perhaps we are reusing an old out-of-date config.sh.
13231                 case "$hint" in
13232                 previous)
13233                         if test X"$dynamic_ext" != X"$avail_ext"; then
13234                                 $cat <<EOM
13235 NOTICE:  Your previous config.sh list may be incorrect. 
13236 The extensions now available to you are 
13237         ${avail_ext}
13238 but the default list from your previous config.sh is
13239         ${dynamic_ext} 
13240
13241 EOM
13242                         fi
13243                         ;;
13244                 esac
13245                 ;;
13246         esac
13247         case "$dflt" in
13248         '')     dflt=none;;
13249         esac
13250         rp="What extensions do you wish to load dynamically?"
13251         . ./myread
13252         case "$ans" in
13253         none) dynamic_ext=' ' ;;
13254         *) dynamic_ext="$ans" ;;
13255         esac
13256
13257         case "$static_ext" in
13258         '')
13259                 : Exclude those already listed in dynamic linking
13260                 dflt=''
13261                 for xxx in $avail_ext; do
13262                         case " $dynamic_ext " in
13263                         *" $xxx "*) ;;
13264                         *) dflt="$dflt $xxx" ;;
13265                         esac
13266                 done
13267                 set X $dflt
13268                 shift
13269                 dflt="$*"
13270                 ;;
13271         *)  dflt="$static_ext" 
13272                 ;;
13273         esac
13274
13275         case "$dflt" in
13276         '')     dflt=none;;
13277         esac
13278         rp="What extensions do you wish to load statically?"
13279         . ./myread
13280         case "$ans" in
13281         none) static_ext=' ' ;;
13282         *) static_ext="$ans" ;;
13283         esac
13284         ;;
13285 *)
13286         $cat <<EOM
13287 A number of extensions are supplied with $package.  Answer "none" 
13288 to include no extensions. 
13289 Note that DynaLoader is always built and need not be mentioned here.
13290
13291 EOM
13292         case "$static_ext" in
13293         '') dflt="$avail_ext" ;;
13294         *)      dflt="$static_ext"
13295                 # Perhaps we are reusing an old out-of-date config.sh.
13296                 case "$hint" in
13297                 previous)
13298                         if test X"$static_ext" != X"$avail_ext"; then
13299                                 $cat <<EOM
13300 NOTICE:  Your previous config.sh list may be incorrect. 
13301 The extensions now available to you are 
13302         ${avail_ext}
13303 but the default list from your previous config.sh is
13304         ${static_ext} 
13305
13306 EOM
13307                         fi
13308                         ;;
13309                 esac
13310                 ;;
13311         esac
13312         : Exclude those that are not xs extensions
13313         case "$dflt" in
13314         '')     dflt=none;;
13315         esac
13316         rp="What extensions do you wish to include?"
13317         . ./myread
13318         case "$ans" in
13319         none) static_ext=' ' ;;
13320         *) static_ext="$ans" ;;
13321         esac
13322         ;;
13323 esac
13324
13325 set X $dynamic_ext $static_ext $nonxs_ext
13326 shift
13327 extensions="$*"
13328
13329 : Remove build directory name from cppstdin so it can be used from
13330 : either the present location or the final installed location.
13331 echo " "
13332 : Get out of the UU directory to get correct path name.
13333 cd ..
13334 case "$cppstdin" in
13335 `pwd`/cppstdin)
13336         echo "Stripping down cppstdin path name"
13337         cppstdin=cppstdin
13338         ;;
13339 esac
13340 cd UU
13341
13342 : end of configuration questions
13343 echo " "
13344 echo "End of configuration questions."
13345 echo " "
13346
13347 : back to where it started
13348 if test -d ../UU; then
13349         cd ..
13350 fi
13351
13352 : configuration may be patched via a 'config.over' file
13353 if $test -f config.over; then
13354         echo " "
13355         dflt=y
13356         rp='I see a config.over file.  Do you wish to load it?'
13357         . UU/myread
13358         case "$ans" in
13359         n*) echo "OK, I'll ignore it.";;
13360         *)      . ./config.over
13361                 echo "Configuration override changes have been loaded."
13362                 ;;
13363         esac
13364 fi
13365
13366 : in case they want portability, strip down executable paths
13367 case "$d_portable" in
13368 "$define")
13369         echo " "
13370         echo "Stripping down executable paths..." >&4
13371         for file in $loclist $trylist; do
13372                 eval temp=\$$file
13373                 eval $file=`basename $temp`
13374         done
13375         ;;
13376 esac
13377
13378 : create config.sh file
13379 echo " "
13380 echo "Creating config.sh..." >&4
13381 $spitshell <<EOT >config.sh
13382 $startsh
13383 #
13384 # This file was produced by running the Configure script. It holds all the
13385 # definitions figured out by Configure. Should you modify one of these values,
13386 # do not forget to propagate your changes by running "Configure -der". You may
13387 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13388 #
13389
13390 # Package name      : $package
13391 # Source directory  : $src
13392 # Configuration time: $cf_time
13393 # Configured by     : $cf_by
13394 # Target system     : $myuname
13395
13396 Author='$Author'
13397 Date='$Date'
13398 Header='$Header'
13399 Id='$Id'
13400 Locker='$Locker'
13401 Log='$Log'
13402 Mcc='$Mcc'
13403 RCSfile='$RCSfile'
13404 Revision='$Revision'
13405 Source='$Source'
13406 State='$State'
13407 _a='$_a'
13408 _exe='$_exe'
13409 _o='$_o'
13410 afs='$afs'
13411 alignbytes='$alignbytes'
13412 ansi2knr='$ansi2knr'
13413 aphostname='$aphostname'
13414 apiversion='$apiversion'
13415 ar='$ar'
13416 archlib='$archlib'
13417 archlibexp='$archlibexp'
13418 archname64='$archname64'
13419 archname='$archname'
13420 archobjs='$archobjs'
13421 awk='$awk'
13422 baserev='$baserev'
13423 bash='$bash'
13424 bin='$bin'
13425 bincompat5005='$bincompat5005'
13426 binexp='$binexp'
13427 bison='$bison'
13428 byacc='$byacc'
13429 byteorder='$byteorder'
13430 c='$c'
13431 castflags='$castflags'
13432 cat='$cat'
13433 cc='$cc'
13434 cccdlflags='$cccdlflags'
13435 ccdlflags='$ccdlflags'
13436 ccflags='$ccflags'
13437 ccsymbols='$ccsymbols'
13438 cf_by='$cf_by'
13439 cf_email='$cf_email'
13440 cf_time='$cf_time'
13441 chgrp='$chgrp'
13442 chmod='$chmod'
13443 chown='$chown'
13444 clocktype='$clocktype'
13445 comm='$comm'
13446 compress='$compress'
13447 contains='$contains'
13448 cp='$cp'
13449 cpio='$cpio'
13450 cpp='$cpp'
13451 cpp_stuff='$cpp_stuff'
13452 cppccsymbols='$cppccsymbols'
13453 cppflags='$cppflags'
13454 cpplast='$cpplast'
13455 cppminus='$cppminus'
13456 cpprun='$cpprun'
13457 cppstdin='$cppstdin'
13458 cppsymbols='$cppsymbols'
13459 crosscompile='$crosscompile'
13460 cryptlib='$cryptlib'
13461 csh='$csh'
13462 d_Gconvert='$d_Gconvert'
13463 d_PRIEldbl='$d_PRIEldbl'
13464 d_PRIFldbl='$d_PRIFldbl'
13465 d_PRIGldbl='$d_PRIGldbl'
13466 d_PRIX64='$d_PRIX64'
13467 d_PRId64='$d_PRId64'
13468 d_PRIeldbl='$d_PRIeldbl'
13469 d_PRIfldbl='$d_PRIfldbl'
13470 d_PRIgldbl='$d_PRIgldbl'
13471 d_PRIi64='$d_PRIi64'
13472 d_PRIo64='$d_PRIo64'
13473 d_PRIu64='$d_PRIu64'
13474 d_PRIx64='$d_PRIx64'
13475 d_access='$d_access'
13476 d_accessx='$d_accessx'
13477 d_alarm='$d_alarm'
13478 d_archlib='$d_archlib'
13479 d_atolf='$d_atolf'
13480 d_atoll='$d_atoll'
13481 d_attribut='$d_attribut'
13482 d_bcmp='$d_bcmp'
13483 d_bcopy='$d_bcopy'
13484 d_bincompat5005='$d_bincompat5005'
13485 d_bsd='$d_bsd'
13486 d_bsdgetpgrp='$d_bsdgetpgrp'
13487 d_bsdsetpgrp='$d_bsdsetpgrp'
13488 d_bzero='$d_bzero'
13489 d_casti32='$d_casti32'
13490 d_castneg='$d_castneg'
13491 d_charvspr='$d_charvspr'
13492 d_chown='$d_chown'
13493 d_chroot='$d_chroot'
13494 d_chsize='$d_chsize'
13495 d_closedir='$d_closedir'
13496 d_cmsghdr_s='$d_cmsghdr_s'
13497 d_const='$d_const'
13498 d_crypt='$d_crypt'
13499 d_csh='$d_csh'
13500 d_cuserid='$d_cuserid'
13501 d_dbl_dig='$d_dbl_dig'
13502 d_difftime='$d_difftime'
13503 d_dirnamlen='$d_dirnamlen'
13504 d_dlerror='$d_dlerror'
13505 d_dlopen='$d_dlopen'
13506 d_dlsymun='$d_dlsymun'
13507 d_dosuid='$d_dosuid'
13508 d_drand48proto='$d_drand48proto'
13509 d_dup2='$d_dup2'
13510 d_eaccess='$d_eaccess'
13511 d_endgrent='$d_endgrent'
13512 d_endhent='$d_endhent'
13513 d_endnent='$d_endnent'
13514 d_endpent='$d_endpent'
13515 d_endpwent='$d_endpwent'
13516 d_endsent='$d_endsent'
13517 d_endspent='$d_endspent'
13518 d_eofnblk='$d_eofnblk'
13519 d_eunice='$d_eunice'
13520 d_fchmod='$d_fchmod'
13521 d_fchown='$d_fchown'
13522 d_fcntl='$d_fcntl'
13523 d_fd_macros='$d_fd_macros'
13524 d_fd_set='$d_fd_set'
13525 d_fds_bits='$d_fds_bits'
13526 d_fgetpos='$d_fgetpos'
13527 d_flexfnam='$d_flexfnam'
13528 d_flock='$d_flock'
13529 d_fork='$d_fork'
13530 d_fpathconf='$d_fpathconf'
13531 d_fpos64_t='$d_fpos64_t'
13532 d_fseeko='$d_fseeko'
13533 d_fsetpos='$d_fsetpos'
13534 d_fstatfs='$d_fstatfs'
13535 d_fstatvfs='$d_fstatvfs'
13536 d_ftello='$d_ftello'
13537 d_ftime='$d_ftime'
13538 d_getgrent='$d_getgrent'
13539 d_getgrps='$d_getgrps'
13540 d_gethbyaddr='$d_gethbyaddr'
13541 d_gethbyname='$d_gethbyname'
13542 d_gethent='$d_gethent'
13543 d_gethname='$d_gethname'
13544 d_gethostprotos='$d_gethostprotos'
13545 d_getlogin='$d_getlogin'
13546 d_getmntent='$d_getmntent'
13547 d_getnbyaddr='$d_getnbyaddr'
13548 d_getnbyname='$d_getnbyname'
13549 d_getnent='$d_getnent'
13550 d_getnetprotos='$d_getnetprotos'
13551 d_getpbyname='$d_getpbyname'
13552 d_getpbynumber='$d_getpbynumber'
13553 d_getpent='$d_getpent'
13554 d_getpgid='$d_getpgid'
13555 d_getpgrp2='$d_getpgrp2'
13556 d_getpgrp='$d_getpgrp'
13557 d_getppid='$d_getppid'
13558 d_getprior='$d_getprior'
13559 d_getprotoprotos='$d_getprotoprotos'
13560 d_getpwent='$d_getpwent'
13561 d_getsbyname='$d_getsbyname'
13562 d_getsbyport='$d_getsbyport'
13563 d_getsent='$d_getsent'
13564 d_getservprotos='$d_getservprotos'
13565 d_getspent='$d_getspent'
13566 d_getspnam='$d_getspnam'
13567 d_gettimeod='$d_gettimeod'
13568 d_gnulibc='$d_gnulibc'
13569 d_grpasswd='$d_grpasswd'
13570 d_hasmntopt='$d_hasmntopt'
13571 d_htonl='$d_htonl'
13572 d_index='$d_index'
13573 d_inetaton='$d_inetaton'
13574 d_int64t='$d_int64t'
13575 d_iovec_s='$d_iovec_s'
13576 d_isascii='$d_isascii'
13577 d_killpg='$d_killpg'
13578 d_lchown='$d_lchown'
13579 d_ldbl_dig='$d_ldbl_dig'
13580 d_link='$d_link'
13581 d_llseek='$d_llseek'
13582 d_locconv='$d_locconv'
13583 d_lockf='$d_lockf'
13584 d_longdbl='$d_longdbl'
13585 d_longlong='$d_longlong'
13586 d_lstat='$d_lstat'
13587 d_madvise='$d_madvise'
13588 d_mblen='$d_mblen'
13589 d_mbstowcs='$d_mbstowcs'
13590 d_mbtowc='$d_mbtowc'
13591 d_memchr='$d_memchr'
13592 d_memcmp='$d_memcmp'
13593 d_memcpy='$d_memcpy'
13594 d_memmove='$d_memmove'
13595 d_memset='$d_memset'
13596 d_mkdir='$d_mkdir'
13597 d_mkfifo='$d_mkfifo'
13598 d_mktime='$d_mktime'
13599 d_mmap='$d_mmap'
13600 d_mprotect='$d_mprotect'
13601 d_msg='$d_msg'
13602 d_msg_ctrunc='$d_msg_ctrunc'
13603 d_msg_dontroute='$d_msg_dontroute'
13604 d_msg_oob='$d_msg_oob'
13605 d_msg_peek='$d_msg_peek'
13606 d_msg_proxy='$d_msg_proxy'
13607 d_msgctl='$d_msgctl'
13608 d_msgget='$d_msgget'
13609 d_msghdr_s='$d_msghdr_s'
13610 d_msgrcv='$d_msgrcv'
13611 d_msgsnd='$d_msgsnd'
13612 d_msync='$d_msync'
13613 d_munmap='$d_munmap'
13614 d_mymalloc='$d_mymalloc'
13615 d_nice='$d_nice'
13616 d_off64_t='$d_off64_t'
13617 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13618 d_oldpthreads='$d_oldpthreads'
13619 d_oldsock='$d_oldsock'
13620 d_open3='$d_open3'
13621 d_pathconf='$d_pathconf'
13622 d_pause='$d_pause'
13623 d_phostname='$d_phostname'
13624 d_pipe='$d_pipe'
13625 d_poll='$d_poll'
13626 d_portable='$d_portable'
13627 d_pthread_yield='$d_pthread_yield'
13628 d_pwage='$d_pwage'
13629 d_pwchange='$d_pwchange'
13630 d_pwclass='$d_pwclass'
13631 d_pwcomment='$d_pwcomment'
13632 d_pwexpire='$d_pwexpire'
13633 d_pwgecos='$d_pwgecos'
13634 d_pwpasswd='$d_pwpasswd'
13635 d_pwquota='$d_pwquota'
13636 d_readdir='$d_readdir'
13637 d_readlink='$d_readlink'
13638 d_readv='$d_readv'
13639 d_recvmsg='$d_recvmsg'
13640 d_rename='$d_rename'
13641 d_rewinddir='$d_rewinddir'
13642 d_rmdir='$d_rmdir'
13643 d_safebcpy='$d_safebcpy'
13644 d_safemcpy='$d_safemcpy'
13645 d_sanemcmp='$d_sanemcmp'
13646 d_sched_yield='$d_sched_yield'
13647 d_scm_rights='$d_scm_rights'
13648 d_seekdir='$d_seekdir'
13649 d_select='$d_select'
13650 d_sem='$d_sem'
13651 d_semctl='$d_semctl'
13652 d_semctl_semid_ds='$d_semctl_semid_ds'
13653 d_semctl_semun='$d_semctl_semun'
13654 d_semget='$d_semget'
13655 d_semop='$d_semop'
13656 d_sendmsg='$d_sendmsg'
13657 d_setegid='$d_setegid'
13658 d_seteuid='$d_seteuid'
13659 d_setgrent='$d_setgrent'
13660 d_setgrps='$d_setgrps'
13661 d_sethent='$d_sethent'
13662 d_setlinebuf='$d_setlinebuf'
13663 d_setlocale='$d_setlocale'
13664 d_setnent='$d_setnent'
13665 d_setpent='$d_setpent'
13666 d_setpgid='$d_setpgid'
13667 d_setpgrp2='$d_setpgrp2'
13668 d_setpgrp='$d_setpgrp'
13669 d_setprior='$d_setprior'
13670 d_setpwent='$d_setpwent'
13671 d_setregid='$d_setregid'
13672 d_setresgid='$d_setresgid'
13673 d_setresuid='$d_setresuid'
13674 d_setreuid='$d_setreuid'
13675 d_setrgid='$d_setrgid'
13676 d_setruid='$d_setruid'
13677 d_setsent='$d_setsent'
13678 d_setsid='$d_setsid'
13679 d_setspent='$d_setspent'
13680 d_setvbuf='$d_setvbuf'
13681 d_sfio='$d_sfio'
13682 d_shm='$d_shm'
13683 d_shmat='$d_shmat'
13684 d_shmatprototype='$d_shmatprototype'
13685 d_shmctl='$d_shmctl'
13686 d_shmdt='$d_shmdt'
13687 d_shmget='$d_shmget'
13688 d_sigaction='$d_sigaction'
13689 d_sigsetjmp='$d_sigsetjmp'
13690 d_socket='$d_socket'
13691 d_sockpair='$d_sockpair'
13692 d_statblks='$d_statblks'
13693 d_statfs='$d_statfs'
13694 d_statfsflags='$d_statfsflags'
13695 d_statvfs='$d_statvfs'
13696 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13697 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13698 d_stdio_stream_array='$d_stdio_stream_array'
13699 d_stdiobase='$d_stdiobase'
13700 d_stdstdio='$d_stdstdio'
13701 d_strchr='$d_strchr'
13702 d_strcoll='$d_strcoll'
13703 d_strctcpy='$d_strctcpy'
13704 d_strerrm='$d_strerrm'
13705 d_strerror='$d_strerror'
13706 d_strtod='$d_strtod'
13707 d_strtol='$d_strtol'
13708 d_strtoul='$d_strtoul'
13709 d_strtoull='$d_strtoull'
13710 d_strxfrm='$d_strxfrm'
13711 d_suidsafe='$d_suidsafe'
13712 d_symlink='$d_symlink'
13713 d_syscall='$d_syscall'
13714 d_sysconf='$d_sysconf'
13715 d_sysernlst='$d_sysernlst'
13716 d_syserrlst='$d_syserrlst'
13717 d_system='$d_system'
13718 d_tcgetpgrp='$d_tcgetpgrp'
13719 d_tcsetpgrp='$d_tcsetpgrp'
13720 d_telldir='$d_telldir'
13721 d_telldirproto='$d_telldirproto'
13722 d_time='$d_time'
13723 d_times='$d_times'
13724 d_truncate='$d_truncate'
13725 d_tzname='$d_tzname'
13726 d_umask='$d_umask'
13727 d_uname='$d_uname'
13728 d_union_semun='$d_union_semun'
13729 d_vendorlib='$d_vendorlib'
13730 d_vfork='$d_vfork'
13731 d_void_closedir='$d_void_closedir'
13732 d_voidsig='$d_voidsig'
13733 d_voidtty='$d_voidtty'
13734 d_volatile='$d_volatile'
13735 d_vprintf='$d_vprintf'
13736 d_wait4='$d_wait4'
13737 d_waitpid='$d_waitpid'
13738 d_wcstombs='$d_wcstombs'
13739 d_wctomb='$d_wctomb'
13740 d_writev='$d_writev'
13741 d_xenix='$d_xenix'
13742 date='$date'
13743 db_hashtype='$db_hashtype'
13744 db_prefixtype='$db_prefixtype'
13745 defvoidused='$defvoidused'
13746 direntrytype='$direntrytype'
13747 dlext='$dlext'
13748 dlsrc='$dlsrc'
13749 doublesize='$doublesize'
13750 drand01='$drand01'
13751 dynamic_ext='$dynamic_ext'
13752 eagain='$eagain'
13753 ebcdic='$ebcdic'
13754 echo='$echo'
13755 egrep='$egrep'
13756 emacs='$emacs'
13757 eunicefix='$eunicefix'
13758 exe_ext='$exe_ext'
13759 expr='$expr'
13760 extensions='$extensions'
13761 fflushNULL='$fflushNULL'
13762 fflushall='$fflushall'
13763 find='$find'
13764 firstmakefile='$firstmakefile'
13765 flex='$flex'
13766 fpostype='$fpostype'
13767 freetype='$freetype'
13768 full_ar='$full_ar'
13769 full_csh='$full_csh'
13770 full_sed='$full_sed'
13771 gccversion='$gccversion'
13772 gidtype='$gidtype'
13773 glibpth='$glibpth'
13774 grep='$grep'
13775 groupcat='$groupcat'
13776 groupstype='$groupstype'
13777 gzip='$gzip'
13778 h_fcntl='$h_fcntl'
13779 h_sysfile='$h_sysfile'
13780 hint='$hint'
13781 hostcat='$hostcat'
13782 huge='$huge'
13783 i_arpainet='$i_arpainet'
13784 i_bsdioctl='$i_bsdioctl'
13785 i_db='$i_db'
13786 i_dbm='$i_dbm'
13787 i_dirent='$i_dirent'
13788 i_dld='$i_dld'
13789 i_dlfcn='$i_dlfcn'
13790 i_fcntl='$i_fcntl'
13791 i_float='$i_float'
13792 i_gdbm='$i_gdbm'
13793 i_grp='$i_grp'
13794 i_inttypes='$i_inttypes'
13795 i_limits='$i_limits'
13796 i_locale='$i_locale'
13797 i_machcthr='$i_machcthr'
13798 i_malloc='$i_malloc'
13799 i_math='$i_math'
13800 i_memory='$i_memory'
13801 i_mntent='$i_mntent'
13802 i_ndbm='$i_ndbm'
13803 i_netdb='$i_netdb'
13804 i_neterrno='$i_neterrno'
13805 i_netinettcp='$i_netinettcp'
13806 i_niin='$i_niin'
13807 i_poll='$i_poll'
13808 i_pthread='$i_pthread'
13809 i_pwd='$i_pwd'
13810 i_rpcsvcdbm='$i_rpcsvcdbm'
13811 i_sfio='$i_sfio'
13812 i_sgtty='$i_sgtty'
13813 i_shadow='$i_shadow'
13814 i_socks='$i_socks'
13815 i_stdarg='$i_stdarg'
13816 i_stddef='$i_stddef'
13817 i_stdlib='$i_stdlib'
13818 i_string='$i_string'
13819 i_sysaccess='$i_sysaccess'
13820 i_sysdir='$i_sysdir'
13821 i_sysfile='$i_sysfile'
13822 i_sysfilio='$i_sysfilio'
13823 i_sysin='$i_sysin'
13824 i_sysioctl='$i_sysioctl'
13825 i_sysmman='$i_sysmman'
13826 i_sysmount='$i_sysmount'
13827 i_sysndir='$i_sysndir'
13828 i_sysparam='$i_sysparam'
13829 i_sysresrc='$i_sysresrc'
13830 i_syssecrt='$i_syssecrt'
13831 i_sysselct='$i_sysselct'
13832 i_syssockio='$i_syssockio'
13833 i_sysstat='$i_sysstat'
13834 i_sysstatvfs='$i_sysstatvfs'
13835 i_systime='$i_systime'
13836 i_systimek='$i_systimek'
13837 i_systimes='$i_systimes'
13838 i_systypes='$i_systypes'
13839 i_sysuio='$i_sysuio'
13840 i_sysun='$i_sysun'
13841 i_syswait='$i_syswait'
13842 i_termio='$i_termio'
13843 i_termios='$i_termios'
13844 i_time='$i_time'
13845 i_unistd='$i_unistd'
13846 i_utime='$i_utime'
13847 i_values='$i_values'
13848 i_varargs='$i_varargs'
13849 i_varhdr='$i_varhdr'
13850 i_vfork='$i_vfork'
13851 ignore_versioned_solibs='$ignore_versioned_solibs'
13852 incpath='$incpath'
13853 inews='$inews'
13854 installarchlib='$installarchlib'
13855 installbin='$installbin'
13856 installman1dir='$installman1dir'
13857 installman3dir='$installman3dir'
13858 installprefix='$installprefix'
13859 installprefixexp='$installprefixexp'
13860 installprivlib='$installprivlib'
13861 installscript='$installscript'
13862 installsitearch='$installsitearch'
13863 installsitelib='$installsitelib'
13864 installstyle='$installstyle'
13865 installusrbinperl='$installusrbinperl'
13866 installvendorlib='$installvendorlib'
13867 intsize='$intsize'
13868 known_extensions='$known_extensions'
13869 ksh='$ksh'
13870 large='$large'
13871 ld='$ld'
13872 lddlflags='$lddlflags'
13873 ldflags='$ldflags'
13874 ldlibpthname='$ldlibpthname'
13875 less='$less'
13876 lib_ext='$lib_ext'
13877 libc='$libc'
13878 libperl='$libperl'
13879 libpth='$libpth'
13880 libs='$libs'
13881 libswanted='$libswanted'
13882 line='$line'
13883 lint='$lint'
13884 lkflags='$lkflags'
13885 ln='$ln'
13886 lns='$lns'
13887 locincpth='$locincpth'
13888 loclibpth='$loclibpth'
13889 longdblsize='$longdblsize'
13890 longlongsize='$longlongsize'
13891 longsize='$longsize'
13892 lp='$lp'
13893 lpr='$lpr'
13894 ls='$ls'
13895 lseeksize='$lseeksize'
13896 lseektype='$lseektype'
13897 mail='$mail'
13898 mailx='$mailx'
13899 make='$make'
13900 make_set_make='$make_set_make'
13901 mallocobj='$mallocobj'
13902 mallocsrc='$mallocsrc'
13903 malloctype='$malloctype'
13904 man1dir='$man1dir'
13905 man1direxp='$man1direxp'
13906 man1ext='$man1ext'
13907 man3dir='$man3dir'
13908 man3direxp='$man3direxp'
13909 man3ext='$man3ext'
13910 medium='$medium'
13911 mips='$mips'
13912 mips_type='$mips_type'
13913 mkdir='$mkdir'
13914 mmaptype='$mmaptype'
13915 models='$models'
13916 modetype='$modetype'
13917 more='$more'
13918 multiarch='$multiarch'
13919 mv='$mv'
13920 myarchname='$myarchname'
13921 mydomain='$mydomain'
13922 myhostname='$myhostname'
13923 myuname='$myuname'
13924 n='$n'
13925 netdb_hlen_type='$netdb_hlen_type'
13926 netdb_host_type='$netdb_host_type'
13927 netdb_name_type='$netdb_name_type'
13928 netdb_net_type='$netdb_net_type'
13929 nm='$nm'
13930 nm_opt='$nm_opt'
13931 nm_so_opt='$nm_so_opt'
13932 nonxs_ext='$nonxs_ext'
13933 nroff='$nroff'
13934 o_nonblock='$o_nonblock'
13935 obj_ext='$obj_ext'
13936 old_pthread_create_joinable='$old_pthread_create_joinable'
13937 optimize='$optimize'
13938 orderlib='$orderlib'
13939 osname='$osname'
13940 osvers='$osvers'
13941 package='$package'
13942 pager='$pager'
13943 passcat='$passcat'
13944 patchlevel='$patchlevel'
13945 path_sep='$path_sep'
13946 perl='$perl'
13947 perladmin='$perladmin'
13948 perlpath='$perlpath'
13949 pg='$pg'
13950 phostname='$phostname'
13951 pidtype='$pidtype'
13952 plibpth='$plibpth'
13953 pm_apiversion='$pm_apiversion'
13954 pmake='$pmake'
13955 pr='$pr'
13956 prefix='$prefix'
13957 prefixexp='$prefixexp'
13958 privlib='$privlib'
13959 privlibexp='$privlibexp'
13960 prototype='$prototype'
13961 ptrsize='$ptrsize'
13962 randbits='$randbits'
13963 randfunc='$randfunc'
13964 randseedtype='$randseedtype'
13965 ranlib='$ranlib'
13966 rd_nodata='$rd_nodata'
13967 rm='$rm'
13968 rmail='$rmail'
13969 runnm='$runnm'
13970 sPRIEldbl='$sPRIEldbl'
13971 sPRIFldbl='$sPRIFldbl'
13972 sPRIGldbl='$sPRIGldbl'
13973 sPRIX64='$sPRIX64'
13974 sPRId64='$sPRId64'
13975 sPRIeldbl='$sPRIeldbl'
13976 sPRIfldbl='$sPRIfldbl'
13977 sPRIgldbl='$sPRIgldbl'
13978 sPRIi64='$sPRIi64'
13979 sPRIo64='$sPRIo64'
13980 sPRIu64='$sPRIu64'
13981 sPRIx64='$sPRIx64'
13982 sched_yield='$sched_yield'
13983 scriptdir='$scriptdir'
13984 scriptdirexp='$scriptdirexp'
13985 sed='$sed'
13986 seedfunc='$seedfunc'
13987 selectminbits='$selectminbits'
13988 selecttype='$selecttype'
13989 sendmail='$sendmail'
13990 sh='$sh'
13991 shar='$shar'
13992 sharpbang='$sharpbang'
13993 shmattype='$shmattype'
13994 shortsize='$shortsize'
13995 shrpenv='$shrpenv'
13996 shsharp='$shsharp'
13997 sig_count='$sig_count'
13998 sig_name='$sig_name'
13999 sig_name_init='$sig_name_init'
14000 sig_num='$sig_num'
14001 sig_num_init='$sig_num_init'
14002 signal_t='$signal_t'
14003 sitearch='$sitearch'
14004 sitearchexp='$sitearchexp'
14005 sitelib='$sitelib'
14006 sitelibexp='$sitelibexp'
14007 siteprefix='$siteprefix'
14008 siteprefixexp='$siteprefixexp'
14009 sizetype='$sizetype'
14010 sleep='$sleep'
14011 smail='$smail'
14012 small='$small'
14013 so='$so'
14014 sockethdr='$sockethdr'
14015 socketlib='$socketlib'
14016 sort='$sort'
14017 spackage='$spackage'
14018 spitshell='$spitshell'
14019 split='$split'
14020 src='$src'
14021 ssizetype='$ssizetype'
14022 startperl='$startperl'
14023 startsh='$startsh'
14024 static_ext='$static_ext'
14025 stdchar='$stdchar'
14026 stdio_base='$stdio_base'
14027 stdio_bufsiz='$stdio_bufsiz'
14028 stdio_cnt='$stdio_cnt'
14029 stdio_filbuf='$stdio_filbuf'
14030 stdio_ptr='$stdio_ptr'
14031 stdio_stream_array='$stdio_stream_array'
14032 strings='$strings'
14033 submit='$submit'
14034 subversion='$subversion'
14035 sysman='$sysman'
14036 tail='$tail'
14037 tar='$tar'
14038 tbl='$tbl'
14039 tee='$tee'
14040 test='$test'
14041 timeincl='$timeincl'
14042 timetype='$timetype'
14043 touch='$touch'
14044 tr='$tr'
14045 trnl='$trnl'
14046 troff='$troff'
14047 uidsign='$uidsign'
14048 uidtype='$uidtype'
14049 uname='$uname'
14050 uniq='$uniq'
14051 use64bits='$use64bits'
14052 usedl='$usedl'
14053 uselargefiles='$uselargefiles'
14054 uselongdouble='$uselongdouble'
14055 usemorebits='$usemorebits'
14056 usemultiplicity='$usemultiplicity'
14057 usemymalloc='$usemymalloc'
14058 usenm='$usenm'
14059 useopcode='$useopcode'
14060 useperlio='$useperlio'
14061 useposix='$useposix'
14062 usesfio='$usesfio'
14063 useshrplib='$useshrplib'
14064 usesocks='$usesocks'
14065 usethreads='$usethreads'
14066 usevendorprefix='$usevendorprefix'
14067 usevfork='$usevfork'
14068 usrinc='$usrinc'
14069 uuname='$uuname'
14070 vendorlib='$vendorlib'
14071 vendorlibexp='$vendorlibexp'
14072 vendorprefix='$vendorprefix'
14073 vendorprefixexp='$vendorprefixexp'
14074 version='$version'
14075 vi='$vi'
14076 voidflags='$voidflags'
14077 xlibpth='$xlibpth'
14078 xs_apiversion='$xs_apiversion'
14079 zcat='$zcat'
14080 zip='$zip'
14081 EOT
14082
14083 : Add in command line options if available
14084 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14085
14086 : add special variables
14087 $test -f $src/patchlevel.h && \
14088 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14089 echo "CONFIGDOTSH=true" >>config.sh
14090
14091 : propagate old symbols
14092 if $test -f UU/config.sh; then
14093         <UU/config.sh sort | uniq >UU/oldconfig.sh
14094         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14095         sort | uniq -u >UU/oldsyms
14096         set X `cat UU/oldsyms`
14097         shift
14098         case $# in
14099         0) ;;
14100         *)
14101                 cat <<EOM
14102 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14103 EOM
14104                 echo "# Variables propagated from previous config.sh file." >>config.sh
14105                 for sym in `cat UU/oldsyms`; do
14106                         echo "    Propagating $hint variable "'$'"$sym..."
14107                         eval 'tmp="$'"${sym}"'"'
14108                         echo "$tmp" | \
14109                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14110                 done
14111                 ;;
14112         esac
14113 fi
14114
14115 : Finish up by extracting the .SH files
14116 case "$alldone" in
14117 exit)
14118         $rm -rf UU
14119         echo "Done."
14120         exit 0
14121         ;;
14122 cont)
14123         ;;
14124 '')
14125         dflt=''
14126         nostick=true
14127         $cat <<EOM
14128
14129 If you'd like to make any changes to the config.sh file before I begin
14130 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14131
14132 EOM
14133         rp="Press return or use a shell escape to edit config.sh:"
14134         . UU/myread
14135         nostick=''
14136         case "$ans" in
14137         '') ;;
14138         *) : in case they cannot read
14139                 sh 1>&4 -c "$ans";;
14140         esac
14141         ;;
14142 esac
14143
14144 : if this fails, just run all the .SH files by hand
14145 . ./config.sh
14146
14147 echo " "
14148 exec 1>&4
14149 . ./UU/extract
14150
14151 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14152         dflt=y
14153         case "$silent" in
14154         true) ;;
14155         *)
14156                 $cat <<EOM
14157
14158 Now you need to generate make dependencies by running "$make depend".
14159 You might prefer to run it in background: "$make depend > makedepend.out &"
14160 It can take a while, so you might not want to run it right now.
14161
14162 EOM
14163                 ;;
14164         esac
14165         rp="Run $make depend now?"
14166         . UU/myread
14167         case "$ans" in
14168         y*)
14169                 $make depend && echo "Now you must run a $make."
14170                 ;;
14171         *)
14172                 echo "You must run '$make depend' then '$make'."
14173                 ;;
14174         esac
14175 elif test -f [Mm]akefile; then
14176         echo " "
14177         echo "Now you must run a $make."
14178 else
14179         echo "Done."
14180 fi
14181
14182 if $test -f Policy.sh; then
14183     $cat <<EOM
14184
14185 If you compile $package on a different machine or from a different object
14186 directory, copy the Policy.sh file from this object directory to the
14187 new one before you run Configure -- this will help you with most of
14188 the policy defaults.
14189
14190 EOM
14191 fi
14192 if $test -f config.msg; then
14193     echo "Hmm.  I also noted the following information while running:"
14194     echo " "
14195     $cat config.msg >&4
14196     $rm -f config.msg
14197 fi
14198 $rm -f kit*isdone ark*isdone
14199 $rm -rf UU
14200
14201 : End of Configure
14202