a63fbf6d7868984d33cc14c2f7af97b5a3a5a770
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Mon Sep 20 12:12:09 EET DST 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_ftello=''
359 d_ftime=''
360 d_gettimeod=''
361 d_Gconvert=''
362 d_getgrent=''
363 d_getgrps=''
364 d_gethbyaddr=''
365 d_gethbyname=''
366 d_gethent=''
367 aphostname=''
368 d_gethname=''
369 d_phostname=''
370 d_uname=''
371 d_gethostprotos=''
372 d_getlogin=''
373 d_getmntent=''
374 d_getnbyaddr=''
375 d_getnbyname=''
376 d_getnent=''
377 d_getnetprotos=''
378 d_getpent=''
379 d_getpgid=''
380 d_getpgrp2=''
381 d_bsdgetpgrp=''
382 d_getpgrp=''
383 d_getppid=''
384 d_getprior=''
385 d_getpbyname=''
386 d_getpbynumber=''
387 d_getprotoprotos=''
388 d_getpwent=''
389 d_getsent=''
390 d_getservprotos=''
391 d_getspent=''
392 d_getspnam=''
393 d_getsbyname=''
394 d_getsbyport=''
395 d_gnulibc=''
396 d_hasmntopt=''
397 d_htonl=''
398 d_inetaton=''
399 d_isascii=''
400 d_killpg=''
401 d_lchown=''
402 d_ldbl_dig=''
403 d_link=''
404 d_locconv=''
405 d_lockf=''
406 d_longdbl=''
407 longdblsize=''
408 d_longlong=''
409 longlongsize=''
410 d_lstat=''
411 d_madvise=''
412 d_mblen=''
413 d_mbstowcs=''
414 d_mbtowc=''
415 d_memchr=''
416 d_memcmp=''
417 d_memcpy=''
418 d_memmove=''
419 d_memset=''
420 d_mkdir=''
421 d_mkfifo=''
422 d_mktime=''
423 d_mmap=''
424 mmaptype=''
425 d_mprotect=''
426 d_msg=''
427 d_msgctl=''
428 d_msgget=''
429 d_msgrcv=''
430 d_msgsnd=''
431 d_msync=''
432 d_munmap=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_readv=''
452 d_rename=''
453 d_rmdir=''
454 d_safebcpy=''
455 d_safemcpy=''
456 d_sanemcmp=''
457 d_select=''
458 d_sem=''
459 d_semctl=''
460 d_semget=''
461 d_semop=''
462 d_setegid=''
463 d_seteuid=''
464 d_setgrent=''
465 d_setgrps=''
466 d_sethent=''
467 d_setlinebuf=''
468 d_setlocale=''
469 d_setnent=''
470 d_setpent=''
471 d_setpgid=''
472 d_setpgrp2=''
473 d_bsdsetpgrp=''
474 d_setpgrp=''
475 d_setprior=''
476 d_setpwent=''
477 d_setregid=''
478 d_setresgid=''
479 d_setresuid=''
480 d_setreuid=''
481 d_setrgid=''
482 d_setruid=''
483 d_setsent=''
484 d_setsid=''
485 d_setspent=''
486 d_setvbuf=''
487 d_sfio=''
488 usesfio=''
489 d_shm=''
490 d_shmat=''
491 d_shmatprototype=''
492 shmattype=''
493 d_shmctl=''
494 d_shmdt=''
495 d_shmget=''
496 d_sigaction=''
497 d_sigsetjmp=''
498 d_cmsghdr_s=''
499 d_msg_ctrunc=''
500 d_msg_dontroute=''
501 d_msg_oob=''
502 d_msg_peek=''
503 d_msg_proxy=''
504 d_msghdr_s=''
505 d_oldsock=''
506 d_recvmsg=''
507 d_scm_rights=''
508 d_sendmsg=''
509 d_socket=''
510 d_sockpair=''
511 sockethdr=''
512 socketlib=''
513 d_statblks=''
514 d_fstatfs=''
515 d_statfs=''
516 d_statfsflags=''
517 d_fstatvfs=''
518 d_statvfs=''
519 d_stdio_cnt_lval=''
520 d_stdio_ptr_lval=''
521 d_stdiobase=''
522 d_stdstdio=''
523 stdio_base=''
524 stdio_bufsiz=''
525 stdio_cnt=''
526 stdio_filbuf=''
527 stdio_ptr=''
528 d_index=''
529 d_strchr=''
530 d_strcoll=''
531 d_strctcpy=''
532 d_strerrm=''
533 d_strerror=''
534 d_sysernlst=''
535 d_syserrlst=''
536 d_strtod=''
537 d_strtol=''
538 d_strtoul=''
539 d_strxfrm=''
540 d_symlink=''
541 d_syscall=''
542 d_sysconf=''
543 d_system=''
544 d_tcgetpgrp=''
545 d_tcsetpgrp=''
546 d_telldirproto=''
547 d_time=''
548 timetype=''
549 clocktype=''
550 d_times=''
551 d_truncate=''
552 d_tzname=''
553 d_umask=''
554 d_semctl_semid_ds=''
555 d_semctl_semun=''
556 d_union_semun=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 d_writev=''
569 dlext=''
570 cccdlflags=''
571 ccdlflags=''
572 dlsrc=''
573 ld=''
574 lddlflags=''
575 usedl=''
576 doublesize=''
577 ebcdic=''
578 fflushNULL=''
579 fflushall=''
580 fpostype=''
581 gidtype=''
582 groupstype=''
583 h_fcntl=''
584 h_sysfile=''
585 i_arpainet=''
586 db_hashtype=''
587 db_prefixtype=''
588 i_db=''
589 i_dbm=''
590 i_rpcsvcdbm=''
591 d_dirnamlen=''
592 direntrytype=''
593 i_dirent=''
594 i_dld=''
595 i_dlfcn=''
596 i_fcntl=''
597 i_float=''
598 i_gdbm=''
599 d_grpasswd=''
600 i_grp=''
601 d_int64t=''
602 i_inttypes=''
603 i_limits=''
604 i_locale=''
605 i_machcthr=''
606 i_malloc=''
607 i_math=''
608 i_memory=''
609 i_mntent=''
610 i_ndbm=''
611 i_netdb=''
612 i_neterrno=''
613 i_netinettcp=''
614 i_niin=''
615 i_sysin=''
616 i_poll=''
617 i_pthread=''
618 d_pwage=''
619 d_pwchange=''
620 d_pwclass=''
621 d_pwcomment=''
622 d_pwexpire=''
623 d_pwgecos=''
624 d_pwpasswd=''
625 d_pwquota=''
626 i_pwd=''
627 i_sfio=''
628 i_shadow=''
629 i_socks=''
630 i_stddef=''
631 i_stdlib=''
632 i_string=''
633 strings=''
634 i_sysaccess=''
635 i_sysdir=''
636 i_sysfile=''
637 d_voidtty=''
638 i_bsdioctl=''
639 i_sysfilio=''
640 i_sysioctl=''
641 i_syssockio=''
642 i_sysmman=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatvfs=''
651 i_systimes=''
652 i_systypes=''
653 d_iovec_s=''
654 i_sysuio=''
655 i_sysun=''
656 i_syswait=''
657 i_sgtty=''
658 i_termio=''
659 i_termios=''
660 i_systime=''
661 i_systimek=''
662 i_time=''
663 timeincl=''
664 i_unistd=''
665 i_utime=''
666 i_values=''
667 i_stdarg=''
668 i_varargs=''
669 i_varhdr=''
670 i_vfork=''
671 installprefix=''
672 installprefixexp=''
673 installstyle=''
674 installusrbinperl=''
675 intsize=''
676 longsize=''
677 shortsize=''
678 d_fpos64_t=''
679 d_llseek=''
680 d_off64_t=''
681 libc=''
682 ldlibpthname=''
683 libperl=''
684 shrpenv=''
685 useshrplib=''
686 glibpth=''
687 libpth=''
688 loclibpth=''
689 plibpth=''
690 xlibpth=''
691 ignore_versioned_solibs=''
692 libs=''
693 lns=''
694 d_PRIEldbl=''
695 d_PRIFldbl=''
696 d_PRIGldbl=''
697 d_PRIeldbl=''
698 d_PRIfldbl=''
699 d_PRIgldbl=''
700 sPRIEldbl=''
701 sPRIFldbl=''
702 sPRIGldbl=''
703 sPRIeldbl=''
704 sPRIfldbl=''
705 sPRIgldbl=''
706 lseeksize=''
707 lseektype=''
708 make_set_make=''
709 d_mymalloc=''
710 freetype=''
711 mallocobj=''
712 mallocsrc=''
713 malloctype=''
714 usemymalloc=''
715 installman1dir=''
716 man1dir=''
717 man1direxp=''
718 man1ext=''
719 installman3dir=''
720 man3dir=''
721 man3direxp=''
722 man3ext=''
723 huge=''
724 large=''
725 medium=''
726 models=''
727 small=''
728 split=''
729 modetype=''
730 multiarch=''
731 mydomain=''
732 myhostname=''
733 phostname=''
734 c=''
735 n=''
736 d_eofnblk=''
737 eagain=''
738 o_nonblock=''
739 rd_nodata=''
740 netdb_hlen_type=''
741 netdb_host_type=''
742 netdb_name_type=''
743 netdb_net_type=''
744 groupcat=''
745 hostcat=''
746 passcat=''
747 orderlib=''
748 ranlib=''
749 package=''
750 spackage=''
751 pager=''
752 apiversion=''
753 patchlevel=''
754 subversion=''
755 version=''
756 perladmin=''
757 perlpath=''
758 pidtype=''
759 prefix=''
760 prefixexp=''
761 installprivlib=''
762 privlib=''
763 privlibexp=''
764 prototype=''
765 ptrsize=''
766 d_PRIX64=''
767 d_PRId64=''
768 d_PRIi64=''
769 d_PRIo64=''
770 d_PRIu64=''
771 d_PRIx64=''
772 sPRIX64=''
773 sPRId64=''
774 sPRIi64=''
775 sPRIo64=''
776 sPRIu64=''
777 sPRIx64=''
778 drand01=''
779 randbits=''
780 randfunc=''
781 randseedtype=''
782 seedfunc=''
783 installscript=''
784 scriptdir=''
785 scriptdirexp=''
786 selectminbits=''
787 selecttype=''
788 sh=''
789 sig_count=''
790 sig_name=''
791 sig_name_init=''
792 sig_num=''
793 sig_num_init=''
794 installsitearch=''
795 sitearch=''
796 sitearchexp=''
797 installsitelib=''
798 sitelib=''
799 sitelibexp=''
800 siteprefix=''
801 siteprefixexp=''
802 sizetype=''
803 so=''
804 sharpbang=''
805 shsharp=''
806 spitshell=''
807 src=''
808 ssizetype=''
809 startperl=''
810 startsh=''
811 stdchar=''
812 d_stdio_stream_array=''
813 stdio_stream_array=''
814 d_strtoull=''
815 sysman=''
816 trnl=''
817 uidtype=''
818 archname64=''
819 use64bits=''
820 uselfs=''
821 uselongdouble=''
822 usemorebits=''
823 usemultiplicity=''
824 nm_opt=''
825 nm_so_opt=''
826 runnm=''
827 usenm=''
828 useperlio=''
829 usesocks=''
830 d_oldpthreads=''
831 usethreads=''
832 incpath=''
833 mips=''
834 mips_type=''
835 usrinc=''
836 d_vendorlib=''
837 installvendorlib=''
838 vendorlib=''
839 vendorlibexp=''
840 usevendorprefix=''
841 vendorprefix=''
842 vendorprefixexp=''
843 defvoidused=''
844 voidflags=''
845 CONFIG=''
846
847 define='define'
848 undef='undef'
849 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
850 rmlist=''
851
852 : We must find out about Eunice early
853 eunicefix=':'
854 if test -f /etc/unixtovms; then
855         eunicefix=/etc/unixtovms
856 fi
857 if test -f /etc/unixtovms.exe; then
858         eunicefix=/etc/unixtovms.exe
859 fi
860
861 i_whoami=''
862 : Possible local include directories to search.
863 : Set locincpth to "" in a hint file to defeat local include searches.
864 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
865 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
866 :
867 : no include file wanted by default
868 inclwanted=''
869
870 : list of known cpp symbols, sorted alphabetically
871 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
872 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
873 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
874 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
875 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
876 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
877 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
878 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
879 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
880 al="$al VMS Xenix286"
881 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
882 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
883 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
884 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
885 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
886 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
887 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
888 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
889 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
890 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
891 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
892 al="$al __SVR4_2__ __UMAXV__"
893 al="$al ____386BSD____ __alpha __alpha__ __amiga"
894 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
895 al="$al __host_mips__"
896 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
897 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
898 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
899 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
900 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
901 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
902 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
903 al="$al __mc88100 __mc88100__ __mips __mips__"
904 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
905 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
906 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
907 al="$al _host_mips _mips _unix"
908 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
909 al="$al apollo ardent att386 att3b"
910 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
911 al="$al cadmus clipper concurrent convex cray ctix"
912 al="$al dmert encore gcos gcx gimpel gould"
913 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
914 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
915 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
916 al="$al i186 i286 i386 i486 i8086"
917 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
918 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
919 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
920 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
921 al="$al mc88000 mc88100 merlin mert mips mvs n16"
922 al="$al ncl_el ncl_mr"
923 al="$al news1500 news1700 news1800 news1900 news3700"
924 al="$al news700 news800 news900 ns16000 ns32000"
925 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
926 al="$al parisc pc532 pdp11 plexus posix pyr"
927 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
928 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
929 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
930 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
931 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
932 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
933 al="$al xenix z8000"
934
935 : Trailing extension.  Override this in a hint file, if needed.
936 _exe=''
937 : Extra object files, if any, needed on this platform.
938 archobjs=''
939 groupstype=''
940 : change the next line if compiling for Xenix/286 on Xenix/386
941 xlibpth='/usr/lib/386 /lib/386'
942
943 : Possible local library directories to search.
944 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
945 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
946
947 : general looking path for locating libraries
948 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
949 glibpth="$glibpth /lib /usr/lib $xlibpth"
950 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
951 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
952
953 : Private path used by Configure to find libraries.  Its value
954 : is prepended to libpth. This variable takes care of special
955 : machines, like the mips.  Usually, it should be empty.
956 plibpth=''
957
958 : default library list
959 libswanted=''
960 : some systems want to use only the non-versioned libso:s
961 ignore_versioned_solibs=''
962 : full support for void wanted by default
963 defvoidused=15
964
965 : set useposix=false in your hint file to disable the POSIX extension.
966 useposix=true
967 : set useopcode=false in your hint file to disable the Opcode extension.
968 useopcode=true
969 : set usemultiplicity on the Configure command line to enable multiplicity.
970 : set usesocks on the Configure command line to enable socks.
971 : set usethreads on the Configure command line to enable threads.
972 : List of libraries we want.
973 : If anyone needs -lnet, put it in a hint file.
974 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
975 libswanted="$libswanted dld ld sun m c cposix posix"
976 libswanted="$libswanted ndir dir crypt sec"
977 libswanted="$libswanted ucb bsd BSD PW x"
978 : We probably want to search /usr/shlib before most other libraries.
979 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
980 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
981 glibpth="/usr/shlib $glibpth"
982 : Do not use vfork unless overridden by a hint file.
983 usevfork=false
984
985 : Find the basic shell for Bourne shell scripts
986 case "$sh" in
987 '')
988         case "$SYSTYPE" in
989         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
990         *) xxx='/bin/sh';;
991         esac
992         if test -f "$xxx"; then
993                 sh="$xxx"
994         else
995                 : Build up a list and do a single loop so we can 'break' out.
996                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
997                 for xxx in sh bash ksh pdksh ash; do
998                         for p in $pth; do
999                                 try="$try ${p}/${xxx}"
1000                         done
1001                 done
1002                 for xxx in $try; do
1003                         if test -f "$xxx"; then
1004                                 sh="$xxx";
1005                                 break
1006                         elif test -f "$xxx.exe"; then
1007                                 sh="$xxx";
1008                                 break
1009                         fi
1010                 done
1011         fi
1012         ;;
1013 esac
1014
1015 case "$sh" in
1016 '')     cat <<EOM >&2
1017 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1018
1019 Usually it's in /bin/sh.  How did you even get this far?
1020 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1021 we'll try to straighten this all out.
1022 EOM
1023         exit 1
1024         ;;
1025 esac
1026
1027 : see if sh knows # comments
1028 if `$sh -c '#' >/dev/null 2>&1`; then
1029         shsharp=true
1030         spitshell=cat
1031         xcat=/bin/cat
1032         test -f $xcat || xcat=/usr/bin/cat
1033         echo "#!$xcat" >try
1034         $eunicefix try
1035         chmod +x try
1036         ./try > today
1037         if test -s today; then
1038                 sharpbang='#!'
1039         else
1040                 echo "#! $xcat" > try
1041                 $eunicefix try
1042                 chmod +x try
1043                 ./try > today
1044                 if test -s today; then
1045                         sharpbang='#! '
1046                 else
1047                         sharpbang=': use '
1048                 fi
1049         fi
1050 else
1051         echo " "
1052         echo "Your $sh doesn't grok # comments--I will strip them later on."
1053         shsharp=false
1054         cd ..
1055         echo "exec grep -v '^[  ]*#'" >spitshell
1056         chmod +x spitshell
1057         $eunicefix spitshell
1058         spitshell=`pwd`/spitshell
1059         cd UU
1060         echo "I presume that if # doesn't work, #! won't work either!"
1061         sharpbang=': use '
1062 fi
1063 rm -f try today
1064
1065 : figure out how to guarantee sh startup
1066 case "$startsh" in
1067 '') startsh=${sharpbang}${sh} ;;
1068 *)
1069 esac
1070 cat >try <<EOSS
1071 $startsh
1072 set abc
1073 test "$?abc" != 1
1074 EOSS
1075
1076 chmod +x try
1077 $eunicefix try
1078 if ./try; then
1079         : echo "Yup, it does."
1080 else
1081         echo "Hmm... '$startsh' does not guarantee sh startup..."
1082         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1083 fi
1084 rm -f try
1085
1086
1087 : Save command line options in file UU/cmdline.opt for later use in
1088 : generating config.sh.
1089 cat > cmdline.opt <<EOSH
1090 # Configure command line arguments.
1091 config_arg0='$0'
1092 config_args='$*'
1093 config_argc=$#
1094 EOSH
1095 argn=1
1096 for arg in "$@"; do
1097         cat >>cmdline.opt <<EOSH
1098 config_arg$argn='$arg'
1099 EOSH
1100         argn=`expr $argn + 1`
1101 done
1102
1103 : produce awk script to parse command line options
1104 cat >options.awk <<'EOF'
1105 BEGIN {
1106         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1107
1108         len = length(optstr);
1109         for (i = 1; i <= len; i++) {
1110                 c = substr(optstr, i, 1);
1111                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1112                 if (a == ":") {
1113                         arg[c] = 1;
1114                         i++;
1115                 }
1116                 opt[c] = 1;
1117         }
1118 }
1119 {
1120         expect = 0;
1121         str = $0;
1122         if (substr(str, 1, 1) != "-") {
1123                 printf("'%s'\n", str);
1124                 next;
1125         }
1126         len = length($0);
1127         for (i = 2; i <= len; i++) {
1128                 c = substr(str, i, 1);
1129                 if (!opt[c]) {
1130                         printf("-%s\n", substr(str, i));
1131                         next;
1132                 }
1133                 printf("-%s\n", c);
1134                 if (arg[c]) {
1135                         if (i < len)
1136                                 printf("'%s'\n", substr(str, i + 1));
1137                         else
1138                                 expect = 1;
1139                         next;
1140                 }
1141         }
1142 }
1143 END {
1144         if (expect)
1145                 print "?";
1146 }
1147 EOF
1148
1149 : process the command line options
1150 set X `for arg in "$@"; do echo "X$arg"; done |
1151         sed -e s/X// | awk -f options.awk`
1152 eval "set $*"
1153 shift
1154 rm -f options.awk
1155
1156 : set up default values
1157 fastread=''
1158 reuseval=false
1159 config_sh=''
1160 alldone=''
1161 error=''
1162 silent=''
1163 extractsh=''
1164 override=''
1165 knowitall=''
1166 rm -f optdef.sh posthint.sh
1167 cat >optdef.sh <<EOS
1168 $startsh
1169 EOS
1170
1171
1172 : option parsing
1173 while test $# -gt 0; do
1174         case "$1" in
1175         -d) shift; fastread=yes;;
1176         -e) shift; alldone=cont;;
1177         -f)
1178                 shift
1179                 cd ..
1180                 if test -r "$1"; then
1181                         config_sh="$1"
1182                 else
1183                         echo "$me: cannot read config file $1." >&2
1184                         error=true
1185                 fi
1186                 cd UU
1187                 shift;;
1188         -h) shift; error=true;;
1189         -r) shift; reuseval=true;;
1190         -s) shift; silent=true; realsilent=true;;
1191         -E) shift; alldone=exit;;
1192         -K) shift; knowitall=true;;
1193         -O) shift; override=true;;
1194         -S) shift; silent=true; extractsh=true;;
1195         -D)
1196                 shift
1197                 case "$1" in
1198                 *=)
1199                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1200                         echo "$me: ignoring -D $1" >&2
1201                         ;;
1202                 *=*) echo "$1" | \
1203                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1204                 *) echo "$1='define'" >> optdef.sh;;
1205                 esac
1206                 shift
1207                 ;;
1208         -U)
1209                 shift
1210                 case "$1" in
1211                 *=) echo "$1" >> optdef.sh;;
1212                 *=*)
1213                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1214                         echo "$me: ignoring -U $1" >&2
1215                         ;;
1216                 *) echo "$1='undef'" >> optdef.sh;;
1217                 esac
1218                 shift
1219                 ;;
1220         -A)
1221             shift
1222             xxx=''
1223             yyy="$1"
1224             case "$yyy" in
1225             *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1226                  yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1227                  ;;
1228             esac
1229             case "$xxx" in
1230             '') xxx=define ;;
1231             esac
1232             zzz=''
1233             uuu='undef'
1234             case "$yyy" in
1235             *=*) zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1236                  yyy=`echo $yyy|sed 's!=.*!!'`
1237                  case "$yyy:$zzz" in
1238                  undef:) uuu='' ;;
1239                  esac
1240                  ;;
1241             esac
1242             case "$xxx" in
1243             append)
1244                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh
1245                 ;;
1246             clear)
1247                 echo "$yyy=''"                  >> posthint.sh
1248                 ;;
1249             define)
1250                 case "$zzz" in
1251                 '') zzz=define ;;
1252                 esac
1253                 echo "$yyy='$zzz'"              >> posthint.sh
1254                 ;; 
1255             eval)
1256                 echo "eval \"$yyy=$zzz\""       >> posthint.sh
1257                 ;; 
1258             prepend)
1259                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh
1260                 ;; 
1261             undef)
1262                 case "$zzz" in
1263                 '') zzz="$uuu" ;;
1264                 esac
1265                 echo "$yyy=$zzz"                >> posthint.sh
1266                 ;; 
1267             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2
1268                 ;;
1269             esac
1270             ;;
1271         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1272                 exit 0;;
1273         --) break;;
1274         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1275         *) break;;
1276         esac
1277 done
1278
1279 case "$error" in
1280 true)
1281         cat >&2 <<EOM
1282 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1283                  [-U symbol] [-U symbol=] [-A command:symbol...]
1284   -d : use defaults for all answers.
1285   -e : go on without questioning past the production of config.sh.
1286   -f : specify an alternate default configuration file.
1287   -h : print this help message and exit (with an error status).
1288   -r : reuse C symbols value if possible (skips costly nm extraction).
1289   -s : silent mode, only echoes questions and essential information.
1290   -D : define symbol to have some value:
1291          -D symbol         symbol gets the value 'define'
1292          -D symbol=value   symbol gets the value 'value'
1293   -E : stop at the end of questions, after having produced config.sh.
1294   -K : do not use unless you know what you are doing.
1295   -O : let -D and -U override definitions from loaded configuration file.
1296   -S : perform variable substitutions on all .SH files (can mix with -f)
1297   -U : undefine symbol:
1298          -U symbol    symbol gets the value 'undef'
1299          -U symbol=   symbol gets completely empty
1300   -A : manipulate symbol after the platform specific hints have been applied:
1301          -A append:symbol=value         append value to symbol
1302          -A define:symbol=value         define symbol to have value
1303          -A symbol=value                define symbol to have value
1304          -A clear:symbol                define symbol to be ''
1305          -A define:symbol               define symbol to be 'define'
1306          -A eval:symbol=value           define symbol to be eval of value
1307          -A prepend:symbol=value        prepend value to symbol
1308          -A undef:symbol                define symbol to be 'undef'
1309          -A undef:symbol=               define symbol to be ''
1310   -V : print version number and exit (with a zero status).
1311 EOM
1312         exit 1
1313         ;;
1314 esac
1315
1316 : Sanity checks
1317 case "$fastread$alldone" in
1318 yescont|yesexit) ;;
1319 *)
1320         if test ! -t 0; then
1321                 echo "Say 'sh Configure', not 'sh <Configure'"
1322                 exit 1
1323         fi
1324         ;;
1325 esac
1326
1327 exec 4>&1
1328 case "$silent" in
1329 true) exec 1>/dev/null;;
1330 esac
1331
1332 : run the defines and the undefines, if any, but leave the file out there...
1333 touch optdef.sh
1334 . ./optdef.sh
1335 : create the posthint manipulation script and leave the file out there...
1336 touch posthint.sh
1337 . ./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                 uts) osname=uts 
2317                         osvers="$3"
2318                         ;;
2319                 qnx) osname=qnx
2320                         osvers="$4"
2321                         ;;
2322                 $2) case "$osname" in
2323                         *isc*) ;;
2324                         *freebsd*) ;;
2325                         svr*)
2326                                 : svr4.x or possibly later
2327                                 case "svr$3" in 
2328                                 ${osname}*)
2329                                         osname=svr$3
2330                                         osvers=$4
2331                                         ;;
2332                                 esac
2333                                 case "$osname" in
2334                                 svr4.0)
2335                                         : Check for ESIX
2336                                         if test -f /stand/boot ; then
2337                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2338                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2339                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2340                                                         if test -n "$isesix"; then
2341                                                                 osname=esix4
2342                                                         fi
2343                                                 fi
2344                                         fi
2345                                         ;;
2346                                 esac
2347                                 ;;
2348                         *)      if test -f /etc/systemid; then
2349                                         osname=sco
2350                                         set `echo $3 | $sed 's/\./ /g'` $4
2351                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2352                                                 osvers=$1.$2.$3
2353                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2354                                                 osvers=$1.$2
2355                                         elif $test -f $src/hints/sco_$1.sh; then
2356                                                 osvers=$1
2357                                         fi
2358                                 else
2359                                         case "$osname" in
2360                                         '') : Still unknown.  Probably a generic Sys V.
2361                                                 osname="sysv"
2362                                                 osvers="$3"
2363                                                 ;;
2364                                         esac
2365                                 fi
2366                                 ;;
2367                         esac
2368                         ;;
2369                 *)      case "$osname" in
2370                         '') : Still unknown.  Probably a generic BSD.
2371                                 osname="$1"
2372                                 osvers="$3"
2373                                 ;;
2374                         esac
2375                         ;;
2376                 esac
2377         else
2378                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2379                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2380                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2381                                 osname=news_os
2382                         fi
2383                         $rm -f UU/kernel.what
2384                 elif test -d c:/.; then
2385                         set X $myuname
2386                         osname=os2
2387                         osvers="$5"
2388                 fi
2389         fi
2390         
2391         : Now look for a hint file osname_osvers, unless one has been
2392         : specified already.
2393         case "$hintfile" in
2394         ''|' ')
2395                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2396                 : Also try without trailing minor version numbers.
2397                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2398                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2399                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2400                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2401                 case "$file" in
2402                 '') dflt=none ;;
2403                 *)  case "$osvers" in
2404                         '') dflt=$file
2405                                 ;;
2406                         *)  if $test -f $src/hints/$file.sh ; then
2407                                         dflt=$file
2408                                 elif $test -f $src/hints/$xfile.sh ; then
2409                                         dflt=$xfile
2410                                 elif $test -f $src/hints/$xxfile.sh ; then
2411                                         dflt=$xxfile
2412                                 elif $test -f $src/hints/$xxxfile.sh ; then
2413                                         dflt=$xxxfile
2414                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2415                                         dflt=$xxxxfile
2416                                 elif $test -f "$src/hints/${osname}.sh" ; then
2417                                         dflt="${osname}"
2418                                 else
2419                                         dflt=none
2420                                 fi
2421                                 ;;
2422                         esac
2423                         ;;
2424                 esac
2425                 if $test -f Policy.sh ; then
2426                         case "$dflt" in
2427                         *Policy*) ;;
2428                         none) dflt="Policy" ;;
2429                         *) dflt="Policy $dflt" ;;
2430                         esac
2431                 fi
2432                 ;;
2433         *)
2434                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2435                 ;;
2436         esac
2437
2438         if $test -f Policy.sh ; then
2439                 $cat <<EOM
2440
2441 There's also a Policy hint file available, which should make the
2442 site-specific (policy) questions easier to answer.
2443 EOM
2444
2445         fi
2446
2447         $cat <<EOM
2448
2449 You may give one or more space-separated answers, or "none" if appropriate.
2450 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2451 is a good thing.  DO NOT give a wrong version or a wrong OS.
2452
2453 EOM
2454
2455         rp="Which of these apply, if any?"
2456         . UU/myread
2457         tans=$ans
2458         for file in $tans; do
2459                 if $test X$file = XPolicy -a -f Policy.sh; then
2460                         . Policy.sh
2461                         $cat Policy.sh >> UU/config.sh
2462                 elif $test -f $src/hints/$file.sh; then
2463                         . $src/hints/$file.sh
2464                         $cat $src/hints/$file.sh >> UU/config.sh
2465                 elif $test X$tans = X -o X$tans = Xnone ; then
2466                         : nothing
2467                 else
2468                         : Give one chance to correct a possible typo.
2469                         echo "$file.sh does not exist"
2470                         dflt=$file
2471                         rp="hint to use instead?"
2472                         . UU/myread
2473                         for file in $ans; do
2474                                 if $test -f "$src/hints/$file.sh"; then
2475                                         . $src/hints/$file.sh
2476                                         $cat $src/hints/$file.sh >> UU/config.sh
2477                                 elif $test X$ans = X -o X$ans = Xnone ; then
2478                                         : nothing
2479                                 else
2480                                         echo "$file.sh does not exist -- ignored."
2481                                 fi
2482                         done
2483                 fi
2484         done
2485
2486         hint=recommended
2487         : Remember our hint file for later.
2488         if $test -f "$src/hints/$file.sh" ; then
2489                 hintfile="$file"
2490         else
2491                 hintfile=''
2492         fi
2493 fi
2494 cd UU
2495 ;;
2496 *)
2497         echo " "
2498         echo "Fetching default answers from $config_sh..." >&4
2499         tmp_n="$n"
2500         tmp_c="$c"
2501         cd ..
2502         cp $config_sh config.sh 2>/dev/null
2503         chmod +w config.sh
2504         . ./config.sh
2505         cd UU
2506         cp ../config.sh .
2507         n="$tmp_n"
2508         c="$tmp_c"
2509         hint=previous
2510         ;;
2511 esac
2512 test "$override" && . ./optdef.sh
2513 myuname="$newmyuname"
2514
2515 : Restore computed paths
2516 for file in $loclist $trylist; do
2517         eval $file="\$_$file"
2518 done
2519
2520 cat << EOM
2521
2522 Configure uses the operating system name and version to set some defaults.
2523 The default value is probably right if the name rings a bell. Otherwise,
2524 since spelling matters for me, either accept the default or answer "none"
2525 to leave it blank.
2526
2527 EOM
2528 case "$osname" in
2529         ''|' ')
2530                 case "$hintfile" in
2531                 ''|' '|none) dflt=none ;;
2532                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2533                 esac
2534                 ;;
2535         *) dflt="$osname" ;;
2536 esac
2537 rp="Operating system name?"
2538 . ./myread
2539 case "$ans" in
2540 none)  osname='' ;;
2541 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2542 esac
2543 echo " "
2544 case "$osvers" in
2545         ''|' ')
2546                 case "$hintfile" in
2547                 ''|' '|none) dflt=none ;;
2548                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2549                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2550                         case "$dflt" in
2551                         ''|' ') dflt=none ;;
2552                         esac
2553                         ;;
2554                 esac
2555                 ;;
2556         *) dflt="$osvers" ;;
2557 esac
2558 rp="Operating system version?"
2559 . ./myread
2560 case "$ans" in
2561 none)  osvers='' ;;
2562 *) osvers="$ans" ;;
2563 esac
2564
2565
2566 . ./posthint.sh
2567
2568 : who configured the system
2569 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2570 cf_by=`(logname) 2>/dev/null`
2571 case "$cf_by" in
2572 "")
2573         cf_by=`(whoami) 2>/dev/null`
2574         case "$cf_by" in
2575         "") cf_by=unknown ;;
2576         esac ;;
2577 esac
2578
2579 : set up the script used to warn in case of inconsistency
2580 cat <<EOS >whoa
2581 $startsh
2582 EOS
2583 cat <<'EOSC' >>whoa
2584 dflt=y
2585 echo " "
2586 echo "*** WHOA THERE!!! ***" >&4
2587 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2588 rp="    Keep the $hint value?"
2589 . ./myread
2590 case "$ans" in
2591 y) td=$was; tu=$was;;
2592 esac
2593 EOSC
2594
2595 : function used to set $1 to $val
2596 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2597 case "$val$was" in
2598 $define$undef) . ./whoa; eval "$var=\$td";;
2599 $undef$define) . ./whoa; eval "$var=\$tu";;
2600 *) eval "$var=$val";;
2601 esac'
2602
2603 cat <<EOM
2604
2605 Perl can be built to take advantage of threads, on some systems.
2606 To do so, Configure must be run with -Dusethreads.
2607
2608 Note that threading is a highly experimental feature, and
2609 some known race conditions still remain.  If you choose to try
2610 it, be very sure to not actually deploy it for production
2611 purposes.  README.threads has more details, and is required
2612 reading if you enable threads.
2613 EOM
2614 case "$usethreads" in
2615 $define|true|[yY]*)     dflt='y';;
2616 *) dflt='n';;
2617 esac
2618 rp='Build a threading Perl?'
2619 . ./myread
2620 case "$ans" in
2621 y|Y)    val="$define" ;;     
2622 *)      val="$undef" ;;
2623 esac
2624 set usethreads
2625 eval $setvar 
2626
2627 case "$d_oldpthreads" in
2628 '')     : Configure tests would be welcome here.  For now, assume undef.
2629         val="$undef" ;;
2630 *)      val="$d_oldpthreads" ;;
2631 esac
2632 set d_oldpthreads
2633 eval $setvar
2634
2635
2636 case "$usethreads" in
2637 "$define"|true|[yY]*)
2638 : Look for a hint-file generated 'call-back-unit'.  If the
2639 : user has specified that a threading perl is to be built,
2640 : we may need to set or change some other defaults.
2641         if $test -f usethreads.cbu; then
2642                 echo "Your platform has some specific hints for threaded builds, using them..."
2643                 . ./usethreads.cbu
2644         else
2645                 $cat <<EOM
2646 (Your platform doesn't have any specific hints for threaded builds.
2647  Assuming POSIX threads, then.)
2648 EOM
2649         fi
2650     ;;
2651 esac
2652
2653 cat <<EOM
2654
2655 Perl can be built so that multiple Perl interpreters can coexist
2656 within the same Perl executable.  To do so, Configure must be run with
2657 -Dusemultiplicity.
2658
2659 Normally you do not need this and you should answer no.
2660
2661 EOM
2662 case "$usemultiplicity" in
2663 $define|true|[yY]*)     dflt='y';;
2664 *) dflt='n';;
2665 esac
2666 rp='Build Perl for multiplicity?'
2667 . ./myread
2668 case "$ans" in
2669 y|Y)    val="$define" ;;     
2670 *)      val="$undef" ;;
2671 esac
2672 set usemultiplicity
2673 eval $setvar 
2674
2675 : determine where manual pages are on this system
2676 echo " "
2677 case "$sysman" in
2678 '') 
2679         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2680         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2681         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2682         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2683         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2684         sysman=`./loc . /usr/man/man1 $syspath`
2685         ;;
2686 esac
2687 if $test -d "$sysman"; then
2688         echo "System manual is in $sysman." >&4
2689 else
2690         echo "Could not find manual pages in source form." >&4
2691 fi
2692
2693 : see what memory models we can support
2694 case "$models" in
2695 '')
2696         $cat >pdp11.c <<'EOP'
2697 int main() {
2698 #ifdef pdp11
2699         exit(0);
2700 #else
2701         exit(1);
2702 #endif
2703 }
2704 EOP
2705         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2706         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2707                 dflt='unsplit split'
2708         else
2709                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2710                 case "$tans" in
2711                 X) dflt='none';;
2712                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2713                                 dflt='small'
2714                         else
2715                                 dflt=''
2716                         fi
2717                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2718                                 dflt="$dflt medium"
2719                         fi
2720                         if $test -d /lib/large || $test -d /usr/lib/large; then
2721                                 dflt="$dflt large"
2722                         fi
2723                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2724                                 dflt="$dflt huge"
2725                         fi
2726                 esac
2727         fi;;
2728 *) dflt="$models";;
2729 esac
2730 $cat <<EOM
2731  
2732 Some systems have different model sizes.  On most systems they are called
2733 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2734 split.  If your system doesn't support different memory models, say "none".
2735 If you wish to force everything to one memory model, say "none" here and
2736 put the appropriate flags later when it asks you for other cc and ld flags.
2737 Venix systems may wish to put "none" and let the compiler figure things out.
2738 (In the following question multiple model names should be space separated.)
2739
2740 The default for most systems is "none".
2741
2742 EOM
2743 rp="Which memory models are supported?"
2744 . ./myread
2745 models="$ans"
2746
2747 case "$models" in
2748 none)
2749         small=''
2750         medium=''
2751         large=''
2752         huge=''
2753         unsplit=''
2754         split=''
2755         ;;
2756 *split)
2757         case "$split" in
2758         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2759                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2760                         dflt='-i'
2761                 else
2762                         dflt='none'
2763                 fi;;
2764         *) dflt="$split";;
2765         esac
2766         rp="What flag indicates separate I and D space?"
2767         . ./myread
2768         tans="$ans"
2769         case "$tans" in
2770         none) tans='';;
2771         esac
2772         split="$tans"
2773         unsplit='';;
2774 *large*|*small*|*medium*|*huge*)
2775         case "$models" in
2776         *large*)
2777                 case "$large" in
2778                 '') dflt='-Ml';;
2779                 *) dflt="$large";;
2780                 esac
2781         rp="What flag indicates large model?"
2782         . ./myread
2783         tans="$ans"
2784         case "$tans" in
2785         none) tans='';
2786         esac
2787         large="$tans";;
2788         *) large='';;
2789         esac
2790         case "$models" in
2791         *huge*) case "$huge" in
2792                 '') dflt='-Mh';;
2793                 *) dflt="$huge";;
2794                 esac
2795                 rp="What flag indicates huge model?"
2796                 . ./myread
2797                 tans="$ans"
2798                 case "$tans" in
2799                 none) tans='';
2800                 esac
2801                 huge="$tans";;
2802         *) huge="$large";;
2803         esac
2804         case "$models" in
2805         *medium*) case "$medium" in
2806                 '') dflt='-Mm';;
2807                 *) dflt="$medium";;
2808                 esac
2809                 rp="What flag indicates medium model?"
2810                 . ./myread
2811                 tans="$ans"
2812                 case "$tans" in
2813                 none) tans='';
2814                 esac
2815                 medium="$tans";;
2816         *) medium="$large";;
2817         esac
2818         case "$models" in
2819         *small*) case "$small" in
2820                 '') dflt='none';;
2821                 *) dflt="$small";;
2822                 esac
2823                 rp="What flag indicates small model?"
2824                 . ./myread
2825                 tans="$ans"
2826                 case "$tans" in
2827                 none) tans='';
2828                 esac
2829                 small="$tans";;
2830         *) small='';;
2831         esac
2832         ;;
2833 *)
2834         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2835         ;;
2836 esac
2837 $rm -f pdp11.* pdp11
2838
2839 : make some quick guesses about what we are up against
2840 echo " "
2841 $echo $n "Hmm...  $c"
2842 echo exit 1 >bsd
2843 echo exit 1 >usg
2844 echo exit 1 >v7
2845 echo exit 1 >osf1
2846 echo exit 1 >eunice
2847 echo exit 1 >xenix
2848 echo exit 1 >venix
2849 echo exit 1 >os2
2850 d_bsd="$undef"
2851 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2852 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2853 then
2854         echo "Looks kind of like an OSF/1 system, but we'll see..."
2855         echo exit 0 >osf1
2856 elif test `echo abc | tr a-z A-Z` = Abc ; then
2857         xxx=`./loc addbib blurfl $pth`
2858         if $test -f $xxx; then
2859         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2860                 echo exit 0 >bsd
2861                 echo exit 0 >usg
2862         else
2863                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2864                         echo "Looks kind of like an extended USG system, but we'll see..."
2865                 else
2866                         echo "Looks kind of like a USG system, but we'll see..."
2867                 fi
2868                 echo exit 0 >usg
2869         fi
2870 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2871         echo "Looks kind of like a BSD system, but we'll see..."
2872         d_bsd="$define"
2873         echo exit 0 >bsd
2874 else
2875         echo "Looks kind of like a Version 7 system, but we'll see..."
2876         echo exit 0 >v7
2877 fi
2878 case "$eunicefix" in
2879 *unixtovms*)
2880         $cat <<'EOI'
2881 There is, however, a strange, musty smell in the air that reminds me of
2882 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2883 EOI
2884         echo exit 0 >eunice
2885         d_eunice="$define"
2886 : it so happens the Eunice I know will not run shell scripts in Unix format
2887         ;;
2888 *)
2889         echo " "
2890         echo "Congratulations.  You aren't running Eunice."
2891         d_eunice="$undef"
2892         ;;
2893 esac
2894 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2895 case "$p_" in
2896 :) ;;
2897 *)
2898         $cat <<'EOI'
2899 I have the feeling something is not exactly right, however...don't tell me...
2900 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2901 EOI
2902         echo exit 0 >os2
2903         ;;
2904 esac
2905 if test -f /xenix; then
2906         echo "Actually, this looks more like a XENIX system..."
2907         echo exit 0 >xenix
2908         d_xenix="$define"
2909 else
2910         echo " "
2911         echo "It's not Xenix..."
2912         d_xenix="$undef"
2913 fi
2914 chmod +x xenix
2915 $eunicefix xenix
2916 if test -f /venix; then
2917         echo "Actually, this looks more like a VENIX system..."
2918         echo exit 0 >venix
2919 else
2920         echo " "
2921         if ./xenix; then
2922                 : null
2923         else
2924                 echo "Nor is it Venix..."
2925         fi
2926 fi
2927 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2928 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2929 $rm -f foo
2930
2931 : see if we need a special compiler
2932 echo " "
2933 if ./usg; then
2934         case "$cc" in
2935         '') case "$Mcc" in
2936                 /*) dflt='Mcc';;
2937                 *) case "$large" in
2938                         -M*) dflt='cc';;
2939                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2940                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2941                                                 dflt='cc'
2942                                         else
2943                                                 dflt='cc -M'
2944                                         fi
2945                                 else
2946                                         dflt='cc'
2947                                 fi;;
2948                         esac;;
2949                 esac;;
2950         *)  dflt="$cc";;
2951         esac
2952         case "$dflt" in
2953         *M*)    $cat <<'EOM'
2954 On some older systems the default C compiler will not resolve multiple global
2955 references that happen to have the same name.  On some such systems the "Mcc"
2956 command may be used to force these to be resolved.  On other systems a "cc -M"
2957 command is required.  (Note that the -M flag on other systems indicates a
2958 memory model to use!) If you have the Gnu C compiler, you might wish to use
2959 that instead.
2960
2961 EOM
2962         ;;
2963         esac
2964         rp="Use which C compiler?"
2965         . ./myread
2966         cc="$ans"
2967 else
2968         case "$cc" in
2969         '') dflt=cc;;
2970         *) dflt="$cc";;
2971         esac
2972         rp="Use which C compiler?"
2973         . ./myread
2974         cc="$ans"
2975 fi
2976 : Look for a hint-file generated 'call-back-unit'.  Now that the
2977 : user has specified the compiler, we may need to set or change some
2978 : other defaults.
2979 if $test -f cc.cbu; then
2980     . ./cc.cbu
2981 fi
2982 echo " "
2983 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2984 $cat >gccvers.c <<EOM
2985 #include <stdio.h>
2986 int main() {
2987 #ifdef __GNUC__
2988 #ifdef __VERSION__
2989         printf("%s\n", __VERSION__);
2990 #else
2991         printf("%s\n", "1");
2992 #endif
2993 #endif
2994         exit(0);
2995 }
2996 EOM
2997 if $cc -o gccvers gccvers.c; then
2998         gccversion=`./gccvers`
2999         case "$gccversion" in
3000         '') echo "You are not using GNU cc." ;;
3001         *)  echo "You are using GNU cc $gccversion." ;;
3002         esac
3003 else
3004         echo " "
3005         echo "*** WHOA THERE!!! ***" >&4
3006         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3007         case "$knowitall" in
3008         '')
3009         echo "    You'd better start hunting for one and let me know about it." >&4
3010                 exit 1
3011                 ;;
3012         esac
3013 fi
3014 $rm -f gccvers*
3015 case "$gccversion" in
3016 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3017 esac
3018
3019
3020 case "$usemorebits" in
3021 "$define"|true|[yY]*)
3022         use64bits="$define"
3023         uselongdouble="$define"
3024         usemorebits="$define"
3025         ;;
3026 *)      usemorebits="$undef"
3027         ;;
3028 esac
3029
3030 cat <<EOM
3031
3032 Perl can be built to take advantage of explicit 64-bit interfaces,
3033 on some systems.  To do so, Configure must be run with -Duse64bits.
3034
3035 If this doesn't make any sense to you, just accept the default 'n'.
3036 EOM
3037 case "$use64bits" in
3038 $define|true|[yY]*)     dflt='y';;
3039 *) dflt='n';;
3040 esac
3041 rp='Try to use explicit 64-bit interfaces, if available?'
3042 . ./myread
3043 case "$ans" in
3044 y|Y) 
3045         val="$define"
3046         ;;     
3047 *)      
3048         val="$undef"
3049         ;;
3050 esac
3051 set use64bits
3052 eval $setvar
3053
3054 case "$archname64" in
3055 '') archname64='' ;;    # not a typo
3056 esac
3057
3058 case "$use64bits" in
3059 "$define"|true|[yY]*)
3060 : Look for a hint-file generated 'call-back-unit'.  If the
3061 : user has specified that a 64 bit perl is to be built,
3062 : we may need to set or change some other defaults.
3063         if $test -f use64bits.cbu; then
3064                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3065                 . ./use64bits.cbu
3066         else
3067                 $cat <<EOM
3068 (Your platform doesn't have any specific hints for 64-bit builds.
3069  This is probably okay, especially if your system is a true 64-bit system.)
3070 EOM
3071                 case "$gccversion" in
3072                 '')     ;;
3073                 *)      $cat <<EOM
3074 But since you seem to be using gcc,
3075 I will now add -DUSE_LONG_LONG to the compilation flags.
3076 EOM
3077                         ccflags="$ccflags -DUSE_LONG_LONG"
3078                         ;;
3079                 esac
3080         fi
3081         ;;
3082 esac
3083
3084 : determine the architecture name
3085 echo " "
3086 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3087         tarch=`arch`"-$osname"
3088 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3089         if uname -m > tmparch 2>&1 ; then
3090                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3091                         -e 's/$/'"-$osname/" tmparch`
3092         else
3093                 tarch="$osname"
3094         fi
3095         $rm -f tmparch
3096 else
3097         tarch="$osname"
3098 fi
3099 case "$myarchname" in
3100 ''|"$tarch") ;;
3101 *)
3102         echo "(Your architecture name used to be $myarchname.)"
3103         archname=''
3104         ;;
3105 esac
3106 myarchname="$tarch"
3107 case "$archname" in
3108 '') dflt="$tarch";;
3109 *) dflt="$archname";;
3110 esac
3111 rp='What is your architecture name'
3112 . ./myread
3113 archname="$ans"
3114 case "$usethreads" in
3115 $define)
3116         echo "Threads selected." >&4
3117         case "$archname" in
3118         *-thread*) echo "...and architecture name already has -thread." >&4
3119                 ;;
3120         *)      archname="$archname-thread"
3121                 echo "...setting architecture name to $archname." >&4
3122                 ;;
3123         esac
3124         ;;
3125 esac
3126 case "$usemultiplicity" in
3127 $define)
3128         echo "Multiplicity selected." >&4
3129         case "$archname" in
3130         *-multi*) echo "...and architecture name already has -multi." >&4
3131                 ;;
3132         *)      archname="$archname-multi"
3133                 echo "...setting architecture name to $archname." >&4
3134                 ;;
3135         esac
3136         ;;
3137 esac
3138 case "$use64bits" in
3139 $define)
3140         echo "Explicit 64-bitness selected." >&4
3141         case "$archname64" in
3142         '')
3143                 ;;
3144         *)
3145                 case "$archname" in
3146                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3147                         ;;
3148                 *)      archname="$archname-$archname64"
3149                         echo "...setting architecture name to $archname." >&4
3150                         ;;
3151                 esac
3152                 ;;
3153         esac
3154 esac
3155
3156 : decide how portable to be.  Allow command line overrides.
3157 case "$d_portable" in
3158 "$undef") ;;
3159 *)      d_portable="$define" ;;
3160 esac
3161
3162 : set up shell script to do ~ expansion
3163 cat >filexp <<EOSS
3164 $startsh
3165 : expand filename
3166 case "\$1" in
3167  ~/*|~)
3168         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3169         ;;
3170  ~*)
3171         if $test -f /bin/csh; then
3172                 /bin/csh -f -c "glob \$1"
3173                 failed=\$?
3174                 echo ""
3175                 exit \$failed
3176         else
3177                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3178                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3179                 if $test ! -d "\$dir"; then
3180                         me=\`basename \$0\`
3181                         echo "\$me: can't locate home directory for: \$name" >&2
3182                         exit 1
3183                 fi
3184                 case "\$1" in
3185                 */*)
3186                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3187                         ;;
3188                 *)
3189                         echo \$dir
3190                         ;;
3191                 esac
3192         fi
3193         ;;
3194 *)
3195         echo \$1
3196         ;;
3197 esac
3198 EOSS
3199 chmod +x filexp
3200 $eunicefix filexp
3201
3202 : now set up to get a file name
3203 cat <<EOS >getfile
3204 $startsh
3205 EOS
3206 cat <<'EOSC' >>getfile
3207 tilde=''
3208 fullpath=''
3209 already=''
3210 skip=''
3211 none_ok=''
3212 exp_file=''
3213 nopath_ok=''
3214 orig_rp="$rp"
3215 orig_dflt="$dflt"
3216 case "$gfpth" in
3217 '') gfpth='.' ;;
3218 esac
3219
3220 case "$fn" in
3221 *\(*)
3222         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3223         fn=`echo $fn | sed 's/(.*)//'`
3224         ;;
3225 esac
3226
3227 case "$fn" in
3228 *:*)
3229         loc_file=`expr $fn : '.*:\(.*\)'`
3230         fn=`expr $fn : '\(.*\):.*'`
3231         ;;
3232 esac
3233
3234 case "$fn" in
3235 *~*) tilde=true;;
3236 esac
3237 case "$fn" in
3238 */*) fullpath=true;;
3239 esac
3240 case "$fn" in
3241 *+*) skip=true;;
3242 esac
3243 case "$fn" in
3244 *n*) none_ok=true;;
3245 esac
3246 case "$fn" in
3247 *e*) exp_file=true;;
3248 esac
3249 case "$fn" in
3250 *p*) nopath_ok=true;;
3251 esac
3252
3253 case "$fn" in
3254 *f*) type='File';;
3255 *d*) type='Directory';;
3256 *l*) type='Locate';;
3257 esac
3258
3259 what="$type"
3260 case "$what" in
3261 Locate) what='File';;
3262 esac
3263
3264 case "$exp_file" in
3265 '')
3266         case "$d_portable" in
3267         "$define") ;;
3268         *) exp_file=true;;
3269         esac
3270         ;;
3271 esac
3272
3273 cd ..
3274 while test "$type"; do
3275         redo=''
3276         rp="$orig_rp"
3277         dflt="$orig_dflt"
3278         case "$tilde" in
3279         true) rp="$rp (~name ok)";;
3280         esac
3281         . UU/myread
3282         if test -f UU/getfile.ok && \
3283                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3284         then
3285                 value="$ans"
3286                 ansexp="$ans"
3287                 break
3288         fi
3289         case "$ans" in
3290         none)
3291                 value=''
3292                 ansexp=''
3293                 case "$none_ok" in
3294                 true) type='';;
3295                 esac
3296                 ;;
3297         *)
3298                 case "$tilde" in
3299                 '') value="$ans"
3300                         ansexp="$ans";;
3301                 *)
3302                         value=`UU/filexp $ans`
3303                         case $? in
3304                         0)
3305                                 if test "$ans" != "$value"; then
3306                                         echo "(That expands to $value on this system.)"
3307                                 fi
3308                                 ;;
3309                         *) value="$ans";;
3310                         esac
3311                         ansexp="$value"
3312                         case "$exp_file" in
3313                         '') value="$ans";;
3314                         esac
3315                         ;;
3316                 esac
3317                 case "$fullpath" in
3318                 true)
3319                         case "$ansexp" in
3320                         /*) value="$ansexp" ;;
3321                         *)
3322                                 redo=true
3323                                 case "$already" in
3324                                 true)
3325                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3326                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3327                                         ;;
3328                                 *)
3329                                 echo "Please give a full path name, starting with slash." >&4
3330                                         case "$tilde" in
3331                                         true)
3332                                 echo "Note that using ~name is ok provided it expands well." >&4
3333                                                 already=true
3334                                                 ;;
3335                                         esac
3336                                 esac
3337                                 ;;
3338                         esac
3339                         ;;
3340                 esac
3341                 case "$redo" in
3342                 '')
3343                         case "$type" in
3344                         File)
3345                                 for fp in $gfpth; do
3346                                         if test "X$fp" = X.; then
3347                                             pf="$ansexp"
3348                                         else    
3349                                             pf="$fp/$ansexp"
3350                                         fi
3351                                         if test -f "$pf"; then
3352                                                 type=''
3353                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3354                                         then
3355                                                 echo "($value is not a plain file, but that's ok.)"
3356                                                 type=''
3357                                         fi
3358                                         if test X"$type" = X; then
3359                                             value="$pf"
3360                                             break
3361                                         fi
3362                                 done
3363                                 ;;
3364                         Directory)
3365                                 for fp in $gfpth; do
3366                                         if test "X$fp" = X.; then
3367                                             pf="$ansexp"
3368                                         else    
3369                                             pf="$fp/$ansexp"
3370                                         fi
3371                                         if test -d "$pf"; then
3372                                                 type=''
3373                                                 value="$pf"
3374                                                 break
3375                                         fi
3376                                 done
3377                                 ;;
3378                         Locate)
3379                                 if test -d "$ansexp"; then
3380                                         echo "(Looking for $loc_file in directory $value.)"
3381                                         value="$value/$loc_file"
3382                                         ansexp="$ansexp/$loc_file"
3383                                 fi
3384                                 if test -f "$ansexp"; then
3385                                         type=''
3386                                 fi
3387                                 case "$nopath_ok" in
3388                                 true)   case "$value" in
3389                                         */*) ;;
3390                                         *)      echo "Assuming $value will be in people's path."
3391                                                 type=''
3392                                                 ;;
3393                                         esac
3394                                         ;;
3395                                 esac
3396                                 ;;
3397                         esac
3398
3399                         case "$skip" in
3400                         true) type='';
3401                         esac
3402
3403                         case "$type" in
3404                         '') ;;
3405                         *)
3406                                 if test "$fastread" = yes; then
3407                                         dflt=y
3408                                 else
3409                                         dflt=n
3410                                 fi
3411                                 rp="$what $value doesn't exist.  Use that name anyway?"
3412                                 . UU/myread
3413                                 dflt=''
3414                                 case "$ans" in
3415                                 y*) type='';;
3416                                 *) echo " ";;
3417                                 esac
3418                                 ;;
3419                         esac
3420                         ;;
3421                 esac
3422                 ;;
3423         esac
3424 done
3425 cd UU
3426 ans="$value"
3427 rp="$orig_rp"
3428 dflt="$orig_dflt"
3429 rm -f getfile.ok
3430 test "X$gfpthkeep" != Xy && gfpth=""
3431 EOSC
3432
3433 : determine root of directory hierarchy where package will be installed.
3434 case "$prefix" in
3435 '')
3436         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3437         ;;
3438 *)
3439         dflt="$prefix"
3440         ;;
3441 esac
3442 $cat <<EOM
3443
3444 By default, $package will be installed in $dflt/bin, manual pages
3445 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3446 installation directories. Typically this is something like /usr/local.
3447 If you wish to have binaries under /usr/bin but other parts of the
3448 installation under /usr/local, that's ok: you will be prompted
3449 separately for each of the installation directories, the prefix being
3450 only used to set the defaults.
3451
3452 EOM
3453 fn=d~
3454 rp='Installation prefix to use?'
3455 . ./getfile
3456 oldprefix=''
3457 case "$prefix" in
3458 '') ;;
3459 *)
3460         case "$ans" in
3461         "$prefix") ;;
3462         *) oldprefix="$prefix";;
3463         esac
3464         ;;
3465 esac
3466 prefix="$ans"
3467 prefixexp="$ansexp"
3468
3469 : is AFS running?
3470 echo " "
3471 case "$afs" in
3472 $define|true)   afs=true ;;
3473 $undef|false)   afs=false ;;
3474 *)      if test -d /afs; then
3475                 afs=true
3476         else
3477                 afs=false
3478         fi
3479         ;;
3480 esac
3481 if $afs; then
3482         echo "AFS may be running... I'll be extra cautious then..." >&4
3483 else
3484         echo "AFS does not seem to be running..." >&4
3485 fi
3486
3487 : determine installation prefix for where package is to be installed.
3488 if $afs; then 
3489 $cat <<EOM
3490
3491 Since you are running AFS, I need to distinguish the directory in which
3492 files will reside from the directory in which they are installed (and from
3493 which they are presumably copied to the former directory by occult means).
3494
3495 EOM
3496         case "$installprefix" in
3497         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3498         *) dflt="$installprefix";;
3499         esac
3500 else
3501 $cat <<EOM
3502
3503 In some special cases, particularly when building $package for distribution,
3504 it is convenient to distinguish between the directory in which files should 
3505 be installed from the directory ($prefix) in which they 
3506 will eventually reside.  For most users, these two directories are the same.
3507
3508 EOM
3509         case "$installprefix" in
3510         '') dflt=$prefix ;;
3511         *) dflt=$installprefix;;
3512         esac
3513 fi
3514 fn=d~
3515 rp='What installation prefix should I use for installing files?'
3516 . ./getfile
3517 installprefix="$ans"
3518 installprefixexp="$ansexp"
3519
3520 : set the prefixit variable, to compute a suitable default value
3521 prefixit='case "$3" in
3522 ""|none)
3523         case "$oldprefix" in
3524         "") eval "$1=\"\$$2\"";;
3525         *)
3526                 case "$3" in
3527                 "") eval "$1=";;
3528                 none)
3529                         eval "tp=\"\$$2\"";
3530                         case "$tp" in
3531                         ""|" ") eval "$1=\"\$$2\"";;
3532                         *) eval "$1=";;
3533                         esac;;
3534                 esac;;
3535         esac;;
3536 *)
3537         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3538         case "$tp" in
3539         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3540         /*-$oldprefix/*|\~*-$oldprefix/*)
3541                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3542         *) eval "$1=\"\$$2\"";;
3543         esac;;
3544 esac'
3545
3546 : set the base revision
3547 baserev=5.0
3548
3549 : get the patchlevel
3550 echo " "
3551 echo "Getting the current patchlevel..." >&4
3552 if $test -r $rsrc/patchlevel.h;then
3553         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3554         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3555 else
3556         patchlevel=0
3557         subversion=0
3558 fi
3559 $echo $n "(You have $package" $c
3560 case "$package" in
3561 "*$baserev")    ;;
3562 *)              $echo $n " $baserev" $c ;;
3563 esac
3564 $echo $n " patchlevel $patchlevel" $c
3565 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3566 echo ".)"
3567
3568 if test 0 -eq "$subversion"; then
3569         version=`LC_ALL=C; export LC_ALL; \
3570                  echo $baserev $patchlevel | \
3571                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3572 else
3573         version=`LC_ALL=C; export LC_ALL; \
3574                  echo $baserev $patchlevel $subversion | \
3575                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3576 fi
3577 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3578 if test "$subversion" -lt 50; then
3579         apiversion=`LC_ALL=C; export LC_ALL; \
3580                  LANGUAGE=C; export LANGUAGE; \
3581                  echo $baserev $patchlevel | \
3582                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3583 else
3584         apiversion="$version"
3585 fi
3586
3587 : determine installation style
3588 : For now, try to deduce it from prefix unless it is already set.
3589 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3590 case "$installstyle" in
3591 '')     case "$prefix" in
3592                 *perl*) dflt='lib';;
3593                 *) dflt='lib/perl5' ;;
3594         esac
3595         ;;
3596 *)      dflt='lib/perl5' ;;
3597 esac
3598 : Probably not worth prompting for this since we prompt for all
3599 : the directories individually, and the prompt would be too long and
3600 : confusing anyway.
3601 installstyle=$dflt
3602
3603 : determine where private library files go
3604 : Usual default is /usr/local/lib/perl5/$version.
3605 : Also allow things like /opt/perl/lib/$version, since 
3606 : /opt/perl/lib/perl5... would be redundant.
3607 : The default "style" setting is made in installstyle.U
3608 case "$installstyle" in
3609 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3610 *)       set dflt privlib lib/$version ;;
3611 esac
3612 eval $prefixit
3613 $cat <<EOM
3614
3615 There are some auxiliary files for $package that need to be put into a
3616 private library directory that is accessible by everyone.
3617
3618 EOM
3619 fn=d~+
3620 rp='Pathname where the private library files will reside?'
3621 . ./getfile
3622 privlib="$ans"
3623 privlibexp="$ansexp"
3624 : Change installation prefix, if necessary.
3625 if $test X"$prefix" != X"$installprefix"; then
3626         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3627 else
3628         installprivlib="$privlibexp"
3629 fi
3630
3631 : set the prefixup variable, to restore leading tilda escape
3632 prefixup='case "$prefixexp" in
3633 "$prefix") ;;
3634 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3635 esac'
3636
3637 : determine where public architecture dependent libraries go
3638 set archlib archlib
3639 eval $prefixit
3640 : privlib default is /usr/local/lib/$package/$version
3641 : archlib default is /usr/local/lib/$package/$version/$archname
3642 : privlib may have an optional trailing /share.
3643 tdflt=`echo $privlib | $sed 's,/share$,,'`
3644 tdflt=$tdflt/$archname
3645 case "$archlib" in
3646 '')     dflt=$tdflt
3647         ;;
3648 *)      dflt="$archlib"
3649     ;;
3650 esac
3651 $cat <<EOM
3652
3653 $spackage contains architecture-dependent library files.  If you are
3654 sharing libraries in a heterogeneous environment, you might store
3655 these files in a separate location.  Otherwise, you can just include
3656 them with the rest of the public library files.
3657
3658 EOM
3659 fn=d+~
3660 rp='Where do you want to put the public architecture-dependent libraries?'
3661 . ./getfile
3662 archlib="$ans"
3663 archlibexp="$ansexp"
3664 if $test X"$archlib" = X"$privlib"; then
3665         d_archlib="$undef"
3666 else
3667         d_archlib="$define"
3668 fi
3669 : Change installation prefix, if necessary.
3670 if $test X"$prefix" != X"$installprefix"; then
3671         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3672 else
3673         installarchlib="$archlibexp"
3674 fi
3675
3676
3677 : Binary compatibility with 5.005 is not possible for builds
3678 : with advanced features
3679 case "$usethreads$usemultiplicity" in
3680 *define*)
3681         bincompat5005="$undef"
3682         d_bincompat5005="$undef"
3683         ;;
3684 *)      $cat <<EOM
3685
3686 Perl 5.006 can be compiled for binary compatibility with 5.005.
3687 If you decide to do so, you will be able to continue using most
3688 of the extensions that were compiled for Perl 5.005.
3689
3690 EOM
3691         case "$bincompat5005$d_bincompat5005" in
3692         *"$undef"*) dflt=n ;;
3693         *) dflt=y ;;
3694         esac
3695         rp='Binary compatibility with Perl 5.005?'
3696         . ./myread
3697         case "$ans" in
3698         y*) val="$define" ;;
3699         *)  val="$undef" ;;
3700         esac
3701         set d_bincompat5005
3702         eval $setvar
3703         case "$d_bincompat5005" in
3704         "$define")
3705                 bincompat5005="$define"
3706                 ;;
3707         *)      bincompat5005="$undef"
3708                 d_bincompat5005="$undef"
3709                 ;;
3710         esac
3711         ;;
3712 esac
3713
3714
3715 : see if setuid scripts can be secure
3716 $cat <<EOM
3717
3718 Some kernels have a bug that prevents setuid #! scripts from being
3719 secure.  Some sites have disabled setuid #! scripts because of this.
3720
3721 First let's decide if your kernel supports secure setuid #! scripts.
3722 (If setuid #! scripts would be secure but have been disabled anyway,
3723 don't say that they are secure if asked.)
3724
3725 EOM
3726
3727 val="$undef"
3728 if $test -d /dev/fd; then
3729         echo "#!$ls" >reflect
3730         chmod +x,u+s reflect
3731         ./reflect >flect 2>&1
3732         if $contains "/dev/fd" flect >/dev/null; then
3733                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3734                 val="$define"
3735         else
3736                 $cat <<EOM
3737 If you are not sure if they are secure, I can check but I'll need a
3738 username and password different from the one you are using right now.
3739 If you don't have such a username or don't want me to test, simply
3740 enter 'none'.
3741
3742 EOM
3743                 rp='Other username to test security of setuid scripts with?'
3744                 dflt='none'
3745                 . ./myread
3746                 case "$ans" in
3747                 n|none)
3748                         case "$d_suidsafe" in
3749                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3750                                 dflt=n;;
3751                         "$undef")
3752                                 echo "Well, the $hint value is *not* secure." >&4
3753                                 dflt=n;;
3754                         *)      echo "Well, the $hint value *is* secure." >&4
3755                                 dflt=y;;
3756                         esac
3757                         ;;
3758                 *)
3759                         $rm -f reflect flect
3760                         echo "#!$ls" >reflect
3761                         chmod +x,u+s reflect
3762                         echo >flect
3763                         chmod a+w flect
3764                         echo '"su" will (probably) prompt you for '"$ans's password."
3765                         su $ans -c './reflect >flect'
3766                         if $contains "/dev/fd" flect >/dev/null; then
3767                                 echo "Okay, it looks like setuid scripts are secure." >&4
3768                                 dflt=y
3769                         else
3770                                 echo "I don't think setuid scripts are secure." >&4
3771                                 dflt=n
3772                         fi
3773                         ;;
3774                 esac
3775                 rp='Does your kernel have *secure* setuid scripts?'
3776                 . ./myread
3777                 case "$ans" in
3778                 [yY]*)  val="$define";;
3779                 *)      val="$undef";;
3780                 esac
3781         fi
3782 else
3783         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3784         echo "(That's for file descriptors, not floppy disks.)"
3785         val="$undef"
3786 fi
3787 set d_suidsafe
3788 eval $setvar
3789
3790 $rm -f reflect flect
3791
3792 : now see if they want to do setuid emulation
3793 echo " "
3794 val="$undef"
3795 case "$d_suidsafe" in
3796 "$define")
3797         val="$undef"
3798         echo "No need to emulate SUID scripts since they are secure here." >& 4
3799         ;;
3800 *)
3801         $cat <<EOM
3802 Some systems have disabled setuid scripts, especially systems where
3803 setuid scripts cannot be secure.  On systems where setuid scripts have
3804 been disabled, the setuid/setgid bits on scripts are currently
3805 useless.  It is possible for $package to detect those bits and emulate
3806 setuid/setgid in a secure fashion.  This emulation will only work if
3807 setuid scripts have been disabled in your kernel.
3808
3809 EOM
3810         case "$d_dosuid" in
3811         "$define") dflt=y ;;
3812         *) dflt=n ;;
3813         esac
3814         rp="Do you want to do setuid/setgid emulation?"
3815         . ./myread
3816         case "$ans" in
3817         [yY]*)  val="$define";;
3818         *)      val="$undef";;
3819         esac
3820         ;;
3821 esac
3822 set d_dosuid
3823 eval $setvar
3824
3825 : What should the include directory be ?
3826 echo " "
3827 $echo $n "Hmm...  $c"
3828 dflt='/usr/include'
3829 incpath=''
3830 mips_type=''
3831 if $test -f /bin/mips && /bin/mips; then
3832         echo "Looks like a MIPS system..."
3833         $cat >usr.c <<'EOCP'
3834 #ifdef SYSTYPE_BSD43
3835 /bsd43
3836 #endif
3837 EOCP
3838         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3839                 dflt='/bsd43/usr/include'
3840                 incpath='/bsd43'
3841                 mips_type='BSD 4.3'
3842         else
3843                 mips_type='System V'
3844         fi
3845         $rm -f usr.c usr.out
3846         echo "and you're compiling with the $mips_type compiler and libraries."
3847         xxx_prompt=y
3848         echo "exit 0" >mips
3849 else
3850         echo "Doesn't look like a MIPS system."
3851         xxx_prompt=n
3852         echo "exit 1" >mips
3853 fi
3854 chmod +x mips
3855 $eunicefix mips
3856 case "$usrinc" in
3857 '') ;;
3858 *) dflt="$usrinc";;
3859 esac
3860 case "$xxx_prompt" in
3861 y)      fn=d/
3862         echo " "
3863         rp='Where are the include files you want to use?'
3864         . ./getfile
3865         usrinc="$ans"
3866         ;;
3867 *)      usrinc="$dflt"
3868         ;;
3869 esac
3870
3871 : see how we invoke the C preprocessor
3872 echo " "
3873 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3874 cat <<'EOT' >testcpp.c
3875 #define ABC abc
3876 #define XYZ xyz
3877 ABC.XYZ
3878 EOT
3879 cd ..
3880 if test ! -f cppstdin; then
3881         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3882                 # AIX cc -E doesn't show the absolute headerfile
3883                 # locations but we'll cheat by using the -M flag.
3884                 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
3885         else
3886                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3887         fi
3888 else
3889         echo "Keeping your $hint cppstdin wrapper."
3890 fi
3891 chmod 755 cppstdin
3892 wrapper=`pwd`/cppstdin
3893 ok='false'
3894 cd UU
3895
3896 if $test "X$cppstdin" != "X" && \
3897         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3898         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3899 then
3900         echo "You used to use $cppstdin $cppminus so we'll use that again."
3901         case "$cpprun" in
3902         '') echo "But let's see if we can live without a wrapper..." ;;
3903         *)
3904                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3905                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3906                 then
3907                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3908                         ok='true'
3909                 else
3910                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3911                 fi
3912                 ;;
3913         esac
3914 else
3915         case "$cppstdin" in
3916         '') ;;
3917         *)
3918                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3919                 ;;
3920         esac
3921 fi
3922
3923 if $ok; then
3924         : nothing
3925 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3926         $cc -E <testcpp.c >testcpp.out 2>&1; \
3927         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3928         echo "Yup, it does."
3929         x_cpp="$cc -E"
3930         x_minus='';
3931 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3932         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3933         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3934         echo "Yup, it does."
3935         x_cpp="$cc -E"
3936         x_minus='-';
3937 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3938         $cc -P <testcpp.c >testcpp.out 2>&1; \
3939         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3940         echo "Yipee, that works!"
3941         x_cpp="$cc -P"
3942         x_minus='';
3943 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3944         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3945         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3946         echo "At long last!"
3947         x_cpp="$cc -P"
3948         x_minus='-';
3949 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3950         $cpp <testcpp.c >testcpp.out 2>&1; \
3951         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3952         echo "It works!"
3953         x_cpp="$cpp"
3954         x_minus='';
3955 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3956         $cpp - <testcpp.c >testcpp.out 2>&1; \
3957         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3958         echo "Hooray, it works!  I was beginning to wonder."
3959         x_cpp="$cpp"
3960         x_minus='-';
3961 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3962         $wrapper <testcpp.c >testcpp.out 2>&1; \
3963         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3964         x_cpp="$wrapper"
3965         x_minus=''
3966         echo "Eureka!"
3967 else
3968         dflt=''
3969         rp="No dice.  I can't find a C preprocessor.  Name one:"
3970         . ./myread
3971         x_cpp="$ans"
3972         x_minus=''
3973         $x_cpp <testcpp.c >testcpp.out 2>&1
3974         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3975                 echo "OK, that will do." >&4
3976         else
3977 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3978                 exit 1
3979         fi
3980 fi
3981
3982 case "$ok" in
3983 false)
3984         cppstdin="$x_cpp"
3985         cppminus="$x_minus"
3986         cpprun="$x_cpp"
3987         cpplast="$x_minus"
3988         set X $x_cpp
3989         shift
3990         case "$1" in
3991         "$cpp")
3992                 echo "Perhaps can we force $cc -E using a wrapper..."
3993                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3994                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3995                 then
3996                         echo "Yup, we can."
3997                         cppstdin="$wrapper"
3998                         cppminus='';
3999                 else
4000                         echo "Nope, we'll have to live without it..."
4001                 fi
4002                 ;;
4003         esac
4004         case "$cpprun" in
4005         "$wrapper")
4006                 cpprun=''
4007                 cpplast=''
4008                 ;;
4009         esac
4010         ;;
4011 esac
4012
4013 case "$cppstdin" in
4014 "$wrapper"|'cppstdin') ;;
4015 *) $rm -f $wrapper;;
4016 esac
4017 $rm -f testcpp.c testcpp.out
4018
4019 : Set private lib path
4020 case "$plibpth" in
4021 '') if ./mips; then
4022                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4023         fi;;
4024 esac
4025 case "$libpth" in
4026 ' ') dlist='';;
4027 '') dlist="$loclibpth $plibpth $glibpth";;
4028 *) dlist="$libpth";;
4029 esac
4030
4031 : Now check and see which directories actually exist, avoiding duplicates
4032 libpth=''
4033 for xxx in $dlist
4034 do
4035     if $test -d $xxx; then
4036                 case " $libpth " in
4037                 *" $xxx "*) ;;
4038                 *) libpth="$libpth $xxx";;
4039                 esac
4040     fi
4041 done
4042 $cat <<'EOM'
4043
4044 Some systems have incompatible or broken versions of libraries.  Among
4045 the directories listed in the question below, please remove any you
4046 know not to be holding relevant libraries, and add any that are needed.
4047 Say "none" for none.
4048
4049 EOM
4050 case "$libpth" in
4051 '') dflt='none';;
4052 *)
4053         set X $libpth
4054         shift
4055         dflt=${1+"$@"}
4056         ;;
4057 esac
4058 rp="Directories to use for library searches?"
4059 . ./myread
4060 case "$ans" in
4061 none) libpth=' ';;
4062 *) libpth="$ans";;
4063 esac
4064
4065 : compute shared library extension
4066 case "$so" in
4067 '')
4068         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4069                 dflt='sl'
4070         else
4071                 dflt='so'
4072         fi
4073         ;;
4074 *) dflt="$so";;
4075 esac
4076 $cat <<EOM
4077
4078 On some systems, shared libraries may be available.  Answer 'none' if
4079 you want to suppress searching of shared libraries for the remaining
4080 of this configuration.
4081
4082 EOM
4083 rp='What is the file extension used for shared libraries?'
4084 . ./myread
4085 so="$ans"
4086
4087 : Define several unixisms.
4088 : Hints files or command line option can be used to override them.
4089 : The convoluted testing is in case hints files set either the old
4090 : or the new name.
4091 case "$_exe" in
4092 '')     case "$exe_ext" in
4093     '') ;;
4094         *)      _exe="$exe_ext" ;;
4095         esac
4096         ;;
4097 esac
4098 case "$_a" in
4099 '')     case "$lib_ext" in
4100     '') _a='.a';;
4101         *)      _a="$lib_ext" ;;
4102         esac
4103         ;;
4104 esac
4105 case "$_o" in
4106 '') case "$obj_ext" in
4107         '')     _o='.o';;
4108         *)      _o="$obj_ext";;
4109         esac
4110         ;;
4111 esac
4112 case "$p_" in
4113 '') case "$path_sep" in
4114         '')     p_=':';;
4115         *)      p_="$path_sep";;
4116         esac
4117         ;;
4118 esac
4119 exe_ext=$_exe
4120 lib_ext=$_a
4121 obj_ext=$_o
4122 path_sep=$p_
4123
4124 : Which makefile gets called first.  This is used by make depend.
4125 case "$firstmakefile" in
4126 '') firstmakefile='makefile';;
4127 esac
4128
4129 cat <<EOM
4130
4131 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4132 Configure must be run with -Dusesocks.
4133
4134 Normally you do not need this and you should answer no.
4135
4136 EOM
4137 case "$usesocks" in
4138 $define|true|[yY]*)     dflt='y';;
4139 *) dflt='n';;
4140 esac
4141 rp='Build Perl for SOCKS?'
4142 . ./myread
4143 case "$ans" in
4144 y|Y)    val="$define" ;;     
4145 *)      val="$undef" ;;
4146 esac
4147 set usesocks
4148 eval $setvar
4149
4150 : Looking for optional libraries
4151 echo " "
4152 echo "Checking for optional libraries..." >&4
4153 case "$libs" in
4154 ' '|'') dflt='';;
4155 *) dflt="$libs";;
4156 esac
4157 case "$libswanted" in
4158 '') libswanted='c_s';;
4159 esac
4160 case "$usesocks" in
4161 $define)
4162         libswanted="$libswanted socks5 socks5_sh"
4163         ;;
4164 esac
4165 for thislib in $libswanted; do
4166         
4167         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4168                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4169                 echo "Found -l$thislib (shared)."
4170                 case " $dflt " in
4171                 *"-l$thislib "*);;
4172                 *) dflt="$dflt -l$thislib";;
4173                 esac
4174         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4175                 echo "Found -l$thislib (shared)."
4176                 case " $dflt " in
4177                 *"-l$thislib "*);;
4178                 *) dflt="$dflt -l$thislib";;
4179                 esac
4180         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4181                 echo "Found -l$thislib."
4182                 case " $dflt " in
4183                 *"-l$thislib "*);;
4184                 *) dflt="$dflt -l$thislib";;
4185                 esac
4186         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4187                 echo "Found -l$thislib."
4188                 case " $dflt " in
4189                 *"-l$thislib "*);;
4190                 *) dflt="$dflt -l$thislib";;
4191                 esac
4192         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4193                 echo "Found -l${thislib}_s."
4194                 case " $dflt " in
4195                 *"-l$thislib "*);;
4196                 *) dflt="$dflt -l${thislib}_s";;
4197                 esac
4198         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4199                 echo "Found -l$thislib."
4200                 case " $dflt " in
4201                 *"-l$thislib "*);;
4202                 *) dflt="$dflt -l$thislib";;
4203                 esac
4204         else
4205                 echo "No -l$thislib."
4206         fi
4207 done
4208 set X $dflt
4209 shift
4210 dflt="$*"
4211 case "$libs" in
4212 '') dflt="$dflt";;
4213 *) dflt="$libs";;
4214 esac
4215 case "$dflt" in
4216 ' '|'') dflt='none';;
4217 esac
4218
4219 $cat <<EOM
4220
4221 In order to compile $package on your machine, a number of libraries
4222 are usually needed.  Include any other special libraries here as well.
4223 Say "none" for none.  The default list is almost always right.
4224 EOM
4225
4226 echo " "
4227 rp="What libraries to use?"
4228 . ./myread
4229 case "$ans" in
4230 none) libs=' ';;
4231 *) libs="$ans";;
4232 esac
4233
4234 : determine optimization, if desired, or use for debug flag also
4235 case "$optimize" in
4236 ' '|$undef) dflt='none';;
4237 '') dflt='-O';;
4238 *) dflt="$optimize";;
4239 esac
4240 $cat <<EOH
4241
4242 By default, $package compiles with the -O flag to use the optimizer.
4243 Alternately, you might want to use the symbolic debugger, which uses
4244 the -g flag (on traditional Unix systems).  Either flag can be
4245 specified here.  To use neither flag, specify the word "none".
4246
4247 EOH
4248 rp="What optimizer/debugger flag should be used?"
4249 . ./myread
4250 optimize="$ans"
4251 case "$optimize" in
4252 'none') optimize=" ";;
4253 esac
4254
4255 dflt=''
4256 : We will not override a previous value, but we might want to
4257 : augment a hint file
4258 case "$hint" in
4259 default|recommended)
4260         case "$gccversion" in
4261         1*) dflt='-fpcc-struct-return' ;;
4262         esac
4263         case "$optimize" in
4264         *-g*) dflt="$dflt -DDEBUGGING";;
4265         esac
4266         case "$gccversion" in
4267         2*) if test -d /etc/conf/kconfig.d &&
4268                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4269                 then
4270                         dflt="$dflt -posix"
4271                 fi
4272                 ;;
4273         esac
4274         case "$gccversion" in
4275         1*) ;;
4276         2.[0-8]*) ;;
4277         *)      echo " "
4278                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4279                 echo 'int main(void) { return 0; }' > gcctest.c
4280                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4281                         echo "Yes, it does." 2>&1
4282                         case "$ccflags" in
4283                         *strict-aliasing*) 
4284                                 echo "Leaving current flags $ccflags alone." 2>&1
4285                                 ;;
4286                         *) dflt="$dflt -fno-strict-aliasing" ;;
4287                         esac
4288                 else
4289                         echo "Nope, it doesn't, but that's ok." 2>&1
4290                 fi
4291                 ;;
4292         esac
4293         ;;
4294 esac
4295
4296 case "$mips_type" in
4297 *BSD*|'') inclwanted="$locincpth $usrinc";;
4298 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4299 esac
4300 for thisincl in $inclwanted; do
4301         if $test -d $thisincl; then
4302                 if $test x$thisincl != x$usrinc; then
4303                         case "$dflt" in
4304                         *$thisincl*);;
4305                         *) dflt="$dflt -I$thisincl";;
4306                         esac
4307                 fi
4308         fi
4309 done
4310
4311 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4312         xxx=true;
4313 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4314         xxx=true;
4315 else
4316         xxx=false;
4317 fi;
4318 if $xxx; then
4319         case "$dflt" in
4320         *$2*);;
4321         *) dflt="$dflt -D$2";;
4322         esac;
4323 fi'
4324
4325 set signal.h LANGUAGE_C; eval $inctest
4326
4327 case "$usesocks" in
4328 $define)
4329         ccflags="$ccflags -DSOCKS"
4330         ;;
4331 esac
4332
4333 case "$hint" in
4334 default|recommended) dflt="$ccflags $dflt" ;;
4335 *) dflt="$ccflags";;
4336 esac
4337
4338 case "$dflt" in
4339 ''|' ') dflt=none;;
4340 esac
4341 $cat <<EOH
4342
4343 Your C compiler may want other flags.  For this question you should include
4344 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4345 but you should NOT include libraries or ld flags like -lwhatever.  If you
4346 want $package to honor its debug switch, you should include -DDEBUGGING here.
4347 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4348
4349 To use no flags, specify the word "none".
4350
4351 EOH
4352 set X $dflt
4353 shift
4354 dflt=${1+"$@"}
4355 rp="Any additional cc flags?"
4356 . ./myread
4357 case "$ans" in
4358 none) ccflags='';;
4359 *) ccflags="$ans";;
4360 esac
4361
4362 : the following weeds options from ccflags that are of no interest to cpp
4363 cppflags="$ccflags"
4364 case "$gccversion" in
4365 1*) cppflags="$cppflags -D__GNUC__"
4366 esac
4367 case "$mips_type" in
4368 '');;
4369 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4370 esac
4371 case "$cppflags" in
4372 '');;
4373 *)
4374         echo " "
4375         echo "Let me guess what the preprocessor flags are..." >&4
4376         set X $cppflags
4377         shift
4378         cppflags=''
4379         $cat >cpp.c <<'EOM'
4380 #define BLURFL foo
4381
4382 BLURFL xx LFRULB
4383 EOM
4384         previous=''
4385         for flag in $*
4386         do
4387                 case "$flag" in
4388                 -*) ftry="$flag";;
4389                 *) ftry="$previous $flag";;
4390                 esac
4391                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4392                         >cpp1.out 2>/dev/null && \
4393                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4394                         >cpp2.out 2>/dev/null && \
4395                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4396                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4397                 then
4398                         cppflags="$cppflags $ftry"
4399                         previous=''
4400                 else
4401                         previous="$flag"
4402                 fi
4403         done
4404         set X $cppflags
4405         shift
4406         cppflags=${1+"$@"}
4407         case "$cppflags" in
4408         *-*)  echo "They appear to be: $cppflags";;
4409         esac
4410         $rm -f cpp.c cpp?.out
4411         ;;
4412 esac
4413
4414 : flags used in final linking phase
4415 case "$ldflags" in
4416 '') if ./venix; then
4417                 dflt='-i -z'
4418         else
4419                 dflt=''
4420         fi
4421         case "$ccflags" in
4422         *-posix*) dflt="$dflt -posix" ;;
4423         esac
4424         ;;
4425 *) dflt="$ldflags";;
4426 esac
4427
4428 : Try to guess additional flags to pick up local libraries.
4429 for thislibdir in $libpth; do
4430         case " $loclibpth " in
4431         *" $thislibdir "*)
4432                 case "$dflt " in 
4433                 *"-L$thislibdir "*) ;;
4434                 *)  dflt="$dflt -L$thislibdir" ;;
4435                 esac
4436                 ;;
4437         esac
4438 done
4439
4440 case "$dflt" in
4441 '') dflt='none' ;;
4442 esac
4443
4444 $cat <<EOH
4445
4446 Your C linker may need flags.  For this question you should
4447 include -L/whatever and any other flags used by the C linker, but you
4448 should NOT include libraries like -lwhatever.
4449
4450 Make sure you include the appropriate -L/path flags if your C linker
4451 does not normally search all of the directories you specified above,
4452 namely
4453         $libpth
4454 To use no flags, specify the word "none".
4455
4456 EOH
4457
4458 rp="Any additional ld flags (NOT including libraries)?"
4459 . ./myread
4460 case "$ans" in
4461 none) ldflags='';;
4462 *) ldflags="$ans";;
4463 esac
4464 rmlist="$rmlist pdp11"
4465
4466 : coherency check
4467 echo " "
4468 echo "Checking your choice of C compiler and flags for coherency..." >&4
4469 $cat > try.c <<'EOF'
4470 #include <stdio.h>
4471 int main() { printf("Ok\n"); exit(0); }
4472 EOF
4473 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4474 shift
4475 $cat >try.msg <<'EOM'
4476 I've tried to compile and run the following simple program:
4477
4478 EOM
4479 $cat try.c >> try.msg
4480
4481 $cat >> try.msg <<EOM
4482
4483 I used the command:
4484
4485         $*
4486         ./try
4487
4488 and I got the following output:
4489
4490 EOM
4491 dflt=y
4492 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4493         if sh -c './try' >>try.msg 2>&1; then
4494                 xxx=`./try`
4495                 case "$xxx" in
4496                 "Ok") dflt=n ;;
4497                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4498                         case " $libs " in
4499                         *" -lsfio "*)
4500                                 cat >> try.msg <<'EOQS'
4501 If $libs contains -lsfio, and sfio is mis-configured, then it
4502 sometimes (apparently) runs and exits with a 0 status, but with no
4503 output!  It may have to do with sfio's use of _exit vs. exit.
4504
4505 EOQS
4506                                 rp="You have a big problem.  Shall I abort Configure"
4507                                 dflt=y
4508                                 ;;
4509                         esac
4510                         ;;
4511                 esac
4512         else
4513                 echo "The program compiled OK, but exited with status $?." >>try.msg
4514                 rp="You have a problem.  Shall I abort Configure"
4515                 dflt=y
4516         fi
4517 else
4518         echo "I can't compile the test program." >>try.msg
4519         rp="You have a BIG problem.  Shall I abort Configure"
4520         dflt=y
4521 fi
4522 case "$dflt" in
4523 y)
4524         $cat try.msg >&4
4525         case "$knowitall" in
4526         '')
4527                 echo "(The supplied flags or libraries might be incorrect.)"
4528                 ;;
4529         *) dflt=n;;
4530         esac
4531         echo " "
4532         . ./myread
4533         case "$ans" in
4534         n*|N*) ;;
4535         *)      echo "Ok.  Stopping Configure." >&4
4536                 exit 1
4537                 ;;
4538         esac
4539         ;;
4540 n) echo "OK, that should do.";;
4541 esac
4542 $rm -f try try.* core
4543
4544 : determine filename position in cpp output
4545 echo " "
4546 echo "Computing filename position in cpp output for #include directives..." >&4
4547 echo '#include <stdio.h>' > foo.c
4548 $cat >fieldn <<EOF
4549 $startsh
4550 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4551 $grep '^[       ]*#.*stdio\.h' | \
4552 while read cline; do
4553         pos=1
4554         set \$cline
4555         while $test \$# -gt 0; do
4556                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4557                         echo "\$pos"
4558                         exit 0
4559                 fi
4560                 shift
4561                 pos=\`expr \$pos + 1\`
4562         done
4563 done
4564 EOF
4565 chmod +x fieldn
4566 fieldn=`./fieldn`
4567 $rm -f foo.c fieldn
4568 case $fieldn in
4569 '') pos='???';;
4570 1) pos=first;;
4571 2) pos=second;;
4572 3) pos=third;;
4573 *) pos="${fieldn}th";;
4574 esac
4575 echo "Your cpp writes the filename in the $pos field of the line."
4576
4577 : locate header file
4578 $cat >findhdr <<EOF
4579 $startsh
4580 wanted=\$1
4581 name=''
4582 for usrincdir in $usrinc
4583 do
4584         if test -f \$usrincdir/\$wanted; then
4585                 echo "\$usrincdir/\$wanted"
4586                 exit 0
4587         fi
4588 done
4589 awkprg='{ print \$$fieldn }'
4590 echo "#include <\$wanted>" > foo\$\$.c
4591 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4592 $grep "^[       ]*#.*\$wanted" | \
4593 while read cline; do
4594         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4595         case "\$name" in
4596         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4597         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4598         *) exit 2;;
4599         esac;
4600 done;
4601 #
4602 # status = 0: grep returned 0 lines, case statement not executed
4603 # status = 1: headerfile found
4604 # status = 2: while loop executed, no headerfile found
4605 #
4606 status=\$?
4607 $rm -f foo\$\$.c;
4608 if test \$status -eq 1; then
4609         exit 0;
4610 fi
4611 exit 1
4612 EOF
4613 chmod +x findhdr
4614
4615 : define an alternate in-header-list? function
4616 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4617 cont=true; xxf="echo \"<\$1> found.\" >&4";
4618 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4619 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4620 esac;
4621 case $# in 4) instead=instead;; *) instead="at last";; esac;
4622 while $test "$cont"; do
4623         xxx=`./findhdr $1`
4624         var=$2; eval "was=\$$2";
4625         if $test "$xxx" && $test -r "$xxx";
4626         then eval $xxf;
4627         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4628                 cont="";
4629         else eval $xxnf;
4630         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4631         set $yyy; shift; shift; yyy=$@;
4632         case $# in 0) cont="";;
4633         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4634                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4635         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4636                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4637         esac;
4638 done;
4639 while $test "$yyy";
4640 do set $yyy; var=$2; eval "was=\$$2";
4641         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4642         set $yyy; shift; shift; yyy=$@;
4643 done'
4644
4645 : see if this is a malloc.h system
4646 set malloc.h i_malloc
4647 eval $inhdr
4648
4649 : see if stdlib is available
4650 set stdlib.h i_stdlib
4651 eval $inhdr
4652
4653 : determine which malloc to compile in
4654 echo " "
4655 case "$usemymalloc" in
4656 ''|[yY]*|true|$define)  dflt='y' ;;
4657 *)      dflt='n' ;;
4658 esac
4659 rp="Do you wish to attempt to use the malloc that comes with $package?"
4660 . ./myread
4661 usemymalloc="$ans"
4662 case "$ans" in
4663 y*|true)
4664         usemymalloc='y'
4665         mallocsrc='malloc.c'
4666         mallocobj="malloc$_o"
4667         d_mymalloc="$define"
4668         case "$libs" in
4669         *-lmalloc*)
4670                 : Remove malloc from list of libraries to use
4671                 echo "Removing unneeded -lmalloc from library list" >&4
4672                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4673                 shift
4674                 libs="$*"
4675                 echo "libs = $libs" >&4
4676                 ;;
4677         esac
4678         ;;
4679 *)
4680         usemymalloc='n'
4681         mallocsrc=''
4682         mallocobj=''
4683         d_mymalloc="$undef"
4684         ;;
4685 esac
4686
4687 : compute the return types of malloc and free
4688 echo " "
4689 $cat >malloc.c <<END
4690 #$i_malloc I_MALLOC
4691 #$i_stdlib I_STDLIB
4692 #include <stdio.h>
4693 #include <sys/types.h>
4694 #ifdef I_MALLOC
4695 #include <malloc.h>
4696 #endif
4697 #ifdef I_STDLIB
4698 #include <stdlib.h>
4699 #endif
4700 #ifdef TRY_MALLOC
4701 void *malloc();
4702 #endif
4703 #ifdef TRY_FREE
4704 void free();
4705 #endif
4706 END
4707 case "$malloctype" in
4708 '')
4709         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4710                 malloctype='void *'
4711         else
4712                 malloctype='char *'
4713         fi
4714         ;;
4715 esac
4716 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4717
4718 case "$freetype" in
4719 '')
4720         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4721                 freetype='void'
4722         else
4723                 freetype='int'
4724         fi
4725         ;;
4726 esac
4727 echo "Your system uses $freetype free(), it would seem." >&4
4728 $rm -f malloc.[co]
4729 $cat <<EOM
4730
4731 The installation process will also create a directory for
4732 vendor-supplied add-ons.  Vendors who supply perl with their system
4733 may find it convenient to place all vendor-supplied files in this
4734 directory rather than in the main distribution directory.  This will
4735 ease upgrades between binary-compatible maintenance versions of perl.
4736
4737 Of course you may also use these directories in whatever way you see
4738 fit.  For example, you might use them to access modules shared over a
4739 company-wide network.
4740
4741 The default answer should be fine for most people.
4742 This causes further questions about vendor add-ons to be skipped
4743 and no vendor-specific directories will be configured for perl.
4744
4745 EOM
4746 rp='Do you want to configure vendor-specific add-on directories?'
4747 case "$usevendorprefix" in
4748 define|true|[yY]*) dflt=y ;;
4749 *) dflt=n ;;
4750 esac
4751 . ./myread
4752 case "$ans" in
4753 [yY]*)  fn=d~+
4754         rp='Installation prefix to use for vendor-supplied add-ons?'
4755         case "$vendorprefix" in
4756         '') dflt='' ;;
4757         *)  dflt=$vendorprefix ;;
4758         esac
4759         . ./getfile
4760         oldvendorprefix=''
4761         case "$vendorprefix" in
4762         '') ;;
4763         *)      case "$ans" in
4764                 "$prefix") ;;
4765                 *) oldvendorprefix="$prefix";;
4766                 esac
4767                 ;;
4768         esac
4769         usevendorprefix="$define"
4770         vendorprefix="$ans"
4771         vendorprefixexp="$ansexp"
4772         ;;
4773 *)      usevendorprefix="$undef"
4774         vendorprefix=''
4775         vendorprefixexp=''
4776         ;;
4777 esac
4778
4779 case "$vendorprefix" in
4780 '')     d_vendorlib="$undef"
4781         vendorlib=''
4782         vendorlibexp=''
4783         ;;
4784 *)      d_vendorlib="$define"
4785         : determine where vendor-supplied modules go.
4786         : Usual default is /usr/local/lib/perl5/vendor_perl
4787         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4788         case "$installstyle" in
4789         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4790         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4791         esac
4792         fn=d~+
4793         rp='Pathname for the vendor-supplied library files?'
4794         . ./getfile
4795         vendorlib="$ans"
4796         vendorlibexp="$ansexp"
4797         : Change installation prefix, if necessary.
4798         if $test X"$prefix" != X"$installprefix"; then
4799                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4800         else
4801                 installvendorlib="$vendorlibexp"
4802         fi
4803         ;;
4804 esac
4805
4806 : Cruising for prototypes
4807 echo " "
4808 echo "Checking out function prototypes..." >&4
4809 $cat >prototype.c <<'EOCP'
4810 int main(int argc, char *argv[]) {
4811         exit(0);}
4812 EOCP
4813 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4814         echo "Your C compiler appears to support function prototypes."
4815         val="$define"
4816 else
4817         echo "Your C compiler doesn't seem to understand function prototypes."
4818         val="$undef"
4819 fi
4820 set prototype
4821 eval $setvar
4822 $rm -f prototype*
4823
4824 case "$prototype" in
4825 "$define") ;;
4826 *)      ansi2knr='ansi2knr'
4827         echo " "
4828         cat <<EOM >&4
4829
4830 $me:  FATAL ERROR:
4831 This version of $package can only be compiled by a compiler that 
4832 understands function prototypes.  Unfortunately, your C compiler 
4833         $cc $ccflags
4834 doesn't seem to understand them.  Sorry about that.
4835
4836 If GNU cc is available for your system, perhaps you could try that instead.  
4837
4838 Eventually, we hope to support building Perl with pre-ANSI compilers.
4839 If you would like to help in that effort, please contact <perlbug@perl.org>.
4840
4841 Aborting Configure now.
4842 EOM
4843         exit 2
4844         ;;
4845 esac
4846
4847 : determine where public executables go
4848 echo " "
4849 set dflt bin bin
4850 eval $prefixit
4851 fn=d~
4852 rp='Pathname where the public executables will reside?'
4853 . ./getfile
4854 if $test "X$ansexp" != "X$binexp"; then
4855         installbin=''
4856 fi
4857 bin="$ans"
4858 binexp="$ansexp"
4859 : Change installation prefix, if necessary.
4860 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4861 if $test X"$prefix" != X"$installprefix"; then
4862         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4863 else
4864         installbin="$binexp"
4865 fi
4866
4867 : determine whether to install perl also as /usr/bin/perl
4868
4869 echo " "
4870 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4871         $cat <<EOM
4872 Many scripts expect to perl to be installed as /usr/bin/perl.
4873 I can install the perl you are about to compile also as /usr/bin/perl
4874 (in addition to $installbin/perl).
4875 EOM
4876         case "$installusrbinperl" in
4877         "$undef"|[nN]*) dflt='n';;
4878         *)              dflt='y';;
4879         esac
4880         rp="Do you want to install perl as /usr/bin/perl?"
4881         . ./myread
4882         case "$ans" in
4883         [yY]*)  val="$define";;
4884         *)      val="$undef" ;;
4885         esac
4886 else
4887         val="$undef"
4888 fi
4889 set installusrbinperl
4890 eval $setvar
4891
4892 : define a shorthand compile call
4893 compile='
4894 mc_file=$1;
4895 shift;
4896 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4897 : define a shorthand compile call for compilations that should be ok.
4898 compile_ok='
4899 mc_file=$1;
4900 shift;
4901 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4902
4903 echo " "
4904 echo "Checking for GNU C Library..." >&4
4905 cat >gnulibc.c <<EOM
4906 #include <stdio.h>
4907 int main()
4908 {
4909 #ifdef __GLIBC__
4910     exit(0);
4911 #else
4912     exit(1);
4913 #endif
4914 }
4915 EOM
4916 set gnulibc
4917 if eval $compile_ok && ./gnulibc; then
4918         val="$define"
4919         echo "You are using the GNU C Library"
4920 else
4921         val="$undef"
4922         echo "You are not using the GNU C Library"
4923 fi
4924 $rm -f gnulibc*
4925 set d_gnulibc
4926 eval $setvar
4927
4928 : see if nm is to be used to determine whether a symbol is defined or not
4929 case "$usenm" in
4930 '')
4931         dflt=''
4932         case "$d_gnulibc" in
4933         "$define")
4934                 echo " "
4935                 echo "nm probably won't work on the GNU C Library." >&4
4936                 dflt=n
4937                 ;;
4938         esac
4939         case "$dflt" in
4940         '') 
4941                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4942                         echo " "
4943                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4944                         echo "'nm' won't be sufficient on this sytem." >&4
4945                         dflt=n
4946                 fi
4947                 ;;
4948         esac
4949         case "$dflt" in
4950         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4951                 if $test $dflt -gt 20; then
4952                         dflt=y
4953                 else
4954                         dflt=n
4955                 fi
4956                 ;;
4957         esac
4958         ;;
4959 *)
4960         case "$usenm" in
4961         true|$define) dflt=y;;
4962         *) dflt=n;;
4963         esac
4964         ;;
4965 esac
4966 $cat <<EOM
4967
4968 I can use $nm to extract the symbols from your C libraries. This
4969 is a time consuming task which may generate huge output on the disk (up
4970 to 3 megabytes) but that should make the symbols extraction faster. The
4971 alternative is to skip the 'nm' extraction part and to compile a small
4972 test program instead to determine whether each symbol is present. If
4973 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4974 this may be the best solution.
4975
4976 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4977
4978 EOM
4979 rp="Shall I use $nm to extract C symbols from the libraries?"
4980 . ./myread
4981 case "$ans" in
4982 [Nn]*) usenm=false;;
4983 *) usenm=true;;
4984 esac
4985
4986 runnm=$usenm
4987 case "$reuseval" in
4988 true) runnm=false;;
4989 esac
4990
4991 : nm options which may be necessary
4992 case "$nm_opt" in
4993 '') if $test -f /mach_boot; then
4994                 nm_opt=''       # Mach
4995         elif $test -d /usr/ccs/lib; then
4996                 nm_opt='-p'     # Solaris (and SunOS?)
4997         elif $test -f /dgux; then
4998                 nm_opt='-p'     # DG-UX
4999         elif $test -f /lib64/rld; then
5000                 nm_opt='-p'     # 64-bit Irix
5001         else
5002                 nm_opt=''
5003         fi;;
5004 esac
5005
5006 : nm options which may be necessary for shared libraries but illegal
5007 : for archive libraries.  Thank you, Linux.
5008 case "$nm_so_opt" in
5009 '')     case "$myuname" in
5010         *linux*)
5011                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5012                         nm_so_opt='--dynamic'
5013                 fi
5014                 ;;
5015         esac
5016         ;;
5017 esac
5018
5019 case "$runnm" in
5020 true)
5021 : get list of predefined functions in a handy place
5022 echo " "
5023 case "$libc" in
5024 '') libc=unknown
5025         case "$libs" in
5026         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5027         esac
5028         ;;
5029 esac
5030 libnames='';
5031 case "$libs" in
5032 '') ;;
5033 *)  for thislib in $libs; do
5034         case "$thislib" in
5035         -lc|-lc_s)
5036                 : Handle C library specially below.
5037                 ;;
5038         -l*)
5039                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5040                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5041                         :
5042                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5043                         :
5044                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5045                         :
5046                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5047                         :
5048                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5049                         :
5050                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5051                         :
5052                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5053                         :
5054                 else
5055                         try=''
5056                 fi
5057                 libnames="$libnames $try"
5058                 ;;
5059         *) libnames="$libnames $thislib" ;;
5060         esac
5061         done
5062         ;;
5063 esac
5064 xxx=normal
5065 case "$libc" in
5066 unknown)
5067         set /lib/libc.$so
5068         for xxx in $libpth; do
5069                 $test -r $1 || set $xxx/libc.$so
5070                 : The messy sed command sorts on library version numbers.
5071                 $test -r $1 || \
5072                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5073                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5074                                 h
5075                                 s/[0-9][0-9]*/0000&/g
5076                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5077                                 G
5078                                 s/\n/ /' | \
5079                          sort | $sed -e 's/^.* //'`
5080                 eval set \$$#
5081         done
5082         $test -r $1 || set /usr/ccs/lib/libc.$so
5083         $test -r $1 || set /lib/libsys_s$_a
5084         ;;
5085 *)
5086         set blurfl
5087         ;;
5088 esac
5089 if $test -r "$1"; then
5090         echo "Your (shared) C library seems to be in $1."
5091         libc="$1"
5092 elif $test -r /lib/libc && $test -r /lib/clib; then
5093         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5094         xxx=apollo
5095         libc='/lib/clib /lib/libc'
5096         if $test -r /lib/syslib; then
5097                 echo "(Your math library is in /lib/syslib.)"
5098                 libc="$libc /lib/syslib"
5099         fi
5100 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5101         echo "Your C library seems to be in $libc, as you said before."
5102 elif $test -r $incpath/usr/lib/libc$_a; then
5103         libc=$incpath/usr/lib/libc$_a;
5104         echo "Your C library seems to be in $libc.  That's fine."
5105 elif $test -r /lib/libc$_a; then
5106         libc=/lib/libc$_a;
5107         echo "Your C library seems to be in $libc.  You're normal."
5108 else
5109         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5110                 :
5111         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5112                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5113         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5114                 :
5115         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5116                 :
5117         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5118                 :
5119         else
5120                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5121         fi
5122         if $test -r "$tans"; then
5123                 echo "Your C library seems to be in $tans, of all places."
5124                 libc=$tans
5125         else
5126                 libc='blurfl'
5127         fi
5128 fi
5129 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5130         dflt="$libc"
5131         cat <<EOM
5132
5133 If the guess above is wrong (which it might be if you're using a strange
5134 compiler, or your machine supports multiple models), you can override it here.
5135
5136 EOM
5137 else
5138         dflt=''
5139         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5140         cat >&4 <<EOM
5141 I can't seem to find your C library.  I've looked in the following places:
5142
5143 EOM
5144         $sed 's/^/      /' libpath
5145         cat <<EOM
5146
5147 None of these seems to contain your C library. I need to get its name...
5148
5149 EOM
5150 fi
5151 fn=f
5152 rp='Where is your C library?'
5153 . ./getfile
5154 libc="$ans"
5155
5156 echo " "
5157 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5158 set X `cat libnames`
5159 shift
5160 xxx=files
5161 case $# in 1) xxx=file; esac
5162 echo "Extracting names from the following $xxx for later perusal:" >&4
5163 echo " "
5164 $sed 's/^/      /' libnames >&4
5165 echo " "
5166 $echo $n "This may take a while...$c" >&4
5167
5168 for file in $*; do
5169         case $file in
5170         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5171         *) $nm $nm_opt $file 2>/dev/null;;
5172         esac
5173 done >libc.tmp
5174
5175 $echo $n ".$c"
5176 $grep fprintf libc.tmp > libc.ptf
5177 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5178 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5179 xxx='[ADTSIW]'
5180 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5181         eval $xscan;\
5182         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5183                 eval $xrun
5184 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5185         eval $xscan;\
5186         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5187                 eval $xrun
5188 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5189         eval $xscan;\
5190         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5191                 eval $xrun
5192 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5193         eval $xscan;\
5194         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5195                 eval $xrun
5196 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5197         eval $xscan;\
5198         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5199                 eval $xrun
5200 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5201         eval $xscan;\
5202         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5203                 eval $xrun
5204 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5205                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5206         eval $xscan;\
5207         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5208                 eval $xrun
5209 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5210         eval $xscan;\
5211         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5212                 eval $xrun
5213 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5214         eval $xscan;\
5215         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5216                 eval $xrun
5217 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5218         eval $xscan;\
5219         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5220                 eval $xrun
5221 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5222         eval $xscan;\
5223         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5224                 eval $xrun
5225 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//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 's/[       ]*D[    ]*[0-9]*.*//p'";\
5234         eval $xscan;\
5235         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5236                 eval $xrun
5237 else
5238         $nm -p $* 2>/dev/null >libc.tmp
5239         $grep fprintf libc.tmp > libc.ptf
5240         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5241                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5242         then
5243                 nm_opt='-p'
5244                 eval $xrun
5245         else
5246                 echo " "
5247                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5248                 com=''
5249                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5250                         for thisname in $libnames $libc; do
5251                                 $ar t $thisname >>libc.tmp
5252                         done
5253                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5254                         echo "Ok." >&4
5255                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5256                         # Repeat libc to extract forwarders to DLL entries too
5257                         for thisname in $libnames $libc; do
5258                                 $ar tv $thisname >>libc.tmp
5259                                 # Revision 50 of EMX has bug in $ar.
5260                                 # it will not extract forwarders to DLL entries
5261                                 # Use emximp which will extract exactly them.
5262                                 emximp -o tmp.imp $thisname \
5263                                     2>/dev/null && \
5264                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5265                                     < tmp.imp >>libc.tmp
5266                                 $rm tmp.imp
5267                         done
5268                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5269                         echo "Ok." >&4
5270                 else
5271                         echo "$ar didn't seem to work right." >&4
5272                         echo "Maybe this is a Cray...trying bld instead..." >&4
5273                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5274                         then
5275                                 for thisname in $libnames; do
5276                                         bld t $libnames | \
5277                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5278                                         $ar t $thisname >>libc.tmp
5279                                 done
5280                                 echo "Ok." >&4
5281                         else
5282                                 echo "That didn't work either.  Giving up." >&4
5283                                 exit 1
5284                         fi
5285                 fi
5286         fi
5287 fi
5288 nm_extract="$com"
5289 if $test -f /lib/syscalls.exp; then
5290         echo " "
5291         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5292         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5293 fi
5294 ;;
5295 esac
5296 $rm -f libnames libpath
5297
5298 : see if dld is available
5299 set dld.h i_dld
5300 eval $inhdr
5301
5302 : is a C symbol defined?
5303 csym='tlook=$1;
5304 case "$3" in
5305 -v) tf=libc.tmp; tc=""; tdc="";;
5306 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5307 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5308 esac;
5309 tx=yes;
5310 case "$reuseval-$4" in
5311 true-) ;;
5312 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5313 esac;
5314 case "$tx" in
5315 yes)
5316         case "$runnm" in
5317         true)
5318                 if $contains $tlook $tf >/dev/null 2>&1;
5319                 then tval=true;
5320                 else tval=false;
5321                 fi;;
5322         *)
5323                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5324                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5325                 then tval=true;
5326                 else tval=false;
5327                 fi;
5328                 $rm -f t t.c;;
5329         esac;;
5330 *)
5331         case "$tval" in
5332         $define) tval=true;;
5333         *) tval=false;;
5334         esac;;
5335 esac;
5336 eval "$2=$tval"'
5337
5338 : define an is-in-libc? function
5339 inlibc='echo " "; td=$define; tu=$undef;
5340 sym=$1; var=$2; eval "was=\$$2";
5341 tx=yes;
5342 case "$reuseval$was" in
5343 true) ;;
5344 true*) tx=no;;
5345 esac;
5346 case "$tx" in
5347 yes)
5348         set $sym tres -f;
5349         eval $csym;
5350         case "$tres" in
5351         true)
5352                 echo "$sym() found." >&4;
5353                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5354         *)
5355                 echo "$sym() NOT found." >&4;
5356                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5357         esac;;
5358 *)
5359         case "$was" in
5360         $define) echo "$sym() found." >&4;;
5361         *) echo "$sym() NOT found." >&4;;
5362         esac;;
5363 esac'
5364
5365 : see if dlopen exists
5366 xxx_runnm="$runnm"
5367 runnm=false
5368 set dlopen d_dlopen
5369 eval $inlibc
5370 runnm="$xxx_runnm"
5371
5372 : determine which dynamic loading, if any, to compile in
5373 echo " "
5374 dldir="ext/DynaLoader"
5375 case "$usedl" in
5376 $define|y|true)
5377         dflt='y'
5378         usedl="$define"
5379         ;;
5380 $undef|n|false)
5381         dflt='n'
5382         usedl="$undef"
5383         ;;
5384 *) 
5385         dflt='n'
5386         case "$d_dlopen" in
5387             $define) dflt='y' ;;
5388         esac
5389         case "$i_dld" in
5390             $define) dflt='y' ;;
5391         esac
5392         : Does a dl_xxx.xs file exist for this operating system
5393         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5394         ;;
5395 esac
5396 rp="Do you wish to use dynamic loading?"
5397 . ./myread
5398 usedl="$ans"
5399 case "$ans" in
5400 y*) usedl="$define"
5401         case "$dlsrc" in
5402         '')
5403                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5404                         dflt="$dldir/dl_${osname}.xs"
5405                 elif $test "$d_dlopen" = "$define" ; then
5406                         dflt="$dldir/dl_dlopen.xs"
5407                 elif $test "$i_dld" = "$define" ; then
5408                         dflt="$dldir/dl_dld.xs"
5409                 else
5410                         dflt=''
5411                 fi
5412                 ;;
5413         *)      dflt="$dldir/$dlsrc"
5414                 ;;
5415         esac
5416     echo "The following dynamic loading files are available:"
5417         : Can not go over to $dldir because getfile has path hard-coded in.
5418         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5419         rp="Source file to use for dynamic loading"
5420         fn="fne"
5421         gfpth="$src"
5422         . ./getfile
5423         usedl="$define"
5424         : emulate basename
5425         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5426
5427         $cat << EOM
5428
5429 Some systems may require passing special flags to $cc -c to
5430 compile modules that will be used to create a shared library.
5431 To use no flags, say "none".
5432
5433 EOM
5434     case "$cccdlflags" in
5435     '') case "$gccversion" in
5436                 '') case "$osname" in
5437                         hpux)   dflt='+z' ;;
5438                         next)   dflt='none' ;;
5439                         irix*)  dflt='-KPIC' ;;
5440                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5441                         sunos)  dflt='-pic' ;;
5442                         *)      dflt='none' ;;
5443                     esac
5444                         ;;
5445                 *)  case "$osname" in
5446                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5447                         *)      dflt='-fpic' ;;
5448                     esac ;;
5449             esac ;;
5450         ' ') dflt='none' ;;
5451     *)  dflt="$cccdlflags" ;;
5452     esac
5453     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5454     . ./myread
5455     case "$ans" in
5456     none) cccdlflags=' ' ;;
5457     *) cccdlflags="$ans" ;;
5458     esac
5459
5460     cat << EOM
5461
5462 Some systems use ld to create libraries that can be dynamically loaded,
5463 while other systems (such as those using ELF) use $cc.
5464
5465 EOM
5466         case "$ld" in
5467         '')     $cat >try.c <<'EOM'
5468 /* Test for whether ELF binaries are produced */
5469 #include <fcntl.h>
5470 #include <stdlib.h>
5471 int main() {
5472         char b[4];
5473         int i = open("a.out",O_RDONLY);
5474         if(i == -1) 
5475                 exit(1); /* fail */
5476         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5477                 exit(0); /* succeed (yes, it's ELF) */
5478         else
5479                 exit(1); /* fail */
5480 }
5481 EOM
5482                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5483                         cat <<EOM
5484 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5485 EOM
5486                         dflt="$cc"
5487                 else
5488                         echo "I'll use ld to build dynamic libraries."
5489                         dflt='ld'
5490                 fi
5491                 rm -f try.c a.out
5492                 ;;
5493         *)      dflt="$ld"
5494                 ;;
5495         esac
5496
5497     rp="What command should be used to create dynamic libraries?"
5498     . ./myread
5499         ld="$ans"
5500
5501     cat << EOM
5502
5503 Some systems may require passing special flags to $ld to create a
5504 library that can be dynamically loaded.  If your ld flags include
5505 -L/other/path options to locate libraries outside your loader's normal
5506 search path, you may need to specify those -L options here as well.  To
5507 use no flags, say "none".
5508
5509 EOM
5510     case "$lddlflags" in
5511     '') case "$osname" in
5512                         beos) dflt='-nostart' ;;
5513                         hpux)  dflt='-b' ;;
5514                         linux|irix*)    dflt='-shared' ;;
5515                         next)  dflt='none' ;;
5516                         solaris) dflt='-G' ;;
5517                         sunos) dflt='-assert nodefinitions' ;;
5518                         svr4*|esix*) dflt="-G $ldflags" ;;
5519                 *)     dflt='none' ;;
5520                         esac
5521                         ;;
5522     *) dflt="$lddlflags" ;;
5523     esac
5524
5525         : Try to guess additional flags to pick up local libraries.
5526         : Be careful not to append to a plain 'none'
5527         case "$dflt" in
5528         none) dflt='' ;;
5529         esac
5530         for thisflag in $ldflags; do
5531                 case "$thisflag" in
5532                 -L*)
5533                         case " $dflt " in
5534                         *" $thisflag "*) ;;
5535                         *) dflt="$dflt $thisflag" ;;
5536                         esac
5537                         ;;
5538                 esac
5539         done
5540
5541         case "$dflt" in
5542         ''|' ') dflt='none' ;;
5543         esac
5544
5545     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5546     . ./myread
5547     case "$ans" in
5548     none) lddlflags=' ' ;;
5549     *) lddlflags="$ans" ;;
5550     esac
5551
5552         cat <<EOM
5553
5554 Some systems may require passing special flags to $cc to indicate that
5555 the resulting executable will use dynamic linking.  To use no flags,
5556 say "none".
5557
5558 EOM
5559     case "$ccdlflags" in
5560     '') case "$osname" in
5561                 hpux)   dflt='-Wl,-E' ;;
5562                 linux)  dflt='-rdynamic' ;;
5563                 next)   dflt='none' ;;
5564                 sunos)  dflt='none' ;;
5565                 *)      dflt='none' ;;
5566             esac ;;
5567     ' ')  dflt='none' ;;
5568     *)  dflt="$ccdlflags" ;;
5569     esac
5570     rp="Any special flags to pass to $cc to use dynamic loading?"
5571     . ./myread
5572     case "$ans" in
5573     none) ccdlflags=' ' ;;
5574     *) ccdlflags="$ans" ;;
5575     esac
5576     ;;
5577 *)  usedl="$undef"
5578         ld='ld'
5579     dlsrc='dl_none.xs'
5580     lddlflags=''
5581     ccdlflags=''
5582     ;;
5583 esac
5584
5585 also=''
5586 case "$usedl" in
5587 $undef)
5588         # No dynamic loading being used, so don't bother even to prompt.
5589         useshrplib='false'
5590         ;;
5591 *)      case "$useshrplib" in
5592         '')     case "$osname" in
5593                 svr4*|dgux|dynixptx|esix|powerux|beos)
5594                         dflt=y
5595                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5596                         ;;
5597                 next*)
5598                         case "$osvers" in
5599                         4*)     dflt=y
5600                                 also='Building a shared libperl is needed for MAB support.'
5601                                 ;;
5602                         *)      dflt=n
5603                                 ;;
5604                         esac
5605                         ;;
5606                 *)      dflt=n
5607                         ;;
5608                 esac
5609                 ;;
5610         $define|true|[Yy]*)
5611                 dflt=y
5612                 ;;
5613         *)      dflt=n
5614                 ;;
5615         esac
5616         $cat << EOM
5617
5618 The perl executable is normally obtained by linking perlmain.c with
5619 libperl${_a}, any static extensions (usually just DynaLoader), and
5620 any other libraries needed on this system (such as -lm, etc.).  Since
5621 your system supports dynamic loading, it is probably possible to build
5622 a shared libperl.$so.  If you will have more than one executable linked
5623 to libperl.$so, this will significantly reduce the size of each
5624 executable, but it may have a noticeable affect on performance.  The
5625 default is probably sensible for your system.
5626 $also
5627
5628 EOM
5629         rp="Build a shared libperl.$so (y/n)"
5630         . ./myread
5631         case "$ans" in
5632         true|$define|[Yy]*)
5633                 useshrplib='true'  ;;
5634         *)      useshrplib='false' ;;
5635         esac
5636         ;;
5637 esac
5638
5639 case "$useshrplib" in
5640 true)
5641         case "$libperl" in
5642         '')
5643                 # Figure out a good name for libperl.so.  Since it gets stored in
5644                 # a version-specific architecture-dependent library, the version
5645                 # number isn't really that important, except for making cc/ld happy.
5646                 #
5647                 # A name such as libperl.so.3.1
5648                 majmin="libperl.$so.$patchlevel.$subversion"
5649                 # A name such as libperl.so.301
5650                 majonly=`echo $patchlevel $subversion |
5651                         $awk '{printf "%d%02d", $1, $2}'`
5652                 majonly=libperl.$so.$majonly
5653                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5654                 # rely on figuring it out from the naming of libc.
5655                 case "${osname}${osvers}" in
5656                 next4*)
5657                         dflt=libperl.5.$so
5658                         # XXX How handle the --version stuff for MAB?
5659                         ;;
5660                 linux*)  # ld won't link with a bare -lperl otherwise.
5661                         dflt=libperl.$so
5662                         ;;
5663                 *)      # Try to guess based on whether libc has major.minor.
5664                         case "$libc" in
5665                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5666                         *libc.$so.[0-9]*) dflt=$majonly ;;
5667                         *)      dflt=libperl.$so ;;
5668                         esac
5669                         ;;
5670                 esac
5671                 ;;
5672         *)      dflt=$libperl
5673                 ;;
5674         esac
5675         cat << EOM
5676
5677 I need to select a good name for the shared libperl.  If your system uses
5678 library names with major and minor numbers, then you might want something
5679 like $majmin.  Alternatively, if your system uses a single version
5680 number for shared libraries, then you might want to use $majonly.
5681 Or, your system might be quite happy with a simple libperl.$so.
5682
5683 Since the shared libperl will get installed into a version-specific
5684 architecture-dependent directory, the version number of the shared perl
5685 library probably isn't important, so the default should be o.k.
5686
5687 EOM
5688         rp='What name do you want to give to the shared libperl?'
5689         . ./myread
5690         libperl=$ans
5691         echo "Ok, I'll use $libperl"
5692         ;;
5693 *)
5694         libperl="libperl${_a}"
5695         ;;
5696 esac
5697
5698 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5699 case "$shrpdir" in
5700 '') ;;
5701 *)      $cat >&4 <<EOM
5702 WARNING:  Use of the shrpdir variable for the installation location of
5703 the shared $libperl is not supported.  It was never documented and
5704 will not work in this version.  Let me (perlbug@perl.com)
5705 know of any problems this may cause.
5706
5707 EOM
5708         case "$shrpdir" in
5709         "$archlibexp/CORE")
5710                 $cat >&4 <<EOM
5711 But your current setting of $shrpdir is
5712 the default anyway, so it's harmless.
5713 EOM
5714                 ;;
5715         *)
5716                 $cat >&4 <<EOM
5717 Further, your current attempted setting of $shrpdir
5718 conflicts with the value of $archlibexp/CORE
5719 that installperl will use.
5720 EOM
5721                 ;;
5722         esac
5723         ;;
5724 esac
5725
5726 # How will the perl executable find the installed shared $libperl?
5727 # Add $xxx to ccdlflags.
5728 # If we can't figure out a command-line option, use $shrpenv to
5729 # set env LD_RUN_PATH.  The main perl makefile uses this.
5730 shrpdir=$archlibexp/CORE
5731 xxx=''
5732 tmp_shrpenv=''
5733 if "$useshrplib"; then
5734     case "$osname" in 
5735         aix)
5736                 # We'll set it in Makefile.SH...
5737                 ;;
5738         solaris|netbsd)
5739                 xxx="-R $shrpdir"
5740                 ;;
5741         freebsd)
5742                 xxx="-Wl,-R$shrpdir"
5743                 ;;
5744         linux|irix*|dec_osf)
5745                 xxx="-Wl,-rpath,$shrpdir"
5746                 ;;
5747         next)
5748                 # next doesn't like the default...
5749                 ;;
5750         beos)
5751                 # beos doesn't like the default, either.
5752                 ;;
5753         hpux*)
5754                 # hpux doesn't like the default, either.
5755                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5756                 ;;
5757         *)
5758                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5759                 ;;
5760         esac
5761         case "$xxx" in
5762         '') ;;
5763         *)      
5764                 # Only add $xxx if it isn't already in ccdlflags.
5765                 case " $ccdlflags " in
5766                 *" $xxx "*)     ;;
5767                 *)      ccdlflags="$ccdlflags $xxx"
5768                         cat <<EOM >&4
5769
5770 Adding $xxx to the flags
5771 passed to $ld so that the perl executable will find the 
5772 installed shared $libperl.
5773
5774 EOM
5775                         ;;
5776                 esac
5777                 ;;
5778         esac
5779 fi
5780 # Fix ccdlflags in AIX for building external extensions.
5781 # (For building Perl itself bare -bE:perl.exp is needed,
5782 #  Makefile.SH takes care of this.)
5783 case "$osname" in
5784 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5785 esac
5786 # Respect a hint or command-line value.
5787 case "$shrpenv" in
5788 '') shrpenv="$tmp_shrpenv" ;;
5789 esac
5790 case "$ldlibpthname" in
5791 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5792 none)   ldlibpthname='' ;;
5793 esac
5794
5795 : determine where manual pages go
5796 set man1dir man1dir none
5797 eval $prefixit
5798 $cat <<EOM
5799
5800 $spackage has manual pages available in source form.
5801 EOM
5802 case "$nroff" in
5803 nroff)
5804         echo "However, you don't have nroff, so they're probably useless to you."
5805         case "$man1dir" in
5806         '') man1dir="none";;
5807         esac;;
5808 esac
5809 echo "If you don't want the manual sources installed, answer 'none'."
5810 case "$man1dir" in
5811 ' ') dflt=none
5812         ;;
5813 '')
5814         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5815         lookpath="$lookpath $prefixexp/man/p_man/man1"
5816         lookpath="$lookpath $prefixexp/man/u_man/man1"
5817         lookpath="$lookpath $prefixexp/man/man.1"
5818         case "$sysman" in
5819         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5820         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5821         esac
5822         set dflt
5823         eval $prefixup
5824         ;;
5825 *)  dflt="$man1dir"
5826         ;;
5827 esac
5828 echo " "
5829 fn=dn+~
5830 rp="Where do the main $spackage manual pages (source) go?"
5831 . ./getfile
5832 if $test "X$man1direxp" != "X$ansexp"; then
5833         installman1dir=''
5834 fi
5835 man1dir="$ans"
5836 man1direxp="$ansexp"
5837 case "$man1dir" in
5838 '')     man1dir=' '
5839         installman1dir='';;
5840 esac
5841
5842 : Change installation prefix, if necessary.
5843 if $test X"$prefix" != X"$installprefix"; then
5844         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5845 else
5846         installman1dir="$man1direxp"
5847 fi
5848
5849 : What suffix to use on installed man pages
5850
5851 case "$man1dir" in
5852 ' ')
5853         man1ext='0'
5854         ;;
5855 *)
5856         rp="What suffix should be used for the main $spackage man pages?"
5857         case "$man1ext" in
5858         '')     case "$man1dir" in
5859                 *1)  dflt=1 ;;
5860                 *1p) dflt=1p ;;
5861                 *1pm) dflt=1pm ;;
5862                 *l) dflt=l;;
5863                 *n) dflt=n;;
5864                 *o) dflt=o;;
5865                 *p) dflt=p;;
5866                 *C) dflt=C;;
5867                 *L) dflt=L;;
5868                 *L1) dflt=L1;;
5869                 *) dflt=1;;
5870                 esac
5871                 ;;
5872         *)      dflt="$man1ext";;
5873         esac
5874         . ./myread
5875         man1ext="$ans"
5876         ;;
5877 esac
5878
5879 : see if we can have long filenames
5880 echo " "
5881 rmlist="$rmlist /tmp/cf$$"
5882 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5883 first=123456789abcdef
5884 second=/tmp/cf$$/$first
5885 $rm -f $first $second
5886 if (echo hi >$first) 2>/dev/null; then
5887         if $test -f 123456789abcde; then
5888                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5889                 val="$undef"
5890         else
5891                 if (echo hi >$second) 2>/dev/null; then
5892                         if $test -f /tmp/cf$$/123456789abcde; then
5893                                 $cat <<'EOM'
5894 That's peculiar... You can have filenames longer than 14 characters, but only
5895 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5896 I shall consider your system cannot support long filenames at all.
5897 EOM
5898                                 val="$undef"
5899                         else
5900                                 echo 'You can have filenames longer than 14 characters.' >&4
5901                                 val="$define"
5902                         fi
5903                 else
5904                         $cat <<'EOM'
5905 How confusing! Some of your filesystems are sane enough to allow filenames
5906 longer than 14 characters but some others like /tmp can't even think about them.
5907 So, for now on, I shall assume your kernel does not allow them at all.
5908 EOM
5909                         val="$undef"
5910                 fi
5911         fi
5912 else
5913         $cat <<'EOM'
5914 You can't have filenames longer than 14 chars.  You can't even think about them!
5915 EOM
5916         val="$undef"
5917 fi 
5918 set d_flexfnam
5919 eval $setvar
5920 $rm -rf /tmp/cf$$ 123456789abcde*
5921
5922 : determine where library module manual pages go
5923 set man3dir man3dir none
5924 eval $prefixit
5925 $cat <<EOM
5926
5927 $spackage has manual pages for many of the library modules.
5928 EOM
5929
5930 case "$nroff" in
5931 nroff)
5932         $cat <<'EOM'
5933 However, you don't have nroff, so they're probably useless to you.
5934 EOM
5935         case "$man3dir" in
5936         '') man3dir="none";;
5937         esac;;
5938 esac
5939
5940 case "$d_flexfnam" in
5941 undef)
5942         $cat <<'EOM'
5943 However, your system can't handle the long file names like File::Basename.3. 
5944 EOM
5945         case "$man3dir" in
5946         '') man3dir="none";;
5947         esac;;
5948 esac
5949
5950 echo "If you don't want the manual sources installed, answer 'none'."
5951 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5952 case "$man3dir" in
5953 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5954         if $test -d "$privlib/man/man3"; then
5955                 cat <<EOM >&4
5956
5957 WARNING:  Previous versions of perl installed man3 pages into
5958 $privlib/man/man3.  This version will suggest a 
5959 new default of $dflt.  
5960 EOM
5961                 tdflt=$dflt
5962                 dflt='n'
5963                 rp='Do you wish to preserve the old behavior?(y/n)'
5964                 . ./myread
5965                 case "$ans" in
5966                 y*) dflt="$privlib/man/man3" ;;
5967                 *)  dflt=$tdflt ;;
5968                 esac
5969     fi
5970         ;;
5971 ' ') dflt=none;;
5972 *)      dflt="$man3dir" ;;
5973 esac
5974 echo " "
5975 fn=dn+~
5976 rp="Where do the $package library man pages (source) go?"
5977 . ./getfile
5978 man3dir="$ans"
5979 man3direxp="$ansexp"
5980 case "$man1dir" in
5981 '')     man3dir=' '
5982         installman3dir='';;
5983 esac
5984
5985 : Change installation prefix, if necessary.
5986 if $test X"$prefix" != X"$installprefix"; then
5987         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
5988 else
5989         installman3dir="$man3direxp"
5990 fi
5991
5992 : What suffix to use on installed man pages
5993 case "$man3dir" in
5994 ' ')
5995         man3ext='0'
5996         ;;
5997 *)
5998         rp="What suffix should be used for the $package library man pages?"
5999         case "$man3ext" in
6000         '')     case "$man3dir" in
6001                 *3)  dflt=3 ;;
6002                 *3p) dflt=3p ;;
6003                 *3pm) dflt=3pm ;;
6004                 *l) dflt=l;;
6005                 *n) dflt=n;;
6006                 *o) dflt=o;;
6007                 *p) dflt=p;;
6008                 *C) dflt=C;;
6009                 *L) dflt=L;;
6010                 *L3) dflt=L3;;
6011                 *) dflt=3;;
6012                 esac
6013                 ;;
6014         *)      dflt="$man3ext";;
6015         esac
6016         . ./myread
6017         man3ext="$ans"
6018         ;;
6019 esac
6020
6021 : see if we have to deal with yellow pages, now NIS.
6022 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6023         if $test -f /usr/etc/nibindd; then
6024                 echo " "
6025                 echo "I'm fairly confident you're on a NeXT."
6026                 echo " "
6027                 rp='Do you get the hosts file via NetInfo?'
6028                 dflt=y
6029                 case "$hostcat" in
6030                 nidump*) ;;
6031                 '') ;;
6032                 *) dflt=n;;
6033                 esac
6034                 . ./myread
6035                 case "$ans" in
6036                 y*) hostcat='nidump hosts .';;
6037                 *)      case "$hostcat" in
6038                         nidump*) hostcat='';;
6039                         esac
6040                         ;;
6041                 esac
6042         fi
6043         case "$hostcat" in
6044         nidump*) ;;
6045         *)
6046                 case "$hostcat" in
6047                 *ypcat*) dflt=y;;
6048                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6049                                 dflt=y
6050                         else
6051                                 dflt=n
6052                         fi;;
6053                 *) dflt=n;;
6054                 esac
6055                 echo " "
6056                 rp='Are you getting the hosts file via yellow pages?'
6057                 . ./myread
6058                 case "$ans" in
6059                 y*) hostcat='ypcat hosts';;
6060                 *) hostcat='cat /etc/hosts';;
6061                 esac
6062                 ;;
6063         esac
6064 fi
6065 case "$hostcat" in
6066 '') hostcat='cat /etc/hosts';;
6067 esac
6068 case "$groupcat" in
6069 '') groupcat='cat /etc/group';;
6070 esac
6071 case "$passcat" in
6072 '') passcat='cat /etc/passwd';;
6073 esac
6074
6075 : now get the host name
6076 echo " "
6077 echo "Figuring out host name..." >&4
6078 case "$myhostname" in
6079 '') cont=true
6080         echo 'Maybe "hostname" will work...'
6081         if tans=`sh -c hostname 2>&1` ; then
6082                 myhostname=$tans
6083                 phostname=hostname
6084                 cont=''
6085         fi
6086         ;;
6087 *) cont='';;
6088 esac
6089 if $test "$cont"; then
6090         if ./xenix; then
6091                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6092                 if tans=`cat /etc/systemid 2>&1` ; then
6093                         myhostname=$tans
6094                         phostname='cat /etc/systemid'
6095                         echo "Whadyaknow.  Xenix always was a bit strange..."
6096                         cont=''
6097                 fi
6098         elif $test -r /etc/systemid; then
6099                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6100         fi
6101 fi
6102 if $test "$cont"; then
6103         echo 'No, maybe "uuname -l" will work...'
6104         if tans=`sh -c 'uuname -l' 2>&1` ; then
6105                 myhostname=$tans
6106                 phostname='uuname -l'
6107         else
6108                 echo 'Strange.  Maybe "uname -n" will work...'
6109                 if tans=`sh -c 'uname -n' 2>&1` ; then
6110                         myhostname=$tans
6111                         phostname='uname -n'
6112                 else
6113                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6114                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6115                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6116                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6117                         else
6118                                 case "$myhostname" in
6119                                 '') echo "Does this machine have an identity crisis or something?"
6120                                         phostname='';;
6121                                 *)
6122                                         echo "Well, you said $myhostname before..."
6123                                         phostname='echo $myhostname';;
6124                                 esac
6125                         fi
6126                 fi
6127         fi
6128 fi
6129 : you do not want to know about this
6130 set $myhostname
6131 myhostname=$1
6132
6133 : verify guess
6134 if $test "$myhostname" ; then
6135         dflt=y
6136         rp='Your host name appears to be "'$myhostname'".'" Right?"
6137         . ./myread
6138         case "$ans" in
6139         y*) ;;
6140         *) myhostname='';;
6141         esac
6142 fi
6143
6144 : bad guess or no guess
6145 while $test "X$myhostname" = X ; do
6146         dflt=''
6147         rp="Please type the (one word) name of your host:"
6148         . ./myread
6149         myhostname="$ans"
6150 done
6151
6152 : translate upper to lower if necessary
6153 case "$myhostname" in
6154 *[A-Z]*)
6155         echo "(Normalizing case in your host name)"
6156         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6157         ;;
6158 esac
6159
6160 case "$myhostname" in
6161 *.*)
6162         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6163         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6164         echo "(Trimming domain name from host name--host name is now $myhostname)"
6165         ;;
6166 *) case "$mydomain" in
6167         '')
6168                 {
6169                         test "X$hostcat" = "Xypcat hosts" &&
6170                         ypmatch "$myhostname" hosts 2>/dev/null |\
6171                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6172                         $test -s hosts
6173                 } || {
6174                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6175                                         /[       ]$myhostname[  . ]/p" > hosts
6176                 }
6177                 tmp_re="[       . ]"
6178                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6179                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6180                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6181                         hosts | $sort | $uniq | \
6182                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6183                 case `$echo X$dflt` in
6184                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6185                         dflt=.
6186                         ;;
6187                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6188                         ;;
6189                 esac
6190                 case "$dflt" in
6191                 .)
6192                         tans=`./loc resolv.conf X /etc /usr/etc`
6193                         if $test -f "$tans"; then
6194                                 echo "(Attempting domain name extraction from $tans)"
6195                                 dflt=.`$sed -n -e 's/   / /g' \
6196                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6197                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6198                                 case "$dflt" in
6199                                 .) dflt=.`$sed -n -e 's/        / /g' \
6200                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6201                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6202                                         ;;
6203                                 esac
6204                         fi
6205                         ;;
6206                 esac
6207                 case "$dflt" in
6208                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6209                         dflt=.`sh -c domainname 2>/dev/null`
6210                         case "$dflt" in
6211                         '') dflt='.';;
6212                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6213                         esac
6214                         ;;
6215                 esac
6216                 case "$dflt" in
6217                 .) echo "(Lost all hope -- silly guess then)"
6218                         dflt='.uucp'
6219                         ;;
6220                 esac
6221                 $rm -f hosts
6222                 ;;
6223         *) dflt="$mydomain";;
6224         esac;;
6225 esac
6226 echo " "
6227 rp="What is your domain name?"
6228 . ./myread
6229 tans="$ans"
6230 case "$ans" in
6231 '') ;;
6232 .*) ;;
6233 *) tans=".$tans";;
6234 esac
6235 mydomain="$tans"
6236
6237 : translate upper to lower if necessary
6238 case "$mydomain" in
6239 *[A-Z]*)
6240         echo "(Normalizing case in your domain name)"
6241         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6242         ;;
6243 esac
6244
6245 : a little sanity check here
6246 case "$phostname" in
6247 '') ;;
6248 *)
6249         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6250         $myhostname$mydomain|$myhostname) ;;
6251         *)
6252                 case "$phostname" in
6253                 sed*)
6254                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6255                         ;;
6256                 *)
6257                         echo "(That doesn't agree with your $phostname command, by the way.)"
6258                         ;;
6259                 esac
6260         ;;
6261         esac
6262         ;;
6263 esac
6264
6265 $cat <<EOM
6266
6267 I need to get your e-mail address in Internet format if possible, i.e.
6268 something like user@host.domain. Please answer accurately since I have
6269 no easy means to double check it. The default value provided below
6270 is most probably close to the reality but may not be valid from outside
6271 your organization...
6272
6273 EOM
6274 cont=x
6275 while test "$cont"; do
6276         case "$cf_email" in
6277         '') dflt="$cf_by@$myhostname$mydomain";;
6278         *) dflt="$cf_email";;
6279         esac
6280         rp='What is your e-mail address?'
6281         . ./myread
6282         cf_email="$ans"
6283         case "$cf_email" in
6284         *@*.*) cont='' ;;
6285         *)
6286                 rp='Address does not look like an Internet one.  Use it anyway?'
6287                 case "$fastread" in
6288                 yes) dflt=y ;;
6289                 *) dflt=n ;;
6290                 esac
6291                 . ./myread
6292                 case "$ans" in
6293                 y*) cont='' ;;
6294                 *) echo " " ;;
6295                 esac
6296                 ;;
6297         esac
6298 done
6299
6300 $cat <<EOM
6301
6302 If you or somebody else will be maintaining perl at your site, please
6303 fill in the correct e-mail address here so that they may be contacted
6304 if necessary. Currently, the "perlbug" program included with perl
6305 will send mail to this address in addition to perlbug@perl.com. You may
6306 enter "none" for no administrator.
6307
6308 EOM
6309 case "$perladmin" in
6310 '') dflt="$cf_email";;
6311 *) dflt="$perladmin";;
6312 esac
6313 rp='Perl administrator e-mail address'
6314 . ./myread
6315 perladmin="$ans"
6316
6317 : figure out how to guarantee perl startup
6318 case "$startperl" in
6319 '')
6320         case "$sharpbang" in
6321         *!)
6322                 $cat <<EOH
6323
6324 I can use the #! construct to start perl on your system. This will
6325 make startup of perl scripts faster, but may cause problems if you
6326 want to share those scripts and perl is not in a standard place
6327 ($binexp/perl) on all your platforms. The alternative is to force
6328 a shell by starting the script with a single ':' character.
6329
6330 EOH
6331                 dflt="$binexp/perl"
6332                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6333                 . ./myread
6334                 case "$ans" in
6335                 none)   startperl=": # use perl";;
6336                 *)      startperl="#!$ans"
6337                         if $test 30 -lt `echo "$ans" | wc -c`; then
6338                                 $cat >&4 <<EOM
6339
6340 WARNING:  Some systems limit the #! command to 32 characters.
6341 If you experience difficulty running Perl scripts with #!, try
6342 installing Perl in a directory with a shorter pathname.
6343
6344 EOM
6345                         fi ;;
6346                 esac
6347                 ;;
6348         *) startperl=": # use perl"
6349                 ;;
6350         esac
6351         ;;
6352 esac
6353 echo "I'll use $startperl to start perl scripts."
6354
6355 : figure best path for perl in scripts
6356 case "$perlpath" in
6357 '')
6358         perlpath="$binexp/perl"
6359         case "$startperl" in
6360         *!*) ;;
6361         *)
6362                 $cat <<EOH
6363
6364 I will use the "eval 'exec'" idiom to start Perl on your system.
6365 I can use the full path of your Perl binary for this purpose, but
6366 doing so may cause problems if you want to share those scripts and
6367 Perl is not always in a standard place ($binexp/perl).
6368
6369 EOH
6370                 dflt="$binexp/perl"
6371                 rp="What path shall I use in \"eval 'exec'\"?"
6372                 . ./myread
6373                 perlpath="$ans"
6374                 ;;
6375         esac
6376         ;;
6377 esac
6378 case "$startperl" in
6379 *!*)    ;;
6380 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6381 esac
6382
6383 : determine where public executable scripts go
6384 set scriptdir scriptdir
6385 eval $prefixit
6386 case "$scriptdir" in
6387 '')
6388         dflt="$bin"
6389         : guess some guesses
6390         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6391         $test -d /usr/share/bin     && dflt=/usr/share/bin
6392         $test -d /usr/local/script  && dflt=/usr/local/script
6393         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6394         $test -d $prefixexp/script  && dflt=$prefixexp/script
6395         set dflt
6396         eval $prefixup
6397         ;;
6398 *)  dflt="$scriptdir"
6399         ;;
6400 esac
6401 $cat <<EOM
6402  
6403 Some installations have a separate directory just for executable scripts so
6404 that they can mount it across multiple architectures but keep the scripts in
6405 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6406 Or you might just lump your scripts in with all your other executables.
6407  
6408 EOM
6409 fn=d~
6410 rp='Where do you keep publicly executable scripts?'
6411 . ./getfile
6412 if $test "X$ansexp" != "X$scriptdirexp"; then
6413         installscript=''
6414 fi
6415 scriptdir="$ans"
6416 scriptdirexp="$ansexp"
6417 : Change installation prefix, if necessary.
6418 if $test X"$prefix" != X"$installprefix"; then
6419         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6420 else
6421         installscript="$scriptdirexp"
6422 fi
6423
6424 $cat <<EOM
6425
6426 After $package is installed, you may wish to install various
6427 add-on modules and utilities.  Typically, these add-ons will
6428 be installed under $prefix with the rest
6429 of this package.  However, you may wish to install such add-ons
6430 elsewhere under a different prefix.
6431
6432 If you do not wish to put everything under a single prefix, that's
6433 ok.  You will be prompted for the individual locations; this siteprefix
6434 is only used to suggest the defaults.
6435
6436 The default should be fine for most people.
6437
6438 EOM
6439 fn=d~+
6440 rp='Installation prefix to use for add-on modules and utilities?'
6441 : XXX Here might be another good place for an installstyle setting.
6442 case "$siteprefix" in
6443 '') dflt=$prefix ;;
6444 *)  dflt=$siteprefix ;;
6445 esac
6446 . ./getfile
6447 oldsiteprefix=''
6448 case "$siteprefix" in
6449 '') ;;
6450 *)
6451         case "$ans" in
6452         "$prefix") ;;
6453         *) oldsiteprefix="$prefix";;
6454         esac
6455         ;;
6456 esac
6457 siteprefix="$ans"
6458 siteprefixexp="$ansexp"
6459
6460 : determine where site specific libraries go.
6461 : Usual default is /usr/local/lib/perl5/site_perl
6462 : The default "style" setting is made in installstyle.U
6463 : XXX No longer works with Prefixit stuff.
6464 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6465 case "$installstyle" in
6466 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6467 *)       dflt=$siteprefix/lib/site_$prog ;;
6468 esac
6469 $cat <<EOM
6470
6471 The installation process will create a directory for
6472 site-specific extensions and modules.  Most users find it convenient
6473 to place all site-specific files in this directory rather than in the
6474 main distribution directory.
6475
6476 EOM
6477 fn=d~+
6478 rp='Pathname for the site-specific library files?'
6479 . ./getfile
6480 sitelib="$ans"
6481 sitelibexp="$ansexp"
6482 : Change installation prefix, if necessary.
6483 if $test X"$prefix" != X"$installprefix"; then
6484         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6485 else
6486         installsitelib="$sitelibexp"
6487 fi
6488
6489 : determine where site specific architecture-dependent libraries go.
6490 : sitelib  default is /usr/local/lib/perl5/site_perl/
6491 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6492 : sitelib may have an optional trailing /share.
6493 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6494 tdflt="$tdflt/$apiversion/$archname"
6495 set sitearch sitearch none
6496 eval $prefixit
6497 case "$sitearch" in
6498 '')     dflt="$tdflt" ;;
6499 *)      dflt="$sitearch" ;;
6500 esac
6501 $cat <<EOM
6502
6503 The installation process will also create a directory for
6504 architecture-dependent site-specific extensions and modules.
6505
6506 EOM
6507 fn=nd~+
6508 rp='Pathname for the site-specific architecture-dependent library files?'
6509 . ./getfile
6510 sitearch="$ans"
6511 sitearchexp="$ansexp"
6512 : Change installation prefix, if necessary.
6513 if $test X"$prefix" != X"$installprefix"; then
6514         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6515 else
6516         installsitearch="$sitearchexp"
6517 fi
6518
6519
6520 case "$uselfs" in
6521 "$define"|true|[yY]*)
6522         uselfs="$define"
6523         use64bits="$define"
6524         ;;
6525 *)      uselfs="$undef"
6526         ;;
6527 esac
6528
6529 cat <<EOM
6530
6531 Perl can be built to take advantage of long doubles which
6532 (if available) may give more accuracy and range for floating point
6533 numbers.  To do so, Configure must be run with -Duselongdouble.
6534
6535 If this doesn't make any sense to you, just accept the default 'n'.
6536 EOM
6537 case "$uselongdouble" in
6538 $define|true|[yY]*)     dflt='y';;
6539 *) dflt='n';;
6540 esac
6541 rp='Try to use long doubles if available?'
6542 . ./myread
6543 case "$ans" in
6544 y|Y)    val="$define"   ;;
6545 *)      val="$undef"    ;;
6546 esac
6547 set uselongdouble
6548 eval $setvar
6549
6550 case "$uselongdouble" in
6551 "$define"|true|[yY]*)
6552 : Look for a hint-file generated 'call-back-unit'.  If the
6553 : user has specified that long doubles should be used,
6554 : we may need to set or change some other defaults.
6555         if $test -f uselongdouble.cbu; then
6556                 echo "Your platform has some specific hints for long doubles, using them..."
6557                 . ./uselongdouble.cbu
6558         else
6559                 $cat <<EOM
6560 (Your platform doesn't have any specific hints for long doubles.)
6561 EOM
6562         fi
6563         ;;
6564 esac
6565
6566 cat <<EOM
6567
6568 Previous version of $package used the standard IO mechanisms as defined
6569 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6570 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6571 the default.  This abstraction layer can use AT&T's sfio (if you already
6572 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6573 problems with some extension modules.  Using PerlIO with stdio is safe,
6574 but it is slower than plain stdio and therefore is not the default.
6575
6576 If this doesn't make any sense to you, just accept the default 'n'.
6577 EOM
6578 case "$useperlio" in
6579 $define|true|[yY]*)     dflt='y';;
6580 *) dflt='n';;
6581 esac
6582 rp='Use the experimental PerlIO abstraction layer?'
6583 . ./myread
6584 case "$ans" in
6585 y|Y) 
6586         val="$define"
6587         ;;     
6588 *)      
6589         echo "Ok, doing things the stdio way"
6590         val="$undef"
6591         ;;
6592 esac
6593 set useperlio
6594 eval $setvar 
6595
6596 : Check how to convert floats to strings.
6597 if test "X$d_Gconvert" = X; then
6598         echo " "
6599         echo "Checking for an efficient way to convert floats to strings."
6600         $cat >try.c <<'EOP'
6601 #ifdef TRY_gconvert
6602 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6603 char *myname = "gconvert";
6604 #endif
6605 #ifdef TRY_gcvt
6606 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6607 char *myname = "gcvt";
6608 #endif
6609 #ifdef TRY_sprintf
6610 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6611 char *myname = "sprintf";
6612 #endif
6613
6614 #include <stdio.h>
6615
6616 int
6617 checkit(expect, got)
6618 char *expect;
6619 char *got;
6620 {
6621     if (strcmp(expect, got)) {
6622                 printf("%s oddity:  Expected %s, got %s\n",
6623                         myname, expect, got);
6624                 exit(1);
6625         }
6626 }
6627
6628 int main()
6629
6630         char buf[64]; 
6631         buf[63] = '\0';
6632
6633         /* This must be 1st test on (which?) platform */
6634         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6635         Gconvert(0.1, 8, 0, buf);
6636         checkit("0.1", buf);
6637
6638         Gconvert(1.0, 8, 0, buf); 
6639         checkit("1", buf);
6640
6641         Gconvert(0.0, 8, 0, buf); 
6642         checkit("0", buf);
6643
6644         Gconvert(-1.0, 8, 0, buf); 
6645         checkit("-1", buf);
6646
6647         /* Some Linux gcvt's give 1.e+5 here. */
6648         Gconvert(100000.0, 8, 0, buf); 
6649         checkit("100000", buf);
6650         
6651         /* Some Linux gcvt's give -1.e+5 here. */
6652         Gconvert(-100000.0, 8, 0, buf); 
6653         checkit("-100000", buf);
6654
6655         exit(0);
6656 }
6657 EOP
6658         case "$d_Gconvert" in
6659         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6660         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6661         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6662         *) xxx_list='gconvert gcvt sprintf' ;;
6663         esac
6664
6665         for xxx_convert in $xxx_list; do
6666                 echo "Trying $xxx_convert"
6667                 $rm -f try try$_o
6668                 set try -DTRY_$xxx_convert
6669                 if eval $compile; then
6670                         echo "$xxx_convert" found. >&4
6671                         if ./try; then
6672                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6673                                 break;
6674                         else
6675                                 echo "...But $xxx_convert didn't work as I expected."
6676                         fi
6677                 else
6678                         echo "$xxx_convert NOT found." >&4
6679                 fi
6680         done
6681                 
6682         case "$xxx_convert" in
6683         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6684         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6685         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6686         esac
6687 fi
6688
6689 : see if inttypes.h is available
6690 : we want a real compile instead of Inhdr because some systems
6691 : have an inttypes.h which includes non-existent headers
6692 echo " "
6693 $cat >try.c <<EOCP
6694 #include <inttypes.h>
6695 int main() {
6696         static int32_t foo32 = 0x12345678;
6697 }
6698 EOCP
6699 set try
6700 if eval $compile; then
6701         echo "<inttypes.h> found." >&4
6702         val="$define"
6703 else
6704         echo "<inttypes.h> NOT found." >&4
6705         val="$undef"
6706 fi
6707 $rm -f try.c try
6708 set i_inttypes
6709 eval $setvar
6710
6711 : check for int64_t
6712 case "$use64bits" in
6713 "$define" )
6714         echo " "
6715         echo $n "Checking to see if your system supports int64_t...$c" >&4
6716         $cat >try.c <<EOCP
6717 #include <sys/types.h>
6718 #$i_inttypes I_INTTYPES
6719 #ifdef I_INTTYPES
6720 #include <inttypes.h>
6721 #endif
6722 int64_t foo() { int64_t x; x = 7; return x; }
6723 EOCP
6724         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6725                 val="$define"
6726                 echo " Yup, it does." >&4
6727         else
6728                 val="$undef"
6729                 echo " Nope, it doesn't." >&4
6730         fi
6731         $rm -f try.*
6732         ;;
6733 *)      val="$undef"
6734         ;;
6735 esac
6736 set d_int64t
6737 eval $setvar
6738
6739
6740 : check for lengths of integral types
6741 echo " "
6742 case "$intsize" in
6743 '')
6744         echo "Checking to see how big your integers are..." >&4
6745         $cat >intsize.c <<'EOCP'
6746 #include <stdio.h>
6747 int main()
6748 {
6749         printf("intsize=%d;\n", sizeof(int));
6750         printf("longsize=%d;\n", sizeof(long));
6751         printf("shortsize=%d;\n", sizeof(short));
6752         exit(0);
6753 }
6754 EOCP
6755         set intsize
6756         if eval $compile_ok && ./intsize > /dev/null; then
6757                 eval `./intsize`
6758                 echo "Your integers are $intsize bytes long."
6759                 echo "Your long integers are $longsize bytes long."
6760                 echo "Your short integers are $shortsize bytes long."
6761         else
6762                 $cat >&4 <<EOM
6763 !
6764 Help! I can't compile and run the intsize test program: please enlighten me!
6765 (This is probably a misconfiguration in your system or libraries, and
6766 you really ought to fix it.  Still, I'll try anyway.)
6767 !
6768 EOM
6769                 dflt=4
6770                 rp="What is the size of an integer (in bytes)?"
6771                 . ./myread
6772                 intsize="$ans"
6773                 dflt=$intsize
6774                 rp="What is the size of a long integer (in bytes)?"
6775                 . ./myread
6776                 longsize="$ans"
6777                 dflt=2
6778                 rp="What is the size of a short integer (in bytes)?"
6779                 . ./myread
6780                 shortsize="$ans"
6781         fi
6782         ;;
6783 esac
6784 $rm -f intsize intsize.*
6785
6786 : check for long long
6787 echo " "
6788 echo $n "Checking to see if your system supports long long...$c" >&4
6789 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6790 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6791         val="$define"
6792         echo " Yup, it does." >&4
6793 else
6794         val="$undef"
6795         echo " Nope, it doesn't." >&4
6796 fi
6797 $rm try.*
6798 set d_longlong
6799 eval $setvar
6800
6801 : check for length of long long
6802 case "${d_longlong}${longlongsize}" in
6803 $define)
6804         echo " "
6805         $echo $n "Checking to see how big your long longs are...$c" >&4
6806         $cat >try.c <<'EOCP'
6807 #include <stdio.h>
6808 int main()
6809 {
6810         printf("%d\n", sizeof(long long));
6811 }
6812 EOCP
6813         set try
6814         if eval $compile_ok; then
6815                 longlongsize=`./try`
6816                 $echo " $longlongsize bytes." >&4
6817         else
6818                 dflt='8'
6819                 echo " "
6820                 echo "(I can't seem to compile the test program.  Guessing...)"
6821                 rp="What is the size of a long long (in bytes)?"
6822                 . ./myread
6823                 longlongsize="$ans"
6824         fi
6825         if $test "X$longsize" = "X$longlongsize"; then
6826                 echo "(That isn't any different from an ordinary long.)"
6827         fi      
6828         ;;
6829 esac
6830 $rm -f try.c try
6831
6832 echo " "
6833
6834 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6835
6836 echo "Checking how to print 64-bit integers..." >&4
6837
6838 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6839         quad=int
6840         $cat >try.c <<'EOCP'
6841 #include <sys/types.h>
6842 #include <stdio.h>
6843 int main() {
6844   int q = 12345678901;
6845   printf("%ld\n", q);
6846 }
6847 EOCP
6848         set try
6849         if eval $compile; then
6850                 yyy=`./try$exe_ext`
6851                 case "$yyy" in
6852                 12345678901)
6853                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6854                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6855                         echo "We will use %d."
6856                         ;;
6857                 esac
6858         fi
6859 fi
6860
6861 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6862         quad=long
6863         $cat >try.c <<'EOCP'
6864 #include <sys/types.h>
6865 #include <stdio.h>
6866 int main() {
6867   long q = 12345678901;
6868   printf("%ld\n", q);
6869 }
6870 EOCP
6871         set try
6872         if eval $compile; then
6873                 yyy=`./try$exe_ext`
6874                 case "$yyy" in
6875                 12345678901)
6876                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6877                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6878                         echo "We will use %ld."
6879                         ;;
6880                 esac
6881         fi
6882 fi
6883
6884 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6885         quad=int64_t
6886         $cat >try.c <<'EOCP'
6887 #include <sys/types.h>
6888 #include <inttypes.h>
6889 #include <stdio.h>
6890 int main() {
6891   int64_t q = 12345678901;
6892   printf("%" PRId64 "\n", q);
6893 }
6894 EOCP
6895         set try
6896         if eval $compile; then
6897                 yyy=`./try$exe_ext`
6898                 case "$yyy" in
6899                 12345678901)
6900                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6901                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6902                         echo "We will use the C9X style."
6903                         ;;
6904                 esac
6905         fi
6906 fi
6907
6908 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6909         quad="long long"
6910         $cat >try.c <<'EOCP'
6911 #include <sys/types.h>
6912 #include <stdio.h>
6913 int main() {
6914   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6915   printf("%lld\n", q);
6916 }
6917 EOCP
6918         set try
6919         if eval $compile; then
6920                 yyy=`./try$exe_ext`
6921                 case "$yyy" in
6922                 12345678901)
6923                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6924                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6925                         echo "We will use the %lld style."
6926                         ;;
6927                 esac
6928         fi
6929 fi
6930
6931 if $test X"$sPRId64" = X -a X"$quad" != X; then
6932         $cat >try.c <<EOCP
6933 #include <sys/types.h>
6934 #include <stdio.h>
6935 int main() {
6936   $quad q = 12345678901;
6937   printf("%Ld\n", q);
6938 }
6939 EOCP
6940         set try
6941         if eval $compile; then
6942                 yyy=`./try$exe_ext`
6943                 case "$yyy" in
6944                 12345678901)
6945                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6946                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6947                         echo "We will use %lld."
6948                         ;;
6949                 esac
6950         fi
6951 fi
6952
6953 if $test X"$sPRId64" = X -a X"$quad" != X; then
6954         $cat >try.c <<EOCP
6955 #include <sys/types.h>
6956 #include <stdio.h>
6957 int main() {
6958   $quad q = 12345678901;
6959   printf("%qd\n", q);
6960 }
6961 EOCP
6962         set try
6963         if eval $compile; then
6964                 yyy=`./try$exe_ext`
6965                 case "$yyy" in
6966                 12345678901)
6967                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6968                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6969                         echo "We will use %qd."
6970                         ;;
6971                 esac
6972         fi
6973 fi
6974
6975 if $test X"$sPRId64" = X; then
6976         echo "Cannot figure out how to print 64-bit integers." >&4
6977 fi
6978
6979 $rm -f try try.*
6980
6981 fi # intsize -o longsize -o d_int64t -o d_longlong
6982
6983 case "$sPRId64" in
6984 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6985         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6986         ;;
6987 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6988         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6989         ;;
6990 esac
6991
6992 : check for length of double
6993 echo " "
6994 case "$doublesize" in
6995 '')
6996         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6997         $cat >try.c <<'EOCP'
6998 #include <stdio.h>
6999 int main()
7000 {
7001         printf("%d\n", sizeof(double));
7002 }
7003 EOCP
7004         set try
7005         if eval $compile_ok; then
7006                 doublesize=`./try`
7007                 $echo " $doublesize bytes." >&4
7008         else
7009                 dflt='8'
7010                 echo "(I can't seem to compile the test program.  Guessing...)"
7011                 rp="What is the size of a double precision number (in bytes)?"
7012                 . ./myread
7013                 doublesize="$ans"
7014         fi
7015         ;;
7016 esac
7017 $rm -f try.c try
7018
7019 : check for long doubles
7020 echo " "
7021 echo $n "Checking to see if your system supports long double...$c" >&4
7022 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7023 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7024         val="$define"
7025         echo " Yup, it does." >&4
7026 else
7027         val="$undef"
7028         echo " Nope, it doesn't." >&4
7029 fi
7030 $rm try.*
7031 set d_longdbl
7032 eval $setvar
7033
7034 : check for length of long double
7035 case "${d_longdbl}${longdblsize}" in
7036 $define)
7037         echo " "
7038         $echo $n "Checking to see how big your long doubles are...$c" >&4
7039         $cat >try.c <<'EOCP'
7040 #include <stdio.h>
7041 int main()
7042 {
7043         printf("%d\n", sizeof(long double));
7044 }
7045 EOCP
7046         set try
7047         if eval $compile; then
7048                 longdblsize=`./try`
7049                 $echo " $longdblsize bytes." >&4
7050         else
7051                 dflt='8'
7052                 echo " "
7053                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7054                 rp="What is the size of a long double (in bytes)?"
7055                 . ./myread
7056                 longdblsize="$ans"
7057         fi
7058         if $test "X$doublesize" = "X$longdblsize"; then
7059                 echo "(That isn't any different from an ordinary double.)"
7060         fi      
7061         ;;
7062 esac
7063 $rm -f try.c try
7064
7065 echo " "
7066
7067 if $test X"$d_longdbl" = X"$define"; then
7068
7069 echo "Checking how to print long doubles..." >&4
7070
7071 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7072         $cat >try.c <<'EOCP'
7073 #include <sys/types.h>
7074 #include <stdio.h>
7075 int main() {
7076   double d = 123.456;
7077   printf("%.3f\n", d);
7078 }
7079 EOCP
7080         set try
7081         if eval $compile; then
7082                 yyy=`./try$exe_ext`
7083                 case "$yyy" in
7084                 123.456)
7085                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7086                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7087                         echo "We will use %f."
7088                         ;;
7089                 esac
7090         fi
7091 fi
7092
7093 if $test X"$sPRIfldbl" = X; then
7094         $cat >try.c <<'EOCP'
7095 #include <sys/types.h>
7096 #include <stdio.h>
7097 int main() {
7098   long double d = 123.456;
7099   printf("%.3llf\n", d);
7100 }
7101 EOCP
7102         set try
7103         if eval $compile; then
7104                 yyy=`./try$exe_ext`
7105                 case "$yyy" in
7106                 123.456)
7107                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7108                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7109                         echo "We will use %llf."
7110                         ;;
7111                 esac
7112         fi
7113 fi
7114
7115 if $test X"$sPRIfldbl" = X; then
7116         $cat >try.c <<'EOCP'
7117 #include <sys/types.h>
7118 #include <stdio.h>
7119 int main() {
7120   long double d = 123.456;
7121   printf("%.3Lf\n", d);
7122 }
7123 EOCP
7124         set try
7125         if eval $compile; then
7126                 yyy=`./try$exe_ext`
7127                 case "$yyy" in
7128                 123.456)
7129                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7130                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7131                         echo "We will use %Lf."
7132                         ;;
7133                 esac
7134         fi
7135 fi
7136
7137 if $test X"$sPRIfldbl" = X; then
7138         $cat >try.c <<'EOCP'
7139 #include <sys/types.h>
7140 #include <stdio.h>
7141 int main() {
7142   long double d = 123.456;
7143   printf("%.3lf\n", d);
7144 }
7145 EOCP
7146         set try
7147         if eval $compile; then
7148                 yyy=`./try$exe_ext`
7149                 case "$yyy" in
7150                 123.456)
7151                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7152                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7153                         echo "We will use %lf."
7154                         ;;
7155                 esac
7156         fi
7157 fi
7158
7159 if $test X"$sPRIfldbl" = X; then
7160         echo "Cannot figure out how to print long doubles." >&4
7161 fi
7162
7163 $rm -f try try.*
7164
7165 fi # d_longdbl
7166
7167 case "$sPRIfldbl" in
7168 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7169         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7170         ;;
7171 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7172         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7173         ;;
7174 esac
7175
7176 : Initialize h_fcntl
7177 h_fcntl=false
7178
7179 : Initialize h_sysfile
7180 h_sysfile=false
7181
7182 : access call always available on UNIX
7183 set access d_access
7184 eval $inlibc
7185
7186 : locate the flags for 'access()'
7187 case "$d_access" in
7188 "$define")
7189         echo " "
7190         $cat >access.c <<'EOCP'
7191 #include <sys/types.h>
7192 #ifdef I_FCNTL
7193 #include <fcntl.h>
7194 #endif
7195 #ifdef I_SYS_FILE
7196 #include <sys/file.h>
7197 #endif
7198 #ifdef I_UNISTD
7199 #include <unistd.h>
7200 #endif
7201 int main() {
7202         exit(R_OK);
7203 }
7204 EOCP
7205         : check sys/file.h first, no particular reason here
7206         if $test `./findhdr sys/file.h` && \
7207                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7208                 h_sysfile=true;
7209                 echo "<sys/file.h> defines the *_OK access constants." >&4
7210         elif $test `./findhdr fcntl.h` && \
7211                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7212                 h_fcntl=true;
7213                 echo "<fcntl.h> defines the *_OK access constants." >&4
7214         elif $test `./findhdr unistd.h` && \
7215                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7216                 echo "<unistd.h> defines the *_OK access constants." >&4
7217         else
7218                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7219         fi
7220         ;;
7221 esac
7222 $rm -f access*
7223
7224 : see if accessx exists
7225 set accessx d_accessx
7226 eval $inlibc
7227
7228 : see if alarm exists
7229 set alarm d_alarm
7230 eval $inlibc
7231
7232 : see if atolf exists
7233 set atolf d_atolf
7234 eval $inlibc
7235
7236 : see if atoll exists
7237 set atoll d_atoll
7238 eval $inlibc
7239
7240 : Look for GNU-cc style attribute checking
7241 echo " "
7242 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7243 $cat >attrib.c <<'EOCP'
7244 #include <stdio.h>
7245 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7246 EOCP
7247 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7248         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7249                 echo "Your C compiler doesn't fully support __attribute__."
7250                 val="$undef"
7251         else
7252                 echo "Your C compiler supports __attribute__."
7253                 val="$define"
7254         fi
7255 else
7256         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7257         val="$undef"
7258 fi
7259 set d_attribut
7260 eval $setvar
7261 $rm -f attrib*
7262
7263 : see if bcmp exists
7264 set bcmp d_bcmp
7265 eval $inlibc
7266
7267 : see if bcopy exists
7268 set bcopy d_bcopy
7269 eval $inlibc
7270
7271 : see if this is a unistd.h system
7272 set unistd.h i_unistd
7273 eval $inhdr
7274
7275 : see if getpgrp exists
7276 set getpgrp d_getpgrp
7277 eval $inlibc
7278
7279 case "$d_getpgrp" in
7280 "$define")
7281         echo " "
7282         echo "Checking to see which flavor of getpgrp is in use..."
7283         $cat >set.c <<EOP
7284 #$i_unistd I_UNISTD
7285 #include <sys/types.h>
7286 #ifdef I_UNISTD
7287 #  include <unistd.h>
7288 #endif
7289 int main()
7290 {
7291         if (getuid() == 0) {
7292                 printf("(I see you are running Configure as super-user...)\n");
7293                 setuid(1);
7294         }
7295 #ifdef TRY_BSD_PGRP
7296         if (getpgrp(1) == 0)
7297                 exit(0);
7298 #else
7299         if (getpgrp() > 0)
7300                 exit(0);
7301 #endif
7302         exit(1);
7303 }
7304 EOP
7305         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7306                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7307                 val="$define"
7308         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7309                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7310                 val="$undef"
7311         else
7312                 echo "I can't seem to compile and run the test program."
7313                 if ./usg; then
7314                         xxx="a USG one, i.e. you use getpgrp()."
7315                 else
7316                         # SVR4 systems can appear rather BSD-ish.
7317                         case "$i_unistd" in
7318                         $undef)
7319                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7320                                 val="$define"
7321                                 ;;
7322                         $define)
7323                                 xxx="probably a USG one, i.e. you use getpgrp()."
7324                                 val="$undef"
7325                                 ;;
7326                         esac
7327                 fi
7328                 echo "Assuming your getpgrp is $xxx" >&4
7329         fi
7330         ;;
7331 *) val="$undef";;
7332 esac
7333 set d_bsdgetpgrp
7334 eval $setvar
7335 $rm -f set set.c
7336
7337 : see if setpgrp exists
7338 set setpgrp d_setpgrp
7339 eval $inlibc
7340
7341 case "$d_setpgrp" in
7342 "$define")
7343         echo " "
7344         echo "Checking to see which flavor of setpgrp is in use..."
7345         $cat >set.c <<EOP
7346 #$i_unistd I_UNISTD
7347 #include <sys/types.h>
7348 #ifdef I_UNISTD
7349 #  include <unistd.h>
7350 #endif
7351 int main()
7352 {
7353         if (getuid() == 0) {
7354                 printf("(I see you are running Configure as super-user...)\n");
7355                 setuid(1);
7356         }
7357 #ifdef TRY_BSD_PGRP
7358         if (-1 == setpgrp(1, 1))
7359                 exit(0);
7360 #else
7361         if (setpgrp() != -1)
7362                 exit(0);
7363 #endif
7364         exit(1);
7365 }
7366 EOP
7367         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7368                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7369                 val="$define"
7370         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7371                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7372                 val="$undef"
7373         else
7374                 echo "(I can't seem to compile and run the test program.)"
7375                 if ./usg; then
7376                         xxx="a USG one, i.e. you use setpgrp()."
7377                 else
7378                         # SVR4 systems can appear rather BSD-ish.
7379                         case "$i_unistd" in
7380                         $undef)
7381                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7382                                 val="$define"
7383                                 ;;
7384                         $define)
7385                                 xxx="probably a USG one, i.e. you use setpgrp()."
7386                                 val="$undef"
7387                                 ;;
7388                         esac
7389                 fi
7390                 echo "Assuming your setpgrp is $xxx" >&4
7391         fi
7392         ;;
7393 *) val="$undef";;
7394 esac
7395 set d_bsdsetpgrp
7396 eval $setvar
7397 $rm -f set set.c
7398 : see if bzero exists
7399 set bzero d_bzero
7400 eval $inlibc
7401
7402 : see if signal is declared as pointer to function returning int or void
7403 echo " "
7404 xxx=`./findhdr signal.h`
7405 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7406 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7407         echo "You have int (*signal())() instead of void." >&4
7408         val="$undef"
7409 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7410         echo "You have void (*signal())()." >&4
7411         val="$define"
7412 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7413         echo "You have int (*signal())() instead of void." >&4
7414         val="$undef"
7415 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7416         echo "You have void (*signal())()." >&4
7417         val="$define"
7418 else
7419         case "$d_voidsig" in
7420         '')
7421         echo "I can't determine whether signal handler returns void or int..." >&4
7422                 dflt=void
7423                 rp="What type does your signal handler return?"
7424                 . ./myread
7425                 case "$ans" in
7426                 v*) val="$define";;
7427                 *) val="$undef";;
7428                 esac;;
7429         "$define")
7430                 echo "As you already told me, signal handler returns void." >&4
7431                 val="$define"
7432                 ;;
7433         *)      echo "As you already told me, signal handler returns int." >&4
7434                 val="$undef"
7435                 ;;
7436         esac
7437 fi
7438 set d_voidsig
7439 eval $setvar
7440 case "$d_voidsig" in
7441 "$define") signal_t="void";;
7442 *) signal_t="int";;
7443 esac
7444 $rm -f $$.tmp
7445
7446 : check for ability to cast large floats to 32-bit ints.
7447 echo " "
7448 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7449 if $test "$intsize" -ge 4; then
7450         xxx=int
7451 else
7452         xxx=long
7453 fi
7454 $cat >try.c <<EOCP
7455 #include <stdio.h>
7456 #include <sys/types.h>
7457 #include <signal.h>
7458 $signal_t blech(s) int s; { exit(3); }
7459 int main()
7460 {
7461         $xxx i32;
7462         double f, g;
7463         int result = 0;
7464         char str[16];
7465         signal(SIGFPE, blech);
7466
7467         /* Don't let compiler optimize the test away.  Store the number 
7468            in a writable string for gcc to pass to sscanf under HP/UX.
7469         */
7470         sprintf(str, "2147483647");
7471         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7472         g = 10 * f;
7473         i32  = ($xxx) g;
7474
7475         /* x86 processors will probably give 0x8000 0000, which is a
7476        sign change.  We don't want that.  We want to mimic SPARC
7477            behavior here, which is to preserve the sign and give
7478            back 0x7fff ffff.
7479         */
7480         if (i32 != ($xxx) f)
7481                 result |= 1;
7482         exit(result);
7483 }
7484 EOCP
7485 set try
7486 if eval $compile_ok; then
7487         ./try
7488         yyy=$?
7489 else
7490         echo "(I can't seem to compile the test program--assuming it can't)"
7491         yyy=1
7492 fi
7493 case "$yyy" in
7494 0)      val="$define"
7495         echo "Yup, it can."
7496         ;;
7497 *)      val="$undef"
7498         echo "Nope, it can't."
7499         ;;
7500 esac
7501 set d_casti32
7502 eval $setvar
7503 $rm -f try try.*
7504
7505 : check for ability to cast negative floats to unsigned
7506 echo " "
7507 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7508 $cat >try.c <<EOCP
7509 #include <stdio.h>
7510 #include <sys/types.h>
7511 #include <signal.h>
7512 $signal_t blech(s) int s; { exit(7); }
7513 $signal_t blech_in_list(s) int s; { exit(4); }
7514 unsigned long dummy_long(p) unsigned long p; { return p; }
7515 unsigned int dummy_int(p) unsigned int p; { return p; }
7516 unsigned short dummy_short(p) unsigned short p; { return p; }
7517 int main()
7518 {
7519         double f;
7520         unsigned long along;
7521         unsigned int aint;
7522         unsigned short ashort;
7523         int result = 0;
7524         char str[16];
7525         
7526         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7527            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7528            optimized the whole file away
7529         */
7530         /* Store the number in a writable string for gcc to pass to 
7531            sscanf under HP/UX.
7532         */
7533         sprintf(str, "-123");
7534         sscanf(str, "%lf", &f);  /* f = -123.; */
7535
7536         signal(SIGFPE, blech);
7537         along = (unsigned long)f;
7538         aint = (unsigned int)f;
7539         ashort = (unsigned short)f;
7540         if (along != (unsigned long)-123)
7541                 result |= 1;
7542         if (aint != (unsigned int)-123)
7543                 result |= 1;
7544         if (ashort != (unsigned short)-123)
7545                 result |= 1;
7546         sprintf(str, "1073741824.");
7547         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7548         f = f + f;
7549         along = 0;
7550         along = (unsigned long)f;
7551         if (along != 0x80000000)
7552                 result |= 2;
7553         f -= 1.;
7554         along = 0;
7555         along = (unsigned long)f;
7556         if (along != 0x7fffffff)
7557                 result |= 1;
7558         f += 2.;
7559         along = 0;
7560         along = (unsigned long)f;
7561         if (along != 0x80000001)
7562                 result |= 2;
7563         if (result)
7564                 exit(result);
7565         signal(SIGFPE, blech_in_list);
7566         sprintf(str, "123.");
7567         sscanf(str, "%lf", &f);  /* f = 123.; */
7568         along = dummy_long((unsigned long)f);
7569         aint = dummy_int((unsigned int)f);
7570         ashort = dummy_short((unsigned short)f);
7571         if (along != (unsigned long)123)
7572                 result |= 4;
7573         if (aint != (unsigned int)123)
7574                 result |= 4;
7575         if (ashort != (unsigned short)123)
7576                 result |= 4;
7577         exit(result);
7578
7579 }
7580 EOCP
7581 set try
7582 if eval $compile_ok; then
7583         ./try
7584         castflags=$?
7585 else
7586         echo "(I can't seem to compile the test program--assuming it can't)"
7587         castflags=7
7588 fi
7589 case "$castflags" in
7590 0)      val="$define"
7591         echo "Yup, it can."
7592         ;;
7593 *)      val="$undef"
7594         echo "Nope, it can't."
7595         ;;
7596 esac
7597 set d_castneg
7598 eval $setvar
7599 $rm -f try.*
7600
7601 : see if vprintf exists
7602 echo " "
7603 if set vprintf val -f d_vprintf; eval $csym; $val; then
7604         echo 'vprintf() found.' >&4
7605         val="$define"
7606         $cat >vprintf.c <<'EOF'
7607 #include <varargs.h>
7608
7609 int main() { xxx("foo"); }
7610
7611 xxx(va_alist)
7612 va_dcl
7613 {
7614         va_list args;
7615         char buf[10];
7616
7617         va_start(args);
7618         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7619 }
7620 EOF
7621         set vprintf
7622         if eval $compile && ./vprintf; then
7623                 echo "Your vsprintf() returns (int)." >&4
7624                 val2="$undef"
7625         else
7626                 echo "Your vsprintf() returns (char*)." >&4
7627                 val2="$define"
7628         fi
7629 else
7630         echo 'vprintf() NOT found.' >&4
7631                 val="$undef"
7632                 val2="$undef"
7633 fi
7634 set d_vprintf
7635 eval $setvar
7636 val=$val2
7637 set d_charvspr
7638 eval $setvar
7639
7640 : see if chown exists
7641 set chown d_chown
7642 eval $inlibc
7643
7644 : see if chroot exists
7645 set chroot d_chroot
7646 eval $inlibc
7647
7648 : see if chsize exists
7649 set chsize d_chsize
7650 eval $inlibc
7651
7652 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7653 while $test $# -ge 2; do
7654         case "$1" in
7655         $define) echo "#include <$2>";;
7656         esac ;
7657     shift 2;
7658 done > try.c;
7659 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7660 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7661         val="$define";
7662 else
7663         val="$undef";
7664 fi;
7665 set $varname;
7666 eval $setvar;
7667 $rm -f try.c try.o'
7668
7669 : see if this is a sys/uio.h system
7670 set sys/uio.h i_sysuio
7671 eval $inhdr
7672
7673 echo "Checking to see if your system supports struct iovec..." >&4
7674 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7675 eval $hasfield
7676 case "$d_iovec_s" in
7677 "$define")      echo "Yup, it does." >&4
7678                 ;;
7679 *)              echo "Nope, it doesn't." >&4
7680                 ;;
7681 esac
7682
7683 socketlib=''
7684 sockethdr=''
7685 : see whether socket exists
7686 echo " "
7687 $echo $n "Hmm... $c" >&4
7688 if set socket val -f d_socket; eval $csym; $val; then
7689         echo "Looks like you have Berkeley networking support." >&4
7690         d_socket="$define"
7691         if set setsockopt val -f; eval $csym; $val; then
7692                 d_oldsock="$undef"
7693         else
7694                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7695                 d_oldsock="$define"
7696         fi
7697 else
7698         if $contains socklib libc.list >/dev/null 2>&1; then
7699                 echo "Looks like you have Berkeley networking support." >&4
7700                 d_socket="$define"
7701                 : we will have to assume that it supports the 4.2 BSD interface
7702                 d_oldsock="$undef"
7703         else
7704                 echo "You don't have Berkeley networking in libc$_a..." >&4
7705                 if test "X$d_socket" = "X$define"; then
7706                    echo "...but you seem to believe that you have sockets." >&4
7707                 else
7708                         for net in net socket
7709                         do
7710                                 if test -f /usr/lib/lib$net$_a; then
7711                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7712                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7713                                         if $contains socket libc.list >/dev/null 2>&1; then
7714                                                 d_socket="$define"
7715                                                 socketlib="-l$net"
7716                                                 case "$net" in
7717                                                 net)
7718                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7719                                                         sockethdr="-I/usr/netinclude"
7720                                                         ;;
7721                                                 esac
7722                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7723                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7724                                                         d_oldsock="$undef"
7725                                                 else
7726                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7727                                                         d_oldsock="$define"
7728                                                 fi
7729                                                 break
7730                                         fi
7731                                 fi
7732                         done
7733                         if test "X$d_socket" != "X$define"; then
7734                            echo "or anywhere else I see." >&4
7735                            d_socket="$undef"
7736                            d_oldsock="$undef"
7737                         fi
7738                 fi
7739         fi
7740 fi
7741
7742 : see if socketpair exists
7743 set socketpair d_sockpair
7744 eval $inlibc
7745
7746
7747 echo " "
7748 echo "Checking the availability of certain socket constants..." >& 4
7749 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7750         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7751         $cat >try.c <<EOF
7752 #include <sys/types.h>
7753 #include <sys/socket.h>
7754 int main() {
7755     int i = $ENUM;
7756 }
7757 EOF
7758         val="$undef"
7759         set try; if eval $compile; then
7760                 val="$define"
7761         fi
7762         set d_${enum}; eval $setvar
7763         $rm -f try.c try
7764 done
7765
7766 set sendmsg d_sendmsg
7767 eval $inlibc
7768
7769 set recvmsg d_recvmsg
7770 eval $inlibc
7771
7772 echo " "
7773 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7774 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7775 eval $hasfield
7776 case "$d_msghdr_s" in
7777 "$define")      echo "Yup, it does." >&4
7778                 ;;
7779 *)              echo "Nope, it doesn't." >&4
7780                 ;;
7781 esac
7782
7783 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7784 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7785 eval $hasfield
7786 case "$d_cmsghdr_s" in
7787 "$define")      echo "Yup, it does." >&4
7788                 ;;
7789 *)              echo "Nope, it doesn't." >&4
7790                 ;;
7791 esac
7792
7793 : check for const keyword
7794 echo " "
7795 echo 'Checking to see if your C compiler knows about "const"...' >&4
7796 $cat >const.c <<'EOCP'
7797 typedef struct spug { int drokk; } spug;
7798 int main()
7799 {
7800         const char *foo;
7801         const spug y;
7802 }
7803 EOCP
7804 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7805         val="$define"
7806         echo "Yup, it does."
7807 else
7808         val="$undef"
7809         echo "Nope, it doesn't."
7810 fi
7811 set d_const
7812 eval $setvar
7813
7814 : see if crypt exists
7815 echo " "
7816 if set crypt val -f d_crypt; eval $csym; $val; then
7817         echo 'crypt() found.' >&4
7818         val="$define"
7819         cryptlib=''
7820 else
7821         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7822         if $test -z "$cryptlib"; then
7823                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7824         else
7825                 cryptlib=-lcrypt
7826         fi
7827         if $test -z "$cryptlib"; then
7828                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7829         else
7830                 cryptlib=-lcrypt
7831         fi
7832         if $test -z "$cryptlib"; then
7833                 cryptlib=`./loc libcrypt$_a "" $libpth`
7834         else
7835                 cryptlib=-lcrypt
7836         fi
7837         if $test -z "$cryptlib"; then
7838                 echo 'crypt() NOT found.' >&4
7839                 val="$undef"
7840         else
7841                 val="$define"
7842         fi
7843 fi
7844 set d_crypt
7845 eval $setvar
7846
7847 : get csh whereabouts
7848 case "$csh" in
7849 'csh') val="$undef" ;;
7850 *) val="$define" ;;
7851 esac
7852 set d_csh
7853 eval $setvar
7854 : Respect a hint or command line value for full_csh.
7855 case "$full_csh" in
7856 '') full_csh=$csh ;;
7857 esac
7858
7859 : see if cuserid exists
7860 set cuserid d_cuserid
7861 eval $inlibc
7862
7863 : see if this is a limits.h system
7864 set limits.h i_limits
7865 eval $inhdr
7866
7867 : see if this is a float.h system
7868 set float.h i_float
7869 eval $inhdr
7870
7871 : See if number of significant digits in a double precision number is known
7872 echo " "
7873 $cat >dbl_dig.c <<EOM
7874 #$i_limits I_LIMITS
7875 #$i_float I_FLOAT
7876 #ifdef I_LIMITS
7877 #include <limits.h>
7878 #endif
7879 #ifdef I_FLOAT
7880 #include <float.h>
7881 #endif
7882 #ifdef DBL_DIG
7883 printf("Contains DBL_DIG");
7884 #endif
7885 EOM
7886 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7887 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7888         echo "DBL_DIG found." >&4
7889         val="$define"
7890 else
7891         echo "DBL_DIG NOT found." >&4
7892         val="$undef"
7893 fi
7894 $rm -f dbl_dig.?
7895 set d_dbl_dig
7896 eval $setvar
7897
7898 : see if difftime exists
7899 set difftime d_difftime
7900 eval $inlibc
7901
7902 : see if this is a dirent system
7903 echo " "
7904 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7905         val="$define"
7906         echo "<dirent.h> found." >&4
7907 else
7908         val="$undef"
7909         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7910                 echo "<sys/dir.h> found." >&4
7911                 echo " "
7912         else
7913                 xinc=`./findhdr sys/ndir.h`
7914         fi
7915         echo "<dirent.h> NOT found." >&4
7916 fi
7917 set i_dirent
7918 eval $setvar
7919
7920 : Look for type of directory structure.
7921 echo " "
7922 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7923
7924 case "$direntrytype" in
7925 ''|' ')
7926         case "$i_dirent" in
7927         $define) guess1='struct dirent' ;;
7928         *) guess1='struct direct'  ;;
7929         esac
7930         ;;
7931 *)      guess1="$direntrytype"
7932         ;;
7933 esac
7934
7935 case "$guess1" in
7936 'struct dirent') guess2='struct direct' ;;
7937 *) guess2='struct dirent' ;;
7938 esac
7939                 
7940 if $contains "$guess1" try.c >/dev/null 2>&1; then
7941         direntrytype="$guess1"
7942         echo "Your directory entries are $direntrytype." >&4
7943 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7944         direntrytype="$guess2"
7945         echo "Your directory entries seem to be $direntrytype." >&4
7946 else
7947         echo "I don't recognize your system's directory entries." >&4
7948         rp="What type is used for directory entries on this system?"
7949         dflt="$guess1"
7950         . ./myread
7951         direntrytype="$ans"
7952 fi
7953 $rm -f try.c
7954
7955
7956 : see if the directory entry stores field length
7957 echo " "
7958 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7959 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7960         echo "Good, your directory entry keeps length information in d_namlen." >&4
7961         val="$define"
7962 else
7963         echo "Your directory entry does not know about the d_namlen field." >&4
7964         val="$undef"
7965 fi
7966 set d_dirnamlen
7967 eval $setvar
7968 $rm -f try.c
7969
7970 : see if dlerror exists
7971 xxx_runnm="$runnm"
7972 runnm=false
7973 set dlerror d_dlerror
7974 eval $inlibc
7975 runnm="$xxx_runnm"
7976
7977 : see if dlfcn is available
7978 set dlfcn.h i_dlfcn
7979 eval $inhdr
7980
7981 case "$usedl" in
7982 $define|y|true)
7983         $cat << EOM
7984
7985 On a few systems, the dynamically loaded modules that perl generates and uses
7986 will need a different extension than shared libs. The default will probably
7987 be appropriate.
7988
7989 EOM
7990         case "$dlext" in
7991         '')     dflt="$so" ;;
7992         *)      dflt="$dlext" ;;
7993         esac
7994         rp='What is the extension of dynamically loaded modules'
7995         . ./myread
7996         dlext="$ans"
7997         ;;
7998 *)
7999         dlext="none"
8000         ;;
8001 esac
8002
8003 : Check if dlsym need a leading underscore
8004 echo " "
8005 val="$undef"
8006
8007 case "$dlsrc" in
8008 dl_dlopen.xs)
8009         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8010         $cat >dyna.c <<'EOM'
8011 fred () { }
8012 EOM
8013
8014 $cat >fred.c<<EOM
8015
8016 #include <stdio.h>
8017 #$i_dlfcn I_DLFCN
8018 #ifdef I_DLFCN
8019 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8020 #else
8021 #include <sys/types.h>
8022 #include <nlist.h>
8023 #include <link.h>
8024 #endif
8025
8026 extern int fred() ;
8027
8028 int main()
8029 {
8030     void * handle ;
8031     void * symbol ;
8032 #ifndef RTLD_LAZY
8033     int mode = 1 ;
8034 #else
8035     int mode = RTLD_LAZY ;
8036 #endif
8037     handle = dlopen("./dyna.$dlext", mode) ;
8038     if (handle == NULL) {
8039         printf ("1\n") ;
8040         fflush (stdout) ;
8041         exit(0);
8042     }
8043     symbol = dlsym(handle, "fred") ;
8044     if (symbol == NULL) {
8045         /* try putting a leading underscore */
8046         symbol = dlsym(handle, "_fred") ;
8047         if (symbol == NULL) {
8048             printf ("2\n") ;
8049             fflush (stdout) ;
8050             exit(0);
8051         }
8052         printf ("3\n") ;
8053     }
8054     else
8055         printf ("4\n") ;
8056     fflush (stdout) ;
8057     exit(0);
8058 }
8059 EOM
8060         : Call the object file tmp-dyna.o in case dlext=o.
8061         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8062                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8063                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8064                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8065                 xxx=`./fred`
8066                 case $xxx in
8067                 1)      echo "Test program failed using dlopen." >&4
8068                         echo "Perhaps you should not use dynamic loading." >&4;;
8069                 2)      echo "Test program failed using dlsym." >&4
8070                         echo "Perhaps you should not use dynamic loading." >&4;;
8071                 3)      echo "dlsym needs a leading underscore" >&4
8072                         val="$define" ;;
8073                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8074                 esac
8075         else
8076                 echo "I can't compile and run the test program." >&4
8077                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8078         fi
8079         ;;
8080 esac
8081                 
8082 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8083
8084 set d_dlsymun
8085 eval $setvar
8086
8087 hasproto='varname=$1; func=$2; shift; shift;
8088 while $test $# -ge 2; do
8089         case "$1" in
8090         $define) echo "#include <$2>";;
8091         esac ;
8092     shift 2;
8093 done > try.c;
8094 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8095 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8096         echo "$func() prototype found.";
8097         val="$define";
8098 else
8099         echo "$func() prototype NOT found.";
8100         val="$undef";
8101 fi;
8102 set $varname;
8103 eval $setvar;
8104 $rm -f try.c tryout.c'
8105
8106 : see if prototype for drand48 is available
8107 echo " "
8108 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8109 eval $hasproto
8110
8111 : see if dup2 exists
8112 set dup2 d_dup2
8113 eval $inlibc
8114
8115 : see if eaccess exists
8116 set eaccess d_eaccess
8117 eval $inlibc
8118
8119 : see if endgrent exists
8120 set endgrent d_endgrent
8121 eval $inlibc
8122
8123 : see if endhostent exists
8124 set endhostent d_endhent
8125 eval $inlibc
8126
8127 : see if endnetent exists
8128 set endnetent d_endnent
8129 eval $inlibc
8130
8131 : see if endprotoent exists
8132 set endprotoent d_endpent
8133 eval $inlibc
8134
8135 : see if endpwent exists
8136 set endpwent d_endpwent
8137 eval $inlibc
8138
8139 : see if endservent exists
8140 set endservent d_endsent
8141 eval $inlibc
8142
8143 : see if endspent exists
8144 set endspent d_endspent
8145 eval $inlibc
8146
8147 : Locate the flags for 'open()'
8148 echo " "
8149 $cat >open3.c <<'EOCP'
8150 #include <sys/types.h>
8151 #ifdef I_FCNTL
8152 #include <fcntl.h>
8153 #endif
8154 #ifdef I_SYS_FILE
8155 #include <sys/file.h>
8156 #endif
8157 int main() {
8158         if(O_RDONLY);
8159 #ifdef O_TRUNC
8160         exit(0);
8161 #else
8162         exit(1);
8163 #endif
8164 }
8165 EOCP
8166 : check sys/file.h first to get FREAD on Sun
8167 if $test `./findhdr sys/file.h` && \
8168                 set open3 -DI_SYS_FILE && eval $compile; then
8169         h_sysfile=true;
8170         echo "<sys/file.h> defines the O_* constants..." >&4
8171         if ./open3; then
8172                 echo "and you have the 3 argument form of open()." >&4
8173                 val="$define"
8174         else
8175                 echo "but not the 3 argument form of open().  Oh, well." >&4
8176                 val="$undef"
8177         fi
8178 elif $test `./findhdr fcntl.h` && \
8179                 set open3 -DI_FCNTL && eval $compile; then
8180         h_fcntl=true;
8181         echo "<fcntl.h> defines the O_* constants..." >&4
8182         if ./open3; then
8183                 echo "and you have the 3 argument form of open()." >&4
8184                 val="$define"
8185         else
8186                 echo "but not the 3 argument form of open().  Oh, well." >&4
8187                 val="$undef"
8188         fi
8189 else
8190         val="$undef"
8191         echo "I can't find the O_* constant definitions!  You got problems." >&4
8192 fi
8193 set d_open3
8194 eval $setvar
8195 $rm -f open3*
8196
8197 : check for non-blocking I/O stuff
8198 case "$h_sysfile" in
8199 true) echo "#include <sys/file.h>" > head.c;;
8200 *)
8201         case "$h_fcntl" in
8202         true) echo "#include <fcntl.h>" > head.c;;
8203         *) echo "#include <sys/fcntl.h>" > head.c;;
8204         esac
8205         ;;
8206 esac
8207 echo " "
8208 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8209 case "$o_nonblock" in
8210 '')
8211         $cat head.c > try.c
8212         $cat >>try.c <<'EOCP'
8213 int main() {
8214 #ifdef O_NONBLOCK
8215         printf("O_NONBLOCK\n");
8216         exit(0);
8217 #endif
8218 #ifdef O_NDELAY
8219         printf("O_NDELAY\n");
8220         exit(0);
8221 #endif
8222 #ifdef FNDELAY
8223         printf("FNDELAY\n");
8224         exit(0);
8225 #endif
8226         exit(0);
8227 }
8228 EOCP
8229         set try
8230         if eval $compile_ok; then
8231                 o_nonblock=`./try`
8232                 case "$o_nonblock" in
8233                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8234                 *) echo "Seems like we can use $o_nonblock.";;
8235                 esac
8236         else
8237                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8238         fi
8239         ;;
8240 *) echo "Using $hint value $o_nonblock.";;
8241 esac
8242 $rm -f try try.* .out core
8243
8244 echo " "
8245 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8246 case "$eagain" in
8247 '')
8248         $cat head.c > try.c
8249         $cat >>try.c <<EOCP
8250 #include <errno.h>
8251 #include <sys/types.h>
8252 #include <signal.h>
8253 #define MY_O_NONBLOCK $o_nonblock
8254 #ifndef errno  /* XXX need better Configure test */
8255 extern int errno;
8256 #endif
8257 $signal_t blech(x) int x; { exit(3); }
8258 EOCP
8259         $cat >> try.c <<'EOCP'
8260 int main()
8261 {
8262         int pd[2];
8263         int pu[2];
8264         char buf[1];
8265         char string[100];
8266
8267         pipe(pd);       /* Down: child -> parent */
8268         pipe(pu);       /* Up: parent -> child */
8269         if (0 != fork()) {
8270                 int ret;
8271                 close(pd[1]);   /* Parent reads from pd[0] */
8272                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8273                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8274                         exit(1);
8275                 signal(SIGALRM, blech);
8276                 alarm(5);
8277                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8278                         exit(2);
8279                 sprintf(string, "%d\n", ret);
8280                 write(2, string, strlen(string));
8281                 alarm(0);
8282 #ifdef EAGAIN
8283                 if (errno == EAGAIN) {
8284                         printf("EAGAIN\n");
8285                         goto ok;
8286                 }
8287 #endif
8288 #ifdef EWOULDBLOCK
8289                 if (errno == EWOULDBLOCK)
8290                         printf("EWOULDBLOCK\n");
8291 #endif
8292         ok:
8293                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8294                 sleep(2);                               /* Give it time to close our pipe */
8295                 alarm(5);
8296                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8297                 alarm(0);
8298                 sprintf(string, "%d\n", ret);
8299                 write(3, string, strlen(string));
8300                 exit(0);
8301         }
8302
8303         close(pd[0]);                   /* We write to pd[1] */
8304         close(pu[1]);                   /* We read from pu[0] */
8305         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8306         close(pd[1]);                   /* Pipe pd is now fully closed! */
8307         exit(0);                                /* Bye bye, thank you for playing! */
8308 }
8309 EOCP
8310         set try
8311         if eval $compile_ok; then
8312                 echo "$startsh" >mtry
8313                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8314                 chmod +x mtry
8315                 ./mtry >/dev/null 2>&1
8316                 case $? in
8317                 0) eagain=`$cat try.out`;;
8318                 1) echo "Could not perform non-blocking setting!";;
8319                 2) echo "I did a successful read() for something that was not there!";;
8320                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8321                 *) echo "Something terribly wrong happened during testing.";;
8322                 esac
8323                 rd_nodata=`$cat try.ret`
8324                 echo "A read() system call with no data present returns $rd_nodata."
8325                 case "$rd_nodata" in
8326                 0|-1) ;;
8327                 *)
8328                         echo "(That's peculiar, fixing that to be -1.)"
8329                         rd_nodata=-1
8330                         ;;
8331                 esac
8332                 case "$eagain" in
8333                 '')
8334                         echo "Forcing errno EAGAIN on read() with no data available."
8335                         eagain=EAGAIN
8336                         ;;
8337                 *)
8338                         echo "Your read() sets errno to $eagain when no data is available."
8339                         ;;
8340                 esac
8341                 status=`$cat try.err`
8342                 case "$status" in
8343                 0) echo "And it correctly returns 0 to signal EOF.";;
8344                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8345                 *) echo "However, your read() returns '$status' on EOF??";;
8346                 esac
8347                 val="$define"
8348                 if test "$status" = "$rd_nodata"; then
8349                         echo "WARNING: you can't distinguish between EOF and no data!"
8350                         val="$undef"
8351                 fi
8352         else
8353                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8354                 eagain=EAGAIN
8355         fi
8356         set d_eofnblk
8357         eval $setvar
8358         ;;
8359 *)
8360         echo "Using $hint value $eagain."
8361         echo "Your read() returns $rd_nodata when no data is present."
8362         case "$d_eofnblk" in
8363         "$define") echo "And you can see EOF because read() returns 0.";;
8364         "$undef") echo "But you can't see EOF status from read() returned value.";;
8365         *)
8366                 echo "(Assuming you can't see EOF status from read anyway.)"
8367                 d_eofnblk=$undef
8368                 ;;
8369         esac
8370         ;;
8371 esac
8372 $rm -f try try.* .out core head.c mtry
8373
8374 : see if fchmod exists
8375 set fchmod d_fchmod
8376 eval $inlibc
8377
8378 : see if fchown exists
8379 set fchown d_fchown
8380 eval $inlibc
8381
8382 : see if this is an fcntl system
8383 set fcntl d_fcntl
8384 eval $inlibc
8385
8386 : see if sys/select.h has to be included
8387 set sys/select.h i_sysselct
8388 eval $inhdr
8389
8390 : see if we should include time.h, sys/time.h, or both
8391 echo " "
8392 if test "X$timeincl" = X; then
8393         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8394         $echo $n "I'm now running the test program...$c"
8395         $cat >try.c <<'EOCP'
8396 #include <sys/types.h>
8397 #ifdef I_TIME
8398 #include <time.h>
8399 #endif
8400 #ifdef I_SYSTIME
8401 #ifdef SYSTIMEKERNEL
8402 #define KERNEL
8403 #endif
8404 #include <sys/time.h>
8405 #endif
8406 #ifdef I_SYSSELECT
8407 #include <sys/select.h>
8408 #endif
8409 int main()
8410 {
8411         struct tm foo;
8412 #ifdef S_TIMEVAL
8413         struct timeval bar;
8414 #endif
8415 #ifdef S_TIMEZONE
8416         struct timezone tzp;
8417 #endif
8418         if (foo.tm_sec == foo.tm_sec)
8419                 exit(0);
8420 #ifdef S_TIMEVAL
8421         if (bar.tv_sec == bar.tv_sec)
8422                 exit(0);
8423 #endif
8424         exit(1);
8425 }
8426 EOCP
8427         flags=''
8428         for s_timezone in '-DS_TIMEZONE' ''; do
8429         sysselect=''
8430         for s_timeval in '-DS_TIMEVAL' ''; do
8431         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8432         for i_time in '' '-DI_TIME'; do
8433         for i_systime in '-DI_SYSTIME' ''; do
8434                 case "$flags" in
8435                 '') $echo $n ".$c"
8436                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8437                         if eval $compile; then
8438                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8439                                 shift
8440                                 flags="$*"
8441                                 echo " "
8442                                 $echo $n "Succeeded with $flags$c"
8443                         fi
8444                         ;;
8445                 esac
8446         done
8447         done
8448         done
8449         done
8450         done
8451         timeincl=''
8452         echo " "
8453         case "$flags" in
8454         *SYSTIMEKERNEL*) i_systimek="$define"
8455                 timeincl=`./findhdr sys/time.h`
8456                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8457         *) i_systimek="$undef";;
8458         esac
8459         case "$flags" in
8460         *I_TIME*) i_time="$define"
8461                 timeincl=`./findhdr time.h`" $timeincl"
8462                 echo "We'll include <time.h>." >&4;;
8463         *) i_time="$undef";;
8464         esac
8465         case "$flags" in
8466         *I_SYSTIME*) i_systime="$define"
8467                 timeincl=`./findhdr sys/time.h`" $timeincl"
8468                 echo "We'll include <sys/time.h>." >&4;;
8469         *) i_systime="$undef";;
8470         esac
8471         $rm -f try.c try
8472 fi
8473
8474 : check for fd_set items
8475 $cat <<EOM
8476
8477 Checking to see how well your C compiler handles fd_set and friends ...
8478 EOM
8479 $cat >fd_set.c <<EOCP
8480 #$i_systime I_SYS_TIME
8481 #$i_sysselct I_SYS_SELECT
8482 #$d_socket HAS_SOCKET
8483 #include <sys/types.h>
8484 #ifdef HAS_SOCKET
8485 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8486 #endif
8487 #ifdef I_SYS_TIME
8488 #include <sys/time.h>
8489 #endif
8490 #ifdef I_SYS_SELECT
8491 #include <sys/select.h>
8492 #endif
8493 int main() {
8494         fd_set fds;
8495
8496 #ifdef TRYBITS
8497         if(fds.fds_bits);
8498 #endif
8499
8500 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8501         exit(0);
8502 #else
8503         exit(1);
8504 #endif
8505 }
8506 EOCP
8507 set fd_set -DTRYBITS
8508 if eval $compile; then
8509         d_fds_bits="$define"
8510         d_fd_set="$define"
8511         echo "Well, your system knows about the normal fd_set typedef..." >&4
8512         if ./fd_set; then
8513                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8514                 d_fd_macros="$define"
8515         else
8516                 $cat >&4 <<'EOM'
8517 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8518 EOM
8519                 d_fd_macros="$undef"
8520         fi
8521 else
8522         $cat <<'EOM'
8523 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8524 EOM
8525         set fd_set
8526         if eval $compile; then
8527                 d_fds_bits="$undef"
8528                 d_fd_set="$define"
8529                 echo "Well, your system has some sort of fd_set available..." >&4
8530                 if ./fd_set; then
8531                         echo "and you have the normal fd_set macros." >&4
8532                         d_fd_macros="$define"
8533                 else
8534                         $cat <<'EOM'
8535 but not the normal fd_set macros!  Gross!  More work for me...
8536 EOM
8537                         d_fd_macros="$undef"
8538                 fi
8539         else
8540         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8541                 d_fd_set="$undef"
8542                 d_fds_bits="$undef"
8543                 d_fd_macros="$undef"
8544         fi
8545 fi
8546 $rm -f fd_set*
8547
8548 : see if fgetpos exists
8549 set fgetpos d_fgetpos
8550 eval $inlibc
8551
8552 : see if flock exists
8553 set flock d_flock
8554 eval $inlibc
8555
8556 : see if fork exists
8557 set fork d_fork
8558 eval $inlibc
8559
8560 : see if pathconf exists
8561 set pathconf d_pathconf
8562 eval $inlibc
8563
8564 : see if fpathconf exists
8565 set fpathconf d_fpathconf
8566 eval $inlibc
8567
8568
8569 : see if llseek exists
8570 set llseek d_llseek
8571 eval $inlibc
8572
8573 : check for off64_t
8574 echo " "
8575 echo $n "Checking to see if your system supports off64_t...$c" >&4
8576 $cat >try.c <<EOCP
8577 #include <sys/types.h>
8578 #include <unistd.h>
8579 off64_t foo() { off64_t x; x = 7; return x; }'
8580 EOCP
8581 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8582         val="$define"
8583         echo " Yup, it does." >&4
8584 else
8585         val="$undef"
8586         echo " Nope, it doesn't." >&4
8587 fi
8588 $rm -f try.*
8589 set d_off64_t
8590 eval $setvar
8591
8592 : check for fpos64_t
8593 echo " "
8594 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8595 $cat >try.c <<EOCP
8596 #include <sys/stdio.h>
8597 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8598 EOCP
8599 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8600         val="$define"
8601         echo " Yup, it does." >&4
8602 else
8603         val="$undef"
8604         echo " Nope, it doesn't." >&4
8605 fi
8606 $rm -f try.*
8607 set d_fpos64_t
8608 eval $setvar
8609
8610 : see if fseeko exists
8611 set fseeko d_fseeko
8612 eval $inlibc
8613
8614 : see if fsetpos exists
8615 set fsetpos d_fsetpos
8616 eval $inlibc
8617
8618 : see if this is a sys/param system
8619 set sys/param.h i_sysparam
8620 eval $inhdr
8621
8622 : see if this is a sys/mount.h system
8623 set sys/mount.h i_sysmount
8624 eval $inhdr
8625
8626
8627 : see if statfs exists
8628 set statfs d_statfs
8629 eval $inlibc
8630
8631 : see if fstatfs exists
8632 set fstatfs d_fstatfs
8633 eval $inlibc
8634
8635 : see if statfs knows about mount flags
8636 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8637 eval $hasfield
8638
8639
8640 : see if statvfs exists
8641 set statvfs d_statvfs
8642 eval $inlibc
8643
8644 : see if fstatvfs exists
8645 set fstatvfs d_fstatvfs
8646 eval $inlibc
8647
8648
8649 : see if ftello exists
8650 set ftello d_ftello
8651 eval $inlibc
8652
8653 : see if getgrent exists
8654 set getgrent d_getgrent
8655 eval $inlibc
8656
8657 : see if gethostbyaddr exists
8658 set gethostbyaddr d_gethbyaddr
8659 eval $inlibc
8660
8661 : see if gethostbyname exists
8662 set gethostbyname d_gethbyname
8663 eval $inlibc
8664
8665 : see if gethostent exists
8666 set gethostent d_gethent
8667 eval $inlibc
8668
8669 : see how we will look up host name
8670 echo " "
8671 call=''
8672 if set gethostname val -f d_gethname; eval $csym; $val; then
8673         echo 'gethostname() found.' >&4
8674         d_gethname="$define"
8675         call=gethostname
8676 fi
8677 if set uname val -f d_uname; eval $csym; $val; then
8678         if ./xenix; then
8679                 $cat <<'EOM'
8680 uname() was found, but you're running xenix, and older versions of xenix
8681 have a broken uname(). If you don't really know whether your xenix is old
8682 enough to have a broken system call, use the default answer.
8683
8684 EOM
8685                 dflt=y
8686                 case "$d_uname" in
8687                 "$define") dflt=n;;
8688                 esac
8689                 rp='Is your uname() broken?'
8690                 . ./myread
8691                 case "$ans" in
8692                 n*) d_uname="$define"; call=uname;;
8693                 esac
8694         else
8695                 echo 'uname() found.' >&4
8696                 d_uname="$define"
8697                 case "$call" in
8698                 '') call=uname ;;
8699                 esac
8700         fi
8701 fi
8702 case "$d_gethname" in
8703 '') d_gethname="$undef";;
8704 esac
8705 case "$d_uname" in
8706 '') d_uname="$undef";;
8707 esac
8708 case "$d_uname$d_gethname" in
8709 *define*)
8710         dflt=n
8711         cat <<EOM
8712  
8713 Every now and then someone has a $call() that lies about the hostname
8714 but can't be fixed for political or economic reasons.  If you wish, I can
8715 pretend $call() isn't there and maybe compute hostname at run-time
8716 thanks to the '$phostname' command.
8717
8718 EOM
8719         rp="Shall I ignore $call() from now on?"
8720         . ./myread
8721         case "$ans" in
8722         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8723         esac;;
8724 esac
8725 case "$phostname" in
8726 '') aphostname='';;
8727 *) case "$aphostname" in
8728         /*) ;;
8729         *) set X $phostname
8730                 shift
8731                 file=$1
8732                 shift
8733                 file=`./loc $file $file $pth`
8734                 aphostname=`echo $file $*`
8735                 ;;
8736         esac
8737         ;;
8738 esac
8739 case "$d_uname$d_gethname" in
8740 *define*) ;;
8741 *)
8742         case "$phostname" in
8743         '')
8744                 echo "There will be no way for $package to get your hostname." >&4;;
8745         *)
8746         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8747                 ;;
8748         esac;;
8749 esac
8750 case "$d_phostname" in
8751 '') d_phostname="$undef";;
8752 esac
8753
8754 : see if this is a netdb.h system
8755 set netdb.h i_netdb
8756 eval $inhdr
8757
8758 : see if prototypes for various gethostxxx netdb.h functions are available
8759 echo " "
8760 set d_gethostprotos gethostent $i_netdb netdb.h
8761 eval $hasproto
8762
8763 : see if getlogin exists
8764 set getlogin d_getlogin
8765 eval $inlibc
8766
8767 : see if getmntent exists
8768 set getmntent d_getmntent
8769 eval $inlibc
8770
8771 : see if getnetbyaddr exists
8772 set getnetbyaddr d_getnbyaddr
8773 eval $inlibc
8774
8775 : see if getnetbyname exists
8776 set getnetbyname d_getnbyname
8777 eval $inlibc
8778
8779 : see if getnetent exists
8780 set getnetent d_getnent
8781 eval $inlibc
8782
8783 : see if prototypes for various getnetxxx netdb.h functions are available
8784 echo " "
8785 set d_getnetprotos getnetent $i_netdb netdb.h
8786 eval $hasproto
8787
8788
8789 : see if getprotobyname exists
8790 set getprotobyname d_getpbyname
8791 eval $inlibc
8792
8793 : see if getprotobynumber exists
8794 set getprotobynumber d_getpbynumber
8795 eval $inlibc
8796
8797 : see if getprotoent exists
8798 set getprotoent d_getpent
8799 eval $inlibc
8800
8801 : see if getpgid exists
8802 set getpgid d_getpgid
8803 eval $inlibc
8804
8805 : see if getpgrp2 exists
8806 set getpgrp2 d_getpgrp2
8807 eval $inlibc
8808
8809 : see if getppid exists
8810 set getppid d_getppid
8811 eval $inlibc
8812
8813 : see if getpriority exists
8814 set getpriority d_getprior
8815 eval $inlibc
8816
8817 : see if prototypes for various getprotoxxx netdb.h functions are available
8818 echo " "
8819 set d_getprotoprotos getprotoent $i_netdb netdb.h
8820 eval $hasproto
8821
8822 : see if getpwent exists
8823 set getpwent d_getpwent
8824 eval $inlibc
8825
8826
8827 : see if getservbyname exists
8828 set getservbyname d_getsbyname
8829 eval $inlibc
8830
8831 : see if getservbyport exists
8832 set getservbyport d_getsbyport
8833 eval $inlibc
8834
8835 : see if getservent exists
8836 set getservent d_getsent
8837 eval $inlibc
8838
8839 : see if prototypes for various getservxxx netdb.h functions are available
8840 echo " "
8841 set d_getservprotos getservent $i_netdb netdb.h
8842 eval $hasproto
8843
8844 : see if getspent exists
8845 set getspent d_getspent
8846 eval $inlibc
8847
8848 : see if getspnam exists
8849 set getspnam d_getspnam
8850 eval $inlibc
8851
8852 : see if gettimeofday or ftime exists
8853 set gettimeofday d_gettimeod
8854 eval $inlibc
8855 case "$d_gettimeod" in
8856 "$undef")
8857         set ftime d_ftime 
8858         eval $inlibc
8859         ;;
8860 *)
8861         val="$undef"; set d_ftime; eval $setvar
8862         ;;
8863 esac
8864 case "$d_gettimeod$d_ftime" in
8865 "$undef$undef")
8866         echo " "
8867         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8868         ;;
8869 esac
8870
8871 : see if this is an grp system
8872 set grp.h i_grp
8873 eval $inhdr
8874
8875 case "$i_grp" in
8876 $define)
8877         xxx=`./findhdr grp.h`
8878         $cppstdin $cppflags $cppminus < $xxx >$$.h
8879
8880         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8881                 val="$define"
8882         else
8883                 val="$undef"
8884         fi
8885         set d_grpasswd
8886         eval $setvar
8887
8888         $rm -f $$.h
8889         ;;
8890 *)
8891         val="$undef";
8892         set d_grpasswd; eval $setvar
8893         ;;
8894 esac
8895
8896 : see if hasmntopt exists
8897 set hasmntopt d_hasmntopt
8898 eval $inlibc
8899
8900 : see if this is a netinet/in.h or sys/in.h system
8901 set netinet/in.h i_niin sys/in.h i_sysin
8902 eval $inhdr
8903
8904 : see if arpa/inet.h has to be included
8905 set arpa/inet.h i_arpainet
8906 eval $inhdr
8907
8908 : see if htonl --and friends-- exists
8909 val=''
8910 set htonl val
8911 eval $inlibc
8912
8913 : Maybe they are macros.
8914 case "$val" in
8915 $undef)
8916         $cat >htonl.c <<EOM
8917 #include <stdio.h>
8918 #include <sys/types.h>
8919 #$i_niin I_NETINET_IN
8920 #$i_sysin I_SYS_IN
8921 #$i_arpainet I_ARPA_INET
8922 #ifdef I_NETINET_IN
8923 #include <netinet/in.h>
8924 #endif
8925 #ifdef I_SYS_IN
8926 #include <sys/in.h>
8927 #endif
8928 #ifdef I_ARPA_INET
8929 #include <arpa/inet.h>
8930 #endif
8931 #ifdef htonl
8932 printf("Defined as a macro.");
8933 #endif
8934 EOM
8935         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8936         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8937                 val="$define"
8938                 echo "But it seems to be defined as a macro." >&4
8939         fi
8940         $rm -f htonl.?
8941         ;;
8942 esac
8943 set d_htonl
8944 eval $setvar
8945
8946 : see which of string.h or strings.h is needed
8947 echo " "
8948 strings=`./findhdr string.h`
8949 if $test "$strings" && $test -r "$strings"; then
8950         echo "Using <string.h> instead of <strings.h>." >&4
8951         val="$define"
8952 else
8953         val="$undef"
8954         strings=`./findhdr strings.h`
8955         if $test "$strings" && $test -r "$strings"; then
8956                 echo "Using <strings.h> instead of <string.h>." >&4
8957         else
8958                 echo "No string header found -- You'll surely have problems." >&4
8959         fi
8960 fi
8961 set i_string
8962 eval $setvar
8963 case "$i_string" in
8964 "$undef") strings=`./findhdr strings.h`;;
8965 *)        strings=`./findhdr string.h`;;
8966 esac
8967
8968 : index or strchr
8969 echo " "
8970 if set index val -f; eval $csym; $val; then
8971         if set strchr val -f d_strchr; eval $csym; $val; then
8972                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8973                         val="$define"
8974                         vali="$undef"
8975                         echo "strchr() found." >&4
8976                 else
8977                         val="$undef"
8978                         vali="$define"
8979                         echo "index() found." >&4
8980                 fi
8981         else
8982                 val="$undef"
8983                 vali="$define"
8984                 echo "index() found." >&4
8985         fi
8986 else
8987         if set strchr val -f d_strchr; eval $csym; $val; then
8988                 val="$define"
8989                 vali="$undef"
8990                 echo "strchr() found." >&4
8991         else
8992                 echo "No index() or strchr() found!" >&4
8993                 val="$undef"
8994                 vali="$undef"
8995         fi
8996 fi
8997 set d_strchr; eval $setvar
8998 val="$vali"
8999 set d_index; eval $setvar
9000
9001 : check whether inet_aton exists
9002 set inet_aton d_inetaton
9003 eval $inlibc
9004
9005 : Look for isascii
9006 echo " "
9007 $cat >isascii.c <<'EOCP'
9008 #include <stdio.h>
9009 #include <ctype.h>
9010 int main() {
9011         int c = 'A';
9012         if (isascii(c))
9013                 exit(0);
9014         else
9015                 exit(1);
9016 }
9017 EOCP
9018 set isascii
9019 if eval $compile; then
9020         echo "isascii() found." >&4
9021         val="$define"
9022 else
9023         echo "isascii() NOT found." >&4
9024         val="$undef"
9025 fi
9026 set d_isascii
9027 eval $setvar
9028 $rm -f isascii*
9029
9030 : see if killpg exists
9031 set killpg d_killpg
9032 eval $inlibc
9033
9034 : see if lchown exists
9035 echo " "
9036 $cat > try.c <<'EOCP'
9037 /* System header to define __stub macros and hopefully few prototypes,
9038     which can conflict with char lchown(); below.  */
9039 #include <assert.h>
9040 /* Override any gcc2 internal prototype to avoid an error.  */
9041 /* We use char because int might match the return type of a gcc2
9042    builtin and then its argument prototype would still apply.  */
9043 char lchown();
9044 int main() {
9045     /*  The GNU C library defines this for functions which it implements
9046         to always fail with ENOSYS.  Some functions are actually named
9047         something starting with __ and the normal name is an alias.  */
9048 #if defined (__stub_lchown) || defined (__stub___lchown)
9049 choke me
9050 #else
9051 lchown();
9052 #endif
9053 ; return 0; }
9054 EOCP
9055 set try
9056 if eval $compile; then
9057     $echo "lchown() found." >&4
9058     val="$define"
9059 else
9060     $echo "lchown() NOT found." >&4
9061     val="$undef"
9062 fi
9063 set d_lchown
9064 eval $setvar
9065
9066 : See if number of significant digits in a double precision number is known
9067 echo " "
9068 $cat >ldbl_dig.c <<EOM
9069 #$i_limits I_LIMITS
9070 #$i_float I_FLOAT
9071 #ifdef I_LIMITS
9072 #include <limits.h>
9073 #endif
9074 #ifdef I_FLOAT
9075 #include <float.h>
9076 #endif
9077 #ifdef LDBL_DIG
9078 printf("Contains LDBL_DIG");
9079 #endif
9080 EOM
9081 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9082 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9083         echo "LDBL_DIG found." >&4
9084         val="$define"
9085 else
9086         echo "LDBL_DIG NOT found." >&4
9087         val="$undef"
9088 fi
9089 $rm -f ldbl_dig.?
9090 set d_ldbl_dig
9091 eval $setvar
9092
9093 : see if link exists
9094 set link d_link
9095 eval $inlibc
9096
9097 : see if localeconv exists
9098 set localeconv d_locconv
9099 eval $inlibc
9100
9101 : see if lockf exists
9102 set lockf d_lockf
9103 eval $inlibc
9104
9105 : see if lstat exists
9106 set lstat d_lstat
9107 eval $inlibc
9108
9109 : see if madvise exists
9110 set madvise d_madvise
9111 eval $inlibc
9112
9113 : see if mblen exists
9114 set mblen d_mblen
9115 eval $inlibc
9116
9117 : see if mbstowcs exists
9118 set mbstowcs d_mbstowcs
9119 eval $inlibc
9120
9121 : see if mbtowc exists
9122 set mbtowc d_mbtowc
9123 eval $inlibc
9124
9125 : see if memchr exists
9126 set memchr d_memchr
9127 eval $inlibc
9128
9129 : see if memcmp exists
9130 set memcmp d_memcmp
9131 eval $inlibc
9132
9133 : see if memcpy exists
9134 set memcpy d_memcpy
9135 eval $inlibc
9136
9137 : see if memmove exists
9138 set memmove d_memmove
9139 eval $inlibc
9140
9141 : see if memset exists
9142 set memset d_memset
9143 eval $inlibc
9144
9145 : see if mkdir exists
9146 set mkdir d_mkdir
9147 eval $inlibc
9148
9149 : see if mkfifo exists
9150 set mkfifo d_mkfifo
9151 eval $inlibc
9152
9153 : see if mktime exists
9154 set mktime d_mktime
9155 eval $inlibc
9156
9157 : see if this is a sys/mman.h system
9158 set sys/mman.h i_sysmman
9159 eval $inhdr
9160
9161 : see if mmap exists
9162 set mmap d_mmap
9163 eval $inlibc
9164 : see what shmat returns
9165 : default to something harmless
9166 mmaptype='void *'
9167 case "$i_sysmman$d_mmap" in
9168 "$define$define")
9169         $cat >mmap.c <<'END'
9170 #include <sys/mman.h>
9171 void *mmap();
9172 END
9173         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9174                 mmaptype='void *'
9175         else
9176                 mmaptype='caddr_t'
9177         fi
9178         echo "and it returns ($mmaptype)." >&4
9179         ;;
9180 esac
9181
9182
9183
9184 : see if mprotect exists
9185 set mprotect d_mprotect
9186 eval $inlibc
9187
9188 : see if msgctl exists
9189 set msgctl d_msgctl
9190 eval $inlibc
9191
9192 : see if msgget exists
9193 set msgget d_msgget
9194 eval $inlibc
9195
9196 : see if msgsnd exists
9197 set msgsnd d_msgsnd
9198 eval $inlibc
9199
9200 : see if msgrcv exists
9201 set msgrcv d_msgrcv
9202 eval $inlibc
9203
9204 : see how much of the 'msg*(2)' library is present.
9205 h_msg=true
9206 echo " "
9207 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9208 *"$undef"*) h_msg=false;;
9209 esac
9210 case "$osname" in
9211 freebsd)
9212     case "`ipcs 2>&1`" in
9213     "SVID messages"*"not configured"*)
9214         echo "Your $osname does not have the msg*(2) configured." >&4
9215         h_msg=false
9216         val="$undef"
9217         set msgctl d_msgctl
9218         eval $setvar
9219         set msgget d_msgget
9220         eval $setvar
9221         set msgsnd d_msgsnd
9222         eval $setvar
9223         set msgrcv d_msgrcv
9224         eval $setvar
9225         ;;
9226     esac
9227     ;;
9228 esac
9229 : we could also check for sys/ipc.h ...
9230 if $h_msg && $test `./findhdr sys/msg.h`; then
9231         echo "You have the full msg*(2) library." >&4
9232         val="$define"
9233 else
9234         echo "You don't have the full msg*(2) library." >&4
9235         val="$undef"
9236 fi
9237 set d_msg
9238 eval $setvar
9239
9240 : see if msync exists
9241 set msync d_msync
9242 eval $inlibc
9243
9244 : see if munmap exists
9245 set munmap d_munmap
9246 eval $inlibc
9247
9248 : see if nice exists
9249 set nice d_nice
9250 eval $inlibc
9251
9252 : see if POSIX threads are available
9253 set pthread.h i_pthread
9254 eval $inhdr
9255
9256
9257
9258
9259 : how to create joinable pthreads
9260 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9261         echo " "
9262         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9263         $cat >try.c <<'EOCP'
9264 #include <pthread.h>
9265 int main() {
9266     int detachstate = JOINABLE;
9267 }
9268 EOCP
9269         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9270         if eval $compile; then
9271                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9272                 val="$undef" # Yes, undef.
9273                 set d_old_pthread_create_joinable
9274                 eval $setvar
9275                 val=""
9276                 set old_pthread_create_joinable
9277                 eval $setvar
9278         else
9279                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9280                 if eval $compile; then
9281                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9282                         val="$define"
9283                         set d_old_pthread_create_joinable
9284                         eval $setvar
9285                         val=PTHREAD_CREATE_UNDETACHED
9286                         set old_pthread_create_joinable
9287                         eval $setvar
9288                 else            
9289                         set try -DJOINABLE=__UNDETACHED
9290                         if eval $compile; then
9291                                 echo "You seem to use __UNDETACHED." >&4
9292                                 val="$define"
9293                                 set d_old_pthread_create_joinable
9294                                 eval $setvar
9295                                 val=__UNDETACHED
9296                                 set old_pthread_create_joinable
9297                                 eval $setvar
9298                         else
9299                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9300                                 val="$define"
9301                                 set d_old_pthread_create_joinable
9302                                 eval $setvar
9303                                 val=0
9304                                 set old_pthread_create_joinable
9305                                 eval $setvar
9306                         fi
9307                 fi
9308         fi
9309         $rm -f try try.*
9310 else
9311     d_old_pthread_create_joinable="$undef"
9312     old_pthread_create_joinable=""
9313 fi
9314
9315 : see if pause exists
9316 set pause d_pause
9317 eval $inlibc
9318
9319 : see if pipe exists
9320 set pipe d_pipe
9321 eval $inlibc
9322
9323 : see if poll exists
9324 set poll d_poll
9325 eval $inlibc
9326
9327
9328 : see whether the various POSIXish _yields exist
9329 $cat >try.c <<EOP
9330 #include <pthread.h>
9331 #include <stdio.h>
9332 int main() {
9333 #ifdef SCHED_YIELD
9334         sched_yield();
9335 #else
9336 #ifdef PTHREAD_YIELD
9337         pthread_yield();
9338 #else
9339 #ifdef PTHREAD_YIELD_NULL
9340         pthread_yield(NULL);
9341 #endif
9342 #endif
9343 #endif
9344 }
9345 EOP
9346 : see if sched_yield exists
9347 set try -DSCHED_YIELD
9348 if eval $compile; then
9349     val="$define"
9350     sched_yield='sched_yield()'
9351 else
9352     val="$undef"
9353 fi
9354 case "$usethreads" in
9355 $define)
9356         case "$val" in
9357         $define) echo 'sched_yield() found.' >&4        ;;
9358         *)       echo 'sched_yield() NOT found.' >&4    ;;
9359         esac
9360 esac
9361 set d_sched_yield
9362 eval $setvar
9363
9364 : see if pthread_yield exists
9365 set try -DPTHREAD_YIELD
9366 if eval $compile; then
9367     val="$define"
9368     case "$sched_yield" in
9369     '') sched_yield='pthread_yield()' ;;
9370     esac
9371 else
9372     set try -DPTHREAD_YIELD_NULL
9373     if eval $compile; then
9374         val="$define"
9375         case "$sched_yield" in
9376         '') sched_yield='pthread_yield(NULL)' ;;
9377         esac
9378     else
9379         val="$undef"
9380     fi
9381 fi
9382 case "$usethreads" in
9383 $define)
9384         case "$val" in
9385         $define) echo 'pthread_yield() found.' >&4      ;;
9386         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9387         esac
9388         ;;
9389 esac
9390 set d_pthread_yield
9391 eval $setvar
9392
9393 case "$sched_yield" in
9394 '') sched_yield=undef ;;
9395 esac
9396
9397 $rm -f try try.*
9398
9399 : see if this is a pwd.h system
9400 set pwd.h i_pwd
9401 eval $inhdr
9402
9403 case "$i_pwd" in
9404 $define)
9405         xxx=`./findhdr pwd.h`
9406         $cppstdin $cppflags $cppminus < $xxx >$$.h
9407
9408         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9409                 val="$define"
9410         else
9411                 val="$undef"
9412         fi
9413         set d_pwquota
9414         eval $setvar
9415
9416         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9417                 val="$define"
9418         else
9419                 val="$undef"
9420         fi
9421         set d_pwage
9422         eval $setvar
9423
9424         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9425                 val="$define"
9426         else
9427                 val="$undef"
9428         fi
9429         set d_pwchange
9430         eval $setvar
9431
9432         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9433                 val="$define"
9434         else
9435                 val="$undef"
9436         fi
9437         set d_pwclass
9438         eval $setvar
9439
9440         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9441                 val="$define"
9442         else
9443                 val="$undef"
9444         fi
9445         set d_pwexpire
9446         eval $setvar
9447
9448         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9449                 val="$define"
9450         else
9451                 val="$undef"
9452         fi
9453         set d_pwcomment
9454         eval $setvar
9455
9456         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9457                 val="$define"
9458         else
9459                 val="$undef"
9460         fi
9461         set d_pwgecos
9462         eval $setvar
9463
9464         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9465                 val="$define"
9466         else
9467                 val="$undef"
9468         fi
9469         set d_pwpasswd
9470         eval $setvar
9471
9472         $rm -f $$.h
9473         ;;
9474 *)
9475         val="$undef"; 
9476         set d_pwquota; eval $setvar
9477         set d_pwage; eval $setvar
9478         set d_pwchange; eval $setvar
9479         set d_pwclass; eval $setvar
9480         set d_pwexpire; eval $setvar
9481         set d_pwcomment; eval $setvar
9482         set d_pwgecos; eval $setvar
9483         set d_pwpasswd; eval $setvar
9484         ;;
9485 esac
9486
9487 : see if readdir and friends exist
9488 set readdir d_readdir
9489 eval $inlibc
9490 set seekdir d_seekdir
9491 eval $inlibc
9492 set telldir d_telldir
9493 eval $inlibc
9494 set rewinddir d_rewinddir
9495 eval $inlibc
9496
9497 : see if readlink exists
9498 set readlink d_readlink
9499 eval $inlibc
9500
9501 : see if readv exists
9502 set readv d_readv
9503 eval $inlibc
9504
9505 : see if rename exists
9506 set rename d_rename
9507 eval $inlibc
9508
9509 : see if rmdir exists
9510 set rmdir d_rmdir
9511 eval $inlibc
9512
9513 : see if memory.h is available.
9514 val=''
9515 set memory.h val
9516 eval $inhdr
9517
9518 : See if it conflicts with string.h
9519 case "$val" in
9520 $define)
9521         case "$strings" in
9522         '') ;;
9523         *)
9524                 $cppstdin $cppflags $cppminus < $strings > mem.h
9525                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9526                         echo " "
9527                         echo "We won't be including <memory.h>."
9528                         val="$undef"
9529                 fi
9530                 $rm -f mem.h
9531                 ;;
9532         esac
9533 esac
9534 set i_memory
9535 eval $setvar
9536
9537 : can bcopy handle overlapping blocks?
9538 val="$undef"
9539 case "$d_bcopy" in
9540 "$define")
9541         echo " "
9542         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9543         $cat >try.c <<EOCP
9544 #$i_memory I_MEMORY
9545 #$i_stdlib I_STDLIB
9546 #$i_string I_STRING
9547 #$i_unistd I_UNISTD
9548 EOCP
9549         $cat >>try.c <<'EOCP'
9550 #include <stdio.h>
9551 #ifdef I_MEMORY
9552 #  include <memory.h>
9553 #endif
9554 #ifdef I_STDLIB
9555 #  include <stdlib.h>
9556 #endif
9557 #ifdef I_STRING
9558 #  include <string.h>
9559 #else
9560 #  include <strings.h>
9561 #endif
9562 #ifdef I_UNISTD
9563 #  include <unistd.h>  /* Needed for NetBSD */
9564 #endif
9565 int main()
9566 {
9567 char buf[128], abc[128];
9568 char *b;
9569 int len;
9570 int off;
9571 int align;
9572
9573 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9574
9575 for (align = 7; align >= 0; align--) {
9576         for (len = 36; len; len--) {
9577                 b = buf+align;
9578                 bcopy(abc, b, len);
9579                 for (off = 1; off <= len; off++) {
9580                         bcopy(b, b+off, len);
9581                         bcopy(b+off, b, len);
9582                         if (bcmp(b, abc, len))
9583                                 exit(1);
9584                 }
9585         }
9586 }
9587 exit(0);
9588 }
9589 EOCP
9590         set try
9591         if eval $compile_ok; then
9592                 if ./try 2>/dev/null; then
9593                         echo "Yes, it can."
9594                         val="$define"
9595                 else
9596                         echo "It can't, sorry."
9597                         case "$d_memmove" in
9598                         "$define") echo "But that's Ok since you have memmove()." ;;
9599                         esac
9600                 fi
9601         else
9602                 echo "(I can't compile the test program, so we'll assume not...)"
9603                 case "$d_memmove" in
9604                 "$define") echo "But that's Ok since you have memmove()." ;;
9605                 esac
9606         fi
9607         ;;
9608 esac
9609 $rm -f try.* try core
9610 set d_safebcpy
9611 eval $setvar
9612
9613 : can memcpy handle overlapping blocks?
9614 val="$undef"
9615 case "$d_memcpy" in
9616 "$define")
9617         echo " "
9618         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9619         $cat >try.c <<EOCP
9620 #$i_memory I_MEMORY
9621 #$i_stdlib I_STDLIB
9622 #$i_string I_STRING
9623 #$i_unistd I_UNISTD
9624 EOCP
9625         $cat >>try.c <<'EOCP'
9626 #include <stdio.h>
9627 #ifdef I_MEMORY
9628 #  include <memory.h>
9629 #endif
9630 #ifdef I_STDLIB
9631 #  include <stdlib.h>
9632 #endif
9633 #ifdef I_STRING
9634 #  include <string.h>
9635 #else
9636 #  include <strings.h>
9637 #endif
9638 #ifdef I_UNISTD
9639 #  include <unistd.h>  /* Needed for NetBSD */
9640 #endif
9641 int main()
9642 {
9643 char buf[128], abc[128];
9644 char *b;
9645 int len;
9646 int off;
9647 int align;
9648
9649 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9650    try to store the string in read-only memory. */
9651 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9652
9653 for (align = 7; align >= 0; align--) {
9654         for (len = 36; len; len--) {
9655                 b = buf+align;
9656                 memcpy(b, abc, len);
9657                 for (off = 1; off <= len; off++) {
9658                         memcpy(b+off, b, len);
9659                         memcpy(b, b+off, len);
9660                         if (memcmp(b, abc, len))
9661                                 exit(1);
9662                 }
9663         }
9664 }
9665 exit(0);
9666 }
9667 EOCP
9668         set try
9669         if eval $compile_ok; then
9670                 if ./try 2>/dev/null; then
9671                         echo "Yes, it can."
9672                         val="$define"
9673                 else
9674                         echo "It can't, sorry."
9675                         case "$d_memmove" in
9676                         "$define") echo "But that's Ok since you have memmove()." ;;
9677                         esac
9678                 fi
9679         else
9680                 echo "(I can't compile the test program, so we'll assume not...)"
9681                 case "$d_memmove" in
9682                 "$define") echo "But that's Ok since you have memmove()." ;;
9683                 esac
9684         fi
9685         ;;
9686 esac
9687 $rm -f try.* try core
9688 set d_safemcpy
9689 eval $setvar
9690
9691 : can memcmp be trusted to compare relative magnitude?
9692 val="$undef"
9693 case "$d_memcmp" in
9694 "$define")
9695         echo " "
9696         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9697         $cat >try.c <<EOCP
9698 #$i_memory I_MEMORY
9699 #$i_stdlib I_STDLIB
9700 #$i_string I_STRING
9701 #$i_unistd I_UNISTD
9702 EOCP
9703         $cat >>try.c <<'EOCP'
9704 #include <stdio.h>
9705 #ifdef I_MEMORY
9706 #  include <memory.h>
9707 #endif
9708 #ifdef I_STDLIB
9709 #  include <stdlib.h>
9710 #endif
9711 #ifdef I_STRING
9712 #  include <string.h>
9713 #else
9714 #  include <strings.h>
9715 #endif
9716 #ifdef I_UNISTD
9717 #  include <unistd.h>  /* Needed for NetBSD */
9718 #endif
9719 int main()
9720 {
9721 char a = -1;
9722 char b = 0;
9723 if ((a < b) && memcmp(&a, &b, 1) < 0)
9724         exit(1);
9725 exit(0);
9726 }
9727 EOCP
9728         set try
9729         if eval $compile_ok; then
9730                 if ./try 2>/dev/null; then
9731                         echo "Yes, it can."
9732                         val="$define"
9733                 else
9734                         echo "No, it can't (it uses signed chars)."
9735                 fi
9736         else
9737                 echo "(I can't compile the test program, so we'll assume not...)"
9738         fi
9739         ;;
9740 esac
9741 $rm -f try.* try core
9742 set d_sanemcmp
9743 eval $setvar
9744
9745 : see if select exists
9746 set select d_select
9747 eval $inlibc
9748
9749 : see if semctl exists
9750 set semctl d_semctl
9751 eval $inlibc
9752
9753 : see if semget exists
9754 set semget d_semget
9755 eval $inlibc
9756
9757 : see if semop exists
9758 set semop d_semop
9759 eval $inlibc
9760
9761 : see how much of the 'sem*(2)' library is present.
9762 h_sem=true
9763 echo " "
9764 case "$d_semctl$d_semget$d_semop" in
9765 *"$undef"*) h_sem=false;;
9766 esac
9767 case "$osname" in
9768 freebsd)
9769     case "`ipcs 2>&1`" in
9770     "SVID messages"*"not configured"*)
9771         echo "Your $osname does not have the sem*(2) configured." >&4
9772         h_sem=false
9773         val="$undef"
9774         set semctl d_semctl
9775         eval $setvar
9776         set semget d_semget
9777         eval $setvar
9778         set semop d_semop
9779         eval $setvar
9780         ;;
9781     esac
9782     ;;
9783 esac
9784 : we could also check for sys/ipc.h ...
9785 if $h_sem && $test `./findhdr sys/sem.h`; then
9786         echo "You have the full sem*(2) library." >&4
9787         val="$define"
9788 else
9789         echo "You don't have the full sem*(2) library." >&4
9790         val="$undef"
9791 fi
9792 set d_sem
9793 eval $setvar
9794
9795 : see whether sys/sem.h defines union semun
9796 echo " "
9797 $cat > try.c <<'END'
9798 #include <sys/types.h>
9799 #include <sys/ipc.h>
9800 #include <sys/sem.h>
9801 int main () { union semun semun; semun.buf = 0; }
9802 END
9803 set try
9804 if eval $compile; then
9805     echo "You have union semun in <sys/sem.h>." >&4
9806     val="$define"
9807 else
9808     echo "You do not have union semun in <sys/sem.h>." >&4
9809     val="$undef"
9810 fi
9811 $rm -f try try.c try.h
9812 set d_union_semun
9813 eval $setvar
9814
9815 : see how to do semctl IPC_STAT
9816 case "$d_sem" in
9817 $define)
9818     : see whether semctl IPC_STAT can use union semun
9819     echo " "
9820     $cat > try.h <<END
9821 #ifndef S_IRUSR
9822 #   ifdef S_IREAD
9823 #       define S_IRUSR S_IREAD
9824 #       define S_IWUSR S_IWRITE
9825 #       define S_IXUSR S_IEXEC
9826 #   else
9827 #       define S_IRUSR 0400
9828 #       define S_IWUSR 0200
9829 #       define S_IXUSR 0100
9830 #   endif
9831 #   define S_IRGRP (S_IRUSR>>3)
9832 #   define S_IWGRP (S_IWUSR>>3)
9833 #   define S_IXGRP (S_IXUSR>>3)
9834 #   define S_IROTH (S_IRUSR>>6)
9835 #   define S_IWOTH (S_IWUSR>>6)
9836 #   define S_IXOTH (S_IXUSR>>6)
9837 #endif
9838 #ifndef S_IRWXU
9839 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9840 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9841 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9842 #endif
9843 END
9844
9845     $cat > try.c <<END
9846 #include <sys/types.h>
9847 #include <sys/ipc.h>
9848 #include <sys/sem.h>
9849 #include <sys/stat.h>
9850 #include <stdio.h>
9851 #include <errno.h>
9852 #include "try.h"
9853 #ifndef errno
9854 extern int errno;
9855 #endif
9856 #$d_union_semun HAS_UNION_SEMUN
9857 int main() {
9858     union semun
9859 #ifndef HAS_UNION_SEMUN
9860     {
9861         int val;
9862         struct semid_ds *buf;
9863         unsigned short *array;
9864     }
9865 #endif
9866     arg;
9867     int sem, st;
9868
9869 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9870     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9871     if (sem > -1) {
9872         struct semid_ds argbuf;
9873         arg.buf = &argbuf;
9874 #       ifdef IPC_STAT
9875         st = semctl(sem, 0, IPC_STAT, arg);
9876         if (st == 0)
9877             printf("semun\n");
9878         else
9879 #       endif /* IPC_STAT */
9880             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9881 #       ifdef IPC_RMID
9882         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9883 #       endif /* IPC_RMID */
9884             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9885     } else
9886 #endif /* IPC_PRIVATE && ... */
9887         printf("semget failed: errno = %d\n", errno);
9888   return 0;
9889 }
9890 END
9891     val="$undef"
9892     set try
9893     if eval $compile; then
9894         xxx=`./try`
9895         case "$xxx" in
9896         semun) val="$define" ;;
9897         esac
9898     fi
9899     $rm -f try try.c
9900     set d_semctl_semun
9901     eval $setvar
9902     case "$d_semctl_semun" in
9903     $define)
9904         echo "You can use union semun for semctl IPC_STAT." >&4
9905         also='also'
9906         ;;
9907     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9908         also=''
9909         ;;
9910     esac
9911
9912     : see whether semctl IPC_STAT can use struct semid_ds pointer
9913     $cat > try.c <<'END'
9914 #include <sys/types.h>
9915 #include <sys/ipc.h>
9916 #include <sys/sem.h>
9917 #include <sys/stat.h>
9918 #include "try.h"
9919 #include <stdio.h>
9920 #include <errno.h>
9921 #ifndef errno
9922 extern int errno;
9923 #endif
9924 int main() {
9925     struct semid_ds arg;
9926     int sem, st;
9927
9928 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9929     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9930     if (sem > -1) {
9931 #       ifdef IPC_STAT
9932         st = semctl(sem, 0, IPC_STAT, &arg);
9933         if (st == 0)
9934             printf("semid_ds\n");
9935         else
9936 #       endif /* IPC_STAT */
9937             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9938 #       ifdef IPC_RMID
9939         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9940 #       endif /* IPC_RMID */
9941             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9942     } else
9943 #endif /* IPC_PRIVATE && ... */
9944         printf("semget failed: errno = %d\n", errno);
9945
9946     return 0;
9947 }
9948 END
9949     val="$undef"
9950     set try
9951     if eval $compile; then
9952         xxx=`./try`
9953         case "$xxx" in
9954         semid_ds) val="$define" ;;
9955         esac
9956     fi
9957     $rm -f try try.c
9958     set d_semctl_semid_ds
9959     eval $setvar
9960     case "$d_semctl_semid_ds" in
9961     $define)
9962         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9963         ;;
9964     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9965         ;;
9966     esac
9967     $rm -f try.h
9968     ;;
9969 *)  val="$undef"
9970
9971     # We do not have the full sem*(2) library, so assume we can not
9972     # use either.
9973
9974     set d_semctl_semun
9975     eval $setvar
9976
9977     set d_semctl_semid_ds
9978     eval $setvar
9979     ;;
9980 esac
9981
9982 : see if setegid exists
9983 set setegid d_setegid
9984 eval $inlibc
9985
9986 : see if seteuid exists
9987 set seteuid d_seteuid
9988 eval $inlibc
9989
9990 : see if setgrent exists
9991 set setgrent d_setgrent
9992 eval $inlibc
9993
9994 : see if sethostent exists
9995 set sethostent d_sethent
9996 eval $inlibc
9997
9998 : see if setlinebuf exists
9999 set setlinebuf d_setlinebuf
10000 eval $inlibc
10001
10002 : see if setlocale exists
10003 set setlocale d_setlocale
10004 eval $inlibc
10005
10006 : see if setnetent exists
10007 set setnetent d_setnent
10008 eval $inlibc
10009
10010 : see if setprotoent exists
10011 set setprotoent d_setpent
10012 eval $inlibc
10013
10014 : see if setpgid exists
10015 set setpgid d_setpgid
10016 eval $inlibc
10017
10018 : see if setpgrp2 exists
10019 set setpgrp2 d_setpgrp2
10020 eval $inlibc
10021
10022 : see if setpriority exists
10023 set setpriority d_setprior
10024 eval $inlibc
10025
10026 : see if setpwent exists
10027 set setpwent d_setpwent
10028 eval $inlibc
10029
10030 : see if setregid exists
10031 set setregid d_setregid
10032 eval $inlibc
10033 set setresgid d_setresgid
10034 eval $inlibc
10035
10036 : see if setreuid exists
10037 set setreuid d_setreuid
10038 eval $inlibc
10039 set setresuid d_setresuid
10040 eval $inlibc
10041
10042 : see if setrgid exists
10043 set setrgid d_setrgid
10044 eval $inlibc
10045
10046 : see if setruid exists
10047 set setruid d_setruid
10048 eval $inlibc
10049
10050 : see if setservent exists
10051 set setservent d_setsent
10052 eval $inlibc
10053
10054 : see if setsid exists
10055 set setsid d_setsid
10056 eval $inlibc
10057
10058 : see if setspent exists
10059 set setspent d_setspent
10060 eval $inlibc
10061
10062 : see if setvbuf exists
10063 set setvbuf d_setvbuf
10064 eval $inlibc
10065
10066 : see if sfio.h is available
10067 set sfio.h i_sfio
10068 eval $inhdr
10069
10070
10071 : see if sfio library is available
10072 case "$i_sfio" in
10073 $define)
10074         val=''
10075         set sfreserve val
10076         eval $inlibc
10077         ;;
10078 *)
10079         val="$undef"
10080         ;;
10081 esac
10082 : Ok, but do we want to use it.
10083 case "$val" in
10084 $define)
10085         case "$usesfio" in
10086         true|$define|[yY]*) dflt='y';;
10087         *) dflt='n';;
10088         esac
10089         echo "$package can use the sfio library, but it is experimental."
10090         rp="You seem to have sfio available, do you want to try using it?"
10091         . ./myread
10092         case "$ans" in
10093         y|Y) ;;
10094         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10095                 val="$undef"
10096                 : Remove sfio from list of libraries to use
10097                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10098                 shift
10099                 libs="$*"
10100                 echo "libs = $libs" >&4
10101                 ;;
10102         esac
10103         ;;
10104 *)      case "$usesfio" in
10105         true|$define|[yY]*)
10106                 echo "Sorry, cannot find sfio on this machine" >&4
10107                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10108                 ;;
10109         esac
10110         ;;
10111 esac
10112 set d_sfio
10113 eval $setvar
10114 case "$d_sfio" in
10115 $define) usesfio='true';;
10116 *) usesfio='false';;
10117 esac
10118
10119 : see if shmctl exists
10120 set shmctl d_shmctl
10121 eval $inlibc
10122
10123 : see if shmget exists
10124 set shmget d_shmget
10125 eval $inlibc
10126
10127 : see if shmat exists
10128 set shmat d_shmat
10129 eval $inlibc
10130 : see what shmat returns
10131 case "$d_shmat" in
10132 "$define")
10133         $cat >shmat.c <<'END'
10134 #include <sys/shm.h>
10135 void *shmat();
10136 END
10137         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10138                 shmattype='void *'
10139         else
10140                 shmattype='char *'
10141         fi
10142         echo "and it returns ($shmattype)." >&4
10143         : see if a prototype for shmat is available
10144         xxx=`./findhdr sys/shm.h`
10145         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10146         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10147                 val="$define"
10148         else
10149                 val="$undef"
10150         fi
10151         $rm -f shmat.[co]
10152         ;;
10153 *)
10154         val="$undef"
10155         ;;
10156 esac
10157 set d_shmatprototype
10158 eval $setvar
10159
10160 : see if shmdt exists
10161 set shmdt d_shmdt
10162 eval $inlibc
10163
10164 : see how much of the 'shm*(2)' library is present.
10165 h_shm=true
10166 echo " "
10167 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10168 *"$undef"*) h_shm=false;;
10169 esac
10170 case "$osname" in
10171 freebsd)
10172     case "`ipcs 2>&1`" in
10173     "SVID shared memory"*"not configured"*)
10174         echo "Your $osname does not have the shm*(2) configured." >&4
10175         h_shm=false
10176         val="$undef"
10177         set shmctl d_shmctl
10178         evat $setvar
10179         set shmget d_shmget
10180         evat $setvar
10181         set shmat d_shmat
10182         evat $setvar
10183         set shmdt d_shmdt
10184         evat $setvar
10185         ;;
10186     esac
10187     ;;
10188 esac
10189 : we could also check for sys/ipc.h ...
10190 if $h_shm && $test `./findhdr sys/shm.h`; then
10191         echo "You have the full shm*(2) library." >&4
10192         val="$define"
10193 else
10194         echo "You don't have the full shm*(2) library." >&4
10195         val="$undef"
10196 fi
10197 set d_shm
10198 eval $setvar
10199
10200 echo " "
10201 : see if we have sigaction
10202 if set sigaction val -f d_sigaction; eval $csym; $val; then
10203         echo 'sigaction() found.' >&4
10204         $cat > try.c <<'EOP'
10205 #include <stdio.h>
10206 #include <sys/types.h>
10207 #include <signal.h>
10208 int main()
10209 {
10210     struct sigaction act, oact;
10211     act.sa_flags = 0;
10212     oact.sa_handler = 0;
10213 }
10214 EOP
10215         set try
10216         if eval $compile_ok; then
10217                 val="$define"
10218         else
10219                 echo "But you don't seem to have a useable struct sigaction." >&4
10220                 val="$undef"
10221         fi
10222 else
10223         echo 'sigaction NOT found.' >&4
10224         val="$undef"
10225 fi
10226 set d_sigaction; eval $setvar
10227 $rm -f try try$_o try.c
10228
10229 : see if sigsetjmp exists
10230 echo " "
10231 case "$d_sigsetjmp" in
10232 '')
10233         $cat >try.c <<'EOP'
10234 #include <setjmp.h>
10235 sigjmp_buf env;
10236 int set = 1;
10237 int main()
10238 {
10239         if (sigsetjmp(env,1))
10240                 exit(set);
10241         set = 0;
10242         siglongjmp(env, 1);
10243         exit(1);
10244 }
10245 EOP
10246         set try
10247         if eval $compile; then
10248                 if ./try >/dev/null 2>&1; then
10249                         echo "POSIX sigsetjmp found." >&4
10250                         val="$define"
10251                 else
10252                         $cat >&4 <<EOM
10253 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10254 I'll ignore them.
10255 EOM
10256                         val="$undef"
10257                 fi
10258         else
10259                 echo "sigsetjmp not found." >&4
10260                 val="$undef"
10261         fi
10262         ;;
10263 *) val="$d_sigsetjmp"
10264         case "$d_sigsetjmp" in
10265         $define) echo "POSIX sigsetjmp found." >&4;;
10266         $undef) echo "sigsetjmp not found." >&4;;
10267         esac
10268         ;;
10269 esac
10270 set d_sigsetjmp
10271 eval $setvar
10272 $rm -f try.c try
10273
10274 : see if sys/stat.h is available
10275 set sys/stat.h i_sysstat
10276 eval $inhdr
10277
10278 : see if stat knows about block sizes
10279 echo " "
10280 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10281 eval $hasfield
10282
10283 : see if _ptr and _cnt from stdio act std
10284 echo " "
10285 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10286         echo "(Looks like you have stdio.h from Linux.)"
10287         case "$stdio_ptr" in
10288         '') stdio_ptr='((fp)->_IO_read_ptr)'
10289                 ptr_lval=$define
10290                 ;;
10291         *)      ptr_lval=$d_stdio_ptr_lval;;
10292         esac
10293         case "$stdio_cnt" in
10294         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10295                 cnt_lval=$undef
10296                 ;;
10297         *)      cnt_lval=$d_stdio_cnt_lval;;
10298         esac
10299         case "$stdio_base" in
10300         '') stdio_base='((fp)->_IO_read_base)';;
10301         esac
10302         case "$stdio_bufsiz" in
10303         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10304         esac
10305 else
10306         case "$stdio_ptr" in
10307         '') stdio_ptr='((fp)->_ptr)'
10308                 ptr_lval=$define
10309                 ;;
10310         *)      ptr_lval=$d_stdio_ptr_lval;;
10311         esac
10312         case "$stdio_cnt" in
10313         '') stdio_cnt='((fp)->_cnt)'
10314                 cnt_lval=$define
10315                 ;;
10316         *)      cnt_lval=$d_stdio_cnt_lval;;
10317         esac
10318         case "$stdio_base" in
10319         '') stdio_base='((fp)->_base)';;
10320         esac
10321         case "$stdio_bufsiz" in
10322         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10323         esac
10324 fi
10325 : test whether _ptr and _cnt really work
10326 echo "Checking how std your stdio is..." >&4
10327 $cat >try.c <<EOP
10328 #include <stdio.h>
10329 #define FILE_ptr(fp)    $stdio_ptr
10330 #define FILE_cnt(fp)    $stdio_cnt
10331 int main() {
10332         FILE *fp = fopen("try.c", "r");
10333         char c = getc(fp);
10334         if (
10335                 18 <= FILE_cnt(fp) &&
10336                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10337         )
10338                 exit(0);
10339         exit(1);
10340 }
10341 EOP
10342 val="$undef"
10343 set try
10344 if eval $compile; then
10345         if ./try; then
10346                 echo "Your stdio acts pretty std."
10347                 val="$define"
10348         else
10349                 echo "Your stdio isn't very std."
10350         fi
10351 else
10352         echo "Your stdio doesn't appear very std."
10353 fi
10354 $rm -f try.c try
10355 set d_stdstdio
10356 eval $setvar
10357
10358 : Can _ptr be used as an lvalue?
10359 case "$d_stdstdio$ptr_lval" in
10360 $define$define) val=$define ;;
10361 *) val=$undef ;;
10362 esac
10363 set d_stdio_ptr_lval
10364 eval $setvar
10365
10366 : Can _cnt be used as an lvalue?
10367 case "$d_stdstdio$cnt_lval" in
10368 $define$define) val=$define ;;
10369 *) val=$undef ;;
10370 esac
10371 set d_stdio_cnt_lval
10372 eval $setvar
10373
10374 : see if _base is also standard
10375 val="$undef"
10376 case "$d_stdstdio" in
10377 $define)
10378         $cat >try.c <<EOP
10379 #include <stdio.h>
10380 #define FILE_base(fp)   $stdio_base
10381 #define FILE_bufsiz(fp) $stdio_bufsiz
10382 int main() {
10383         FILE *fp = fopen("try.c", "r");
10384         char c = getc(fp);
10385         if (
10386                 19 <= FILE_bufsiz(fp) &&
10387                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10388         )
10389                 exit(0);
10390         exit(1);
10391 }
10392 EOP
10393         set try
10394         if eval $compile; then
10395                 if ./try; then
10396                         echo "And its _base field acts std."
10397                         val="$define"
10398                 else
10399                         echo "But its _base field isn't std."
10400                 fi
10401         else
10402                 echo "However, it seems to be lacking the _base field."
10403         fi
10404         $rm -f try.c try
10405         ;;
10406 esac
10407 set d_stdiobase
10408 eval $setvar
10409
10410 $cat >&4 <<EOM
10411 Checking how to access stdio streams by file descriptor number...
10412 EOM
10413 case "$stdio_stream_array" in
10414 '')     $cat >try.c <<EOCP
10415 #include <stdio.h>
10416 int main() {
10417   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10418     printf("yes\n");
10419 }
10420 EOCP
10421         for s in _iob __iob __sF
10422         do
10423                 set try -DSTDIO_STREAM_ARRAY=$s
10424                 if eval $compile; then
10425                         case "`./try$exe_ext`" in
10426                         yes)    stdio_stream_array=$s; break ;;
10427                         esac
10428                 fi
10429         done
10430         $rm -f try.* try$exe_ext
10431 esac
10432 case "$stdio_stream_array" in
10433 '')     $cat >&4 <<EOM
10434 I can't figure out how to access stdio streams by file descriptor number.
10435 EOM
10436         d_stdio_stream_array="$undef"
10437         ;;
10438 *)      $cat >&4 <<EOM
10439 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10440 EOM
10441         d_stdio_stream_array="$define"
10442         ;;
10443 esac
10444
10445 : see if strcoll exists
10446 set strcoll d_strcoll
10447 eval $inlibc
10448
10449 : check for structure copying
10450 echo " "
10451 echo "Checking to see if your C compiler can copy structs..." >&4
10452 $cat >try.c <<'EOCP'
10453 int main()
10454 {
10455         struct blurfl {
10456                 int dyick;
10457         } foo, bar;
10458
10459         foo = bar;
10460 }
10461 EOCP
10462 if $cc -c try.c >/dev/null 2>&1 ; then
10463         val="$define"
10464         echo "Yup, it can."
10465 else
10466         val="$undef"
10467         echo "Nope, it can't."
10468 fi
10469 set d_strctcpy
10470 eval $setvar
10471 $rm -f try.*
10472
10473 : see if strerror and/or sys_errlist[] exist
10474 echo " "
10475 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10476     if set strerror val -f d_strerror; eval $csym; $val; then
10477                 echo 'strerror() found.' >&4
10478                 d_strerror="$define"
10479                 d_strerrm='strerror(e)'
10480                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10481                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10482                         d_syserrlst="$define"
10483                 else
10484                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10485                         d_syserrlst="$undef"
10486                 fi
10487     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10488                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10489                 echo 'strerror() found in string header.' >&4
10490                 d_strerror="$define"
10491                 d_strerrm='strerror(e)'
10492                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10493                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10494                                 d_syserrlst="$define"
10495                 else
10496                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10497                         d_syserrlst="$undef"
10498                 fi
10499     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10500                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10501                 d_strerror="$undef"
10502                 d_syserrlst="$define"
10503                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10504     else
10505                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10506                 d_strerror="$undef"
10507                 d_syserrlst="$undef"
10508                 d_strerrm='"unknown"'
10509     fi
10510 fi
10511
10512 : see if strtod exists
10513 set strtod d_strtod
10514 eval $inlibc
10515
10516 : see if strtol exists
10517 set strtol d_strtol
10518 eval $inlibc
10519
10520 : see if strtoul exists
10521 set strtoul d_strtoul
10522 eval $inlibc
10523
10524 : see if strtoull exists
10525 set strtoull d_strtoull
10526 eval $inlibc
10527
10528 : see if strxfrm exists
10529 set strxfrm d_strxfrm
10530 eval $inlibc
10531
10532 : see if symlink exists
10533 set symlink d_symlink
10534 eval $inlibc
10535
10536 : see if syscall exists
10537 set syscall d_syscall
10538 eval $inlibc
10539
10540 : see if sysconf exists
10541 set sysconf d_sysconf
10542 eval $inlibc
10543
10544 : see if system exists
10545 set system d_system
10546 eval $inlibc
10547
10548 : see if tcgetpgrp exists
10549 set tcgetpgrp d_tcgetpgrp
10550 eval $inlibc
10551
10552 : see if tcsetpgrp exists
10553 set tcsetpgrp d_tcsetpgrp
10554 eval $inlibc
10555
10556 : see if sys/types.h has to be included
10557 set sys/types.h i_systypes
10558 eval $inhdr
10559
10560 : see if prototype for telldir is available
10561 echo " "
10562 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10563 eval $hasproto
10564
10565 : define an is-a-typedef? function
10566 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10567 case "$inclist" in
10568 "") inclist="sys/types.h";;
10569 esac;
10570 eval "varval=\$$var";
10571 case "$varval" in
10572 "")
10573         $rm -f temp.c;
10574         for inc in $inclist; do
10575                 echo "#include <$inc>" >>temp.c;
10576         done;
10577         echo "#ifdef $type" >> temp.c;
10578         echo "printf(\"We have $type\");" >> temp.c;
10579         echo "#endif" >> temp.c;
10580         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10581         if $contains $type temp.E >/dev/null 2>&1; then
10582                 eval "$var=\$type";
10583         else
10584                 eval "$var=\$def";
10585         fi;
10586         $rm -f temp.?;;
10587 *) eval "$var=\$varval";;
10588 esac'
10589
10590 : define an is-a-typedef? function that prompts if the type is not available.
10591 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10592 case "$inclist" in
10593 "") inclist="sys/types.h";;
10594 esac;
10595 eval "varval=\$$var";
10596 case "$varval" in
10597 "")
10598         $rm -f temp.c;
10599         for inc in $inclist; do
10600                 echo "#include <$inc>" >>temp.c;
10601         done;
10602         echo "#ifdef $type" >> temp.c;
10603         echo "printf(\"We have $type\");" >> temp.c;
10604         echo "#endif" >> temp.c;
10605         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10606         echo " " ;
10607         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10608         if $contains $type temp.E >/dev/null 2>&1; then
10609                 echo "$type found." >&4;
10610                 eval "$var=\$type";
10611         else
10612                 echo "$type NOT found." >&4;
10613                 dflt="$def";
10614                 . ./myread ;
10615                 eval "$var=\$ans";
10616         fi;
10617         $rm -f temp.?;;
10618 *) eval "$var=\$varval";;
10619 esac'
10620
10621 : see if this is a sys/times.h system
10622 set sys/times.h i_systimes
10623 eval $inhdr
10624
10625 : see if times exists
10626 echo " "
10627 if set times val -f d_times; eval $csym; $val; then
10628         echo 'times() found.' >&4
10629         d_times="$define"
10630         inc=''
10631         case "$i_systimes" in
10632         "$define") inc='sys/times.h';;
10633         esac
10634         rp="What is the type returned by times() on this system?"
10635         set clock_t clocktype long stdio.h sys/types.h $inc
10636         eval $typedef_ask
10637 else
10638         echo 'times() NOT found, hope that will do.' >&4
10639         d_times="$undef"
10640         clocktype='int'
10641 fi
10642
10643 : see if truncate exists
10644 set truncate d_truncate
10645 eval $inlibc
10646
10647 : see if tzname[] exists
10648 echo " "
10649 if set tzname val -a d_tzname; eval $csym; $val; then
10650         val="$define"
10651         echo 'tzname[] found.' >&4
10652 else
10653         val="$undef"
10654         echo 'tzname[] NOT found.' >&4
10655 fi
10656 set d_tzname
10657 eval $setvar
10658
10659 : see if umask exists
10660 set umask d_umask
10661 eval $inlibc
10662
10663 : backward compatibility for d_hvfork
10664 if test X$d_hvfork != X; then
10665         d_vfork="$d_hvfork"
10666         d_hvfork=''
10667 fi
10668 : see if there is a vfork
10669 val=''
10670 set vfork val
10671 eval $inlibc
10672
10673 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10674 : perl on Solaris 2.x, and probably elsewhere.
10675 case "$val" in
10676 $define)
10677         echo " "
10678         case "$usevfork" in
10679         false) dflt='n';;
10680         *) dflt='y';;
10681         esac
10682         cat <<'EOM'
10683  
10684 Perl can only use a vfork() that doesn't suffer from strict
10685 restrictions on calling functions or modifying global data in
10686 the child.  For example, glibc-2.1 contains such a vfork()
10687 that is unsuitable.  If your system provides a proper fork()
10688 call, chances are that you do NOT want perl to use vfork().
10689
10690 EOM
10691         rp="Do you still want to use vfork()?"
10692         . ./myread
10693         case "$ans" in
10694         y|Y) ;;
10695         *)
10696                 echo "Ok, we won't use vfork()."
10697                 val="$undef"
10698                 ;;
10699         esac
10700         ;;
10701 esac
10702 set d_vfork
10703 eval $setvar
10704 case "$d_vfork" in
10705 $define) usevfork='true';;
10706 *) usevfork='false';;
10707 esac
10708
10709 : see if this is an sysdir system
10710 set sys/dir.h i_sysdir
10711 eval $inhdr
10712
10713 : see if this is an sysndir system
10714 set sys/ndir.h i_sysndir
10715 eval $inhdr
10716
10717 : see if closedir exists
10718 set closedir d_closedir
10719 eval $inlibc
10720
10721 case "$d_closedir" in
10722 "$define")
10723         echo " "
10724         echo "Checking whether closedir() returns a status..." >&4
10725         cat > closedir.c <<EOM
10726 #$i_dirent I_DIRENT             /**/
10727 #$i_sysdir I_SYS_DIR            /**/
10728 #$i_sysndir I_SYS_NDIR          /**/
10729 #$i_systypes I_SYS_TYPES        /**/
10730
10731 #if defined(I_SYS_TYPES)
10732 #include <sys/types.h>
10733 #endif
10734 #if defined(I_DIRENT)
10735 #include <dirent.h>
10736 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10737 #include <sys/dir.h>
10738 #endif
10739 #else
10740 #ifdef I_SYS_NDIR
10741 #include <sys/ndir.h>
10742 #else
10743 #ifdef I_SYS_DIR
10744 #ifdef hp9000s500
10745 #include <ndir.h>       /* may be wrong in the future */
10746 #else
10747 #include <sys/dir.h>
10748 #endif
10749 #endif
10750 #endif
10751 #endif 
10752 int main() { return closedir(opendir(".")); }
10753 EOM
10754         set closedir
10755         if eval $compile_ok; then
10756                 if ./closedir > /dev/null 2>&1 ; then
10757                         echo "Yes, it does."
10758                         val="$undef"
10759                 else
10760                         echo "No, it doesn't."
10761                         val="$define"
10762                 fi
10763         else
10764                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10765                 val="$define"
10766         fi
10767         ;;
10768 *)
10769         val="$undef";
10770         ;;
10771 esac
10772 set d_void_closedir
10773 eval $setvar
10774 $rm -f closedir*
10775 : check for volatile keyword
10776 echo " "
10777 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10778 $cat >try.c <<'EOCP'
10779 int main()
10780 {
10781         typedef struct _goo_struct goo_struct;
10782         goo_struct * volatile goo = ((goo_struct *)0);
10783         struct _goo_struct {
10784                 long long_int;
10785                 int reg_int;
10786                 char char_var;
10787         };
10788         typedef unsigned short foo_t;
10789         char *volatile foo;
10790         volatile int bar;
10791         volatile foo_t blech;
10792         foo = foo;
10793 }
10794 EOCP
10795 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10796         val="$define"
10797         echo "Yup, it does."
10798 else
10799         val="$undef"
10800         echo "Nope, it doesn't."
10801 fi
10802 set d_volatile
10803 eval $setvar
10804 $rm -f try.*
10805
10806 : see if there is a wait4
10807 set wait4 d_wait4
10808 eval $inlibc
10809
10810 : see if waitpid exists
10811 set waitpid d_waitpid
10812 eval $inlibc
10813
10814 : see if wcstombs exists
10815 set wcstombs d_wcstombs
10816 eval $inlibc
10817
10818 : see if wctomb exists
10819 set wctomb d_wctomb
10820 eval $inlibc
10821
10822 : see if writev exists
10823 set writev d_writev
10824 eval $inlibc
10825
10826 : preserve RCS keywords in files with variable substitution, grrr
10827 Date='$Date'
10828 Id='$Id'
10829 Log='$Log'
10830 RCSfile='$RCSfile'
10831 Revision='$Revision'
10832
10833 case "$crosscompile" in
10834 ''|[nN]*) crosscompile="$undef" ;;
10835 esac
10836
10837 case "$osname" in
10838 next|rhapsody) multiarch="$define" ;;
10839 esac
10840 case "$multiarch" in
10841 ''|[nN]*) multiarch="$undef" ;;
10842 esac
10843
10844 : check for alignment requirements
10845 echo " "
10846 case "$crosscompile$multiarch" in
10847 *$define*)
10848         $cat <<EOM
10849 You seem to be either cross-compiling or doing a multiarchitecture build,
10850 skipping the memory alignment check.
10851
10852 EOM
10853         case "$alignbytes" in
10854         '') alignbytes=8 ;;
10855         esac
10856         ;;
10857 *)
10858         case "$alignbytes" in
10859         '') echo "Checking alignment constraints..." >&4
10860                 $cat >try.c <<'EOCP'
10861 struct foobar {
10862         char foo;
10863         double bar;
10864 } try_algn;
10865 int main()
10866 {
10867         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10868 }
10869 EOCP
10870                 set try
10871                 if eval $compile_ok; then
10872                         dflt=`./try`
10873                 else
10874                         dflt='8'
10875                         echo "(I can't seem to compile the test program...)"
10876                 fi
10877                 ;;
10878         *) dflt="$alignbytes"
10879                 ;;
10880         esac
10881         rp="Doubles must be aligned on a how-many-byte boundary?"
10882         . ./myread
10883         alignbytes="$ans"
10884         $rm -f try.c try
10885         ;;
10886 esac
10887
10888
10889 : check for ordering of bytes in a long
10890 echo " "
10891 case "$crosscompile$multiarch" in
10892 *$define*)
10893         $cat <<EOM
10894 You seem to be either cross-compiling or doing a multiarchitecture build,
10895 skipping the byteorder check.
10896
10897 EOM
10898         byteorder='0xffff'
10899         ;;
10900 *)
10901         case "$byteorder" in
10902         '')
10903                 $cat <<'EOM'
10904 In the following, larger digits indicate more significance.  A big-endian
10905 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10906 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10907 machines may have weird orders like 3412.  A Cray will report 87654321,
10908 an Alpha will report 12345678. If the test program works the default is
10909 probably right.
10910 I'm now running the test program...
10911 EOM
10912                 $cat >try.c <<'EOCP'
10913 #include <stdio.h>
10914 int main()
10915 {
10916         int i;
10917         union {
10918                 unsigned long l;
10919                 char c[sizeof(long)];
10920         } u;
10921
10922         if (sizeof(long) > 4)
10923                 u.l = (0x08070605L << 32) | 0x04030201L;
10924         else
10925                 u.l = 0x04030201L;
10926         for (i = 0; i < sizeof(long); i++)
10927                 printf("%c", u.c[i]+'0');
10928         printf("\n");
10929         exit(0);
10930 }
10931 EOCP
10932                 xxx_prompt=y
10933                 set try
10934                 if eval $compile && ./try > /dev/null; then
10935                         dflt=`./try`
10936                         case "$dflt" in
10937                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10938                                 echo "(The test program ran ok.)"
10939                                 echo "byteorder=$dflt"
10940                                 xxx_prompt=n
10941                         ;;
10942                         ????|????????) echo "(The test program ran ok.)" ;;
10943                         *) echo "(The test program didn't run right for some reason.)" ;;
10944                         esac
10945                 else
10946                         dflt='4321'
10947                         cat <<'EOM'
10948 (I can't seem to compile the test program.  Guessing big-endian...)
10949 EOM
10950                 fi
10951                 case "$xxx_prompt" in
10952                 y)
10953                         rp="What is the order of bytes in a long?"
10954                         . ./myread
10955                         byteorder="$ans"
10956                         ;;
10957                 *)      byteorder=$dflt
10958                         ;;
10959                 esac
10960                 ;;
10961         esac
10962         $rm -f try.c try
10963         ;;
10964 esac
10965
10966
10967 : how do we catenate cpp tokens here?
10968 echo " "
10969 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10970 $cat >cpp_stuff.c <<'EOCP'
10971 #define RCAT(a,b)a/**/b
10972 #define ACAT(a,b)a ## b
10973 RCAT(Rei,ser)
10974 ACAT(Cir,cus)
10975 EOCP
10976 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10977 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10978         echo "Oh!  Smells like ANSI's been here." >&4
10979         echo "We can catify or stringify, separately or together!"
10980         cpp_stuff=42
10981 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10982         echo "Ah, yes!  The good old days!" >&4
10983         echo "However, in the good old days we don't know how to stringify and"
10984         echo "catify at the same time."
10985         cpp_stuff=1
10986 else
10987         $cat >&4 <<EOM
10988 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10989 to have to edit the values of CAT[2-5] in config.h...
10990 EOM
10991         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10992 fi
10993 $rm -f cpp_stuff.*
10994
10995 : see if this is a db.h system
10996 set db.h i_db
10997 eval $inhdr
10998
10999 case "$i_db" in
11000 $define)
11001         : Check db version.
11002         echo " "
11003         echo "Checking Berkeley DB version ..." >&4
11004         $cat >try.c <<EOCP
11005 #$d_const HASCONST
11006 #ifndef HASCONST
11007 #define const
11008 #endif
11009 #include <sys/types.h>
11010 #include <stdio.h>
11011 #include <db.h>
11012 int main()
11013 {
11014 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11015     int Major, Minor, Patch ;
11016     unsigned long Version ;
11017     (void)db_version(&Major, &Minor, &Patch) ;
11018     printf("You have Berkeley DB Version 2 or greater\n");
11019
11020     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11021                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11022     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11023                 Major, Minor, Patch) ;
11024
11025     /* check that db.h & libdb are compatible */
11026     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11027         printf("db.h and libdb are incompatible\n") ;
11028         exit(3);        
11029     }
11030
11031     printf("db.h and libdb are compatible\n") ;
11032
11033     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11034                 + DB_VERSION_PATCH ;
11035
11036     /* needs to be >= 2.3.4 */
11037     if (Version < 2003004) {
11038     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11039         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11040         exit(2);        
11041     }
11042
11043     exit(0);
11044 #else
11045 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11046     printf("You have Berkeley DB Version 1\n");
11047     exit(0);    /* DB version < 2: the coast is clear. */
11048 #else
11049     exit(1);    /* <db.h> not Berkeley DB? */
11050 #endif
11051 #endif
11052 }
11053 EOCP
11054         set try
11055         if eval $compile && ./try; then
11056                 echo 'Looks OK.' >&4
11057         else
11058                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11059                 i_db=$undef
11060                 case " $libs " in
11061                 *"-ldb "*)
11062                         : Remove db from list of libraries to use
11063                         echo "Removing unusable -ldb from library list" >&4
11064                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11065                         shift
11066                         libs="$*"
11067                         echo "libs = $libs" >&4
11068                         ;;
11069                 esac
11070         fi
11071         $rm -f try.*
11072         ;;
11073 esac
11074
11075 case "$i_db" in
11076 define)
11077         : Check the return type needed for hash 
11078         echo " "
11079         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11080         $cat >try.c <<EOCP
11081 #$d_const HASCONST
11082 #ifndef HASCONST
11083 #define const
11084 #endif
11085 #include <sys/types.h>
11086 #include <db.h>
11087
11088 #ifndef DB_VERSION_MAJOR
11089 u_int32_t hash_cb (ptr, size)
11090 const void *ptr;
11091 size_t size;
11092 {
11093 }
11094 HASHINFO info;
11095 int main()
11096 {
11097         info.hash = hash_cb;
11098 }
11099 #endif
11100 EOCP
11101         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11102                 if $contains warning try.out >>/dev/null 2>&1 ; then
11103                         db_hashtype='int'
11104                 else
11105                         db_hashtype='u_int32_t'
11106                 fi
11107         else
11108                 : XXX Maybe we should just give up here.
11109                 db_hashtype=u_int32_t
11110                 $cat try.out >&4
11111                 echo "Help:  I can't seem to compile the db test program." >&4
11112                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11113         fi
11114         $rm -f try.*
11115         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11116         ;;
11117 *)      db_hashtype=u_int32_t
11118         ;;
11119 esac
11120 case "$i_db" in
11121 define)
11122         : Check the return type needed for prefix 
11123         echo " "
11124         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11125         cat >try.c <<EOCP
11126 #$d_const HASCONST
11127 #ifndef HASCONST
11128 #define const
11129 #endif
11130 #include <sys/types.h>
11131 #include <db.h>
11132
11133 #ifndef DB_VERSION_MAJOR
11134 size_t prefix_cb (key1, key2)
11135 const DBT *key1;
11136 const DBT *key2;
11137 {
11138 }
11139 BTREEINFO info;
11140 int main()
11141 {
11142         info.prefix = prefix_cb;
11143 }
11144 #endif
11145 EOCP
11146         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11147                 if $contains warning try.out >>/dev/null 2>&1 ; then
11148                         db_prefixtype='int'
11149                 else
11150                         db_prefixtype='size_t'
11151                 fi
11152         else
11153                 db_prefixtype='size_t'
11154                 : XXX Maybe we should just give up here.
11155                 $cat try.out >&4
11156                 echo "Help:  I can't seem to compile the db test program." >&4
11157                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11158         fi
11159         $rm -f try.*
11160         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11161         ;;
11162 *)      db_prefixtype='size_t'
11163         ;;
11164 esac
11165
11166 : check for void type
11167 echo " "
11168 echo "Checking to see how well your C compiler groks the void type..." >&4
11169 case "$voidflags" in
11170 '')
11171         $cat >try.c <<'EOCP'
11172 #if TRY & 1
11173 void sub() {
11174 #else
11175 sub() {
11176 #endif
11177         extern void moo();      /* function returning void */
11178         void (*goo)();          /* ptr to func returning void */
11179 #if TRY & 8
11180         void *hue;              /* generic ptr */
11181 #endif
11182 #if TRY & 2
11183         void (*foo[10])();
11184 #endif
11185
11186 #if TRY & 4
11187         if(goo == moo) {
11188                 exit(0);
11189         }
11190 #endif
11191         exit(0);
11192 }
11193 int main() { sub(); }
11194 EOCP
11195         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11196                 voidflags=$defvoidused
11197         echo "Good.  It appears to support void to the level $package wants.">&4
11198                 if $contains warning .out >/dev/null 2>&1; then
11199                         echo "However, you might get some warnings that look like this:"
11200                         $cat .out
11201                 fi
11202         else
11203 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11204                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11205                         echo "It supports 1..."
11206                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11207                                 echo "It also supports 2..."
11208                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11209                                         voidflags=7
11210                                         echo "And it supports 4 but not 8 definitely."
11211                                 else
11212                                         echo "It doesn't support 4..."
11213                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11214                                                 voidflags=11
11215                                                 echo "But it supports 8."
11216                                         else
11217                                                 voidflags=3
11218                                                 echo "Neither does it support 8."
11219                                         fi
11220                                 fi
11221                         else
11222                                 echo "It does not support 2..."
11223                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11224                                         voidflags=13
11225                                         echo "But it supports 4 and 8."
11226                                 else
11227                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11228                                                 voidflags=5
11229                                                 echo "And it supports 4 but has not heard about 8."
11230                                         else
11231                                                 echo "However it supports 8 but not 4."
11232                                         fi
11233                                 fi
11234                         fi
11235                 else
11236                         echo "There is no support at all for void."
11237                         voidflags=0
11238                 fi
11239         fi
11240 esac
11241 case "$voidflags" in
11242 "$defvoidused") ;;
11243 *)      $cat >&4 <<'EOM'
11244   Support flag bits are:
11245     1: basic void declarations.
11246     2: arrays of pointers to functions returning void.
11247     4: operations between pointers to and addresses of void functions.
11248     8: generic void pointers.
11249 EOM
11250         dflt="$voidflags";
11251         rp="Your void support flags add up to what?"
11252         . ./myread
11253         voidflags="$ans"
11254         ;;
11255 esac
11256 $rm -f try.* .out
11257
11258
11259 : How can we generate normalized random numbers ?
11260 echo " "
11261 echo "Looking for a random number function..." >&4
11262 case "$randfunc" in
11263 '')
11264         if set drand48 val -f; eval $csym; $val; then
11265                 dflt="drand48"
11266                 echo "Good, found drand48()." >&4
11267         elif set random val -f; eval $csym; $val; then
11268                 dflt="random"
11269                 echo "OK, found random()." >&4
11270         else
11271                 dflt="rand"
11272                 echo "Yick, looks like I have to use rand()." >&4
11273         fi
11274         echo " "
11275         ;;
11276 *)
11277         dflt="$randfunc"
11278         ;;
11279 esac
11280 cont=true
11281
11282 case "$ccflags" in
11283 *-Dmy_rand=*|*-Dmy_srand=*)
11284         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11285         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11286         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11287         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11288         ;;
11289 esac
11290
11291 while $test "$cont"; do
11292         rp="Use which function to generate random numbers?"
11293         . ./myread
11294         if $test "$ans" = "$dflt"; then
11295                 : null
11296         else
11297                 randbits=''
11298         fi
11299         randfunc="$ans"
11300         if set $ans val -f; eval $csym; $val; then
11301                 cont=''
11302         else
11303                 dflt=y
11304                 rp="I cannot find function $ans. Use that name anyway?"
11305                 . ./myread
11306                 dflt=rand
11307                 case "$ans" in
11308                         [yY]*) cont='';;
11309                 esac
11310         fi
11311         case "$cont" in
11312         '')
11313                 case "$randfunc" in
11314                 drand48)
11315                         drand01="drand48()"
11316                         seedfunc="srand48"
11317                         randbits=48
11318                         randseedtype=long
11319                         ;;
11320                 rand|random)
11321                         case "$randbits" in
11322                         '')
11323 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11324                                 $cat >try.c <<EOCP
11325 #$i_unistd I_UNISTD
11326 #$i_stdlib I_STDLIB
11327 #include <stdio.h>
11328 #ifdef I_UNISTD
11329 #  include <unistd.h>
11330 #endif
11331 #ifdef I_STDLIB
11332 #  include <stdlib.h>
11333 #endif
11334 int main()
11335 {
11336         register int i;
11337         register unsigned long tmp;
11338         register unsigned long max = 0L;
11339
11340         for (i = 1000; i; i--) {
11341                 tmp = (unsigned long) $randfunc();
11342                 if (tmp > max) max = tmp;
11343         }
11344         for (i = 0; max; i++)
11345                 max /= 2;
11346         printf("%d\n",i);
11347 }
11348 EOCP
11349                                 set try
11350                                 if eval $compile_ok; then
11351                                         dflt=`try`
11352                                 else
11353                                         dflt='?'
11354                                         echo "(I can't seem to compile the test program...)"
11355                                 fi
11356                                 ;;
11357                         *)
11358                                 dflt="$randbits"
11359                                 ;;
11360                         esac
11361                         rp="How many bits does your $randfunc() function produce?"
11362                         . ./myread
11363                         randbits="$ans"
11364                         $rm -f try.c try
11365                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11366                         seedfunc="s$randfunc"
11367                         randseedtype=unsigned
11368                         ;;
11369                 *)
11370                         dflt="31"
11371                         rp="How many bits does your $randfunc() function produce?"
11372                         . ./myread
11373                         randbits="$ans"
11374                         seedfunc="s$randfunc"
11375                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11376                         if set $seedfunc val -f; eval $csym; $val; then
11377                                 echo "(Using $seedfunc() to seed random generator)"
11378                         else
11379                                 echo "(Warning: no $seedfunc() to seed random generator)"
11380                                 seedfunc=rand
11381                         fi
11382                         randseedtype=unsigned
11383                         ;;
11384                 esac
11385                 ;;
11386         esac
11387 done
11388
11389 echo " "
11390 echo "Determining whether or not we are on an EBCDIC system..." >&4
11391 $cat >tebcdic.c <<'EOM'
11392 int main()
11393 {
11394   if ('M'==0xd4) return 0;
11395   return 1;
11396 }
11397 EOM
11398
11399 val=$undef
11400 set tebcdic
11401 if eval $compile_ok; then
11402         if ./tebcdic; then
11403                 echo "You have EBCDIC." >&4
11404                 val="$define"
11405         else
11406                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11407         fi
11408 else
11409         echo "I'm unable to compile the test program." >&4
11410         echo "I'll assume ASCII or some ISO Latin." >&4
11411 fi
11412 $rm -f tebcdic.c tebcdic
11413 set ebcdic
11414 eval $setvar
11415
11416 echo " "
11417 $cat >&4 <<EOM
11418 Checking how to flush all pending stdio output...
11419 EOM
11420 # I only know how to find the first 32 possibly open files on SunOS.
11421 # See also hints/sunos_4_1.sh and util.c  --AD
11422 case "$osname" in
11423 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11424 esac
11425 $cat >>try.c <<EOCP
11426 #include <stdio.h>
11427 #$i_unistd I_UNISTD
11428 #ifdef I_UNISTD
11429 # include <unistd.h>
11430 #endif
11431 #$d_sysconf HAS_SYSCONF
11432 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11433 #ifdef HAS_STDIO_STREAM_ARRAY
11434 # define STDIO_STREAM_ARRAY $stdio_stream_array
11435 #endif
11436 int main() {
11437   FILE* p = fopen("try.out", "w");
11438 #ifdef TRY_FPUTC
11439   fputc('x', p);
11440 #else
11441 # ifdef TRY_FPRINTF
11442   fprintf(p, "x");
11443 # endif
11444 #endif
11445 #ifdef TRY_FFLUSH_NULL
11446   fflush(NULL);
11447 #endif
11448 #ifdef TRY_FFLUSH_ALL
11449   {
11450     long open_max = -1;
11451 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11452     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11453 # else
11454 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11455     open_max = sysconf(_SC_OPEN_MAX);
11456 #  else
11457 #   ifdef FOPEN_MAX
11458     open_max = FOPEN_MAX;
11459 #   else
11460 #    ifdef OPEN_MAX
11461     open_max = OPEN_MAX;
11462 #    else
11463 #     ifdef _NFILE
11464     open_max = _NFILE;
11465 #     endif
11466 #    endif
11467 #   endif
11468 #  endif
11469 # endif 
11470 # ifdef HAS_STDIO_STREAM_ARRAY
11471     if (open_max > 0) {
11472       long i;
11473       for (i = 0; i < open_max; i++)
11474             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11475                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11476                 STDIO_STREAM_ARRAY[i]._flag)
11477                 fflush(&STDIO_STREAM_ARRAY[i]);
11478     }   
11479   }
11480 # endif
11481 #endif
11482   _exit(42);
11483 }
11484 EOCP
11485 : first we have to find out how _not_ to flush
11486 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11487     output=''
11488     set try -DTRY_FPUTC
11489     if eval $compile; then
11490             $rm -f try.out
11491             ./try$exe_ext 2>/dev/null
11492             if $test ! -s try.out -a "X$?" = X42; then
11493                 output=-DTRY_FPUTC
11494             fi
11495     fi
11496     case "$output" in
11497     '')
11498             set try -DTRY_FPRINTF
11499             $rm -f try.out
11500             if eval $compile; then
11501                     $rm -f try.out
11502                     ./try$exe_ext 2>/dev/null
11503                     if $test ! -s try.out -a "X$?" = X42; then
11504                         output=-DTRY_FPRINTF
11505                     fi
11506             fi
11507         ;;
11508     esac
11509 fi
11510 : check for fflush NULL behaviour
11511 case "$fflushNULL" in
11512 '')     set try -DTRY_FFLUSH_NULL $output
11513         if eval $compile; then
11514                 $rm -f try.out
11515                 ./try$exe_ext 2>/dev/null
11516                 code="$?"
11517                 if $test -s try.out -a "X$code" = X42; then
11518                         fflushNULL="`$cat try.out`"
11519                 else
11520                         if $test "X$code" != X42; then
11521                                 $cat >&4 <<EOM
11522 (If this test failed, don't worry, we'll try another method shortly.)
11523 EOM
11524                         fi
11525                 fi
11526         fi
11527         $rm -f core try.core core.try.*
11528         case "$fflushNULL" in
11529         x)      $cat >&4 <<EOM
11530 Your fflush(NULL) works okay.
11531 EOM
11532                 fflushNULL="$define"
11533                 ;;
11534         '')     $cat >&4 <<EOM
11535 Your fflush(NULL) isn't working (contrary to ANSI C).
11536 EOM
11537                 fflushNULL="$undef"
11538                 ;;
11539         *)      $cat >&4 <<EOM
11540 Cannot figure out whether your fflush(NULL) works or not.
11541 I'm assuming it doesn't (contrary to ANSI C).
11542 EOM
11543                 fflushNULL="$undef"
11544                 ;;
11545         esac
11546         ;;
11547 $define|true|[yY]*)
11548         fflushNULL="$define"
11549         ;;
11550 *)
11551         fflushNULL="$undef"
11552         ;;
11553 esac
11554 : check explicit looping only if NULL did not work
11555 case "$fflushNULL" in
11556 "$undef")
11557         : check for fflush all behaviour
11558         case "$fflushall" in
11559         '')     set try -DTRY_FFLUSH_ALL $output
11560                 if eval $compile; then
11561                         $cat >&4 <<EOM
11562 (Now testing the other method--but note that also this may fail.)
11563 EOM
11564                         $rm -f try.out
11565                         ./try$exe_ext 2>/dev/null
11566                         if $test -s try.out -a "X$?" = X42; then
11567                                 fflushall="`$cat try.out`"
11568                         fi
11569                 fi
11570                 $rm -f core try.core core.try.*
11571                 case "$fflushall" in
11572                 x)      $cat >&4 <<EOM
11573 Whew. Flushing explicitly all the stdio streams works.
11574 EOM
11575                         fflushall="$define"
11576                         ;;
11577                 '')     $cat >&4 <<EOM
11578 Sigh. Flushing explicitly all the stdio streams doesn't work.
11579 EOM
11580                         fflushall="$undef"
11581                         ;;
11582                 *)      $cat >&4 <<EOM
11583 Cannot figure out whether flushing stdio streams explicitly works or not.
11584 I'm assuming it doesn't.
11585 EOM
11586                         fflushall="$undef"
11587                         ;;
11588                 esac
11589                 ;;
11590         "$define"|true|[yY]*)
11591                 fflushall="$define"
11592                 ;;
11593         *)
11594                 fflushall="$undef"
11595                 ;;
11596         esac
11597         ;;
11598 *)      fflushall="$undef"      
11599         ;;
11600 esac
11601 case "$fflushNULL$fflushall" in
11602 undefundef)
11603         $cat <<EOM
11604 I cannot figure out how to flush pending stdio output.
11605 EOM
11606         ;;
11607 esac
11608 $rm -f try.* try$exe_ext
11609
11610 : see what type file positions are declared as in the library
11611 rp="What is the type for file position used by fsetpos()?"
11612 set fpos_t fpostype long stdio.h sys/types.h
11613 eval $typedef_ask
11614
11615 : Store the full pathname to the ar program for use in the C program
11616 : Respect a hint or command line value for full_ar.
11617 case "$full_ar" in
11618 '') full_ar=$ar ;;
11619 esac
11620
11621 : Store the full pathname to the sed program for use in the C program
11622 full_sed=$sed
11623
11624 : see what type gids are declared as in the kernel
11625 echo " "
11626 echo "Looking for the type for group ids returned by getgid()."
11627 set gid_t gidtype xxx stdio.h sys/types.h
11628 eval $typedef
11629 case "$gidtype" in
11630 xxx)
11631         xxx=`./findhdr sys/user.h`
11632         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11633         case $1 in
11634         unsigned) dflt="$1 $2" ;;
11635         *) dflt="$1" ;;
11636         esac
11637         ;;
11638 *) dflt="$gidtype";;
11639 esac
11640 case "$gidtype" in
11641 gid_t) echo "gid_t found." ;;
11642 *)      rp="What is the type for group ids returned by getgid()?"
11643         . ./myread
11644         gidtype="$ans"
11645         ;;
11646 esac
11647
11648 : see if getgroups exists
11649 set getgroups d_getgrps
11650 eval $inlibc
11651
11652 : see if setgroups exists
11653 set setgroups d_setgrps
11654 eval $inlibc
11655
11656
11657 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11658 echo " "
11659 case "$d_getgrps$d_setgrps" in
11660 *define*)
11661         case "$groupstype" in
11662         '') dflt="$gidtype" ;;
11663         *)  dflt="$groupstype" ;;
11664         esac
11665         $cat <<EOM
11666 What type of pointer is the second argument to getgroups() and setgroups()?
11667 Usually this is the same as group ids, $gidtype, but not always.
11668
11669 EOM
11670         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11671         . ./myread
11672         groupstype="$ans"
11673         ;;
11674 *)  groupstype="$gidtype";;
11675 esac
11676
11677 : see what type lseek is declared as in the kernel
11678 rp="What is the type used for lseek's offset on this system?"
11679 set off_t lseektype long stdio.h sys/types.h
11680 eval $typedef_ask
11681
11682 echo " "
11683 $echo $n "Checking to see how big your file offsets are...$c" >&4
11684 $cat >try.c <<EOCP
11685 #include <sys/types.h>
11686 #include <stdio.h>
11687 int main()
11688 {
11689         printf("%d\n", sizeof($lseektype));
11690 }
11691 EOCP
11692 set try
11693 if eval $compile_ok; then
11694         lseeksize=`./try`
11695         $echo " $lseeksize bytes." >&4
11696 else
11697         dflt='4'
11698         echo " "
11699         echo "(I can't seem to compile the test program.  Guessing...)"
11700         rp="What is the size of your file offsets (in bytes)?"
11701         . ./myread
11702         lseeksize="$ans"
11703 fi
11704 $rm -f try.c try
11705
11706 echo " "
11707 echo "Checking if your $make program sets \$(MAKE)..." >&4
11708 case "$make_set_make" in
11709 '')
11710         $sed 's/^X //' > testmake.mak << 'EOF'
11711 Xall:
11712 X       @echo 'maketemp="$(MAKE)"'
11713 EOF
11714         case "`$make -f testmake.mak 2>/dev/null`" in
11715         *maketemp=*) make_set_make='#' ;;
11716         *)      make_set_make="MAKE=$make" ;;
11717         esac
11718         $rm -f testmake.mak
11719         ;;
11720 esac
11721 case "$make_set_make" in
11722 '#') echo "Yup, it does.";;
11723 *) echo "Nope, it doesn't.";;
11724 esac
11725
11726 : see what type is used for mode_t
11727 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11728 set mode_t modetype int stdio.h sys/types.h
11729 eval $typedef_ask
11730
11731 : define a fucntion to check prototypes
11732 $cat > protochk <<EOSH
11733 $startsh
11734 cc="$cc"
11735 optimize="$optimize"
11736 ccflags="$ccflags"
11737 prototype="$prototype"
11738 define="$define"
11739 rm=$rm
11740 EOSH
11741
11742 $cat >> protochk <<'EOSH'
11743
11744 $rm -f try.c
11745 foo="$1"
11746 shift
11747 while test $# -ge 2; do
11748         case "$1" in
11749                 $define) echo "#include <$2>" >> try.c ;;
11750                 literal) echo "$2" >> try.c ;;
11751         esac
11752     shift 2
11753 done
11754 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11755 cat >> try.c <<'EOCP'
11756 #ifdef CAN_PROTOTYPE
11757 #define _(args) args
11758 #else
11759 #define _(args) ()
11760 #endif
11761 EOCP
11762 echo "$foo" >> try.c
11763 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11764 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11765 status=$?
11766 $rm -f try.[co]
11767 exit $status
11768 EOSH
11769 chmod +x protochk
11770 $eunicefix protochk
11771
11772 : see what type is used for size_t
11773 rp="What is the type used for the length parameter for string functions?"
11774 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11775 eval $typedef_ask
11776
11777 : check for type of arguments to gethostbyaddr. 
11778 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11779         case "$d_gethbyaddr" in
11780         $define)
11781                 $cat <<EOM
11782
11783 Checking to see what type of arguments are accepted by gethostbyaddr().
11784 EOM
11785                 hdrs="$define sys/types.h
11786                         $d_socket sys/socket.h 
11787                         $i_niin netinet/in.h 
11788                         $i_netdb netdb.h
11789                         $i_unistd unistd.h"
11790                 : The first arg can 'char *' or 'void *'
11791                 : The second arg is some of integral type
11792                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11793                         for yyy in size_t long int; do
11794                                 case "$netdb_host_type" in
11795                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11796                                         if ./protochk "$try" $hdrs; then
11797                                                 echo "Your system accepts $xxx for the first arg."
11798                                                 echo "...and $yyy for the second arg."
11799                                                 netdb_host_type="$xxx"
11800                                                 netdb_hlen_type="$yyy"
11801                                         fi
11802                                         ;;
11803                                 esac
11804                         done
11805                 done
11806                 : In case none of those worked, prompt the user.
11807                 case "$netdb_host_type" in
11808                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11809                         dflt='char *'
11810                         . ./myread
11811                         netdb_host_type=$ans
11812                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11813                         dflt="$sizetype"
11814                         . ./myread
11815                         netdb_hlen_type=$ans
11816                         ;;
11817                 esac
11818                 ;;
11819         *)      : no gethostbyaddr, so pick harmless defaults
11820                 netdb_host_type='char *'
11821                 netdb_hlen_type="$sizetype"
11822                 ;;
11823         esac
11824         # Remove the "const" if needed. -- but then we'll have a 
11825         # prototype clash!
11826         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11827 fi
11828
11829 : check for type of argument to gethostbyname. 
11830 if test "X$netdb_name_type" = X ; then
11831         case "$d_gethbyname" in
11832         $define)
11833                 $cat <<EOM
11834
11835 Checking to see what type of argument is accepted by gethostbyname().
11836 EOM
11837                 hdrs="$define sys/types.h
11838                         $d_socket sys/socket.h 
11839                         $i_niin netinet/in.h 
11840                         $i_netdb netdb.h
11841                         $i_unistd unistd.h"
11842                 for xxx in "const char *" "char *"; do
11843                         case "$netdb_name_type" in
11844                         '')     try="extern struct hostent *gethostbyname($xxx);"
11845                                 if ./protochk "$try" $hdrs; then
11846                                         echo "Your system accepts $xxx."
11847                                         netdb_name_type="$xxx"
11848                                 fi
11849                                 ;;
11850                         esac
11851                 done
11852                 : In case none of those worked, prompt the user.
11853                 case "$netdb_name_type" in
11854                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11855                         dflt='char *'
11856                         . ./myread
11857                         netdb_name_type=$ans
11858                         ;;
11859                 esac
11860                 ;;
11861         *)      : no gethostbyname, so pick harmless default
11862                 netdb_name_type='char *'
11863                 ;;
11864         esac
11865 fi
11866
11867 : check for type of 1st argument to getnetbyaddr. 
11868 if test "X$netdb_net_type" = X ; then
11869         case "$d_getnbyaddr" in
11870         $define)
11871                 $cat <<EOM
11872
11873 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11874 EOM
11875                 hdrs="$define sys/types.h
11876                         $d_socket sys/socket.h 
11877                         $i_niin netinet/in.h 
11878                         $i_netdb netdb.h
11879                         $i_unistd unistd.h"
11880                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11881                         case "$netdb_net_type" in
11882                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11883                                 if ./protochk "$try" $hdrs; then
11884                                         echo "Your system accepts $xxx."
11885                                         netdb_net_type="$xxx"
11886                                 fi
11887                                 ;;
11888                         esac
11889                 done
11890                 : In case none of those worked, prompt the user.
11891                 case "$netdb_net_type" in
11892                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11893                         dflt='long'
11894                         . ./myread
11895                         netdb_net_type=$ans
11896                         ;;
11897                 esac
11898                 ;;
11899         *)      : no getnetbyaddr, so pick harmless default
11900                 netdb_net_type='long'
11901                 ;;
11902         esac
11903 fi
11904 : locate the preferred pager for this system
11905 case "$pager" in
11906 '')
11907         dflt=''
11908         case "$pg" in
11909         /*) dflt=$pg;;
11910         esac
11911         case "$more" in
11912         /*) dflt=$more;;
11913         esac
11914         case "$less" in
11915         /*) dflt=$less;;
11916         esac
11917         case "$dflt" in
11918         '') dflt=/usr/ucb/more;;
11919         esac
11920         ;;
11921 *) dflt="$pager";;
11922 esac
11923 echo " "
11924 fn=f/
11925 rp='What pager is used on your system?'
11926 . ./getfile
11927 pager="$ans"
11928
11929 : see what type pids are declared as in the kernel
11930 rp="What is the type of process ids on this system?"
11931 set pid_t pidtype int stdio.h sys/types.h
11932 eval $typedef_ask
11933
11934 : check for length of pointer
11935 echo " "
11936 case "$ptrsize" in
11937 '')
11938         $echo $n "Checking to see how big your pointers are...$c" >&4
11939         if test "$voidflags" -gt 7; then
11940                 echo '#define VOID_PTR char *' > try.c
11941         else
11942                 echo '#define VOID_PTR void *' > try.c
11943         fi
11944         $cat >>try.c <<'EOCP'
11945 #include <stdio.h>
11946 int main()
11947 {
11948         printf("%d\n", sizeof(VOID_PTR));
11949         exit(0);
11950 }
11951 EOCP
11952         set try
11953         if eval $compile_ok; then
11954                 ptrsize=`./try`
11955                 $echo " $ptrsize bytes." >&4
11956         else
11957                 dflt='4'
11958                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11959                 rp="What is the size of a pointer (in bytes)?"
11960                 . ./myread
11961                 ptrsize="$ans"
11962         fi
11963         ;;
11964 esac
11965 $rm -f try.c try
11966
11967 : see if ar generates random libraries by itself
11968 echo " "
11969 echo "Checking how to generate random libraries on your machine..." >&4
11970 echo 'int bar1() { return bar2(); }' > bar1.c
11971 echo 'int bar2() { return 2; }' > bar2.c
11972 $cat > foo.c <<'EOP'
11973 int main() { printf("%d\n", bar1()); exit(0); }
11974 EOP
11975 $cc $ccflags -c bar1.c >/dev/null 2>&1
11976 $cc $ccflags -c bar2.c >/dev/null 2>&1
11977 $cc $ccflags -c foo.c >/dev/null 2>&1
11978 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11979 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11980         ./foobar >/dev/null 2>&1; then
11981         echo "$ar appears to generate random libraries itself."
11982         orderlib=false
11983         ranlib=":"
11984 elif $ar ts bar$_a >/dev/null 2>&1 &&
11985         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11986         ./foobar >/dev/null 2>&1; then
11987                 echo "a table of contents needs to be added with '$ar ts'."
11988                 orderlib=false
11989                 ranlib="$ar ts"
11990 else
11991         case "$ranlib" in
11992         :) ranlib='';;
11993         '')
11994                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11995                 $test -f $ranlib || ranlib=''
11996                 ;;
11997         esac
11998         if $test -n "$ranlib"; then
11999                 echo "your system has '$ranlib'; we'll use that."
12000                 orderlib=false
12001         else
12002                 echo "your system doesn't seem to support random libraries"
12003                 echo "so we'll use lorder and tsort to order the libraries."
12004                 orderlib=true
12005                 ranlib=":"
12006         fi
12007 fi
12008 $rm -f foo* bar* 
12009
12010 : check for type of arguments to select. 
12011 case "$selecttype" in
12012 '') case "$d_select" in
12013         $define)
12014                 $cat <<EOM
12015 Checking to see what type of arguments are accepted by select().
12016 EOM
12017                 hdrs="$define sys/types.h
12018                         $i_systime sys/time.h 
12019                         $i_sysselct sys/select.h
12020                         $d_socket sys/socket.h"
12021                 : The first arg can be int, unsigned, or size_t
12022                 : The last arg may or may not be 'const'
12023                 val=''
12024                 : void pointer has been seen but using that
12025                 : breaks the selectminbits test
12026                 for xxx in 'fd_set *' 'int *'; do
12027                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12028                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12029                                         case "$val" in
12030                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12031                                                 if ./protochk "$try" $hdrs; then
12032                                                         echo "Your system accepts $xxx."
12033                                                         val="$xxx"
12034                                                 fi
12035                                                 ;;
12036                                         esac
12037                                 done
12038                         done
12039                 done
12040                 case "$val" in
12041                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12042                         case "$d_fd_set" in
12043                                 $define) dflt="fd_set *" ;;
12044                                 *)              dflt="int *" ;;
12045                         esac
12046                         . ./myread
12047                         val=$ans
12048                         ;;
12049                 esac
12050                 selecttype="$val"
12051                 ;;
12052         *)      : no select, so pick a harmless default
12053                 selecttype='int *'
12054                 ;;
12055         esac
12056         ;;
12057 esac
12058
12059 : check for the select 'width'
12060 case "$selectminbits" in
12061 '') case "$d_select" in
12062         $define)
12063                 $cat <<EOM
12064
12065 Checking to see on how many bits at a time your select() operates...
12066 EOM
12067                 $cat >try.c <<EOCP
12068 #include <sys/types.h>
12069 #$i_time I_TIME
12070 #$i_systime I_SYS_TIME
12071 #$i_systimek I_SYS_TIME_KERNEL
12072 #ifdef I_TIME
12073 #   include <time.h>
12074 #endif
12075 #ifdef I_SYS_TIME
12076 #   ifdef I_SYS_TIME_KERNEL
12077 #       define KERNEL
12078 #   endif
12079 #   include <sys/time.h>
12080 #   ifdef I_SYS_TIME_KERNEL
12081 #       undef KERNEL
12082 #   endif
12083 #endif
12084 #$i_sysselct I_SYS_SELECT
12085 #ifdef I_SYS_SELECT
12086 #include <sys/select.h>
12087 #endif
12088 #$d_socket HAS_SOCKET
12089 #ifdef HAS_SOCKET
12090 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12091 #endif
12092 #include <stdio.h>
12093 $selecttype b;
12094 #define S sizeof(*(b))
12095 #define MINBITS 64
12096 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12097 #define NBITS  (NBYTES * 8)
12098 int main() {
12099     char s[NBYTES];
12100     struct timeval t;
12101     int i;
12102     FILE* fp;
12103     int fd;
12104
12105     fclose(stdin);
12106     fp = fopen("try.c", "r");
12107     if (fp == 0)
12108       exit(1);
12109     fd = fileno(fp);
12110     if (fd < 0)
12111       exit(2);
12112     b = ($selecttype)s;
12113     for (i = 0; i < NBITS; i++)
12114         FD_SET(i, b);
12115     t.tv_sec  = 0;
12116     t.tv_usec = 0;
12117     select(fd + 1, b, 0, 0, &t);
12118     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12119     printf("%d\n", i + 1);
12120     return 0;
12121 }
12122 EOCP
12123                 set try
12124                 if eval $compile_ok; then
12125                         selectminbits=`./try`
12126                         case "$selectminbits" in
12127                         '')     cat >&4 <<EOM
12128 Cannot figure out on how many bits at a time your select() operates.
12129 I'll play safe and guess it is 32 bits.
12130 EOM
12131                                 selectminbits=32
12132                                 bits="32 bits"
12133                                 ;;
12134                         1)      bits="1 bit" ;;
12135                         *)      bits="$selectminbits bits" ;;
12136                         esac
12137                         echo "Your select() operates on $bits at a time." >&4
12138                 else
12139                         rp='What is the minimum number of bits your select() operates on?'
12140                         case "$byteorder" in
12141                         1234|12345678)  dflt=32 ;;
12142                         *)              dflt=1  ;;
12143                         esac
12144                         . ./myread
12145                         val=$ans
12146                         selectminbits="$val"
12147                 fi
12148                 $rm -f try.* try
12149                 ;;
12150         *)      : no select, so pick a harmless default
12151                 selectminbits='32'
12152                 ;;
12153         esac
12154         ;;
12155 esac
12156
12157 : Trace out the files included by signal.h, then look for SIGxxx names.
12158 : Remove SIGARRAYSIZE used by HPUX.
12159 : Remove SIGSTKSIZE used by Linux.
12160 : Remove SIGSTKSZ used by Posix.
12161 : Remove SIGTYP void lines used by OS2.
12162 xxx=`echo '#include <signal.h>' |
12163         $cppstdin $cppminus $cppflags 2>/dev/null |
12164         $grep '^[       ]*#.*include' | 
12165         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12166 : Check this list of files to be sure we have parsed the cpp output ok.
12167 : This will also avoid potentially non-existent files, such 
12168 : as ../foo/bar.h
12169 xxxfiles=''
12170 for xx in $xxx /dev/null ; do
12171         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12172 done
12173 : If we have found no files, at least try signal.h
12174 case "$xxxfiles" in
12175 '')     xxxfiles=`./findhdr signal.h` ;;
12176 esac
12177 xxx=`awk '
12178 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12179         print substr($2, 4, 20)
12180 }
12181 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12182         print substr($3, 4, 20)
12183 }' $xxxfiles`
12184 : Append some common names just in case the awk scan failed.
12185 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12186 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12187 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12188 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12189 : generate a few handy files for later
12190 $cat > signal.c <<'EOCP'
12191 #include <sys/types.h>
12192 #include <signal.h>
12193 #include <stdio.h>
12194 int main() {
12195
12196 /* Strange style to avoid deeply-nested #if/#else/#endif */
12197 #ifndef NSIG
12198 #  ifdef _NSIG
12199 #    define NSIG (_NSIG)
12200 #  endif
12201 #endif
12202
12203 #ifndef NSIG
12204 #  ifdef SIGMAX
12205 #    define NSIG (SIGMAX+1)
12206 #  endif
12207 #endif
12208
12209 #ifndef NSIG
12210 #  ifdef SIG_MAX
12211 #    define NSIG (SIG_MAX+1)
12212 #  endif
12213 #endif
12214
12215 #ifndef NSIG
12216 #  ifdef MAXSIG
12217 #    define NSIG (MAXSIG+1)
12218 #  endif
12219 #endif
12220
12221 #ifndef NSIG
12222 #  ifdef MAX_SIG
12223 #    define NSIG (MAX_SIG+1)
12224 #  endif
12225 #endif
12226
12227 #ifndef NSIG
12228 #  ifdef SIGARRAYSIZE
12229 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12230 #  endif
12231 #endif
12232
12233 #ifndef NSIG
12234 #  ifdef _sys_nsig
12235 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12236 #  endif
12237 #endif
12238
12239 /* Default to some arbitrary number that's big enough to get most
12240    of the common signals.
12241 */
12242 #ifndef NSIG
12243 #    define NSIG 50
12244 #endif
12245
12246 printf("NSIG %d\n", NSIG);
12247
12248 #ifndef JUST_NSIG
12249
12250 EOCP
12251
12252 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12253 {
12254         printf "#ifdef SIG"; printf $1; printf "\n"
12255         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12256         printf $1; printf ");\n"
12257         printf "#endif\n"
12258 }
12259 END {
12260         printf "#endif /* JUST_NSIG */\n";
12261         printf "}\n";
12262 }
12263 ' >>signal.c
12264 $cat >signal.awk <<'EOP'
12265 BEGIN { ndups = 0 }
12266 $1 ~ /^NSIG$/ { nsig = $2 }
12267 ($1 !~ /^NSIG$/) && (NF == 2) {
12268     if ($2 > maxsig) { maxsig = $2 }
12269     if (sig_name[$2]) {
12270         dup_name[ndups] = $1
12271         dup_num[ndups] = $2
12272         ndups++ 
12273     }
12274     else {
12275         sig_name[$2] = $1
12276         sig_num[$2] = $2
12277     }
12278 }
12279 END { 
12280     if (nsig == 0) {
12281         nsig = maxsig + 1
12282     }
12283     printf("NSIG %d\n", nsig);
12284     for (n = 1; n < nsig; n++) {
12285         if (sig_name[n]) {
12286             printf("%s %d\n", sig_name[n], sig_num[n])
12287         }
12288         else {
12289             printf("NUM%d %d\n", n, n) 
12290         }
12291     }
12292     for (n = 0; n < ndups; n++) {
12293         printf("%s %d\n", dup_name[n], dup_num[n])
12294     }
12295 }
12296 EOP
12297 $cat >signal_cmd <<EOS
12298 $startsh
12299 if $test -s signal.lst; then
12300     echo "Using your existing signal.lst file"
12301         exit 0
12302 fi
12303 xxx="$xxx"
12304 EOS
12305 $cat >>signal_cmd <<'EOS'
12306
12307 set signal
12308 if eval $compile_ok; then
12309         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12310 else
12311         echo "(I can't seem be able to compile the whole test program)" >&4
12312         echo "(I'll try it in little pieces.)" >&4
12313         set signal -DJUST_NSIG
12314         if eval $compile_ok; then
12315                 ./signal$_exe > signal.nsg
12316                 $cat signal.nsg
12317         else
12318                 echo "I can't seem to figure out how many signals you have." >&4
12319                 echo "Guessing 50." >&4
12320                 echo 'NSIG 50' > signal.nsg
12321         fi
12322         : Now look at all the signal names, one at a time.
12323         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12324                 $cat > signal.c <<EOCP
12325 #include <sys/types.h>
12326 #include <signal.h>
12327 #include <stdio.h>
12328 int main() {
12329 printf("$xx %d\n", SIG${xx});
12330 return 0;
12331 }
12332 EOCP
12333                 set signal
12334                 if eval $compile; then
12335                         echo "SIG${xx} found."
12336                         ./signal$_exe  >> signal.ls1
12337                 else
12338                         echo "SIG${xx} NOT found."
12339                 fi
12340         done
12341         if $test -s signal.ls1; then
12342                 $cat signal.nsg signal.ls1 |
12343                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12344         fi
12345
12346 fi
12347 if $test -s signal.lst; then
12348         :
12349 else
12350         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12351         echo 'kill -l' >signal
12352         set X `csh -f <signal`
12353         $rm -f signal
12354         shift
12355         case $# in
12356         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12357         esac
12358         echo $@ | $tr ' ' $trnl | \
12359             $awk '{ printf "%s %d\n", $1, ++s; }
12360                   END { printf "NSIG %d\n", ++s }' >signal.lst
12361 fi
12362 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12363 EOS
12364 chmod a+x signal_cmd
12365 $eunicefix signal_cmd
12366
12367 : generate list of signal names
12368 echo " "
12369 case "$sig_name_init" in
12370 '') doinit=yes ;;
12371 *)  case "$sig_num_init" in
12372     ''|*,*) doinit=yes ;;
12373     esac ;;
12374 esac
12375 case "$doinit" in
12376 yes)
12377         echo "Generating a list of signal names and numbers..." >&4
12378         . ./signal_cmd
12379         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12380         sig_name=`$awk 'BEGIN { printf "ZERO " }
12381                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12382         sig_num=`$awk  'BEGIN { printf "0 " }
12383                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12384         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12385                              !/^NSIG/   { printf "\"%s\", ", $1 }
12386                              END        { printf "0\n" }' signal.lst`
12387         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12388                              !/^NSIG/   { printf "%d, ", $2}
12389                              END        { printf "0\n"}' signal.lst`
12390         ;;
12391 esac
12392 echo "The following $sig_count signals are available:"
12393 echo " "
12394 echo $sig_name | $awk \
12395 'BEGIN { linelen = 0 }
12396 {
12397         for (i = 1; i <= NF; i++) {
12398                 name = "SIG" $i " "
12399                 linelen = linelen + length(name)
12400                 if (linelen > 70) {
12401                         printf "\n"
12402                         linelen = length(name)
12403                 }
12404                 printf "%s", name
12405         }
12406         printf "\n"
12407 }'
12408 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12409
12410 : see what type is used for signed size_t
12411 set ssize_t ssizetype int stdio.h sys/types.h
12412 eval $typedef
12413 dflt="$ssizetype"
12414 $cat > ssize.c <<EOM
12415 #include <stdio.h>
12416 #include <sys/types.h>
12417 #define Size_t $sizetype
12418 #define SSize_t $dflt
12419 int main()
12420 {
12421         if (sizeof(Size_t) == sizeof(SSize_t))
12422                 printf("$dflt\n");
12423         else if (sizeof(Size_t) == sizeof(int))
12424                 printf("int\n");
12425         else 
12426                 printf("long\n");
12427         exit(0);
12428 }
12429 EOM
12430 echo " "
12431 set ssize
12432 if eval $compile_ok && ./ssize > /dev/null; then
12433         ssizetype=`./ssize`
12434         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12435 else
12436         $cat >&4 <<EOM
12437 Help! I can't compile and run the ssize_t test program: please enlighten me!
12438 (This is probably a misconfiguration in your system or libraries, and
12439 you really ought to fix it.  Still, I'll try anyway.)
12440
12441 I need a type that is the same size as $sizetype, but is guaranteed to
12442 be signed.  Common values are ssize_t, int and long.
12443
12444 EOM
12445         rp="What signed type is the same size as $sizetype?"
12446         . ./myread
12447         ssizetype="$ans"
12448 fi
12449 $rm -f ssize ssize.*
12450
12451 : see what type of char stdio uses.
12452 echo " "
12453 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12454         echo "Your stdio uses unsigned chars." >&4
12455         stdchar="unsigned char"
12456 else
12457         echo "Your stdio uses signed chars." >&4
12458         stdchar="char"
12459 fi
12460
12461 : see if time exists
12462 echo " "
12463 if test "X$d_time" = X -o X"$timetype" = X; then
12464     if set time val -f d_time; eval $csym; $val; then
12465                 echo 'time() found.' >&4
12466                 val="$define"
12467                 rp="What is the type returned by time() on this system?"
12468                 set time_t timetype long stdio.h sys/types.h
12469                 eval $typedef_ask
12470     else
12471                 echo 'time() not found, hope that will do.' >&4
12472                 val="$undef"
12473                 timetype='int';
12474     fi
12475     set d_time
12476     eval $setvar
12477 fi
12478
12479 : see what type uids are declared as in the kernel
12480 echo " "
12481 echo "Looking for the type for user ids returned by getuid()."
12482 set uid_t uidtype xxx stdio.h sys/types.h
12483 eval $typedef
12484 case "$uidtype" in
12485 xxx)
12486         xxx=`./findhdr sys/user.h`
12487         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12488         case $1 in
12489         unsigned) dflt="$1 $2" ;;
12490         *) dflt="$1" ;;
12491         esac
12492         ;;
12493 *) dflt="$uidtype";;
12494 esac
12495 case "$uidtype" in
12496 uid_t)  echo "uid_t found." ;;
12497 *)      rp="What is the type for user ids returned by getuid()?"
12498         . ./myread
12499         uidtype="$ans"
12500         ;;
12501 esac
12502
12503 : see if dbm.h is available
12504 : see if dbmclose exists
12505 set dbmclose d_dbmclose
12506 eval $inlibc
12507
12508 case "$d_dbmclose" in
12509 $define)
12510         set dbm.h i_dbm
12511         eval $inhdr
12512         case "$i_dbm" in
12513         $define)
12514                 val="$undef"
12515                 set i_rpcsvcdbm
12516                 eval $setvar
12517                 ;;
12518         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12519                 eval $inhdr
12520                 ;;
12521         esac
12522         ;;
12523 *)      echo "We won't be including <dbm.h>"
12524         val="$undef"
12525         set i_dbm
12526         eval $setvar
12527         val="$undef"
12528         set i_rpcsvcdbm
12529         eval $setvar
12530         ;;
12531 esac
12532
12533 : see if this is a sys/file.h system
12534 val=''
12535 set sys/file.h val
12536 eval $inhdr
12537
12538 : do we need to include sys/file.h ?
12539 case "$val" in
12540 "$define")
12541         echo " "
12542         if $h_sysfile; then
12543                 val="$define"
12544                 echo "We'll be including <sys/file.h>." >&4
12545         else
12546                 val="$undef"
12547                 echo "We won't be including <sys/file.h>." >&4
12548         fi
12549         ;;
12550 *)
12551         h_sysfile=false
12552         ;;
12553 esac
12554 set i_sysfile
12555 eval $setvar
12556
12557 : see if fcntl.h is there
12558 val=''
12559 set fcntl.h val
12560 eval $inhdr
12561
12562 : see if we can include fcntl.h
12563 case "$val" in
12564 "$define")
12565         echo " "
12566         if $h_fcntl; then
12567                 val="$define"
12568                 echo "We'll be including <fcntl.h>." >&4
12569         else
12570                 val="$undef"
12571                 if $h_sysfile; then
12572         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12573                 else
12574                         echo "We won't be including <fcntl.h>." >&4
12575                 fi
12576         fi
12577         ;;
12578 *)
12579         h_fcntl=false
12580         val="$undef"
12581         ;;
12582 esac
12583 set i_fcntl
12584 eval $setvar
12585
12586 : see if locale.h is available
12587 set locale.h i_locale
12588 eval $inhdr
12589
12590 : see if mach cthreads are available
12591 if test "X$usethreads" = "X$define"; then
12592         set mach/cthreads.h i_machcthr
12593         eval $inhdr
12594 else
12595         i_machcthr="$undef"
12596 fi
12597
12598
12599
12600 : see if this is a math.h system
12601 set math.h i_math
12602 eval $inhdr
12603
12604 : see if this is a mntent.h system
12605 set mntent.h i_mntent
12606 eval $inhdr
12607
12608 : see if ndbm.h is available
12609 set ndbm.h t_ndbm
12610 eval $inhdr
12611 case "$t_ndbm" in
12612 $define)
12613         : see if dbm_open exists
12614         set dbm_open d_dbm_open
12615         eval $inlibc
12616         case "$d_dbm_open" in
12617         $undef)
12618                 t_ndbm="$undef"
12619                 echo "We won't be including <ndbm.h>"
12620                 ;;
12621         esac
12622         ;;
12623 esac
12624 val="$t_ndbm"
12625 set i_ndbm
12626 eval $setvar
12627
12628 : see if net/errno.h is available
12629 val=''
12630 set net/errno.h val
12631 eval $inhdr
12632
12633 : Unfortunately, it causes problems on some systems.  Arrgh.
12634 case "$val" in
12635 $define)
12636         cat > try.c <<'EOM'
12637 #include <stdio.h>
12638 #include <errno.h>
12639 #include <net/errno.h>
12640 int func()
12641 {
12642         return ENOTSOCK;
12643 }
12644 EOM
12645         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12646                 echo "We'll be including <net/errno.h>." >&4
12647         else
12648                 echo "We won't be including <net/errno.h>." >&4
12649                 val="$undef"
12650         fi
12651         $rm -f try.* try
12652         ;;
12653 esac
12654 set i_neterrno
12655 eval $setvar
12656
12657 : see if netinet/tcp.h is available
12658 set netinet/tcp.h i_netinettcp
12659 eval $inhdr
12660
12661 : see if this is a poll.h system
12662 set poll.h i_poll
12663 eval $inhdr
12664
12665 : get C preprocessor symbols handy
12666 echo " "
12667 $echo $n "Hmm... $c"
12668 echo $al | $tr ' ' $trnl >Cppsym.know
12669 $cat <<EOSS >Cppsym
12670 $startsh
12671 case "\$1" in
12672 -l) list=true
12673         shift
12674         ;;
12675 esac
12676 unknown=''
12677 case "\$list\$#" in
12678 1|2)
12679         for sym do
12680                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12681                         exit 0
12682                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12683                         :
12684                 else
12685                         unknown="\$unknown \$sym"
12686                 fi
12687         done
12688         set X \$unknown
12689         shift
12690         ;;
12691 esac
12692 case \$# in
12693 0) exit 1;;
12694 esac
12695 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12696 #ifdef \1\\
12697 exit 0; _ _ _ _\1\\      \1\\
12698 #endif\\
12699 /' >Cppsym\$\$
12700 echo "exit 1; _ _ _" >>Cppsym\$\$
12701 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12702 case "\$list" in
12703 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12704 *)
12705         sh Cppsym2\$\$
12706         status=\$?
12707         ;;
12708 esac
12709 $rm -f Cppsym\$\$ Cppsym2\$\$
12710 exit \$status
12711 EOSS
12712 chmod +x Cppsym
12713 $eunicefix Cppsym
12714 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12715
12716 : now check the C compiler for additional symbols
12717 postprocess_cc_v=''
12718 case "$osname" in
12719 aix) postprocess_cc_v="|$tr , ' '" ;;
12720 esac
12721 $cat >ccsym <<EOS
12722 $startsh
12723 $cat >tmp.c <<EOF
12724 extern int foo;
12725 EOF
12726 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12727 do
12728         case "\$i" in
12729         -D*) echo "\$i" | $sed 's/^-D//';;
12730         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12731         esac
12732 done
12733 $rm -f try.c
12734 EOS
12735 postprocess_cc_v=''
12736 chmod +x ccsym
12737 $eunicefix ccsym
12738 ./ccsym > ccsym1.raw
12739 if $test -s ccsym1.raw; then
12740        $sort ccsym1.raw | $uniq >ccsym.raw
12741 else
12742        mv ccsym1.raw ccsym.raw
12743 fi
12744
12745 $awk '/\=/ { print $0; next }
12746         { print $0"=1" }' ccsym.raw >ccsym.list
12747 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12748 $comm -13 ccsym.true ccsym.list >ccsym.own
12749 $comm -12 ccsym.true ccsym.list >ccsym.com
12750 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12751 also=''
12752 if $test -z ccsym.raw; then
12753         echo "Your C compiler doesn't seem to define any symbols!" >&4
12754         echo " "
12755         echo "However, your C preprocessor defines the following symbols:"
12756         $cat Cppsym.true
12757         ccsymbols=''
12758         cppsymbols=`$cat Cppsym.true`
12759         cppsymbols=`echo $cppsymbols`
12760         cppccsymbols="$cppsymbols"
12761 else
12762         if $test -s ccsym.com; then
12763                 echo "Your C compiler and pre-processor define these symbols:"
12764                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12765                 also='also '
12766                 symbols='ones'
12767                 cppccsymbols=`$cat ccsym.com`
12768                 cppccsymbols=`echo $cppccsymbols`
12769                 $test "$silent" || sleep 1
12770         fi
12771         if $test -s ccsym.cpp; then
12772                 $test "$also" && echo " "
12773                 echo "Your C pre-processor ${also}defines the following symbols:"
12774                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12775                 also='further '
12776                 cppsymbols=`$cat ccsym.cpp`
12777                 cppsymbols=`echo $cppsymbols`
12778                 $test "$silent" || sleep 1
12779         fi
12780         if $test -s ccsym.own; then
12781                 $test "$also" && echo " "
12782                 echo "Your C compiler ${also}defines the following cpp symbols:"
12783                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12784                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12785                 ccsymbols=`$cat ccsym.own`
12786                 ccsymbols=`echo $ccsymbols`
12787                 $test "$silent" || sleep 1
12788         fi
12789 fi
12790 $rm -f ccsym*
12791
12792 : see if this is a termio system
12793 val="$undef"
12794 val2="$undef"
12795 val3="$undef"
12796 if $test `./findhdr termios.h`; then
12797         set tcsetattr i_termios
12798         eval $inlibc
12799         val3="$i_termios"
12800 fi
12801 echo " "
12802 case "$val3" in
12803 "$define") echo "You have POSIX termios.h... good!" >&4;;
12804 *) if ./Cppsym pyr; then
12805                 case "`/bin/universe`" in
12806                 ucb) if $test `./findhdr sgtty.h`; then
12807                                 val2="$define"
12808                                 echo "<sgtty.h> found." >&4
12809                         else
12810                                 echo "System is pyramid with BSD universe."
12811                                 echo "<sgtty.h> not found--you could have problems." >&4
12812                         fi;;
12813                 *) if $test `./findhdr termio.h`; then
12814                                 val="$define"
12815                                 echo "<termio.h> found." >&4
12816                         else
12817                                 echo "System is pyramid with USG universe."
12818                                 echo "<termio.h> not found--you could have problems." >&4
12819                         fi;;
12820                 esac
12821         elif ./usg; then
12822                 if $test `./findhdr termio.h`; then
12823                         echo "<termio.h> found." >&4
12824                         val="$define"
12825                 elif $test `./findhdr sgtty.h`; then
12826                         echo "<sgtty.h> found." >&4
12827                         val2="$define"
12828                 else
12829 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12830                 fi
12831         else
12832                 if $test `./findhdr sgtty.h`; then
12833                         echo "<sgtty.h> found." >&4
12834                         val2="$define"
12835                 elif $test `./findhdr termio.h`; then
12836                         echo "<termio.h> found." >&4
12837                         val="$define"
12838                 else
12839 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12840                 fi
12841         fi;;
12842 esac
12843 set i_termio; eval $setvar
12844 val=$val2; set i_sgtty; eval $setvar
12845 val=$val3; set i_termios; eval $setvar
12846
12847 : see if this is a shadow.h system
12848 set shadow.h i_shadow
12849 eval $inhdr
12850
12851 : see if this is a socks.h system
12852 set socks.h i_socks
12853 eval $inhdr
12854
12855 : see if stdarg is available
12856 echo " "
12857 if $test `./findhdr stdarg.h`; then
12858         echo "<stdarg.h> found." >&4
12859         valstd="$define"
12860 else
12861         echo "<stdarg.h> NOT found." >&4
12862         valstd="$undef"
12863 fi
12864
12865 : see if varags is available
12866 echo " "
12867 if $test `./findhdr varargs.h`; then
12868         echo "<varargs.h> found." >&4
12869 else
12870         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12871 fi
12872
12873 : set up the varargs testing programs
12874 $cat > varargs.c <<EOP
12875 #ifdef I_STDARG
12876 #include <stdarg.h>
12877 #endif
12878 #ifdef I_VARARGS
12879 #include <varargs.h>
12880 #endif
12881
12882 #ifdef I_STDARG
12883 int f(char *p, ...)
12884 #else
12885 int f(va_alist)
12886 va_dcl
12887 #endif
12888 {
12889         va_list ap;
12890 #ifndef I_STDARG
12891         char *p;
12892 #endif
12893 #ifdef I_STDARG
12894         va_start(ap,p);
12895 #else
12896         va_start(ap);
12897         p = va_arg(ap, char *);
12898 #endif
12899         va_end(ap);
12900 }
12901 EOP
12902 $cat > varargs <<EOP
12903 $startsh
12904 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12905         echo "true"
12906 else
12907         echo "false"
12908 fi
12909 $rm -f varargs$_o
12910 EOP
12911 chmod +x varargs
12912
12913 : now check which varargs header should be included
12914 echo " "
12915 i_varhdr=''
12916 case "$valstd" in
12917 "$define")
12918         if `./varargs I_STDARG`; then
12919                 val='stdarg.h'
12920         elif `./varargs I_VARARGS`; then
12921                 val='varargs.h'
12922         fi
12923         ;;
12924 *)
12925         if `./varargs I_VARARGS`; then
12926                 val='varargs.h'
12927         fi
12928         ;;
12929 esac
12930 case "$val" in
12931 '')
12932 echo "I could not find the definition for va_dcl... You have problems..." >&4
12933         val="$undef"; set i_stdarg; eval $setvar
12934         val="$undef"; set i_varargs; eval $setvar
12935         ;;
12936 *) 
12937         set i_varhdr
12938         eval $setvar
12939         case "$i_varhdr" in
12940         stdarg.h)
12941                 val="$define"; set i_stdarg; eval $setvar
12942                 val="$undef"; set i_varargs; eval $setvar
12943                 ;;
12944         varargs.h)
12945                 val="$undef"; set i_stdarg; eval $setvar
12946                 val="$define"; set i_varargs; eval $setvar
12947                 ;;
12948         esac
12949         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12950 esac
12951 $rm -f varargs*
12952
12953 : see if stddef is available
12954 set stddef.h i_stddef
12955 eval $inhdr
12956
12957 : see if sys/access.h is available
12958 set sys/access.h i_sysaccess
12959 eval $inhdr
12960
12961 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12962 set sys/filio.h i_sysfilio
12963 eval $inhdr
12964 echo " "
12965 if $test `./findhdr sys/ioctl.h`; then
12966         val="$define"
12967         echo '<sys/ioctl.h> found.' >&4
12968 else
12969         val="$undef"
12970         if $test $i_sysfilio = "$define"; then
12971             echo '<sys/ioctl.h> NOT found.' >&4
12972         else
12973                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12974                 $test $i_termio = "$define" && xxx="termio.h"
12975                 $test $i_termios = "$define" && xxx="termios.h"
12976 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12977         fi
12978 fi
12979 set i_sysioctl
12980 eval $setvar
12981
12982 : see if sys/resource.h has to be included
12983 set sys/resource.h i_sysresrc
12984 eval $inhdr
12985
12986 : see if sys/security.h is available
12987 set sys/security.h i_syssecrt
12988 eval $inhdr
12989
12990 : see if this is a sys/statvfs.h system
12991 set sys/statvfs.h i_sysstatvfs
12992 eval $inhdr
12993
12994 : see if this is a sys/un.h system
12995 set sys/un.h i_sysun
12996 eval $inhdr
12997
12998 : see if this is a syswait system
12999 set sys/wait.h i_syswait
13000 eval $inhdr
13001
13002 : see if this is an utime system
13003 set utime.h i_utime
13004 eval $inhdr
13005
13006 : see if this is a values.h system
13007 set values.h i_values
13008 eval $inhdr
13009
13010 : see if this is a vfork system
13011 case "$d_vfork" in
13012 "$define")
13013         set vfork.h i_vfork
13014         eval $inhdr
13015         ;;
13016 *)
13017         i_vfork="$undef"
13018         ;;
13019 esac
13020
13021 : see if gdbm.h is available
13022 set gdbm.h t_gdbm
13023 eval $inhdr
13024 case "$t_gdbm" in
13025 $define)
13026         : see if gdbm_open exists
13027         set gdbm_open d_gdbm_open
13028         eval $inlibc
13029         case "$d_gdbm_open" in
13030         $undef)
13031                 t_gdbm="$undef"
13032                 echo "We won't be including <gdbm.h>"
13033                 ;;
13034         esac
13035         ;;
13036 esac
13037 val="$t_gdbm"
13038 set i_gdbm
13039 eval $setvar
13040
13041 echo " "
13042 echo "Looking for extensions..." >&4
13043 : If we are using the old config.sh, known_extensions may contain
13044 : old or inaccurate or duplicate values.
13045 known_extensions=''
13046 nonxs_extensions=''
13047 : We do not use find because it might not be available.
13048 : We do not just use MANIFEST because the user may have dropped
13049 : some additional extensions into the source tree and expect them
13050 : to be built.
13051
13052 : Function to recursively find available extensions, ignoring DynaLoader
13053 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13054 find_extensions='
13055     for xxx in *; do
13056        case "$xxx" in
13057            DynaLoader|dynaload) ;;
13058            *)
13059            if $test -f $xxx/$xxx.xs; then
13060                known_extensions="$known_extensions $1$xxx";
13061            elif $test -f $xxx/Makefile.PL; then
13062                nonxs_extensions="$nonxs_extensions $1$xxx";
13063            else
13064                if $test -d $xxx -a $# -lt 10; then
13065                    set $1$xxx/ $*;
13066                    cd $xxx;
13067                    eval $find_extensions;
13068                    cd ..;
13069                    shift;
13070                fi;
13071            fi
13072            ;;
13073        esac;
13074     done'
13075 tdir=`pwd`
13076 cd $rsrc/ext
13077 set X
13078 shift
13079 eval $find_extensions
13080 set X $nonxs_extensions
13081 shift
13082 nonxs_extensions="$*"
13083 set X $known_extensions
13084 shift
13085 known_extensions="$*"
13086 cd $tdir
13087
13088 : Now see which are supported on this system.
13089 avail_ext=''
13090 for xxx in $known_extensions ; do
13091         case "$xxx" in
13092         DB_File|db_file)
13093                 case "$i_db" in
13094                 $define) avail_ext="$avail_ext $xxx" ;;
13095                 esac
13096                 ;;
13097         GDBM_File|gdbm_fil)
13098                 case "$i_gdbm" in 
13099                 $define) avail_ext="$avail_ext $xxx" ;;
13100                 esac
13101                 ;;
13102         NDBM_File|ndbm_fil)
13103                 case "$i_ndbm" in
13104                 $define) avail_ext="$avail_ext $xxx" ;;
13105                 esac
13106                 ;;
13107         ODBM_File|odbm_fil) 
13108                 case "${i_dbm}${i_rpcsvcdbm}" in
13109                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13110                 esac
13111                 ;;
13112         POSIX|posix)
13113                 case "$useposix" in
13114                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13115                 esac
13116                 ;;
13117         Opcode|opcode)
13118                 case "$useopcode" in
13119                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13120                 esac
13121                 ;;
13122         Socket|socket)
13123                 case "$d_socket" in 
13124                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13125                 esac
13126                 ;;
13127         Thread|thread)
13128                 case "$usethreads" in 
13129                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13130                 esac
13131                 ;;
13132         IPC/SysV|ipc/sysv)
13133                 : XXX Do we need a useipcsysv variable here
13134                 case "${d_msg}${d_sem}${d_shm}" in 
13135                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13136                 esac
13137                 ;;
13138         *)      avail_ext="$avail_ext $xxx"
13139                 ;;
13140         esac
13141 done
13142
13143 set X $avail_ext
13144 shift
13145 avail_ext="$*"
13146
13147 : Now see which nonxs extensions are supported on this system.
13148 : For now assume all are.
13149 nonxs_ext=''
13150 for xxx in $nonxs_extensions ; do
13151         case "$xxx" in
13152         *)      nonxs_ext="$nonxs_ext $xxx"
13153                 ;;
13154         esac
13155 done
13156
13157 set X $nonxs_ext
13158 shift
13159 nonxs_ext="$*"
13160
13161 case $usedl in
13162 $define)
13163         $cat <<EOM
13164 A number of extensions are supplied with $package.  You may choose to
13165 compile these extensions for dynamic loading (the default), compile
13166 them into the $package executable (static loading), or not include
13167 them at all.  Answer "none" to include no extensions.
13168 Note that DynaLoader is always built and need not be mentioned here.
13169
13170 EOM
13171         case "$dynamic_ext" in
13172         '') dflt="$avail_ext" ;;
13173         *)      dflt="$dynamic_ext"
13174                 # Perhaps we are reusing an old out-of-date config.sh.
13175                 case "$hint" in
13176                 previous)
13177                         if test X"$dynamic_ext" != X"$avail_ext"; then
13178                                 $cat <<EOM
13179 NOTICE:  Your previous config.sh list may be incorrect. 
13180 The extensions now available to you are 
13181         ${avail_ext}
13182 but the default list from your previous config.sh is
13183         ${dynamic_ext} 
13184
13185 EOM
13186                         fi
13187                         ;;
13188                 esac
13189                 ;;
13190         esac
13191         case "$dflt" in
13192         '')     dflt=none;;
13193         esac
13194         rp="What extensions do you wish to load dynamically?"
13195         . ./myread
13196         case "$ans" in
13197         none) dynamic_ext=' ' ;;
13198         *) dynamic_ext="$ans" ;;
13199         esac
13200
13201         case "$static_ext" in
13202         '')
13203                 : Exclude those already listed in dynamic linking
13204                 dflt=''
13205                 for xxx in $avail_ext; do
13206                         case " $dynamic_ext " in
13207                         *" $xxx "*) ;;
13208                         *) dflt="$dflt $xxx" ;;
13209                         esac
13210                 done
13211                 set X $dflt
13212                 shift
13213                 dflt="$*"
13214                 ;;
13215         *)  dflt="$static_ext" 
13216                 ;;
13217         esac
13218
13219         case "$dflt" in
13220         '')     dflt=none;;
13221         esac
13222         rp="What extensions do you wish to load statically?"
13223         . ./myread
13224         case "$ans" in
13225         none) static_ext=' ' ;;
13226         *) static_ext="$ans" ;;
13227         esac
13228         ;;
13229 *)
13230         $cat <<EOM
13231 A number of extensions are supplied with $package.  Answer "none" 
13232 to include no extensions. 
13233 Note that DynaLoader is always built and need not be mentioned here.
13234
13235 EOM
13236         case "$static_ext" in
13237         '') dflt="$avail_ext" ;;
13238         *)      dflt="$static_ext"
13239                 # Perhaps we are reusing an old out-of-date config.sh.
13240                 case "$hint" in
13241                 previous)
13242                         if test X"$static_ext" != X"$avail_ext"; then
13243                                 $cat <<EOM
13244 NOTICE:  Your previous config.sh list may be incorrect. 
13245 The extensions now available to you are 
13246         ${avail_ext}
13247 but the default list from your previous config.sh is
13248         ${static_ext} 
13249
13250 EOM
13251                         fi
13252                         ;;
13253                 esac
13254                 ;;
13255         esac
13256         : Exclude those that are not xs extensions
13257         case "$dflt" in
13258         '')     dflt=none;;
13259         esac
13260         rp="What extensions do you wish to include?"
13261         . ./myread
13262         case "$ans" in
13263         none) static_ext=' ' ;;
13264         *) static_ext="$ans" ;;
13265         esac
13266         ;;
13267 esac
13268
13269 set X $dynamic_ext $static_ext $nonxs_ext
13270 shift
13271 extensions="$*"
13272
13273 : Remove build directory name from cppstdin so it can be used from
13274 : either the present location or the final installed location.
13275 echo " "
13276 : Get out of the UU directory to get correct path name.
13277 cd ..
13278 case "$cppstdin" in
13279 `pwd`/cppstdin)
13280         echo "Stripping down cppstdin path name"
13281         cppstdin=cppstdin
13282         ;;
13283 esac
13284 cd UU
13285
13286 : end of configuration questions
13287 echo " "
13288 echo "End of configuration questions."
13289 echo " "
13290
13291 : back to where it started
13292 if test -d ../UU; then
13293         cd ..
13294 fi
13295
13296 : configuration may be patched via a 'config.over' file
13297 if $test -f config.over; then
13298         echo " "
13299         dflt=y
13300         rp='I see a config.over file.  Do you wish to load it?'
13301         . UU/myread
13302         case "$ans" in
13303         n*) echo "OK, I'll ignore it.";;
13304         *)      . ./config.over
13305                 echo "Configuration override changes have been loaded."
13306                 ;;
13307         esac
13308 fi
13309
13310 : in case they want portability, strip down executable paths
13311 case "$d_portable" in
13312 "$define")
13313         echo " "
13314         echo "Stripping down executable paths..." >&4
13315         for file in $loclist $trylist; do
13316                 eval temp=\$$file
13317                 eval $file=`basename $temp`
13318         done
13319         ;;
13320 esac
13321
13322 : create config.sh file
13323 echo " "
13324 echo "Creating config.sh..." >&4
13325 $spitshell <<EOT >config.sh
13326 $startsh
13327 #
13328 # This file was produced by running the Configure script. It holds all the
13329 # definitions figured out by Configure. Should you modify one of these values,
13330 # do not forget to propagate your changes by running "Configure -der". You may
13331 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13332 #
13333
13334 # Package name      : $package
13335 # Source directory  : $src
13336 # Configuration time: $cf_time
13337 # Configured by     : $cf_by
13338 # Target system     : $myuname
13339
13340 Author='$Author'
13341 Date='$Date'
13342 Header='$Header'
13343 Id='$Id'
13344 Locker='$Locker'
13345 Log='$Log'
13346 Mcc='$Mcc'
13347 RCSfile='$RCSfile'
13348 Revision='$Revision'
13349 Source='$Source'
13350 State='$State'
13351 _a='$_a'
13352 _exe='$_exe'
13353 _o='$_o'
13354 afs='$afs'
13355 alignbytes='$alignbytes'
13356 ansi2knr='$ansi2knr'
13357 aphostname='$aphostname'
13358 apiversion='$apiversion'
13359 ar='$ar'
13360 archlib='$archlib'
13361 archlibexp='$archlibexp'
13362 archname64='$archname64'
13363 archname='$archname'
13364 archobjs='$archobjs'
13365 awk='$awk'
13366 baserev='$baserev'
13367 bash='$bash'
13368 bin='$bin'
13369 bincompat5005='$bincompat5005'
13370 binexp='$binexp'
13371 bison='$bison'
13372 byacc='$byacc'
13373 byteorder='$byteorder'
13374 c='$c'
13375 castflags='$castflags'
13376 cat='$cat'
13377 cc='$cc'
13378 cccdlflags='$cccdlflags'
13379 ccdlflags='$ccdlflags'
13380 ccflags='$ccflags'
13381 ccsymbols='$ccsymbols'
13382 cf_by='$cf_by'
13383 cf_email='$cf_email'
13384 cf_time='$cf_time'
13385 chgrp='$chgrp'
13386 chmod='$chmod'
13387 chown='$chown'
13388 clocktype='$clocktype'
13389 comm='$comm'
13390 compress='$compress'
13391 contains='$contains'
13392 cp='$cp'
13393 cpio='$cpio'
13394 cpp='$cpp'
13395 cpp_stuff='$cpp_stuff'
13396 cppccsymbols='$cppccsymbols'
13397 cppflags='$cppflags'
13398 cpplast='$cpplast'
13399 cppminus='$cppminus'
13400 cpprun='$cpprun'
13401 cppstdin='$cppstdin'
13402 cppsymbols='$cppsymbols'
13403 crosscompile='$crosscompile'
13404 cryptlib='$cryptlib'
13405 csh='$csh'
13406 d_Gconvert='$d_Gconvert'
13407 d_PRIEldbl='$d_PRIEldbl'
13408 d_PRIFldbl='$d_PRIFldbl'
13409 d_PRIGldbl='$d_PRIGldbl'
13410 d_PRIX64='$d_PRIX64'
13411 d_PRId64='$d_PRId64'
13412 d_PRIeldbl='$d_PRIeldbl'
13413 d_PRIfldbl='$d_PRIfldbl'
13414 d_PRIgldbl='$d_PRIgldbl'
13415 d_PRIi64='$d_PRIi64'
13416 d_PRIo64='$d_PRIo64'
13417 d_PRIu64='$d_PRIu64'
13418 d_PRIx64='$d_PRIx64'
13419 d_access='$d_access'
13420 d_accessx='$d_accessx'
13421 d_alarm='$d_alarm'
13422 d_archlib='$d_archlib'
13423 d_atolf='$d_atolf'
13424 d_atoll='$d_atoll'
13425 d_attribut='$d_attribut'
13426 d_bcmp='$d_bcmp'
13427 d_bcopy='$d_bcopy'
13428 d_bincompat5005='$d_bincompat5005'
13429 d_bsd='$d_bsd'
13430 d_bsdgetpgrp='$d_bsdgetpgrp'
13431 d_bsdsetpgrp='$d_bsdsetpgrp'
13432 d_bzero='$d_bzero'
13433 d_casti32='$d_casti32'
13434 d_castneg='$d_castneg'
13435 d_charvspr='$d_charvspr'
13436 d_chown='$d_chown'
13437 d_chroot='$d_chroot'
13438 d_chsize='$d_chsize'
13439 d_closedir='$d_closedir'
13440 d_cmsghdr_s='$d_cmsghdr_s'
13441 d_const='$d_const'
13442 d_crypt='$d_crypt'
13443 d_csh='$d_csh'
13444 d_cuserid='$d_cuserid'
13445 d_dbl_dig='$d_dbl_dig'
13446 d_difftime='$d_difftime'
13447 d_dirnamlen='$d_dirnamlen'
13448 d_dlerror='$d_dlerror'
13449 d_dlopen='$d_dlopen'
13450 d_dlsymun='$d_dlsymun'
13451 d_dosuid='$d_dosuid'
13452 d_drand48proto='$d_drand48proto'
13453 d_dup2='$d_dup2'
13454 d_eaccess='$d_eaccess'
13455 d_endgrent='$d_endgrent'
13456 d_endhent='$d_endhent'
13457 d_endnent='$d_endnent'
13458 d_endpent='$d_endpent'
13459 d_endpwent='$d_endpwent'
13460 d_endsent='$d_endsent'
13461 d_endspent='$d_endspent'
13462 d_eofnblk='$d_eofnblk'
13463 d_eunice='$d_eunice'
13464 d_fchmod='$d_fchmod'
13465 d_fchown='$d_fchown'
13466 d_fcntl='$d_fcntl'
13467 d_fd_macros='$d_fd_macros'
13468 d_fd_set='$d_fd_set'
13469 d_fds_bits='$d_fds_bits'
13470 d_fgetpos='$d_fgetpos'
13471 d_flexfnam='$d_flexfnam'
13472 d_flock='$d_flock'
13473 d_fork='$d_fork'
13474 d_fpathconf='$d_fpathconf'
13475 d_fpos64_t='$d_fpos64_t'
13476 d_fseeko='$d_fseeko'
13477 d_fsetpos='$d_fsetpos'
13478 d_fstatfs='$d_fstatfs'
13479 d_fstatvfs='$d_fstatvfs'
13480 d_ftello='$d_ftello'
13481 d_ftime='$d_ftime'
13482 d_getgrent='$d_getgrent'
13483 d_getgrps='$d_getgrps'
13484 d_gethbyaddr='$d_gethbyaddr'
13485 d_gethbyname='$d_gethbyname'
13486 d_gethent='$d_gethent'
13487 d_gethname='$d_gethname'
13488 d_gethostprotos='$d_gethostprotos'
13489 d_getlogin='$d_getlogin'
13490 d_getmntent='$d_getmntent'
13491 d_getnbyaddr='$d_getnbyaddr'
13492 d_getnbyname='$d_getnbyname'
13493 d_getnent='$d_getnent'
13494 d_getnetprotos='$d_getnetprotos'
13495 d_getpbyname='$d_getpbyname'
13496 d_getpbynumber='$d_getpbynumber'
13497 d_getpent='$d_getpent'
13498 d_getpgid='$d_getpgid'
13499 d_getpgrp2='$d_getpgrp2'
13500 d_getpgrp='$d_getpgrp'
13501 d_getppid='$d_getppid'
13502 d_getprior='$d_getprior'
13503 d_getprotoprotos='$d_getprotoprotos'
13504 d_getpwent='$d_getpwent'
13505 d_getsbyname='$d_getsbyname'
13506 d_getsbyport='$d_getsbyport'
13507 d_getsent='$d_getsent'
13508 d_getservprotos='$d_getservprotos'
13509 d_getspent='$d_getspent'
13510 d_getspnam='$d_getspnam'
13511 d_gettimeod='$d_gettimeod'
13512 d_gnulibc='$d_gnulibc'
13513 d_grpasswd='$d_grpasswd'
13514 d_hasmntopt='$d_hasmntopt'
13515 d_htonl='$d_htonl'
13516 d_index='$d_index'
13517 d_inetaton='$d_inetaton'
13518 d_int64t='$d_int64t'
13519 d_iovec_s='$d_iovec_s'
13520 d_isascii='$d_isascii'
13521 d_killpg='$d_killpg'
13522 d_lchown='$d_lchown'
13523 d_ldbl_dig='$d_ldbl_dig'
13524 d_link='$d_link'
13525 d_llseek='$d_llseek'
13526 d_locconv='$d_locconv'
13527 d_lockf='$d_lockf'
13528 d_longdbl='$d_longdbl'
13529 d_longlong='$d_longlong'
13530 d_lstat='$d_lstat'
13531 d_madvise='$d_madvise'
13532 d_mblen='$d_mblen'
13533 d_mbstowcs='$d_mbstowcs'
13534 d_mbtowc='$d_mbtowc'
13535 d_memchr='$d_memchr'
13536 d_memcmp='$d_memcmp'
13537 d_memcpy='$d_memcpy'
13538 d_memmove='$d_memmove'
13539 d_memset='$d_memset'
13540 d_mkdir='$d_mkdir'
13541 d_mkfifo='$d_mkfifo'
13542 d_mktime='$d_mktime'
13543 d_mmap='$d_mmap'
13544 d_mprotect='$d_mprotect'
13545 d_msg='$d_msg'
13546 d_msg_ctrunc='$d_msg_ctrunc'
13547 d_msg_dontroute='$d_msg_dontroute'
13548 d_msg_oob='$d_msg_oob'
13549 d_msg_peek='$d_msg_peek'
13550 d_msg_proxy='$d_msg_proxy'
13551 d_msgctl='$d_msgctl'
13552 d_msgget='$d_msgget'
13553 d_msghdr_s='$d_msghdr_s'
13554 d_msgrcv='$d_msgrcv'
13555 d_msgsnd='$d_msgsnd'
13556 d_msync='$d_msync'
13557 d_munmap='$d_munmap'
13558 d_mymalloc='$d_mymalloc'
13559 d_nice='$d_nice'
13560 d_off64_t='$d_off64_t'
13561 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13562 d_oldpthreads='$d_oldpthreads'
13563 d_oldsock='$d_oldsock'
13564 d_open3='$d_open3'
13565 d_pathconf='$d_pathconf'
13566 d_pause='$d_pause'
13567 d_phostname='$d_phostname'
13568 d_pipe='$d_pipe'
13569 d_poll='$d_poll'
13570 d_portable='$d_portable'
13571 d_pthread_yield='$d_pthread_yield'
13572 d_pwage='$d_pwage'
13573 d_pwchange='$d_pwchange'
13574 d_pwclass='$d_pwclass'
13575 d_pwcomment='$d_pwcomment'
13576 d_pwexpire='$d_pwexpire'
13577 d_pwgecos='$d_pwgecos'
13578 d_pwpasswd='$d_pwpasswd'
13579 d_pwquota='$d_pwquota'
13580 d_readdir='$d_readdir'
13581 d_readlink='$d_readlink'
13582 d_readv='$d_readv'
13583 d_recvmsg='$d_recvmsg'
13584 d_rename='$d_rename'
13585 d_rewinddir='$d_rewinddir'
13586 d_rmdir='$d_rmdir'
13587 d_safebcpy='$d_safebcpy'
13588 d_safemcpy='$d_safemcpy'
13589 d_sanemcmp='$d_sanemcmp'
13590 d_sched_yield='$d_sched_yield'
13591 d_scm_rights='$d_scm_rights'
13592 d_seekdir='$d_seekdir'
13593 d_select='$d_select'
13594 d_sem='$d_sem'
13595 d_semctl='$d_semctl'
13596 d_semctl_semid_ds='$d_semctl_semid_ds'
13597 d_semctl_semun='$d_semctl_semun'
13598 d_semget='$d_semget'
13599 d_semop='$d_semop'
13600 d_sendmsg='$d_sendmsg'
13601 d_setegid='$d_setegid'
13602 d_seteuid='$d_seteuid'
13603 d_setgrent='$d_setgrent'
13604 d_setgrps='$d_setgrps'
13605 d_sethent='$d_sethent'
13606 d_setlinebuf='$d_setlinebuf'
13607 d_setlocale='$d_setlocale'
13608 d_setnent='$d_setnent'
13609 d_setpent='$d_setpent'
13610 d_setpgid='$d_setpgid'
13611 d_setpgrp2='$d_setpgrp2'
13612 d_setpgrp='$d_setpgrp'
13613 d_setprior='$d_setprior'
13614 d_setpwent='$d_setpwent'
13615 d_setregid='$d_setregid'
13616 d_setresgid='$d_setresgid'
13617 d_setresuid='$d_setresuid'
13618 d_setreuid='$d_setreuid'
13619 d_setrgid='$d_setrgid'
13620 d_setruid='$d_setruid'
13621 d_setsent='$d_setsent'
13622 d_setsid='$d_setsid'
13623 d_setspent='$d_setspent'
13624 d_setvbuf='$d_setvbuf'
13625 d_sfio='$d_sfio'
13626 d_shm='$d_shm'
13627 d_shmat='$d_shmat'
13628 d_shmatprototype='$d_shmatprototype'
13629 d_shmctl='$d_shmctl'
13630 d_shmdt='$d_shmdt'
13631 d_shmget='$d_shmget'
13632 d_sigaction='$d_sigaction'
13633 d_sigsetjmp='$d_sigsetjmp'
13634 d_socket='$d_socket'
13635 d_sockpair='$d_sockpair'
13636 d_statblks='$d_statblks'
13637 d_statfs='$d_statfs'
13638 d_statfsflags='$d_statfsflags'
13639 d_statvfs='$d_statvfs'
13640 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13641 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13642 d_stdio_stream_array='$d_stdio_stream_array'
13643 d_stdiobase='$d_stdiobase'
13644 d_stdstdio='$d_stdstdio'
13645 d_strchr='$d_strchr'
13646 d_strcoll='$d_strcoll'
13647 d_strctcpy='$d_strctcpy'
13648 d_strerrm='$d_strerrm'
13649 d_strerror='$d_strerror'
13650 d_strtod='$d_strtod'
13651 d_strtol='$d_strtol'
13652 d_strtoul='$d_strtoul'
13653 d_strtoull='$d_strtoull'
13654 d_strxfrm='$d_strxfrm'
13655 d_suidsafe='$d_suidsafe'
13656 d_symlink='$d_symlink'
13657 d_syscall='$d_syscall'
13658 d_sysconf='$d_sysconf'
13659 d_sysernlst='$d_sysernlst'
13660 d_syserrlst='$d_syserrlst'
13661 d_system='$d_system'
13662 d_tcgetpgrp='$d_tcgetpgrp'
13663 d_tcsetpgrp='$d_tcsetpgrp'
13664 d_telldir='$d_telldir'
13665 d_telldirproto='$d_telldirproto'
13666 d_time='$d_time'
13667 d_times='$d_times'
13668 d_truncate='$d_truncate'
13669 d_tzname='$d_tzname'
13670 d_umask='$d_umask'
13671 d_uname='$d_uname'
13672 d_union_semun='$d_union_semun'
13673 d_vendorlib='$d_vendorlib'
13674 d_vfork='$d_vfork'
13675 d_void_closedir='$d_void_closedir'
13676 d_voidsig='$d_voidsig'
13677 d_voidtty='$d_voidtty'
13678 d_volatile='$d_volatile'
13679 d_vprintf='$d_vprintf'
13680 d_wait4='$d_wait4'
13681 d_waitpid='$d_waitpid'
13682 d_wcstombs='$d_wcstombs'
13683 d_wctomb='$d_wctomb'
13684 d_writev='$d_writev'
13685 d_xenix='$d_xenix'
13686 date='$date'
13687 db_hashtype='$db_hashtype'
13688 db_prefixtype='$db_prefixtype'
13689 defvoidused='$defvoidused'
13690 direntrytype='$direntrytype'
13691 dlext='$dlext'
13692 dlsrc='$dlsrc'
13693 doublesize='$doublesize'
13694 drand01='$drand01'
13695 dynamic_ext='$dynamic_ext'
13696 eagain='$eagain'
13697 ebcdic='$ebcdic'
13698 echo='$echo'
13699 egrep='$egrep'
13700 emacs='$emacs'
13701 eunicefix='$eunicefix'
13702 exe_ext='$exe_ext'
13703 expr='$expr'
13704 extensions='$extensions'
13705 fflushNULL='$fflushNULL'
13706 fflushall='$fflushall'
13707 find='$find'
13708 firstmakefile='$firstmakefile'
13709 flex='$flex'
13710 fpostype='$fpostype'
13711 freetype='$freetype'
13712 full_ar='$full_ar'
13713 full_csh='$full_csh'
13714 full_sed='$full_sed'
13715 gccversion='$gccversion'
13716 gidtype='$gidtype'
13717 glibpth='$glibpth'
13718 grep='$grep'
13719 groupcat='$groupcat'
13720 groupstype='$groupstype'
13721 gzip='$gzip'
13722 h_fcntl='$h_fcntl'
13723 h_sysfile='$h_sysfile'
13724 hint='$hint'
13725 hostcat='$hostcat'
13726 huge='$huge'
13727 i_arpainet='$i_arpainet'
13728 i_bsdioctl='$i_bsdioctl'
13729 i_db='$i_db'
13730 i_dbm='$i_dbm'
13731 i_dirent='$i_dirent'
13732 i_dld='$i_dld'
13733 i_dlfcn='$i_dlfcn'
13734 i_fcntl='$i_fcntl'
13735 i_float='$i_float'
13736 i_gdbm='$i_gdbm'
13737 i_grp='$i_grp'
13738 i_inttypes='$i_inttypes'
13739 i_limits='$i_limits'
13740 i_locale='$i_locale'
13741 i_machcthr='$i_machcthr'
13742 i_malloc='$i_malloc'
13743 i_math='$i_math'
13744 i_memory='$i_memory'
13745 i_mntent='$i_mntent'
13746 i_ndbm='$i_ndbm'
13747 i_netdb='$i_netdb'
13748 i_neterrno='$i_neterrno'
13749 i_netinettcp='$i_netinettcp'
13750 i_niin='$i_niin'
13751 i_poll='$i_poll'
13752 i_pthread='$i_pthread'
13753 i_pwd='$i_pwd'
13754 i_rpcsvcdbm='$i_rpcsvcdbm'
13755 i_sfio='$i_sfio'
13756 i_sgtty='$i_sgtty'
13757 i_shadow='$i_shadow'
13758 i_socks='$i_socks'
13759 i_stdarg='$i_stdarg'
13760 i_stddef='$i_stddef'
13761 i_stdlib='$i_stdlib'
13762 i_string='$i_string'
13763 i_sysaccess='$i_sysaccess'
13764 i_sysdir='$i_sysdir'
13765 i_sysfile='$i_sysfile'
13766 i_sysfilio='$i_sysfilio'
13767 i_sysin='$i_sysin'
13768 i_sysioctl='$i_sysioctl'
13769 i_sysmman='$i_sysmman'
13770 i_sysmount='$i_sysmount'
13771 i_sysndir='$i_sysndir'
13772 i_sysparam='$i_sysparam'
13773 i_sysresrc='$i_sysresrc'
13774 i_syssecrt='$i_syssecrt'
13775 i_sysselct='$i_sysselct'
13776 i_syssockio='$i_syssockio'
13777 i_sysstat='$i_sysstat'
13778 i_sysstatvfs='$i_sysstatvfs'
13779 i_systime='$i_systime'
13780 i_systimek='$i_systimek'
13781 i_systimes='$i_systimes'
13782 i_systypes='$i_systypes'
13783 i_sysuio='$i_sysuio'
13784 i_sysun='$i_sysun'
13785 i_syswait='$i_syswait'
13786 i_termio='$i_termio'
13787 i_termios='$i_termios'
13788 i_time='$i_time'
13789 i_unistd='$i_unistd'
13790 i_utime='$i_utime'
13791 i_values='$i_values'
13792 i_varargs='$i_varargs'
13793 i_varhdr='$i_varhdr'
13794 i_vfork='$i_vfork'
13795 ignore_versioned_solibs='$ignore_versioned_solibs'
13796 incpath='$incpath'
13797 inews='$inews'
13798 installarchlib='$installarchlib'
13799 installbin='$installbin'
13800 installman1dir='$installman1dir'
13801 installman3dir='$installman3dir'
13802 installprefix='$installprefix'
13803 installprefixexp='$installprefixexp'
13804 installprivlib='$installprivlib'
13805 installscript='$installscript'
13806 installsitearch='$installsitearch'
13807 installsitelib='$installsitelib'
13808 installstyle='$installstyle'
13809 installusrbinperl='$installusrbinperl'
13810 installvendorlib='$installvendorlib'
13811 intsize='$intsize'
13812 known_extensions='$known_extensions'
13813 ksh='$ksh'
13814 large='$large'
13815 ld='$ld'
13816 lddlflags='$lddlflags'
13817 ldflags='$ldflags'
13818 ldlibpthname='$ldlibpthname'
13819 less='$less'
13820 lib_ext='$lib_ext'
13821 libc='$libc'
13822 libperl='$libperl'
13823 libpth='$libpth'
13824 libs='$libs'
13825 libswanted='$libswanted'
13826 line='$line'
13827 lint='$lint'
13828 lkflags='$lkflags'
13829 ln='$ln'
13830 lns='$lns'
13831 locincpth='$locincpth'
13832 loclibpth='$loclibpth'
13833 longdblsize='$longdblsize'
13834 longlongsize='$longlongsize'
13835 longsize='$longsize'
13836 lp='$lp'
13837 lpr='$lpr'
13838 ls='$ls'
13839 lseeksize='$lseeksize'
13840 lseektype='$lseektype'
13841 mail='$mail'
13842 mailx='$mailx'
13843 make='$make'
13844 make_set_make='$make_set_make'
13845 mallocobj='$mallocobj'
13846 mallocsrc='$mallocsrc'
13847 malloctype='$malloctype'
13848 man1dir='$man1dir'
13849 man1direxp='$man1direxp'
13850 man1ext='$man1ext'
13851 man3dir='$man3dir'
13852 man3direxp='$man3direxp'
13853 man3ext='$man3ext'
13854 medium='$medium'
13855 mips='$mips'
13856 mips_type='$mips_type'
13857 mkdir='$mkdir'
13858 mmaptype='$mmaptype'
13859 models='$models'
13860 modetype='$modetype'
13861 more='$more'
13862 multiarch='$multiarch'
13863 mv='$mv'
13864 myarchname='$myarchname'
13865 mydomain='$mydomain'
13866 myhostname='$myhostname'
13867 myuname='$myuname'
13868 n='$n'
13869 netdb_hlen_type='$netdb_hlen_type'
13870 netdb_host_type='$netdb_host_type'
13871 netdb_name_type='$netdb_name_type'
13872 netdb_net_type='$netdb_net_type'
13873 nm='$nm'
13874 nm_opt='$nm_opt'
13875 nm_so_opt='$nm_so_opt'
13876 nonxs_ext='$nonxs_ext'
13877 nroff='$nroff'
13878 o_nonblock='$o_nonblock'
13879 obj_ext='$obj_ext'
13880 old_pthread_create_joinable='$old_pthread_create_joinable'
13881 optimize='$optimize'
13882 orderlib='$orderlib'
13883 osname='$osname'
13884 osvers='$osvers'
13885 package='$package'
13886 pager='$pager'
13887 passcat='$passcat'
13888 patchlevel='$patchlevel'
13889 path_sep='$path_sep'
13890 perl='$perl'
13891 perladmin='$perladmin'
13892 perlpath='$perlpath'
13893 pg='$pg'
13894 phostname='$phostname'
13895 pidtype='$pidtype'
13896 plibpth='$plibpth'
13897 pmake='$pmake'
13898 pr='$pr'
13899 prefix='$prefix'
13900 prefixexp='$prefixexp'
13901 privlib='$privlib'
13902 privlibexp='$privlibexp'
13903 prototype='$prototype'
13904 ptrsize='$ptrsize'
13905 randbits='$randbits'
13906 randfunc='$randfunc'
13907 randseedtype='$randseedtype'
13908 ranlib='$ranlib'
13909 rd_nodata='$rd_nodata'
13910 rm='$rm'
13911 rmail='$rmail'
13912 runnm='$runnm'
13913 sPRIEldbl='$sPRIEldbl'
13914 sPRIFldbl='$sPRIFldbl'
13915 sPRIGldbl='$sPRIGldbl'
13916 sPRIX64='$sPRIX64'
13917 sPRId64='$sPRId64'
13918 sPRIeldbl='$sPRIeldbl'
13919 sPRIfldbl='$sPRIfldbl'
13920 sPRIgldbl='$sPRIgldbl'
13921 sPRIi64='$sPRIi64'
13922 sPRIo64='$sPRIo64'
13923 sPRIu64='$sPRIu64'
13924 sPRIx64='$sPRIx64'
13925 sched_yield='$sched_yield'
13926 scriptdir='$scriptdir'
13927 scriptdirexp='$scriptdirexp'
13928 sed='$sed'
13929 seedfunc='$seedfunc'
13930 selectminbits='$selectminbits'
13931 selecttype='$selecttype'
13932 sendmail='$sendmail'
13933 sh='$sh'
13934 shar='$shar'
13935 sharpbang='$sharpbang'
13936 shmattype='$shmattype'
13937 shortsize='$shortsize'
13938 shrpenv='$shrpenv'
13939 shsharp='$shsharp'
13940 sig_count='$sig_count'
13941 sig_name='$sig_name'
13942 sig_name_init='$sig_name_init'
13943 sig_num='$sig_num'
13944 sig_num_init='$sig_num_init'
13945 signal_t='$signal_t'
13946 sitearch='$sitearch'
13947 sitearchexp='$sitearchexp'
13948 sitelib='$sitelib'
13949 sitelibexp='$sitelibexp'
13950 siteprefix='$siteprefix'
13951 siteprefixexp='$siteprefixexp'
13952 sizetype='$sizetype'
13953 sleep='$sleep'
13954 smail='$smail'
13955 small='$small'
13956 so='$so'
13957 sockethdr='$sockethdr'
13958 socketlib='$socketlib'
13959 sort='$sort'
13960 spackage='$spackage'
13961 spitshell='$spitshell'
13962 split='$split'
13963 src='$src'
13964 ssizetype='$ssizetype'
13965 startperl='$startperl'
13966 startsh='$startsh'
13967 static_ext='$static_ext'
13968 stdchar='$stdchar'
13969 stdio_base='$stdio_base'
13970 stdio_bufsiz='$stdio_bufsiz'
13971 stdio_cnt='$stdio_cnt'
13972 stdio_filbuf='$stdio_filbuf'
13973 stdio_ptr='$stdio_ptr'
13974 stdio_stream_array='$stdio_stream_array'
13975 strings='$strings'
13976 submit='$submit'
13977 subversion='$subversion'
13978 sysman='$sysman'
13979 tail='$tail'
13980 tar='$tar'
13981 tbl='$tbl'
13982 tee='$tee'
13983 test='$test'
13984 timeincl='$timeincl'
13985 timetype='$timetype'
13986 touch='$touch'
13987 tr='$tr'
13988 trnl='$trnl'
13989 troff='$troff'
13990 uidtype='$uidtype'
13991 uname='$uname'
13992 uniq='$uniq'
13993 use64bits='$use64bits'
13994 usedl='$usedl'
13995 uselfs='$uselfs'
13996 uselongdouble='$uselongdouble'
13997 usemorebits='$usemorebits'
13998 usemultiplicity='$usemultiplicity'
13999 usemymalloc='$usemymalloc'
14000 usenm='$usenm'
14001 useopcode='$useopcode'
14002 useperlio='$useperlio'
14003 useposix='$useposix'
14004 usesfio='$usesfio'
14005 useshrplib='$useshrplib'
14006 usesocks='$usesocks'
14007 usethreads='$usethreads'
14008 usevendorprefix='$usevendorprefix'
14009 usevfork='$usevfork'
14010 usrinc='$usrinc'
14011 uuname='$uuname'
14012 vendorlib='$vendorlib'
14013 vendorlibexp='$vendorlibexp'
14014 vendorprefix='$vendorprefix'
14015 vendorprefixexp='$vendorprefixexp'
14016 version='$version'
14017 vi='$vi'
14018 voidflags='$voidflags'
14019 xlibpth='$xlibpth'
14020 zcat='$zcat'
14021 zip='$zip'
14022 EOT
14023
14024 : Add in command line options if available
14025 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14026
14027 : add special variables
14028 $test -f $src/patchlevel.h && \
14029 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14030 echo "CONFIGDOTSH=true" >>config.sh
14031
14032 : propagate old symbols
14033 if $test -f UU/config.sh; then
14034         <UU/config.sh sort | uniq >UU/oldconfig.sh
14035         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14036         sort | uniq -u >UU/oldsyms
14037         set X `cat UU/oldsyms`
14038         shift
14039         case $# in
14040         0) ;;
14041         *)
14042                 cat <<EOM
14043 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14044 EOM
14045                 echo "# Variables propagated from previous config.sh file." >>config.sh
14046                 for sym in `cat UU/oldsyms`; do
14047                         echo "    Propagating $hint variable "'$'"$sym..."
14048                         eval 'tmp="$'"${sym}"'"'
14049                         echo "$tmp" | \
14050                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14051                 done
14052                 ;;
14053         esac
14054 fi
14055
14056 : Finish up by extracting the .SH files
14057 case "$alldone" in
14058 exit)
14059         $rm -rf UU
14060         echo "Done."
14061         exit 0
14062         ;;
14063 cont)
14064         ;;
14065 '')
14066         dflt=''
14067         nostick=true
14068         $cat <<EOM
14069
14070 If you'd like to make any changes to the config.sh file before I begin
14071 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14072
14073 EOM
14074         rp="Press return or use a shell escape to edit config.sh:"
14075         . UU/myread
14076         nostick=''
14077         case "$ans" in
14078         '') ;;
14079         *) : in case they cannot read
14080                 sh 1>&4 -c "$ans";;
14081         esac
14082         ;;
14083 esac
14084
14085 : if this fails, just run all the .SH files by hand
14086 . ./config.sh
14087
14088 echo " "
14089 exec 1>&4
14090 . ./UU/extract
14091
14092 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14093         dflt=y
14094         case "$silent" in
14095         true) ;;
14096         *)
14097                 $cat <<EOM
14098
14099 Now you need to generate make dependencies by running "$make depend".
14100 You might prefer to run it in background: "$make depend > makedepend.out &"
14101 It can take a while, so you might not want to run it right now.
14102
14103 EOM
14104                 ;;
14105         esac
14106         rp="Run $make depend now?"
14107         . UU/myread
14108         case "$ans" in
14109         y*)
14110                 $make depend && echo "Now you must run a $make."
14111                 ;;
14112         *)
14113                 echo "You must run '$make depend' then '$make'."
14114                 ;;
14115         esac
14116 elif test -f [Mm]akefile; then
14117         echo " "
14118         echo "Now you must run a $make."
14119 else
14120         echo "Done."
14121 fi
14122
14123 if $test -f Policy.sh; then
14124     $cat <<EOM
14125
14126 If you compile $package on a different machine or from a different object
14127 directory, copy the Policy.sh file from this object directory to the
14128 new one before you run Configure -- this will help you with most of
14129 the policy defaults.
14130
14131 EOM
14132 fi
14133 if $test -f config.msg; then
14134     echo "Hmm.  I also noted the following information while running:"
14135     echo " "
14136     $cat config.msg >&4
14137     $rm -f config.msg
14138 fi
14139 $rm -f kit*isdone ark*isdone
14140 $rm -rf UU
14141
14142 : End of Configure
14143