Regen Configure.
[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 Tue Oct 26 13:10:37 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_getmnt=''
374 d_getmntent=''
375 d_getnbyaddr=''
376 d_getnbyname=''
377 d_getnent=''
378 d_getnetprotos=''
379 d_getpent=''
380 d_getpgid=''
381 d_getpgrp2=''
382 d_bsdgetpgrp=''
383 d_getpgrp=''
384 d_getppid=''
385 d_getprior=''
386 d_getpbyname=''
387 d_getpbynumber=''
388 d_getprotoprotos=''
389 d_getpwent=''
390 d_getsent=''
391 d_getservprotos=''
392 d_getspent=''
393 d_getspnam=''
394 d_getsbyname=''
395 d_getsbyport=''
396 d_gnulibc=''
397 d_hasmntopt=''
398 d_htonl=''
399 d_inetaton=''
400 d_isascii=''
401 d_killpg=''
402 d_lchown=''
403 d_ldbl_dig=''
404 d_link=''
405 d_locconv=''
406 d_lockf=''
407 d_longdbl=''
408 longdblsize=''
409 d_longlong=''
410 longlongsize=''
411 d_lstat=''
412 d_madvise=''
413 d_mblen=''
414 d_mbstowcs=''
415 d_mbtowc=''
416 d_memchr=''
417 d_memcmp=''
418 d_memcpy=''
419 d_memmove=''
420 d_memset=''
421 d_mkdir=''
422 d_mkfifo=''
423 d_mktime=''
424 d_mmap=''
425 mmaptype=''
426 d_mprotect=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_msync=''
433 d_munmap=''
434 d_nice=''
435 d_open3=''
436 d_fpathconf=''
437 d_pathconf=''
438 d_pause=''
439 d_pipe=''
440 d_poll=''
441 d_portable=''
442 d_old_pthread_create_joinable=''
443 old_pthread_create_joinable=''
444 d_pthread_yield=''
445 d_sched_yield=''
446 sched_yield=''
447 d_readdir=''
448 d_rewinddir=''
449 d_seekdir=''
450 d_telldir=''
451 d_readlink=''
452 d_readv=''
453 d_rename=''
454 d_rmdir=''
455 d_safebcpy=''
456 d_safemcpy=''
457 d_sanemcmp=''
458 d_select=''
459 d_sem=''
460 d_semctl=''
461 d_semget=''
462 d_semop=''
463 d_setegid=''
464 d_seteuid=''
465 d_setgrent=''
466 d_setgrps=''
467 d_sethent=''
468 d_setlinebuf=''
469 d_setlocale=''
470 d_setnent=''
471 d_setpent=''
472 d_setpgid=''
473 d_setpgrp2=''
474 d_bsdsetpgrp=''
475 d_setpgrp=''
476 d_setprior=''
477 d_setpwent=''
478 d_setregid=''
479 d_setresgid=''
480 d_setresuid=''
481 d_setreuid=''
482 d_setrgid=''
483 d_setruid=''
484 d_setsent=''
485 d_setsid=''
486 d_setspent=''
487 d_setvbuf=''
488 d_sfio=''
489 usesfio=''
490 d_shm=''
491 d_shmat=''
492 d_shmatprototype=''
493 shmattype=''
494 d_shmctl=''
495 d_shmdt=''
496 d_shmget=''
497 d_sigaction=''
498 d_sigsetjmp=''
499 d_cmsghdr_s=''
500 d_msg_ctrunc=''
501 d_msg_dontroute=''
502 d_msg_oob=''
503 d_msg_peek=''
504 d_msg_proxy=''
505 d_msghdr_s=''
506 d_oldsock=''
507 d_recvmsg=''
508 d_scm_rights=''
509 d_sendmsg=''
510 d_socket=''
511 d_sockpair=''
512 sockethdr=''
513 socketlib=''
514 d_sqrtl=''
515 d_statblks=''
516 d_fstatfs=''
517 d_statfs=''
518 d_statfsflags=''
519 d_fstatvfs=''
520 d_statvfs=''
521 d_stdio_cnt_lval=''
522 d_stdio_ptr_lval=''
523 d_stdiobase=''
524 d_stdstdio=''
525 stdio_base=''
526 stdio_bufsiz=''
527 stdio_cnt=''
528 stdio_filbuf=''
529 stdio_ptr=''
530 d_index=''
531 d_strchr=''
532 d_strcoll=''
533 d_strctcpy=''
534 d_strerrm=''
535 d_strerror=''
536 d_sysernlst=''
537 d_syserrlst=''
538 d_strtod=''
539 d_strtol=''
540 d_strtoul=''
541 d_strxfrm=''
542 d_symlink=''
543 d_syscall=''
544 d_sysconf=''
545 d_system=''
546 d_tcgetpgrp=''
547 d_tcsetpgrp=''
548 d_telldirproto=''
549 d_time=''
550 timetype=''
551 clocktype=''
552 d_times=''
553 d_truncate=''
554 d_tzname=''
555 d_umask=''
556 d_semctl_semid_ds=''
557 d_semctl_semun=''
558 d_union_semun=''
559 d_vfork=''
560 usevfork=''
561 d_voidsig=''
562 signal_t=''
563 d_volatile=''
564 d_charvspr=''
565 d_vprintf=''
566 d_wait4=''
567 d_waitpid=''
568 d_wcstombs=''
569 d_wctomb=''
570 d_writev=''
571 dlext=''
572 cccdlflags=''
573 ccdlflags=''
574 dlsrc=''
575 ld=''
576 lddlflags=''
577 usedl=''
578 doublesize=''
579 ebcdic=''
580 fflushNULL=''
581 fflushall=''
582 fpostype=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 d_int64t=''
604 i_inttypes=''
605 i_limits=''
606 i_locale=''
607 i_machcthr=''
608 i_malloc=''
609 i_math=''
610 i_memory=''
611 i_mntent=''
612 i_ndbm=''
613 i_netdb=''
614 i_neterrno=''
615 i_netinettcp=''
616 i_niin=''
617 i_sysin=''
618 i_poll=''
619 i_pthread=''
620 d_pwage=''
621 d_pwchange=''
622 d_pwclass=''
623 d_pwcomment=''
624 d_pwexpire=''
625 d_pwgecos=''
626 d_pwpasswd=''
627 d_pwquota=''
628 i_pwd=''
629 i_sfio=''
630 i_shadow=''
631 i_socks=''
632 i_stddef=''
633 i_stdlib=''
634 i_string=''
635 strings=''
636 i_sysaccess=''
637 i_sysdir=''
638 i_sysfile=''
639 d_voidtty=''
640 i_bsdioctl=''
641 i_sysfilio=''
642 i_sysioctl=''
643 i_syssockio=''
644 i_sysmman=''
645 i_sysmount=''
646 i_sysndir=''
647 i_sysparam=''
648 i_sysresrc=''
649 i_syssecrt=''
650 i_sysselct=''
651 i_sysstat=''
652 i_sysstatvfs=''
653 i_systimes=''
654 i_systypes=''
655 d_iovec_s=''
656 i_sysuio=''
657 i_sysun=''
658 i_syswait=''
659 i_sgtty=''
660 i_termio=''
661 i_termios=''
662 i_systime=''
663 i_systimek=''
664 i_time=''
665 timeincl=''
666 i_unistd=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 installprefix=''
674 installprefixexp=''
675 installstyle=''
676 installusrbinperl=''
677 intsize=''
678 longsize=''
679 shortsize=''
680 d_fpos64_t=''
681 d_llseek=''
682 d_off64_t=''
683 libc=''
684 ldlibpthname=''
685 libperl=''
686 shrpenv=''
687 useshrplib=''
688 glibpth=''
689 libpth=''
690 loclibpth=''
691 plibpth=''
692 xlibpth=''
693 ignore_versioned_solibs=''
694 libs=''
695 lns=''
696 d_PRIEldbl=''
697 d_PRIFldbl=''
698 d_PRIGldbl=''
699 d_PRIeldbl=''
700 d_PRIfldbl=''
701 d_PRIgldbl=''
702 sPRIEldbl=''
703 sPRIFldbl=''
704 sPRIGldbl=''
705 sPRIeldbl=''
706 sPRIfldbl=''
707 sPRIgldbl=''
708 lseeksize=''
709 lseektype=''
710 make_set_make=''
711 d_mymalloc=''
712 freetype=''
713 mallocobj=''
714 mallocsrc=''
715 malloctype=''
716 usemymalloc=''
717 installman1dir=''
718 man1dir=''
719 man1direxp=''
720 man1ext=''
721 installman3dir=''
722 man3dir=''
723 man3direxp=''
724 man3ext=''
725 huge=''
726 large=''
727 medium=''
728 models=''
729 small=''
730 split=''
731 modetype=''
732 multiarch=''
733 mydomain=''
734 myhostname=''
735 phostname=''
736 c=''
737 n=''
738 d_eofnblk=''
739 eagain=''
740 o_nonblock=''
741 rd_nodata=''
742 netdb_hlen_type=''
743 netdb_host_type=''
744 netdb_name_type=''
745 netdb_net_type=''
746 groupcat=''
747 hostcat=''
748 passcat=''
749 orderlib=''
750 ranlib=''
751 package=''
752 spackage=''
753 pager=''
754 apiversion=''
755 patchlevel=''
756 subversion=''
757 version=''
758 perladmin=''
759 perlpath=''
760 pidtype=''
761 prefix=''
762 prefixexp=''
763 installprivlib=''
764 privlib=''
765 privlibexp=''
766 prototype=''
767 ptrsize=''
768 d_PRIX64=''
769 d_PRId64=''
770 d_PRIi64=''
771 d_PRIo64=''
772 d_PRIu64=''
773 d_PRIx64=''
774 sPRIX64=''
775 sPRId64=''
776 sPRIi64=''
777 sPRIo64=''
778 sPRIu64=''
779 sPRIx64=''
780 drand01=''
781 randbits=''
782 randfunc=''
783 randseedtype=''
784 seedfunc=''
785 installscript=''
786 scriptdir=''
787 scriptdirexp=''
788 selectminbits=''
789 selecttype=''
790 sh=''
791 sig_count=''
792 sig_name=''
793 sig_name_init=''
794 sig_num=''
795 sig_num_init=''
796 installsitearch=''
797 sitearch=''
798 sitearchexp=''
799 installsitebin=''
800 sitebin=''
801 sitebinexp=''
802 installsitelib=''
803 sitelib=''
804 sitelibexp=''
805 siteprefix=''
806 siteprefixexp=''
807 sizetype=''
808 so=''
809 sharpbang=''
810 shsharp=''
811 spitshell=''
812 src=''
813 ssizetype=''
814 startperl=''
815 startsh=''
816 stdchar=''
817 d_stdio_stream_array=''
818 stdio_stream_array=''
819 d_strtoull=''
820 sysman=''
821 trnl=''
822 uidsign=''
823 uidtype=''
824 archname64=''
825 use64bits=''
826 uselargefiles=''
827 uselongdouble=''
828 usemorebits=''
829 usemultiplicity=''
830 nm_opt=''
831 nm_so_opt=''
832 runnm=''
833 usenm=''
834 useperlio=''
835 usesocks=''
836 d_oldpthreads=''
837 usethreads=''
838 incpath=''
839 mips=''
840 mips_type=''
841 usrinc=''
842 d_vendorbin=''
843 installvendorbin=''
844 vendorbin=''
845 vendorbinexp=''
846 d_vendorlib=''
847 installvendorlib=''
848 vendorlib=''
849 vendorlibexp=''
850 usevendorprefix=''
851 vendorprefix=''
852 vendorprefixexp=''
853 defvoidused=''
854 voidflags=''
855 pm_apiversion=''
856 xs_apiversion=''
857 CONFIG=''
858
859 define='define'
860 undef='undef'
861 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
862 rmlist=''
863
864 : We must find out about Eunice early
865 eunicefix=':'
866 if test -f /etc/unixtovms; then
867         eunicefix=/etc/unixtovms
868 fi
869 if test -f /etc/unixtovms.exe; then
870         eunicefix=/etc/unixtovms.exe
871 fi
872
873 i_whoami=''
874 : Possible local include directories to search.
875 : Set locincpth to "" in a hint file to defeat local include searches.
876 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
877 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
878 :
879 : no include file wanted by default
880 inclwanted=''
881
882 : list of known cpp symbols, sorted alphabetically
883 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
884 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
885 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
886 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
887 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
888 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
889 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
890 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
891 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
892 al="$al VMS Xenix286"
893 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
894 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
895 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
896 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
897 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
898 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
899 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
900 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
901 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
902 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
903 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
904 al="$al __SVR4_2__ __UMAXV__"
905 al="$al ____386BSD____ __alpha __alpha__ __amiga"
906 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
907 al="$al __host_mips__"
908 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
909 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
910 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
911 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
912 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
913 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
914 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
915 al="$al __mc88100 __mc88100__ __mips __mips__"
916 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
917 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
918 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
919 al="$al _host_mips _mips _unix"
920 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
921 al="$al apollo ardent att386 att3b"
922 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
923 al="$al cadmus clipper concurrent convex cray ctix"
924 al="$al dmert encore gcos gcx gimpel gould"
925 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
926 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
927 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
928 al="$al i186 i286 i386 i486 i8086"
929 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
930 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
931 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
932 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
933 al="$al mc88000 mc88100 merlin mert mips mvs n16"
934 al="$al ncl_el ncl_mr"
935 al="$al news1500 news1700 news1800 news1900 news3700"
936 al="$al news700 news800 news900 ns16000 ns32000"
937 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
938 al="$al parisc pc532 pdp11 plexus posix pyr"
939 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
940 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
941 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
942 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
943 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
944 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
945 al="$al xenix z8000"
946
947 : Trailing extension.  Override this in a hint file, if needed.
948 _exe=''
949 : Extra object files, if any, needed on this platform.
950 archobjs=''
951 groupstype=''
952 : change the next line if compiling for Xenix/286 on Xenix/386
953 xlibpth='/usr/lib/386 /lib/386'
954
955 : Possible local library directories to search.
956 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
957 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
958
959 : general looking path for locating libraries
960 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
961 glibpth="$glibpth /lib /usr/lib $xlibpth"
962 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
963 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
964
965 : Private path used by Configure to find libraries.  Its value
966 : is prepended to libpth. This variable takes care of special
967 : machines, like the mips.  Usually, it should be empty.
968 plibpth=''
969
970 : default library list
971 libswanted=''
972 : some systems want to use only the non-versioned libso:s
973 ignore_versioned_solibs=''
974 : full support for void wanted by default
975 defvoidused=15
976
977 : set useposix=false in your hint file to disable the POSIX extension.
978 useposix=true
979 : set useopcode=false in your hint file to disable the Opcode extension.
980 useopcode=true
981 : set usemultiplicity on the Configure command line to enable multiplicity.
982 : set usesocks on the Configure command line to enable socks.
983 : set usethreads on the Configure command line to enable threads.
984 : List of libraries we want.
985 : If anyone needs -lnet, put it in a hint file.
986 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
987 libswanted="$libswanted dld ld sun m c cposix posix"
988 libswanted="$libswanted ndir dir crypt sec"
989 libswanted="$libswanted ucb bsd BSD PW x"
990 : We probably want to search /usr/shlib before most other libraries.
991 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
992 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
993 glibpth="/usr/shlib $glibpth"
994 : Do not use vfork unless overridden by a hint file.
995 usevfork=false
996
997 : Find the basic shell for Bourne shell scripts
998 case "$sh" in
999 '')
1000         case "$SYSTYPE" in
1001         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1002         *) xxx='/bin/sh';;
1003         esac
1004         if test -f "$xxx"; then
1005                 sh="$xxx"
1006         else
1007                 : Build up a list and do a single loop so we can 'break' out.
1008                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1009                 for xxx in sh bash ksh pdksh ash; do
1010                         for p in $pth; do
1011                                 try="$try ${p}/${xxx}"
1012                         done
1013                 done
1014                 for xxx in $try; do
1015                         if test -f "$xxx"; then
1016                                 sh="$xxx";
1017                                 break
1018                         elif test -f "$xxx.exe"; then
1019                                 sh="$xxx";
1020                                 break
1021                         fi
1022                 done
1023         fi
1024         ;;
1025 esac
1026
1027 case "$sh" in
1028 '')     cat <<EOM >&2
1029 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1030
1031 Usually it's in /bin/sh.  How did you even get this far?
1032 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1033 we'll try to straighten this all out.
1034 EOM
1035         exit 1
1036         ;;
1037 esac
1038
1039 : see if sh knows # comments
1040 if `$sh -c '#' >/dev/null 2>&1`; then
1041         shsharp=true
1042         spitshell=cat
1043         xcat=/bin/cat
1044         test -f $xcat || xcat=/usr/bin/cat
1045         echo "#!$xcat" >try
1046         $eunicefix try
1047         chmod +x try
1048         ./try > today
1049         if test -s today; then
1050                 sharpbang='#!'
1051         else
1052                 echo "#! $xcat" > try
1053                 $eunicefix try
1054                 chmod +x try
1055                 ./try > today
1056                 if test -s today; then
1057                         sharpbang='#! '
1058                 else
1059                         sharpbang=': use '
1060                 fi
1061         fi
1062 else
1063         echo " "
1064         echo "Your $sh doesn't grok # comments--I will strip them later on."
1065         shsharp=false
1066         cd ..
1067         echo "exec grep -v '^[  ]*#'" >spitshell
1068         chmod +x spitshell
1069         $eunicefix spitshell
1070         spitshell=`pwd`/spitshell
1071         cd UU
1072         echo "I presume that if # doesn't work, #! won't work either!"
1073         sharpbang=': use '
1074 fi
1075 rm -f try today
1076
1077 : figure out how to guarantee sh startup
1078 case "$startsh" in
1079 '') startsh=${sharpbang}${sh} ;;
1080 *)
1081 esac
1082 cat >try <<EOSS
1083 $startsh
1084 set abc
1085 test "$?abc" != 1
1086 EOSS
1087
1088 chmod +x try
1089 $eunicefix try
1090 if ./try; then
1091         : echo "Yup, it does."
1092 else
1093         echo "Hmm... '$startsh' does not guarantee sh startup..."
1094         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1095 fi
1096 rm -f try
1097
1098
1099 : Save command line options in file UU/cmdline.opt for later use in
1100 : generating config.sh.
1101 cat > cmdline.opt <<EOSH
1102 # Configure command line arguments.
1103 config_arg0='$0'
1104 config_args='$*'
1105 config_argc=$#
1106 EOSH
1107 argn=1
1108 for arg in "$@"; do
1109         cat >>cmdline.opt <<EOSH
1110 config_arg$argn='$arg'
1111 EOSH
1112         argn=`expr $argn + 1`
1113 done
1114
1115 : produce awk script to parse command line options
1116 cat >options.awk <<'EOF'
1117 BEGIN {
1118         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1119
1120         len = length(optstr);
1121         for (i = 1; i <= len; i++) {
1122                 c = substr(optstr, i, 1);
1123                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1124                 if (a == ":") {
1125                         arg[c] = 1;
1126                         i++;
1127                 }
1128                 opt[c] = 1;
1129         }
1130 }
1131 {
1132         expect = 0;
1133         str = $0;
1134         if (substr(str, 1, 1) != "-") {
1135                 printf("'%s'\n", str);
1136                 next;
1137         }
1138         len = length($0);
1139         for (i = 2; i <= len; i++) {
1140                 c = substr(str, i, 1);
1141                 if (!opt[c]) {
1142                         printf("-%s\n", substr(str, i));
1143                         next;
1144                 }
1145                 printf("-%s\n", c);
1146                 if (arg[c]) {
1147                         if (i < len)
1148                                 printf("'%s'\n", substr(str, i + 1));
1149                         else
1150                                 expect = 1;
1151                         next;
1152                 }
1153         }
1154 }
1155 END {
1156         if (expect)
1157                 print "?";
1158 }
1159 EOF
1160
1161 : process the command line options
1162 set X `for arg in "$@"; do echo "X$arg"; done |
1163         sed -e s/X// | awk -f options.awk`
1164 eval "set $*"
1165 shift
1166 rm -f options.awk
1167
1168 : set up default values
1169 fastread=''
1170 reuseval=false
1171 config_sh=''
1172 alldone=''
1173 error=''
1174 silent=''
1175 extractsh=''
1176 override=''
1177 knowitall=''
1178 rm -f optdef.sh posthint.sh
1179 cat >optdef.sh <<EOS
1180 $startsh
1181 EOS
1182
1183
1184 : option parsing
1185 while test $# -gt 0; do
1186         case "$1" in
1187         -d) shift; fastread=yes;;
1188         -e) shift; alldone=cont;;
1189         -f)
1190                 shift
1191                 cd ..
1192                 if test -r "$1"; then
1193                         config_sh="$1"
1194                 else
1195                         echo "$me: cannot read config file $1." >&2
1196                         error=true
1197                 fi
1198                 cd UU
1199                 shift;;
1200         -h) shift; error=true;;
1201         -r) shift; reuseval=true;;
1202         -s) shift; silent=true; realsilent=true;;
1203         -E) shift; alldone=exit;;
1204         -K) shift; knowitall=true;;
1205         -O) shift; override=true;;
1206         -S) shift; silent=true; extractsh=true;;
1207         -D)
1208                 shift
1209                 case "$1" in
1210                 *=)
1211                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1212                         echo "$me: ignoring -D $1" >&2
1213                         ;;
1214                 *=*) echo "$1" | \
1215                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1216                 *) echo "$1='define'" >> optdef.sh;;
1217                 esac
1218                 shift
1219                 ;;
1220         -U)
1221                 shift
1222                 case "$1" in
1223                 *=) echo "$1" >> optdef.sh;;
1224                 *=*)
1225                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1226                         echo "$me: ignoring -U $1" >&2
1227                         ;;
1228                 *) echo "$1='undef'" >> optdef.sh;;
1229                 esac
1230                 shift
1231                 ;;
1232         -A)
1233             shift
1234             xxx=''
1235             yyy="$1"
1236             zzz=''
1237             uuu=undef
1238             case "$yyy" in
1239             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1240                  case "$zzz" in
1241                  *:*) zzz='' ;;
1242                  *)   xxx=append
1243                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1244                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1245                  esac
1246                  ;;
1247             esac
1248             case "$xxx" in
1249             '')  case "$yyy" in
1250                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1251                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1252                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1253                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1254                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1255                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1256                  esac
1257                  ;;       
1258             esac
1259             case "$xxx" in
1260             append)
1261                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1262             clear)
1263                 echo "$yyy=''"                  >> posthint.sh ;;
1264             define)
1265                 case "$zzz" in
1266                 '') zzz=define ;;
1267                 esac
1268                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1269             eval)
1270                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1271             prepend)
1272                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1273             undef)
1274                 case "$zzz" in
1275                 '') zzz="$uuu" ;;
1276                 esac
1277                 echo "$yyy=$zzz"                >> posthint.sh ;;
1278             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1279             esac
1280             ;;
1281         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1282             exit 0;;
1283         --) break;;
1284         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1285         *) break;;
1286         esac
1287 done
1288
1289 case "$error" in
1290 true)
1291         cat >&2 <<EOM
1292 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1293                  [-U symbol] [-U symbol=] [-A command:symbol...]
1294   -d : use defaults for all answers.
1295   -e : go on without questioning past the production of config.sh.
1296   -f : specify an alternate default configuration file.
1297   -h : print this help message and exit (with an error status).
1298   -r : reuse C symbols value if possible (skips costly nm extraction).
1299   -s : silent mode, only echoes questions and essential information.
1300   -D : define symbol to have some value:
1301          -D symbol         symbol gets the value 'define'
1302          -D symbol=value   symbol gets the value 'value'
1303   -E : stop at the end of questions, after having produced config.sh.
1304   -K : do not use unless you know what you are doing.
1305   -O : let -D and -U override definitions from loaded configuration file.
1306   -S : perform variable substitutions on all .SH files (can mix with -f)
1307   -U : undefine symbol:
1308          -U symbol    symbol gets the value 'undef'
1309          -U symbol=   symbol gets completely empty
1310   -A : manipulate symbol after the platform specific hints have been applied:
1311          -A symbol=value                append " "value to symbol
1312          -A append:symbol=value         append value to symbol
1313          -A define:symbol=value         define symbol to have value
1314          -A clear:symbol                define symbol to be ''
1315          -A define:symbol               define symbol to be 'define'
1316          -A eval:symbol=value           define symbol to be eval of value
1317          -A prepend:symbol=value        prepend value to symbol
1318          -A undef:symbol                define symbol to be 'undef'
1319          -A undef:symbol=               define symbol to be ''
1320   -V : print version number and exit (with a zero status).
1321 EOM
1322         exit 1
1323         ;;
1324 esac
1325
1326 : Sanity checks
1327 case "$fastread$alldone" in
1328 yescont|yesexit) ;;
1329 *)
1330         if test ! -t 0; then
1331                 echo "Say 'sh Configure', not 'sh <Configure'"
1332                 exit 1
1333         fi
1334         ;;
1335 esac
1336
1337 exec 4>&1
1338 case "$silent" in
1339 true) exec 1>/dev/null;;
1340 esac
1341
1342 : run the defines and the undefines, if any, but leave the file out there...
1343 touch optdef.sh
1344 . ./optdef.sh
1345 : create the posthint manipulation script and leave the file out there...
1346 touch posthint.sh
1347
1348 : set package name
1349 package=perl5
1350 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1351 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1352 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1353 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1354 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1355 esac
1356
1357 : Some greps do not return status, grrr.
1358 echo "grimblepritz" >grimble
1359 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1360         contains=contains
1361 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1362         contains=grep
1363 else
1364         contains=contains
1365 fi
1366 rm -f grimble
1367 : the following should work in any shell
1368 case "$contains" in
1369 contains*)
1370         echo " "
1371         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1372         cat >contains <<'EOSS'
1373 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1374 EOSS
1375 chmod +x contains
1376 esac
1377
1378 : Find the path to the source tree
1379 case "$src" in
1380 '') case "$0" in
1381     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1382          case "$src" in
1383          /*)    ;;
1384          *)     src=`cd ../$src && pwd` ;;
1385          esac
1386          ;;
1387     *)   src='.';;
1388     esac;;
1389 esac
1390 case "$src" in
1391 '')     src=/
1392         rsrc=/
1393         ;;
1394 /*) rsrc="$src";;
1395 *) rsrc="../$src";;
1396 esac
1397 if test -f $rsrc/Configure && \
1398         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1399 then
1400    : found it, so we are ok.
1401 else
1402         rsrc=''
1403         for src in . .. ../.. ../../.. ../../../..; do
1404                 if test -f ../$src/Configure && \
1405                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1406                 then
1407                         rsrc=../$src
1408                         break
1409                 fi
1410         done
1411 fi
1412 case "$rsrc" in
1413 '')
1414         cat <<EOM >&4
1415
1416 Sorry, I can't seem to locate the source dir for $package.  Please start
1417 Configure with an explicit path -- i.e. /some/path/Configure.
1418
1419 EOM
1420         exit 1
1421         ;;
1422 ../.)   rsrc='..';;
1423 *)
1424         echo " "
1425         echo "Sources for $package found in \"$src\"." >&4
1426         ;;
1427 esac
1428
1429 : script used to extract .SH files with variable substitutions
1430 cat >extract <<'EOS'
1431 CONFIGDOTSH=true
1432 echo "Doing variable substitutions on .SH files..."
1433 if test -f $src/MANIFEST; then
1434         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1435 else
1436         echo "(Looking for .SH files under the source directory.)"
1437         set x `(cd $src; find . -name "*.SH" -print)`
1438 fi
1439 shift
1440 case $# in
1441 0) set x `(cd $src; echo *.SH)`; shift;;
1442 esac
1443 if test ! -f $src/$1; then
1444         shift
1445 fi
1446 mkdir_p='
1447 name=$1;
1448 create="";
1449 while test $name; do
1450         if test ! -d "$name"; then
1451                 create="$name $create";
1452                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1453                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1454         else
1455                 name="";
1456         fi;
1457 done;
1458 for file in $create; do
1459         mkdir $file;
1460 done
1461 '
1462 for file in $*; do
1463         case "$src" in
1464         ".")
1465                 case "$file" in
1466                 */*)
1467                         dir=`expr X$file : 'X\(.*\)/'`
1468                         file=`expr X$file : 'X.*/\(.*\)'`
1469                         (cd $dir && . ./$file)
1470                         ;;
1471                 *)
1472                         . ./$file
1473                         ;;
1474                 esac
1475                 ;;
1476         *)
1477                 case "$file" in
1478                 */*)
1479                         dir=`expr X$file : 'X\(.*\)/'`
1480                         file=`expr X$file : 'X.*/\(.*\)'`
1481                         (set x $dir; shift; eval $mkdir_p)
1482                         sh <$src/$dir/$file
1483                         ;;
1484                 *)
1485                         sh <$src/$file
1486                         ;;
1487                 esac
1488                 ;;
1489         esac
1490 done
1491 if test -f $src/config_h.SH; then
1492         if test ! -f config.h; then
1493         : oops, they left it out of MANIFEST, probably, so do it anyway.
1494         . $src/config_h.SH
1495         fi
1496 fi
1497 EOS
1498
1499 : extract files and exit if asked to do so
1500 case "$extractsh" in
1501 true)
1502         case "$realsilent" in
1503         true) ;;
1504         *) exec 1>&4;;
1505         esac
1506         case "$config_sh" in
1507         '') config_sh='config.sh';;
1508         esac
1509         echo " "
1510         echo "Fetching answers from $config_sh..."
1511         cd ..
1512         . $config_sh
1513         test "$override" && . ./optdef.sh
1514         echo " "
1515         . UU/extract
1516         rm -rf UU
1517         echo "Done."
1518         exit 0
1519         ;;
1520 esac
1521
1522 : Eunice requires " " instead of "", can you believe it
1523 echo " "
1524 : Here we go...
1525 echo "Beginning of configuration questions for $package."
1526
1527 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1528
1529 : first determine how to suppress newline on echo command
1530 echo " "
1531 echo "Checking echo to see how to suppress newlines..."
1532 (echo "hi there\c" ; echo " ") >.echotmp
1533 if $contains c .echotmp >/dev/null 2>&1 ; then
1534         echo "...using -n."
1535         n='-n'
1536         c=''
1537 else
1538         cat <<'EOM'
1539 ...using \c
1540 EOM
1541         n=''
1542         c='\c'
1543 fi
1544 echo $n "The star should be here-->$c"
1545 echo '*'
1546 rm -f .echotmp
1547
1548 : Now test for existence of everything in MANIFEST
1549 echo " "
1550 if test -f $rsrc/MANIFEST; then
1551         echo "First let's make sure your kit is complete.  Checking..." >&4
1552         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1553         rm -f missing
1554         tmppwd=`pwd`
1555         for filelist in x??; do
1556                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1557         done
1558         if test -s missing; then
1559                 cat missing >&4
1560                 cat >&4 <<'EOM'
1561
1562 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1563
1564 You have the option of continuing the configuration process, despite the
1565 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1566 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1567 and contact the author (perlbug@perl.com).
1568
1569 EOM
1570                 echo $n "Continue? [n] $c" >&4
1571                 read ans
1572                 case "$ans" in
1573                 y*)
1574                         echo "Continuing..." >&4
1575                         rm -f missing
1576                         ;;
1577                 *)
1578                         echo "ABORTING..." >&4
1579                         kill $$
1580                         ;;
1581                 esac
1582         else
1583                 echo "Looks good..."
1584         fi
1585 else
1586         echo "There is no MANIFEST file.  I hope your kit is complete !"
1587 fi
1588 rm -f missing x??
1589
1590 echo " "
1591 : Find the appropriate value for a newline for tr
1592 if test -n "$DJGPP"; then
1593        trnl='\012'
1594 fi
1595 if test X"$trnl" = X; then
1596         case "`echo foo|tr '\n' x 2>/dev/null`" in
1597         foox) trnl='\n' ;;
1598         esac
1599 fi
1600 if test X"$trnl" = X; then
1601         case "`echo foo|tr '\012' x 2>/dev/null`" in
1602         foox) trnl='\012' ;;
1603         esac
1604 fi
1605 if test X"$trnl" = X; then
1606         cat <<EOM >&2
1607
1608 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1609
1610 EOM
1611         exit 1
1612 fi
1613
1614 : compute the number of columns on the terminal for proper question formatting
1615 case "$COLUMNS" in
1616 '') COLUMNS='80';;
1617 esac
1618
1619 : set up the echo used in my read
1620 myecho="case \"\$xxxm\" in
1621 '') echo $n \"\$rp $c\" >&4;;
1622 *) case \"\$rp\" in
1623         '') echo $n \"[\$xxxm] $c\";;
1624         *)
1625                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1626                         echo \"\$rp\" >&4
1627                         echo $n \"[\$xxxm] $c\" >&4
1628                 else
1629                         echo $n \"\$rp [\$xxxm] $c\" >&4
1630                 fi
1631                 ;;
1632         esac;;
1633 esac"
1634
1635 : now set up to do reads with possible shell escape and default assignment
1636 cat <<EOSC >myread
1637 $startsh
1638 xxxm=\$dflt
1639 $myecho
1640 ans='!'
1641 case "\$fastread" in
1642 yes) case "\$dflt" in
1643         '') ;;
1644         *) ans='';
1645                 case "\$silent-\$rp" in
1646                 true-) ;;
1647                 *) echo " " >&4;;
1648                 esac;;
1649         esac;;
1650 *) case "\$silent" in
1651         true) case "\$rp" in
1652                 '') ans='';;
1653                 esac;;
1654         esac;;
1655 esac
1656 while expr "X\$ans" : "X!" >/dev/null; do
1657         read answ
1658         set x \$xxxm
1659         shift
1660         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1661         case  "\$answ" in
1662         "!")
1663                 sh 1>&4
1664                 echo " "
1665                 $myecho
1666                 ;;
1667         !*)
1668                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1669                 shift
1670                 sh 1>&4 -c "\$*"
1671                 echo " "
1672                 $myecho
1673                 ;;
1674         "\$ans")
1675                 case "\$ans" in
1676                 \\&*)
1677                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1678                         shift
1679                         case "\$1" in
1680                         -d)
1681                                 fastread=yes
1682                                 echo "(OK, I'll run with -d after this question.)" >&4
1683                                 ;;
1684                         -*)
1685                                 echo "*** Sorry, \$1 not supported yet." >&4
1686                                 ;;
1687                         esac
1688                         $myecho
1689                         ans=!
1690                         ;;
1691                 esac;;
1692         *)
1693                 case "\$aok" in
1694                 y)
1695                         echo "*** Substitution done -- please confirm."
1696                         xxxm="\$ans"
1697                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1698                         xxxm="\$ans"
1699                         ans=!
1700                         ;;
1701                 *)
1702                         echo "*** Error -- try again."
1703                         ans=!
1704                         ;;
1705                 esac
1706                 $myecho
1707                 ;;
1708         esac
1709         case "\$ans\$xxxm\$nostick" in
1710         '')
1711                 ans=!
1712                 $myecho
1713                 ;;
1714         esac
1715 done
1716 case "\$ans" in
1717 '') ans="\$xxxm";;
1718 esac
1719 EOSC
1720
1721 : create .config dir to save info across Configure sessions
1722 test -d ../.config || mkdir ../.config
1723 cat >../.config/README <<EOF
1724 This directory created by Configure to save information that should
1725 persist across sessions for $package.
1726
1727 You may safely delete it if you wish.
1728 EOF
1729
1730 : general instructions
1731 needman=true
1732 firsttime=true
1733 user=`(logname) 2>/dev/null`
1734 case "$user" in
1735 '') user=`whoami 2>&1`;;
1736 esac
1737 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1738         firsttime=false
1739         echo " "
1740         rp='Would you like to see the instructions?'
1741         dflt=n
1742         . ./myread
1743         case "$ans" in
1744         [yY]*) ;;
1745         *) needman=false;;
1746         esac
1747 fi
1748 if $needman; then
1749         cat <<EOH
1750
1751 This installation shell script will examine your system and ask you questions
1752 to determine how the perl5 package should be installed. If you get
1753 stuck on a question, you may use a ! shell escape to start a subshell or
1754 execute a command.  Many of the questions will have default answers in square
1755 brackets; typing carriage return will give you the default.
1756
1757 On some of the questions which ask for file or directory names you are allowed
1758 to use the ~name construct to specify the login directory belonging to "name",
1759 even if you don't have a shell which knows about that.  Questions where this is
1760 allowed will be marked "(~name ok)".
1761
1762 EOH
1763         rp=''
1764         dflt='Type carriage return to continue'
1765         . ./myread
1766         cat <<'EOH'
1767
1768 The prompter used in this script allows you to use shell variables and
1769 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1770 in the default answer, as if the default line was a set of arguments given to a
1771 script shell.  This means you may also use $* to repeat the whole default line,
1772 so you do not have to re-type everything to add something to the default.
1773
1774 Everytime there is a substitution, you will have to confirm.  If there is an
1775 error (e.g. an unmatched backtick), the default answer will remain unchanged
1776 and you will be prompted again.
1777
1778 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1779 the questions and use the computed defaults (or the previous answers if there
1780 was already a config.sh file). Type 'Configure -h' for a list of options.
1781 You may also start interactively and then answer '& -d' at any prompt to turn
1782 on the non-interactive behaviour for the remainder of the execution.
1783
1784 EOH
1785         . ./myread
1786         cat <<EOH
1787
1788 Much effort has been expended to ensure that this shell script will run on any
1789 Unix system.  If despite that it blows up on yours, your best bet is to edit
1790 Configure and run it again.  If you can't run Configure for some reason,
1791 you'll have to generate a config.sh file by hand.  Whatever problems you
1792 have, let me (perlbug@perl.com) know how I blew it.
1793
1794 This installation script affects things in two ways:
1795
1796 1) it may do direct variable substitutions on some of the files included
1797    in this kit.
1798 2) it builds a config.h file for inclusion in C programs.  You may edit
1799    any of these files as the need arises after running this script.
1800
1801 If you make a mistake on a question, there is no easy way to back up to it
1802 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1803 files.  Configure will offer to let you do this before it runs the SH files.
1804
1805 EOH
1806         dflt='Type carriage return to continue'
1807         . ./myread
1808         case "$firsttime" in
1809         true) echo $user >>../.config/instruct;;
1810         esac
1811 fi
1812
1813 : find out where common programs are
1814 echo " "
1815 echo "Locating common programs..." >&4
1816 cat <<EOSC >loc
1817 $startsh
1818 case \$# in
1819 0) exit 1;;
1820 esac
1821 thing=\$1
1822 shift
1823 dflt=\$1
1824 shift
1825 for dir in \$*; do
1826         case "\$thing" in
1827         .)
1828         if test -d \$dir/\$thing; then
1829                 echo \$dir
1830                 exit 0
1831         fi
1832         ;;
1833         *)
1834         for thisthing in \$dir/\$thing; do
1835                 : just loop through to pick last item
1836         done
1837         if test -f \$thisthing; then
1838                 echo \$thisthing
1839                 exit 0
1840         elif test -f \$dir/\$thing.exe; then
1841                 if test -n "$DJGPP"; then
1842                         echo \$dir/\$thing.exe
1843                 else
1844                         : on Eunice apparently
1845                         echo \$dir/\$thing
1846                 fi
1847                 exit 0
1848         fi
1849         ;;
1850         esac
1851 done
1852 echo \$dflt
1853 exit 1
1854 EOSC
1855 chmod +x loc
1856 $eunicefix loc
1857 loclist="
1858 awk
1859 cat
1860 comm
1861 cp
1862 echo
1863 expr
1864 grep
1865 ls
1866 make
1867 mkdir
1868 rm
1869 sed
1870 sort
1871 touch
1872 tr
1873 uniq
1874 "
1875 trylist="
1876 Mcc
1877 ar
1878 byacc
1879 cpp
1880 csh
1881 date
1882 egrep
1883 gzip
1884 less
1885 ln
1886 more
1887 nm
1888 nroff
1889 pg
1890 test
1891 uname
1892 zip
1893 "
1894 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1895 pth="$pth /lib /usr/lib"
1896 for file in $loclist; do
1897         eval xxx=\$$file
1898         case "$xxx" in
1899         /*|?:[\\/]*)
1900                 if test -f "$xxx"; then
1901                         : ok
1902                 else
1903                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1904                         xxx=`./loc $file $file $pth`
1905                 fi
1906                 ;;
1907         '') xxx=`./loc $file $file $pth`;;
1908         *) xxx=`./loc $xxx $xxx $pth`;;
1909         esac
1910         eval $file=$xxx
1911         eval _$file=$xxx
1912         case "$xxx" in
1913         /*)
1914                 echo $file is in $xxx.
1915                 ;;
1916         ?:[\\/]*)
1917                 echo $file is in $xxx.
1918                 ;;
1919         *)
1920                 echo "I don't know where '$file' is, and my life depends on it." >&4
1921                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1922                 exit 1
1923                 ;;
1924         esac
1925 done
1926 echo " "
1927 echo "Don't worry if any of the following aren't found..."
1928 say=offhand
1929 for file in $trylist; do
1930         eval xxx=\$$file
1931         case "$xxx" in
1932         /*|?:[\\/]*)
1933                 if test -f "$xxx"; then
1934                         : ok
1935                 else
1936                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1937                         xxx=`./loc $file $file $pth`
1938                 fi
1939                 ;;
1940         '') xxx=`./loc $file $file $pth`;;
1941         *) xxx=`./loc $xxx $xxx $pth`;;
1942         esac
1943         eval $file=$xxx
1944         eval _$file=$xxx
1945         case "$xxx" in
1946         /*)
1947                 echo $file is in $xxx.
1948                 ;;
1949         ?:[\\/]*)
1950                 echo $file is in $xxx.
1951                 ;;
1952         *)
1953                 echo "I don't see $file out there, $say."
1954                 say=either
1955                 ;;
1956         esac
1957 done
1958 case "$egrep" in
1959 egrep)
1960         echo "Substituting grep for egrep."
1961         egrep=$grep
1962         ;;
1963 esac
1964 case "$ln" in
1965 ln)
1966         echo "Substituting cp for ln."
1967         ln=$cp
1968         ;;
1969 esac
1970 case "$test" in
1971 test)
1972         echo "Hopefully test is built into your sh."
1973         ;;
1974 *)
1975         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1976                 echo "Using the test built into your sh."
1977                 test=test
1978                 _test=test
1979         fi
1980         ;;
1981 esac
1982 case "$echo" in
1983 echo)
1984         echo "Hopefully echo is built into your sh."
1985         ;;
1986 '') ;;
1987 *)
1988         echo " "
1989 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1990         $echo $n "hi there$c" >foo1
1991         echo $n "hi there$c" >foo2
1992         if cmp foo1 foo2 >/dev/null 2>&1; then
1993                 echo "They are compatible.  In fact, they may be identical."
1994         else
1995                 case "$n" in
1996                 '-n') n='' c='\c';;
1997                 *) n='-n' c='';;
1998                 esac
1999                 cat <<FOO
2000 They are not compatible!  You are probably running ksh on a non-USG system.
2001 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2002 have echo built in and we may have to run some Bourne shell scripts.  That
2003 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2004
2005 FOO
2006                 $echo $n "The star should be here-->$c"
2007                 $echo "*"
2008         fi
2009         $rm -f foo1 foo2
2010         ;;
2011 esac
2012
2013 : determine whether symbolic links are supported
2014 echo " "
2015 $touch blurfl
2016 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2017         echo "Symbolic links are supported." >&4
2018         lns="$ln -s"
2019 else
2020         echo "Symbolic links are NOT supported." >&4
2021         lns="$ln"
2022 fi
2023 $rm -f blurfl sym
2024
2025 : see whether [:lower:] and [:upper:] are supported character classes
2026 echo " "
2027 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2028 ABYZ)
2029         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2030         up='[:upper:]'
2031         low='[:lower:]'
2032         ;;
2033 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2034         # (0xc9 and 0xd1), therefore that is a nice testing point.
2035         if test "X$up" = X -o "X$low" = X; then
2036             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2037             ij) up='[A-Z]'
2038                 low='[a-z]'
2039                 ;;
2040             esac
2041         fi
2042         if test "X$up" = X -o "X$low" = X; then
2043             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2044             ij) up='A-Z'
2045                 low='a-z'
2046                 ;;
2047             esac
2048         fi
2049         if test "X$up" = X -o "X$low" = X; then
2050             case "`echo IJ | od -x 2>/dev/null`" in
2051             *C9D1*|*c9d1*)
2052                 echo "Hey, this might be EBCDIC." >&4
2053                 if test "X$up" = X -o "X$low" = X; then
2054                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2055                     ij) up='[A-IJ-RS-Z]'
2056                         low='[a-ij-rs-z]'
2057                         ;;
2058                     esac
2059                 fi
2060                 if test "X$up" = X -o "X$low" = X; then
2061                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2062                     ij) up='A-IJ-RS-Z'
2063                         low='a-ij-rs-z'
2064                         ;;
2065                     esac
2066                 fi
2067                 ;;
2068             esac
2069         fi
2070 esac
2071 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2072 ij)
2073     echo "Using $up and $low to convert case." >&4
2074     ;;
2075 *)
2076     echo "I don't know how to translate letters from upper to lower case." >&4
2077     echo "Your tr is not acting any way I know of." >&4
2078     exit 1
2079     ;;
2080 esac
2081 : set up the translation script tr, must be called with ./tr of course
2082 cat >tr <<EOSC
2083 $startsh
2084 case "\$1\$2" in
2085 '[A-Z][a-z]') exec $tr '$up' '$low';;
2086 '[a-z][A-Z]') exec $tr '$low' '$up';;
2087 esac
2088 exec $tr "\$@"
2089 EOSC
2090 chmod +x tr
2091 $eunicefix tr
2092
2093 : Try to determine whether config.sh was made on this system
2094 case "$config_sh" in
2095 '')
2096 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2097 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2098 # because the A-Z/a-z are not consecutive.
2099 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2100         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2101 newmyuname="$myuname"
2102 dflt=n
2103 case "$knowitall" in
2104 '')
2105         if test -f ../config.sh; then
2106                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2107                         eval "`grep myuname= ../config.sh`"
2108                 fi
2109                 if test "X$myuname" = "X$newmyuname"; then
2110                         dflt=y
2111                 fi
2112         fi
2113         ;;
2114 *) dflt=y;;
2115 esac
2116
2117 : Get old answers from old config file if Configure was run on the
2118 : same system, otherwise use the hints.
2119 hint=default
2120 cd ..
2121 if test -f config.sh; then
2122         echo " "
2123         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2124         . UU/myread
2125         case "$ans" in
2126         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2127         *)  echo "Fetching default answers from your old config.sh file..." >&4
2128                 tmp_n="$n"
2129                 tmp_c="$c"
2130                 tmp_sh="$sh"
2131                 . ./config.sh
2132                 cp config.sh UU
2133                 n="$tmp_n"
2134                 c="$tmp_c"
2135                 : Older versions did not always set $sh.  Catch re-use of such
2136                 : an old config.sh.
2137                 case "$sh" in
2138                 '') sh="$tmp_sh" ;;
2139                 esac
2140                 hint=previous
2141                 ;;
2142         esac
2143 fi
2144 if test ! -f config.sh; then
2145         $cat <<EOM
2146
2147 First time through, eh?  I have some defaults handy for some systems
2148 that need some extra help getting the Configure answers right:
2149
2150 EOM
2151         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2152         dflt=''
2153         : Half the following guesses are probably wrong... If you have better
2154         : tests or hints, please send them to perlbug@perl.com
2155         : The metaconfig authors would also appreciate a copy...
2156         $test -f /irix && osname=irix
2157         $test -f /xenix && osname=sco_xenix
2158         $test -f /dynix && osname=dynix
2159         $test -f /dnix && osname=dnix
2160         $test -f /lynx.os && osname=lynxos
2161         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2162         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2163         $test -f /bin/mips && /bin/mips && osname=mips
2164         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2165                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2166         $test -d /usr/apollo/bin && osname=apollo
2167         $test -f /etc/saf/_sactab && osname=svr4
2168         $test -d /usr/include/minix && osname=minix
2169         if $test -d /MachTen -o -d /MachTen_Folder; then
2170                 osname=machten
2171                 if $test -x /sbin/version; then
2172                         osvers=`/sbin/version | $awk '{print $2}' |
2173                         $sed -e 's/[A-Za-z]$//'`
2174                 elif $test -x /usr/etc/version; then
2175                         osvers=`/usr/etc/version | $awk '{print $2}' |
2176                         $sed -e 's/[A-Za-z]$//'`
2177                 else
2178                         osvers="$2.$3"
2179                 fi
2180         fi
2181        $test -f /sys/posix.dll &&
2182                $test -f /usr/bin/what &&
2183                set X `/usr/bin/what /sys/posix.dll` &&
2184                $test "$3" = UWIN &&
2185                osname=uwin &&
2186                osvers="$5"
2187         if $test -f $uname; then
2188                 set X $myuname
2189                 shift
2190
2191                 case "$5" in
2192                 fps*) osname=fps ;;
2193                 mips*)
2194                         case "$4" in
2195                         umips) osname=umips ;;
2196                         *) osname=mips ;;
2197                         esac;;
2198                 [23]100) osname=mips ;;
2199                 next*) osname=next ;;
2200                 i386*)
2201                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2202                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2203                                 osname='sco'
2204                                 osvers=$tmp
2205                         elif $test -f /etc/kconfig; then
2206                                 osname=isc
2207                                 if test "$lns" = "$ln -s"; then
2208                                         osvers=4
2209                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2210                                         osvers=3
2211                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2212                                         osvers=2
2213                                 fi
2214                         fi
2215                         tmp=''
2216                         ;;
2217                 pc*)
2218                         if test -n "$DJGPP"; then
2219                                 osname=dos
2220                                 osvers=djgpp
2221                         fi
2222                         ;;
2223                 esac
2224
2225                 case "$1" in
2226                 aix) osname=aix
2227                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2228                         case "$tmp" in
2229                         'not found') osvers="$4"."$3" ;;
2230                         '<3240'|'<>3240') osvers=3.2.0 ;;
2231                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2232                         '=3250'|'>3250') osvers=3.2.5 ;;
2233                         *) osvers=$tmp;;
2234                         esac
2235                         ;;
2236                 *dc.osx) osname=dcosx
2237                         osvers="$3"
2238                         ;;
2239                 dnix) osname=dnix
2240                         osvers="$3"
2241                         ;;
2242                 domainos) osname=apollo
2243                         osvers="$3"
2244                         ;;
2245                 dgux) osname=dgux 
2246                         osvers="$3"
2247                         ;;
2248                 dynixptx*) osname=dynixptx
2249                         osvers=`echo "$4"|sed 's/^v//'`
2250                         ;;
2251                 freebsd) osname=freebsd 
2252                         osvers="$3" ;;
2253                 genix) osname=genix ;;
2254                 hp*) osname=hpux 
2255                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2256                         ;;
2257                 irix*) osname=irix
2258                         case "$3" in
2259                         4*) osvers=4 ;;
2260                         5*) osvers=5 ;;
2261                         *)      osvers="$3" ;;
2262                         esac
2263                         ;;
2264                 linux) osname=linux
2265                         case "$3" in
2266                         *)      osvers="$3" ;;
2267                         esac
2268                         ;;
2269                 MiNT) osname=mint
2270                         ;;
2271                 netbsd*) osname=netbsd
2272                         osvers="$3"
2273                         ;;
2274                 news-os) osvers="$3"
2275                         case "$3" in
2276                         4*) osname=newsos4 ;;
2277                         *) osname=newsos ;;
2278                         esac
2279                         ;;
2280                 bsd386) osname=bsd386
2281                         osvers=`$uname -r`
2282                         ;;
2283                 POSIX-BC | posix-bc ) osname=posix-bc
2284                         osvers="$3"
2285                         ;;
2286                 powerux | power_ux | powermax_os | powermaxos | \
2287                 powerunix | power_unix) osname=powerux
2288                         osvers="$3"
2289                         ;;
2290                 next*) osname=next ;;
2291                 solaris) osname=solaris
2292                         case "$3" in
2293                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2294                         *)      osvers="$3" ;;
2295                         esac
2296                         ;;
2297                 sunos) osname=sunos
2298                         case "$3" in
2299                         5*) osname=solaris
2300                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2301                         *)      osvers="$3" ;;
2302                         esac
2303                         ;;
2304                 titanos) osname=titanos
2305                         case "$3" in
2306                         1*) osvers=1 ;;
2307                         2*) osvers=2 ;;
2308                         3*) osvers=3 ;;
2309                         4*) osvers=4 ;;
2310                         *)      osvers="$3" ;;
2311                         esac
2312                         ;;
2313                 ultrix) osname=ultrix
2314                         osvers="$3"
2315                         ;;
2316                 osf1|mls+)      case "$5" in
2317                                 alpha)
2318                                         osname=dec_osf
2319                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2320                                         ;;
2321                         hp*)    osname=hp_osf1  ;;
2322                         mips)   osname=mips_osf1 ;;
2323                         esac
2324                         ;;
2325                 unixware) osname=svr5
2326                         osvers="$4"
2327                         ;;
2328                 uts) osname=uts
2329                         osvers="$3"
2330                         ;;
2331                 qnx) osname=qnx
2332                         osvers="$4"
2333                         ;;
2334                 $2) case "$osname" in
2335                         *isc*) ;;
2336                         *freebsd*) ;;
2337                         svr*)
2338                                 : svr4.x or possibly later
2339                                 case "svr$3" in 
2340                                 ${osname}*)
2341                                         osname=svr$3
2342                                         osvers=$4
2343                                         ;;
2344                                 esac
2345                                 case "$osname" in
2346                                 svr4.0)
2347                                         : Check for ESIX
2348                                         if test -f /stand/boot ; then
2349                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2350                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2351                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2352                                                         if test -n "$isesix"; then
2353                                                                 osname=esix4
2354                                                         fi
2355                                                 fi
2356                                         fi
2357                                         ;;
2358                                 esac
2359                                 ;;
2360                         *)      if test -f /etc/systemid; then
2361                                         osname=sco
2362                                         set `echo $3 | $sed 's/\./ /g'` $4
2363                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2364                                                 osvers=$1.$2.$3
2365                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2366                                                 osvers=$1.$2
2367                                         elif $test -f $src/hints/sco_$1.sh; then
2368                                                 osvers=$1
2369                                         fi
2370                                 else
2371                                         case "$osname" in
2372                                         '') : Still unknown.  Probably a generic Sys V.
2373                                                 osname="sysv"
2374                                                 osvers="$3"
2375                                                 ;;
2376                                         esac
2377                                 fi
2378                                 ;;
2379                         esac
2380                         ;;
2381                 *)      case "$osname" in
2382                         '') : Still unknown.  Probably a generic BSD.
2383                                 osname="$1"
2384                                 osvers="$3"
2385                                 ;;
2386                         esac
2387                         ;;
2388                 esac
2389         else
2390                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2391                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2392                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2393                                 osname=news_os
2394                         fi
2395                         $rm -f UU/kernel.what
2396                 elif test -d c:/.; then
2397                         set X $myuname
2398                         osname=os2
2399                         osvers="$5"
2400                 fi
2401         fi
2402         
2403         : Now look for a hint file osname_osvers, unless one has been
2404         : specified already.
2405         case "$hintfile" in
2406         ''|' ')
2407                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2408                 : Also try without trailing minor version numbers.
2409                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2410                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2411                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2412                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2413                 case "$file" in
2414                 '') dflt=none ;;
2415                 *)  case "$osvers" in
2416                         '') dflt=$file
2417                                 ;;
2418                         *)  if $test -f $src/hints/$file.sh ; then
2419                                         dflt=$file
2420                                 elif $test -f $src/hints/$xfile.sh ; then
2421                                         dflt=$xfile
2422                                 elif $test -f $src/hints/$xxfile.sh ; then
2423                                         dflt=$xxfile
2424                                 elif $test -f $src/hints/$xxxfile.sh ; then
2425                                         dflt=$xxxfile
2426                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2427                                         dflt=$xxxxfile
2428                                 elif $test -f "$src/hints/${osname}.sh" ; then
2429                                         dflt="${osname}"
2430                                 else
2431                                         dflt=none
2432                                 fi
2433                                 ;;
2434                         esac
2435                         ;;
2436                 esac
2437                 if $test -f Policy.sh ; then
2438                         case "$dflt" in
2439                         *Policy*) ;;
2440                         none) dflt="Policy" ;;
2441                         *) dflt="Policy $dflt" ;;
2442                         esac
2443                 fi
2444                 ;;
2445         *)
2446                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2447                 ;;
2448         esac
2449
2450         if $test -f Policy.sh ; then
2451                 $cat <<EOM
2452
2453 There's also a Policy hint file available, which should make the
2454 site-specific (policy) questions easier to answer.
2455 EOM
2456
2457         fi
2458
2459         $cat <<EOM
2460
2461 You may give one or more space-separated answers, or "none" if appropriate.
2462 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2463 is a good thing.  DO NOT give a wrong version or a wrong OS.
2464
2465 EOM
2466
2467         rp="Which of these apply, if any?"
2468         . UU/myread
2469         tans=$ans
2470         for file in $tans; do
2471                 if $test X$file = XPolicy -a -f Policy.sh; then
2472                         . Policy.sh
2473                         $cat Policy.sh >> UU/config.sh
2474                 elif $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$tans = X -o X$tans = Xnone ; then
2478                         : nothing
2479                 else
2480                         : Give one chance to correct a possible typo.
2481                         echo "$file.sh does not exist"
2482                         dflt=$file
2483                         rp="hint to use instead?"
2484                         . UU/myread
2485                         for file in $ans; do
2486                                 if $test -f "$src/hints/$file.sh"; then
2487                                         . $src/hints/$file.sh
2488                                         $cat $src/hints/$file.sh >> UU/config.sh
2489                                 elif $test X$ans = X -o X$ans = Xnone ; then
2490                                         : nothing
2491                                 else
2492                                         echo "$file.sh does not exist -- ignored."
2493                                 fi
2494                         done
2495                 fi
2496         done
2497
2498         hint=recommended
2499         : Remember our hint file for later.
2500         if $test -f "$src/hints/$file.sh" ; then
2501                 hintfile="$file"
2502         else
2503                 hintfile=''
2504         fi
2505 fi
2506 cd UU
2507 ;;
2508 *)
2509         echo " "
2510         echo "Fetching default answers from $config_sh..." >&4
2511         tmp_n="$n"
2512         tmp_c="$c"
2513         cd ..
2514         cp $config_sh config.sh 2>/dev/null
2515         chmod +w config.sh
2516         . ./config.sh
2517         cd UU
2518         cp ../config.sh .
2519         n="$tmp_n"
2520         c="$tmp_c"
2521         hint=previous
2522         ;;
2523 esac
2524 test "$override" && . ./optdef.sh
2525 myuname="$newmyuname"
2526
2527 : Restore computed paths
2528 for file in $loclist $trylist; do
2529         eval $file="\$_$file"
2530 done
2531
2532 cat << EOM
2533
2534 Configure uses the operating system name and version to set some defaults.
2535 The default value is probably right if the name rings a bell. Otherwise,
2536 since spelling matters for me, either accept the default or answer "none"
2537 to leave it blank.
2538
2539 EOM
2540 case "$osname" in
2541         ''|' ')
2542                 case "$hintfile" in
2543                 ''|' '|none) dflt=none ;;
2544                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2545                 esac
2546                 ;;
2547         *) dflt="$osname" ;;
2548 esac
2549 rp="Operating system name?"
2550 . ./myread
2551 case "$ans" in
2552 none)  osname='' ;;
2553 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2554 esac
2555 echo " "
2556 case "$osvers" in
2557         ''|' ')
2558                 case "$hintfile" in
2559                 ''|' '|none) dflt=none ;;
2560                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2561                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2562                         case "$dflt" in
2563                         ''|' ') dflt=none ;;
2564                         esac
2565                         ;;
2566                 esac
2567                 ;;
2568         *) dflt="$osvers" ;;
2569 esac
2570 rp="Operating system version?"
2571 . ./myread
2572 case "$ans" in
2573 none)  osvers='' ;;
2574 *) osvers="$ans" ;;
2575 esac
2576
2577
2578 . ./posthint.sh
2579
2580 : who configured the system
2581 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2582 cf_by=`(logname) 2>/dev/null`
2583 case "$cf_by" in
2584 "")
2585         cf_by=`(whoami) 2>/dev/null`
2586         case "$cf_by" in
2587         "") cf_by=unknown ;;
2588         esac ;;
2589 esac
2590
2591 : set up the script used to warn in case of inconsistency
2592 cat <<EOS >whoa
2593 $startsh
2594 EOS
2595 cat <<'EOSC' >>whoa
2596 dflt=y
2597 echo " "
2598 echo "*** WHOA THERE!!! ***" >&4
2599 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2600 rp="    Keep the $hint value?"
2601 . ./myread
2602 case "$ans" in
2603 y) td=$was; tu=$was;;
2604 esac
2605 EOSC
2606
2607 : function used to set $1 to $val
2608 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2609 case "$val$was" in
2610 $define$undef) . ./whoa; eval "$var=\$td";;
2611 $undef$define) . ./whoa; eval "$var=\$tu";;
2612 *) eval "$var=$val";;
2613 esac'
2614
2615 cat <<EOM
2616
2617 Perl can be built to take advantage of threads, on some systems.
2618 To do so, Configure must be run with -Dusethreads.
2619
2620 Note that threading is a highly experimental feature, and
2621 some known race conditions still remain.  If you choose to try
2622 it, be very sure to not actually deploy it for production
2623 purposes.  README.threads has more details, and is required
2624 reading if you enable threads.
2625 EOM
2626 case "$usethreads" in
2627 $define|true|[yY]*)     dflt='y';;
2628 *) dflt='n';;
2629 esac
2630 rp='Build a threading Perl?'
2631 . ./myread
2632 case "$ans" in
2633 y|Y)    val="$define" ;;     
2634 *)      val="$undef" ;;
2635 esac
2636 set usethreads
2637 eval $setvar 
2638
2639 case "$d_oldpthreads" in
2640 '')     : Configure tests would be welcome here.  For now, assume undef.
2641         val="$undef" ;;
2642 *)      val="$d_oldpthreads" ;;
2643 esac
2644 set d_oldpthreads
2645 eval $setvar
2646
2647
2648 case "$usethreads" in
2649 "$define"|true|[yY]*)
2650 : Look for a hint-file generated 'call-back-unit'.  If the
2651 : user has specified that a threading perl is to be built,
2652 : we may need to set or change some other defaults.
2653         if $test -f usethreads.cbu; then
2654                 echo "Your platform has some specific hints for threaded builds, using them..."
2655                 . ./usethreads.cbu
2656         else
2657                 $cat <<EOM
2658 (Your platform doesn't have any specific hints for threaded builds.
2659  Assuming POSIX threads, then.)
2660 EOM
2661         fi
2662     ;;
2663 esac
2664
2665 cat <<EOM
2666
2667 Perl can be built so that multiple Perl interpreters can coexist
2668 within the same Perl executable.  To do so, Configure must be run with
2669 -Dusemultiplicity.
2670
2671 Normally you do not need this and you should answer no.
2672
2673 EOM
2674 case "$usemultiplicity" in
2675 $define|true|[yY]*)     dflt='y';;
2676 *) dflt='n';;
2677 esac
2678 rp='Build Perl for multiplicity?'
2679 . ./myread
2680 case "$ans" in
2681 y|Y)    val="$define" ;;     
2682 *)      val="$undef" ;;
2683 esac
2684 set usemultiplicity
2685 eval $setvar 
2686
2687 : determine where manual pages are on this system
2688 echo " "
2689 case "$sysman" in
2690 '') 
2691         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2692         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2693         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2694         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2695         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2696         sysman=`./loc . /usr/man/man1 $syspath`
2697         ;;
2698 esac
2699 if $test -d "$sysman"; then
2700         echo "System manual is in $sysman." >&4
2701 else
2702         echo "Could not find manual pages in source form." >&4
2703 fi
2704
2705 : see what memory models we can support
2706 case "$models" in
2707 '')
2708         $cat >pdp11.c <<'EOP'
2709 int main() {
2710 #ifdef pdp11
2711         exit(0);
2712 #else
2713         exit(1);
2714 #endif
2715 }
2716 EOP
2717         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2718         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2719                 dflt='unsplit split'
2720         else
2721                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2722                 case "$tans" in
2723                 X) dflt='none';;
2724                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2725                                 dflt='small'
2726                         else
2727                                 dflt=''
2728                         fi
2729                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2730                                 dflt="$dflt medium"
2731                         fi
2732                         if $test -d /lib/large || $test -d /usr/lib/large; then
2733                                 dflt="$dflt large"
2734                         fi
2735                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2736                                 dflt="$dflt huge"
2737                         fi
2738                 esac
2739         fi;;
2740 *) dflt="$models";;
2741 esac
2742 $cat <<EOM
2743  
2744 Some systems have different model sizes.  On most systems they are called
2745 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2746 split.  If your system doesn't support different memory models, say "none".
2747 If you wish to force everything to one memory model, say "none" here and
2748 put the appropriate flags later when it asks you for other cc and ld flags.
2749 Venix systems may wish to put "none" and let the compiler figure things out.
2750 (In the following question multiple model names should be space separated.)
2751
2752 The default for most systems is "none".
2753
2754 EOM
2755 rp="Which memory models are supported?"
2756 . ./myread
2757 models="$ans"
2758
2759 case "$models" in
2760 none)
2761         small=''
2762         medium=''
2763         large=''
2764         huge=''
2765         unsplit=''
2766         split=''
2767         ;;
2768 *split)
2769         case "$split" in
2770         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2771                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2772                         dflt='-i'
2773                 else
2774                         dflt='none'
2775                 fi;;
2776         *) dflt="$split";;
2777         esac
2778         rp="What flag indicates separate I and D space?"
2779         . ./myread
2780         tans="$ans"
2781         case "$tans" in
2782         none) tans='';;
2783         esac
2784         split="$tans"
2785         unsplit='';;
2786 *large*|*small*|*medium*|*huge*)
2787         case "$models" in
2788         *large*)
2789                 case "$large" in
2790                 '') dflt='-Ml';;
2791                 *) dflt="$large";;
2792                 esac
2793         rp="What flag indicates large model?"
2794         . ./myread
2795         tans="$ans"
2796         case "$tans" in
2797         none) tans='';
2798         esac
2799         large="$tans";;
2800         *) large='';;
2801         esac
2802         case "$models" in
2803         *huge*) case "$huge" in
2804                 '') dflt='-Mh';;
2805                 *) dflt="$huge";;
2806                 esac
2807                 rp="What flag indicates huge model?"
2808                 . ./myread
2809                 tans="$ans"
2810                 case "$tans" in
2811                 none) tans='';
2812                 esac
2813                 huge="$tans";;
2814         *) huge="$large";;
2815         esac
2816         case "$models" in
2817         *medium*) case "$medium" in
2818                 '') dflt='-Mm';;
2819                 *) dflt="$medium";;
2820                 esac
2821                 rp="What flag indicates medium model?"
2822                 . ./myread
2823                 tans="$ans"
2824                 case "$tans" in
2825                 none) tans='';
2826                 esac
2827                 medium="$tans";;
2828         *) medium="$large";;
2829         esac
2830         case "$models" in
2831         *small*) case "$small" in
2832                 '') dflt='none';;
2833                 *) dflt="$small";;
2834                 esac
2835                 rp="What flag indicates small model?"
2836                 . ./myread
2837                 tans="$ans"
2838                 case "$tans" in
2839                 none) tans='';
2840                 esac
2841                 small="$tans";;
2842         *) small='';;
2843         esac
2844         ;;
2845 *)
2846         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2847         ;;
2848 esac
2849 $rm -f pdp11.* pdp11
2850
2851 : make some quick guesses about what we are up against
2852 echo " "
2853 $echo $n "Hmm...  $c"
2854 echo exit 1 >bsd
2855 echo exit 1 >usg
2856 echo exit 1 >v7
2857 echo exit 1 >osf1
2858 echo exit 1 >eunice
2859 echo exit 1 >xenix
2860 echo exit 1 >venix
2861 echo exit 1 >os2
2862 d_bsd="$undef"
2863 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2864 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2865 then
2866         echo "Looks kind of like an OSF/1 system, but we'll see..."
2867         echo exit 0 >osf1
2868 elif test `echo abc | tr a-z A-Z` = Abc ; then
2869         xxx=`./loc addbib blurfl $pth`
2870         if $test -f $xxx; then
2871         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2872                 echo exit 0 >bsd
2873                 echo exit 0 >usg
2874         else
2875                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2876                         echo "Looks kind of like an extended USG system, but we'll see..."
2877                 else
2878                         echo "Looks kind of like a USG system, but we'll see..."
2879                 fi
2880                 echo exit 0 >usg
2881         fi
2882 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2883         echo "Looks kind of like a BSD system, but we'll see..."
2884         d_bsd="$define"
2885         echo exit 0 >bsd
2886 else
2887         echo "Looks kind of like a Version 7 system, but we'll see..."
2888         echo exit 0 >v7
2889 fi
2890 case "$eunicefix" in
2891 *unixtovms*)
2892         $cat <<'EOI'
2893 There is, however, a strange, musty smell in the air that reminds me of
2894 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2895 EOI
2896         echo exit 0 >eunice
2897         d_eunice="$define"
2898 : it so happens the Eunice I know will not run shell scripts in Unix format
2899         ;;
2900 *)
2901         echo " "
2902         echo "Congratulations.  You aren't running Eunice."
2903         d_eunice="$undef"
2904         ;;
2905 esac
2906 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2907 case "$p_" in
2908 :) ;;
2909 *)
2910         $cat <<'EOI'
2911 I have the feeling something is not exactly right, however...don't tell me...
2912 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2913 EOI
2914         echo exit 0 >os2
2915         ;;
2916 esac
2917 if test -f /xenix; then
2918         echo "Actually, this looks more like a XENIX system..."
2919         echo exit 0 >xenix
2920         d_xenix="$define"
2921 else
2922         echo " "
2923         echo "It's not Xenix..."
2924         d_xenix="$undef"
2925 fi
2926 chmod +x xenix
2927 $eunicefix xenix
2928 if test -f /venix; then
2929         echo "Actually, this looks more like a VENIX system..."
2930         echo exit 0 >venix
2931 else
2932         echo " "
2933         if ./xenix; then
2934                 : null
2935         else
2936                 echo "Nor is it Venix..."
2937         fi
2938 fi
2939 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2940 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2941 $rm -f foo
2942
2943 : see if we need a special compiler
2944 echo " "
2945 if ./usg; then
2946         case "$cc" in
2947         '') case "$Mcc" in
2948                 /*) dflt='Mcc';;
2949                 *) case "$large" in
2950                         -M*) dflt='cc';;
2951                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2952                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2953                                                 dflt='cc'
2954                                         else
2955                                                 dflt='cc -M'
2956                                         fi
2957                                 else
2958                                         dflt='cc'
2959                                 fi;;
2960                         esac;;
2961                 esac;;
2962         *)  dflt="$cc";;
2963         esac
2964         case "$dflt" in
2965         *M*)    $cat <<'EOM'
2966 On some older systems the default C compiler will not resolve multiple global
2967 references that happen to have the same name.  On some such systems the "Mcc"
2968 command may be used to force these to be resolved.  On other systems a "cc -M"
2969 command is required.  (Note that the -M flag on other systems indicates a
2970 memory model to use!) If you have the Gnu C compiler, you might wish to use
2971 that instead.
2972
2973 EOM
2974         ;;
2975         esac
2976         rp="Use which C compiler?"
2977         . ./myread
2978         cc="$ans"
2979 else
2980         case "$cc" in
2981         '') dflt=cc;;
2982         *) dflt="$cc";;
2983         esac
2984         rp="Use which C compiler?"
2985         . ./myread
2986         cc="$ans"
2987 fi
2988 : Look for a hint-file generated 'call-back-unit'.  Now that the
2989 : user has specified the compiler, we may need to set or change some
2990 : other defaults.
2991 if $test -f cc.cbu; then
2992     . ./cc.cbu
2993 fi
2994 echo " "
2995 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2996 $cat >gccvers.c <<EOM
2997 #include <stdio.h>
2998 int main() {
2999 #ifdef __GNUC__
3000 #ifdef __VERSION__
3001         printf("%s\n", __VERSION__);
3002 #else
3003         printf("%s\n", "1");
3004 #endif
3005 #endif
3006         exit(0);
3007 }
3008 EOM
3009 if $cc -o gccvers gccvers.c; then
3010         gccversion=`./gccvers`
3011         case "$gccversion" in
3012         '') echo "You are not using GNU cc." ;;
3013         *)  echo "You are using GNU cc $gccversion." ;;
3014         esac
3015 else
3016         echo " "
3017         echo "*** WHOA THERE!!! ***" >&4
3018         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3019         case "$knowitall" in
3020         '')
3021         echo "    You'd better start hunting for one and let me know about it." >&4
3022                 exit 1
3023                 ;;
3024         esac
3025 fi
3026 $rm -f gccvers*
3027 case "$gccversion" in
3028 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3029 esac
3030
3031
3032 case "$usemorebits" in
3033 "$define"|true|[yY]*)
3034         use64bits="$define"
3035         uselongdouble="$define"
3036         usemorebits="$define"
3037         ;;
3038 *)      usemorebits="$undef"
3039         ;;
3040 esac
3041
3042
3043 cat <<EOM
3044
3045 Perl can be built to understand large files (files larger than 2 gigabytes)
3046 on some systems.  To do so, Configure must be run with -Duselargefiles.
3047
3048 If this doesn't make any sense to you, just accept the default.
3049 EOM
3050 case "$uselargefiles" in
3051 "$define"|true|[yY]*) dflt='y' ;;
3052 *)      dflt='n' ;;
3053 esac
3054 rp='Try to understand large files?'
3055 . ./myread
3056 case "$ans" in
3057 y|Y)    val="$define" ;;
3058 *)      val="$undef"  ;;
3059 esac
3060 set uselargefiles
3061 eval $setvar
3062 case "$uselargefiles" in
3063 "$define") use64bits="$define" ;;
3064 esac
3065
3066 cat <<EOM
3067
3068 Perl can be built to take advantage of explicit 64-bit interfaces,
3069 on some systems.  To do so, Configure must be run with -Duse64bits.
3070
3071 If this doesn't make any sense to you, just accept the default.
3072 EOM
3073 case "$use64bits" in
3074 $define|true|[yY]*)     dflt='y';;
3075 *) dflt='n';;
3076 esac
3077 rp='Try to use explicit 64-bit interfaces, if available?'
3078 . ./myread
3079 case "$ans" in
3080 y|Y) 
3081         val="$define"
3082         ;;     
3083 *)      
3084         val="$undef"
3085         ;;
3086 esac
3087 set use64bits
3088 eval $setvar
3089
3090 case "$archname64" in
3091 '') archname64='' ;;    # not a typo
3092 esac
3093
3094 case "$use64bits" in
3095 "$define"|true|[yY]*)
3096 : Look for a hint-file generated 'call-back-unit'.  If the
3097 : user has specified that a 64 bit perl is to be built,
3098 : we may need to set or change some other defaults.
3099         if $test -f use64bits.cbu; then
3100                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3101                 . ./use64bits.cbu
3102         else
3103                 $cat <<EOM
3104 (Your platform doesn't have any specific hints for 64-bit builds.
3105  This is probably okay, especially if your system is a true 64-bit system.)
3106 EOM
3107                 case "$gccversion" in
3108                 '')     ;;
3109                 *)      $cat <<EOM
3110 But since you seem to be using gcc,
3111 I will now add -DUSE_LONG_LONG to the compilation flags.
3112 EOM
3113                         ccflags="$ccflags -DUSE_LONG_LONG"
3114                         ;;
3115                 esac
3116         fi
3117         ;;
3118 esac
3119
3120 : determine the architecture name
3121 echo " "
3122 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3123         tarch=`arch`"-$osname"
3124 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3125         if uname -m > tmparch 2>&1 ; then
3126                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3127                         -e 's/$/'"-$osname/" tmparch`
3128         else
3129                 tarch="$osname"
3130         fi
3131         $rm -f tmparch
3132 else
3133         tarch="$osname"
3134 fi
3135 case "$myarchname" in
3136 ''|"$tarch") ;;
3137 *)
3138         echo "(Your architecture name used to be $myarchname.)"
3139         archname=''
3140         ;;
3141 esac
3142 myarchname="$tarch"
3143 case "$archname" in
3144 '') dflt="$tarch";;
3145 *) dflt="$archname";;
3146 esac
3147 rp='What is your architecture name'
3148 . ./myread
3149 archname="$ans"
3150 case "$usethreads" in
3151 $define)
3152         echo "Threads selected." >&4
3153         case "$archname" in
3154         *-thread*) echo "...and architecture name already has -thread." >&4
3155                 ;;
3156         *)      archname="$archname-thread"
3157                 echo "...setting architecture name to $archname." >&4
3158                 ;;
3159         esac
3160         ;;
3161 esac
3162 case "$usemultiplicity" in
3163 $define)
3164         echo "Multiplicity selected." >&4
3165         case "$archname" in
3166         *-multi*) echo "...and architecture name already has -multi." >&4
3167                 ;;
3168         *)      archname="$archname-multi"
3169                 echo "...setting architecture name to $archname." >&4
3170                 ;;
3171         esac
3172         ;;
3173 esac
3174 case "$use64bits" in
3175 $define)
3176         echo "Explicit 64-bitness selected." >&4
3177         case "$archname64" in
3178         '')
3179                 ;;
3180         *)
3181                 case "$archname" in
3182                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3183                         ;;
3184                 *)      archname="$archname-$archname64"
3185                         echo "...setting architecture name to $archname." >&4
3186                         ;;
3187                 esac
3188                 ;;
3189         esac
3190 esac
3191
3192 : decide how portable to be.  Allow command line overrides.
3193 case "$d_portable" in
3194 "$undef") ;;
3195 *)      d_portable="$define" ;;
3196 esac
3197
3198 : set up shell script to do ~ expansion
3199 cat >filexp <<EOSS
3200 $startsh
3201 : expand filename
3202 case "\$1" in
3203  ~/*|~)
3204         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3205         ;;
3206  ~*)
3207         if $test -f /bin/csh; then
3208                 /bin/csh -f -c "glob \$1"
3209                 failed=\$?
3210                 echo ""
3211                 exit \$failed
3212         else
3213                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3214                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3215                 if $test ! -d "\$dir"; then
3216                         me=\`basename \$0\`
3217                         echo "\$me: can't locate home directory for: \$name" >&2
3218                         exit 1
3219                 fi
3220                 case "\$1" in
3221                 */*)
3222                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3223                         ;;
3224                 *)
3225                         echo \$dir
3226                         ;;
3227                 esac
3228         fi
3229         ;;
3230 *)
3231         echo \$1
3232         ;;
3233 esac
3234 EOSS
3235 chmod +x filexp
3236 $eunicefix filexp
3237
3238 : now set up to get a file name
3239 cat <<EOS >getfile
3240 $startsh
3241 EOS
3242 cat <<'EOSC' >>getfile
3243 tilde=''
3244 fullpath=''
3245 already=''
3246 skip=''
3247 none_ok=''
3248 exp_file=''
3249 nopath_ok=''
3250 orig_rp="$rp"
3251 orig_dflt="$dflt"
3252 case "$gfpth" in
3253 '') gfpth='.' ;;
3254 esac
3255
3256 case "$fn" in
3257 *\(*)
3258         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3259         fn=`echo $fn | sed 's/(.*)//'`
3260         ;;
3261 esac
3262
3263 case "$fn" in
3264 *:*)
3265         loc_file=`expr $fn : '.*:\(.*\)'`
3266         fn=`expr $fn : '\(.*\):.*'`
3267         ;;
3268 esac
3269
3270 case "$fn" in
3271 *~*) tilde=true;;
3272 esac
3273 case "$fn" in
3274 */*) fullpath=true;;
3275 esac
3276 case "$fn" in
3277 *+*) skip=true;;
3278 esac
3279 case "$fn" in
3280 *n*) none_ok=true;;
3281 esac
3282 case "$fn" in
3283 *e*) exp_file=true;;
3284 esac
3285 case "$fn" in
3286 *p*) nopath_ok=true;;
3287 esac
3288
3289 case "$fn" in
3290 *f*) type='File';;
3291 *d*) type='Directory';;
3292 *l*) type='Locate';;
3293 esac
3294
3295 what="$type"
3296 case "$what" in
3297 Locate) what='File';;
3298 esac
3299
3300 case "$exp_file" in
3301 '')
3302         case "$d_portable" in
3303         "$define") ;;
3304         *) exp_file=true;;
3305         esac
3306         ;;
3307 esac
3308
3309 cd ..
3310 while test "$type"; do
3311         redo=''
3312         rp="$orig_rp"
3313         dflt="$orig_dflt"
3314         case "$tilde" in
3315         true) rp="$rp (~name ok)";;
3316         esac
3317         . UU/myread
3318         if test -f UU/getfile.ok && \
3319                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3320         then
3321                 value="$ans"
3322                 ansexp="$ans"
3323                 break
3324         fi
3325         case "$ans" in
3326         none)
3327                 value=''
3328                 ansexp=''
3329                 case "$none_ok" in
3330                 true) type='';;
3331                 esac
3332                 ;;
3333         *)
3334                 case "$tilde" in
3335                 '') value="$ans"
3336                         ansexp="$ans";;
3337                 *)
3338                         value=`UU/filexp $ans`
3339                         case $? in
3340                         0)
3341                                 if test "$ans" != "$value"; then
3342                                         echo "(That expands to $value on this system.)"
3343                                 fi
3344                                 ;;
3345                         *) value="$ans";;
3346                         esac
3347                         ansexp="$value"
3348                         case "$exp_file" in
3349                         '') value="$ans";;
3350                         esac
3351                         ;;
3352                 esac
3353                 case "$fullpath" in
3354                 true)
3355                         case "$ansexp" in
3356                         /*) value="$ansexp" ;;
3357                         *)
3358                                 redo=true
3359                                 case "$already" in
3360                                 true)
3361                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3362                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3363                                         ;;
3364                                 *)
3365                                 echo "Please give a full path name, starting with slash." >&4
3366                                         case "$tilde" in
3367                                         true)
3368                                 echo "Note that using ~name is ok provided it expands well." >&4
3369                                                 already=true
3370                                                 ;;
3371                                         esac
3372                                 esac
3373                                 ;;
3374                         esac
3375                         ;;
3376                 esac
3377                 case "$redo" in
3378                 '')
3379                         case "$type" in
3380                         File)
3381                                 for fp in $gfpth; do
3382                                         if test "X$fp" = X.; then
3383                                             pf="$ansexp"
3384                                         else    
3385                                             pf="$fp/$ansexp"
3386                                         fi
3387                                         if test -f "$pf"; then
3388                                                 type=''
3389                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3390                                         then
3391                                                 echo "($value is not a plain file, but that's ok.)"
3392                                                 type=''
3393                                         fi
3394                                         if test X"$type" = X; then
3395                                             value="$pf"
3396                                             break
3397                                         fi
3398                                 done
3399                                 ;;
3400                         Directory)
3401                                 for fp in $gfpth; do
3402                                         if test "X$fp" = X.; then
3403                                             pf="$ansexp"
3404                                         else    
3405                                             pf="$fp/$ansexp"
3406                                         fi
3407                                         if test -d "$pf"; then
3408                                                 type=''
3409                                                 value="$pf"
3410                                                 break
3411                                         fi
3412                                 done
3413                                 ;;
3414                         Locate)
3415                                 if test -d "$ansexp"; then
3416                                         echo "(Looking for $loc_file in directory $value.)"
3417                                         value="$value/$loc_file"
3418                                         ansexp="$ansexp/$loc_file"
3419                                 fi
3420                                 if test -f "$ansexp"; then
3421                                         type=''
3422                                 fi
3423                                 case "$nopath_ok" in
3424                                 true)   case "$value" in
3425                                         */*) ;;
3426                                         *)      echo "Assuming $value will be in people's path."
3427                                                 type=''
3428                                                 ;;
3429                                         esac
3430                                         ;;
3431                                 esac
3432                                 ;;
3433                         esac
3434
3435                         case "$skip" in
3436                         true) type='';
3437                         esac
3438
3439                         case "$type" in
3440                         '') ;;
3441                         *)
3442                                 if test "$fastread" = yes; then
3443                                         dflt=y
3444                                 else
3445                                         dflt=n
3446                                 fi
3447                                 rp="$what $value doesn't exist.  Use that name anyway?"
3448                                 . UU/myread
3449                                 dflt=''
3450                                 case "$ans" in
3451                                 y*) type='';;
3452                                 *) echo " ";;
3453                                 esac
3454                                 ;;
3455                         esac
3456                         ;;
3457                 esac
3458                 ;;
3459         esac
3460 done
3461 cd UU
3462 ans="$value"
3463 rp="$orig_rp"
3464 dflt="$orig_dflt"
3465 rm -f getfile.ok
3466 test "X$gfpthkeep" != Xy && gfpth=""
3467 EOSC
3468
3469 : determine root of directory hierarchy where package will be installed.
3470 case "$prefix" in
3471 '')
3472         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3473         ;;
3474 *)
3475         dflt="$prefix"
3476         ;;
3477 esac
3478 $cat <<EOM
3479
3480 By default, $package will be installed in $dflt/bin, manual pages
3481 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3482 installation directories. Typically this is something like /usr/local.
3483 If you wish to have binaries under /usr/bin but other parts of the
3484 installation under /usr/local, that's ok: you will be prompted
3485 separately for each of the installation directories, the prefix being
3486 only used to set the defaults.
3487
3488 EOM
3489 fn=d~
3490 rp='Installation prefix to use?'
3491 . ./getfile
3492 oldprefix=''
3493 case "$prefix" in
3494 '') ;;
3495 *)
3496         case "$ans" in
3497         "$prefix") ;;
3498         *) oldprefix="$prefix";;
3499         esac
3500         ;;
3501 esac
3502 prefix="$ans"
3503 prefixexp="$ansexp"
3504
3505 : is AFS running?
3506 echo " "
3507 case "$afs" in
3508 $define|true)   afs=true ;;
3509 $undef|false)   afs=false ;;
3510 *)      if test -d /afs; then
3511                 afs=true
3512         else
3513                 afs=false
3514         fi
3515         ;;
3516 esac
3517 if $afs; then
3518         echo "AFS may be running... I'll be extra cautious then..." >&4
3519 else
3520         echo "AFS does not seem to be running..." >&4
3521 fi
3522
3523 : determine installation prefix for where package is to be installed.
3524 if $afs; then 
3525 $cat <<EOM
3526
3527 Since you are running AFS, I need to distinguish the directory in which
3528 files will reside from the directory in which they are installed (and from
3529 which they are presumably copied to the former directory by occult means).
3530
3531 EOM
3532         case "$installprefix" in
3533         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3534         *) dflt="$installprefix";;
3535         esac
3536 else
3537 $cat <<EOM
3538
3539 In some special cases, particularly when building $package for distribution,
3540 it is convenient to distinguish between the directory in which files should 
3541 be installed from the directory ($prefix) in which they 
3542 will eventually reside.  For most users, these two directories are the same.
3543
3544 EOM
3545         case "$installprefix" in
3546         '') dflt=$prefix ;;
3547         *) dflt=$installprefix;;
3548         esac
3549 fi
3550 fn=d~
3551 rp='What installation prefix should I use for installing files?'
3552 . ./getfile
3553 installprefix="$ans"
3554 installprefixexp="$ansexp"
3555
3556 : set the prefixit variable, to compute a suitable default value
3557 prefixit='case "$3" in
3558 ""|none)
3559         case "$oldprefix" in
3560         "") eval "$1=\"\$$2\"";;
3561         *)
3562                 case "$3" in
3563                 "") eval "$1=";;
3564                 none)
3565                         eval "tp=\"\$$2\"";
3566                         case "$tp" in
3567                         ""|" ") eval "$1=\"\$$2\"";;
3568                         *) eval "$1=";;
3569                         esac;;
3570                 esac;;
3571         esac;;
3572 *)
3573         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3574         case "$tp" in
3575         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3576         /*-$oldprefix/*|\~*-$oldprefix/*)
3577                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3578         *) eval "$1=\"\$$2\"";;
3579         esac;;
3580 esac'
3581
3582 : set the base revision
3583 baserev=5.0
3584
3585 : get the patchlevel
3586 echo " "
3587 echo "Getting the current patchlevel..." >&4
3588 if $test -r $rsrc/patchlevel.h;then
3589         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3590         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3591         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3592 else
3593         patchlevel=0
3594         subversion=0
3595         apiversion=0
3596 fi
3597 $echo $n "(You have $package" $c
3598 case "$package" in
3599 "*$baserev")    ;;
3600 *)              $echo $n " $baserev" $c ;;
3601 esac
3602 $echo $n " patchlevel $patchlevel" $c
3603 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3604 echo ".)"
3605
3606 if test 0 -eq "$subversion"; then
3607         version=`LC_ALL=C; export LC_ALL; \
3608                  echo $baserev $patchlevel | \
3609                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3610 else
3611         version=`LC_ALL=C; export LC_ALL; \
3612                  echo $baserev $patchlevel $subversion | \
3613                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3614 fi
3615
3616 : determine installation style
3617 : For now, try to deduce it from prefix unless it is already set.
3618 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3619 case "$installstyle" in
3620 '')     case "$prefix" in
3621                 *perl*) dflt='lib';;
3622                 *) dflt='lib/perl5' ;;
3623         esac
3624         ;;
3625 *)      dflt='lib/perl5' ;;
3626 esac
3627 : Probably not worth prompting for this since we prompt for all
3628 : the directories individually, and the prompt would be too long and
3629 : confusing anyway.
3630 installstyle=$dflt
3631
3632 : determine where private library files go
3633 : Usual default is /usr/local/lib/perl5/$version.
3634 : Also allow things like /opt/perl/lib/$version, since 
3635 : /opt/perl/lib/perl5... would be redundant.
3636 : The default "style" setting is made in installstyle.U
3637 case "$installstyle" in
3638 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3639 *)       set dflt privlib lib/$version ;;
3640 esac
3641 eval $prefixit
3642 $cat <<EOM
3643
3644 There are some auxiliary files for $package that need to be put into a
3645 private library directory that is accessible by everyone.
3646
3647 EOM
3648 fn=d~+
3649 rp='Pathname where the private library files will reside?'
3650 . ./getfile
3651 privlib="$ans"
3652 privlibexp="$ansexp"
3653 : Change installation prefix, if necessary.
3654 if $test X"$prefix" != X"$installprefix"; then
3655         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3656 else
3657         installprivlib="$privlibexp"
3658 fi
3659
3660 : set the prefixup variable, to restore leading tilda escape
3661 prefixup='case "$prefixexp" in
3662 "$prefix") ;;
3663 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3664 esac'
3665
3666 : determine where public architecture dependent libraries go
3667 set archlib archlib
3668 eval $prefixit
3669 : privlib default is /usr/local/lib/$package/$version
3670 : archlib default is /usr/local/lib/$package/$version/$archname
3671 : privlib may have an optional trailing /share.
3672 tdflt=`echo $privlib | $sed 's,/share$,,'`
3673 tdflt=$tdflt/$archname
3674 case "$archlib" in
3675 '')     dflt=$tdflt
3676         ;;
3677 *)      dflt="$archlib"
3678     ;;
3679 esac
3680 $cat <<EOM
3681
3682 $spackage contains architecture-dependent library files.  If you are
3683 sharing libraries in a heterogeneous environment, you might store
3684 these files in a separate location.  Otherwise, you can just include
3685 them with the rest of the public library files.
3686
3687 EOM
3688 fn=d+~
3689 rp='Where do you want to put the public architecture-dependent libraries?'
3690 . ./getfile
3691 archlib="$ans"
3692 archlibexp="$ansexp"
3693 if $test X"$archlib" = X"$privlib"; then
3694         d_archlib="$undef"
3695 else
3696         d_archlib="$define"
3697 fi
3698 : Change installation prefix, if necessary.
3699 if $test X"$prefix" != X"$installprefix"; then
3700         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3701 else
3702         installarchlib="$archlibexp"
3703 fi
3704
3705
3706 : Binary compatibility with 5.005 is not possible for builds
3707 : with advanced features
3708 case "$usethreads$usemultiplicity" in
3709 *define*)
3710         bincompat5005="$undef"
3711         d_bincompat5005="$undef"
3712         ;;
3713 *)      $cat <<EOM
3714
3715 Perl 5.006 can be compiled for binary compatibility with 5.005.
3716 If you decide to do so, you will be able to continue using most
3717 of the extensions that were compiled for Perl 5.005.
3718
3719 EOM
3720         case "$bincompat5005$d_bincompat5005" in
3721         *"$undef"*) dflt=n ;;
3722         *) dflt=y ;;
3723         esac
3724         rp='Binary compatibility with Perl 5.005?'
3725         . ./myread
3726         case "$ans" in
3727         y*) val="$define" ;;
3728         *)  val="$undef" ;;
3729         esac
3730         set d_bincompat5005
3731         eval $setvar
3732         case "$d_bincompat5005" in
3733         "$define")
3734                 bincompat5005="$define"
3735                 ;;
3736         *)      bincompat5005="$undef"
3737                 d_bincompat5005="$undef"
3738                 ;;
3739         esac
3740         ;;
3741 esac
3742
3743
3744 : see if setuid scripts can be secure
3745 $cat <<EOM
3746
3747 Some kernels have a bug that prevents setuid #! scripts from being
3748 secure.  Some sites have disabled setuid #! scripts because of this.
3749
3750 First let's decide if your kernel supports secure setuid #! scripts.
3751 (If setuid #! scripts would be secure but have been disabled anyway,
3752 don't say that they are secure if asked.)
3753
3754 EOM
3755
3756 val="$undef"
3757 if $test -d /dev/fd; then
3758         echo "#!$ls" >reflect
3759         chmod +x,u+s reflect
3760         ./reflect >flect 2>&1
3761         if $contains "/dev/fd" flect >/dev/null; then
3762                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3763                 val="$define"
3764         else
3765                 $cat <<EOM
3766 If you are not sure if they are secure, I can check but I'll need a
3767 username and password different from the one you are using right now.
3768 If you don't have such a username or don't want me to test, simply
3769 enter 'none'.
3770
3771 EOM
3772                 rp='Other username to test security of setuid scripts with?'
3773                 dflt='none'
3774                 . ./myread
3775                 case "$ans" in
3776                 n|none)
3777                         case "$d_suidsafe" in
3778                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3779                                 dflt=n;;
3780                         "$undef")
3781                                 echo "Well, the $hint value is *not* secure." >&4
3782                                 dflt=n;;
3783                         *)      echo "Well, the $hint value *is* secure." >&4
3784                                 dflt=y;;
3785                         esac
3786                         ;;
3787                 *)
3788                         $rm -f reflect flect
3789                         echo "#!$ls" >reflect
3790                         chmod +x,u+s reflect
3791                         echo >flect
3792                         chmod a+w flect
3793                         echo '"su" will (probably) prompt you for '"$ans's password."
3794                         su $ans -c './reflect >flect'
3795                         if $contains "/dev/fd" flect >/dev/null; then
3796                                 echo "Okay, it looks like setuid scripts are secure." >&4
3797                                 dflt=y
3798                         else
3799                                 echo "I don't think setuid scripts are secure." >&4
3800                                 dflt=n
3801                         fi
3802                         ;;
3803                 esac
3804                 rp='Does your kernel have *secure* setuid scripts?'
3805                 . ./myread
3806                 case "$ans" in
3807                 [yY]*)  val="$define";;
3808                 *)      val="$undef";;
3809                 esac
3810         fi
3811 else
3812         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3813         echo "(That's for file descriptors, not floppy disks.)"
3814         val="$undef"
3815 fi
3816 set d_suidsafe
3817 eval $setvar
3818
3819 $rm -f reflect flect
3820
3821 : now see if they want to do setuid emulation
3822 echo " "
3823 val="$undef"
3824 case "$d_suidsafe" in
3825 "$define")
3826         val="$undef"
3827         echo "No need to emulate SUID scripts since they are secure here." >& 4
3828         ;;
3829 *)
3830         $cat <<EOM
3831 Some systems have disabled setuid scripts, especially systems where
3832 setuid scripts cannot be secure.  On systems where setuid scripts have
3833 been disabled, the setuid/setgid bits on scripts are currently
3834 useless.  It is possible for $package to detect those bits and emulate
3835 setuid/setgid in a secure fashion.  This emulation will only work if
3836 setuid scripts have been disabled in your kernel.
3837
3838 EOM
3839         case "$d_dosuid" in
3840         "$define") dflt=y ;;
3841         *) dflt=n ;;
3842         esac
3843         rp="Do you want to do setuid/setgid emulation?"
3844         . ./myread
3845         case "$ans" in
3846         [yY]*)  val="$define";;
3847         *)      val="$undef";;
3848         esac
3849         ;;
3850 esac
3851 set d_dosuid
3852 eval $setvar
3853
3854 : What should the include directory be ?
3855 echo " "
3856 $echo $n "Hmm...  $c"
3857 dflt='/usr/include'
3858 incpath=''
3859 mips_type=''
3860 if $test -f /bin/mips && /bin/mips; then
3861         echo "Looks like a MIPS system..."
3862         $cat >usr.c <<'EOCP'
3863 #ifdef SYSTYPE_BSD43
3864 /bsd43
3865 #endif
3866 EOCP
3867         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3868                 dflt='/bsd43/usr/include'
3869                 incpath='/bsd43'
3870                 mips_type='BSD 4.3'
3871         else
3872                 mips_type='System V'
3873         fi
3874         $rm -f usr.c usr.out
3875         echo "and you're compiling with the $mips_type compiler and libraries."
3876         xxx_prompt=y
3877         echo "exit 0" >mips
3878 else
3879         echo "Doesn't look like a MIPS system."
3880         xxx_prompt=n
3881         echo "exit 1" >mips
3882 fi
3883 chmod +x mips
3884 $eunicefix mips
3885 case "$usrinc" in
3886 '') ;;
3887 *) dflt="$usrinc";;
3888 esac
3889 case "$xxx_prompt" in
3890 y)      fn=d/
3891         echo " "
3892         rp='Where are the include files you want to use?'
3893         . ./getfile
3894         usrinc="$ans"
3895         ;;
3896 *)      usrinc="$dflt"
3897         ;;
3898 esac
3899
3900 : see how we invoke the C preprocessor
3901 echo " "
3902 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3903 cat <<'EOT' >testcpp.c
3904 #define ABC abc
3905 #define XYZ xyz
3906 ABC.XYZ
3907 EOT
3908 cd ..
3909 if test ! -f cppstdin; then
3910         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3911                 # AIX cc -E doesn't show the absolute headerfile
3912                 # locations but we'll cheat by using the -M flag.
3913                 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
3914         else
3915                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3916         fi
3917 else
3918         echo "Keeping your $hint cppstdin wrapper."
3919 fi
3920 chmod 755 cppstdin
3921 wrapper=`pwd`/cppstdin
3922 ok='false'
3923 cd UU
3924
3925 if $test "X$cppstdin" != "X" && \
3926         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3927         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3928 then
3929         echo "You used to use $cppstdin $cppminus so we'll use that again."
3930         case "$cpprun" in
3931         '') echo "But let's see if we can live without a wrapper..." ;;
3932         *)
3933                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3934                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3935                 then
3936                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3937                         ok='true'
3938                 else
3939                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3940                 fi
3941                 ;;
3942         esac
3943 else
3944         case "$cppstdin" in
3945         '') ;;
3946         *)
3947                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3948                 ;;
3949         esac
3950 fi
3951
3952 if $ok; then
3953         : nothing
3954 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3955         $cc -E <testcpp.c >testcpp.out 2>&1; \
3956         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3957         echo "Yup, it does."
3958         x_cpp="$cc -E"
3959         x_minus='';
3960 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3961         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3962         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3963         echo "Yup, it does."
3964         x_cpp="$cc -E"
3965         x_minus='-';
3966 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3967         $cc -P <testcpp.c >testcpp.out 2>&1; \
3968         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3969         echo "Yipee, that works!"
3970         x_cpp="$cc -P"
3971         x_minus='';
3972 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3973         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3974         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3975         echo "At long last!"
3976         x_cpp="$cc -P"
3977         x_minus='-';
3978 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3979         $cpp <testcpp.c >testcpp.out 2>&1; \
3980         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3981         echo "It works!"
3982         x_cpp="$cpp"
3983         x_minus='';
3984 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3985         $cpp - <testcpp.c >testcpp.out 2>&1; \
3986         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3987         echo "Hooray, it works!  I was beginning to wonder."
3988         x_cpp="$cpp"
3989         x_minus='-';
3990 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3991         $wrapper <testcpp.c >testcpp.out 2>&1; \
3992         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3993         x_cpp="$wrapper"
3994         x_minus=''
3995         echo "Eureka!"
3996 else
3997         dflt=''
3998         rp="No dice.  I can't find a C preprocessor.  Name one:"
3999         . ./myread
4000         x_cpp="$ans"
4001         x_minus=''
4002         $x_cpp <testcpp.c >testcpp.out 2>&1
4003         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4004                 echo "OK, that will do." >&4
4005         else
4006 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4007                 exit 1
4008         fi
4009 fi
4010
4011 case "$ok" in
4012 false)
4013         cppstdin="$x_cpp"
4014         cppminus="$x_minus"
4015         cpprun="$x_cpp"
4016         cpplast="$x_minus"
4017         set X $x_cpp
4018         shift
4019         case "$1" in
4020         "$cpp")
4021                 echo "Perhaps can we force $cc -E using a wrapper..."
4022                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4023                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4024                 then
4025                         echo "Yup, we can."
4026                         cppstdin="$wrapper"
4027                         cppminus='';
4028                 else
4029                         echo "Nope, we'll have to live without it..."
4030                 fi
4031                 ;;
4032         esac
4033         case "$cpprun" in
4034         "$wrapper")
4035                 cpprun=''
4036                 cpplast=''
4037                 ;;
4038         esac
4039         ;;
4040 esac
4041
4042 case "$cppstdin" in
4043 "$wrapper"|'cppstdin') ;;
4044 *) $rm -f $wrapper;;
4045 esac
4046 $rm -f testcpp.c testcpp.out
4047
4048 : Set private lib path
4049 case "$plibpth" in
4050 '') if ./mips; then
4051                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4052         fi;;
4053 esac
4054 case "$libpth" in
4055 ' ') dlist='';;
4056 '') dlist="$loclibpth $plibpth $glibpth";;
4057 *) dlist="$libpth";;
4058 esac
4059
4060 : Now check and see which directories actually exist, avoiding duplicates
4061 libpth=''
4062 for xxx in $dlist
4063 do
4064     if $test -d $xxx; then
4065                 case " $libpth " in
4066                 *" $xxx "*) ;;
4067                 *) libpth="$libpth $xxx";;
4068                 esac
4069     fi
4070 done
4071 $cat <<'EOM'
4072
4073 Some systems have incompatible or broken versions of libraries.  Among
4074 the directories listed in the question below, please remove any you
4075 know not to be holding relevant libraries, and add any that are needed.
4076 Say "none" for none.
4077
4078 EOM
4079 case "$libpth" in
4080 '') dflt='none';;
4081 *)
4082         set X $libpth
4083         shift
4084         dflt=${1+"$@"}
4085         ;;
4086 esac
4087 rp="Directories to use for library searches?"
4088 . ./myread
4089 case "$ans" in
4090 none) libpth=' ';;
4091 *) libpth="$ans";;
4092 esac
4093
4094 : compute shared library extension
4095 case "$so" in
4096 '')
4097         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4098                 dflt='sl'
4099         else
4100                 dflt='so'
4101         fi
4102         ;;
4103 *) dflt="$so";;
4104 esac
4105 $cat <<EOM
4106
4107 On some systems, shared libraries may be available.  Answer 'none' if
4108 you want to suppress searching of shared libraries for the remaining
4109 of this configuration.
4110
4111 EOM
4112 rp='What is the file extension used for shared libraries?'
4113 . ./myread
4114 so="$ans"
4115
4116 : Define several unixisms.
4117 : Hints files or command line option can be used to override them.
4118 : The convoluted testing is in case hints files set either the old
4119 : or the new name.
4120 case "$_exe" in
4121 '')     case "$exe_ext" in
4122     '') ;;
4123         *)      _exe="$exe_ext" ;;
4124         esac
4125         ;;
4126 esac
4127 case "$_a" in
4128 '')     case "$lib_ext" in
4129     '') _a='.a';;
4130         *)      _a="$lib_ext" ;;
4131         esac
4132         ;;
4133 esac
4134 case "$_o" in
4135 '') case "$obj_ext" in
4136         '')     _o='.o';;
4137         *)      _o="$obj_ext";;
4138         esac
4139         ;;
4140 esac
4141 case "$p_" in
4142 '') case "$path_sep" in
4143         '')     p_=':';;
4144         *)      p_="$path_sep";;
4145         esac
4146         ;;
4147 esac
4148 exe_ext=$_exe
4149 lib_ext=$_a
4150 obj_ext=$_o
4151 path_sep=$p_
4152
4153 : Which makefile gets called first.  This is used by make depend.
4154 case "$firstmakefile" in
4155 '') firstmakefile='makefile';;
4156 esac
4157
4158 cat <<EOM
4159
4160 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4161 Configure must be run with -Dusesocks.
4162
4163 Normally you do not need this and you should answer no.
4164
4165 EOM
4166 case "$usesocks" in
4167 $define|true|[yY]*)     dflt='y';;
4168 *) dflt='n';;
4169 esac
4170 rp='Build Perl for SOCKS?'
4171 . ./myread
4172 case "$ans" in
4173 y|Y)    val="$define" ;;     
4174 *)      val="$undef" ;;
4175 esac
4176 set usesocks
4177 eval $setvar
4178
4179 : Looking for optional libraries
4180 echo " "
4181 echo "Checking for optional libraries..." >&4
4182 case "$libs" in
4183 ' '|'') dflt='';;
4184 *) dflt="$libs";;
4185 esac
4186 case "$libswanted" in
4187 '') libswanted='c_s';;
4188 esac
4189 case "$usesocks" in
4190 $define)
4191         libswanted="$libswanted socks5 socks5_sh"
4192         ;;
4193 esac
4194 for thislib in $libswanted; do
4195         
4196         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4197                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4198                 echo "Found -l$thislib (shared)."
4199                 case " $dflt " in
4200                 *"-l$thislib "*);;
4201                 *) dflt="$dflt -l$thislib";;
4202                 esac
4203         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4204                 echo "Found -l$thislib (shared)."
4205                 case " $dflt " in
4206                 *"-l$thislib "*);;
4207                 *) dflt="$dflt -l$thislib";;
4208                 esac
4209         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4210                 echo "Found -l$thislib."
4211                 case " $dflt " in
4212                 *"-l$thislib "*);;
4213                 *) dflt="$dflt -l$thislib";;
4214                 esac
4215         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4216                 echo "Found -l$thislib."
4217                 case " $dflt " in
4218                 *"-l$thislib "*);;
4219                 *) dflt="$dflt -l$thislib";;
4220                 esac
4221         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4222                 echo "Found -l${thislib}_s."
4223                 case " $dflt " in
4224                 *"-l$thislib "*);;
4225                 *) dflt="$dflt -l${thislib}_s";;
4226                 esac
4227         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4228                 echo "Found -l$thislib."
4229                 case " $dflt " in
4230                 *"-l$thislib "*);;
4231                 *) dflt="$dflt -l$thislib";;
4232                 esac
4233         else
4234                 echo "No -l$thislib."
4235         fi
4236 done
4237 set X $dflt
4238 shift
4239 dflt="$*"
4240 case "$libs" in
4241 '') dflt="$dflt";;
4242 *) dflt="$libs";;
4243 esac
4244 case "$dflt" in
4245 ' '|'') dflt='none';;
4246 esac
4247
4248 $cat <<EOM
4249
4250 In order to compile $package on your machine, a number of libraries
4251 are usually needed.  Include any other special libraries here as well.
4252 Say "none" for none.  The default list is almost always right.
4253 EOM
4254
4255 echo " "
4256 rp="What libraries to use?"
4257 . ./myread
4258 case "$ans" in
4259 none) libs=' ';;
4260 *) libs="$ans";;
4261 esac
4262
4263 : determine optimization, if desired, or use for debug flag also
4264 case "$optimize" in
4265 ' '|$undef) dflt='none';;
4266 '') dflt='-O';;
4267 *) dflt="$optimize";;
4268 esac
4269 $cat <<EOH
4270
4271 By default, $package compiles with the -O flag to use the optimizer.
4272 Alternately, you might want to use the symbolic debugger, which uses
4273 the -g flag (on traditional Unix systems).  Either flag can be
4274 specified here.  To use neither flag, specify the word "none".
4275
4276 EOH
4277 rp="What optimizer/debugger flag should be used?"
4278 . ./myread
4279 optimize="$ans"
4280 case "$optimize" in
4281 'none') optimize=" ";;
4282 esac
4283
4284 dflt=''
4285 : We will not override a previous value, but we might want to
4286 : augment a hint file
4287 case "$hint" in
4288 default|recommended)
4289         case "$gccversion" in
4290         1*) dflt='-fpcc-struct-return' ;;
4291         esac
4292         case "$optimize" in
4293         *-g*) dflt="$dflt -DDEBUGGING";;
4294         esac
4295         case "$gccversion" in
4296         2*) if test -d /etc/conf/kconfig.d &&
4297                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4298                 then
4299                         dflt="$dflt -posix"
4300                 fi
4301                 ;;
4302         esac
4303         case "$gccversion" in
4304         1*) ;;
4305         2.[0-8]*) ;;
4306         ?*)     echo " "
4307                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4308                 echo 'int main(void) { return 0; }' > gcctest.c
4309                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4310                         echo "Yes, it does." 2>&1
4311                         case "$ccflags" in
4312                         *strict-aliasing*) 
4313                                 echo "Leaving current flags $ccflags alone." 2>&1
4314                                 ;;
4315                         *) dflt="$dflt -fno-strict-aliasing" ;;
4316                         esac
4317                 else
4318                         echo "Nope, it doesn't, but that's ok." 2>&1
4319                 fi
4320                 ;;
4321         esac
4322         ;;
4323 esac
4324
4325 case "$mips_type" in
4326 *BSD*|'') inclwanted="$locincpth $usrinc";;
4327 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4328 esac
4329 for thisincl in $inclwanted; do
4330         if $test -d $thisincl; then
4331                 if $test x$thisincl != x$usrinc; then
4332                         case "$dflt" in
4333                         *$thisincl*);;
4334                         *) dflt="$dflt -I$thisincl";;
4335                         esac
4336                 fi
4337         fi
4338 done
4339
4340 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4341         xxx=true;
4342 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4343         xxx=true;
4344 else
4345         xxx=false;
4346 fi;
4347 if $xxx; then
4348         case "$dflt" in
4349         *$2*);;
4350         *) dflt="$dflt -D$2";;
4351         esac;
4352 fi'
4353
4354 set signal.h LANGUAGE_C; eval $inctest
4355
4356 case "$usesocks" in
4357 $define)
4358         ccflags="$ccflags -DSOCKS"
4359         ;;
4360 esac
4361
4362 case "$hint" in
4363 default|recommended) dflt="$ccflags $dflt" ;;
4364 *) dflt="$ccflags";;
4365 esac
4366
4367 case "$dflt" in
4368 ''|' ') dflt=none;;
4369 esac
4370 $cat <<EOH
4371
4372 Your C compiler may want other flags.  For this question you should include
4373 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4374 but you should NOT include libraries or ld flags like -lwhatever.  If you
4375 want $package to honor its debug switch, you should include -DDEBUGGING here.
4376 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4377
4378 To use no flags, specify the word "none".
4379
4380 EOH
4381 set X $dflt
4382 shift
4383 dflt=${1+"$@"}
4384 rp="Any additional cc flags?"
4385 . ./myread
4386 case "$ans" in
4387 none) ccflags='';;
4388 *) ccflags="$ans";;
4389 esac
4390
4391 : the following weeds options from ccflags that are of no interest to cpp
4392 cppflags="$ccflags"
4393 case "$gccversion" in
4394 1*) cppflags="$cppflags -D__GNUC__"
4395 esac
4396 case "$mips_type" in
4397 '');;
4398 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4399 esac
4400 case "$cppflags" in
4401 '');;
4402 *)
4403         echo " "
4404         echo "Let me guess what the preprocessor flags are..." >&4
4405         set X $cppflags
4406         shift
4407         cppflags=''
4408         $cat >cpp.c <<'EOM'
4409 #define BLURFL foo
4410
4411 BLURFL xx LFRULB
4412 EOM
4413         previous=''
4414         for flag in $*
4415         do
4416                 case "$flag" in
4417                 -*) ftry="$flag";;
4418                 *) ftry="$previous $flag";;
4419                 esac
4420                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4421                         >cpp1.out 2>/dev/null && \
4422                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4423                         >cpp2.out 2>/dev/null && \
4424                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4425                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4426                 then
4427                         cppflags="$cppflags $ftry"
4428                         previous=''
4429                 else
4430                         previous="$flag"
4431                 fi
4432         done
4433         set X $cppflags
4434         shift
4435         cppflags=${1+"$@"}
4436         case "$cppflags" in
4437         *-*)  echo "They appear to be: $cppflags";;
4438         esac
4439         $rm -f cpp.c cpp?.out
4440         ;;
4441 esac
4442
4443 : flags used in final linking phase
4444 case "$ldflags" in
4445 '') if ./venix; then
4446                 dflt='-i -z'
4447         else
4448                 dflt=''
4449         fi
4450         case "$ccflags" in
4451         *-posix*) dflt="$dflt -posix" ;;
4452         esac
4453         ;;
4454 *) dflt="$ldflags";;
4455 esac
4456
4457 : Try to guess additional flags to pick up local libraries.
4458 for thislibdir in $libpth; do
4459         case " $loclibpth " in
4460         *" $thislibdir "*)
4461                 case "$dflt " in 
4462                 *"-L$thislibdir "*) ;;
4463                 *)  dflt="$dflt -L$thislibdir" ;;
4464                 esac
4465                 ;;
4466         esac
4467 done
4468
4469 case "$dflt" in
4470 '') dflt='none' ;;
4471 esac
4472
4473 $cat <<EOH
4474
4475 Your C linker may need flags.  For this question you should
4476 include -L/whatever and any other flags used by the C linker, but you
4477 should NOT include libraries like -lwhatever.
4478
4479 Make sure you include the appropriate -L/path flags if your C linker
4480 does not normally search all of the directories you specified above,
4481 namely
4482         $libpth
4483 To use no flags, specify the word "none".
4484
4485 EOH
4486
4487 rp="Any additional ld flags (NOT including libraries)?"
4488 . ./myread
4489 case "$ans" in
4490 none) ldflags='';;
4491 *) ldflags="$ans";;
4492 esac
4493 rmlist="$rmlist pdp11"
4494
4495 : coherency check
4496 echo " "
4497 echo "Checking your choice of C compiler and flags for coherency..." >&4
4498 $cat > try.c <<'EOF'
4499 #include <stdio.h>
4500 int main() { printf("Ok\n"); exit(0); }
4501 EOF
4502 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4503 shift
4504 $cat >try.msg <<'EOM'
4505 I've tried to compile and run the following simple program:
4506
4507 EOM
4508 $cat try.c >> try.msg
4509
4510 $cat >> try.msg <<EOM
4511
4512 I used the command:
4513
4514         $*
4515         ./try
4516
4517 and I got the following output:
4518
4519 EOM
4520 dflt=y
4521 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4522         if sh -c './try' >>try.msg 2>&1; then
4523                 xxx=`./try`
4524                 case "$xxx" in
4525                 "Ok") dflt=n ;;
4526                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4527                         case " $libs " in
4528                         *" -lsfio "*)
4529                                 cat >> try.msg <<'EOQS'
4530 If $libs contains -lsfio, and sfio is mis-configured, then it
4531 sometimes (apparently) runs and exits with a 0 status, but with no
4532 output!  It may have to do with sfio's use of _exit vs. exit.
4533
4534 EOQS
4535                                 rp="You have a big problem.  Shall I abort Configure"
4536                                 dflt=y
4537                                 ;;
4538                         esac
4539                         ;;
4540                 esac
4541         else
4542                 echo "The program compiled OK, but exited with status $?." >>try.msg
4543                 rp="You have a problem.  Shall I abort Configure"
4544                 dflt=y
4545         fi
4546 else
4547         echo "I can't compile the test program." >>try.msg
4548         rp="You have a BIG problem.  Shall I abort Configure"
4549         dflt=y
4550 fi
4551 case "$dflt" in
4552 y)
4553         $cat try.msg >&4
4554         case "$knowitall" in
4555         '')
4556                 echo "(The supplied flags or libraries might be incorrect.)"
4557                 ;;
4558         *) dflt=n;;
4559         esac
4560         echo " "
4561         . ./myread
4562         case "$ans" in
4563         n*|N*) ;;
4564         *)      echo "Ok.  Stopping Configure." >&4
4565                 exit 1
4566                 ;;
4567         esac
4568         ;;
4569 n) echo "OK, that should do.";;
4570 esac
4571 $rm -f try try.* core
4572
4573 : determine filename position in cpp output
4574 echo " "
4575 echo "Computing filename position in cpp output for #include directives..." >&4
4576 echo '#include <stdio.h>' > foo.c
4577 $cat >fieldn <<EOF
4578 $startsh
4579 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4580 $grep '^[       ]*#.*stdio\.h' | \
4581 while read cline; do
4582         pos=1
4583         set \$cline
4584         while $test \$# -gt 0; do
4585                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4586                         echo "\$pos"
4587                         exit 0
4588                 fi
4589                 shift
4590                 pos=\`expr \$pos + 1\`
4591         done
4592 done
4593 EOF
4594 chmod +x fieldn
4595 fieldn=`./fieldn`
4596 $rm -f foo.c fieldn
4597 case $fieldn in
4598 '') pos='???';;
4599 1) pos=first;;
4600 2) pos=second;;
4601 3) pos=third;;
4602 *) pos="${fieldn}th";;
4603 esac
4604 echo "Your cpp writes the filename in the $pos field of the line."
4605
4606 : locate header file
4607 $cat >findhdr <<EOF
4608 $startsh
4609 wanted=\$1
4610 name=''
4611 for usrincdir in $usrinc
4612 do
4613         if test -f \$usrincdir/\$wanted; then
4614                 echo "\$usrincdir/\$wanted"
4615                 exit 0
4616         fi
4617 done
4618 awkprg='{ print \$$fieldn }'
4619 echo "#include <\$wanted>" > foo\$\$.c
4620 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4621 $grep "^[       ]*#.*\$wanted" | \
4622 while read cline; do
4623         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4624         case "\$name" in
4625         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4626         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4627         *) exit 2;;
4628         esac;
4629 done;
4630 #
4631 # status = 0: grep returned 0 lines, case statement not executed
4632 # status = 1: headerfile found
4633 # status = 2: while loop executed, no headerfile found
4634 #
4635 status=\$?
4636 $rm -f foo\$\$.c;
4637 if test \$status -eq 1; then
4638         exit 0;
4639 fi
4640 exit 1
4641 EOF
4642 chmod +x findhdr
4643
4644 : define an alternate in-header-list? function
4645 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4646 cont=true; xxf="echo \"<\$1> found.\" >&4";
4647 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4648 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4649 esac;
4650 case $# in 4) instead=instead;; *) instead="at last";; esac;
4651 while $test "$cont"; do
4652         xxx=`./findhdr $1`
4653         var=$2; eval "was=\$$2";
4654         if $test "$xxx" && $test -r "$xxx";
4655         then eval $xxf;
4656         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4657                 cont="";
4658         else eval $xxnf;
4659         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4660         set $yyy; shift; shift; yyy=$@;
4661         case $# in 0) cont="";;
4662         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4663                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4664         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4665                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4666         esac;
4667 done;
4668 while $test "$yyy";
4669 do set $yyy; var=$2; eval "was=\$$2";
4670         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4671         set $yyy; shift; shift; yyy=$@;
4672 done'
4673
4674 : see if this is a malloc.h system
4675 set malloc.h i_malloc
4676 eval $inhdr
4677
4678 : see if stdlib is available
4679 set stdlib.h i_stdlib
4680 eval $inhdr
4681
4682 : determine which malloc to compile in
4683 echo " "
4684 case "$usemymalloc" in
4685 ''|[yY]*|true|$define)  dflt='y' ;;
4686 *)      dflt='n' ;;
4687 esac
4688 rp="Do you wish to attempt to use the malloc that comes with $package?"
4689 . ./myread
4690 usemymalloc="$ans"
4691 case "$ans" in
4692 y*|true)
4693         usemymalloc='y'
4694         mallocsrc='malloc.c'
4695         mallocobj="malloc$_o"
4696         d_mymalloc="$define"
4697         case "$libs" in
4698         *-lmalloc*)
4699                 : Remove malloc from list of libraries to use
4700                 echo "Removing unneeded -lmalloc from library list" >&4
4701                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4702                 shift
4703                 libs="$*"
4704                 echo "libs = $libs" >&4
4705                 ;;
4706         esac
4707         ;;
4708 *)
4709         usemymalloc='n'
4710         mallocsrc=''
4711         mallocobj=''
4712         d_mymalloc="$undef"
4713         ;;
4714 esac
4715
4716 : compute the return types of malloc and free
4717 echo " "
4718 $cat >malloc.c <<END
4719 #$i_malloc I_MALLOC
4720 #$i_stdlib I_STDLIB
4721 #include <stdio.h>
4722 #include <sys/types.h>
4723 #ifdef I_MALLOC
4724 #include <malloc.h>
4725 #endif
4726 #ifdef I_STDLIB
4727 #include <stdlib.h>
4728 #endif
4729 #ifdef TRY_MALLOC
4730 void *malloc();
4731 #endif
4732 #ifdef TRY_FREE
4733 void free();
4734 #endif
4735 END
4736 case "$malloctype" in
4737 '')
4738         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4739                 malloctype='void *'
4740         else
4741                 malloctype='char *'
4742         fi
4743         ;;
4744 esac
4745 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4746
4747 case "$freetype" in
4748 '')
4749         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4750                 freetype='void'
4751         else
4752                 freetype='int'
4753         fi
4754         ;;
4755 esac
4756 echo "Your system uses $freetype free(), it would seem." >&4
4757 $rm -f malloc.[co]
4758 $cat <<EOM
4759
4760 The installation process will also create a directory for
4761 vendor-supplied add-ons.  Vendors who supply perl with their system
4762 may find it convenient to place all vendor-supplied files in this
4763 directory rather than in the main distribution directory.  This will
4764 ease upgrades between binary-compatible maintenance versions of perl.
4765
4766 Of course you may also use these directories in whatever way you see
4767 fit.  For example, you might use them to access modules shared over a
4768 company-wide network.
4769
4770 The default answer should be fine for most people.
4771 This causes further questions about vendor add-ons to be skipped
4772 and no vendor-specific directories will be configured for perl.
4773
4774 EOM
4775 rp='Do you want to configure vendor-specific add-on directories?'
4776 case "$usevendorprefix" in
4777 define|true|[yY]*) dflt=y ;;
4778 *) dflt=n ;;
4779 esac
4780 . ./myread
4781 case "$ans" in
4782 [yY]*)  fn=d~+
4783         rp='Installation prefix to use for vendor-supplied add-ons?'
4784         case "$vendorprefix" in
4785         '') dflt='' ;;
4786         *)  dflt=$vendorprefix ;;
4787         esac
4788         . ./getfile
4789         oldvendorprefix=''
4790         case "$vendorprefix" in
4791         '') ;;
4792         *)      case "$ans" in
4793                 "$prefix") ;;
4794                 *) oldvendorprefix="$prefix";;
4795                 esac
4796                 ;;
4797         esac
4798         usevendorprefix="$define"
4799         vendorprefix="$ans"
4800         vendorprefixexp="$ansexp"
4801         ;;
4802 *)      usevendorprefix="$undef"
4803         vendorprefix=''
4804         vendorprefixexp=''
4805         ;;
4806 esac
4807
4808 case "$vendorprefix" in
4809 '')     d_vendorlib="$undef"
4810         vendorlib=''
4811         vendorlibexp=''
4812         ;;
4813 *)      d_vendorlib="$define"
4814         : determine where vendor-supplied modules go.
4815         : Usual default is /usr/local/lib/perl5/vendor_perl
4816         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4817         case "$installstyle" in
4818         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4819         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4820         esac
4821         fn=d~+
4822         rp='Pathname for the vendor-supplied library files?'
4823         . ./getfile
4824         vendorlib="$ans"
4825         vendorlibexp="$ansexp"
4826         : Change installation prefix, if necessary.
4827         if $test X"$prefix" != X"$installprefix"; then
4828                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4829         else
4830                 installvendorlib="$vendorlibexp"
4831         fi
4832         ;;
4833 esac
4834
4835 : Cruising for prototypes
4836 echo " "
4837 echo "Checking out function prototypes..." >&4
4838 $cat >prototype.c <<'EOCP'
4839 int main(int argc, char *argv[]) {
4840         exit(0);}
4841 EOCP
4842 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4843         echo "Your C compiler appears to support function prototypes."
4844         val="$define"
4845 else
4846         echo "Your C compiler doesn't seem to understand function prototypes."
4847         val="$undef"
4848 fi
4849 set prototype
4850 eval $setvar
4851 $rm -f prototype*
4852
4853 case "$prototype" in
4854 "$define") ;;
4855 *)      ansi2knr='ansi2knr'
4856         echo " "
4857         cat <<EOM >&4
4858
4859 $me:  FATAL ERROR:
4860 This version of $package can only be compiled by a compiler that 
4861 understands function prototypes.  Unfortunately, your C compiler 
4862         $cc $ccflags
4863 doesn't seem to understand them.  Sorry about that.
4864
4865 If GNU cc is available for your system, perhaps you could try that instead.  
4866
4867 Eventually, we hope to support building Perl with pre-ANSI compilers.
4868 If you would like to help in that effort, please contact <perlbug@perl.org>.
4869
4870 Aborting Configure now.
4871 EOM
4872         exit 2
4873         ;;
4874 esac
4875
4876 : determine where public executables go
4877 echo " "
4878 set dflt bin bin
4879 eval $prefixit
4880 fn=d~
4881 rp='Pathname where the public executables will reside?'
4882 . ./getfile
4883 if $test "X$ansexp" != "X$binexp"; then
4884         installbin=''
4885 fi
4886 bin="$ans"
4887 binexp="$ansexp"
4888 : Change installation prefix, if necessary.
4889 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4890 if $test X"$prefix" != X"$installprefix"; then
4891         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4892 else
4893         installbin="$binexp"
4894 fi
4895
4896 : determine whether to install perl also as /usr/bin/perl
4897
4898 echo " "
4899 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4900         $cat <<EOM
4901 Many scripts expect to perl to be installed as /usr/bin/perl.
4902 I can install the perl you are about to compile also as /usr/bin/perl
4903 (in addition to $installbin/perl).
4904 EOM
4905         case "$installusrbinperl" in
4906         "$undef"|[nN]*) dflt='n';;
4907         *)              dflt='y';;
4908         esac
4909         rp="Do you want to install perl as /usr/bin/perl?"
4910         . ./myread
4911         case "$ans" in
4912         [yY]*)  val="$define";;
4913         *)      val="$undef" ;;
4914         esac
4915 else
4916         val="$undef"
4917 fi
4918 set installusrbinperl
4919 eval $setvar
4920
4921 : define a shorthand compile call
4922 compile='
4923 mc_file=$1;
4924 shift;
4925 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4926 : define a shorthand compile call for compilations that should be ok.
4927 compile_ok='
4928 mc_file=$1;
4929 shift;
4930 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4931
4932 echo " "
4933 echo "Checking for GNU C Library..." >&4
4934 cat >gnulibc.c <<EOM
4935 #include <stdio.h>
4936 int main()
4937 {
4938 #ifdef __GLIBC__
4939     exit(0);
4940 #else
4941     exit(1);
4942 #endif
4943 }
4944 EOM
4945 set gnulibc
4946 if eval $compile_ok && ./gnulibc; then
4947         val="$define"
4948         echo "You are using the GNU C Library"
4949 else
4950         val="$undef"
4951         echo "You are not using the GNU C Library"
4952 fi
4953 $rm -f gnulibc*
4954 set d_gnulibc
4955 eval $setvar
4956
4957 : see if nm is to be used to determine whether a symbol is defined or not
4958 case "$usenm" in
4959 '')
4960         dflt=''
4961         case "$d_gnulibc" in
4962         "$define")
4963                 echo " "
4964                 echo "nm probably won't work on the GNU C Library." >&4
4965                 dflt=n
4966                 ;;
4967         esac
4968         case "$dflt" in
4969         '') 
4970                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4971                         echo " "
4972                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4973                         echo "'nm' won't be sufficient on this sytem." >&4
4974                         dflt=n
4975                 fi
4976                 ;;
4977         esac
4978         case "$dflt" in
4979         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4980                 if $test $dflt -gt 20; then
4981                         dflt=y
4982                 else
4983                         dflt=n
4984                 fi
4985                 ;;
4986         esac
4987         ;;
4988 *)
4989         case "$usenm" in
4990         true|$define) dflt=y;;
4991         *) dflt=n;;
4992         esac
4993         ;;
4994 esac
4995 $cat <<EOM
4996
4997 I can use $nm to extract the symbols from your C libraries. This
4998 is a time consuming task which may generate huge output on the disk (up
4999 to 3 megabytes) but that should make the symbols extraction faster. The
5000 alternative is to skip the 'nm' extraction part and to compile a small
5001 test program instead to determine whether each symbol is present. If
5002 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5003 this may be the best solution.
5004
5005 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5006
5007 EOM
5008 rp="Shall I use $nm to extract C symbols from the libraries?"
5009 . ./myread
5010 case "$ans" in
5011 [Nn]*) usenm=false;;
5012 *) usenm=true;;
5013 esac
5014
5015 runnm=$usenm
5016 case "$reuseval" in
5017 true) runnm=false;;
5018 esac
5019
5020 : nm options which may be necessary
5021 case "$nm_opt" in
5022 '') if $test -f /mach_boot; then
5023                 nm_opt=''       # Mach
5024         elif $test -d /usr/ccs/lib; then
5025                 nm_opt='-p'     # Solaris (and SunOS?)
5026         elif $test -f /dgux; then
5027                 nm_opt='-p'     # DG-UX
5028         elif $test -f /lib64/rld; then
5029                 nm_opt='-p'     # 64-bit Irix
5030         else
5031                 nm_opt=''
5032         fi;;
5033 esac
5034
5035 : nm options which may be necessary for shared libraries but illegal
5036 : for archive libraries.  Thank you, Linux.
5037 case "$nm_so_opt" in
5038 '')     case "$myuname" in
5039         *linux*)
5040                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5041                         nm_so_opt='--dynamic'
5042                 fi
5043                 ;;
5044         esac
5045         ;;
5046 esac
5047
5048 case "$runnm" in
5049 true)
5050 : get list of predefined functions in a handy place
5051 echo " "
5052 case "$libc" in
5053 '') libc=unknown
5054         case "$libs" in
5055         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5056         esac
5057         ;;
5058 esac
5059 libnames='';
5060 case "$libs" in
5061 '') ;;
5062 *)  for thislib in $libs; do
5063         case "$thislib" in
5064         -lc|-lc_s)
5065                 : Handle C library specially below.
5066                 ;;
5067         -l*)
5068                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5069                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5070                         :
5071                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5072                         :
5073                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5074                         :
5075                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5076                         :
5077                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5078                         :
5079                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5080                         :
5081                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5082                         :
5083                 else
5084                         try=''
5085                 fi
5086                 libnames="$libnames $try"
5087                 ;;
5088         *) libnames="$libnames $thislib" ;;
5089         esac
5090         done
5091         ;;
5092 esac
5093 xxx=normal
5094 case "$libc" in
5095 unknown)
5096         set /lib/libc.$so
5097         for xxx in $libpth; do
5098                 $test -r $1 || set $xxx/libc.$so
5099                 : The messy sed command sorts on library version numbers.
5100                 $test -r $1 || \
5101                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5102                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5103                                 h
5104                                 s/[0-9][0-9]*/0000&/g
5105                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5106                                 G
5107                                 s/\n/ /' | \
5108                          sort | $sed -e 's/^.* //'`
5109                 eval set \$$#
5110         done
5111         $test -r $1 || set /usr/ccs/lib/libc.$so
5112         $test -r $1 || set /lib/libsys_s$_a
5113         ;;
5114 *)
5115         set blurfl
5116         ;;
5117 esac
5118 if $test -r "$1"; then
5119         echo "Your (shared) C library seems to be in $1."
5120         libc="$1"
5121 elif $test -r /lib/libc && $test -r /lib/clib; then
5122         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5123         xxx=apollo
5124         libc='/lib/clib /lib/libc'
5125         if $test -r /lib/syslib; then
5126                 echo "(Your math library is in /lib/syslib.)"
5127                 libc="$libc /lib/syslib"
5128         fi
5129 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5130         echo "Your C library seems to be in $libc, as you said before."
5131 elif $test -r $incpath/usr/lib/libc$_a; then
5132         libc=$incpath/usr/lib/libc$_a;
5133         echo "Your C library seems to be in $libc.  That's fine."
5134 elif $test -r /lib/libc$_a; then
5135         libc=/lib/libc$_a;
5136         echo "Your C library seems to be in $libc.  You're normal."
5137 else
5138         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5139                 :
5140         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5141                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5142         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5143                 :
5144         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5145                 :
5146         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5147                 :
5148         else
5149                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5150         fi
5151         if $test -r "$tans"; then
5152                 echo "Your C library seems to be in $tans, of all places."
5153                 libc=$tans
5154         else
5155                 libc='blurfl'
5156         fi
5157 fi
5158 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5159         dflt="$libc"
5160         cat <<EOM
5161
5162 If the guess above is wrong (which it might be if you're using a strange
5163 compiler, or your machine supports multiple models), you can override it here.
5164
5165 EOM
5166 else
5167         dflt=''
5168         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5169         cat >&4 <<EOM
5170 I can't seem to find your C library.  I've looked in the following places:
5171
5172 EOM
5173         $sed 's/^/      /' libpath
5174         cat <<EOM
5175
5176 None of these seems to contain your C library. I need to get its name...
5177
5178 EOM
5179 fi
5180 fn=f
5181 rp='Where is your C library?'
5182 . ./getfile
5183 libc="$ans"
5184
5185 echo " "
5186 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5187 set X `cat libnames`
5188 shift
5189 xxx=files
5190 case $# in 1) xxx=file; esac
5191 echo "Extracting names from the following $xxx for later perusal:" >&4
5192 echo " "
5193 $sed 's/^/      /' libnames >&4
5194 echo " "
5195 $echo $n "This may take a while...$c" >&4
5196
5197 for file in $*; do
5198         case $file in
5199         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5200         *) $nm $nm_opt $file 2>/dev/null;;
5201         esac
5202 done >libc.tmp
5203
5204 $echo $n ".$c"
5205 $grep fprintf libc.tmp > libc.ptf
5206 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5207 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5208 xxx='[ADTSIW]'
5209 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5210         eval $xscan;\
5211         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5212                 eval $xrun
5213 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5214         eval $xscan;\
5215         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5216                 eval $xrun
5217 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5218         eval $xscan;\
5219         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5220                 eval $xrun
5221 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5222         eval $xscan;\
5223         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5224                 eval $xrun
5225 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5226         eval $xscan;\
5227         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5228                 eval $xrun
5229 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5230         eval $xscan;\
5231         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5232                 eval $xrun
5233 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5234                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5235         eval $xscan;\
5236         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5237                 eval $xrun
5238 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5239         eval $xscan;\
5240         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5241                 eval $xrun
5242 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5243         eval $xscan;\
5244         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5245                 eval $xrun
5246 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5247         eval $xscan;\
5248         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5249                 eval $xrun
5250 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5251         eval $xscan;\
5252         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5253                 eval $xrun
5254 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5255         eval $xscan;\
5256         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5257                 eval $xrun
5258 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5259         eval $xscan;\
5260         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5261                 eval $xrun
5262 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5263         eval $xscan;\
5264         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5265                 eval $xrun
5266 else
5267         $nm -p $* 2>/dev/null >libc.tmp
5268         $grep fprintf libc.tmp > libc.ptf
5269         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5270                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5271         then
5272                 nm_opt='-p'
5273                 eval $xrun
5274         else
5275                 echo " "
5276                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5277                 com=''
5278                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5279                         for thisname in $libnames $libc; do
5280                                 $ar t $thisname >>libc.tmp
5281                         done
5282                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5283                         echo "Ok." >&4
5284                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5285                         # Repeat libc to extract forwarders to DLL entries too
5286                         for thisname in $libnames $libc; do
5287                                 $ar tv $thisname >>libc.tmp
5288                                 # Revision 50 of EMX has bug in $ar.
5289                                 # it will not extract forwarders to DLL entries
5290                                 # Use emximp which will extract exactly them.
5291                                 emximp -o tmp.imp $thisname \
5292                                     2>/dev/null && \
5293                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5294                                     < tmp.imp >>libc.tmp
5295                                 $rm tmp.imp
5296                         done
5297                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5298                         echo "Ok." >&4
5299                 else
5300                         echo "$ar didn't seem to work right." >&4
5301                         echo "Maybe this is a Cray...trying bld instead..." >&4
5302                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5303                         then
5304                                 for thisname in $libnames; do
5305                                         bld t $libnames | \
5306                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5307                                         $ar t $thisname >>libc.tmp
5308                                 done
5309                                 echo "Ok." >&4
5310                         else
5311                                 echo "That didn't work either.  Giving up." >&4
5312                                 exit 1
5313                         fi
5314                 fi
5315         fi
5316 fi
5317 nm_extract="$com"
5318 if $test -f /lib/syscalls.exp; then
5319         echo " "
5320         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5321         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5322 fi
5323 ;;
5324 esac
5325 $rm -f libnames libpath
5326
5327 : see if dld is available
5328 set dld.h i_dld
5329 eval $inhdr
5330
5331 : is a C symbol defined?
5332 csym='tlook=$1;
5333 case "$3" in
5334 -v) tf=libc.tmp; tc=""; tdc="";;
5335 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5336 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5337 esac;
5338 tx=yes;
5339 case "$reuseval-$4" in
5340 true-) ;;
5341 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5342 esac;
5343 case "$tx" in
5344 yes)
5345         case "$runnm" in
5346         true)
5347                 if $contains $tlook $tf >/dev/null 2>&1;
5348                 then tval=true;
5349                 else tval=false;
5350                 fi;;
5351         *)
5352                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5353                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5354                 then tval=true;
5355                 else tval=false;
5356                 fi;
5357                 $rm -f t t.c;;
5358         esac;;
5359 *)
5360         case "$tval" in
5361         $define) tval=true;;
5362         *) tval=false;;
5363         esac;;
5364 esac;
5365 eval "$2=$tval"'
5366
5367 : define an is-in-libc? function
5368 inlibc='echo " "; td=$define; tu=$undef;
5369 sym=$1; var=$2; eval "was=\$$2";
5370 tx=yes;
5371 case "$reuseval$was" in
5372 true) ;;
5373 true*) tx=no;;
5374 esac;
5375 case "$tx" in
5376 yes)
5377         set $sym tres -f;
5378         eval $csym;
5379         case "$tres" in
5380         true)
5381                 echo "$sym() found." >&4;
5382                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5383         *)
5384                 echo "$sym() NOT found." >&4;
5385                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5386         esac;;
5387 *)
5388         case "$was" in
5389         $define) echo "$sym() found." >&4;;
5390         *) echo "$sym() NOT found." >&4;;
5391         esac;;
5392 esac'
5393
5394 : see if dlopen exists
5395 xxx_runnm="$runnm"
5396 runnm=false
5397 set dlopen d_dlopen
5398 eval $inlibc
5399 runnm="$xxx_runnm"
5400
5401 : determine which dynamic loading, if any, to compile in
5402 echo " "
5403 dldir="ext/DynaLoader"
5404 case "$usedl" in
5405 $define|y|true)
5406         dflt='y'
5407         usedl="$define"
5408         ;;
5409 $undef|n|false)
5410         dflt='n'
5411         usedl="$undef"
5412         ;;
5413 *) 
5414         dflt='n'
5415         case "$d_dlopen" in
5416             $define) dflt='y' ;;
5417         esac
5418         case "$i_dld" in
5419             $define) dflt='y' ;;
5420         esac
5421         : Does a dl_xxx.xs file exist for this operating system
5422         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5423         ;;
5424 esac
5425 rp="Do you wish to use dynamic loading?"
5426 . ./myread
5427 usedl="$ans"
5428 case "$ans" in
5429 y*) usedl="$define"
5430         case "$dlsrc" in
5431         '')
5432                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5433                         dflt="$dldir/dl_${osname}.xs"
5434                 elif $test "$d_dlopen" = "$define" ; then
5435                         dflt="$dldir/dl_dlopen.xs"
5436                 elif $test "$i_dld" = "$define" ; then
5437                         dflt="$dldir/dl_dld.xs"
5438                 else
5439                         dflt=''
5440                 fi
5441                 ;;
5442         *)      dflt="$dldir/$dlsrc"
5443                 ;;
5444         esac
5445     echo "The following dynamic loading files are available:"
5446         : Can not go over to $dldir because getfile has path hard-coded in.
5447         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5448         rp="Source file to use for dynamic loading"
5449         fn="fne"
5450         gfpth="$src"
5451         . ./getfile
5452         usedl="$define"
5453         : emulate basename
5454         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5455
5456         $cat << EOM
5457
5458 Some systems may require passing special flags to $cc -c to
5459 compile modules that will be used to create a shared library.
5460 To use no flags, say "none".
5461
5462 EOM
5463     case "$cccdlflags" in
5464     '') case "$gccversion" in
5465                 '') case "$osname" in
5466                         hpux)   dflt='+z' ;;
5467                         next)   dflt='none' ;;
5468                         irix*)  dflt='-KPIC' ;;
5469                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5470                         sunos)  dflt='-pic' ;;
5471                         *)      dflt='none' ;;
5472                     esac
5473                         ;;
5474                 *)  case "$osname" in
5475                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5476                         *)      dflt='-fpic' ;;
5477                     esac ;;
5478             esac ;;
5479         ' ') dflt='none' ;;
5480     *)  dflt="$cccdlflags" ;;
5481     esac
5482     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5483     . ./myread
5484     case "$ans" in
5485     none) cccdlflags=' ' ;;
5486     *) cccdlflags="$ans" ;;
5487     esac
5488
5489     cat << EOM
5490
5491 Some systems use ld to create libraries that can be dynamically loaded,
5492 while other systems (such as those using ELF) use $cc.
5493
5494 EOM
5495         case "$ld" in
5496         '')     $cat >try.c <<'EOM'
5497 /* Test for whether ELF binaries are produced */
5498 #include <fcntl.h>
5499 #include <stdlib.h>
5500 int main() {
5501         char b[4];
5502         int i = open("a.out",O_RDONLY);
5503         if(i == -1) 
5504                 exit(1); /* fail */
5505         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5506                 exit(0); /* succeed (yes, it's ELF) */
5507         else
5508                 exit(1); /* fail */
5509 }
5510 EOM
5511                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5512                         cat <<EOM
5513 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5514 EOM
5515                         dflt="$cc"
5516                 else
5517                         echo "I'll use ld to build dynamic libraries."
5518                         dflt='ld'
5519                 fi
5520                 rm -f try.c a.out
5521                 ;;
5522         *)      dflt="$ld"
5523                 ;;
5524         esac
5525
5526     rp="What command should be used to create dynamic libraries?"
5527     . ./myread
5528         ld="$ans"
5529
5530     cat << EOM
5531
5532 Some systems may require passing special flags to $ld to create a
5533 library that can be dynamically loaded.  If your ld flags include
5534 -L/other/path options to locate libraries outside your loader's normal
5535 search path, you may need to specify those -L options here as well.  To
5536 use no flags, say "none".
5537
5538 EOM
5539     case "$lddlflags" in
5540     '') case "$osname" in
5541                         beos) dflt='-nostart' ;;
5542                         hpux)  dflt='-b' ;;
5543                         linux|irix*)    dflt='-shared' ;;
5544                         next)  dflt='none' ;;
5545                         solaris) dflt='-G' ;;
5546                         sunos) dflt='-assert nodefinitions' ;;
5547                         svr4*|esix*) dflt="-G $ldflags" ;;
5548                 *)     dflt='none' ;;
5549                         esac
5550                         ;;
5551     *) dflt="$lddlflags" ;;
5552     esac
5553
5554         : Try to guess additional flags to pick up local libraries.
5555         : Be careful not to append to a plain 'none'
5556         case "$dflt" in
5557         none) dflt='' ;;
5558         esac
5559         for thisflag in $ldflags; do
5560                 case "$thisflag" in
5561                 -L*)
5562                         case " $dflt " in
5563                         *" $thisflag "*) ;;
5564                         *) dflt="$dflt $thisflag" ;;
5565                         esac
5566                         ;;
5567                 esac
5568         done
5569
5570         case "$dflt" in
5571         ''|' ') dflt='none' ;;
5572         esac
5573
5574     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5575     . ./myread
5576     case "$ans" in
5577     none) lddlflags=' ' ;;
5578     *) lddlflags="$ans" ;;
5579     esac
5580
5581         cat <<EOM
5582
5583 Some systems may require passing special flags to $cc to indicate that
5584 the resulting executable will use dynamic linking.  To use no flags,
5585 say "none".
5586
5587 EOM
5588     case "$ccdlflags" in
5589     '') case "$osname" in
5590                 hpux)   dflt='-Wl,-E' ;;
5591                 linux)  dflt='-rdynamic' ;;
5592                 next)   dflt='none' ;;
5593                 sunos)  dflt='none' ;;
5594                 *)      dflt='none' ;;
5595             esac ;;
5596     ' ')  dflt='none' ;;
5597     *)  dflt="$ccdlflags" ;;
5598     esac
5599     rp="Any special flags to pass to $cc to use dynamic loading?"
5600     . ./myread
5601     case "$ans" in
5602     none) ccdlflags=' ' ;;
5603     *) ccdlflags="$ans" ;;
5604     esac
5605     ;;
5606 *)  usedl="$undef"
5607         ld='ld'
5608     dlsrc='dl_none.xs'
5609     lddlflags=''
5610     ccdlflags=''
5611     ;;
5612 esac
5613
5614 also=''
5615 case "$usedl" in
5616 $undef)
5617         # No dynamic loading being used, so don't bother even to prompt.
5618         useshrplib='false'
5619         ;;
5620 *)      case "$useshrplib" in
5621         '')     case "$osname" in
5622                 svr4*|dgux|dynixptx|esix|powerux|beos)
5623                         dflt=y
5624                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5625                         ;;
5626                 next*)
5627                         case "$osvers" in
5628                         4*)     dflt=y
5629                                 also='Building a shared libperl is needed for MAB support.'
5630                                 ;;
5631                         *)      dflt=n
5632                                 ;;
5633                         esac
5634                         ;;
5635                 *)      dflt=n
5636                         ;;
5637                 esac
5638                 ;;
5639         $define|true|[Yy]*)
5640                 dflt=y
5641                 ;;
5642         *)      dflt=n
5643                 ;;
5644         esac
5645         $cat << EOM
5646
5647 The perl executable is normally obtained by linking perlmain.c with
5648 libperl${_a}, any static extensions (usually just DynaLoader), and
5649 any other libraries needed on this system (such as -lm, etc.).  Since
5650 your system supports dynamic loading, it is probably possible to build
5651 a shared libperl.$so.  If you will have more than one executable linked
5652 to libperl.$so, this will significantly reduce the size of each
5653 executable, but it may have a noticeable affect on performance.  The
5654 default is probably sensible for your system.
5655 $also
5656
5657 EOM
5658         rp="Build a shared libperl.$so (y/n)"
5659         . ./myread
5660         case "$ans" in
5661         true|$define|[Yy]*)
5662                 useshrplib='true'  ;;
5663         *)      useshrplib='false' ;;
5664         esac
5665         ;;
5666 esac
5667
5668 case "$useshrplib" in
5669 true)
5670         case "$libperl" in
5671         '')
5672                 # Figure out a good name for libperl.so.  Since it gets stored in
5673                 # a version-specific architecture-dependent library, the version
5674                 # number isn't really that important, except for making cc/ld happy.
5675                 #
5676                 # A name such as libperl.so.3.1
5677                 majmin="libperl.$so.$patchlevel.$subversion"
5678                 # A name such as libperl.so.301
5679                 majonly=`echo $patchlevel $subversion |
5680                         $awk '{printf "%d%02d", $1, $2}'`
5681                 majonly=libperl.$so.$majonly
5682                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5683                 # rely on figuring it out from the naming of libc.
5684                 case "${osname}${osvers}" in
5685                 next4*)
5686                         dflt=libperl.5.$so
5687                         # XXX How handle the --version stuff for MAB?
5688                         ;;
5689                 linux*)  # ld won't link with a bare -lperl otherwise.
5690                         dflt=libperl.$so
5691                         ;;
5692                 *)      # Try to guess based on whether libc has major.minor.
5693                         case "$libc" in
5694                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5695                         *libc.$so.[0-9]*) dflt=$majonly ;;
5696                         *)      dflt=libperl.$so ;;
5697                         esac
5698                         ;;
5699                 esac
5700                 ;;
5701         *)      dflt=$libperl
5702                 ;;
5703         esac
5704         cat << EOM
5705
5706 I need to select a good name for the shared libperl.  If your system uses
5707 library names with major and minor numbers, then you might want something
5708 like $majmin.  Alternatively, if your system uses a single version
5709 number for shared libraries, then you might want to use $majonly.
5710 Or, your system might be quite happy with a simple libperl.$so.
5711
5712 Since the shared libperl will get installed into a version-specific
5713 architecture-dependent directory, the version number of the shared perl
5714 library probably isn't important, so the default should be o.k.
5715
5716 EOM
5717         rp='What name do you want to give to the shared libperl?'
5718         . ./myread
5719         libperl=$ans
5720         echo "Ok, I'll use $libperl"
5721         ;;
5722 *)
5723         libperl="libperl${_a}"
5724         ;;
5725 esac
5726
5727 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5728 case "$shrpdir" in
5729 '') ;;
5730 *)      $cat >&4 <<EOM
5731 WARNING:  Use of the shrpdir variable for the installation location of
5732 the shared $libperl is not supported.  It was never documented and
5733 will not work in this version.  Let me (perlbug@perl.com)
5734 know of any problems this may cause.
5735
5736 EOM
5737         case "$shrpdir" in
5738         "$archlibexp/CORE")
5739                 $cat >&4 <<EOM
5740 But your current setting of $shrpdir is
5741 the default anyway, so it's harmless.
5742 EOM
5743                 ;;
5744         *)
5745                 $cat >&4 <<EOM
5746 Further, your current attempted setting of $shrpdir
5747 conflicts with the value of $archlibexp/CORE
5748 that installperl will use.
5749 EOM
5750                 ;;
5751         esac
5752         ;;
5753 esac
5754
5755 # How will the perl executable find the installed shared $libperl?
5756 # Add $xxx to ccdlflags.
5757 # If we can't figure out a command-line option, use $shrpenv to
5758 # set env LD_RUN_PATH.  The main perl makefile uses this.
5759 shrpdir=$archlibexp/CORE
5760 xxx=''
5761 tmp_shrpenv=''
5762 if "$useshrplib"; then
5763     case "$osname" in 
5764         aix)
5765                 # We'll set it in Makefile.SH...
5766                 ;;
5767         solaris|netbsd)
5768                 xxx="-R $shrpdir"
5769                 ;;
5770         freebsd)
5771                 xxx="-Wl,-R$shrpdir"
5772                 ;;
5773         linux|irix*|dec_osf)
5774                 xxx="-Wl,-rpath,$shrpdir"
5775                 ;;
5776         next)
5777                 # next doesn't like the default...
5778                 ;;
5779         beos)
5780                 # beos doesn't like the default, either.
5781                 ;;
5782         hpux*)
5783                 # hpux doesn't like the default, either.
5784                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5785                 ;;
5786         *)
5787                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5788                 ;;
5789         esac
5790         case "$xxx" in
5791         '') ;;
5792         *)      
5793                 # Only add $xxx if it isn't already in ccdlflags.
5794                 case " $ccdlflags " in
5795                 *" $xxx "*)     ;;
5796                 *)      ccdlflags="$ccdlflags $xxx"
5797                         cat <<EOM >&4
5798
5799 Adding $xxx to the flags
5800 passed to $ld so that the perl executable will find the 
5801 installed shared $libperl.
5802
5803 EOM
5804                         ;;
5805                 esac
5806                 ;;
5807         esac
5808 fi
5809 # Fix ccdlflags in AIX for building external extensions.
5810 # (For building Perl itself bare -bE:perl.exp is needed,
5811 #  Makefile.SH takes care of this.)
5812 case "$osname" in
5813 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5814 esac
5815 # Respect a hint or command-line value.
5816 case "$shrpenv" in
5817 '') shrpenv="$tmp_shrpenv" ;;
5818 esac
5819 case "$ldlibpthname" in
5820 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5821 none)   ldlibpthname='' ;;
5822 esac
5823
5824 : determine where manual pages go
5825 set man1dir man1dir none
5826 eval $prefixit
5827 $cat <<EOM
5828
5829 $spackage has manual pages available in source form.
5830 EOM
5831 case "$nroff" in
5832 nroff)
5833         echo "However, you don't have nroff, so they're probably useless to you."
5834         case "$man1dir" in
5835         '') man1dir="none";;
5836         esac;;
5837 esac
5838 echo "If you don't want the manual sources installed, answer 'none'."
5839 case "$man1dir" in
5840 ' ') dflt=none
5841         ;;
5842 '')
5843         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5844         lookpath="$lookpath $prefixexp/man/p_man/man1"
5845         lookpath="$lookpath $prefixexp/man/u_man/man1"
5846         lookpath="$lookpath $prefixexp/man/man.1"
5847         case "$sysman" in
5848         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5849         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5850         esac
5851         set dflt
5852         eval $prefixup
5853         ;;
5854 *)  dflt="$man1dir"
5855         ;;
5856 esac
5857 echo " "
5858 fn=dn+~
5859 rp="Where do the main $spackage manual pages (source) go?"
5860 . ./getfile
5861 if $test "X$man1direxp" != "X$ansexp"; then
5862         installman1dir=''
5863 fi
5864 man1dir="$ans"
5865 man1direxp="$ansexp"
5866 case "$man1dir" in
5867 '')     man1dir=' '
5868         installman1dir='';;
5869 esac
5870
5871 : Change installation prefix, if necessary.
5872 if $test X"$prefix" != X"$installprefix"; then
5873         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5874 else
5875         installman1dir="$man1direxp"
5876 fi
5877
5878 : What suffix to use on installed man pages
5879
5880 case "$man1dir" in
5881 ' ')
5882         man1ext='0'
5883         ;;
5884 *)
5885         rp="What suffix should be used for the main $spackage man pages?"
5886         case "$man1ext" in
5887         '')     case "$man1dir" in
5888                 *1)  dflt=1 ;;
5889                 *1p) dflt=1p ;;
5890                 *1pm) dflt=1pm ;;
5891                 *l) dflt=l;;
5892                 *n) dflt=n;;
5893                 *o) dflt=o;;
5894                 *p) dflt=p;;
5895                 *C) dflt=C;;
5896                 *L) dflt=L;;
5897                 *L1) dflt=L1;;
5898                 *) dflt=1;;
5899                 esac
5900                 ;;
5901         *)      dflt="$man1ext";;
5902         esac
5903         . ./myread
5904         man1ext="$ans"
5905         ;;
5906 esac
5907
5908 : see if we can have long filenames
5909 echo " "
5910 rmlist="$rmlist /tmp/cf$$"
5911 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5912 first=123456789abcdef
5913 second=/tmp/cf$$/$first
5914 $rm -f $first $second
5915 if (echo hi >$first) 2>/dev/null; then
5916         if $test -f 123456789abcde; then
5917                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5918                 val="$undef"
5919         else
5920                 if (echo hi >$second) 2>/dev/null; then
5921                         if $test -f /tmp/cf$$/123456789abcde; then
5922                                 $cat <<'EOM'
5923 That's peculiar... You can have filenames longer than 14 characters, but only
5924 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5925 I shall consider your system cannot support long filenames at all.
5926 EOM
5927                                 val="$undef"
5928                         else
5929                                 echo 'You can have filenames longer than 14 characters.' >&4
5930                                 val="$define"
5931                         fi
5932                 else
5933                         $cat <<'EOM'
5934 How confusing! Some of your filesystems are sane enough to allow filenames
5935 longer than 14 characters but some others like /tmp can't even think about them.
5936 So, for now on, I shall assume your kernel does not allow them at all.
5937 EOM
5938                         val="$undef"
5939                 fi
5940         fi
5941 else
5942         $cat <<'EOM'
5943 You can't have filenames longer than 14 chars.  You can't even think about them!
5944 EOM
5945         val="$undef"
5946 fi 
5947 set d_flexfnam
5948 eval $setvar
5949 $rm -rf /tmp/cf$$ 123456789abcde*
5950
5951 : determine where library module manual pages go
5952 set man3dir man3dir none
5953 eval $prefixit
5954 $cat <<EOM
5955
5956 $spackage has manual pages for many of the library modules.
5957 EOM
5958
5959 case "$nroff" in
5960 nroff)
5961         $cat <<'EOM'
5962 However, you don't have nroff, so they're probably useless to you.
5963 EOM
5964         case "$man3dir" in
5965         '') man3dir="none";;
5966         esac;;
5967 esac
5968
5969 case "$d_flexfnam" in
5970 undef)
5971         $cat <<'EOM'
5972 However, your system can't handle the long file names like File::Basename.3. 
5973 EOM
5974         case "$man3dir" in
5975         '') man3dir="none";;
5976         esac;;
5977 esac
5978
5979 echo "If you don't want the manual sources installed, answer 'none'."
5980 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5981 case "$man3dir" in
5982 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5983         if $test -d "$privlib/man/man3"; then
5984                 cat <<EOM >&4
5985
5986 WARNING:  Previous versions of perl installed man3 pages into
5987 $privlib/man/man3.  This version will suggest a 
5988 new default of $dflt.  
5989 EOM
5990                 tdflt=$dflt
5991                 dflt='n'
5992                 rp='Do you wish to preserve the old behavior?(y/n)'
5993                 . ./myread
5994                 case "$ans" in
5995                 y*) dflt="$privlib/man/man3" ;;
5996                 *)  dflt=$tdflt ;;
5997                 esac
5998     fi
5999         ;;
6000 ' ') dflt=none;;
6001 *)      dflt="$man3dir" ;;
6002 esac
6003 echo " "
6004 fn=dn+~
6005 rp="Where do the $package library man pages (source) go?"
6006 . ./getfile
6007 man3dir="$ans"
6008 man3direxp="$ansexp"
6009 case "$man1dir" in
6010 '')     man3dir=' '
6011         installman3dir='';;
6012 esac
6013
6014 : Change installation prefix, if necessary.
6015 if $test X"$prefix" != X"$installprefix"; then
6016         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6017 else
6018         installman3dir="$man3direxp"
6019 fi
6020
6021 : What suffix to use on installed man pages
6022 case "$man3dir" in
6023 ' ')
6024         man3ext='0'
6025         ;;
6026 *)
6027         rp="What suffix should be used for the $package library man pages?"
6028         case "$man3ext" in
6029         '')     case "$man3dir" in
6030                 *3)  dflt=3 ;;
6031                 *3p) dflt=3p ;;
6032                 *3pm) dflt=3pm ;;
6033                 *l) dflt=l;;
6034                 *n) dflt=n;;
6035                 *o) dflt=o;;
6036                 *p) dflt=p;;
6037                 *C) dflt=C;;
6038                 *L) dflt=L;;
6039                 *L3) dflt=L3;;
6040                 *) dflt=3;;
6041                 esac
6042                 ;;
6043         *)      dflt="$man3ext";;
6044         esac
6045         . ./myread
6046         man3ext="$ans"
6047         ;;
6048 esac
6049
6050 : see if we have to deal with yellow pages, now NIS.
6051 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6052         if $test -f /usr/etc/nibindd; then
6053                 echo " "
6054                 echo "I'm fairly confident you're on a NeXT."
6055                 echo " "
6056                 rp='Do you get the hosts file via NetInfo?'
6057                 dflt=y
6058                 case "$hostcat" in
6059                 nidump*) ;;
6060                 '') ;;
6061                 *) dflt=n;;
6062                 esac
6063                 . ./myread
6064                 case "$ans" in
6065                 y*) hostcat='nidump hosts .';;
6066                 *)      case "$hostcat" in
6067                         nidump*) hostcat='';;
6068                         esac
6069                         ;;
6070                 esac
6071         fi
6072         case "$hostcat" in
6073         nidump*) ;;
6074         *)
6075                 case "$hostcat" in
6076                 *ypcat*) dflt=y;;
6077                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6078                                 dflt=y
6079                         else
6080                                 dflt=n
6081                         fi;;
6082                 *) dflt=n;;
6083                 esac
6084                 echo " "
6085                 rp='Are you getting the hosts file via yellow pages?'
6086                 . ./myread
6087                 case "$ans" in
6088                 y*) hostcat='ypcat hosts';;
6089                 *) hostcat='cat /etc/hosts';;
6090                 esac
6091                 ;;
6092         esac
6093 fi
6094 case "$hostcat" in
6095 '') hostcat='cat /etc/hosts';;
6096 esac
6097 case "$groupcat" in
6098 '') groupcat='cat /etc/group';;
6099 esac
6100 case "$passcat" in
6101 '') passcat='cat /etc/passwd';;
6102 esac
6103
6104 : now get the host name
6105 echo " "
6106 echo "Figuring out host name..." >&4
6107 case "$myhostname" in
6108 '') cont=true
6109         echo 'Maybe "hostname" will work...'
6110         if tans=`sh -c hostname 2>&1` ; then
6111                 myhostname=$tans
6112                 phostname=hostname
6113                 cont=''
6114         fi
6115         ;;
6116 *) cont='';;
6117 esac
6118 if $test "$cont"; then
6119         if ./xenix; then
6120                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6121                 if tans=`cat /etc/systemid 2>&1` ; then
6122                         myhostname=$tans
6123                         phostname='cat /etc/systemid'
6124                         echo "Whadyaknow.  Xenix always was a bit strange..."
6125                         cont=''
6126                 fi
6127         elif $test -r /etc/systemid; then
6128                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6129         fi
6130 fi
6131 if $test "$cont"; then
6132         echo 'No, maybe "uuname -l" will work...'
6133         if tans=`sh -c 'uuname -l' 2>&1` ; then
6134                 myhostname=$tans
6135                 phostname='uuname -l'
6136         else
6137                 echo 'Strange.  Maybe "uname -n" will work...'
6138                 if tans=`sh -c 'uname -n' 2>&1` ; then
6139                         myhostname=$tans
6140                         phostname='uname -n'
6141                 else
6142                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6143                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6144                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6145                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6146                         else
6147                                 case "$myhostname" in
6148                                 '') echo "Does this machine have an identity crisis or something?"
6149                                         phostname='';;
6150                                 *)
6151                                         echo "Well, you said $myhostname before..."
6152                                         phostname='echo $myhostname';;
6153                                 esac
6154                         fi
6155                 fi
6156         fi
6157 fi
6158 : you do not want to know about this
6159 set $myhostname
6160 myhostname=$1
6161
6162 : verify guess
6163 if $test "$myhostname" ; then
6164         dflt=y
6165         rp='Your host name appears to be "'$myhostname'".'" Right?"
6166         . ./myread
6167         case "$ans" in
6168         y*) ;;
6169         *) myhostname='';;
6170         esac
6171 fi
6172
6173 : bad guess or no guess
6174 while $test "X$myhostname" = X ; do
6175         dflt=''
6176         rp="Please type the (one word) name of your host:"
6177         . ./myread
6178         myhostname="$ans"
6179 done
6180
6181 : translate upper to lower if necessary
6182 case "$myhostname" in
6183 *[A-Z]*)
6184         echo "(Normalizing case in your host name)"
6185         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6186         ;;
6187 esac
6188
6189 case "$myhostname" in
6190 *.*)
6191         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6192         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6193         echo "(Trimming domain name from host name--host name is now $myhostname)"
6194         ;;
6195 *) case "$mydomain" in
6196         '')
6197                 {
6198                         test "X$hostcat" = "Xypcat hosts" &&
6199                         ypmatch "$myhostname" hosts 2>/dev/null |\
6200                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6201                         $test -s hosts
6202                 } || {
6203                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6204                                         /[       ]$myhostname[  . ]/p" > hosts
6205                 }
6206                 tmp_re="[       . ]"
6207                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6208                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6209                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6210                         hosts | $sort | $uniq | \
6211                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6212                 case `$echo X$dflt` in
6213                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6214                         dflt=.
6215                         ;;
6216                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6217                         ;;
6218                 esac
6219                 case "$dflt" in
6220                 .)
6221                         tans=`./loc resolv.conf X /etc /usr/etc`
6222                         if $test -f "$tans"; then
6223                                 echo "(Attempting domain name extraction from $tans)"
6224                                 dflt=.`$sed -n -e 's/   / /g' \
6225                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6226                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6227                                 case "$dflt" in
6228                                 .) dflt=.`$sed -n -e 's/        / /g' \
6229                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6230                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6231                                         ;;
6232                                 esac
6233                         fi
6234                         ;;
6235                 esac
6236                 case "$dflt" in
6237                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6238                         dflt=.`sh -c domainname 2>/dev/null`
6239                         case "$dflt" in
6240                         '') dflt='.';;
6241                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6242                         esac
6243                         ;;
6244                 esac
6245                 case "$dflt" in
6246                 .) echo "(Lost all hope -- silly guess then)"
6247                         dflt='.uucp'
6248                         ;;
6249                 esac
6250                 $rm -f hosts
6251                 ;;
6252         *) dflt="$mydomain";;
6253         esac;;
6254 esac
6255 echo " "
6256 rp="What is your domain name?"
6257 . ./myread
6258 tans="$ans"
6259 case "$ans" in
6260 '') ;;
6261 .*) ;;
6262 *) tans=".$tans";;
6263 esac
6264 mydomain="$tans"
6265
6266 : translate upper to lower if necessary
6267 case "$mydomain" in
6268 *[A-Z]*)
6269         echo "(Normalizing case in your domain name)"
6270         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6271         ;;
6272 esac
6273
6274 : a little sanity check here
6275 case "$phostname" in
6276 '') ;;
6277 *)
6278         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6279         $myhostname$mydomain|$myhostname) ;;
6280         *)
6281                 case "$phostname" in
6282                 sed*)
6283                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6284                         ;;
6285                 *)
6286                         echo "(That doesn't agree with your $phostname command, by the way.)"
6287                         ;;
6288                 esac
6289         ;;
6290         esac
6291         ;;
6292 esac
6293
6294 $cat <<EOM
6295
6296 I need to get your e-mail address in Internet format if possible, i.e.
6297 something like user@host.domain. Please answer accurately since I have
6298 no easy means to double check it. The default value provided below
6299 is most probably close to the reality but may not be valid from outside
6300 your organization...
6301
6302 EOM
6303 cont=x
6304 while test "$cont"; do
6305         case "$cf_email" in
6306         '') dflt="$cf_by@$myhostname$mydomain";;
6307         *) dflt="$cf_email";;
6308         esac
6309         rp='What is your e-mail address?'
6310         . ./myread
6311         cf_email="$ans"
6312         case "$cf_email" in
6313         *@*.*) cont='' ;;
6314         *)
6315                 rp='Address does not look like an Internet one.  Use it anyway?'
6316                 case "$fastread" in
6317                 yes) dflt=y ;;
6318                 *) dflt=n ;;
6319                 esac
6320                 . ./myread
6321                 case "$ans" in
6322                 y*) cont='' ;;
6323                 *) echo " " ;;
6324                 esac
6325                 ;;
6326         esac
6327 done
6328
6329 $cat <<EOM
6330
6331 If you or somebody else will be maintaining perl at your site, please
6332 fill in the correct e-mail address here so that they may be contacted
6333 if necessary. Currently, the "perlbug" program included with perl
6334 will send mail to this address in addition to perlbug@perl.com. You may
6335 enter "none" for no administrator.
6336
6337 EOM
6338 case "$perladmin" in
6339 '') dflt="$cf_email";;
6340 *) dflt="$perladmin";;
6341 esac
6342 rp='Perl administrator e-mail address'
6343 . ./myread
6344 perladmin="$ans"
6345
6346 : figure out how to guarantee perl startup
6347 case "$startperl" in
6348 '')
6349         case "$sharpbang" in
6350         *!)
6351                 $cat <<EOH
6352
6353 I can use the #! construct to start perl on your system. This will
6354 make startup of perl scripts faster, but may cause problems if you
6355 want to share those scripts and perl is not in a standard place
6356 ($binexp/perl) on all your platforms. The alternative is to force
6357 a shell by starting the script with a single ':' character.
6358
6359 EOH
6360                 dflt="$binexp/perl"
6361                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6362                 . ./myread
6363                 case "$ans" in
6364                 none)   startperl=": # use perl";;
6365                 *)      startperl="#!$ans"
6366                         if $test 30 -lt `echo "$ans" | wc -c`; then
6367                                 $cat >&4 <<EOM
6368
6369 WARNING:  Some systems limit the #! command to 32 characters.
6370 If you experience difficulty running Perl scripts with #!, try
6371 installing Perl in a directory with a shorter pathname.
6372
6373 EOM
6374                         fi ;;
6375                 esac
6376                 ;;
6377         *) startperl=": # use perl"
6378                 ;;
6379         esac
6380         ;;
6381 esac
6382 echo "I'll use $startperl to start perl scripts."
6383
6384 : figure best path for perl in scripts
6385 case "$perlpath" in
6386 '')
6387         perlpath="$binexp/perl"
6388         case "$startperl" in
6389         *!*) ;;
6390         *)
6391                 $cat <<EOH
6392
6393 I will use the "eval 'exec'" idiom to start Perl on your system.
6394 I can use the full path of your Perl binary for this purpose, but
6395 doing so may cause problems if you want to share those scripts and
6396 Perl is not always in a standard place ($binexp/perl).
6397
6398 EOH
6399                 dflt="$binexp/perl"
6400                 rp="What path shall I use in \"eval 'exec'\"?"
6401                 . ./myread
6402                 perlpath="$ans"
6403                 ;;
6404         esac
6405         ;;
6406 esac
6407 case "$startperl" in
6408 *!*)    ;;
6409 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6410 esac
6411
6412 : determine where public executable scripts go
6413 set scriptdir scriptdir
6414 eval $prefixit
6415 case "$scriptdir" in
6416 '')
6417         dflt="$bin"
6418         : guess some guesses
6419         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6420         $test -d /usr/share/bin     && dflt=/usr/share/bin
6421         $test -d /usr/local/script  && dflt=/usr/local/script
6422         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6423         $test -d $prefixexp/script  && dflt=$prefixexp/script
6424         set dflt
6425         eval $prefixup
6426         ;;
6427 *)  dflt="$scriptdir"
6428         ;;
6429 esac
6430 $cat <<EOM
6431  
6432 Some installations have a separate directory just for executable scripts so
6433 that they can mount it across multiple architectures but keep the scripts in
6434 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6435 Or you might just lump your scripts in with all your other executables.
6436  
6437 EOM
6438 fn=d~
6439 rp='Where do you keep publicly executable scripts?'
6440 . ./getfile
6441 if $test "X$ansexp" != "X$scriptdirexp"; then
6442         installscript=''
6443 fi
6444 scriptdir="$ans"
6445 scriptdirexp="$ansexp"
6446 : Change installation prefix, if necessary.
6447 if $test X"$prefix" != X"$installprefix"; then
6448         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6449 else
6450         installscript="$scriptdirexp"
6451 fi
6452
6453 $cat <<EOM
6454
6455 After $package is installed, you may wish to install various
6456 add-on modules and utilities.  Typically, these add-ons will
6457 be installed under $prefix with the rest
6458 of this package.  However, you may wish to install such add-ons
6459 elsewhere under a different prefix.
6460
6461 If you do not wish to put everything under a single prefix, that's
6462 ok.  You will be prompted for the individual locations; this siteprefix
6463 is only used to suggest the defaults.
6464
6465 The default should be fine for most people.
6466
6467 EOM
6468 fn=d~+
6469 rp='Installation prefix to use for add-on modules and utilities?'
6470 : XXX Here might be another good place for an installstyle setting.
6471 case "$siteprefix" in
6472 '') dflt=$prefix ;;
6473 *)  dflt=$siteprefix ;;
6474 esac
6475 . ./getfile
6476 oldsiteprefix=''
6477 case "$siteprefix" in
6478 '') ;;
6479 *)
6480         case "$ans" in
6481         "$prefix") ;;
6482         *) oldsiteprefix="$prefix";;
6483         esac
6484         ;;
6485 esac
6486 siteprefix="$ans"
6487 siteprefixexp="$ansexp"
6488
6489 : determine where site specific libraries go.
6490 : Usual default is /usr/local/lib/perl5/site_perl
6491 : The default "style" setting is made in installstyle.U
6492 : XXX No longer works with Prefixit stuff.
6493 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6494 case "$installstyle" in
6495 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6496 *)       dflt=$siteprefix/lib/site_$prog ;;
6497 esac
6498 $cat <<EOM
6499
6500 The installation process will create a directory for
6501 site-specific extensions and modules.  Most users find it convenient
6502 to place all site-specific files in this directory rather than in the
6503 main distribution directory.
6504
6505 EOM
6506 fn=d~+
6507 rp='Pathname for the site-specific library files?'
6508 . ./getfile
6509 sitelib="$ans"
6510 sitelibexp="$ansexp"
6511 : Change installation prefix, if necessary.
6512 if $test X"$prefix" != X"$installprefix"; then
6513         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6514 else
6515         installsitelib="$sitelibexp"
6516 fi
6517
6518 : determine where site specific architecture-dependent libraries go.
6519 : sitelib  default is /usr/local/lib/perl5/site_perl/
6520 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6521 : sitelib may have an optional trailing /share.
6522 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6523 tdflt="$tdflt/$apiversion/$archname"
6524 set sitearch sitearch none
6525 eval $prefixit
6526 case "$sitearch" in
6527 '')     dflt="$tdflt" ;;
6528 *)      dflt="$sitearch" ;;
6529 esac
6530 $cat <<EOM
6531
6532 The installation process will also create a directory for
6533 architecture-dependent site-specific extensions and modules.
6534
6535 EOM
6536 fn=nd~+
6537 rp='Pathname for the site-specific architecture-dependent library files?'
6538 . ./getfile
6539 sitearch="$ans"
6540 sitearchexp="$ansexp"
6541 : Change installation prefix, if necessary.
6542 if $test X"$prefix" != X"$installprefix"; then
6543         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6544 else
6545         installsitearch="$sitearchexp"
6546 fi
6547
6548 : determine where add-on public executables go
6549 case "$sitebin" in
6550 '')     dflt=$siteprefix/bin ;;
6551 *)      dflt=$sitebin ;;
6552 esac
6553 fn=d~
6554 rp='Pathname where the add-on public executables should be installed?'
6555 . ./getfile
6556 sitebin="$ans"
6557 sitebinexp="$ansexp"
6558 : Change installation prefix, if necessary.
6559 if $test X"$prefix" != X"$installprefix"; then
6560         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6561 else
6562         installsitebin="$sitebinexp"
6563 fi
6564
6565 cat <<EOM
6566
6567 Perl can be built to take advantage of long doubles which
6568 (if available) may give more accuracy and range for floating point
6569 numbers.  To do so, Configure must be run with -Duselongdouble.
6570
6571 If this doesn't make any sense to you, just accept the default 'n'.
6572 EOM
6573 case "$uselongdouble" in
6574 $define|true|[yY]*)     dflt='y';;
6575 *) dflt='n';;
6576 esac
6577 rp='Try to use long doubles if available?'
6578 . ./myread
6579 case "$ans" in
6580 y|Y)    val="$define"   ;;
6581 *)      val="$undef"    ;;
6582 esac
6583 set uselongdouble
6584 eval $setvar
6585
6586 case "$uselongdouble" in
6587 "$define"|true|[yY]*)
6588 : Look for a hint-file generated 'call-back-unit'.  If the
6589 : user has specified that long doubles should be used,
6590 : we may need to set or change some other defaults.
6591         if $test -f uselongdouble.cbu; then
6592                 echo "Your platform has some specific hints for long doubles, using them..."
6593                 . ./uselongdouble.cbu
6594         else
6595                 $cat <<EOM
6596 (Your platform doesn't have any specific hints for long doubles.)
6597 EOM
6598         fi
6599         ;;
6600 esac
6601
6602 cat <<EOM
6603
6604 Previous version of $package used the standard IO mechanisms as defined
6605 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6606 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6607 the default.  This abstraction layer can use AT&T's sfio (if you already
6608 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6609 problems with some extension modules.  Using PerlIO with stdio is safe,
6610 but it is slower than plain stdio and therefore is not the default.
6611
6612 If this doesn't make any sense to you, just accept the default 'n'.
6613 EOM
6614 case "$useperlio" in
6615 $define|true|[yY]*)     dflt='y';;
6616 *) dflt='n';;
6617 esac
6618 rp='Use the experimental PerlIO abstraction layer?'
6619 . ./myread
6620 case "$ans" in
6621 y|Y) 
6622         val="$define"
6623         ;;     
6624 *)      
6625         echo "Ok, doing things the stdio way"
6626         val="$undef"
6627         ;;
6628 esac
6629 set useperlio
6630 eval $setvar 
6631
6632 case "$vendorprefix" in
6633 '')     d_vendorbin="$undef"
6634         vendorbin=''
6635         vendorbinexp=''
6636         ;;
6637 *)      d_vendorbin="$define"
6638         : determine where vendor-supplied executables go.
6639         dflt=$vendorprefix/bin
6640         fn=d~+
6641         rp='Pathname for the vendor-supplied executables directory?'
6642         . ./getfile
6643         vendorbin="$ans"
6644         vendorbinexp="$ansexp"
6645         : Change installation prefix, if necessary.
6646         if $test X"$prefix" != X"$installprefix"; then
6647                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6648         else
6649                 installvendorbin="$vendorbinexp"
6650         fi
6651         ;;
6652 esac
6653
6654 : Check how to convert floats to strings.
6655 if test "X$d_Gconvert" = X; then
6656         echo " "
6657         echo "Checking for an efficient way to convert floats to strings."
6658         $cat >try.c <<'EOP'
6659 #ifdef TRY_gconvert
6660 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6661 char *myname = "gconvert";
6662 #endif
6663 #ifdef TRY_gcvt
6664 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6665 char *myname = "gcvt";
6666 #endif
6667 #ifdef TRY_sprintf
6668 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6669 char *myname = "sprintf";
6670 #endif
6671
6672 #include <stdio.h>
6673
6674 int
6675 checkit(expect, got)
6676 char *expect;
6677 char *got;
6678 {
6679     if (strcmp(expect, got)) {
6680                 printf("%s oddity:  Expected %s, got %s\n",
6681                         myname, expect, got);
6682                 exit(1);
6683         }
6684 }
6685
6686 int main()
6687
6688         char buf[64]; 
6689         buf[63] = '\0';
6690
6691         /* This must be 1st test on (which?) platform */
6692         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6693         Gconvert(0.1, 8, 0, buf);
6694         checkit("0.1", buf);
6695
6696         Gconvert(1.0, 8, 0, buf); 
6697         checkit("1", buf);
6698
6699         Gconvert(0.0, 8, 0, buf); 
6700         checkit("0", buf);
6701
6702         Gconvert(-1.0, 8, 0, buf); 
6703         checkit("-1", buf);
6704
6705         /* Some Linux gcvt's give 1.e+5 here. */
6706         Gconvert(100000.0, 8, 0, buf); 
6707         checkit("100000", buf);
6708         
6709         /* Some Linux gcvt's give -1.e+5 here. */
6710         Gconvert(-100000.0, 8, 0, buf); 
6711         checkit("-100000", buf);
6712
6713         exit(0);
6714 }
6715 EOP
6716         case "$d_Gconvert" in
6717         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6718         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6719         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6720         *) xxx_list='gconvert gcvt sprintf' ;;
6721         esac
6722
6723         for xxx_convert in $xxx_list; do
6724                 echo "Trying $xxx_convert"
6725                 $rm -f try try$_o
6726                 set try -DTRY_$xxx_convert
6727                 if eval $compile; then
6728                         echo "$xxx_convert" found. >&4
6729                         if ./try; then
6730                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6731                                 break;
6732                         else
6733                                 echo "...But $xxx_convert didn't work as I expected."
6734                         fi
6735                 else
6736                         echo "$xxx_convert NOT found." >&4
6737                 fi
6738         done
6739                 
6740         case "$xxx_convert" in
6741         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6742         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6743         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6744         esac
6745 fi
6746
6747 : see if inttypes.h is available
6748 : we want a real compile instead of Inhdr because some systems
6749 : have an inttypes.h which includes non-existent headers
6750 echo " "
6751 $cat >try.c <<EOCP
6752 #include <inttypes.h>
6753 int main() {
6754         static int32_t foo32 = 0x12345678;
6755 }
6756 EOCP
6757 set try
6758 if eval $compile; then
6759         echo "<inttypes.h> found." >&4
6760         val="$define"
6761 else
6762         echo "<inttypes.h> NOT found." >&4
6763         val="$undef"
6764 fi
6765 $rm -f try.c try
6766 set i_inttypes
6767 eval $setvar
6768
6769 : check for int64_t
6770 case "$use64bits" in
6771 "$define" )
6772         echo " "
6773         $echo $n "Checking to see if your system supports int64_t...$c" >&4
6774         $cat >try.c <<EOCP
6775 #include <sys/types.h>
6776 #$i_inttypes I_INTTYPES
6777 #ifdef I_INTTYPES
6778 #include <inttypes.h>
6779 #endif
6780 int64_t foo() { int64_t x; x = 7; return x; }
6781 EOCP
6782         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6783                 val="$define"
6784                 echo " Yup, it does." >&4
6785         else
6786                 val="$undef"
6787                 echo " Nope, it doesn't." >&4
6788         fi
6789         $rm -f try.*
6790         ;;
6791 *)      val="$undef"
6792         ;;
6793 esac
6794 set d_int64t
6795 eval $setvar
6796
6797
6798 : check for lengths of integral types
6799 echo " "
6800 case "$intsize" in
6801 '')
6802         echo "Checking to see how big your integers are..." >&4
6803         $cat >intsize.c <<'EOCP'
6804 #include <stdio.h>
6805 int main()
6806 {
6807         printf("intsize=%d;\n", sizeof(int));
6808         printf("longsize=%d;\n", sizeof(long));
6809         printf("shortsize=%d;\n", sizeof(short));
6810         exit(0);
6811 }
6812 EOCP
6813         set intsize
6814         if eval $compile_ok && ./intsize > /dev/null; then
6815                 eval `./intsize`
6816                 echo "Your integers are $intsize bytes long."
6817                 echo "Your long integers are $longsize bytes long."
6818                 echo "Your short integers are $shortsize bytes long."
6819         else
6820                 $cat >&4 <<EOM
6821 !
6822 Help! I can't compile and run the intsize test program: please enlighten me!
6823 (This is probably a misconfiguration in your system or libraries, and
6824 you really ought to fix it.  Still, I'll try anyway.)
6825 !
6826 EOM
6827                 dflt=4
6828                 rp="What is the size of an integer (in bytes)?"
6829                 . ./myread
6830                 intsize="$ans"
6831                 dflt=$intsize
6832                 rp="What is the size of a long integer (in bytes)?"
6833                 . ./myread
6834                 longsize="$ans"
6835                 dflt=2
6836                 rp="What is the size of a short integer (in bytes)?"
6837                 . ./myread
6838                 shortsize="$ans"
6839         fi
6840         ;;
6841 esac
6842 $rm -f intsize intsize.*
6843
6844 : check for long long
6845 echo " "
6846 $echo $n "Checking to see if your system supports long long...$c" >&4
6847 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6848 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6849         val="$define"
6850         echo " Yup, it does." >&4
6851 else
6852         val="$undef"
6853         echo " Nope, it doesn't." >&4
6854 fi
6855 $rm try.*
6856 set d_longlong
6857 eval $setvar
6858
6859 : check for length of long long
6860 case "${d_longlong}${longlongsize}" in
6861 $define)
6862         echo " "
6863         $echo $n "Checking to see how big your long longs are...$c" >&4
6864         $cat >try.c <<'EOCP'
6865 #include <stdio.h>
6866 int main()
6867 {
6868         printf("%d\n", sizeof(long long));
6869 }
6870 EOCP
6871         set try
6872         if eval $compile_ok; then
6873                 longlongsize=`./try`
6874                 $echo " $longlongsize bytes." >&4
6875         else
6876                 dflt='8'
6877                 echo " "
6878                 echo "(I can't seem to compile the test program.  Guessing...)"
6879                 rp="What is the size of a long long (in bytes)?"
6880                 . ./myread
6881                 longlongsize="$ans"
6882         fi
6883         if $test "X$longsize" = "X$longlongsize"; then
6884                 echo "(That isn't any different from an ordinary long.)"
6885         fi      
6886         ;;
6887 esac
6888 $rm -f try.c try
6889
6890 echo " "
6891
6892 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6893
6894 echo "Checking how to print 64-bit integers..." >&4
6895
6896 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6897         quad=int
6898         $cat >try.c <<'EOCP'
6899 #include <sys/types.h>
6900 #include <stdio.h>
6901 int main() {
6902   int q = 12345678901;
6903   printf("%ld\n", q);
6904 }
6905 EOCP
6906         set try
6907         if eval $compile; then
6908                 yyy=`./try$exe_ext`
6909                 case "$yyy" in
6910                 12345678901)
6911                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6912                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6913                         echo "We will use %d."
6914                         ;;
6915                 esac
6916         fi
6917 fi
6918
6919 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6920         quad=long
6921         $cat >try.c <<'EOCP'
6922 #include <sys/types.h>
6923 #include <stdio.h>
6924 int main() {
6925   long q = 12345678901;
6926   printf("%ld\n", q);
6927 }
6928 EOCP
6929         set try
6930         if eval $compile; then
6931                 yyy=`./try$exe_ext`
6932                 case "$yyy" in
6933                 12345678901)
6934                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6935                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6936                         echo "We will use %ld."
6937                         ;;
6938                 esac
6939         fi
6940 fi
6941
6942 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6943         quad=int64_t
6944         $cat >try.c <<'EOCP'
6945 #include <sys/types.h>
6946 #include <inttypes.h>
6947 #include <stdio.h>
6948 int main() {
6949   int64_t q = 12345678901;
6950   printf("%" PRId64 "\n", q);
6951 }
6952 EOCP
6953         set try
6954         if eval $compile; then
6955                 yyy=`./try$exe_ext`
6956                 case "$yyy" in
6957                 12345678901)
6958                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6959                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6960                         echo "We will use the C9X style."
6961                         ;;
6962                 esac
6963         fi
6964 fi
6965
6966 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6967         quad="long long"
6968         $cat >try.c <<'EOCP'
6969 #include <sys/types.h>
6970 #include <stdio.h>
6971 int main() {
6972   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6973   printf("%lld\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='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6982                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6983                         echo "We will use the %lld style."
6984                         ;;
6985                 esac
6986         fi
6987 fi
6988
6989 if $test X"$sPRId64" = X -a X"$quad" != X; then
6990         $cat >try.c <<EOCP
6991 #include <sys/types.h>
6992 #include <stdio.h>
6993 int main() {
6994   $quad q = 12345678901;
6995   printf("%Ld\n", q);
6996 }
6997 EOCP
6998         set try
6999         if eval $compile; then
7000                 yyy=`./try$exe_ext`
7001                 case "$yyy" in
7002                 12345678901)
7003                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
7004                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
7005                         echo "We will use %lld."
7006                         ;;
7007                 esac
7008         fi
7009 fi
7010
7011 if $test X"$sPRId64" = X -a X"$quad" != X; then
7012         $cat >try.c <<EOCP
7013 #include <sys/types.h>
7014 #include <stdio.h>
7015 int main() {
7016   $quad q = 12345678901;
7017   printf("%qd\n", q);
7018 }
7019 EOCP
7020         set try
7021         if eval $compile; then
7022                 yyy=`./try$exe_ext`
7023                 case "$yyy" in
7024                 12345678901)
7025                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
7026                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
7027                         echo "We will use %qd."
7028                         ;;
7029                 esac
7030         fi
7031 fi
7032
7033 if $test X"$sPRId64" = X; then
7034         echo "Cannot figure out how to print 64-bit integers." >&4
7035 fi
7036
7037 $rm -f try try.*
7038
7039 fi # intsize -o longsize -o d_int64t -o d_longlong
7040
7041 case "$sPRId64" in
7042 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
7043         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
7044         ;;
7045 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
7046         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
7047         ;;
7048 esac
7049
7050 : check for length of double
7051 echo " "
7052 case "$doublesize" in
7053 '')
7054         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7055         $cat >try.c <<'EOCP'
7056 #include <stdio.h>
7057 int main()
7058 {
7059         printf("%d\n", sizeof(double));
7060 }
7061 EOCP
7062         set try
7063         if eval $compile_ok; then
7064                 doublesize=`./try`
7065                 $echo " $doublesize bytes." >&4
7066         else
7067                 dflt='8'
7068                 echo "(I can't seem to compile the test program.  Guessing...)"
7069                 rp="What is the size of a double precision number (in bytes)?"
7070                 . ./myread
7071                 doublesize="$ans"
7072         fi
7073         ;;
7074 esac
7075 $rm -f try.c try
7076
7077 : check for long doubles
7078 echo " "
7079 $echo $n "Checking to see if your system supports long double...$c" >&4
7080 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7081 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7082         val="$define"
7083         echo " Yup, it does." >&4
7084 else
7085         val="$undef"
7086         echo " Nope, it doesn't." >&4
7087 fi
7088 $rm try.*
7089 set d_longdbl
7090 eval $setvar
7091
7092 : check for length of long double
7093 case "${d_longdbl}${longdblsize}" in
7094 $define)
7095         echo " "
7096         $echo $n "Checking to see how big your long doubles are...$c" >&4
7097         $cat >try.c <<'EOCP'
7098 #include <stdio.h>
7099 int main()
7100 {
7101         printf("%d\n", sizeof(long double));
7102 }
7103 EOCP
7104         set try
7105         if eval $compile; then
7106                 longdblsize=`./try`
7107                 $echo " $longdblsize bytes." >&4
7108         else
7109                 dflt='8'
7110                 echo " "
7111                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7112                 rp="What is the size of a long double (in bytes)?"
7113                 . ./myread
7114                 longdblsize="$ans"
7115         fi
7116         if $test "X$doublesize" = "X$longdblsize"; then
7117                 echo "(That isn't any different from an ordinary double.)"
7118         fi      
7119         ;;
7120 esac
7121 $rm -f try.c try
7122
7123 echo " "
7124
7125 if $test X"$d_longdbl" = X"$define"; then
7126
7127 echo "Checking how to print long doubles..." >&4
7128
7129 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7130         $cat >try.c <<'EOCP'
7131 #include <sys/types.h>
7132 #include <stdio.h>
7133 int main() {
7134   double d = 123.456;
7135   printf("%.3f\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='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7144                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7145                         echo "We will use %f."
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("%.3llf\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='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7166                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7167                         echo "We will use %llf."
7168                         ;;
7169                 esac
7170         fi
7171 fi
7172
7173 if $test X"$sPRIfldbl" = X; then
7174         $cat >try.c <<'EOCP'
7175 #include <sys/types.h>
7176 #include <stdio.h>
7177 int main() {
7178   long double d = 123.456;
7179   printf("%.3Lf\n", d);
7180 }
7181 EOCP
7182         set try
7183         if eval $compile; then
7184                 yyy=`./try$exe_ext`
7185                 case "$yyy" in
7186                 123.456)
7187                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7188                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7189                         echo "We will use %Lf."
7190                         ;;
7191                 esac
7192         fi
7193 fi
7194
7195 if $test X"$sPRIfldbl" = X; then
7196         $cat >try.c <<'EOCP'
7197 #include <sys/types.h>
7198 #include <stdio.h>
7199 int main() {
7200   long double d = 123.456;
7201   printf("%.3lf\n", d);
7202 }
7203 EOCP
7204         set try
7205         if eval $compile; then
7206                 yyy=`./try$exe_ext`
7207                 case "$yyy" in
7208                 123.456)
7209                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7210                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7211                         echo "We will use %lf."
7212                         ;;
7213                 esac
7214         fi
7215 fi
7216
7217 if $test X"$sPRIfldbl" = X; then
7218         echo "Cannot figure out how to print long doubles." >&4
7219 fi
7220
7221 $rm -f try try.*
7222
7223 fi # d_longdbl
7224
7225 case "$sPRIfldbl" in
7226 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7227         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7228         ;;
7229 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7230         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7231         ;;
7232 esac
7233
7234 : Initialize h_fcntl
7235 h_fcntl=false
7236
7237 : Initialize h_sysfile
7238 h_sysfile=false
7239
7240 : access call always available on UNIX
7241 set access d_access
7242 eval $inlibc
7243
7244 : locate the flags for 'access()'
7245 case "$d_access" in
7246 "$define")
7247         echo " "
7248         $cat >access.c <<'EOCP'
7249 #include <sys/types.h>
7250 #ifdef I_FCNTL
7251 #include <fcntl.h>
7252 #endif
7253 #ifdef I_SYS_FILE
7254 #include <sys/file.h>
7255 #endif
7256 #ifdef I_UNISTD
7257 #include <unistd.h>
7258 #endif
7259 int main() {
7260         exit(R_OK);
7261 }
7262 EOCP
7263         : check sys/file.h first, no particular reason here
7264         if $test `./findhdr sys/file.h` && \
7265                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7266                 h_sysfile=true;
7267                 echo "<sys/file.h> defines the *_OK access constants." >&4
7268         elif $test `./findhdr fcntl.h` && \
7269                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7270                 h_fcntl=true;
7271                 echo "<fcntl.h> defines the *_OK access constants." >&4
7272         elif $test `./findhdr unistd.h` && \
7273                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7274                 echo "<unistd.h> defines the *_OK access constants." >&4
7275         else
7276                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7277         fi
7278         ;;
7279 esac
7280 $rm -f access*
7281
7282 : see if accessx exists
7283 set accessx d_accessx
7284 eval $inlibc
7285
7286 : see if alarm exists
7287 set alarm d_alarm
7288 eval $inlibc
7289
7290 : see if atolf exists
7291 set atolf d_atolf
7292 eval $inlibc
7293
7294 : see if atoll exists
7295 set atoll d_atoll
7296 eval $inlibc
7297
7298 : Look for GNU-cc style attribute checking
7299 echo " "
7300 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7301 $cat >attrib.c <<'EOCP'
7302 #include <stdio.h>
7303 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7304 EOCP
7305 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7306         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7307                 echo "Your C compiler doesn't fully support __attribute__."
7308                 val="$undef"
7309         else
7310                 echo "Your C compiler supports __attribute__."
7311                 val="$define"
7312         fi
7313 else
7314         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7315         val="$undef"
7316 fi
7317 set d_attribut
7318 eval $setvar
7319 $rm -f attrib*
7320
7321 : see if bcmp exists
7322 set bcmp d_bcmp
7323 eval $inlibc
7324
7325 : see if bcopy exists
7326 set bcopy d_bcopy
7327 eval $inlibc
7328
7329 : see if this is a unistd.h system
7330 set unistd.h i_unistd
7331 eval $inhdr
7332
7333 : see if getpgrp exists
7334 set getpgrp d_getpgrp
7335 eval $inlibc
7336
7337 case "$d_getpgrp" in
7338 "$define")
7339         echo " "
7340         echo "Checking to see which flavor of getpgrp is in use..."
7341         $cat >set.c <<EOP
7342 #$i_unistd I_UNISTD
7343 #include <sys/types.h>
7344 #ifdef I_UNISTD
7345 #  include <unistd.h>
7346 #endif
7347 int main()
7348 {
7349         if (getuid() == 0) {
7350                 printf("(I see you are running Configure as super-user...)\n");
7351                 setuid(1);
7352         }
7353 #ifdef TRY_BSD_PGRP
7354         if (getpgrp(1) == 0)
7355                 exit(0);
7356 #else
7357         if (getpgrp() > 0)
7358                 exit(0);
7359 #endif
7360         exit(1);
7361 }
7362 EOP
7363         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7364                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7365                 val="$define"
7366         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7367                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7368                 val="$undef"
7369         else
7370                 echo "I can't seem to compile and run the test program."
7371                 if ./usg; then
7372                         xxx="a USG one, i.e. you use getpgrp()."
7373                 else
7374                         # SVR4 systems can appear rather BSD-ish.
7375                         case "$i_unistd" in
7376                         $undef)
7377                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7378                                 val="$define"
7379                                 ;;
7380                         $define)
7381                                 xxx="probably a USG one, i.e. you use getpgrp()."
7382                                 val="$undef"
7383                                 ;;
7384                         esac
7385                 fi
7386                 echo "Assuming your getpgrp is $xxx" >&4
7387         fi
7388         ;;
7389 *) val="$undef";;
7390 esac
7391 set d_bsdgetpgrp
7392 eval $setvar
7393 $rm -f set set.c
7394
7395 : see if setpgrp exists
7396 set setpgrp d_setpgrp
7397 eval $inlibc
7398
7399 case "$d_setpgrp" in
7400 "$define")
7401         echo " "
7402         echo "Checking to see which flavor of setpgrp is in use..."
7403         $cat >set.c <<EOP
7404 #$i_unistd I_UNISTD
7405 #include <sys/types.h>
7406 #ifdef I_UNISTD
7407 #  include <unistd.h>
7408 #endif
7409 int main()
7410 {
7411         if (getuid() == 0) {
7412                 printf("(I see you are running Configure as super-user...)\n");
7413                 setuid(1);
7414         }
7415 #ifdef TRY_BSD_PGRP
7416         if (-1 == setpgrp(1, 1))
7417                 exit(0);
7418 #else
7419         if (setpgrp() != -1)
7420                 exit(0);
7421 #endif
7422         exit(1);
7423 }
7424 EOP
7425         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7426                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7427                 val="$define"
7428         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7429                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7430                 val="$undef"
7431         else
7432                 echo "(I can't seem to compile and run the test program.)"
7433                 if ./usg; then
7434                         xxx="a USG one, i.e. you use setpgrp()."
7435                 else
7436                         # SVR4 systems can appear rather BSD-ish.
7437                         case "$i_unistd" in
7438                         $undef)
7439                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7440                                 val="$define"
7441                                 ;;
7442                         $define)
7443                                 xxx="probably a USG one, i.e. you use setpgrp()."
7444                                 val="$undef"
7445                                 ;;
7446                         esac
7447                 fi
7448                 echo "Assuming your setpgrp is $xxx" >&4
7449         fi
7450         ;;
7451 *) val="$undef";;
7452 esac
7453 set d_bsdsetpgrp
7454 eval $setvar
7455 $rm -f set set.c
7456 : see if bzero exists
7457 set bzero d_bzero
7458 eval $inlibc
7459
7460 : see if signal is declared as pointer to function returning int or void
7461 echo " "
7462 xxx=`./findhdr signal.h`
7463 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7464 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7465         echo "You have int (*signal())() instead of void." >&4
7466         val="$undef"
7467 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7468         echo "You have void (*signal())()." >&4
7469         val="$define"
7470 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7471         echo "You have int (*signal())() instead of void." >&4
7472         val="$undef"
7473 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7474         echo "You have void (*signal())()." >&4
7475         val="$define"
7476 else
7477         case "$d_voidsig" in
7478         '')
7479         echo "I can't determine whether signal handler returns void or int..." >&4
7480                 dflt=void
7481                 rp="What type does your signal handler return?"
7482                 . ./myread
7483                 case "$ans" in
7484                 v*) val="$define";;
7485                 *) val="$undef";;
7486                 esac;;
7487         "$define")
7488                 echo "As you already told me, signal handler returns void." >&4
7489                 val="$define"
7490                 ;;
7491         *)      echo "As you already told me, signal handler returns int." >&4
7492                 val="$undef"
7493                 ;;
7494         esac
7495 fi
7496 set d_voidsig
7497 eval $setvar
7498 case "$d_voidsig" in
7499 "$define") signal_t="void";;
7500 *) signal_t="int";;
7501 esac
7502 $rm -f $$.tmp
7503
7504 : check for ability to cast large floats to 32-bit ints.
7505 echo " "
7506 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7507 if $test "$intsize" -ge 4; then
7508         xxx=int
7509 else
7510         xxx=long
7511 fi
7512 $cat >try.c <<EOCP
7513 #include <stdio.h>
7514 #include <sys/types.h>
7515 #include <signal.h>
7516 $signal_t blech(s) int s; { exit(3); }
7517 int main()
7518 {
7519         $xxx i32;
7520         double f, g;
7521         int result = 0;
7522         char str[16];
7523         signal(SIGFPE, blech);
7524
7525         /* Don't let compiler optimize the test away.  Store the number 
7526            in a writable string for gcc to pass to sscanf under HP/UX.
7527         */
7528         sprintf(str, "2147483647");
7529         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7530         g = 10 * f;
7531         i32  = ($xxx) g;
7532
7533         /* x86 processors will probably give 0x8000 0000, which is a
7534        sign change.  We don't want that.  We want to mimic SPARC
7535            behavior here, which is to preserve the sign and give
7536            back 0x7fff ffff.
7537         */
7538         if (i32 != ($xxx) f)
7539                 result |= 1;
7540         exit(result);
7541 }
7542 EOCP
7543 set try
7544 if eval $compile_ok; then
7545         ./try
7546         yyy=$?
7547 else
7548         echo "(I can't seem to compile the test program--assuming it can't)"
7549         yyy=1
7550 fi
7551 case "$yyy" in
7552 0)      val="$define"
7553         echo "Yup, it can."
7554         ;;
7555 *)      val="$undef"
7556         echo "Nope, it can't."
7557         ;;
7558 esac
7559 set d_casti32
7560 eval $setvar
7561 $rm -f try try.*
7562
7563 : check for ability to cast negative floats to unsigned
7564 echo " "
7565 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7566 $cat >try.c <<EOCP
7567 #include <stdio.h>
7568 #include <sys/types.h>
7569 #include <signal.h>
7570 $signal_t blech(s) int s; { exit(7); }
7571 $signal_t blech_in_list(s) int s; { exit(4); }
7572 unsigned long dummy_long(p) unsigned long p; { return p; }
7573 unsigned int dummy_int(p) unsigned int p; { return p; }
7574 unsigned short dummy_short(p) unsigned short p; { return p; }
7575 int main()
7576 {
7577         double f;
7578         unsigned long along;
7579         unsigned int aint;
7580         unsigned short ashort;
7581         int result = 0;
7582         char str[16];
7583         
7584         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7585            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7586            optimized the whole file away
7587         */
7588         /* Store the number in a writable string for gcc to pass to 
7589            sscanf under HP/UX.
7590         */
7591         sprintf(str, "-123");
7592         sscanf(str, "%lf", &f);  /* f = -123.; */
7593
7594         signal(SIGFPE, blech);
7595         along = (unsigned long)f;
7596         aint = (unsigned int)f;
7597         ashort = (unsigned short)f;
7598         if (along != (unsigned long)-123)
7599                 result |= 1;
7600         if (aint != (unsigned int)-123)
7601                 result |= 1;
7602         if (ashort != (unsigned short)-123)
7603                 result |= 1;
7604         sprintf(str, "1073741824.");
7605         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7606         f = f + f;
7607         along = 0;
7608         along = (unsigned long)f;
7609         if (along != 0x80000000)
7610                 result |= 2;
7611         f -= 1.;
7612         along = 0;
7613         along = (unsigned long)f;
7614         if (along != 0x7fffffff)
7615                 result |= 1;
7616         f += 2.;
7617         along = 0;
7618         along = (unsigned long)f;
7619         if (along != 0x80000001)
7620                 result |= 2;
7621         if (result)
7622                 exit(result);
7623         signal(SIGFPE, blech_in_list);
7624         sprintf(str, "123.");
7625         sscanf(str, "%lf", &f);  /* f = 123.; */
7626         along = dummy_long((unsigned long)f);
7627         aint = dummy_int((unsigned int)f);
7628         ashort = dummy_short((unsigned short)f);
7629         if (along != (unsigned long)123)
7630                 result |= 4;
7631         if (aint != (unsigned int)123)
7632                 result |= 4;
7633         if (ashort != (unsigned short)123)
7634                 result |= 4;
7635         exit(result);
7636
7637 }
7638 EOCP
7639 set try
7640 if eval $compile_ok; then
7641         ./try
7642         castflags=$?
7643 else
7644         echo "(I can't seem to compile the test program--assuming it can't)"
7645         castflags=7
7646 fi
7647 case "$castflags" in
7648 0)      val="$define"
7649         echo "Yup, it can."
7650         ;;
7651 *)      val="$undef"
7652         echo "Nope, it can't."
7653         ;;
7654 esac
7655 set d_castneg
7656 eval $setvar
7657 $rm -f try.*
7658
7659 : see if vprintf exists
7660 echo " "
7661 if set vprintf val -f d_vprintf; eval $csym; $val; then
7662         echo 'vprintf() found.' >&4
7663         val="$define"
7664         $cat >vprintf.c <<'EOF'
7665 #include <varargs.h>
7666
7667 int main() { xxx("foo"); }
7668
7669 xxx(va_alist)
7670 va_dcl
7671 {
7672         va_list args;
7673         char buf[10];
7674
7675         va_start(args);
7676         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7677 }
7678 EOF
7679         set vprintf
7680         if eval $compile && ./vprintf; then
7681                 echo "Your vsprintf() returns (int)." >&4
7682                 val2="$undef"
7683         else
7684                 echo "Your vsprintf() returns (char*)." >&4
7685                 val2="$define"
7686         fi
7687 else
7688         echo 'vprintf() NOT found.' >&4
7689                 val="$undef"
7690                 val2="$undef"
7691 fi
7692 set d_vprintf
7693 eval $setvar
7694 val=$val2
7695 set d_charvspr
7696 eval $setvar
7697
7698 : see if chown exists
7699 set chown d_chown
7700 eval $inlibc
7701
7702 : see if chroot exists
7703 set chroot d_chroot
7704 eval $inlibc
7705
7706 : see if chsize exists
7707 set chsize d_chsize
7708 eval $inlibc
7709
7710 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7711 while $test $# -ge 2; do
7712         case "$1" in
7713         $define) echo "#include <$2>";;
7714         esac ;
7715     shift 2;
7716 done > try.c;
7717 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7718 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7719         val="$define";
7720 else
7721         val="$undef";
7722 fi;
7723 set $varname;
7724 eval $setvar;
7725 $rm -f try.c try.o'
7726
7727 : see if this is a sys/uio.h system
7728 set sys/uio.h i_sysuio
7729 eval $inhdr
7730
7731 echo "Checking to see if your system supports struct iovec..." >&4
7732 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7733 eval $hasfield
7734 case "$d_iovec_s" in
7735 "$define")      echo "Yup, it does." >&4
7736                 ;;
7737 *)              echo "Nope, it doesn't." >&4
7738                 ;;
7739 esac
7740
7741 socketlib=''
7742 sockethdr=''
7743 : see whether socket exists
7744 echo " "
7745 $echo $n "Hmm... $c" >&4
7746 if set socket val -f d_socket; eval $csym; $val; then
7747         echo "Looks like you have Berkeley networking support." >&4
7748         d_socket="$define"
7749         if set setsockopt val -f; eval $csym; $val; then
7750                 d_oldsock="$undef"
7751         else
7752                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7753                 d_oldsock="$define"
7754         fi
7755 else
7756         if $contains socklib libc.list >/dev/null 2>&1; then
7757                 echo "Looks like you have Berkeley networking support." >&4
7758                 d_socket="$define"
7759                 : we will have to assume that it supports the 4.2 BSD interface
7760                 d_oldsock="$undef"
7761         else
7762                 echo "You don't have Berkeley networking in libc$_a..." >&4
7763                 if test "X$d_socket" = "X$define"; then
7764                    echo "...but you seem to believe that you have sockets." >&4
7765                 else
7766                         for net in net socket
7767                         do
7768                                 if test -f /usr/lib/lib$net$_a; then
7769                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7770                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7771                                         if $contains socket libc.list >/dev/null 2>&1; then
7772                                                 d_socket="$define"
7773                                                 socketlib="-l$net"
7774                                                 case "$net" in
7775                                                 net)
7776                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7777                                                         sockethdr="-I/usr/netinclude"
7778                                                         ;;
7779                                                 esac
7780                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7781                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7782                                                         d_oldsock="$undef"
7783                                                 else
7784                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7785                                                         d_oldsock="$define"
7786                                                 fi
7787                                                 break
7788                                         fi
7789                                 fi
7790                         done
7791                         if test "X$d_socket" != "X$define"; then
7792                            echo "or anywhere else I see." >&4
7793                            d_socket="$undef"
7794                            d_oldsock="$undef"
7795                         fi
7796                 fi
7797         fi
7798 fi
7799
7800 : see if socketpair exists
7801 set socketpair d_sockpair
7802 eval $inlibc
7803
7804
7805 echo " "
7806 echo "Checking the availability of certain socket constants..." >& 4
7807 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7808         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7809         $cat >try.c <<EOF
7810 #include <sys/types.h>
7811 #include <sys/socket.h>
7812 int main() {
7813     int i = $ENUM;
7814 }
7815 EOF
7816         val="$undef"
7817         set try; if eval $compile; then
7818                 val="$define"
7819         fi
7820         set d_${enum}; eval $setvar
7821         $rm -f try.c try
7822 done
7823
7824 set sendmsg d_sendmsg
7825 eval $inlibc
7826
7827 set recvmsg d_recvmsg
7828 eval $inlibc
7829
7830 echo " "
7831 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7832 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7833 eval $hasfield
7834 case "$d_msghdr_s" in
7835 "$define")      echo "Yup, it does." >&4
7836                 ;;
7837 *)              echo "Nope, it doesn't." >&4
7838                 ;;
7839 esac
7840
7841 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7842 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7843 eval $hasfield
7844 case "$d_cmsghdr_s" in
7845 "$define")      echo "Yup, it does." >&4
7846                 ;;
7847 *)              echo "Nope, it doesn't." >&4
7848                 ;;
7849 esac
7850
7851 : check for const keyword
7852 echo " "
7853 echo 'Checking to see if your C compiler knows about "const"...' >&4
7854 $cat >const.c <<'EOCP'
7855 typedef struct spug { int drokk; } spug;
7856 int main()
7857 {
7858         const char *foo;
7859         const spug y;
7860 }
7861 EOCP
7862 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7863         val="$define"
7864         echo "Yup, it does."
7865 else
7866         val="$undef"
7867         echo "Nope, it doesn't."
7868 fi
7869 set d_const
7870 eval $setvar
7871
7872 : see if crypt exists
7873 echo " "
7874 if set crypt val -f d_crypt; eval $csym; $val; then
7875         echo 'crypt() found.' >&4
7876         val="$define"
7877         cryptlib=''
7878 else
7879         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7880         if $test -z "$cryptlib"; then
7881                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7882         else
7883                 cryptlib=-lcrypt
7884         fi
7885         if $test -z "$cryptlib"; then
7886                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7887         else
7888                 cryptlib=-lcrypt
7889         fi
7890         if $test -z "$cryptlib"; then
7891                 cryptlib=`./loc libcrypt$_a "" $libpth`
7892         else
7893                 cryptlib=-lcrypt
7894         fi
7895         if $test -z "$cryptlib"; then
7896                 echo 'crypt() NOT found.' >&4
7897                 val="$undef"
7898         else
7899                 val="$define"
7900         fi
7901 fi
7902 set d_crypt
7903 eval $setvar
7904
7905 : get csh whereabouts
7906 case "$csh" in
7907 'csh') val="$undef" ;;
7908 *) val="$define" ;;
7909 esac
7910 set d_csh
7911 eval $setvar
7912 : Respect a hint or command line value for full_csh.
7913 case "$full_csh" in
7914 '') full_csh=$csh ;;
7915 esac
7916
7917 : see if cuserid exists
7918 set cuserid d_cuserid
7919 eval $inlibc
7920
7921 : see if this is a limits.h system
7922 set limits.h i_limits
7923 eval $inhdr
7924
7925 : see if this is a float.h system
7926 set float.h i_float
7927 eval $inhdr
7928
7929 : See if number of significant digits in a double precision number is known
7930 echo " "
7931 $cat >dbl_dig.c <<EOM
7932 #$i_limits I_LIMITS
7933 #$i_float I_FLOAT
7934 #ifdef I_LIMITS
7935 #include <limits.h>
7936 #endif
7937 #ifdef I_FLOAT
7938 #include <float.h>
7939 #endif
7940 #ifdef DBL_DIG
7941 printf("Contains DBL_DIG");
7942 #endif
7943 EOM
7944 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7945 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7946         echo "DBL_DIG found." >&4
7947         val="$define"
7948 else
7949         echo "DBL_DIG NOT found." >&4
7950         val="$undef"
7951 fi
7952 $rm -f dbl_dig.?
7953 set d_dbl_dig
7954 eval $setvar
7955
7956 : see if difftime exists
7957 set difftime d_difftime
7958 eval $inlibc
7959
7960 : see if this is a dirent system
7961 echo " "
7962 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7963         val="$define"
7964         echo "<dirent.h> found." >&4
7965 else
7966         val="$undef"
7967         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7968                 echo "<sys/dir.h> found." >&4
7969                 echo " "
7970         else
7971                 xinc=`./findhdr sys/ndir.h`
7972         fi
7973         echo "<dirent.h> NOT found." >&4
7974 fi
7975 set i_dirent
7976 eval $setvar
7977
7978 : Look for type of directory structure.
7979 echo " "
7980 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7981
7982 case "$direntrytype" in
7983 ''|' ')
7984         case "$i_dirent" in
7985         $define) guess1='struct dirent' ;;
7986         *) guess1='struct direct'  ;;
7987         esac
7988         ;;
7989 *)      guess1="$direntrytype"
7990         ;;
7991 esac
7992
7993 case "$guess1" in
7994 'struct dirent') guess2='struct direct' ;;
7995 *) guess2='struct dirent' ;;
7996 esac
7997                 
7998 if $contains "$guess1" try.c >/dev/null 2>&1; then
7999         direntrytype="$guess1"
8000         echo "Your directory entries are $direntrytype." >&4
8001 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8002         direntrytype="$guess2"
8003         echo "Your directory entries seem to be $direntrytype." >&4
8004 else
8005         echo "I don't recognize your system's directory entries." >&4
8006         rp="What type is used for directory entries on this system?"
8007         dflt="$guess1"
8008         . ./myread
8009         direntrytype="$ans"
8010 fi
8011 $rm -f try.c
8012
8013
8014 : see if the directory entry stores field length
8015 echo " "
8016 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8017 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8018         echo "Good, your directory entry keeps length information in d_namlen." >&4
8019         val="$define"
8020 else
8021         echo "Your directory entry does not know about the d_namlen field." >&4
8022         val="$undef"
8023 fi
8024 set d_dirnamlen
8025 eval $setvar
8026 $rm -f try.c
8027
8028 : see if dlerror exists
8029 xxx_runnm="$runnm"
8030 runnm=false
8031 set dlerror d_dlerror
8032 eval $inlibc
8033 runnm="$xxx_runnm"
8034
8035 : see if dlfcn is available
8036 set dlfcn.h i_dlfcn
8037 eval $inhdr
8038
8039 case "$usedl" in
8040 $define|y|true)
8041         $cat << EOM
8042
8043 On a few systems, the dynamically loaded modules that perl generates and uses
8044 will need a different extension than shared libs. The default will probably
8045 be appropriate.
8046
8047 EOM
8048         case "$dlext" in
8049         '')     dflt="$so" ;;
8050         *)      dflt="$dlext" ;;
8051         esac
8052         rp='What is the extension of dynamically loaded modules'
8053         . ./myread
8054         dlext="$ans"
8055         ;;
8056 *)
8057         dlext="none"
8058         ;;
8059 esac
8060
8061 : Check if dlsym need a leading underscore
8062 echo " "
8063 val="$undef"
8064
8065 case "$dlsrc" in
8066 dl_dlopen.xs)
8067         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8068         $cat >dyna.c <<'EOM'
8069 fred () { }
8070 EOM
8071
8072 $cat >fred.c<<EOM
8073
8074 #include <stdio.h>
8075 #$i_dlfcn I_DLFCN
8076 #ifdef I_DLFCN
8077 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8078 #else
8079 #include <sys/types.h>
8080 #include <nlist.h>
8081 #include <link.h>
8082 #endif
8083
8084 extern int fred() ;
8085
8086 int main()
8087 {
8088     void * handle ;
8089     void * symbol ;
8090 #ifndef RTLD_LAZY
8091     int mode = 1 ;
8092 #else
8093     int mode = RTLD_LAZY ;
8094 #endif
8095     handle = dlopen("./dyna.$dlext", mode) ;
8096     if (handle == NULL) {
8097         printf ("1\n") ;
8098         fflush (stdout) ;
8099         exit(0);
8100     }
8101     symbol = dlsym(handle, "fred") ;
8102     if (symbol == NULL) {
8103         /* try putting a leading underscore */
8104         symbol = dlsym(handle, "_fred") ;
8105         if (symbol == NULL) {
8106             printf ("2\n") ;
8107             fflush (stdout) ;
8108             exit(0);
8109         }
8110         printf ("3\n") ;
8111     }
8112     else
8113         printf ("4\n") ;
8114     fflush (stdout) ;
8115     exit(0);
8116 }
8117 EOM
8118         : Call the object file tmp-dyna.o in case dlext=o.
8119         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8120                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8121                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8122                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8123                 xxx=`./fred`
8124                 case $xxx in
8125                 1)      echo "Test program failed using dlopen." >&4
8126                         echo "Perhaps you should not use dynamic loading." >&4;;
8127                 2)      echo "Test program failed using dlsym." >&4
8128                         echo "Perhaps you should not use dynamic loading." >&4;;
8129                 3)      echo "dlsym needs a leading underscore" >&4
8130                         val="$define" ;;
8131                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8132                 esac
8133         else
8134                 echo "I can't compile and run the test program." >&4
8135                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8136         fi
8137         ;;
8138 esac
8139                 
8140 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8141
8142 set d_dlsymun
8143 eval $setvar
8144
8145 hasproto='varname=$1; func=$2; shift; shift;
8146 while $test $# -ge 2; do
8147         case "$1" in
8148         $define) echo "#include <$2>";;
8149         esac ;
8150     shift 2;
8151 done > try.c;
8152 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8153 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8154         echo "$func() prototype found.";
8155         val="$define";
8156 else
8157         echo "$func() prototype NOT found.";
8158         val="$undef";
8159 fi;
8160 set $varname;
8161 eval $setvar;
8162 $rm -f try.c tryout.c'
8163
8164 : see if prototype for drand48 is available
8165 echo " "
8166 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8167 eval $hasproto
8168
8169 : see if dup2 exists
8170 set dup2 d_dup2
8171 eval $inlibc
8172
8173 : see if eaccess exists
8174 set eaccess d_eaccess
8175 eval $inlibc
8176
8177 : see if endgrent exists
8178 set endgrent d_endgrent
8179 eval $inlibc
8180
8181 : see if endhostent exists
8182 set endhostent d_endhent
8183 eval $inlibc
8184
8185 : see if endnetent exists
8186 set endnetent d_endnent
8187 eval $inlibc
8188
8189 : see if endprotoent exists
8190 set endprotoent d_endpent
8191 eval $inlibc
8192
8193 : see if endpwent exists
8194 set endpwent d_endpwent
8195 eval $inlibc
8196
8197 : see if endservent exists
8198 set endservent d_endsent
8199 eval $inlibc
8200
8201 : see if endspent exists
8202 set endspent d_endspent
8203 eval $inlibc
8204
8205 : Locate the flags for 'open()'
8206 echo " "
8207 $cat >open3.c <<'EOCP'
8208 #include <sys/types.h>
8209 #ifdef I_FCNTL
8210 #include <fcntl.h>
8211 #endif
8212 #ifdef I_SYS_FILE
8213 #include <sys/file.h>
8214 #endif
8215 int main() {
8216         if(O_RDONLY);
8217 #ifdef O_TRUNC
8218         exit(0);
8219 #else
8220         exit(1);
8221 #endif
8222 }
8223 EOCP
8224 : check sys/file.h first to get FREAD on Sun
8225 if $test `./findhdr sys/file.h` && \
8226                 set open3 -DI_SYS_FILE && eval $compile; then
8227         h_sysfile=true;
8228         echo "<sys/file.h> defines the O_* constants..." >&4
8229         if ./open3; then
8230                 echo "and you have the 3 argument form of open()." >&4
8231                 val="$define"
8232         else
8233                 echo "but not the 3 argument form of open().  Oh, well." >&4
8234                 val="$undef"
8235         fi
8236 elif $test `./findhdr fcntl.h` && \
8237                 set open3 -DI_FCNTL && eval $compile; then
8238         h_fcntl=true;
8239         echo "<fcntl.h> defines the O_* constants..." >&4
8240         if ./open3; then
8241                 echo "and you have the 3 argument form of open()." >&4
8242                 val="$define"
8243         else
8244                 echo "but not the 3 argument form of open().  Oh, well." >&4
8245                 val="$undef"
8246         fi
8247 else
8248         val="$undef"
8249         echo "I can't find the O_* constant definitions!  You got problems." >&4
8250 fi
8251 set d_open3
8252 eval $setvar
8253 $rm -f open3*
8254
8255 : check for non-blocking I/O stuff
8256 case "$h_sysfile" in
8257 true) echo "#include <sys/file.h>" > head.c;;
8258 *)
8259         case "$h_fcntl" in
8260         true) echo "#include <fcntl.h>" > head.c;;
8261         *) echo "#include <sys/fcntl.h>" > head.c;;
8262         esac
8263         ;;
8264 esac
8265 echo " "
8266 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8267 case "$o_nonblock" in
8268 '')
8269         $cat head.c > try.c
8270         $cat >>try.c <<'EOCP'
8271 int main() {
8272 #ifdef O_NONBLOCK
8273         printf("O_NONBLOCK\n");
8274         exit(0);
8275 #endif
8276 #ifdef O_NDELAY
8277         printf("O_NDELAY\n");
8278         exit(0);
8279 #endif
8280 #ifdef FNDELAY
8281         printf("FNDELAY\n");
8282         exit(0);
8283 #endif
8284         exit(0);
8285 }
8286 EOCP
8287         set try
8288         if eval $compile_ok; then
8289                 o_nonblock=`./try`
8290                 case "$o_nonblock" in
8291                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8292                 *) echo "Seems like we can use $o_nonblock.";;
8293                 esac
8294         else
8295                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8296         fi
8297         ;;
8298 *) echo "Using $hint value $o_nonblock.";;
8299 esac
8300 $rm -f try try.* .out core
8301
8302 echo " "
8303 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8304 case "$eagain" in
8305 '')
8306         $cat head.c > try.c
8307         $cat >>try.c <<EOCP
8308 #include <errno.h>
8309 #include <sys/types.h>
8310 #include <signal.h>
8311 #define MY_O_NONBLOCK $o_nonblock
8312 #ifndef errno  /* XXX need better Configure test */
8313 extern int errno;
8314 #endif
8315 $signal_t blech(x) int x; { exit(3); }
8316 EOCP
8317         $cat >> try.c <<'EOCP'
8318 int main()
8319 {
8320         int pd[2];
8321         int pu[2];
8322         char buf[1];
8323         char string[100];
8324
8325         pipe(pd);       /* Down: child -> parent */
8326         pipe(pu);       /* Up: parent -> child */
8327         if (0 != fork()) {
8328                 int ret;
8329                 close(pd[1]);   /* Parent reads from pd[0] */
8330                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8331                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8332                         exit(1);
8333                 signal(SIGALRM, blech);
8334                 alarm(5);
8335                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8336                         exit(2);
8337                 sprintf(string, "%d\n", ret);
8338                 write(2, string, strlen(string));
8339                 alarm(0);
8340 #ifdef EAGAIN
8341                 if (errno == EAGAIN) {
8342                         printf("EAGAIN\n");
8343                         goto ok;
8344                 }
8345 #endif
8346 #ifdef EWOULDBLOCK
8347                 if (errno == EWOULDBLOCK)
8348                         printf("EWOULDBLOCK\n");
8349 #endif
8350         ok:
8351                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8352                 sleep(2);                               /* Give it time to close our pipe */
8353                 alarm(5);
8354                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8355                 alarm(0);
8356                 sprintf(string, "%d\n", ret);
8357                 write(3, string, strlen(string));
8358                 exit(0);
8359         }
8360
8361         close(pd[0]);                   /* We write to pd[1] */
8362         close(pu[1]);                   /* We read from pu[0] */
8363         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8364         close(pd[1]);                   /* Pipe pd is now fully closed! */
8365         exit(0);                                /* Bye bye, thank you for playing! */
8366 }
8367 EOCP
8368         set try
8369         if eval $compile_ok; then
8370                 echo "$startsh" >mtry
8371                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8372                 chmod +x mtry
8373                 ./mtry >/dev/null 2>&1
8374                 case $? in
8375                 0) eagain=`$cat try.out`;;
8376                 1) echo "Could not perform non-blocking setting!";;
8377                 2) echo "I did a successful read() for something that was not there!";;
8378                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8379                 *) echo "Something terribly wrong happened during testing.";;
8380                 esac
8381                 rd_nodata=`$cat try.ret`
8382                 echo "A read() system call with no data present returns $rd_nodata."
8383                 case "$rd_nodata" in
8384                 0|-1) ;;
8385                 *)
8386                         echo "(That's peculiar, fixing that to be -1.)"
8387                         rd_nodata=-1
8388                         ;;
8389                 esac
8390                 case "$eagain" in
8391                 '')
8392                         echo "Forcing errno EAGAIN on read() with no data available."
8393                         eagain=EAGAIN
8394                         ;;
8395                 *)
8396                         echo "Your read() sets errno to $eagain when no data is available."
8397                         ;;
8398                 esac
8399                 status=`$cat try.err`
8400                 case "$status" in
8401                 0) echo "And it correctly returns 0 to signal EOF.";;
8402                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8403                 *) echo "However, your read() returns '$status' on EOF??";;
8404                 esac
8405                 val="$define"
8406                 if test "$status" = "$rd_nodata"; then
8407                         echo "WARNING: you can't distinguish between EOF and no data!"
8408                         val="$undef"
8409                 fi
8410         else
8411                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8412                 eagain=EAGAIN
8413         fi
8414         set d_eofnblk
8415         eval $setvar
8416         ;;
8417 *)
8418         echo "Using $hint value $eagain."
8419         echo "Your read() returns $rd_nodata when no data is present."
8420         case "$d_eofnblk" in
8421         "$define") echo "And you can see EOF because read() returns 0.";;
8422         "$undef") echo "But you can't see EOF status from read() returned value.";;
8423         *)
8424                 echo "(Assuming you can't see EOF status from read anyway.)"
8425                 d_eofnblk=$undef
8426                 ;;
8427         esac
8428         ;;
8429 esac
8430 $rm -f try try.* .out core head.c mtry
8431
8432 : see if fchmod exists
8433 set fchmod d_fchmod
8434 eval $inlibc
8435
8436 : see if fchown exists
8437 set fchown d_fchown
8438 eval $inlibc
8439
8440 : see if this is an fcntl system
8441 set fcntl d_fcntl
8442 eval $inlibc
8443
8444 : see if sys/select.h has to be included
8445 set sys/select.h i_sysselct
8446 eval $inhdr
8447
8448 : see if we should include time.h, sys/time.h, or both
8449 echo " "
8450 if test "X$timeincl" = X; then
8451         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8452         $echo $n "I'm now running the test program...$c"
8453         $cat >try.c <<'EOCP'
8454 #include <sys/types.h>
8455 #ifdef I_TIME
8456 #include <time.h>
8457 #endif
8458 #ifdef I_SYSTIME
8459 #ifdef SYSTIMEKERNEL
8460 #define KERNEL
8461 #endif
8462 #include <sys/time.h>
8463 #endif
8464 #ifdef I_SYSSELECT
8465 #include <sys/select.h>
8466 #endif
8467 int main()
8468 {
8469         struct tm foo;
8470 #ifdef S_TIMEVAL
8471         struct timeval bar;
8472 #endif
8473 #ifdef S_TIMEZONE
8474         struct timezone tzp;
8475 #endif
8476         if (foo.tm_sec == foo.tm_sec)
8477                 exit(0);
8478 #ifdef S_TIMEVAL
8479         if (bar.tv_sec == bar.tv_sec)
8480                 exit(0);
8481 #endif
8482         exit(1);
8483 }
8484 EOCP
8485         flags=''
8486         for s_timezone in '-DS_TIMEZONE' ''; do
8487         sysselect=''
8488         for s_timeval in '-DS_TIMEVAL' ''; do
8489         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8490         for i_time in '' '-DI_TIME'; do
8491         for i_systime in '-DI_SYSTIME' ''; do
8492                 case "$flags" in
8493                 '') $echo $n ".$c"
8494                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8495                         if eval $compile; then
8496                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8497                                 shift
8498                                 flags="$*"
8499                                 echo " "
8500                                 $echo $n "Succeeded with $flags$c"
8501                         fi
8502                         ;;
8503                 esac
8504         done
8505         done
8506         done
8507         done
8508         done
8509         timeincl=''
8510         echo " "
8511         case "$flags" in
8512         *SYSTIMEKERNEL*) i_systimek="$define"
8513                 timeincl=`./findhdr sys/time.h`
8514                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8515         *) i_systimek="$undef";;
8516         esac
8517         case "$flags" in
8518         *I_TIME*) i_time="$define"
8519                 timeincl=`./findhdr time.h`" $timeincl"
8520                 echo "We'll include <time.h>." >&4;;
8521         *) i_time="$undef";;
8522         esac
8523         case "$flags" in
8524         *I_SYSTIME*) i_systime="$define"
8525                 timeincl=`./findhdr sys/time.h`" $timeincl"
8526                 echo "We'll include <sys/time.h>." >&4;;
8527         *) i_systime="$undef";;
8528         esac
8529         $rm -f try.c try
8530 fi
8531
8532 : check for fd_set items
8533 $cat <<EOM
8534
8535 Checking to see how well your C compiler handles fd_set and friends ...
8536 EOM
8537 $cat >fd_set.c <<EOCP
8538 #$i_systime I_SYS_TIME
8539 #$i_sysselct I_SYS_SELECT
8540 #$d_socket HAS_SOCKET
8541 #include <sys/types.h>
8542 #ifdef HAS_SOCKET
8543 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8544 #endif
8545 #ifdef I_SYS_TIME
8546 #include <sys/time.h>
8547 #endif
8548 #ifdef I_SYS_SELECT
8549 #include <sys/select.h>
8550 #endif
8551 int main() {
8552         fd_set fds;
8553
8554 #ifdef TRYBITS
8555         if(fds.fds_bits);
8556 #endif
8557
8558 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8559         exit(0);
8560 #else
8561         exit(1);
8562 #endif
8563 }
8564 EOCP
8565 set fd_set -DTRYBITS
8566 if eval $compile; then
8567         d_fds_bits="$define"
8568         d_fd_set="$define"
8569         echo "Well, your system knows about the normal fd_set typedef..." >&4
8570         if ./fd_set; then
8571                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8572                 d_fd_macros="$define"
8573         else
8574                 $cat >&4 <<'EOM'
8575 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8576 EOM
8577                 d_fd_macros="$undef"
8578         fi
8579 else
8580         $cat <<'EOM'
8581 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8582 EOM
8583         set fd_set
8584         if eval $compile; then
8585                 d_fds_bits="$undef"
8586                 d_fd_set="$define"
8587                 echo "Well, your system has some sort of fd_set available..." >&4
8588                 if ./fd_set; then
8589                         echo "and you have the normal fd_set macros." >&4
8590                         d_fd_macros="$define"
8591                 else
8592                         $cat <<'EOM'
8593 but not the normal fd_set macros!  Gross!  More work for me...
8594 EOM
8595                         d_fd_macros="$undef"
8596                 fi
8597         else
8598         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8599                 d_fd_set="$undef"
8600                 d_fds_bits="$undef"
8601                 d_fd_macros="$undef"
8602         fi
8603 fi
8604 $rm -f fd_set*
8605
8606 : see if fgetpos exists
8607 set fgetpos d_fgetpos
8608 eval $inlibc
8609
8610 : see if flock exists
8611 set flock d_flock
8612 eval $inlibc
8613
8614 : see if fork exists
8615 set fork d_fork
8616 eval $inlibc
8617
8618 : see if pathconf exists
8619 set pathconf d_pathconf
8620 eval $inlibc
8621
8622 : see if fpathconf exists
8623 set fpathconf d_fpathconf
8624 eval $inlibc
8625
8626
8627 : see if llseek exists
8628 set llseek d_llseek
8629 eval $inlibc
8630
8631 : check for off64_t
8632 echo " "
8633 $echo $n "Checking to see if your system supports off64_t...$c" >&4
8634 $cat >try.c <<EOCP
8635 #include <sys/types.h>
8636 #include <unistd.h>
8637 off64_t foo() { off64_t x; x = 7; return x; }'
8638 EOCP
8639 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8640         val="$define"
8641         echo " Yup, it does." >&4
8642 else
8643         val="$undef"
8644         echo " Nope, it doesn't." >&4
8645 fi
8646 $rm -f try.*
8647 set d_off64_t
8648 eval $setvar
8649
8650 : check for fpos64_t
8651 echo " "
8652 $echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8653 $cat >try.c <<EOCP
8654 #include <sys/stdio.h>
8655 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8656 EOCP
8657 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8658         val="$define"
8659         echo " Yup, it does." >&4
8660 else
8661         val="$undef"
8662         echo " Nope, it doesn't." >&4
8663 fi
8664 $rm -f try.*
8665 set d_fpos64_t
8666 eval $setvar
8667
8668 : see if fseeko exists
8669 set fseeko d_fseeko
8670 eval $inlibc
8671
8672 : see if fsetpos exists
8673 set fsetpos d_fsetpos
8674 eval $inlibc
8675
8676 : see if this is a sys/param system
8677 set sys/param.h i_sysparam
8678 eval $inhdr
8679
8680 : see if this is a sys/mount.h system
8681 set sys/mount.h i_sysmount
8682 eval $inhdr
8683
8684
8685 : see if statfs exists
8686 set statfs d_statfs
8687 eval $inlibc
8688
8689 : see if fstatfs exists
8690 set fstatfs d_fstatfs
8691 eval $inlibc
8692
8693 : see if statfs knows about mount flags
8694 case "$d_statfs" in
8695 define) set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8696         eval $hasfield
8697         ;;
8698 *)      val="$undef"
8699         set d_statfsflags
8700         eval $setvar
8701         ;;
8702 esac
8703
8704
8705 : see if statvfs exists
8706 set statvfs d_statvfs
8707 eval $inlibc
8708
8709 : see if fstatvfs exists
8710 set fstatvfs d_fstatvfs
8711 eval $inlibc
8712
8713
8714 : see if ftello exists
8715 set ftello d_ftello
8716 eval $inlibc
8717
8718 : see if getgrent exists
8719 set getgrent d_getgrent
8720 eval $inlibc
8721
8722 : see if gethostbyaddr exists
8723 set gethostbyaddr d_gethbyaddr
8724 eval $inlibc
8725
8726 : see if gethostbyname exists
8727 set gethostbyname d_gethbyname
8728 eval $inlibc
8729
8730 : see if gethostent exists
8731 set gethostent d_gethent
8732 eval $inlibc
8733
8734 : see how we will look up host name
8735 echo " "
8736 call=''
8737 if set gethostname val -f d_gethname; eval $csym; $val; then
8738         echo 'gethostname() found.' >&4
8739         d_gethname="$define"
8740         call=gethostname
8741 fi
8742 if set uname val -f d_uname; eval $csym; $val; then
8743         if ./xenix; then
8744                 $cat <<'EOM'
8745 uname() was found, but you're running xenix, and older versions of xenix
8746 have a broken uname(). If you don't really know whether your xenix is old
8747 enough to have a broken system call, use the default answer.
8748
8749 EOM
8750                 dflt=y
8751                 case "$d_uname" in
8752                 "$define") dflt=n;;
8753                 esac
8754                 rp='Is your uname() broken?'
8755                 . ./myread
8756                 case "$ans" in
8757                 n*) d_uname="$define"; call=uname;;
8758                 esac
8759         else
8760                 echo 'uname() found.' >&4
8761                 d_uname="$define"
8762                 case "$call" in
8763                 '') call=uname ;;
8764                 esac
8765         fi
8766 fi
8767 case "$d_gethname" in
8768 '') d_gethname="$undef";;
8769 esac
8770 case "$d_uname" in
8771 '') d_uname="$undef";;
8772 esac
8773 case "$d_uname$d_gethname" in
8774 *define*)
8775         dflt=n
8776         cat <<EOM
8777  
8778 Every now and then someone has a $call() that lies about the hostname
8779 but can't be fixed for political or economic reasons.  If you wish, I can
8780 pretend $call() isn't there and maybe compute hostname at run-time
8781 thanks to the '$phostname' command.
8782
8783 EOM
8784         rp="Shall I ignore $call() from now on?"
8785         . ./myread
8786         case "$ans" in
8787         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8788         esac;;
8789 esac
8790 case "$phostname" in
8791 '') aphostname='';;
8792 *) case "$aphostname" in
8793         /*) ;;
8794         *) set X $phostname
8795                 shift
8796                 file=$1
8797                 shift
8798                 file=`./loc $file $file $pth`
8799                 aphostname=`echo $file $*`
8800                 ;;
8801         esac
8802         ;;
8803 esac
8804 case "$d_uname$d_gethname" in
8805 *define*) ;;
8806 *)
8807         case "$phostname" in
8808         '')
8809                 echo "There will be no way for $package to get your hostname." >&4;;
8810         *)
8811         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8812                 ;;
8813         esac;;
8814 esac
8815 case "$d_phostname" in
8816 '') d_phostname="$undef";;
8817 esac
8818
8819 : see if this is a netdb.h system
8820 set netdb.h i_netdb
8821 eval $inhdr
8822
8823 : see if prototypes for various gethostxxx netdb.h functions are available
8824 echo " "
8825 set d_gethostprotos gethostent $i_netdb netdb.h
8826 eval $hasproto
8827
8828 : see if getlogin exists
8829 set getlogin d_getlogin
8830 eval $inlibc
8831
8832 : see if getmnt exists
8833 set getmnt d_getmnt
8834 eval $inlibc
8835
8836 : see if getmntent exists
8837 set getmntent d_getmntent
8838 eval $inlibc
8839
8840 : see if getnetbyaddr exists
8841 set getnetbyaddr d_getnbyaddr
8842 eval $inlibc
8843
8844 : see if getnetbyname exists
8845 set getnetbyname d_getnbyname
8846 eval $inlibc
8847
8848 : see if getnetent exists
8849 set getnetent d_getnent
8850 eval $inlibc
8851
8852 : see if prototypes for various getnetxxx netdb.h functions are available
8853 echo " "
8854 set d_getnetprotos getnetent $i_netdb netdb.h
8855 eval $hasproto
8856
8857
8858 : see if getprotobyname exists
8859 set getprotobyname d_getpbyname
8860 eval $inlibc
8861
8862 : see if getprotobynumber exists
8863 set getprotobynumber d_getpbynumber
8864 eval $inlibc
8865
8866 : see if getprotoent exists
8867 set getprotoent d_getpent
8868 eval $inlibc
8869
8870 : see if getpgid exists
8871 set getpgid d_getpgid
8872 eval $inlibc
8873
8874 : see if getpgrp2 exists
8875 set getpgrp2 d_getpgrp2
8876 eval $inlibc
8877
8878 : see if getppid exists
8879 set getppid d_getppid
8880 eval $inlibc
8881
8882 : see if getpriority exists
8883 set getpriority d_getprior
8884 eval $inlibc
8885
8886 : see if prototypes for various getprotoxxx netdb.h functions are available
8887 echo " "
8888 set d_getprotoprotos getprotoent $i_netdb netdb.h
8889 eval $hasproto
8890
8891 : see if getpwent exists
8892 set getpwent d_getpwent
8893 eval $inlibc
8894
8895
8896 : see if getservbyname exists
8897 set getservbyname d_getsbyname
8898 eval $inlibc
8899
8900 : see if getservbyport exists
8901 set getservbyport d_getsbyport
8902 eval $inlibc
8903
8904 : see if getservent exists
8905 set getservent d_getsent
8906 eval $inlibc
8907
8908 : see if prototypes for various getservxxx netdb.h functions are available
8909 echo " "
8910 set d_getservprotos getservent $i_netdb netdb.h
8911 eval $hasproto
8912
8913 : see if getspent exists
8914 set getspent d_getspent
8915 eval $inlibc
8916
8917 : see if getspnam exists
8918 set getspnam d_getspnam
8919 eval $inlibc
8920
8921 : see if gettimeofday or ftime exists
8922 set gettimeofday d_gettimeod
8923 eval $inlibc
8924 case "$d_gettimeod" in
8925 "$undef")
8926         set ftime d_ftime 
8927         eval $inlibc
8928         ;;
8929 *)
8930         val="$undef"; set d_ftime; eval $setvar
8931         ;;
8932 esac
8933 case "$d_gettimeod$d_ftime" in
8934 "$undef$undef")
8935         echo " "
8936         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8937         ;;
8938 esac
8939
8940 : see if this is an grp system
8941 set grp.h i_grp
8942 eval $inhdr
8943
8944 case "$i_grp" in
8945 $define)
8946         xxx=`./findhdr grp.h`
8947         $cppstdin $cppflags $cppminus < $xxx >$$.h
8948
8949         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8950                 val="$define"
8951         else
8952                 val="$undef"
8953         fi
8954         set d_grpasswd
8955         eval $setvar
8956
8957         $rm -f $$.h
8958         ;;
8959 *)
8960         val="$undef";
8961         set d_grpasswd; eval $setvar
8962         ;;
8963 esac
8964
8965 : see if hasmntopt exists
8966 set hasmntopt d_hasmntopt
8967 eval $inlibc
8968
8969 : see if this is a netinet/in.h or sys/in.h system
8970 set netinet/in.h i_niin sys/in.h i_sysin
8971 eval $inhdr
8972
8973 : see if arpa/inet.h has to be included
8974 set arpa/inet.h i_arpainet
8975 eval $inhdr
8976
8977 : see if htonl --and friends-- exists
8978 val=''
8979 set htonl val
8980 eval $inlibc
8981
8982 : Maybe they are macros.
8983 case "$val" in
8984 $undef)
8985         $cat >htonl.c <<EOM
8986 #include <stdio.h>
8987 #include <sys/types.h>
8988 #$i_niin I_NETINET_IN
8989 #$i_sysin I_SYS_IN
8990 #$i_arpainet I_ARPA_INET
8991 #ifdef I_NETINET_IN
8992 #include <netinet/in.h>
8993 #endif
8994 #ifdef I_SYS_IN
8995 #include <sys/in.h>
8996 #endif
8997 #ifdef I_ARPA_INET
8998 #include <arpa/inet.h>
8999 #endif
9000 #ifdef htonl
9001 printf("Defined as a macro.");
9002 #endif
9003 EOM
9004         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9005         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9006                 val="$define"
9007                 echo "But it seems to be defined as a macro." >&4
9008         fi
9009         $rm -f htonl.?
9010         ;;
9011 esac
9012 set d_htonl
9013 eval $setvar
9014
9015 : see which of string.h or strings.h is needed
9016 echo " "
9017 strings=`./findhdr string.h`
9018 if $test "$strings" && $test -r "$strings"; then
9019         echo "Using <string.h> instead of <strings.h>." >&4
9020         val="$define"
9021 else
9022         val="$undef"
9023         strings=`./findhdr strings.h`
9024         if $test "$strings" && $test -r "$strings"; then
9025                 echo "Using <strings.h> instead of <string.h>." >&4
9026         else
9027                 echo "No string header found -- You'll surely have problems." >&4
9028         fi
9029 fi
9030 set i_string
9031 eval $setvar
9032 case "$i_string" in
9033 "$undef") strings=`./findhdr strings.h`;;
9034 *)        strings=`./findhdr string.h`;;
9035 esac
9036
9037 : index or strchr
9038 echo " "
9039 if set index val -f; eval $csym; $val; then
9040         if set strchr val -f d_strchr; eval $csym; $val; then
9041                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9042                         val="$define"
9043                         vali="$undef"
9044                         echo "strchr() found." >&4
9045                 else
9046                         val="$undef"
9047                         vali="$define"
9048                         echo "index() found." >&4
9049                 fi
9050         else
9051                 val="$undef"
9052                 vali="$define"
9053                 echo "index() found." >&4
9054         fi
9055 else
9056         if set strchr val -f d_strchr; eval $csym; $val; then
9057                 val="$define"
9058                 vali="$undef"
9059                 echo "strchr() found." >&4
9060         else
9061                 echo "No index() or strchr() found!" >&4
9062                 val="$undef"
9063                 vali="$undef"
9064         fi
9065 fi
9066 set d_strchr; eval $setvar
9067 val="$vali"
9068 set d_index; eval $setvar
9069
9070 : check whether inet_aton exists
9071 set inet_aton d_inetaton
9072 eval $inlibc
9073
9074 : Look for isascii
9075 echo " "
9076 $cat >isascii.c <<'EOCP'
9077 #include <stdio.h>
9078 #include <ctype.h>
9079 int main() {
9080         int c = 'A';
9081         if (isascii(c))
9082                 exit(0);
9083         else
9084                 exit(1);
9085 }
9086 EOCP
9087 set isascii
9088 if eval $compile; then
9089         echo "isascii() found." >&4
9090         val="$define"
9091 else
9092         echo "isascii() NOT found." >&4
9093         val="$undef"
9094 fi
9095 set d_isascii
9096 eval $setvar
9097 $rm -f isascii*
9098
9099 : see if killpg exists
9100 set killpg d_killpg
9101 eval $inlibc
9102
9103 : see if lchown exists
9104 echo " "
9105 $cat > try.c <<'EOCP'
9106 /* System header to define __stub macros and hopefully few prototypes,
9107     which can conflict with char lchown(); below.  */
9108 #include <assert.h>
9109 /* Override any gcc2 internal prototype to avoid an error.  */
9110 /* We use char because int might match the return type of a gcc2
9111    builtin and then its argument prototype would still apply.  */
9112 char lchown();
9113 int main() {
9114     /*  The GNU C library defines this for functions which it implements
9115         to always fail with ENOSYS.  Some functions are actually named
9116         something starting with __ and the normal name is an alias.  */
9117 #if defined (__stub_lchown) || defined (__stub___lchown)
9118 choke me
9119 #else
9120 lchown();
9121 #endif
9122 ; return 0; }
9123 EOCP
9124 set try
9125 if eval $compile; then
9126     $echo "lchown() found." >&4
9127     val="$define"
9128 else
9129     $echo "lchown() NOT found." >&4
9130     val="$undef"
9131 fi
9132 set d_lchown
9133 eval $setvar
9134
9135 : See if number of significant digits in a double precision number is known
9136 echo " "
9137 $cat >ldbl_dig.c <<EOM
9138 #$i_limits I_LIMITS
9139 #$i_float I_FLOAT
9140 #ifdef I_LIMITS
9141 #include <limits.h>
9142 #endif
9143 #ifdef I_FLOAT
9144 #include <float.h>
9145 #endif
9146 #ifdef LDBL_DIG
9147 printf("Contains LDBL_DIG");
9148 #endif
9149 EOM
9150 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9151 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9152         echo "LDBL_DIG found." >&4
9153         val="$define"
9154 else
9155         echo "LDBL_DIG NOT found." >&4
9156         val="$undef"
9157 fi
9158 $rm -f ldbl_dig.?
9159 set d_ldbl_dig
9160 eval $setvar
9161
9162 : see if link exists
9163 set link d_link
9164 eval $inlibc
9165
9166 : see if localeconv exists
9167 set localeconv d_locconv
9168 eval $inlibc
9169
9170 : see if lockf exists
9171 set lockf d_lockf
9172 eval $inlibc
9173
9174 : see if lstat exists
9175 set lstat d_lstat
9176 eval $inlibc
9177
9178 : see if madvise exists
9179 set madvise d_madvise
9180 eval $inlibc
9181
9182 : see if mblen exists
9183 set mblen d_mblen
9184 eval $inlibc
9185
9186 : see if mbstowcs exists
9187 set mbstowcs d_mbstowcs
9188 eval $inlibc
9189
9190 : see if mbtowc exists
9191 set mbtowc d_mbtowc
9192 eval $inlibc
9193
9194 : see if memchr exists
9195 set memchr d_memchr
9196 eval $inlibc
9197
9198 : see if memcmp exists
9199 set memcmp d_memcmp
9200 eval $inlibc
9201
9202 : see if memcpy exists
9203 set memcpy d_memcpy
9204 eval $inlibc
9205
9206 : see if memmove exists
9207 set memmove d_memmove
9208 eval $inlibc
9209
9210 : see if memset exists
9211 set memset d_memset
9212 eval $inlibc
9213
9214 : see if mkdir exists
9215 set mkdir d_mkdir
9216 eval $inlibc
9217
9218 : see if mkfifo exists
9219 set mkfifo d_mkfifo
9220 eval $inlibc
9221
9222 : see if mktime exists
9223 set mktime d_mktime
9224 eval $inlibc
9225
9226 : see if this is a sys/mman.h system
9227 set sys/mman.h i_sysmman
9228 eval $inhdr
9229
9230 : see if mmap exists
9231 set mmap d_mmap
9232 eval $inlibc
9233 : see what shmat returns
9234 : default to something harmless
9235 mmaptype='void *'
9236 case "$i_sysmman$d_mmap" in
9237 "$define$define")
9238         $cat >mmap.c <<'END'
9239 #include <sys/mman.h>
9240 void *mmap();
9241 END
9242         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9243                 mmaptype='void *'
9244         else
9245                 mmaptype='caddr_t'
9246         fi
9247         echo "and it returns ($mmaptype)." >&4
9248         ;;
9249 esac
9250
9251
9252
9253 : see if mprotect exists
9254 set mprotect d_mprotect
9255 eval $inlibc
9256
9257 : see if msgctl exists
9258 set msgctl d_msgctl
9259 eval $inlibc
9260
9261 : see if msgget exists
9262 set msgget d_msgget
9263 eval $inlibc
9264
9265 : see if msgsnd exists
9266 set msgsnd d_msgsnd
9267 eval $inlibc
9268
9269 : see if msgrcv exists
9270 set msgrcv d_msgrcv
9271 eval $inlibc
9272
9273 : see how much of the 'msg*(2)' library is present.
9274 h_msg=true
9275 echo " "
9276 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9277 *"$undef"*) h_msg=false;;
9278 esac
9279 case "$osname" in
9280 freebsd)
9281     case "`ipcs 2>&1`" in
9282     "SVID messages"*"not configured"*)
9283         echo "Your $osname does not have the msg*(2) configured." >&4
9284         h_msg=false
9285         val="$undef"
9286         set msgctl d_msgctl
9287         eval $setvar
9288         set msgget d_msgget
9289         eval $setvar
9290         set msgsnd d_msgsnd
9291         eval $setvar
9292         set msgrcv d_msgrcv
9293         eval $setvar
9294         ;;
9295     esac
9296     ;;
9297 esac
9298 : we could also check for sys/ipc.h ...
9299 if $h_msg && $test `./findhdr sys/msg.h`; then
9300         echo "You have the full msg*(2) library." >&4
9301         val="$define"
9302 else
9303         echo "You don't have the full msg*(2) library." >&4
9304         val="$undef"
9305 fi
9306 set d_msg
9307 eval $setvar
9308
9309 : see if msync exists
9310 set msync d_msync
9311 eval $inlibc
9312
9313 : see if munmap exists
9314 set munmap d_munmap
9315 eval $inlibc
9316
9317 : see if nice exists
9318 set nice d_nice
9319 eval $inlibc
9320
9321 : see if POSIX threads are available
9322 set pthread.h i_pthread
9323 eval $inhdr
9324
9325
9326
9327
9328 : how to create joinable pthreads
9329 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9330         echo " "
9331         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9332         $cat >try.c <<'EOCP'
9333 #include <pthread.h>
9334 int main() {
9335     int detachstate = JOINABLE;
9336 }
9337 EOCP
9338         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9339         if eval $compile; then
9340                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9341                 val="$undef" # Yes, undef.
9342                 set d_old_pthread_create_joinable
9343                 eval $setvar
9344                 val=""
9345                 set old_pthread_create_joinable
9346                 eval $setvar
9347         else
9348                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9349                 if eval $compile; then
9350                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9351                         val="$define"
9352                         set d_old_pthread_create_joinable
9353                         eval $setvar
9354                         val=PTHREAD_CREATE_UNDETACHED
9355                         set old_pthread_create_joinable
9356                         eval $setvar
9357                 else            
9358                         set try -DJOINABLE=__UNDETACHED
9359                         if eval $compile; then
9360                                 echo "You seem to use __UNDETACHED." >&4
9361                                 val="$define"
9362                                 set d_old_pthread_create_joinable
9363                                 eval $setvar
9364                                 val=__UNDETACHED
9365                                 set old_pthread_create_joinable
9366                                 eval $setvar
9367                         else
9368                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9369                                 val="$define"
9370                                 set d_old_pthread_create_joinable
9371                                 eval $setvar
9372                                 val=0
9373                                 set old_pthread_create_joinable
9374                                 eval $setvar
9375                         fi
9376                 fi
9377         fi
9378         $rm -f try try.*
9379 else
9380     d_old_pthread_create_joinable="$undef"
9381     old_pthread_create_joinable=""
9382 fi
9383
9384 : see if pause exists
9385 set pause d_pause
9386 eval $inlibc
9387
9388 : see if pipe exists
9389 set pipe d_pipe
9390 eval $inlibc
9391
9392 : see if poll exists
9393 set poll d_poll
9394 eval $inlibc
9395
9396
9397 : see whether the various POSIXish _yields exist
9398 $cat >try.c <<EOP
9399 #include <pthread.h>
9400 #include <stdio.h>
9401 int main() {
9402 #ifdef SCHED_YIELD
9403         sched_yield();
9404 #else
9405 #ifdef PTHREAD_YIELD
9406         pthread_yield();
9407 #else
9408 #ifdef PTHREAD_YIELD_NULL
9409         pthread_yield(NULL);
9410 #endif
9411 #endif
9412 #endif
9413 }
9414 EOP
9415 : see if sched_yield exists
9416 set try -DSCHED_YIELD
9417 if eval $compile; then
9418     val="$define"
9419     sched_yield='sched_yield()'
9420 else
9421     val="$undef"
9422 fi
9423 case "$usethreads" in
9424 $define)
9425         case "$val" in
9426         $define) echo 'sched_yield() found.' >&4        ;;
9427         *)       echo 'sched_yield() NOT found.' >&4    ;;
9428         esac
9429 esac
9430 set d_sched_yield
9431 eval $setvar
9432
9433 : see if pthread_yield exists
9434 set try -DPTHREAD_YIELD
9435 if eval $compile; then
9436     val="$define"
9437     case "$sched_yield" in
9438     '') sched_yield='pthread_yield()' ;;
9439     esac
9440 else
9441     set try -DPTHREAD_YIELD_NULL
9442     if eval $compile; then
9443         val="$define"
9444         case "$sched_yield" in
9445         '') sched_yield='pthread_yield(NULL)' ;;
9446         esac
9447     else
9448         val="$undef"
9449     fi
9450 fi
9451 case "$usethreads" in
9452 $define)
9453         case "$val" in
9454         $define) echo 'pthread_yield() found.' >&4      ;;
9455         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9456         esac
9457         ;;
9458 esac
9459 set d_pthread_yield
9460 eval $setvar
9461
9462 case "$sched_yield" in
9463 '') sched_yield=undef ;;
9464 esac
9465
9466 $rm -f try try.*
9467
9468 : see if this is a pwd.h system
9469 set pwd.h i_pwd
9470 eval $inhdr
9471
9472 case "$i_pwd" in
9473 $define)
9474         xxx=`./findhdr pwd.h`
9475         $cppstdin $cppflags $cppminus < $xxx >$$.h
9476
9477         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9478                 val="$define"
9479         else
9480                 val="$undef"
9481         fi
9482         set d_pwquota
9483         eval $setvar
9484
9485         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9486                 val="$define"
9487         else
9488                 val="$undef"
9489         fi
9490         set d_pwage
9491         eval $setvar
9492
9493         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9494                 val="$define"
9495         else
9496                 val="$undef"
9497         fi
9498         set d_pwchange
9499         eval $setvar
9500
9501         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9502                 val="$define"
9503         else
9504                 val="$undef"
9505         fi
9506         set d_pwclass
9507         eval $setvar
9508
9509         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9510                 val="$define"
9511         else
9512                 val="$undef"
9513         fi
9514         set d_pwexpire
9515         eval $setvar
9516
9517         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9518                 val="$define"
9519         else
9520                 val="$undef"
9521         fi
9522         set d_pwcomment
9523         eval $setvar
9524
9525         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9526                 val="$define"
9527         else
9528                 val="$undef"
9529         fi
9530         set d_pwgecos
9531         eval $setvar
9532
9533         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9534                 val="$define"
9535         else
9536                 val="$undef"
9537         fi
9538         set d_pwpasswd
9539         eval $setvar
9540
9541         $rm -f $$.h
9542         ;;
9543 *)
9544         val="$undef"; 
9545         set d_pwquota; eval $setvar
9546         set d_pwage; eval $setvar
9547         set d_pwchange; eval $setvar
9548         set d_pwclass; eval $setvar
9549         set d_pwexpire; eval $setvar
9550         set d_pwcomment; eval $setvar
9551         set d_pwgecos; eval $setvar
9552         set d_pwpasswd; eval $setvar
9553         ;;
9554 esac
9555
9556 : see if readdir and friends exist
9557 set readdir d_readdir
9558 eval $inlibc
9559 set seekdir d_seekdir
9560 eval $inlibc
9561 set telldir d_telldir
9562 eval $inlibc
9563 set rewinddir d_rewinddir
9564 eval $inlibc
9565
9566 : see if readlink exists
9567 set readlink d_readlink
9568 eval $inlibc
9569
9570 : see if readv exists
9571 set readv d_readv
9572 eval $inlibc
9573
9574 : see if rename exists
9575 set rename d_rename
9576 eval $inlibc
9577
9578 : see if rmdir exists
9579 set rmdir d_rmdir
9580 eval $inlibc
9581
9582 : see if memory.h is available.
9583 val=''
9584 set memory.h val
9585 eval $inhdr
9586
9587 : See if it conflicts with string.h
9588 case "$val" in
9589 $define)
9590         case "$strings" in
9591         '') ;;
9592         *)
9593                 $cppstdin $cppflags $cppminus < $strings > mem.h
9594                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9595                         echo " "
9596                         echo "We won't be including <memory.h>."
9597                         val="$undef"
9598                 fi
9599                 $rm -f mem.h
9600                 ;;
9601         esac
9602 esac
9603 set i_memory
9604 eval $setvar
9605
9606 : can bcopy handle overlapping blocks?
9607 val="$undef"
9608 case "$d_bcopy" in
9609 "$define")
9610         echo " "
9611         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9612         $cat >try.c <<EOCP
9613 #$i_memory I_MEMORY
9614 #$i_stdlib I_STDLIB
9615 #$i_string I_STRING
9616 #$i_unistd I_UNISTD
9617 EOCP
9618         $cat >>try.c <<'EOCP'
9619 #include <stdio.h>
9620 #ifdef I_MEMORY
9621 #  include <memory.h>
9622 #endif
9623 #ifdef I_STDLIB
9624 #  include <stdlib.h>
9625 #endif
9626 #ifdef I_STRING
9627 #  include <string.h>
9628 #else
9629 #  include <strings.h>
9630 #endif
9631 #ifdef I_UNISTD
9632 #  include <unistd.h>  /* Needed for NetBSD */
9633 #endif
9634 int main()
9635 {
9636 char buf[128], abc[128];
9637 char *b;
9638 int len;
9639 int off;
9640 int align;
9641
9642 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9643
9644 for (align = 7; align >= 0; align--) {
9645         for (len = 36; len; len--) {
9646                 b = buf+align;
9647                 bcopy(abc, b, len);
9648                 for (off = 1; off <= len; off++) {
9649                         bcopy(b, b+off, len);
9650                         bcopy(b+off, b, len);
9651                         if (bcmp(b, abc, len))
9652                                 exit(1);
9653                 }
9654         }
9655 }
9656 exit(0);
9657 }
9658 EOCP
9659         set try
9660         if eval $compile_ok; then
9661                 if ./try 2>/dev/null; then
9662                         echo "Yes, it can."
9663                         val="$define"
9664                 else
9665                         echo "It can't, sorry."
9666                         case "$d_memmove" in
9667                         "$define") echo "But that's Ok since you have memmove()." ;;
9668                         esac
9669                 fi
9670         else
9671                 echo "(I can't compile the test program, so we'll assume not...)"
9672                 case "$d_memmove" in
9673                 "$define") echo "But that's Ok since you have memmove()." ;;
9674                 esac
9675         fi
9676         ;;
9677 esac
9678 $rm -f try.* try core
9679 set d_safebcpy
9680 eval $setvar
9681
9682 : can memcpy handle overlapping blocks?
9683 val="$undef"
9684 case "$d_memcpy" in
9685 "$define")
9686         echo " "
9687         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9688         $cat >try.c <<EOCP
9689 #$i_memory I_MEMORY
9690 #$i_stdlib I_STDLIB
9691 #$i_string I_STRING
9692 #$i_unistd I_UNISTD
9693 EOCP
9694         $cat >>try.c <<'EOCP'
9695 #include <stdio.h>
9696 #ifdef I_MEMORY
9697 #  include <memory.h>
9698 #endif
9699 #ifdef I_STDLIB
9700 #  include <stdlib.h>
9701 #endif
9702 #ifdef I_STRING
9703 #  include <string.h>
9704 #else
9705 #  include <strings.h>
9706 #endif
9707 #ifdef I_UNISTD
9708 #  include <unistd.h>  /* Needed for NetBSD */
9709 #endif
9710 int main()
9711 {
9712 char buf[128], abc[128];
9713 char *b;
9714 int len;
9715 int off;
9716 int align;
9717
9718 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9719    try to store the string in read-only memory. */
9720 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9721
9722 for (align = 7; align >= 0; align--) {
9723         for (len = 36; len; len--) {
9724                 b = buf+align;
9725                 memcpy(b, abc, len);
9726                 for (off = 1; off <= len; off++) {
9727                         memcpy(b+off, b, len);
9728                         memcpy(b, b+off, len);
9729                         if (memcmp(b, abc, len))
9730                                 exit(1);
9731                 }
9732         }
9733 }
9734 exit(0);
9735 }
9736 EOCP
9737         set try
9738         if eval $compile_ok; then
9739                 if ./try 2>/dev/null; then
9740                         echo "Yes, it can."
9741                         val="$define"
9742                 else
9743                         echo "It can't, sorry."
9744                         case "$d_memmove" in
9745                         "$define") echo "But that's Ok since you have memmove()." ;;
9746                         esac
9747                 fi
9748         else
9749                 echo "(I can't compile the test program, so we'll assume not...)"
9750                 case "$d_memmove" in
9751                 "$define") echo "But that's Ok since you have memmove()." ;;
9752                 esac
9753         fi
9754         ;;
9755 esac
9756 $rm -f try.* try core
9757 set d_safemcpy
9758 eval $setvar
9759
9760 : can memcmp be trusted to compare relative magnitude?
9761 val="$undef"
9762 case "$d_memcmp" in
9763 "$define")
9764         echo " "
9765         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9766         $cat >try.c <<EOCP
9767 #$i_memory I_MEMORY
9768 #$i_stdlib I_STDLIB
9769 #$i_string I_STRING
9770 #$i_unistd I_UNISTD
9771 EOCP
9772         $cat >>try.c <<'EOCP'
9773 #include <stdio.h>
9774 #ifdef I_MEMORY
9775 #  include <memory.h>
9776 #endif
9777 #ifdef I_STDLIB
9778 #  include <stdlib.h>
9779 #endif
9780 #ifdef I_STRING
9781 #  include <string.h>
9782 #else
9783 #  include <strings.h>
9784 #endif
9785 #ifdef I_UNISTD
9786 #  include <unistd.h>  /* Needed for NetBSD */
9787 #endif
9788 int main()
9789 {
9790 char a = -1;
9791 char b = 0;
9792 if ((a < b) && memcmp(&a, &b, 1) < 0)
9793         exit(1);
9794 exit(0);
9795 }
9796 EOCP
9797         set try
9798         if eval $compile_ok; then
9799                 if ./try 2>/dev/null; then
9800                         echo "Yes, it can."
9801                         val="$define"
9802                 else
9803                         echo "No, it can't (it uses signed chars)."
9804                 fi
9805         else
9806                 echo "(I can't compile the test program, so we'll assume not...)"
9807         fi
9808         ;;
9809 esac
9810 $rm -f try.* try core
9811 set d_sanemcmp
9812 eval $setvar
9813
9814 : see if select exists
9815 set select d_select
9816 eval $inlibc
9817
9818 : see if semctl exists
9819 set semctl d_semctl
9820 eval $inlibc
9821
9822 : see if semget exists
9823 set semget d_semget
9824 eval $inlibc
9825
9826 : see if semop exists
9827 set semop d_semop
9828 eval $inlibc
9829
9830 : see how much of the 'sem*(2)' library is present.
9831 h_sem=true
9832 echo " "
9833 case "$d_semctl$d_semget$d_semop" in
9834 *"$undef"*) h_sem=false;;
9835 esac
9836 case "$osname" in
9837 freebsd)
9838     case "`ipcs 2>&1`" in
9839     "SVID messages"*"not configured"*)
9840         echo "Your $osname does not have the sem*(2) configured." >&4
9841         h_sem=false
9842         val="$undef"
9843         set semctl d_semctl
9844         eval $setvar
9845         set semget d_semget
9846         eval $setvar
9847         set semop d_semop
9848         eval $setvar
9849         ;;
9850     esac
9851     ;;
9852 esac
9853 : we could also check for sys/ipc.h ...
9854 if $h_sem && $test `./findhdr sys/sem.h`; then
9855         echo "You have the full sem*(2) library." >&4
9856         val="$define"
9857 else
9858         echo "You don't have the full sem*(2) library." >&4
9859         val="$undef"
9860 fi
9861 set d_sem
9862 eval $setvar
9863
9864 : see whether sys/sem.h defines union semun
9865 echo " "
9866 $cat > try.c <<'END'
9867 #include <sys/types.h>
9868 #include <sys/ipc.h>
9869 #include <sys/sem.h>
9870 int main () { union semun semun; semun.buf = 0; }
9871 END
9872 set try
9873 if eval $compile; then
9874     echo "You have union semun in <sys/sem.h>." >&4
9875     val="$define"
9876 else
9877     echo "You do not have union semun in <sys/sem.h>." >&4
9878     val="$undef"
9879 fi
9880 $rm -f try try.c try.h
9881 set d_union_semun
9882 eval $setvar
9883
9884 : see how to do semctl IPC_STAT
9885 case "$d_sem" in
9886 $define)
9887     : see whether semctl IPC_STAT can use union semun
9888     echo " "
9889     $cat > try.h <<END
9890 #ifndef S_IRUSR
9891 #   ifdef S_IREAD
9892 #       define S_IRUSR S_IREAD
9893 #       define S_IWUSR S_IWRITE
9894 #       define S_IXUSR S_IEXEC
9895 #   else
9896 #       define S_IRUSR 0400
9897 #       define S_IWUSR 0200
9898 #       define S_IXUSR 0100
9899 #   endif
9900 #   define S_IRGRP (S_IRUSR>>3)
9901 #   define S_IWGRP (S_IWUSR>>3)
9902 #   define S_IXGRP (S_IXUSR>>3)
9903 #   define S_IROTH (S_IRUSR>>6)
9904 #   define S_IWOTH (S_IWUSR>>6)
9905 #   define S_IXOTH (S_IXUSR>>6)
9906 #endif
9907 #ifndef S_IRWXU
9908 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9909 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9910 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9911 #endif
9912 END
9913
9914     $cat > try.c <<END
9915 #include <sys/types.h>
9916 #include <sys/ipc.h>
9917 #include <sys/sem.h>
9918 #include <sys/stat.h>
9919 #include <stdio.h>
9920 #include <errno.h>
9921 #include "try.h"
9922 #ifndef errno
9923 extern int errno;
9924 #endif
9925 #$d_union_semun HAS_UNION_SEMUN
9926 int main() {
9927     union semun
9928 #ifndef HAS_UNION_SEMUN
9929     {
9930         int val;
9931         struct semid_ds *buf;
9932         unsigned short *array;
9933     }
9934 #endif
9935     arg;
9936     int sem, st;
9937
9938 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9939     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9940     if (sem > -1) {
9941         struct semid_ds argbuf;
9942         arg.buf = &argbuf;
9943 #       ifdef IPC_STAT
9944         st = semctl(sem, 0, IPC_STAT, arg);
9945         if (st == 0)
9946             printf("semun\n");
9947         else
9948 #       endif /* IPC_STAT */
9949             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9950 #       ifdef IPC_RMID
9951         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9952 #       endif /* IPC_RMID */
9953             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9954     } else
9955 #endif /* IPC_PRIVATE && ... */
9956         printf("semget failed: errno = %d\n", errno);
9957   return 0;
9958 }
9959 END
9960     val="$undef"
9961     set try
9962     if eval $compile; then
9963         xxx=`./try`
9964         case "$xxx" in
9965         semun) val="$define" ;;
9966         esac
9967     fi
9968     $rm -f try try.c
9969     set d_semctl_semun
9970     eval $setvar
9971     case "$d_semctl_semun" in
9972     $define)
9973         echo "You can use union semun for semctl IPC_STAT." >&4
9974         also='also'
9975         ;;
9976     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9977         also=''
9978         ;;
9979     esac
9980
9981     : see whether semctl IPC_STAT can use struct semid_ds pointer
9982     $cat > try.c <<'END'
9983 #include <sys/types.h>
9984 #include <sys/ipc.h>
9985 #include <sys/sem.h>
9986 #include <sys/stat.h>
9987 #include "try.h"
9988 #include <stdio.h>
9989 #include <errno.h>
9990 #ifndef errno
9991 extern int errno;
9992 #endif
9993 int main() {
9994     struct semid_ds arg;
9995     int sem, st;
9996
9997 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9998     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9999     if (sem > -1) {
10000 #       ifdef IPC_STAT
10001         st = semctl(sem, 0, IPC_STAT, &arg);
10002         if (st == 0)
10003             printf("semid_ds\n");
10004         else
10005 #       endif /* IPC_STAT */
10006             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10007 #       ifdef IPC_RMID
10008         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10009 #       endif /* IPC_RMID */
10010             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10011     } else
10012 #endif /* IPC_PRIVATE && ... */
10013         printf("semget failed: errno = %d\n", errno);
10014
10015     return 0;
10016 }
10017 END
10018     val="$undef"
10019     set try
10020     if eval $compile; then
10021         xxx=`./try`
10022         case "$xxx" in
10023         semid_ds) val="$define" ;;
10024         esac
10025     fi
10026     $rm -f try try.c
10027     set d_semctl_semid_ds
10028     eval $setvar
10029     case "$d_semctl_semid_ds" in
10030     $define)
10031         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10032         ;;
10033     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10034         ;;
10035     esac
10036     $rm -f try.h
10037     ;;
10038 *)  val="$undef"
10039
10040     # We do not have the full sem*(2) library, so assume we can not
10041     # use either.
10042
10043     set d_semctl_semun
10044     eval $setvar
10045
10046     set d_semctl_semid_ds
10047     eval $setvar
10048     ;;
10049 esac
10050
10051 : see if setegid exists
10052 set setegid d_setegid
10053 eval $inlibc
10054
10055 : see if seteuid exists
10056 set seteuid d_seteuid
10057 eval $inlibc
10058
10059 : see if setgrent exists
10060 set setgrent d_setgrent
10061 eval $inlibc
10062
10063 : see if sethostent exists
10064 set sethostent d_sethent
10065 eval $inlibc
10066
10067 : see if setlinebuf exists
10068 set setlinebuf d_setlinebuf
10069 eval $inlibc
10070
10071 : see if setlocale exists
10072 set setlocale d_setlocale
10073 eval $inlibc
10074
10075 : see if setnetent exists
10076 set setnetent d_setnent
10077 eval $inlibc
10078
10079 : see if setprotoent exists
10080 set setprotoent d_setpent
10081 eval $inlibc
10082
10083 : see if setpgid exists
10084 set setpgid d_setpgid
10085 eval $inlibc
10086
10087 : see if setpgrp2 exists
10088 set setpgrp2 d_setpgrp2
10089 eval $inlibc
10090
10091 : see if setpriority exists
10092 set setpriority d_setprior
10093 eval $inlibc
10094
10095 : see if setpwent exists
10096 set setpwent d_setpwent
10097 eval $inlibc
10098
10099 : see if setregid exists
10100 set setregid d_setregid
10101 eval $inlibc
10102 set setresgid d_setresgid
10103 eval $inlibc
10104
10105 : see if setreuid exists
10106 set setreuid d_setreuid
10107 eval $inlibc
10108 set setresuid d_setresuid
10109 eval $inlibc
10110
10111 : see if setrgid exists
10112 set setrgid d_setrgid
10113 eval $inlibc
10114
10115 : see if setruid exists
10116 set setruid d_setruid
10117 eval $inlibc
10118
10119 : see if setservent exists
10120 set setservent d_setsent
10121 eval $inlibc
10122
10123 : see if setsid exists
10124 set setsid d_setsid
10125 eval $inlibc
10126
10127 : see if setspent exists
10128 set setspent d_setspent
10129 eval $inlibc
10130
10131 : see if setvbuf exists
10132 set setvbuf d_setvbuf
10133 eval $inlibc
10134
10135 : see if sfio.h is available
10136 set sfio.h i_sfio
10137 eval $inhdr
10138
10139
10140 : see if sfio library is available
10141 case "$i_sfio" in
10142 $define)
10143         val=''
10144         set sfreserve val
10145         eval $inlibc
10146         ;;
10147 *)
10148         val="$undef"
10149         ;;
10150 esac
10151 : Ok, but do we want to use it.
10152 case "$val" in
10153 $define)
10154         case "$usesfio" in
10155         true|$define|[yY]*) dflt='y';;
10156         *) dflt='n';;
10157         esac
10158         echo "$package can use the sfio library, but it is experimental."
10159         rp="You seem to have sfio available, do you want to try using it?"
10160         . ./myread
10161         case "$ans" in
10162         y|Y) ;;
10163         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10164                 val="$undef"
10165                 : Remove sfio from list of libraries to use
10166                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10167                 shift
10168                 libs="$*"
10169                 echo "libs = $libs" >&4
10170                 ;;
10171         esac
10172         ;;
10173 *)      case "$usesfio" in
10174         true|$define|[yY]*)
10175                 echo "Sorry, cannot find sfio on this machine" >&4
10176                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10177                 ;;
10178         esac
10179         ;;
10180 esac
10181 set d_sfio
10182 eval $setvar
10183 case "$d_sfio" in
10184 $define) usesfio='true';;
10185 *) usesfio='false';;
10186 esac
10187
10188 : see if shmctl exists
10189 set shmctl d_shmctl
10190 eval $inlibc
10191
10192 : see if shmget exists
10193 set shmget d_shmget
10194 eval $inlibc
10195
10196 : see if shmat exists
10197 set shmat d_shmat
10198 eval $inlibc
10199 : see what shmat returns
10200 case "$d_shmat" in
10201 "$define")
10202         $cat >shmat.c <<'END'
10203 #include <sys/shm.h>
10204 void *shmat();
10205 END
10206         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10207                 shmattype='void *'
10208         else
10209                 shmattype='char *'
10210         fi
10211         echo "and it returns ($shmattype)." >&4
10212         : see if a prototype for shmat is available
10213         xxx=`./findhdr sys/shm.h`
10214         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10215         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10216                 val="$define"
10217         else
10218                 val="$undef"
10219         fi
10220         $rm -f shmat.[co]
10221         ;;
10222 *)
10223         val="$undef"
10224         ;;
10225 esac
10226 set d_shmatprototype
10227 eval $setvar
10228
10229 : see if shmdt exists
10230 set shmdt d_shmdt
10231 eval $inlibc
10232
10233 : see how much of the 'shm*(2)' library is present.
10234 h_shm=true
10235 echo " "
10236 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10237 *"$undef"*) h_shm=false;;
10238 esac
10239 case "$osname" in
10240 freebsd)
10241     case "`ipcs 2>&1`" in
10242     "SVID shared memory"*"not configured"*)
10243         echo "Your $osname does not have the shm*(2) configured." >&4
10244         h_shm=false
10245         val="$undef"
10246         set shmctl d_shmctl
10247         evat $setvar
10248         set shmget d_shmget
10249         evat $setvar
10250         set shmat d_shmat
10251         evat $setvar
10252         set shmdt d_shmdt
10253         evat $setvar
10254         ;;
10255     esac
10256     ;;
10257 esac
10258 : we could also check for sys/ipc.h ...
10259 if $h_shm && $test `./findhdr sys/shm.h`; then
10260         echo "You have the full shm*(2) library." >&4
10261         val="$define"
10262 else
10263         echo "You don't have the full shm*(2) library." >&4
10264         val="$undef"
10265 fi
10266 set d_shm
10267 eval $setvar
10268
10269 echo " "
10270 : see if we have sigaction
10271 if set sigaction val -f d_sigaction; eval $csym; $val; then
10272         echo 'sigaction() found.' >&4
10273         $cat > try.c <<'EOP'
10274 #include <stdio.h>
10275 #include <sys/types.h>
10276 #include <signal.h>
10277 int main()
10278 {
10279     struct sigaction act, oact;
10280     act.sa_flags = 0;
10281     oact.sa_handler = 0;
10282 }
10283 EOP
10284         set try
10285         if eval $compile_ok; then
10286                 val="$define"
10287         else
10288                 echo "But you don't seem to have a useable struct sigaction." >&4
10289                 val="$undef"
10290         fi
10291 else
10292         echo 'sigaction NOT found.' >&4
10293         val="$undef"
10294 fi
10295 set d_sigaction; eval $setvar
10296 $rm -f try try$_o try.c
10297
10298 : see if sigsetjmp exists
10299 echo " "
10300 case "$d_sigsetjmp" in
10301 '')
10302         $cat >try.c <<'EOP'
10303 #include <setjmp.h>
10304 sigjmp_buf env;
10305 int set = 1;
10306 int main()
10307 {
10308         if (sigsetjmp(env,1))
10309                 exit(set);
10310         set = 0;
10311         siglongjmp(env, 1);
10312         exit(1);
10313 }
10314 EOP
10315         set try
10316         if eval $compile; then
10317                 if ./try >/dev/null 2>&1; then
10318                         echo "POSIX sigsetjmp found." >&4
10319                         val="$define"
10320                 else
10321                         $cat >&4 <<EOM
10322 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10323 I'll ignore them.
10324 EOM
10325                         val="$undef"
10326                 fi
10327         else
10328                 echo "sigsetjmp not found." >&4
10329                 val="$undef"
10330         fi
10331         ;;
10332 *) val="$d_sigsetjmp"
10333         case "$d_sigsetjmp" in
10334         $define) echo "POSIX sigsetjmp found." >&4;;
10335         $undef) echo "sigsetjmp not found." >&4;;
10336         esac
10337         ;;
10338 esac
10339 set d_sigsetjmp
10340 eval $setvar
10341 $rm -f try.c try
10342
10343 : see if sqrtl exists
10344 set sqrtl d_sqrtl
10345 eval $inlibc
10346
10347 : see if sys/stat.h is available
10348 set sys/stat.h i_sysstat
10349 eval $inhdr
10350
10351 : see if stat knows about block sizes
10352 echo " "
10353 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10354 eval $hasfield
10355
10356 : see if _ptr and _cnt from stdio act std
10357 echo " "
10358 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10359         echo "(Looks like you have stdio.h from Linux.)"
10360         case "$stdio_ptr" in
10361         '') stdio_ptr='((fp)->_IO_read_ptr)'
10362                 ptr_lval=$define
10363                 ;;
10364         *)      ptr_lval=$d_stdio_ptr_lval;;
10365         esac
10366         case "$stdio_cnt" in
10367         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10368                 cnt_lval=$undef
10369                 ;;
10370         *)      cnt_lval=$d_stdio_cnt_lval;;
10371         esac
10372         case "$stdio_base" in
10373         '') stdio_base='((fp)->_IO_read_base)';;
10374         esac
10375         case "$stdio_bufsiz" in
10376         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10377         esac
10378 else
10379         case "$stdio_ptr" in
10380         '') stdio_ptr='((fp)->_ptr)'
10381                 ptr_lval=$define
10382                 ;;
10383         *)      ptr_lval=$d_stdio_ptr_lval;;
10384         esac
10385         case "$stdio_cnt" in
10386         '') stdio_cnt='((fp)->_cnt)'
10387                 cnt_lval=$define
10388                 ;;
10389         *)      cnt_lval=$d_stdio_cnt_lval;;
10390         esac
10391         case "$stdio_base" in
10392         '') stdio_base='((fp)->_base)';;
10393         esac
10394         case "$stdio_bufsiz" in
10395         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10396         esac
10397 fi
10398 : test whether _ptr and _cnt really work
10399 echo "Checking how std your stdio is..." >&4
10400 $cat >try.c <<EOP
10401 #include <stdio.h>
10402 #define FILE_ptr(fp)    $stdio_ptr
10403 #define FILE_cnt(fp)    $stdio_cnt
10404 int main() {
10405         FILE *fp = fopen("try.c", "r");
10406         char c = getc(fp);
10407         if (
10408                 18 <= FILE_cnt(fp) &&
10409                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10410         )
10411                 exit(0);
10412         exit(1);
10413 }
10414 EOP
10415 val="$undef"
10416 set try
10417 if eval $compile; then
10418         if ./try; then
10419                 echo "Your stdio acts pretty std."
10420                 val="$define"
10421         else
10422                 echo "Your stdio isn't very std."
10423         fi
10424 else
10425         echo "Your stdio doesn't appear very std."
10426 fi
10427 $rm -f try.c try
10428 set d_stdstdio
10429 eval $setvar
10430
10431 : Can _ptr be used as an lvalue?
10432 case "$d_stdstdio$ptr_lval" in
10433 $define$define) val=$define ;;
10434 *) val=$undef ;;
10435 esac
10436 set d_stdio_ptr_lval
10437 eval $setvar
10438
10439 : Can _cnt be used as an lvalue?
10440 case "$d_stdstdio$cnt_lval" in
10441 $define$define) val=$define ;;
10442 *) val=$undef ;;
10443 esac
10444 set d_stdio_cnt_lval
10445 eval $setvar
10446
10447 : see if _base is also standard
10448 val="$undef"
10449 case "$d_stdstdio" in
10450 $define)
10451         $cat >try.c <<EOP
10452 #include <stdio.h>
10453 #define FILE_base(fp)   $stdio_base
10454 #define FILE_bufsiz(fp) $stdio_bufsiz
10455 int main() {
10456         FILE *fp = fopen("try.c", "r");
10457         char c = getc(fp);
10458         if (
10459                 19 <= FILE_bufsiz(fp) &&
10460                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10461         )
10462                 exit(0);
10463         exit(1);
10464 }
10465 EOP
10466         set try
10467         if eval $compile; then
10468                 if ./try; then
10469                         echo "And its _base field acts std."
10470                         val="$define"
10471                 else
10472                         echo "But its _base field isn't std."
10473                 fi
10474         else
10475                 echo "However, it seems to be lacking the _base field."
10476         fi
10477         $rm -f try.c try
10478         ;;
10479 esac
10480 set d_stdiobase
10481 eval $setvar
10482
10483 $cat >&4 <<EOM
10484 Checking how to access stdio streams by file descriptor number...
10485 EOM
10486 case "$stdio_stream_array" in
10487 '')     $cat >try.c <<EOCP
10488 #include <stdio.h>
10489 int main() {
10490   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10491     printf("yes\n");
10492 }
10493 EOCP
10494         for s in _iob __iob __sF
10495         do
10496                 set try -DSTDIO_STREAM_ARRAY=$s
10497                 if eval $compile; then
10498                         case "`./try$exe_ext`" in
10499                         yes)    stdio_stream_array=$s; break ;;
10500                         esac
10501                 fi
10502         done
10503         $rm -f try.* try$exe_ext
10504 esac
10505 case "$stdio_stream_array" in
10506 '')     $cat >&4 <<EOM
10507 I can't figure out how to access stdio streams by file descriptor number.
10508 EOM
10509         d_stdio_stream_array="$undef"
10510         ;;
10511 *)      $cat >&4 <<EOM
10512 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10513 EOM
10514         d_stdio_stream_array="$define"
10515         ;;
10516 esac
10517
10518 : see if strcoll exists
10519 set strcoll d_strcoll
10520 eval $inlibc
10521
10522 : check for structure copying
10523 echo " "
10524 echo "Checking to see if your C compiler can copy structs..." >&4
10525 $cat >try.c <<'EOCP'
10526 int main()
10527 {
10528         struct blurfl {
10529                 int dyick;
10530         } foo, bar;
10531
10532         foo = bar;
10533 }
10534 EOCP
10535 if $cc -c try.c >/dev/null 2>&1 ; then
10536         val="$define"
10537         echo "Yup, it can."
10538 else
10539         val="$undef"
10540         echo "Nope, it can't."
10541 fi
10542 set d_strctcpy
10543 eval $setvar
10544 $rm -f try.*
10545
10546 : see if strerror and/or sys_errlist[] exist
10547 echo " "
10548 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10549     if set strerror val -f d_strerror; eval $csym; $val; then
10550                 echo 'strerror() found.' >&4
10551                 d_strerror="$define"
10552                 d_strerrm='strerror(e)'
10553                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10554                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10555                         d_syserrlst="$define"
10556                 else
10557                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10558                         d_syserrlst="$undef"
10559                 fi
10560     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10561                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10562                 echo 'strerror() found in string header.' >&4
10563                 d_strerror="$define"
10564                 d_strerrm='strerror(e)'
10565                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10566                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10567                                 d_syserrlst="$define"
10568                 else
10569                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10570                         d_syserrlst="$undef"
10571                 fi
10572     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10573                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10574                 d_strerror="$undef"
10575                 d_syserrlst="$define"
10576                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10577     else
10578                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10579                 d_strerror="$undef"
10580                 d_syserrlst="$undef"
10581                 d_strerrm='"unknown"'
10582     fi
10583 fi
10584
10585 : see if strtod exists
10586 set strtod d_strtod
10587 eval $inlibc
10588
10589 : see if strtol exists
10590 set strtol d_strtol
10591 eval $inlibc
10592
10593 : see if strtoul exists
10594 set strtoul d_strtoul
10595 eval $inlibc
10596
10597 : see if strtoull exists
10598 set strtoull d_strtoull
10599 eval $inlibc
10600
10601 : see if strxfrm exists
10602 set strxfrm d_strxfrm
10603 eval $inlibc
10604
10605 : see if symlink exists
10606 set symlink d_symlink
10607 eval $inlibc
10608
10609 : see if syscall exists
10610 set syscall d_syscall
10611 eval $inlibc
10612
10613 : see if sysconf exists
10614 set sysconf d_sysconf
10615 eval $inlibc
10616
10617 : see if system exists
10618 set system d_system
10619 eval $inlibc
10620
10621 : see if tcgetpgrp exists
10622 set tcgetpgrp d_tcgetpgrp
10623 eval $inlibc
10624
10625 : see if tcsetpgrp exists
10626 set tcsetpgrp d_tcsetpgrp
10627 eval $inlibc
10628
10629 : see if sys/types.h has to be included
10630 set sys/types.h i_systypes
10631 eval $inhdr
10632
10633 : see if prototype for telldir is available
10634 echo " "
10635 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10636 eval $hasproto
10637
10638 : define an is-a-typedef? function
10639 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10640 case "$inclist" in
10641 "") inclist="sys/types.h";;
10642 esac;
10643 eval "varval=\$$var";
10644 case "$varval" in
10645 "")
10646         $rm -f temp.c;
10647         for inc in $inclist; do
10648                 echo "#include <$inc>" >>temp.c;
10649         done;
10650         echo "#ifdef $type" >> temp.c;
10651         echo "printf(\"We have $type\");" >> temp.c;
10652         echo "#endif" >> temp.c;
10653         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10654         if $contains $type temp.E >/dev/null 2>&1; then
10655                 eval "$var=\$type";
10656         else
10657                 eval "$var=\$def";
10658         fi;
10659         $rm -f temp.?;;
10660 *) eval "$var=\$varval";;
10661 esac'
10662
10663 : define an is-a-typedef? function that prompts if the type is not available.
10664 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10665 case "$inclist" in
10666 "") inclist="sys/types.h";;
10667 esac;
10668 eval "varval=\$$var";
10669 case "$varval" in
10670 "")
10671         $rm -f temp.c;
10672         for inc in $inclist; do
10673                 echo "#include <$inc>" >>temp.c;
10674         done;
10675         echo "#ifdef $type" >> temp.c;
10676         echo "printf(\"We have $type\");" >> temp.c;
10677         echo "#endif" >> temp.c;
10678         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10679         echo " " ;
10680         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10681         if $contains $type temp.E >/dev/null 2>&1; then
10682                 echo "$type found." >&4;
10683                 eval "$var=\$type";
10684         else
10685                 echo "$type NOT found." >&4;
10686                 dflt="$def";
10687                 . ./myread ;
10688                 eval "$var=\$ans";
10689         fi;
10690         $rm -f temp.?;;
10691 *) eval "$var=\$varval";;
10692 esac'
10693
10694 : see if this is a sys/times.h system
10695 set sys/times.h i_systimes
10696 eval $inhdr
10697
10698 : see if times exists
10699 echo " "
10700 if set times val -f d_times; eval $csym; $val; then
10701         echo 'times() found.' >&4
10702         d_times="$define"
10703         inc=''
10704         case "$i_systimes" in
10705         "$define") inc='sys/times.h';;
10706         esac
10707         rp="What is the type returned by times() on this system?"
10708         set clock_t clocktype long stdio.h sys/types.h $inc
10709         eval $typedef_ask
10710 else
10711         echo 'times() NOT found, hope that will do.' >&4
10712         d_times="$undef"
10713         clocktype='int'
10714 fi
10715
10716 : see if truncate exists
10717 set truncate d_truncate
10718 eval $inlibc
10719
10720 : see if tzname[] exists
10721 echo " "
10722 if set tzname val -a d_tzname; eval $csym; $val; then
10723         val="$define"
10724         echo 'tzname[] found.' >&4
10725 else
10726         val="$undef"
10727         echo 'tzname[] NOT found.' >&4
10728 fi
10729 set d_tzname
10730 eval $setvar
10731
10732 : see if umask exists
10733 set umask d_umask
10734 eval $inlibc
10735
10736 : backward compatibility for d_hvfork
10737 if test X$d_hvfork != X; then
10738         d_vfork="$d_hvfork"
10739         d_hvfork=''
10740 fi
10741 : see if there is a vfork
10742 val=''
10743 set vfork val
10744 eval $inlibc
10745
10746 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10747 : perl on Solaris 2.x, and probably elsewhere.
10748 case "$val" in
10749 $define)
10750         echo " "
10751         case "$usevfork" in
10752         false) dflt='n';;
10753         *) dflt='y';;
10754         esac
10755         cat <<'EOM'
10756  
10757 Perl can only use a vfork() that doesn't suffer from strict
10758 restrictions on calling functions or modifying global data in
10759 the child.  For example, glibc-2.1 contains such a vfork()
10760 that is unsuitable.  If your system provides a proper fork()
10761 call, chances are that you do NOT want perl to use vfork().
10762
10763 EOM
10764         rp="Do you still want to use vfork()?"
10765         . ./myread
10766         case "$ans" in
10767         y|Y) ;;
10768         *)
10769                 echo "Ok, we won't use vfork()."
10770                 val="$undef"
10771                 ;;
10772         esac
10773         ;;
10774 esac
10775 set d_vfork
10776 eval $setvar
10777 case "$d_vfork" in
10778 $define) usevfork='true';;
10779 *) usevfork='false';;
10780 esac
10781
10782 : see if this is an sysdir system
10783 set sys/dir.h i_sysdir
10784 eval $inhdr
10785
10786 : see if this is an sysndir system
10787 set sys/ndir.h i_sysndir
10788 eval $inhdr
10789
10790 : see if closedir exists
10791 set closedir d_closedir
10792 eval $inlibc
10793
10794 case "$d_closedir" in
10795 "$define")
10796         echo " "
10797         echo "Checking whether closedir() returns a status..." >&4
10798         cat > closedir.c <<EOM
10799 #$i_dirent I_DIRENT             /**/
10800 #$i_sysdir I_SYS_DIR            /**/
10801 #$i_sysndir I_SYS_NDIR          /**/
10802 #$i_systypes I_SYS_TYPES        /**/
10803
10804 #if defined(I_SYS_TYPES)
10805 #include <sys/types.h>
10806 #endif
10807 #if defined(I_DIRENT)
10808 #include <dirent.h>
10809 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10810 #include <sys/dir.h>
10811 #endif
10812 #else
10813 #ifdef I_SYS_NDIR
10814 #include <sys/ndir.h>
10815 #else
10816 #ifdef I_SYS_DIR
10817 #ifdef hp9000s500
10818 #include <ndir.h>       /* may be wrong in the future */
10819 #else
10820 #include <sys/dir.h>
10821 #endif
10822 #endif
10823 #endif
10824 #endif 
10825 int main() { return closedir(opendir(".")); }
10826 EOM
10827         set closedir
10828         if eval $compile_ok; then
10829                 if ./closedir > /dev/null 2>&1 ; then
10830                         echo "Yes, it does."
10831                         val="$undef"
10832                 else
10833                         echo "No, it doesn't."
10834                         val="$define"
10835                 fi
10836         else
10837                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10838                 val="$define"
10839         fi
10840         ;;
10841 *)
10842         val="$undef";
10843         ;;
10844 esac
10845 set d_void_closedir
10846 eval $setvar
10847 $rm -f closedir*
10848 : check for volatile keyword
10849 echo " "
10850 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10851 $cat >try.c <<'EOCP'
10852 int main()
10853 {
10854         typedef struct _goo_struct goo_struct;
10855         goo_struct * volatile goo = ((goo_struct *)0);
10856         struct _goo_struct {
10857                 long long_int;
10858                 int reg_int;
10859                 char char_var;
10860         };
10861         typedef unsigned short foo_t;
10862         char *volatile foo;
10863         volatile int bar;
10864         volatile foo_t blech;
10865         foo = foo;
10866 }
10867 EOCP
10868 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10869         val="$define"
10870         echo "Yup, it does."
10871 else
10872         val="$undef"
10873         echo "Nope, it doesn't."
10874 fi
10875 set d_volatile
10876 eval $setvar
10877 $rm -f try.*
10878
10879 : see if there is a wait4
10880 set wait4 d_wait4
10881 eval $inlibc
10882
10883 : see if waitpid exists
10884 set waitpid d_waitpid
10885 eval $inlibc
10886
10887 : see if wcstombs exists
10888 set wcstombs d_wcstombs
10889 eval $inlibc
10890
10891 : see if wctomb exists
10892 set wctomb d_wctomb
10893 eval $inlibc
10894
10895 : see if writev exists
10896 set writev d_writev
10897 eval $inlibc
10898
10899 : preserve RCS keywords in files with variable substitution, grrr
10900 Date='$Date'
10901 Id='$Id'
10902 Log='$Log'
10903 RCSfile='$RCSfile'
10904 Revision='$Revision'
10905
10906 case "$crosscompile" in
10907 ''|[nN]*) crosscompile="$undef" ;;
10908 esac
10909
10910 case "$osname" in
10911 next|rhapsody) multiarch="$define" ;;
10912 esac
10913 case "$multiarch" in
10914 ''|[nN]*) multiarch="$undef" ;;
10915 esac
10916
10917 : check for alignment requirements
10918 echo " "
10919 case "$crosscompile$multiarch" in
10920 *$define*)
10921         $cat <<EOM
10922 You seem to be either cross-compiling or doing a multiarchitecture build,
10923 skipping the memory alignment check.
10924
10925 EOM
10926         case "$alignbytes" in
10927         '') alignbytes=8 ;;
10928         esac
10929         ;;
10930 *)
10931         case "$alignbytes" in
10932         '') echo "Checking alignment constraints..." >&4
10933                 $cat >try.c <<'EOCP'
10934 struct foobar {
10935         char foo;
10936         double bar;
10937 } try_algn;
10938 int main()
10939 {
10940         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10941 }
10942 EOCP
10943                 set try
10944                 if eval $compile_ok; then
10945                         dflt=`./try`
10946                 else
10947                         dflt='8'
10948                         echo "(I can't seem to compile the test program...)"
10949                 fi
10950                 ;;
10951         *) dflt="$alignbytes"
10952                 ;;
10953         esac
10954         rp="Doubles must be aligned on a how-many-byte boundary?"
10955         . ./myread
10956         alignbytes="$ans"
10957         $rm -f try.c try
10958         ;;
10959 esac
10960
10961
10962 : check for ordering of bytes in a long
10963 echo " "
10964 case "$crosscompile$multiarch" in
10965 *$define*)
10966         $cat <<EOM
10967 You seem to be either cross-compiling or doing a multiarchitecture build,
10968 skipping the byteorder check.
10969
10970 EOM
10971         byteorder='0xffff'
10972         ;;
10973 *)
10974         case "$byteorder" in
10975         '')
10976                 $cat <<'EOM'
10977 In the following, larger digits indicate more significance.  A big-endian
10978 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10979 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10980 machines may have weird orders like 3412.  A Cray will report 87654321,
10981 an Alpha will report 12345678. If the test program works the default is
10982 probably right.
10983 I'm now running the test program...
10984 EOM
10985                 $cat >try.c <<'EOCP'
10986 #include <stdio.h>
10987 int main()
10988 {
10989         int i;
10990         union {
10991                 unsigned long l;
10992                 char c[sizeof(long)];
10993         } u;
10994
10995         if (sizeof(long) > 4)
10996                 u.l = (0x08070605L << 32) | 0x04030201L;
10997         else
10998                 u.l = 0x04030201L;
10999         for (i = 0; i < sizeof(long); i++)
11000                 printf("%c", u.c[i]+'0');
11001         printf("\n");
11002         exit(0);
11003 }
11004 EOCP
11005                 xxx_prompt=y
11006                 set try
11007                 if eval $compile && ./try > /dev/null; then
11008                         dflt=`./try`
11009                         case "$dflt" in
11010                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11011                                 echo "(The test program ran ok.)"
11012                                 echo "byteorder=$dflt"
11013                                 xxx_prompt=n
11014                         ;;
11015                         ????|????????) echo "(The test program ran ok.)" ;;
11016                         *) echo "(The test program didn't run right for some reason.)" ;;
11017                         esac
11018                 else
11019                         dflt='4321'
11020                         cat <<'EOM'
11021 (I can't seem to compile the test program.  Guessing big-endian...)
11022 EOM
11023                 fi
11024                 case "$xxx_prompt" in
11025                 y)
11026                         rp="What is the order of bytes in a long?"
11027                         . ./myread
11028                         byteorder="$ans"
11029                         ;;
11030                 *)      byteorder=$dflt
11031                         ;;
11032                 esac
11033                 ;;
11034         esac
11035         $rm -f try.c try
11036         ;;
11037 esac
11038
11039
11040 : how do we catenate cpp tokens here?
11041 echo " "
11042 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11043 $cat >cpp_stuff.c <<'EOCP'
11044 #define RCAT(a,b)a/**/b
11045 #define ACAT(a,b)a ## b
11046 RCAT(Rei,ser)
11047 ACAT(Cir,cus)
11048 EOCP
11049 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11050 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11051         echo "Oh!  Smells like ANSI's been here." >&4
11052         echo "We can catify or stringify, separately or together!"
11053         cpp_stuff=42
11054 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11055         echo "Ah, yes!  The good old days!" >&4
11056         echo "However, in the good old days we don't know how to stringify and"
11057         echo "catify at the same time."
11058         cpp_stuff=1
11059 else
11060         $cat >&4 <<EOM
11061 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11062 to have to edit the values of CAT[2-5] in config.h...
11063 EOM
11064         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11065 fi
11066 $rm -f cpp_stuff.*
11067
11068 : see if this is a db.h system
11069 set db.h i_db
11070 eval $inhdr
11071
11072 case "$i_db" in
11073 $define)
11074         : Check db version.
11075         echo " "
11076         echo "Checking Berkeley DB version ..." >&4
11077         $cat >try.c <<EOCP
11078 #$d_const HASCONST
11079 #ifndef HASCONST
11080 #define const
11081 #endif
11082 #include <sys/types.h>
11083 #include <stdio.h>
11084 #include <db.h>
11085 int main()
11086 {
11087 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11088     int Major, Minor, Patch ;
11089     unsigned long Version ;
11090     (void)db_version(&Major, &Minor, &Patch) ;
11091     printf("You have Berkeley DB Version 2 or greater\n");
11092
11093     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11094                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11095     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11096                 Major, Minor, Patch) ;
11097
11098     /* check that db.h & libdb are compatible */
11099     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11100         printf("db.h and libdb are incompatible\n") ;
11101         exit(3);        
11102     }
11103
11104     printf("db.h and libdb are compatible\n") ;
11105
11106     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11107                 + DB_VERSION_PATCH ;
11108
11109     /* needs to be >= 2.3.4 */
11110     if (Version < 2003004) {
11111     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11112         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11113         exit(2);        
11114     }
11115
11116     exit(0);
11117 #else
11118 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11119     printf("You have Berkeley DB Version 1\n");
11120     exit(0);    /* DB version < 2: the coast is clear. */
11121 #else
11122     exit(1);    /* <db.h> not Berkeley DB? */
11123 #endif
11124 #endif
11125 }
11126 EOCP
11127         set try
11128         if eval $compile && ./try; then
11129                 echo 'Looks OK.' >&4
11130         else
11131                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11132                 i_db=$undef
11133                 case " $libs " in
11134                 *"-ldb "*)
11135                         : Remove db from list of libraries to use
11136                         echo "Removing unusable -ldb from library list" >&4
11137                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11138                         shift
11139                         libs="$*"
11140                         echo "libs = $libs" >&4
11141                         ;;
11142                 esac
11143         fi
11144         $rm -f try.*
11145         ;;
11146 esac
11147
11148 case "$i_db" in
11149 define)
11150         : Check the return type needed for hash 
11151         echo " "
11152         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11153         $cat >try.c <<EOCP
11154 #$d_const HASCONST
11155 #ifndef HASCONST
11156 #define const
11157 #endif
11158 #include <sys/types.h>
11159 #include <db.h>
11160
11161 #ifndef DB_VERSION_MAJOR
11162 u_int32_t hash_cb (ptr, size)
11163 const void *ptr;
11164 size_t size;
11165 {
11166 }
11167 HASHINFO info;
11168 int main()
11169 {
11170         info.hash = hash_cb;
11171 }
11172 #endif
11173 EOCP
11174         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11175                 if $contains warning try.out >>/dev/null 2>&1 ; then
11176                         db_hashtype='int'
11177                 else
11178                         db_hashtype='u_int32_t'
11179                 fi
11180         else
11181                 : XXX Maybe we should just give up here.
11182                 db_hashtype=u_int32_t
11183                 $cat try.out >&4
11184                 echo "Help:  I can't seem to compile the db test program." >&4
11185                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11186         fi
11187         $rm -f try.*
11188         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11189         ;;
11190 *)      db_hashtype=u_int32_t
11191         ;;
11192 esac
11193 case "$i_db" in
11194 define)
11195         : Check the return type needed for prefix 
11196         echo " "
11197         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11198         cat >try.c <<EOCP
11199 #$d_const HASCONST
11200 #ifndef HASCONST
11201 #define const
11202 #endif
11203 #include <sys/types.h>
11204 #include <db.h>
11205
11206 #ifndef DB_VERSION_MAJOR
11207 size_t prefix_cb (key1, key2)
11208 const DBT *key1;
11209 const DBT *key2;
11210 {
11211 }
11212 BTREEINFO info;
11213 int main()
11214 {
11215         info.prefix = prefix_cb;
11216 }
11217 #endif
11218 EOCP
11219         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11220                 if $contains warning try.out >>/dev/null 2>&1 ; then
11221                         db_prefixtype='int'
11222                 else
11223                         db_prefixtype='size_t'
11224                 fi
11225         else
11226                 db_prefixtype='size_t'
11227                 : XXX Maybe we should just give up here.
11228                 $cat try.out >&4
11229                 echo "Help:  I can't seem to compile the db test program." >&4
11230                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11231         fi
11232         $rm -f try.*
11233         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11234         ;;
11235 *)      db_prefixtype='size_t'
11236         ;;
11237 esac
11238
11239 : check for void type
11240 echo " "
11241 echo "Checking to see how well your C compiler groks the void type..." >&4
11242 case "$voidflags" in
11243 '')
11244         $cat >try.c <<'EOCP'
11245 #if TRY & 1
11246 void sub() {
11247 #else
11248 sub() {
11249 #endif
11250         extern void moo();      /* function returning void */
11251         void (*goo)();          /* ptr to func returning void */
11252 #if TRY & 8
11253         void *hue;              /* generic ptr */
11254 #endif
11255 #if TRY & 2
11256         void (*foo[10])();
11257 #endif
11258
11259 #if TRY & 4
11260         if(goo == moo) {
11261                 exit(0);
11262         }
11263 #endif
11264         exit(0);
11265 }
11266 int main() { sub(); }
11267 EOCP
11268         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11269                 voidflags=$defvoidused
11270         echo "Good.  It appears to support void to the level $package wants.">&4
11271                 if $contains warning .out >/dev/null 2>&1; then
11272                         echo "However, you might get some warnings that look like this:"
11273                         $cat .out
11274                 fi
11275         else
11276 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11277                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11278                         echo "It supports 1..."
11279                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11280                                 echo "It also supports 2..."
11281                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11282                                         voidflags=7
11283                                         echo "And it supports 4 but not 8 definitely."
11284                                 else
11285                                         echo "It doesn't support 4..."
11286                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11287                                                 voidflags=11
11288                                                 echo "But it supports 8."
11289                                         else
11290                                                 voidflags=3
11291                                                 echo "Neither does it support 8."
11292                                         fi
11293                                 fi
11294                         else
11295                                 echo "It does not support 2..."
11296                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11297                                         voidflags=13
11298                                         echo "But it supports 4 and 8."
11299                                 else
11300                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11301                                                 voidflags=5
11302                                                 echo "And it supports 4 but has not heard about 8."
11303                                         else
11304                                                 echo "However it supports 8 but not 4."
11305                                         fi
11306                                 fi
11307                         fi
11308                 else
11309                         echo "There is no support at all for void."
11310                         voidflags=0
11311                 fi
11312         fi
11313 esac
11314 case "$voidflags" in
11315 "$defvoidused") ;;
11316 *)      $cat >&4 <<'EOM'
11317   Support flag bits are:
11318     1: basic void declarations.
11319     2: arrays of pointers to functions returning void.
11320     4: operations between pointers to and addresses of void functions.
11321     8: generic void pointers.
11322 EOM
11323         dflt="$voidflags";
11324         rp="Your void support flags add up to what?"
11325         . ./myread
11326         voidflags="$ans"
11327         ;;
11328 esac
11329 $rm -f try.* .out
11330
11331
11332 : How can we generate normalized random numbers ?
11333 echo " "
11334 echo "Looking for a random number function..." >&4
11335 case "$randfunc" in
11336 '')
11337         if set drand48 val -f; eval $csym; $val; then
11338                 dflt="drand48"
11339                 echo "Good, found drand48()." >&4
11340         elif set random val -f; eval $csym; $val; then
11341                 dflt="random"
11342                 echo "OK, found random()." >&4
11343         else
11344                 dflt="rand"
11345                 echo "Yick, looks like I have to use rand()." >&4
11346         fi
11347         echo " "
11348         ;;
11349 *)
11350         dflt="$randfunc"
11351         ;;
11352 esac
11353 cont=true
11354
11355 case "$ccflags" in
11356 *-Dmy_rand=*|*-Dmy_srand=*)
11357         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11358         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11359         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11360         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11361         ;;
11362 esac
11363
11364 while $test "$cont"; do
11365         rp="Use which function to generate random numbers?"
11366         . ./myread
11367         if $test "$ans" = "$dflt"; then
11368                 : null
11369         else
11370                 randbits=''
11371         fi
11372         randfunc="$ans"
11373         if set $ans val -f; eval $csym; $val; then
11374                 cont=''
11375         else
11376                 dflt=y
11377                 rp="I cannot find function $ans. Use that name anyway?"
11378                 . ./myread
11379                 dflt=rand
11380                 case "$ans" in
11381                         [yY]*) cont='';;
11382                 esac
11383         fi
11384         case "$cont" in
11385         '')
11386                 case "$randfunc" in
11387                 drand48)
11388                         drand01="drand48()"
11389                         seedfunc="srand48"
11390                         randbits=48
11391                         randseedtype=long
11392                         ;;
11393                 rand|random)
11394                         case "$randbits" in
11395                         '')
11396 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11397                                 $cat >try.c <<EOCP
11398 #$i_unistd I_UNISTD
11399 #$i_stdlib I_STDLIB
11400 #include <stdio.h>
11401 #ifdef I_UNISTD
11402 #  include <unistd.h>
11403 #endif
11404 #ifdef I_STDLIB
11405 #  include <stdlib.h>
11406 #endif
11407 int main()
11408 {
11409         register int i;
11410         register unsigned long tmp;
11411         register unsigned long max = 0L;
11412
11413         for (i = 1000; i; i--) {
11414                 tmp = (unsigned long) $randfunc();
11415                 if (tmp > max) max = tmp;
11416         }
11417         for (i = 0; max; i++)
11418                 max /= 2;
11419         printf("%d\n",i);
11420 }
11421 EOCP
11422                                 set try
11423                                 if eval $compile_ok; then
11424                                         dflt=`try`
11425                                 else
11426                                         dflt='?'
11427                                         echo "(I can't seem to compile the test program...)"
11428                                 fi
11429                                 ;;
11430                         *)
11431                                 dflt="$randbits"
11432                                 ;;
11433                         esac
11434                         rp="How many bits does your $randfunc() function produce?"
11435                         . ./myread
11436                         randbits="$ans"
11437                         $rm -f try.c try
11438                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11439                         seedfunc="s$randfunc"
11440                         randseedtype=unsigned
11441                         ;;
11442                 *)
11443                         dflt="31"
11444                         rp="How many bits does your $randfunc() function produce?"
11445                         . ./myread
11446                         randbits="$ans"
11447                         seedfunc="s$randfunc"
11448                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11449                         if set $seedfunc val -f; eval $csym; $val; then
11450                                 echo "(Using $seedfunc() to seed random generator)"
11451                         else
11452                                 echo "(Warning: no $seedfunc() to seed random generator)"
11453                                 seedfunc=rand
11454                         fi
11455                         randseedtype=unsigned
11456                         ;;
11457                 esac
11458                 ;;
11459         esac
11460 done
11461
11462 echo " "
11463 echo "Determining whether or not we are on an EBCDIC system..." >&4
11464 $cat >tebcdic.c <<'EOM'
11465 int main()
11466 {
11467   if ('M'==0xd4) return 0;
11468   return 1;
11469 }
11470 EOM
11471
11472 val=$undef
11473 set tebcdic
11474 if eval $compile_ok; then
11475         if ./tebcdic; then
11476                 echo "You have EBCDIC." >&4
11477                 val="$define"
11478         else
11479                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11480         fi
11481 else
11482         echo "I'm unable to compile the test program." >&4
11483         echo "I'll assume ASCII or some ISO Latin." >&4
11484 fi
11485 $rm -f tebcdic.c tebcdic
11486 set ebcdic
11487 eval $setvar
11488
11489 echo " "
11490 $cat >&4 <<EOM
11491 Checking how to flush all pending stdio output...
11492 EOM
11493 # I only know how to find the first 32 possibly open files on SunOS.
11494 # See also hints/sunos_4_1.sh and util.c  --AD
11495 case "$osname" in
11496 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11497 esac
11498 $cat >>try.c <<EOCP
11499 #include <stdio.h>
11500 #$i_unistd I_UNISTD
11501 #ifdef I_UNISTD
11502 # include <unistd.h>
11503 #endif
11504 #$d_sysconf HAS_SYSCONF
11505 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11506 #ifdef HAS_STDIO_STREAM_ARRAY
11507 # define STDIO_STREAM_ARRAY $stdio_stream_array
11508 #endif
11509 int main() {
11510   FILE* p = fopen("try.out", "w");
11511 #ifdef TRY_FPUTC
11512   fputc('x', p);
11513 #else
11514 # ifdef TRY_FPRINTF
11515   fprintf(p, "x");
11516 # endif
11517 #endif
11518 #ifdef TRY_FFLUSH_NULL
11519   fflush(NULL);
11520 #endif
11521 #ifdef TRY_FFLUSH_ALL
11522   {
11523     long open_max = -1;
11524 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11525     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11526 # else
11527 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11528     open_max = sysconf(_SC_OPEN_MAX);
11529 #  else
11530 #   ifdef FOPEN_MAX
11531     open_max = FOPEN_MAX;
11532 #   else
11533 #    ifdef OPEN_MAX
11534     open_max = OPEN_MAX;
11535 #    else
11536 #     ifdef _NFILE
11537     open_max = _NFILE;
11538 #     endif
11539 #    endif
11540 #   endif
11541 #  endif
11542 # endif 
11543 # ifdef HAS_STDIO_STREAM_ARRAY
11544     if (open_max > 0) {
11545       long i;
11546       for (i = 0; i < open_max; i++)
11547             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11548                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11549                 STDIO_STREAM_ARRAY[i]._flag)
11550                 fflush(&STDIO_STREAM_ARRAY[i]);
11551     }   
11552   }
11553 # endif
11554 #endif
11555   _exit(42);
11556 }
11557 EOCP
11558 : first we have to find out how _not_ to flush
11559 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11560     output=''
11561     set try -DTRY_FPUTC
11562     if eval $compile; then
11563             $rm -f try.out
11564             ./try$exe_ext 2>/dev/null
11565             if $test ! -s try.out -a "X$?" = X42; then
11566                 output=-DTRY_FPUTC
11567             fi
11568     fi
11569     case "$output" in
11570     '')
11571             set try -DTRY_FPRINTF
11572             $rm -f try.out
11573             if eval $compile; then
11574                     $rm -f try.out
11575                     ./try$exe_ext 2>/dev/null
11576                     if $test ! -s try.out -a "X$?" = X42; then
11577                         output=-DTRY_FPRINTF
11578                     fi
11579             fi
11580         ;;
11581     esac
11582 fi
11583 : check for fflush NULL behaviour
11584 case "$fflushNULL" in
11585 '')     set try -DTRY_FFLUSH_NULL $output
11586         if eval $compile; then
11587                 $rm -f try.out
11588                 ./try$exe_ext 2>/dev/null
11589                 code="$?"
11590                 if $test -s try.out -a "X$code" = X42; then
11591                         fflushNULL="`$cat try.out`"
11592                 else
11593                         if $test "X$code" != X42; then
11594                                 $cat >&4 <<EOM
11595 (If this test failed, don't worry, we'll try another method shortly.)
11596 EOM
11597                         fi
11598                 fi
11599         fi
11600         $rm -f core try.core core.try.*
11601         case "$fflushNULL" in
11602         x)      $cat >&4 <<EOM
11603 Your fflush(NULL) works okay.
11604 EOM
11605                 fflushNULL="$define"
11606                 ;;
11607         '')     $cat >&4 <<EOM
11608 Your fflush(NULL) isn't working (contrary to ANSI C).
11609 EOM
11610                 fflushNULL="$undef"
11611                 ;;
11612         *)      $cat >&4 <<EOM
11613 Cannot figure out whether your fflush(NULL) works or not.
11614 I'm assuming it doesn't (contrary to ANSI C).
11615 EOM
11616                 fflushNULL="$undef"
11617                 ;;
11618         esac
11619         ;;
11620 $define|true|[yY]*)
11621         fflushNULL="$define"
11622         ;;
11623 *)
11624         fflushNULL="$undef"
11625         ;;
11626 esac
11627 : check explicit looping only if NULL did not work
11628 case "$fflushNULL" in
11629 "$undef")
11630         : check for fflush all behaviour
11631         case "$fflushall" in
11632         '')     set try -DTRY_FFLUSH_ALL $output
11633                 if eval $compile; then
11634                         $cat >&4 <<EOM
11635 (Now testing the other method--but note that also this may fail.)
11636 EOM
11637                         $rm -f try.out
11638                         ./try$exe_ext 2>/dev/null
11639                         if $test -s try.out -a "X$?" = X42; then
11640                                 fflushall="`$cat try.out`"
11641                         fi
11642                 fi
11643                 $rm -f core try.core core.try.*
11644                 case "$fflushall" in
11645                 x)      $cat >&4 <<EOM
11646 Whew. Flushing explicitly all the stdio streams works.
11647 EOM
11648                         fflushall="$define"
11649                         ;;
11650                 '')     $cat >&4 <<EOM
11651 Sigh. Flushing explicitly all the stdio streams doesn't work.
11652 EOM
11653                         fflushall="$undef"
11654                         ;;
11655                 *)      $cat >&4 <<EOM
11656 Cannot figure out whether flushing stdio streams explicitly works or not.
11657 I'm assuming it doesn't.
11658 EOM
11659                         fflushall="$undef"
11660                         ;;
11661                 esac
11662                 ;;
11663         "$define"|true|[yY]*)
11664                 fflushall="$define"
11665                 ;;
11666         *)
11667                 fflushall="$undef"
11668                 ;;
11669         esac
11670         ;;
11671 *)      fflushall="$undef"      
11672         ;;
11673 esac
11674 case "$fflushNULL$fflushall" in
11675 undefundef)
11676         $cat <<EOM
11677 I cannot figure out how to flush pending stdio output.
11678 EOM
11679         ;;
11680 esac
11681 $rm -f try.* try$exe_ext
11682
11683 : see what type file positions are declared as in the library
11684 rp="What is the type for file position used by fsetpos()?"
11685 set fpos_t fpostype long stdio.h sys/types.h
11686 eval $typedef_ask
11687
11688 : Store the full pathname to the ar program for use in the C program
11689 : Respect a hint or command line value for full_ar.
11690 case "$full_ar" in
11691 '') full_ar=$ar ;;
11692 esac
11693
11694 : Store the full pathname to the sed program for use in the C program
11695 full_sed=$sed
11696
11697 : see what type gids are declared as in the kernel
11698 echo " "
11699 echo "Looking for the type for group ids returned by getgid()."
11700 set gid_t gidtype xxx stdio.h sys/types.h
11701 eval $typedef
11702 case "$gidtype" in
11703 xxx)
11704         xxx=`./findhdr sys/user.h`
11705         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11706         case $1 in
11707         unsigned) dflt="$1 $2" ;;
11708         *) dflt="$1" ;;
11709         esac
11710         ;;
11711 *) dflt="$gidtype";;
11712 esac
11713 case "$gidtype" in
11714 gid_t) echo "gid_t found." ;;
11715 *)      rp="What is the type for group ids returned by getgid()?"
11716         . ./myread
11717         gidtype="$ans"
11718         ;;
11719 esac
11720
11721 : see if getgroups exists
11722 set getgroups d_getgrps
11723 eval $inlibc
11724
11725 : see if setgroups exists
11726 set setgroups d_setgrps
11727 eval $inlibc
11728
11729
11730 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11731 echo " "
11732 case "$d_getgrps$d_setgrps" in
11733 *define*)
11734         case "$groupstype" in
11735         '') dflt="$gidtype" ;;
11736         *)  dflt="$groupstype" ;;
11737         esac
11738         $cat <<EOM
11739 What type of pointer is the second argument to getgroups() and setgroups()?
11740 Usually this is the same as group ids, $gidtype, but not always.
11741
11742 EOM
11743         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11744         . ./myread
11745         groupstype="$ans"
11746         ;;
11747 *)  groupstype="$gidtype";;
11748 esac
11749
11750 : see what type lseek is declared as in the kernel
11751 rp="What is the type used for lseek's offset on this system?"
11752 set off_t lseektype long stdio.h sys/types.h
11753 eval $typedef_ask
11754
11755 echo " "
11756 $echo $n "Checking to see how big your file offsets are...$c" >&4
11757 $cat >try.c <<EOCP
11758 #include <sys/types.h>
11759 #include <stdio.h>
11760 int main()
11761 {
11762         printf("%d\n", sizeof($lseektype));
11763 }
11764 EOCP
11765 set try
11766 if eval $compile_ok; then
11767         lseeksize=`./try`
11768         $echo " $lseeksize bytes." >&4
11769 else
11770         dflt='4'
11771         echo " "
11772         echo "(I can't seem to compile the test program.  Guessing...)"
11773         rp="What is the size of your file offsets (in bytes)?"
11774         . ./myread
11775         lseeksize="$ans"
11776 fi
11777 $rm -f try.c try
11778
11779 echo " "
11780 echo "Checking if your $make program sets \$(MAKE)..." >&4
11781 case "$make_set_make" in
11782 '')
11783         $sed 's/^X //' > testmake.mak << 'EOF'
11784 Xall:
11785 X       @echo 'maketemp="$(MAKE)"'
11786 EOF
11787         case "`$make -f testmake.mak 2>/dev/null`" in
11788         *maketemp=*) make_set_make='#' ;;
11789         *)      make_set_make="MAKE=$make" ;;
11790         esac
11791         $rm -f testmake.mak
11792         ;;
11793 esac
11794 case "$make_set_make" in
11795 '#') echo "Yup, it does.";;
11796 *) echo "Nope, it doesn't.";;
11797 esac
11798
11799 : see what type is used for mode_t
11800 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11801 set mode_t modetype int stdio.h sys/types.h
11802 eval $typedef_ask
11803
11804 : define a fucntion to check prototypes
11805 $cat > protochk <<EOSH
11806 $startsh
11807 cc="$cc"
11808 optimize="$optimize"
11809 ccflags="$ccflags"
11810 prototype="$prototype"
11811 define="$define"
11812 rm=$rm
11813 EOSH
11814
11815 $cat >> protochk <<'EOSH'
11816
11817 $rm -f try.c
11818 foo="$1"
11819 shift
11820 while test $# -ge 2; do
11821         case "$1" in
11822                 $define) echo "#include <$2>" >> try.c ;;
11823                 literal) echo "$2" >> try.c ;;
11824         esac
11825     shift 2
11826 done
11827 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11828 cat >> try.c <<'EOCP'
11829 #ifdef CAN_PROTOTYPE
11830 #define _(args) args
11831 #else
11832 #define _(args) ()
11833 #endif
11834 EOCP
11835 echo "$foo" >> try.c
11836 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11837 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11838 status=$?
11839 $rm -f try.[co]
11840 exit $status
11841 EOSH
11842 chmod +x protochk
11843 $eunicefix protochk
11844
11845 : see what type is used for size_t
11846 rp="What is the type used for the length parameter for string functions?"
11847 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11848 eval $typedef_ask
11849
11850 : check for type of arguments to gethostbyaddr. 
11851 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11852         case "$d_gethbyaddr" in
11853         $define)
11854                 $cat <<EOM
11855
11856 Checking to see what type of arguments are accepted by gethostbyaddr().
11857 EOM
11858                 hdrs="$define sys/types.h
11859                         $d_socket sys/socket.h 
11860                         $i_niin netinet/in.h 
11861                         $i_netdb netdb.h
11862                         $i_unistd unistd.h"
11863                 : The first arg can 'char *' or 'void *'
11864                 : The second arg is some of integral type
11865                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11866                         for yyy in size_t long int; do
11867                                 case "$netdb_host_type" in
11868                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11869                                         if ./protochk "$try" $hdrs; then
11870                                                 echo "Your system accepts $xxx for the first arg."
11871                                                 echo "...and $yyy for the second arg."
11872                                                 netdb_host_type="$xxx"
11873                                                 netdb_hlen_type="$yyy"
11874                                         fi
11875                                         ;;
11876                                 esac
11877                         done
11878                 done
11879                 : In case none of those worked, prompt the user.
11880                 case "$netdb_host_type" in
11881                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11882                         dflt='char *'
11883                         . ./myread
11884                         netdb_host_type=$ans
11885                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11886                         dflt="$sizetype"
11887                         . ./myread
11888                         netdb_hlen_type=$ans
11889                         ;;
11890                 esac
11891                 ;;
11892         *)      : no gethostbyaddr, so pick harmless defaults
11893                 netdb_host_type='char *'
11894                 netdb_hlen_type="$sizetype"
11895                 ;;
11896         esac
11897         # Remove the "const" if needed. -- but then we'll have a 
11898         # prototype clash!
11899         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11900 fi
11901
11902 : check for type of argument to gethostbyname. 
11903 if test "X$netdb_name_type" = X ; then
11904         case "$d_gethbyname" in
11905         $define)
11906                 $cat <<EOM
11907
11908 Checking to see what type of argument is accepted by gethostbyname().
11909 EOM
11910                 hdrs="$define sys/types.h
11911                         $d_socket sys/socket.h 
11912                         $i_niin netinet/in.h 
11913                         $i_netdb netdb.h
11914                         $i_unistd unistd.h"
11915                 for xxx in "const char *" "char *"; do
11916                         case "$netdb_name_type" in
11917                         '')     try="extern struct hostent *gethostbyname($xxx);"
11918                                 if ./protochk "$try" $hdrs; then
11919                                         echo "Your system accepts $xxx."
11920                                         netdb_name_type="$xxx"
11921                                 fi
11922                                 ;;
11923                         esac
11924                 done
11925                 : In case none of those worked, prompt the user.
11926                 case "$netdb_name_type" in
11927                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11928                         dflt='char *'
11929                         . ./myread
11930                         netdb_name_type=$ans
11931                         ;;
11932                 esac
11933                 ;;
11934         *)      : no gethostbyname, so pick harmless default
11935                 netdb_name_type='char *'
11936                 ;;
11937         esac
11938 fi
11939
11940 : check for type of 1st argument to getnetbyaddr. 
11941 if test "X$netdb_net_type" = X ; then
11942         case "$d_getnbyaddr" in
11943         $define)
11944                 $cat <<EOM
11945
11946 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11947 EOM
11948                 hdrs="$define sys/types.h
11949                         $d_socket sys/socket.h 
11950                         $i_niin netinet/in.h 
11951                         $i_netdb netdb.h
11952                         $i_unistd unistd.h"
11953                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11954                         case "$netdb_net_type" in
11955                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11956                                 if ./protochk "$try" $hdrs; then
11957                                         echo "Your system accepts $xxx."
11958                                         netdb_net_type="$xxx"
11959                                 fi
11960                                 ;;
11961                         esac
11962                 done
11963                 : In case none of those worked, prompt the user.
11964                 case "$netdb_net_type" in
11965                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11966                         dflt='long'
11967                         . ./myread
11968                         netdb_net_type=$ans
11969                         ;;
11970                 esac
11971                 ;;
11972         *)      : no getnetbyaddr, so pick harmless default
11973                 netdb_net_type='long'
11974                 ;;
11975         esac
11976 fi
11977 : locate the preferred pager for this system
11978 case "$pager" in
11979 '')
11980         dflt=''
11981         case "$pg" in
11982         /*) dflt=$pg;;
11983         esac
11984         case "$more" in
11985         /*) dflt=$more;;
11986         esac
11987         case "$less" in
11988         /*) dflt=$less;;
11989         esac
11990         case "$dflt" in
11991         '') dflt=/usr/ucb/more;;
11992         esac
11993         ;;
11994 *) dflt="$pager";;
11995 esac
11996 echo " "
11997 fn=f/
11998 rp='What pager is used on your system?'
11999 . ./getfile
12000 pager="$ans"
12001
12002 : see what type pids are declared as in the kernel
12003 rp="What is the type of process ids on this system?"
12004 set pid_t pidtype int stdio.h sys/types.h
12005 eval $typedef_ask
12006
12007 : Find earliest binary compatible site_perl subdirectory perl can use.
12008 case "$bincompat5005" in
12009 "$define") xs_apiversion='5.005' ;;
12010 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12011 esac
12012 : Find earliest pure perl site_perl subdirectory perl can use.
12013 : The versioned directories started at 5.005.
12014 pm_apiversion='5.005'
12015
12016 : check for length of pointer
12017 echo " "
12018 case "$ptrsize" in
12019 '')
12020         $echo $n "Checking to see how big your pointers are...$c" >&4
12021         if test "$voidflags" -gt 7; then
12022                 echo '#define VOID_PTR char *' > try.c
12023         else
12024                 echo '#define VOID_PTR void *' > try.c
12025         fi
12026         $cat >>try.c <<'EOCP'
12027 #include <stdio.h>
12028 int main()
12029 {
12030         printf("%d\n", sizeof(VOID_PTR));
12031         exit(0);
12032 }
12033 EOCP
12034         set try
12035         if eval $compile_ok; then
12036                 ptrsize=`./try`
12037                 $echo " $ptrsize bytes." >&4
12038         else
12039                 dflt='4'
12040                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12041                 rp="What is the size of a pointer (in bytes)?"
12042                 . ./myread
12043                 ptrsize="$ans"
12044         fi
12045         ;;
12046 esac
12047 $rm -f try.c try
12048
12049 : see if ar generates random libraries by itself
12050 echo " "
12051 echo "Checking how to generate random libraries on your machine..." >&4
12052 echo 'int bar1() { return bar2(); }' > bar1.c
12053 echo 'int bar2() { return 2; }' > bar2.c
12054 $cat > foo.c <<'EOP'
12055 int main() { printf("%d\n", bar1()); exit(0); }
12056 EOP
12057 $cc $ccflags -c bar1.c >/dev/null 2>&1
12058 $cc $ccflags -c bar2.c >/dev/null 2>&1
12059 $cc $ccflags -c foo.c >/dev/null 2>&1
12060 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12061 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12062         ./foobar >/dev/null 2>&1; then
12063         echo "$ar appears to generate random libraries itself."
12064         orderlib=false
12065         ranlib=":"
12066 elif $ar ts bar$_a >/dev/null 2>&1 &&
12067         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12068         ./foobar >/dev/null 2>&1; then
12069                 echo "a table of contents needs to be added with '$ar ts'."
12070                 orderlib=false
12071                 ranlib="$ar ts"
12072 else
12073         case "$ranlib" in
12074         :) ranlib='';;
12075         '')
12076                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12077                 $test -f $ranlib || ranlib=''
12078                 ;;
12079         esac
12080         if $test -n "$ranlib"; then
12081                 echo "your system has '$ranlib'; we'll use that."
12082                 orderlib=false
12083         else
12084                 echo "your system doesn't seem to support random libraries"
12085                 echo "so we'll use lorder and tsort to order the libraries."
12086                 orderlib=true
12087                 ranlib=":"
12088         fi
12089 fi
12090 $rm -f foo* bar* 
12091
12092 : check for type of arguments to select. 
12093 case "$selecttype" in
12094 '') case "$d_select" in
12095         $define)
12096                 $cat <<EOM
12097 Checking to see what type of arguments are accepted by select().
12098 EOM
12099                 hdrs="$define sys/types.h
12100                         $i_systime sys/time.h 
12101                         $i_sysselct sys/select.h
12102                         $d_socket sys/socket.h"
12103                 : The first arg can be int, unsigned, or size_t
12104                 : The last arg may or may not be 'const'
12105                 val=''
12106                 : void pointer has been seen but using that
12107                 : breaks the selectminbits test
12108                 for xxx in 'fd_set *' 'int *'; do
12109                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12110                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12111                                         case "$val" in
12112                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12113                                                 if ./protochk "$try" $hdrs; then
12114                                                         echo "Your system accepts $xxx."
12115                                                         val="$xxx"
12116                                                 fi
12117                                                 ;;
12118                                         esac
12119                                 done
12120                         done
12121                 done
12122                 case "$val" in
12123                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12124                         case "$d_fd_set" in
12125                                 $define) dflt="fd_set *" ;;
12126                                 *)              dflt="int *" ;;
12127                         esac
12128                         . ./myread
12129                         val=$ans
12130                         ;;
12131                 esac
12132                 selecttype="$val"
12133                 ;;
12134         *)      : no select, so pick a harmless default
12135                 selecttype='int *'
12136                 ;;
12137         esac
12138         ;;
12139 esac
12140
12141 : check for the select 'width'
12142 case "$selectminbits" in
12143 '') case "$d_select" in
12144         $define)
12145                 $cat <<EOM
12146
12147 Checking to see on how many bits at a time your select() operates...
12148 EOM
12149                 $cat >try.c <<EOCP
12150 #include <sys/types.h>
12151 #$i_time I_TIME
12152 #$i_systime I_SYS_TIME
12153 #$i_systimek I_SYS_TIME_KERNEL
12154 #ifdef I_TIME
12155 #   include <time.h>
12156 #endif
12157 #ifdef I_SYS_TIME
12158 #   ifdef I_SYS_TIME_KERNEL
12159 #       define KERNEL
12160 #   endif
12161 #   include <sys/time.h>
12162 #   ifdef I_SYS_TIME_KERNEL
12163 #       undef KERNEL
12164 #   endif
12165 #endif
12166 #$i_sysselct I_SYS_SELECT
12167 #ifdef I_SYS_SELECT
12168 #include <sys/select.h>
12169 #endif
12170 #$d_socket HAS_SOCKET
12171 #ifdef HAS_SOCKET
12172 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12173 #endif
12174 #include <stdio.h>
12175 $selecttype b;
12176 #define S sizeof(*(b))
12177 #define MINBITS 64
12178 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12179 #define NBITS  (NBYTES * 8)
12180 int main() {
12181     char s[NBYTES];
12182     struct timeval t;
12183     int i;
12184     FILE* fp;
12185     int fd;
12186
12187     fclose(stdin);
12188     fp = fopen("try.c", "r");
12189     if (fp == 0)
12190       exit(1);
12191     fd = fileno(fp);
12192     if (fd < 0)
12193       exit(2);
12194     b = ($selecttype)s;
12195     for (i = 0; i < NBITS; i++)
12196         FD_SET(i, b);
12197     t.tv_sec  = 0;
12198     t.tv_usec = 0;
12199     select(fd + 1, b, 0, 0, &t);
12200     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12201     printf("%d\n", i + 1);
12202     return 0;
12203 }
12204 EOCP
12205                 set try
12206                 if eval $compile_ok; then
12207                         selectminbits=`./try`
12208                         case "$selectminbits" in
12209                         '')     cat >&4 <<EOM
12210 Cannot figure out on how many bits at a time your select() operates.
12211 I'll play safe and guess it is 32 bits.
12212 EOM
12213                                 selectminbits=32
12214                                 bits="32 bits"
12215                                 ;;
12216                         1)      bits="1 bit" ;;
12217                         *)      bits="$selectminbits bits" ;;
12218                         esac
12219                         echo "Your select() operates on $bits at a time." >&4
12220                 else
12221                         rp='What is the minimum number of bits your select() operates on?'
12222                         case "$byteorder" in
12223                         1234|12345678)  dflt=32 ;;
12224                         *)              dflt=1  ;;
12225                         esac
12226                         . ./myread
12227                         val=$ans
12228                         selectminbits="$val"
12229                 fi
12230                 $rm -f try.* try
12231                 ;;
12232         *)      : no select, so pick a harmless default
12233                 selectminbits='32'
12234                 ;;
12235         esac
12236         ;;
12237 esac
12238
12239 : Trace out the files included by signal.h, then look for SIGxxx names.
12240 : Remove SIGARRAYSIZE used by HPUX.
12241 : Remove SIGSTKSIZE used by Linux.
12242 : Remove SIGSTKSZ used by Posix.
12243 : Remove SIGTYP void lines used by OS2.
12244 xxx=`echo '#include <signal.h>' |
12245         $cppstdin $cppminus $cppflags 2>/dev/null |
12246         $grep '^[       ]*#.*include' | 
12247         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12248 : Check this list of files to be sure we have parsed the cpp output ok.
12249 : This will also avoid potentially non-existent files, such 
12250 : as ../foo/bar.h
12251 xxxfiles=''
12252 for xx in $xxx /dev/null ; do
12253         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12254 done
12255 : If we have found no files, at least try signal.h
12256 case "$xxxfiles" in
12257 '')     xxxfiles=`./findhdr signal.h` ;;
12258 esac
12259 xxx=`awk '
12260 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12261         print substr($2, 4, 20)
12262 }
12263 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12264         print substr($3, 4, 20)
12265 }' $xxxfiles`
12266 : Append some common names just in case the awk scan failed.
12267 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12268 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12269 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12270 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12271 : generate a few handy files for later
12272 $cat > signal.c <<'EOCP'
12273 #include <sys/types.h>
12274 #include <signal.h>
12275 #include <stdio.h>
12276 int main() {
12277
12278 /* Strange style to avoid deeply-nested #if/#else/#endif */
12279 #ifndef NSIG
12280 #  ifdef _NSIG
12281 #    define NSIG (_NSIG)
12282 #  endif
12283 #endif
12284
12285 #ifndef NSIG
12286 #  ifdef SIGMAX
12287 #    define NSIG (SIGMAX+1)
12288 #  endif
12289 #endif
12290
12291 #ifndef NSIG
12292 #  ifdef SIG_MAX
12293 #    define NSIG (SIG_MAX+1)
12294 #  endif
12295 #endif
12296
12297 #ifndef NSIG
12298 #  ifdef MAXSIG
12299 #    define NSIG (MAXSIG+1)
12300 #  endif
12301 #endif
12302
12303 #ifndef NSIG
12304 #  ifdef MAX_SIG
12305 #    define NSIG (MAX_SIG+1)
12306 #  endif
12307 #endif
12308
12309 #ifndef NSIG
12310 #  ifdef SIGARRAYSIZE
12311 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12312 #  endif
12313 #endif
12314
12315 #ifndef NSIG
12316 #  ifdef _sys_nsig
12317 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12318 #  endif
12319 #endif
12320
12321 /* Default to some arbitrary number that's big enough to get most
12322    of the common signals.
12323 */
12324 #ifndef NSIG
12325 #    define NSIG 50
12326 #endif
12327
12328 printf("NSIG %d\n", NSIG);
12329
12330 #ifndef JUST_NSIG
12331
12332 EOCP
12333
12334 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12335 {
12336         printf "#ifdef SIG"; printf $1; printf "\n"
12337         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12338         printf $1; printf ");\n"
12339         printf "#endif\n"
12340 }
12341 END {
12342         printf "#endif /* JUST_NSIG */\n";
12343         printf "}\n";
12344 }
12345 ' >>signal.c
12346 $cat >signal.awk <<'EOP'
12347 BEGIN { ndups = 0 }
12348 $1 ~ /^NSIG$/ { nsig = $2 }
12349 ($1 !~ /^NSIG$/) && (NF == 2) {
12350     if ($2 > maxsig) { maxsig = $2 }
12351     if (sig_name[$2]) {
12352         dup_name[ndups] = $1
12353         dup_num[ndups] = $2
12354         ndups++ 
12355     }
12356     else {
12357         sig_name[$2] = $1
12358         sig_num[$2] = $2
12359     }
12360 }
12361 END { 
12362     if (nsig == 0) {
12363         nsig = maxsig + 1
12364     }
12365     printf("NSIG %d\n", nsig);
12366     for (n = 1; n < nsig; n++) {
12367         if (sig_name[n]) {
12368             printf("%s %d\n", sig_name[n], sig_num[n])
12369         }
12370         else {
12371             printf("NUM%d %d\n", n, n) 
12372         }
12373     }
12374     for (n = 0; n < ndups; n++) {
12375         printf("%s %d\n", dup_name[n], dup_num[n])
12376     }
12377 }
12378 EOP
12379 $cat >signal_cmd <<EOS
12380 $startsh
12381 if $test -s signal.lst; then
12382     echo "Using your existing signal.lst file"
12383         exit 0
12384 fi
12385 xxx="$xxx"
12386 EOS
12387 $cat >>signal_cmd <<'EOS'
12388
12389 set signal
12390 if eval $compile_ok; then
12391         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12392 else
12393         echo "(I can't seem be able to compile the whole test program)" >&4
12394         echo "(I'll try it in little pieces.)" >&4
12395         set signal -DJUST_NSIG
12396         if eval $compile_ok; then
12397                 ./signal$_exe > signal.nsg
12398                 $cat signal.nsg
12399         else
12400                 echo "I can't seem to figure out how many signals you have." >&4
12401                 echo "Guessing 50." >&4
12402                 echo 'NSIG 50' > signal.nsg
12403         fi
12404         : Now look at all the signal names, one at a time.
12405         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12406                 $cat > signal.c <<EOCP
12407 #include <sys/types.h>
12408 #include <signal.h>
12409 #include <stdio.h>
12410 int main() {
12411 printf("$xx %d\n", SIG${xx});
12412 return 0;
12413 }
12414 EOCP
12415                 set signal
12416                 if eval $compile; then
12417                         echo "SIG${xx} found."
12418                         ./signal$_exe  >> signal.ls1
12419                 else
12420                         echo "SIG${xx} NOT found."
12421                 fi
12422         done
12423         if $test -s signal.ls1; then
12424                 $cat signal.nsg signal.ls1 |
12425                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12426         fi
12427
12428 fi
12429 if $test -s signal.lst; then
12430         :
12431 else
12432         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12433         echo 'kill -l' >signal
12434         set X `csh -f <signal`
12435         $rm -f signal
12436         shift
12437         case $# in
12438         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12439         esac
12440         echo $@ | $tr ' ' $trnl | \
12441             $awk '{ printf "%s %d\n", $1, ++s; }
12442                   END { printf "NSIG %d\n", ++s }' >signal.lst
12443 fi
12444 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12445 EOS
12446 chmod a+x signal_cmd
12447 $eunicefix signal_cmd
12448
12449 : generate list of signal names
12450 echo " "
12451 case "$sig_name_init" in
12452 '') doinit=yes ;;
12453 *)  case "$sig_num_init" in
12454     ''|*,*) doinit=yes ;;
12455     esac ;;
12456 esac
12457 case "$doinit" in
12458 yes)
12459         echo "Generating a list of signal names and numbers..." >&4
12460         . ./signal_cmd
12461         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12462         sig_name=`$awk 'BEGIN { printf "ZERO " }
12463                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12464         sig_num=`$awk  'BEGIN { printf "0 " }
12465                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12466         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12467                              !/^NSIG/   { printf "\"%s\", ", $1 }
12468                              END        { printf "0\n" }' signal.lst`
12469         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12470                              !/^NSIG/   { printf "%d, ", $2}
12471                              END        { printf "0\n"}' signal.lst`
12472         ;;
12473 esac
12474 echo "The following $sig_count signals are available:"
12475 echo " "
12476 echo $sig_name | $awk \
12477 'BEGIN { linelen = 0 }
12478 {
12479         for (i = 1; i <= NF; i++) {
12480                 name = "SIG" $i " "
12481                 linelen = linelen + length(name)
12482                 if (linelen > 70) {
12483                         printf "\n"
12484                         linelen = length(name)
12485                 }
12486                 printf "%s", name
12487         }
12488         printf "\n"
12489 }'
12490 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12491
12492 : see what type is used for signed size_t
12493 set ssize_t ssizetype int stdio.h sys/types.h
12494 eval $typedef
12495 dflt="$ssizetype"
12496 $cat > ssize.c <<EOM
12497 #include <stdio.h>
12498 #include <sys/types.h>
12499 #define Size_t $sizetype
12500 #define SSize_t $dflt
12501 int main()
12502 {
12503         if (sizeof(Size_t) == sizeof(SSize_t))
12504                 printf("$dflt\n");
12505         else if (sizeof(Size_t) == sizeof(int))
12506                 printf("int\n");
12507         else 
12508                 printf("long\n");
12509         exit(0);
12510 }
12511 EOM
12512 echo " "
12513 set ssize
12514 if eval $compile_ok && ./ssize > /dev/null; then
12515         ssizetype=`./ssize`
12516         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12517 else
12518         $cat >&4 <<EOM
12519 Help! I can't compile and run the ssize_t test program: please enlighten me!
12520 (This is probably a misconfiguration in your system or libraries, and
12521 you really ought to fix it.  Still, I'll try anyway.)
12522
12523 I need a type that is the same size as $sizetype, but is guaranteed to
12524 be signed.  Common values are ssize_t, int and long.
12525
12526 EOM
12527         rp="What signed type is the same size as $sizetype?"
12528         . ./myread
12529         ssizetype="$ans"
12530 fi
12531 $rm -f ssize ssize.*
12532
12533 : see what type of char stdio uses.
12534 echo " "
12535 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12536         echo "Your stdio uses unsigned chars." >&4
12537         stdchar="unsigned char"
12538 else
12539         echo "Your stdio uses signed chars." >&4
12540         stdchar="char"
12541 fi
12542
12543 : see if time exists
12544 echo " "
12545 if test "X$d_time" = X -o X"$timetype" = X; then
12546     if set time val -f d_time; eval $csym; $val; then
12547                 echo 'time() found.' >&4
12548                 val="$define"
12549                 rp="What is the type returned by time() on this system?"
12550                 set time_t timetype long stdio.h sys/types.h
12551                 eval $typedef_ask
12552     else
12553                 echo 'time() not found, hope that will do.' >&4
12554                 val="$undef"
12555                 timetype='int';
12556     fi
12557     set d_time
12558     eval $setvar
12559 fi
12560
12561 : see what type uids are declared as in the kernel
12562 echo " "
12563 echo "Looking for the type for user ids returned by getuid()."
12564 set uid_t uidtype xxx stdio.h sys/types.h
12565 eval $typedef
12566 case "$uidtype" in
12567 xxx)
12568         xxx=`./findhdr sys/user.h`
12569         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12570         case $1 in
12571         unsigned) dflt="$1 $2" ;;
12572         *) dflt="$1" ;;
12573         esac
12574         ;;
12575 *) dflt="$uidtype";;
12576 esac
12577 case "$uidtype" in
12578 uid_t)  echo "uid_t found." ;;
12579 *)      rp="What is the type for user ids returned by getuid()?"
12580         . ./myread
12581         uidtype="$ans"
12582         ;;
12583 esac
12584
12585 echo " "
12586 case "$uidtype" in
12587 *_t) zzz="$uidtype"     ;;
12588 *)   zzz="uid"          ;;
12589 esac
12590 echo "Checking the sign of $zzz..." >&4
12591 cat > try.c <<EOCP
12592 #include <sys/types.h>
12593 #include <stdio.h>
12594 int main() {
12595         $uidtype foo = -1;
12596         if (foo < 0)
12597                 printf("-1\n");
12598         else
12599                 printf("1\n");
12600 }
12601 EOCP
12602 set try
12603 if eval $compile; then
12604         yyy=`./try`
12605         case "$yyy" in
12606         '')     uidsign=1
12607                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12608                 ;;
12609         *)      uidsign=$yyy
12610                 case "$uidsign" in
12611                  1) echo "Your $zzz is unsigned." ;;
12612                 -1) echo "Your $zzz is signed."   ;;
12613                 esac
12614                 ;;
12615         esac
12616 else
12617         uidsign=1
12618         echo "(I can't compile the test program--guessing unsigned.)" >&4
12619 fi
12620
12621
12622 : see if dbm.h is available
12623 : see if dbmclose exists
12624 set dbmclose d_dbmclose
12625 eval $inlibc
12626
12627 case "$d_dbmclose" in
12628 $define)
12629         set dbm.h i_dbm
12630         eval $inhdr
12631         case "$i_dbm" in
12632         $define)
12633                 val="$undef"
12634                 set i_rpcsvcdbm
12635                 eval $setvar
12636                 ;;
12637         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12638                 eval $inhdr
12639                 ;;
12640         esac
12641         ;;
12642 *)      echo "We won't be including <dbm.h>"
12643         val="$undef"
12644         set i_dbm
12645         eval $setvar
12646         val="$undef"
12647         set i_rpcsvcdbm
12648         eval $setvar
12649         ;;
12650 esac
12651
12652 : see if this is a sys/file.h system
12653 val=''
12654 set sys/file.h val
12655 eval $inhdr
12656
12657 : do we need to include sys/file.h ?
12658 case "$val" in
12659 "$define")
12660         echo " "
12661         if $h_sysfile; then
12662                 val="$define"
12663                 echo "We'll be including <sys/file.h>." >&4
12664         else
12665                 val="$undef"
12666                 echo "We won't be including <sys/file.h>." >&4
12667         fi
12668         ;;
12669 *)
12670         h_sysfile=false
12671         ;;
12672 esac
12673 set i_sysfile
12674 eval $setvar
12675
12676 : see if fcntl.h is there
12677 val=''
12678 set fcntl.h val
12679 eval $inhdr
12680
12681 : see if we can include fcntl.h
12682 case "$val" in
12683 "$define")
12684         echo " "
12685         if $h_fcntl; then
12686                 val="$define"
12687                 echo "We'll be including <fcntl.h>." >&4
12688         else
12689                 val="$undef"
12690                 if $h_sysfile; then
12691         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12692                 else
12693                         echo "We won't be including <fcntl.h>." >&4
12694                 fi
12695         fi
12696         ;;
12697 *)
12698         h_fcntl=false
12699         val="$undef"
12700         ;;
12701 esac
12702 set i_fcntl
12703 eval $setvar
12704
12705 : see if locale.h is available
12706 set locale.h i_locale
12707 eval $inhdr
12708
12709 : see if mach cthreads are available
12710 if test "X$usethreads" = "X$define"; then
12711         set mach/cthreads.h i_machcthr
12712         eval $inhdr
12713 else
12714         i_machcthr="$undef"
12715 fi
12716
12717
12718
12719 : see if this is a math.h system
12720 set math.h i_math
12721 eval $inhdr
12722
12723 : see if this is a mntent.h system
12724 set mntent.h i_mntent
12725 eval $inhdr
12726
12727 : see if ndbm.h is available
12728 set ndbm.h t_ndbm
12729 eval $inhdr
12730 case "$t_ndbm" in
12731 $define)
12732         : see if dbm_open exists
12733         set dbm_open d_dbm_open
12734         eval $inlibc
12735         case "$d_dbm_open" in
12736         $undef)
12737                 t_ndbm="$undef"
12738                 echo "We won't be including <ndbm.h>"
12739                 ;;
12740         esac
12741         ;;
12742 esac
12743 val="$t_ndbm"
12744 set i_ndbm
12745 eval $setvar
12746
12747 : see if net/errno.h is available
12748 val=''
12749 set net/errno.h val
12750 eval $inhdr
12751
12752 : Unfortunately, it causes problems on some systems.  Arrgh.
12753 case "$val" in
12754 $define)
12755         cat > try.c <<'EOM'
12756 #include <stdio.h>
12757 #include <errno.h>
12758 #include <net/errno.h>
12759 int func()
12760 {
12761         return ENOTSOCK;
12762 }
12763 EOM
12764         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12765                 echo "We'll be including <net/errno.h>." >&4
12766         else
12767                 echo "We won't be including <net/errno.h>." >&4
12768                 val="$undef"
12769         fi
12770         $rm -f try.* try
12771         ;;
12772 esac
12773 set i_neterrno
12774 eval $setvar
12775
12776 : see if netinet/tcp.h is available
12777 set netinet/tcp.h i_netinettcp
12778 eval $inhdr
12779
12780 : see if this is a poll.h system
12781 set poll.h i_poll
12782 eval $inhdr
12783
12784 : get C preprocessor symbols handy
12785 echo " "
12786 $echo $n "Hmm... $c"
12787 echo $al | $tr ' ' $trnl >Cppsym.know
12788 $cat <<EOSS >Cppsym
12789 $startsh
12790 case "\$1" in
12791 -l) list=true
12792         shift
12793         ;;
12794 esac
12795 unknown=''
12796 case "\$list\$#" in
12797 1|2)
12798         for sym do
12799                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12800                         exit 0
12801                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12802                         :
12803                 else
12804                         unknown="\$unknown \$sym"
12805                 fi
12806         done
12807         set X \$unknown
12808         shift
12809         ;;
12810 esac
12811 case \$# in
12812 0) exit 1;;
12813 esac
12814 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12815 #ifdef \1\\
12816 exit 0; _ _ _ _\1\\      \1\\
12817 #endif\\
12818 /' >Cppsym\$\$
12819 echo "exit 1; _ _ _" >>Cppsym\$\$
12820 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12821 case "\$list" in
12822 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12823 *)
12824         sh Cppsym2\$\$
12825         status=\$?
12826         ;;
12827 esac
12828 $rm -f Cppsym\$\$ Cppsym2\$\$
12829 exit \$status
12830 EOSS
12831 chmod +x Cppsym
12832 $eunicefix Cppsym
12833 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12834
12835 : now check the C compiler for additional symbols
12836 postprocess_cc_v=''
12837 case "$osname" in
12838 aix) postprocess_cc_v="|$tr , ' '" ;;
12839 esac
12840 $cat >ccsym <<EOS
12841 $startsh
12842 $cat >tmp.c <<EOF
12843 extern int foo;
12844 EOF
12845 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12846 do
12847         case "\$i" in
12848         -D*) echo "\$i" | $sed 's/^-D//';;
12849         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12850         esac
12851 done
12852 $rm -f try.c
12853 EOS
12854 postprocess_cc_v=''
12855 chmod +x ccsym
12856 $eunicefix ccsym
12857 ./ccsym > ccsym1.raw
12858 if $test -s ccsym1.raw; then
12859        $sort ccsym1.raw | $uniq >ccsym.raw
12860 else
12861        mv ccsym1.raw ccsym.raw
12862 fi
12863
12864 $awk '/\=/ { print $0; next }
12865         { print $0"=1" }' ccsym.raw >ccsym.list
12866 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12867 $comm -13 ccsym.true ccsym.list >ccsym.own
12868 $comm -12 ccsym.true ccsym.list >ccsym.com
12869 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12870 also=''
12871 if $test -z ccsym.raw; then
12872         echo "Your C compiler doesn't seem to define any symbols!" >&4
12873         echo " "
12874         echo "However, your C preprocessor defines the following symbols:"
12875         $cat Cppsym.true
12876         ccsymbols=''
12877         cppsymbols=`$cat Cppsym.true`
12878         cppsymbols=`echo $cppsymbols`
12879         cppccsymbols="$cppsymbols"
12880 else
12881         if $test -s ccsym.com; then
12882                 echo "Your C compiler and pre-processor define these symbols:"
12883                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12884                 also='also '
12885                 symbols='ones'
12886                 cppccsymbols=`$cat ccsym.com`
12887                 cppccsymbols=`echo $cppccsymbols`
12888                 $test "$silent" || sleep 1
12889         fi
12890         if $test -s ccsym.cpp; then
12891                 $test "$also" && echo " "
12892                 echo "Your C pre-processor ${also}defines the following symbols:"
12893                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12894                 also='further '
12895                 cppsymbols=`$cat ccsym.cpp`
12896                 cppsymbols=`echo $cppsymbols`
12897                 $test "$silent" || sleep 1
12898         fi
12899         if $test -s ccsym.own; then
12900                 $test "$also" && echo " "
12901                 echo "Your C compiler ${also}defines the following cpp symbols:"
12902                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12903                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12904                 ccsymbols=`$cat ccsym.own`
12905                 ccsymbols=`echo $ccsymbols`
12906                 $test "$silent" || sleep 1
12907         fi
12908 fi
12909 $rm -f ccsym*
12910
12911 : see if this is a termio system
12912 val="$undef"
12913 val2="$undef"
12914 val3="$undef"
12915 if $test `./findhdr termios.h`; then
12916         set tcsetattr i_termios
12917         eval $inlibc
12918         val3="$i_termios"
12919 fi
12920 echo " "
12921 case "$val3" in
12922 "$define") echo "You have POSIX termios.h... good!" >&4;;
12923 *) if ./Cppsym pyr; then
12924                 case "`/bin/universe`" in
12925                 ucb) if $test `./findhdr sgtty.h`; then
12926                                 val2="$define"
12927                                 echo "<sgtty.h> found." >&4
12928                         else
12929                                 echo "System is pyramid with BSD universe."
12930                                 echo "<sgtty.h> not found--you could have problems." >&4
12931                         fi;;
12932                 *) if $test `./findhdr termio.h`; then
12933                                 val="$define"
12934                                 echo "<termio.h> found." >&4
12935                         else
12936                                 echo "System is pyramid with USG universe."
12937                                 echo "<termio.h> not found--you could have problems." >&4
12938                         fi;;
12939                 esac
12940         elif ./usg; then
12941                 if $test `./findhdr termio.h`; then
12942                         echo "<termio.h> found." >&4
12943                         val="$define"
12944                 elif $test `./findhdr sgtty.h`; then
12945                         echo "<sgtty.h> found." >&4
12946                         val2="$define"
12947                 else
12948 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12949                 fi
12950         else
12951                 if $test `./findhdr sgtty.h`; then
12952                         echo "<sgtty.h> found." >&4
12953                         val2="$define"
12954                 elif $test `./findhdr termio.h`; then
12955                         echo "<termio.h> found." >&4
12956                         val="$define"
12957                 else
12958 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12959                 fi
12960         fi;;
12961 esac
12962 set i_termio; eval $setvar
12963 val=$val2; set i_sgtty; eval $setvar
12964 val=$val3; set i_termios; eval $setvar
12965
12966 : see if this is a shadow.h system
12967 set shadow.h i_shadow
12968 eval $inhdr
12969
12970 : see if this is a socks.h system
12971 set socks.h i_socks
12972 eval $inhdr
12973
12974 : see if stdarg is available
12975 echo " "
12976 if $test `./findhdr stdarg.h`; then
12977         echo "<stdarg.h> found." >&4
12978         valstd="$define"
12979 else
12980         echo "<stdarg.h> NOT found." >&4
12981         valstd="$undef"
12982 fi
12983
12984 : see if varags is available
12985 echo " "
12986 if $test `./findhdr varargs.h`; then
12987         echo "<varargs.h> found." >&4
12988 else
12989         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12990 fi
12991
12992 : set up the varargs testing programs
12993 $cat > varargs.c <<EOP
12994 #ifdef I_STDARG
12995 #include <stdarg.h>
12996 #endif
12997 #ifdef I_VARARGS
12998 #include <varargs.h>
12999 #endif
13000
13001 #ifdef I_STDARG
13002 int f(char *p, ...)
13003 #else
13004 int f(va_alist)
13005 va_dcl
13006 #endif
13007 {
13008         va_list ap;
13009 #ifndef I_STDARG
13010         char *p;
13011 #endif
13012 #ifdef I_STDARG
13013         va_start(ap,p);
13014 #else
13015         va_start(ap);
13016         p = va_arg(ap, char *);
13017 #endif
13018         va_end(ap);
13019 }
13020 EOP
13021 $cat > varargs <<EOP
13022 $startsh
13023 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13024         echo "true"
13025 else
13026         echo "false"
13027 fi
13028 $rm -f varargs$_o
13029 EOP
13030 chmod +x varargs
13031
13032 : now check which varargs header should be included
13033 echo " "
13034 i_varhdr=''
13035 case "$valstd" in
13036 "$define")
13037         if `./varargs I_STDARG`; then
13038                 val='stdarg.h'
13039         elif `./varargs I_VARARGS`; then
13040                 val='varargs.h'
13041         fi
13042         ;;
13043 *)
13044         if `./varargs I_VARARGS`; then
13045                 val='varargs.h'
13046         fi
13047         ;;
13048 esac
13049 case "$val" in
13050 '')
13051 echo "I could not find the definition for va_dcl... You have problems..." >&4
13052         val="$undef"; set i_stdarg; eval $setvar
13053         val="$undef"; set i_varargs; eval $setvar
13054         ;;
13055 *) 
13056         set i_varhdr
13057         eval $setvar
13058         case "$i_varhdr" in
13059         stdarg.h)
13060                 val="$define"; set i_stdarg; eval $setvar
13061                 val="$undef"; set i_varargs; eval $setvar
13062                 ;;
13063         varargs.h)
13064                 val="$undef"; set i_stdarg; eval $setvar
13065                 val="$define"; set i_varargs; eval $setvar
13066                 ;;
13067         esac
13068         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13069 esac
13070 $rm -f varargs*
13071
13072 : see if stddef is available
13073 set stddef.h i_stddef
13074 eval $inhdr
13075
13076 : see if sys/access.h is available
13077 set sys/access.h i_sysaccess
13078 eval $inhdr
13079
13080 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13081 set sys/filio.h i_sysfilio
13082 eval $inhdr
13083 echo " "
13084 if $test `./findhdr sys/ioctl.h`; then
13085         val="$define"
13086         echo '<sys/ioctl.h> found.' >&4
13087 else
13088         val="$undef"
13089         if $test $i_sysfilio = "$define"; then
13090             echo '<sys/ioctl.h> NOT found.' >&4
13091         else
13092                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13093                 $test $i_termio = "$define" && xxx="termio.h"
13094                 $test $i_termios = "$define" && xxx="termios.h"
13095 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13096         fi
13097 fi
13098 set i_sysioctl
13099 eval $setvar
13100
13101 : see if sys/resource.h has to be included
13102 set sys/resource.h i_sysresrc
13103 eval $inhdr
13104
13105 : see if sys/security.h is available
13106 set sys/security.h i_syssecrt
13107 eval $inhdr
13108
13109 : see if this is a sys/statvfs.h system
13110 set sys/statvfs.h i_sysstatvfs
13111 eval $inhdr
13112
13113 : see if this is a sys/un.h system
13114 set sys/un.h i_sysun
13115 eval $inhdr
13116
13117 : see if this is a syswait system
13118 set sys/wait.h i_syswait
13119 eval $inhdr
13120
13121 : see if this is an utime system
13122 set utime.h i_utime
13123 eval $inhdr
13124
13125 : see if this is a values.h system
13126 set values.h i_values
13127 eval $inhdr
13128
13129 : see if this is a vfork system
13130 case "$d_vfork" in
13131 "$define")
13132         set vfork.h i_vfork
13133         eval $inhdr
13134         ;;
13135 *)
13136         i_vfork="$undef"
13137         ;;
13138 esac
13139
13140 : see if gdbm.h is available
13141 set gdbm.h t_gdbm
13142 eval $inhdr
13143 case "$t_gdbm" in
13144 $define)
13145         : see if gdbm_open exists
13146         set gdbm_open d_gdbm_open
13147         eval $inlibc
13148         case "$d_gdbm_open" in
13149         $undef)
13150                 t_gdbm="$undef"
13151                 echo "We won't be including <gdbm.h>"
13152                 ;;
13153         esac
13154         ;;
13155 esac
13156 val="$t_gdbm"
13157 set i_gdbm
13158 eval $setvar
13159
13160 echo " "
13161 echo "Looking for extensions..." >&4
13162 : If we are using the old config.sh, known_extensions may contain
13163 : old or inaccurate or duplicate values.
13164 known_extensions=''
13165 nonxs_extensions=''
13166 : We do not use find because it might not be available.
13167 : We do not just use MANIFEST because the user may have dropped
13168 : some additional extensions into the source tree and expect them
13169 : to be built.
13170
13171 : Function to recursively find available extensions, ignoring DynaLoader
13172 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13173 find_extensions='
13174     for xxx in *; do
13175        case "$xxx" in
13176            DynaLoader|dynaload) ;;
13177            *)
13178            if $test -f $xxx/$xxx.xs; then
13179                known_extensions="$known_extensions $1$xxx";
13180            elif $test -f $xxx/Makefile.PL; then
13181                nonxs_extensions="$nonxs_extensions $1$xxx";
13182            else
13183                if $test -d $xxx -a $# -lt 10; then
13184                    set $1$xxx/ $*;
13185                    cd $xxx;
13186                    eval $find_extensions;
13187                    cd ..;
13188                    shift;
13189                fi;
13190            fi
13191            ;;
13192        esac;
13193     done'
13194 tdir=`pwd`
13195 cd $rsrc/ext
13196 set X
13197 shift
13198 eval $find_extensions
13199 set X $nonxs_extensions
13200 shift
13201 nonxs_extensions="$*"
13202 set X $known_extensions
13203 shift
13204 known_extensions="$*"
13205 cd $tdir
13206
13207 : Now see which are supported on this system.
13208 avail_ext=''
13209 for xxx in $known_extensions ; do
13210         case "$xxx" in
13211         DB_File|db_file)
13212                 case "$i_db" in
13213                 $define) avail_ext="$avail_ext $xxx" ;;
13214                 esac
13215                 ;;
13216         GDBM_File|gdbm_fil)
13217                 case "$i_gdbm" in 
13218                 $define) avail_ext="$avail_ext $xxx" ;;
13219                 esac
13220                 ;;
13221         NDBM_File|ndbm_fil)
13222                 case "$i_ndbm" in
13223                 $define) avail_ext="$avail_ext $xxx" ;;
13224                 esac
13225                 ;;
13226         ODBM_File|odbm_fil) 
13227                 case "${i_dbm}${i_rpcsvcdbm}" in
13228                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13229                 esac
13230                 ;;
13231         POSIX|posix)
13232                 case "$useposix" in
13233                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13234                 esac
13235                 ;;
13236         Opcode|opcode)
13237                 case "$useopcode" in
13238                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13239                 esac
13240                 ;;
13241         Socket|socket)
13242                 case "$d_socket" in 
13243                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13244                 esac
13245                 ;;
13246         Thread|thread)
13247                 case "$usethreads" in 
13248                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13249                 esac
13250                 ;;
13251         IPC/SysV|ipc/sysv)
13252                 : XXX Do we need a useipcsysv variable here
13253                 case "${d_msg}${d_sem}${d_shm}" in 
13254                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13255                 esac
13256                 ;;
13257         *)      avail_ext="$avail_ext $xxx"
13258                 ;;
13259         esac
13260 done
13261
13262 set X $avail_ext
13263 shift
13264 avail_ext="$*"
13265
13266 : Now see which nonxs extensions are supported on this system.
13267 : For now assume all are.
13268 nonxs_ext=''
13269 for xxx in $nonxs_extensions ; do
13270         case "$xxx" in
13271         *)      nonxs_ext="$nonxs_ext $xxx"
13272                 ;;
13273         esac
13274 done
13275
13276 set X $nonxs_ext
13277 shift
13278 nonxs_ext="$*"
13279
13280 case $usedl in
13281 $define)
13282         $cat <<EOM
13283 A number of extensions are supplied with $package.  You may choose to
13284 compile these extensions for dynamic loading (the default), compile
13285 them into the $package executable (static loading), or not include
13286 them at all.  Answer "none" to include no extensions.
13287 Note that DynaLoader is always built and need not be mentioned here.
13288
13289 EOM
13290         case "$dynamic_ext" in
13291         '') dflt="$avail_ext" ;;
13292         *)      dflt="$dynamic_ext"
13293                 # Perhaps we are reusing an old out-of-date config.sh.
13294                 case "$hint" in
13295                 previous)
13296                         if test X"$dynamic_ext" != X"$avail_ext"; then
13297                                 $cat <<EOM
13298 NOTICE:  Your previous config.sh list may be incorrect. 
13299 The extensions now available to you are 
13300         ${avail_ext}
13301 but the default list from your previous config.sh is
13302         ${dynamic_ext} 
13303
13304 EOM
13305                         fi
13306                         ;;
13307                 esac
13308                 ;;
13309         esac
13310         case "$dflt" in
13311         '')     dflt=none;;
13312         esac
13313         rp="What extensions do you wish to load dynamically?"
13314         . ./myread
13315         case "$ans" in
13316         none) dynamic_ext=' ' ;;
13317         *) dynamic_ext="$ans" ;;
13318         esac
13319
13320         case "$static_ext" in
13321         '')
13322                 : Exclude those already listed in dynamic linking
13323                 dflt=''
13324                 for xxx in $avail_ext; do
13325                         case " $dynamic_ext " in
13326                         *" $xxx "*) ;;
13327                         *) dflt="$dflt $xxx" ;;
13328                         esac
13329                 done
13330                 set X $dflt
13331                 shift
13332                 dflt="$*"
13333                 ;;
13334         *)  dflt="$static_ext" 
13335                 ;;
13336         esac
13337
13338         case "$dflt" in
13339         '')     dflt=none;;
13340         esac
13341         rp="What extensions do you wish to load statically?"
13342         . ./myread
13343         case "$ans" in
13344         none) static_ext=' ' ;;
13345         *) static_ext="$ans" ;;
13346         esac
13347         ;;
13348 *)
13349         $cat <<EOM
13350 A number of extensions are supplied with $package.  Answer "none" 
13351 to include no extensions. 
13352 Note that DynaLoader is always built and need not be mentioned here.
13353
13354 EOM
13355         case "$static_ext" in
13356         '') dflt="$avail_ext" ;;
13357         *)      dflt="$static_ext"
13358                 # Perhaps we are reusing an old out-of-date config.sh.
13359                 case "$hint" in
13360                 previous)
13361                         if test X"$static_ext" != X"$avail_ext"; then
13362                                 $cat <<EOM
13363 NOTICE:  Your previous config.sh list may be incorrect. 
13364 The extensions now available to you are 
13365         ${avail_ext}
13366 but the default list from your previous config.sh is
13367         ${static_ext} 
13368
13369 EOM
13370                         fi
13371                         ;;
13372                 esac
13373                 ;;
13374         esac
13375         : Exclude those that are not xs extensions
13376         case "$dflt" in
13377         '')     dflt=none;;
13378         esac
13379         rp="What extensions do you wish to include?"
13380         . ./myread
13381         case "$ans" in
13382         none) static_ext=' ' ;;
13383         *) static_ext="$ans" ;;
13384         esac
13385         ;;
13386 esac
13387
13388 set X $dynamic_ext $static_ext $nonxs_ext
13389 shift
13390 extensions="$*"
13391
13392 : Remove build directory name from cppstdin so it can be used from
13393 : either the present location or the final installed location.
13394 echo " "
13395 : Get out of the UU directory to get correct path name.
13396 cd ..
13397 case "$cppstdin" in
13398 `pwd`/cppstdin)
13399         echo "Stripping down cppstdin path name"
13400         cppstdin=cppstdin
13401         ;;
13402 esac
13403 cd UU
13404
13405 : end of configuration questions
13406 echo " "
13407 echo "End of configuration questions."
13408 echo " "
13409
13410 : back to where it started
13411 if test -d ../UU; then
13412         cd ..
13413 fi
13414
13415 : configuration may be patched via a 'config.over' file
13416 if $test -f config.over; then
13417         echo " "
13418         dflt=y
13419         rp='I see a config.over file.  Do you wish to load it?'
13420         . UU/myread
13421         case "$ans" in
13422         n*) echo "OK, I'll ignore it.";;
13423         *)      . ./config.over
13424                 echo "Configuration override changes have been loaded."
13425                 ;;
13426         esac
13427 fi
13428
13429 : in case they want portability, strip down executable paths
13430 case "$d_portable" in
13431 "$define")
13432         echo " "
13433         echo "Stripping down executable paths..." >&4
13434         for file in $loclist $trylist; do
13435                 eval temp=\$$file
13436                 eval $file=`basename $temp`
13437         done
13438         ;;
13439 esac
13440
13441 : create config.sh file
13442 echo " "
13443 echo "Creating config.sh..." >&4
13444 $spitshell <<EOT >config.sh
13445 $startsh
13446 #
13447 # This file was produced by running the Configure script. It holds all the
13448 # definitions figured out by Configure. Should you modify one of these values,
13449 # do not forget to propagate your changes by running "Configure -der". You may
13450 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13451 #
13452
13453 # Package name      : $package
13454 # Source directory  : $src
13455 # Configuration time: $cf_time
13456 # Configured by     : $cf_by
13457 # Target system     : $myuname
13458
13459 Author='$Author'
13460 Date='$Date'
13461 Header='$Header'
13462 Id='$Id'
13463 Locker='$Locker'
13464 Log='$Log'
13465 Mcc='$Mcc'
13466 RCSfile='$RCSfile'
13467 Revision='$Revision'
13468 Source='$Source'
13469 State='$State'
13470 _a='$_a'
13471 _exe='$_exe'
13472 _o='$_o'
13473 afs='$afs'
13474 alignbytes='$alignbytes'
13475 ansi2knr='$ansi2knr'
13476 aphostname='$aphostname'
13477 apiversion='$apiversion'
13478 ar='$ar'
13479 archlib='$archlib'
13480 archlibexp='$archlibexp'
13481 archname64='$archname64'
13482 archname='$archname'
13483 archobjs='$archobjs'
13484 awk='$awk'
13485 baserev='$baserev'
13486 bash='$bash'
13487 bin='$bin'
13488 bincompat5005='$bincompat5005'
13489 binexp='$binexp'
13490 bison='$bison'
13491 byacc='$byacc'
13492 byteorder='$byteorder'
13493 c='$c'
13494 castflags='$castflags'
13495 cat='$cat'
13496 cc='$cc'
13497 cccdlflags='$cccdlflags'
13498 ccdlflags='$ccdlflags'
13499 ccflags='$ccflags'
13500 ccsymbols='$ccsymbols'
13501 cf_by='$cf_by'
13502 cf_email='$cf_email'
13503 cf_time='$cf_time'
13504 chgrp='$chgrp'
13505 chmod='$chmod'
13506 chown='$chown'
13507 clocktype='$clocktype'
13508 comm='$comm'
13509 compress='$compress'
13510 contains='$contains'
13511 cp='$cp'
13512 cpio='$cpio'
13513 cpp='$cpp'
13514 cpp_stuff='$cpp_stuff'
13515 cppccsymbols='$cppccsymbols'
13516 cppflags='$cppflags'
13517 cpplast='$cpplast'
13518 cppminus='$cppminus'
13519 cpprun='$cpprun'
13520 cppstdin='$cppstdin'
13521 cppsymbols='$cppsymbols'
13522 crosscompile='$crosscompile'
13523 cryptlib='$cryptlib'
13524 csh='$csh'
13525 d_Gconvert='$d_Gconvert'
13526 d_PRIEldbl='$d_PRIEldbl'
13527 d_PRIFldbl='$d_PRIFldbl'
13528 d_PRIGldbl='$d_PRIGldbl'
13529 d_PRIX64='$d_PRIX64'
13530 d_PRId64='$d_PRId64'
13531 d_PRIeldbl='$d_PRIeldbl'
13532 d_PRIfldbl='$d_PRIfldbl'
13533 d_PRIgldbl='$d_PRIgldbl'
13534 d_PRIi64='$d_PRIi64'
13535 d_PRIo64='$d_PRIo64'
13536 d_PRIu64='$d_PRIu64'
13537 d_PRIx64='$d_PRIx64'
13538 d_access='$d_access'
13539 d_accessx='$d_accessx'
13540 d_alarm='$d_alarm'
13541 d_archlib='$d_archlib'
13542 d_atolf='$d_atolf'
13543 d_atoll='$d_atoll'
13544 d_attribut='$d_attribut'
13545 d_bcmp='$d_bcmp'
13546 d_bcopy='$d_bcopy'
13547 d_bincompat5005='$d_bincompat5005'
13548 d_bsd='$d_bsd'
13549 d_bsdgetpgrp='$d_bsdgetpgrp'
13550 d_bsdsetpgrp='$d_bsdsetpgrp'
13551 d_bzero='$d_bzero'
13552 d_casti32='$d_casti32'
13553 d_castneg='$d_castneg'
13554 d_charvspr='$d_charvspr'
13555 d_chown='$d_chown'
13556 d_chroot='$d_chroot'
13557 d_chsize='$d_chsize'
13558 d_closedir='$d_closedir'
13559 d_cmsghdr_s='$d_cmsghdr_s'
13560 d_const='$d_const'
13561 d_crypt='$d_crypt'
13562 d_csh='$d_csh'
13563 d_cuserid='$d_cuserid'
13564 d_dbl_dig='$d_dbl_dig'
13565 d_difftime='$d_difftime'
13566 d_dirnamlen='$d_dirnamlen'
13567 d_dlerror='$d_dlerror'
13568 d_dlopen='$d_dlopen'
13569 d_dlsymun='$d_dlsymun'
13570 d_dosuid='$d_dosuid'
13571 d_drand48proto='$d_drand48proto'
13572 d_dup2='$d_dup2'
13573 d_eaccess='$d_eaccess'
13574 d_endgrent='$d_endgrent'
13575 d_endhent='$d_endhent'
13576 d_endnent='$d_endnent'
13577 d_endpent='$d_endpent'
13578 d_endpwent='$d_endpwent'
13579 d_endsent='$d_endsent'
13580 d_endspent='$d_endspent'
13581 d_eofnblk='$d_eofnblk'
13582 d_eunice='$d_eunice'
13583 d_fchmod='$d_fchmod'
13584 d_fchown='$d_fchown'
13585 d_fcntl='$d_fcntl'
13586 d_fd_macros='$d_fd_macros'
13587 d_fd_set='$d_fd_set'
13588 d_fds_bits='$d_fds_bits'
13589 d_fgetpos='$d_fgetpos'
13590 d_flexfnam='$d_flexfnam'
13591 d_flock='$d_flock'
13592 d_fork='$d_fork'
13593 d_fpathconf='$d_fpathconf'
13594 d_fpos64_t='$d_fpos64_t'
13595 d_fseeko='$d_fseeko'
13596 d_fsetpos='$d_fsetpos'
13597 d_fstatfs='$d_fstatfs'
13598 d_fstatvfs='$d_fstatvfs'
13599 d_ftello='$d_ftello'
13600 d_ftime='$d_ftime'
13601 d_getgrent='$d_getgrent'
13602 d_getgrps='$d_getgrps'
13603 d_gethbyaddr='$d_gethbyaddr'
13604 d_gethbyname='$d_gethbyname'
13605 d_gethent='$d_gethent'
13606 d_gethname='$d_gethname'
13607 d_gethostprotos='$d_gethostprotos'
13608 d_getlogin='$d_getlogin'
13609 d_getmnt='$d_getmnt'
13610 d_getmntent='$d_getmntent'
13611 d_getnbyaddr='$d_getnbyaddr'
13612 d_getnbyname='$d_getnbyname'
13613 d_getnent='$d_getnent'
13614 d_getnetprotos='$d_getnetprotos'
13615 d_getpbyname='$d_getpbyname'
13616 d_getpbynumber='$d_getpbynumber'
13617 d_getpent='$d_getpent'
13618 d_getpgid='$d_getpgid'
13619 d_getpgrp2='$d_getpgrp2'
13620 d_getpgrp='$d_getpgrp'
13621 d_getppid='$d_getppid'
13622 d_getprior='$d_getprior'
13623 d_getprotoprotos='$d_getprotoprotos'
13624 d_getpwent='$d_getpwent'
13625 d_getsbyname='$d_getsbyname'
13626 d_getsbyport='$d_getsbyport'
13627 d_getsent='$d_getsent'
13628 d_getservprotos='$d_getservprotos'
13629 d_getspent='$d_getspent'
13630 d_getspnam='$d_getspnam'
13631 d_gettimeod='$d_gettimeod'
13632 d_gnulibc='$d_gnulibc'
13633 d_grpasswd='$d_grpasswd'
13634 d_hasmntopt='$d_hasmntopt'
13635 d_htonl='$d_htonl'
13636 d_index='$d_index'
13637 d_inetaton='$d_inetaton'
13638 d_int64t='$d_int64t'
13639 d_iovec_s='$d_iovec_s'
13640 d_isascii='$d_isascii'
13641 d_killpg='$d_killpg'
13642 d_lchown='$d_lchown'
13643 d_ldbl_dig='$d_ldbl_dig'
13644 d_link='$d_link'
13645 d_llseek='$d_llseek'
13646 d_locconv='$d_locconv'
13647 d_lockf='$d_lockf'
13648 d_longdbl='$d_longdbl'
13649 d_longlong='$d_longlong'
13650 d_lstat='$d_lstat'
13651 d_madvise='$d_madvise'
13652 d_mblen='$d_mblen'
13653 d_mbstowcs='$d_mbstowcs'
13654 d_mbtowc='$d_mbtowc'
13655 d_memchr='$d_memchr'
13656 d_memcmp='$d_memcmp'
13657 d_memcpy='$d_memcpy'
13658 d_memmove='$d_memmove'
13659 d_memset='$d_memset'
13660 d_mkdir='$d_mkdir'
13661 d_mkfifo='$d_mkfifo'
13662 d_mktime='$d_mktime'
13663 d_mmap='$d_mmap'
13664 d_mprotect='$d_mprotect'
13665 d_msg='$d_msg'
13666 d_msg_ctrunc='$d_msg_ctrunc'
13667 d_msg_dontroute='$d_msg_dontroute'
13668 d_msg_oob='$d_msg_oob'
13669 d_msg_peek='$d_msg_peek'
13670 d_msg_proxy='$d_msg_proxy'
13671 d_msgctl='$d_msgctl'
13672 d_msgget='$d_msgget'
13673 d_msghdr_s='$d_msghdr_s'
13674 d_msgrcv='$d_msgrcv'
13675 d_msgsnd='$d_msgsnd'
13676 d_msync='$d_msync'
13677 d_munmap='$d_munmap'
13678 d_mymalloc='$d_mymalloc'
13679 d_nice='$d_nice'
13680 d_off64_t='$d_off64_t'
13681 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13682 d_oldpthreads='$d_oldpthreads'
13683 d_oldsock='$d_oldsock'
13684 d_open3='$d_open3'
13685 d_pathconf='$d_pathconf'
13686 d_pause='$d_pause'
13687 d_phostname='$d_phostname'
13688 d_pipe='$d_pipe'
13689 d_poll='$d_poll'
13690 d_portable='$d_portable'
13691 d_pthread_yield='$d_pthread_yield'
13692 d_pwage='$d_pwage'
13693 d_pwchange='$d_pwchange'
13694 d_pwclass='$d_pwclass'
13695 d_pwcomment='$d_pwcomment'
13696 d_pwexpire='$d_pwexpire'
13697 d_pwgecos='$d_pwgecos'
13698 d_pwpasswd='$d_pwpasswd'
13699 d_pwquota='$d_pwquota'
13700 d_readdir='$d_readdir'
13701 d_readlink='$d_readlink'
13702 d_readv='$d_readv'
13703 d_recvmsg='$d_recvmsg'
13704 d_rename='$d_rename'
13705 d_rewinddir='$d_rewinddir'
13706 d_rmdir='$d_rmdir'
13707 d_safebcpy='$d_safebcpy'
13708 d_safemcpy='$d_safemcpy'
13709 d_sanemcmp='$d_sanemcmp'
13710 d_sched_yield='$d_sched_yield'
13711 d_scm_rights='$d_scm_rights'
13712 d_seekdir='$d_seekdir'
13713 d_select='$d_select'
13714 d_sem='$d_sem'
13715 d_semctl='$d_semctl'
13716 d_semctl_semid_ds='$d_semctl_semid_ds'
13717 d_semctl_semun='$d_semctl_semun'
13718 d_semget='$d_semget'
13719 d_semop='$d_semop'
13720 d_sendmsg='$d_sendmsg'
13721 d_setegid='$d_setegid'
13722 d_seteuid='$d_seteuid'
13723 d_setgrent='$d_setgrent'
13724 d_setgrps='$d_setgrps'
13725 d_sethent='$d_sethent'
13726 d_setlinebuf='$d_setlinebuf'
13727 d_setlocale='$d_setlocale'
13728 d_setnent='$d_setnent'
13729 d_setpent='$d_setpent'
13730 d_setpgid='$d_setpgid'
13731 d_setpgrp2='$d_setpgrp2'
13732 d_setpgrp='$d_setpgrp'
13733 d_setprior='$d_setprior'
13734 d_setpwent='$d_setpwent'
13735 d_setregid='$d_setregid'
13736 d_setresgid='$d_setresgid'
13737 d_setresuid='$d_setresuid'
13738 d_setreuid='$d_setreuid'
13739 d_setrgid='$d_setrgid'
13740 d_setruid='$d_setruid'
13741 d_setsent='$d_setsent'
13742 d_setsid='$d_setsid'
13743 d_setspent='$d_setspent'
13744 d_setvbuf='$d_setvbuf'
13745 d_sfio='$d_sfio'
13746 d_shm='$d_shm'
13747 d_shmat='$d_shmat'
13748 d_shmatprototype='$d_shmatprototype'
13749 d_shmctl='$d_shmctl'
13750 d_shmdt='$d_shmdt'
13751 d_shmget='$d_shmget'
13752 d_sigaction='$d_sigaction'
13753 d_sigsetjmp='$d_sigsetjmp'
13754 d_socket='$d_socket'
13755 d_sockpair='$d_sockpair'
13756 d_sqrtl='$d_sqrtl'
13757 d_statblks='$d_statblks'
13758 d_statfs='$d_statfs'
13759 d_statfsflags='$d_statfsflags'
13760 d_statvfs='$d_statvfs'
13761 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13762 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13763 d_stdio_stream_array='$d_stdio_stream_array'
13764 d_stdiobase='$d_stdiobase'
13765 d_stdstdio='$d_stdstdio'
13766 d_strchr='$d_strchr'
13767 d_strcoll='$d_strcoll'
13768 d_strctcpy='$d_strctcpy'
13769 d_strerrm='$d_strerrm'
13770 d_strerror='$d_strerror'
13771 d_strtod='$d_strtod'
13772 d_strtol='$d_strtol'
13773 d_strtoul='$d_strtoul'
13774 d_strtoull='$d_strtoull'
13775 d_strxfrm='$d_strxfrm'
13776 d_suidsafe='$d_suidsafe'
13777 d_symlink='$d_symlink'
13778 d_syscall='$d_syscall'
13779 d_sysconf='$d_sysconf'
13780 d_sysernlst='$d_sysernlst'
13781 d_syserrlst='$d_syserrlst'
13782 d_system='$d_system'
13783 d_tcgetpgrp='$d_tcgetpgrp'
13784 d_tcsetpgrp='$d_tcsetpgrp'
13785 d_telldir='$d_telldir'
13786 d_telldirproto='$d_telldirproto'
13787 d_time='$d_time'
13788 d_times='$d_times'
13789 d_truncate='$d_truncate'
13790 d_tzname='$d_tzname'
13791 d_umask='$d_umask'
13792 d_uname='$d_uname'
13793 d_union_semun='$d_union_semun'
13794 d_vendorbin='$d_vendorbin'
13795 d_vendorlib='$d_vendorlib'
13796 d_vfork='$d_vfork'
13797 d_void_closedir='$d_void_closedir'
13798 d_voidsig='$d_voidsig'
13799 d_voidtty='$d_voidtty'
13800 d_volatile='$d_volatile'
13801 d_vprintf='$d_vprintf'
13802 d_wait4='$d_wait4'
13803 d_waitpid='$d_waitpid'
13804 d_wcstombs='$d_wcstombs'
13805 d_wctomb='$d_wctomb'
13806 d_writev='$d_writev'
13807 d_xenix='$d_xenix'
13808 date='$date'
13809 db_hashtype='$db_hashtype'
13810 db_prefixtype='$db_prefixtype'
13811 defvoidused='$defvoidused'
13812 direntrytype='$direntrytype'
13813 dlext='$dlext'
13814 dlsrc='$dlsrc'
13815 doublesize='$doublesize'
13816 drand01='$drand01'
13817 dynamic_ext='$dynamic_ext'
13818 eagain='$eagain'
13819 ebcdic='$ebcdic'
13820 echo='$echo'
13821 egrep='$egrep'
13822 emacs='$emacs'
13823 eunicefix='$eunicefix'
13824 exe_ext='$exe_ext'
13825 expr='$expr'
13826 extensions='$extensions'
13827 fflushNULL='$fflushNULL'
13828 fflushall='$fflushall'
13829 find='$find'
13830 firstmakefile='$firstmakefile'
13831 flex='$flex'
13832 fpostype='$fpostype'
13833 freetype='$freetype'
13834 full_ar='$full_ar'
13835 full_csh='$full_csh'
13836 full_sed='$full_sed'
13837 gccversion='$gccversion'
13838 gidtype='$gidtype'
13839 glibpth='$glibpth'
13840 grep='$grep'
13841 groupcat='$groupcat'
13842 groupstype='$groupstype'
13843 gzip='$gzip'
13844 h_fcntl='$h_fcntl'
13845 h_sysfile='$h_sysfile'
13846 hint='$hint'
13847 hostcat='$hostcat'
13848 huge='$huge'
13849 i_arpainet='$i_arpainet'
13850 i_bsdioctl='$i_bsdioctl'
13851 i_db='$i_db'
13852 i_dbm='$i_dbm'
13853 i_dirent='$i_dirent'
13854 i_dld='$i_dld'
13855 i_dlfcn='$i_dlfcn'
13856 i_fcntl='$i_fcntl'
13857 i_float='$i_float'
13858 i_gdbm='$i_gdbm'
13859 i_grp='$i_grp'
13860 i_inttypes='$i_inttypes'
13861 i_limits='$i_limits'
13862 i_locale='$i_locale'
13863 i_machcthr='$i_machcthr'
13864 i_malloc='$i_malloc'
13865 i_math='$i_math'
13866 i_memory='$i_memory'
13867 i_mntent='$i_mntent'
13868 i_ndbm='$i_ndbm'
13869 i_netdb='$i_netdb'
13870 i_neterrno='$i_neterrno'
13871 i_netinettcp='$i_netinettcp'
13872 i_niin='$i_niin'
13873 i_poll='$i_poll'
13874 i_pthread='$i_pthread'
13875 i_pwd='$i_pwd'
13876 i_rpcsvcdbm='$i_rpcsvcdbm'
13877 i_sfio='$i_sfio'
13878 i_sgtty='$i_sgtty'
13879 i_shadow='$i_shadow'
13880 i_socks='$i_socks'
13881 i_stdarg='$i_stdarg'
13882 i_stddef='$i_stddef'
13883 i_stdlib='$i_stdlib'
13884 i_string='$i_string'
13885 i_sysaccess='$i_sysaccess'
13886 i_sysdir='$i_sysdir'
13887 i_sysfile='$i_sysfile'
13888 i_sysfilio='$i_sysfilio'
13889 i_sysin='$i_sysin'
13890 i_sysioctl='$i_sysioctl'
13891 i_sysmman='$i_sysmman'
13892 i_sysmount='$i_sysmount'
13893 i_sysndir='$i_sysndir'
13894 i_sysparam='$i_sysparam'
13895 i_sysresrc='$i_sysresrc'
13896 i_syssecrt='$i_syssecrt'
13897 i_sysselct='$i_sysselct'
13898 i_syssockio='$i_syssockio'
13899 i_sysstat='$i_sysstat'
13900 i_sysstatvfs='$i_sysstatvfs'
13901 i_systime='$i_systime'
13902 i_systimek='$i_systimek'
13903 i_systimes='$i_systimes'
13904 i_systypes='$i_systypes'
13905 i_sysuio='$i_sysuio'
13906 i_sysun='$i_sysun'
13907 i_syswait='$i_syswait'
13908 i_termio='$i_termio'
13909 i_termios='$i_termios'
13910 i_time='$i_time'
13911 i_unistd='$i_unistd'
13912 i_utime='$i_utime'
13913 i_values='$i_values'
13914 i_varargs='$i_varargs'
13915 i_varhdr='$i_varhdr'
13916 i_vfork='$i_vfork'
13917 ignore_versioned_solibs='$ignore_versioned_solibs'
13918 incpath='$incpath'
13919 inews='$inews'
13920 installarchlib='$installarchlib'
13921 installbin='$installbin'
13922 installman1dir='$installman1dir'
13923 installman3dir='$installman3dir'
13924 installprefix='$installprefix'
13925 installprefixexp='$installprefixexp'
13926 installprivlib='$installprivlib'
13927 installscript='$installscript'
13928 installsitearch='$installsitearch'
13929 installsitebin='$installsitebin'
13930 installsitelib='$installsitelib'
13931 installstyle='$installstyle'
13932 installusrbinperl='$installusrbinperl'
13933 installvendorbin='$installvendorbin'
13934 installvendorlib='$installvendorlib'
13935 intsize='$intsize'
13936 known_extensions='$known_extensions'
13937 ksh='$ksh'
13938 large='$large'
13939 ld='$ld'
13940 lddlflags='$lddlflags'
13941 ldflags='$ldflags'
13942 ldlibpthname='$ldlibpthname'
13943 less='$less'
13944 lib_ext='$lib_ext'
13945 libc='$libc'
13946 libperl='$libperl'
13947 libpth='$libpth'
13948 libs='$libs'
13949 libswanted='$libswanted'
13950 line='$line'
13951 lint='$lint'
13952 lkflags='$lkflags'
13953 ln='$ln'
13954 lns='$lns'
13955 locincpth='$locincpth'
13956 loclibpth='$loclibpth'
13957 longdblsize='$longdblsize'
13958 longlongsize='$longlongsize'
13959 longsize='$longsize'
13960 lp='$lp'
13961 lpr='$lpr'
13962 ls='$ls'
13963 lseeksize='$lseeksize'
13964 lseektype='$lseektype'
13965 mail='$mail'
13966 mailx='$mailx'
13967 make='$make'
13968 make_set_make='$make_set_make'
13969 mallocobj='$mallocobj'
13970 mallocsrc='$mallocsrc'
13971 malloctype='$malloctype'
13972 man1dir='$man1dir'
13973 man1direxp='$man1direxp'
13974 man1ext='$man1ext'
13975 man3dir='$man3dir'
13976 man3direxp='$man3direxp'
13977 man3ext='$man3ext'
13978 medium='$medium'
13979 mips='$mips'
13980 mips_type='$mips_type'
13981 mkdir='$mkdir'
13982 mmaptype='$mmaptype'
13983 models='$models'
13984 modetype='$modetype'
13985 more='$more'
13986 multiarch='$multiarch'
13987 mv='$mv'
13988 myarchname='$myarchname'
13989 mydomain='$mydomain'
13990 myhostname='$myhostname'
13991 myuname='$myuname'
13992 n='$n'
13993 netdb_hlen_type='$netdb_hlen_type'
13994 netdb_host_type='$netdb_host_type'
13995 netdb_name_type='$netdb_name_type'
13996 netdb_net_type='$netdb_net_type'
13997 nm='$nm'
13998 nm_opt='$nm_opt'
13999 nm_so_opt='$nm_so_opt'
14000 nonxs_ext='$nonxs_ext'
14001 nroff='$nroff'
14002 o_nonblock='$o_nonblock'
14003 obj_ext='$obj_ext'
14004 old_pthread_create_joinable='$old_pthread_create_joinable'
14005 optimize='$optimize'
14006 orderlib='$orderlib'
14007 osname='$osname'
14008 osvers='$osvers'
14009 package='$package'
14010 pager='$pager'
14011 passcat='$passcat'
14012 patchlevel='$patchlevel'
14013 path_sep='$path_sep'
14014 perl='$perl'
14015 perladmin='$perladmin'
14016 perlpath='$perlpath'
14017 pg='$pg'
14018 phostname='$phostname'
14019 pidtype='$pidtype'
14020 plibpth='$plibpth'
14021 pm_apiversion='$pm_apiversion'
14022 pmake='$pmake'
14023 pr='$pr'
14024 prefix='$prefix'
14025 prefixexp='$prefixexp'
14026 privlib='$privlib'
14027 privlibexp='$privlibexp'
14028 prototype='$prototype'
14029 ptrsize='$ptrsize'
14030 randbits='$randbits'
14031 randfunc='$randfunc'
14032 randseedtype='$randseedtype'
14033 ranlib='$ranlib'
14034 rd_nodata='$rd_nodata'
14035 rm='$rm'
14036 rmail='$rmail'
14037 runnm='$runnm'
14038 sPRIEldbl='$sPRIEldbl'
14039 sPRIFldbl='$sPRIFldbl'
14040 sPRIGldbl='$sPRIGldbl'
14041 sPRIX64='$sPRIX64'
14042 sPRId64='$sPRId64'
14043 sPRIeldbl='$sPRIeldbl'
14044 sPRIfldbl='$sPRIfldbl'
14045 sPRIgldbl='$sPRIgldbl'
14046 sPRIi64='$sPRIi64'
14047 sPRIo64='$sPRIo64'
14048 sPRIu64='$sPRIu64'
14049 sPRIx64='$sPRIx64'
14050 sched_yield='$sched_yield'
14051 scriptdir='$scriptdir'
14052 scriptdirexp='$scriptdirexp'
14053 sed='$sed'
14054 seedfunc='$seedfunc'
14055 selectminbits='$selectminbits'
14056 selecttype='$selecttype'
14057 sendmail='$sendmail'
14058 sh='$sh'
14059 shar='$shar'
14060 sharpbang='$sharpbang'
14061 shmattype='$shmattype'
14062 shortsize='$shortsize'
14063 shrpenv='$shrpenv'
14064 shsharp='$shsharp'
14065 sig_count='$sig_count'
14066 sig_name='$sig_name'
14067 sig_name_init='$sig_name_init'
14068 sig_num='$sig_num'
14069 sig_num_init='$sig_num_init'
14070 signal_t='$signal_t'
14071 sitearch='$sitearch'
14072 sitearchexp='$sitearchexp'
14073 sitebin='$sitebin'
14074 sitebinexp='$sitebinexp'
14075 sitelib='$sitelib'
14076 sitelibexp='$sitelibexp'
14077 siteprefix='$siteprefix'
14078 siteprefixexp='$siteprefixexp'
14079 sizetype='$sizetype'
14080 sleep='$sleep'
14081 smail='$smail'
14082 small='$small'
14083 so='$so'
14084 sockethdr='$sockethdr'
14085 socketlib='$socketlib'
14086 sort='$sort'
14087 spackage='$spackage'
14088 spitshell='$spitshell'
14089 split='$split'
14090 src='$src'
14091 ssizetype='$ssizetype'
14092 startperl='$startperl'
14093 startsh='$startsh'
14094 static_ext='$static_ext'
14095 stdchar='$stdchar'
14096 stdio_base='$stdio_base'
14097 stdio_bufsiz='$stdio_bufsiz'
14098 stdio_cnt='$stdio_cnt'
14099 stdio_filbuf='$stdio_filbuf'
14100 stdio_ptr='$stdio_ptr'
14101 stdio_stream_array='$stdio_stream_array'
14102 strings='$strings'
14103 submit='$submit'
14104 subversion='$subversion'
14105 sysman='$sysman'
14106 tail='$tail'
14107 tar='$tar'
14108 tbl='$tbl'
14109 tee='$tee'
14110 test='$test'
14111 timeincl='$timeincl'
14112 timetype='$timetype'
14113 touch='$touch'
14114 tr='$tr'
14115 trnl='$trnl'
14116 troff='$troff'
14117 uidsign='$uidsign'
14118 uidtype='$uidtype'
14119 uname='$uname'
14120 uniq='$uniq'
14121 use64bits='$use64bits'
14122 usedl='$usedl'
14123 uselargefiles='$uselargefiles'
14124 uselongdouble='$uselongdouble'
14125 usemorebits='$usemorebits'
14126 usemultiplicity='$usemultiplicity'
14127 usemymalloc='$usemymalloc'
14128 usenm='$usenm'
14129 useopcode='$useopcode'
14130 useperlio='$useperlio'
14131 useposix='$useposix'
14132 usesfio='$usesfio'
14133 useshrplib='$useshrplib'
14134 usesocks='$usesocks'
14135 usethreads='$usethreads'
14136 usevendorprefix='$usevendorprefix'
14137 usevfork='$usevfork'
14138 usrinc='$usrinc'
14139 uuname='$uuname'
14140 vendorbin='$vendorbin'
14141 vendorbinexp='$vendorbinexp'
14142 vendorlib='$vendorlib'
14143 vendorlibexp='$vendorlibexp'
14144 vendorprefix='$vendorprefix'
14145 vendorprefixexp='$vendorprefixexp'
14146 version='$version'
14147 vi='$vi'
14148 voidflags='$voidflags'
14149 xlibpth='$xlibpth'
14150 xs_apiversion='$xs_apiversion'
14151 zcat='$zcat'
14152 zip='$zip'
14153 EOT
14154
14155 : Add in command line options if available
14156 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14157
14158 : add special variables
14159 $test -f $src/patchlevel.h && \
14160 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14161 echo "CONFIGDOTSH=true" >>config.sh
14162
14163 : propagate old symbols
14164 if $test -f UU/config.sh; then
14165         <UU/config.sh sort | uniq >UU/oldconfig.sh
14166         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14167         sort | uniq -u >UU/oldsyms
14168         set X `cat UU/oldsyms`
14169         shift
14170         case $# in
14171         0) ;;
14172         *)
14173                 cat <<EOM
14174 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14175 EOM
14176                 echo "# Variables propagated from previous config.sh file." >>config.sh
14177                 for sym in `cat UU/oldsyms`; do
14178                         echo "    Propagating $hint variable "'$'"$sym..."
14179                         eval 'tmp="$'"${sym}"'"'
14180                         echo "$tmp" | \
14181                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14182                 done
14183                 ;;
14184         esac
14185 fi
14186
14187 : Finish up by extracting the .SH files
14188 case "$alldone" in
14189 exit)
14190         $rm -rf UU
14191         echo "Done."
14192         exit 0
14193         ;;
14194 cont)
14195         ;;
14196 '')
14197         dflt=''
14198         nostick=true
14199         $cat <<EOM
14200
14201 If you'd like to make any changes to the config.sh file before I begin
14202 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14203
14204 EOM
14205         rp="Press return or use a shell escape to edit config.sh:"
14206         . UU/myread
14207         nostick=''
14208         case "$ans" in
14209         '') ;;
14210         *) : in case they cannot read
14211                 sh 1>&4 -c "$ans";;
14212         esac
14213         ;;
14214 esac
14215
14216 : if this fails, just run all the .SH files by hand
14217 . ./config.sh
14218
14219 echo " "
14220 exec 1>&4
14221 . ./UU/extract
14222
14223 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14224         dflt=y
14225         case "$silent" in
14226         true) ;;
14227         *)
14228                 $cat <<EOM
14229
14230 Now you need to generate make dependencies by running "$make depend".
14231 You might prefer to run it in background: "$make depend > makedepend.out &"
14232 It can take a while, so you might not want to run it right now.
14233
14234 EOM
14235                 ;;
14236         esac
14237         rp="Run $make depend now?"
14238         . UU/myread
14239         case "$ans" in
14240         y*)
14241                 $make depend && echo "Now you must run a $make."
14242                 ;;
14243         *)
14244                 echo "You must run '$make depend' then '$make'."
14245                 ;;
14246         esac
14247 elif test -f [Mm]akefile; then
14248         echo " "
14249         echo "Now you must run a $make."
14250 else
14251         echo "Done."
14252 fi
14253
14254 if $test -f Policy.sh; then
14255     $cat <<EOM
14256
14257 If you compile $package on a different machine or from a different object
14258 directory, copy the Policy.sh file from this object directory to the
14259 new one before you run Configure -- this will help you with most of
14260 the policy defaults.
14261
14262 EOM
14263 fi
14264 if $test -f config.msg; then
14265     echo "Hmm.  I also noted the following information while running:"
14266     echo " "
14267     $cat config.msg >&4
14268     $rm -f config.msg
14269 fi
14270 $rm -f kit*isdone ark*isdone
14271 $rm -rf UU
14272
14273 : End of Configure
14274