ab41b667ca5693eacf52d6b81f1d73abe252cab3
[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:40:23 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
3031 cat <<EOM
3032
3033 Perl can be built to understand large files (files larger than 2 gigabytes)
3034 on some systems.  To do so, Configure must be run with -Duselfs.
3035
3036 If this doesn't make any sense to you, just accept the default.
3037 EOM
3038 case "$uselfs" in
3039 "$define"|true|[yY]*) dflt='y' ;;
3040 *)      dflt='n' ;;
3041 esac
3042 rp='Try to understand large files?'
3043 . ./myread
3044 case "$ans" in
3045 y|Y)    val="$define" ;;
3046 *)      val="$undef"  ;;
3047 esac
3048 set uselfs
3049 eval $setvar
3050 case "$uselfs" in
3051 "$define") use64bits="$define" ;;
3052 esac
3053
3054 cat <<EOM
3055
3056 Perl can be built to take advantage of explicit 64-bit interfaces,
3057 on some systems.  To do so, Configure must be run with -Duse64bits.
3058
3059 If this doesn't make any sense to you, just accept the default.
3060 EOM
3061 case "$use64bits" in
3062 $define|true|[yY]*)     dflt='y';;
3063 *) dflt='n';;
3064 esac
3065 rp='Try to use explicit 64-bit interfaces, if available?'
3066 . ./myread
3067 case "$ans" in
3068 y|Y) 
3069         val="$define"
3070         ;;     
3071 *)      
3072         val="$undef"
3073         ;;
3074 esac
3075 set use64bits
3076 eval $setvar
3077
3078 case "$archname64" in
3079 '') archname64='' ;;    # not a typo
3080 esac
3081
3082 case "$use64bits" in
3083 "$define"|true|[yY]*)
3084 : Look for a hint-file generated 'call-back-unit'.  If the
3085 : user has specified that a 64 bit perl is to be built,
3086 : we may need to set or change some other defaults.
3087         if $test -f use64bits.cbu; then
3088                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3089                 . ./use64bits.cbu
3090         else
3091                 $cat <<EOM
3092 (Your platform doesn't have any specific hints for 64-bit builds.
3093  This is probably okay, especially if your system is a true 64-bit system.)
3094 EOM
3095                 case "$gccversion" in
3096                 '')     ;;
3097                 *)      $cat <<EOM
3098 But since you seem to be using gcc,
3099 I will now add -DUSE_LONG_LONG to the compilation flags.
3100 EOM
3101                         ccflags="$ccflags -DUSE_LONG_LONG"
3102                         ;;
3103                 esac
3104         fi
3105         ;;
3106 esac
3107
3108 : determine the architecture name
3109 echo " "
3110 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3111         tarch=`arch`"-$osname"
3112 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3113         if uname -m > tmparch 2>&1 ; then
3114                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3115                         -e 's/$/'"-$osname/" tmparch`
3116         else
3117                 tarch="$osname"
3118         fi
3119         $rm -f tmparch
3120 else
3121         tarch="$osname"
3122 fi
3123 case "$myarchname" in
3124 ''|"$tarch") ;;
3125 *)
3126         echo "(Your architecture name used to be $myarchname.)"
3127         archname=''
3128         ;;
3129 esac
3130 myarchname="$tarch"
3131 case "$archname" in
3132 '') dflt="$tarch";;
3133 *) dflt="$archname";;
3134 esac
3135 rp='What is your architecture name'
3136 . ./myread
3137 archname="$ans"
3138 case "$usethreads" in
3139 $define)
3140         echo "Threads selected." >&4
3141         case "$archname" in
3142         *-thread*) echo "...and architecture name already has -thread." >&4
3143                 ;;
3144         *)      archname="$archname-thread"
3145                 echo "...setting architecture name to $archname." >&4
3146                 ;;
3147         esac
3148         ;;
3149 esac
3150 case "$usemultiplicity" in
3151 $define)
3152         echo "Multiplicity selected." >&4
3153         case "$archname" in
3154         *-multi*) echo "...and architecture name already has -multi." >&4
3155                 ;;
3156         *)      archname="$archname-multi"
3157                 echo "...setting architecture name to $archname." >&4
3158                 ;;
3159         esac
3160         ;;
3161 esac
3162 case "$use64bits" in
3163 $define)
3164         echo "Explicit 64-bitness selected." >&4
3165         case "$archname64" in
3166         '')
3167                 ;;
3168         *)
3169                 case "$archname" in
3170                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3171                         ;;
3172                 *)      archname="$archname-$archname64"
3173                         echo "...setting architecture name to $archname." >&4
3174                         ;;
3175                 esac
3176                 ;;
3177         esac
3178 esac
3179
3180 : decide how portable to be.  Allow command line overrides.
3181 case "$d_portable" in
3182 "$undef") ;;
3183 *)      d_portable="$define" ;;
3184 esac
3185
3186 : set up shell script to do ~ expansion
3187 cat >filexp <<EOSS
3188 $startsh
3189 : expand filename
3190 case "\$1" in
3191  ~/*|~)
3192         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3193         ;;
3194  ~*)
3195         if $test -f /bin/csh; then
3196                 /bin/csh -f -c "glob \$1"
3197                 failed=\$?
3198                 echo ""
3199                 exit \$failed
3200         else
3201                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3202                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3203                 if $test ! -d "\$dir"; then
3204                         me=\`basename \$0\`
3205                         echo "\$me: can't locate home directory for: \$name" >&2
3206                         exit 1
3207                 fi
3208                 case "\$1" in
3209                 */*)
3210                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3211                         ;;
3212                 *)
3213                         echo \$dir
3214                         ;;
3215                 esac
3216         fi
3217         ;;
3218 *)
3219         echo \$1
3220         ;;
3221 esac
3222 EOSS
3223 chmod +x filexp
3224 $eunicefix filexp
3225
3226 : now set up to get a file name
3227 cat <<EOS >getfile
3228 $startsh
3229 EOS
3230 cat <<'EOSC' >>getfile
3231 tilde=''
3232 fullpath=''
3233 already=''
3234 skip=''
3235 none_ok=''
3236 exp_file=''
3237 nopath_ok=''
3238 orig_rp="$rp"
3239 orig_dflt="$dflt"
3240 case "$gfpth" in
3241 '') gfpth='.' ;;
3242 esac
3243
3244 case "$fn" in
3245 *\(*)
3246         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3247         fn=`echo $fn | sed 's/(.*)//'`
3248         ;;
3249 esac
3250
3251 case "$fn" in
3252 *:*)
3253         loc_file=`expr $fn : '.*:\(.*\)'`
3254         fn=`expr $fn : '\(.*\):.*'`
3255         ;;
3256 esac
3257
3258 case "$fn" in
3259 *~*) tilde=true;;
3260 esac
3261 case "$fn" in
3262 */*) fullpath=true;;
3263 esac
3264 case "$fn" in
3265 *+*) skip=true;;
3266 esac
3267 case "$fn" in
3268 *n*) none_ok=true;;
3269 esac
3270 case "$fn" in
3271 *e*) exp_file=true;;
3272 esac
3273 case "$fn" in
3274 *p*) nopath_ok=true;;
3275 esac
3276
3277 case "$fn" in
3278 *f*) type='File';;
3279 *d*) type='Directory';;
3280 *l*) type='Locate';;
3281 esac
3282
3283 what="$type"
3284 case "$what" in
3285 Locate) what='File';;
3286 esac
3287
3288 case "$exp_file" in
3289 '')
3290         case "$d_portable" in
3291         "$define") ;;
3292         *) exp_file=true;;
3293         esac
3294         ;;
3295 esac
3296
3297 cd ..
3298 while test "$type"; do
3299         redo=''
3300         rp="$orig_rp"
3301         dflt="$orig_dflt"
3302         case "$tilde" in
3303         true) rp="$rp (~name ok)";;
3304         esac
3305         . UU/myread
3306         if test -f UU/getfile.ok && \
3307                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3308         then
3309                 value="$ans"
3310                 ansexp="$ans"
3311                 break
3312         fi
3313         case "$ans" in
3314         none)
3315                 value=''
3316                 ansexp=''
3317                 case "$none_ok" in
3318                 true) type='';;
3319                 esac
3320                 ;;
3321         *)
3322                 case "$tilde" in
3323                 '') value="$ans"
3324                         ansexp="$ans";;
3325                 *)
3326                         value=`UU/filexp $ans`
3327                         case $? in
3328                         0)
3329                                 if test "$ans" != "$value"; then
3330                                         echo "(That expands to $value on this system.)"
3331                                 fi
3332                                 ;;
3333                         *) value="$ans";;
3334                         esac
3335                         ansexp="$value"
3336                         case "$exp_file" in
3337                         '') value="$ans";;
3338                         esac
3339                         ;;
3340                 esac
3341                 case "$fullpath" in
3342                 true)
3343                         case "$ansexp" in
3344                         /*) value="$ansexp" ;;
3345                         *)
3346                                 redo=true
3347                                 case "$already" in
3348                                 true)
3349                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3350                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3351                                         ;;
3352                                 *)
3353                                 echo "Please give a full path name, starting with slash." >&4
3354                                         case "$tilde" in
3355                                         true)
3356                                 echo "Note that using ~name is ok provided it expands well." >&4
3357                                                 already=true
3358                                                 ;;
3359                                         esac
3360                                 esac
3361                                 ;;
3362                         esac
3363                         ;;
3364                 esac
3365                 case "$redo" in
3366                 '')
3367                         case "$type" in
3368                         File)
3369                                 for fp in $gfpth; do
3370                                         if test "X$fp" = X.; then
3371                                             pf="$ansexp"
3372                                         else    
3373                                             pf="$fp/$ansexp"
3374                                         fi
3375                                         if test -f "$pf"; then
3376                                                 type=''
3377                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3378                                         then
3379                                                 echo "($value is not a plain file, but that's ok.)"
3380                                                 type=''
3381                                         fi
3382                                         if test X"$type" = X; then
3383                                             value="$pf"
3384                                             break
3385                                         fi
3386                                 done
3387                                 ;;
3388                         Directory)
3389                                 for fp in $gfpth; do
3390                                         if test "X$fp" = X.; then
3391                                             pf="$ansexp"
3392                                         else    
3393                                             pf="$fp/$ansexp"
3394                                         fi
3395                                         if test -d "$pf"; then
3396                                                 type=''
3397                                                 value="$pf"
3398                                                 break
3399                                         fi
3400                                 done
3401                                 ;;
3402                         Locate)
3403                                 if test -d "$ansexp"; then
3404                                         echo "(Looking for $loc_file in directory $value.)"
3405                                         value="$value/$loc_file"
3406                                         ansexp="$ansexp/$loc_file"
3407                                 fi
3408                                 if test -f "$ansexp"; then
3409                                         type=''
3410                                 fi
3411                                 case "$nopath_ok" in
3412                                 true)   case "$value" in
3413                                         */*) ;;
3414                                         *)      echo "Assuming $value will be in people's path."
3415                                                 type=''
3416                                                 ;;
3417                                         esac
3418                                         ;;
3419                                 esac
3420                                 ;;
3421                         esac
3422
3423                         case "$skip" in
3424                         true) type='';
3425                         esac
3426
3427                         case "$type" in
3428                         '') ;;
3429                         *)
3430                                 if test "$fastread" = yes; then
3431                                         dflt=y
3432                                 else
3433                                         dflt=n
3434                                 fi
3435                                 rp="$what $value doesn't exist.  Use that name anyway?"
3436                                 . UU/myread
3437                                 dflt=''
3438                                 case "$ans" in
3439                                 y*) type='';;
3440                                 *) echo " ";;
3441                                 esac
3442                                 ;;
3443                         esac
3444                         ;;
3445                 esac
3446                 ;;
3447         esac
3448 done
3449 cd UU
3450 ans="$value"
3451 rp="$orig_rp"
3452 dflt="$orig_dflt"
3453 rm -f getfile.ok
3454 test "X$gfpthkeep" != Xy && gfpth=""
3455 EOSC
3456
3457 : determine root of directory hierarchy where package will be installed.
3458 case "$prefix" in
3459 '')
3460         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3461         ;;
3462 *)
3463         dflt="$prefix"
3464         ;;
3465 esac
3466 $cat <<EOM
3467
3468 By default, $package will be installed in $dflt/bin, manual pages
3469 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3470 installation directories. Typically this is something like /usr/local.
3471 If you wish to have binaries under /usr/bin but other parts of the
3472 installation under /usr/local, that's ok: you will be prompted
3473 separately for each of the installation directories, the prefix being
3474 only used to set the defaults.
3475
3476 EOM
3477 fn=d~
3478 rp='Installation prefix to use?'
3479 . ./getfile
3480 oldprefix=''
3481 case "$prefix" in
3482 '') ;;
3483 *)
3484         case "$ans" in
3485         "$prefix") ;;
3486         *) oldprefix="$prefix";;
3487         esac
3488         ;;
3489 esac
3490 prefix="$ans"
3491 prefixexp="$ansexp"
3492
3493 : is AFS running?
3494 echo " "
3495 case "$afs" in
3496 $define|true)   afs=true ;;
3497 $undef|false)   afs=false ;;
3498 *)      if test -d /afs; then
3499                 afs=true
3500         else
3501                 afs=false
3502         fi
3503         ;;
3504 esac
3505 if $afs; then
3506         echo "AFS may be running... I'll be extra cautious then..." >&4
3507 else
3508         echo "AFS does not seem to be running..." >&4
3509 fi
3510
3511 : determine installation prefix for where package is to be installed.
3512 if $afs; then 
3513 $cat <<EOM
3514
3515 Since you are running AFS, I need to distinguish the directory in which
3516 files will reside from the directory in which they are installed (and from
3517 which they are presumably copied to the former directory by occult means).
3518
3519 EOM
3520         case "$installprefix" in
3521         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3522         *) dflt="$installprefix";;
3523         esac
3524 else
3525 $cat <<EOM
3526
3527 In some special cases, particularly when building $package for distribution,
3528 it is convenient to distinguish between the directory in which files should 
3529 be installed from the directory ($prefix) in which they 
3530 will eventually reside.  For most users, these two directories are the same.
3531
3532 EOM
3533         case "$installprefix" in
3534         '') dflt=$prefix ;;
3535         *) dflt=$installprefix;;
3536         esac
3537 fi
3538 fn=d~
3539 rp='What installation prefix should I use for installing files?'
3540 . ./getfile
3541 installprefix="$ans"
3542 installprefixexp="$ansexp"
3543
3544 : set the prefixit variable, to compute a suitable default value
3545 prefixit='case "$3" in
3546 ""|none)
3547         case "$oldprefix" in
3548         "") eval "$1=\"\$$2\"";;
3549         *)
3550                 case "$3" in
3551                 "") eval "$1=";;
3552                 none)
3553                         eval "tp=\"\$$2\"";
3554                         case "$tp" in
3555                         ""|" ") eval "$1=\"\$$2\"";;
3556                         *) eval "$1=";;
3557                         esac;;
3558                 esac;;
3559         esac;;
3560 *)
3561         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3562         case "$tp" in
3563         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3564         /*-$oldprefix/*|\~*-$oldprefix/*)
3565                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3566         *) eval "$1=\"\$$2\"";;
3567         esac;;
3568 esac'
3569
3570 : set the base revision
3571 baserev=5.0
3572
3573 : get the patchlevel
3574 echo " "
3575 echo "Getting the current patchlevel..." >&4
3576 if $test -r $rsrc/patchlevel.h;then
3577         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3578         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3579 else
3580         patchlevel=0
3581         subversion=0
3582 fi
3583 $echo $n "(You have $package" $c
3584 case "$package" in
3585 "*$baserev")    ;;
3586 *)              $echo $n " $baserev" $c ;;
3587 esac
3588 $echo $n " patchlevel $patchlevel" $c
3589 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3590 echo ".)"
3591
3592 if test 0 -eq "$subversion"; then
3593         version=`LC_ALL=C; export LC_ALL; \
3594                  echo $baserev $patchlevel | \
3595                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3596 else
3597         version=`LC_ALL=C; export LC_ALL; \
3598                  echo $baserev $patchlevel $subversion | \
3599                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3600 fi
3601 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3602 if test "$subversion" -lt 50; then
3603         apiversion=`LC_ALL=C; export LC_ALL; \
3604                  LANGUAGE=C; export LANGUAGE; \
3605                  echo $baserev $patchlevel | \
3606                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3607 else
3608         apiversion="$version"
3609 fi
3610
3611 : determine installation style
3612 : For now, try to deduce it from prefix unless it is already set.
3613 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3614 case "$installstyle" in
3615 '')     case "$prefix" in
3616                 *perl*) dflt='lib';;
3617                 *) dflt='lib/perl5' ;;
3618         esac
3619         ;;
3620 *)      dflt='lib/perl5' ;;
3621 esac
3622 : Probably not worth prompting for this since we prompt for all
3623 : the directories individually, and the prompt would be too long and
3624 : confusing anyway.
3625 installstyle=$dflt
3626
3627 : determine where private library files go
3628 : Usual default is /usr/local/lib/perl5/$version.
3629 : Also allow things like /opt/perl/lib/$version, since 
3630 : /opt/perl/lib/perl5... would be redundant.
3631 : The default "style" setting is made in installstyle.U
3632 case "$installstyle" in
3633 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3634 *)       set dflt privlib lib/$version ;;
3635 esac
3636 eval $prefixit
3637 $cat <<EOM
3638
3639 There are some auxiliary files for $package that need to be put into a
3640 private library directory that is accessible by everyone.
3641
3642 EOM
3643 fn=d~+
3644 rp='Pathname where the private library files will reside?'
3645 . ./getfile
3646 privlib="$ans"
3647 privlibexp="$ansexp"
3648 : Change installation prefix, if necessary.
3649 if $test X"$prefix" != X"$installprefix"; then
3650         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3651 else
3652         installprivlib="$privlibexp"
3653 fi
3654
3655 : set the prefixup variable, to restore leading tilda escape
3656 prefixup='case "$prefixexp" in
3657 "$prefix") ;;
3658 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3659 esac'
3660
3661 : determine where public architecture dependent libraries go
3662 set archlib archlib
3663 eval $prefixit
3664 : privlib default is /usr/local/lib/$package/$version
3665 : archlib default is /usr/local/lib/$package/$version/$archname
3666 : privlib may have an optional trailing /share.
3667 tdflt=`echo $privlib | $sed 's,/share$,,'`
3668 tdflt=$tdflt/$archname
3669 case "$archlib" in
3670 '')     dflt=$tdflt
3671         ;;
3672 *)      dflt="$archlib"
3673     ;;
3674 esac
3675 $cat <<EOM
3676
3677 $spackage contains architecture-dependent library files.  If you are
3678 sharing libraries in a heterogeneous environment, you might store
3679 these files in a separate location.  Otherwise, you can just include
3680 them with the rest of the public library files.
3681
3682 EOM
3683 fn=d+~
3684 rp='Where do you want to put the public architecture-dependent libraries?'
3685 . ./getfile
3686 archlib="$ans"
3687 archlibexp="$ansexp"
3688 if $test X"$archlib" = X"$privlib"; then
3689         d_archlib="$undef"
3690 else
3691         d_archlib="$define"
3692 fi
3693 : Change installation prefix, if necessary.
3694 if $test X"$prefix" != X"$installprefix"; then
3695         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3696 else
3697         installarchlib="$archlibexp"
3698 fi
3699
3700
3701 : Binary compatibility with 5.005 is not possible for builds
3702 : with advanced features
3703 case "$usethreads$usemultiplicity" in
3704 *define*)
3705         bincompat5005="$undef"
3706         d_bincompat5005="$undef"
3707         ;;
3708 *)      $cat <<EOM
3709
3710 Perl 5.006 can be compiled for binary compatibility with 5.005.
3711 If you decide to do so, you will be able to continue using most
3712 of the extensions that were compiled for Perl 5.005.
3713
3714 EOM
3715         case "$bincompat5005$d_bincompat5005" in
3716         *"$undef"*) dflt=n ;;
3717         *) dflt=y ;;
3718         esac
3719         rp='Binary compatibility with Perl 5.005?'
3720         . ./myread
3721         case "$ans" in
3722         y*) val="$define" ;;
3723         *)  val="$undef" ;;
3724         esac
3725         set d_bincompat5005
3726         eval $setvar
3727         case "$d_bincompat5005" in
3728         "$define")
3729                 bincompat5005="$define"
3730                 ;;
3731         *)      bincompat5005="$undef"
3732                 d_bincompat5005="$undef"
3733                 ;;
3734         esac
3735         ;;
3736 esac
3737
3738
3739 : see if setuid scripts can be secure
3740 $cat <<EOM
3741
3742 Some kernels have a bug that prevents setuid #! scripts from being
3743 secure.  Some sites have disabled setuid #! scripts because of this.
3744
3745 First let's decide if your kernel supports secure setuid #! scripts.
3746 (If setuid #! scripts would be secure but have been disabled anyway,
3747 don't say that they are secure if asked.)
3748
3749 EOM
3750
3751 val="$undef"
3752 if $test -d /dev/fd; then
3753         echo "#!$ls" >reflect
3754         chmod +x,u+s reflect
3755         ./reflect >flect 2>&1
3756         if $contains "/dev/fd" flect >/dev/null; then
3757                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3758                 val="$define"
3759         else
3760                 $cat <<EOM
3761 If you are not sure if they are secure, I can check but I'll need a
3762 username and password different from the one you are using right now.
3763 If you don't have such a username or don't want me to test, simply
3764 enter 'none'.
3765
3766 EOM
3767                 rp='Other username to test security of setuid scripts with?'
3768                 dflt='none'
3769                 . ./myread
3770                 case "$ans" in
3771                 n|none)
3772                         case "$d_suidsafe" in
3773                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3774                                 dflt=n;;
3775                         "$undef")
3776                                 echo "Well, the $hint value is *not* secure." >&4
3777                                 dflt=n;;
3778                         *)      echo "Well, the $hint value *is* secure." >&4
3779                                 dflt=y;;
3780                         esac
3781                         ;;
3782                 *)
3783                         $rm -f reflect flect
3784                         echo "#!$ls" >reflect
3785                         chmod +x,u+s reflect
3786                         echo >flect
3787                         chmod a+w flect
3788                         echo '"su" will (probably) prompt you for '"$ans's password."
3789                         su $ans -c './reflect >flect'
3790                         if $contains "/dev/fd" flect >/dev/null; then
3791                                 echo "Okay, it looks like setuid scripts are secure." >&4
3792                                 dflt=y
3793                         else
3794                                 echo "I don't think setuid scripts are secure." >&4
3795                                 dflt=n
3796                         fi
3797                         ;;
3798                 esac
3799                 rp='Does your kernel have *secure* setuid scripts?'
3800                 . ./myread
3801                 case "$ans" in
3802                 [yY]*)  val="$define";;
3803                 *)      val="$undef";;
3804                 esac
3805         fi
3806 else
3807         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3808         echo "(That's for file descriptors, not floppy disks.)"
3809         val="$undef"
3810 fi
3811 set d_suidsafe
3812 eval $setvar
3813
3814 $rm -f reflect flect
3815
3816 : now see if they want to do setuid emulation
3817 echo " "
3818 val="$undef"
3819 case "$d_suidsafe" in
3820 "$define")
3821         val="$undef"
3822         echo "No need to emulate SUID scripts since they are secure here." >& 4
3823         ;;
3824 *)
3825         $cat <<EOM
3826 Some systems have disabled setuid scripts, especially systems where
3827 setuid scripts cannot be secure.  On systems where setuid scripts have
3828 been disabled, the setuid/setgid bits on scripts are currently
3829 useless.  It is possible for $package to detect those bits and emulate
3830 setuid/setgid in a secure fashion.  This emulation will only work if
3831 setuid scripts have been disabled in your kernel.
3832
3833 EOM
3834         case "$d_dosuid" in
3835         "$define") dflt=y ;;
3836         *) dflt=n ;;
3837         esac
3838         rp="Do you want to do setuid/setgid emulation?"
3839         . ./myread
3840         case "$ans" in
3841         [yY]*)  val="$define";;
3842         *)      val="$undef";;
3843         esac
3844         ;;
3845 esac
3846 set d_dosuid
3847 eval $setvar
3848
3849 : What should the include directory be ?
3850 echo " "
3851 $echo $n "Hmm...  $c"
3852 dflt='/usr/include'
3853 incpath=''
3854 mips_type=''
3855 if $test -f /bin/mips && /bin/mips; then
3856         echo "Looks like a MIPS system..."
3857         $cat >usr.c <<'EOCP'
3858 #ifdef SYSTYPE_BSD43
3859 /bsd43
3860 #endif
3861 EOCP
3862         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3863                 dflt='/bsd43/usr/include'
3864                 incpath='/bsd43'
3865                 mips_type='BSD 4.3'
3866         else
3867                 mips_type='System V'
3868         fi
3869         $rm -f usr.c usr.out
3870         echo "and you're compiling with the $mips_type compiler and libraries."
3871         xxx_prompt=y
3872         echo "exit 0" >mips
3873 else
3874         echo "Doesn't look like a MIPS system."
3875         xxx_prompt=n
3876         echo "exit 1" >mips
3877 fi
3878 chmod +x mips
3879 $eunicefix mips
3880 case "$usrinc" in
3881 '') ;;
3882 *) dflt="$usrinc";;
3883 esac
3884 case "$xxx_prompt" in
3885 y)      fn=d/
3886         echo " "
3887         rp='Where are the include files you want to use?'
3888         . ./getfile
3889         usrinc="$ans"
3890         ;;
3891 *)      usrinc="$dflt"
3892         ;;
3893 esac
3894
3895 : see how we invoke the C preprocessor
3896 echo " "
3897 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3898 cat <<'EOT' >testcpp.c
3899 #define ABC abc
3900 #define XYZ xyz
3901 ABC.XYZ
3902 EOT
3903 cd ..
3904 if test ! -f cppstdin; then
3905         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3906                 # AIX cc -E doesn't show the absolute headerfile
3907                 # locations but we'll cheat by using the -M flag.
3908                 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
3909         else
3910                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3911         fi
3912 else
3913         echo "Keeping your $hint cppstdin wrapper."
3914 fi
3915 chmod 755 cppstdin
3916 wrapper=`pwd`/cppstdin
3917 ok='false'
3918 cd UU
3919
3920 if $test "X$cppstdin" != "X" && \
3921         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3922         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3923 then
3924         echo "You used to use $cppstdin $cppminus so we'll use that again."
3925         case "$cpprun" in
3926         '') echo "But let's see if we can live without a wrapper..." ;;
3927         *)
3928                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3929                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3930                 then
3931                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3932                         ok='true'
3933                 else
3934                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3935                 fi
3936                 ;;
3937         esac
3938 else
3939         case "$cppstdin" in
3940         '') ;;
3941         *)
3942                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3943                 ;;
3944         esac
3945 fi
3946
3947 if $ok; then
3948         : nothing
3949 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3950         $cc -E <testcpp.c >testcpp.out 2>&1; \
3951         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3952         echo "Yup, it does."
3953         x_cpp="$cc -E"
3954         x_minus='';
3955 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3956         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3957         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3958         echo "Yup, it does."
3959         x_cpp="$cc -E"
3960         x_minus='-';
3961 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3962         $cc -P <testcpp.c >testcpp.out 2>&1; \
3963         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3964         echo "Yipee, that works!"
3965         x_cpp="$cc -P"
3966         x_minus='';
3967 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3968         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3969         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3970         echo "At long last!"
3971         x_cpp="$cc -P"
3972         x_minus='-';
3973 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3974         $cpp <testcpp.c >testcpp.out 2>&1; \
3975         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3976         echo "It works!"
3977         x_cpp="$cpp"
3978         x_minus='';
3979 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3980         $cpp - <testcpp.c >testcpp.out 2>&1; \
3981         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3982         echo "Hooray, it works!  I was beginning to wonder."
3983         x_cpp="$cpp"
3984         x_minus='-';
3985 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3986         $wrapper <testcpp.c >testcpp.out 2>&1; \
3987         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3988         x_cpp="$wrapper"
3989         x_minus=''
3990         echo "Eureka!"
3991 else
3992         dflt=''
3993         rp="No dice.  I can't find a C preprocessor.  Name one:"
3994         . ./myread
3995         x_cpp="$ans"
3996         x_minus=''
3997         $x_cpp <testcpp.c >testcpp.out 2>&1
3998         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3999                 echo "OK, that will do." >&4
4000         else
4001 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4002                 exit 1
4003         fi
4004 fi
4005
4006 case "$ok" in
4007 false)
4008         cppstdin="$x_cpp"
4009         cppminus="$x_minus"
4010         cpprun="$x_cpp"
4011         cpplast="$x_minus"
4012         set X $x_cpp
4013         shift
4014         case "$1" in
4015         "$cpp")
4016                 echo "Perhaps can we force $cc -E using a wrapper..."
4017                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4018                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4019                 then
4020                         echo "Yup, we can."
4021                         cppstdin="$wrapper"
4022                         cppminus='';
4023                 else
4024                         echo "Nope, we'll have to live without it..."
4025                 fi
4026                 ;;
4027         esac
4028         case "$cpprun" in
4029         "$wrapper")
4030                 cpprun=''
4031                 cpplast=''
4032                 ;;
4033         esac
4034         ;;
4035 esac
4036
4037 case "$cppstdin" in
4038 "$wrapper"|'cppstdin') ;;
4039 *) $rm -f $wrapper;;
4040 esac
4041 $rm -f testcpp.c testcpp.out
4042
4043 : Set private lib path
4044 case "$plibpth" in
4045 '') if ./mips; then
4046                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4047         fi;;
4048 esac
4049 case "$libpth" in
4050 ' ') dlist='';;
4051 '') dlist="$loclibpth $plibpth $glibpth";;
4052 *) dlist="$libpth";;
4053 esac
4054
4055 : Now check and see which directories actually exist, avoiding duplicates
4056 libpth=''
4057 for xxx in $dlist
4058 do
4059     if $test -d $xxx; then
4060                 case " $libpth " in
4061                 *" $xxx "*) ;;
4062                 *) libpth="$libpth $xxx";;
4063                 esac
4064     fi
4065 done
4066 $cat <<'EOM'
4067
4068 Some systems have incompatible or broken versions of libraries.  Among
4069 the directories listed in the question below, please remove any you
4070 know not to be holding relevant libraries, and add any that are needed.
4071 Say "none" for none.
4072
4073 EOM
4074 case "$libpth" in
4075 '') dflt='none';;
4076 *)
4077         set X $libpth
4078         shift
4079         dflt=${1+"$@"}
4080         ;;
4081 esac
4082 rp="Directories to use for library searches?"
4083 . ./myread
4084 case "$ans" in
4085 none) libpth=' ';;
4086 *) libpth="$ans";;
4087 esac
4088
4089 : compute shared library extension
4090 case "$so" in
4091 '')
4092         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4093                 dflt='sl'
4094         else
4095                 dflt='so'
4096         fi
4097         ;;
4098 *) dflt="$so";;
4099 esac
4100 $cat <<EOM
4101
4102 On some systems, shared libraries may be available.  Answer 'none' if
4103 you want to suppress searching of shared libraries for the remaining
4104 of this configuration.
4105
4106 EOM
4107 rp='What is the file extension used for shared libraries?'
4108 . ./myread
4109 so="$ans"
4110
4111 : Define several unixisms.
4112 : Hints files or command line option can be used to override them.
4113 : The convoluted testing is in case hints files set either the old
4114 : or the new name.
4115 case "$_exe" in
4116 '')     case "$exe_ext" in
4117     '') ;;
4118         *)      _exe="$exe_ext" ;;
4119         esac
4120         ;;
4121 esac
4122 case "$_a" in
4123 '')     case "$lib_ext" in
4124     '') _a='.a';;
4125         *)      _a="$lib_ext" ;;
4126         esac
4127         ;;
4128 esac
4129 case "$_o" in
4130 '') case "$obj_ext" in
4131         '')     _o='.o';;
4132         *)      _o="$obj_ext";;
4133         esac
4134         ;;
4135 esac
4136 case "$p_" in
4137 '') case "$path_sep" in
4138         '')     p_=':';;
4139         *)      p_="$path_sep";;
4140         esac
4141         ;;
4142 esac
4143 exe_ext=$_exe
4144 lib_ext=$_a
4145 obj_ext=$_o
4146 path_sep=$p_
4147
4148 : Which makefile gets called first.  This is used by make depend.
4149 case "$firstmakefile" in
4150 '') firstmakefile='makefile';;
4151 esac
4152
4153 cat <<EOM
4154
4155 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4156 Configure must be run with -Dusesocks.
4157
4158 Normally you do not need this and you should answer no.
4159
4160 EOM
4161 case "$usesocks" in
4162 $define|true|[yY]*)     dflt='y';;
4163 *) dflt='n';;
4164 esac
4165 rp='Build Perl for SOCKS?'
4166 . ./myread
4167 case "$ans" in
4168 y|Y)    val="$define" ;;     
4169 *)      val="$undef" ;;
4170 esac
4171 set usesocks
4172 eval $setvar
4173
4174 : Looking for optional libraries
4175 echo " "
4176 echo "Checking for optional libraries..." >&4
4177 case "$libs" in
4178 ' '|'') dflt='';;
4179 *) dflt="$libs";;
4180 esac
4181 case "$libswanted" in
4182 '') libswanted='c_s';;
4183 esac
4184 case "$usesocks" in
4185 $define)
4186         libswanted="$libswanted socks5 socks5_sh"
4187         ;;
4188 esac
4189 for thislib in $libswanted; do
4190         
4191         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4192                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4193                 echo "Found -l$thislib (shared)."
4194                 case " $dflt " in
4195                 *"-l$thislib "*);;
4196                 *) dflt="$dflt -l$thislib";;
4197                 esac
4198         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4199                 echo "Found -l$thislib (shared)."
4200                 case " $dflt " in
4201                 *"-l$thislib "*);;
4202                 *) dflt="$dflt -l$thislib";;
4203                 esac
4204         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4205                 echo "Found -l$thislib."
4206                 case " $dflt " in
4207                 *"-l$thislib "*);;
4208                 *) dflt="$dflt -l$thislib";;
4209                 esac
4210         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4211                 echo "Found -l$thislib."
4212                 case " $dflt " in
4213                 *"-l$thislib "*);;
4214                 *) dflt="$dflt -l$thislib";;
4215                 esac
4216         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4217                 echo "Found -l${thislib}_s."
4218                 case " $dflt " in
4219                 *"-l$thislib "*);;
4220                 *) dflt="$dflt -l${thislib}_s";;
4221                 esac
4222         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4223                 echo "Found -l$thislib."
4224                 case " $dflt " in
4225                 *"-l$thislib "*);;
4226                 *) dflt="$dflt -l$thislib";;
4227                 esac
4228         else
4229                 echo "No -l$thislib."
4230         fi
4231 done
4232 set X $dflt
4233 shift
4234 dflt="$*"
4235 case "$libs" in
4236 '') dflt="$dflt";;
4237 *) dflt="$libs";;
4238 esac
4239 case "$dflt" in
4240 ' '|'') dflt='none';;
4241 esac
4242
4243 $cat <<EOM
4244
4245 In order to compile $package on your machine, a number of libraries
4246 are usually needed.  Include any other special libraries here as well.
4247 Say "none" for none.  The default list is almost always right.
4248 EOM
4249
4250 echo " "
4251 rp="What libraries to use?"
4252 . ./myread
4253 case "$ans" in
4254 none) libs=' ';;
4255 *) libs="$ans";;
4256 esac
4257
4258 : determine optimization, if desired, or use for debug flag also
4259 case "$optimize" in
4260 ' '|$undef) dflt='none';;
4261 '') dflt='-O';;
4262 *) dflt="$optimize";;
4263 esac
4264 $cat <<EOH
4265
4266 By default, $package compiles with the -O flag to use the optimizer.
4267 Alternately, you might want to use the symbolic debugger, which uses
4268 the -g flag (on traditional Unix systems).  Either flag can be
4269 specified here.  To use neither flag, specify the word "none".
4270
4271 EOH
4272 rp="What optimizer/debugger flag should be used?"
4273 . ./myread
4274 optimize="$ans"
4275 case "$optimize" in
4276 'none') optimize=" ";;
4277 esac
4278
4279 dflt=''
4280 : We will not override a previous value, but we might want to
4281 : augment a hint file
4282 case "$hint" in
4283 default|recommended)
4284         case "$gccversion" in
4285         1*) dflt='-fpcc-struct-return' ;;
4286         esac
4287         case "$optimize" in
4288         *-g*) dflt="$dflt -DDEBUGGING";;
4289         esac
4290         case "$gccversion" in
4291         2*) if test -d /etc/conf/kconfig.d &&
4292                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4293                 then
4294                         dflt="$dflt -posix"
4295                 fi
4296                 ;;
4297         esac
4298         case "$gccversion" in
4299         1*) ;;
4300         2.[0-8]*) ;;
4301         *)      echo " "
4302                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4303                 echo 'int main(void) { return 0; }' > gcctest.c
4304                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4305                         echo "Yes, it does." 2>&1
4306                         case "$ccflags" in
4307                         *strict-aliasing*) 
4308                                 echo "Leaving current flags $ccflags alone." 2>&1
4309                                 ;;
4310                         *) dflt="$dflt -fno-strict-aliasing" ;;
4311                         esac
4312                 else
4313                         echo "Nope, it doesn't, but that's ok." 2>&1
4314                 fi
4315                 ;;
4316         esac
4317         ;;
4318 esac
4319
4320 case "$mips_type" in
4321 *BSD*|'') inclwanted="$locincpth $usrinc";;
4322 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4323 esac
4324 for thisincl in $inclwanted; do
4325         if $test -d $thisincl; then
4326                 if $test x$thisincl != x$usrinc; then
4327                         case "$dflt" in
4328                         *$thisincl*);;
4329                         *) dflt="$dflt -I$thisincl";;
4330                         esac
4331                 fi
4332         fi
4333 done
4334
4335 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4336         xxx=true;
4337 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4338         xxx=true;
4339 else
4340         xxx=false;
4341 fi;
4342 if $xxx; then
4343         case "$dflt" in
4344         *$2*);;
4345         *) dflt="$dflt -D$2";;
4346         esac;
4347 fi'
4348
4349 set signal.h LANGUAGE_C; eval $inctest
4350
4351 case "$usesocks" in
4352 $define)
4353         ccflags="$ccflags -DSOCKS"
4354         ;;
4355 esac
4356
4357 case "$hint" in
4358 default|recommended) dflt="$ccflags $dflt" ;;
4359 *) dflt="$ccflags";;
4360 esac
4361
4362 case "$dflt" in
4363 ''|' ') dflt=none;;
4364 esac
4365 $cat <<EOH
4366
4367 Your C compiler may want other flags.  For this question you should include
4368 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4369 but you should NOT include libraries or ld flags like -lwhatever.  If you
4370 want $package to honor its debug switch, you should include -DDEBUGGING here.
4371 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4372
4373 To use no flags, specify the word "none".
4374
4375 EOH
4376 set X $dflt
4377 shift
4378 dflt=${1+"$@"}
4379 rp="Any additional cc flags?"
4380 . ./myread
4381 case "$ans" in
4382 none) ccflags='';;
4383 *) ccflags="$ans";;
4384 esac
4385
4386 : the following weeds options from ccflags that are of no interest to cpp
4387 cppflags="$ccflags"
4388 case "$gccversion" in
4389 1*) cppflags="$cppflags -D__GNUC__"
4390 esac
4391 case "$mips_type" in
4392 '');;
4393 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4394 esac
4395 case "$cppflags" in
4396 '');;
4397 *)
4398         echo " "
4399         echo "Let me guess what the preprocessor flags are..." >&4
4400         set X $cppflags
4401         shift
4402         cppflags=''
4403         $cat >cpp.c <<'EOM'
4404 #define BLURFL foo
4405
4406 BLURFL xx LFRULB
4407 EOM
4408         previous=''
4409         for flag in $*
4410         do
4411                 case "$flag" in
4412                 -*) ftry="$flag";;
4413                 *) ftry="$previous $flag";;
4414                 esac
4415                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4416                         >cpp1.out 2>/dev/null && \
4417                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4418                         >cpp2.out 2>/dev/null && \
4419                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4420                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4421                 then
4422                         cppflags="$cppflags $ftry"
4423                         previous=''
4424                 else
4425                         previous="$flag"
4426                 fi
4427         done
4428         set X $cppflags
4429         shift
4430         cppflags=${1+"$@"}
4431         case "$cppflags" in
4432         *-*)  echo "They appear to be: $cppflags";;
4433         esac
4434         $rm -f cpp.c cpp?.out
4435         ;;
4436 esac
4437
4438 : flags used in final linking phase
4439 case "$ldflags" in
4440 '') if ./venix; then
4441                 dflt='-i -z'
4442         else
4443                 dflt=''
4444         fi
4445         case "$ccflags" in
4446         *-posix*) dflt="$dflt -posix" ;;
4447         esac
4448         ;;
4449 *) dflt="$ldflags";;
4450 esac
4451
4452 : Try to guess additional flags to pick up local libraries.
4453 for thislibdir in $libpth; do
4454         case " $loclibpth " in
4455         *" $thislibdir "*)
4456                 case "$dflt " in 
4457                 *"-L$thislibdir "*) ;;
4458                 *)  dflt="$dflt -L$thislibdir" ;;
4459                 esac
4460                 ;;
4461         esac
4462 done
4463
4464 case "$dflt" in
4465 '') dflt='none' ;;
4466 esac
4467
4468 $cat <<EOH
4469
4470 Your C linker may need flags.  For this question you should
4471 include -L/whatever and any other flags used by the C linker, but you
4472 should NOT include libraries like -lwhatever.
4473
4474 Make sure you include the appropriate -L/path flags if your C linker
4475 does not normally search all of the directories you specified above,
4476 namely
4477         $libpth
4478 To use no flags, specify the word "none".
4479
4480 EOH
4481
4482 rp="Any additional ld flags (NOT including libraries)?"
4483 . ./myread
4484 case "$ans" in
4485 none) ldflags='';;
4486 *) ldflags="$ans";;
4487 esac
4488 rmlist="$rmlist pdp11"
4489
4490 : coherency check
4491 echo " "
4492 echo "Checking your choice of C compiler and flags for coherency..." >&4
4493 $cat > try.c <<'EOF'
4494 #include <stdio.h>
4495 int main() { printf("Ok\n"); exit(0); }
4496 EOF
4497 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4498 shift
4499 $cat >try.msg <<'EOM'
4500 I've tried to compile and run the following simple program:
4501
4502 EOM
4503 $cat try.c >> try.msg
4504
4505 $cat >> try.msg <<EOM
4506
4507 I used the command:
4508
4509         $*
4510         ./try
4511
4512 and I got the following output:
4513
4514 EOM
4515 dflt=y
4516 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4517         if sh -c './try' >>try.msg 2>&1; then
4518                 xxx=`./try`
4519                 case "$xxx" in
4520                 "Ok") dflt=n ;;
4521                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4522                         case " $libs " in
4523                         *" -lsfio "*)
4524                                 cat >> try.msg <<'EOQS'
4525 If $libs contains -lsfio, and sfio is mis-configured, then it
4526 sometimes (apparently) runs and exits with a 0 status, but with no
4527 output!  It may have to do with sfio's use of _exit vs. exit.
4528
4529 EOQS
4530                                 rp="You have a big problem.  Shall I abort Configure"
4531                                 dflt=y
4532                                 ;;
4533                         esac
4534                         ;;
4535                 esac
4536         else
4537                 echo "The program compiled OK, but exited with status $?." >>try.msg
4538                 rp="You have a problem.  Shall I abort Configure"
4539                 dflt=y
4540         fi
4541 else
4542         echo "I can't compile the test program." >>try.msg
4543         rp="You have a BIG problem.  Shall I abort Configure"
4544         dflt=y
4545 fi
4546 case "$dflt" in
4547 y)
4548         $cat try.msg >&4
4549         case "$knowitall" in
4550         '')
4551                 echo "(The supplied flags or libraries might be incorrect.)"
4552                 ;;
4553         *) dflt=n;;
4554         esac
4555         echo " "
4556         . ./myread
4557         case "$ans" in
4558         n*|N*) ;;
4559         *)      echo "Ok.  Stopping Configure." >&4
4560                 exit 1
4561                 ;;
4562         esac
4563         ;;
4564 n) echo "OK, that should do.";;
4565 esac
4566 $rm -f try try.* core
4567
4568 : determine filename position in cpp output
4569 echo " "
4570 echo "Computing filename position in cpp output for #include directives..." >&4
4571 echo '#include <stdio.h>' > foo.c
4572 $cat >fieldn <<EOF
4573 $startsh
4574 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4575 $grep '^[       ]*#.*stdio\.h' | \
4576 while read cline; do
4577         pos=1
4578         set \$cline
4579         while $test \$# -gt 0; do
4580                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4581                         echo "\$pos"
4582                         exit 0
4583                 fi
4584                 shift
4585                 pos=\`expr \$pos + 1\`
4586         done
4587 done
4588 EOF
4589 chmod +x fieldn
4590 fieldn=`./fieldn`
4591 $rm -f foo.c fieldn
4592 case $fieldn in
4593 '') pos='???';;
4594 1) pos=first;;
4595 2) pos=second;;
4596 3) pos=third;;
4597 *) pos="${fieldn}th";;
4598 esac
4599 echo "Your cpp writes the filename in the $pos field of the line."
4600
4601 : locate header file
4602 $cat >findhdr <<EOF
4603 $startsh
4604 wanted=\$1
4605 name=''
4606 for usrincdir in $usrinc
4607 do
4608         if test -f \$usrincdir/\$wanted; then
4609                 echo "\$usrincdir/\$wanted"
4610                 exit 0
4611         fi
4612 done
4613 awkprg='{ print \$$fieldn }'
4614 echo "#include <\$wanted>" > foo\$\$.c
4615 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4616 $grep "^[       ]*#.*\$wanted" | \
4617 while read cline; do
4618         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4619         case "\$name" in
4620         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4621         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4622         *) exit 2;;
4623         esac;
4624 done;
4625 #
4626 # status = 0: grep returned 0 lines, case statement not executed
4627 # status = 1: headerfile found
4628 # status = 2: while loop executed, no headerfile found
4629 #
4630 status=\$?
4631 $rm -f foo\$\$.c;
4632 if test \$status -eq 1; then
4633         exit 0;
4634 fi
4635 exit 1
4636 EOF
4637 chmod +x findhdr
4638
4639 : define an alternate in-header-list? function
4640 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4641 cont=true; xxf="echo \"<\$1> found.\" >&4";
4642 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4643 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4644 esac;
4645 case $# in 4) instead=instead;; *) instead="at last";; esac;
4646 while $test "$cont"; do
4647         xxx=`./findhdr $1`
4648         var=$2; eval "was=\$$2";
4649         if $test "$xxx" && $test -r "$xxx";
4650         then eval $xxf;
4651         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4652                 cont="";
4653         else eval $xxnf;
4654         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4655         set $yyy; shift; shift; yyy=$@;
4656         case $# in 0) cont="";;
4657         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4658                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4659         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4660                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4661         esac;
4662 done;
4663 while $test "$yyy";
4664 do set $yyy; var=$2; eval "was=\$$2";
4665         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4666         set $yyy; shift; shift; yyy=$@;
4667 done'
4668
4669 : see if this is a malloc.h system
4670 set malloc.h i_malloc
4671 eval $inhdr
4672
4673 : see if stdlib is available
4674 set stdlib.h i_stdlib
4675 eval $inhdr
4676
4677 : determine which malloc to compile in
4678 echo " "
4679 case "$usemymalloc" in
4680 ''|[yY]*|true|$define)  dflt='y' ;;
4681 *)      dflt='n' ;;
4682 esac
4683 rp="Do you wish to attempt to use the malloc that comes with $package?"
4684 . ./myread
4685 usemymalloc="$ans"
4686 case "$ans" in
4687 y*|true)
4688         usemymalloc='y'
4689         mallocsrc='malloc.c'
4690         mallocobj="malloc$_o"
4691         d_mymalloc="$define"
4692         case "$libs" in
4693         *-lmalloc*)
4694                 : Remove malloc from list of libraries to use
4695                 echo "Removing unneeded -lmalloc from library list" >&4
4696                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4697                 shift
4698                 libs="$*"
4699                 echo "libs = $libs" >&4
4700                 ;;
4701         esac
4702         ;;
4703 *)
4704         usemymalloc='n'
4705         mallocsrc=''
4706         mallocobj=''
4707         d_mymalloc="$undef"
4708         ;;
4709 esac
4710
4711 : compute the return types of malloc and free
4712 echo " "
4713 $cat >malloc.c <<END
4714 #$i_malloc I_MALLOC
4715 #$i_stdlib I_STDLIB
4716 #include <stdio.h>
4717 #include <sys/types.h>
4718 #ifdef I_MALLOC
4719 #include <malloc.h>
4720 #endif
4721 #ifdef I_STDLIB
4722 #include <stdlib.h>
4723 #endif
4724 #ifdef TRY_MALLOC
4725 void *malloc();
4726 #endif
4727 #ifdef TRY_FREE
4728 void free();
4729 #endif
4730 END
4731 case "$malloctype" in
4732 '')
4733         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4734                 malloctype='void *'
4735         else
4736                 malloctype='char *'
4737         fi
4738         ;;
4739 esac
4740 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4741
4742 case "$freetype" in
4743 '')
4744         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4745                 freetype='void'
4746         else
4747                 freetype='int'
4748         fi
4749         ;;
4750 esac
4751 echo "Your system uses $freetype free(), it would seem." >&4
4752 $rm -f malloc.[co]
4753 $cat <<EOM
4754
4755 The installation process will also create a directory for
4756 vendor-supplied add-ons.  Vendors who supply perl with their system
4757 may find it convenient to place all vendor-supplied files in this
4758 directory rather than in the main distribution directory.  This will
4759 ease upgrades between binary-compatible maintenance versions of perl.
4760
4761 Of course you may also use these directories in whatever way you see
4762 fit.  For example, you might use them to access modules shared over a
4763 company-wide network.
4764
4765 The default answer should be fine for most people.
4766 This causes further questions about vendor add-ons to be skipped
4767 and no vendor-specific directories will be configured for perl.
4768
4769 EOM
4770 rp='Do you want to configure vendor-specific add-on directories?'
4771 case "$usevendorprefix" in
4772 define|true|[yY]*) dflt=y ;;
4773 *) dflt=n ;;
4774 esac
4775 . ./myread
4776 case "$ans" in
4777 [yY]*)  fn=d~+
4778         rp='Installation prefix to use for vendor-supplied add-ons?'
4779         case "$vendorprefix" in
4780         '') dflt='' ;;
4781         *)  dflt=$vendorprefix ;;
4782         esac
4783         . ./getfile
4784         oldvendorprefix=''
4785         case "$vendorprefix" in
4786         '') ;;
4787         *)      case "$ans" in
4788                 "$prefix") ;;
4789                 *) oldvendorprefix="$prefix";;
4790                 esac
4791                 ;;
4792         esac
4793         usevendorprefix="$define"
4794         vendorprefix="$ans"
4795         vendorprefixexp="$ansexp"
4796         ;;
4797 *)      usevendorprefix="$undef"
4798         vendorprefix=''
4799         vendorprefixexp=''
4800         ;;
4801 esac
4802
4803 case "$vendorprefix" in
4804 '')     d_vendorlib="$undef"
4805         vendorlib=''
4806         vendorlibexp=''
4807         ;;
4808 *)      d_vendorlib="$define"
4809         : determine where vendor-supplied modules go.
4810         : Usual default is /usr/local/lib/perl5/vendor_perl
4811         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4812         case "$installstyle" in
4813         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4814         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4815         esac
4816         fn=d~+
4817         rp='Pathname for the vendor-supplied library files?'
4818         . ./getfile
4819         vendorlib="$ans"
4820         vendorlibexp="$ansexp"
4821         : Change installation prefix, if necessary.
4822         if $test X"$prefix" != X"$installprefix"; then
4823                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4824         else
4825                 installvendorlib="$vendorlibexp"
4826         fi
4827         ;;
4828 esac
4829
4830 : Cruising for prototypes
4831 echo " "
4832 echo "Checking out function prototypes..." >&4
4833 $cat >prototype.c <<'EOCP'
4834 int main(int argc, char *argv[]) {
4835         exit(0);}
4836 EOCP
4837 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4838         echo "Your C compiler appears to support function prototypes."
4839         val="$define"
4840 else
4841         echo "Your C compiler doesn't seem to understand function prototypes."
4842         val="$undef"
4843 fi
4844 set prototype
4845 eval $setvar
4846 $rm -f prototype*
4847
4848 case "$prototype" in
4849 "$define") ;;
4850 *)      ansi2knr='ansi2knr'
4851         echo " "
4852         cat <<EOM >&4
4853
4854 $me:  FATAL ERROR:
4855 This version of $package can only be compiled by a compiler that 
4856 understands function prototypes.  Unfortunately, your C compiler 
4857         $cc $ccflags
4858 doesn't seem to understand them.  Sorry about that.
4859
4860 If GNU cc is available for your system, perhaps you could try that instead.  
4861
4862 Eventually, we hope to support building Perl with pre-ANSI compilers.
4863 If you would like to help in that effort, please contact <perlbug@perl.org>.
4864
4865 Aborting Configure now.
4866 EOM
4867         exit 2
4868         ;;
4869 esac
4870
4871 : determine where public executables go
4872 echo " "
4873 set dflt bin bin
4874 eval $prefixit
4875 fn=d~
4876 rp='Pathname where the public executables will reside?'
4877 . ./getfile
4878 if $test "X$ansexp" != "X$binexp"; then
4879         installbin=''
4880 fi
4881 bin="$ans"
4882 binexp="$ansexp"
4883 : Change installation prefix, if necessary.
4884 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4885 if $test X"$prefix" != X"$installprefix"; then
4886         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4887 else
4888         installbin="$binexp"
4889 fi
4890
4891 : determine whether to install perl also as /usr/bin/perl
4892
4893 echo " "
4894 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4895         $cat <<EOM
4896 Many scripts expect to perl to be installed as /usr/bin/perl.
4897 I can install the perl you are about to compile also as /usr/bin/perl
4898 (in addition to $installbin/perl).
4899 EOM
4900         case "$installusrbinperl" in
4901         "$undef"|[nN]*) dflt='n';;
4902         *)              dflt='y';;
4903         esac
4904         rp="Do you want to install perl as /usr/bin/perl?"
4905         . ./myread
4906         case "$ans" in
4907         [yY]*)  val="$define";;
4908         *)      val="$undef" ;;
4909         esac
4910 else
4911         val="$undef"
4912 fi
4913 set installusrbinperl
4914 eval $setvar
4915
4916 : define a shorthand compile call
4917 compile='
4918 mc_file=$1;
4919 shift;
4920 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4921 : define a shorthand compile call for compilations that should be ok.
4922 compile_ok='
4923 mc_file=$1;
4924 shift;
4925 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4926
4927 echo " "
4928 echo "Checking for GNU C Library..." >&4
4929 cat >gnulibc.c <<EOM
4930 #include <stdio.h>
4931 int main()
4932 {
4933 #ifdef __GLIBC__
4934     exit(0);
4935 #else
4936     exit(1);
4937 #endif
4938 }
4939 EOM
4940 set gnulibc
4941 if eval $compile_ok && ./gnulibc; then
4942         val="$define"
4943         echo "You are using the GNU C Library"
4944 else
4945         val="$undef"
4946         echo "You are not using the GNU C Library"
4947 fi
4948 $rm -f gnulibc*
4949 set d_gnulibc
4950 eval $setvar
4951
4952 : see if nm is to be used to determine whether a symbol is defined or not
4953 case "$usenm" in
4954 '')
4955         dflt=''
4956         case "$d_gnulibc" in
4957         "$define")
4958                 echo " "
4959                 echo "nm probably won't work on the GNU C Library." >&4
4960                 dflt=n
4961                 ;;
4962         esac
4963         case "$dflt" in
4964         '') 
4965                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4966                         echo " "
4967                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4968                         echo "'nm' won't be sufficient on this sytem." >&4
4969                         dflt=n
4970                 fi
4971                 ;;
4972         esac
4973         case "$dflt" in
4974         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4975                 if $test $dflt -gt 20; then
4976                         dflt=y
4977                 else
4978                         dflt=n
4979                 fi
4980                 ;;
4981         esac
4982         ;;
4983 *)
4984         case "$usenm" in
4985         true|$define) dflt=y;;
4986         *) dflt=n;;
4987         esac
4988         ;;
4989 esac
4990 $cat <<EOM
4991
4992 I can use $nm to extract the symbols from your C libraries. This
4993 is a time consuming task which may generate huge output on the disk (up
4994 to 3 megabytes) but that should make the symbols extraction faster. The
4995 alternative is to skip the 'nm' extraction part and to compile a small
4996 test program instead to determine whether each symbol is present. If
4997 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4998 this may be the best solution.
4999
5000 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5001
5002 EOM
5003 rp="Shall I use $nm to extract C symbols from the libraries?"
5004 . ./myread
5005 case "$ans" in
5006 [Nn]*) usenm=false;;
5007 *) usenm=true;;
5008 esac
5009
5010 runnm=$usenm
5011 case "$reuseval" in
5012 true) runnm=false;;
5013 esac
5014
5015 : nm options which may be necessary
5016 case "$nm_opt" in
5017 '') if $test -f /mach_boot; then
5018                 nm_opt=''       # Mach
5019         elif $test -d /usr/ccs/lib; then
5020                 nm_opt='-p'     # Solaris (and SunOS?)
5021         elif $test -f /dgux; then
5022                 nm_opt='-p'     # DG-UX
5023         elif $test -f /lib64/rld; then
5024                 nm_opt='-p'     # 64-bit Irix
5025         else
5026                 nm_opt=''
5027         fi;;
5028 esac
5029
5030 : nm options which may be necessary for shared libraries but illegal
5031 : for archive libraries.  Thank you, Linux.
5032 case "$nm_so_opt" in
5033 '')     case "$myuname" in
5034         *linux*)
5035                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5036                         nm_so_opt='--dynamic'
5037                 fi
5038                 ;;
5039         esac
5040         ;;
5041 esac
5042
5043 case "$runnm" in
5044 true)
5045 : get list of predefined functions in a handy place
5046 echo " "
5047 case "$libc" in
5048 '') libc=unknown
5049         case "$libs" in
5050         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5051         esac
5052         ;;
5053 esac
5054 libnames='';
5055 case "$libs" in
5056 '') ;;
5057 *)  for thislib in $libs; do
5058         case "$thislib" in
5059         -lc|-lc_s)
5060                 : Handle C library specially below.
5061                 ;;
5062         -l*)
5063                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5064                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5065                         :
5066                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5067                         :
5068                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5069                         :
5070                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5071                         :
5072                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5073                         :
5074                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5075                         :
5076                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5077                         :
5078                 else
5079                         try=''
5080                 fi
5081                 libnames="$libnames $try"
5082                 ;;
5083         *) libnames="$libnames $thislib" ;;
5084         esac
5085         done
5086         ;;
5087 esac
5088 xxx=normal
5089 case "$libc" in
5090 unknown)
5091         set /lib/libc.$so
5092         for xxx in $libpth; do
5093                 $test -r $1 || set $xxx/libc.$so
5094                 : The messy sed command sorts on library version numbers.
5095                 $test -r $1 || \
5096                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5097                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5098                                 h
5099                                 s/[0-9][0-9]*/0000&/g
5100                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5101                                 G
5102                                 s/\n/ /' | \
5103                          sort | $sed -e 's/^.* //'`
5104                 eval set \$$#
5105         done
5106         $test -r $1 || set /usr/ccs/lib/libc.$so
5107         $test -r $1 || set /lib/libsys_s$_a
5108         ;;
5109 *)
5110         set blurfl
5111         ;;
5112 esac
5113 if $test -r "$1"; then
5114         echo "Your (shared) C library seems to be in $1."
5115         libc="$1"
5116 elif $test -r /lib/libc && $test -r /lib/clib; then
5117         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5118         xxx=apollo
5119         libc='/lib/clib /lib/libc'
5120         if $test -r /lib/syslib; then
5121                 echo "(Your math library is in /lib/syslib.)"
5122                 libc="$libc /lib/syslib"
5123         fi
5124 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5125         echo "Your C library seems to be in $libc, as you said before."
5126 elif $test -r $incpath/usr/lib/libc$_a; then
5127         libc=$incpath/usr/lib/libc$_a;
5128         echo "Your C library seems to be in $libc.  That's fine."
5129 elif $test -r /lib/libc$_a; then
5130         libc=/lib/libc$_a;
5131         echo "Your C library seems to be in $libc.  You're normal."
5132 else
5133         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5134                 :
5135         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5136                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5137         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5138                 :
5139         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5140                 :
5141         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5142                 :
5143         else
5144                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5145         fi
5146         if $test -r "$tans"; then
5147                 echo "Your C library seems to be in $tans, of all places."
5148                 libc=$tans
5149         else
5150                 libc='blurfl'
5151         fi
5152 fi
5153 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5154         dflt="$libc"
5155         cat <<EOM
5156
5157 If the guess above is wrong (which it might be if you're using a strange
5158 compiler, or your machine supports multiple models), you can override it here.
5159
5160 EOM
5161 else
5162         dflt=''
5163         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5164         cat >&4 <<EOM
5165 I can't seem to find your C library.  I've looked in the following places:
5166
5167 EOM
5168         $sed 's/^/      /' libpath
5169         cat <<EOM
5170
5171 None of these seems to contain your C library. I need to get its name...
5172
5173 EOM
5174 fi
5175 fn=f
5176 rp='Where is your C library?'
5177 . ./getfile
5178 libc="$ans"
5179
5180 echo " "
5181 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5182 set X `cat libnames`
5183 shift
5184 xxx=files
5185 case $# in 1) xxx=file; esac
5186 echo "Extracting names from the following $xxx for later perusal:" >&4
5187 echo " "
5188 $sed 's/^/      /' libnames >&4
5189 echo " "
5190 $echo $n "This may take a while...$c" >&4
5191
5192 for file in $*; do
5193         case $file in
5194         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5195         *) $nm $nm_opt $file 2>/dev/null;;
5196         esac
5197 done >libc.tmp
5198
5199 $echo $n ".$c"
5200 $grep fprintf libc.tmp > libc.ptf
5201 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5202 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5203 xxx='[ADTSIW]'
5204 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5205         eval $xscan;\
5206         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5207                 eval $xrun
5208 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5209         eval $xscan;\
5210         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5211                 eval $xrun
5212 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5213         eval $xscan;\
5214         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5215                 eval $xrun
5216 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5217         eval $xscan;\
5218         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5219                 eval $xrun
5220 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5221         eval $xscan;\
5222         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5223                 eval $xrun
5224 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5225         eval $xscan;\
5226         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5227                 eval $xrun
5228 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5229                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5230         eval $xscan;\
5231         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5232                 eval $xrun
5233 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5234         eval $xscan;\
5235         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5236                 eval $xrun
5237 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5238         eval $xscan;\
5239         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5240                 eval $xrun
5241 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5242         eval $xscan;\
5243         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5244                 eval $xrun
5245 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5246         eval $xscan;\
5247         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5248                 eval $xrun
5249 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5250         eval $xscan;\
5251         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5252                 eval $xrun
5253 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5254         eval $xscan;\
5255         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5256                 eval $xrun
5257 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5258         eval $xscan;\
5259         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5260                 eval $xrun
5261 else
5262         $nm -p $* 2>/dev/null >libc.tmp
5263         $grep fprintf libc.tmp > libc.ptf
5264         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5265                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5266         then
5267                 nm_opt='-p'
5268                 eval $xrun
5269         else
5270                 echo " "
5271                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5272                 com=''
5273                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5274                         for thisname in $libnames $libc; do
5275                                 $ar t $thisname >>libc.tmp
5276                         done
5277                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5278                         echo "Ok." >&4
5279                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5280                         # Repeat libc to extract forwarders to DLL entries too
5281                         for thisname in $libnames $libc; do
5282                                 $ar tv $thisname >>libc.tmp
5283                                 # Revision 50 of EMX has bug in $ar.
5284                                 # it will not extract forwarders to DLL entries
5285                                 # Use emximp which will extract exactly them.
5286                                 emximp -o tmp.imp $thisname \
5287                                     2>/dev/null && \
5288                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5289                                     < tmp.imp >>libc.tmp
5290                                 $rm tmp.imp
5291                         done
5292                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5293                         echo "Ok." >&4
5294                 else
5295                         echo "$ar didn't seem to work right." >&4
5296                         echo "Maybe this is a Cray...trying bld instead..." >&4
5297                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5298                         then
5299                                 for thisname in $libnames; do
5300                                         bld t $libnames | \
5301                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5302                                         $ar t $thisname >>libc.tmp
5303                                 done
5304                                 echo "Ok." >&4
5305                         else
5306                                 echo "That didn't work either.  Giving up." >&4
5307                                 exit 1
5308                         fi
5309                 fi
5310         fi
5311 fi
5312 nm_extract="$com"
5313 if $test -f /lib/syscalls.exp; then
5314         echo " "
5315         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5316         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5317 fi
5318 ;;
5319 esac
5320 $rm -f libnames libpath
5321
5322 : see if dld is available
5323 set dld.h i_dld
5324 eval $inhdr
5325
5326 : is a C symbol defined?
5327 csym='tlook=$1;
5328 case "$3" in
5329 -v) tf=libc.tmp; tc=""; tdc="";;
5330 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5331 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5332 esac;
5333 tx=yes;
5334 case "$reuseval-$4" in
5335 true-) ;;
5336 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5337 esac;
5338 case "$tx" in
5339 yes)
5340         case "$runnm" in
5341         true)
5342                 if $contains $tlook $tf >/dev/null 2>&1;
5343                 then tval=true;
5344                 else tval=false;
5345                 fi;;
5346         *)
5347                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5348                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5349                 then tval=true;
5350                 else tval=false;
5351                 fi;
5352                 $rm -f t t.c;;
5353         esac;;
5354 *)
5355         case "$tval" in
5356         $define) tval=true;;
5357         *) tval=false;;
5358         esac;;
5359 esac;
5360 eval "$2=$tval"'
5361
5362 : define an is-in-libc? function
5363 inlibc='echo " "; td=$define; tu=$undef;
5364 sym=$1; var=$2; eval "was=\$$2";
5365 tx=yes;
5366 case "$reuseval$was" in
5367 true) ;;
5368 true*) tx=no;;
5369 esac;
5370 case "$tx" in
5371 yes)
5372         set $sym tres -f;
5373         eval $csym;
5374         case "$tres" in
5375         true)
5376                 echo "$sym() found." >&4;
5377                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5378         *)
5379                 echo "$sym() NOT found." >&4;
5380                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5381         esac;;
5382 *)
5383         case "$was" in
5384         $define) echo "$sym() found." >&4;;
5385         *) echo "$sym() NOT found." >&4;;
5386         esac;;
5387 esac'
5388
5389 : see if dlopen exists
5390 xxx_runnm="$runnm"
5391 runnm=false
5392 set dlopen d_dlopen
5393 eval $inlibc
5394 runnm="$xxx_runnm"
5395
5396 : determine which dynamic loading, if any, to compile in
5397 echo " "
5398 dldir="ext/DynaLoader"
5399 case "$usedl" in
5400 $define|y|true)
5401         dflt='y'
5402         usedl="$define"
5403         ;;
5404 $undef|n|false)
5405         dflt='n'
5406         usedl="$undef"
5407         ;;
5408 *) 
5409         dflt='n'
5410         case "$d_dlopen" in
5411             $define) dflt='y' ;;
5412         esac
5413         case "$i_dld" in
5414             $define) dflt='y' ;;
5415         esac
5416         : Does a dl_xxx.xs file exist for this operating system
5417         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5418         ;;
5419 esac
5420 rp="Do you wish to use dynamic loading?"
5421 . ./myread
5422 usedl="$ans"
5423 case "$ans" in
5424 y*) usedl="$define"
5425         case "$dlsrc" in
5426         '')
5427                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5428                         dflt="$dldir/dl_${osname}.xs"
5429                 elif $test "$d_dlopen" = "$define" ; then
5430                         dflt="$dldir/dl_dlopen.xs"
5431                 elif $test "$i_dld" = "$define" ; then
5432                         dflt="$dldir/dl_dld.xs"
5433                 else
5434                         dflt=''
5435                 fi
5436                 ;;
5437         *)      dflt="$dldir/$dlsrc"
5438                 ;;
5439         esac
5440     echo "The following dynamic loading files are available:"
5441         : Can not go over to $dldir because getfile has path hard-coded in.
5442         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5443         rp="Source file to use for dynamic loading"
5444         fn="fne"
5445         gfpth="$src"
5446         . ./getfile
5447         usedl="$define"
5448         : emulate basename
5449         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5450
5451         $cat << EOM
5452
5453 Some systems may require passing special flags to $cc -c to
5454 compile modules that will be used to create a shared library.
5455 To use no flags, say "none".
5456
5457 EOM
5458     case "$cccdlflags" in
5459     '') case "$gccversion" in
5460                 '') case "$osname" in
5461                         hpux)   dflt='+z' ;;
5462                         next)   dflt='none' ;;
5463                         irix*)  dflt='-KPIC' ;;
5464                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5465                         sunos)  dflt='-pic' ;;
5466                         *)      dflt='none' ;;
5467                     esac
5468                         ;;
5469                 *)  case "$osname" in
5470                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5471                         *)      dflt='-fpic' ;;
5472                     esac ;;
5473             esac ;;
5474         ' ') dflt='none' ;;
5475     *)  dflt="$cccdlflags" ;;
5476     esac
5477     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5478     . ./myread
5479     case "$ans" in
5480     none) cccdlflags=' ' ;;
5481     *) cccdlflags="$ans" ;;
5482     esac
5483
5484     cat << EOM
5485
5486 Some systems use ld to create libraries that can be dynamically loaded,
5487 while other systems (such as those using ELF) use $cc.
5488
5489 EOM
5490         case "$ld" in
5491         '')     $cat >try.c <<'EOM'
5492 /* Test for whether ELF binaries are produced */
5493 #include <fcntl.h>
5494 #include <stdlib.h>
5495 int main() {
5496         char b[4];
5497         int i = open("a.out",O_RDONLY);
5498         if(i == -1) 
5499                 exit(1); /* fail */
5500         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5501                 exit(0); /* succeed (yes, it's ELF) */
5502         else
5503                 exit(1); /* fail */
5504 }
5505 EOM
5506                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5507                         cat <<EOM
5508 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5509 EOM
5510                         dflt="$cc"
5511                 else
5512                         echo "I'll use ld to build dynamic libraries."
5513                         dflt='ld'
5514                 fi
5515                 rm -f try.c a.out
5516                 ;;
5517         *)      dflt="$ld"
5518                 ;;
5519         esac
5520
5521     rp="What command should be used to create dynamic libraries?"
5522     . ./myread
5523         ld="$ans"
5524
5525     cat << EOM
5526
5527 Some systems may require passing special flags to $ld to create a
5528 library that can be dynamically loaded.  If your ld flags include
5529 -L/other/path options to locate libraries outside your loader's normal
5530 search path, you may need to specify those -L options here as well.  To
5531 use no flags, say "none".
5532
5533 EOM
5534     case "$lddlflags" in
5535     '') case "$osname" in
5536                         beos) dflt='-nostart' ;;
5537                         hpux)  dflt='-b' ;;
5538                         linux|irix*)    dflt='-shared' ;;
5539                         next)  dflt='none' ;;
5540                         solaris) dflt='-G' ;;
5541                         sunos) dflt='-assert nodefinitions' ;;
5542                         svr4*|esix*) dflt="-G $ldflags" ;;
5543                 *)     dflt='none' ;;
5544                         esac
5545                         ;;
5546     *) dflt="$lddlflags" ;;
5547     esac
5548
5549         : Try to guess additional flags to pick up local libraries.
5550         : Be careful not to append to a plain 'none'
5551         case "$dflt" in
5552         none) dflt='' ;;
5553         esac
5554         for thisflag in $ldflags; do
5555                 case "$thisflag" in
5556                 -L*)
5557                         case " $dflt " in
5558                         *" $thisflag "*) ;;
5559                         *) dflt="$dflt $thisflag" ;;
5560                         esac
5561                         ;;
5562                 esac
5563         done
5564
5565         case "$dflt" in
5566         ''|' ') dflt='none' ;;
5567         esac
5568
5569     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5570     . ./myread
5571     case "$ans" in
5572     none) lddlflags=' ' ;;
5573     *) lddlflags="$ans" ;;
5574     esac
5575
5576         cat <<EOM
5577
5578 Some systems may require passing special flags to $cc to indicate that
5579 the resulting executable will use dynamic linking.  To use no flags,
5580 say "none".
5581
5582 EOM
5583     case "$ccdlflags" in
5584     '') case "$osname" in
5585                 hpux)   dflt='-Wl,-E' ;;
5586                 linux)  dflt='-rdynamic' ;;
5587                 next)   dflt='none' ;;
5588                 sunos)  dflt='none' ;;
5589                 *)      dflt='none' ;;
5590             esac ;;
5591     ' ')  dflt='none' ;;
5592     *)  dflt="$ccdlflags" ;;
5593     esac
5594     rp="Any special flags to pass to $cc to use dynamic loading?"
5595     . ./myread
5596     case "$ans" in
5597     none) ccdlflags=' ' ;;
5598     *) ccdlflags="$ans" ;;
5599     esac
5600     ;;
5601 *)  usedl="$undef"
5602         ld='ld'
5603     dlsrc='dl_none.xs'
5604     lddlflags=''
5605     ccdlflags=''
5606     ;;
5607 esac
5608
5609 also=''
5610 case "$usedl" in
5611 $undef)
5612         # No dynamic loading being used, so don't bother even to prompt.
5613         useshrplib='false'
5614         ;;
5615 *)      case "$useshrplib" in
5616         '')     case "$osname" in
5617                 svr4*|dgux|dynixptx|esix|powerux|beos)
5618                         dflt=y
5619                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5620                         ;;
5621                 next*)
5622                         case "$osvers" in
5623                         4*)     dflt=y
5624                                 also='Building a shared libperl is needed for MAB support.'
5625                                 ;;
5626                         *)      dflt=n
5627                                 ;;
5628                         esac
5629                         ;;
5630                 *)      dflt=n
5631                         ;;
5632                 esac
5633                 ;;
5634         $define|true|[Yy]*)
5635                 dflt=y
5636                 ;;
5637         *)      dflt=n
5638                 ;;
5639         esac
5640         $cat << EOM
5641
5642 The perl executable is normally obtained by linking perlmain.c with
5643 libperl${_a}, any static extensions (usually just DynaLoader), and
5644 any other libraries needed on this system (such as -lm, etc.).  Since
5645 your system supports dynamic loading, it is probably possible to build
5646 a shared libperl.$so.  If you will have more than one executable linked
5647 to libperl.$so, this will significantly reduce the size of each
5648 executable, but it may have a noticeable affect on performance.  The
5649 default is probably sensible for your system.
5650 $also
5651
5652 EOM
5653         rp="Build a shared libperl.$so (y/n)"
5654         . ./myread
5655         case "$ans" in
5656         true|$define|[Yy]*)
5657                 useshrplib='true'  ;;
5658         *)      useshrplib='false' ;;
5659         esac
5660         ;;
5661 esac
5662
5663 case "$useshrplib" in
5664 true)
5665         case "$libperl" in
5666         '')
5667                 # Figure out a good name for libperl.so.  Since it gets stored in
5668                 # a version-specific architecture-dependent library, the version
5669                 # number isn't really that important, except for making cc/ld happy.
5670                 #
5671                 # A name such as libperl.so.3.1
5672                 majmin="libperl.$so.$patchlevel.$subversion"
5673                 # A name such as libperl.so.301
5674                 majonly=`echo $patchlevel $subversion |
5675                         $awk '{printf "%d%02d", $1, $2}'`
5676                 majonly=libperl.$so.$majonly
5677                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5678                 # rely on figuring it out from the naming of libc.
5679                 case "${osname}${osvers}" in
5680                 next4*)
5681                         dflt=libperl.5.$so
5682                         # XXX How handle the --version stuff for MAB?
5683                         ;;
5684                 linux*)  # ld won't link with a bare -lperl otherwise.
5685                         dflt=libperl.$so
5686                         ;;
5687                 *)      # Try to guess based on whether libc has major.minor.
5688                         case "$libc" in
5689                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5690                         *libc.$so.[0-9]*) dflt=$majonly ;;
5691                         *)      dflt=libperl.$so ;;
5692                         esac
5693                         ;;
5694                 esac
5695                 ;;
5696         *)      dflt=$libperl
5697                 ;;
5698         esac
5699         cat << EOM
5700
5701 I need to select a good name for the shared libperl.  If your system uses
5702 library names with major and minor numbers, then you might want something
5703 like $majmin.  Alternatively, if your system uses a single version
5704 number for shared libraries, then you might want to use $majonly.
5705 Or, your system might be quite happy with a simple libperl.$so.
5706
5707 Since the shared libperl will get installed into a version-specific
5708 architecture-dependent directory, the version number of the shared perl
5709 library probably isn't important, so the default should be o.k.
5710
5711 EOM
5712         rp='What name do you want to give to the shared libperl?'
5713         . ./myread
5714         libperl=$ans
5715         echo "Ok, I'll use $libperl"
5716         ;;
5717 *)
5718         libperl="libperl${_a}"
5719         ;;
5720 esac
5721
5722 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5723 case "$shrpdir" in
5724 '') ;;
5725 *)      $cat >&4 <<EOM
5726 WARNING:  Use of the shrpdir variable for the installation location of
5727 the shared $libperl is not supported.  It was never documented and
5728 will not work in this version.  Let me (perlbug@perl.com)
5729 know of any problems this may cause.
5730
5731 EOM
5732         case "$shrpdir" in
5733         "$archlibexp/CORE")
5734                 $cat >&4 <<EOM
5735 But your current setting of $shrpdir is
5736 the default anyway, so it's harmless.
5737 EOM
5738                 ;;
5739         *)
5740                 $cat >&4 <<EOM
5741 Further, your current attempted setting of $shrpdir
5742 conflicts with the value of $archlibexp/CORE
5743 that installperl will use.
5744 EOM
5745                 ;;
5746         esac
5747         ;;
5748 esac
5749
5750 # How will the perl executable find the installed shared $libperl?
5751 # Add $xxx to ccdlflags.
5752 # If we can't figure out a command-line option, use $shrpenv to
5753 # set env LD_RUN_PATH.  The main perl makefile uses this.
5754 shrpdir=$archlibexp/CORE
5755 xxx=''
5756 tmp_shrpenv=''
5757 if "$useshrplib"; then
5758     case "$osname" in 
5759         aix)
5760                 # We'll set it in Makefile.SH...
5761                 ;;
5762         solaris|netbsd)
5763                 xxx="-R $shrpdir"
5764                 ;;
5765         freebsd)
5766                 xxx="-Wl,-R$shrpdir"
5767                 ;;
5768         linux|irix*|dec_osf)
5769                 xxx="-Wl,-rpath,$shrpdir"
5770                 ;;
5771         next)
5772                 # next doesn't like the default...
5773                 ;;
5774         beos)
5775                 # beos doesn't like the default, either.
5776                 ;;
5777         hpux*)
5778                 # hpux doesn't like the default, either.
5779                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5780                 ;;
5781         *)
5782                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5783                 ;;
5784         esac
5785         case "$xxx" in
5786         '') ;;
5787         *)      
5788                 # Only add $xxx if it isn't already in ccdlflags.
5789                 case " $ccdlflags " in
5790                 *" $xxx "*)     ;;
5791                 *)      ccdlflags="$ccdlflags $xxx"
5792                         cat <<EOM >&4
5793
5794 Adding $xxx to the flags
5795 passed to $ld so that the perl executable will find the 
5796 installed shared $libperl.
5797
5798 EOM
5799                         ;;
5800                 esac
5801                 ;;
5802         esac
5803 fi
5804 # Fix ccdlflags in AIX for building external extensions.
5805 # (For building Perl itself bare -bE:perl.exp is needed,
5806 #  Makefile.SH takes care of this.)
5807 case "$osname" in
5808 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5809 esac
5810 # Respect a hint or command-line value.
5811 case "$shrpenv" in
5812 '') shrpenv="$tmp_shrpenv" ;;
5813 esac
5814 case "$ldlibpthname" in
5815 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5816 none)   ldlibpthname='' ;;
5817 esac
5818
5819 : determine where manual pages go
5820 set man1dir man1dir none
5821 eval $prefixit
5822 $cat <<EOM
5823
5824 $spackage has manual pages available in source form.
5825 EOM
5826 case "$nroff" in
5827 nroff)
5828         echo "However, you don't have nroff, so they're probably useless to you."
5829         case "$man1dir" in
5830         '') man1dir="none";;
5831         esac;;
5832 esac
5833 echo "If you don't want the manual sources installed, answer 'none'."
5834 case "$man1dir" in
5835 ' ') dflt=none
5836         ;;
5837 '')
5838         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5839         lookpath="$lookpath $prefixexp/man/p_man/man1"
5840         lookpath="$lookpath $prefixexp/man/u_man/man1"
5841         lookpath="$lookpath $prefixexp/man/man.1"
5842         case "$sysman" in
5843         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5844         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5845         esac
5846         set dflt
5847         eval $prefixup
5848         ;;
5849 *)  dflt="$man1dir"
5850         ;;
5851 esac
5852 echo " "
5853 fn=dn+~
5854 rp="Where do the main $spackage manual pages (source) go?"
5855 . ./getfile
5856 if $test "X$man1direxp" != "X$ansexp"; then
5857         installman1dir=''
5858 fi
5859 man1dir="$ans"
5860 man1direxp="$ansexp"
5861 case "$man1dir" in
5862 '')     man1dir=' '
5863         installman1dir='';;
5864 esac
5865
5866 : Change installation prefix, if necessary.
5867 if $test X"$prefix" != X"$installprefix"; then
5868         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5869 else
5870         installman1dir="$man1direxp"
5871 fi
5872
5873 : What suffix to use on installed man pages
5874
5875 case "$man1dir" in
5876 ' ')
5877         man1ext='0'
5878         ;;
5879 *)
5880         rp="What suffix should be used for the main $spackage man pages?"
5881         case "$man1ext" in
5882         '')     case "$man1dir" in
5883                 *1)  dflt=1 ;;
5884                 *1p) dflt=1p ;;
5885                 *1pm) dflt=1pm ;;
5886                 *l) dflt=l;;
5887                 *n) dflt=n;;
5888                 *o) dflt=o;;
5889                 *p) dflt=p;;
5890                 *C) dflt=C;;
5891                 *L) dflt=L;;
5892                 *L1) dflt=L1;;
5893                 *) dflt=1;;
5894                 esac
5895                 ;;
5896         *)      dflt="$man1ext";;
5897         esac
5898         . ./myread
5899         man1ext="$ans"
5900         ;;
5901 esac
5902
5903 : see if we can have long filenames
5904 echo " "
5905 rmlist="$rmlist /tmp/cf$$"
5906 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5907 first=123456789abcdef
5908 second=/tmp/cf$$/$first
5909 $rm -f $first $second
5910 if (echo hi >$first) 2>/dev/null; then
5911         if $test -f 123456789abcde; then
5912                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5913                 val="$undef"
5914         else
5915                 if (echo hi >$second) 2>/dev/null; then
5916                         if $test -f /tmp/cf$$/123456789abcde; then
5917                                 $cat <<'EOM'
5918 That's peculiar... You can have filenames longer than 14 characters, but only
5919 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5920 I shall consider your system cannot support long filenames at all.
5921 EOM
5922                                 val="$undef"
5923                         else
5924                                 echo 'You can have filenames longer than 14 characters.' >&4
5925                                 val="$define"
5926                         fi
5927                 else
5928                         $cat <<'EOM'
5929 How confusing! Some of your filesystems are sane enough to allow filenames
5930 longer than 14 characters but some others like /tmp can't even think about them.
5931 So, for now on, I shall assume your kernel does not allow them at all.
5932 EOM
5933                         val="$undef"
5934                 fi
5935         fi
5936 else
5937         $cat <<'EOM'
5938 You can't have filenames longer than 14 chars.  You can't even think about them!
5939 EOM
5940         val="$undef"
5941 fi 
5942 set d_flexfnam
5943 eval $setvar
5944 $rm -rf /tmp/cf$$ 123456789abcde*
5945
5946 : determine where library module manual pages go
5947 set man3dir man3dir none
5948 eval $prefixit
5949 $cat <<EOM
5950
5951 $spackage has manual pages for many of the library modules.
5952 EOM
5953
5954 case "$nroff" in
5955 nroff)
5956         $cat <<'EOM'
5957 However, you don't have nroff, so they're probably useless to you.
5958 EOM
5959         case "$man3dir" in
5960         '') man3dir="none";;
5961         esac;;
5962 esac
5963
5964 case "$d_flexfnam" in
5965 undef)
5966         $cat <<'EOM'
5967 However, your system can't handle the long file names like File::Basename.3. 
5968 EOM
5969         case "$man3dir" in
5970         '') man3dir="none";;
5971         esac;;
5972 esac
5973
5974 echo "If you don't want the manual sources installed, answer 'none'."
5975 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5976 case "$man3dir" in
5977 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5978         if $test -d "$privlib/man/man3"; then
5979                 cat <<EOM >&4
5980
5981 WARNING:  Previous versions of perl installed man3 pages into
5982 $privlib/man/man3.  This version will suggest a 
5983 new default of $dflt.  
5984 EOM
5985                 tdflt=$dflt
5986                 dflt='n'
5987                 rp='Do you wish to preserve the old behavior?(y/n)'
5988                 . ./myread
5989                 case "$ans" in
5990                 y*) dflt="$privlib/man/man3" ;;
5991                 *)  dflt=$tdflt ;;
5992                 esac
5993     fi
5994         ;;
5995 ' ') dflt=none;;
5996 *)      dflt="$man3dir" ;;
5997 esac
5998 echo " "
5999 fn=dn+~
6000 rp="Where do the $package library man pages (source) go?"
6001 . ./getfile
6002 man3dir="$ans"
6003 man3direxp="$ansexp"
6004 case "$man1dir" in
6005 '')     man3dir=' '
6006         installman3dir='';;
6007 esac
6008
6009 : Change installation prefix, if necessary.
6010 if $test X"$prefix" != X"$installprefix"; then
6011         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6012 else
6013         installman3dir="$man3direxp"
6014 fi
6015
6016 : What suffix to use on installed man pages
6017 case "$man3dir" in
6018 ' ')
6019         man3ext='0'
6020         ;;
6021 *)
6022         rp="What suffix should be used for the $package library man pages?"
6023         case "$man3ext" in
6024         '')     case "$man3dir" in
6025                 *3)  dflt=3 ;;
6026                 *3p) dflt=3p ;;
6027                 *3pm) dflt=3pm ;;
6028                 *l) dflt=l;;
6029                 *n) dflt=n;;
6030                 *o) dflt=o;;
6031                 *p) dflt=p;;
6032                 *C) dflt=C;;
6033                 *L) dflt=L;;
6034                 *L3) dflt=L3;;
6035                 *) dflt=3;;
6036                 esac
6037                 ;;
6038         *)      dflt="$man3ext";;
6039         esac
6040         . ./myread
6041         man3ext="$ans"
6042         ;;
6043 esac
6044
6045 : see if we have to deal with yellow pages, now NIS.
6046 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6047         if $test -f /usr/etc/nibindd; then
6048                 echo " "
6049                 echo "I'm fairly confident you're on a NeXT."
6050                 echo " "
6051                 rp='Do you get the hosts file via NetInfo?'
6052                 dflt=y
6053                 case "$hostcat" in
6054                 nidump*) ;;
6055                 '') ;;
6056                 *) dflt=n;;
6057                 esac
6058                 . ./myread
6059                 case "$ans" in
6060                 y*) hostcat='nidump hosts .';;
6061                 *)      case "$hostcat" in
6062                         nidump*) hostcat='';;
6063                         esac
6064                         ;;
6065                 esac
6066         fi
6067         case "$hostcat" in
6068         nidump*) ;;
6069         *)
6070                 case "$hostcat" in
6071                 *ypcat*) dflt=y;;
6072                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6073                                 dflt=y
6074                         else
6075                                 dflt=n
6076                         fi;;
6077                 *) dflt=n;;
6078                 esac
6079                 echo " "
6080                 rp='Are you getting the hosts file via yellow pages?'
6081                 . ./myread
6082                 case "$ans" in
6083                 y*) hostcat='ypcat hosts';;
6084                 *) hostcat='cat /etc/hosts';;
6085                 esac
6086                 ;;
6087         esac
6088 fi
6089 case "$hostcat" in
6090 '') hostcat='cat /etc/hosts';;
6091 esac
6092 case "$groupcat" in
6093 '') groupcat='cat /etc/group';;
6094 esac
6095 case "$passcat" in
6096 '') passcat='cat /etc/passwd';;
6097 esac
6098
6099 : now get the host name
6100 echo " "
6101 echo "Figuring out host name..." >&4
6102 case "$myhostname" in
6103 '') cont=true
6104         echo 'Maybe "hostname" will work...'
6105         if tans=`sh -c hostname 2>&1` ; then
6106                 myhostname=$tans
6107                 phostname=hostname
6108                 cont=''
6109         fi
6110         ;;
6111 *) cont='';;
6112 esac
6113 if $test "$cont"; then
6114         if ./xenix; then
6115                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6116                 if tans=`cat /etc/systemid 2>&1` ; then
6117                         myhostname=$tans
6118                         phostname='cat /etc/systemid'
6119                         echo "Whadyaknow.  Xenix always was a bit strange..."
6120                         cont=''
6121                 fi
6122         elif $test -r /etc/systemid; then
6123                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6124         fi
6125 fi
6126 if $test "$cont"; then
6127         echo 'No, maybe "uuname -l" will work...'
6128         if tans=`sh -c 'uuname -l' 2>&1` ; then
6129                 myhostname=$tans
6130                 phostname='uuname -l'
6131         else
6132                 echo 'Strange.  Maybe "uname -n" will work...'
6133                 if tans=`sh -c 'uname -n' 2>&1` ; then
6134                         myhostname=$tans
6135                         phostname='uname -n'
6136                 else
6137                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6138                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6139                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6140                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6141                         else
6142                                 case "$myhostname" in
6143                                 '') echo "Does this machine have an identity crisis or something?"
6144                                         phostname='';;
6145                                 *)
6146                                         echo "Well, you said $myhostname before..."
6147                                         phostname='echo $myhostname';;
6148                                 esac
6149                         fi
6150                 fi
6151         fi
6152 fi
6153 : you do not want to know about this
6154 set $myhostname
6155 myhostname=$1
6156
6157 : verify guess
6158 if $test "$myhostname" ; then
6159         dflt=y
6160         rp='Your host name appears to be "'$myhostname'".'" Right?"
6161         . ./myread
6162         case "$ans" in
6163         y*) ;;
6164         *) myhostname='';;
6165         esac
6166 fi
6167
6168 : bad guess or no guess
6169 while $test "X$myhostname" = X ; do
6170         dflt=''
6171         rp="Please type the (one word) name of your host:"
6172         . ./myread
6173         myhostname="$ans"
6174 done
6175
6176 : translate upper to lower if necessary
6177 case "$myhostname" in
6178 *[A-Z]*)
6179         echo "(Normalizing case in your host name)"
6180         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6181         ;;
6182 esac
6183
6184 case "$myhostname" in
6185 *.*)
6186         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6187         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6188         echo "(Trimming domain name from host name--host name is now $myhostname)"
6189         ;;
6190 *) case "$mydomain" in
6191         '')
6192                 {
6193                         test "X$hostcat" = "Xypcat hosts" &&
6194                         ypmatch "$myhostname" hosts 2>/dev/null |\
6195                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6196                         $test -s hosts
6197                 } || {
6198                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6199                                         /[       ]$myhostname[  . ]/p" > hosts
6200                 }
6201                 tmp_re="[       . ]"
6202                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6203                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6204                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6205                         hosts | $sort | $uniq | \
6206                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6207                 case `$echo X$dflt` in
6208                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6209                         dflt=.
6210                         ;;
6211                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6212                         ;;
6213                 esac
6214                 case "$dflt" in
6215                 .)
6216                         tans=`./loc resolv.conf X /etc /usr/etc`
6217                         if $test -f "$tans"; then
6218                                 echo "(Attempting domain name extraction from $tans)"
6219                                 dflt=.`$sed -n -e 's/   / /g' \
6220                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6221                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6222                                 case "$dflt" in
6223                                 .) dflt=.`$sed -n -e 's/        / /g' \
6224                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6225                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6226                                         ;;
6227                                 esac
6228                         fi
6229                         ;;
6230                 esac
6231                 case "$dflt" in
6232                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6233                         dflt=.`sh -c domainname 2>/dev/null`
6234                         case "$dflt" in
6235                         '') dflt='.';;
6236                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6237                         esac
6238                         ;;
6239                 esac
6240                 case "$dflt" in
6241                 .) echo "(Lost all hope -- silly guess then)"
6242                         dflt='.uucp'
6243                         ;;
6244                 esac
6245                 $rm -f hosts
6246                 ;;
6247         *) dflt="$mydomain";;
6248         esac;;
6249 esac
6250 echo " "
6251 rp="What is your domain name?"
6252 . ./myread
6253 tans="$ans"
6254 case "$ans" in
6255 '') ;;
6256 .*) ;;
6257 *) tans=".$tans";;
6258 esac
6259 mydomain="$tans"
6260
6261 : translate upper to lower if necessary
6262 case "$mydomain" in
6263 *[A-Z]*)
6264         echo "(Normalizing case in your domain name)"
6265         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6266         ;;
6267 esac
6268
6269 : a little sanity check here
6270 case "$phostname" in
6271 '') ;;
6272 *)
6273         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6274         $myhostname$mydomain|$myhostname) ;;
6275         *)
6276                 case "$phostname" in
6277                 sed*)
6278                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6279                         ;;
6280                 *)
6281                         echo "(That doesn't agree with your $phostname command, by the way.)"
6282                         ;;
6283                 esac
6284         ;;
6285         esac
6286         ;;
6287 esac
6288
6289 $cat <<EOM
6290
6291 I need to get your e-mail address in Internet format if possible, i.e.
6292 something like user@host.domain. Please answer accurately since I have
6293 no easy means to double check it. The default value provided below
6294 is most probably close to the reality but may not be valid from outside
6295 your organization...
6296
6297 EOM
6298 cont=x
6299 while test "$cont"; do
6300         case "$cf_email" in
6301         '') dflt="$cf_by@$myhostname$mydomain";;
6302         *) dflt="$cf_email";;
6303         esac
6304         rp='What is your e-mail address?'
6305         . ./myread
6306         cf_email="$ans"
6307         case "$cf_email" in
6308         *@*.*) cont='' ;;
6309         *)
6310                 rp='Address does not look like an Internet one.  Use it anyway?'
6311                 case "$fastread" in
6312                 yes) dflt=y ;;
6313                 *) dflt=n ;;
6314                 esac
6315                 . ./myread
6316                 case "$ans" in
6317                 y*) cont='' ;;
6318                 *) echo " " ;;
6319                 esac
6320                 ;;
6321         esac
6322 done
6323
6324 $cat <<EOM
6325
6326 If you or somebody else will be maintaining perl at your site, please
6327 fill in the correct e-mail address here so that they may be contacted
6328 if necessary. Currently, the "perlbug" program included with perl
6329 will send mail to this address in addition to perlbug@perl.com. You may
6330 enter "none" for no administrator.
6331
6332 EOM
6333 case "$perladmin" in
6334 '') dflt="$cf_email";;
6335 *) dflt="$perladmin";;
6336 esac
6337 rp='Perl administrator e-mail address'
6338 . ./myread
6339 perladmin="$ans"
6340
6341 : figure out how to guarantee perl startup
6342 case "$startperl" in
6343 '')
6344         case "$sharpbang" in
6345         *!)
6346                 $cat <<EOH
6347
6348 I can use the #! construct to start perl on your system. This will
6349 make startup of perl scripts faster, but may cause problems if you
6350 want to share those scripts and perl is not in a standard place
6351 ($binexp/perl) on all your platforms. The alternative is to force
6352 a shell by starting the script with a single ':' character.
6353
6354 EOH
6355                 dflt="$binexp/perl"
6356                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6357                 . ./myread
6358                 case "$ans" in
6359                 none)   startperl=": # use perl";;
6360                 *)      startperl="#!$ans"
6361                         if $test 30 -lt `echo "$ans" | wc -c`; then
6362                                 $cat >&4 <<EOM
6363
6364 WARNING:  Some systems limit the #! command to 32 characters.
6365 If you experience difficulty running Perl scripts with #!, try
6366 installing Perl in a directory with a shorter pathname.
6367
6368 EOM
6369                         fi ;;
6370                 esac
6371                 ;;
6372         *) startperl=": # use perl"
6373                 ;;
6374         esac
6375         ;;
6376 esac
6377 echo "I'll use $startperl to start perl scripts."
6378
6379 : figure best path for perl in scripts
6380 case "$perlpath" in
6381 '')
6382         perlpath="$binexp/perl"
6383         case "$startperl" in
6384         *!*) ;;
6385         *)
6386                 $cat <<EOH
6387
6388 I will use the "eval 'exec'" idiom to start Perl on your system.
6389 I can use the full path of your Perl binary for this purpose, but
6390 doing so may cause problems if you want to share those scripts and
6391 Perl is not always in a standard place ($binexp/perl).
6392
6393 EOH
6394                 dflt="$binexp/perl"
6395                 rp="What path shall I use in \"eval 'exec'\"?"
6396                 . ./myread
6397                 perlpath="$ans"
6398                 ;;
6399         esac
6400         ;;
6401 esac
6402 case "$startperl" in
6403 *!*)    ;;
6404 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6405 esac
6406
6407 : determine where public executable scripts go
6408 set scriptdir scriptdir
6409 eval $prefixit
6410 case "$scriptdir" in
6411 '')
6412         dflt="$bin"
6413         : guess some guesses
6414         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6415         $test -d /usr/share/bin     && dflt=/usr/share/bin
6416         $test -d /usr/local/script  && dflt=/usr/local/script
6417         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6418         $test -d $prefixexp/script  && dflt=$prefixexp/script
6419         set dflt
6420         eval $prefixup
6421         ;;
6422 *)  dflt="$scriptdir"
6423         ;;
6424 esac
6425 $cat <<EOM
6426  
6427 Some installations have a separate directory just for executable scripts so
6428 that they can mount it across multiple architectures but keep the scripts in
6429 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6430 Or you might just lump your scripts in with all your other executables.
6431  
6432 EOM
6433 fn=d~
6434 rp='Where do you keep publicly executable scripts?'
6435 . ./getfile
6436 if $test "X$ansexp" != "X$scriptdirexp"; then
6437         installscript=''
6438 fi
6439 scriptdir="$ans"
6440 scriptdirexp="$ansexp"
6441 : Change installation prefix, if necessary.
6442 if $test X"$prefix" != X"$installprefix"; then
6443         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6444 else
6445         installscript="$scriptdirexp"
6446 fi
6447
6448 $cat <<EOM
6449
6450 After $package is installed, you may wish to install various
6451 add-on modules and utilities.  Typically, these add-ons will
6452 be installed under $prefix with the rest
6453 of this package.  However, you may wish to install such add-ons
6454 elsewhere under a different prefix.
6455
6456 If you do not wish to put everything under a single prefix, that's
6457 ok.  You will be prompted for the individual locations; this siteprefix
6458 is only used to suggest the defaults.
6459
6460 The default should be fine for most people.
6461
6462 EOM
6463 fn=d~+
6464 rp='Installation prefix to use for add-on modules and utilities?'
6465 : XXX Here might be another good place for an installstyle setting.
6466 case "$siteprefix" in
6467 '') dflt=$prefix ;;
6468 *)  dflt=$siteprefix ;;
6469 esac
6470 . ./getfile
6471 oldsiteprefix=''
6472 case "$siteprefix" in
6473 '') ;;
6474 *)
6475         case "$ans" in
6476         "$prefix") ;;
6477         *) oldsiteprefix="$prefix";;
6478         esac
6479         ;;
6480 esac
6481 siteprefix="$ans"
6482 siteprefixexp="$ansexp"
6483
6484 : determine where site specific libraries go.
6485 : Usual default is /usr/local/lib/perl5/site_perl
6486 : The default "style" setting is made in installstyle.U
6487 : XXX No longer works with Prefixit stuff.
6488 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6489 case "$installstyle" in
6490 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6491 *)       dflt=$siteprefix/lib/site_$prog ;;
6492 esac
6493 $cat <<EOM
6494
6495 The installation process will create a directory for
6496 site-specific extensions and modules.  Most users find it convenient
6497 to place all site-specific files in this directory rather than in the
6498 main distribution directory.
6499
6500 EOM
6501 fn=d~+
6502 rp='Pathname for the site-specific library files?'
6503 . ./getfile
6504 sitelib="$ans"
6505 sitelibexp="$ansexp"
6506 : Change installation prefix, if necessary.
6507 if $test X"$prefix" != X"$installprefix"; then
6508         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6509 else
6510         installsitelib="$sitelibexp"
6511 fi
6512
6513 : determine where site specific architecture-dependent libraries go.
6514 : sitelib  default is /usr/local/lib/perl5/site_perl/
6515 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6516 : sitelib may have an optional trailing /share.
6517 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6518 tdflt="$tdflt/$apiversion/$archname"
6519 set sitearch sitearch none
6520 eval $prefixit
6521 case "$sitearch" in
6522 '')     dflt="$tdflt" ;;
6523 *)      dflt="$sitearch" ;;
6524 esac
6525 $cat <<EOM
6526
6527 The installation process will also create a directory for
6528 architecture-dependent site-specific extensions and modules.
6529
6530 EOM
6531 fn=nd~+
6532 rp='Pathname for the site-specific architecture-dependent library files?'
6533 . ./getfile
6534 sitearch="$ans"
6535 sitearchexp="$ansexp"
6536 : Change installation prefix, if necessary.
6537 if $test X"$prefix" != X"$installprefix"; then
6538         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6539 else
6540         installsitearch="$sitearchexp"
6541 fi
6542
6543 cat <<EOM
6544
6545 Perl can be built to take advantage of long doubles which
6546 (if available) may give more accuracy and range for floating point
6547 numbers.  To do so, Configure must be run with -Duselongdouble.
6548
6549 If this doesn't make any sense to you, just accept the default 'n'.
6550 EOM
6551 case "$uselongdouble" in
6552 $define|true|[yY]*)     dflt='y';;
6553 *) dflt='n';;
6554 esac
6555 rp='Try to use long doubles if available?'
6556 . ./myread
6557 case "$ans" in
6558 y|Y)    val="$define"   ;;
6559 *)      val="$undef"    ;;
6560 esac
6561 set uselongdouble
6562 eval $setvar
6563
6564 case "$uselongdouble" in
6565 "$define"|true|[yY]*)
6566 : Look for a hint-file generated 'call-back-unit'.  If the
6567 : user has specified that long doubles should be used,
6568 : we may need to set or change some other defaults.
6569         if $test -f uselongdouble.cbu; then
6570                 echo "Your platform has some specific hints for long doubles, using them..."
6571                 . ./uselongdouble.cbu
6572         else
6573                 $cat <<EOM
6574 (Your platform doesn't have any specific hints for long doubles.)
6575 EOM
6576         fi
6577         ;;
6578 esac
6579
6580 cat <<EOM
6581
6582 Previous version of $package used the standard IO mechanisms as defined
6583 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6584 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6585 the default.  This abstraction layer can use AT&T's sfio (if you already
6586 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6587 problems with some extension modules.  Using PerlIO with stdio is safe,
6588 but it is slower than plain stdio and therefore is not the default.
6589
6590 If this doesn't make any sense to you, just accept the default 'n'.
6591 EOM
6592 case "$useperlio" in
6593 $define|true|[yY]*)     dflt='y';;
6594 *) dflt='n';;
6595 esac
6596 rp='Use the experimental PerlIO abstraction layer?'
6597 . ./myread
6598 case "$ans" in
6599 y|Y) 
6600         val="$define"
6601         ;;     
6602 *)      
6603         echo "Ok, doing things the stdio way"
6604         val="$undef"
6605         ;;
6606 esac
6607 set useperlio
6608 eval $setvar 
6609
6610 : Check how to convert floats to strings.
6611 if test "X$d_Gconvert" = X; then
6612         echo " "
6613         echo "Checking for an efficient way to convert floats to strings."
6614         $cat >try.c <<'EOP'
6615 #ifdef TRY_gconvert
6616 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6617 char *myname = "gconvert";
6618 #endif
6619 #ifdef TRY_gcvt
6620 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6621 char *myname = "gcvt";
6622 #endif
6623 #ifdef TRY_sprintf
6624 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6625 char *myname = "sprintf";
6626 #endif
6627
6628 #include <stdio.h>
6629
6630 int
6631 checkit(expect, got)
6632 char *expect;
6633 char *got;
6634 {
6635     if (strcmp(expect, got)) {
6636                 printf("%s oddity:  Expected %s, got %s\n",
6637                         myname, expect, got);
6638                 exit(1);
6639         }
6640 }
6641
6642 int main()
6643
6644         char buf[64]; 
6645         buf[63] = '\0';
6646
6647         /* This must be 1st test on (which?) platform */
6648         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6649         Gconvert(0.1, 8, 0, buf);
6650         checkit("0.1", buf);
6651
6652         Gconvert(1.0, 8, 0, buf); 
6653         checkit("1", buf);
6654
6655         Gconvert(0.0, 8, 0, buf); 
6656         checkit("0", buf);
6657
6658         Gconvert(-1.0, 8, 0, buf); 
6659         checkit("-1", buf);
6660
6661         /* Some Linux gcvt's give 1.e+5 here. */
6662         Gconvert(100000.0, 8, 0, buf); 
6663         checkit("100000", buf);
6664         
6665         /* Some Linux gcvt's give -1.e+5 here. */
6666         Gconvert(-100000.0, 8, 0, buf); 
6667         checkit("-100000", buf);
6668
6669         exit(0);
6670 }
6671 EOP
6672         case "$d_Gconvert" in
6673         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6674         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6675         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6676         *) xxx_list='gconvert gcvt sprintf' ;;
6677         esac
6678
6679         for xxx_convert in $xxx_list; do
6680                 echo "Trying $xxx_convert"
6681                 $rm -f try try$_o
6682                 set try -DTRY_$xxx_convert
6683                 if eval $compile; then
6684                         echo "$xxx_convert" found. >&4
6685                         if ./try; then
6686                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6687                                 break;
6688                         else
6689                                 echo "...But $xxx_convert didn't work as I expected."
6690                         fi
6691                 else
6692                         echo "$xxx_convert NOT found." >&4
6693                 fi
6694         done
6695                 
6696         case "$xxx_convert" in
6697         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6698         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6699         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6700         esac
6701 fi
6702
6703 : see if inttypes.h is available
6704 : we want a real compile instead of Inhdr because some systems
6705 : have an inttypes.h which includes non-existent headers
6706 echo " "
6707 $cat >try.c <<EOCP
6708 #include <inttypes.h>
6709 int main() {
6710         static int32_t foo32 = 0x12345678;
6711 }
6712 EOCP
6713 set try
6714 if eval $compile; then
6715         echo "<inttypes.h> found." >&4
6716         val="$define"
6717 else
6718         echo "<inttypes.h> NOT found." >&4
6719         val="$undef"
6720 fi
6721 $rm -f try.c try
6722 set i_inttypes
6723 eval $setvar
6724
6725 : check for int64_t
6726 case "$use64bits" in
6727 "$define" )
6728         echo " "
6729         echo $n "Checking to see if your system supports int64_t...$c" >&4
6730         $cat >try.c <<EOCP
6731 #include <sys/types.h>
6732 #$i_inttypes I_INTTYPES
6733 #ifdef I_INTTYPES
6734 #include <inttypes.h>
6735 #endif
6736 int64_t foo() { int64_t x; x = 7; return x; }
6737 EOCP
6738         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6739                 val="$define"
6740                 echo " Yup, it does." >&4
6741         else
6742                 val="$undef"
6743                 echo " Nope, it doesn't." >&4
6744         fi
6745         $rm -f try.*
6746         ;;
6747 *)      val="$undef"
6748         ;;
6749 esac
6750 set d_int64t
6751 eval $setvar
6752
6753
6754 : check for lengths of integral types
6755 echo " "
6756 case "$intsize" in
6757 '')
6758         echo "Checking to see how big your integers are..." >&4
6759         $cat >intsize.c <<'EOCP'
6760 #include <stdio.h>
6761 int main()
6762 {
6763         printf("intsize=%d;\n", sizeof(int));
6764         printf("longsize=%d;\n", sizeof(long));
6765         printf("shortsize=%d;\n", sizeof(short));
6766         exit(0);
6767 }
6768 EOCP
6769         set intsize
6770         if eval $compile_ok && ./intsize > /dev/null; then
6771                 eval `./intsize`
6772                 echo "Your integers are $intsize bytes long."
6773                 echo "Your long integers are $longsize bytes long."
6774                 echo "Your short integers are $shortsize bytes long."
6775         else
6776                 $cat >&4 <<EOM
6777 !
6778 Help! I can't compile and run the intsize test program: please enlighten me!
6779 (This is probably a misconfiguration in your system or libraries, and
6780 you really ought to fix it.  Still, I'll try anyway.)
6781 !
6782 EOM
6783                 dflt=4
6784                 rp="What is the size of an integer (in bytes)?"
6785                 . ./myread
6786                 intsize="$ans"
6787                 dflt=$intsize
6788                 rp="What is the size of a long integer (in bytes)?"
6789                 . ./myread
6790                 longsize="$ans"
6791                 dflt=2
6792                 rp="What is the size of a short integer (in bytes)?"
6793                 . ./myread
6794                 shortsize="$ans"
6795         fi
6796         ;;
6797 esac
6798 $rm -f intsize intsize.*
6799
6800 : check for long long
6801 echo " "
6802 echo $n "Checking to see if your system supports long long...$c" >&4
6803 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6804 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6805         val="$define"
6806         echo " Yup, it does." >&4
6807 else
6808         val="$undef"
6809         echo " Nope, it doesn't." >&4
6810 fi
6811 $rm try.*
6812 set d_longlong
6813 eval $setvar
6814
6815 : check for length of long long
6816 case "${d_longlong}${longlongsize}" in
6817 $define)
6818         echo " "
6819         $echo $n "Checking to see how big your long longs are...$c" >&4
6820         $cat >try.c <<'EOCP'
6821 #include <stdio.h>
6822 int main()
6823 {
6824         printf("%d\n", sizeof(long long));
6825 }
6826 EOCP
6827         set try
6828         if eval $compile_ok; then
6829                 longlongsize=`./try`
6830                 $echo " $longlongsize bytes." >&4
6831         else
6832                 dflt='8'
6833                 echo " "
6834                 echo "(I can't seem to compile the test program.  Guessing...)"
6835                 rp="What is the size of a long long (in bytes)?"
6836                 . ./myread
6837                 longlongsize="$ans"
6838         fi
6839         if $test "X$longsize" = "X$longlongsize"; then
6840                 echo "(That isn't any different from an ordinary long.)"
6841         fi      
6842         ;;
6843 esac
6844 $rm -f try.c try
6845
6846 echo " "
6847
6848 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6849
6850 echo "Checking how to print 64-bit integers..." >&4
6851
6852 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6853         quad=int
6854         $cat >try.c <<'EOCP'
6855 #include <sys/types.h>
6856 #include <stdio.h>
6857 int main() {
6858   int q = 12345678901;
6859   printf("%ld\n", q);
6860 }
6861 EOCP
6862         set try
6863         if eval $compile; then
6864                 yyy=`./try$exe_ext`
6865                 case "$yyy" in
6866                 12345678901)
6867                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6868                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6869                         echo "We will use %d."
6870                         ;;
6871                 esac
6872         fi
6873 fi
6874
6875 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6876         quad=long
6877         $cat >try.c <<'EOCP'
6878 #include <sys/types.h>
6879 #include <stdio.h>
6880 int main() {
6881   long q = 12345678901;
6882   printf("%ld\n", q);
6883 }
6884 EOCP
6885         set try
6886         if eval $compile; then
6887                 yyy=`./try$exe_ext`
6888                 case "$yyy" in
6889                 12345678901)
6890                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6891                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6892                         echo "We will use %ld."
6893                         ;;
6894                 esac
6895         fi
6896 fi
6897
6898 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6899         quad=int64_t
6900         $cat >try.c <<'EOCP'
6901 #include <sys/types.h>
6902 #include <inttypes.h>
6903 #include <stdio.h>
6904 int main() {
6905   int64_t q = 12345678901;
6906   printf("%" PRId64 "\n", q);
6907 }
6908 EOCP
6909         set try
6910         if eval $compile; then
6911                 yyy=`./try$exe_ext`
6912                 case "$yyy" in
6913                 12345678901)
6914                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6915                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6916                         echo "We will use the C9X style."
6917                         ;;
6918                 esac
6919         fi
6920 fi
6921
6922 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6923         quad="long long"
6924         $cat >try.c <<'EOCP'
6925 #include <sys/types.h>
6926 #include <stdio.h>
6927 int main() {
6928   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6929   printf("%lld\n", q);
6930 }
6931 EOCP
6932         set try
6933         if eval $compile; then
6934                 yyy=`./try$exe_ext`
6935                 case "$yyy" in
6936                 12345678901)
6937                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6938                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6939                         echo "We will use the %lld style."
6940                         ;;
6941                 esac
6942         fi
6943 fi
6944
6945 if $test X"$sPRId64" = X -a X"$quad" != X; then
6946         $cat >try.c <<EOCP
6947 #include <sys/types.h>
6948 #include <stdio.h>
6949 int main() {
6950   $quad q = 12345678901;
6951   printf("%Ld\n", q);
6952 }
6953 EOCP
6954         set try
6955         if eval $compile; then
6956                 yyy=`./try$exe_ext`
6957                 case "$yyy" in
6958                 12345678901)
6959                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6960                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6961                         echo "We will use %lld."
6962                         ;;
6963                 esac
6964         fi
6965 fi
6966
6967 if $test X"$sPRId64" = X -a X"$quad" != X; then
6968         $cat >try.c <<EOCP
6969 #include <sys/types.h>
6970 #include <stdio.h>
6971 int main() {
6972   $quad q = 12345678901;
6973   printf("%qd\n", q);
6974 }
6975 EOCP
6976         set try
6977         if eval $compile; then
6978                 yyy=`./try$exe_ext`
6979                 case "$yyy" in
6980                 12345678901)
6981                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6982                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6983                         echo "We will use %qd."
6984                         ;;
6985                 esac
6986         fi
6987 fi
6988
6989 if $test X"$sPRId64" = X; then
6990         echo "Cannot figure out how to print 64-bit integers." >&4
6991 fi
6992
6993 $rm -f try try.*
6994
6995 fi # intsize -o longsize -o d_int64t -o d_longlong
6996
6997 case "$sPRId64" in
6998 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6999         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7000         ;;
7001 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7002         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7003         ;;
7004 esac
7005
7006 : check for length of double
7007 echo " "
7008 case "$doublesize" in
7009 '')
7010         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7011         $cat >try.c <<'EOCP'
7012 #include <stdio.h>
7013 int main()
7014 {
7015         printf("%d\n", sizeof(double));
7016 }
7017 EOCP
7018         set try
7019         if eval $compile_ok; then
7020                 doublesize=`./try`
7021                 $echo " $doublesize bytes." >&4
7022         else
7023                 dflt='8'
7024                 echo "(I can't seem to compile the test program.  Guessing...)"
7025                 rp="What is the size of a double precision number (in bytes)?"
7026                 . ./myread
7027                 doublesize="$ans"
7028         fi
7029         ;;
7030 esac
7031 $rm -f try.c try
7032
7033 : check for long doubles
7034 echo " "
7035 echo $n "Checking to see if your system supports long double...$c" >&4
7036 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7037 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7038         val="$define"
7039         echo " Yup, it does." >&4
7040 else
7041         val="$undef"
7042         echo " Nope, it doesn't." >&4
7043 fi
7044 $rm try.*
7045 set d_longdbl
7046 eval $setvar
7047
7048 : check for length of long double
7049 case "${d_longdbl}${longdblsize}" in
7050 $define)
7051         echo " "
7052         $echo $n "Checking to see how big your long doubles are...$c" >&4
7053         $cat >try.c <<'EOCP'
7054 #include <stdio.h>
7055 int main()
7056 {
7057         printf("%d\n", sizeof(long double));
7058 }
7059 EOCP
7060         set try
7061         if eval $compile; then
7062                 longdblsize=`./try`
7063                 $echo " $longdblsize bytes." >&4
7064         else
7065                 dflt='8'
7066                 echo " "
7067                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7068                 rp="What is the size of a long double (in bytes)?"
7069                 . ./myread
7070                 longdblsize="$ans"
7071         fi
7072         if $test "X$doublesize" = "X$longdblsize"; then
7073                 echo "(That isn't any different from an ordinary double.)"
7074         fi      
7075         ;;
7076 esac
7077 $rm -f try.c try
7078
7079 echo " "
7080
7081 if $test X"$d_longdbl" = X"$define"; then
7082
7083 echo "Checking how to print long doubles..." >&4
7084
7085 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7086         $cat >try.c <<'EOCP'
7087 #include <sys/types.h>
7088 #include <stdio.h>
7089 int main() {
7090   double d = 123.456;
7091   printf("%.3f\n", d);
7092 }
7093 EOCP
7094         set try
7095         if eval $compile; then
7096                 yyy=`./try$exe_ext`
7097                 case "$yyy" in
7098                 123.456)
7099                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7100                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7101                         echo "We will use %f."
7102                         ;;
7103                 esac
7104         fi
7105 fi
7106
7107 if $test X"$sPRIfldbl" = X; then
7108         $cat >try.c <<'EOCP'
7109 #include <sys/types.h>
7110 #include <stdio.h>
7111 int main() {
7112   long double d = 123.456;
7113   printf("%.3llf\n", d);
7114 }
7115 EOCP
7116         set try
7117         if eval $compile; then
7118                 yyy=`./try$exe_ext`
7119                 case "$yyy" in
7120                 123.456)
7121                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7122                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7123                         echo "We will use %llf."
7124                         ;;
7125                 esac
7126         fi
7127 fi
7128
7129 if $test X"$sPRIfldbl" = X; then
7130         $cat >try.c <<'EOCP'
7131 #include <sys/types.h>
7132 #include <stdio.h>
7133 int main() {
7134   long double d = 123.456;
7135   printf("%.3Lf\n", d);
7136 }
7137 EOCP
7138         set try
7139         if eval $compile; then
7140                 yyy=`./try$exe_ext`
7141                 case "$yyy" in
7142                 123.456)
7143                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7144                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7145                         echo "We will use %Lf."
7146                         ;;
7147                 esac
7148         fi
7149 fi
7150
7151 if $test X"$sPRIfldbl" = X; then
7152         $cat >try.c <<'EOCP'
7153 #include <sys/types.h>
7154 #include <stdio.h>
7155 int main() {
7156   long double d = 123.456;
7157   printf("%.3lf\n", d);
7158 }
7159 EOCP
7160         set try
7161         if eval $compile; then
7162                 yyy=`./try$exe_ext`
7163                 case "$yyy" in
7164                 123.456)
7165                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7166                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7167                         echo "We will use %lf."
7168                         ;;
7169                 esac
7170         fi
7171 fi
7172
7173 if $test X"$sPRIfldbl" = X; then
7174         echo "Cannot figure out how to print long doubles." >&4
7175 fi
7176
7177 $rm -f try try.*
7178
7179 fi # d_longdbl
7180
7181 case "$sPRIfldbl" in
7182 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7183         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7184         ;;
7185 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7186         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7187         ;;
7188 esac
7189
7190 : Initialize h_fcntl
7191 h_fcntl=false
7192
7193 : Initialize h_sysfile
7194 h_sysfile=false
7195
7196 : access call always available on UNIX
7197 set access d_access
7198 eval $inlibc
7199
7200 : locate the flags for 'access()'
7201 case "$d_access" in
7202 "$define")
7203         echo " "
7204         $cat >access.c <<'EOCP'
7205 #include <sys/types.h>
7206 #ifdef I_FCNTL
7207 #include <fcntl.h>
7208 #endif
7209 #ifdef I_SYS_FILE
7210 #include <sys/file.h>
7211 #endif
7212 #ifdef I_UNISTD
7213 #include <unistd.h>
7214 #endif
7215 int main() {
7216         exit(R_OK);
7217 }
7218 EOCP
7219         : check sys/file.h first, no particular reason here
7220         if $test `./findhdr sys/file.h` && \
7221                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7222                 h_sysfile=true;
7223                 echo "<sys/file.h> defines the *_OK access constants." >&4
7224         elif $test `./findhdr fcntl.h` && \
7225                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7226                 h_fcntl=true;
7227                 echo "<fcntl.h> defines the *_OK access constants." >&4
7228         elif $test `./findhdr unistd.h` && \
7229                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7230                 echo "<unistd.h> defines the *_OK access constants." >&4
7231         else
7232                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7233         fi
7234         ;;
7235 esac
7236 $rm -f access*
7237
7238 : see if accessx exists
7239 set accessx d_accessx
7240 eval $inlibc
7241
7242 : see if alarm exists
7243 set alarm d_alarm
7244 eval $inlibc
7245
7246 : see if atolf exists
7247 set atolf d_atolf
7248 eval $inlibc
7249
7250 : see if atoll exists
7251 set atoll d_atoll
7252 eval $inlibc
7253
7254 : Look for GNU-cc style attribute checking
7255 echo " "
7256 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7257 $cat >attrib.c <<'EOCP'
7258 #include <stdio.h>
7259 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7260 EOCP
7261 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7262         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7263                 echo "Your C compiler doesn't fully support __attribute__."
7264                 val="$undef"
7265         else
7266                 echo "Your C compiler supports __attribute__."
7267                 val="$define"
7268         fi
7269 else
7270         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7271         val="$undef"
7272 fi
7273 set d_attribut
7274 eval $setvar
7275 $rm -f attrib*
7276
7277 : see if bcmp exists
7278 set bcmp d_bcmp
7279 eval $inlibc
7280
7281 : see if bcopy exists
7282 set bcopy d_bcopy
7283 eval $inlibc
7284
7285 : see if this is a unistd.h system
7286 set unistd.h i_unistd
7287 eval $inhdr
7288
7289 : see if getpgrp exists
7290 set getpgrp d_getpgrp
7291 eval $inlibc
7292
7293 case "$d_getpgrp" in
7294 "$define")
7295         echo " "
7296         echo "Checking to see which flavor of getpgrp is in use..."
7297         $cat >set.c <<EOP
7298 #$i_unistd I_UNISTD
7299 #include <sys/types.h>
7300 #ifdef I_UNISTD
7301 #  include <unistd.h>
7302 #endif
7303 int main()
7304 {
7305         if (getuid() == 0) {
7306                 printf("(I see you are running Configure as super-user...)\n");
7307                 setuid(1);
7308         }
7309 #ifdef TRY_BSD_PGRP
7310         if (getpgrp(1) == 0)
7311                 exit(0);
7312 #else
7313         if (getpgrp() > 0)
7314                 exit(0);
7315 #endif
7316         exit(1);
7317 }
7318 EOP
7319         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7320                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7321                 val="$define"
7322         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7323                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7324                 val="$undef"
7325         else
7326                 echo "I can't seem to compile and run the test program."
7327                 if ./usg; then
7328                         xxx="a USG one, i.e. you use getpgrp()."
7329                 else
7330                         # SVR4 systems can appear rather BSD-ish.
7331                         case "$i_unistd" in
7332                         $undef)
7333                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7334                                 val="$define"
7335                                 ;;
7336                         $define)
7337                                 xxx="probably a USG one, i.e. you use getpgrp()."
7338                                 val="$undef"
7339                                 ;;
7340                         esac
7341                 fi
7342                 echo "Assuming your getpgrp is $xxx" >&4
7343         fi
7344         ;;
7345 *) val="$undef";;
7346 esac
7347 set d_bsdgetpgrp
7348 eval $setvar
7349 $rm -f set set.c
7350
7351 : see if setpgrp exists
7352 set setpgrp d_setpgrp
7353 eval $inlibc
7354
7355 case "$d_setpgrp" in
7356 "$define")
7357         echo " "
7358         echo "Checking to see which flavor of setpgrp is in use..."
7359         $cat >set.c <<EOP
7360 #$i_unistd I_UNISTD
7361 #include <sys/types.h>
7362 #ifdef I_UNISTD
7363 #  include <unistd.h>
7364 #endif
7365 int main()
7366 {
7367         if (getuid() == 0) {
7368                 printf("(I see you are running Configure as super-user...)\n");
7369                 setuid(1);
7370         }
7371 #ifdef TRY_BSD_PGRP
7372         if (-1 == setpgrp(1, 1))
7373                 exit(0);
7374 #else
7375         if (setpgrp() != -1)
7376                 exit(0);
7377 #endif
7378         exit(1);
7379 }
7380 EOP
7381         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7382                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7383                 val="$define"
7384         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7385                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7386                 val="$undef"
7387         else
7388                 echo "(I can't seem to compile and run the test program.)"
7389                 if ./usg; then
7390                         xxx="a USG one, i.e. you use setpgrp()."
7391                 else
7392                         # SVR4 systems can appear rather BSD-ish.
7393                         case "$i_unistd" in
7394                         $undef)
7395                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7396                                 val="$define"
7397                                 ;;
7398                         $define)
7399                                 xxx="probably a USG one, i.e. you use setpgrp()."
7400                                 val="$undef"
7401                                 ;;
7402                         esac
7403                 fi
7404                 echo "Assuming your setpgrp is $xxx" >&4
7405         fi
7406         ;;
7407 *) val="$undef";;
7408 esac
7409 set d_bsdsetpgrp
7410 eval $setvar
7411 $rm -f set set.c
7412 : see if bzero exists
7413 set bzero d_bzero
7414 eval $inlibc
7415
7416 : see if signal is declared as pointer to function returning int or void
7417 echo " "
7418 xxx=`./findhdr signal.h`
7419 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7420 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7421         echo "You have int (*signal())() instead of void." >&4
7422         val="$undef"
7423 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7424         echo "You have void (*signal())()." >&4
7425         val="$define"
7426 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7427         echo "You have int (*signal())() instead of void." >&4
7428         val="$undef"
7429 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7430         echo "You have void (*signal())()." >&4
7431         val="$define"
7432 else
7433         case "$d_voidsig" in
7434         '')
7435         echo "I can't determine whether signal handler returns void or int..." >&4
7436                 dflt=void
7437                 rp="What type does your signal handler return?"
7438                 . ./myread
7439                 case "$ans" in
7440                 v*) val="$define";;
7441                 *) val="$undef";;
7442                 esac;;
7443         "$define")
7444                 echo "As you already told me, signal handler returns void." >&4
7445                 val="$define"
7446                 ;;
7447         *)      echo "As you already told me, signal handler returns int." >&4
7448                 val="$undef"
7449                 ;;
7450         esac
7451 fi
7452 set d_voidsig
7453 eval $setvar
7454 case "$d_voidsig" in
7455 "$define") signal_t="void";;
7456 *) signal_t="int";;
7457 esac
7458 $rm -f $$.tmp
7459
7460 : check for ability to cast large floats to 32-bit ints.
7461 echo " "
7462 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7463 if $test "$intsize" -ge 4; then
7464         xxx=int
7465 else
7466         xxx=long
7467 fi
7468 $cat >try.c <<EOCP
7469 #include <stdio.h>
7470 #include <sys/types.h>
7471 #include <signal.h>
7472 $signal_t blech(s) int s; { exit(3); }
7473 int main()
7474 {
7475         $xxx i32;
7476         double f, g;
7477         int result = 0;
7478         char str[16];
7479         signal(SIGFPE, blech);
7480
7481         /* Don't let compiler optimize the test away.  Store the number 
7482            in a writable string for gcc to pass to sscanf under HP/UX.
7483         */
7484         sprintf(str, "2147483647");
7485         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7486         g = 10 * f;
7487         i32  = ($xxx) g;
7488
7489         /* x86 processors will probably give 0x8000 0000, which is a
7490        sign change.  We don't want that.  We want to mimic SPARC
7491            behavior here, which is to preserve the sign and give
7492            back 0x7fff ffff.
7493         */
7494         if (i32 != ($xxx) f)
7495                 result |= 1;
7496         exit(result);
7497 }
7498 EOCP
7499 set try
7500 if eval $compile_ok; then
7501         ./try
7502         yyy=$?
7503 else
7504         echo "(I can't seem to compile the test program--assuming it can't)"
7505         yyy=1
7506 fi
7507 case "$yyy" in
7508 0)      val="$define"
7509         echo "Yup, it can."
7510         ;;
7511 *)      val="$undef"
7512         echo "Nope, it can't."
7513         ;;
7514 esac
7515 set d_casti32
7516 eval $setvar
7517 $rm -f try try.*
7518
7519 : check for ability to cast negative floats to unsigned
7520 echo " "
7521 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7522 $cat >try.c <<EOCP
7523 #include <stdio.h>
7524 #include <sys/types.h>
7525 #include <signal.h>
7526 $signal_t blech(s) int s; { exit(7); }
7527 $signal_t blech_in_list(s) int s; { exit(4); }
7528 unsigned long dummy_long(p) unsigned long p; { return p; }
7529 unsigned int dummy_int(p) unsigned int p; { return p; }
7530 unsigned short dummy_short(p) unsigned short p; { return p; }
7531 int main()
7532 {
7533         double f;
7534         unsigned long along;
7535         unsigned int aint;
7536         unsigned short ashort;
7537         int result = 0;
7538         char str[16];
7539         
7540         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7541            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7542            optimized the whole file away
7543         */
7544         /* Store the number in a writable string for gcc to pass to 
7545            sscanf under HP/UX.
7546         */
7547         sprintf(str, "-123");
7548         sscanf(str, "%lf", &f);  /* f = -123.; */
7549
7550         signal(SIGFPE, blech);
7551         along = (unsigned long)f;
7552         aint = (unsigned int)f;
7553         ashort = (unsigned short)f;
7554         if (along != (unsigned long)-123)
7555                 result |= 1;
7556         if (aint != (unsigned int)-123)
7557                 result |= 1;
7558         if (ashort != (unsigned short)-123)
7559                 result |= 1;
7560         sprintf(str, "1073741824.");
7561         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7562         f = f + f;
7563         along = 0;
7564         along = (unsigned long)f;
7565         if (along != 0x80000000)
7566                 result |= 2;
7567         f -= 1.;
7568         along = 0;
7569         along = (unsigned long)f;
7570         if (along != 0x7fffffff)
7571                 result |= 1;
7572         f += 2.;
7573         along = 0;
7574         along = (unsigned long)f;
7575         if (along != 0x80000001)
7576                 result |= 2;
7577         if (result)
7578                 exit(result);
7579         signal(SIGFPE, blech_in_list);
7580         sprintf(str, "123.");
7581         sscanf(str, "%lf", &f);  /* f = 123.; */
7582         along = dummy_long((unsigned long)f);
7583         aint = dummy_int((unsigned int)f);
7584         ashort = dummy_short((unsigned short)f);
7585         if (along != (unsigned long)123)
7586                 result |= 4;
7587         if (aint != (unsigned int)123)
7588                 result |= 4;
7589         if (ashort != (unsigned short)123)
7590                 result |= 4;
7591         exit(result);
7592
7593 }
7594 EOCP
7595 set try
7596 if eval $compile_ok; then
7597         ./try
7598         castflags=$?
7599 else
7600         echo "(I can't seem to compile the test program--assuming it can't)"
7601         castflags=7
7602 fi
7603 case "$castflags" in
7604 0)      val="$define"
7605         echo "Yup, it can."
7606         ;;
7607 *)      val="$undef"
7608         echo "Nope, it can't."
7609         ;;
7610 esac
7611 set d_castneg
7612 eval $setvar
7613 $rm -f try.*
7614
7615 : see if vprintf exists
7616 echo " "
7617 if set vprintf val -f d_vprintf; eval $csym; $val; then
7618         echo 'vprintf() found.' >&4
7619         val="$define"
7620         $cat >vprintf.c <<'EOF'
7621 #include <varargs.h>
7622
7623 int main() { xxx("foo"); }
7624
7625 xxx(va_alist)
7626 va_dcl
7627 {
7628         va_list args;
7629         char buf[10];
7630
7631         va_start(args);
7632         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7633 }
7634 EOF
7635         set vprintf
7636         if eval $compile && ./vprintf; then
7637                 echo "Your vsprintf() returns (int)." >&4
7638                 val2="$undef"
7639         else
7640                 echo "Your vsprintf() returns (char*)." >&4
7641                 val2="$define"
7642         fi
7643 else
7644         echo 'vprintf() NOT found.' >&4
7645                 val="$undef"
7646                 val2="$undef"
7647 fi
7648 set d_vprintf
7649 eval $setvar
7650 val=$val2
7651 set d_charvspr
7652 eval $setvar
7653
7654 : see if chown exists
7655 set chown d_chown
7656 eval $inlibc
7657
7658 : see if chroot exists
7659 set chroot d_chroot
7660 eval $inlibc
7661
7662 : see if chsize exists
7663 set chsize d_chsize
7664 eval $inlibc
7665
7666 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7667 while $test $# -ge 2; do
7668         case "$1" in
7669         $define) echo "#include <$2>";;
7670         esac ;
7671     shift 2;
7672 done > try.c;
7673 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7674 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7675         val="$define";
7676 else
7677         val="$undef";
7678 fi;
7679 set $varname;
7680 eval $setvar;
7681 $rm -f try.c try.o'
7682
7683 : see if this is a sys/uio.h system
7684 set sys/uio.h i_sysuio
7685 eval $inhdr
7686
7687 echo "Checking to see if your system supports struct iovec..." >&4
7688 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7689 eval $hasfield
7690 case "$d_iovec_s" in
7691 "$define")      echo "Yup, it does." >&4
7692                 ;;
7693 *)              echo "Nope, it doesn't." >&4
7694                 ;;
7695 esac
7696
7697 socketlib=''
7698 sockethdr=''
7699 : see whether socket exists
7700 echo " "
7701 $echo $n "Hmm... $c" >&4
7702 if set socket val -f d_socket; eval $csym; $val; then
7703         echo "Looks like you have Berkeley networking support." >&4
7704         d_socket="$define"
7705         if set setsockopt val -f; eval $csym; $val; then
7706                 d_oldsock="$undef"
7707         else
7708                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7709                 d_oldsock="$define"
7710         fi
7711 else
7712         if $contains socklib libc.list >/dev/null 2>&1; then
7713                 echo "Looks like you have Berkeley networking support." >&4
7714                 d_socket="$define"
7715                 : we will have to assume that it supports the 4.2 BSD interface
7716                 d_oldsock="$undef"
7717         else
7718                 echo "You don't have Berkeley networking in libc$_a..." >&4
7719                 if test "X$d_socket" = "X$define"; then
7720                    echo "...but you seem to believe that you have sockets." >&4
7721                 else
7722                         for net in net socket
7723                         do
7724                                 if test -f /usr/lib/lib$net$_a; then
7725                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7726                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7727                                         if $contains socket libc.list >/dev/null 2>&1; then
7728                                                 d_socket="$define"
7729                                                 socketlib="-l$net"
7730                                                 case "$net" in
7731                                                 net)
7732                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7733                                                         sockethdr="-I/usr/netinclude"
7734                                                         ;;
7735                                                 esac
7736                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7737                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7738                                                         d_oldsock="$undef"
7739                                                 else
7740                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7741                                                         d_oldsock="$define"
7742                                                 fi
7743                                                 break
7744                                         fi
7745                                 fi
7746                         done
7747                         if test "X$d_socket" != "X$define"; then
7748                            echo "or anywhere else I see." >&4
7749                            d_socket="$undef"
7750                            d_oldsock="$undef"
7751                         fi
7752                 fi
7753         fi
7754 fi
7755
7756 : see if socketpair exists
7757 set socketpair d_sockpair
7758 eval $inlibc
7759
7760
7761 echo " "
7762 echo "Checking the availability of certain socket constants..." >& 4
7763 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7764         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7765         $cat >try.c <<EOF
7766 #include <sys/types.h>
7767 #include <sys/socket.h>
7768 int main() {
7769     int i = $ENUM;
7770 }
7771 EOF
7772         val="$undef"
7773         set try; if eval $compile; then
7774                 val="$define"
7775         fi
7776         set d_${enum}; eval $setvar
7777         $rm -f try.c try
7778 done
7779
7780 set sendmsg d_sendmsg
7781 eval $inlibc
7782
7783 set recvmsg d_recvmsg
7784 eval $inlibc
7785
7786 echo " "
7787 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7788 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7789 eval $hasfield
7790 case "$d_msghdr_s" in
7791 "$define")      echo "Yup, it does." >&4
7792                 ;;
7793 *)              echo "Nope, it doesn't." >&4
7794                 ;;
7795 esac
7796
7797 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7798 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7799 eval $hasfield
7800 case "$d_cmsghdr_s" in
7801 "$define")      echo "Yup, it does." >&4
7802                 ;;
7803 *)              echo "Nope, it doesn't." >&4
7804                 ;;
7805 esac
7806
7807 : check for const keyword
7808 echo " "
7809 echo 'Checking to see if your C compiler knows about "const"...' >&4
7810 $cat >const.c <<'EOCP'
7811 typedef struct spug { int drokk; } spug;
7812 int main()
7813 {
7814         const char *foo;
7815         const spug y;
7816 }
7817 EOCP
7818 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7819         val="$define"
7820         echo "Yup, it does."
7821 else
7822         val="$undef"
7823         echo "Nope, it doesn't."
7824 fi
7825 set d_const
7826 eval $setvar
7827
7828 : see if crypt exists
7829 echo " "
7830 if set crypt val -f d_crypt; eval $csym; $val; then
7831         echo 'crypt() found.' >&4
7832         val="$define"
7833         cryptlib=''
7834 else
7835         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7836         if $test -z "$cryptlib"; then
7837                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7838         else
7839                 cryptlib=-lcrypt
7840         fi
7841         if $test -z "$cryptlib"; then
7842                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7843         else
7844                 cryptlib=-lcrypt
7845         fi
7846         if $test -z "$cryptlib"; then
7847                 cryptlib=`./loc libcrypt$_a "" $libpth`
7848         else
7849                 cryptlib=-lcrypt
7850         fi
7851         if $test -z "$cryptlib"; then
7852                 echo 'crypt() NOT found.' >&4
7853                 val="$undef"
7854         else
7855                 val="$define"
7856         fi
7857 fi
7858 set d_crypt
7859 eval $setvar
7860
7861 : get csh whereabouts
7862 case "$csh" in
7863 'csh') val="$undef" ;;
7864 *) val="$define" ;;
7865 esac
7866 set d_csh
7867 eval $setvar
7868 : Respect a hint or command line value for full_csh.
7869 case "$full_csh" in
7870 '') full_csh=$csh ;;
7871 esac
7872
7873 : see if cuserid exists
7874 set cuserid d_cuserid
7875 eval $inlibc
7876
7877 : see if this is a limits.h system
7878 set limits.h i_limits
7879 eval $inhdr
7880
7881 : see if this is a float.h system
7882 set float.h i_float
7883 eval $inhdr
7884
7885 : See if number of significant digits in a double precision number is known
7886 echo " "
7887 $cat >dbl_dig.c <<EOM
7888 #$i_limits I_LIMITS
7889 #$i_float I_FLOAT
7890 #ifdef I_LIMITS
7891 #include <limits.h>
7892 #endif
7893 #ifdef I_FLOAT
7894 #include <float.h>
7895 #endif
7896 #ifdef DBL_DIG
7897 printf("Contains DBL_DIG");
7898 #endif
7899 EOM
7900 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7901 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7902         echo "DBL_DIG found." >&4
7903         val="$define"
7904 else
7905         echo "DBL_DIG NOT found." >&4
7906         val="$undef"
7907 fi
7908 $rm -f dbl_dig.?
7909 set d_dbl_dig
7910 eval $setvar
7911
7912 : see if difftime exists
7913 set difftime d_difftime
7914 eval $inlibc
7915
7916 : see if this is a dirent system
7917 echo " "
7918 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7919         val="$define"
7920         echo "<dirent.h> found." >&4
7921 else
7922         val="$undef"
7923         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7924                 echo "<sys/dir.h> found." >&4
7925                 echo " "
7926         else
7927                 xinc=`./findhdr sys/ndir.h`
7928         fi
7929         echo "<dirent.h> NOT found." >&4
7930 fi
7931 set i_dirent
7932 eval $setvar
7933
7934 : Look for type of directory structure.
7935 echo " "
7936 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7937
7938 case "$direntrytype" in
7939 ''|' ')
7940         case "$i_dirent" in
7941         $define) guess1='struct dirent' ;;
7942         *) guess1='struct direct'  ;;
7943         esac
7944         ;;
7945 *)      guess1="$direntrytype"
7946         ;;
7947 esac
7948
7949 case "$guess1" in
7950 'struct dirent') guess2='struct direct' ;;
7951 *) guess2='struct dirent' ;;
7952 esac
7953                 
7954 if $contains "$guess1" try.c >/dev/null 2>&1; then
7955         direntrytype="$guess1"
7956         echo "Your directory entries are $direntrytype." >&4
7957 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7958         direntrytype="$guess2"
7959         echo "Your directory entries seem to be $direntrytype." >&4
7960 else
7961         echo "I don't recognize your system's directory entries." >&4
7962         rp="What type is used for directory entries on this system?"
7963         dflt="$guess1"
7964         . ./myread
7965         direntrytype="$ans"
7966 fi
7967 $rm -f try.c
7968
7969
7970 : see if the directory entry stores field length
7971 echo " "
7972 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7973 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7974         echo "Good, your directory entry keeps length information in d_namlen." >&4
7975         val="$define"
7976 else
7977         echo "Your directory entry does not know about the d_namlen field." >&4
7978         val="$undef"
7979 fi
7980 set d_dirnamlen
7981 eval $setvar
7982 $rm -f try.c
7983
7984 : see if dlerror exists
7985 xxx_runnm="$runnm"
7986 runnm=false
7987 set dlerror d_dlerror
7988 eval $inlibc
7989 runnm="$xxx_runnm"
7990
7991 : see if dlfcn is available
7992 set dlfcn.h i_dlfcn
7993 eval $inhdr
7994
7995 case "$usedl" in
7996 $define|y|true)
7997         $cat << EOM
7998
7999 On a few systems, the dynamically loaded modules that perl generates and uses
8000 will need a different extension than shared libs. The default will probably
8001 be appropriate.
8002
8003 EOM
8004         case "$dlext" in
8005         '')     dflt="$so" ;;
8006         *)      dflt="$dlext" ;;
8007         esac
8008         rp='What is the extension of dynamically loaded modules'
8009         . ./myread
8010         dlext="$ans"
8011         ;;
8012 *)
8013         dlext="none"
8014         ;;
8015 esac
8016
8017 : Check if dlsym need a leading underscore
8018 echo " "
8019 val="$undef"
8020
8021 case "$dlsrc" in
8022 dl_dlopen.xs)
8023         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8024         $cat >dyna.c <<'EOM'
8025 fred () { }
8026 EOM
8027
8028 $cat >fred.c<<EOM
8029
8030 #include <stdio.h>
8031 #$i_dlfcn I_DLFCN
8032 #ifdef I_DLFCN
8033 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8034 #else
8035 #include <sys/types.h>
8036 #include <nlist.h>
8037 #include <link.h>
8038 #endif
8039
8040 extern int fred() ;
8041
8042 int main()
8043 {
8044     void * handle ;
8045     void * symbol ;
8046 #ifndef RTLD_LAZY
8047     int mode = 1 ;
8048 #else
8049     int mode = RTLD_LAZY ;
8050 #endif
8051     handle = dlopen("./dyna.$dlext", mode) ;
8052     if (handle == NULL) {
8053         printf ("1\n") ;
8054         fflush (stdout) ;
8055         exit(0);
8056     }
8057     symbol = dlsym(handle, "fred") ;
8058     if (symbol == NULL) {
8059         /* try putting a leading underscore */
8060         symbol = dlsym(handle, "_fred") ;
8061         if (symbol == NULL) {
8062             printf ("2\n") ;
8063             fflush (stdout) ;
8064             exit(0);
8065         }
8066         printf ("3\n") ;
8067     }
8068     else
8069         printf ("4\n") ;
8070     fflush (stdout) ;
8071     exit(0);
8072 }
8073 EOM
8074         : Call the object file tmp-dyna.o in case dlext=o.
8075         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8076                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8077                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8078                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8079                 xxx=`./fred`
8080                 case $xxx in
8081                 1)      echo "Test program failed using dlopen." >&4
8082                         echo "Perhaps you should not use dynamic loading." >&4;;
8083                 2)      echo "Test program failed using dlsym." >&4
8084                         echo "Perhaps you should not use dynamic loading." >&4;;
8085                 3)      echo "dlsym needs a leading underscore" >&4
8086                         val="$define" ;;
8087                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8088                 esac
8089         else
8090                 echo "I can't compile and run the test program." >&4
8091                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8092         fi
8093         ;;
8094 esac
8095                 
8096 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8097
8098 set d_dlsymun
8099 eval $setvar
8100
8101 hasproto='varname=$1; func=$2; shift; shift;
8102 while $test $# -ge 2; do
8103         case "$1" in
8104         $define) echo "#include <$2>";;
8105         esac ;
8106     shift 2;
8107 done > try.c;
8108 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8109 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8110         echo "$func() prototype found.";
8111         val="$define";
8112 else
8113         echo "$func() prototype NOT found.";
8114         val="$undef";
8115 fi;
8116 set $varname;
8117 eval $setvar;
8118 $rm -f try.c tryout.c'
8119
8120 : see if prototype for drand48 is available
8121 echo " "
8122 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8123 eval $hasproto
8124
8125 : see if dup2 exists
8126 set dup2 d_dup2
8127 eval $inlibc
8128
8129 : see if eaccess exists
8130 set eaccess d_eaccess
8131 eval $inlibc
8132
8133 : see if endgrent exists
8134 set endgrent d_endgrent
8135 eval $inlibc
8136
8137 : see if endhostent exists
8138 set endhostent d_endhent
8139 eval $inlibc
8140
8141 : see if endnetent exists
8142 set endnetent d_endnent
8143 eval $inlibc
8144
8145 : see if endprotoent exists
8146 set endprotoent d_endpent
8147 eval $inlibc
8148
8149 : see if endpwent exists
8150 set endpwent d_endpwent
8151 eval $inlibc
8152
8153 : see if endservent exists
8154 set endservent d_endsent
8155 eval $inlibc
8156
8157 : see if endspent exists
8158 set endspent d_endspent
8159 eval $inlibc
8160
8161 : Locate the flags for 'open()'
8162 echo " "
8163 $cat >open3.c <<'EOCP'
8164 #include <sys/types.h>
8165 #ifdef I_FCNTL
8166 #include <fcntl.h>
8167 #endif
8168 #ifdef I_SYS_FILE
8169 #include <sys/file.h>
8170 #endif
8171 int main() {
8172         if(O_RDONLY);
8173 #ifdef O_TRUNC
8174         exit(0);
8175 #else
8176         exit(1);
8177 #endif
8178 }
8179 EOCP
8180 : check sys/file.h first to get FREAD on Sun
8181 if $test `./findhdr sys/file.h` && \
8182                 set open3 -DI_SYS_FILE && eval $compile; then
8183         h_sysfile=true;
8184         echo "<sys/file.h> defines the O_* constants..." >&4
8185         if ./open3; then
8186                 echo "and you have the 3 argument form of open()." >&4
8187                 val="$define"
8188         else
8189                 echo "but not the 3 argument form of open().  Oh, well." >&4
8190                 val="$undef"
8191         fi
8192 elif $test `./findhdr fcntl.h` && \
8193                 set open3 -DI_FCNTL && eval $compile; then
8194         h_fcntl=true;
8195         echo "<fcntl.h> defines the O_* constants..." >&4
8196         if ./open3; then
8197                 echo "and you have the 3 argument form of open()." >&4
8198                 val="$define"
8199         else
8200                 echo "but not the 3 argument form of open().  Oh, well." >&4
8201                 val="$undef"
8202         fi
8203 else
8204         val="$undef"
8205         echo "I can't find the O_* constant definitions!  You got problems." >&4
8206 fi
8207 set d_open3
8208 eval $setvar
8209 $rm -f open3*
8210
8211 : check for non-blocking I/O stuff
8212 case "$h_sysfile" in
8213 true) echo "#include <sys/file.h>" > head.c;;
8214 *)
8215         case "$h_fcntl" in
8216         true) echo "#include <fcntl.h>" > head.c;;
8217         *) echo "#include <sys/fcntl.h>" > head.c;;
8218         esac
8219         ;;
8220 esac
8221 echo " "
8222 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8223 case "$o_nonblock" in
8224 '')
8225         $cat head.c > try.c
8226         $cat >>try.c <<'EOCP'
8227 int main() {
8228 #ifdef O_NONBLOCK
8229         printf("O_NONBLOCK\n");
8230         exit(0);
8231 #endif
8232 #ifdef O_NDELAY
8233         printf("O_NDELAY\n");
8234         exit(0);
8235 #endif
8236 #ifdef FNDELAY
8237         printf("FNDELAY\n");
8238         exit(0);
8239 #endif
8240         exit(0);
8241 }
8242 EOCP
8243         set try
8244         if eval $compile_ok; then
8245                 o_nonblock=`./try`
8246                 case "$o_nonblock" in
8247                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8248                 *) echo "Seems like we can use $o_nonblock.";;
8249                 esac
8250         else
8251                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8252         fi
8253         ;;
8254 *) echo "Using $hint value $o_nonblock.";;
8255 esac
8256 $rm -f try try.* .out core
8257
8258 echo " "
8259 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8260 case "$eagain" in
8261 '')
8262         $cat head.c > try.c
8263         $cat >>try.c <<EOCP
8264 #include <errno.h>
8265 #include <sys/types.h>
8266 #include <signal.h>
8267 #define MY_O_NONBLOCK $o_nonblock
8268 #ifndef errno  /* XXX need better Configure test */
8269 extern int errno;
8270 #endif
8271 $signal_t blech(x) int x; { exit(3); }
8272 EOCP
8273         $cat >> try.c <<'EOCP'
8274 int main()
8275 {
8276         int pd[2];
8277         int pu[2];
8278         char buf[1];
8279         char string[100];
8280
8281         pipe(pd);       /* Down: child -> parent */
8282         pipe(pu);       /* Up: parent -> child */
8283         if (0 != fork()) {
8284                 int ret;
8285                 close(pd[1]);   /* Parent reads from pd[0] */
8286                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8287                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8288                         exit(1);
8289                 signal(SIGALRM, blech);
8290                 alarm(5);
8291                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8292                         exit(2);
8293                 sprintf(string, "%d\n", ret);
8294                 write(2, string, strlen(string));
8295                 alarm(0);
8296 #ifdef EAGAIN
8297                 if (errno == EAGAIN) {
8298                         printf("EAGAIN\n");
8299                         goto ok;
8300                 }
8301 #endif
8302 #ifdef EWOULDBLOCK
8303                 if (errno == EWOULDBLOCK)
8304                         printf("EWOULDBLOCK\n");
8305 #endif
8306         ok:
8307                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8308                 sleep(2);                               /* Give it time to close our pipe */
8309                 alarm(5);
8310                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8311                 alarm(0);
8312                 sprintf(string, "%d\n", ret);
8313                 write(3, string, strlen(string));
8314                 exit(0);
8315         }
8316
8317         close(pd[0]);                   /* We write to pd[1] */
8318         close(pu[1]);                   /* We read from pu[0] */
8319         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8320         close(pd[1]);                   /* Pipe pd is now fully closed! */
8321         exit(0);                                /* Bye bye, thank you for playing! */
8322 }
8323 EOCP
8324         set try
8325         if eval $compile_ok; then
8326                 echo "$startsh" >mtry
8327                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8328                 chmod +x mtry
8329                 ./mtry >/dev/null 2>&1
8330                 case $? in
8331                 0) eagain=`$cat try.out`;;
8332                 1) echo "Could not perform non-blocking setting!";;
8333                 2) echo "I did a successful read() for something that was not there!";;
8334                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8335                 *) echo "Something terribly wrong happened during testing.";;
8336                 esac
8337                 rd_nodata=`$cat try.ret`
8338                 echo "A read() system call with no data present returns $rd_nodata."
8339                 case "$rd_nodata" in
8340                 0|-1) ;;
8341                 *)
8342                         echo "(That's peculiar, fixing that to be -1.)"
8343                         rd_nodata=-1
8344                         ;;
8345                 esac
8346                 case "$eagain" in
8347                 '')
8348                         echo "Forcing errno EAGAIN on read() with no data available."
8349                         eagain=EAGAIN
8350                         ;;
8351                 *)
8352                         echo "Your read() sets errno to $eagain when no data is available."
8353                         ;;
8354                 esac
8355                 status=`$cat try.err`
8356                 case "$status" in
8357                 0) echo "And it correctly returns 0 to signal EOF.";;
8358                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8359                 *) echo "However, your read() returns '$status' on EOF??";;
8360                 esac
8361                 val="$define"
8362                 if test "$status" = "$rd_nodata"; then
8363                         echo "WARNING: you can't distinguish between EOF and no data!"
8364                         val="$undef"
8365                 fi
8366         else
8367                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8368                 eagain=EAGAIN
8369         fi
8370         set d_eofnblk
8371         eval $setvar
8372         ;;
8373 *)
8374         echo "Using $hint value $eagain."
8375         echo "Your read() returns $rd_nodata when no data is present."
8376         case "$d_eofnblk" in
8377         "$define") echo "And you can see EOF because read() returns 0.";;
8378         "$undef") echo "But you can't see EOF status from read() returned value.";;
8379         *)
8380                 echo "(Assuming you can't see EOF status from read anyway.)"
8381                 d_eofnblk=$undef
8382                 ;;
8383         esac
8384         ;;
8385 esac
8386 $rm -f try try.* .out core head.c mtry
8387
8388 : see if fchmod exists
8389 set fchmod d_fchmod
8390 eval $inlibc
8391
8392 : see if fchown exists
8393 set fchown d_fchown
8394 eval $inlibc
8395
8396 : see if this is an fcntl system
8397 set fcntl d_fcntl
8398 eval $inlibc
8399
8400 : see if sys/select.h has to be included
8401 set sys/select.h i_sysselct
8402 eval $inhdr
8403
8404 : see if we should include time.h, sys/time.h, or both
8405 echo " "
8406 if test "X$timeincl" = X; then
8407         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8408         $echo $n "I'm now running the test program...$c"
8409         $cat >try.c <<'EOCP'
8410 #include <sys/types.h>
8411 #ifdef I_TIME
8412 #include <time.h>
8413 #endif
8414 #ifdef I_SYSTIME
8415 #ifdef SYSTIMEKERNEL
8416 #define KERNEL
8417 #endif
8418 #include <sys/time.h>
8419 #endif
8420 #ifdef I_SYSSELECT
8421 #include <sys/select.h>
8422 #endif
8423 int main()
8424 {
8425         struct tm foo;
8426 #ifdef S_TIMEVAL
8427         struct timeval bar;
8428 #endif
8429 #ifdef S_TIMEZONE
8430         struct timezone tzp;
8431 #endif
8432         if (foo.tm_sec == foo.tm_sec)
8433                 exit(0);
8434 #ifdef S_TIMEVAL
8435         if (bar.tv_sec == bar.tv_sec)
8436                 exit(0);
8437 #endif
8438         exit(1);
8439 }
8440 EOCP
8441         flags=''
8442         for s_timezone in '-DS_TIMEZONE' ''; do
8443         sysselect=''
8444         for s_timeval in '-DS_TIMEVAL' ''; do
8445         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8446         for i_time in '' '-DI_TIME'; do
8447         for i_systime in '-DI_SYSTIME' ''; do
8448                 case "$flags" in
8449                 '') $echo $n ".$c"
8450                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8451                         if eval $compile; then
8452                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8453                                 shift
8454                                 flags="$*"
8455                                 echo " "
8456                                 $echo $n "Succeeded with $flags$c"
8457                         fi
8458                         ;;
8459                 esac
8460         done
8461         done
8462         done
8463         done
8464         done
8465         timeincl=''
8466         echo " "
8467         case "$flags" in
8468         *SYSTIMEKERNEL*) i_systimek="$define"
8469                 timeincl=`./findhdr sys/time.h`
8470                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8471         *) i_systimek="$undef";;
8472         esac
8473         case "$flags" in
8474         *I_TIME*) i_time="$define"
8475                 timeincl=`./findhdr time.h`" $timeincl"
8476                 echo "We'll include <time.h>." >&4;;
8477         *) i_time="$undef";;
8478         esac
8479         case "$flags" in
8480         *I_SYSTIME*) i_systime="$define"
8481                 timeincl=`./findhdr sys/time.h`" $timeincl"
8482                 echo "We'll include <sys/time.h>." >&4;;
8483         *) i_systime="$undef";;
8484         esac
8485         $rm -f try.c try
8486 fi
8487
8488 : check for fd_set items
8489 $cat <<EOM
8490
8491 Checking to see how well your C compiler handles fd_set and friends ...
8492 EOM
8493 $cat >fd_set.c <<EOCP
8494 #$i_systime I_SYS_TIME
8495 #$i_sysselct I_SYS_SELECT
8496 #$d_socket HAS_SOCKET
8497 #include <sys/types.h>
8498 #ifdef HAS_SOCKET
8499 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8500 #endif
8501 #ifdef I_SYS_TIME
8502 #include <sys/time.h>
8503 #endif
8504 #ifdef I_SYS_SELECT
8505 #include <sys/select.h>
8506 #endif
8507 int main() {
8508         fd_set fds;
8509
8510 #ifdef TRYBITS
8511         if(fds.fds_bits);
8512 #endif
8513
8514 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8515         exit(0);
8516 #else
8517         exit(1);
8518 #endif
8519 }
8520 EOCP
8521 set fd_set -DTRYBITS
8522 if eval $compile; then
8523         d_fds_bits="$define"
8524         d_fd_set="$define"
8525         echo "Well, your system knows about the normal fd_set typedef..." >&4
8526         if ./fd_set; then
8527                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8528                 d_fd_macros="$define"
8529         else
8530                 $cat >&4 <<'EOM'
8531 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8532 EOM
8533                 d_fd_macros="$undef"
8534         fi
8535 else
8536         $cat <<'EOM'
8537 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8538 EOM
8539         set fd_set
8540         if eval $compile; then
8541                 d_fds_bits="$undef"
8542                 d_fd_set="$define"
8543                 echo "Well, your system has some sort of fd_set available..." >&4
8544                 if ./fd_set; then
8545                         echo "and you have the normal fd_set macros." >&4
8546                         d_fd_macros="$define"
8547                 else
8548                         $cat <<'EOM'
8549 but not the normal fd_set macros!  Gross!  More work for me...
8550 EOM
8551                         d_fd_macros="$undef"
8552                 fi
8553         else
8554         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8555                 d_fd_set="$undef"
8556                 d_fds_bits="$undef"
8557                 d_fd_macros="$undef"
8558         fi
8559 fi
8560 $rm -f fd_set*
8561
8562 : see if fgetpos exists
8563 set fgetpos d_fgetpos
8564 eval $inlibc
8565
8566 : see if flock exists
8567 set flock d_flock
8568 eval $inlibc
8569
8570 : see if fork exists
8571 set fork d_fork
8572 eval $inlibc
8573
8574 : see if pathconf exists
8575 set pathconf d_pathconf
8576 eval $inlibc
8577
8578 : see if fpathconf exists
8579 set fpathconf d_fpathconf
8580 eval $inlibc
8581
8582
8583 : see if llseek exists
8584 set llseek d_llseek
8585 eval $inlibc
8586
8587 : check for off64_t
8588 echo " "
8589 echo $n "Checking to see if your system supports off64_t...$c" >&4
8590 $cat >try.c <<EOCP
8591 #include <sys/types.h>
8592 #include <unistd.h>
8593 off64_t foo() { off64_t x; x = 7; return x; }'
8594 EOCP
8595 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8596         val="$define"
8597         echo " Yup, it does." >&4
8598 else
8599         val="$undef"
8600         echo " Nope, it doesn't." >&4
8601 fi
8602 $rm -f try.*
8603 set d_off64_t
8604 eval $setvar
8605
8606 : check for fpos64_t
8607 echo " "
8608 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8609 $cat >try.c <<EOCP
8610 #include <sys/stdio.h>
8611 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8612 EOCP
8613 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8614         val="$define"
8615         echo " Yup, it does." >&4
8616 else
8617         val="$undef"
8618         echo " Nope, it doesn't." >&4
8619 fi
8620 $rm -f try.*
8621 set d_fpos64_t
8622 eval $setvar
8623
8624 : see if fseeko exists
8625 set fseeko d_fseeko
8626 eval $inlibc
8627
8628 : see if fsetpos exists
8629 set fsetpos d_fsetpos
8630 eval $inlibc
8631
8632 : see if this is a sys/param system
8633 set sys/param.h i_sysparam
8634 eval $inhdr
8635
8636 : see if this is a sys/mount.h system
8637 set sys/mount.h i_sysmount
8638 eval $inhdr
8639
8640
8641 : see if statfs exists
8642 set statfs d_statfs
8643 eval $inlibc
8644
8645 : see if fstatfs exists
8646 set fstatfs d_fstatfs
8647 eval $inlibc
8648
8649 : see if statfs knows about mount flags
8650 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8651 eval $hasfield
8652
8653
8654 : see if statvfs exists
8655 set statvfs d_statvfs
8656 eval $inlibc
8657
8658 : see if fstatvfs exists
8659 set fstatvfs d_fstatvfs
8660 eval $inlibc
8661
8662
8663 : see if ftello exists
8664 set ftello d_ftello
8665 eval $inlibc
8666
8667 : see if getgrent exists
8668 set getgrent d_getgrent
8669 eval $inlibc
8670
8671 : see if gethostbyaddr exists
8672 set gethostbyaddr d_gethbyaddr
8673 eval $inlibc
8674
8675 : see if gethostbyname exists
8676 set gethostbyname d_gethbyname
8677 eval $inlibc
8678
8679 : see if gethostent exists
8680 set gethostent d_gethent
8681 eval $inlibc
8682
8683 : see how we will look up host name
8684 echo " "
8685 call=''
8686 if set gethostname val -f d_gethname; eval $csym; $val; then
8687         echo 'gethostname() found.' >&4
8688         d_gethname="$define"
8689         call=gethostname
8690 fi
8691 if set uname val -f d_uname; eval $csym; $val; then
8692         if ./xenix; then
8693                 $cat <<'EOM'
8694 uname() was found, but you're running xenix, and older versions of xenix
8695 have a broken uname(). If you don't really know whether your xenix is old
8696 enough to have a broken system call, use the default answer.
8697
8698 EOM
8699                 dflt=y
8700                 case "$d_uname" in
8701                 "$define") dflt=n;;
8702                 esac
8703                 rp='Is your uname() broken?'
8704                 . ./myread
8705                 case "$ans" in
8706                 n*) d_uname="$define"; call=uname;;
8707                 esac
8708         else
8709                 echo 'uname() found.' >&4
8710                 d_uname="$define"
8711                 case "$call" in
8712                 '') call=uname ;;
8713                 esac
8714         fi
8715 fi
8716 case "$d_gethname" in
8717 '') d_gethname="$undef";;
8718 esac
8719 case "$d_uname" in
8720 '') d_uname="$undef";;
8721 esac
8722 case "$d_uname$d_gethname" in
8723 *define*)
8724         dflt=n
8725         cat <<EOM
8726  
8727 Every now and then someone has a $call() that lies about the hostname
8728 but can't be fixed for political or economic reasons.  If you wish, I can
8729 pretend $call() isn't there and maybe compute hostname at run-time
8730 thanks to the '$phostname' command.
8731
8732 EOM
8733         rp="Shall I ignore $call() from now on?"
8734         . ./myread
8735         case "$ans" in
8736         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8737         esac;;
8738 esac
8739 case "$phostname" in
8740 '') aphostname='';;
8741 *) case "$aphostname" in
8742         /*) ;;
8743         *) set X $phostname
8744                 shift
8745                 file=$1
8746                 shift
8747                 file=`./loc $file $file $pth`
8748                 aphostname=`echo $file $*`
8749                 ;;
8750         esac
8751         ;;
8752 esac
8753 case "$d_uname$d_gethname" in
8754 *define*) ;;
8755 *)
8756         case "$phostname" in
8757         '')
8758                 echo "There will be no way for $package to get your hostname." >&4;;
8759         *)
8760         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8761                 ;;
8762         esac;;
8763 esac
8764 case "$d_phostname" in
8765 '') d_phostname="$undef";;
8766 esac
8767
8768 : see if this is a netdb.h system
8769 set netdb.h i_netdb
8770 eval $inhdr
8771
8772 : see if prototypes for various gethostxxx netdb.h functions are available
8773 echo " "
8774 set d_gethostprotos gethostent $i_netdb netdb.h
8775 eval $hasproto
8776
8777 : see if getlogin exists
8778 set getlogin d_getlogin
8779 eval $inlibc
8780
8781 : see if getmntent exists
8782 set getmntent d_getmntent
8783 eval $inlibc
8784
8785 : see if getnetbyaddr exists
8786 set getnetbyaddr d_getnbyaddr
8787 eval $inlibc
8788
8789 : see if getnetbyname exists
8790 set getnetbyname d_getnbyname
8791 eval $inlibc
8792
8793 : see if getnetent exists
8794 set getnetent d_getnent
8795 eval $inlibc
8796
8797 : see if prototypes for various getnetxxx netdb.h functions are available
8798 echo " "
8799 set d_getnetprotos getnetent $i_netdb netdb.h
8800 eval $hasproto
8801
8802
8803 : see if getprotobyname exists
8804 set getprotobyname d_getpbyname
8805 eval $inlibc
8806
8807 : see if getprotobynumber exists
8808 set getprotobynumber d_getpbynumber
8809 eval $inlibc
8810
8811 : see if getprotoent exists
8812 set getprotoent d_getpent
8813 eval $inlibc
8814
8815 : see if getpgid exists
8816 set getpgid d_getpgid
8817 eval $inlibc
8818
8819 : see if getpgrp2 exists
8820 set getpgrp2 d_getpgrp2
8821 eval $inlibc
8822
8823 : see if getppid exists
8824 set getppid d_getppid
8825 eval $inlibc
8826
8827 : see if getpriority exists
8828 set getpriority d_getprior
8829 eval $inlibc
8830
8831 : see if prototypes for various getprotoxxx netdb.h functions are available
8832 echo " "
8833 set d_getprotoprotos getprotoent $i_netdb netdb.h
8834 eval $hasproto
8835
8836 : see if getpwent exists
8837 set getpwent d_getpwent
8838 eval $inlibc
8839
8840
8841 : see if getservbyname exists
8842 set getservbyname d_getsbyname
8843 eval $inlibc
8844
8845 : see if getservbyport exists
8846 set getservbyport d_getsbyport
8847 eval $inlibc
8848
8849 : see if getservent exists
8850 set getservent d_getsent
8851 eval $inlibc
8852
8853 : see if prototypes for various getservxxx netdb.h functions are available
8854 echo " "
8855 set d_getservprotos getservent $i_netdb netdb.h
8856 eval $hasproto
8857
8858 : see if getspent exists
8859 set getspent d_getspent
8860 eval $inlibc
8861
8862 : see if getspnam exists
8863 set getspnam d_getspnam
8864 eval $inlibc
8865
8866 : see if gettimeofday or ftime exists
8867 set gettimeofday d_gettimeod
8868 eval $inlibc
8869 case "$d_gettimeod" in
8870 "$undef")
8871         set ftime d_ftime 
8872         eval $inlibc
8873         ;;
8874 *)
8875         val="$undef"; set d_ftime; eval $setvar
8876         ;;
8877 esac
8878 case "$d_gettimeod$d_ftime" in
8879 "$undef$undef")
8880         echo " "
8881         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8882         ;;
8883 esac
8884
8885 : see if this is an grp system
8886 set grp.h i_grp
8887 eval $inhdr
8888
8889 case "$i_grp" in
8890 $define)
8891         xxx=`./findhdr grp.h`
8892         $cppstdin $cppflags $cppminus < $xxx >$$.h
8893
8894         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8895                 val="$define"
8896         else
8897                 val="$undef"
8898         fi
8899         set d_grpasswd
8900         eval $setvar
8901
8902         $rm -f $$.h
8903         ;;
8904 *)
8905         val="$undef";
8906         set d_grpasswd; eval $setvar
8907         ;;
8908 esac
8909
8910 : see if hasmntopt exists
8911 set hasmntopt d_hasmntopt
8912 eval $inlibc
8913
8914 : see if this is a netinet/in.h or sys/in.h system
8915 set netinet/in.h i_niin sys/in.h i_sysin
8916 eval $inhdr
8917
8918 : see if arpa/inet.h has to be included
8919 set arpa/inet.h i_arpainet
8920 eval $inhdr
8921
8922 : see if htonl --and friends-- exists
8923 val=''
8924 set htonl val
8925 eval $inlibc
8926
8927 : Maybe they are macros.
8928 case "$val" in
8929 $undef)
8930         $cat >htonl.c <<EOM
8931 #include <stdio.h>
8932 #include <sys/types.h>
8933 #$i_niin I_NETINET_IN
8934 #$i_sysin I_SYS_IN
8935 #$i_arpainet I_ARPA_INET
8936 #ifdef I_NETINET_IN
8937 #include <netinet/in.h>
8938 #endif
8939 #ifdef I_SYS_IN
8940 #include <sys/in.h>
8941 #endif
8942 #ifdef I_ARPA_INET
8943 #include <arpa/inet.h>
8944 #endif
8945 #ifdef htonl
8946 printf("Defined as a macro.");
8947 #endif
8948 EOM
8949         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8950         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8951                 val="$define"
8952                 echo "But it seems to be defined as a macro." >&4
8953         fi
8954         $rm -f htonl.?
8955         ;;
8956 esac
8957 set d_htonl
8958 eval $setvar
8959
8960 : see which of string.h or strings.h is needed
8961 echo " "
8962 strings=`./findhdr string.h`
8963 if $test "$strings" && $test -r "$strings"; then
8964         echo "Using <string.h> instead of <strings.h>." >&4
8965         val="$define"
8966 else
8967         val="$undef"
8968         strings=`./findhdr strings.h`
8969         if $test "$strings" && $test -r "$strings"; then
8970                 echo "Using <strings.h> instead of <string.h>." >&4
8971         else
8972                 echo "No string header found -- You'll surely have problems." >&4
8973         fi
8974 fi
8975 set i_string
8976 eval $setvar
8977 case "$i_string" in
8978 "$undef") strings=`./findhdr strings.h`;;
8979 *)        strings=`./findhdr string.h`;;
8980 esac
8981
8982 : index or strchr
8983 echo " "
8984 if set index val -f; eval $csym; $val; then
8985         if set strchr val -f d_strchr; eval $csym; $val; then
8986                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8987                         val="$define"
8988                         vali="$undef"
8989                         echo "strchr() found." >&4
8990                 else
8991                         val="$undef"
8992                         vali="$define"
8993                         echo "index() found." >&4
8994                 fi
8995         else
8996                 val="$undef"
8997                 vali="$define"
8998                 echo "index() found." >&4
8999         fi
9000 else
9001         if set strchr val -f d_strchr; eval $csym; $val; then
9002                 val="$define"
9003                 vali="$undef"
9004                 echo "strchr() found." >&4
9005         else
9006                 echo "No index() or strchr() found!" >&4
9007                 val="$undef"
9008                 vali="$undef"
9009         fi
9010 fi
9011 set d_strchr; eval $setvar
9012 val="$vali"
9013 set d_index; eval $setvar
9014
9015 : check whether inet_aton exists
9016 set inet_aton d_inetaton
9017 eval $inlibc
9018
9019 : Look for isascii
9020 echo " "
9021 $cat >isascii.c <<'EOCP'
9022 #include <stdio.h>
9023 #include <ctype.h>
9024 int main() {
9025         int c = 'A';
9026         if (isascii(c))
9027                 exit(0);
9028         else
9029                 exit(1);
9030 }
9031 EOCP
9032 set isascii
9033 if eval $compile; then
9034         echo "isascii() found." >&4
9035         val="$define"
9036 else
9037         echo "isascii() NOT found." >&4
9038         val="$undef"
9039 fi
9040 set d_isascii
9041 eval $setvar
9042 $rm -f isascii*
9043
9044 : see if killpg exists
9045 set killpg d_killpg
9046 eval $inlibc
9047
9048 : see if lchown exists
9049 echo " "
9050 $cat > try.c <<'EOCP'
9051 /* System header to define __stub macros and hopefully few prototypes,
9052     which can conflict with char lchown(); below.  */
9053 #include <assert.h>
9054 /* Override any gcc2 internal prototype to avoid an error.  */
9055 /* We use char because int might match the return type of a gcc2
9056    builtin and then its argument prototype would still apply.  */
9057 char lchown();
9058 int main() {
9059     /*  The GNU C library defines this for functions which it implements
9060         to always fail with ENOSYS.  Some functions are actually named
9061         something starting with __ and the normal name is an alias.  */
9062 #if defined (__stub_lchown) || defined (__stub___lchown)
9063 choke me
9064 #else
9065 lchown();
9066 #endif
9067 ; return 0; }
9068 EOCP
9069 set try
9070 if eval $compile; then
9071     $echo "lchown() found." >&4
9072     val="$define"
9073 else
9074     $echo "lchown() NOT found." >&4
9075     val="$undef"
9076 fi
9077 set d_lchown
9078 eval $setvar
9079
9080 : See if number of significant digits in a double precision number is known
9081 echo " "
9082 $cat >ldbl_dig.c <<EOM
9083 #$i_limits I_LIMITS
9084 #$i_float I_FLOAT
9085 #ifdef I_LIMITS
9086 #include <limits.h>
9087 #endif
9088 #ifdef I_FLOAT
9089 #include <float.h>
9090 #endif
9091 #ifdef LDBL_DIG
9092 printf("Contains LDBL_DIG");
9093 #endif
9094 EOM
9095 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9096 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9097         echo "LDBL_DIG found." >&4
9098         val="$define"
9099 else
9100         echo "LDBL_DIG NOT found." >&4
9101         val="$undef"
9102 fi
9103 $rm -f ldbl_dig.?
9104 set d_ldbl_dig
9105 eval $setvar
9106
9107 : see if link exists
9108 set link d_link
9109 eval $inlibc
9110
9111 : see if localeconv exists
9112 set localeconv d_locconv
9113 eval $inlibc
9114
9115 : see if lockf exists
9116 set lockf d_lockf
9117 eval $inlibc
9118
9119 : see if lstat exists
9120 set lstat d_lstat
9121 eval $inlibc
9122
9123 : see if madvise exists
9124 set madvise d_madvise
9125 eval $inlibc
9126
9127 : see if mblen exists
9128 set mblen d_mblen
9129 eval $inlibc
9130
9131 : see if mbstowcs exists
9132 set mbstowcs d_mbstowcs
9133 eval $inlibc
9134
9135 : see if mbtowc exists
9136 set mbtowc d_mbtowc
9137 eval $inlibc
9138
9139 : see if memchr exists
9140 set memchr d_memchr
9141 eval $inlibc
9142
9143 : see if memcmp exists
9144 set memcmp d_memcmp
9145 eval $inlibc
9146
9147 : see if memcpy exists
9148 set memcpy d_memcpy
9149 eval $inlibc
9150
9151 : see if memmove exists
9152 set memmove d_memmove
9153 eval $inlibc
9154
9155 : see if memset exists
9156 set memset d_memset
9157 eval $inlibc
9158
9159 : see if mkdir exists
9160 set mkdir d_mkdir
9161 eval $inlibc
9162
9163 : see if mkfifo exists
9164 set mkfifo d_mkfifo
9165 eval $inlibc
9166
9167 : see if mktime exists
9168 set mktime d_mktime
9169 eval $inlibc
9170
9171 : see if this is a sys/mman.h system
9172 set sys/mman.h i_sysmman
9173 eval $inhdr
9174
9175 : see if mmap exists
9176 set mmap d_mmap
9177 eval $inlibc
9178 : see what shmat returns
9179 : default to something harmless
9180 mmaptype='void *'
9181 case "$i_sysmman$d_mmap" in
9182 "$define$define")
9183         $cat >mmap.c <<'END'
9184 #include <sys/mman.h>
9185 void *mmap();
9186 END
9187         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9188                 mmaptype='void *'
9189         else
9190                 mmaptype='caddr_t'
9191         fi
9192         echo "and it returns ($mmaptype)." >&4
9193         ;;
9194 esac
9195
9196
9197
9198 : see if mprotect exists
9199 set mprotect d_mprotect
9200 eval $inlibc
9201
9202 : see if msgctl exists
9203 set msgctl d_msgctl
9204 eval $inlibc
9205
9206 : see if msgget exists
9207 set msgget d_msgget
9208 eval $inlibc
9209
9210 : see if msgsnd exists
9211 set msgsnd d_msgsnd
9212 eval $inlibc
9213
9214 : see if msgrcv exists
9215 set msgrcv d_msgrcv
9216 eval $inlibc
9217
9218 : see how much of the 'msg*(2)' library is present.
9219 h_msg=true
9220 echo " "
9221 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9222 *"$undef"*) h_msg=false;;
9223 esac
9224 case "$osname" in
9225 freebsd)
9226     case "`ipcs 2>&1`" in
9227     "SVID messages"*"not configured"*)
9228         echo "Your $osname does not have the msg*(2) configured." >&4
9229         h_msg=false
9230         val="$undef"
9231         set msgctl d_msgctl
9232         eval $setvar
9233         set msgget d_msgget
9234         eval $setvar
9235         set msgsnd d_msgsnd
9236         eval $setvar
9237         set msgrcv d_msgrcv
9238         eval $setvar
9239         ;;
9240     esac
9241     ;;
9242 esac
9243 : we could also check for sys/ipc.h ...
9244 if $h_msg && $test `./findhdr sys/msg.h`; then
9245         echo "You have the full msg*(2) library." >&4
9246         val="$define"
9247 else
9248         echo "You don't have the full msg*(2) library." >&4
9249         val="$undef"
9250 fi
9251 set d_msg
9252 eval $setvar
9253
9254 : see if msync exists
9255 set msync d_msync
9256 eval $inlibc
9257
9258 : see if munmap exists
9259 set munmap d_munmap
9260 eval $inlibc
9261
9262 : see if nice exists
9263 set nice d_nice
9264 eval $inlibc
9265
9266 : see if POSIX threads are available
9267 set pthread.h i_pthread
9268 eval $inhdr
9269
9270
9271
9272
9273 : how to create joinable pthreads
9274 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9275         echo " "
9276         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9277         $cat >try.c <<'EOCP'
9278 #include <pthread.h>
9279 int main() {
9280     int detachstate = JOINABLE;
9281 }
9282 EOCP
9283         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9284         if eval $compile; then
9285                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9286                 val="$undef" # Yes, undef.
9287                 set d_old_pthread_create_joinable
9288                 eval $setvar
9289                 val=""
9290                 set old_pthread_create_joinable
9291                 eval $setvar
9292         else
9293                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9294                 if eval $compile; then
9295                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9296                         val="$define"
9297                         set d_old_pthread_create_joinable
9298                         eval $setvar
9299                         val=PTHREAD_CREATE_UNDETACHED
9300                         set old_pthread_create_joinable
9301                         eval $setvar
9302                 else            
9303                         set try -DJOINABLE=__UNDETACHED
9304                         if eval $compile; then
9305                                 echo "You seem to use __UNDETACHED." >&4
9306                                 val="$define"
9307                                 set d_old_pthread_create_joinable
9308                                 eval $setvar
9309                                 val=__UNDETACHED
9310                                 set old_pthread_create_joinable
9311                                 eval $setvar
9312                         else
9313                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9314                                 val="$define"
9315                                 set d_old_pthread_create_joinable
9316                                 eval $setvar
9317                                 val=0
9318                                 set old_pthread_create_joinable
9319                                 eval $setvar
9320                         fi
9321                 fi
9322         fi
9323         $rm -f try try.*
9324 else
9325     d_old_pthread_create_joinable="$undef"
9326     old_pthread_create_joinable=""
9327 fi
9328
9329 : see if pause exists
9330 set pause d_pause
9331 eval $inlibc
9332
9333 : see if pipe exists
9334 set pipe d_pipe
9335 eval $inlibc
9336
9337 : see if poll exists
9338 set poll d_poll
9339 eval $inlibc
9340
9341
9342 : see whether the various POSIXish _yields exist
9343 $cat >try.c <<EOP
9344 #include <pthread.h>
9345 #include <stdio.h>
9346 int main() {
9347 #ifdef SCHED_YIELD
9348         sched_yield();
9349 #else
9350 #ifdef PTHREAD_YIELD
9351         pthread_yield();
9352 #else
9353 #ifdef PTHREAD_YIELD_NULL
9354         pthread_yield(NULL);
9355 #endif
9356 #endif
9357 #endif
9358 }
9359 EOP
9360 : see if sched_yield exists
9361 set try -DSCHED_YIELD
9362 if eval $compile; then
9363     val="$define"
9364     sched_yield='sched_yield()'
9365 else
9366     val="$undef"
9367 fi
9368 case "$usethreads" in
9369 $define)
9370         case "$val" in
9371         $define) echo 'sched_yield() found.' >&4        ;;
9372         *)       echo 'sched_yield() NOT found.' >&4    ;;
9373         esac
9374 esac
9375 set d_sched_yield
9376 eval $setvar
9377
9378 : see if pthread_yield exists
9379 set try -DPTHREAD_YIELD
9380 if eval $compile; then
9381     val="$define"
9382     case "$sched_yield" in
9383     '') sched_yield='pthread_yield()' ;;
9384     esac
9385 else
9386     set try -DPTHREAD_YIELD_NULL
9387     if eval $compile; then
9388         val="$define"
9389         case "$sched_yield" in
9390         '') sched_yield='pthread_yield(NULL)' ;;
9391         esac
9392     else
9393         val="$undef"
9394     fi
9395 fi
9396 case "$usethreads" in
9397 $define)
9398         case "$val" in
9399         $define) echo 'pthread_yield() found.' >&4      ;;
9400         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9401         esac
9402         ;;
9403 esac
9404 set d_pthread_yield
9405 eval $setvar
9406
9407 case "$sched_yield" in
9408 '') sched_yield=undef ;;
9409 esac
9410
9411 $rm -f try try.*
9412
9413 : see if this is a pwd.h system
9414 set pwd.h i_pwd
9415 eval $inhdr
9416
9417 case "$i_pwd" in
9418 $define)
9419         xxx=`./findhdr pwd.h`
9420         $cppstdin $cppflags $cppminus < $xxx >$$.h
9421
9422         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9423                 val="$define"
9424         else
9425                 val="$undef"
9426         fi
9427         set d_pwquota
9428         eval $setvar
9429
9430         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9431                 val="$define"
9432         else
9433                 val="$undef"
9434         fi
9435         set d_pwage
9436         eval $setvar
9437
9438         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9439                 val="$define"
9440         else
9441                 val="$undef"
9442         fi
9443         set d_pwchange
9444         eval $setvar
9445
9446         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9447                 val="$define"
9448         else
9449                 val="$undef"
9450         fi
9451         set d_pwclass
9452         eval $setvar
9453
9454         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9455                 val="$define"
9456         else
9457                 val="$undef"
9458         fi
9459         set d_pwexpire
9460         eval $setvar
9461
9462         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9463                 val="$define"
9464         else
9465                 val="$undef"
9466         fi
9467         set d_pwcomment
9468         eval $setvar
9469
9470         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9471                 val="$define"
9472         else
9473                 val="$undef"
9474         fi
9475         set d_pwgecos
9476         eval $setvar
9477
9478         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9479                 val="$define"
9480         else
9481                 val="$undef"
9482         fi
9483         set d_pwpasswd
9484         eval $setvar
9485
9486         $rm -f $$.h
9487         ;;
9488 *)
9489         val="$undef"; 
9490         set d_pwquota; eval $setvar
9491         set d_pwage; eval $setvar
9492         set d_pwchange; eval $setvar
9493         set d_pwclass; eval $setvar
9494         set d_pwexpire; eval $setvar
9495         set d_pwcomment; eval $setvar
9496         set d_pwgecos; eval $setvar
9497         set d_pwpasswd; eval $setvar
9498         ;;
9499 esac
9500
9501 : see if readdir and friends exist
9502 set readdir d_readdir
9503 eval $inlibc
9504 set seekdir d_seekdir
9505 eval $inlibc
9506 set telldir d_telldir
9507 eval $inlibc
9508 set rewinddir d_rewinddir
9509 eval $inlibc
9510
9511 : see if readlink exists
9512 set readlink d_readlink
9513 eval $inlibc
9514
9515 : see if readv exists
9516 set readv d_readv
9517 eval $inlibc
9518
9519 : see if rename exists
9520 set rename d_rename
9521 eval $inlibc
9522
9523 : see if rmdir exists
9524 set rmdir d_rmdir
9525 eval $inlibc
9526
9527 : see if memory.h is available.
9528 val=''
9529 set memory.h val
9530 eval $inhdr
9531
9532 : See if it conflicts with string.h
9533 case "$val" in
9534 $define)
9535         case "$strings" in
9536         '') ;;
9537         *)
9538                 $cppstdin $cppflags $cppminus < $strings > mem.h
9539                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9540                         echo " "
9541                         echo "We won't be including <memory.h>."
9542                         val="$undef"
9543                 fi
9544                 $rm -f mem.h
9545                 ;;
9546         esac
9547 esac
9548 set i_memory
9549 eval $setvar
9550
9551 : can bcopy handle overlapping blocks?
9552 val="$undef"
9553 case "$d_bcopy" in
9554 "$define")
9555         echo " "
9556         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9557         $cat >try.c <<EOCP
9558 #$i_memory I_MEMORY
9559 #$i_stdlib I_STDLIB
9560 #$i_string I_STRING
9561 #$i_unistd I_UNISTD
9562 EOCP
9563         $cat >>try.c <<'EOCP'
9564 #include <stdio.h>
9565 #ifdef I_MEMORY
9566 #  include <memory.h>
9567 #endif
9568 #ifdef I_STDLIB
9569 #  include <stdlib.h>
9570 #endif
9571 #ifdef I_STRING
9572 #  include <string.h>
9573 #else
9574 #  include <strings.h>
9575 #endif
9576 #ifdef I_UNISTD
9577 #  include <unistd.h>  /* Needed for NetBSD */
9578 #endif
9579 int main()
9580 {
9581 char buf[128], abc[128];
9582 char *b;
9583 int len;
9584 int off;
9585 int align;
9586
9587 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9588
9589 for (align = 7; align >= 0; align--) {
9590         for (len = 36; len; len--) {
9591                 b = buf+align;
9592                 bcopy(abc, b, len);
9593                 for (off = 1; off <= len; off++) {
9594                         bcopy(b, b+off, len);
9595                         bcopy(b+off, b, len);
9596                         if (bcmp(b, abc, len))
9597                                 exit(1);
9598                 }
9599         }
9600 }
9601 exit(0);
9602 }
9603 EOCP
9604         set try
9605         if eval $compile_ok; then
9606                 if ./try 2>/dev/null; then
9607                         echo "Yes, it can."
9608                         val="$define"
9609                 else
9610                         echo "It can't, sorry."
9611                         case "$d_memmove" in
9612                         "$define") echo "But that's Ok since you have memmove()." ;;
9613                         esac
9614                 fi
9615         else
9616                 echo "(I can't compile the test program, so we'll assume not...)"
9617                 case "$d_memmove" in
9618                 "$define") echo "But that's Ok since you have memmove()." ;;
9619                 esac
9620         fi
9621         ;;
9622 esac
9623 $rm -f try.* try core
9624 set d_safebcpy
9625 eval $setvar
9626
9627 : can memcpy handle overlapping blocks?
9628 val="$undef"
9629 case "$d_memcpy" in
9630 "$define")
9631         echo " "
9632         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9633         $cat >try.c <<EOCP
9634 #$i_memory I_MEMORY
9635 #$i_stdlib I_STDLIB
9636 #$i_string I_STRING
9637 #$i_unistd I_UNISTD
9638 EOCP
9639         $cat >>try.c <<'EOCP'
9640 #include <stdio.h>
9641 #ifdef I_MEMORY
9642 #  include <memory.h>
9643 #endif
9644 #ifdef I_STDLIB
9645 #  include <stdlib.h>
9646 #endif
9647 #ifdef I_STRING
9648 #  include <string.h>
9649 #else
9650 #  include <strings.h>
9651 #endif
9652 #ifdef I_UNISTD
9653 #  include <unistd.h>  /* Needed for NetBSD */
9654 #endif
9655 int main()
9656 {
9657 char buf[128], abc[128];
9658 char *b;
9659 int len;
9660 int off;
9661 int align;
9662
9663 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9664    try to store the string in read-only memory. */
9665 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9666
9667 for (align = 7; align >= 0; align--) {
9668         for (len = 36; len; len--) {
9669                 b = buf+align;
9670                 memcpy(b, abc, len);
9671                 for (off = 1; off <= len; off++) {
9672                         memcpy(b+off, b, len);
9673                         memcpy(b, b+off, len);
9674                         if (memcmp(b, abc, len))
9675                                 exit(1);
9676                 }
9677         }
9678 }
9679 exit(0);
9680 }
9681 EOCP
9682         set try
9683         if eval $compile_ok; then
9684                 if ./try 2>/dev/null; then
9685                         echo "Yes, it can."
9686                         val="$define"
9687                 else
9688                         echo "It can't, sorry."
9689                         case "$d_memmove" in
9690                         "$define") echo "But that's Ok since you have memmove()." ;;
9691                         esac
9692                 fi
9693         else
9694                 echo "(I can't compile the test program, so we'll assume not...)"
9695                 case "$d_memmove" in
9696                 "$define") echo "But that's Ok since you have memmove()." ;;
9697                 esac
9698         fi
9699         ;;
9700 esac
9701 $rm -f try.* try core
9702 set d_safemcpy
9703 eval $setvar
9704
9705 : can memcmp be trusted to compare relative magnitude?
9706 val="$undef"
9707 case "$d_memcmp" in
9708 "$define")
9709         echo " "
9710         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9711         $cat >try.c <<EOCP
9712 #$i_memory I_MEMORY
9713 #$i_stdlib I_STDLIB
9714 #$i_string I_STRING
9715 #$i_unistd I_UNISTD
9716 EOCP
9717         $cat >>try.c <<'EOCP'
9718 #include <stdio.h>
9719 #ifdef I_MEMORY
9720 #  include <memory.h>
9721 #endif
9722 #ifdef I_STDLIB
9723 #  include <stdlib.h>
9724 #endif
9725 #ifdef I_STRING
9726 #  include <string.h>
9727 #else
9728 #  include <strings.h>
9729 #endif
9730 #ifdef I_UNISTD
9731 #  include <unistd.h>  /* Needed for NetBSD */
9732 #endif
9733 int main()
9734 {
9735 char a = -1;
9736 char b = 0;
9737 if ((a < b) && memcmp(&a, &b, 1) < 0)
9738         exit(1);
9739 exit(0);
9740 }
9741 EOCP
9742         set try
9743         if eval $compile_ok; then
9744                 if ./try 2>/dev/null; then
9745                         echo "Yes, it can."
9746                         val="$define"
9747                 else
9748                         echo "No, it can't (it uses signed chars)."
9749                 fi
9750         else
9751                 echo "(I can't compile the test program, so we'll assume not...)"
9752         fi
9753         ;;
9754 esac
9755 $rm -f try.* try core
9756 set d_sanemcmp
9757 eval $setvar
9758
9759 : see if select exists
9760 set select d_select
9761 eval $inlibc
9762
9763 : see if semctl exists
9764 set semctl d_semctl
9765 eval $inlibc
9766
9767 : see if semget exists
9768 set semget d_semget
9769 eval $inlibc
9770
9771 : see if semop exists
9772 set semop d_semop
9773 eval $inlibc
9774
9775 : see how much of the 'sem*(2)' library is present.
9776 h_sem=true
9777 echo " "
9778 case "$d_semctl$d_semget$d_semop" in
9779 *"$undef"*) h_sem=false;;
9780 esac
9781 case "$osname" in
9782 freebsd)
9783     case "`ipcs 2>&1`" in
9784     "SVID messages"*"not configured"*)
9785         echo "Your $osname does not have the sem*(2) configured." >&4
9786         h_sem=false
9787         val="$undef"
9788         set semctl d_semctl
9789         eval $setvar
9790         set semget d_semget
9791         eval $setvar
9792         set semop d_semop
9793         eval $setvar
9794         ;;
9795     esac
9796     ;;
9797 esac
9798 : we could also check for sys/ipc.h ...
9799 if $h_sem && $test `./findhdr sys/sem.h`; then
9800         echo "You have the full sem*(2) library." >&4
9801         val="$define"
9802 else
9803         echo "You don't have the full sem*(2) library." >&4
9804         val="$undef"
9805 fi
9806 set d_sem
9807 eval $setvar
9808
9809 : see whether sys/sem.h defines union semun
9810 echo " "
9811 $cat > try.c <<'END'
9812 #include <sys/types.h>
9813 #include <sys/ipc.h>
9814 #include <sys/sem.h>
9815 int main () { union semun semun; semun.buf = 0; }
9816 END
9817 set try
9818 if eval $compile; then
9819     echo "You have union semun in <sys/sem.h>." >&4
9820     val="$define"
9821 else
9822     echo "You do not have union semun in <sys/sem.h>." >&4
9823     val="$undef"
9824 fi
9825 $rm -f try try.c try.h
9826 set d_union_semun
9827 eval $setvar
9828
9829 : see how to do semctl IPC_STAT
9830 case "$d_sem" in
9831 $define)
9832     : see whether semctl IPC_STAT can use union semun
9833     echo " "
9834     $cat > try.h <<END
9835 #ifndef S_IRUSR
9836 #   ifdef S_IREAD
9837 #       define S_IRUSR S_IREAD
9838 #       define S_IWUSR S_IWRITE
9839 #       define S_IXUSR S_IEXEC
9840 #   else
9841 #       define S_IRUSR 0400
9842 #       define S_IWUSR 0200
9843 #       define S_IXUSR 0100
9844 #   endif
9845 #   define S_IRGRP (S_IRUSR>>3)
9846 #   define S_IWGRP (S_IWUSR>>3)
9847 #   define S_IXGRP (S_IXUSR>>3)
9848 #   define S_IROTH (S_IRUSR>>6)
9849 #   define S_IWOTH (S_IWUSR>>6)
9850 #   define S_IXOTH (S_IXUSR>>6)
9851 #endif
9852 #ifndef S_IRWXU
9853 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9854 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9855 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9856 #endif
9857 END
9858
9859     $cat > try.c <<END
9860 #include <sys/types.h>
9861 #include <sys/ipc.h>
9862 #include <sys/sem.h>
9863 #include <sys/stat.h>
9864 #include <stdio.h>
9865 #include <errno.h>
9866 #include "try.h"
9867 #ifndef errno
9868 extern int errno;
9869 #endif
9870 #$d_union_semun HAS_UNION_SEMUN
9871 int main() {
9872     union semun
9873 #ifndef HAS_UNION_SEMUN
9874     {
9875         int val;
9876         struct semid_ds *buf;
9877         unsigned short *array;
9878     }
9879 #endif
9880     arg;
9881     int sem, st;
9882
9883 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9884     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9885     if (sem > -1) {
9886         struct semid_ds argbuf;
9887         arg.buf = &argbuf;
9888 #       ifdef IPC_STAT
9889         st = semctl(sem, 0, IPC_STAT, arg);
9890         if (st == 0)
9891             printf("semun\n");
9892         else
9893 #       endif /* IPC_STAT */
9894             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9895 #       ifdef IPC_RMID
9896         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9897 #       endif /* IPC_RMID */
9898             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9899     } else
9900 #endif /* IPC_PRIVATE && ... */
9901         printf("semget failed: errno = %d\n", errno);
9902   return 0;
9903 }
9904 END
9905     val="$undef"
9906     set try
9907     if eval $compile; then
9908         xxx=`./try`
9909         case "$xxx" in
9910         semun) val="$define" ;;
9911         esac
9912     fi
9913     $rm -f try try.c
9914     set d_semctl_semun
9915     eval $setvar
9916     case "$d_semctl_semun" in
9917     $define)
9918         echo "You can use union semun for semctl IPC_STAT." >&4
9919         also='also'
9920         ;;
9921     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9922         also=''
9923         ;;
9924     esac
9925
9926     : see whether semctl IPC_STAT can use struct semid_ds pointer
9927     $cat > try.c <<'END'
9928 #include <sys/types.h>
9929 #include <sys/ipc.h>
9930 #include <sys/sem.h>
9931 #include <sys/stat.h>
9932 #include "try.h"
9933 #include <stdio.h>
9934 #include <errno.h>
9935 #ifndef errno
9936 extern int errno;
9937 #endif
9938 int main() {
9939     struct semid_ds arg;
9940     int sem, st;
9941
9942 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9943     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9944     if (sem > -1) {
9945 #       ifdef IPC_STAT
9946         st = semctl(sem, 0, IPC_STAT, &arg);
9947         if (st == 0)
9948             printf("semid_ds\n");
9949         else
9950 #       endif /* IPC_STAT */
9951             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9952 #       ifdef IPC_RMID
9953         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9954 #       endif /* IPC_RMID */
9955             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9956     } else
9957 #endif /* IPC_PRIVATE && ... */
9958         printf("semget failed: errno = %d\n", errno);
9959
9960     return 0;
9961 }
9962 END
9963     val="$undef"
9964     set try
9965     if eval $compile; then
9966         xxx=`./try`
9967         case "$xxx" in
9968         semid_ds) val="$define" ;;
9969         esac
9970     fi
9971     $rm -f try try.c
9972     set d_semctl_semid_ds
9973     eval $setvar
9974     case "$d_semctl_semid_ds" in
9975     $define)
9976         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9977         ;;
9978     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9979         ;;
9980     esac
9981     $rm -f try.h
9982     ;;
9983 *)  val="$undef"
9984
9985     # We do not have the full sem*(2) library, so assume we can not
9986     # use either.
9987
9988     set d_semctl_semun
9989     eval $setvar
9990
9991     set d_semctl_semid_ds
9992     eval $setvar
9993     ;;
9994 esac
9995
9996 : see if setegid exists
9997 set setegid d_setegid
9998 eval $inlibc
9999
10000 : see if seteuid exists
10001 set seteuid d_seteuid
10002 eval $inlibc
10003
10004 : see if setgrent exists
10005 set setgrent d_setgrent
10006 eval $inlibc
10007
10008 : see if sethostent exists
10009 set sethostent d_sethent
10010 eval $inlibc
10011
10012 : see if setlinebuf exists
10013 set setlinebuf d_setlinebuf
10014 eval $inlibc
10015
10016 : see if setlocale exists
10017 set setlocale d_setlocale
10018 eval $inlibc
10019
10020 : see if setnetent exists
10021 set setnetent d_setnent
10022 eval $inlibc
10023
10024 : see if setprotoent exists
10025 set setprotoent d_setpent
10026 eval $inlibc
10027
10028 : see if setpgid exists
10029 set setpgid d_setpgid
10030 eval $inlibc
10031
10032 : see if setpgrp2 exists
10033 set setpgrp2 d_setpgrp2
10034 eval $inlibc
10035
10036 : see if setpriority exists
10037 set setpriority d_setprior
10038 eval $inlibc
10039
10040 : see if setpwent exists
10041 set setpwent d_setpwent
10042 eval $inlibc
10043
10044 : see if setregid exists
10045 set setregid d_setregid
10046 eval $inlibc
10047 set setresgid d_setresgid
10048 eval $inlibc
10049
10050 : see if setreuid exists
10051 set setreuid d_setreuid
10052 eval $inlibc
10053 set setresuid d_setresuid
10054 eval $inlibc
10055
10056 : see if setrgid exists
10057 set setrgid d_setrgid
10058 eval $inlibc
10059
10060 : see if setruid exists
10061 set setruid d_setruid
10062 eval $inlibc
10063
10064 : see if setservent exists
10065 set setservent d_setsent
10066 eval $inlibc
10067
10068 : see if setsid exists
10069 set setsid d_setsid
10070 eval $inlibc
10071
10072 : see if setspent exists
10073 set setspent d_setspent
10074 eval $inlibc
10075
10076 : see if setvbuf exists
10077 set setvbuf d_setvbuf
10078 eval $inlibc
10079
10080 : see if sfio.h is available
10081 set sfio.h i_sfio
10082 eval $inhdr
10083
10084
10085 : see if sfio library is available
10086 case "$i_sfio" in
10087 $define)
10088         val=''
10089         set sfreserve val
10090         eval $inlibc
10091         ;;
10092 *)
10093         val="$undef"
10094         ;;
10095 esac
10096 : Ok, but do we want to use it.
10097 case "$val" in
10098 $define)
10099         case "$usesfio" in
10100         true|$define|[yY]*) dflt='y';;
10101         *) dflt='n';;
10102         esac
10103         echo "$package can use the sfio library, but it is experimental."
10104         rp="You seem to have sfio available, do you want to try using it?"
10105         . ./myread
10106         case "$ans" in
10107         y|Y) ;;
10108         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10109                 val="$undef"
10110                 : Remove sfio from list of libraries to use
10111                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10112                 shift
10113                 libs="$*"
10114                 echo "libs = $libs" >&4
10115                 ;;
10116         esac
10117         ;;
10118 *)      case "$usesfio" in
10119         true|$define|[yY]*)
10120                 echo "Sorry, cannot find sfio on this machine" >&4
10121                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10122                 ;;
10123         esac
10124         ;;
10125 esac
10126 set d_sfio
10127 eval $setvar
10128 case "$d_sfio" in
10129 $define) usesfio='true';;
10130 *) usesfio='false';;
10131 esac
10132
10133 : see if shmctl exists
10134 set shmctl d_shmctl
10135 eval $inlibc
10136
10137 : see if shmget exists
10138 set shmget d_shmget
10139 eval $inlibc
10140
10141 : see if shmat exists
10142 set shmat d_shmat
10143 eval $inlibc
10144 : see what shmat returns
10145 case "$d_shmat" in
10146 "$define")
10147         $cat >shmat.c <<'END'
10148 #include <sys/shm.h>
10149 void *shmat();
10150 END
10151         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10152                 shmattype='void *'
10153         else
10154                 shmattype='char *'
10155         fi
10156         echo "and it returns ($shmattype)." >&4
10157         : see if a prototype for shmat is available
10158         xxx=`./findhdr sys/shm.h`
10159         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10160         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10161                 val="$define"
10162         else
10163                 val="$undef"
10164         fi
10165         $rm -f shmat.[co]
10166         ;;
10167 *)
10168         val="$undef"
10169         ;;
10170 esac
10171 set d_shmatprototype
10172 eval $setvar
10173
10174 : see if shmdt exists
10175 set shmdt d_shmdt
10176 eval $inlibc
10177
10178 : see how much of the 'shm*(2)' library is present.
10179 h_shm=true
10180 echo " "
10181 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10182 *"$undef"*) h_shm=false;;
10183 esac
10184 case "$osname" in
10185 freebsd)
10186     case "`ipcs 2>&1`" in
10187     "SVID shared memory"*"not configured"*)
10188         echo "Your $osname does not have the shm*(2) configured." >&4
10189         h_shm=false
10190         val="$undef"
10191         set shmctl d_shmctl
10192         evat $setvar
10193         set shmget d_shmget
10194         evat $setvar
10195         set shmat d_shmat
10196         evat $setvar
10197         set shmdt d_shmdt
10198         evat $setvar
10199         ;;
10200     esac
10201     ;;
10202 esac
10203 : we could also check for sys/ipc.h ...
10204 if $h_shm && $test `./findhdr sys/shm.h`; then
10205         echo "You have the full shm*(2) library." >&4
10206         val="$define"
10207 else
10208         echo "You don't have the full shm*(2) library." >&4
10209         val="$undef"
10210 fi
10211 set d_shm
10212 eval $setvar
10213
10214 echo " "
10215 : see if we have sigaction
10216 if set sigaction val -f d_sigaction; eval $csym; $val; then
10217         echo 'sigaction() found.' >&4
10218         $cat > try.c <<'EOP'
10219 #include <stdio.h>
10220 #include <sys/types.h>
10221 #include <signal.h>
10222 int main()
10223 {
10224     struct sigaction act, oact;
10225     act.sa_flags = 0;
10226     oact.sa_handler = 0;
10227 }
10228 EOP
10229         set try
10230         if eval $compile_ok; then
10231                 val="$define"
10232         else
10233                 echo "But you don't seem to have a useable struct sigaction." >&4
10234                 val="$undef"
10235         fi
10236 else
10237         echo 'sigaction NOT found.' >&4
10238         val="$undef"
10239 fi
10240 set d_sigaction; eval $setvar
10241 $rm -f try try$_o try.c
10242
10243 : see if sigsetjmp exists
10244 echo " "
10245 case "$d_sigsetjmp" in
10246 '')
10247         $cat >try.c <<'EOP'
10248 #include <setjmp.h>
10249 sigjmp_buf env;
10250 int set = 1;
10251 int main()
10252 {
10253         if (sigsetjmp(env,1))
10254                 exit(set);
10255         set = 0;
10256         siglongjmp(env, 1);
10257         exit(1);
10258 }
10259 EOP
10260         set try
10261         if eval $compile; then
10262                 if ./try >/dev/null 2>&1; then
10263                         echo "POSIX sigsetjmp found." >&4
10264                         val="$define"
10265                 else
10266                         $cat >&4 <<EOM
10267 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10268 I'll ignore them.
10269 EOM
10270                         val="$undef"
10271                 fi
10272         else
10273                 echo "sigsetjmp not found." >&4
10274                 val="$undef"
10275         fi
10276         ;;
10277 *) val="$d_sigsetjmp"
10278         case "$d_sigsetjmp" in
10279         $define) echo "POSIX sigsetjmp found." >&4;;
10280         $undef) echo "sigsetjmp not found." >&4;;
10281         esac
10282         ;;
10283 esac
10284 set d_sigsetjmp
10285 eval $setvar
10286 $rm -f try.c try
10287
10288 : see if sys/stat.h is available
10289 set sys/stat.h i_sysstat
10290 eval $inhdr
10291
10292 : see if stat knows about block sizes
10293 echo " "
10294 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10295 eval $hasfield
10296
10297 : see if _ptr and _cnt from stdio act std
10298 echo " "
10299 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10300         echo "(Looks like you have stdio.h from Linux.)"
10301         case "$stdio_ptr" in
10302         '') stdio_ptr='((fp)->_IO_read_ptr)'
10303                 ptr_lval=$define
10304                 ;;
10305         *)      ptr_lval=$d_stdio_ptr_lval;;
10306         esac
10307         case "$stdio_cnt" in
10308         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10309                 cnt_lval=$undef
10310                 ;;
10311         *)      cnt_lval=$d_stdio_cnt_lval;;
10312         esac
10313         case "$stdio_base" in
10314         '') stdio_base='((fp)->_IO_read_base)';;
10315         esac
10316         case "$stdio_bufsiz" in
10317         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10318         esac
10319 else
10320         case "$stdio_ptr" in
10321         '') stdio_ptr='((fp)->_ptr)'
10322                 ptr_lval=$define
10323                 ;;
10324         *)      ptr_lval=$d_stdio_ptr_lval;;
10325         esac
10326         case "$stdio_cnt" in
10327         '') stdio_cnt='((fp)->_cnt)'
10328                 cnt_lval=$define
10329                 ;;
10330         *)      cnt_lval=$d_stdio_cnt_lval;;
10331         esac
10332         case "$stdio_base" in
10333         '') stdio_base='((fp)->_base)';;
10334         esac
10335         case "$stdio_bufsiz" in
10336         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10337         esac
10338 fi
10339 : test whether _ptr and _cnt really work
10340 echo "Checking how std your stdio is..." >&4
10341 $cat >try.c <<EOP
10342 #include <stdio.h>
10343 #define FILE_ptr(fp)    $stdio_ptr
10344 #define FILE_cnt(fp)    $stdio_cnt
10345 int main() {
10346         FILE *fp = fopen("try.c", "r");
10347         char c = getc(fp);
10348         if (
10349                 18 <= FILE_cnt(fp) &&
10350                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10351         )
10352                 exit(0);
10353         exit(1);
10354 }
10355 EOP
10356 val="$undef"
10357 set try
10358 if eval $compile; then
10359         if ./try; then
10360                 echo "Your stdio acts pretty std."
10361                 val="$define"
10362         else
10363                 echo "Your stdio isn't very std."
10364         fi
10365 else
10366         echo "Your stdio doesn't appear very std."
10367 fi
10368 $rm -f try.c try
10369 set d_stdstdio
10370 eval $setvar
10371
10372 : Can _ptr be used as an lvalue?
10373 case "$d_stdstdio$ptr_lval" in
10374 $define$define) val=$define ;;
10375 *) val=$undef ;;
10376 esac
10377 set d_stdio_ptr_lval
10378 eval $setvar
10379
10380 : Can _cnt be used as an lvalue?
10381 case "$d_stdstdio$cnt_lval" in
10382 $define$define) val=$define ;;
10383 *) val=$undef ;;
10384 esac
10385 set d_stdio_cnt_lval
10386 eval $setvar
10387
10388 : see if _base is also standard
10389 val="$undef"
10390 case "$d_stdstdio" in
10391 $define)
10392         $cat >try.c <<EOP
10393 #include <stdio.h>
10394 #define FILE_base(fp)   $stdio_base
10395 #define FILE_bufsiz(fp) $stdio_bufsiz
10396 int main() {
10397         FILE *fp = fopen("try.c", "r");
10398         char c = getc(fp);
10399         if (
10400                 19 <= FILE_bufsiz(fp) &&
10401                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10402         )
10403                 exit(0);
10404         exit(1);
10405 }
10406 EOP
10407         set try
10408         if eval $compile; then
10409                 if ./try; then
10410                         echo "And its _base field acts std."
10411                         val="$define"
10412                 else
10413                         echo "But its _base field isn't std."
10414                 fi
10415         else
10416                 echo "However, it seems to be lacking the _base field."
10417         fi
10418         $rm -f try.c try
10419         ;;
10420 esac
10421 set d_stdiobase
10422 eval $setvar
10423
10424 $cat >&4 <<EOM
10425 Checking how to access stdio streams by file descriptor number...
10426 EOM
10427 case "$stdio_stream_array" in
10428 '')     $cat >try.c <<EOCP
10429 #include <stdio.h>
10430 int main() {
10431   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10432     printf("yes\n");
10433 }
10434 EOCP
10435         for s in _iob __iob __sF
10436         do
10437                 set try -DSTDIO_STREAM_ARRAY=$s
10438                 if eval $compile; then
10439                         case "`./try$exe_ext`" in
10440                         yes)    stdio_stream_array=$s; break ;;
10441                         esac
10442                 fi
10443         done
10444         $rm -f try.* try$exe_ext
10445 esac
10446 case "$stdio_stream_array" in
10447 '')     $cat >&4 <<EOM
10448 I can't figure out how to access stdio streams by file descriptor number.
10449 EOM
10450         d_stdio_stream_array="$undef"
10451         ;;
10452 *)      $cat >&4 <<EOM
10453 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10454 EOM
10455         d_stdio_stream_array="$define"
10456         ;;
10457 esac
10458
10459 : see if strcoll exists
10460 set strcoll d_strcoll
10461 eval $inlibc
10462
10463 : check for structure copying
10464 echo " "
10465 echo "Checking to see if your C compiler can copy structs..." >&4
10466 $cat >try.c <<'EOCP'
10467 int main()
10468 {
10469         struct blurfl {
10470                 int dyick;
10471         } foo, bar;
10472
10473         foo = bar;
10474 }
10475 EOCP
10476 if $cc -c try.c >/dev/null 2>&1 ; then
10477         val="$define"
10478         echo "Yup, it can."
10479 else
10480         val="$undef"
10481         echo "Nope, it can't."
10482 fi
10483 set d_strctcpy
10484 eval $setvar
10485 $rm -f try.*
10486
10487 : see if strerror and/or sys_errlist[] exist
10488 echo " "
10489 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10490     if set strerror val -f d_strerror; eval $csym; $val; then
10491                 echo 'strerror() found.' >&4
10492                 d_strerror="$define"
10493                 d_strerrm='strerror(e)'
10494                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10495                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10496                         d_syserrlst="$define"
10497                 else
10498                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10499                         d_syserrlst="$undef"
10500                 fi
10501     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10502                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10503                 echo 'strerror() found in string header.' >&4
10504                 d_strerror="$define"
10505                 d_strerrm='strerror(e)'
10506                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10507                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10508                                 d_syserrlst="$define"
10509                 else
10510                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10511                         d_syserrlst="$undef"
10512                 fi
10513     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10514                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10515                 d_strerror="$undef"
10516                 d_syserrlst="$define"
10517                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10518     else
10519                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10520                 d_strerror="$undef"
10521                 d_syserrlst="$undef"
10522                 d_strerrm='"unknown"'
10523     fi
10524 fi
10525
10526 : see if strtod exists
10527 set strtod d_strtod
10528 eval $inlibc
10529
10530 : see if strtol exists
10531 set strtol d_strtol
10532 eval $inlibc
10533
10534 : see if strtoul exists
10535 set strtoul d_strtoul
10536 eval $inlibc
10537
10538 : see if strtoull exists
10539 set strtoull d_strtoull
10540 eval $inlibc
10541
10542 : see if strxfrm exists
10543 set strxfrm d_strxfrm
10544 eval $inlibc
10545
10546 : see if symlink exists
10547 set symlink d_symlink
10548 eval $inlibc
10549
10550 : see if syscall exists
10551 set syscall d_syscall
10552 eval $inlibc
10553
10554 : see if sysconf exists
10555 set sysconf d_sysconf
10556 eval $inlibc
10557
10558 : see if system exists
10559 set system d_system
10560 eval $inlibc
10561
10562 : see if tcgetpgrp exists
10563 set tcgetpgrp d_tcgetpgrp
10564 eval $inlibc
10565
10566 : see if tcsetpgrp exists
10567 set tcsetpgrp d_tcsetpgrp
10568 eval $inlibc
10569
10570 : see if sys/types.h has to be included
10571 set sys/types.h i_systypes
10572 eval $inhdr
10573
10574 : see if prototype for telldir is available
10575 echo " "
10576 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10577 eval $hasproto
10578
10579 : define an is-a-typedef? function
10580 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10581 case "$inclist" in
10582 "") inclist="sys/types.h";;
10583 esac;
10584 eval "varval=\$$var";
10585 case "$varval" in
10586 "")
10587         $rm -f temp.c;
10588         for inc in $inclist; do
10589                 echo "#include <$inc>" >>temp.c;
10590         done;
10591         echo "#ifdef $type" >> temp.c;
10592         echo "printf(\"We have $type\");" >> temp.c;
10593         echo "#endif" >> temp.c;
10594         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10595         if $contains $type temp.E >/dev/null 2>&1; then
10596                 eval "$var=\$type";
10597         else
10598                 eval "$var=\$def";
10599         fi;
10600         $rm -f temp.?;;
10601 *) eval "$var=\$varval";;
10602 esac'
10603
10604 : define an is-a-typedef? function that prompts if the type is not available.
10605 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10606 case "$inclist" in
10607 "") inclist="sys/types.h";;
10608 esac;
10609 eval "varval=\$$var";
10610 case "$varval" in
10611 "")
10612         $rm -f temp.c;
10613         for inc in $inclist; do
10614                 echo "#include <$inc>" >>temp.c;
10615         done;
10616         echo "#ifdef $type" >> temp.c;
10617         echo "printf(\"We have $type\");" >> temp.c;
10618         echo "#endif" >> temp.c;
10619         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10620         echo " " ;
10621         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10622         if $contains $type temp.E >/dev/null 2>&1; then
10623                 echo "$type found." >&4;
10624                 eval "$var=\$type";
10625         else
10626                 echo "$type NOT found." >&4;
10627                 dflt="$def";
10628                 . ./myread ;
10629                 eval "$var=\$ans";
10630         fi;
10631         $rm -f temp.?;;
10632 *) eval "$var=\$varval";;
10633 esac'
10634
10635 : see if this is a sys/times.h system
10636 set sys/times.h i_systimes
10637 eval $inhdr
10638
10639 : see if times exists
10640 echo " "
10641 if set times val -f d_times; eval $csym; $val; then
10642         echo 'times() found.' >&4
10643         d_times="$define"
10644         inc=''
10645         case "$i_systimes" in
10646         "$define") inc='sys/times.h';;
10647         esac
10648         rp="What is the type returned by times() on this system?"
10649         set clock_t clocktype long stdio.h sys/types.h $inc
10650         eval $typedef_ask
10651 else
10652         echo 'times() NOT found, hope that will do.' >&4
10653         d_times="$undef"
10654         clocktype='int'
10655 fi
10656
10657 : see if truncate exists
10658 set truncate d_truncate
10659 eval $inlibc
10660
10661 : see if tzname[] exists
10662 echo " "
10663 if set tzname val -a d_tzname; eval $csym; $val; then
10664         val="$define"
10665         echo 'tzname[] found.' >&4
10666 else
10667         val="$undef"
10668         echo 'tzname[] NOT found.' >&4
10669 fi
10670 set d_tzname
10671 eval $setvar
10672
10673 : see if umask exists
10674 set umask d_umask
10675 eval $inlibc
10676
10677 : backward compatibility for d_hvfork
10678 if test X$d_hvfork != X; then
10679         d_vfork="$d_hvfork"
10680         d_hvfork=''
10681 fi
10682 : see if there is a vfork
10683 val=''
10684 set vfork val
10685 eval $inlibc
10686
10687 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10688 : perl on Solaris 2.x, and probably elsewhere.
10689 case "$val" in
10690 $define)
10691         echo " "
10692         case "$usevfork" in
10693         false) dflt='n';;
10694         *) dflt='y';;
10695         esac
10696         cat <<'EOM'
10697  
10698 Perl can only use a vfork() that doesn't suffer from strict
10699 restrictions on calling functions or modifying global data in
10700 the child.  For example, glibc-2.1 contains such a vfork()
10701 that is unsuitable.  If your system provides a proper fork()
10702 call, chances are that you do NOT want perl to use vfork().
10703
10704 EOM
10705         rp="Do you still want to use vfork()?"
10706         . ./myread
10707         case "$ans" in
10708         y|Y) ;;
10709         *)
10710                 echo "Ok, we won't use vfork()."
10711                 val="$undef"
10712                 ;;
10713         esac
10714         ;;
10715 esac
10716 set d_vfork
10717 eval $setvar
10718 case "$d_vfork" in
10719 $define) usevfork='true';;
10720 *) usevfork='false';;
10721 esac
10722
10723 : see if this is an sysdir system
10724 set sys/dir.h i_sysdir
10725 eval $inhdr
10726
10727 : see if this is an sysndir system
10728 set sys/ndir.h i_sysndir
10729 eval $inhdr
10730
10731 : see if closedir exists
10732 set closedir d_closedir
10733 eval $inlibc
10734
10735 case "$d_closedir" in
10736 "$define")
10737         echo " "
10738         echo "Checking whether closedir() returns a status..." >&4
10739         cat > closedir.c <<EOM
10740 #$i_dirent I_DIRENT             /**/
10741 #$i_sysdir I_SYS_DIR            /**/
10742 #$i_sysndir I_SYS_NDIR          /**/
10743 #$i_systypes I_SYS_TYPES        /**/
10744
10745 #if defined(I_SYS_TYPES)
10746 #include <sys/types.h>
10747 #endif
10748 #if defined(I_DIRENT)
10749 #include <dirent.h>
10750 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10751 #include <sys/dir.h>
10752 #endif
10753 #else
10754 #ifdef I_SYS_NDIR
10755 #include <sys/ndir.h>
10756 #else
10757 #ifdef I_SYS_DIR
10758 #ifdef hp9000s500
10759 #include <ndir.h>       /* may be wrong in the future */
10760 #else
10761 #include <sys/dir.h>
10762 #endif
10763 #endif
10764 #endif
10765 #endif 
10766 int main() { return closedir(opendir(".")); }
10767 EOM
10768         set closedir
10769         if eval $compile_ok; then
10770                 if ./closedir > /dev/null 2>&1 ; then
10771                         echo "Yes, it does."
10772                         val="$undef"
10773                 else
10774                         echo "No, it doesn't."
10775                         val="$define"
10776                 fi
10777         else
10778                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10779                 val="$define"
10780         fi
10781         ;;
10782 *)
10783         val="$undef";
10784         ;;
10785 esac
10786 set d_void_closedir
10787 eval $setvar
10788 $rm -f closedir*
10789 : check for volatile keyword
10790 echo " "
10791 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10792 $cat >try.c <<'EOCP'
10793 int main()
10794 {
10795         typedef struct _goo_struct goo_struct;
10796         goo_struct * volatile goo = ((goo_struct *)0);
10797         struct _goo_struct {
10798                 long long_int;
10799                 int reg_int;
10800                 char char_var;
10801         };
10802         typedef unsigned short foo_t;
10803         char *volatile foo;
10804         volatile int bar;
10805         volatile foo_t blech;
10806         foo = foo;
10807 }
10808 EOCP
10809 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10810         val="$define"
10811         echo "Yup, it does."
10812 else
10813         val="$undef"
10814         echo "Nope, it doesn't."
10815 fi
10816 set d_volatile
10817 eval $setvar
10818 $rm -f try.*
10819
10820 : see if there is a wait4
10821 set wait4 d_wait4
10822 eval $inlibc
10823
10824 : see if waitpid exists
10825 set waitpid d_waitpid
10826 eval $inlibc
10827
10828 : see if wcstombs exists
10829 set wcstombs d_wcstombs
10830 eval $inlibc
10831
10832 : see if wctomb exists
10833 set wctomb d_wctomb
10834 eval $inlibc
10835
10836 : see if writev exists
10837 set writev d_writev
10838 eval $inlibc
10839
10840 : preserve RCS keywords in files with variable substitution, grrr
10841 Date='$Date'
10842 Id='$Id'
10843 Log='$Log'
10844 RCSfile='$RCSfile'
10845 Revision='$Revision'
10846
10847 case "$crosscompile" in
10848 ''|[nN]*) crosscompile="$undef" ;;
10849 esac
10850
10851 case "$osname" in
10852 next|rhapsody) multiarch="$define" ;;
10853 esac
10854 case "$multiarch" in
10855 ''|[nN]*) multiarch="$undef" ;;
10856 esac
10857
10858 : check for alignment requirements
10859 echo " "
10860 case "$crosscompile$multiarch" in
10861 *$define*)
10862         $cat <<EOM
10863 You seem to be either cross-compiling or doing a multiarchitecture build,
10864 skipping the memory alignment check.
10865
10866 EOM
10867         case "$alignbytes" in
10868         '') alignbytes=8 ;;
10869         esac
10870         ;;
10871 *)
10872         case "$alignbytes" in
10873         '') echo "Checking alignment constraints..." >&4
10874                 $cat >try.c <<'EOCP'
10875 struct foobar {
10876         char foo;
10877         double bar;
10878 } try_algn;
10879 int main()
10880 {
10881         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10882 }
10883 EOCP
10884                 set try
10885                 if eval $compile_ok; then
10886                         dflt=`./try`
10887                 else
10888                         dflt='8'
10889                         echo "(I can't seem to compile the test program...)"
10890                 fi
10891                 ;;
10892         *) dflt="$alignbytes"
10893                 ;;
10894         esac
10895         rp="Doubles must be aligned on a how-many-byte boundary?"
10896         . ./myread
10897         alignbytes="$ans"
10898         $rm -f try.c try
10899         ;;
10900 esac
10901
10902
10903 : check for ordering of bytes in a long
10904 echo " "
10905 case "$crosscompile$multiarch" in
10906 *$define*)
10907         $cat <<EOM
10908 You seem to be either cross-compiling or doing a multiarchitecture build,
10909 skipping the byteorder check.
10910
10911 EOM
10912         byteorder='0xffff'
10913         ;;
10914 *)
10915         case "$byteorder" in
10916         '')
10917                 $cat <<'EOM'
10918 In the following, larger digits indicate more significance.  A big-endian
10919 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10920 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10921 machines may have weird orders like 3412.  A Cray will report 87654321,
10922 an Alpha will report 12345678. If the test program works the default is
10923 probably right.
10924 I'm now running the test program...
10925 EOM
10926                 $cat >try.c <<'EOCP'
10927 #include <stdio.h>
10928 int main()
10929 {
10930         int i;
10931         union {
10932                 unsigned long l;
10933                 char c[sizeof(long)];
10934         } u;
10935
10936         if (sizeof(long) > 4)
10937                 u.l = (0x08070605L << 32) | 0x04030201L;
10938         else
10939                 u.l = 0x04030201L;
10940         for (i = 0; i < sizeof(long); i++)
10941                 printf("%c", u.c[i]+'0');
10942         printf("\n");
10943         exit(0);
10944 }
10945 EOCP
10946                 xxx_prompt=y
10947                 set try
10948                 if eval $compile && ./try > /dev/null; then
10949                         dflt=`./try`
10950                         case "$dflt" in
10951                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10952                                 echo "(The test program ran ok.)"
10953                                 echo "byteorder=$dflt"
10954                                 xxx_prompt=n
10955                         ;;
10956                         ????|????????) echo "(The test program ran ok.)" ;;
10957                         *) echo "(The test program didn't run right for some reason.)" ;;
10958                         esac
10959                 else
10960                         dflt='4321'
10961                         cat <<'EOM'
10962 (I can't seem to compile the test program.  Guessing big-endian...)
10963 EOM
10964                 fi
10965                 case "$xxx_prompt" in
10966                 y)
10967                         rp="What is the order of bytes in a long?"
10968                         . ./myread
10969                         byteorder="$ans"
10970                         ;;
10971                 *)      byteorder=$dflt
10972                         ;;
10973                 esac
10974                 ;;
10975         esac
10976         $rm -f try.c try
10977         ;;
10978 esac
10979
10980
10981 : how do we catenate cpp tokens here?
10982 echo " "
10983 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10984 $cat >cpp_stuff.c <<'EOCP'
10985 #define RCAT(a,b)a/**/b
10986 #define ACAT(a,b)a ## b
10987 RCAT(Rei,ser)
10988 ACAT(Cir,cus)
10989 EOCP
10990 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10991 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10992         echo "Oh!  Smells like ANSI's been here." >&4
10993         echo "We can catify or stringify, separately or together!"
10994         cpp_stuff=42
10995 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10996         echo "Ah, yes!  The good old days!" >&4
10997         echo "However, in the good old days we don't know how to stringify and"
10998         echo "catify at the same time."
10999         cpp_stuff=1
11000 else
11001         $cat >&4 <<EOM
11002 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11003 to have to edit the values of CAT[2-5] in config.h...
11004 EOM
11005         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11006 fi
11007 $rm -f cpp_stuff.*
11008
11009 : see if this is a db.h system
11010 set db.h i_db
11011 eval $inhdr
11012
11013 case "$i_db" in
11014 $define)
11015         : Check db version.
11016         echo " "
11017         echo "Checking Berkeley DB version ..." >&4
11018         $cat >try.c <<EOCP
11019 #$d_const HASCONST
11020 #ifndef HASCONST
11021 #define const
11022 #endif
11023 #include <sys/types.h>
11024 #include <stdio.h>
11025 #include <db.h>
11026 int main()
11027 {
11028 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11029     int Major, Minor, Patch ;
11030     unsigned long Version ;
11031     (void)db_version(&Major, &Minor, &Patch) ;
11032     printf("You have Berkeley DB Version 2 or greater\n");
11033
11034     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11035                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11036     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11037                 Major, Minor, Patch) ;
11038
11039     /* check that db.h & libdb are compatible */
11040     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11041         printf("db.h and libdb are incompatible\n") ;
11042         exit(3);        
11043     }
11044
11045     printf("db.h and libdb are compatible\n") ;
11046
11047     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11048                 + DB_VERSION_PATCH ;
11049
11050     /* needs to be >= 2.3.4 */
11051     if (Version < 2003004) {
11052     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11053         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11054         exit(2);        
11055     }
11056
11057     exit(0);
11058 #else
11059 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11060     printf("You have Berkeley DB Version 1\n");
11061     exit(0);    /* DB version < 2: the coast is clear. */
11062 #else
11063     exit(1);    /* <db.h> not Berkeley DB? */
11064 #endif
11065 #endif
11066 }
11067 EOCP
11068         set try
11069         if eval $compile && ./try; then
11070                 echo 'Looks OK.' >&4
11071         else
11072                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11073                 i_db=$undef
11074                 case " $libs " in
11075                 *"-ldb "*)
11076                         : Remove db from list of libraries to use
11077                         echo "Removing unusable -ldb from library list" >&4
11078                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11079                         shift
11080                         libs="$*"
11081                         echo "libs = $libs" >&4
11082                         ;;
11083                 esac
11084         fi
11085         $rm -f try.*
11086         ;;
11087 esac
11088
11089 case "$i_db" in
11090 define)
11091         : Check the return type needed for hash 
11092         echo " "
11093         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11094         $cat >try.c <<EOCP
11095 #$d_const HASCONST
11096 #ifndef HASCONST
11097 #define const
11098 #endif
11099 #include <sys/types.h>
11100 #include <db.h>
11101
11102 #ifndef DB_VERSION_MAJOR
11103 u_int32_t hash_cb (ptr, size)
11104 const void *ptr;
11105 size_t size;
11106 {
11107 }
11108 HASHINFO info;
11109 int main()
11110 {
11111         info.hash = hash_cb;
11112 }
11113 #endif
11114 EOCP
11115         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11116                 if $contains warning try.out >>/dev/null 2>&1 ; then
11117                         db_hashtype='int'
11118                 else
11119                         db_hashtype='u_int32_t'
11120                 fi
11121         else
11122                 : XXX Maybe we should just give up here.
11123                 db_hashtype=u_int32_t
11124                 $cat try.out >&4
11125                 echo "Help:  I can't seem to compile the db test program." >&4
11126                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11127         fi
11128         $rm -f try.*
11129         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11130         ;;
11131 *)      db_hashtype=u_int32_t
11132         ;;
11133 esac
11134 case "$i_db" in
11135 define)
11136         : Check the return type needed for prefix 
11137         echo " "
11138         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11139         cat >try.c <<EOCP
11140 #$d_const HASCONST
11141 #ifndef HASCONST
11142 #define const
11143 #endif
11144 #include <sys/types.h>
11145 #include <db.h>
11146
11147 #ifndef DB_VERSION_MAJOR
11148 size_t prefix_cb (key1, key2)
11149 const DBT *key1;
11150 const DBT *key2;
11151 {
11152 }
11153 BTREEINFO info;
11154 int main()
11155 {
11156         info.prefix = prefix_cb;
11157 }
11158 #endif
11159 EOCP
11160         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11161                 if $contains warning try.out >>/dev/null 2>&1 ; then
11162                         db_prefixtype='int'
11163                 else
11164                         db_prefixtype='size_t'
11165                 fi
11166         else
11167                 db_prefixtype='size_t'
11168                 : XXX Maybe we should just give up here.
11169                 $cat try.out >&4
11170                 echo "Help:  I can't seem to compile the db test program." >&4
11171                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11172         fi
11173         $rm -f try.*
11174         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11175         ;;
11176 *)      db_prefixtype='size_t'
11177         ;;
11178 esac
11179
11180 : check for void type
11181 echo " "
11182 echo "Checking to see how well your C compiler groks the void type..." >&4
11183 case "$voidflags" in
11184 '')
11185         $cat >try.c <<'EOCP'
11186 #if TRY & 1
11187 void sub() {
11188 #else
11189 sub() {
11190 #endif
11191         extern void moo();      /* function returning void */
11192         void (*goo)();          /* ptr to func returning void */
11193 #if TRY & 8
11194         void *hue;              /* generic ptr */
11195 #endif
11196 #if TRY & 2
11197         void (*foo[10])();
11198 #endif
11199
11200 #if TRY & 4
11201         if(goo == moo) {
11202                 exit(0);
11203         }
11204 #endif
11205         exit(0);
11206 }
11207 int main() { sub(); }
11208 EOCP
11209         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11210                 voidflags=$defvoidused
11211         echo "Good.  It appears to support void to the level $package wants.">&4
11212                 if $contains warning .out >/dev/null 2>&1; then
11213                         echo "However, you might get some warnings that look like this:"
11214                         $cat .out
11215                 fi
11216         else
11217 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11218                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11219                         echo "It supports 1..."
11220                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11221                                 echo "It also supports 2..."
11222                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11223                                         voidflags=7
11224                                         echo "And it supports 4 but not 8 definitely."
11225                                 else
11226                                         echo "It doesn't support 4..."
11227                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11228                                                 voidflags=11
11229                                                 echo "But it supports 8."
11230                                         else
11231                                                 voidflags=3
11232                                                 echo "Neither does it support 8."
11233                                         fi
11234                                 fi
11235                         else
11236                                 echo "It does not support 2..."
11237                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11238                                         voidflags=13
11239                                         echo "But it supports 4 and 8."
11240                                 else
11241                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11242                                                 voidflags=5
11243                                                 echo "And it supports 4 but has not heard about 8."
11244                                         else
11245                                                 echo "However it supports 8 but not 4."
11246                                         fi
11247                                 fi
11248                         fi
11249                 else
11250                         echo "There is no support at all for void."
11251                         voidflags=0
11252                 fi
11253         fi
11254 esac
11255 case "$voidflags" in
11256 "$defvoidused") ;;
11257 *)      $cat >&4 <<'EOM'
11258   Support flag bits are:
11259     1: basic void declarations.
11260     2: arrays of pointers to functions returning void.
11261     4: operations between pointers to and addresses of void functions.
11262     8: generic void pointers.
11263 EOM
11264         dflt="$voidflags";
11265         rp="Your void support flags add up to what?"
11266         . ./myread
11267         voidflags="$ans"
11268         ;;
11269 esac
11270 $rm -f try.* .out
11271
11272
11273 : How can we generate normalized random numbers ?
11274 echo " "
11275 echo "Looking for a random number function..." >&4
11276 case "$randfunc" in
11277 '')
11278         if set drand48 val -f; eval $csym; $val; then
11279                 dflt="drand48"
11280                 echo "Good, found drand48()." >&4
11281         elif set random val -f; eval $csym; $val; then
11282                 dflt="random"
11283                 echo "OK, found random()." >&4
11284         else
11285                 dflt="rand"
11286                 echo "Yick, looks like I have to use rand()." >&4
11287         fi
11288         echo " "
11289         ;;
11290 *)
11291         dflt="$randfunc"
11292         ;;
11293 esac
11294 cont=true
11295
11296 case "$ccflags" in
11297 *-Dmy_rand=*|*-Dmy_srand=*)
11298         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11299         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11300         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11301         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11302         ;;
11303 esac
11304
11305 while $test "$cont"; do
11306         rp="Use which function to generate random numbers?"
11307         . ./myread
11308         if $test "$ans" = "$dflt"; then
11309                 : null
11310         else
11311                 randbits=''
11312         fi
11313         randfunc="$ans"
11314         if set $ans val -f; eval $csym; $val; then
11315                 cont=''
11316         else
11317                 dflt=y
11318                 rp="I cannot find function $ans. Use that name anyway?"
11319                 . ./myread
11320                 dflt=rand
11321                 case "$ans" in
11322                         [yY]*) cont='';;
11323                 esac
11324         fi
11325         case "$cont" in
11326         '')
11327                 case "$randfunc" in
11328                 drand48)
11329                         drand01="drand48()"
11330                         seedfunc="srand48"
11331                         randbits=48
11332                         randseedtype=long
11333                         ;;
11334                 rand|random)
11335                         case "$randbits" in
11336                         '')
11337 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11338                                 $cat >try.c <<EOCP
11339 #$i_unistd I_UNISTD
11340 #$i_stdlib I_STDLIB
11341 #include <stdio.h>
11342 #ifdef I_UNISTD
11343 #  include <unistd.h>
11344 #endif
11345 #ifdef I_STDLIB
11346 #  include <stdlib.h>
11347 #endif
11348 int main()
11349 {
11350         register int i;
11351         register unsigned long tmp;
11352         register unsigned long max = 0L;
11353
11354         for (i = 1000; i; i--) {
11355                 tmp = (unsigned long) $randfunc();
11356                 if (tmp > max) max = tmp;
11357         }
11358         for (i = 0; max; i++)
11359                 max /= 2;
11360         printf("%d\n",i);
11361 }
11362 EOCP
11363                                 set try
11364                                 if eval $compile_ok; then
11365                                         dflt=`try`
11366                                 else
11367                                         dflt='?'
11368                                         echo "(I can't seem to compile the test program...)"
11369                                 fi
11370                                 ;;
11371                         *)
11372                                 dflt="$randbits"
11373                                 ;;
11374                         esac
11375                         rp="How many bits does your $randfunc() function produce?"
11376                         . ./myread
11377                         randbits="$ans"
11378                         $rm -f try.c try
11379                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11380                         seedfunc="s$randfunc"
11381                         randseedtype=unsigned
11382                         ;;
11383                 *)
11384                         dflt="31"
11385                         rp="How many bits does your $randfunc() function produce?"
11386                         . ./myread
11387                         randbits="$ans"
11388                         seedfunc="s$randfunc"
11389                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11390                         if set $seedfunc val -f; eval $csym; $val; then
11391                                 echo "(Using $seedfunc() to seed random generator)"
11392                         else
11393                                 echo "(Warning: no $seedfunc() to seed random generator)"
11394                                 seedfunc=rand
11395                         fi
11396                         randseedtype=unsigned
11397                         ;;
11398                 esac
11399                 ;;
11400         esac
11401 done
11402
11403 echo " "
11404 echo "Determining whether or not we are on an EBCDIC system..." >&4
11405 $cat >tebcdic.c <<'EOM'
11406 int main()
11407 {
11408   if ('M'==0xd4) return 0;
11409   return 1;
11410 }
11411 EOM
11412
11413 val=$undef
11414 set tebcdic
11415 if eval $compile_ok; then
11416         if ./tebcdic; then
11417                 echo "You have EBCDIC." >&4
11418                 val="$define"
11419         else
11420                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11421         fi
11422 else
11423         echo "I'm unable to compile the test program." >&4
11424         echo "I'll assume ASCII or some ISO Latin." >&4
11425 fi
11426 $rm -f tebcdic.c tebcdic
11427 set ebcdic
11428 eval $setvar
11429
11430 echo " "
11431 $cat >&4 <<EOM
11432 Checking how to flush all pending stdio output...
11433 EOM
11434 # I only know how to find the first 32 possibly open files on SunOS.
11435 # See also hints/sunos_4_1.sh and util.c  --AD
11436 case "$osname" in
11437 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11438 esac
11439 $cat >>try.c <<EOCP
11440 #include <stdio.h>
11441 #$i_unistd I_UNISTD
11442 #ifdef I_UNISTD
11443 # include <unistd.h>
11444 #endif
11445 #$d_sysconf HAS_SYSCONF
11446 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11447 #ifdef HAS_STDIO_STREAM_ARRAY
11448 # define STDIO_STREAM_ARRAY $stdio_stream_array
11449 #endif
11450 int main() {
11451   FILE* p = fopen("try.out", "w");
11452 #ifdef TRY_FPUTC
11453   fputc('x', p);
11454 #else
11455 # ifdef TRY_FPRINTF
11456   fprintf(p, "x");
11457 # endif
11458 #endif
11459 #ifdef TRY_FFLUSH_NULL
11460   fflush(NULL);
11461 #endif
11462 #ifdef TRY_FFLUSH_ALL
11463   {
11464     long open_max = -1;
11465 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11466     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11467 # else
11468 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11469     open_max = sysconf(_SC_OPEN_MAX);
11470 #  else
11471 #   ifdef FOPEN_MAX
11472     open_max = FOPEN_MAX;
11473 #   else
11474 #    ifdef OPEN_MAX
11475     open_max = OPEN_MAX;
11476 #    else
11477 #     ifdef _NFILE
11478     open_max = _NFILE;
11479 #     endif
11480 #    endif
11481 #   endif
11482 #  endif
11483 # endif 
11484 # ifdef HAS_STDIO_STREAM_ARRAY
11485     if (open_max > 0) {
11486       long i;
11487       for (i = 0; i < open_max; i++)
11488             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11489                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11490                 STDIO_STREAM_ARRAY[i]._flag)
11491                 fflush(&STDIO_STREAM_ARRAY[i]);
11492     }   
11493   }
11494 # endif
11495 #endif
11496   _exit(42);
11497 }
11498 EOCP
11499 : first we have to find out how _not_ to flush
11500 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11501     output=''
11502     set try -DTRY_FPUTC
11503     if eval $compile; then
11504             $rm -f try.out
11505             ./try$exe_ext 2>/dev/null
11506             if $test ! -s try.out -a "X$?" = X42; then
11507                 output=-DTRY_FPUTC
11508             fi
11509     fi
11510     case "$output" in
11511     '')
11512             set try -DTRY_FPRINTF
11513             $rm -f try.out
11514             if eval $compile; then
11515                     $rm -f try.out
11516                     ./try$exe_ext 2>/dev/null
11517                     if $test ! -s try.out -a "X$?" = X42; then
11518                         output=-DTRY_FPRINTF
11519                     fi
11520             fi
11521         ;;
11522     esac
11523 fi
11524 : check for fflush NULL behaviour
11525 case "$fflushNULL" in
11526 '')     set try -DTRY_FFLUSH_NULL $output
11527         if eval $compile; then
11528                 $rm -f try.out
11529                 ./try$exe_ext 2>/dev/null
11530                 code="$?"
11531                 if $test -s try.out -a "X$code" = X42; then
11532                         fflushNULL="`$cat try.out`"
11533                 else
11534                         if $test "X$code" != X42; then
11535                                 $cat >&4 <<EOM
11536 (If this test failed, don't worry, we'll try another method shortly.)
11537 EOM
11538                         fi
11539                 fi
11540         fi
11541         $rm -f core try.core core.try.*
11542         case "$fflushNULL" in
11543         x)      $cat >&4 <<EOM
11544 Your fflush(NULL) works okay.
11545 EOM
11546                 fflushNULL="$define"
11547                 ;;
11548         '')     $cat >&4 <<EOM
11549 Your fflush(NULL) isn't working (contrary to ANSI C).
11550 EOM
11551                 fflushNULL="$undef"
11552                 ;;
11553         *)      $cat >&4 <<EOM
11554 Cannot figure out whether your fflush(NULL) works or not.
11555 I'm assuming it doesn't (contrary to ANSI C).
11556 EOM
11557                 fflushNULL="$undef"
11558                 ;;
11559         esac
11560         ;;
11561 $define|true|[yY]*)
11562         fflushNULL="$define"
11563         ;;
11564 *)
11565         fflushNULL="$undef"
11566         ;;
11567 esac
11568 : check explicit looping only if NULL did not work
11569 case "$fflushNULL" in
11570 "$undef")
11571         : check for fflush all behaviour
11572         case "$fflushall" in
11573         '')     set try -DTRY_FFLUSH_ALL $output
11574                 if eval $compile; then
11575                         $cat >&4 <<EOM
11576 (Now testing the other method--but note that also this may fail.)
11577 EOM
11578                         $rm -f try.out
11579                         ./try$exe_ext 2>/dev/null
11580                         if $test -s try.out -a "X$?" = X42; then
11581                                 fflushall="`$cat try.out`"
11582                         fi
11583                 fi
11584                 $rm -f core try.core core.try.*
11585                 case "$fflushall" in
11586                 x)      $cat >&4 <<EOM
11587 Whew. Flushing explicitly all the stdio streams works.
11588 EOM
11589                         fflushall="$define"
11590                         ;;
11591                 '')     $cat >&4 <<EOM
11592 Sigh. Flushing explicitly all the stdio streams doesn't work.
11593 EOM
11594                         fflushall="$undef"
11595                         ;;
11596                 *)      $cat >&4 <<EOM
11597 Cannot figure out whether flushing stdio streams explicitly works or not.
11598 I'm assuming it doesn't.
11599 EOM
11600                         fflushall="$undef"
11601                         ;;
11602                 esac
11603                 ;;
11604         "$define"|true|[yY]*)
11605                 fflushall="$define"
11606                 ;;
11607         *)
11608                 fflushall="$undef"
11609                 ;;
11610         esac
11611         ;;
11612 *)      fflushall="$undef"      
11613         ;;
11614 esac
11615 case "$fflushNULL$fflushall" in
11616 undefundef)
11617         $cat <<EOM
11618 I cannot figure out how to flush pending stdio output.
11619 EOM
11620         ;;
11621 esac
11622 $rm -f try.* try$exe_ext
11623
11624 : see what type file positions are declared as in the library
11625 rp="What is the type for file position used by fsetpos()?"
11626 set fpos_t fpostype long stdio.h sys/types.h
11627 eval $typedef_ask
11628
11629 : Store the full pathname to the ar program for use in the C program
11630 : Respect a hint or command line value for full_ar.
11631 case "$full_ar" in
11632 '') full_ar=$ar ;;
11633 esac
11634
11635 : Store the full pathname to the sed program for use in the C program
11636 full_sed=$sed
11637
11638 : see what type gids are declared as in the kernel
11639 echo " "
11640 echo "Looking for the type for group ids returned by getgid()."
11641 set gid_t gidtype xxx stdio.h sys/types.h
11642 eval $typedef
11643 case "$gidtype" in
11644 xxx)
11645         xxx=`./findhdr sys/user.h`
11646         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11647         case $1 in
11648         unsigned) dflt="$1 $2" ;;
11649         *) dflt="$1" ;;
11650         esac
11651         ;;
11652 *) dflt="$gidtype";;
11653 esac
11654 case "$gidtype" in
11655 gid_t) echo "gid_t found." ;;
11656 *)      rp="What is the type for group ids returned by getgid()?"
11657         . ./myread
11658         gidtype="$ans"
11659         ;;
11660 esac
11661
11662 : see if getgroups exists
11663 set getgroups d_getgrps
11664 eval $inlibc
11665
11666 : see if setgroups exists
11667 set setgroups d_setgrps
11668 eval $inlibc
11669
11670
11671 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11672 echo " "
11673 case "$d_getgrps$d_setgrps" in
11674 *define*)
11675         case "$groupstype" in
11676         '') dflt="$gidtype" ;;
11677         *)  dflt="$groupstype" ;;
11678         esac
11679         $cat <<EOM
11680 What type of pointer is the second argument to getgroups() and setgroups()?
11681 Usually this is the same as group ids, $gidtype, but not always.
11682
11683 EOM
11684         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11685         . ./myread
11686         groupstype="$ans"
11687         ;;
11688 *)  groupstype="$gidtype";;
11689 esac
11690
11691 : see what type lseek is declared as in the kernel
11692 rp="What is the type used for lseek's offset on this system?"
11693 set off_t lseektype long stdio.h sys/types.h
11694 eval $typedef_ask
11695
11696 echo " "
11697 $echo $n "Checking to see how big your file offsets are...$c" >&4
11698 $cat >try.c <<EOCP
11699 #include <sys/types.h>
11700 #include <stdio.h>
11701 int main()
11702 {
11703         printf("%d\n", sizeof($lseektype));
11704 }
11705 EOCP
11706 set try
11707 if eval $compile_ok; then
11708         lseeksize=`./try`
11709         $echo " $lseeksize bytes." >&4
11710 else
11711         dflt='4'
11712         echo " "
11713         echo "(I can't seem to compile the test program.  Guessing...)"
11714         rp="What is the size of your file offsets (in bytes)?"
11715         . ./myread
11716         lseeksize="$ans"
11717 fi
11718 $rm -f try.c try
11719
11720 echo " "
11721 echo "Checking if your $make program sets \$(MAKE)..." >&4
11722 case "$make_set_make" in
11723 '')
11724         $sed 's/^X //' > testmake.mak << 'EOF'
11725 Xall:
11726 X       @echo 'maketemp="$(MAKE)"'
11727 EOF
11728         case "`$make -f testmake.mak 2>/dev/null`" in
11729         *maketemp=*) make_set_make='#' ;;
11730         *)      make_set_make="MAKE=$make" ;;
11731         esac
11732         $rm -f testmake.mak
11733         ;;
11734 esac
11735 case "$make_set_make" in
11736 '#') echo "Yup, it does.";;
11737 *) echo "Nope, it doesn't.";;
11738 esac
11739
11740 : see what type is used for mode_t
11741 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11742 set mode_t modetype int stdio.h sys/types.h
11743 eval $typedef_ask
11744
11745 : define a fucntion to check prototypes
11746 $cat > protochk <<EOSH
11747 $startsh
11748 cc="$cc"
11749 optimize="$optimize"
11750 ccflags="$ccflags"
11751 prototype="$prototype"
11752 define="$define"
11753 rm=$rm
11754 EOSH
11755
11756 $cat >> protochk <<'EOSH'
11757
11758 $rm -f try.c
11759 foo="$1"
11760 shift
11761 while test $# -ge 2; do
11762         case "$1" in
11763                 $define) echo "#include <$2>" >> try.c ;;
11764                 literal) echo "$2" >> try.c ;;
11765         esac
11766     shift 2
11767 done
11768 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11769 cat >> try.c <<'EOCP'
11770 #ifdef CAN_PROTOTYPE
11771 #define _(args) args
11772 #else
11773 #define _(args) ()
11774 #endif
11775 EOCP
11776 echo "$foo" >> try.c
11777 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11778 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11779 status=$?
11780 $rm -f try.[co]
11781 exit $status
11782 EOSH
11783 chmod +x protochk
11784 $eunicefix protochk
11785
11786 : see what type is used for size_t
11787 rp="What is the type used for the length parameter for string functions?"
11788 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11789 eval $typedef_ask
11790
11791 : check for type of arguments to gethostbyaddr. 
11792 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11793         case "$d_gethbyaddr" in
11794         $define)
11795                 $cat <<EOM
11796
11797 Checking to see what type of arguments are accepted by gethostbyaddr().
11798 EOM
11799                 hdrs="$define sys/types.h
11800                         $d_socket sys/socket.h 
11801                         $i_niin netinet/in.h 
11802                         $i_netdb netdb.h
11803                         $i_unistd unistd.h"
11804                 : The first arg can 'char *' or 'void *'
11805                 : The second arg is some of integral type
11806                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11807                         for yyy in size_t long int; do
11808                                 case "$netdb_host_type" in
11809                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11810                                         if ./protochk "$try" $hdrs; then
11811                                                 echo "Your system accepts $xxx for the first arg."
11812                                                 echo "...and $yyy for the second arg."
11813                                                 netdb_host_type="$xxx"
11814                                                 netdb_hlen_type="$yyy"
11815                                         fi
11816                                         ;;
11817                                 esac
11818                         done
11819                 done
11820                 : In case none of those worked, prompt the user.
11821                 case "$netdb_host_type" in
11822                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11823                         dflt='char *'
11824                         . ./myread
11825                         netdb_host_type=$ans
11826                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11827                         dflt="$sizetype"
11828                         . ./myread
11829                         netdb_hlen_type=$ans
11830                         ;;
11831                 esac
11832                 ;;
11833         *)      : no gethostbyaddr, so pick harmless defaults
11834                 netdb_host_type='char *'
11835                 netdb_hlen_type="$sizetype"
11836                 ;;
11837         esac
11838         # Remove the "const" if needed. -- but then we'll have a 
11839         # prototype clash!
11840         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11841 fi
11842
11843 : check for type of argument to gethostbyname. 
11844 if test "X$netdb_name_type" = X ; then
11845         case "$d_gethbyname" in
11846         $define)
11847                 $cat <<EOM
11848
11849 Checking to see what type of argument is accepted by gethostbyname().
11850 EOM
11851                 hdrs="$define sys/types.h
11852                         $d_socket sys/socket.h 
11853                         $i_niin netinet/in.h 
11854                         $i_netdb netdb.h
11855                         $i_unistd unistd.h"
11856                 for xxx in "const char *" "char *"; do
11857                         case "$netdb_name_type" in
11858                         '')     try="extern struct hostent *gethostbyname($xxx);"
11859                                 if ./protochk "$try" $hdrs; then
11860                                         echo "Your system accepts $xxx."
11861                                         netdb_name_type="$xxx"
11862                                 fi
11863                                 ;;
11864                         esac
11865                 done
11866                 : In case none of those worked, prompt the user.
11867                 case "$netdb_name_type" in
11868                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11869                         dflt='char *'
11870                         . ./myread
11871                         netdb_name_type=$ans
11872                         ;;
11873                 esac
11874                 ;;
11875         *)      : no gethostbyname, so pick harmless default
11876                 netdb_name_type='char *'
11877                 ;;
11878         esac
11879 fi
11880
11881 : check for type of 1st argument to getnetbyaddr. 
11882 if test "X$netdb_net_type" = X ; then
11883         case "$d_getnbyaddr" in
11884         $define)
11885                 $cat <<EOM
11886
11887 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11888 EOM
11889                 hdrs="$define sys/types.h
11890                         $d_socket sys/socket.h 
11891                         $i_niin netinet/in.h 
11892                         $i_netdb netdb.h
11893                         $i_unistd unistd.h"
11894                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11895                         case "$netdb_net_type" in
11896                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11897                                 if ./protochk "$try" $hdrs; then
11898                                         echo "Your system accepts $xxx."
11899                                         netdb_net_type="$xxx"
11900                                 fi
11901                                 ;;
11902                         esac
11903                 done
11904                 : In case none of those worked, prompt the user.
11905                 case "$netdb_net_type" in
11906                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11907                         dflt='long'
11908                         . ./myread
11909                         netdb_net_type=$ans
11910                         ;;
11911                 esac
11912                 ;;
11913         *)      : no getnetbyaddr, so pick harmless default
11914                 netdb_net_type='long'
11915                 ;;
11916         esac
11917 fi
11918 : locate the preferred pager for this system
11919 case "$pager" in
11920 '')
11921         dflt=''
11922         case "$pg" in
11923         /*) dflt=$pg;;
11924         esac
11925         case "$more" in
11926         /*) dflt=$more;;
11927         esac
11928         case "$less" in
11929         /*) dflt=$less;;
11930         esac
11931         case "$dflt" in
11932         '') dflt=/usr/ucb/more;;
11933         esac
11934         ;;
11935 *) dflt="$pager";;
11936 esac
11937 echo " "
11938 fn=f/
11939 rp='What pager is used on your system?'
11940 . ./getfile
11941 pager="$ans"
11942
11943 : see what type pids are declared as in the kernel
11944 rp="What is the type of process ids on this system?"
11945 set pid_t pidtype int stdio.h sys/types.h
11946 eval $typedef_ask
11947
11948 : check for length of pointer
11949 echo " "
11950 case "$ptrsize" in
11951 '')
11952         $echo $n "Checking to see how big your pointers are...$c" >&4
11953         if test "$voidflags" -gt 7; then
11954                 echo '#define VOID_PTR char *' > try.c
11955         else
11956                 echo '#define VOID_PTR void *' > try.c
11957         fi
11958         $cat >>try.c <<'EOCP'
11959 #include <stdio.h>
11960 int main()
11961 {
11962         printf("%d\n", sizeof(VOID_PTR));
11963         exit(0);
11964 }
11965 EOCP
11966         set try
11967         if eval $compile_ok; then
11968                 ptrsize=`./try`
11969                 $echo " $ptrsize bytes." >&4
11970         else
11971                 dflt='4'
11972                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11973                 rp="What is the size of a pointer (in bytes)?"
11974                 . ./myread
11975                 ptrsize="$ans"
11976         fi
11977         ;;
11978 esac
11979 $rm -f try.c try
11980
11981 : see if ar generates random libraries by itself
11982 echo " "
11983 echo "Checking how to generate random libraries on your machine..." >&4
11984 echo 'int bar1() { return bar2(); }' > bar1.c
11985 echo 'int bar2() { return 2; }' > bar2.c
11986 $cat > foo.c <<'EOP'
11987 int main() { printf("%d\n", bar1()); exit(0); }
11988 EOP
11989 $cc $ccflags -c bar1.c >/dev/null 2>&1
11990 $cc $ccflags -c bar2.c >/dev/null 2>&1
11991 $cc $ccflags -c foo.c >/dev/null 2>&1
11992 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11993 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11994         ./foobar >/dev/null 2>&1; then
11995         echo "$ar appears to generate random libraries itself."
11996         orderlib=false
11997         ranlib=":"
11998 elif $ar ts bar$_a >/dev/null 2>&1 &&
11999         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12000         ./foobar >/dev/null 2>&1; then
12001                 echo "a table of contents needs to be added with '$ar ts'."
12002                 orderlib=false
12003                 ranlib="$ar ts"
12004 else
12005         case "$ranlib" in
12006         :) ranlib='';;
12007         '')
12008                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12009                 $test -f $ranlib || ranlib=''
12010                 ;;
12011         esac
12012         if $test -n "$ranlib"; then
12013                 echo "your system has '$ranlib'; we'll use that."
12014                 orderlib=false
12015         else
12016                 echo "your system doesn't seem to support random libraries"
12017                 echo "so we'll use lorder and tsort to order the libraries."
12018                 orderlib=true
12019                 ranlib=":"
12020         fi
12021 fi
12022 $rm -f foo* bar* 
12023
12024 : check for type of arguments to select. 
12025 case "$selecttype" in
12026 '') case "$d_select" in
12027         $define)
12028                 $cat <<EOM
12029 Checking to see what type of arguments are accepted by select().
12030 EOM
12031                 hdrs="$define sys/types.h
12032                         $i_systime sys/time.h 
12033                         $i_sysselct sys/select.h
12034                         $d_socket sys/socket.h"
12035                 : The first arg can be int, unsigned, or size_t
12036                 : The last arg may or may not be 'const'
12037                 val=''
12038                 : void pointer has been seen but using that
12039                 : breaks the selectminbits test
12040                 for xxx in 'fd_set *' 'int *'; do
12041                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12042                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12043                                         case "$val" in
12044                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12045                                                 if ./protochk "$try" $hdrs; then
12046                                                         echo "Your system accepts $xxx."
12047                                                         val="$xxx"
12048                                                 fi
12049                                                 ;;
12050                                         esac
12051                                 done
12052                         done
12053                 done
12054                 case "$val" in
12055                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12056                         case "$d_fd_set" in
12057                                 $define) dflt="fd_set *" ;;
12058                                 *)              dflt="int *" ;;
12059                         esac
12060                         . ./myread
12061                         val=$ans
12062                         ;;
12063                 esac
12064                 selecttype="$val"
12065                 ;;
12066         *)      : no select, so pick a harmless default
12067                 selecttype='int *'
12068                 ;;
12069         esac
12070         ;;
12071 esac
12072
12073 : check for the select 'width'
12074 case "$selectminbits" in
12075 '') case "$d_select" in
12076         $define)
12077                 $cat <<EOM
12078
12079 Checking to see on how many bits at a time your select() operates...
12080 EOM
12081                 $cat >try.c <<EOCP
12082 #include <sys/types.h>
12083 #$i_time I_TIME
12084 #$i_systime I_SYS_TIME
12085 #$i_systimek I_SYS_TIME_KERNEL
12086 #ifdef I_TIME
12087 #   include <time.h>
12088 #endif
12089 #ifdef I_SYS_TIME
12090 #   ifdef I_SYS_TIME_KERNEL
12091 #       define KERNEL
12092 #   endif
12093 #   include <sys/time.h>
12094 #   ifdef I_SYS_TIME_KERNEL
12095 #       undef KERNEL
12096 #   endif
12097 #endif
12098 #$i_sysselct I_SYS_SELECT
12099 #ifdef I_SYS_SELECT
12100 #include <sys/select.h>
12101 #endif
12102 #$d_socket HAS_SOCKET
12103 #ifdef HAS_SOCKET
12104 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12105 #endif
12106 #include <stdio.h>
12107 $selecttype b;
12108 #define S sizeof(*(b))
12109 #define MINBITS 64
12110 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12111 #define NBITS  (NBYTES * 8)
12112 int main() {
12113     char s[NBYTES];
12114     struct timeval t;
12115     int i;
12116     FILE* fp;
12117     int fd;
12118
12119     fclose(stdin);
12120     fp = fopen("try.c", "r");
12121     if (fp == 0)
12122       exit(1);
12123     fd = fileno(fp);
12124     if (fd < 0)
12125       exit(2);
12126     b = ($selecttype)s;
12127     for (i = 0; i < NBITS; i++)
12128         FD_SET(i, b);
12129     t.tv_sec  = 0;
12130     t.tv_usec = 0;
12131     select(fd + 1, b, 0, 0, &t);
12132     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12133     printf("%d\n", i + 1);
12134     return 0;
12135 }
12136 EOCP
12137                 set try
12138                 if eval $compile_ok; then
12139                         selectminbits=`./try`
12140                         case "$selectminbits" in
12141                         '')     cat >&4 <<EOM
12142 Cannot figure out on how many bits at a time your select() operates.
12143 I'll play safe and guess it is 32 bits.
12144 EOM
12145                                 selectminbits=32
12146                                 bits="32 bits"
12147                                 ;;
12148                         1)      bits="1 bit" ;;
12149                         *)      bits="$selectminbits bits" ;;
12150                         esac
12151                         echo "Your select() operates on $bits at a time." >&4
12152                 else
12153                         rp='What is the minimum number of bits your select() operates on?'
12154                         case "$byteorder" in
12155                         1234|12345678)  dflt=32 ;;
12156                         *)              dflt=1  ;;
12157                         esac
12158                         . ./myread
12159                         val=$ans
12160                         selectminbits="$val"
12161                 fi
12162                 $rm -f try.* try
12163                 ;;
12164         *)      : no select, so pick a harmless default
12165                 selectminbits='32'
12166                 ;;
12167         esac
12168         ;;
12169 esac
12170
12171 : Trace out the files included by signal.h, then look for SIGxxx names.
12172 : Remove SIGARRAYSIZE used by HPUX.
12173 : Remove SIGSTKSIZE used by Linux.
12174 : Remove SIGSTKSZ used by Posix.
12175 : Remove SIGTYP void lines used by OS2.
12176 xxx=`echo '#include <signal.h>' |
12177         $cppstdin $cppminus $cppflags 2>/dev/null |
12178         $grep '^[       ]*#.*include' | 
12179         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12180 : Check this list of files to be sure we have parsed the cpp output ok.
12181 : This will also avoid potentially non-existent files, such 
12182 : as ../foo/bar.h
12183 xxxfiles=''
12184 for xx in $xxx /dev/null ; do
12185         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12186 done
12187 : If we have found no files, at least try signal.h
12188 case "$xxxfiles" in
12189 '')     xxxfiles=`./findhdr signal.h` ;;
12190 esac
12191 xxx=`awk '
12192 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12193         print substr($2, 4, 20)
12194 }
12195 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12196         print substr($3, 4, 20)
12197 }' $xxxfiles`
12198 : Append some common names just in case the awk scan failed.
12199 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12200 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12201 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12202 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12203 : generate a few handy files for later
12204 $cat > signal.c <<'EOCP'
12205 #include <sys/types.h>
12206 #include <signal.h>
12207 #include <stdio.h>
12208 int main() {
12209
12210 /* Strange style to avoid deeply-nested #if/#else/#endif */
12211 #ifndef NSIG
12212 #  ifdef _NSIG
12213 #    define NSIG (_NSIG)
12214 #  endif
12215 #endif
12216
12217 #ifndef NSIG
12218 #  ifdef SIGMAX
12219 #    define NSIG (SIGMAX+1)
12220 #  endif
12221 #endif
12222
12223 #ifndef NSIG
12224 #  ifdef SIG_MAX
12225 #    define NSIG (SIG_MAX+1)
12226 #  endif
12227 #endif
12228
12229 #ifndef NSIG
12230 #  ifdef MAXSIG
12231 #    define NSIG (MAXSIG+1)
12232 #  endif
12233 #endif
12234
12235 #ifndef NSIG
12236 #  ifdef MAX_SIG
12237 #    define NSIG (MAX_SIG+1)
12238 #  endif
12239 #endif
12240
12241 #ifndef NSIG
12242 #  ifdef SIGARRAYSIZE
12243 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12244 #  endif
12245 #endif
12246
12247 #ifndef NSIG
12248 #  ifdef _sys_nsig
12249 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12250 #  endif
12251 #endif
12252
12253 /* Default to some arbitrary number that's big enough to get most
12254    of the common signals.
12255 */
12256 #ifndef NSIG
12257 #    define NSIG 50
12258 #endif
12259
12260 printf("NSIG %d\n", NSIG);
12261
12262 #ifndef JUST_NSIG
12263
12264 EOCP
12265
12266 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12267 {
12268         printf "#ifdef SIG"; printf $1; printf "\n"
12269         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12270         printf $1; printf ");\n"
12271         printf "#endif\n"
12272 }
12273 END {
12274         printf "#endif /* JUST_NSIG */\n";
12275         printf "}\n";
12276 }
12277 ' >>signal.c
12278 $cat >signal.awk <<'EOP'
12279 BEGIN { ndups = 0 }
12280 $1 ~ /^NSIG$/ { nsig = $2 }
12281 ($1 !~ /^NSIG$/) && (NF == 2) {
12282     if ($2 > maxsig) { maxsig = $2 }
12283     if (sig_name[$2]) {
12284         dup_name[ndups] = $1
12285         dup_num[ndups] = $2
12286         ndups++ 
12287     }
12288     else {
12289         sig_name[$2] = $1
12290         sig_num[$2] = $2
12291     }
12292 }
12293 END { 
12294     if (nsig == 0) {
12295         nsig = maxsig + 1
12296     }
12297     printf("NSIG %d\n", nsig);
12298     for (n = 1; n < nsig; n++) {
12299         if (sig_name[n]) {
12300             printf("%s %d\n", sig_name[n], sig_num[n])
12301         }
12302         else {
12303             printf("NUM%d %d\n", n, n) 
12304         }
12305     }
12306     for (n = 0; n < ndups; n++) {
12307         printf("%s %d\n", dup_name[n], dup_num[n])
12308     }
12309 }
12310 EOP
12311 $cat >signal_cmd <<EOS
12312 $startsh
12313 if $test -s signal.lst; then
12314     echo "Using your existing signal.lst file"
12315         exit 0
12316 fi
12317 xxx="$xxx"
12318 EOS
12319 $cat >>signal_cmd <<'EOS'
12320
12321 set signal
12322 if eval $compile_ok; then
12323         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12324 else
12325         echo "(I can't seem be able to compile the whole test program)" >&4
12326         echo "(I'll try it in little pieces.)" >&4
12327         set signal -DJUST_NSIG
12328         if eval $compile_ok; then
12329                 ./signal$_exe > signal.nsg
12330                 $cat signal.nsg
12331         else
12332                 echo "I can't seem to figure out how many signals you have." >&4
12333                 echo "Guessing 50." >&4
12334                 echo 'NSIG 50' > signal.nsg
12335         fi
12336         : Now look at all the signal names, one at a time.
12337         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12338                 $cat > signal.c <<EOCP
12339 #include <sys/types.h>
12340 #include <signal.h>
12341 #include <stdio.h>
12342 int main() {
12343 printf("$xx %d\n", SIG${xx});
12344 return 0;
12345 }
12346 EOCP
12347                 set signal
12348                 if eval $compile; then
12349                         echo "SIG${xx} found."
12350                         ./signal$_exe  >> signal.ls1
12351                 else
12352                         echo "SIG${xx} NOT found."
12353                 fi
12354         done
12355         if $test -s signal.ls1; then
12356                 $cat signal.nsg signal.ls1 |
12357                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12358         fi
12359
12360 fi
12361 if $test -s signal.lst; then
12362         :
12363 else
12364         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12365         echo 'kill -l' >signal
12366         set X `csh -f <signal`
12367         $rm -f signal
12368         shift
12369         case $# in
12370         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12371         esac
12372         echo $@ | $tr ' ' $trnl | \
12373             $awk '{ printf "%s %d\n", $1, ++s; }
12374                   END { printf "NSIG %d\n", ++s }' >signal.lst
12375 fi
12376 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12377 EOS
12378 chmod a+x signal_cmd
12379 $eunicefix signal_cmd
12380
12381 : generate list of signal names
12382 echo " "
12383 case "$sig_name_init" in
12384 '') doinit=yes ;;
12385 *)  case "$sig_num_init" in
12386     ''|*,*) doinit=yes ;;
12387     esac ;;
12388 esac
12389 case "$doinit" in
12390 yes)
12391         echo "Generating a list of signal names and numbers..." >&4
12392         . ./signal_cmd
12393         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12394         sig_name=`$awk 'BEGIN { printf "ZERO " }
12395                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12396         sig_num=`$awk  'BEGIN { printf "0 " }
12397                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12398         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12399                              !/^NSIG/   { printf "\"%s\", ", $1 }
12400                              END        { printf "0\n" }' signal.lst`
12401         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12402                              !/^NSIG/   { printf "%d, ", $2}
12403                              END        { printf "0\n"}' signal.lst`
12404         ;;
12405 esac
12406 echo "The following $sig_count signals are available:"
12407 echo " "
12408 echo $sig_name | $awk \
12409 'BEGIN { linelen = 0 }
12410 {
12411         for (i = 1; i <= NF; i++) {
12412                 name = "SIG" $i " "
12413                 linelen = linelen + length(name)
12414                 if (linelen > 70) {
12415                         printf "\n"
12416                         linelen = length(name)
12417                 }
12418                 printf "%s", name
12419         }
12420         printf "\n"
12421 }'
12422 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12423
12424 : see what type is used for signed size_t
12425 set ssize_t ssizetype int stdio.h sys/types.h
12426 eval $typedef
12427 dflt="$ssizetype"
12428 $cat > ssize.c <<EOM
12429 #include <stdio.h>
12430 #include <sys/types.h>
12431 #define Size_t $sizetype
12432 #define SSize_t $dflt
12433 int main()
12434 {
12435         if (sizeof(Size_t) == sizeof(SSize_t))
12436                 printf("$dflt\n");
12437         else if (sizeof(Size_t) == sizeof(int))
12438                 printf("int\n");
12439         else 
12440                 printf("long\n");
12441         exit(0);
12442 }
12443 EOM
12444 echo " "
12445 set ssize
12446 if eval $compile_ok && ./ssize > /dev/null; then
12447         ssizetype=`./ssize`
12448         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12449 else
12450         $cat >&4 <<EOM
12451 Help! I can't compile and run the ssize_t test program: please enlighten me!
12452 (This is probably a misconfiguration in your system or libraries, and
12453 you really ought to fix it.  Still, I'll try anyway.)
12454
12455 I need a type that is the same size as $sizetype, but is guaranteed to
12456 be signed.  Common values are ssize_t, int and long.
12457
12458 EOM
12459         rp="What signed type is the same size as $sizetype?"
12460         . ./myread
12461         ssizetype="$ans"
12462 fi
12463 $rm -f ssize ssize.*
12464
12465 : see what type of char stdio uses.
12466 echo " "
12467 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12468         echo "Your stdio uses unsigned chars." >&4
12469         stdchar="unsigned char"
12470 else
12471         echo "Your stdio uses signed chars." >&4
12472         stdchar="char"
12473 fi
12474
12475 : see if time exists
12476 echo " "
12477 if test "X$d_time" = X -o X"$timetype" = X; then
12478     if set time val -f d_time; eval $csym; $val; then
12479                 echo 'time() found.' >&4
12480                 val="$define"
12481                 rp="What is the type returned by time() on this system?"
12482                 set time_t timetype long stdio.h sys/types.h
12483                 eval $typedef_ask
12484     else
12485                 echo 'time() not found, hope that will do.' >&4
12486                 val="$undef"
12487                 timetype='int';
12488     fi
12489     set d_time
12490     eval $setvar
12491 fi
12492
12493 : see what type uids are declared as in the kernel
12494 echo " "
12495 echo "Looking for the type for user ids returned by getuid()."
12496 set uid_t uidtype xxx stdio.h sys/types.h
12497 eval $typedef
12498 case "$uidtype" in
12499 xxx)
12500         xxx=`./findhdr sys/user.h`
12501         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12502         case $1 in
12503         unsigned) dflt="$1 $2" ;;
12504         *) dflt="$1" ;;
12505         esac
12506         ;;
12507 *) dflt="$uidtype";;
12508 esac
12509 case "$uidtype" in
12510 uid_t)  echo "uid_t found." ;;
12511 *)      rp="What is the type for user ids returned by getuid()?"
12512         . ./myread
12513         uidtype="$ans"
12514         ;;
12515 esac
12516
12517 : see if dbm.h is available
12518 : see if dbmclose exists
12519 set dbmclose d_dbmclose
12520 eval $inlibc
12521
12522 case "$d_dbmclose" in
12523 $define)
12524         set dbm.h i_dbm
12525         eval $inhdr
12526         case "$i_dbm" in
12527         $define)
12528                 val="$undef"
12529                 set i_rpcsvcdbm
12530                 eval $setvar
12531                 ;;
12532         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12533                 eval $inhdr
12534                 ;;
12535         esac
12536         ;;
12537 *)      echo "We won't be including <dbm.h>"
12538         val="$undef"
12539         set i_dbm
12540         eval $setvar
12541         val="$undef"
12542         set i_rpcsvcdbm
12543         eval $setvar
12544         ;;
12545 esac
12546
12547 : see if this is a sys/file.h system
12548 val=''
12549 set sys/file.h val
12550 eval $inhdr
12551
12552 : do we need to include sys/file.h ?
12553 case "$val" in
12554 "$define")
12555         echo " "
12556         if $h_sysfile; then
12557                 val="$define"
12558                 echo "We'll be including <sys/file.h>." >&4
12559         else
12560                 val="$undef"
12561                 echo "We won't be including <sys/file.h>." >&4
12562         fi
12563         ;;
12564 *)
12565         h_sysfile=false
12566         ;;
12567 esac
12568 set i_sysfile
12569 eval $setvar
12570
12571 : see if fcntl.h is there
12572 val=''
12573 set fcntl.h val
12574 eval $inhdr
12575
12576 : see if we can include fcntl.h
12577 case "$val" in
12578 "$define")
12579         echo " "
12580         if $h_fcntl; then
12581                 val="$define"
12582                 echo "We'll be including <fcntl.h>." >&4
12583         else
12584                 val="$undef"
12585                 if $h_sysfile; then
12586         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12587                 else
12588                         echo "We won't be including <fcntl.h>." >&4
12589                 fi
12590         fi
12591         ;;
12592 *)
12593         h_fcntl=false
12594         val="$undef"
12595         ;;
12596 esac
12597 set i_fcntl
12598 eval $setvar
12599
12600 : see if locale.h is available
12601 set locale.h i_locale
12602 eval $inhdr
12603
12604 : see if mach cthreads are available
12605 if test "X$usethreads" = "X$define"; then
12606         set mach/cthreads.h i_machcthr
12607         eval $inhdr
12608 else
12609         i_machcthr="$undef"
12610 fi
12611
12612
12613
12614 : see if this is a math.h system
12615 set math.h i_math
12616 eval $inhdr
12617
12618 : see if this is a mntent.h system
12619 set mntent.h i_mntent
12620 eval $inhdr
12621
12622 : see if ndbm.h is available
12623 set ndbm.h t_ndbm
12624 eval $inhdr
12625 case "$t_ndbm" in
12626 $define)
12627         : see if dbm_open exists
12628         set dbm_open d_dbm_open
12629         eval $inlibc
12630         case "$d_dbm_open" in
12631         $undef)
12632                 t_ndbm="$undef"
12633                 echo "We won't be including <ndbm.h>"
12634                 ;;
12635         esac
12636         ;;
12637 esac
12638 val="$t_ndbm"
12639 set i_ndbm
12640 eval $setvar
12641
12642 : see if net/errno.h is available
12643 val=''
12644 set net/errno.h val
12645 eval $inhdr
12646
12647 : Unfortunately, it causes problems on some systems.  Arrgh.
12648 case "$val" in
12649 $define)
12650         cat > try.c <<'EOM'
12651 #include <stdio.h>
12652 #include <errno.h>
12653 #include <net/errno.h>
12654 int func()
12655 {
12656         return ENOTSOCK;
12657 }
12658 EOM
12659         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12660                 echo "We'll be including <net/errno.h>." >&4
12661         else
12662                 echo "We won't be including <net/errno.h>." >&4
12663                 val="$undef"
12664         fi
12665         $rm -f try.* try
12666         ;;
12667 esac
12668 set i_neterrno
12669 eval $setvar
12670
12671 : see if netinet/tcp.h is available
12672 set netinet/tcp.h i_netinettcp
12673 eval $inhdr
12674
12675 : see if this is a poll.h system
12676 set poll.h i_poll
12677 eval $inhdr
12678
12679 : get C preprocessor symbols handy
12680 echo " "
12681 $echo $n "Hmm... $c"
12682 echo $al | $tr ' ' $trnl >Cppsym.know
12683 $cat <<EOSS >Cppsym
12684 $startsh
12685 case "\$1" in
12686 -l) list=true
12687         shift
12688         ;;
12689 esac
12690 unknown=''
12691 case "\$list\$#" in
12692 1|2)
12693         for sym do
12694                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12695                         exit 0
12696                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12697                         :
12698                 else
12699                         unknown="\$unknown \$sym"
12700                 fi
12701         done
12702         set X \$unknown
12703         shift
12704         ;;
12705 esac
12706 case \$# in
12707 0) exit 1;;
12708 esac
12709 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12710 #ifdef \1\\
12711 exit 0; _ _ _ _\1\\      \1\\
12712 #endif\\
12713 /' >Cppsym\$\$
12714 echo "exit 1; _ _ _" >>Cppsym\$\$
12715 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12716 case "\$list" in
12717 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12718 *)
12719         sh Cppsym2\$\$
12720         status=\$?
12721         ;;
12722 esac
12723 $rm -f Cppsym\$\$ Cppsym2\$\$
12724 exit \$status
12725 EOSS
12726 chmod +x Cppsym
12727 $eunicefix Cppsym
12728 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12729
12730 : now check the C compiler for additional symbols
12731 postprocess_cc_v=''
12732 case "$osname" in
12733 aix) postprocess_cc_v="|$tr , ' '" ;;
12734 esac
12735 $cat >ccsym <<EOS
12736 $startsh
12737 $cat >tmp.c <<EOF
12738 extern int foo;
12739 EOF
12740 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12741 do
12742         case "\$i" in
12743         -D*) echo "\$i" | $sed 's/^-D//';;
12744         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12745         esac
12746 done
12747 $rm -f try.c
12748 EOS
12749 postprocess_cc_v=''
12750 chmod +x ccsym
12751 $eunicefix ccsym
12752 ./ccsym > ccsym1.raw
12753 if $test -s ccsym1.raw; then
12754        $sort ccsym1.raw | $uniq >ccsym.raw
12755 else
12756        mv ccsym1.raw ccsym.raw
12757 fi
12758
12759 $awk '/\=/ { print $0; next }
12760         { print $0"=1" }' ccsym.raw >ccsym.list
12761 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12762 $comm -13 ccsym.true ccsym.list >ccsym.own
12763 $comm -12 ccsym.true ccsym.list >ccsym.com
12764 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12765 also=''
12766 if $test -z ccsym.raw; then
12767         echo "Your C compiler doesn't seem to define any symbols!" >&4
12768         echo " "
12769         echo "However, your C preprocessor defines the following symbols:"
12770         $cat Cppsym.true
12771         ccsymbols=''
12772         cppsymbols=`$cat Cppsym.true`
12773         cppsymbols=`echo $cppsymbols`
12774         cppccsymbols="$cppsymbols"
12775 else
12776         if $test -s ccsym.com; then
12777                 echo "Your C compiler and pre-processor define these symbols:"
12778                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12779                 also='also '
12780                 symbols='ones'
12781                 cppccsymbols=`$cat ccsym.com`
12782                 cppccsymbols=`echo $cppccsymbols`
12783                 $test "$silent" || sleep 1
12784         fi
12785         if $test -s ccsym.cpp; then
12786                 $test "$also" && echo " "
12787                 echo "Your C pre-processor ${also}defines the following symbols:"
12788                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12789                 also='further '
12790                 cppsymbols=`$cat ccsym.cpp`
12791                 cppsymbols=`echo $cppsymbols`
12792                 $test "$silent" || sleep 1
12793         fi
12794         if $test -s ccsym.own; then
12795                 $test "$also" && echo " "
12796                 echo "Your C compiler ${also}defines the following cpp symbols:"
12797                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12798                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12799                 ccsymbols=`$cat ccsym.own`
12800                 ccsymbols=`echo $ccsymbols`
12801                 $test "$silent" || sleep 1
12802         fi
12803 fi
12804 $rm -f ccsym*
12805
12806 : see if this is a termio system
12807 val="$undef"
12808 val2="$undef"
12809 val3="$undef"
12810 if $test `./findhdr termios.h`; then
12811         set tcsetattr i_termios
12812         eval $inlibc
12813         val3="$i_termios"
12814 fi
12815 echo " "
12816 case "$val3" in
12817 "$define") echo "You have POSIX termios.h... good!" >&4;;
12818 *) if ./Cppsym pyr; then
12819                 case "`/bin/universe`" in
12820                 ucb) if $test `./findhdr sgtty.h`; then
12821                                 val2="$define"
12822                                 echo "<sgtty.h> found." >&4
12823                         else
12824                                 echo "System is pyramid with BSD universe."
12825                                 echo "<sgtty.h> not found--you could have problems." >&4
12826                         fi;;
12827                 *) if $test `./findhdr termio.h`; then
12828                                 val="$define"
12829                                 echo "<termio.h> found." >&4
12830                         else
12831                                 echo "System is pyramid with USG universe."
12832                                 echo "<termio.h> not found--you could have problems." >&4
12833                         fi;;
12834                 esac
12835         elif ./usg; then
12836                 if $test `./findhdr termio.h`; then
12837                         echo "<termio.h> found." >&4
12838                         val="$define"
12839                 elif $test `./findhdr sgtty.h`; then
12840                         echo "<sgtty.h> found." >&4
12841                         val2="$define"
12842                 else
12843 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12844                 fi
12845         else
12846                 if $test `./findhdr sgtty.h`; then
12847                         echo "<sgtty.h> found." >&4
12848                         val2="$define"
12849                 elif $test `./findhdr termio.h`; then
12850                         echo "<termio.h> found." >&4
12851                         val="$define"
12852                 else
12853 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12854                 fi
12855         fi;;
12856 esac
12857 set i_termio; eval $setvar
12858 val=$val2; set i_sgtty; eval $setvar
12859 val=$val3; set i_termios; eval $setvar
12860
12861 : see if this is a shadow.h system
12862 set shadow.h i_shadow
12863 eval $inhdr
12864
12865 : see if this is a socks.h system
12866 set socks.h i_socks
12867 eval $inhdr
12868
12869 : see if stdarg is available
12870 echo " "
12871 if $test `./findhdr stdarg.h`; then
12872         echo "<stdarg.h> found." >&4
12873         valstd="$define"
12874 else
12875         echo "<stdarg.h> NOT found." >&4
12876         valstd="$undef"
12877 fi
12878
12879 : see if varags is available
12880 echo " "
12881 if $test `./findhdr varargs.h`; then
12882         echo "<varargs.h> found." >&4
12883 else
12884         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12885 fi
12886
12887 : set up the varargs testing programs
12888 $cat > varargs.c <<EOP
12889 #ifdef I_STDARG
12890 #include <stdarg.h>
12891 #endif
12892 #ifdef I_VARARGS
12893 #include <varargs.h>
12894 #endif
12895
12896 #ifdef I_STDARG
12897 int f(char *p, ...)
12898 #else
12899 int f(va_alist)
12900 va_dcl
12901 #endif
12902 {
12903         va_list ap;
12904 #ifndef I_STDARG
12905         char *p;
12906 #endif
12907 #ifdef I_STDARG
12908         va_start(ap,p);
12909 #else
12910         va_start(ap);
12911         p = va_arg(ap, char *);
12912 #endif
12913         va_end(ap);
12914 }
12915 EOP
12916 $cat > varargs <<EOP
12917 $startsh
12918 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12919         echo "true"
12920 else
12921         echo "false"
12922 fi
12923 $rm -f varargs$_o
12924 EOP
12925 chmod +x varargs
12926
12927 : now check which varargs header should be included
12928 echo " "
12929 i_varhdr=''
12930 case "$valstd" in
12931 "$define")
12932         if `./varargs I_STDARG`; then
12933                 val='stdarg.h'
12934         elif `./varargs I_VARARGS`; then
12935                 val='varargs.h'
12936         fi
12937         ;;
12938 *)
12939         if `./varargs I_VARARGS`; then
12940                 val='varargs.h'
12941         fi
12942         ;;
12943 esac
12944 case "$val" in
12945 '')
12946 echo "I could not find the definition for va_dcl... You have problems..." >&4
12947         val="$undef"; set i_stdarg; eval $setvar
12948         val="$undef"; set i_varargs; eval $setvar
12949         ;;
12950 *) 
12951         set i_varhdr
12952         eval $setvar
12953         case "$i_varhdr" in
12954         stdarg.h)
12955                 val="$define"; set i_stdarg; eval $setvar
12956                 val="$undef"; set i_varargs; eval $setvar
12957                 ;;
12958         varargs.h)
12959                 val="$undef"; set i_stdarg; eval $setvar
12960                 val="$define"; set i_varargs; eval $setvar
12961                 ;;
12962         esac
12963         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12964 esac
12965 $rm -f varargs*
12966
12967 : see if stddef is available
12968 set stddef.h i_stddef
12969 eval $inhdr
12970
12971 : see if sys/access.h is available
12972 set sys/access.h i_sysaccess
12973 eval $inhdr
12974
12975 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12976 set sys/filio.h i_sysfilio
12977 eval $inhdr
12978 echo " "
12979 if $test `./findhdr sys/ioctl.h`; then
12980         val="$define"
12981         echo '<sys/ioctl.h> found.' >&4
12982 else
12983         val="$undef"
12984         if $test $i_sysfilio = "$define"; then
12985             echo '<sys/ioctl.h> NOT found.' >&4
12986         else
12987                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12988                 $test $i_termio = "$define" && xxx="termio.h"
12989                 $test $i_termios = "$define" && xxx="termios.h"
12990 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12991         fi
12992 fi
12993 set i_sysioctl
12994 eval $setvar
12995
12996 : see if sys/resource.h has to be included
12997 set sys/resource.h i_sysresrc
12998 eval $inhdr
12999
13000 : see if sys/security.h is available
13001 set sys/security.h i_syssecrt
13002 eval $inhdr
13003
13004 : see if this is a sys/statvfs.h system
13005 set sys/statvfs.h i_sysstatvfs
13006 eval $inhdr
13007
13008 : see if this is a sys/un.h system
13009 set sys/un.h i_sysun
13010 eval $inhdr
13011
13012 : see if this is a syswait system
13013 set sys/wait.h i_syswait
13014 eval $inhdr
13015
13016 : see if this is an utime system
13017 set utime.h i_utime
13018 eval $inhdr
13019
13020 : see if this is a values.h system
13021 set values.h i_values
13022 eval $inhdr
13023
13024 : see if this is a vfork system
13025 case "$d_vfork" in
13026 "$define")
13027         set vfork.h i_vfork
13028         eval $inhdr
13029         ;;
13030 *)
13031         i_vfork="$undef"
13032         ;;
13033 esac
13034
13035 : see if gdbm.h is available
13036 set gdbm.h t_gdbm
13037 eval $inhdr
13038 case "$t_gdbm" in
13039 $define)
13040         : see if gdbm_open exists
13041         set gdbm_open d_gdbm_open
13042         eval $inlibc
13043         case "$d_gdbm_open" in
13044         $undef)
13045                 t_gdbm="$undef"
13046                 echo "We won't be including <gdbm.h>"
13047                 ;;
13048         esac
13049         ;;
13050 esac
13051 val="$t_gdbm"
13052 set i_gdbm
13053 eval $setvar
13054
13055 echo " "
13056 echo "Looking for extensions..." >&4
13057 : If we are using the old config.sh, known_extensions may contain
13058 : old or inaccurate or duplicate values.
13059 known_extensions=''
13060 nonxs_extensions=''
13061 : We do not use find because it might not be available.
13062 : We do not just use MANIFEST because the user may have dropped
13063 : some additional extensions into the source tree and expect them
13064 : to be built.
13065
13066 : Function to recursively find available extensions, ignoring DynaLoader
13067 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13068 find_extensions='
13069     for xxx in *; do
13070        case "$xxx" in
13071            DynaLoader|dynaload) ;;
13072            *)
13073            if $test -f $xxx/$xxx.xs; then
13074                known_extensions="$known_extensions $1$xxx";
13075            elif $test -f $xxx/Makefile.PL; then
13076                nonxs_extensions="$nonxs_extensions $1$xxx";
13077            else
13078                if $test -d $xxx -a $# -lt 10; then
13079                    set $1$xxx/ $*;
13080                    cd $xxx;
13081                    eval $find_extensions;
13082                    cd ..;
13083                    shift;
13084                fi;
13085            fi
13086            ;;
13087        esac;
13088     done'
13089 tdir=`pwd`
13090 cd $rsrc/ext
13091 set X
13092 shift
13093 eval $find_extensions
13094 set X $nonxs_extensions
13095 shift
13096 nonxs_extensions="$*"
13097 set X $known_extensions
13098 shift
13099 known_extensions="$*"
13100 cd $tdir
13101
13102 : Now see which are supported on this system.
13103 avail_ext=''
13104 for xxx in $known_extensions ; do
13105         case "$xxx" in
13106         DB_File|db_file)
13107                 case "$i_db" in
13108                 $define) avail_ext="$avail_ext $xxx" ;;
13109                 esac
13110                 ;;
13111         GDBM_File|gdbm_fil)
13112                 case "$i_gdbm" in 
13113                 $define) avail_ext="$avail_ext $xxx" ;;
13114                 esac
13115                 ;;
13116         NDBM_File|ndbm_fil)
13117                 case "$i_ndbm" in
13118                 $define) avail_ext="$avail_ext $xxx" ;;
13119                 esac
13120                 ;;
13121         ODBM_File|odbm_fil) 
13122                 case "${i_dbm}${i_rpcsvcdbm}" in
13123                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13124                 esac
13125                 ;;
13126         POSIX|posix)
13127                 case "$useposix" in
13128                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13129                 esac
13130                 ;;
13131         Opcode|opcode)
13132                 case "$useopcode" in
13133                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13134                 esac
13135                 ;;
13136         Socket|socket)
13137                 case "$d_socket" in 
13138                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13139                 esac
13140                 ;;
13141         Thread|thread)
13142                 case "$usethreads" in 
13143                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13144                 esac
13145                 ;;
13146         IPC/SysV|ipc/sysv)
13147                 : XXX Do we need a useipcsysv variable here
13148                 case "${d_msg}${d_sem}${d_shm}" in 
13149                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13150                 esac
13151                 ;;
13152         *)      avail_ext="$avail_ext $xxx"
13153                 ;;
13154         esac
13155 done
13156
13157 set X $avail_ext
13158 shift
13159 avail_ext="$*"
13160
13161 : Now see which nonxs extensions are supported on this system.
13162 : For now assume all are.
13163 nonxs_ext=''
13164 for xxx in $nonxs_extensions ; do
13165         case "$xxx" in
13166         *)      nonxs_ext="$nonxs_ext $xxx"
13167                 ;;
13168         esac
13169 done
13170
13171 set X $nonxs_ext
13172 shift
13173 nonxs_ext="$*"
13174
13175 case $usedl in
13176 $define)
13177         $cat <<EOM
13178 A number of extensions are supplied with $package.  You may choose to
13179 compile these extensions for dynamic loading (the default), compile
13180 them into the $package executable (static loading), or not include
13181 them at all.  Answer "none" to include no extensions.
13182 Note that DynaLoader is always built and need not be mentioned here.
13183
13184 EOM
13185         case "$dynamic_ext" in
13186         '') dflt="$avail_ext" ;;
13187         *)      dflt="$dynamic_ext"
13188                 # Perhaps we are reusing an old out-of-date config.sh.
13189                 case "$hint" in
13190                 previous)
13191                         if test X"$dynamic_ext" != X"$avail_ext"; then
13192                                 $cat <<EOM
13193 NOTICE:  Your previous config.sh list may be incorrect. 
13194 The extensions now available to you are 
13195         ${avail_ext}
13196 but the default list from your previous config.sh is
13197         ${dynamic_ext} 
13198
13199 EOM
13200                         fi
13201                         ;;
13202                 esac
13203                 ;;
13204         esac
13205         case "$dflt" in
13206         '')     dflt=none;;
13207         esac
13208         rp="What extensions do you wish to load dynamically?"
13209         . ./myread
13210         case "$ans" in
13211         none) dynamic_ext=' ' ;;
13212         *) dynamic_ext="$ans" ;;
13213         esac
13214
13215         case "$static_ext" in
13216         '')
13217                 : Exclude those already listed in dynamic linking
13218                 dflt=''
13219                 for xxx in $avail_ext; do
13220                         case " $dynamic_ext " in
13221                         *" $xxx "*) ;;
13222                         *) dflt="$dflt $xxx" ;;
13223                         esac
13224                 done
13225                 set X $dflt
13226                 shift
13227                 dflt="$*"
13228                 ;;
13229         *)  dflt="$static_ext" 
13230                 ;;
13231         esac
13232
13233         case "$dflt" in
13234         '')     dflt=none;;
13235         esac
13236         rp="What extensions do you wish to load statically?"
13237         . ./myread
13238         case "$ans" in
13239         none) static_ext=' ' ;;
13240         *) static_ext="$ans" ;;
13241         esac
13242         ;;
13243 *)
13244         $cat <<EOM
13245 A number of extensions are supplied with $package.  Answer "none" 
13246 to include no extensions. 
13247 Note that DynaLoader is always built and need not be mentioned here.
13248
13249 EOM
13250         case "$static_ext" in
13251         '') dflt="$avail_ext" ;;
13252         *)      dflt="$static_ext"
13253                 # Perhaps we are reusing an old out-of-date config.sh.
13254                 case "$hint" in
13255                 previous)
13256                         if test X"$static_ext" != X"$avail_ext"; then
13257                                 $cat <<EOM
13258 NOTICE:  Your previous config.sh list may be incorrect. 
13259 The extensions now available to you are 
13260         ${avail_ext}
13261 but the default list from your previous config.sh is
13262         ${static_ext} 
13263
13264 EOM
13265                         fi
13266                         ;;
13267                 esac
13268                 ;;
13269         esac
13270         : Exclude those that are not xs extensions
13271         case "$dflt" in
13272         '')     dflt=none;;
13273         esac
13274         rp="What extensions do you wish to include?"
13275         . ./myread
13276         case "$ans" in
13277         none) static_ext=' ' ;;
13278         *) static_ext="$ans" ;;
13279         esac
13280         ;;
13281 esac
13282
13283 set X $dynamic_ext $static_ext $nonxs_ext
13284 shift
13285 extensions="$*"
13286
13287 : Remove build directory name from cppstdin so it can be used from
13288 : either the present location or the final installed location.
13289 echo " "
13290 : Get out of the UU directory to get correct path name.
13291 cd ..
13292 case "$cppstdin" in
13293 `pwd`/cppstdin)
13294         echo "Stripping down cppstdin path name"
13295         cppstdin=cppstdin
13296         ;;
13297 esac
13298 cd UU
13299
13300 : end of configuration questions
13301 echo " "
13302 echo "End of configuration questions."
13303 echo " "
13304
13305 : back to where it started
13306 if test -d ../UU; then
13307         cd ..
13308 fi
13309
13310 : configuration may be patched via a 'config.over' file
13311 if $test -f config.over; then
13312         echo " "
13313         dflt=y
13314         rp='I see a config.over file.  Do you wish to load it?'
13315         . UU/myread
13316         case "$ans" in
13317         n*) echo "OK, I'll ignore it.";;
13318         *)      . ./config.over
13319                 echo "Configuration override changes have been loaded."
13320                 ;;
13321         esac
13322 fi
13323
13324 : in case they want portability, strip down executable paths
13325 case "$d_portable" in
13326 "$define")
13327         echo " "
13328         echo "Stripping down executable paths..." >&4
13329         for file in $loclist $trylist; do
13330                 eval temp=\$$file
13331                 eval $file=`basename $temp`
13332         done
13333         ;;
13334 esac
13335
13336 : create config.sh file
13337 echo " "
13338 echo "Creating config.sh..." >&4
13339 $spitshell <<EOT >config.sh
13340 $startsh
13341 #
13342 # This file was produced by running the Configure script. It holds all the
13343 # definitions figured out by Configure. Should you modify one of these values,
13344 # do not forget to propagate your changes by running "Configure -der". You may
13345 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13346 #
13347
13348 # Package name      : $package
13349 # Source directory  : $src
13350 # Configuration time: $cf_time
13351 # Configured by     : $cf_by
13352 # Target system     : $myuname
13353
13354 Author='$Author'
13355 Date='$Date'
13356 Header='$Header'
13357 Id='$Id'
13358 Locker='$Locker'
13359 Log='$Log'
13360 Mcc='$Mcc'
13361 RCSfile='$RCSfile'
13362 Revision='$Revision'
13363 Source='$Source'
13364 State='$State'
13365 _a='$_a'
13366 _exe='$_exe'
13367 _o='$_o'
13368 afs='$afs'
13369 alignbytes='$alignbytes'
13370 ansi2knr='$ansi2knr'
13371 aphostname='$aphostname'
13372 apiversion='$apiversion'
13373 ar='$ar'
13374 archlib='$archlib'
13375 archlibexp='$archlibexp'
13376 archname64='$archname64'
13377 archname='$archname'
13378 archobjs='$archobjs'
13379 awk='$awk'
13380 baserev='$baserev'
13381 bash='$bash'
13382 bin='$bin'
13383 bincompat5005='$bincompat5005'
13384 binexp='$binexp'
13385 bison='$bison'
13386 byacc='$byacc'
13387 byteorder='$byteorder'
13388 c='$c'
13389 castflags='$castflags'
13390 cat='$cat'
13391 cc='$cc'
13392 cccdlflags='$cccdlflags'
13393 ccdlflags='$ccdlflags'
13394 ccflags='$ccflags'
13395 ccsymbols='$ccsymbols'
13396 cf_by='$cf_by'
13397 cf_email='$cf_email'
13398 cf_time='$cf_time'
13399 chgrp='$chgrp'
13400 chmod='$chmod'
13401 chown='$chown'
13402 clocktype='$clocktype'
13403 comm='$comm'
13404 compress='$compress'
13405 contains='$contains'
13406 cp='$cp'
13407 cpio='$cpio'
13408 cpp='$cpp'
13409 cpp_stuff='$cpp_stuff'
13410 cppccsymbols='$cppccsymbols'
13411 cppflags='$cppflags'
13412 cpplast='$cpplast'
13413 cppminus='$cppminus'
13414 cpprun='$cpprun'
13415 cppstdin='$cppstdin'
13416 cppsymbols='$cppsymbols'
13417 crosscompile='$crosscompile'
13418 cryptlib='$cryptlib'
13419 csh='$csh'
13420 d_Gconvert='$d_Gconvert'
13421 d_PRIEldbl='$d_PRIEldbl'
13422 d_PRIFldbl='$d_PRIFldbl'
13423 d_PRIGldbl='$d_PRIGldbl'
13424 d_PRIX64='$d_PRIX64'
13425 d_PRId64='$d_PRId64'
13426 d_PRIeldbl='$d_PRIeldbl'
13427 d_PRIfldbl='$d_PRIfldbl'
13428 d_PRIgldbl='$d_PRIgldbl'
13429 d_PRIi64='$d_PRIi64'
13430 d_PRIo64='$d_PRIo64'
13431 d_PRIu64='$d_PRIu64'
13432 d_PRIx64='$d_PRIx64'
13433 d_access='$d_access'
13434 d_accessx='$d_accessx'
13435 d_alarm='$d_alarm'
13436 d_archlib='$d_archlib'
13437 d_atolf='$d_atolf'
13438 d_atoll='$d_atoll'
13439 d_attribut='$d_attribut'
13440 d_bcmp='$d_bcmp'
13441 d_bcopy='$d_bcopy'
13442 d_bincompat5005='$d_bincompat5005'
13443 d_bsd='$d_bsd'
13444 d_bsdgetpgrp='$d_bsdgetpgrp'
13445 d_bsdsetpgrp='$d_bsdsetpgrp'
13446 d_bzero='$d_bzero'
13447 d_casti32='$d_casti32'
13448 d_castneg='$d_castneg'
13449 d_charvspr='$d_charvspr'
13450 d_chown='$d_chown'
13451 d_chroot='$d_chroot'
13452 d_chsize='$d_chsize'
13453 d_closedir='$d_closedir'
13454 d_cmsghdr_s='$d_cmsghdr_s'
13455 d_const='$d_const'
13456 d_crypt='$d_crypt'
13457 d_csh='$d_csh'
13458 d_cuserid='$d_cuserid'
13459 d_dbl_dig='$d_dbl_dig'
13460 d_difftime='$d_difftime'
13461 d_dirnamlen='$d_dirnamlen'
13462 d_dlerror='$d_dlerror'
13463 d_dlopen='$d_dlopen'
13464 d_dlsymun='$d_dlsymun'
13465 d_dosuid='$d_dosuid'
13466 d_drand48proto='$d_drand48proto'
13467 d_dup2='$d_dup2'
13468 d_eaccess='$d_eaccess'
13469 d_endgrent='$d_endgrent'
13470 d_endhent='$d_endhent'
13471 d_endnent='$d_endnent'
13472 d_endpent='$d_endpent'
13473 d_endpwent='$d_endpwent'
13474 d_endsent='$d_endsent'
13475 d_endspent='$d_endspent'
13476 d_eofnblk='$d_eofnblk'
13477 d_eunice='$d_eunice'
13478 d_fchmod='$d_fchmod'
13479 d_fchown='$d_fchown'
13480 d_fcntl='$d_fcntl'
13481 d_fd_macros='$d_fd_macros'
13482 d_fd_set='$d_fd_set'
13483 d_fds_bits='$d_fds_bits'
13484 d_fgetpos='$d_fgetpos'
13485 d_flexfnam='$d_flexfnam'
13486 d_flock='$d_flock'
13487 d_fork='$d_fork'
13488 d_fpathconf='$d_fpathconf'
13489 d_fpos64_t='$d_fpos64_t'
13490 d_fseeko='$d_fseeko'
13491 d_fsetpos='$d_fsetpos'
13492 d_fstatfs='$d_fstatfs'
13493 d_fstatvfs='$d_fstatvfs'
13494 d_ftello='$d_ftello'
13495 d_ftime='$d_ftime'
13496 d_getgrent='$d_getgrent'
13497 d_getgrps='$d_getgrps'
13498 d_gethbyaddr='$d_gethbyaddr'
13499 d_gethbyname='$d_gethbyname'
13500 d_gethent='$d_gethent'
13501 d_gethname='$d_gethname'
13502 d_gethostprotos='$d_gethostprotos'
13503 d_getlogin='$d_getlogin'
13504 d_getmntent='$d_getmntent'
13505 d_getnbyaddr='$d_getnbyaddr'
13506 d_getnbyname='$d_getnbyname'
13507 d_getnent='$d_getnent'
13508 d_getnetprotos='$d_getnetprotos'
13509 d_getpbyname='$d_getpbyname'
13510 d_getpbynumber='$d_getpbynumber'
13511 d_getpent='$d_getpent'
13512 d_getpgid='$d_getpgid'
13513 d_getpgrp2='$d_getpgrp2'
13514 d_getpgrp='$d_getpgrp'
13515 d_getppid='$d_getppid'
13516 d_getprior='$d_getprior'
13517 d_getprotoprotos='$d_getprotoprotos'
13518 d_getpwent='$d_getpwent'
13519 d_getsbyname='$d_getsbyname'
13520 d_getsbyport='$d_getsbyport'
13521 d_getsent='$d_getsent'
13522 d_getservprotos='$d_getservprotos'
13523 d_getspent='$d_getspent'
13524 d_getspnam='$d_getspnam'
13525 d_gettimeod='$d_gettimeod'
13526 d_gnulibc='$d_gnulibc'
13527 d_grpasswd='$d_grpasswd'
13528 d_hasmntopt='$d_hasmntopt'
13529 d_htonl='$d_htonl'
13530 d_index='$d_index'
13531 d_inetaton='$d_inetaton'
13532 d_int64t='$d_int64t'
13533 d_iovec_s='$d_iovec_s'
13534 d_isascii='$d_isascii'
13535 d_killpg='$d_killpg'
13536 d_lchown='$d_lchown'
13537 d_ldbl_dig='$d_ldbl_dig'
13538 d_link='$d_link'
13539 d_llseek='$d_llseek'
13540 d_locconv='$d_locconv'
13541 d_lockf='$d_lockf'
13542 d_longdbl='$d_longdbl'
13543 d_longlong='$d_longlong'
13544 d_lstat='$d_lstat'
13545 d_madvise='$d_madvise'
13546 d_mblen='$d_mblen'
13547 d_mbstowcs='$d_mbstowcs'
13548 d_mbtowc='$d_mbtowc'
13549 d_memchr='$d_memchr'
13550 d_memcmp='$d_memcmp'
13551 d_memcpy='$d_memcpy'
13552 d_memmove='$d_memmove'
13553 d_memset='$d_memset'
13554 d_mkdir='$d_mkdir'
13555 d_mkfifo='$d_mkfifo'
13556 d_mktime='$d_mktime'
13557 d_mmap='$d_mmap'
13558 d_mprotect='$d_mprotect'
13559 d_msg='$d_msg'
13560 d_msg_ctrunc='$d_msg_ctrunc'
13561 d_msg_dontroute='$d_msg_dontroute'
13562 d_msg_oob='$d_msg_oob'
13563 d_msg_peek='$d_msg_peek'
13564 d_msg_proxy='$d_msg_proxy'
13565 d_msgctl='$d_msgctl'
13566 d_msgget='$d_msgget'
13567 d_msghdr_s='$d_msghdr_s'
13568 d_msgrcv='$d_msgrcv'
13569 d_msgsnd='$d_msgsnd'
13570 d_msync='$d_msync'
13571 d_munmap='$d_munmap'
13572 d_mymalloc='$d_mymalloc'
13573 d_nice='$d_nice'
13574 d_off64_t='$d_off64_t'
13575 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13576 d_oldpthreads='$d_oldpthreads'
13577 d_oldsock='$d_oldsock'
13578 d_open3='$d_open3'
13579 d_pathconf='$d_pathconf'
13580 d_pause='$d_pause'
13581 d_phostname='$d_phostname'
13582 d_pipe='$d_pipe'
13583 d_poll='$d_poll'
13584 d_portable='$d_portable'
13585 d_pthread_yield='$d_pthread_yield'
13586 d_pwage='$d_pwage'
13587 d_pwchange='$d_pwchange'
13588 d_pwclass='$d_pwclass'
13589 d_pwcomment='$d_pwcomment'
13590 d_pwexpire='$d_pwexpire'
13591 d_pwgecos='$d_pwgecos'
13592 d_pwpasswd='$d_pwpasswd'
13593 d_pwquota='$d_pwquota'
13594 d_readdir='$d_readdir'
13595 d_readlink='$d_readlink'
13596 d_readv='$d_readv'
13597 d_recvmsg='$d_recvmsg'
13598 d_rename='$d_rename'
13599 d_rewinddir='$d_rewinddir'
13600 d_rmdir='$d_rmdir'
13601 d_safebcpy='$d_safebcpy'
13602 d_safemcpy='$d_safemcpy'
13603 d_sanemcmp='$d_sanemcmp'
13604 d_sched_yield='$d_sched_yield'
13605 d_scm_rights='$d_scm_rights'
13606 d_seekdir='$d_seekdir'
13607 d_select='$d_select'
13608 d_sem='$d_sem'
13609 d_semctl='$d_semctl'
13610 d_semctl_semid_ds='$d_semctl_semid_ds'
13611 d_semctl_semun='$d_semctl_semun'
13612 d_semget='$d_semget'
13613 d_semop='$d_semop'
13614 d_sendmsg='$d_sendmsg'
13615 d_setegid='$d_setegid'
13616 d_seteuid='$d_seteuid'
13617 d_setgrent='$d_setgrent'
13618 d_setgrps='$d_setgrps'
13619 d_sethent='$d_sethent'
13620 d_setlinebuf='$d_setlinebuf'
13621 d_setlocale='$d_setlocale'
13622 d_setnent='$d_setnent'
13623 d_setpent='$d_setpent'
13624 d_setpgid='$d_setpgid'
13625 d_setpgrp2='$d_setpgrp2'
13626 d_setpgrp='$d_setpgrp'
13627 d_setprior='$d_setprior'
13628 d_setpwent='$d_setpwent'
13629 d_setregid='$d_setregid'
13630 d_setresgid='$d_setresgid'
13631 d_setresuid='$d_setresuid'
13632 d_setreuid='$d_setreuid'
13633 d_setrgid='$d_setrgid'
13634 d_setruid='$d_setruid'
13635 d_setsent='$d_setsent'
13636 d_setsid='$d_setsid'
13637 d_setspent='$d_setspent'
13638 d_setvbuf='$d_setvbuf'
13639 d_sfio='$d_sfio'
13640 d_shm='$d_shm'
13641 d_shmat='$d_shmat'
13642 d_shmatprototype='$d_shmatprototype'
13643 d_shmctl='$d_shmctl'
13644 d_shmdt='$d_shmdt'
13645 d_shmget='$d_shmget'
13646 d_sigaction='$d_sigaction'
13647 d_sigsetjmp='$d_sigsetjmp'
13648 d_socket='$d_socket'
13649 d_sockpair='$d_sockpair'
13650 d_statblks='$d_statblks'
13651 d_statfs='$d_statfs'
13652 d_statfsflags='$d_statfsflags'
13653 d_statvfs='$d_statvfs'
13654 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13655 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13656 d_stdio_stream_array='$d_stdio_stream_array'
13657 d_stdiobase='$d_stdiobase'
13658 d_stdstdio='$d_stdstdio'
13659 d_strchr='$d_strchr'
13660 d_strcoll='$d_strcoll'
13661 d_strctcpy='$d_strctcpy'
13662 d_strerrm='$d_strerrm'
13663 d_strerror='$d_strerror'
13664 d_strtod='$d_strtod'
13665 d_strtol='$d_strtol'
13666 d_strtoul='$d_strtoul'
13667 d_strtoull='$d_strtoull'
13668 d_strxfrm='$d_strxfrm'
13669 d_suidsafe='$d_suidsafe'
13670 d_symlink='$d_symlink'
13671 d_syscall='$d_syscall'
13672 d_sysconf='$d_sysconf'
13673 d_sysernlst='$d_sysernlst'
13674 d_syserrlst='$d_syserrlst'
13675 d_system='$d_system'
13676 d_tcgetpgrp='$d_tcgetpgrp'
13677 d_tcsetpgrp='$d_tcsetpgrp'
13678 d_telldir='$d_telldir'
13679 d_telldirproto='$d_telldirproto'
13680 d_time='$d_time'
13681 d_times='$d_times'
13682 d_truncate='$d_truncate'
13683 d_tzname='$d_tzname'
13684 d_umask='$d_umask'
13685 d_uname='$d_uname'
13686 d_union_semun='$d_union_semun'
13687 d_vendorlib='$d_vendorlib'
13688 d_vfork='$d_vfork'
13689 d_void_closedir='$d_void_closedir'
13690 d_voidsig='$d_voidsig'
13691 d_voidtty='$d_voidtty'
13692 d_volatile='$d_volatile'
13693 d_vprintf='$d_vprintf'
13694 d_wait4='$d_wait4'
13695 d_waitpid='$d_waitpid'
13696 d_wcstombs='$d_wcstombs'
13697 d_wctomb='$d_wctomb'
13698 d_writev='$d_writev'
13699 d_xenix='$d_xenix'
13700 date='$date'
13701 db_hashtype='$db_hashtype'
13702 db_prefixtype='$db_prefixtype'
13703 defvoidused='$defvoidused'
13704 direntrytype='$direntrytype'
13705 dlext='$dlext'
13706 dlsrc='$dlsrc'
13707 doublesize='$doublesize'
13708 drand01='$drand01'
13709 dynamic_ext='$dynamic_ext'
13710 eagain='$eagain'
13711 ebcdic='$ebcdic'
13712 echo='$echo'
13713 egrep='$egrep'
13714 emacs='$emacs'
13715 eunicefix='$eunicefix'
13716 exe_ext='$exe_ext'
13717 expr='$expr'
13718 extensions='$extensions'
13719 fflushNULL='$fflushNULL'
13720 fflushall='$fflushall'
13721 find='$find'
13722 firstmakefile='$firstmakefile'
13723 flex='$flex'
13724 fpostype='$fpostype'
13725 freetype='$freetype'
13726 full_ar='$full_ar'
13727 full_csh='$full_csh'
13728 full_sed='$full_sed'
13729 gccversion='$gccversion'
13730 gidtype='$gidtype'
13731 glibpth='$glibpth'
13732 grep='$grep'
13733 groupcat='$groupcat'
13734 groupstype='$groupstype'
13735 gzip='$gzip'
13736 h_fcntl='$h_fcntl'
13737 h_sysfile='$h_sysfile'
13738 hint='$hint'
13739 hostcat='$hostcat'
13740 huge='$huge'
13741 i_arpainet='$i_arpainet'
13742 i_bsdioctl='$i_bsdioctl'
13743 i_db='$i_db'
13744 i_dbm='$i_dbm'
13745 i_dirent='$i_dirent'
13746 i_dld='$i_dld'
13747 i_dlfcn='$i_dlfcn'
13748 i_fcntl='$i_fcntl'
13749 i_float='$i_float'
13750 i_gdbm='$i_gdbm'
13751 i_grp='$i_grp'
13752 i_inttypes='$i_inttypes'
13753 i_limits='$i_limits'
13754 i_locale='$i_locale'
13755 i_machcthr='$i_machcthr'
13756 i_malloc='$i_malloc'
13757 i_math='$i_math'
13758 i_memory='$i_memory'
13759 i_mntent='$i_mntent'
13760 i_ndbm='$i_ndbm'
13761 i_netdb='$i_netdb'
13762 i_neterrno='$i_neterrno'
13763 i_netinettcp='$i_netinettcp'
13764 i_niin='$i_niin'
13765 i_poll='$i_poll'
13766 i_pthread='$i_pthread'
13767 i_pwd='$i_pwd'
13768 i_rpcsvcdbm='$i_rpcsvcdbm'
13769 i_sfio='$i_sfio'
13770 i_sgtty='$i_sgtty'
13771 i_shadow='$i_shadow'
13772 i_socks='$i_socks'
13773 i_stdarg='$i_stdarg'
13774 i_stddef='$i_stddef'
13775 i_stdlib='$i_stdlib'
13776 i_string='$i_string'
13777 i_sysaccess='$i_sysaccess'
13778 i_sysdir='$i_sysdir'
13779 i_sysfile='$i_sysfile'
13780 i_sysfilio='$i_sysfilio'
13781 i_sysin='$i_sysin'
13782 i_sysioctl='$i_sysioctl'
13783 i_sysmman='$i_sysmman'
13784 i_sysmount='$i_sysmount'
13785 i_sysndir='$i_sysndir'
13786 i_sysparam='$i_sysparam'
13787 i_sysresrc='$i_sysresrc'
13788 i_syssecrt='$i_syssecrt'
13789 i_sysselct='$i_sysselct'
13790 i_syssockio='$i_syssockio'
13791 i_sysstat='$i_sysstat'
13792 i_sysstatvfs='$i_sysstatvfs'
13793 i_systime='$i_systime'
13794 i_systimek='$i_systimek'
13795 i_systimes='$i_systimes'
13796 i_systypes='$i_systypes'
13797 i_sysuio='$i_sysuio'
13798 i_sysun='$i_sysun'
13799 i_syswait='$i_syswait'
13800 i_termio='$i_termio'
13801 i_termios='$i_termios'
13802 i_time='$i_time'
13803 i_unistd='$i_unistd'
13804 i_utime='$i_utime'
13805 i_values='$i_values'
13806 i_varargs='$i_varargs'
13807 i_varhdr='$i_varhdr'
13808 i_vfork='$i_vfork'
13809 ignore_versioned_solibs='$ignore_versioned_solibs'
13810 incpath='$incpath'
13811 inews='$inews'
13812 installarchlib='$installarchlib'
13813 installbin='$installbin'
13814 installman1dir='$installman1dir'
13815 installman3dir='$installman3dir'
13816 installprefix='$installprefix'
13817 installprefixexp='$installprefixexp'
13818 installprivlib='$installprivlib'
13819 installscript='$installscript'
13820 installsitearch='$installsitearch'
13821 installsitelib='$installsitelib'
13822 installstyle='$installstyle'
13823 installusrbinperl='$installusrbinperl'
13824 installvendorlib='$installvendorlib'
13825 intsize='$intsize'
13826 known_extensions='$known_extensions'
13827 ksh='$ksh'
13828 large='$large'
13829 ld='$ld'
13830 lddlflags='$lddlflags'
13831 ldflags='$ldflags'
13832 ldlibpthname='$ldlibpthname'
13833 less='$less'
13834 lib_ext='$lib_ext'
13835 libc='$libc'
13836 libperl='$libperl'
13837 libpth='$libpth'
13838 libs='$libs'
13839 libswanted='$libswanted'
13840 line='$line'
13841 lint='$lint'
13842 lkflags='$lkflags'
13843 ln='$ln'
13844 lns='$lns'
13845 locincpth='$locincpth'
13846 loclibpth='$loclibpth'
13847 longdblsize='$longdblsize'
13848 longlongsize='$longlongsize'
13849 longsize='$longsize'
13850 lp='$lp'
13851 lpr='$lpr'
13852 ls='$ls'
13853 lseeksize='$lseeksize'
13854 lseektype='$lseektype'
13855 mail='$mail'
13856 mailx='$mailx'
13857 make='$make'
13858 make_set_make='$make_set_make'
13859 mallocobj='$mallocobj'
13860 mallocsrc='$mallocsrc'
13861 malloctype='$malloctype'
13862 man1dir='$man1dir'
13863 man1direxp='$man1direxp'
13864 man1ext='$man1ext'
13865 man3dir='$man3dir'
13866 man3direxp='$man3direxp'
13867 man3ext='$man3ext'
13868 medium='$medium'
13869 mips='$mips'
13870 mips_type='$mips_type'
13871 mkdir='$mkdir'
13872 mmaptype='$mmaptype'
13873 models='$models'
13874 modetype='$modetype'
13875 more='$more'
13876 multiarch='$multiarch'
13877 mv='$mv'
13878 myarchname='$myarchname'
13879 mydomain='$mydomain'
13880 myhostname='$myhostname'
13881 myuname='$myuname'
13882 n='$n'
13883 netdb_hlen_type='$netdb_hlen_type'
13884 netdb_host_type='$netdb_host_type'
13885 netdb_name_type='$netdb_name_type'
13886 netdb_net_type='$netdb_net_type'
13887 nm='$nm'
13888 nm_opt='$nm_opt'
13889 nm_so_opt='$nm_so_opt'
13890 nonxs_ext='$nonxs_ext'
13891 nroff='$nroff'
13892 o_nonblock='$o_nonblock'
13893 obj_ext='$obj_ext'
13894 old_pthread_create_joinable='$old_pthread_create_joinable'
13895 optimize='$optimize'
13896 orderlib='$orderlib'
13897 osname='$osname'
13898 osvers='$osvers'
13899 package='$package'
13900 pager='$pager'
13901 passcat='$passcat'
13902 patchlevel='$patchlevel'
13903 path_sep='$path_sep'
13904 perl='$perl'
13905 perladmin='$perladmin'
13906 perlpath='$perlpath'
13907 pg='$pg'
13908 phostname='$phostname'
13909 pidtype='$pidtype'
13910 plibpth='$plibpth'
13911 pmake='$pmake'
13912 pr='$pr'
13913 prefix='$prefix'
13914 prefixexp='$prefixexp'
13915 privlib='$privlib'
13916 privlibexp='$privlibexp'
13917 prototype='$prototype'
13918 ptrsize='$ptrsize'
13919 randbits='$randbits'
13920 randfunc='$randfunc'
13921 randseedtype='$randseedtype'
13922 ranlib='$ranlib'
13923 rd_nodata='$rd_nodata'
13924 rm='$rm'
13925 rmail='$rmail'
13926 runnm='$runnm'
13927 sPRIEldbl='$sPRIEldbl'
13928 sPRIFldbl='$sPRIFldbl'
13929 sPRIGldbl='$sPRIGldbl'
13930 sPRIX64='$sPRIX64'
13931 sPRId64='$sPRId64'
13932 sPRIeldbl='$sPRIeldbl'
13933 sPRIfldbl='$sPRIfldbl'
13934 sPRIgldbl='$sPRIgldbl'
13935 sPRIi64='$sPRIi64'
13936 sPRIo64='$sPRIo64'
13937 sPRIu64='$sPRIu64'
13938 sPRIx64='$sPRIx64'
13939 sched_yield='$sched_yield'
13940 scriptdir='$scriptdir'
13941 scriptdirexp='$scriptdirexp'
13942 sed='$sed'
13943 seedfunc='$seedfunc'
13944 selectminbits='$selectminbits'
13945 selecttype='$selecttype'
13946 sendmail='$sendmail'
13947 sh='$sh'
13948 shar='$shar'
13949 sharpbang='$sharpbang'
13950 shmattype='$shmattype'
13951 shortsize='$shortsize'
13952 shrpenv='$shrpenv'
13953 shsharp='$shsharp'
13954 sig_count='$sig_count'
13955 sig_name='$sig_name'
13956 sig_name_init='$sig_name_init'
13957 sig_num='$sig_num'
13958 sig_num_init='$sig_num_init'
13959 signal_t='$signal_t'
13960 sitearch='$sitearch'
13961 sitearchexp='$sitearchexp'
13962 sitelib='$sitelib'
13963 sitelibexp='$sitelibexp'
13964 siteprefix='$siteprefix'
13965 siteprefixexp='$siteprefixexp'
13966 sizetype='$sizetype'
13967 sleep='$sleep'
13968 smail='$smail'
13969 small='$small'
13970 so='$so'
13971 sockethdr='$sockethdr'
13972 socketlib='$socketlib'
13973 sort='$sort'
13974 spackage='$spackage'
13975 spitshell='$spitshell'
13976 split='$split'
13977 src='$src'
13978 ssizetype='$ssizetype'
13979 startperl='$startperl'
13980 startsh='$startsh'
13981 static_ext='$static_ext'
13982 stdchar='$stdchar'
13983 stdio_base='$stdio_base'
13984 stdio_bufsiz='$stdio_bufsiz'
13985 stdio_cnt='$stdio_cnt'
13986 stdio_filbuf='$stdio_filbuf'
13987 stdio_ptr='$stdio_ptr'
13988 stdio_stream_array='$stdio_stream_array'
13989 strings='$strings'
13990 submit='$submit'
13991 subversion='$subversion'
13992 sysman='$sysman'
13993 tail='$tail'
13994 tar='$tar'
13995 tbl='$tbl'
13996 tee='$tee'
13997 test='$test'
13998 timeincl='$timeincl'
13999 timetype='$timetype'
14000 touch='$touch'
14001 tr='$tr'
14002 trnl='$trnl'
14003 troff='$troff'
14004 uidtype='$uidtype'
14005 uname='$uname'
14006 uniq='$uniq'
14007 use64bits='$use64bits'
14008 usedl='$usedl'
14009 uselfs='$uselfs'
14010 uselongdouble='$uselongdouble'
14011 usemorebits='$usemorebits'
14012 usemultiplicity='$usemultiplicity'
14013 usemymalloc='$usemymalloc'
14014 usenm='$usenm'
14015 useopcode='$useopcode'
14016 useperlio='$useperlio'
14017 useposix='$useposix'
14018 usesfio='$usesfio'
14019 useshrplib='$useshrplib'
14020 usesocks='$usesocks'
14021 usethreads='$usethreads'
14022 usevendorprefix='$usevendorprefix'
14023 usevfork='$usevfork'
14024 usrinc='$usrinc'
14025 uuname='$uuname'
14026 vendorlib='$vendorlib'
14027 vendorlibexp='$vendorlibexp'
14028 vendorprefix='$vendorprefix'
14029 vendorprefixexp='$vendorprefixexp'
14030 version='$version'
14031 vi='$vi'
14032 voidflags='$voidflags'
14033 xlibpth='$xlibpth'
14034 zcat='$zcat'
14035 zip='$zip'
14036 EOT
14037
14038 : Add in command line options if available
14039 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14040
14041 : add special variables
14042 $test -f $src/patchlevel.h && \
14043 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14044 echo "CONFIGDOTSH=true" >>config.sh
14045
14046 : propagate old symbols
14047 if $test -f UU/config.sh; then
14048         <UU/config.sh sort | uniq >UU/oldconfig.sh
14049         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14050         sort | uniq -u >UU/oldsyms
14051         set X `cat UU/oldsyms`
14052         shift
14053         case $# in
14054         0) ;;
14055         *)
14056                 cat <<EOM
14057 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14058 EOM
14059                 echo "# Variables propagated from previous config.sh file." >>config.sh
14060                 for sym in `cat UU/oldsyms`; do
14061                         echo "    Propagating $hint variable "'$'"$sym..."
14062                         eval 'tmp="$'"${sym}"'"'
14063                         echo "$tmp" | \
14064                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14065                 done
14066                 ;;
14067         esac
14068 fi
14069
14070 : Finish up by extracting the .SH files
14071 case "$alldone" in
14072 exit)
14073         $rm -rf UU
14074         echo "Done."
14075         exit 0
14076         ;;
14077 cont)
14078         ;;
14079 '')
14080         dflt=''
14081         nostick=true
14082         $cat <<EOM
14083
14084 If you'd like to make any changes to the config.sh file before I begin
14085 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14086
14087 EOM
14088         rp="Press return or use a shell escape to edit config.sh:"
14089         . UU/myread
14090         nostick=''
14091         case "$ans" in
14092         '') ;;
14093         *) : in case they cannot read
14094                 sh 1>&4 -c "$ans";;
14095         esac
14096         ;;
14097 esac
14098
14099 : if this fails, just run all the .SH files by hand
14100 . ./config.sh
14101
14102 echo " "
14103 exec 1>&4
14104 . ./UU/extract
14105
14106 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14107         dflt=y
14108         case "$silent" in
14109         true) ;;
14110         *)
14111                 $cat <<EOM
14112
14113 Now you need to generate make dependencies by running "$make depend".
14114 You might prefer to run it in background: "$make depend > makedepend.out &"
14115 It can take a while, so you might not want to run it right now.
14116
14117 EOM
14118                 ;;
14119         esac
14120         rp="Run $make depend now?"
14121         . UU/myread
14122         case "$ans" in
14123         y*)
14124                 $make depend && echo "Now you must run a $make."
14125                 ;;
14126         *)
14127                 echo "You must run '$make depend' then '$make'."
14128                 ;;
14129         esac
14130 elif test -f [Mm]akefile; then
14131         echo " "
14132         echo "Now you must run a $make."
14133 else
14134         echo "Done."
14135 fi
14136
14137 if $test -f Policy.sh; then
14138     $cat <<EOM
14139
14140 If you compile $package on a different machine or from a different object
14141 directory, copy the Policy.sh file from this object directory to the
14142 new one before you run Configure -- this will help you with most of
14143 the policy defaults.
14144
14145 EOM
14146 fi
14147 if $test -f config.msg; then
14148     echo "Hmm.  I also noted the following information while running:"
14149     echo " "
14150     $cat config.msg >&4
14151     $rm -f config.msg
14152 fi
14153 $rm -f kit*isdone ark*isdone
14154 $rm -rf UU
14155
14156 : End of Configure
14157