This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Undo the references to local{lib,arch} introduced by #3006.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Mon Feb 22 10:52:12 EET 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 case "$inksh/$needksh" in
112 /[a-z]*)
113                 ENV=''
114                 changesh=true
115                 reason="$needksh"
116         ;;
117 esac
118 case "$inksh/$avoidksh" in
119 true/[a-z]*)
120         changesh=true
121         reason="$avoidksh"
122         ;;
123 esac
124 case "$inksh/$needksh-$avoidksh-" in
125 true/--)
126                 cat <<EOM
127 (I see you are using the Korn shell.  Some ksh's blow up on $me,
128 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
129 EOM
130         ;;
131 esac
132 case "$changesh" in
133 true)
134         echo "(Feeding myself to $newsh $reason.)"
135         case "$0" in
136         Configure|*/Configure) exec $newsh $0 "$@";;
137         *) exec $newsh Configure "$@";;
138         esac
139         ;;
140 esac
141
142 : if needed set CDPATH to a harmless value that is not chatty
143 : avoid bash 2.02 problems with empty CDPATH.
144 case "$CDPATH" in
145 '')     ;;
146 *)      case "$SHELL" in
147         *bash*) CDPATH='.' ;;
148         *)              CDPATH='' ;;
149         esac
150         ;;
151 esac
152 : Configure runs within the UU subdirectory
153 test -d UU || mkdir UU
154 cd UU && rm -f ./*
155
156 ccsymbols=''
157 cppccsymbols=''
158 cppsymbols=''
159 dynamic_ext=''
160 extensions=''
161 known_extensions=''
162 nonxs_ext=''
163 static_ext=''
164 useopcode=''
165 useposix=''
166 d_bsd=''
167 d_eunice=''
168 d_xenix=''
169 eunicefix=''
170 Mcc=''
171 ar=''
172 awk=''
173 bash=''
174 bison=''
175 byacc=''
176 cat=''
177 chgrp=''
178 chmod=''
179 chown=''
180 comm=''
181 compress=''
182 cp=''
183 cpio=''
184 cpp=''
185 csh=''
186 date=''
187 echo=''
188 egrep=''
189 emacs=''
190 expr=''
191 find=''
192 flex=''
193 grep=''
194 gzip=''
195 inews=''
196 ksh=''
197 less=''
198 line=''
199 lint=''
200 ln=''
201 lp=''
202 lpr=''
203 ls=''
204 mail=''
205 mailx=''
206 make=''
207 mkdir=''
208 more=''
209 mv=''
210 nm=''
211 nroff=''
212 perl=''
213 pg=''
214 pmake=''
215 pr=''
216 rm=''
217 rmail=''
218 sed=''
219 sendmail=''
220 shar=''
221 sleep=''
222 smail=''
223 sort=''
224 submit=''
225 tail=''
226 tar=''
227 tbl=''
228 tee=''
229 test=''
230 touch=''
231 tr=''
232 troff=''
233 uname=''
234 uniq=''
235 uuname=''
236 vi=''
237 zcat=''
238 zip=''
239 full_ar=''
240 full_sed=''
241 libswanted=''
242 hint=''
243 myuname=''
244 osname=''
245 osvers=''
246 Author=''
247 Date=''
248 Header=''
249 Id=''
250 Locker=''
251 Log=''
252 RCSfile=''
253 Revision=''
254 Source=''
255 State=''
256 _a=''
257 _exe=''
258 _o=''
259 archobjs=''
260 exe_ext=''
261 firstmakefile=''
262 lib_ext=''
263 obj_ext=''
264 path_sep=''
265 afs=''
266 alignbytes=''
267 ansi2knr=''
268 archlib=''
269 archlibexp=''
270 d_archlib=''
271 installarchlib=''
272 archname=''
273 myarchname=''
274 baserev=''
275 bin=''
276 binexp=''
277 installbin=''
278 byteorder=''
279 cc=''
280 gccversion=''
281 ccflags=''
282 cppflags=''
283 ldflags=''
284 lkflags=''
285 locincpth=''
286 optimize=''
287 cf_email=''
288 cf_by=''
289 cf_time=''
290 contains=''
291 cpp_stuff=''
292 cpplast=''
293 cppminus=''
294 cpprun=''
295 cppstdin=''
296 crosscompile=''
297 d_access=''
298 d_accessx=''
299 d_alarm=''
300 d_attribut=''
301 d_bcmp=''
302 d_bcopy=''
303 d_bzero=''
304 d_casti32=''
305 castflags=''
306 d_castneg=''
307 d_chown=''
308 d_chroot=''
309 d_chsize=''
310 d_closedir=''
311 d_void_closedir=''
312 d_const=''
313 cryptlib=''
314 d_crypt=''
315 d_csh=''
316 full_csh=''
317 d_cuserid=''
318 d_dbl_dig=''
319 d_difftime=''
320 d_dlerror=''
321 d_dlopen=''
322 d_dlsymun=''
323 d_dosuid=''
324 d_suidsafe=''
325 d_drand48proto=''
326 d_dup2=''
327 d_eaccess=''
328 d_endgrent=''
329 d_endhent=''
330 d_endnent=''
331 d_endpent=''
332 d_endpwent=''
333 d_endsent=''
334 d_fchmod=''
335 d_fchown=''
336 d_fcntl=''
337 d_fd_macros=''
338 d_fd_set=''
339 d_fds_bits=''
340 d_fgetpos=''
341 d_flexfnam=''
342 d_flock=''
343 d_fork=''
344 d_fseeko=''
345 d_fsetpos=''
346 d_ftello=''
347 d_ftime=''
348 d_gettimeod=''
349 d_Gconvert=''
350 d_getgrent=''
351 d_getgrps=''
352 d_gethbyaddr=''
353 d_gethbyname=''
354 d_gethent=''
355 aphostname=''
356 d_gethname=''
357 d_phostname=''
358 d_uname=''
359 d_gethostprotos=''
360 d_getlogin=''
361 d_getmntent=''
362 d_getnbyaddr=''
363 d_getnbyname=''
364 d_getnent=''
365 d_getnetprotos=''
366 d_getpent=''
367 d_getpgid=''
368 d_getpgrp2=''
369 d_bsdgetpgrp=''
370 d_getpgrp=''
371 d_getppid=''
372 d_getprior=''
373 d_getpbyname=''
374 d_getpbynumber=''
375 d_getprotoprotos=''
376 d_getpwent=''
377 d_getsent=''
378 d_getservprotos=''
379 d_getsbyname=''
380 d_getsbyport=''
381 d_gnulibc=''
382 d_hasmntopt=''
383 d_htonl=''
384 d_inetaton=''
385 d_isascii=''
386 d_killpg=''
387 d_lchown=''
388 d_link=''
389 d_locconv=''
390 d_lockf=''
391 d_longdbl=''
392 longdblsize=''
393 d_longlong=''
394 longlongsize=''
395 d_lstat=''
396 d_madvise=''
397 d_mblen=''
398 d_mbstowcs=''
399 d_mbtowc=''
400 d_memcmp=''
401 d_memcpy=''
402 d_memmove=''
403 d_memset=''
404 d_mkdir=''
405 d_mkfifo=''
406 d_mktime=''
407 d_mmap=''
408 mmaptype=''
409 d_mprotect=''
410 d_msg=''
411 d_msgctl=''
412 d_msgget=''
413 d_msgrcv=''
414 d_msgsnd=''
415 d_msync=''
416 d_munmap=''
417 d_nice=''
418 d_open3=''
419 d_fpathconf=''
420 d_pathconf=''
421 d_pause=''
422 d_pipe=''
423 d_poll=''
424 d_portable=''
425 d_old_pthread_create_joinable=''
426 old_pthread_create_joinable=''
427 d_pthread_yield=''
428 d_sched_yield=''
429 sched_yield=''
430 d_readdir=''
431 d_rewinddir=''
432 d_seekdir=''
433 d_telldir=''
434 d_readlink=''
435 d_readv=''
436 d_rename=''
437 d_rmdir=''
438 d_safebcpy=''
439 d_safemcpy=''
440 d_sanemcmp=''
441 d_select=''
442 d_sem=''
443 d_semctl=''
444 d_semget=''
445 d_semop=''
446 d_setegid=''
447 d_seteuid=''
448 d_setgrent=''
449 d_setgrps=''
450 d_sethent=''
451 d_setlinebuf=''
452 d_setlocale=''
453 d_setnent=''
454 d_setpent=''
455 d_setpgid=''
456 d_setpgrp2=''
457 d_bsdsetpgrp=''
458 d_setpgrp=''
459 d_setprior=''
460 d_setpwent=''
461 d_setregid=''
462 d_setresgid=''
463 d_setresuid=''
464 d_setreuid=''
465 d_setrgid=''
466 d_setruid=''
467 d_setsent=''
468 d_setsid=''
469 d_setvbuf=''
470 d_sfio=''
471 usesfio=''
472 d_shm=''
473 d_shmat=''
474 d_shmatprototype=''
475 shmattype=''
476 d_shmctl=''
477 d_shmdt=''
478 d_shmget=''
479 d_sigaction=''
480 d_sigsetjmp=''
481 d_cmsghdr_s=''
482 d_msg_ctrunc=''
483 d_msg_dontroute=''
484 d_msg_oob=''
485 d_msg_peek=''
486 d_msg_proxy=''
487 d_msghdr_s=''
488 d_oldsock=''
489 d_recvmsg=''
490 d_scm_rights=''
491 d_sendmsg=''
492 d_socket=''
493 d_sockpair=''
494 sockethdr=''
495 socketlib=''
496 d_statblks=''
497 d_fstatfs=''
498 d_statfs=''
499 d_statfsflags=''
500 d_fstatvfs=''
501 d_statvfs=''
502 d_stdio_cnt_lval=''
503 d_stdio_ptr_lval=''
504 d_stdiobase=''
505 d_stdstdio=''
506 stdio_base=''
507 stdio_bufsiz=''
508 stdio_cnt=''
509 stdio_filbuf=''
510 stdio_ptr=''
511 d_index=''
512 d_strchr=''
513 d_strcoll=''
514 d_strctcpy=''
515 d_strerrm=''
516 d_strerror=''
517 d_sysernlst=''
518 d_syserrlst=''
519 d_strtod=''
520 d_strtol=''
521 d_strtoul=''
522 d_strxfrm=''
523 d_symlink=''
524 d_syscall=''
525 d_sysconf=''
526 d_system=''
527 d_tcgetpgrp=''
528 d_tcsetpgrp=''
529 d_telldirproto=''
530 d_time=''
531 timetype=''
532 clocktype=''
533 d_times=''
534 d_truncate=''
535 d_tzname=''
536 d_umask=''
537 d_semctl_semid_ds=''
538 d_semctl_semun=''
539 d_union_semun=''
540 d_vfork=''
541 usevfork=''
542 d_voidsig=''
543 signal_t=''
544 d_volatile=''
545 d_charvspr=''
546 d_vprintf=''
547 d_wait4=''
548 d_waitpid=''
549 d_wcstombs=''
550 d_wctomb=''
551 d_writev=''
552 d_dbmclose64=''
553 d_dbminit64=''
554 d_delete64=''
555 d_fetch64=''
556 d_firstkey64=''
557 d_nextkey64=''
558 d_store64=''
559 dlext=''
560 cccdlflags=''
561 ccdlflags=''
562 dlsrc=''
563 ld=''
564 lddlflags=''
565 usedl=''
566 doublesize=''
567 ebcdic=''
568 fpostype=''
569 gidtype=''
570 groupstype=''
571 h_fcntl=''
572 h_sysfile=''
573 i_arpainet=''
574 db_hashtype=''
575 db_prefixtype=''
576 i_db=''
577 i_dbm=''
578 i_rpcsvcdbm=''
579 d_dirnamlen=''
580 direntrytype=''
581 i_dirent=''
582 i_dld=''
583 i_dlfcn=''
584 i_fcntl=''
585 i_float=''
586 i_gdbm=''
587 d_grpasswd=''
588 i_grp=''
589 d_int64t=''
590 i_inttypes=''
591 i_limits=''
592 i_locale=''
593 i_machcthr=''
594 i_malloc=''
595 i_math=''
596 i_memory=''
597 i_mntent=''
598 i_ndbm=''
599 i_netdb=''
600 i_neterrno=''
601 i_niin=''
602 i_sysin=''
603 i_poll=''
604 d_pwage=''
605 d_pwchange=''
606 d_pwclass=''
607 d_pwcomment=''
608 d_pwexpire=''
609 d_pwgecos=''
610 d_pwpasswd=''
611 d_pwquota=''
612 i_pwd=''
613 i_sfio=''
614 i_stddef=''
615 i_stdlib=''
616 i_string=''
617 strings=''
618 i_sysaccess=''
619 i_sysdir=''
620 i_sysfile=''
621 d_voidtty=''
622 i_bsdioctl=''
623 i_sysfilio=''
624 i_sysioctl=''
625 i_syssockio=''
626 i_sysmman=''
627 i_sysmount=''
628 i_sysndir=''
629 i_sysparam=''
630 i_sysresrc=''
631 i_syssecrt=''
632 i_sysselct=''
633 i_sysstat=''
634 i_sysstatvfs=''
635 i_systimes=''
636 i_systypes=''
637 d_iovec_s=''
638 i_sysuio=''
639 i_sysun=''
640 i_syswait=''
641 i_sgtty=''
642 i_termio=''
643 i_termios=''
644 i_systime=''
645 i_systimek=''
646 i_time=''
647 timeincl=''
648 i_unistd=''
649 i_utime=''
650 i_values=''
651 i_stdarg=''
652 i_varargs=''
653 i_varhdr=''
654 i_vfork=''
655 installusrbinperl=''
656 intsize=''
657 longsize=''
658 shortsize=''
659 d_dirent64_s=''
660 d_flock64_s=''
661 d_fstat64=''
662 d_ftruncate64=''
663 d_ino64t=''
664 d_lockf64=''
665 d_lseek64=''
666 d_lstat64=''
667 d_off64t=''
668 d_open64=''
669 d_opendir64=''
670 d_readdir64=''
671 d_seekdir64=''
672 d_stat64=''
673 d_telldir64=''
674 d_truncate64=''
675 libc=''
676 libperl=''
677 shrpenv=''
678 useshrplib=''
679 glibpth=''
680 libpth=''
681 loclibpth=''
682 plibpth=''
683 xlibpth=''
684 ignore_versioned_solibs=''
685 libs=''
686 lns=''
687 lseeksize=''
688 lseektype=''
689 make_set_make=''
690 d_mymalloc=''
691 freetype=''
692 mallocobj=''
693 mallocsrc=''
694 malloctype=''
695 usemymalloc=''
696 installman1dir=''
697 man1dir=''
698 man1direxp=''
699 man1ext=''
700 installman3dir=''
701 man3dir=''
702 man3direxp=''
703 man3ext=''
704 huge=''
705 large=''
706 medium=''
707 models=''
708 small=''
709 split=''
710 modetype=''
711 multiarch=''
712 mydomain=''
713 myhostname=''
714 phostname=''
715 c=''
716 n=''
717 d_eofnblk=''
718 eagain=''
719 o_nonblock=''
720 rd_nodata=''
721 netdb_hlen_type=''
722 netdb_host_type=''
723 netdb_name_type=''
724 netdb_net_type=''
725 groupcat=''
726 hostcat=''
727 passcat=''
728 orderlib=''
729 ranlib=''
730 package=''
731 spackage=''
732 pager=''
733 apiversion=''
734 patchlevel=''
735 subversion=''
736 version=''
737 perladmin=''
738 perlpath=''
739 pidtype=''
740 prefix=''
741 prefixexp=''
742 installprivlib=''
743 privlib=''
744 privlibexp=''
745 prototype=''
746 ptrsize=''
747 drand01=''
748 randbits=''
749 randfunc=''
750 randseedtype=''
751 seedfunc=''
752 installscript=''
753 scriptdir=''
754 scriptdirexp=''
755 selectminbits=''
756 selecttype=''
757 sh=''
758 sig_name=''
759 sig_name_init=''
760 sig_num=''
761 sig_num_init=''
762 installsitearch=''
763 sitearch=''
764 sitearchexp=''
765 installsitelib=''
766 sitelib=''
767 sitelibexp=''
768 sizetype=''
769 so=''
770 sharpbang=''
771 shsharp=''
772 spitshell=''
773 src=''
774 ssizetype=''
775 startperl=''
776 startsh=''
777 stdchar=''
778 d_fgetpos64=''
779 d_fopen64=''
780 d_freopen64=''
781 d_fseek64=''
782 d_fseeko64=''
783 d_fsetpos64=''
784 d_ftell64=''
785 d_ftello64=''
786 d_tmpfile64=''
787 sysman=''
788 trnl=''
789 uidtype=''
790 archname64=''
791 use64bits=''
792 usemultiplicity=''
793 nm_opt=''
794 nm_so_opt=''
795 runnm=''
796 usenm=''
797 useperlio=''
798 d_oldpthreads=''
799 usethreads=''
800 incpath=''
801 mips=''
802 mips_type=''
803 usrinc=''
804 defvoidused=''
805 voidflags=''
806 CONFIG=''
807
808 define='define'
809 undef='undef'
810 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
811 rmlist=''
812
813 : We must find out about Eunice early
814 eunicefix=':'
815 if test -f /etc/unixtovms; then
816         eunicefix=/etc/unixtovms
817 fi
818 if test -f /etc/unixtovms.exe; then
819         eunicefix=/etc/unixtovms.exe
820 fi
821
822 i_whoami=''
823 : Possible local include directories to search.
824 : Set locincpth to "" in a hint file to defeat local include searches.
825 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
826 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
827 :
828 : no include file wanted by default
829 inclwanted=''
830
831 : list of known cpp symbols, sorted alphabetically
832 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
833 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
834 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
835 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
836 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
837 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
838 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
839 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
840 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
841 al="$al VMS Xenix286"
842 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
843 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
844 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
845 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
846 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
847 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
848 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
849 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
850 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
851 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
852 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
853 al="$al __SVR4_2__ __UMAXV__"
854 al="$al ____386BSD____ __alpha __alpha__ __amiga"
855 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
856 al="$al __host_mips__"
857 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
858 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
859 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
860 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
861 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
862 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
863 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
864 al="$al __mc88100 __mc88100__ __mips __mips__"
865 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
866 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
867 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
868 al="$al _host_mips _mips _unix"
869 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
870 al="$al apollo ardent att386 att3b"
871 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
872 al="$al cadmus clipper concurrent convex cray ctix"
873 al="$al dmert encore gcos gcx gimpel gould"
874 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
875 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
876 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
877 al="$al i186 i286 i386 i486 i8086"
878 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
879 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
880 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
881 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
882 al="$al mc88000 mc88100 merlin mert mips mvs n16"
883 al="$al ncl_el ncl_mr"
884 al="$al news1500 news1700 news1800 news1900 news3700"
885 al="$al news700 news800 news900 ns16000 ns32000"
886 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
887 al="$al parisc pc532 pdp11 plexus posix pyr"
888 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
889 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
890 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
891 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
892 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
893 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
894 al="$al xenix z8000"
895
896 : Trailing extension.  Override this in a hint file, if needed.
897 _exe=''
898 : Extra object files, if any, needed on this platform.
899 archobjs=''
900 groupstype=''
901 : change the next line if compiling for Xenix/286 on Xenix/386
902 xlibpth='/usr/lib/386 /lib/386'
903
904 : Possible local library directories to search.
905 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
906 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
907
908 : general looking path for locating libraries
909 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
910 glibpth="$glibpth /lib /usr/lib $xlibpth"
911 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
912 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
913
914 : Private path used by Configure to find libraries.  Its value
915 : is prepended to libpth. This variable takes care of special
916 : machines, like the mips.  Usually, it should be empty.
917 plibpth=''
918
919 : default library list
920 libswanted=''
921 : some systems want to use only the non-versioned libso:s
922 ignore_versioned_solibs=''
923 : full support for void wanted by default
924 defvoidused=15
925
926 : set useposix=false in your hint file to disable the POSIX extension.
927 useposix=true
928 : set useopcode=false in your hint file to disable the Opcode extension.
929 useopcode=true
930 : set usemultiplicity on the Configure command line to enable multiplicity.
931 : set usethreads on the Configure command line to enable threads.
932 : List of libraries we want.
933 : If anyone needs -lnet, put it in a hint file.
934 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
935 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
936 libswanted="$libswanted ucb bsd BSD PW x"
937 : We probably want to search /usr/shlib before most other libraries.
938 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
939 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
940 glibpth="/usr/shlib $glibpth"
941 : Do not use vfork unless overridden by a hint file.
942 usevfork=false
943
944 : Find the basic shell for Bourne shell scripts
945 case "$sh" in
946 '')
947         case "$SYSTYPE" in
948         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
949         *) xxx='/bin/sh';;
950         esac
951         if test -f "$xxx"; then
952                 sh="$xxx"
953         else
954                 : Build up a list and do a single loop so we can 'break' out.
955                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
956                 for xxx in sh bash ksh pdksh ash; do
957                         for p in $pth; do
958                                 try="$try ${p}/${xxx}"
959                         done
960                 done
961                 for xxx in $try; do
962                         if test -f "$xxx"; then
963                                 sh="$xxx";
964                                 break
965                         elif test -f "$xxx.exe"; then
966                                 sh="$xxx";
967                                 break
968                         fi
969                 done
970         fi
971         ;;
972 esac
973
974 case "$sh" in
975 '')     cat <<EOM >&2
976 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
977
978 Usually it's in /bin/sh.  How did you even get this far?
979 Please contact me (Perl Maintainers) at perlbug@perl.com and 
980 we'll try to straighten this all out.
981 EOM
982         exit 1
983         ;;
984 esac
985
986 : see if sh knows # comments
987 if `$sh -c '#' >/dev/null 2>&1`; then
988         shsharp=true
989         spitshell=cat
990         xcat=/bin/cat
991         test -f $xcat || xcat=/usr/bin/cat
992         echo "#!$xcat" >try
993         $eunicefix try
994         chmod +x try
995         ./try > today
996         if test -s today; then
997                 sharpbang='#!'
998         else
999                 echo "#! $xcat" > try
1000                 $eunicefix try
1001                 chmod +x try
1002                 ./try > today
1003                 if test -s today; then
1004                         sharpbang='#! '
1005                 else
1006                         sharpbang=': use '
1007                 fi
1008         fi
1009 else
1010         echo " "
1011         echo "Your $sh doesn't grok # comments--I will strip them later on."
1012         shsharp=false
1013         cd ..
1014         echo "exec grep -v '^[  ]*#'" >spitshell
1015         chmod +x spitshell
1016         $eunicefix spitshell
1017         spitshell=`pwd`/spitshell
1018         cd UU
1019         echo "I presume that if # doesn't work, #! won't work either!"
1020         sharpbang=': use '
1021 fi
1022 rm -f try today
1023
1024 : figure out how to guarantee sh startup
1025 case "$startsh" in
1026 '') startsh=${sharpbang}${sh} ;;
1027 *)
1028 esac
1029 cat >try <<EOSS
1030 $startsh
1031 set abc
1032 test "$?abc" != 1
1033 EOSS
1034
1035 chmod +x try
1036 $eunicefix try
1037 if ./try; then
1038         : echo "Yup, it does."
1039 else
1040         echo "Hmm... '$startsh' does not guarantee sh startup..."
1041         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1042 fi
1043 rm -f try
1044
1045
1046 : Save command line options in file UU/cmdline.opt for later use in
1047 : generating config.sh.
1048 cat > cmdline.opt <<EOSH
1049 # Configure command line arguments.
1050 config_arg0='$0'
1051 config_args='$*'
1052 config_argc=$#
1053 EOSH
1054 argn=1
1055 for arg in "$@"; do
1056         cat >>cmdline.opt <<EOSH
1057 config_arg$argn='$arg'
1058 EOSH
1059         argn=`expr $argn + 1`
1060 done
1061
1062 : produce awk script to parse command line options
1063 cat >options.awk <<'EOF'
1064 BEGIN {
1065         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1066
1067         len = length(optstr);
1068         for (i = 1; i <= len; i++) {
1069                 c = substr(optstr, i, 1);
1070                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1071                 if (a == ":") {
1072                         arg[c] = 1;
1073                         i++;
1074                 }
1075                 opt[c] = 1;
1076         }
1077 }
1078 {
1079         expect = 0;
1080         str = $0;
1081         if (substr(str, 1, 1) != "-") {
1082                 printf("'%s'\n", str);
1083                 next;
1084         }
1085         len = length($0);
1086         for (i = 2; i <= len; i++) {
1087                 c = substr(str, i, 1);
1088                 if (!opt[c]) {
1089                         printf("-%s\n", substr(str, i));
1090                         next;
1091                 }
1092                 printf("-%s\n", c);
1093                 if (arg[c]) {
1094                         if (i < len)
1095                                 printf("'%s'\n", substr(str, i + 1));
1096                         else
1097                                 expect = 1;
1098                         next;
1099                 }
1100         }
1101 }
1102 END {
1103         if (expect)
1104                 print "?";
1105 }
1106 EOF
1107
1108 : process the command line options
1109 set X `for arg in "$@"; do echo "X$arg"; done |
1110         sed -e s/X// | awk -f options.awk`
1111 eval "set $*"
1112 shift
1113 rm -f options.awk
1114
1115 : set up default values
1116 fastread=''
1117 reuseval=false
1118 config_sh=''
1119 alldone=''
1120 error=''
1121 silent=''
1122 extractsh=''
1123 override=''
1124 knowitall=''
1125 rm -f optdef.sh
1126 cat >optdef.sh <<EOS
1127 $startsh
1128 EOS
1129
1130
1131 : option parsing
1132 while test $# -gt 0; do
1133         case "$1" in
1134         -d) shift; fastread=yes;;
1135         -e) shift; alldone=cont;;
1136         -f)
1137                 shift
1138                 cd ..
1139                 if test -r "$1"; then
1140                         config_sh="$1"
1141                 else
1142                         echo "$me: cannot read config file $1." >&2
1143                         error=true
1144                 fi
1145                 cd UU
1146                 shift;;
1147         -h) shift; error=true;;
1148         -r) shift; reuseval=true;;
1149         -s) shift; silent=true; realsilent=true;;
1150         -E) shift; alldone=exit;;
1151         -K) shift; knowitall=true;;
1152         -O) shift; override=true;;
1153         -S) shift; silent=true; extractsh=true;;
1154         -D)
1155                 shift
1156                 case "$1" in
1157                 *=)
1158                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1159                         echo "$me: ignoring -D $1" >&2
1160                         ;;
1161                 *=*) echo "$1" | \
1162                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1163                 *) echo "$1='define'" >> optdef.sh;;
1164                 esac
1165                 shift
1166                 ;;
1167         -U)
1168                 shift
1169                 case "$1" in
1170                 *=) echo "$1" >> optdef.sh;;
1171                 *=*)
1172                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1173                         echo "$me: ignoring -U $1" >&2
1174                         ;;
1175                 *) echo "$1='undef'" >> optdef.sh;;
1176                 esac
1177                 shift
1178                 ;;
1179         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1180                 exit 0;;
1181         --) break;;
1182         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1183         *) break;;
1184         esac
1185 done
1186
1187 case "$error" in
1188 true)
1189         cat >&2 <<EOM
1190 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1191                  [-U symbol] [-U symbol=]
1192   -d : use defaults for all answers.
1193   -e : go on without questioning past the production of config.sh.
1194   -f : specify an alternate default configuration file.
1195   -h : print this help message and exit (with an error status).
1196   -r : reuse C symbols value if possible (skips costly nm extraction).
1197   -s : silent mode, only echoes questions and essential information.
1198   -D : define symbol to have some value:
1199          -D symbol         symbol gets the value 'define'
1200          -D symbol=value   symbol gets the value 'value'
1201   -E : stop at the end of questions, after having produced config.sh.
1202   -K : do not use unless you know what you are doing.
1203   -O : let -D and -U override definitions from loaded configuration file.
1204   -S : perform variable substitutions on all .SH files (can mix with -f)
1205   -U : undefine symbol:
1206          -U symbol    symbol gets the value 'undef'
1207          -U symbol=   symbol gets completely empty
1208   -V : print version number and exit (with a zero status).
1209 EOM
1210         exit 1
1211         ;;
1212 esac
1213
1214 : Sanity checks
1215 case "$fastread$alldone" in
1216 yescont|yesexit) ;;
1217 *)
1218         if test ! -t 0; then
1219                 echo "Say 'sh Configure', not 'sh <Configure'"
1220                 exit 1
1221         fi
1222         ;;
1223 esac
1224
1225 exec 4>&1
1226 case "$silent" in
1227 true) exec 1>/dev/null;;
1228 esac
1229
1230 : run the defines and the undefines, if any, but leave the file out there...
1231 touch optdef.sh
1232 . ./optdef.sh
1233
1234 : set package name
1235 package=perl5
1236 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1237 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1238 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1239 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1240 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1241 esac
1242
1243 : Some greps do not return status, grrr.
1244 echo "grimblepritz" >grimble
1245 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1246         contains=contains
1247 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1248         contains=grep
1249 else
1250         contains=contains
1251 fi
1252 rm -f grimble
1253 : the following should work in any shell
1254 case "$contains" in
1255 contains*)
1256         echo " "
1257         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1258         cat >contains <<'EOSS'
1259 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1260 EOSS
1261 chmod +x contains
1262 esac
1263
1264 : Find the path to the source tree
1265 case "$src" in
1266 '') case "$0" in
1267     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1268     *)   src='.';;
1269     esac;;
1270 esac
1271 case "$src" in
1272 '')     src=/
1273         rsrc=/
1274         ;;
1275 /*) rsrc="$src";;
1276 *) rsrc="../$src";;
1277 esac
1278 if test -f $rsrc/Configure && \
1279         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1280 then
1281    : found it, so we are ok.
1282 else
1283         rsrc=''
1284         for src in . .. ../.. ../../.. ../../../..; do
1285                 if test -f ../$src/Configure && \
1286                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1287                 then
1288                         rsrc=../$src
1289                         break
1290                 fi
1291         done
1292 fi
1293 case "$rsrc" in
1294 '')
1295         cat <<EOM >&4
1296
1297 Sorry, I can't seem to locate the source dir for $package.  Please start
1298 Configure with an explicit path -- i.e. /some/path/Configure.
1299
1300 EOM
1301         exit 1
1302         ;;
1303 ../.)   rsrc='..';;
1304 *)
1305         echo " "
1306         echo "Sources for $package found in \"$src\"." >&4
1307         ;;
1308 esac
1309
1310 : script used to extract .SH files with variable substitutions
1311 cat >extract <<'EOS'
1312 CONFIG=true
1313 echo "Doing variable substitutions on .SH files..."
1314 if test -f $src/MANIFEST; then
1315         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1316 else
1317         echo "(Looking for .SH files under the source directory.)"
1318         set x `(cd $src; find . -name "*.SH" -print)`
1319 fi
1320 shift
1321 case $# in
1322 0) set x `(cd $src; echo *.SH)`; shift;;
1323 esac
1324 if test ! -f $src/$1; then
1325         shift
1326 fi
1327 mkdir_p='
1328 name=$1;
1329 create="";
1330 while test $name; do
1331         if test ! -d "$name"; then
1332                 create="$name $create";
1333                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1334                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1335         else
1336                 name="";
1337         fi;
1338 done;
1339 for file in $create; do
1340         mkdir $file;
1341 done
1342 '
1343 for file in $*; do
1344         case "$src" in
1345         ".")
1346                 case "$file" in
1347                 */*)
1348                         dir=`expr X$file : 'X\(.*\)/'`
1349                         file=`expr X$file : 'X.*/\(.*\)'`
1350                         (cd $dir && . ./$file)
1351                         ;;
1352                 *)
1353                         . ./$file
1354                         ;;
1355                 esac
1356                 ;;
1357         *)
1358                 case "$file" in
1359                 */*)
1360                         dir=`expr X$file : 'X\(.*\)/'`
1361                         file=`expr X$file : 'X.*/\(.*\)'`
1362                         (set x $dir; shift; eval $mkdir_p)
1363                         sh <$src/$dir/$file
1364                         ;;
1365                 *)
1366                         sh <$src/$file
1367                         ;;
1368                 esac
1369                 ;;
1370         esac
1371 done
1372 if test -f $src/config_h.SH; then
1373         if test ! -f config.h; then
1374         : oops, they left it out of MANIFEST, probably, so do it anyway.
1375         . $src/config_h.SH
1376         fi
1377 fi
1378 EOS
1379
1380 : extract files and exit if asked to do so
1381 case "$extractsh" in
1382 true)
1383         case "$realsilent" in
1384         true) ;;
1385         *) exec 1>&4;;
1386         esac
1387         case "$config_sh" in
1388         '') config_sh='config.sh';;
1389         esac
1390         echo " "
1391         echo "Fetching answers from $config_sh..."
1392         cd ..
1393         . $config_sh
1394         test "$override" && . ./optdef.sh
1395         echo " "
1396         . UU/extract
1397         rm -rf UU
1398         echo "Done."
1399         exit 0
1400         ;;
1401 esac
1402
1403 : Eunice requires " " instead of "", can you believe it
1404 echo " "
1405 : Here we go...
1406 echo "Beginning of configuration questions for $package."
1407
1408 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1409
1410 : first determine how to suppress newline on echo command
1411 echo " "
1412 echo "Checking echo to see how to suppress newlines..."
1413 (echo "hi there\c" ; echo " ") >.echotmp
1414 if $contains c .echotmp >/dev/null 2>&1 ; then
1415         echo "...using -n."
1416         n='-n'
1417         c=''
1418 else
1419         cat <<'EOM'
1420 ...using \c
1421 EOM
1422         n=''
1423         c='\c'
1424 fi
1425 echo $n "The star should be here-->$c"
1426 echo '*'
1427 rm -f .echotmp
1428
1429 : Now test for existence of everything in MANIFEST
1430 echo " "
1431 if test -f $rsrc/MANIFEST; then
1432         echo "First let's make sure your kit is complete.  Checking..." >&4
1433         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1434         rm -f missing
1435         tmppwd=`pwd`
1436         for filelist in x??; do
1437                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1438         done
1439         if test -s missing; then
1440                 cat missing >&4
1441                 cat >&4 <<'EOM'
1442
1443 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1444
1445 You have the option of continuing the configuration process, despite the
1446 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1447 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1448 and contact the author (perlbug@perl.com).
1449
1450 EOM
1451                 echo $n "Continue? [n] $c" >&4
1452                 read ans
1453                 case "$ans" in
1454                 y*)
1455                         echo "Continuing..." >&4
1456                         rm -f missing
1457                         ;;
1458                 *)
1459                         echo "ABORTING..." >&4
1460                         kill $$
1461                         ;;
1462                 esac
1463         else
1464                 echo "Looks good..."
1465         fi
1466 else
1467         echo "There is no MANIFEST file.  I hope your kit is complete !"
1468 fi
1469 rm -f missing x??
1470
1471 echo " "
1472 : Find the appropriate value for a newline for tr
1473 if test -n "$DJGPP"; then
1474        trnl='\012'
1475 fi
1476 if test X"$trnl" = X; then
1477         case "`echo foo|tr '\n' x 2>/dev/null`" in
1478         foox) trnl='\n' ;;
1479         esac
1480 fi
1481 if test X"$trnl" = X; then
1482         case "`echo foo|tr '\012' x 2>/dev/null`" in
1483         foox) trnl='\012' ;;
1484         esac
1485 fi
1486 if test X"$trnl" = X; then
1487         cat <<EOM >&2
1488
1489 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1490
1491 EOM
1492         exit 1
1493 fi
1494
1495 : compute the number of columns on the terminal for proper question formatting
1496 case "$COLUMNS" in
1497 '') COLUMNS='80';;
1498 esac
1499
1500 : set up the echo used in my read
1501 myecho="case \"\$xxxm\" in
1502 '') echo $n \"\$rp $c\" >&4;;
1503 *) case \"\$rp\" in
1504         '') echo $n \"[\$xxxm] $c\";;
1505         *)
1506                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1507                         echo \"\$rp\" >&4
1508                         echo $n \"[\$xxxm] $c\" >&4
1509                 else
1510                         echo $n \"\$rp [\$xxxm] $c\" >&4
1511                 fi
1512                 ;;
1513         esac;;
1514 esac"
1515
1516 : now set up to do reads with possible shell escape and default assignment
1517 cat <<EOSC >myread
1518 $startsh
1519 xxxm=\$dflt
1520 $myecho
1521 ans='!'
1522 case "\$fastread" in
1523 yes) case "\$dflt" in
1524         '') ;;
1525         *) ans='';
1526                 case "\$silent-\$rp" in
1527                 true-) ;;
1528                 *) echo " " >&4;;
1529                 esac;;
1530         esac;;
1531 *) case "\$silent" in
1532         true) case "\$rp" in
1533                 '') ans='';;
1534                 esac;;
1535         esac;;
1536 esac
1537 while expr "X\$ans" : "X!" >/dev/null; do
1538         read answ
1539         set x \$xxxm
1540         shift
1541         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1542         case  "\$answ" in
1543         "!")
1544                 sh 1>&4
1545                 echo " "
1546                 $myecho
1547                 ;;
1548         !*)
1549                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1550                 shift
1551                 sh 1>&4 -c "\$*"
1552                 echo " "
1553                 $myecho
1554                 ;;
1555         "\$ans")
1556                 case "\$ans" in
1557                 \\&*)
1558                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1559                         shift
1560                         case "\$1" in
1561                         -d)
1562                                 fastread=yes
1563                                 echo "(OK, I'll run with -d after this question.)" >&4
1564                                 ;;
1565                         -*)
1566                                 echo "*** Sorry, \$1 not supported yet." >&4
1567                                 ;;
1568                         esac
1569                         $myecho
1570                         ans=!
1571                         ;;
1572                 esac;;
1573         *)
1574                 case "\$aok" in
1575                 y)
1576                         echo "*** Substitution done -- please confirm."
1577                         xxxm="\$ans"
1578                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1579                         xxxm="\$ans"
1580                         ans=!
1581                         ;;
1582                 *)
1583                         echo "*** Error -- try again."
1584                         ans=!
1585                         ;;
1586                 esac
1587                 $myecho
1588                 ;;
1589         esac
1590         case "\$ans\$xxxm\$nostick" in
1591         '')
1592                 ans=!
1593                 $myecho
1594                 ;;
1595         esac
1596 done
1597 case "\$ans" in
1598 '') ans="\$xxxm";;
1599 esac
1600 EOSC
1601
1602 : create .config dir to save info across Configure sessions
1603 test -d ../.config || mkdir ../.config
1604 cat >../.config/README <<EOF
1605 This directory created by Configure to save information that should
1606 persist across sessions for $package.
1607
1608 You may safely delete it if you wish.
1609 EOF
1610
1611 : general instructions
1612 needman=true
1613 firsttime=true
1614 user=`(logname) 2>/dev/null`
1615 case "$user" in
1616 '') user=`whoami 2>&1`;;
1617 esac
1618 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1619         firsttime=false
1620         echo " "
1621         rp='Would you like to see the instructions?'
1622         dflt=n
1623         . ./myread
1624         case "$ans" in
1625         [yY]*) ;;
1626         *) needman=false;;
1627         esac
1628 fi
1629 if $needman; then
1630         cat <<EOH
1631
1632 This installation shell script will examine your system and ask you questions
1633 to determine how the perl5 package should be installed. If you get
1634 stuck on a question, you may use a ! shell escape to start a subshell or
1635 execute a command.  Many of the questions will have default answers in square
1636 brackets; typing carriage return will give you the default.
1637
1638 On some of the questions which ask for file or directory names you are allowed
1639 to use the ~name construct to specify the login directory belonging to "name",
1640 even if you don't have a shell which knows about that.  Questions where this is
1641 allowed will be marked "(~name ok)".
1642
1643 EOH
1644         rp=''
1645         dflt='Type carriage return to continue'
1646         . ./myread
1647         cat <<'EOH'
1648
1649 The prompter used in this script allows you to use shell variables and
1650 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1651 in the default answer, as if the default line was a set of arguments given to a
1652 script shell.  This means you may also use $* to repeat the whole default line,
1653 so you do not have to re-type everything to add something to the default.
1654
1655 Everytime there is a substitution, you will have to confirm.  If there is an
1656 error (e.g. an unmatched backtick), the default answer will remain unchanged
1657 and you will be prompted again.
1658
1659 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1660 the questions and use the computed defaults (or the previous answers if there
1661 was already a config.sh file). Type 'Configure -h' for a list of options.
1662 You may also start interactively and then answer '& -d' at any prompt to turn
1663 on the non-interactive behaviour for the remainder of the execution.
1664
1665 EOH
1666         . ./myread
1667         cat <<EOH
1668
1669 Much effort has been expended to ensure that this shell script will run on any
1670 Unix system.  If despite that it blows up on yours, your best bet is to edit
1671 Configure and run it again.  If you can't run Configure for some reason,
1672 you'll have to generate a config.sh file by hand.  Whatever problems you
1673 have, let me (perlbug@perl.com) know how I blew it.
1674
1675 This installation script affects things in two ways:
1676
1677 1) it may do direct variable substitutions on some of the files included
1678    in this kit.
1679 2) it builds a config.h file for inclusion in C programs.  You may edit
1680    any of these files as the need arises after running this script.
1681
1682 If you make a mistake on a question, there is no easy way to back up to it
1683 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1684 files.  Configure will offer to let you do this before it runs the SH files.
1685
1686 EOH
1687         dflt='Type carriage return to continue'
1688         . ./myread
1689         case "$firsttime" in
1690         true) echo $user >>../.config/instruct;;
1691         esac
1692 fi
1693
1694 : find out where common programs are
1695 echo " "
1696 echo "Locating common programs..." >&4
1697 cat <<EOSC >loc
1698 $startsh
1699 case \$# in
1700 0) exit 1;;
1701 esac
1702 thing=\$1
1703 shift
1704 dflt=\$1
1705 shift
1706 for dir in \$*; do
1707         case "\$thing" in
1708         .)
1709         if test -d \$dir/\$thing; then
1710                 echo \$dir
1711                 exit 0
1712         fi
1713         ;;
1714         *)
1715         for thisthing in \$dir/\$thing; do
1716                 : just loop through to pick last item
1717         done
1718         if test -f \$thisthing; then
1719                 echo \$thisthing
1720                 exit 0
1721         elif test -f \$dir/\$thing.exe; then
1722                 if test -n "$DJGPP"; then
1723                         echo \$dir/\$thing.exe
1724                 else
1725                         : on Eunice apparently
1726                         echo \$dir/\$thing
1727                 fi
1728                 exit 0
1729         fi
1730         ;;
1731         esac
1732 done
1733 echo \$dflt
1734 exit 1
1735 EOSC
1736 chmod +x loc
1737 $eunicefix loc
1738 loclist="
1739 awk
1740 cat
1741 comm
1742 cp
1743 echo
1744 expr
1745 grep
1746 ls
1747 make
1748 mkdir
1749 rm
1750 sed
1751 sort
1752 touch
1753 tr
1754 uniq
1755 "
1756 trylist="
1757 Mcc
1758 ar
1759 byacc
1760 cpp
1761 csh
1762 date
1763 egrep
1764 gzip
1765 less
1766 ln
1767 more
1768 nm
1769 nroff
1770 pg
1771 tee
1772 test
1773 uname
1774 zip
1775 "
1776 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1777 pth="$pth /lib /usr/lib"
1778 for file in $loclist; do
1779         eval xxx=\$$file
1780         case "$xxx" in
1781         /*|?:[\\/]*)
1782                 if test -f "$xxx"; then
1783                         : ok
1784                 else
1785                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1786                         xxx=`./loc $file $file $pth`
1787                 fi
1788                 ;;
1789         '') xxx=`./loc $file $file $pth`;;
1790         *) xxx=`./loc $xxx $xxx $pth`;;
1791         esac
1792         eval $file=$xxx
1793         eval _$file=$xxx
1794         case "$xxx" in
1795         /*)
1796                 echo $file is in $xxx.
1797                 ;;
1798         ?:[\\/]*)
1799                 echo $file is in $xxx.
1800                 ;;
1801         *)
1802                 echo "I don't know where '$file' is, and my life depends on it." >&4
1803                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1804                 exit 1
1805                 ;;
1806         esac
1807 done
1808 echo " "
1809 echo "Don't worry if any of the following aren't found..."
1810 say=offhand
1811 for file in $trylist; do
1812         eval xxx=\$$file
1813         case "$xxx" in
1814         /*|?:[\\/]*)
1815                 if test -f "$xxx"; then
1816                         : ok
1817                 else
1818                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1819                         xxx=`./loc $file $file $pth`
1820                 fi
1821                 ;;
1822         '') xxx=`./loc $file $file $pth`;;
1823         *) xxx=`./loc $xxx $xxx $pth`;;
1824         esac
1825         eval $file=$xxx
1826         eval _$file=$xxx
1827         case "$xxx" in
1828         /*)
1829                 echo $file is in $xxx.
1830                 ;;
1831         ?:[\\/]*)
1832                 echo $file is in $xxx.
1833                 ;;
1834         *)
1835                 echo "I don't see $file out there, $say."
1836                 say=either
1837                 ;;
1838         esac
1839 done
1840 case "$egrep" in
1841 egrep)
1842         echo "Substituting grep for egrep."
1843         egrep=$grep
1844         ;;
1845 esac
1846 case "$ln" in
1847 ln)
1848         echo "Substituting cp for ln."
1849         ln=$cp
1850         ;;
1851 esac
1852 case "$test" in
1853 test)
1854         echo "Hopefully test is built into your sh."
1855         ;;
1856 *)
1857         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1858                 echo "Using the test built into your sh."
1859                 test=test
1860                 _test=test
1861         fi
1862         ;;
1863 esac
1864 case "$echo" in
1865 echo)
1866         echo "Hopefully echo is built into your sh."
1867         ;;
1868 '') ;;
1869 *)
1870         echo " "
1871 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1872         $echo $n "hi there$c" >foo1
1873         echo $n "hi there$c" >foo2
1874         if cmp foo1 foo2 >/dev/null 2>&1; then
1875                 echo "They are compatible.  In fact, they may be identical."
1876         else
1877                 case "$n" in
1878                 '-n') n='' c='\c';;
1879                 *) n='-n' c='';;
1880                 esac
1881                 cat <<FOO
1882 They are not compatible!  You are probably running ksh on a non-USG system.
1883 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1884 have echo built in and we may have to run some Bourne shell scripts.  That
1885 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1886
1887 FOO
1888                 $echo $n "The star should be here-->$c"
1889                 $echo "*"
1890         fi
1891         $rm -f foo1 foo2
1892         ;;
1893 esac
1894
1895 : determine whether symbolic links are supported
1896 echo " "
1897 $touch blurfl
1898 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1899         echo "Symbolic links are supported." >&4
1900         lns="$ln -s"
1901 else
1902         echo "Symbolic links are NOT supported." >&4
1903         lns="$ln"
1904 fi
1905 $rm -f blurfl sym
1906
1907 : see whether [:lower:] and [:upper:] are supported character classes
1908 echo " "
1909 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1910 ABYZ)
1911         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1912         up='[:upper:]'
1913         low='[:lower:]'
1914         ;;
1915 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1916         # (0xc9 and 0xd1), therefore that is a nice testing point.
1917         if test "X$up" = X -o "X$low" = X; then
1918             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1919             ij) up='[A-Z]'
1920                 low='[a-z]'
1921                 ;;
1922             esac
1923         fi
1924         if test "X$up" = X -o "X$low" = X; then
1925             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1926             ij) up='A-Z'
1927                 low='a-z'
1928                 ;;
1929             esac
1930         fi
1931         if test "X$up" = X -o "X$low" = X; then
1932             case "`echo IJ | od -x 2>/dev/null`" in
1933             *C9D1*|*c9d1*)
1934                 echo "Hey, this might be EBCDIC." >&4
1935                 if test "X$up" = X -o "X$low" = X; then
1936                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1937                     ij) up='[A-IJ-RS-Z]'
1938                         low='[a-ij-rs-z]'
1939                         ;;
1940                     esac
1941                 fi
1942                 if test "X$up" = X -o "X$low" = X; then
1943                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1944                     ij) up='A-IJ-RS-Z'
1945                         low='a-ij-rs-z'
1946                         ;;
1947                     esac
1948                 fi
1949                 ;;
1950             esac
1951         fi
1952 esac
1953 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1954 ij)
1955     echo "Using $up and $low to convert case." >&4
1956     ;;
1957 *)
1958     echo "I don't know how to translate letters from upper to lower case." >&4
1959     echo "Your tr is not acting any way I know of." >&4
1960     exit 1
1961     ;;
1962 esac
1963 : set up the translation script tr, must be called with ./tr of course
1964 cat >tr <<EOSC
1965 $startsh
1966 case "\$1\$2" in
1967 '[A-Z][a-z]') exec $tr '$up' '$low';;
1968 '[a-z][A-Z]') exec $tr '$low' '$up';;
1969 esac
1970 exec $tr "\$@"
1971 EOSC
1972 chmod +x tr
1973 $eunicefix tr
1974
1975 : Try to determine whether config.sh was made on this system
1976 case "$config_sh" in
1977 '')
1978 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1979 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1980 # because the A-Z/a-z are not consecutive.
1981 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1982         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1983 newmyuname="$myuname"
1984 dflt=n
1985 case "$knowitall" in
1986 '')
1987         if test -f ../config.sh; then
1988                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1989                         eval "`grep myuname= ../config.sh`"
1990                 fi
1991                 if test "X$myuname" = "X$newmyuname"; then
1992                         dflt=y
1993                 fi
1994         fi
1995         ;;
1996 *) dflt=y;;
1997 esac
1998
1999 : Get old answers from old config file if Configure was run on the
2000 : same system, otherwise use the hints.
2001 hint=default
2002 cd ..
2003 if test -f config.sh; then
2004         echo " "
2005         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2006         . UU/myread
2007         case "$ans" in
2008         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2009         *)  echo "Fetching default answers from your old config.sh file..." >&4
2010                 tmp_n="$n"
2011                 tmp_c="$c"
2012                 tmp_sh="$sh"
2013                 . ./config.sh
2014                 cp config.sh UU
2015                 n="$tmp_n"
2016                 c="$tmp_c"
2017                 : Older versions did not always set $sh.  Catch re-use of such
2018                 : an old config.sh.
2019                 case "$sh" in
2020                 '') sh="$tmp_sh" ;;
2021                 esac
2022                 hint=previous
2023                 ;;
2024         esac
2025 fi
2026 if test ! -f config.sh; then
2027         $cat <<EOM
2028
2029 First time through, eh?  I have some defaults handy for some systems
2030 that need some extra help getting the Configure answers right:
2031
2032 EOM
2033         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2034         dflt=''
2035         : Half the following guesses are probably wrong... If you have better
2036         : tests or hints, please send them to perlbug@perl.com
2037         : The metaconfig authors would also appreciate a copy...
2038         $test -f /irix && osname=irix
2039         $test -f /xenix && osname=sco_xenix
2040         $test -f /dynix && osname=dynix
2041         $test -f /dnix && osname=dnix
2042         $test -f /lynx.os && osname=lynxos
2043         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2044         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2045         $test -f /bin/mips && /bin/mips && osname=mips
2046         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2047                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2048         $test -d /usr/apollo/bin && osname=apollo
2049         $test -f /etc/saf/_sactab && osname=svr4
2050         $test -d /usr/include/minix && osname=minix
2051         if $test -d /MachTen -o -d /MachTen_Folder; then
2052                 osname=machten
2053                 if $test -x /sbin/version; then
2054                         osvers=`/sbin/version | $awk '{print $2}' |
2055                         $sed -e 's/[A-Za-z]$//'`
2056                 elif $test -x /usr/etc/version; then
2057                         osvers=`/usr/etc/version | $awk '{print $2}' |
2058                         $sed -e 's/[A-Za-z]$//'`
2059                 else
2060                         osvers="$2.$3"
2061                 fi
2062         fi
2063        $test -f /sys/posix.dll &&
2064                $test -f /usr/bin/what &&
2065                set X `/usr/bin/what /sys/posix.dll` &&
2066                $test "$3" = UWIN &&
2067                osname=uwin &&
2068                osvers="$5"
2069         if $test -f $uname; then
2070                 set X $myuname
2071                 shift
2072
2073                 case "$5" in
2074                 fps*) osname=fps ;;
2075                 mips*)
2076                         case "$4" in
2077                         umips) osname=umips ;;
2078                         *) osname=mips ;;
2079                         esac;;
2080                 [23]100) osname=mips ;;
2081                 next*) osname=next ;;
2082                 i386*)
2083                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2084                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2085                                 osname='sco'
2086                                 osvers=$tmp
2087                         elif $test -f /etc/kconfig; then
2088                                 osname=isc
2089                                 if test "$lns" = "ln -s"; then
2090                                         osvers=4
2091                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2092                                         osvers=3
2093                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2094                                         osvers=2
2095                                 fi
2096                         fi
2097                         unset tmp
2098                         ;;
2099                 pc*)
2100                         if test -n "$DJGPP"; then
2101                                 osname=dos
2102                                 osvers=djgpp
2103                         fi
2104                         ;;
2105                 esac
2106
2107                 case "$1" in
2108                 aix) osname=aix
2109                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2110                         case "$tmp" in
2111                         'not found') osvers="$4"."$3" ;;
2112                         '<3240'|'<>3240') osvers=3.2.0 ;;
2113                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2114                         '=3250'|'>3250') osvers=3.2.5 ;;
2115                         *) osvers=$tmp;;
2116                         esac
2117                         ;;
2118                 *dc.osx) osname=dcosx
2119                         osvers="$3"
2120                         ;;
2121                 dnix) osname=dnix
2122                         osvers="$3"
2123                         ;;
2124                 domainos) osname=apollo
2125                         osvers="$3"
2126                         ;;
2127                 dgux) osname=dgux 
2128                         osvers="$3"
2129                         ;;
2130                 dynixptx*) osname=dynixptx
2131                         osvers=`echo "$4"|sed 's/^v//'`
2132                         ;;
2133                 freebsd) osname=freebsd 
2134                         osvers="$3" ;;
2135                 genix) osname=genix ;;
2136                 hp*) osname=hpux 
2137                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2138                         ;;
2139                 irix*) osname=irix
2140                         case "$3" in
2141                         4*) osvers=4 ;;
2142                         5*) osvers=5 ;;
2143                         *)      osvers="$3" ;;
2144                         esac
2145                         ;;
2146                 linux) osname=linux
2147                         case "$3" in
2148                         *)      osvers="$3" ;;
2149                         esac
2150                         ;;
2151                 MiNT) osname=mint
2152                         ;;
2153                 netbsd*) osname=netbsd
2154                         osvers="$3"
2155                         ;;
2156                 news-os) osvers="$3"
2157                         case "$3" in
2158                         4*) osname=newsos4 ;;
2159                         *) osname=newsos ;;
2160                         esac
2161                         ;;
2162                 bsd386) osname=bsd386
2163                         osvers=`$uname -r`
2164                         ;;
2165                 POSIX-BC | posix-bc ) osname=posix-bc
2166                         osvers="$3"
2167                         ;;
2168                 powerux | power_ux | powermax_os | powermaxos | \
2169                 powerunix | power_unix) osname=powerux
2170                         osvers="$3"
2171                         ;;
2172                 next*) osname=next ;;
2173                 solaris) osname=solaris
2174                         case "$3" in
2175                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2176                         *)      osvers="$3" ;;
2177                         esac
2178                         ;;
2179                 sunos) osname=sunos
2180                         case "$3" in
2181                         5*) osname=solaris
2182                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2183                         *)      osvers="$3" ;;
2184                         esac
2185                         ;;
2186                 titanos) osname=titanos
2187                         case "$3" in
2188                         1*) osvers=1 ;;
2189                         2*) osvers=2 ;;
2190                         3*) osvers=3 ;;
2191                         4*) osvers=4 ;;
2192                         *)      osvers="$3" ;;
2193                         esac
2194                         ;;
2195                 ultrix) osname=ultrix
2196                         osvers="$3"
2197                         ;;
2198                 osf1|mls+)      case "$5" in
2199                                 alpha)
2200                                         osname=dec_osf
2201                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2202                                         ;;
2203                         hp*)    osname=hp_osf1  ;;
2204                         mips)   osname=mips_osf1 ;;
2205                         esac
2206                         ;;
2207                 uts) osname=uts 
2208                         osvers="$3"
2209                         ;;
2210                 qnx) osname=qnx
2211                         osvers="$4"
2212                         ;;
2213                 $2) case "$osname" in
2214                         *isc*) ;;
2215                         *freebsd*) ;;
2216                         svr*)
2217                                 : svr4.x or possibly later
2218                                 case "svr$3" in 
2219                                 ${osname}*)
2220                                         osname=svr$3
2221                                         osvers=$4
2222                                         ;;
2223                                 esac
2224                                 case "$osname" in
2225                                 svr4.0)
2226                                         : Check for ESIX
2227                                         if test -f /stand/boot ; then
2228                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2229                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2230                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2231                                                         if test -n "$isesix"; then
2232                                                                 osname=esix4
2233                                                         fi
2234                                                 fi
2235                                         fi
2236                                         ;;
2237                                 esac
2238                                 ;;
2239                         *)      if test -f /etc/systemid; then
2240                                         osname=sco
2241                                         set `echo $3 | $sed 's/\./ /g'` $4
2242                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2243                                                 osvers=$1.$2.$3
2244                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2245                                                 osvers=$1.$2
2246                                         elif $test -f $src/hints/sco_$1.sh; then
2247                                                 osvers=$1
2248                                         fi
2249                                 else
2250                                         case "$osname" in
2251                                         '') : Still unknown.  Probably a generic Sys V.
2252                                                 osname="sysv"
2253                                                 osvers="$3"
2254                                                 ;;
2255                                         esac
2256                                 fi
2257                                 ;;
2258                         esac
2259                         ;;
2260                 *)      case "$osname" in
2261                         '') : Still unknown.  Probably a generic BSD.
2262                                 osname="$1"
2263                                 osvers="$3"
2264                                 ;;
2265                         esac
2266                         ;;
2267                 esac
2268         else
2269                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2270                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2271                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2272                                 osname=news_os
2273                         fi
2274                         $rm -f UU/kernel.what
2275                 elif test -d c:/.; then
2276                         set X $myuname
2277                         osname=os2
2278                         osvers="$5"
2279                 fi
2280         fi
2281         
2282         : Now look for a hint file osname_osvers, unless one has been
2283         : specified already.
2284         case "$hintfile" in
2285         ''|' ')
2286                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2287                 : Also try without trailing minor version numbers.
2288                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2289                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2290                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2291                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2292                 case "$file" in
2293                 '') dflt=none ;;
2294                 *)  case "$osvers" in
2295                         '') dflt=$file
2296                                 ;;
2297                         *)  if $test -f $src/hints/$file.sh ; then
2298                                         dflt=$file
2299                                 elif $test -f $src/hints/$xfile.sh ; then
2300                                         dflt=$xfile
2301                                 elif $test -f $src/hints/$xxfile.sh ; then
2302                                         dflt=$xxfile
2303                                 elif $test -f $src/hints/$xxxfile.sh ; then
2304                                         dflt=$xxxfile
2305                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2306                                         dflt=$xxxxfile
2307                                 elif $test -f "$src/hints/${osname}.sh" ; then
2308                                         dflt="${osname}"
2309                                 else
2310                                         dflt=none
2311                                 fi
2312                                 ;;
2313                         esac
2314                         ;;
2315                 esac
2316                 if $test -f Policy.sh ; then
2317                         case "$dflt" in
2318                         *Policy*) ;;
2319                         none) dflt="Policy" ;;
2320                         *) dflt="Policy $dflt" ;;
2321                         esac
2322                 fi
2323                 ;;
2324         *)
2325                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2326                 ;;
2327         esac
2328
2329         if $test -f Policy.sh ; then
2330                 $cat <<EOM
2331
2332 There's also a Policy hint file available, which should make the
2333 site-specific (policy) questions easier to answer.
2334 EOM
2335
2336         fi
2337
2338         $cat <<EOM
2339
2340 You may give one or more space-separated answers, or "none" if appropriate.
2341 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2342 is a good thing.  DO NOT give a wrong version.
2343
2344 EOM
2345
2346         rp="Which of these apply, if any?"
2347         . UU/myread
2348         tans=$ans
2349         for file in $tans; do
2350                 if $test X$file = XPolicy -a -f Policy.sh; then
2351                         . Policy.sh
2352                         $cat Policy.sh >> UU/config.sh
2353                 elif $test -f $src/hints/$file.sh; then
2354                         . $src/hints/$file.sh
2355                         $cat $src/hints/$file.sh >> UU/config.sh
2356                 elif $test X$tans = X -o X$tans = Xnone ; then
2357                         : nothing
2358                 else
2359                         : Give one chance to correct a possible typo.
2360                         echo "$file.sh does not exist"
2361                         dflt=$file
2362                         rp="hint to use instead?"
2363                         . UU/myread
2364                         for file in $ans; do
2365                                 if $test -f "$src/hints/$file.sh"; then
2366                                         . $src/hints/$file.sh
2367                                         $cat $src/hints/$file.sh >> UU/config.sh
2368                                 elif $test X$ans = X -o X$ans = Xnone ; then
2369                                         : nothing
2370                                 else
2371                                         echo "$file.sh does not exist -- ignored."
2372                                 fi
2373                         done
2374                 fi
2375         done
2376
2377         hint=recommended
2378         : Remember our hint file for later.
2379         if $test -f "$src/hints/$file.sh" ; then
2380                 hintfile="$file"
2381         else
2382                 hintfile=''
2383         fi
2384 fi
2385 cd UU
2386 ;;
2387 *)
2388         echo " "
2389         echo "Fetching default answers from $config_sh..." >&4
2390         tmp_n="$n"
2391         tmp_c="$c"
2392         cd ..
2393         cp $config_sh config.sh 2>/dev/null
2394         chmod +w config.sh
2395         . ./config.sh
2396         cd UU
2397         cp ../config.sh .
2398         n="$tmp_n"
2399         c="$tmp_c"
2400         hint=previous
2401         ;;
2402 esac
2403 test "$override" && . ./optdef.sh
2404 myuname="$newmyuname"
2405
2406 : Restore computed paths
2407 for file in $loclist $trylist; do
2408         eval $file="\$_$file"
2409 done
2410
2411 cat << EOM
2412
2413 Configure uses the operating system name and version to set some defaults.
2414 The default value is probably right if the name rings a bell. Otherwise,
2415 since spelling matters for me, either accept the default or answer "none"
2416 to leave it blank.
2417
2418 EOM
2419 case "$osname" in
2420         ''|' ')
2421                 case "$hintfile" in
2422                 ''|' '|none) dflt=none ;;
2423                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2424                 esac
2425                 ;;
2426         *) dflt="$osname" ;;
2427 esac
2428 rp="Operating system name?"
2429 . ./myread
2430 case "$ans" in
2431 none)  osname='' ;;
2432 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2433 esac
2434 echo " "
2435 case "$osvers" in
2436         ''|' ')
2437                 case "$hintfile" in
2438                 ''|' '|none) dflt=none ;;
2439                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2440                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2441                         case "$dflt" in
2442                         ''|' ') dflt=none ;;
2443                         esac
2444                         ;;
2445                 esac
2446                 ;;
2447         *) dflt="$osvers" ;;
2448 esac
2449 rp="Operating system version?"
2450 . ./myread
2451 case "$ans" in
2452 none)  osvers='' ;;
2453 *) osvers="$ans" ;;
2454 esac
2455
2456 : who configured the system
2457 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2458 cf_by=`(logname) 2>/dev/null`
2459 case "$cf_by" in
2460 "")
2461         cf_by=`(whoami) 2>/dev/null`
2462         case "$cf_by" in
2463         "") cf_by=unknown ;;
2464         esac ;;
2465 esac
2466
2467 : set up the script used to warn in case of inconsistency
2468 cat <<EOS >whoa
2469 $startsh
2470 EOS
2471 cat <<'EOSC' >>whoa
2472 dflt=y
2473 echo " "
2474 echo "*** WHOA THERE!!! ***" >&4
2475 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2476 rp="    Keep the $hint value?"
2477 . ./myread
2478 case "$ans" in
2479 y) td=$was; tu=$was;;
2480 esac
2481 EOSC
2482
2483 : function used to set $1 to $val
2484 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2485 case "$val$was" in
2486 $define$undef) . ./whoa; eval "$var=\$td";;
2487 $undef$define) . ./whoa; eval "$var=\$tu";;
2488 *) eval "$var=$val";;
2489 esac'
2490
2491 cat <<EOM
2492
2493 Perl can be built to take advantage of threads, on some systems.
2494 To do so, Configure must be run with -Dusethreads.
2495
2496 Note that threading is a highly experimental feature, and
2497 some known race conditions still remain.  If you choose to try
2498 it, be very sure to not actually deploy it for production
2499 purposes.  README.threads has more details, and is required
2500 reading if you enable threads.
2501 EOM
2502 case "$usethreads" in
2503 $define|true|[yY]*)     dflt='y';;
2504 *) dflt='n';;
2505 esac
2506 rp='Build a threading Perl?'
2507 . ./myread
2508 case "$ans" in
2509 y|Y)    val="$define" ;;     
2510 *)      val="$undef" ;;
2511 esac
2512 set usethreads
2513 eval $setvar 
2514
2515 case "$d_oldpthreads" in
2516 '')     : Configure tests would be welcome here.  For now, assume undef.
2517         val="$undef" ;;
2518 *)      val="$d_oldpthreads" ;;
2519 esac
2520 set d_oldpthreads
2521 eval $setvar
2522
2523
2524 case "$usethreads" in
2525 "$define"|true|[yY]*)
2526 : Look for a hint-file generated 'call-back-unit'.  If the
2527 : user has specified that a threading perl is to be built,
2528 : we may need to set or change some other defaults.
2529         if $test -f usethreads.cbu; then
2530                 . ./usethreads.cbu
2531         fi
2532         case "$osname" in
2533         aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|next|openbsd|os2|solaris|vmesa)
2534                 # Known thread-capable platforms.
2535                 ;;
2536         *)
2537                 cat >&4 <<EOM
2538 $osname is not known to support threads.
2539 Please let perlbug@perl.com know how to do that.
2540
2541 Cannot continue, aborting.
2542 EOM
2543                 exit 1
2544         ;;
2545         esac # $osname
2546     ;;
2547 esac # $usethreads
2548
2549 cat <<EOM
2550
2551 Perl can be built so that multiple Perl interpreters can coexist
2552 within the same Perl executable.  To do so, Configure must be run with
2553 -Dusemultiplicity.
2554
2555 Normally you do not need this and you should answer no.
2556
2557 EOM
2558 case "$usemultiplicity" in
2559 $define|true|[yY]*)     dflt='y';;
2560 *) dflt='n';;
2561 esac
2562 rp='Build Perl for multiplicity?'
2563 . ./myread
2564 case "$ans" in
2565 y|Y)    val="$define" ;;     
2566 *)      val="$undef" ;;
2567 esac
2568 set usemultiplicity
2569 eval $setvar 
2570
2571 cat <<EOM
2572
2573 Perl can be built to take advantage of explicit 64-bit interfaces,
2574 on some systems.  To do so, Configure must be run with -Duse64bits.
2575
2576 If this doesn't make any sense to you, just accept the default 'n'.
2577 EOM
2578 case "$use64bits" in
2579 $define|true|[yY]*)     dflt='y';;
2580 *) dflt='n';;
2581 esac
2582 rp='Try to use explicit 64-bit interfaces, if available?'
2583 . ./myread
2584 case "$ans" in
2585 y|Y) 
2586         val="$define"
2587         ;;     
2588 *)      
2589         val="$undef"
2590         ;;
2591 esac
2592 set use64bits
2593 eval $setvar
2594
2595 case "$archname64" in
2596 '') archname64='' ;;    # not a typo
2597 esac
2598
2599 case "$use64bits" in
2600 "$define"|true|[yY]*)
2601 : Look for a hint-file generated 'call-back-unit'.  If the
2602 : user has specified that a threading perl is to be built,
2603 : we may need to set or change some other defaults.
2604         if $test -f use64bits.cbu; then
2605                 . ./use64bits.cbu
2606         fi
2607         case "$osname" in
2608         dec_osf|hpux|irix|solaris|unicos)
2609                 # Known 64-bit capable platforms.
2610                 ;;
2611         *)
2612                 cat >&4 <<EOM
2613 $osname is not known to support 64-bit interfaces.
2614 Please let perlbug@perl.com know how to do that.
2615
2616 Cannot continue, aborting.
2617 EOM
2618                 exit 1
2619                 ;;
2620         esac
2621         ;;
2622 esac
2623
2624 : determine the architecture name
2625 echo " "
2626 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2627         tarch=`arch`"-$osname"
2628 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2629         if uname -m > tmparch 2>&1 ; then
2630                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2631                         -e 's/$/'"-$osname/" tmparch`
2632         else
2633                 tarch="$osname"
2634         fi
2635         $rm -f tmparch
2636 else
2637         tarch="$osname"
2638 fi
2639 case "$myarchname" in
2640 ''|"$tarch") ;;
2641 *)
2642         echo "(Your architecture name used to be $myarchname.)"
2643         archname=''
2644         ;;
2645 esac
2646 myarchname="$tarch"
2647 case "$archname" in
2648 '') dflt="$tarch";;
2649 *) dflt="$archname";;
2650 esac
2651 rp='What is your architecture name'
2652 . ./myread
2653 archname="$ans"
2654 case "$usethreads" in
2655 $define)
2656         echo "Threads selected." >&4
2657         case "$archname" in
2658         *-thread*) echo "...and architecture name already has -thread." >&4
2659                 ;;
2660         *)      archname="$archname-thread"
2661                 echo "...setting architecture name to $archname." >&4
2662                 ;;
2663         esac
2664         ;;
2665 esac
2666 case "$usemultiplicity" in
2667 $define)
2668         echo "Multiplicity selected." >&4
2669         case "$archname" in
2670         *-multi*) echo "...and architecture name already has -multi." >&4
2671                 ;;
2672         *)      archname="$archname-multi"
2673                 echo "...setting architecture name to $archname." >&4
2674                 ;;
2675         esac
2676         ;;
2677 esac
2678 case "$use64bits" in
2679 $define)
2680         echo "Explicit 64-bitness selected." >&4
2681         case "$archname64" in
2682         '')
2683                 ;;
2684         *)
2685                 case "$archname" in
2686                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2687                         ;;
2688                 *)      archname="$archname-$archname64"
2689                         echo "...setting architecture name to $archname." >&4
2690                         ;;
2691                 esac
2692                 ;;
2693         esac
2694 esac
2695
2696 : is AFS running?
2697 echo " "
2698 case "$afs" in
2699 $define|true)   afs=true ;;
2700 $undef|false)   afs=false ;;
2701 *)      if test -d /afs; then
2702                 afs=true
2703         else
2704                 afs=false
2705         fi
2706         ;;
2707 esac
2708 if $afs; then
2709         echo "AFS may be running... I'll be extra cautious then..." >&4
2710 else
2711         echo "AFS does not seem to be running..." >&4
2712 fi
2713
2714 : decide how portable to be.  Allow command line overrides.
2715 case "$d_portable" in
2716 "$undef") ;;
2717 *)      d_portable="$define" ;;
2718 esac
2719
2720 : set up shell script to do ~ expansion
2721 cat >filexp <<EOSS
2722 $startsh
2723 : expand filename
2724 case "\$1" in
2725  ~/*|~)
2726         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2727         ;;
2728  ~*)
2729         if $test -f /bin/csh; then
2730                 /bin/csh -f -c "glob \$1"
2731                 failed=\$?
2732                 echo ""
2733                 exit \$failed
2734         else
2735                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2736                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2737                 if $test ! -d "\$dir"; then
2738                         me=\`basename \$0\`
2739                         echo "\$me: can't locate home directory for: \$name" >&2
2740                         exit 1
2741                 fi
2742                 case "\$1" in
2743                 */*)
2744                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2745                         ;;
2746                 *)
2747                         echo \$dir
2748                         ;;
2749                 esac
2750         fi
2751         ;;
2752 *)
2753         echo \$1
2754         ;;
2755 esac
2756 EOSS
2757 chmod +x filexp
2758 $eunicefix filexp
2759
2760 : now set up to get a file name
2761 cat <<EOS >getfile
2762 $startsh
2763 EOS
2764 cat <<'EOSC' >>getfile
2765 tilde=''
2766 fullpath=''
2767 already=''
2768 skip=''
2769 none_ok=''
2770 exp_file=''
2771 nopath_ok=''
2772 orig_rp="$rp"
2773 orig_dflt="$dflt"
2774
2775 case "$fn" in
2776 *\(*)
2777         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2778         fn=`echo $fn | sed 's/(.*)//'`
2779         ;;
2780 esac
2781
2782 case "$fn" in
2783 *:*)
2784         loc_file=`expr $fn : '.*:\(.*\)'`
2785         fn=`expr $fn : '\(.*\):.*'`
2786         ;;
2787 esac
2788
2789 case "$fn" in
2790 *~*) tilde=true;;
2791 esac
2792 case "$fn" in
2793 */*) fullpath=true;;
2794 esac
2795 case "$fn" in
2796 *+*) skip=true;;
2797 esac
2798 case "$fn" in
2799 *n*) none_ok=true;;
2800 esac
2801 case "$fn" in
2802 *e*) exp_file=true;;
2803 esac
2804 case "$fn" in
2805 *p*) nopath_ok=true;;
2806 esac
2807
2808 case "$fn" in
2809 *f*) type='File';;
2810 *d*) type='Directory';;
2811 *l*) type='Locate';;
2812 esac
2813
2814 what="$type"
2815 case "$what" in
2816 Locate) what='File';;
2817 esac
2818
2819 case "$exp_file" in
2820 '')
2821         case "$d_portable" in
2822         "$define") ;;
2823         *) exp_file=true;;
2824         esac
2825         ;;
2826 esac
2827
2828 cd ..
2829 while test "$type"; do
2830         redo=''
2831         rp="$orig_rp"
2832         dflt="$orig_dflt"
2833         case "$tilde" in
2834         true) rp="$rp (~name ok)";;
2835         esac
2836         . UU/myread
2837         if test -f UU/getfile.ok && \
2838                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2839         then
2840                 value="$ans"
2841                 ansexp="$ans"
2842                 break
2843         fi
2844         case "$ans" in
2845         none)
2846                 value=''
2847                 ansexp=''
2848                 case "$none_ok" in
2849                 true) type='';;
2850                 esac
2851                 ;;
2852         *)
2853                 case "$tilde" in
2854                 '') value="$ans"
2855                         ansexp="$ans";;
2856                 *)
2857                         value=`UU/filexp $ans`
2858                         case $? in
2859                         0)
2860                                 if test "$ans" != "$value"; then
2861                                         echo "(That expands to $value on this system.)"
2862                                 fi
2863                                 ;;
2864                         *) value="$ans";;
2865                         esac
2866                         ansexp="$value"
2867                         case "$exp_file" in
2868                         '') value="$ans";;
2869                         esac
2870                         ;;
2871                 esac
2872                 case "$fullpath" in
2873                 true)
2874                         case "$ansexp" in
2875                         /*) value="$ansexp" ;;
2876                         *)
2877                                 redo=true
2878                                 case "$already" in
2879                                 true)
2880                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2881                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2882                                         ;;
2883                                 *)
2884                                 echo "Please give a full path name, starting with slash." >&4
2885                                         case "$tilde" in
2886                                         true)
2887                                 echo "Note that using ~name is ok provided it expands well." >&4
2888                                                 already=true
2889                                                 ;;
2890                                         esac
2891                                 esac
2892                                 ;;
2893                         esac
2894                         ;;
2895                 esac
2896                 case "$redo" in
2897                 '')
2898                         case "$type" in
2899                         File)
2900                                 if test -f "$ansexp"; then
2901                                         type=''
2902                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2903                                 then
2904                                         echo "($value is not a plain file, but that's ok.)"
2905                                         type=''
2906                                 fi
2907                                 ;;
2908                         Directory)
2909                                 if test -d "$ansexp"; then
2910                                         type=''
2911                                 fi
2912                                 ;;
2913                         Locate)
2914                                 if test -d "$ansexp"; then
2915                                         echo "(Looking for $loc_file in directory $value.)"
2916                                         value="$value/$loc_file"
2917                                         ansexp="$ansexp/$loc_file"
2918                                 fi
2919                                 if test -f "$ansexp"; then
2920                                         type=''
2921                                 fi
2922                                 case "$nopath_ok" in
2923                                 true)   case "$value" in
2924                                         */*) ;;
2925                                         *)      echo "Assuming $value will be in people's path."
2926                                                 type=''
2927                                                 ;;
2928                                         esac
2929                                         ;;
2930                                 esac
2931                                 ;;
2932                         esac
2933
2934                         case "$skip" in
2935                         true) type='';
2936                         esac
2937
2938                         case "$type" in
2939                         '') ;;
2940                         *)
2941                                 if test "$fastread" = yes; then
2942                                         dflt=y
2943                                 else
2944                                         dflt=n
2945                                 fi
2946                                 rp="$what $value doesn't exist.  Use that name anyway?"
2947                                 . UU/myread
2948                                 dflt=''
2949                                 case "$ans" in
2950                                 y*) type='';;
2951                                 *) echo " ";;
2952                                 esac
2953                                 ;;
2954                         esac
2955                         ;;
2956                 esac
2957                 ;;
2958         esac
2959 done
2960 cd UU
2961 ans="$value"
2962 rp="$orig_rp"
2963 dflt="$orig_dflt"
2964 rm -f getfile.ok
2965 EOSC
2966
2967 : determine root of directory hierarchy where package will be installed.
2968 case "$prefix" in
2969 '')
2970         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2971         ;;
2972 *)
2973         dflt="$prefix"
2974         ;;
2975 esac
2976 $cat <<EOM
2977
2978 By default, $package will be installed in $dflt/bin, manual
2979 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2980 all installation directories. Typically set to /usr/local, but you
2981 may choose /usr if you wish to install $package among your system
2982 binaries. If you wish to have binaries under /bin but manual pages
2983 under /usr/local/man, that's ok: you will be prompted separately
2984 for each of the installation directories, the prefix being only used
2985 to set the defaults.
2986
2987 EOM
2988 fn=d~
2989 rp='Installation prefix to use?'
2990 . ./getfile
2991 oldprefix=''
2992 case "$prefix" in
2993 '') ;;
2994 *)
2995         case "$ans" in
2996         "$prefix") ;;
2997         *) oldprefix="$prefix";;
2998         esac
2999         ;;
3000 esac
3001 prefix="$ans"
3002 prefixexp="$ansexp"
3003
3004 : set the prefixit variable, to compute a suitable default value
3005 prefixit='case "$3" in
3006 ""|none)
3007         case "$oldprefix" in
3008         "") eval "$1=\"\$$2\"";;
3009         *)
3010                 case "$3" in
3011                 "") eval "$1=";;
3012                 none)
3013                         eval "tp=\"\$$2\"";
3014                         case "$tp" in
3015                         ""|" ") eval "$1=\"\$$2\"";;
3016                         *) eval "$1=";;
3017                         esac;;
3018                 esac;;
3019         esac;;
3020 *)
3021         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3022         case "$tp" in
3023         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3024         /*-$oldprefix/*|\~*-$oldprefix/*)
3025                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3026         *) eval "$1=\"\$$2\"";;
3027         esac;;
3028 esac'
3029
3030 : set the base revision
3031 baserev=5.0
3032
3033 : get the patchlevel
3034 echo " "
3035 echo "Getting the current patchlevel..." >&4
3036 if $test -r $rsrc/patchlevel.h;then
3037         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3038         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3039 else
3040         patchlevel=0
3041         subversion=0
3042 fi
3043 $echo $n "(You have $package" $c
3044 case "$package" in
3045 "*$baserev")    ;;
3046 *)              $echo $n " $baserev" $c ;;
3047 esac
3048 $echo $n " patchlevel $patchlevel" $c
3049 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3050 echo ".)"
3051
3052 if test 0 -eq "$subversion"; then
3053         version=`LC_ALL=C; export LC_ALL; \
3054                  echo $baserev $patchlevel | \
3055                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3056 else
3057         version=`LC_ALL=C; export LC_ALL; \
3058                  echo $baserev $patchlevel $subversion | \
3059                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3060 fi
3061 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3062 if test "$subversion" -lt 50; then
3063         apiversion=`LC_ALL=C; export LC_ALL; \
3064                  LANGUAGE=C; export LANGUAGE; \
3065                  echo $baserev $patchlevel | \
3066                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3067 else
3068         apiversion="$version"
3069 fi
3070
3071 : determine where private library files go
3072 : Usual default is /usr/local/lib/perl5/$version.
3073 : Also allow things like /opt/perl/lib/$version, since 
3074 : /opt/perl/lib/perl5... would be redundant.
3075 case "$prefix" in
3076 *perl*) set dflt privlib lib/$version ;;
3077 *)       set dflt privlib lib/$package/$version ;;
3078 esac
3079 eval $prefixit
3080 $cat <<EOM
3081
3082 There are some auxiliary files for $package that need to be put into a
3083 private library directory that is accessible by everyone.
3084
3085 EOM
3086 fn=d~+
3087 rp='Pathname where the private library files will reside?'
3088 . ./getfile
3089 if $test "X$privlibexp" != "X$ansexp"; then
3090         installprivlib=''
3091 fi
3092 privlib="$ans"
3093 privlibexp="$ansexp"
3094 if $afs; then
3095         $cat <<EOM
3096
3097 Since you are running AFS, I need to distinguish the directory in which
3098 private files reside from the directory in which they are installed (and from
3099 which they are presumably copied to the former directory by occult means).
3100
3101 EOM
3102         case "$installprivlib" in
3103         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3104         *) dflt="$installprivlib";;
3105         esac
3106         fn=de~
3107         rp='Where will private files be installed?'
3108         . ./getfile
3109         installprivlib="$ans"
3110 else
3111         installprivlib="$privlibexp"
3112 fi
3113
3114 : set the prefixup variable, to restore leading tilda escape
3115 prefixup='case "$prefixexp" in
3116 "$prefix") ;;
3117 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3118 esac'
3119
3120 : determine where public architecture dependent libraries go
3121 set archlib archlib
3122 eval $prefixit
3123 : privlib default is /usr/local/lib/$package/$version
3124 : archlib default is /usr/local/lib/$package/$version/$archname
3125 : privlib may have an optional trailing /share.
3126 tdflt=`echo $privlib | $sed 's,/share$,,'`
3127 tdflt=$tdflt/$archname
3128 case "$archlib" in
3129 '')     dflt=$tdflt
3130         ;;
3131 *)      dflt="$archlib"
3132     ;;
3133 esac
3134 cat <<EOM
3135
3136 $spackage contains architecture-dependent library files.  If you are
3137 sharing libraries in a heterogeneous environment, you might store
3138 these files in a separate location.  Otherwise, you can just include
3139 them with the rest of the public library files.
3140
3141 EOM
3142 fn=d+~
3143 rp='Where do you want to put the public architecture-dependent libraries?'
3144 . ./getfile
3145 archlib="$ans"
3146 archlibexp="$ansexp"
3147
3148 if $afs; then
3149         $cat <<EOM
3150
3151 Since you are running AFS, I need to distinguish the directory in
3152 which architecture-dependent library files reside from the directory
3153 in which they are installed (and from which they are presumably copied
3154 to the former directory by occult means).
3155
3156 EOM
3157         case "$installarchlib" in
3158         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3159         *) dflt="$installarchlib";;
3160         esac
3161         fn=de~
3162         rp='Where will architecture-dependent library files be installed?'
3163         . ./getfile
3164         installarchlib="$ans"
3165 else
3166         installarchlib="$archlibexp"
3167 fi
3168 if $test X"$archlib" = X"$privlib"; then
3169         d_archlib="$undef"
3170 else
3171         d_archlib="$define"
3172 fi
3173
3174 : make some quick guesses about what we are up against
3175 echo " "
3176 $echo $n "Hmm...  $c"
3177 echo exit 1 >bsd
3178 echo exit 1 >usg
3179 echo exit 1 >v7
3180 echo exit 1 >osf1
3181 echo exit 1 >eunice
3182 echo exit 1 >xenix
3183 echo exit 1 >venix
3184 echo exit 1 >os2
3185 d_bsd="$undef"
3186 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3187 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3188 then
3189         echo "Looks kind of like an OSF/1 system, but we'll see..."
3190         echo exit 0 >osf1
3191 elif test `echo abc | tr a-z A-Z` = Abc ; then
3192         xxx=`./loc addbib blurfl $pth`
3193         if $test -f $xxx; then
3194         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3195                 echo exit 0 >bsd
3196                 echo exit 0 >usg
3197         else
3198                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3199                         echo "Looks kind of like an extended USG system, but we'll see..."
3200                 else
3201                         echo "Looks kind of like a USG system, but we'll see..."
3202                 fi
3203                 echo exit 0 >usg
3204         fi
3205 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3206         echo "Looks kind of like a BSD system, but we'll see..."
3207         d_bsd="$define"
3208         echo exit 0 >bsd
3209 else
3210         echo "Looks kind of like a Version 7 system, but we'll see..."
3211         echo exit 0 >v7
3212 fi
3213 case "$eunicefix" in
3214 *unixtovms*)
3215         $cat <<'EOI'
3216 There is, however, a strange, musty smell in the air that reminds me of
3217 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3218 EOI
3219         echo exit 0 >eunice
3220         d_eunice="$define"
3221 : it so happens the Eunice I know will not run shell scripts in Unix format
3222         ;;
3223 *)
3224         echo " "
3225         echo "Congratulations.  You aren't running Eunice."
3226         d_eunice="$undef"
3227         ;;
3228 esac
3229 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3230 case "$p_" in
3231 :) ;;
3232 *)
3233         $cat <<'EOI'
3234 I have the feeling something is not exactly right, however...don't tell me...
3235 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3236 EOI
3237         echo exit 0 >os2
3238         ;;
3239 esac
3240 if test -f /xenix; then
3241         echo "Actually, this looks more like a XENIX system..."
3242         echo exit 0 >xenix
3243         d_xenix="$define"
3244 else
3245         echo " "
3246         echo "It's not Xenix..."
3247         d_xenix="$undef"
3248 fi
3249 chmod +x xenix
3250 $eunicefix xenix
3251 if test -f /venix; then
3252         echo "Actually, this looks more like a VENIX system..."
3253         echo exit 0 >venix
3254 else
3255         echo " "
3256         if ./xenix; then
3257                 : null
3258         else
3259                 echo "Nor is it Venix..."
3260         fi
3261 fi
3262 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3263 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3264 $rm -f foo
3265
3266 : see if setuid scripts can be secure
3267 $cat <<EOM
3268
3269 Some kernels have a bug that prevents setuid #! scripts from being
3270 secure.  Some sites have disabled setuid #! scripts because of this.
3271
3272 First let's decide if your kernel supports secure setuid #! scripts.
3273 (If setuid #! scripts would be secure but have been disabled anyway,
3274 don't say that they are secure if asked.)
3275
3276 EOM
3277
3278 val="$undef"
3279 if $test -d /dev/fd; then
3280         echo "#!$ls" >reflect
3281         chmod +x,u+s reflect
3282         ./reflect >flect 2>&1
3283         if $contains "/dev/fd" flect >/dev/null; then
3284                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3285                 val="$define"
3286         else
3287                 $cat <<EOM
3288 If you are not sure if they are secure, I can check but I'll need a
3289 username and password different from the one you are using right now.
3290 If you don't have such a username or don't want me to test, simply
3291 enter 'none'.
3292
3293 EOM
3294                 rp='Other username to test security of setuid scripts with?'
3295                 dflt='none'
3296                 . ./myread
3297                 case "$ans" in
3298                 n|none)
3299                         case "$d_suidsafe" in
3300                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3301                                 dflt=n;;
3302                         "$undef")
3303                                 echo "Well, the $hint value is *not* secure." >&4
3304                                 dflt=n;;
3305                         *)      echo "Well, the $hint value *is* secure." >&4
3306                                 dflt=y;;
3307                         esac
3308                         ;;
3309                 *)
3310                         $rm -f reflect flect
3311                         echo "#!$ls" >reflect
3312                         chmod +x,u+s reflect
3313                         echo >flect
3314                         chmod a+w flect
3315                         echo '"su" will (probably) prompt you for '"$ans's password."
3316                         su $ans -c './reflect >flect'
3317                         if $contains "/dev/fd" flect >/dev/null; then
3318                                 echo "Okay, it looks like setuid scripts are secure." >&4
3319                                 dflt=y
3320                         else
3321                                 echo "I don't think setuid scripts are secure." >&4
3322                                 dflt=n
3323                         fi
3324                         ;;
3325                 esac
3326                 rp='Does your kernel have *secure* setuid scripts?'
3327                 . ./myread
3328                 case "$ans" in
3329                 [yY]*)  val="$define";;
3330                 *)      val="$undef";;
3331                 esac
3332         fi
3333 else
3334         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3335         echo "(That's for file descriptors, not floppy disks.)"
3336         val="$undef"
3337 fi
3338 set d_suidsafe
3339 eval $setvar
3340
3341 $rm -f reflect flect
3342
3343 : now see if they want to do setuid emulation
3344 echo " "
3345 val="$undef"
3346 case "$d_suidsafe" in
3347 "$define")
3348         val="$undef"
3349         echo "No need to emulate SUID scripts since they are secure here." >& 4
3350         ;;
3351 *)
3352         $cat <<EOM
3353 Some systems have disabled setuid scripts, especially systems where
3354 setuid scripts cannot be secure.  On systems where setuid scripts have
3355 been disabled, the setuid/setgid bits on scripts are currently
3356 useless.  It is possible for $package to detect those bits and emulate
3357 setuid/setgid in a secure fashion.  This emulation will only work if
3358 setuid scripts have been disabled in your kernel.
3359
3360 EOM
3361         case "$d_dosuid" in
3362         "$define") dflt=y ;;
3363         *) dflt=n ;;
3364         esac
3365         rp="Do you want to do setuid/setgid emulation?"
3366         . ./myread
3367         case "$ans" in
3368         [yY]*)  val="$define";;
3369         *)      val="$undef";;
3370         esac
3371         ;;
3372 esac
3373 set d_dosuid
3374 eval $setvar
3375
3376 : determine where manual pages are on this system
3377 echo " "
3378 case "$sysman" in
3379 '') 
3380         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3381         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3382         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3383         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3384         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3385         sysman=`./loc . /usr/man/man1 $syspath`
3386         ;;
3387 esac
3388 if $test -d "$sysman"; then
3389         echo "System manual is in $sysman." >&4
3390 else
3391         echo "Could not find manual pages in source form." >&4
3392 fi
3393
3394 : see what memory models we can support
3395 case "$models" in
3396 '')
3397         $cat >pdp11.c <<'EOP'
3398 int main() {
3399 #ifdef pdp11
3400         exit(0);
3401 #else
3402         exit(1);
3403 #endif
3404 }
3405 EOP
3406         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3407         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3408                 dflt='unsplit split'
3409         else
3410                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3411                 case "$tans" in
3412                 X) dflt='none';;
3413                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3414                                 dflt='small'
3415                         else
3416                                 dflt=''
3417                         fi
3418                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3419                                 dflt="$dflt medium"
3420                         fi
3421                         if $test -d /lib/large || $test -d /usr/lib/large; then
3422                                 dflt="$dflt large"
3423                         fi
3424                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3425                                 dflt="$dflt huge"
3426                         fi
3427                 esac
3428         fi;;
3429 *) dflt="$models";;
3430 esac
3431 $cat <<EOM
3432  
3433 Some systems have different model sizes.  On most systems they are called
3434 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3435 split.  If your system doesn't support different memory models, say "none".
3436 If you wish to force everything to one memory model, say "none" here and
3437 put the appropriate flags later when it asks you for other cc and ld flags.
3438 Venix systems may wish to put "none" and let the compiler figure things out.
3439 (In the following question multiple model names should be space separated.)
3440
3441 The default for most systems is "none".
3442
3443 EOM
3444 rp="Which memory models are supported?"
3445 . ./myread
3446 models="$ans"
3447
3448 case "$models" in
3449 none)
3450         small=''
3451         medium=''
3452         large=''
3453         huge=''
3454         unsplit=''
3455         split=''
3456         ;;
3457 *split)
3458         case "$split" in
3459         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3460                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3461                         dflt='-i'
3462                 else
3463                         dflt='none'
3464                 fi;;
3465         *) dflt="$split";;
3466         esac
3467         rp="What flag indicates separate I and D space?"
3468         . ./myread
3469         tans="$ans"
3470         case "$tans" in
3471         none) tans='';;
3472         esac
3473         split="$tans"
3474         unsplit='';;
3475 *large*|*small*|*medium*|*huge*)
3476         case "$models" in
3477         *large*)
3478                 case "$large" in
3479                 '') dflt='-Ml';;
3480                 *) dflt="$large";;
3481                 esac
3482         rp="What flag indicates large model?"
3483         . ./myread
3484         tans="$ans"
3485         case "$tans" in
3486         none) tans='';
3487         esac
3488         large="$tans";;
3489         *) large='';;
3490         esac
3491         case "$models" in
3492         *huge*) case "$huge" in
3493                 '') dflt='-Mh';;
3494                 *) dflt="$huge";;
3495                 esac
3496                 rp="What flag indicates huge model?"
3497                 . ./myread
3498                 tans="$ans"
3499                 case "$tans" in
3500                 none) tans='';
3501                 esac
3502                 huge="$tans";;
3503         *) huge="$large";;
3504         esac
3505         case "$models" in
3506         *medium*) case "$medium" in
3507                 '') dflt='-Mm';;
3508                 *) dflt="$medium";;
3509                 esac
3510                 rp="What flag indicates medium model?"
3511                 . ./myread
3512                 tans="$ans"
3513                 case "$tans" in
3514                 none) tans='';
3515                 esac
3516                 medium="$tans";;
3517         *) medium="$large";;
3518         esac
3519         case "$models" in
3520         *small*) case "$small" in
3521                 '') dflt='none';;
3522                 *) dflt="$small";;
3523                 esac
3524                 rp="What flag indicates small model?"
3525                 . ./myread
3526                 tans="$ans"
3527                 case "$tans" in
3528                 none) tans='';
3529                 esac
3530                 small="$tans";;
3531         *) small='';;
3532         esac
3533         ;;
3534 *)
3535         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3536         ;;
3537 esac
3538 $rm -f pdp11.* pdp11
3539
3540 : see if we need a special compiler
3541 echo " "
3542 if ./usg; then
3543         case "$cc" in
3544         '') case "$Mcc" in
3545                 /*) dflt='Mcc';;
3546                 *) case "$large" in
3547                         -M*) dflt='cc';;
3548                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3549                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3550                                                 dflt='cc'
3551                                         else
3552                                                 dflt='cc -M'
3553                                         fi
3554                                 else
3555                                         dflt='cc'
3556                                 fi;;
3557                         esac;;
3558                 esac;;
3559         *)  dflt="$cc";;
3560         esac
3561         case "$dflt" in
3562         *M*)    $cat <<'EOM'
3563 On some older systems the default C compiler will not resolve multiple global
3564 references that happen to have the same name.  On some such systems the "Mcc"
3565 command may be used to force these to be resolved.  On other systems a "cc -M"
3566 command is required.  (Note that the -M flag on other systems indicates a
3567 memory model to use!) If you have the Gnu C compiler, you might wish to use
3568 that instead.
3569
3570 EOM
3571         ;;
3572         esac
3573         rp="Use which C compiler?"
3574         . ./myread
3575         cc="$ans"
3576 else
3577         case "$cc" in
3578         '') dflt=cc;;
3579         *) dflt="$cc";;
3580         esac
3581         rp="Use which C compiler?"
3582         . ./myread
3583         cc="$ans"
3584 fi
3585 : Look for a hint-file generated 'call-back-unit'.  Now that the
3586 : user has specified the compiler, we may need to set or change some
3587 : other defaults.
3588 if $test -f cc.cbu; then
3589     . ./cc.cbu
3590 fi
3591 echo " "
3592 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3593 $cat >gccvers.c <<EOM
3594 #include <stdio.h>
3595 int main() {
3596 #ifdef __GNUC__
3597 #ifdef __VERSION__
3598         printf("%s\n", __VERSION__);
3599 #else
3600         printf("%s\n", "1");
3601 #endif
3602 #endif
3603         exit(0);
3604 }
3605 EOM
3606 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3607         gccversion=`./gccvers`
3608         case "$gccversion" in
3609         '') echo "You are not using GNU cc." ;;
3610         *)  echo "You are using GNU cc $gccversion." ;;
3611         esac
3612 else
3613         echo " "
3614         echo "*** WHOA THERE!!! ***" >&4
3615         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3616         case "$knowitall" in
3617         '')
3618         echo "    You'd better start hunting for one and let me know about it." >&4
3619                 exit 1
3620                 ;;
3621         esac
3622 fi
3623 $rm -f gccvers*
3624 case "$gccversion" in
3625 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3626 esac
3627
3628 : What should the include directory be ?
3629 echo " "
3630 $echo $n "Hmm...  $c"
3631 dflt='/usr/include'
3632 incpath=''
3633 mips_type=''
3634 if $test -f /bin/mips && /bin/mips; then
3635         echo "Looks like a MIPS system..."
3636         $cat >usr.c <<'EOCP'
3637 #ifdef SYSTYPE_BSD43
3638 /bsd43
3639 #endif
3640 EOCP
3641         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3642                 dflt='/bsd43/usr/include'
3643                 incpath='/bsd43'
3644                 mips_type='BSD 4.3'
3645         else
3646                 mips_type='System V'
3647         fi
3648         $rm -f usr.c usr.out
3649         echo "and you're compiling with the $mips_type compiler and libraries."
3650         xxx_prompt=y
3651         echo "exit 0" >mips
3652 else
3653         echo "Doesn't look like a MIPS system."
3654         xxx_prompt=n
3655         echo "exit 1" >mips
3656 fi
3657 chmod +x mips
3658 $eunicefix mips
3659 case "$usrinc" in
3660 '') ;;
3661 *) dflt="$usrinc";;
3662 esac
3663 case "$xxx_prompt" in
3664 y)      fn=d/
3665         echo " "
3666         rp='Where are the include files you want to use?'
3667         . ./getfile
3668         usrinc="$ans"
3669         ;;
3670 *)      usrinc="$dflt"
3671         ;;
3672 esac
3673
3674 : see how we invoke the C preprocessor
3675 echo " "
3676 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3677 cat <<'EOT' >testcpp.c
3678 #define ABC abc
3679 #define XYZ xyz
3680 ABC.XYZ
3681 EOT
3682 cd ..
3683 if test ! -f cppstdin; then
3684         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3685 else
3686         echo "Keeping your $hint cppstdin wrapper."
3687 fi
3688 chmod 755 cppstdin
3689 wrapper=`pwd`/cppstdin
3690 ok='false'
3691 cd UU
3692
3693 if $test "X$cppstdin" != "X" && \
3694         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3695         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3696 then
3697         echo "You used to use $cppstdin $cppminus so we'll use that again."
3698         case "$cpprun" in
3699         '') echo "But let's see if we can live without a wrapper..." ;;
3700         *)
3701                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3702                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3703                 then
3704                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3705                         ok='true'
3706                 else
3707                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3708                 fi
3709                 ;;
3710         esac
3711 else
3712         case "$cppstdin" in
3713         '') ;;
3714         *)
3715                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3716                 ;;
3717         esac
3718 fi
3719
3720 if $ok; then
3721         : nothing
3722 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3723         $cc -E <testcpp.c >testcpp.out 2>&1; \
3724         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3725         echo "Yup, it does."
3726         x_cpp="$cc -E"
3727         x_minus='';
3728 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3729         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3730         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3731         echo "Yup, it does."
3732         x_cpp="$cc -E"
3733         x_minus='-';
3734 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3735         $cc -P <testcpp.c >testcpp.out 2>&1; \
3736         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3737         echo "Yipee, that works!"
3738         x_cpp="$cc -P"
3739         x_minus='';
3740 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3741         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3742         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3743         echo "At long last!"
3744         x_cpp="$cc -P"
3745         x_minus='-';
3746 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3747         $cpp <testcpp.c >testcpp.out 2>&1; \
3748         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3749         echo "It works!"
3750         x_cpp="$cpp"
3751         x_minus='';
3752 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3753         $cpp - <testcpp.c >testcpp.out 2>&1; \
3754         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3755         echo "Hooray, it works!  I was beginning to wonder."
3756         x_cpp="$cpp"
3757         x_minus='-';
3758 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3759         $wrapper <testcpp.c >testcpp.out 2>&1; \
3760         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3761         x_cpp="$wrapper"
3762         x_minus=''
3763         echo "Eureka!"
3764 else
3765         dflt=''
3766         rp="No dice.  I can't find a C preprocessor.  Name one:"
3767         . ./myread
3768         x_cpp="$ans"
3769         x_minus=''
3770         $x_cpp <testcpp.c >testcpp.out 2>&1
3771         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3772                 echo "OK, that will do." >&4
3773         else
3774 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3775                 exit 1
3776         fi
3777 fi
3778
3779 case "$ok" in
3780 false)
3781         cppstdin="$x_cpp"
3782         cppminus="$x_minus"
3783         cpprun="$x_cpp"
3784         cpplast="$x_minus"
3785         set X $x_cpp
3786         shift
3787         case "$1" in
3788         "$cpp")
3789                 echo "Perhaps can we force $cc -E using a wrapper..."
3790                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3791                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3792                 then
3793                         echo "Yup, we can."
3794                         cppstdin="$wrapper"
3795                         cppminus='';
3796                 else
3797                         echo "Nope, we'll have to live without it..."
3798                 fi
3799                 ;;
3800         esac
3801         case "$cpprun" in
3802         "$wrapper")
3803                 cpprun=''
3804                 cpplast=''
3805                 ;;
3806         esac
3807         ;;
3808 esac
3809
3810 case "$cppstdin" in
3811 "$wrapper"|'cppstdin') ;;
3812 *) $rm -f $wrapper;;
3813 esac
3814 $rm -f testcpp.c testcpp.out
3815
3816 : Set private lib path
3817 case "$plibpth" in
3818 '') if ./mips; then
3819                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3820         fi;;
3821 esac
3822 case "$libpth" in
3823 ' ') dlist='';;
3824 '') dlist="$loclibpth $plibpth $glibpth";;
3825 *) dlist="$libpth";;
3826 esac
3827
3828 : Now check and see which directories actually exist, avoiding duplicates
3829 libpth=''
3830 for xxx in $dlist
3831 do
3832     if $test -d $xxx; then
3833                 case " $libpth " in
3834                 *" $xxx "*) ;;
3835                 *) libpth="$libpth $xxx";;
3836                 esac
3837     fi
3838 done
3839 $cat <<'EOM'
3840
3841 Some systems have incompatible or broken versions of libraries.  Among
3842 the directories listed in the question below, please remove any you
3843 know not to be holding relevant libraries, and add any that are needed.
3844 Say "none" for none.
3845
3846 EOM
3847 case "$libpth" in
3848 '') dflt='none';;
3849 *)
3850         set X $libpth
3851         shift
3852         dflt=${1+"$@"}
3853         ;;
3854 esac
3855 rp="Directories to use for library searches?"
3856 . ./myread
3857 case "$ans" in
3858 none) libpth=' ';;
3859 *) libpth="$ans";;
3860 esac
3861
3862 : compute shared library extension
3863 case "$so" in
3864 '')
3865         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3866                 dflt='sl'
3867         else
3868                 dflt='so'
3869         fi
3870         ;;
3871 *) dflt="$so";;
3872 esac
3873 $cat <<EOM
3874
3875 On some systems, shared libraries may be available.  Answer 'none' if
3876 you want to suppress searching of shared libraries for the remaining
3877 of this configuration.
3878
3879 EOM
3880 rp='What is the file extension used for shared libraries?'
3881 . ./myread
3882 so="$ans"
3883
3884 : Define several unixisms.
3885 : Hints files or command line option can be used to override them.
3886 : The convoluted testing is in case hints files set either the old
3887 : or the new name.
3888 case "$_exe" in
3889 '')     case "$exe_ext" in
3890     '') ;;
3891         *)      _exe="$exe_ext" ;;
3892         esac
3893         ;;
3894 esac
3895 case "$_a" in
3896 '')     case "$lib_ext" in
3897     '') _a='.a';;
3898         *)      _a="$lib_ext" ;;
3899         esac
3900         ;;
3901 esac
3902 case "$_o" in
3903 '') case "$obj_ext" in
3904         '')     _o='.o';;
3905         *)      _o="$obj_ext";;
3906         esac
3907         ;;
3908 esac
3909 case "$p_" in
3910 '') case "$path_sep" in
3911         '')     p_=':';;
3912         *)      p_="$path_sep";;
3913         esac
3914         ;;
3915 esac
3916 exe_ext=$_exe
3917 lib_ext=$_a
3918 obj_ext=$_o
3919 path_sep=$p_
3920
3921 : Which makefile gets called first.  This is used by make depend.
3922 case "$firstmakefile" in
3923 '') firstmakefile='makefile';;
3924 esac
3925
3926 : Looking for optional libraries
3927 echo " "
3928 echo "Checking for optional libraries..." >&4
3929 case "$libs" in
3930 ' '|'') dflt='';;
3931 *) dflt="$libs";;
3932 esac
3933 case "$libswanted" in
3934 '') libswanted='c_s';;
3935 esac
3936 for thislib in $libswanted; do
3937         
3938         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3939                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3940                 echo "Found -l$thislib (shared)."
3941                 case " $dflt " in
3942                 *"-l$thislib "*);;
3943                 *) dflt="$dflt -l$thislib";;
3944                 esac
3945         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3946                 echo "Found -l$thislib (shared)."
3947                 case " $dflt " in
3948                 *"-l$thislib "*);;
3949                 *) dflt="$dflt -l$thislib";;
3950                 esac
3951         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3952                 echo "Found -l$thislib."
3953                 case " $dflt " in
3954                 *"-l$thislib "*);;
3955                 *) dflt="$dflt -l$thislib";;
3956                 esac
3957         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3958                 echo "Found -l$thislib."
3959                 case " $dflt " in
3960                 *"-l$thislib "*);;
3961                 *) dflt="$dflt -l$thislib";;
3962                 esac
3963         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3964                 echo "Found -l${thislib}_s."
3965                 case " $dflt " in
3966                 *"-l$thislib "*);;
3967                 *) dflt="$dflt -l${thislib}_s";;
3968                 esac
3969         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3970                 echo "Found -l$thislib."
3971                 case " $dflt " in
3972                 *"-l$thislib "*);;
3973                 *) dflt="$dflt -l$thislib";;
3974                 esac
3975         else
3976                 echo "No -l$thislib."
3977         fi
3978 done
3979 set X $dflt
3980 shift
3981 dflt="$*"
3982 case "$libs" in
3983 '') dflt="$dflt";;
3984 *) dflt="$libs";;
3985 esac
3986 case "$dflt" in
3987 ' '|'') dflt='none';;
3988 esac
3989
3990 $cat <<EOM
3991  
3992 Some versions of Unix support shared libraries, which make executables smaller
3993 but make load time slightly longer.
3994
3995 On some systems, mostly System V Release 3's, the shared library is included
3996 by putting the option "-lc_s" as the last thing on the cc command line when
3997 linking.  Other systems use shared libraries by default.  There may be other
3998 libraries needed to compile $package on your machine as well.  If your system
3999 needs the "-lc_s" option, include it here.  Include any other special libraries
4000 here as well.  Say "none" for none.
4001 EOM
4002
4003 echo " "
4004 rp="Any additional libraries?"
4005 . ./myread
4006 case "$ans" in
4007 none) libs=' ';;
4008 *) libs="$ans";;
4009 esac
4010
4011 : determine optimize, if desired, or use for debug flag also
4012 case "$optimize" in
4013 ' '|$undef) dflt='none';;
4014 '') dflt='-O';;
4015 *) dflt="$optimize";;
4016 esac
4017 $cat <<EOH
4018
4019 Some C compilers have problems with their optimizers.  By default, $package
4020 compiles with the -O flag to use the optimizer.  Alternately, you might want
4021 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4022 systems).  Either flag can be specified here.  To use neither flag, specify
4023 the word "none".
4024
4025 EOH
4026 rp="What optimizer/debugger flag should be used?"
4027 . ./myread
4028 optimize="$ans"
4029 case "$optimize" in
4030 'none') optimize=" ";;
4031 esac
4032
4033 dflt=''
4034 : We will not override a previous value, but we might want to
4035 : augment a hint file
4036 case "$hint" in
4037 none|recommended)
4038         case "$gccversion" in
4039         1*) dflt='-fpcc-struct-return' ;;
4040         esac
4041         case "$optimize" in
4042         *-g*) dflt="$dflt -DDEBUGGING";;
4043         esac
4044         case "$gccversion" in
4045         2*) if test -d /etc/conf/kconfig.d &&
4046                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4047                 then
4048                         dflt="$dflt -posix"
4049                 fi
4050                 ;;
4051         esac
4052         ;;
4053 esac
4054
4055 case "$mips_type" in
4056 *BSD*|'') inclwanted="$locincpth $usrinc";;
4057 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4058 esac
4059 for thisincl in $inclwanted; do
4060         if $test -d $thisincl; then
4061                 if $test x$thisincl != x$usrinc; then
4062                         case "$dflt" in
4063                         *$thisincl*);;
4064                         *) dflt="$dflt -I$thisincl";;
4065                         esac
4066                 fi
4067         fi
4068 done
4069
4070 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4071         xxx=true;
4072 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4073         xxx=true;
4074 else
4075         xxx=false;
4076 fi;
4077 if $xxx; then
4078         case "$dflt" in
4079         *$2*);;
4080         *) dflt="$dflt -D$2";;
4081         esac;
4082 fi'
4083
4084 set signal.h LANGUAGE_C; eval $inctest
4085
4086 case "$hint" in
4087 none|recommended) dflt="$ccflags $dflt" ;;
4088 *) dflt="$ccflags";;
4089 esac
4090
4091 case "$dflt" in
4092 ''|' ') dflt=none;;
4093 esac
4094 $cat <<EOH
4095
4096 Your C compiler may want other flags.  For this question you should include
4097 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4098 but you should NOT include libraries or ld flags like -lwhatever.  If you
4099 want $package to honor its debug switch, you should include -DDEBUGGING here.
4100 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4101
4102 To use no flags, specify the word "none".
4103
4104 EOH
4105 set X $dflt
4106 shift
4107 dflt=${1+"$@"}
4108 rp="Any additional cc flags?"
4109 . ./myread
4110 case "$ans" in
4111 none) ccflags='';;
4112 *) ccflags="$ans";;
4113 esac
4114
4115 : the following weeds options from ccflags that are of no interest to cpp
4116 cppflags="$ccflags"
4117 case "$gccversion" in
4118 1*) cppflags="$cppflags -D__GNUC__"
4119 esac
4120 case "$mips_type" in
4121 '');;
4122 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4123 esac
4124 case "$cppflags" in
4125 '');;
4126 *)
4127         echo " "
4128         echo "Let me guess what the preprocessor flags are..." >&4
4129         set X $cppflags
4130         shift
4131         cppflags=''
4132         $cat >cpp.c <<'EOM'
4133 #define BLURFL foo
4134
4135 BLURFL xx LFRULB
4136 EOM
4137         previous=''
4138         for flag in $*
4139         do
4140                 case "$flag" in
4141                 -*) ftry="$flag";;
4142                 *) ftry="$previous $flag";;
4143                 esac
4144                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4145                         >cpp1.out 2>/dev/null && \
4146                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4147                         >cpp2.out 2>/dev/null && \
4148                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4149                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4150                 then
4151                         cppflags="$cppflags $ftry"
4152                         previous=''
4153                 else
4154                         previous="$flag"
4155                 fi
4156         done
4157         set X $cppflags
4158         shift
4159         cppflags=${1+"$@"}
4160         case "$cppflags" in
4161         *-*)  echo "They appear to be: $cppflags";;
4162         esac
4163         $rm -f cpp.c cpp?.out
4164         ;;
4165 esac
4166
4167 : flags used in final linking phase
4168 case "$ldflags" in
4169 '') if ./venix; then
4170                 dflt='-i -z'
4171         else
4172                 dflt=''
4173         fi
4174         case "$ccflags" in
4175         *-posix*) dflt="$dflt -posix" ;;
4176         esac
4177         ;;
4178 *) dflt="$ldflags";;
4179 esac
4180
4181 : Try to guess additional flags to pick up local libraries.
4182 for thislibdir in $libpth; do
4183         case " $loclibpth " in
4184         *" $thislibdir "*)
4185                 case "$dflt " in 
4186                 *"-L$thislibdir "*) ;;
4187                 *)  dflt="$dflt -L$thislibdir" ;;
4188                 esac
4189                 ;;
4190         esac
4191 done
4192
4193 case "$dflt" in
4194 '') dflt='none' ;;
4195 esac
4196
4197 $cat <<EOH
4198
4199 Your C linker may need flags.  For this question you should
4200 include -L/whatever and any other flags used by the C linker, but you
4201 should NOT include libraries like -lwhatever.
4202
4203 Make sure you include the appropriate -L/path flags if your C linker
4204 does not normally search all of the directories you specified above,
4205 namely
4206         $libpth
4207 To use no flags, specify the word "none".
4208
4209 EOH
4210
4211 rp="Any additional ld flags (NOT including libraries)?"
4212 . ./myread
4213 case "$ans" in
4214 none) ldflags='';;
4215 *) ldflags="$ans";;
4216 esac
4217 rmlist="$rmlist pdp11"
4218
4219 : coherency check
4220 echo " "
4221 echo "Checking your choice of C compiler and flags for coherency..." >&4
4222 $cat > try.c <<'EOF'
4223 #include <stdio.h>
4224 int main() { printf("Ok\n"); exit(0); }
4225 EOF
4226 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4227 shift
4228 $cat >try.msg <<'EOM'
4229 I've tried to compile and run the following simple program:
4230
4231 EOM
4232 $cat try.c >> try.msg
4233
4234 $cat >> try.msg <<EOM
4235
4236 I used the command:
4237
4238         $*
4239         ./try
4240
4241 and I got the following output:
4242
4243 EOM
4244 dflt=y
4245 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4246         if sh -c './try' >>try.msg 2>&1; then
4247                 xxx=`./try`
4248                 case "$xxx" in
4249                 "Ok") dflt=n ;;
4250                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4251                         case " $libs " in
4252                         *" -lsfio "*)
4253                                 cat >> try.msg <<'EOQS'
4254 If $libs contains -lsfio, and sfio is mis-configured, then it
4255 sometimes (apparently) runs and exits with a 0 status, but with no
4256 output!  It may have to do with sfio's use of _exit vs. exit.
4257
4258 EOQS
4259                                 rp="You have a big problem.  Shall I abort Configure"
4260                                 dflt=y
4261                                 ;;
4262                         esac
4263                         ;;
4264                 esac
4265         else
4266                 echo "The program compiled OK, but exited with status $?." >>try.msg
4267                 rp="You have a problem.  Shall I abort Configure"
4268                 dflt=y
4269         fi
4270 else
4271         echo "I can't compile the test program." >>try.msg
4272         rp="You have a BIG problem.  Shall I abort Configure"
4273         dflt=y
4274 fi
4275 case "$dflt" in
4276 y)
4277         $cat try.msg >&4
4278         case "$knowitall" in
4279         '')
4280                 echo "(The supplied flags or libraries might be incorrect.)"
4281                 ;;
4282         *) dflt=n;;
4283         esac
4284         echo " "
4285         . ./myread
4286         case "$ans" in
4287         n*|N*) ;;
4288         *)      echo "Ok.  Stopping Configure." >&4
4289                 exit 1
4290                 ;;
4291         esac
4292         ;;
4293 n) echo "OK, that should do.";;
4294 esac
4295 $rm -f try try.* core
4296
4297 : determine filename position in cpp output
4298 echo " "
4299 echo "Computing filename position in cpp output for #include directives..." >&4
4300 echo '#include <stdio.h>' > foo.c
4301 $cat >fieldn <<EOF
4302 $startsh
4303 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4304 $grep '^[       ]*#.*stdio\.h' | \
4305 while read cline; do
4306         pos=1
4307         set \$cline
4308         while $test \$# -gt 0; do
4309                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4310                         echo "\$pos"
4311                         exit 0
4312                 fi
4313                 shift
4314                 pos=\`expr \$pos + 1\`
4315         done
4316 done
4317 EOF
4318 chmod +x fieldn
4319 fieldn=`./fieldn`
4320 $rm -f foo.c fieldn
4321 case $fieldn in
4322 '') pos='???';;
4323 1) pos=first;;
4324 2) pos=second;;
4325 3) pos=third;;
4326 *) pos="${fieldn}th";;
4327 esac
4328 echo "Your cpp writes the filename in the $pos field of the line."
4329
4330 : locate header file
4331 $cat >findhdr <<EOF
4332 $startsh
4333 wanted=\$1
4334 name=''
4335 if test -f $usrinc/\$wanted; then
4336         echo "$usrinc/\$wanted"
4337         exit 0
4338 fi
4339 awkprg='{ print \$$fieldn }'
4340 echo "#include <\$wanted>" > foo\$\$.c
4341 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4342 $grep "^[       ]*#.*\$wanted" | \
4343 while read cline; do
4344         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4345         case "\$name" in
4346         */\$wanted) echo "\$name"; exit 0;;
4347         *) name='';;
4348         esac;
4349 done;
4350 $rm -f foo\$\$.c;
4351 case "\$name" in
4352 '') exit 1;;
4353 esac
4354 EOF
4355 chmod +x findhdr
4356
4357 : define an alternate in-header-list? function
4358 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4359 cont=true; xxf="echo \"<\$1> found.\" >&4";
4360 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4361 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4362 esac;
4363 case $# in 4) instead=instead;; *) instead="at last";; esac;
4364 while $test "$cont"; do
4365         xxx=`./findhdr $1`
4366         var=$2; eval "was=\$$2";
4367         if $test "$xxx" && $test -r "$xxx";
4368         then eval $xxf;
4369         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4370                 cont="";
4371         else eval $xxnf;
4372         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4373         set $yyy; shift; shift; yyy=$@;
4374         case $# in 0) cont="";;
4375         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4376                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4377         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4378                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4379         esac;
4380 done;
4381 while $test "$yyy";
4382 do set $yyy; var=$2; eval "was=\$$2";
4383         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4384         set $yyy; shift; shift; yyy=$@;
4385 done'
4386
4387 : see if this is a malloc.h system
4388 set malloc.h i_malloc
4389 eval $inhdr
4390
4391 : see if stdlib is available
4392 set stdlib.h i_stdlib
4393 eval $inhdr
4394
4395 : determine which malloc to compile in
4396 echo " "
4397 case "$usemymalloc" in
4398 ''|[yY]*|true|$define)  dflt='y' ;;
4399 *)      dflt='n' ;;
4400 esac
4401 rp="Do you wish to attempt to use the malloc that comes with $package?"
4402 . ./myread
4403 usemymalloc="$ans"
4404 case "$ans" in
4405 y*|true)
4406         usemymalloc='y'
4407         mallocsrc='malloc.c'
4408         mallocobj="malloc$_o"
4409         d_mymalloc="$define"
4410         case "$libs" in
4411         *-lmalloc*)
4412                 : Remove malloc from list of libraries to use
4413                 echo "Removing unneeded -lmalloc from library list" >&4
4414                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4415                 shift
4416                 libs="$*"
4417                 echo "libs = $libs" >&4
4418                 ;;
4419         esac
4420         ;;
4421 *)
4422         usemymalloc='n'
4423         mallocsrc=''
4424         mallocobj=''
4425         d_mymalloc="$undef"
4426         ;;
4427 esac
4428
4429 : compute the return types of malloc and free
4430 echo " "
4431 $cat >malloc.c <<END
4432 #$i_malloc I_MALLOC
4433 #$i_stdlib I_STDLIB
4434 #include <stdio.h>
4435 #include <sys/types.h>
4436 #ifdef I_MALLOC
4437 #include <malloc.h>
4438 #endif
4439 #ifdef I_STDLIB
4440 #include <stdlib.h>
4441 #endif
4442 #ifdef TRY_MALLOC
4443 void *malloc();
4444 #endif
4445 #ifdef TRY_FREE
4446 void free();
4447 #endif
4448 END
4449 case "$malloctype" in
4450 '')
4451         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4452                 malloctype='void *'
4453         else
4454                 malloctype='char *'
4455         fi
4456         ;;
4457 esac
4458 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4459
4460 case "$freetype" in
4461 '')
4462         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4463                 freetype='void'
4464         else
4465                 freetype='int'
4466         fi
4467         ;;
4468 esac
4469 echo "Your system uses $freetype free(), it would seem." >&4
4470 $rm -f malloc.[co]
4471 : Cruising for prototypes
4472 echo " "
4473 echo "Checking out function prototypes..." >&4
4474 $cat >prototype.c <<'EOCP'
4475 int main(int argc, char *argv[]) {
4476         exit(0);}
4477 EOCP
4478 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4479         echo "Your C compiler appears to support function prototypes."
4480         val="$define"
4481 else
4482         echo "Your C compiler doesn't seem to understand function prototypes."
4483         val="$undef"
4484 fi
4485 set prototype
4486 eval $setvar
4487 $rm -f prototype*
4488
4489 case "$prototype" in
4490 "$define") ;;
4491 *)      ansi2knr='ansi2knr'
4492         echo " "
4493         cat <<EOM >&4
4494
4495 $me:  FATAL ERROR:
4496 This version of $package can only be compiled by a compiler that 
4497 understands function prototypes.  Unfortunately, your C compiler 
4498         $cc $ccflags
4499 doesn't seem to understand them.  Sorry about that.
4500
4501 If GNU cc is available for your system, perhaps you could try that instead.  
4502
4503 Eventually, we hope to support building Perl with pre-ANSI compilers.
4504 If you would like to help in that effort, please contact <perlbug@perl.org>.
4505
4506 Aborting Configure now.
4507 EOM
4508         exit 2
4509         ;;
4510 esac
4511
4512 : determine where public executables go
4513 echo " "
4514 set dflt bin bin
4515 eval $prefixit
4516 fn=d~
4517 rp='Pathname where the public executables will reside?'
4518 . ./getfile
4519 if $test "X$ansexp" != "X$binexp"; then
4520         installbin=''
4521 fi
4522 bin="$ans"
4523 binexp="$ansexp"
4524 if $afs; then
4525         $cat <<EOM
4526
4527 Since you are running AFS, I need to distinguish the directory in which
4528 executables reside from the directory in which they are installed (and from
4529 which they are presumably copied to the former directory by occult means).
4530
4531 EOM
4532         case "$installbin" in
4533         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4534         *) dflt="$installbin";;
4535         esac
4536         fn=de~
4537         rp='Where will public executables be installed?'
4538         . ./getfile
4539         installbin="$ans"
4540 else
4541         installbin="$binexp"
4542 fi
4543
4544 : determine whether to install perl also as /usr/bin/perl
4545
4546 echo " "
4547 if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4548         $cat <<EOM
4549 Many scripts expect to perl to be installed as /usr/bin/perl.
4550 I can install the perl you are about to compile also as /usr/bin/perl
4551 (in addition to $installbin/perl).
4552 EOM
4553         case "$installusrbinperl" in
4554         "$undef"|[nN]*) dflt='n';;
4555         *)              dflt='y';;
4556         esac
4557         rp="Do you want to install perl as /usr/bin/perl?"
4558         . ./myread
4559         case "$ans" in
4560         [yY]*)  val="$define";;
4561         *)      val="$undef" ;;
4562         esac
4563 else
4564         val="$undef"
4565 fi
4566 set installusrbinperl
4567 eval $setvar
4568
4569 : define a shorthand compile call
4570 compile='
4571 mc_file=$1;
4572 shift;
4573 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4574 : define a shorthand compile call for compilations that should be ok.
4575 compile_ok='
4576 mc_file=$1;
4577 shift;
4578 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4579
4580 echo " "
4581 echo "Checking for GNU C Library..." >&4
4582 cat >gnulibc.c <<EOM
4583 #include <stdio.h>
4584 int main()
4585 {
4586 #ifdef __GLIBC__
4587     exit(0);
4588 #else
4589     exit(1);
4590 #endif
4591 }
4592 EOM
4593 set gnulibc
4594 if eval $compile_ok && ./gnulibc; then
4595         val="$define"
4596         echo "You are using the GNU C Library"
4597 else
4598         val="$undef"
4599         echo "You are not using the GNU C Library"
4600 fi
4601 $rm -f gnulibc*
4602 set d_gnulibc
4603 eval $setvar
4604
4605 : see if nm is to be used to determine whether a symbol is defined or not
4606 case "$usenm" in
4607 '')
4608         dflt=''
4609         case "$d_gnulibc" in
4610         "$define")
4611                 echo " "
4612                 echo "nm probably won't work on the GNU C Library." >&4
4613                 dflt=n
4614                 ;;
4615         esac
4616         case "$dflt" in
4617         '') 
4618                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4619                         echo " "
4620                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4621                         echo "'nm' won't be sufficient on this sytem." >&4
4622                         dflt=n
4623                 fi
4624                 ;;
4625         esac
4626         case "$dflt" in
4627         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4628                 if $test $dflt -gt 20; then
4629                         dflt=y
4630                 else
4631                         dflt=n
4632                 fi
4633                 ;;
4634         esac
4635         ;;
4636 *)
4637         case "$usenm" in
4638         true|$define) dflt=y;;
4639         *) dflt=n;;
4640         esac
4641         ;;
4642 esac
4643 $cat <<EOM
4644
4645 I can use $nm to extract the symbols from your C libraries. This
4646 is a time consuming task which may generate huge output on the disk (up
4647 to 3 megabytes) but that should make the symbols extraction faster. The
4648 alternative is to skip the 'nm' extraction part and to compile a small
4649 test program instead to determine whether each symbol is present. If
4650 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4651 this may be the best solution.
4652
4653 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4654
4655 EOM
4656 rp="Shall I use $nm to extract C symbols from the libraries?"
4657 . ./myread
4658 case "$ans" in
4659 [Nn]*) usenm=false;;
4660 *) usenm=true;;
4661 esac
4662
4663 runnm=$usenm
4664 case "$reuseval" in
4665 true) runnm=false;;
4666 esac
4667
4668 : nm options which may be necessary
4669 case "$nm_opt" in
4670 '') if $test -f /mach_boot; then
4671                 nm_opt=''       # Mach
4672         elif $test -d /usr/ccs/lib; then
4673                 nm_opt='-p'     # Solaris (and SunOS?)
4674         elif $test -f /dgux; then
4675                 nm_opt='-p'     # DG-UX
4676         elif $test -f /lib64/rld; then
4677                 nm_opt='-p'     # 64-bit Irix
4678         else
4679                 nm_opt=''
4680         fi;;
4681 esac
4682
4683 : nm options which may be necessary for shared libraries but illegal
4684 : for archive libraries.  Thank you, Linux.
4685 case "$nm_so_opt" in
4686 '')     case "$myuname" in
4687         *linux*)
4688                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4689                         nm_so_opt='--dynamic'
4690                 fi
4691                 ;;
4692         esac
4693         ;;
4694 esac
4695
4696 case "$runnm" in
4697 true)
4698 : get list of predefined functions in a handy place
4699 echo " "
4700 case "$libc" in
4701 '') libc=unknown
4702         case "$libs" in
4703         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4704         esac
4705         ;;
4706 esac
4707 libnames='';
4708 case "$libs" in
4709 '') ;;
4710 *)  for thislib in $libs; do
4711         case "$thislib" in
4712         -lc|-lc_s)
4713                 : Handle C library specially below.
4714                 ;;
4715         -l*)
4716                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4717                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4718                         :
4719                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4720                         :
4721                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4722                         :
4723                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4724                         :
4725                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4726                         :
4727                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4728                         :
4729                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4730                         :
4731                 else
4732                         try=''
4733                 fi
4734                 libnames="$libnames $try"
4735                 ;;
4736         *) libnames="$libnames $thislib" ;;
4737         esac
4738         done
4739         ;;
4740 esac
4741 xxx=normal
4742 case "$libc" in
4743 unknown)
4744         set /lib/libc.$so
4745         for xxx in $libpth; do
4746                 $test -r $1 || set $xxx/libc.$so
4747                 : The messy sed command sorts on library version numbers.
4748                 $test -r $1 || \
4749                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4750                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4751                                 h
4752                                 s/[0-9][0-9]*/0000&/g
4753                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4754                                 G
4755                                 s/\n/ /' | \
4756                          sort | $sed -e 's/^.* //'`
4757                 eval set \$$#
4758         done
4759         $test -r $1 || set /usr/ccs/lib/libc.$so
4760         $test -r $1 || set /lib/libsys_s$_a
4761         ;;
4762 *)
4763         set blurfl
4764         ;;
4765 esac
4766 if $test -r "$1"; then
4767         echo "Your (shared) C library seems to be in $1."
4768         libc="$1"
4769 elif $test -r /lib/libc && $test -r /lib/clib; then
4770         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4771         xxx=apollo
4772         libc='/lib/clib /lib/libc'
4773         if $test -r /lib/syslib; then
4774                 echo "(Your math library is in /lib/syslib.)"
4775                 libc="$libc /lib/syslib"
4776         fi
4777 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4778         echo "Your C library seems to be in $libc, as you said before."
4779 elif $test -r $incpath/usr/lib/libc$_a; then
4780         libc=$incpath/usr/lib/libc$_a;
4781         echo "Your C library seems to be in $libc.  That's fine."
4782 elif $test -r /lib/libc$_a; then
4783         libc=/lib/libc$_a;
4784         echo "Your C library seems to be in $libc.  You're normal."
4785 else
4786         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4787                 :
4788         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4789                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4790         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4791                 :
4792         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4793                 :
4794         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4795                 :
4796         else
4797                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4798         fi
4799         if $test -r "$tans"; then
4800                 echo "Your C library seems to be in $tans, of all places."
4801                 libc=$tans
4802         else
4803                 libc='blurfl'
4804         fi
4805 fi
4806 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4807         dflt="$libc"
4808         cat <<EOM
4809
4810 If the guess above is wrong (which it might be if you're using a strange
4811 compiler, or your machine supports multiple models), you can override it here.
4812
4813 EOM
4814 else
4815         dflt=''
4816         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4817         cat >&4 <<EOM
4818 I can't seem to find your C library.  I've looked in the following places:
4819
4820 EOM
4821         $sed 's/^/      /' libpath
4822         cat <<EOM
4823
4824 None of these seems to contain your C library. I need to get its name...
4825
4826 EOM
4827 fi
4828 fn=f
4829 rp='Where is your C library?'
4830 . ./getfile
4831 libc="$ans"
4832
4833 echo " "
4834 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4835 set X `cat libnames`
4836 shift
4837 xxx=files
4838 case $# in 1) xxx=file; esac
4839 echo "Extracting names from the following $xxx for later perusal:" >&4
4840 echo " "
4841 $sed 's/^/      /' libnames >&4
4842 echo " "
4843 $echo $n "This may take a while...$c" >&4
4844
4845 for file in $*; do
4846         case $file in
4847         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4848         *) $nm $nm_opt $file 2>/dev/null;;
4849         esac
4850 done >libc.tmp
4851
4852 $echo $n ".$c"
4853 $grep fprintf libc.tmp > libc.ptf
4854 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4855 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4856 xxx='[ADTSIW]'
4857 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4858         eval $xscan;\
4859         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4860                 eval $xrun
4861 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4862         eval $xscan;\
4863         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4864                 eval $xrun
4865 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4866         eval $xscan;\
4867         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4868                 eval $xrun
4869 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4870         eval $xscan;\
4871         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4872                 eval $xrun
4873 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4874         eval $xscan;\
4875         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4876                 eval $xrun
4877 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4878         eval $xscan;\
4879         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4880                 eval $xrun
4881 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4882                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4883         eval $xscan;\
4884         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4885                 eval $xrun
4886 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4887         eval $xscan;\
4888         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4889                 eval $xrun
4890 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4891         eval $xscan;\
4892         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4893                 eval $xrun
4894 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4895         eval $xscan;\
4896         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4897                 eval $xrun
4898 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4899         eval $xscan;\
4900         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4901                 eval $xrun
4902 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4903         eval $xscan;\
4904         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4905                 eval $xrun
4906 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4907         eval $xscan;\
4908         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4909                 eval $xrun
4910 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4911         eval $xscan;\
4912         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4913                 eval $xrun
4914 else
4915         $nm -p $* 2>/dev/null >libc.tmp
4916         $grep fprintf libc.tmp > libc.ptf
4917         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4918                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4919         then
4920                 nm_opt='-p'
4921                 eval $xrun
4922         else
4923                 echo " "
4924                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4925                 com=''
4926                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4927                         for thisname in $libnames $libc; do
4928                                 $ar t $thisname >>libc.tmp
4929                         done
4930                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4931                         echo "Ok." >&4
4932                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4933                         # Repeat libc to extract forwarders to DLL entries too
4934                         for thisname in $libnames $libc; do
4935                                 $ar tv $thisname >>libc.tmp
4936                                 # Revision 50 of EMX has bug in $ar.
4937                                 # it will not extract forwarders to DLL entries
4938                                 # Use emximp which will extract exactly them.
4939                                 emximp -o tmp.imp $thisname \
4940                                     2>/dev/null && \
4941                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4942                                     < tmp.imp >>libc.tmp
4943                                 $rm tmp.imp
4944                         done
4945                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4946                         echo "Ok." >&4
4947                 else
4948                         echo "$ar didn't seem to work right." >&4
4949                         echo "Maybe this is a Cray...trying bld instead..." >&4
4950                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4951                         then
4952                                 for thisname in $libnames; do
4953                                         bld t $libnames | \
4954                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4955                                         $ar t $thisname >>libc.tmp
4956                                 done
4957                                 echo "Ok." >&4
4958                         else
4959                                 echo "That didn't work either.  Giving up." >&4
4960                                 exit 1
4961                         fi
4962                 fi
4963         fi
4964 fi
4965 nm_extract="$com"
4966 if $test -f /lib/syscalls.exp; then
4967         echo " "
4968         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4969         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4970 fi
4971 ;;
4972 esac
4973 $rm -f libnames libpath
4974
4975 : see if dld is available
4976 set dld.h i_dld
4977 eval $inhdr
4978
4979 : is a C symbol defined?
4980 csym='tlook=$1;
4981 case "$3" in
4982 -v) tf=libc.tmp; tc=""; tdc="";;
4983 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4984 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4985 esac;
4986 tx=yes;
4987 case "$reuseval-$4" in
4988 true-) ;;
4989 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4990 esac;
4991 case "$tx" in
4992 yes)
4993         case "$runnm" in
4994         true)
4995                 if $contains $tlook $tf >/dev/null 2>&1;
4996                 then tval=true;
4997                 else tval=false;
4998                 fi;;
4999         *)
5000                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5001                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5002                 then tval=true;
5003                 else tval=false;
5004                 fi;
5005                 $rm -f t t.c;;
5006         esac;;
5007 *)
5008         case "$tval" in
5009         $define) tval=true;;
5010         *) tval=false;;
5011         esac;;
5012 esac;
5013 eval "$2=$tval"'
5014
5015 : define an is-in-libc? function
5016 inlibc='echo " "; td=$define; tu=$undef;
5017 sym=$1; var=$2; eval "was=\$$2";
5018 tx=yes;
5019 case "$reuseval$was" in
5020 true) ;;
5021 true*) tx=no;;
5022 esac;
5023 case "$tx" in
5024 yes)
5025         set $sym tres -f;
5026         eval $csym;
5027         case "$tres" in
5028         true)
5029                 echo "$sym() found." >&4;
5030                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5031         *)
5032                 echo "$sym() NOT found." >&4;
5033                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5034         esac;;
5035 *)
5036         case "$was" in
5037         $define) echo "$sym() found." >&4;;
5038         *) echo "$sym() NOT found." >&4;;
5039         esac;;
5040 esac'
5041
5042 : see if dlopen exists
5043 xxx_runnm="$runnm"
5044 runnm=false
5045 set dlopen d_dlopen
5046 eval $inlibc
5047 runnm="$xxx_runnm"
5048
5049 : determine which dynamic loading, if any, to compile in
5050 echo " "
5051 dldir="ext/DynaLoader"
5052 case "$usedl" in
5053 $define|y|true)
5054         dflt='y'
5055         usedl="$define"
5056         ;;
5057 $undef|n|false)
5058         dflt='n'
5059         usedl="$undef"
5060         ;;
5061 *) 
5062         dflt='n'
5063         case "$d_dlopen" in
5064             $define) dflt='y' ;;
5065         esac
5066         case "$i_dld" in
5067             $define) dflt='y' ;;
5068         esac
5069         : Does a dl_xxx.xs file exist for this operating system
5070         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5071         ;;
5072 esac
5073 rp="Do you wish to use dynamic loading?"
5074 . ./myread
5075 usedl="$ans"
5076 case "$ans" in
5077 y*) usedl="$define"
5078         case "$dlsrc" in
5079         '')
5080                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5081                         dflt="$dldir/dl_${osname}.xs"
5082                 elif $test "$d_dlopen" = "$define" ; then
5083                         dflt="$dldir/dl_dlopen.xs"
5084                 elif $test "$i_dld" = "$define" ; then
5085                         dflt="$dldir/dl_dld.xs"
5086                 else
5087                         dflt=''
5088                 fi
5089                 ;;
5090         *)      dflt="$dldir/$dlsrc"
5091                 ;;
5092         esac
5093     echo "The following dynamic loading files are available:"
5094         : Can not go over to $dldir because getfile has path hard-coded in.
5095         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5096         rp="Source file to use for dynamic loading"
5097         fn="fne"
5098         # XXX This getfile call will fail the existence check if you try 
5099         # building away from $src (this is not supported yet).
5100         . ./getfile
5101         usedl="$define"
5102         : emulate basename
5103         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5104
5105         $cat << EOM
5106
5107 Some systems may require passing special flags to $cc -c to
5108 compile modules that will be used to create a shared library.
5109 To use no flags, say "none".
5110
5111 EOM
5112     case "$cccdlflags" in
5113     '') case "$gccversion" in
5114                 '') case "$osname" in
5115                         hpux)   dflt='+z' ;;
5116                         next)   dflt='none' ;;
5117                         irix*)  dflt='-KPIC' ;;
5118                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5119                         sunos)  dflt='-pic' ;;
5120                         *)      dflt='none' ;;
5121                     esac
5122                         ;;
5123                 *)  case "$osname" in
5124                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5125                         *)      dflt='-fpic' ;;
5126                     esac ;;
5127             esac ;;
5128         ' ') dflt='none' ;;
5129     *)  dflt="$cccdlflags" ;;
5130     esac
5131     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5132     . ./myread
5133     case "$ans" in
5134     none) cccdlflags=' ' ;;
5135     *) cccdlflags="$ans" ;;
5136     esac
5137
5138     cat << EOM
5139
5140 Some systems use ld to create libraries that can be dynamically loaded,
5141 while other systems (such as those using ELF) use $cc.
5142
5143 EOM
5144         case "$ld" in
5145         '')     $cat >try.c <<'EOM'
5146 /* Test for whether ELF binaries are produced */
5147 #include <fcntl.h>
5148 #include <stdlib.h>
5149 int main() {
5150         char b[4];
5151         int i = open("a.out",O_RDONLY);
5152         if(i == -1) 
5153                 exit(1); /* fail */
5154         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5155                 exit(0); /* succeed (yes, it's ELF) */
5156         else
5157                 exit(1); /* fail */
5158 }
5159 EOM
5160                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5161                         cat <<EOM
5162 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5163 EOM
5164                         dflt="$cc"
5165                 else
5166                         echo "I'll use ld to build dynamic libraries."
5167                         dflt='ld'
5168                 fi
5169                 rm -f try.c a.out
5170                 ;;
5171         *)      dflt="$ld"
5172                 ;;
5173         esac
5174
5175     rp="What command should be used to create dynamic libraries?"
5176     . ./myread
5177         ld="$ans"
5178
5179     cat << EOM
5180
5181 Some systems may require passing special flags to $ld to create a
5182 library that can be dynamically loaded.  If your ld flags include
5183 -L/other/path options to locate libraries outside your loader's normal
5184 search path, you may need to specify those -L options here as well.  To
5185 use no flags, say "none".
5186
5187 EOM
5188     case "$lddlflags" in
5189     '') case "$osname" in
5190                         beos) dflt='-nostart' ;;
5191                         hpux)  dflt='-b' ;;
5192                         linux|irix*)    dflt='-shared' ;;
5193                         next)  dflt='none' ;;
5194                         solaris) dflt='-G' ;;
5195                         sunos) dflt='-assert nodefinitions' ;;
5196                         svr4*|esix*) dflt="-G $ldflags" ;;
5197                 *)     dflt='none' ;;
5198                         esac
5199                         ;;
5200     *) dflt="$lddlflags" ;;
5201     esac
5202
5203         : Try to guess additional flags to pick up local libraries.
5204         : Be careful not to append to a plain 'none'
5205         case "$dflt" in
5206         none) dflt='' ;;
5207         esac
5208         for thisflag in $ldflags; do
5209                 case "$thisflag" in
5210                 -L*)
5211                         case " $dflt " in
5212                         *" $thisflag "*) ;;
5213                         *) dflt="$dflt $thisflag" ;;
5214                         esac
5215                         ;;
5216                 esac
5217         done
5218
5219         case "$dflt" in
5220         ''|' ') dflt='none' ;;
5221         esac
5222
5223     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5224     . ./myread
5225     case "$ans" in
5226     none) lddlflags=' ' ;;
5227     *) lddlflags="$ans" ;;
5228     esac
5229
5230         cat <<EOM
5231
5232 Some systems may require passing special flags to $cc to indicate that
5233 the resulting executable will use dynamic linking.  To use no flags,
5234 say "none".
5235
5236 EOM
5237     case "$ccdlflags" in
5238     '') case "$osname" in
5239                 hpux)   dflt='-Wl,-E' ;;
5240                 linux)  dflt='-rdynamic' ;;
5241                 next)   dflt='none' ;;
5242                 sunos)  dflt='none' ;;
5243                 *)      dflt='none' ;;
5244             esac ;;
5245     ' ')  dflt='none' ;;
5246     *)  dflt="$ccdlflags" ;;
5247     esac
5248     rp="Any special flags to pass to $cc to use dynamic loading?"
5249     . ./myread
5250     case "$ans" in
5251     none) ccdlflags=' ' ;;
5252     *) ccdlflags="$ans" ;;
5253     esac
5254     ;;
5255 *)  usedl="$undef"
5256         ld='ld'
5257     dlsrc='dl_none.xs'
5258     lddlflags=''
5259     ccdlflags=''
5260     ;;
5261 esac
5262
5263 also=''
5264 case "$usedl" in
5265 $undef)
5266         # No dynamic loading being used, so don't bother even to prompt.
5267         useshrplib='false'
5268         ;;
5269 *)      case "$useshrplib" in
5270         '')     case "$osname" in
5271                 svr4*|dgux|dynixptx|esix|powerux|beos)
5272                         dflt=y
5273                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5274                         ;;
5275                 next*)
5276                         case "$osvers" in
5277                         4*)     dflt=y
5278                                 also='Building a shared libperl is needed for MAB support.'
5279                                 ;;
5280                         *)      dflt=n
5281                                 ;;
5282                         esac
5283                         ;;
5284                 *)      dflt=n
5285                         ;;
5286                 esac
5287                 ;;
5288         $define|true|[Yy]*)
5289                 dflt=y
5290                 ;;
5291         *)      dflt=n
5292                 ;;
5293         esac
5294         $cat << EOM
5295
5296 The perl executable is normally obtained by linking perlmain.c with
5297 libperl${_a}, any static extensions (usually just DynaLoader), and
5298 any other libraries needed on this system (such as -lm, etc.).  Since
5299 your system supports dynamic loading, it is probably possible to build
5300 a shared libperl.$so.  If you will have more than one executable linked
5301 to libperl.$so, this will significantly reduce the size of each
5302 executable, but it may have a noticeable affect on performance.  The
5303 default is probably sensible for your system.
5304 $also
5305
5306 EOM
5307         rp="Build a shared libperl.$so (y/n)"
5308         . ./myread
5309         case "$ans" in
5310         true|$define|[Yy]*)
5311                 useshrplib='true'
5312                 # Why does next4 have to be so different?
5313                 case "${osname}${osvers}" in
5314                 next4*) xxx='DYLD_LIBRARY_PATH' ;;
5315                 os2*)   xxx='' ;; # Nothing special needed.
5316                 beos*)  xxx='' ;;
5317                 *)              xxx='LD_LIBRARY_PATH' ;;
5318                 esac
5319                 if test X"$xxx" != "X"; then
5320                         $cat <<EOM  | $tee -a ../config.msg >&4
5321
5322 To build perl, you must add the current working directory to your
5323 $xxx environment variable before running make.  You can do
5324 this with
5325    $xxx=\`pwd\`:\$$xxx; export $xxx
5326 for Bourne-style shells, or
5327    setenv $xxx \`pwd\`
5328 for Csh-style shells.  You *MUST* do this before running make.
5329
5330 EOM
5331                 fi
5332                 ;;
5333         *)      useshrplib='false' ;;
5334         esac
5335         ;;
5336 esac
5337
5338 case "$useshrplib" in
5339 true)
5340         case "$libperl" in
5341         '')
5342                 # Figure out a good name for libperl.so.  Since it gets stored in
5343                 # a version-specific architecture-dependent library, the version
5344                 # number isn't really that important, except for making cc/ld happy.
5345                 #
5346                 # A name such as libperl.so.3.1
5347                 majmin="libperl.$so.$patchlevel.$subversion"
5348                 # A name such as libperl.so.301
5349                 majonly=`echo $patchlevel $subversion |
5350                         $awk '{printf "%d%02d", $1, $2}'`
5351                 majonly=libperl.$so.$majonly
5352                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5353                 # rely on figuring it out from the naming of libc.
5354                 case "${osname}${osvers}" in
5355                 next4*)
5356                         dflt=libperl.5.$so
5357                         # XXX How handle the --version stuff for MAB?
5358                         ;;
5359                 linux*)  # ld won't link with a bare -lperl otherwise.
5360                         dflt=libperl.$so
5361                         ;;
5362                 *)      # Try to guess based on whether libc has major.minor.
5363                         case "$libc" in
5364                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5365                         *libc.$so.[0-9]*) dflt=$majonly ;;
5366                         *)      dflt=libperl.$so ;;
5367                         esac
5368                         ;;
5369                 esac
5370                 ;;
5371         *)      dflt=$libperl
5372                 ;;
5373         esac
5374         cat << EOM
5375
5376 I need to select a good name for the shared libperl.  If your system uses
5377 library names with major and minor numbers, then you might want something
5378 like $majmin.  Alternatively, if your system uses a single version
5379 number for shared libraries, then you might want to use $majonly.
5380 Or, your system might be quite happy with a simple libperl.$so.
5381
5382 Since the shared libperl will get installed into a version-specific
5383 architecture-dependent directory, the version number of the shared perl
5384 library probably isn't important, so the default should be o.k.
5385
5386 EOM
5387         rp='What name do you want to give to the shared libperl?'
5388         . ./myread
5389         libperl=$ans
5390         echo "Ok, I'll use $libperl"
5391         ;;
5392 *)
5393         libperl="libperl${_a}"
5394         ;;
5395 esac
5396
5397 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5398 case "$shrpdir" in
5399 '') ;;
5400 *)      $cat >&4 <<EOM
5401 WARNING:  Use of the shrpdir variable for the installation location of
5402 the shared $libperl is not supported.  It was never documented and
5403 will not work in this version.  Let me (perlbug@perl.com)
5404 know of any problems this may cause.
5405
5406 EOM
5407         case "$shrpdir" in
5408         "$archlibexp/CORE")
5409                 $cat >&4 <<EOM
5410 But your current setting of $shrpdir is
5411 the default anyway, so it's harmless.
5412 EOM
5413                 ;;
5414         *)
5415                 $cat >&4 <<EOM
5416 Further, your current attempted setting of $shrpdir
5417 conflicts with the value of $archlibexp/CORE
5418 that installperl will use.
5419 EOM
5420                 ;;
5421         esac
5422         ;;
5423 esac
5424
5425 # How will the perl executable find the installed shared $libperl?
5426 # Add $xxx to ccdlflags.
5427 # If we can't figure out a command-line option, use $shrpenv to
5428 # set env LD_RUN_PATH.  The main perl makefile uses this.
5429 shrpdir=$archlibexp/CORE
5430 xxx=''
5431 tmp_shrpenv=''
5432 if "$useshrplib"; then
5433     case "$osname" in 
5434         aix)
5435                 # We'll set it in Makefile.SH...
5436                 ;;
5437         solaris|netbsd)
5438                 xxx="-R $shrpdir"
5439                 ;;
5440         freebsd)
5441                 xxx="-Wl,-R$shrpdir"
5442                 ;;
5443         linux|irix*|dec_osf)
5444                 xxx="-Wl,-rpath,$shrpdir"
5445                 ;;
5446         next)
5447                 # next doesn't like the default...
5448                 ;;
5449         beos)
5450                 # beos doesn't like the default, either.
5451                 ;;
5452         *)
5453                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5454                 ;;
5455         esac
5456         case "$xxx" in
5457         '') ;;
5458         *)      
5459                 # Only add $xxx if it isn't already in ccdlflags.
5460                 case " $ccdlflags " in
5461                 *" $xxx "*)     ;;
5462                 *)      ccdlflags="$ccdlflags $xxx"
5463                         cat <<EOM >&4
5464
5465 Adding $xxx to the flags
5466 passed to $ld so that the perl executable will find the 
5467 installed shared $libperl.
5468
5469 EOM
5470                         ;;
5471                 esac
5472                 ;;
5473         esac
5474 fi
5475 # Respect a hint or command-line value.
5476 case "$shrpenv" in
5477 '') shrpenv="$tmp_shrpenv" ;;
5478 esac
5479
5480 : determine where manual pages go
5481 set man1dir man1dir none
5482 eval $prefixit
5483 $cat <<EOM
5484
5485 $spackage has manual pages available in source form.
5486 EOM
5487 case "$nroff" in
5488 nroff)
5489         echo "However, you don't have nroff, so they're probably useless to you."
5490         case "$man1dir" in
5491         '') man1dir="none";;
5492         esac;;
5493 esac
5494 echo "If you don't want the manual sources installed, answer 'none'."
5495 case "$man1dir" in
5496 ' ') dflt=none
5497         ;;
5498 '')
5499         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5500         lookpath="$lookpath $prefixexp/man/p_man/man1"
5501         lookpath="$lookpath $prefixexp/man/u_man/man1"
5502         lookpath="$lookpath $prefixexp/man/man.1"
5503         case "$sysman" in
5504         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5505         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5506         esac
5507         set dflt
5508         eval $prefixup
5509         ;;
5510 *)  dflt="$man1dir"
5511         ;;
5512 esac
5513 echo " "
5514 fn=dn+~
5515 rp="Where do the main $spackage manual pages (source) go?"
5516 . ./getfile
5517 if $test "X$man1direxp" != "X$ansexp"; then
5518         installman1dir=''
5519 fi
5520 man1dir="$ans"
5521 man1direxp="$ansexp"
5522 case "$man1dir" in
5523 '') man1dir=' '
5524         installman1dir='';;
5525 esac
5526 if $afs; then
5527         $cat <<EOM
5528
5529 Since you are running AFS, I need to distinguish the directory in which
5530 manual pages reside from the directory in which they are installed (and from
5531 which they are presumably copied to the former directory by occult means).
5532
5533 EOM
5534         case "$installman1dir" in
5535         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5536         *) dflt="$installman1dir";;
5537         esac
5538         fn=de~
5539         rp='Where will man pages be installed?'
5540         . ./getfile
5541         installman1dir="$ans"
5542 else
5543         installman1dir="$man1direxp"
5544 fi
5545
5546 : What suffix to use on installed man pages
5547
5548 case "$man1dir" in
5549 ' ')
5550         man1ext='0'
5551         ;;
5552 *)
5553         rp="What suffix should be used for the main $spackage man pages?"
5554         case "$man1ext" in
5555         '')     case "$man1dir" in
5556                 *1)  dflt=1 ;;
5557                 *1p) dflt=1p ;;
5558                 *1pm) dflt=1pm ;;
5559                 *l) dflt=l;;
5560                 *n) dflt=n;;
5561                 *o) dflt=o;;
5562                 *p) dflt=p;;
5563                 *C) dflt=C;;
5564                 *L) dflt=L;;
5565                 *L1) dflt=L1;;
5566                 *) dflt=1;;
5567                 esac
5568                 ;;
5569         *)      dflt="$man1ext";;
5570         esac
5571         . ./myread
5572         man1ext="$ans"
5573         ;;
5574 esac
5575
5576 : see if we can have long filenames
5577 echo " "
5578 rmlist="$rmlist /tmp/cf$$"
5579 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5580 first=123456789abcdef
5581 second=/tmp/cf$$/$first
5582 $rm -f $first $second
5583 if (echo hi >$first) 2>/dev/null; then
5584         if $test -f 123456789abcde; then
5585                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5586                 val="$undef"
5587         else
5588                 if (echo hi >$second) 2>/dev/null; then
5589                         if $test -f /tmp/cf$$/123456789abcde; then
5590                                 $cat <<'EOM'
5591 That's peculiar... You can have filenames longer than 14 characters, but only
5592 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5593 I shall consider your system cannot support long filenames at all.
5594 EOM
5595                                 val="$undef"
5596                         else
5597                                 echo 'You can have filenames longer than 14 characters.' >&4
5598                                 val="$define"
5599                         fi
5600                 else
5601                         $cat <<'EOM'
5602 How confusing! Some of your filesystems are sane enough to allow filenames
5603 longer than 14 characters but some others like /tmp can't even think about them.
5604 So, for now on, I shall assume your kernel does not allow them at all.
5605 EOM
5606                         val="$undef"
5607                 fi
5608         fi
5609 else
5610         $cat <<'EOM'
5611 You can't have filenames longer than 14 chars.  You can't even think about them!
5612 EOM
5613         val="$undef"
5614 fi 
5615 set d_flexfnam
5616 eval $setvar
5617 $rm -rf /tmp/cf$$ 123456789abcde*
5618
5619 : determine where library module manual pages go
5620 set man3dir man3dir none
5621 eval $prefixit
5622 $cat <<EOM
5623
5624 $spackage has manual pages for many of the library modules.
5625 EOM
5626
5627 case "$nroff" in
5628 nroff)
5629         $cat <<'EOM'
5630 However, you don't have nroff, so they're probably useless to you.
5631 EOM
5632         case "$man3dir" in
5633         '') man3dir="none";;
5634         esac;;
5635 esac
5636
5637 case "$d_flexfnam" in
5638 undef)
5639         $cat <<'EOM'
5640 However, your system can't handle the long file names like File::Basename.3. 
5641 EOM
5642         case "$man3dir" in
5643         '') man3dir="none";;
5644         esac;;
5645 esac
5646
5647 echo "If you don't want the manual sources installed, answer 'none'."
5648 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5649 case "$man3dir" in
5650 '')     case "$prefix" in 
5651         *$prog*) dflt=`echo $man1dir | 
5652                         $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5653         *)      dflt="$privlib/man/man3" ;;
5654         esac
5655         ;;
5656 ' ') dflt=none;;
5657 *)      dflt="$man3dir" ;;
5658 esac
5659 echo " "
5660
5661 fn=dn+~
5662 rp="Where do the $package library man pages (source) go?"
5663 . ./getfile
5664 if test "X$man3direxp" != "X$ansexp"; then
5665         installman3dir=''
5666 fi
5667
5668 man3dir="$ans"
5669 man3direxp="$ansexp"
5670 case "$man3dir" in
5671 '') man3dir=' '
5672         installman3dir='';;
5673 esac
5674 if $afs; then
5675         $cat <<EOM
5676
5677 Since you are running AFS, I need to distinguish the directory in which
5678 manual pages reside from the directory in which they are installed (and from
5679 which they are presumably copied to the former directory by occult means).
5680
5681 EOM
5682         case "$installman3dir" in
5683         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5684         *) dflt="$installman3dir";;
5685         esac
5686         fn=de~
5687         rp='Where will man pages be installed?'
5688         . ./getfile
5689         installman3dir="$ans"
5690 else
5691         installman3dir="$man3direxp"
5692 fi
5693
5694 : What suffix to use on installed man pages
5695
5696 case "$man3dir" in
5697 ' ')
5698         man3ext='0'
5699         ;;
5700 *)
5701         rp="What suffix should be used for the $package library man pages?"
5702         case "$man3ext" in
5703         '')     case "$man3dir" in
5704                 *3)  dflt=3 ;;
5705                 *3p) dflt=3p ;;
5706                 *3pm) dflt=3pm ;;
5707                 *l) dflt=l;;
5708                 *n) dflt=n;;
5709                 *o) dflt=o;;
5710                 *p) dflt=p;;
5711                 *C) dflt=C;;
5712                 *L) dflt=L;;
5713                 *L3) dflt=L3;;
5714                 *) dflt=3;;
5715                 esac
5716                 ;;
5717         *)      dflt="$man3ext";;
5718         esac
5719         . ./myread
5720         man3ext="$ans"
5721         ;;
5722 esac
5723
5724 : see if we have to deal with yellow pages, now NIS.
5725 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5726         if $test -f /usr/etc/nibindd; then
5727                 echo " "
5728                 echo "I'm fairly confident you're on a NeXT."
5729                 echo " "
5730                 rp='Do you get the hosts file via NetInfo?'
5731                 dflt=y
5732                 case "$hostcat" in
5733                 nidump*) ;;
5734                 '') ;;
5735                 *) dflt=n;;
5736                 esac
5737                 . ./myread
5738                 case "$ans" in
5739                 y*) hostcat='nidump hosts .';;
5740                 *)      case "$hostcat" in
5741                         nidump*) hostcat='';;
5742                         esac
5743                         ;;
5744                 esac
5745         fi
5746         case "$hostcat" in
5747         nidump*) ;;
5748         *)
5749                 case "$hostcat" in
5750                 *ypcat*) dflt=y;;
5751                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5752                                 dflt=y
5753                         else
5754                                 dflt=n
5755                         fi;;
5756                 *) dflt=n;;
5757                 esac
5758                 echo " "
5759                 rp='Are you getting the hosts file via yellow pages?'
5760                 . ./myread
5761                 case "$ans" in
5762                 y*) hostcat='ypcat hosts';;
5763                 *) hostcat='cat /etc/hosts';;
5764                 esac
5765                 ;;
5766         esac
5767 fi
5768 case "$hostcat" in
5769 '') hostcat='cat /etc/hosts';;
5770 esac
5771 case "$groupcat" in
5772 '') groupcat='cat /etc/group';;
5773 esac
5774 case "$passcat" in
5775 '') passcat='cat /etc/passwd';;
5776 esac
5777
5778 : now get the host name
5779 echo " "
5780 echo "Figuring out host name..." >&4
5781 case "$myhostname" in
5782 '') cont=true
5783         echo 'Maybe "hostname" will work...'
5784         if tans=`sh -c hostname 2>&1` ; then
5785                 myhostname=$tans
5786                 phostname=hostname
5787                 cont=''
5788         fi
5789         ;;
5790 *) cont='';;
5791 esac
5792 if $test "$cont"; then
5793         if ./xenix; then
5794                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5795                 if tans=`cat /etc/systemid 2>&1` ; then
5796                         myhostname=$tans
5797                         phostname='cat /etc/systemid'
5798                         echo "Whadyaknow.  Xenix always was a bit strange..."
5799                         cont=''
5800                 fi
5801         elif $test -r /etc/systemid; then
5802                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5803         fi
5804 fi
5805 if $test "$cont"; then
5806         echo 'No, maybe "uuname -l" will work...'
5807         if tans=`sh -c 'uuname -l' 2>&1` ; then
5808                 myhostname=$tans
5809                 phostname='uuname -l'
5810         else
5811                 echo 'Strange.  Maybe "uname -n" will work...'
5812                 if tans=`sh -c 'uname -n' 2>&1` ; then
5813                         myhostname=$tans
5814                         phostname='uname -n'
5815                 else
5816                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5817                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5818                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5819                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5820                         else
5821                                 case "$myhostname" in
5822                                 '') echo "Does this machine have an identity crisis or something?"
5823                                         phostname='';;
5824                                 *)
5825                                         echo "Well, you said $myhostname before..."
5826                                         phostname='echo $myhostname';;
5827                                 esac
5828                         fi
5829                 fi
5830         fi
5831 fi
5832 : you do not want to know about this
5833 set $myhostname
5834 myhostname=$1
5835
5836 : verify guess
5837 if $test "$myhostname" ; then
5838         dflt=y
5839         rp='Your host name appears to be "'$myhostname'".'" Right?"
5840         . ./myread
5841         case "$ans" in
5842         y*) ;;
5843         *) myhostname='';;
5844         esac
5845 fi
5846
5847 : bad guess or no guess
5848 while $test "X$myhostname" = X ; do
5849         dflt=''
5850         rp="Please type the (one word) name of your host:"
5851         . ./myread
5852         myhostname="$ans"
5853 done
5854
5855 : translate upper to lower if necessary
5856 case "$myhostname" in
5857 *[A-Z]*)
5858         echo "(Normalizing case in your host name)"
5859         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5860         ;;
5861 esac
5862
5863 case "$myhostname" in
5864 *.*)
5865         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5866         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5867         echo "(Trimming domain name from host name--host name is now $myhostname)"
5868         ;;
5869 *) case "$mydomain" in
5870         '')
5871                 {
5872                         test "X$hostcat" = "Xypcat hosts" &&
5873                         ypmatch "$myhostname" hosts 2>/dev/null |\
5874                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
5875                         $test -s hosts
5876                 } || {
5877                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
5878                                         /[       ]$myhostname[  . ]/p" > hosts
5879                 }
5880                 tmp_re="[       . ]"
5881                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
5882                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
5883                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5884                         hosts | $sort | $uniq | \
5885                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5886                 case `$echo X$dflt` in
5887                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
5888                         dflt=.
5889                         ;;
5890                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5891                         ;;
5892                 esac
5893                 case "$dflt" in
5894                 .)
5895                         tans=`./loc resolv.conf X /etc /usr/etc`
5896                         if $test -f "$tans"; then
5897                                 echo "(Attempting domain name extraction from $tans)"
5898                                 dflt=.`$sed -n -e 's/   / /g' \
5899                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
5900                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5901                                 case "$dflt" in
5902                                 .) dflt=.`$sed -n -e 's/        / /g' \
5903                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
5904                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5905                                         ;;
5906                                 esac
5907                         fi
5908                         ;;
5909                 esac
5910                 case "$dflt" in
5911                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5912                         dflt=.`sh -c domainname 2>/dev/null`
5913                         case "$dflt" in
5914                         '') dflt='.';;
5915                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5916                         esac
5917                         ;;
5918                 esac
5919                 case "$dflt" in
5920                 .) echo "(Lost all hope -- silly guess then)"
5921                         dflt='.uucp'
5922                         ;;
5923                 esac
5924                 $rm -f hosts
5925                 ;;
5926         *) dflt="$mydomain";;
5927         esac;;
5928 esac
5929 echo " "
5930 rp="What is your domain name?"
5931 . ./myread
5932 tans="$ans"
5933 case "$ans" in
5934 '') ;;
5935 .*) ;;
5936 *) tans=".$tans";;
5937 esac
5938 mydomain="$tans"
5939
5940 : translate upper to lower if necessary
5941 case "$mydomain" in
5942 *[A-Z]*)
5943         echo "(Normalizing case in your domain name)"
5944         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5945         ;;
5946 esac
5947
5948 : a little sanity check here
5949 case "$phostname" in
5950 '') ;;
5951 *)
5952         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5953         $myhostname$mydomain|$myhostname) ;;
5954         *)
5955                 case "$phostname" in
5956                 sed*)
5957                         echo "(That doesn't agree with your whoami.h file, by the way.)"
5958                         ;;
5959                 *)
5960                         echo "(That doesn't agree with your $phostname command, by the way.)"
5961                         ;;
5962                 esac
5963         ;;
5964         esac
5965         ;;
5966 esac
5967
5968 $cat <<EOM
5969
5970 I need to get your e-mail address in Internet format if possible, i.e.
5971 something like user@host.domain. Please answer accurately since I have
5972 no easy means to double check it. The default value provided below
5973 is most probably close to the reality but may not be valid from outside
5974 your organization...
5975
5976 EOM
5977 cont=x
5978 while test "$cont"; do
5979         case "$cf_email" in
5980         '') dflt="$cf_by@$myhostname$mydomain";;
5981         *) dflt="$cf_email";;
5982         esac
5983         rp='What is your e-mail address?'
5984         . ./myread
5985         cf_email="$ans"
5986         case "$cf_email" in
5987         *@*.*) cont='' ;;
5988         *)
5989                 rp='Address does not look like an Internet one.  Use it anyway?'
5990                 case "$fastread" in
5991                 yes) dflt=y ;;
5992                 *) dflt=n ;;
5993                 esac
5994                 . ./myread
5995                 case "$ans" in
5996                 y*) cont='' ;;
5997                 *) echo " " ;;
5998                 esac
5999                 ;;
6000         esac
6001 done
6002
6003 $cat <<EOM
6004
6005 If you or somebody else will be maintaining perl at your site, please
6006 fill in the correct e-mail address here so that they may be contacted
6007 if necessary. Currently, the "perlbug" program included with perl
6008 will send mail to this address in addition to perlbug@perl.com. You may
6009 enter "none" for no administrator.
6010
6011 EOM
6012 case "$perladmin" in
6013 '') dflt="$cf_email";;
6014 *) dflt="$perladmin";;
6015 esac
6016 rp='Perl administrator e-mail address'
6017 . ./myread
6018 perladmin="$ans"
6019
6020 : figure out how to guarantee perl startup
6021 case "$startperl" in
6022 '')
6023         case "$sharpbang" in
6024         *!)
6025                 $cat <<EOH
6026
6027 I can use the #! construct to start perl on your system. This will
6028 make startup of perl scripts faster, but may cause problems if you
6029 want to share those scripts and perl is not in a standard place
6030 ($binexp/perl) on all your platforms. The alternative is to force
6031 a shell by starting the script with a single ':' character.
6032
6033 EOH
6034                 dflt="$binexp/perl"
6035                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6036                 . ./myread
6037                 case "$ans" in
6038                 none)   startperl=": # use perl";;
6039                 *)      startperl="#!$ans"
6040                         if $test 30 -lt `echo "$ans" | wc -c`; then
6041                                 $cat >&4 <<EOM
6042
6043 WARNING:  Some systems limit the #! command to 32 characters.
6044 If you experience difficulty running Perl scripts with #!, try
6045 installing Perl in a directory with a shorter pathname.
6046
6047 EOM
6048                         fi ;;
6049                 esac
6050                 ;;
6051         *) startperl=": # use perl"
6052                 ;;
6053         esac
6054         ;;
6055 esac
6056 echo "I'll use $startperl to start perl scripts."
6057
6058 : figure best path for perl in scripts
6059 case "$perlpath" in
6060 '')
6061         perlpath="$binexp/perl"
6062         case "$startperl" in
6063         *!*) ;;
6064         *)
6065                 $cat <<EOH
6066
6067 I will use the "eval 'exec'" idiom to start Perl on your system.
6068 I can use the full path of your Perl binary for this purpose, but
6069 doing so may cause problems if you want to share those scripts and
6070 Perl is not always in a standard place ($binexp/perl).
6071
6072 EOH
6073                 dflt="$binexp/perl"
6074                 rp="What path shall I use in \"eval 'exec'\"?"
6075                 . ./myread
6076                 perlpath="$ans"
6077                 ;;
6078         esac
6079         ;;
6080 esac
6081 case "$startperl" in
6082 *!*)    ;;
6083 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6084 esac
6085
6086 : determine where public executable scripts go
6087 set scriptdir scriptdir
6088 eval $prefixit
6089 case "$scriptdir" in
6090 '')
6091         dflt="$bin"
6092         : guess some guesses
6093         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6094         $test -d /usr/share/bin && dflt=/usr/share/bin
6095         $test -d /usr/local/script && dflt=/usr/local/script
6096         $test -d $prefixexp/script && dflt=$prefixexp/script
6097         set dflt
6098         eval $prefixup
6099         ;;
6100 *)  dflt="$scriptdir"
6101         ;;
6102 esac
6103 $cat <<EOM
6104  
6105 Some installations have a separate directory just for executable scripts so
6106 that they can mount it across multiple architectures but keep the scripts in
6107 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6108 Or you might just lump your scripts in with all your other executables.
6109  
6110 EOM
6111 fn=d~
6112 rp='Where do you keep publicly executable scripts?'
6113 . ./getfile
6114 if $test "X$ansexp" != "X$scriptdirexp"; then
6115         installscript=''
6116 fi
6117 scriptdir="$ans"
6118 scriptdirexp="$ansexp"
6119 if $afs; then
6120         $cat <<EOM
6121
6122 Since you are running AFS, I need to distinguish the directory in which
6123 scripts reside from the directory in which they are installed (and from
6124 which they are presumably copied to the former directory by occult means).
6125
6126 EOM
6127         case "$installscript" in
6128         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6129         *) dflt="$installscript";;
6130         esac
6131         fn=de~
6132         rp='Where will public scripts be installed?'
6133         . ./getfile
6134         installscript="$ans"
6135 else
6136         installscript="$scriptdirexp"
6137 fi
6138
6139 : determine where site specific libraries go.
6140 : Usual default is /usr/local/lib/perl5/site_perl/$apiversion
6141 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6142 case "$prefix" in
6143 *perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6144 *)       set dflt sitelib lib/$package/site_$prog/$apiversion ;;
6145 esac
6146 eval $prefixit
6147 $cat <<EOM
6148
6149 The installation process will also create a directory for
6150 site-specific extensions and modules.  Some users find it convenient
6151 to place all site-specific files in this directory rather than in the
6152 main distribution directory.
6153
6154 EOM
6155 fn=d~+
6156 rp='Pathname for the site-specific library files?'
6157 . ./getfile
6158 if $test "X$sitelibexp" != "X$ansexp"; then
6159         installsitelib=''
6160 fi
6161 sitelib="$ans"
6162 sitelibexp="$ansexp"
6163 if $afs; then
6164         $cat <<EOM
6165
6166 Since you are running AFS, I need to distinguish the directory in
6167 which site-specific files reside from the directory in which they are
6168 installed (and from which they are presumably copied to the former
6169 directory by occult means).
6170
6171 EOM
6172         case "$installsitelib" in
6173         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6174         *) dflt="$installsitelib";;
6175         esac
6176         fn=de~
6177         rp='Where will site-specific files be installed?'
6178         . ./getfile
6179         installsitelib="$ans"
6180 else
6181         installsitelib="$sitelibexp"
6182 fi
6183
6184 : determine where site specific architecture-dependent libraries go.
6185 : sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
6186 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6187 : sitelib may have an optional trailing /share.
6188 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6189 tdflt="$tdflt/$archname"
6190 set sitearch sitearch none
6191 eval $prefixit
6192 case "$sitearch" in
6193 '')     dflt="$tdflt" ;;
6194 *)      dflt="$sitearch" ;;
6195 esac
6196 $cat <<EOM
6197
6198 The installation process will also create a directory for
6199 architecture-dependent site-specific extensions and modules.
6200
6201 EOM
6202 fn=nd~+
6203 rp='Pathname for the site-specific architecture-dependent library files?'
6204 . ./getfile
6205 if $test "X$sitearchexp" != "X$ansexp"; then
6206         installsitearch=''
6207 fi
6208 sitearch="$ans"
6209 sitearchexp="$ansexp"
6210 if $afs; then
6211         $cat <<EOM
6212
6213 Since you are running AFS, I need to distinguish the directory in
6214 which site-specific architecture-dependent library files reside from
6215 the directory in which they are installed (and from which they are
6216 presumably copied to the former directory by occult means).
6217
6218 EOM
6219         case "$installsitearch" in
6220         '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6221         *) dflt="$installsitearch";;
6222         esac
6223         fn=de~
6224         rp='Where will site-specific architecture-dependent files be installed?'
6225         . ./getfile
6226         installsitearch="$ans"
6227 else
6228         installsitearch="$sitearchexp"
6229 fi
6230
6231 cat <<EOM
6232
6233 Previous version of $package used the standard IO mechanisms as defined
6234 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6235 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6236 the default.  This abstraction layer can use AT&T's sfio (if you already
6237 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6238 problems with some extension modules.  Using PerlIO with stdio is safe,
6239 but it is slower than plain stdio and therefore is not the default.
6240
6241 If this doesn't make any sense to you, just accept the default 'n'.
6242 EOM
6243 case "$useperlio" in
6244 $define|true|[yY]*)     dflt='y';;
6245 *) dflt='n';;
6246 esac
6247 rp='Use the experimental PerlIO abstraction layer?'
6248 . ./myread
6249 case "$ans" in
6250 y|Y) 
6251         val="$define"
6252         ;;     
6253 *)      
6254         echo "Ok, doing things the stdio way"
6255         val="$undef"
6256         ;;
6257 esac
6258 set useperlio
6259 eval $setvar 
6260
6261 : Check how to convert floats to strings.
6262 if test "X$d_Gconvert" = X; then
6263         echo " "
6264         echo "Checking for an efficient way to convert floats to strings."
6265         $cat >try.c <<'EOP'
6266 #ifdef TRY_gconvert
6267 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6268 char *myname = "gconvert";
6269 #endif
6270 #ifdef TRY_gcvt
6271 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6272 char *myname = "gcvt";
6273 #endif
6274 #ifdef TRY_sprintf
6275 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6276 char *myname = "sprintf";
6277 #endif
6278
6279 #include <stdio.h>
6280
6281 int
6282 checkit(expect, got)
6283 char *expect;
6284 char *got;
6285 {
6286     if (strcmp(expect, got)) {
6287                 printf("%s oddity:  Expected %s, got %s\n",
6288                         myname, expect, got);
6289                 exit(1);
6290         }
6291 }
6292
6293 int main()
6294
6295         char buf[64]; 
6296         buf[63] = '\0';
6297
6298         /* This must be 1st test on (which?) platform */
6299         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6300         Gconvert(0.1, 8, 0, buf);
6301         checkit("0.1", buf);
6302
6303         Gconvert(1.0, 8, 0, buf); 
6304         checkit("1", buf);
6305
6306         Gconvert(0.0, 8, 0, buf); 
6307         checkit("0", buf);
6308
6309         Gconvert(-1.0, 8, 0, buf); 
6310         checkit("-1", buf);
6311
6312         /* Some Linux gcvt's give 1.e+5 here. */
6313         Gconvert(100000.0, 8, 0, buf); 
6314         checkit("100000", buf);
6315         
6316         /* Some Linux gcvt's give -1.e+5 here. */
6317         Gconvert(-100000.0, 8, 0, buf); 
6318         checkit("-100000", buf);
6319
6320         exit(0);
6321 }
6322 EOP
6323         case "$d_Gconvert" in
6324         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6325         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6326         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6327         *) xxx_list='gconvert gcvt sprintf' ;;
6328         esac
6329
6330         for xxx_convert in $xxx_list; do
6331                 echo "Trying $xxx_convert"
6332                 $rm -f try try$_o
6333                 set try -DTRY_$xxx_convert
6334                 if eval $compile; then
6335                         echo "$xxx_convert" found. >&4
6336                         if ./try; then
6337                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6338                                 break;
6339                         else
6340                                 echo "...But $xxx_convert didn't work as I expected."
6341                         fi
6342                 else
6343                         echo "$xxx_convert NOT found." >&4
6344                 fi
6345         done
6346                 
6347         case "$xxx_convert" in
6348         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6349         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6350         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6351         esac
6352 fi
6353
6354 : Initialize h_fcntl
6355 h_fcntl=false
6356
6357 : Initialize h_sysfile
6358 h_sysfile=false
6359
6360 : access call always available on UNIX
6361 set access d_access
6362 eval $inlibc
6363
6364 : locate the flags for 'access()'
6365 case "$d_access" in
6366 "$define")
6367         echo " "
6368         $cat >access.c <<'EOCP'
6369 #include <sys/types.h>
6370 #ifdef I_FCNTL
6371 #include <fcntl.h>
6372 #endif
6373 #ifdef I_SYS_FILE
6374 #include <sys/file.h>
6375 #endif
6376 #ifdef I_UNISTD
6377 #include <unistd.h>
6378 #endif
6379 int main() {
6380         exit(R_OK);
6381 }
6382 EOCP
6383         : check sys/file.h first, no particular reason here
6384         if $test `./findhdr sys/file.h` && \
6385                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
6386                 h_sysfile=true;
6387                 echo "<sys/file.h> defines the *_OK access constants." >&4
6388         elif $test `./findhdr fcntl.h` && \
6389                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
6390                 h_fcntl=true;
6391                 echo "<fcntl.h> defines the *_OK access constants." >&4
6392         elif $test `./findhdr unistd.h` && \
6393                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
6394                 echo "<unistd.h> defines the *_OK access constants." >&4
6395         else
6396                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6397         fi
6398         ;;
6399 esac
6400 $rm -f access*
6401
6402 : see if accessx exists
6403 set accessx d_accessx
6404 eval $inlibc
6405
6406 : see if alarm exists
6407 set alarm d_alarm
6408 eval $inlibc
6409
6410 : Look for GNU-cc style attribute checking
6411 echo " "
6412 echo "Checking whether your compiler can handle __attribute__ ..." >&4
6413 $cat >attrib.c <<'EOCP'
6414 #include <stdio.h>
6415 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
6416 EOCP
6417 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6418         if $contains 'warning' attrib.out >/dev/null 2>&1; then
6419                 echo "Your C compiler doesn't fully support __attribute__."
6420                 val="$undef"
6421         else
6422                 echo "Your C compiler supports __attribute__."
6423                 val="$define"
6424         fi
6425 else
6426         echo "Your C compiler doesn't seem to understand __attribute__ at all."
6427         val="$undef"
6428 fi
6429 set d_attribut
6430 eval $setvar
6431 $rm -f attrib*
6432
6433 : see if bcmp exists
6434 set bcmp d_bcmp
6435 eval $inlibc
6436
6437 : see if bcopy exists
6438 set bcopy d_bcopy
6439 eval $inlibc
6440
6441 : see if this is a unistd.h system
6442 set unistd.h i_unistd
6443 eval $inhdr
6444
6445 : see if getpgrp exists
6446 set getpgrp d_getpgrp
6447 eval $inlibc
6448
6449 case "$d_getpgrp" in
6450 "$define")
6451         echo " "
6452         echo "Checking to see which flavor of getpgrp is in use..."
6453         $cat >set.c <<EOP
6454 #$i_unistd I_UNISTD
6455 #include <sys/types.h>
6456 #ifdef I_UNISTD
6457 #  include <unistd.h>
6458 #endif
6459 int main()
6460 {
6461         if (getuid() == 0) {
6462                 printf("(I see you are running Configure as super-user...)\n");
6463                 setuid(1);
6464         }
6465 #ifdef TRY_BSD_PGRP
6466         if (getpgrp(1) == 0)
6467                 exit(0);
6468 #else
6469         if (getpgrp() > 0)
6470                 exit(0);
6471 #endif
6472         exit(1);
6473 }
6474 EOP
6475         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6476                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6477                 val="$define"
6478         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6479                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6480                 val="$undef"
6481         else
6482                 echo "I can't seem to compile and run the test program."
6483                 if ./usg; then
6484                         xxx="a USG one, i.e. you use getpgrp()."
6485                 else
6486                         # SVR4 systems can appear rather BSD-ish.
6487                         case "$i_unistd" in
6488                         $undef)
6489                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6490                                 val="$define"
6491                                 ;;
6492                         $define)
6493                                 xxx="probably a USG one, i.e. you use getpgrp()."
6494                                 val="$undef"
6495                                 ;;
6496                         esac
6497                 fi
6498                 echo "Assuming your getpgrp is $xxx" >&4
6499         fi
6500         ;;
6501 *) val="$undef";;
6502 esac
6503 set d_bsdgetpgrp
6504 eval $setvar
6505 $rm -f set set.c
6506
6507 : see if setpgrp exists
6508 set setpgrp d_setpgrp
6509 eval $inlibc
6510
6511 case "$d_setpgrp" in
6512 "$define")
6513         echo " "
6514         echo "Checking to see which flavor of setpgrp is in use..."
6515         $cat >set.c <<EOP
6516 #$i_unistd I_UNISTD
6517 #include <sys/types.h>
6518 #ifdef I_UNISTD
6519 #  include <unistd.h>
6520 #endif
6521 int main()
6522 {
6523         if (getuid() == 0) {
6524                 printf("(I see you are running Configure as super-user...)\n");
6525                 setuid(1);
6526         }
6527 #ifdef TRY_BSD_PGRP
6528         if (-1 == setpgrp(1, 1))
6529                 exit(0);
6530 #else
6531         if (setpgrp() != -1)
6532                 exit(0);
6533 #endif
6534         exit(1);
6535 }
6536 EOP
6537         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6538                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6539                 val="$define"
6540         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6541                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6542                 val="$undef"
6543         else
6544                 echo "(I can't seem to compile and run the test program.)"
6545                 if ./usg; then
6546                         xxx="a USG one, i.e. you use setpgrp()."
6547                 else
6548                         # SVR4 systems can appear rather BSD-ish.
6549                         case "$i_unistd" in
6550                         $undef)
6551                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6552                                 val="$define"
6553                                 ;;
6554                         $define)
6555                                 xxx="probably a USG one, i.e. you use setpgrp()."
6556                                 val="$undef"
6557                                 ;;
6558                         esac
6559                 fi
6560                 echo "Assuming your setpgrp is $xxx" >&4
6561         fi
6562         ;;
6563 *) val="$undef";;
6564 esac
6565 set d_bsdsetpgrp
6566 eval $setvar
6567 $rm -f set set.c
6568 : see if bzero exists
6569 set bzero d_bzero
6570 eval $inlibc
6571
6572 : check for lengths of integral types
6573 echo " "
6574 case "$intsize" in
6575 '')
6576         echo "Checking to see how big your integers are..." >&4
6577         $cat >intsize.c <<'EOCP'
6578 #include <stdio.h>
6579 int main()
6580 {
6581         printf("intsize=%d;\n", sizeof(int));
6582         printf("longsize=%d;\n", sizeof(long));
6583         printf("shortsize=%d;\n", sizeof(short));
6584         exit(0);
6585 }
6586 EOCP
6587         set intsize
6588         if eval $compile_ok && ./intsize > /dev/null; then
6589                 eval `./intsize`
6590                 echo "Your integers are $intsize bytes long."
6591                 echo "Your long integers are $longsize bytes long."
6592                 echo "Your short integers are $shortsize bytes long."
6593         else
6594                 $cat >&4 <<EOM
6595 !
6596 Help! I can't compile and run the intsize test program: please enlighten me!
6597 (This is probably a misconfiguration in your system or libraries, and
6598 you really ought to fix it.  Still, I'll try anyway.)
6599 !
6600 EOM
6601                 dflt=4
6602                 rp="What is the size of an integer (in bytes)?"
6603                 . ./myread
6604                 intsize="$ans"
6605                 dflt=$intsize
6606                 rp="What is the size of a long integer (in bytes)?"
6607                 . ./myread
6608                 longsize="$ans"
6609                 dflt=2
6610                 rp="What is the size of a short integer (in bytes)?"
6611                 . ./myread
6612                 shortsize="$ans"
6613         fi
6614         ;;
6615 esac
6616 $rm -f intsize intsize.*
6617
6618 : see if signal is declared as pointer to function returning int or void
6619 echo " "
6620 xxx=`./findhdr signal.h`
6621 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6622 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6623         echo "You have int (*signal())() instead of void." >&4
6624         val="$undef"
6625 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6626         echo "You have void (*signal())()." >&4
6627         val="$define"
6628 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6629         echo "You have int (*signal())() instead of void." >&4
6630         val="$undef"
6631 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6632         echo "You have void (*signal())()." >&4
6633         val="$define"
6634 else
6635         case "$d_voidsig" in
6636         '')
6637         echo "I can't determine whether signal handler returns void or int..." >&4
6638                 dflt=void
6639                 rp="What type does your signal handler return?"
6640                 . ./myread
6641                 case "$ans" in
6642                 v*) val="$define";;
6643                 *) val="$undef";;
6644                 esac;;
6645         "$define")
6646                 echo "As you already told me, signal handler returns void." >&4
6647                 val="$define"
6648                 ;;
6649         *)      echo "As you already told me, signal handler returns int." >&4
6650                 val="$undef"
6651                 ;;
6652         esac
6653 fi
6654 set d_voidsig
6655 eval $setvar
6656 case "$d_voidsig" in
6657 "$define") signal_t="void";;
6658 *) signal_t="int";;
6659 esac
6660 $rm -f $$.tmp
6661
6662 : check for ability to cast large floats to 32-bit ints.
6663 echo " "
6664 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6665 if $test "$intsize" -ge 4; then
6666         xxx=int
6667 else
6668         xxx=long
6669 fi
6670 $cat >try.c <<EOCP
6671 #include <stdio.h>
6672 #include <sys/types.h>
6673 #include <signal.h>
6674 $signal_t blech(s) int s; { exit(3); }
6675 int main()
6676 {
6677         $xxx i32;
6678         double f, g;
6679         int result = 0;
6680         char str[16];
6681         signal(SIGFPE, blech);
6682
6683         /* Don't let compiler optimize the test away.  Store the number 
6684            in a writable string for gcc to pass to sscanf under HP/UX.
6685         */
6686         sprintf(str, "2147483647");
6687         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6688         g = 10 * f;
6689         i32  = ($xxx) g;
6690
6691         /* x86 processors will probably give 0x8000 0000, which is a
6692        sign change.  We don't want that.  We want to mimic SPARC
6693            behavior here, which is to preserve the sign and give
6694            back 0x7fff ffff.
6695         */
6696         if (i32 != ($xxx) f)
6697                 result |= 1;
6698         exit(result);
6699 }
6700 EOCP
6701 set try
6702 if eval $compile_ok; then
6703         ./try
6704         yyy=$?
6705 else
6706         echo "(I can't seem to compile the test program--assuming it can't)"
6707         yyy=1
6708 fi
6709 case "$yyy" in
6710 0)      val="$define"
6711         echo "Yup, it can."
6712         ;;
6713 *)      val="$undef"
6714         echo "Nope, it can't."
6715         ;;
6716 esac
6717 set d_casti32
6718 eval $setvar
6719 $rm -f try try.*
6720
6721 : check for ability to cast negative floats to unsigned
6722 echo " "
6723 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6724 $cat >try.c <<EOCP
6725 #include <stdio.h>
6726 #include <sys/types.h>
6727 #include <signal.h>
6728 $signal_t blech(s) int s; { exit(7); }
6729 $signal_t blech_in_list(s) int s; { exit(4); }
6730 unsigned long dummy_long(p) unsigned long p; { return p; }
6731 unsigned int dummy_int(p) unsigned int p; { return p; }
6732 unsigned short dummy_short(p) unsigned short p; { return p; }
6733 int main()
6734 {
6735         double f;
6736         unsigned long along;
6737         unsigned int aint;
6738         unsigned short ashort;
6739         int result = 0;
6740         char str[16];
6741         
6742         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6743            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6744            optimized the whole file away
6745         */
6746         /* Store the number in a writable string for gcc to pass to 
6747            sscanf under HP/UX.
6748         */
6749         sprintf(str, "-123");
6750         sscanf(str, "%lf", &f);  /* f = -123.; */
6751
6752         signal(SIGFPE, blech);
6753         along = (unsigned long)f;
6754         aint = (unsigned int)f;
6755         ashort = (unsigned short)f;
6756         if (along != (unsigned long)-123)
6757                 result |= 1;
6758         if (aint != (unsigned int)-123)
6759                 result |= 1;
6760         if (ashort != (unsigned short)-123)
6761                 result |= 1;
6762         sprintf(str, "1073741824.");
6763         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6764         f = f + f;
6765         along = 0;
6766         along = (unsigned long)f;
6767         if (along != 0x80000000)
6768                 result |= 2;
6769         f -= 1.;
6770         along = 0;
6771         along = (unsigned long)f;
6772         if (along != 0x7fffffff)
6773                 result |= 1;
6774         f += 2.;
6775         along = 0;
6776         along = (unsigned long)f;
6777         if (along != 0x80000001)
6778                 result |= 2;
6779         if (result)
6780                 exit(result);
6781         signal(SIGFPE, blech_in_list);
6782         sprintf(str, "123.");
6783         sscanf(str, "%lf", &f);  /* f = 123.; */
6784         along = dummy_long((unsigned long)f);
6785         aint = dummy_int((unsigned int)f);
6786         ashort = dummy_short((unsigned short)f);
6787         if (along != (unsigned long)123)
6788                 result |= 4;
6789         if (aint != (unsigned int)123)
6790                 result |= 4;
6791         if (ashort != (unsigned short)123)
6792                 result |= 4;
6793         exit(result);
6794
6795 }
6796 EOCP
6797 set try
6798 if eval $compile_ok; then
6799         ./try
6800         castflags=$?
6801 else
6802         echo "(I can't seem to compile the test program--assuming it can't)"
6803         castflags=7
6804 fi
6805 case "$castflags" in
6806 0)      val="$define"
6807         echo "Yup, it can."
6808         ;;
6809 *)      val="$undef"
6810         echo "Nope, it can't."
6811         ;;
6812 esac
6813 set d_castneg
6814 eval $setvar
6815 $rm -f try.*
6816
6817 : see if vprintf exists
6818 echo " "
6819 if set vprintf val -f d_vprintf; eval $csym; $val; then
6820         echo 'vprintf() found.' >&4
6821         val="$define"
6822         $cat >vprintf.c <<'EOF'
6823 #include <varargs.h>
6824
6825 int main() { xxx("foo"); }
6826
6827 xxx(va_alist)
6828 va_dcl
6829 {
6830         va_list args;
6831         char buf[10];
6832
6833         va_start(args);
6834         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6835 }
6836 EOF
6837         set vprintf
6838         if eval $compile && ./vprintf; then
6839                 echo "Your vsprintf() returns (int)." >&4
6840                 val2="$undef"
6841         else
6842                 echo "Your vsprintf() returns (char*)." >&4
6843                 val2="$define"
6844         fi
6845 else
6846         echo 'vprintf() NOT found.' >&4
6847                 val="$undef"
6848                 val2="$undef"
6849 fi
6850 set d_vprintf
6851 eval $setvar
6852 val=$val2
6853 set d_charvspr
6854 eval $setvar
6855
6856 : see if chown exists
6857 set chown d_chown
6858 eval $inlibc
6859
6860 : see if chroot exists
6861 set chroot d_chroot
6862 eval $inlibc
6863
6864 : see if chsize exists
6865 set chsize d_chsize
6866 eval $inlibc
6867
6868 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6869 while $test $# -ge 2; do
6870         case "$1" in
6871         $define) echo "#include <$2>";;
6872         esac ;
6873     shift 2;
6874 done > try.c;
6875 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
6876 if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6877         val="$define";
6878 else
6879         val="$undef";
6880 fi;
6881 set $varname;
6882 eval $setvar;
6883 $rm -f try.c try.o'
6884
6885 : see if this is a sys/uio.h system
6886 set sys/uio.h i_sysuio
6887 eval $inhdr
6888
6889 echo "Checking to see if your system supports struct iovec..." >&4
6890 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
6891 eval $hasfield
6892 case "$d_iovec_s" in
6893 "$define")      echo "Yup, it does." >&4
6894                 ;;
6895 *)              echo "Nope, it doesn't." >&4
6896                 ;;
6897 esac
6898
6899 socketlib=''
6900 sockethdr=''
6901 : see whether socket exists
6902 echo " "
6903 $echo $n "Hmm... $c" >&4
6904 if set socket val -f d_socket; eval $csym; $val; then
6905         echo "Looks like you have Berkeley networking support." >&4
6906         d_socket="$define"
6907         if set setsockopt val -f; eval $csym; $val; then
6908                 d_oldsock="$undef"
6909         else
6910                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
6911                 d_oldsock="$define"
6912         fi
6913 else
6914         if $contains socklib libc.list >/dev/null 2>&1; then
6915                 echo "Looks like you have Berkeley networking support." >&4
6916                 d_socket="$define"
6917                 : we will have to assume that it supports the 4.2 BSD interface
6918                 d_oldsock="$undef"
6919         else
6920                 echo "You don't have Berkeley networking in libc$_a..." >&4
6921                 if test "X$d_socket" = "X$define"; then
6922                    echo "...but you seem to believe that you have sockets." >&4
6923                 else
6924                         for net in net socket
6925                         do
6926                                 if test -f /usr/lib/lib$net$_a; then
6927                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
6928                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
6929                                         if $contains socket libc.list >/dev/null 2>&1; then
6930                                                 d_socket="$define"
6931                                                 socketlib="-l$net"
6932                                                 case "$net" in
6933                                                 net)
6934                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
6935                                                         sockethdr="-I/usr/netinclude"
6936                                                         ;;
6937                                                 esac
6938                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
6939                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
6940                                                         d_oldsock="$undef"
6941                                                 else
6942                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
6943                                                         d_oldsock="$define"
6944                                                 fi
6945                                                 break
6946                                         fi
6947                                 fi
6948                         done
6949                         if test "X$d_socket" != "X$define"; then
6950                            echo "or anywhere else I see." >&4
6951                            d_socket="$undef"
6952                            d_oldsock="$undef"
6953                         fi
6954                 fi
6955         fi
6956 fi
6957
6958 : see if socketpair exists
6959 set socketpair d_sockpair
6960 eval $inlibc
6961
6962
6963 echo " "
6964 echo "Checking the availability of certain socket constants..." >& 4
6965 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
6966         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
6967         $cat >try.c <<EOF
6968 #include <sys/types.h>
6969 #include <sys/socket.h>
6970 int main() {
6971     int i = $ENUM;
6972 }
6973 EOF
6974         val="$undef"
6975         set try; if eval $compile; then
6976                 val="$define"
6977         fi
6978         set d_${enum}; eval $setvar
6979         $rm -f try.c try
6980 done
6981
6982 set sendmsg d_sendmsg
6983 eval $inlibc
6984
6985 set recvmsg d_recvmsg
6986 eval $inlibc
6987
6988 echo " "
6989 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
6990 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6991 eval $hasfield
6992 case "$d_msghdr_s" in
6993 "$define")      echo "Yup, it does." >&4
6994                 ;;
6995 *)              echo "Nope, it doesn't." >&4
6996                 ;;
6997 esac
6998
6999 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7000 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7001 eval $hasfield
7002 case "$d_cmsghdr_s" in
7003 "$define")      echo "Yup, it does." >&4
7004                 ;;
7005 *)              echo "Nope, it doesn't." >&4
7006                 ;;
7007 esac
7008
7009 : check for const keyword
7010 echo " "
7011 echo 'Checking to see if your C compiler knows about "const"...' >&4
7012 $cat >const.c <<'EOCP'
7013 typedef struct spug { int drokk; } spug;
7014 int main()
7015 {
7016         const char *foo;
7017         const spug y;
7018 }
7019 EOCP
7020 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7021         val="$define"
7022         echo "Yup, it does."
7023 else
7024         val="$undef"
7025         echo "Nope, it doesn't."
7026 fi
7027 set d_const
7028 eval $setvar
7029
7030 : see if crypt exists
7031 echo " "
7032 if set crypt val -f d_crypt; eval $csym; $val; then
7033         echo 'crypt() found.' >&4
7034         val="$define"
7035         cryptlib=''
7036 else
7037         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7038         if $test -z "$cryptlib"; then
7039                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7040         else
7041                 cryptlib=-lcrypt
7042         fi
7043         if $test -z "$cryptlib"; then
7044                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7045         else
7046                 cryptlib=-lcrypt
7047         fi
7048         if $test -z "$cryptlib"; then
7049                 cryptlib=`./loc libcrypt$_a "" $libpth`
7050         else
7051                 cryptlib=-lcrypt
7052         fi
7053         if $test -z "$cryptlib"; then
7054                 echo 'crypt() NOT found.' >&4
7055                 val="$undef"
7056         else
7057                 val="$define"
7058         fi
7059 fi
7060 set d_crypt
7061 eval $setvar
7062
7063 : get csh whereabouts
7064 case "$csh" in
7065 'csh') val="$undef" ;;
7066 *) val="$define" ;;
7067 esac
7068 set d_csh
7069 eval $setvar
7070 : Respect a hint or command line value for full_csh.
7071 case "$full_csh" in
7072 '') full_csh=$csh ;;
7073 esac
7074
7075 : see if cuserid exists
7076 set cuserid d_cuserid
7077 eval $inlibc
7078
7079 : see if this is a limits.h system
7080 set limits.h i_limits
7081 eval $inhdr
7082
7083 : see if this is a float.h system
7084 set float.h i_float
7085 eval $inhdr
7086
7087 : See if number of significant digits in a double precision number is known
7088 echo " "
7089 $cat >dbl_dig.c <<EOM
7090 #$i_limits I_LIMITS
7091 #$i_float I_FLOAT
7092 #ifdef I_LIMITS
7093 #include <limits.h>
7094 #endif
7095 #ifdef I_FLOAT
7096 #include <float.h>
7097 #endif
7098 #ifdef DBL_DIG
7099 printf("Contains DBL_DIG");
7100 #endif
7101 EOM
7102 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7103 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7104         echo "DBL_DIG found." >&4
7105         val="$define"
7106 else
7107         echo "DBL_DIG NOT found." >&4
7108         val="$undef"
7109 fi
7110 $rm -f dbl_dig.?
7111 set d_dbl_dig
7112 eval $setvar
7113
7114
7115 if $test X"$use64bits" = X"$define"; then
7116         : see if dbminit64 exists
7117         set dbminit64 d_dbminit64
7118         eval $inlibc
7119
7120         : see if dbmclose64 exists
7121         set dbmclose64 d_dbmclose64
7122         eval $inlibc
7123
7124         : see if fetch64 exists
7125         set fetch64 d_fetch64
7126         eval $inlibc
7127
7128         : see if store64 exists
7129         set store64 d_store64
7130         eval $inlibc
7131
7132         : see if delete64 exists
7133         set delete64 d_delete64
7134         eval $inlibc
7135
7136         : see if firstkey64 exists
7137         set firstkey64 d_firstkey64
7138         eval $inlibc
7139
7140         : see if nextkey64 exists
7141         set nextkey64 d_nextkey64
7142         eval $inlibc
7143 else
7144         val="$undef"
7145         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7146         do
7147                 set $xxx
7148                 eval $setvar
7149         done
7150 fi
7151
7152 : see if difftime exists
7153 set difftime d_difftime
7154 eval $inlibc
7155
7156 : see if sys/stat.h is available
7157 set sys/stat.h i_sysstat
7158 eval $inhdr
7159
7160 : see if this is a dirent system
7161 echo " "
7162 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7163         val="$define"
7164         echo "<dirent.h> found." >&4
7165 else
7166         val="$undef"
7167         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7168                 echo "<sys/dir.h> found." >&4
7169                 echo " "
7170         else
7171                 xinc=`./findhdr sys/ndir.h`
7172         fi
7173         echo "<dirent.h> NOT found." >&4
7174 fi
7175 set i_dirent
7176 eval $setvar
7177
7178 : Look for type of directory structure.
7179 echo " "
7180 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7181
7182 case "$direntrytype" in
7183 ''|' ')
7184         case "$i_dirent" in
7185         $define) guess1='struct dirent' ;;
7186         *) guess1='struct direct'  ;;
7187         esac
7188         ;;
7189 *)      guess1="$direntrytype"
7190         ;;
7191 esac
7192
7193 case "$guess1" in
7194 'struct dirent') guess2='struct direct' ;;
7195 *) guess2='struct dirent' ;;
7196 esac
7197                 
7198 if $contains "$guess1" try.c >/dev/null 2>&1; then
7199         direntrytype="$guess1"
7200         echo "Your directory entries are $direntrytype." >&4
7201 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7202         direntrytype="$guess2"
7203         echo "Your directory entries seem to be $direntrytype." >&4
7204 else
7205         echo "I don't recognize your system's directory entries." >&4
7206         rp="What type is used for directory entries on this system?"
7207         dflt="$guess1"
7208         . ./myread
7209         direntrytype="$ans"
7210 fi
7211 $rm -f try.c
7212
7213
7214 : see if the directory entry stores field length
7215 echo " "
7216 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7217 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7218         echo "Good, your directory entry keeps length information in d_namlen." >&4
7219         val="$define"
7220 else
7221         echo "Your directory entry does not know about the d_namlen field." >&4
7222         val="$undef"
7223 fi
7224 set d_dirnamlen
7225 eval $setvar
7226 $rm -f try.c
7227
7228
7229 if $test X"$use64bits" = X"$define"; then
7230         : see if fstat64 exists
7231         set fstat64 d_fstat64
7232         eval $inlibc
7233
7234         : see if ftruncate64 exists
7235         set ftruncate64 d_ftruncate64
7236         eval $inlibc
7237
7238         : see if lockf64 exists
7239         set lockf64 d_lockf64
7240         eval $inlibc
7241
7242         : see if lseek64 exists
7243         set lseek64 d_lseek64
7244         eval $inlibc
7245
7246         : see if lstat64 exists
7247         set lstat64 d_lstat64
7248         eval $inlibc
7249
7250         : see if open64 exists
7251         set open64 d_open64
7252         eval $inlibc
7253
7254         : see if opendir64 exists
7255         set opendir64 d_opendir64
7256         eval $inlibc
7257
7258         : see if readdir64 exists
7259         set readdir64 d_readdir64
7260         eval $inlibc
7261
7262         : see if seekdir64 exists
7263         set seekdir64 d_seekdir64
7264         eval $inlibc
7265
7266         : see if stat64 exists
7267         set stat64 d_stat64
7268         eval $inlibc
7269
7270         : see if telldir64 exists
7271         set telldir64 d_telldir64
7272         eval $inlibc
7273
7274         : see if truncate64 exists
7275         set truncate64 d_truncate64
7276         eval $inlibc
7277
7278         : check for off64_t
7279         echo " "
7280         echo $n "Checking to see if your system supports off64_t...$c" >&4
7281         $cat >try.c <<EOCP
7282 #include <sys/types.h>
7283 off64_t foo() { off64_t x; x = 7; return x; }'
7284 EOCP
7285         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7286                 val="$define"
7287                 echo " Yup, it does." >&4
7288         else
7289                 val="$undef"
7290                 echo " Nope, it doesn't." >&4
7291         fi
7292         $rm -f try.*
7293         set d_off64t
7294         eval $setvar
7295
7296         : check for ino64_t
7297         echo " "
7298         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7299         val="$undef"
7300         case "$i_sysstat" in
7301         "$define" )
7302                 $cat >try.c <<EOCP
7303 #include <sys/types.h>
7304 #include <sys/stat.h>
7305 ino64_t foo() { ino64_t x; x = 7; return x; }'
7306 EOCP
7307                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7308                         val="$define"
7309                 fi
7310                 $rm -f try.*
7311                 ;;
7312         esac
7313         if $test "X$val" = X"$define"; then
7314                 echo " Yup, it does." >&4
7315         else
7316                 echo " Nope, it doesn't." >&4
7317         fi
7318         set d_ino64t
7319         eval $setvar
7320
7321         : check for struct flock64
7322         echo " "
7323         echo "Checking to see if your system supports struct flock64..." >&4
7324         if $h_fcntl; then
7325                 set d_flock64_s flock64 l_len define fcntl.h
7326                 eval $hasfield
7327         else
7328                 val="$undef"
7329                 set d_flock64_s
7330                 eval $setvar
7331         fi
7332         case "$d_flock64_s" in
7333         "$define")      echo "Yup, it does." >&4
7334                         ;;
7335         *)              echo "Nope, it doesn't." >&4
7336                         ;;
7337         esac
7338
7339         : check for struct dirent64
7340         echo " "
7341         echo "Checking to see if your system supports struct dirent64..." >&4
7342         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
7343         eval $hasfield
7344         case "$d_dirent64_s" in
7345         "$define")      echo "Yup, it does." >&4
7346                         ;;
7347         *)              echo "Nope, it doesn't." >&4
7348                         ;;
7349         esac
7350
7351 else
7352         val="$undef"
7353         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64t d_ino64t d_flock64_s d_dirent64_s
7354         do
7355                 set $xxx
7356                 eval $setvar
7357         done
7358 fi
7359
7360 : see if dlerror exists
7361 xxx_runnm="$runnm"
7362 runnm=false
7363 set dlerror d_dlerror
7364 eval $inlibc
7365 runnm="$xxx_runnm"
7366
7367 : see if dlfcn is available
7368 set dlfcn.h i_dlfcn
7369 eval $inhdr
7370
7371 case "$usedl" in
7372 $define|y|true)
7373         $cat << EOM
7374
7375 On a few systems, the dynamically loaded modules that perl generates and uses
7376 will need a different extension than shared libs. The default will probably
7377 be appropriate.
7378
7379 EOM
7380         case "$dlext" in
7381         '')     dflt="$so" ;;
7382         *)      dflt="$dlext" ;;
7383         esac
7384         rp='What is the extension of dynamically loaded modules'
7385         . ./myread
7386         dlext="$ans"
7387         ;;
7388 *)
7389         dlext="none"
7390         ;;
7391 esac
7392
7393 : Check if dlsym need a leading underscore
7394 echo " "
7395 val="$undef"
7396
7397 case "$dlsrc" in
7398 dl_dlopen.xs)
7399         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7400         $cat >dyna.c <<'EOM'
7401 fred () { }
7402 EOM
7403
7404 $cat >fred.c<<EOM
7405
7406 #include <stdio.h>
7407 #$i_dlfcn I_DLFCN
7408 #ifdef I_DLFCN
7409 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7410 #else
7411 #include <sys/types.h>
7412 #include <nlist.h>
7413 #include <link.h>
7414 #endif
7415
7416 extern int fred() ;
7417
7418 int main()
7419 {
7420     void * handle ;
7421     void * symbol ;
7422 #ifndef RTLD_LAZY
7423     int mode = 1 ;
7424 #else
7425     int mode = RTLD_LAZY ;
7426 #endif
7427     handle = dlopen("./dyna.$dlext", mode) ;
7428     if (handle == NULL) {
7429         printf ("1\n") ;
7430         fflush (stdout) ;
7431         exit(0);
7432     }
7433     symbol = dlsym(handle, "fred") ;
7434     if (symbol == NULL) {
7435         /* try putting a leading underscore */
7436         symbol = dlsym(handle, "_fred") ;
7437         if (symbol == NULL) {
7438             printf ("2\n") ;
7439             fflush (stdout) ;
7440             exit(0);
7441         }
7442         printf ("3\n") ;
7443     }
7444     else
7445         printf ("4\n") ;
7446     fflush (stdout) ;
7447     exit(0);
7448 }
7449 EOM
7450         : Call the object file tmp-dyna.o in case dlext=o.
7451         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7452                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7453                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7454                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7455                 xxx=`./fred`
7456                 case $xxx in
7457                 1)      echo "Test program failed using dlopen." >&4
7458                         echo "Perhaps you should not use dynamic loading." >&4;;
7459                 2)      echo "Test program failed using dlsym." >&4
7460                         echo "Perhaps you should not use dynamic loading." >&4;;
7461                 3)      echo "dlsym needs a leading underscore" >&4
7462                         val="$define" ;;
7463                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7464                 esac
7465         else
7466                 echo "I can't compile and run the test program." >&4
7467         fi
7468         ;;
7469 esac
7470                 
7471 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7472
7473 set d_dlsymun
7474 eval $setvar
7475
7476 hasproto='varname=$1; func=$2; shift; shift;
7477 while $test $# -ge 2; do
7478         case "$1" in
7479         $define) echo "#include <$2>";;
7480         esac ;
7481     shift 2;
7482 done > try.c;
7483 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7484 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7485         echo "$func() prototype found.";
7486         val="$define";
7487 else
7488         echo "$func() prototype NOT found.";
7489         val="$undef";
7490 fi;
7491 set $varname;
7492 eval $setvar;
7493 $rm -f try.c tryout.c'
7494
7495 : see if prototype for drand48 is available
7496 echo " "
7497 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7498 eval $hasproto
7499
7500 : see if dup2 exists
7501 set dup2 d_dup2
7502 eval $inlibc
7503
7504 : see if eaccess exists
7505 set eaccess d_eaccess
7506 eval $inlibc
7507
7508 : see if endgrent exists
7509 set endgrent d_endgrent
7510 eval $inlibc
7511
7512 : see if endhostent exists
7513 set endhostent d_endhent
7514 eval $inlibc
7515
7516 : see if endnetent exists
7517 set endnetent d_endnent
7518 eval $inlibc
7519
7520 : see if endprotoent exists
7521 set endprotoent d_endpent
7522 eval $inlibc
7523
7524 : see if endpwent exists
7525 set endpwent d_endpwent
7526 eval $inlibc
7527
7528 : see if endservent exists
7529 set endservent d_endsent
7530 eval $inlibc
7531
7532 : Locate the flags for 'open()'
7533 echo " "
7534 $cat >open3.c <<'EOCP'
7535 #include <sys/types.h>
7536 #ifdef I_FCNTL
7537 #include <fcntl.h>
7538 #endif
7539 #ifdef I_SYS_FILE
7540 #include <sys/file.h>
7541 #endif
7542 int main() {
7543         if(O_RDONLY);
7544 #ifdef O_TRUNC
7545         exit(0);
7546 #else
7547         exit(1);
7548 #endif
7549 }
7550 EOCP
7551 : check sys/file.h first to get FREAD on Sun
7552 if $test `./findhdr sys/file.h` && \
7553                 set open3 -DI_SYS_FILE && eval $compile; then
7554         h_sysfile=true;
7555         echo "<sys/file.h> defines the O_* constants..." >&4
7556         if ./open3; then
7557                 echo "and you have the 3 argument form of open()." >&4
7558                 val="$define"
7559         else
7560                 echo "but not the 3 argument form of open().  Oh, well." >&4
7561                 val="$undef"
7562         fi
7563 elif $test `./findhdr fcntl.h` && \
7564                 set open3 -DI_FCNTL && eval $compile; then
7565         h_fcntl=true;
7566         echo "<fcntl.h> defines the O_* constants..." >&4
7567         if ./open3; then
7568                 echo "and you have the 3 argument form of open()." >&4
7569                 val="$define"
7570         else
7571                 echo "but not the 3 argument form of open().  Oh, well." >&4
7572                 val="$undef"
7573         fi
7574 else
7575         val="$undef"
7576         echo "I can't find the O_* constant definitions!  You got problems." >&4
7577 fi
7578 set d_open3
7579 eval $setvar
7580 $rm -f open3*
7581
7582 : check for non-blocking I/O stuff
7583 case "$h_sysfile" in
7584 true) echo "#include <sys/file.h>" > head.c;;
7585 *)
7586         case "$h_fcntl" in
7587         true) echo "#include <fcntl.h>" > head.c;;
7588         *) echo "#include <sys/fcntl.h>" > head.c;;
7589         esac
7590         ;;
7591 esac
7592 echo " "
7593 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7594 case "$o_nonblock" in
7595 '')
7596         $cat head.c > try.c
7597         $cat >>try.c <<'EOCP'
7598 int main() {
7599 #ifdef O_NONBLOCK
7600         printf("O_NONBLOCK\n");
7601         exit(0);
7602 #endif
7603 #ifdef O_NDELAY
7604         printf("O_NDELAY\n");
7605         exit(0);
7606 #endif
7607 #ifdef FNDELAY
7608         printf("FNDELAY\n");
7609         exit(0);
7610 #endif
7611         exit(0);
7612 }
7613 EOCP
7614         set try
7615         if eval $compile_ok; then
7616                 o_nonblock=`./try`
7617                 case "$o_nonblock" in
7618                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7619                 *) echo "Seems like we can use $o_nonblock.";;
7620                 esac
7621         else
7622                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7623         fi
7624         ;;
7625 *) echo "Using $hint value $o_nonblock.";;
7626 esac
7627 $rm -f try try.* .out core
7628
7629 echo " "
7630 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7631 case "$eagain" in
7632 '')
7633         $cat head.c > try.c
7634         $cat >>try.c <<EOCP
7635 #include <errno.h>
7636 #include <sys/types.h>
7637 #include <signal.h>
7638 #define MY_O_NONBLOCK $o_nonblock
7639 #ifndef errno  /* XXX need better Configure test */
7640 extern int errno;
7641 #endif
7642 $signal_t blech(x) int x; { exit(3); }
7643 EOCP
7644         $cat >> try.c <<'EOCP'
7645 int main()
7646 {
7647         int pd[2];
7648         int pu[2];
7649         char buf[1];
7650         char string[100];
7651
7652         pipe(pd);       /* Down: child -> parent */
7653         pipe(pu);       /* Up: parent -> child */
7654         if (0 != fork()) {
7655                 int ret;
7656                 close(pd[1]);   /* Parent reads from pd[0] */
7657                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
7658                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
7659                         exit(1);
7660                 signal(SIGALRM, blech);
7661                 alarm(5);
7662                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
7663                         exit(2);
7664                 sprintf(string, "%d\n", ret);
7665                 write(2, string, strlen(string));
7666                 alarm(0);
7667 #ifdef EAGAIN
7668                 if (errno == EAGAIN) {
7669                         printf("EAGAIN\n");
7670                         goto ok;
7671                 }
7672 #endif
7673 #ifdef EWOULDBLOCK
7674                 if (errno == EWOULDBLOCK)
7675                         printf("EWOULDBLOCK\n");
7676 #endif
7677         ok:
7678                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
7679                 sleep(2);                               /* Give it time to close our pipe */
7680                 alarm(5);
7681                 ret = read(pd[0], buf, 1);      /* Should read EOF */
7682                 alarm(0);
7683                 sprintf(string, "%d\n", ret);
7684                 write(3, string, strlen(string));
7685                 exit(0);
7686         }
7687
7688         close(pd[0]);                   /* We write to pd[1] */
7689         close(pu[1]);                   /* We read from pu[0] */
7690         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
7691         close(pd[1]);                   /* Pipe pd is now fully closed! */
7692         exit(0);                                /* Bye bye, thank you for playing! */
7693 }
7694 EOCP
7695         set try
7696         if eval $compile_ok; then
7697                 echo "$startsh" >mtry
7698                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
7699                 chmod +x mtry
7700                 ./mtry >/dev/null 2>&1
7701                 case $? in
7702                 0) eagain=`$cat try.out`;;
7703                 1) echo "Could not perform non-blocking setting!";;
7704                 2) echo "I did a successful read() for something that was not there!";;
7705                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7706                 *) echo "Something terribly wrong happened during testing.";;
7707                 esac
7708                 rd_nodata=`$cat try.ret`
7709                 echo "A read() system call with no data present returns $rd_nodata."
7710                 case "$rd_nodata" in
7711                 0|-1) ;;
7712                 *)
7713                         echo "(That's peculiar, fixing that to be -1.)"
7714                         rd_nodata=-1
7715                         ;;
7716                 esac
7717                 case "$eagain" in
7718                 '')
7719                         echo "Forcing errno EAGAIN on read() with no data available."
7720                         eagain=EAGAIN
7721                         ;;
7722                 *)
7723                         echo "Your read() sets errno to $eagain when no data is available."
7724                         ;;
7725                 esac
7726                 status=`$cat try.err`
7727                 case "$status" in
7728                 0) echo "And it correctly returns 0 to signal EOF.";;
7729                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7730                 *) echo "However, your read() returns '$status' on EOF??";;
7731                 esac
7732                 val="$define"
7733                 if test "$status" = "$rd_nodata"; then
7734                         echo "WARNING: you can't distinguish between EOF and no data!"
7735                         val="$undef"
7736                 fi
7737         else
7738                 echo "I can't compile the test program--assuming errno EAGAIN will do."
7739                 eagain=EAGAIN
7740         fi
7741         set d_eofnblk
7742         eval $setvar
7743         ;;
7744 *)
7745         echo "Using $hint value $eagain."
7746         echo "Your read() returns $rd_nodata when no data is present."
7747         case "$d_eofnblk" in
7748         "$define") echo "And you can see EOF because read() returns 0.";;
7749         "$undef") echo "But you can't see EOF status from read() returned value.";;
7750         *)
7751                 echo "(Assuming you can't see EOF status from read anyway.)"
7752                 d_eofnblk=$undef
7753                 ;;
7754         esac
7755         ;;
7756 esac
7757 $rm -f try try.* .out core head.c mtry
7758
7759 : see if fchmod exists
7760 set fchmod d_fchmod
7761 eval $inlibc
7762
7763 : see if fchown exists
7764 set fchown d_fchown
7765 eval $inlibc
7766
7767 : see if this is an fcntl system
7768 set fcntl d_fcntl
7769 eval $inlibc
7770
7771 : see if sys/select.h has to be included
7772 set sys/select.h i_sysselct
7773 eval $inhdr
7774
7775 : see if we should include time.h, sys/time.h, or both
7776 echo " "
7777 if test "X$timeincl" = X; then
7778         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7779         $echo $n "I'm now running the test program...$c"
7780         $cat >try.c <<'EOCP'
7781 #include <sys/types.h>
7782 #ifdef I_TIME
7783 #include <time.h>
7784 #endif
7785 #ifdef I_SYSTIME
7786 #ifdef SYSTIMEKERNEL
7787 #define KERNEL
7788 #endif
7789 #include <sys/time.h>
7790 #endif
7791 #ifdef I_SYSSELECT
7792 #include <sys/select.h>
7793 #endif
7794 int main()
7795 {
7796         struct tm foo;
7797 #ifdef S_TIMEVAL
7798         struct timeval bar;
7799 #endif
7800 #ifdef S_TIMEZONE
7801         struct timezone tzp;
7802 #endif
7803         if (foo.tm_sec == foo.tm_sec)
7804                 exit(0);
7805 #ifdef S_TIMEVAL
7806         if (bar.tv_sec == bar.tv_sec)
7807                 exit(0);
7808 #endif
7809         exit(1);
7810 }
7811 EOCP
7812         flags=''
7813         for s_timezone in '-DS_TIMEZONE' ''; do
7814         sysselect=''
7815         for s_timeval in '-DS_TIMEVAL' ''; do
7816         for i_systimek in '' '-DSYSTIMEKERNEL'; do
7817         for i_time in '' '-DI_TIME'; do
7818         for i_systime in '-DI_SYSTIME' ''; do
7819                 case "$flags" in
7820                 '') $echo $n ".$c"
7821                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
7822                         if eval $compile; then
7823                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7824                                 shift
7825                                 flags="$*"
7826                                 echo " "
7827                                 $echo $n "Succeeded with $flags$c"
7828                         fi
7829                         ;;
7830                 esac
7831         done
7832         done
7833         done
7834         done
7835         done
7836         timeincl=''
7837         echo " "
7838         case "$flags" in
7839         *SYSTIMEKERNEL*) i_systimek="$define"
7840                 timeincl=`./findhdr sys/time.h`
7841                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7842         *) i_systimek="$undef";;
7843         esac
7844         case "$flags" in
7845         *I_TIME*) i_time="$define"
7846                 timeincl=`./findhdr time.h`" $timeincl"
7847                 echo "We'll include <time.h>." >&4;;
7848         *) i_time="$undef";;
7849         esac
7850         case "$flags" in
7851         *I_SYSTIME*) i_systime="$define"
7852                 timeincl=`./findhdr sys/time.h`" $timeincl"
7853                 echo "We'll include <sys/time.h>." >&4;;
7854         *) i_systime="$undef";;
7855         esac
7856         $rm -f try.c try
7857 fi
7858
7859 : check for fd_set items
7860 $cat <<EOM
7861
7862 Checking to see how well your C compiler handles fd_set and friends ...
7863 EOM
7864 $cat >fd_set.c <<EOCP
7865 #$i_systime I_SYS_TIME
7866 #$i_sysselct I_SYS_SELECT
7867 #$d_socket HAS_SOCKET
7868 #include <sys/types.h>
7869 #ifdef HAS_SOCKET
7870 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7871 #endif
7872 #ifdef I_SYS_TIME
7873 #include <sys/time.h>
7874 #endif
7875 #ifdef I_SYS_SELECT
7876 #include <sys/select.h>
7877 #endif
7878 int main() {
7879         fd_set fds;
7880
7881 #ifdef TRYBITS
7882         if(fds.fds_bits);
7883 #endif
7884
7885 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7886         exit(0);
7887 #else
7888         exit(1);
7889 #endif
7890 }
7891 EOCP
7892 set fd_set -DTRYBITS
7893 if eval $compile; then
7894         d_fds_bits="$define"
7895         d_fd_set="$define"
7896         echo "Well, your system knows about the normal fd_set typedef..." >&4
7897         if ./fd_set; then
7898                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7899                 d_fd_macros="$define"
7900         else
7901                 $cat >&4 <<'EOM'
7902 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
7903 EOM
7904                 d_fd_macros="$undef"
7905         fi
7906 else
7907         $cat <<'EOM'
7908 Hmm, your compiler has some difficulty with fd_set.  Checking further...
7909 EOM
7910         set fd_set
7911         if eval $compile; then
7912                 d_fds_bits="$undef"
7913                 d_fd_set="$define"
7914                 echo "Well, your system has some sort of fd_set available..." >&4
7915                 if ./fd_set; then
7916                         echo "and you have the normal fd_set macros." >&4
7917                         d_fd_macros="$define"
7918                 else
7919                         $cat <<'EOM'
7920 but not the normal fd_set macros!  Gross!  More work for me...
7921 EOM
7922                         d_fd_macros="$undef"
7923                 fi
7924         else
7925         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
7926                 d_fd_set="$undef"
7927                 d_fds_bits="$undef"
7928                 d_fd_macros="$undef"
7929         fi
7930 fi
7931 $rm -f fd_set*
7932
7933 : see if fgetpos exists
7934 set fgetpos d_fgetpos
7935 eval $inlibc
7936
7937
7938 if $test X"$use64bits" = X"$define"; then
7939         : see if fgetpos64 exists
7940         set fgetpos64 d_fgetpos64
7941         eval $inlibc
7942
7943         : see if fopen64 exists
7944         set freopen64 d_fopen64
7945         eval $inlibc
7946
7947         : see if freopen64 exists
7948         set freopen64 d_freopen64
7949         eval $inlibc
7950
7951         : see if fseek64 exists
7952         set fseek64 d_fseek64
7953         eval $inlibc
7954
7955         : see if fseeko64 exists
7956         set fseeko64 d_fseeko64
7957         eval $inlibc
7958
7959         : see if fsetpos64 exists
7960         set fsetpos64 d_fsetpos64
7961         eval $inlibc
7962
7963         : see if ftell64 exists
7964         set ftell64 d_ftell64
7965         eval $inlibc
7966
7967         : see if ftello64 exists
7968         set ftello64 d_ftello64
7969         eval $inlibc
7970
7971         : see if tmpfile64 exists
7972         set tmpfile64 d_tmpfile64
7973         eval $inlibc
7974 else
7975         val="$undef"
7976         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
7977         do
7978                 set $xxx
7979                 eval $setvar
7980         done
7981 fi
7982
7983 : see if flock exists
7984 set flock d_flock
7985 eval $inlibc
7986
7987 : see if fork exists
7988 set fork d_fork
7989 eval $inlibc
7990
7991 : see if pathconf exists
7992 set pathconf d_pathconf
7993 eval $inlibc
7994
7995 : see if fpathconf exists
7996 set fpathconf d_fpathconf
7997 eval $inlibc
7998
7999 : see if fseeko exists
8000 set fseeko d_fseeko
8001 eval $inlibc
8002
8003 : see if fsetpos exists
8004 set fsetpos d_fsetpos
8005 eval $inlibc
8006
8007 : see if this is a sys/param system
8008 set sys/param.h i_sysparam
8009 eval $inhdr
8010
8011 : see if this is a sys/mount.h system
8012 set sys/mount.h i_sysmount
8013 eval $inhdr
8014
8015
8016 : see if statfs exists
8017 set statfs d_statfs
8018 eval $inlibc
8019
8020 : see if fstatfs exists
8021 set fstatfs d_fstatfs
8022 eval $inlibc
8023
8024 : see if statfs knows about mount flags
8025 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8026 eval $hasfield
8027
8028
8029 : see if statvfs exists
8030 set statvfs d_statvfs
8031 eval $inlibc
8032
8033 : see if fstatvfs exists
8034 set fstatvfs d_fstatvfs
8035 eval $inlibc
8036
8037
8038 : see if ftello exists
8039 set ftello d_ftello
8040 eval $inlibc
8041
8042 : see if getgrent exists
8043 set getgrent d_getgrent
8044 eval $inlibc
8045
8046 : see if gethostbyaddr exists
8047 set gethostbyaddr d_gethbyaddr
8048 eval $inlibc
8049
8050 : see if gethostbyname exists
8051 set gethostbyname d_gethbyname
8052 eval $inlibc
8053
8054 : see if gethostent exists
8055 set gethostent d_gethent
8056 eval $inlibc
8057
8058 : see how we will look up host name
8059 echo " "
8060 if false; then
8061         : dummy stub to allow use of elif
8062 elif set gethostname val -f d_gethname; eval $csym; $val; then
8063         echo 'gethostname() found.' >&4
8064         d_gethname="$define"
8065         call=gethostname
8066 elif set uname val -f d_uname; eval $csym; $val; then
8067         if ./xenix; then
8068                 $cat <<'EOM'
8069 uname() was found, but you're running xenix, and older versions of xenix
8070 have a broken uname(). If you don't really know whether your xenix is old
8071 enough to have a broken system call, use the default answer.
8072
8073 EOM
8074                 dflt=y
8075                 case "$d_uname" in
8076                 "$define") dflt=n;;
8077                 esac
8078                 rp='Is your uname() broken?'
8079                 . ./myread
8080                 case "$ans" in
8081                 n*) d_uname="$define"; call=uname;;
8082                 esac
8083         else
8084                 echo 'uname() found.' >&4
8085                 d_uname="$define"
8086                 call=uname
8087         fi
8088 fi
8089 case "$d_gethname" in
8090 '') d_gethname="$undef";;
8091 esac
8092 case "$d_uname" in
8093 '') d_uname="$undef";;
8094 esac
8095 case "$d_uname$d_gethname" in
8096 *define*)
8097         dflt=n
8098         cat <<EOM
8099  
8100 Every now and then someone has a $call() that lies about the hostname
8101 but can't be fixed for political or economic reasons.  If you wish, I can
8102 pretend $call() isn't there and maybe compute hostname at run-time
8103 thanks to the '$phostname' command.
8104
8105 EOM
8106         rp="Shall I ignore $call() from now on?"
8107         . ./myread
8108         case "$ans" in
8109         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8110         esac;;
8111 esac
8112 case "$phostname" in
8113 '') aphostname='';;
8114 *) case "$aphostname" in
8115         /*) ;;
8116         *) set X $phostname
8117                 shift
8118                 file=$1
8119                 shift
8120                 file=`./loc $file $file $pth`
8121                 aphostname=`echo $file $*`
8122                 ;;
8123         esac
8124         ;;
8125 esac
8126 case "$d_uname$d_gethname" in
8127 *define*) ;;
8128 *)
8129         case "$phostname" in
8130         '')
8131                 echo "There will be no way for $package to get your hostname." >&4;;
8132         *)
8133         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8134                 ;;
8135         esac;;
8136 esac
8137 case "$d_phostname" in
8138 '') d_phostname="$undef";;
8139 esac
8140
8141 : see if this is a netdb.h system
8142 set netdb.h i_netdb
8143 eval $inhdr
8144
8145 : see if prototypes for various gethostxxx netdb.h functions are available
8146 echo " "
8147 set d_gethostprotos gethostent $i_netdb netdb.h
8148 eval $hasproto
8149
8150 : see if getlogin exists
8151 set getlogin d_getlogin
8152 eval $inlibc
8153
8154 : see if getmntent exists
8155 set getmntent d_getmntent
8156 eval $inlibc
8157
8158 : see if getnetbyaddr exists
8159 set getnetbyaddr d_getnbyaddr
8160 eval $inlibc
8161
8162 : see if getnetbyname exists
8163 set getnetbyname d_getnbyname
8164 eval $inlibc
8165
8166 : see if getnetent exists
8167 set getnetent d_getnent
8168 eval $inlibc
8169
8170 : see if prototypes for various getnetxxx netdb.h functions are available
8171 echo " "
8172 set d_getnetprotos getnetent $i_netdb netdb.h
8173 eval $hasproto
8174
8175
8176 : see if getprotobyname exists
8177 set getprotobyname d_getpbyname
8178 eval $inlibc
8179
8180 : see if getprotobynumber exists
8181 set getprotobynumber d_getpbynumber
8182 eval $inlibc
8183
8184 : see if getprotoent exists
8185 set getprotoent d_getpent
8186 eval $inlibc
8187
8188 : see if getpgid exists
8189 set getpgid d_getpgid
8190 eval $inlibc
8191
8192 : see if getpgrp2 exists
8193 set getpgrp2 d_getpgrp2
8194 eval $inlibc
8195
8196 : see if getppid exists
8197 set getppid d_getppid
8198 eval $inlibc
8199
8200 : see if getpriority exists
8201 set getpriority d_getprior
8202 eval $inlibc
8203
8204 : see if prototypes for various getprotoxxx netdb.h functions are available
8205 echo " "
8206 set d_getprotoprotos getprotoent $i_netdb netdb.h
8207 eval $hasproto
8208
8209 : see if getpwent exists
8210 set getpwent d_getpwent
8211 eval $inlibc
8212
8213
8214 : see if getservbyname exists
8215 set getservbyname d_getsbyname
8216 eval $inlibc
8217
8218 : see if getservbyport exists
8219 set getservbyport d_getsbyport
8220 eval $inlibc
8221
8222 : see if getservent exists
8223 set getservent d_getsent
8224 eval $inlibc
8225
8226 : see if prototypes for various getservxxx netdb.h functions are available
8227 echo " "
8228 set d_getservprotos getservent $i_netdb netdb.h
8229 eval $hasproto
8230
8231 : see if gettimeofday or ftime exists
8232 set gettimeofday d_gettimeod
8233 eval $inlibc
8234 case "$d_gettimeod" in
8235 "$undef")
8236         set ftime d_ftime 
8237         eval $inlibc
8238         ;;
8239 *)
8240         val="$undef"; set d_ftime; eval $setvar
8241         ;;
8242 esac
8243 case "$d_gettimeod$d_ftime" in
8244 "$undef$undef")
8245         echo " "
8246         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8247         ;;
8248 esac
8249
8250 : see if this is an grp system
8251 set grp.h i_grp
8252 eval $inhdr
8253
8254 case "$i_grp" in
8255 $define)
8256         xxx=`./findhdr grp.h`
8257         $cppstdin $cppflags $cppminus < $xxx >$$.h
8258
8259         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8260                 val="$define"
8261         else
8262                 val="$undef"
8263         fi
8264         set d_grpasswd
8265         eval $setvar
8266
8267         $rm -f $$.h
8268         ;;
8269 *)
8270         val="$undef";
8271         set d_grpasswd; eval $setvar
8272         ;;
8273 esac
8274
8275 : see if hasmntopt exists
8276 set hasmntopt d_hasmntopt
8277 eval $inlibc
8278
8279 : see if this is a netinet/in.h or sys/in.h system
8280 set netinet/in.h i_niin sys/in.h i_sysin
8281 eval $inhdr
8282
8283 : see if arpa/inet.h has to be included
8284 set arpa/inet.h i_arpainet
8285 eval $inhdr
8286
8287 : see if htonl --and friends-- exists
8288 val=''
8289 set htonl val
8290 eval $inlibc
8291
8292 : Maybe they are macros.
8293 case "$val" in
8294 $undef)
8295         $cat >htonl.c <<EOM
8296 #include <stdio.h>
8297 #include <sys/types.h>
8298 #$i_niin I_NETINET_IN
8299 #$i_sysin I_SYS_IN
8300 #$i_arpainet I_ARPA_INET
8301 #ifdef I_NETINET_IN
8302 #include <netinet/in.h>
8303 #endif
8304 #ifdef I_SYS_IN
8305 #include <sys/in.h>
8306 #endif
8307 #ifdef I_ARPA_INET
8308 #include <arpa/inet.h>
8309 #endif
8310 #ifdef htonl
8311 printf("Defined as a macro.");
8312 #endif
8313 EOM
8314         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8315         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8316                 val="$define"
8317                 echo "But it seems to be defined as a macro." >&4
8318         fi
8319         $rm -f htonl.?
8320         ;;
8321 esac
8322 set d_htonl
8323 eval $setvar
8324
8325 : see which of string.h or strings.h is needed
8326 echo " "
8327 strings=`./findhdr string.h`
8328 if $test "$strings" && $test -r "$strings"; then
8329         echo "Using <string.h> instead of <strings.h>." >&4
8330         val="$define"
8331 else
8332         val="$undef"
8333         strings=`./findhdr strings.h`
8334         if $test "$strings" && $test -r "$strings"; then
8335                 echo "Using <strings.h> instead of <string.h>." >&4
8336         else
8337                 echo "No string header found -- You'll surely have problems." >&4
8338         fi
8339 fi
8340 set i_string
8341 eval $setvar
8342 case "$i_string" in
8343 "$undef") strings=`./findhdr strings.h`;;
8344 *)        strings=`./findhdr string.h`;;
8345 esac
8346
8347 : index or strchr
8348 echo " "
8349 if set index val -f; eval $csym; $val; then
8350         if set strchr val -f d_strchr; eval $csym; $val; then
8351                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8352                         val="$define"
8353                         vali="$undef"
8354                         echo "strchr() found." >&4
8355                 else
8356                         val="$undef"
8357                         vali="$define"
8358                         echo "index() found." >&4
8359                 fi
8360         else
8361                 val="$undef"
8362                 vali="$define"
8363                 echo "index() found." >&4
8364         fi
8365 else
8366         if set strchr val -f d_strchr; eval $csym; $val; then
8367                 val="$define"
8368                 vali="$undef"
8369                 echo "strchr() found." >&4
8370         else
8371                 echo "No index() or strchr() found!" >&4
8372                 val="$undef"
8373                 vali="$undef"
8374         fi
8375 fi
8376 set d_strchr; eval $setvar
8377 val="$vali"
8378 set d_index; eval $setvar
8379
8380 : check whether inet_aton exists
8381 set inet_aton d_inetaton
8382 eval $inlibc
8383
8384 : see if inttypes.h is available
8385 : we want a real compile instead of Inhdr because some systems
8386 : have an inttypes.h which includes non-existent headers
8387 echo " "
8388 $cat >try.c <<EOCP
8389 #include <inttypes.h>
8390 int main() {
8391         static int32_t foo32 = 0x12345678;
8392 }
8393 EOCP
8394 set try
8395 if eval $compile; then
8396         echo "<inttypes.h> found." >&4
8397         val="$define"
8398 else
8399         echo "<inttypes.h> NOT found." >&4
8400         val="$undef"
8401 fi
8402 $rm -f try.c try
8403 set i_inttypes
8404 eval $setvar
8405
8406 : check for int64_t
8407 case "$use64bits" in
8408 "$define" )
8409         echo " "
8410         echo $n "Checking to see if your system supports int64_t...$c" >&4
8411         $cat >try.c <<EOCP
8412 #include <sys/types.h>
8413 #$i_inttypes I_INTTYPES
8414 #ifdef I_INTTYPES
8415 #include <inttypes.h>
8416 #endif
8417 int64_t foo() { int64_t x; x = 7; return x; }
8418 EOCP
8419         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8420                 val="$define"
8421                 echo " Yup, it does." >&4
8422         else
8423                 val="$undef"
8424                 echo " Nope, it doesn't." >&4
8425         fi
8426         $rm -f try.*
8427         ;;
8428 *)      val="$undef"
8429         ;;
8430 esac
8431 set d_int64t
8432 eval $setvar
8433
8434
8435 : Look for isascii
8436 echo " "
8437 $cat >isascii.c <<'EOCP'
8438 #include <stdio.h>
8439 #include <ctype.h>
8440 int main() {
8441         int c = 'A';
8442         if (isascii(c))
8443                 exit(0);
8444         else
8445                 exit(1);
8446 }
8447 EOCP
8448 set isascii
8449 if eval $compile; then
8450         echo "isascii() found." >&4
8451         val="$define"
8452 else
8453         echo "isascii() NOT found." >&4
8454         val="$undef"
8455 fi
8456 set d_isascii
8457 eval $setvar
8458 $rm -f isascii*
8459
8460 : see if killpg exists
8461 set killpg d_killpg
8462 eval $inlibc
8463
8464 : see if lchown exists
8465 echo " "
8466 $cat > try.c <<'EOCP'
8467 /* System header to define __stub macros and hopefully few prototypes,
8468     which can conflict with char lchown(); below.  */
8469 #include <assert.h>
8470 /* Override any gcc2 internal prototype to avoid an error.  */
8471 /* We use char because int might match the return type of a gcc2
8472    builtin and then its argument prototype would still apply.  */
8473 char lchown();
8474 int main() {
8475     /*  The GNU C library defines this for functions which it implements
8476         to always fail with ENOSYS.  Some functions are actually named
8477         something starting with __ and the normal name is an alias.  */
8478 #if defined (__stub_lchown) || defined (__stub___lchown)
8479 choke me
8480 #else
8481 lchown();
8482 #endif
8483 ; return 0; }
8484 EOCP
8485 set try
8486 if eval $compile; then
8487     $echo "lchown() found." >&4
8488     val="$define"
8489 else
8490     $echo "lchown() NOT found." >&4
8491     val="$undef"
8492 fi
8493 set d_lchown
8494 eval $setvar
8495
8496 : see if link exists
8497 set link d_link
8498 eval $inlibc
8499
8500 : see if localeconv exists
8501 set localeconv d_locconv
8502 eval $inlibc
8503
8504 : see if lockf exists
8505 set lockf d_lockf
8506 eval $inlibc
8507
8508 : check for length of double
8509 echo " "
8510 case "$doublesize" in
8511 '')
8512         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8513         $cat >try.c <<'EOCP'
8514 #include <stdio.h>
8515 int main()
8516 {
8517         printf("%d\n", sizeof(double));
8518 }
8519 EOCP
8520         set try
8521         if eval $compile_ok; then
8522                 doublesize=`./try`
8523                 $echo " $doublesize bytes." >&4
8524         else
8525                 dflt='8'
8526                 echo "(I can't seem to compile the test program.  Guessing...)"
8527                 rp="What is the size of a double precision number (in bytes)?"
8528                 . ./myread
8529                 doublesize="$ans"
8530         fi
8531         ;;
8532 esac
8533 $rm -f try.c try
8534
8535 : check for long doubles
8536 echo " "
8537 echo $n "Checking to see if your system supports long doubles...$c" >&4
8538 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
8539 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8540         val="$define"
8541         echo " Yup, it does." >&4
8542 else
8543         val="$undef"
8544         echo " Nope, it doesn't." >&4
8545 fi
8546 $rm try.*
8547 set d_longdbl
8548 eval $setvar
8549
8550 : check for length of long double
8551 case "${d_longdbl}${longdblsize}" in
8552 $define)
8553         echo " "
8554         $echo $n "Checking to see how big your long doubles are...$c" >&4
8555         $cat >try.c <<'EOCP'
8556 #include <stdio.h>
8557 int main()
8558 {
8559         printf("%d\n", sizeof(long double));
8560 }
8561 EOCP
8562         set try
8563         if eval $compile; then
8564                 longdblsize=`./try`
8565                 $echo " $longdblsize bytes." >&4
8566         else
8567                 dflt='8'
8568                 echo " "
8569                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
8570                 rp="What is the size of a long double (in bytes)?"
8571                 . ./myread
8572                 longdblsize="$ans"
8573         fi
8574         if $test "X$doublesize" = "X$longdblsize"; then
8575                 echo "(That isn't any different from an ordinary double.)"
8576         fi      
8577         ;;
8578 esac
8579 $rm -f try.c try
8580
8581 : check for long long
8582 echo " "
8583 echo $n "Checking to see if your system supports long long...$c" >&4
8584 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8585 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8586         val="$define"
8587         echo " Yup, it does." >&4
8588 else
8589         val="$undef"
8590         echo " Nope, it doesn't." >&4
8591 fi
8592 $rm try.*
8593 set d_longlong
8594 eval $setvar
8595
8596 : check for length of long long
8597 case "${d_longlong}${longlongsize}" in
8598 $define)
8599         echo " "
8600         $echo $n "Checking to see how big your long longs are...$c" >&4
8601         $cat >try.c <<'EOCP'
8602 #include <stdio.h>
8603 int main()
8604 {
8605         printf("%d\n", sizeof(long long));
8606 }
8607 EOCP
8608         set try
8609         if eval $compile_ok; then
8610                 longlongsize=`./try`
8611                 $echo " $longlongsize bytes." >&4
8612         else
8613                 dflt='8'
8614                 echo " "
8615                 echo "(I can't seem to compile the test program.  Guessing...)"
8616                 rp="What is the size of a long long (in bytes)?"
8617                 . ./myread
8618                 longlongsize="$ans"
8619         fi
8620         if $test "X$longsize" = "X$longlongsize"; then
8621                 echo "(That isn't any different from an ordinary long.)"
8622         fi      
8623         ;;
8624 esac
8625 $rm -f try.c try
8626
8627 : see if lstat exists
8628 set lstat d_lstat
8629 eval $inlibc
8630
8631 : see if madvise exists
8632 set madvise d_madvise
8633 eval $inlibc
8634
8635 : see if mblen exists
8636 set mblen d_mblen
8637 eval $inlibc
8638
8639 : see if mbstowcs exists
8640 set mbstowcs d_mbstowcs
8641 eval $inlibc
8642
8643 : see if mbtowc exists
8644 set mbtowc d_mbtowc
8645 eval $inlibc
8646
8647 : see if memcmp exists
8648 set memcmp d_memcmp
8649 eval $inlibc
8650
8651 : see if memcpy exists
8652 set memcpy d_memcpy
8653 eval $inlibc
8654
8655 : see if memmove exists
8656 set memmove d_memmove
8657 eval $inlibc
8658
8659 : see if memset exists
8660 set memset d_memset
8661 eval $inlibc
8662
8663 : see if mkdir exists
8664 set mkdir d_mkdir
8665 eval $inlibc
8666
8667 : see if mkfifo exists
8668 set mkfifo d_mkfifo
8669 eval $inlibc
8670
8671 : see if mktime exists
8672 set mktime d_mktime
8673 eval $inlibc
8674
8675 : see if this is a sys/mman.h system
8676 set sys/mman.h i_sysmman
8677 eval $inhdr
8678
8679 : see if mmap exists
8680 set mmap d_mmap
8681 eval $inlibc
8682 : see what shmat returns
8683 : default to something harmless
8684 mmaptype='void *'
8685 case "$i_sysmman$d_mmap" in
8686 "$define$define")
8687         $cat >mmap.c <<'END'
8688 #include <sys/mman.h>
8689 void *mmap();
8690 END
8691         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
8692                 mmaptype='void *'
8693         else
8694                 mmaptype='caddr_t'
8695         fi
8696         echo "and it returns ($mmaptype)." >&4
8697         ;;
8698 esac
8699
8700
8701
8702 : see if mprotect exists
8703 set mprotect d_mprotect
8704 eval $inlibc
8705
8706 : see if msgctl exists
8707 set msgctl d_msgctl
8708 eval $inlibc
8709
8710 : see if msgget exists
8711 set msgget d_msgget
8712 eval $inlibc
8713
8714 : see if msgsnd exists
8715 set msgsnd d_msgsnd
8716 eval $inlibc
8717
8718 : see if msgrcv exists
8719 set msgrcv d_msgrcv
8720 eval $inlibc
8721
8722 : see how much of the 'msg*(2)' library is present.
8723 h_msg=true
8724 echo " "
8725 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8726 *"$undef"*) h_msg=false;;
8727 esac
8728 case "$osname" in
8729 freebsd)
8730     case "`ipcs 2>&1`" in
8731     "SVID messages"*"not configured"*)
8732         echo "Your $osname does not have the msg*(2) configured." >&4
8733         h_msg=false
8734         val="$undef"
8735         set msgctl d_msgctl
8736         eval $setvar
8737         set msgget d_msgget
8738         eval $setvar
8739         set msgsnd d_msgsnd
8740         eval $setvar
8741         set msgrcv d_msgrcv
8742         eval $setvar
8743         ;;
8744     esac
8745     ;;
8746 esac
8747 : we could also check for sys/ipc.h ...
8748 if $h_msg && $test `./findhdr sys/msg.h`; then
8749         echo "You have the full msg*(2) library." >&4
8750         val="$define"
8751 else
8752         echo "You don't have the full msg*(2) library." >&4
8753         val="$undef"
8754 fi
8755 set d_msg
8756 eval $setvar
8757
8758 : see if msync exists
8759 set msync d_msync
8760 eval $inlibc
8761
8762 : see if munmap exists
8763 set munmap d_munmap
8764 eval $inlibc
8765
8766 : see if nice exists
8767 set nice d_nice
8768 eval $inlibc
8769
8770 : how to create joinable pthreads
8771 if test "X$usethreads" = "X$define"; then
8772         echo " "
8773         echo "Checking what constant to use for creating joinable pthreads..." >&4 
8774         $cat >try.c <<'EOCP'
8775 #include <pthread.h>
8776 int main() {
8777     int detachstate = JOINABLE;
8778 }
8779 EOCP
8780         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
8781         if eval $compile; then
8782                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
8783                 val="$undef" # Yes, undef.
8784                 set d_old_pthread_create_joinable
8785                 eval $setvar
8786                 val=""
8787                 set old_pthread_create_joinable
8788                 eval $setvar
8789         else
8790                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
8791                 if eval $compile; then
8792                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
8793                         val="$define"
8794                         set d_old_pthread_create_joinable
8795                         eval $setvar
8796                         val=PTHREAD_CREATE_UNDETACHED
8797                         set old_pthread_create_joinable
8798                         eval $setvar
8799                 else            
8800                         set try -DJOINABLE=__UNDETACHED
8801                         if eval $compile; then
8802                                 echo "You seem to use __UNDETACHED." >&4
8803                                 val="$define"
8804                                 set d_old_pthread_create_joinable
8805                                 eval $setvar
8806                                 val=__UNDETACHED
8807                                 set old_pthread_create_joinable
8808                                 eval $setvar
8809                         else
8810                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
8811                                 val="$define"
8812                                 set d_old_pthread_create_joinable
8813                                 eval $setvar
8814                                 val=0
8815                                 set old_pthread_create_joinable
8816                                 eval $setvar
8817                         fi
8818                 fi
8819         fi
8820         $rm -f try try.*
8821 else
8822     d_old_pthread_create_joinable="$undef"
8823     old_pthread_create_joinable=""
8824 fi
8825
8826 : see if pause exists
8827 set pause d_pause
8828 eval $inlibc
8829
8830 : see if pipe exists
8831 set pipe d_pipe
8832 eval $inlibc
8833
8834 : see if poll exists
8835 set poll d_poll
8836 eval $inlibc
8837
8838
8839 : see whether the various POSIXish _yields exist
8840 $cat >try.c <<EOP
8841 #include <pthread.h>
8842 #include <stdio.h>
8843 int main() {
8844 #ifdef SCHED_YIELD
8845         sched_yield();
8846 #else
8847 #ifdef PTHREAD_YIELD
8848         pthread_yield();
8849 #else
8850 #ifdef PTHREAD_YIELD_NULL
8851         pthread_yield(NULL);
8852 #endif
8853 #endif
8854 #endif
8855 }
8856 EOP
8857 : see if sched_yield exists
8858 set try -DSCHED_YIELD
8859 if eval $compile; then
8860     val="$define"
8861     sched_yield='sched_yield()'
8862 else
8863     val="$undef"
8864 fi
8865 case "$usethreads" in
8866 $define)
8867         case "$val" in
8868         $define) echo 'sched_yield() found.' >&4        ;;
8869         *)       echo 'sched_yield() NOT found.' >&4    ;;
8870         esac
8871 esac
8872 set d_sched_yield
8873 eval $setvar
8874
8875 : see if pthread_yield exists
8876 set try -DPTHREAD_YIELD
8877 if eval $compile; then
8878     val="$define"
8879     case "$sched_yield" in
8880     '') sched_yield='pthread_yield()' ;;
8881     esac
8882 else
8883     set try -DPTHREAD_YIELD_NULL
8884     if eval $compile; then
8885         val="$define"
8886         case "$sched_yield" in
8887         '') sched_yield='pthread_yield(NULL)' ;;
8888         esac
8889     else
8890         val="$undef"
8891     fi
8892 fi
8893 case "$usethreads" in
8894 $define)
8895         case "$val" in
8896         $define) echo 'pthread_yield() found.' >&4      ;;
8897         *)       echo 'pthread_yield() NOT found.' >&4  ;;
8898         esac
8899         ;;
8900 esac
8901 set d_pthread_yield
8902 eval $setvar
8903
8904 case "$sched_yield" in
8905 '') sched_yield=undef ;;
8906 esac
8907
8908 $rm -f try try.*
8909
8910 : see if this is a pwd.h system
8911 set pwd.h i_pwd
8912 eval $inhdr
8913
8914 case "$i_pwd" in
8915 $define)
8916         xxx=`./findhdr pwd.h`
8917         $cppstdin $cppflags $cppminus < $xxx >$$.h
8918
8919         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
8920                 val="$define"
8921         else
8922                 val="$undef"
8923         fi
8924         set d_pwquota
8925         eval $setvar
8926
8927         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
8928                 val="$define"
8929         else
8930                 val="$undef"
8931         fi
8932         set d_pwage
8933         eval $setvar
8934
8935         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
8936                 val="$define"
8937         else
8938                 val="$undef"
8939         fi
8940         set d_pwchange
8941         eval $setvar
8942
8943         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
8944                 val="$define"
8945         else
8946                 val="$undef"
8947         fi
8948         set d_pwclass
8949         eval $setvar
8950
8951         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
8952                 val="$define"
8953         else
8954                 val="$undef"
8955         fi
8956         set d_pwexpire
8957         eval $setvar
8958
8959         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
8960                 val="$define"
8961         else
8962                 val="$undef"
8963         fi
8964         set d_pwcomment
8965         eval $setvar
8966
8967         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
8968                 val="$define"
8969         else
8970                 val="$undef"
8971         fi
8972         set d_pwgecos
8973         eval $setvar
8974
8975         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
8976                 val="$define"
8977         else
8978                 val="$undef"
8979         fi
8980         set d_pwpasswd
8981         eval $setvar
8982
8983         $rm -f $$.h
8984         ;;
8985 *)
8986         val="$undef"; 
8987         set d_pwquota; eval $setvar
8988         set d_pwage; eval $setvar
8989         set d_pwchange; eval $setvar
8990         set d_pwclass; eval $setvar
8991         set d_pwexpire; eval $setvar
8992         set d_pwcomment; eval $setvar
8993         set d_pwgecos; eval $setvar
8994         set d_pwpasswd; eval $setvar
8995         ;;
8996 esac
8997
8998 : see if readdir and friends exist
8999 set readdir d_readdir
9000 eval $inlibc
9001 set seekdir d_seekdir
9002 eval $inlibc
9003 set telldir d_telldir
9004 eval $inlibc
9005 set rewinddir d_rewinddir
9006 eval $inlibc
9007
9008 : see if readlink exists
9009 set readlink d_readlink
9010 eval $inlibc
9011
9012 : see if readv exists
9013 set readv d_readv
9014 eval $inlibc
9015
9016 : see if rename exists
9017 set rename d_rename
9018 eval $inlibc
9019
9020 : see if rmdir exists
9021 set rmdir d_rmdir
9022 eval $inlibc
9023
9024 : see if memory.h is available.
9025 val=''
9026 set memory.h val
9027 eval $inhdr
9028
9029 : See if it conflicts with string.h
9030 case "$val" in
9031 $define)
9032         case "$strings" in
9033         '') ;;
9034         *)
9035                 $cppstdin $cppflags $cppminus < $strings > mem.h
9036                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9037                         echo " "
9038                         echo "We won't be including <memory.h>."
9039                         val="$undef"
9040                 fi
9041                 $rm -f mem.h
9042                 ;;
9043         esac
9044 esac
9045 set i_memory
9046 eval $setvar
9047
9048 : can bcopy handle overlapping blocks?
9049 val="$undef"
9050 case "$d_bcopy" in
9051 "$define")
9052         echo " "
9053         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9054         $cat >try.c <<EOCP
9055 #$i_memory I_MEMORY
9056 #$i_stdlib I_STDLIB
9057 #$i_string I_STRING
9058 #$i_unistd I_UNISTD
9059 EOCP
9060         $cat >>try.c <<'EOCP'
9061 #include <stdio.h>
9062 #ifdef I_MEMORY
9063 #  include <memory.h>
9064 #endif
9065 #ifdef I_STDLIB
9066 #  include <stdlib.h>
9067 #endif
9068 #ifdef I_STRING
9069 #  include <string.h>
9070 #else
9071 #  include <strings.h>
9072 #endif
9073 #ifdef I_UNISTD
9074 #  include <unistd.h>  /* Needed for NetBSD */
9075 #endif
9076 int main()
9077 {
9078 char buf[128], abc[128];
9079 char *b;
9080 int len;
9081 int off;
9082 int align;
9083
9084 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9085
9086 for (align = 7; align >= 0; align--) {
9087         for (len = 36; len; len--) {
9088                 b = buf+align;
9089                 bcopy(abc, b, len);
9090                 for (off = 1; off <= len; off++) {
9091                         bcopy(b, b+off, len);
9092                         bcopy(b+off, b, len);
9093                         if (bcmp(b, abc, len))
9094                                 exit(1);
9095                 }
9096         }
9097 }
9098 exit(0);
9099 }
9100 EOCP
9101         set try
9102         if eval $compile_ok; then
9103                 if ./try 2>/dev/null; then
9104                         echo "Yes, it can."
9105                         val="$define"
9106                 else
9107                         echo "It can't, sorry."
9108                         case "$d_memmove" in
9109                         "$define") echo "But that's Ok since you have memmove()." ;;
9110                         esac
9111                 fi
9112         else
9113                 echo "(I can't compile the test program, so we'll assume not...)"
9114                 case "$d_memmove" in
9115                 "$define") echo "But that's Ok since you have memmove()." ;;
9116                 esac
9117         fi
9118         ;;
9119 esac
9120 $rm -f try.* try core
9121 set d_safebcpy
9122 eval $setvar
9123
9124 : can memcpy handle overlapping blocks?
9125 val="$undef"
9126 case "$d_memcpy" in
9127 "$define")
9128         echo " "
9129         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9130         $cat >try.c <<EOCP
9131 #$i_memory I_MEMORY
9132 #$i_stdlib I_STDLIB
9133 #$i_string I_STRING
9134 #$i_unistd I_UNISTD
9135 EOCP
9136         $cat >>try.c <<'EOCP'
9137 #include <stdio.h>
9138 #ifdef I_MEMORY
9139 #  include <memory.h>
9140 #endif
9141 #ifdef I_STDLIB
9142 #  include <stdlib.h>
9143 #endif
9144 #ifdef I_STRING
9145 #  include <string.h>
9146 #else
9147 #  include <strings.h>
9148 #endif
9149 #ifdef I_UNISTD
9150 #  include <unistd.h>  /* Needed for NetBSD */
9151 #endif
9152 int main()
9153 {
9154 char buf[128], abc[128];
9155 char *b;
9156 int len;
9157 int off;
9158 int align;
9159
9160 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9161    try to store the string in read-only memory. */
9162 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9163
9164 for (align = 7; align >= 0; align--) {
9165         for (len = 36; len; len--) {
9166                 b = buf+align;
9167                 memcpy(b, abc, len);
9168                 for (off = 1; off <= len; off++) {
9169                         memcpy(b+off, b, len);
9170                         memcpy(b, b+off, len);
9171                         if (memcmp(b, abc, len))
9172                                 exit(1);
9173                 }
9174         }
9175 }
9176 exit(0);
9177 }
9178 EOCP
9179         set try
9180         if eval $compile_ok; then
9181                 if ./try 2>/dev/null; then
9182                         echo "Yes, it can."
9183                         val="$define"
9184                 else
9185                         echo "It can't, sorry."
9186                         case "$d_memmove" in
9187                         "$define") echo "But that's Ok since you have memmove()." ;;
9188                         esac
9189                 fi
9190         else
9191                 echo "(I can't compile the test program, so we'll assume not...)"
9192                 case "$d_memmove" in
9193                 "$define") echo "But that's Ok since you have memmove()." ;;
9194                 esac
9195         fi
9196         ;;
9197 esac
9198 $rm -f try.* try core
9199 set d_safemcpy
9200 eval $setvar
9201
9202 : can memcmp be trusted to compare relative magnitude?
9203 val="$undef"
9204 case "$d_memcmp" in
9205 "$define")
9206         echo " "
9207         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9208         $cat >try.c <<EOCP
9209 #$i_memory I_MEMORY
9210 #$i_stdlib I_STDLIB
9211 #$i_string I_STRING
9212 #$i_unistd I_UNISTD
9213 EOCP
9214         $cat >>try.c <<'EOCP'
9215 #include <stdio.h>
9216 #ifdef I_MEMORY
9217 #  include <memory.h>
9218 #endif
9219 #ifdef I_STDLIB
9220 #  include <stdlib.h>
9221 #endif
9222 #ifdef I_STRING
9223 #  include <string.h>
9224 #else
9225 #  include <strings.h>
9226 #endif
9227 #ifdef I_UNISTD
9228 #  include <unistd.h>  /* Needed for NetBSD */
9229 #endif
9230 int main()
9231 {
9232 char a = -1;
9233 char b = 0;
9234 if ((a < b) && memcmp(&a, &b, 1) < 0)
9235         exit(1);
9236 exit(0);
9237 }
9238 EOCP
9239         set try
9240         if eval $compile_ok; then
9241                 if ./try 2>/dev/null; then
9242                         echo "Yes, it can."
9243                         val="$define"
9244                 else
9245                         echo "No, it can't (it uses signed chars)."
9246                 fi
9247         else
9248                 echo "(I can't compile the test program, so we'll assume not...)"
9249         fi
9250         ;;
9251 esac
9252 $rm -f try.* try core
9253 set d_sanemcmp
9254 eval $setvar
9255
9256 : see if select exists
9257 set select d_select
9258 eval $inlibc
9259
9260 : see if semctl exists
9261 set semctl d_semctl
9262 eval $inlibc
9263
9264 : see if semget exists
9265 set semget d_semget
9266 eval $inlibc
9267
9268 : see if semop exists
9269 set semop d_semop
9270 eval $inlibc
9271
9272 : see how much of the 'sem*(2)' library is present.
9273 h_sem=true
9274 echo " "
9275 case "$d_semctl$d_semget$d_semop" in
9276 *"$undef"*) h_sem=false;;
9277 esac
9278 case "$osname" in
9279 freebsd)
9280     case "`ipcs 2>&1`" in
9281     "SVID messages"*"not configured"*)
9282         echo "Your $osname does not have the sem*(2) configured." >&4
9283         h_sem=false
9284         val="$undef"
9285         set semctl d_semctl
9286         eval $setvar
9287         set semget d_semget
9288         eval $setvar
9289         set semop d_semop
9290         eval $setvar
9291         ;;
9292     esac
9293     ;;
9294 esac
9295 : we could also check for sys/ipc.h ...
9296 if $h_sem && $test `./findhdr sys/sem.h`; then
9297         echo "You have the full sem*(2) library." >&4
9298         val="$define"
9299 else
9300         echo "You don't have the full sem*(2) library." >&4
9301         val="$undef"
9302 fi
9303 set d_sem
9304 eval $setvar
9305
9306 : see whether sys/sem.h defines union semun
9307 echo " "
9308 $cat > try.c <<'END'
9309 #include <sys/types.h>
9310 #include <sys/ipc.h>
9311 #include <sys/sem.h>
9312 int main () { union semun semun; semun.buf = 0; }
9313 END
9314 set try
9315 if eval $compile; then
9316     echo "You have union semun in <sys/sem.h>." >&4
9317     val="$define"
9318 else
9319     echo "You do not have union semun in <sys/sem.h>." >&4
9320     val="$undef"
9321 fi
9322 $rm -f try try.c try.h
9323 set d_union_semun
9324 eval $setvar
9325
9326 : see how to do semctl IPC_STAT
9327 case "$d_sem" in
9328 $define)
9329     : see whether semctl IPC_STAT can use union semun
9330     echo " "
9331     $cat > try.h <<END
9332 #ifndef S_IRUSR
9333 #   ifdef S_IREAD
9334 #       define S_IRUSR S_IREAD
9335 #       define S_IWUSR S_IWRITE
9336 #       define S_IXUSR S_IEXEC
9337 #   else
9338 #       define S_IRUSR 0400
9339 #       define S_IWUSR 0200
9340 #       define S_IXUSR 0100
9341 #   endif
9342 #   define S_IRGRP (S_IRUSR>>3)
9343 #   define S_IWGRP (S_IWUSR>>3)
9344 #   define S_IXGRP (S_IXUSR>>3)
9345 #   define S_IROTH (S_IRUSR>>6)
9346 #   define S_IWOTH (S_IWUSR>>6)
9347 #   define S_IXOTH (S_IXUSR>>6)
9348 #endif
9349 #ifndef S_IRWXU
9350 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9351 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9352 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9353 #endif
9354 END
9355
9356     $cat > try.c <<END
9357 #include <sys/types.h>
9358 #include <sys/ipc.h>
9359 #include <sys/sem.h>
9360 #include <sys/stat.h>
9361 #include <stdio.h>
9362 #include <errno.h>
9363 #include "try.h"
9364 #ifndef errno
9365 extern int errno;
9366 #endif
9367 #$d_union_semun HAS_UNION_SEMUN
9368 int main() {
9369     union semun
9370 #ifndef HAS_UNION_SEMUN
9371     {
9372         int val;
9373         struct semid_ds *buf;
9374         unsigned short *array;
9375     }
9376 #endif
9377     arg;
9378     int sem, st;
9379
9380 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9381     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9382     if (sem > -1) {
9383         struct semid_ds argbuf;
9384         arg.buf = &argbuf;
9385 #       ifdef IPC_STAT
9386         st = semctl(sem, 0, IPC_STAT, arg);
9387         if (st == 0)
9388             printf("semun\n");
9389         else
9390 #       endif /* IPC_STAT */
9391             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9392 #       ifdef IPC_RMID
9393         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9394 #       endif /* IPC_RMID */
9395             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9396     } else
9397 #endif /* IPC_PRIVATE && ... */
9398         printf("semget failed: errno = %d\n", errno);
9399   return 0;
9400 }
9401 END
9402     val="$undef"
9403     set try
9404     if eval $compile; then
9405         xxx=`./try`
9406         case "$xxx" in
9407         semun) val="$define" ;;
9408         esac
9409     fi
9410     $rm -f try try.c
9411     set d_semctl_semun
9412     eval $setvar
9413     case "$d_semctl_semun" in
9414     $define)
9415         echo "You can use union semun for semctl IPC_STAT." >&4
9416         also='also'
9417         ;;
9418     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9419         also=''
9420         ;;
9421     esac
9422
9423     : see whether semctl IPC_STAT can use struct semid_ds pointer
9424     $cat > try.c <<'END'
9425 #include <sys/types.h>
9426 #include <sys/ipc.h>
9427 #include <sys/sem.h>
9428 #include <sys/stat.h>
9429 #include "try.h"
9430 #include <stdio.h>
9431 #include <errno.h>
9432 #ifndef errno
9433 extern int errno;
9434 #endif
9435 int main() {
9436     struct semid_ds arg;
9437     int sem, st;
9438
9439 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9440     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9441     if (sem > -1) {
9442 #       ifdef IPC_STAT
9443         st = semctl(sem, 0, IPC_STAT, &arg);
9444         if (st == 0)
9445             printf("semid_ds\n");
9446         else
9447 #       endif /* IPC_STAT */
9448             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9449 #       ifdef IPC_RMID
9450         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9451 #       endif /* IPC_RMID */
9452             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9453     } else
9454 #endif /* IPC_PRIVATE && ... */
9455         printf("semget failed: errno = %d\n", errno);
9456
9457     return 0;
9458 }
9459 END
9460     val="$undef"
9461     set try
9462     if eval $compile; then
9463         xxx=`./try`
9464         case "$xxx" in
9465         semid_ds) val="$define" ;;
9466         esac
9467     fi
9468     $rm -f try try.c
9469     set d_semctl_semid_ds
9470     eval $setvar
9471     case "$d_semctl_semid_ds" in
9472     $define)
9473         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9474         ;;
9475     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9476         ;;
9477     esac
9478     $rm -f try.h
9479     ;;
9480 *)  val="$undef"
9481
9482     # We do not have the full sem*(2) library, so assume we can not
9483     # use either.
9484
9485     set d_semctl_semun
9486     eval $setvar
9487
9488     set d_semctl_semid_ds
9489     eval $setvar
9490     ;;
9491 esac
9492
9493 : see if setegid exists
9494 set setegid d_setegid
9495 eval $inlibc
9496
9497 : see if seteuid exists
9498 set seteuid d_seteuid
9499 eval $inlibc
9500
9501 : see if setgrent exists
9502 set setgrent d_setgrent
9503 eval $inlibc
9504
9505 : see if sethostent exists
9506 set sethostent d_sethent
9507 eval $inlibc
9508
9509 : see if setlinebuf exists
9510 set setlinebuf d_setlinebuf
9511 eval $inlibc
9512
9513 : see if setlocale exists
9514 set setlocale d_setlocale
9515 eval $inlibc
9516
9517 : see if setnetent exists
9518 set setnetent d_setnent
9519 eval $inlibc
9520
9521 : see if setprotoent exists
9522 set setprotoent d_setpent
9523 eval $inlibc
9524
9525 : see if setpgid exists
9526 set setpgid d_setpgid
9527 eval $inlibc
9528
9529 : see if setpgrp2 exists
9530 set setpgrp2 d_setpgrp2
9531 eval $inlibc
9532
9533 : see if setpriority exists
9534 set setpriority d_setprior
9535 eval $inlibc
9536
9537 : see if setpwent exists
9538 set setpwent d_setpwent
9539 eval $inlibc
9540
9541 : see if setregid exists
9542 set setregid d_setregid
9543 eval $inlibc
9544 set setresgid d_setresgid
9545 eval $inlibc
9546
9547 : see if setreuid exists
9548 set setreuid d_setreuid
9549 eval $inlibc
9550 set setresuid d_setresuid
9551 eval $inlibc
9552
9553 : see if setrgid exists
9554 set setrgid d_setrgid
9555 eval $inlibc
9556
9557 : see if setruid exists
9558 set setruid d_setruid
9559 eval $inlibc
9560
9561 : see if setservent exists
9562 set setservent d_setsent
9563 eval $inlibc
9564
9565 : see if setsid exists
9566 set setsid d_setsid
9567 eval $inlibc
9568
9569 : see if setvbuf exists
9570 set setvbuf d_setvbuf
9571 eval $inlibc
9572
9573 : see if sfio.h is available
9574 set sfio.h i_sfio
9575 eval $inhdr
9576
9577
9578 : see if sfio library is available
9579 case "$i_sfio" in
9580 $define)
9581         val=''
9582         set sfreserve val
9583         eval $inlibc
9584         ;;
9585 *)
9586         val="$undef"
9587         ;;
9588 esac
9589 : Ok, but do we want to use it.
9590 case "$val" in
9591 $define)
9592         case "$usesfio" in
9593         true|$define|[yY]*) dflt='y';;
9594         *) dflt='n';;
9595         esac
9596         echo "$package can use the sfio library, but it is experimental."
9597         rp="You seem to have sfio available, do you want to try using it?"
9598         . ./myread
9599         case "$ans" in
9600         y|Y) ;;
9601         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
9602                 val="$undef"
9603                 : Remove sfio from list of libraries to use
9604                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9605                 shift
9606                 libs="$*"
9607                 echo "libs = $libs" >&4
9608                 ;;
9609         esac
9610         ;;
9611 *)      case "$usesfio" in
9612         true|$define|[yY]*)
9613                 echo "Sorry, cannot find sfio on this machine" >&4
9614                 echo "Ignoring your setting of usesfio=$usesfio" >&4
9615                 ;;
9616         esac
9617         ;;
9618 esac
9619 set d_sfio
9620 eval $setvar
9621 case "$d_sfio" in
9622 $define) usesfio='true';;
9623 *) usesfio='false';;
9624 esac
9625
9626 : see if shmctl exists
9627 set shmctl d_shmctl
9628 eval $inlibc
9629
9630 : see if shmget exists
9631 set shmget d_shmget
9632 eval $inlibc
9633
9634 : see if shmat exists
9635 set shmat d_shmat
9636 eval $inlibc
9637 : see what shmat returns
9638 case "$d_shmat" in
9639 "$define")
9640         $cat >shmat.c <<'END'
9641 #include <sys/shm.h>
9642 void *shmat();
9643 END
9644         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9645                 shmattype='void *'
9646         else
9647                 shmattype='char *'
9648         fi
9649         echo "and it returns ($shmattype)." >&4
9650         : see if a prototype for shmat is available
9651         xxx=`./findhdr sys/shm.h`
9652         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
9653         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9654                 val="$define"
9655         else
9656                 val="$undef"
9657         fi
9658         $rm -f shmat.[co]
9659         ;;
9660 *)
9661         val="$undef"
9662         ;;
9663 esac
9664 set d_shmatprototype
9665 eval $setvar
9666
9667 : see if shmdt exists
9668 set shmdt d_shmdt
9669 eval $inlibc
9670
9671 : see how much of the 'shm*(2)' library is present.
9672 h_shm=true
9673 echo " "
9674 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9675 *"$undef"*) h_shm=false;;
9676 esac
9677 case "$osname" in
9678 freebsd)
9679     case "`ipcs 2>&1`" in
9680     "SVID shared memory"*"not configured"*)
9681         echo "Your $osname does not have the shm*(2) configured." >&4
9682         h_shm=false
9683         val="$undef"
9684         set shmctl d_shmctl
9685         evat $setvar
9686         set shmget d_shmget
9687         evat $setvar
9688         set shmat d_shmat
9689         evat $setvar
9690         set shmdt d_shmdt
9691         evat $setvar
9692         ;;
9693     esac
9694     ;;
9695 esac
9696 : we could also check for sys/ipc.h ...
9697 if $h_shm && $test `./findhdr sys/shm.h`; then
9698         echo "You have the full shm*(2) library." >&4
9699         val="$define"
9700 else
9701         echo "You don't have the full shm*(2) library." >&4
9702         val="$undef"
9703 fi
9704 set d_shm
9705 eval $setvar
9706
9707 echo " "
9708 : see if we have sigaction
9709 if set sigaction val -f d_sigaction; eval $csym; $val; then
9710         echo 'sigaction() found.' >&4
9711         $cat > try.c <<'EOP'
9712 #include <stdio.h>
9713 #include <sys/types.h>
9714 #include <signal.h>
9715 int main()
9716 {
9717     struct sigaction act, oact;
9718 }
9719 EOP
9720         set try
9721         if eval $compile_ok; then
9722                 val="$define"
9723         else
9724                 echo "But you don't seem to have a useable struct sigaction." >&4
9725                 val="$undef"
9726         fi
9727 else
9728         echo 'sigaction NOT found.' >&4
9729         val="$undef"
9730 fi
9731 set d_sigaction; eval $setvar
9732 $rm -f try try$_o try.c
9733
9734 : see if sigsetjmp exists
9735 echo " "
9736 case "$d_sigsetjmp" in
9737 '')
9738         $cat >try.c <<'EOP'
9739 #include <setjmp.h>
9740 sigjmp_buf env;
9741 int set = 1;
9742 int main()
9743 {
9744         if (sigsetjmp(env,1))
9745                 exit(set);
9746         set = 0;
9747         siglongjmp(env, 1);
9748         exit(1);
9749 }
9750 EOP
9751         set try
9752         if eval $compile; then
9753                 if ./try >/dev/null 2>&1; then
9754                         echo "POSIX sigsetjmp found." >&4
9755                         val="$define"
9756                 else
9757                         $cat >&4 <<EOM
9758 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9759 I'll ignore them.
9760 EOM
9761                         val="$undef"
9762                 fi
9763         else
9764                 echo "sigsetjmp not found." >&4
9765                 val="$undef"
9766         fi
9767         ;;
9768 *) val="$d_sigsetjmp"
9769         case "$d_sigsetjmp" in
9770         $define) echo "POSIX sigsetjmp found." >&4;;
9771         $undef) echo "sigsetjmp not found." >&4;;
9772         esac
9773         ;;
9774 esac
9775 set d_sigsetjmp
9776 eval $setvar
9777 $rm -f try.c try
9778
9779 : see if stat knows about block sizes
9780 echo " "
9781 set d_statblks stat st_blocks $i_sysstat sys/stat.h
9782 eval $hasfield
9783
9784 : see if _ptr and _cnt from stdio act std
9785 echo " "
9786 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9787         echo "(Looks like you have stdio.h from Linux.)"
9788         case "$stdio_ptr" in
9789         '') stdio_ptr='((fp)->_IO_read_ptr)'
9790                 ptr_lval=$define
9791                 ;;
9792         *)      ptr_lval=$d_stdio_ptr_lval;;
9793         esac
9794         case "$stdio_cnt" in
9795         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9796                 cnt_lval=$undef
9797                 ;;
9798         *)      cnt_lval=$d_stdio_cnt_lval;;
9799         esac
9800         case "$stdio_base" in
9801         '') stdio_base='((fp)->_IO_read_base)';;
9802         esac
9803         case "$stdio_bufsiz" in
9804         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
9805         esac
9806 else
9807         case "$stdio_ptr" in
9808         '') stdio_ptr='((fp)->_ptr)'
9809                 ptr_lval=$define
9810                 ;;
9811         *)      ptr_lval=$d_stdio_ptr_lval;;
9812         esac
9813         case "$stdio_cnt" in
9814         '') stdio_cnt='((fp)->_cnt)'
9815                 cnt_lval=$define
9816                 ;;
9817         *)      cnt_lval=$d_stdio_cnt_lval;;
9818         esac
9819         case "$stdio_base" in
9820         '') stdio_base='((fp)->_base)';;
9821         esac
9822         case "$stdio_bufsiz" in
9823         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9824         esac
9825 fi
9826 : test whether _ptr and _cnt really work
9827 echo "Checking how std your stdio is..." >&4
9828 $cat >try.c <<EOP
9829 #include <stdio.h>
9830 #define FILE_ptr(fp)    $stdio_ptr
9831 #define FILE_cnt(fp)    $stdio_cnt
9832 int main() {
9833         FILE *fp = fopen("try.c", "r");
9834         char c = getc(fp);
9835         if (
9836                 18 <= FILE_cnt(fp) &&
9837                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9838         )
9839                 exit(0);
9840         exit(1);
9841 }
9842 EOP
9843 val="$undef"
9844 set try
9845 if eval $compile; then
9846         if ./try; then
9847                 echo "Your stdio acts pretty std."
9848                 val="$define"
9849         else
9850                 echo "Your stdio isn't very std."
9851         fi
9852 else
9853         echo "Your stdio doesn't appear very std."
9854 fi
9855 $rm -f try.c try
9856 set d_stdstdio
9857 eval $setvar
9858
9859 : Can _ptr be used as an lvalue?
9860 case "$d_stdstdio$ptr_lval" in
9861 $define$define) val=$define ;;
9862 *) val=$undef ;;
9863 esac
9864 set d_stdio_ptr_lval
9865 eval $setvar
9866
9867 : Can _cnt be used as an lvalue?
9868 case "$d_stdstdio$cnt_lval" in
9869 $define$define) val=$define ;;
9870 *) val=$undef ;;
9871 esac
9872 set d_stdio_cnt_lval
9873 eval $setvar
9874
9875 : see if _base is also standard
9876 val="$undef"
9877 case "$d_stdstdio" in
9878 $define)
9879         $cat >try.c <<EOP
9880 #include <stdio.h>
9881 #define FILE_base(fp)   $stdio_base
9882 #define FILE_bufsiz(fp) $stdio_bufsiz
9883 int main() {
9884         FILE *fp = fopen("try.c", "r");
9885         char c = getc(fp);
9886         if (
9887                 19 <= FILE_bufsiz(fp) &&
9888                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9889         )
9890                 exit(0);
9891         exit(1);
9892 }
9893 EOP
9894         set try
9895         if eval $compile; then
9896                 if ./try; then
9897                         echo "And its _base field acts std."
9898                         val="$define"
9899                 else
9900                         echo "But its _base field isn't std."
9901                 fi
9902         else
9903                 echo "However, it seems to be lacking the _base field."
9904         fi
9905         $rm -f try.c try
9906         ;;
9907 esac
9908 set d_stdiobase
9909 eval $setvar
9910
9911 : see if strcoll exists
9912 set strcoll d_strcoll
9913 eval $inlibc
9914
9915 : check for structure copying
9916 echo " "
9917 echo "Checking to see if your C compiler can copy structs..." >&4
9918 $cat >try.c <<'EOCP'
9919 int main()
9920 {
9921         struct blurfl {
9922                 int dyick;
9923         } foo, bar;
9924
9925         foo = bar;
9926 }
9927 EOCP
9928 if $cc -c try.c >/dev/null 2>&1 ; then
9929         val="$define"
9930         echo "Yup, it can."
9931 else
9932         val="$undef"
9933         echo "Nope, it can't."
9934 fi
9935 set d_strctcpy
9936 eval $setvar
9937 $rm -f try.*
9938
9939 : see if strerror and/or sys_errlist[] exist
9940 echo " "
9941 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9942     if set strerror val -f d_strerror; eval $csym; $val; then
9943                 echo 'strerror() found.' >&4
9944                 d_strerror="$define"
9945                 d_strerrm='strerror(e)'
9946                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9947                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
9948                         d_syserrlst="$define"
9949                 else
9950                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9951                         d_syserrlst="$undef"
9952                 fi
9953     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
9954                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9955                 echo 'strerror() found in string header.' >&4
9956                 d_strerror="$define"
9957                 d_strerrm='strerror(e)'
9958                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9959                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
9960                                 d_syserrlst="$define"
9961                 else
9962                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
9963                         d_syserrlst="$undef"
9964                 fi
9965     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9966                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
9967                 d_strerror="$undef"
9968                 d_syserrlst="$define"
9969                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
9970     else
9971                 echo 'strerror() and sys_errlist[] NOT found.' >&4
9972                 d_strerror="$undef"
9973                 d_syserrlst="$undef"
9974                 d_strerrm='"unknown"'
9975     fi
9976 fi
9977
9978 : see if strtod exists
9979 set strtod d_strtod
9980 eval $inlibc
9981
9982 : see if strtol exists
9983 set strtol d_strtol
9984 eval $inlibc
9985
9986 : see if strtoul exists
9987 set strtoul d_strtoul
9988 eval $inlibc
9989
9990 : see if strxfrm exists
9991 set strxfrm d_strxfrm
9992 eval $inlibc
9993
9994 : see if symlink exists
9995 set symlink d_symlink
9996 eval $inlibc
9997
9998 : see if syscall exists
9999 set syscall d_syscall
10000 eval $inlibc
10001
10002 : see if sysconf exists
10003 set sysconf d_sysconf
10004 eval $inlibc
10005
10006 : see if system exists
10007 set system d_system
10008 eval $inlibc
10009
10010 : see if tcgetpgrp exists
10011 set tcgetpgrp d_tcgetpgrp
10012 eval $inlibc
10013
10014 : see if tcsetpgrp exists
10015 set tcsetpgrp d_tcsetpgrp
10016 eval $inlibc
10017
10018 : see if sys/types.h has to be included
10019 set sys/types.h i_systypes
10020 eval $inhdr
10021
10022 : see if prototype for telldir is available
10023 echo " "
10024 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10025 eval $hasproto
10026
10027 : define an is-a-typedef? function
10028 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10029 case "$inclist" in
10030 "") inclist="sys/types.h";;
10031 esac;
10032 eval "varval=\$$var";
10033 case "$varval" in
10034 "")
10035         $rm -f temp.c;
10036         for inc in $inclist; do
10037                 echo "#include <$inc>" >>temp.c;
10038         done;
10039         echo "#ifdef $type" >> temp.c;
10040         echo "printf(\"We have $type\");" >> temp.c;
10041         echo "#endif" >> temp.c;
10042         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10043         if $contains $type temp.E >/dev/null 2>&1; then
10044                 eval "$var=\$type";
10045         else
10046                 eval "$var=\$def";
10047         fi;
10048         $rm -f temp.?;;
10049 *) eval "$var=\$varval";;
10050 esac'
10051
10052 : define an is-a-typedef? function that prompts if the type is not available.
10053 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10054 case "$inclist" in
10055 "") inclist="sys/types.h";;
10056 esac;
10057 eval "varval=\$$var";
10058 case "$varval" in
10059 "")
10060         $rm -f temp.c;
10061         for inc in $inclist; do
10062                 echo "#include <$inc>" >>temp.c;
10063         done;
10064         echo "#ifdef $type" >> temp.c;
10065         echo "printf(\"We have $type\");" >> temp.c;
10066         echo "#endif" >> temp.c;
10067         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10068         echo " " ;
10069         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10070         if $contains $type temp.E >/dev/null 2>&1; then
10071                 echo "$type found." >&4;
10072                 eval "$var=\$type";
10073         else
10074                 echo "$type NOT found." >&4;
10075                 dflt="$def";
10076                 . ./myread ;
10077                 eval "$var=\$ans";
10078         fi;
10079         $rm -f temp.?;;
10080 *) eval "$var=\$varval";;
10081 esac'
10082
10083 : see if this is a sys/times.h system
10084 set sys/times.h i_systimes
10085 eval $inhdr
10086
10087 : see if times exists
10088 echo " "
10089 if set times val -f d_times; eval $csym; $val; then
10090         echo 'times() found.' >&4
10091         d_times="$define"
10092         inc=''
10093         case "$i_systimes" in
10094         "$define") inc='sys/times.h';;
10095         esac
10096         rp="What is the type returned by times() on this system?"
10097         set clock_t clocktype long stdio.h sys/types.h $inc
10098         eval $typedef_ask
10099 else
10100         echo 'times() NOT found, hope that will do.' >&4
10101         d_times="$undef"
10102         clocktype='int'
10103 fi
10104
10105 : see if truncate exists
10106 set truncate d_truncate
10107 eval $inlibc
10108
10109 : see if tzname[] exists
10110 echo " "
10111 if set tzname val -a d_tzname; eval $csym; $val; then
10112         val="$define"
10113         echo 'tzname[] found.' >&4
10114 else
10115         val="$undef"
10116         echo 'tzname[] NOT found.' >&4
10117 fi
10118 set d_tzname
10119 eval $setvar
10120
10121 : see if umask exists
10122 set umask d_umask
10123 eval $inlibc
10124
10125 : backward compatibility for d_hvfork
10126 if test X$d_hvfork != X; then
10127         d_vfork="$d_hvfork"
10128         d_hvfork=''
10129 fi
10130 : see if there is a vfork
10131 val=''
10132 set vfork val
10133 eval $inlibc
10134
10135 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10136 : perl on Solaris 2.x, and probably elsewhere.
10137 case "$val" in
10138 $define)
10139         echo " "
10140         case "$usevfork" in
10141         false) dflt='n';;
10142         *) dflt='y';;
10143         esac
10144         rp="Some systems have problems with vfork().  Do you want to use it?"
10145         . ./myread
10146         case "$ans" in
10147         y|Y) ;;
10148         *)
10149                 echo "Ok, we won't use vfork()."
10150                 val="$undef"
10151                 ;;
10152         esac
10153         ;;
10154 esac
10155 set d_vfork
10156 eval $setvar
10157 case "$d_vfork" in
10158 $define) usevfork='true';;
10159 *) usevfork='false';;
10160 esac
10161
10162 : see if this is an sysdir system
10163 set sys/dir.h i_sysdir
10164 eval $inhdr
10165
10166 : see if this is an sysndir system
10167 set sys/ndir.h i_sysndir
10168 eval $inhdr
10169
10170 : see if closedir exists
10171 set closedir d_closedir
10172 eval $inlibc
10173
10174 case "$d_closedir" in
10175 "$define")
10176         echo " "
10177         echo "Checking whether closedir() returns a status..." >&4
10178         cat > closedir.c <<EOM
10179 #$i_dirent I_DIRENT             /**/
10180 #$i_sysdir I_SYS_DIR            /**/
10181 #$i_sysndir I_SYS_NDIR          /**/
10182 #$i_systypes I_SYS_TYPES        /**/
10183
10184 #if defined(I_SYS_TYPES)
10185 #include <sys/types.h>
10186 #endif
10187 #if defined(I_DIRENT)
10188 #include <dirent.h>
10189 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10190 #include <sys/dir.h>
10191 #endif
10192 #else
10193 #ifdef I_SYS_NDIR
10194 #include <sys/ndir.h>
10195 #else
10196 #ifdef I_SYS_DIR
10197 #ifdef hp9000s500
10198 #include <ndir.h>       /* may be wrong in the future */
10199 #else
10200 #include <sys/dir.h>
10201 #endif
10202 #endif
10203 #endif
10204 #endif 
10205 int main() { return closedir(opendir(".")); }
10206 EOM
10207         set closedir
10208         if eval $compile_ok; then
10209                 if ./closedir > /dev/null 2>&1 ; then
10210                         echo "Yes, it does."
10211                         val="$undef"
10212                 else
10213                         echo "No, it doesn't."
10214                         val="$define"
10215                 fi
10216         else
10217                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10218                 val="$define"
10219         fi
10220         ;;
10221 *)
10222         val="$undef";
10223         ;;
10224 esac
10225 set d_void_closedir
10226 eval $setvar
10227 $rm -f closedir*
10228 : check for volatile keyword
10229 echo " "
10230 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10231 $cat >try.c <<'EOCP'
10232 int main()
10233 {
10234         typedef struct _goo_struct goo_struct;
10235         goo_struct * volatile goo = ((goo_struct *)0);
10236         struct _goo_struct {
10237                 long long_int;
10238                 int reg_int;
10239                 char char_var;
10240         };
10241         typedef unsigned short foo_t;
10242         char *volatile foo;
10243         volatile int bar;
10244         volatile foo_t blech;
10245         foo = foo;
10246 }
10247 EOCP
10248 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10249         val="$define"
10250         echo "Yup, it does."
10251 else
10252         val="$undef"
10253         echo "Nope, it doesn't."
10254 fi
10255 set d_volatile
10256 eval $setvar
10257 $rm -f try.*
10258
10259 : see if there is a wait4
10260 set wait4 d_wait4
10261 eval $inlibc
10262
10263 : see if waitpid exists
10264 set waitpid d_waitpid
10265 eval $inlibc
10266
10267 : see if wcstombs exists
10268 set wcstombs d_wcstombs
10269 eval $inlibc
10270
10271 : see if wctomb exists
10272 set wctomb d_wctomb
10273 eval $inlibc
10274
10275 : see if writev exists
10276 set writev d_writev
10277 eval $inlibc
10278
10279 : preserve RCS keywords in files with variable substitution, grrr
10280 Date='$Date'
10281 Id='$Id'
10282 Log='$Log'
10283 RCSfile='$RCSfile'
10284 Revision='$Revision'
10285
10286 case "$crosscompile" in
10287 ''|[nN]*) crosscompile="$undef" ;;
10288 esac
10289
10290 case "$multiarch" in
10291 ''|[nN]*) multiarch="$undef" ;;
10292 esac
10293
10294 : check for alignment requirements
10295 echo " "
10296 case "$crosscompile$multiarch" in
10297 *$define*)
10298 You seem to be cross-compiling, skipping the memory alignment check.
10299
10300 EOM
10301         case "$alignbytes" in
10302         '') alignbytes=8 ;;
10303         esac
10304         ;;
10305 *)
10306         case "$alignbytes" in
10307         '') echo "Checking alignment constraints..." >&4
10308                 $cat >try.c <<'EOCP'
10309 struct foobar {
10310         char foo;
10311         double bar;
10312 } try_algn;
10313 int main()
10314 {
10315         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10316 }
10317 EOCP
10318                 set try
10319                 if eval $compile_ok; then
10320                         dflt=`./try`
10321                 else
10322                         dflt='8'
10323                         echo "(I can't seem to compile the test program...)"
10324                 fi
10325                 ;;
10326         *) dflt="$alignbytes"
10327                 ;;
10328         esac
10329         rp="Doubles must be aligned on a how-many-byte boundary?"
10330         . ./myread
10331         alignbytes="$ans"
10332         $rm -f try.c try
10333         ;;
10334 esac
10335
10336
10337 : check for ordering of bytes in a long
10338 echo " "
10339 case "$crosscompile$multiarch" in
10340 *$define*)
10341         $cat <<EOM
10342 You seem to be cross-compiling, I'm skipping the byteorder check.
10343
10344 EOM
10345         ;;
10346 *)
10347         case "$byteorder" in
10348         '')
10349                 $cat <<'EOM'
10350 In the following, larger digits indicate more significance.  A big-endian
10351 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10352 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10353 machines may have weird orders like 3412.  A Cray will report 87654321. If
10354 the test program works the default is probably right.
10355 I'm now running the test program...
10356 EOM
10357                 $cat >try.c <<'EOCP'
10358 #include <stdio.h>
10359 int main()
10360 {
10361         int i;
10362         union {
10363                 unsigned long l;
10364                 char c[sizeof(long)];
10365         } u;
10366
10367         if (sizeof(long) > 4)
10368                 u.l = (0x08070605L << 32) | 0x04030201L;
10369         else
10370                 u.l = 0x04030201L;
10371         for (i = 0; i < sizeof(long); i++)
10372                 printf("%c", u.c[i]+'0');
10373         printf("\n");
10374         exit(0);
10375 }
10376 EOCP
10377                 xxx_prompt=y
10378                 set try
10379                 if eval $compile && ./try > /dev/null; then
10380                         dflt=`./try`
10381                         case "$dflt" in
10382                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10383                                 echo "(The test program ran ok.)"
10384                                 echo "byteorder=$dflt"
10385                                 xxx_prompt=n
10386                         ;;
10387                         ????|????????) echo "(The test program ran ok.)" ;;
10388                         *) echo "(The test program didn't run right for some reason.)" ;;
10389                         esac
10390                 else
10391                         dflt='4321'
10392                         cat <<'EOM'
10393 (I can't seem to compile the test program.  Guessing big-endian...)
10394 EOM
10395                 fi
10396                 case "$xxx_prompt" in
10397                 y)
10398                         rp="What is the order of bytes in a long?"
10399                         . ./myread
10400                         byteorder="$ans"
10401                         ;;
10402                 *)      byteorder=$dflt
10403                         ;;
10404                 esac
10405                 ;;
10406         esac
10407         $rm -f try.c try
10408         ;;
10409 esac
10410
10411
10412 : how do we catenate cpp tokens here?
10413 echo " "
10414 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10415 $cat >cpp_stuff.c <<'EOCP'
10416 #define RCAT(a,b)a/**/b
10417 #define ACAT(a,b)a ## b
10418 RCAT(Rei,ser)
10419 ACAT(Cir,cus)
10420 EOCP
10421 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10422 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10423         echo "Oh!  Smells like ANSI's been here." >&4
10424         echo "We can catify or stringify, separately or together!"
10425         cpp_stuff=42
10426 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10427         echo "Ah, yes!  The good old days!" >&4
10428         echo "However, in the good old days we don't know how to stringify and"
10429         echo "catify at the same time."
10430         cpp_stuff=1
10431 else
10432         $cat >&4 <<EOM
10433 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10434 to have to edit the values of CAT[2-5] in config.h...
10435 EOM
10436         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10437 fi
10438 $rm -f cpp_stuff.*
10439
10440 : see if this is a db.h system
10441 set db.h i_db
10442 eval $inhdr
10443
10444 case "$i_db" in
10445 $define)
10446         : Check db version.
10447         echo " "
10448         echo "Checking Berkeley DB version ..." >&4
10449         $cat >try.c <<EOCP
10450 #$d_const HASCONST
10451 #ifndef HASCONST
10452 #define const
10453 #endif
10454 #include <sys/types.h>
10455 #include <stdio.h>
10456 #include <db.h>
10457 int main()
10458 {
10459 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10460     int Major, Minor, Patch ;
10461     unsigned long Version ;
10462     (void)db_version(&Major, &Minor, &Patch) ;
10463     printf("You have Berkeley DB Version 2 or greater\n");
10464
10465     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10466                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10467     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10468                 Major, Minor, Patch) ;
10469
10470     /* check that db.h & libdb are compatible */
10471     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10472         printf("db.h and libdb are incompatible\n") ;
10473         exit(3);        
10474     }
10475
10476     printf("db.h and libdb are compatible\n") ;
10477
10478     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10479                 + DB_VERSION_PATCH ;
10480
10481     /* needs to be >= 2.3.4 */
10482     if (Version < 2003004) {
10483     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10484         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10485         exit(2);        
10486     }
10487
10488     exit(0);
10489 #else
10490 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10491     printf("You have Berkeley DB Version 1\n");
10492     exit(0);    /* DB version < 2: the coast is clear. */
10493 #else
10494     exit(1);    /* <db.h> not Berkeley DB? */
10495 #endif
10496 #endif
10497 }
10498 EOCP
10499         set try
10500         if eval $compile && ./try; then
10501                 echo 'Looks OK.' >&4
10502         else
10503                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10504                 i_db=$undef
10505                 case " $libs " in
10506                 *"-ldb "*)
10507                         : Remove db from list of libraries to use
10508                         echo "Removing unusable -ldb from library list" >&4
10509                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10510                         shift
10511                         libs="$*"
10512                         echo "libs = $libs" >&4
10513                         ;;
10514                 esac
10515         fi
10516         $rm -f try.*
10517         ;;
10518 esac
10519
10520 case "$i_db" in
10521 define)
10522         : Check the return type needed for hash 
10523         echo " "
10524         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10525         $cat >try.c <<EOCP
10526 #$d_const HASCONST
10527 #ifndef HASCONST
10528 #define const
10529 #endif
10530 #include <sys/types.h>
10531 #include <db.h>
10532
10533 #ifndef DB_VERSION_MAJOR
10534 u_int32_t hash_cb (ptr, size)
10535 const void *ptr;
10536 size_t size;
10537 {
10538 }
10539 HASHINFO info;
10540 int main()
10541 {
10542         info.hash = hash_cb;
10543 }
10544 #endif
10545 EOCP
10546         if $cc $ccflags -c try.c >try.out 2>&1 ; then
10547                 if $contains warning try.out >>/dev/null 2>&1 ; then
10548                         db_hashtype='int'
10549                 else
10550                         db_hashtype='u_int32_t'
10551                 fi
10552         else
10553                 : XXX Maybe we should just give up here.
10554                 db_hashtype=u_int32_t
10555                 $cat try.out >&4
10556                 echo "Help:  I can't seem to compile the db test program." >&4
10557                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10558         fi
10559         $rm -f try.*
10560         echo "Your version of Berkeley DB uses $db_hashtype for hash."
10561         ;;
10562 *)      db_hashtype=u_int32_t
10563         ;;
10564 esac
10565 case "$i_db" in
10566 define)
10567         : Check the return type needed for prefix 
10568         echo " "
10569         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10570         cat >try.c <<EOCP
10571 #$d_const HASCONST
10572 #ifndef HASCONST
10573 #define const
10574 #endif
10575 #include <sys/types.h>
10576 #include <db.h>
10577
10578 #ifndef DB_VERSION_MAJOR
10579 size_t prefix_cb (key1, key2)
10580 const DBT *key1;
10581 const DBT *key2;
10582 {
10583 }
10584 BTREEINFO info;
10585 int main()
10586 {
10587         info.prefix = prefix_cb;
10588 }
10589 #endif
10590 EOCP
10591         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
10592                 if $contains warning try.out >>/dev/null 2>&1 ; then
10593                         db_prefixtype='int'
10594                 else
10595                         db_prefixtype='size_t'
10596                 fi
10597         else
10598                 db_prefixtype='size_t'
10599                 : XXX Maybe we should just give up here.
10600                 $cat try.out >&4
10601                 echo "Help:  I can't seem to compile the db test program." >&4
10602                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
10603         fi
10604         $rm -f try.*
10605         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
10606         ;;
10607 *)      db_prefixtype='size_t'
10608         ;;
10609 esac
10610
10611 : check for void type
10612 echo " "
10613 echo "Checking to see how well your C compiler groks the void type..." >&4
10614 case "$voidflags" in
10615 '')
10616         $cat >try.c <<'EOCP'
10617 #if TRY & 1
10618 void sub() {
10619 #else
10620 sub() {
10621 #endif
10622         extern void moo();      /* function returning void */
10623         void (*goo)();          /* ptr to func returning void */
10624 #if TRY & 8
10625         void *hue;              /* generic ptr */
10626 #endif
10627 #if TRY & 2
10628         void (*foo[10])();
10629 #endif
10630
10631 #if TRY & 4
10632         if(goo == moo) {
10633                 exit(0);
10634         }
10635 #endif
10636         exit(0);
10637 }
10638 int main() { sub(); }
10639 EOCP
10640         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
10641                 voidflags=$defvoidused
10642         echo "Good.  It appears to support void to the level $package wants.">&4
10643                 if $contains warning .out >/dev/null 2>&1; then
10644                         echo "However, you might get some warnings that look like this:"
10645                         $cat .out
10646                 fi
10647         else
10648 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
10649                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
10650                         echo "It supports 1..."
10651                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
10652                                 echo "It also supports 2..."
10653                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
10654                                         voidflags=7
10655                                         echo "And it supports 4 but not 8 definitely."
10656                                 else
10657                                         echo "It doesn't support 4..."
10658                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
10659                                                 voidflags=11
10660                                                 echo "But it supports 8."
10661                                         else
10662                                                 voidflags=3
10663                                                 echo "Neither does it support 8."
10664                                         fi
10665                                 fi
10666                         else
10667                                 echo "It does not support 2..."
10668                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
10669                                         voidflags=13
10670                                         echo "But it supports 4 and 8."
10671                                 else
10672                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
10673                                                 voidflags=5
10674                                                 echo "And it supports 4 but has not heard about 8."
10675                                         else
10676                                                 echo "However it supports 8 but not 4."
10677                                         fi
10678                                 fi
10679                         fi
10680                 else
10681                         echo "There is no support at all for void."
10682                         voidflags=0
10683                 fi
10684         fi
10685 esac
10686 case "$voidflags" in
10687 "$defvoidused") ;;
10688 *)      $cat >&4 <<'EOM'
10689   Support flag bits are:
10690     1: basic void declarations.
10691     2: arrays of pointers to functions returning void.
10692     4: operations between pointers to and addresses of void functions.
10693     8: generic void pointers.
10694 EOM
10695         dflt="$voidflags";
10696         rp="Your void support flags add up to what?"
10697         . ./myread
10698         voidflags="$ans"
10699         ;;
10700 esac
10701 $rm -f try.* .out
10702
10703
10704 : How can we generate normalized random numbers ?
10705 echo " "
10706 echo "Looking for a random number function..." >&4
10707 case "$randfunc" in
10708 '')
10709         if set drand48 val -f; eval $csym; $val; then
10710                 dflt="drand48"
10711                 echo "Good, found drand48()." >&4
10712         elif set random val -f; eval $csym; $val; then
10713                 dflt="random"
10714                 echo "OK, found random()." >&4
10715         else
10716                 dflt="rand"
10717                 echo "Yick, looks like I have to use rand()." >&4
10718         fi
10719         echo " "
10720         ;;
10721 *)
10722         dflt="$randfunc"
10723         ;;
10724 esac
10725 cont=true
10726
10727 case "$ccflags" in
10728 *-Dmy_rand=*|*-Dmy_srand=*)
10729         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10730         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10731         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10732         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10733         ;;
10734 esac
10735
10736 while $test "$cont"; do
10737         rp="Use which function to generate random numbers?"
10738         . ./myread
10739         if $test "$ans" = "$dflt"; then
10740                 : null
10741         else
10742                 randbits=''
10743         fi
10744         randfunc="$ans"
10745         if set $ans val -f; eval $csym; $val; then
10746                 cont=''
10747         else
10748                 dflt=y
10749                 rp="I cannot find function $ans. Use that name anyway?"
10750                 . ./myread
10751                 dflt=rand
10752                 case "$ans" in
10753                         [yY]*) cont='';;
10754                 esac
10755         fi
10756         case "$cont" in
10757         '')
10758                 case "$randfunc" in
10759                 drand48)
10760                         drand01="drand48()"
10761                         seedfunc="srand48"
10762                         randbits=48
10763                         randseedtype=long
10764                         ;;
10765                 rand|random)
10766                         case "$randbits" in
10767                         '')
10768 echo "Checking to see how many bits your $randfunc() function produces..." >&4
10769                                 $cat >try.c <<EOCP
10770 #$i_unistd I_UNISTD
10771 #$i_stdlib I_STDLIB
10772 #include <stdio.h>
10773 #ifdef I_UNISTD
10774 #  include <unistd.h>
10775 #endif
10776 #ifdef I_STDLIB
10777 #  include <stdlib.h>
10778 #endif
10779 int main()
10780 {
10781         register int i;
10782         register unsigned long tmp;
10783         register unsigned long max = 0L;
10784
10785         for (i = 1000; i; i--) {
10786                 tmp = (unsigned long) $randfunc();
10787                 if (tmp > max) max = tmp;
10788         }
10789         for (i = 0; max; i++)
10790                 max /= 2;
10791         printf("%d\n",i);
10792 }
10793 EOCP
10794                                 set try
10795                                 if eval $compile_ok; then
10796                                         dflt=`try`
10797                                 else
10798                                         dflt='?'
10799                                         echo "(I can't seem to compile the test program...)"
10800                                 fi
10801                                 ;;
10802                         *)
10803                                 dflt="$randbits"
10804                                 ;;
10805                         esac
10806                         rp="How many bits does your $randfunc() function produce?"
10807                         . ./myread
10808                         randbits="$ans"
10809                         $rm -f try.c try
10810                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10811                         seedfunc="s$randfunc"
10812                         randseedtype=unsigned
10813                         ;;
10814                 *)
10815                         dflt="31"
10816                         rp="How many bits does your $randfunc() function produce?"
10817                         . ./myread
10818                         randbits="$ans"
10819                         seedfunc="s$randfunc"
10820                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10821                         if set $seedfunc val -f; eval $csym; $val; then
10822                                 echo "(Using $seedfunc() to seed random generator)"
10823                         else
10824                                 echo "(Warning: no $seedfunc() to seed random generator)"
10825                                 seedfunc=rand
10826                         fi
10827                         randseedtype=unsigned
10828                         ;;
10829                 esac
10830                 ;;
10831         esac
10832 done
10833
10834 echo " "
10835 echo "Determining whether or not we are on an EBCDIC system..." >&4
10836 $cat >tebcdic.c <<'EOM'
10837 int main()
10838 {
10839   if ('M'==0xd4) return 0;
10840   return 1;
10841 }
10842 EOM
10843
10844 val=$undef
10845 set tebcdic
10846 if eval $compile_ok; then
10847         if ./tebcdic; then
10848                 echo "You have EBCDIC." >&4
10849                 val="$define"
10850         else
10851                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
10852         fi
10853 else
10854         echo "I'm unable to compile the test program." >&4
10855         echo "I'll assume ASCII or some ISO Latin." >&4
10856 fi
10857 $rm -f tebcdic.c tebcdic
10858 set ebcdic
10859 eval $setvar
10860
10861 : see what type file positions are declared as in the library
10862 rp="What is the type for file position used by fsetpos()?"
10863 set fpos_t fpostype long stdio.h sys/types.h
10864 eval $typedef_ask
10865
10866 : Store the full pathname to the ar program for use in the C program
10867 : Respect a hint or command line value for full_ar.
10868 case "$full_ar" in
10869 '') full_ar=$ar ;;
10870 esac
10871
10872 : Store the full pathname to the sed program for use in the C program
10873 full_sed=$sed
10874
10875 : see what type gids are declared as in the kernel
10876 echo " "
10877 echo "Looking for the type for group ids returned by getgid()."
10878 set gid_t gidtype xxx stdio.h sys/types.h
10879 eval $typedef
10880 case "$gidtype" in
10881 xxx)
10882         xxx=`./findhdr sys/user.h`
10883         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10884         case $1 in
10885         unsigned) dflt="$1 $2" ;;
10886         *) dflt="$1" ;;
10887         esac
10888         ;;
10889 *) dflt="$gidtype";;
10890 esac
10891 case "$gidtype" in
10892 gid_t) echo "gid_t found." ;;
10893 *)      rp="What is the type for group ids returned by getgid()?"
10894         . ./myread
10895         gidtype="$ans"
10896         ;;
10897 esac
10898
10899 : see if getgroups exists
10900 set getgroups d_getgrps
10901 eval $inlibc
10902
10903 : see if setgroups exists
10904 set setgroups d_setgrps
10905 eval $inlibc
10906
10907
10908 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
10909 echo " "
10910 case "$d_getgrps$d_setgrps" in
10911 *define*)
10912         case "$groupstype" in
10913         '') dflt="$gidtype" ;;
10914         *)  dflt="$groupstype" ;;
10915         esac
10916         $cat <<EOM
10917 What type of pointer is the second argument to getgroups() and setgroups()?
10918 Usually this is the same as group ids, $gidtype, but not always.
10919
10920 EOM
10921         rp='What type pointer is the second argument to getgroups() and setgroups()?'
10922         . ./myread
10923         groupstype="$ans"
10924         ;;
10925 *)  groupstype="$gidtype";;
10926 esac
10927
10928 : see what type lseek is declared as in the kernel
10929 rp="What is the type used for lseek's offset on this system?"
10930 set off_t lseektype long stdio.h sys/types.h
10931 eval $typedef_ask
10932
10933 echo " "
10934 $echo $n "Checking to see how big your file offsets are...$c" >&4
10935 $cat >try.c <<EOCP
10936 #include <sys/types.h>
10937 #include <stdio.h>
10938 int main()
10939 {
10940         printf("%d\n", sizeof($lseektype));
10941 }
10942 EOCP
10943 set try
10944 if eval $compile_ok; then
10945         lseeksize=`./try`
10946         $echo " $lseeksize bytes." >&4
10947 else
10948         dflt='4'
10949         echo " "
10950         echo "(I can't seem to compile the test program.  Guessing...)"
10951         rp="What is the size of your file offsets (in bytes)?"
10952         . ./myread
10953         lseeksize="$ans"
10954 fi
10955 $rm -f try.c try
10956
10957 echo " "
10958 echo "Checking if your $make program sets \$(MAKE)..." >&4
10959 case "$make_set_make" in
10960 '')
10961         $sed 's/^X //' > testmake.mak << 'EOF'
10962 Xall:
10963 X       @echo 'maketemp="$(MAKE)"'
10964 EOF
10965         case "`$make -f testmake.mak 2>/dev/null`" in
10966         *maketemp=*) make_set_make='#' ;;
10967         *)      make_set_make="MAKE=$make" ;;
10968         esac
10969         $rm -f testmake.mak
10970         ;;
10971 esac
10972 case "$make_set_make" in
10973 '#') echo "Yup, it does.";;
10974 *) echo "Nope, it doesn't.";;
10975 esac
10976
10977 : see what type is used for mode_t
10978 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
10979 set mode_t modetype int stdio.h sys/types.h
10980 eval $typedef_ask
10981
10982 : define a fucntion to check prototypes
10983 $cat > protochk <<EOSH
10984 $startsh
10985 cc="$cc"
10986 optimize="$optimize"
10987 ccflags="$ccflags"
10988 prototype="$prototype"
10989 define="$define"
10990 rm=$rm
10991 EOSH
10992
10993 $cat >> protochk <<'EOSH'
10994
10995 $rm -f try.c
10996 foo="$1"
10997 shift
10998 while test $# -ge 2; do
10999         case "$1" in
11000                 $define) echo "#include <$2>" >> try.c ;;
11001                 literal) echo "$2" >> try.c ;;
11002         esac
11003     shift 2
11004 done
11005 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11006 cat >> try.c <<'EOCP'
11007 #ifdef CAN_PROTOTYPE
11008 #define _(args) args
11009 #else
11010 #define _(args) ()
11011 #endif
11012 EOCP
11013 echo "$foo" >> try.c
11014 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11015 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11016 status=$?
11017 $rm -f try.[co]
11018 exit $status
11019 EOSH
11020 chmod +x protochk
11021 $eunicefix protochk
11022
11023 : see what type is used for size_t
11024 rp="What is the type used for the length parameter for string functions?"
11025 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11026 eval $typedef_ask
11027
11028 : check for type of arguments to gethostbyaddr. 
11029 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11030         case "$d_gethbyaddr" in
11031         $define)
11032                 $cat <<EOM
11033
11034 Checking to see what type of arguments are accepted by gethostbyaddr().
11035 EOM
11036                 hdrs="$define sys/types.h
11037                         $d_socket sys/socket.h 
11038                         $i_niin netinet/in.h 
11039                         $i_netdb netdb.h
11040                         $i_unistd unistd.h"
11041                 : The first arg can 'char *' or 'void *'
11042                 : The second arg is some of integral type
11043                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11044                         for yyy in size_t long int; do
11045                                 case "$netdb_host_type" in
11046                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11047                                         if ./protochk "$try" $hdrs; then
11048                                                 echo "Your system accepts $xxx for the first arg."
11049                                                 echo "...and $yyy for the second arg."
11050                                                 netdb_host_type="$xxx"
11051                                                 netdb_hlen_type="$yyy"
11052                                         fi
11053                                         ;;
11054                                 esac
11055                         done
11056                 done
11057                 : In case none of those worked, prompt the user.
11058                 case "$netdb_host_type" in
11059                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11060                         dflt='char *'
11061                         . ./myread
11062                         netdb_host_type=$ans
11063                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11064                         dflt="$sizetype"
11065                         . ./myread
11066                         netdb_hlen_type=$ans
11067                         ;;
11068                 esac
11069                 ;;
11070         *)      : no gethostbyaddr, so pick harmless defaults
11071                 netdb_host_type='char *'
11072                 netdb_hlen_type="$sizetype"
11073                 ;;
11074         esac
11075         # Remove the "const" if needed. -- but then we'll have a 
11076         # prototype clash!
11077         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11078 fi
11079
11080 : check for type of argument to gethostbyname. 
11081 if test "X$netdb_name_type" = X ; then
11082         case "$d_gethbyname" in
11083         $define)
11084                 $cat <<EOM
11085
11086 Checking to see what type of argument is accepted by gethostbyname().
11087 EOM
11088                 hdrs="$define sys/types.h
11089                         $d_socket sys/socket.h 
11090                         $i_niin netinet/in.h 
11091                         $i_netdb netdb.h
11092                         $i_unistd unistd.h"
11093                 for xxx in "const char *" "char *"; do
11094                         case "$netdb_name_type" in
11095                         '')     try="extern struct hostent *gethostbyname($xxx);"
11096                                 if ./protochk "$try" $hdrs; then
11097                                         echo "Your system accepts $xxx."
11098                                         netdb_name_type="$xxx"
11099                                 fi
11100                                 ;;
11101                         esac
11102                 done
11103                 : In case none of those worked, prompt the user.
11104                 case "$netdb_name_type" in
11105                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11106                         dflt='char *'
11107                         . ./myread
11108                         netdb_name_type=$ans
11109                         ;;
11110                 esac
11111                 ;;
11112         *)      : no gethostbyname, so pick harmless default
11113                 netdb_name_type='char *'
11114                 ;;
11115         esac
11116 fi
11117
11118 : check for type of 1st argument to getnetbyaddr. 
11119 if test "X$netdb_net_type" = X ; then
11120         case "$d_getnbyaddr" in
11121         $define)
11122                 $cat <<EOM
11123
11124 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11125 EOM
11126                 hdrs="$define sys/types.h
11127                         $d_socket sys/socket.h 
11128                         $i_niin netinet/in.h 
11129                         $i_netdb netdb.h
11130                         $i_unistd unistd.h"
11131                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11132                         case "$netdb_net_type" in
11133                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11134                                 if ./protochk "$try" $hdrs; then
11135                                         echo "Your system accepts $xxx."
11136                                         netdb_net_type="$xxx"
11137                                 fi
11138                                 ;;
11139                         esac
11140                 done
11141                 : In case none of those worked, prompt the user.
11142                 case "$netdb_net_type" in
11143                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11144                         dflt='long'
11145                         . ./myread
11146                         netdb_net_type=$ans
11147                         ;;
11148                 esac
11149                 ;;
11150         *)      : no getnetbyaddr, so pick harmless default
11151                 netdb_net_type='long'
11152                 ;;
11153         esac
11154 fi
11155 : locate the preferred pager for this system
11156 case "$pager" in
11157 '')
11158         dflt=''
11159         case "$pg" in
11160         /*) dflt=$pg;;
11161         esac
11162         case "$more" in
11163         /*) dflt=$more;;
11164         esac
11165         case "$less" in
11166         /*) dflt=$less;;
11167         esac
11168         case "$dflt" in
11169         '') dflt=/usr/ucb/more;;
11170         esac
11171         ;;
11172 *) dflt="$pager";;
11173 esac
11174 echo " "
11175 fn=f/
11176 rp='What pager is used on your system?'
11177 . ./getfile
11178 pager="$ans"
11179
11180 : see what type pids are declared as in the kernel
11181 rp="What is the type of process ids on this system?"
11182 set pid_t pidtype int stdio.h sys/types.h
11183 eval $typedef_ask
11184
11185 : check for length of pointer
11186 echo " "
11187 case "$ptrsize" in
11188 '')
11189         $echo $n "Checking to see how big your pointers are...$c" >&4
11190         if test "$voidflags" -gt 7; then
11191                 echo '#define VOID_PTR char *' > try.c
11192         else
11193                 echo '#define VOID_PTR void *' > try.c
11194         fi
11195         $cat >>try.c <<'EOCP'
11196 #include <stdio.h>
11197 int main()
11198 {
11199         printf("%d\n", sizeof(VOID_PTR));
11200         exit(0);
11201 }
11202 EOCP
11203         set try
11204         if eval $compile_ok; then
11205                 ptrsize=`./try`
11206                 $echo " $ptrsize bytes." >&4
11207         else
11208                 dflt='4'
11209                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11210                 rp="What is the size of a pointer (in bytes)?"
11211                 . ./myread
11212                 ptrsize="$ans"
11213         fi
11214         ;;
11215 esac
11216 $rm -f try.c try
11217
11218 : see if ar generates random libraries by itself
11219 echo " "
11220 echo "Checking how to generate random libraries on your machine..." >&4
11221 echo 'int bar1() { return bar2(); }' > bar1.c
11222 echo 'int bar2() { return 2; }' > bar2.c
11223 $cat > foo.c <<'EOP'
11224 int main() { printf("%d\n", bar1()); exit(0); }
11225 EOP
11226 $cc $ccflags -c bar1.c >/dev/null 2>&1
11227 $cc $ccflags -c bar2.c >/dev/null 2>&1
11228 $cc $ccflags -c foo.c >/dev/null 2>&1
11229 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11230 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11231         ./foobar >/dev/null 2>&1; then
11232         echo "$ar appears to generate random libraries itself."
11233         orderlib=false
11234         ranlib=":"
11235 elif $ar ts bar$_a >/dev/null 2>&1 &&
11236         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11237         ./foobar >/dev/null 2>&1; then
11238                 echo "a table of contents needs to be added with '$ar ts'."
11239                 orderlib=false
11240                 ranlib="$ar ts"
11241 else
11242         case "$ranlib" in
11243         :) ranlib='';;
11244         '')
11245                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11246                 $test -f $ranlib || ranlib=''
11247                 ;;
11248         esac
11249         if $test -n "$ranlib"; then
11250                 echo "your system has '$ranlib'; we'll use that."
11251                 orderlib=false
11252         else
11253                 echo "your system doesn't seem to support random libraries"
11254                 echo "so we'll use lorder and tsort to order the libraries."
11255                 orderlib=true
11256                 ranlib=":"
11257         fi
11258 fi
11259 $rm -f foo* bar* 
11260
11261 : check for type of arguments to select. 
11262 case "$selecttype" in
11263 '') case "$d_select" in
11264         $define)
11265                 $cat <<EOM
11266 Checking to see what type of arguments are accepted by select().
11267 EOM
11268                 hdrs="$define sys/types.h
11269                         $i_systime sys/time.h 
11270                         $i_sysselct sys/select.h
11271                         $d_socket sys/socket.h"
11272                 : The first arg can be int, unsigned, or size_t
11273                 : The last arg may or may not be 'const'
11274                 val=''
11275                 : void pointer has been seen but using that
11276                 : breaks the selectminbits test
11277                 for xxx in 'fd_set *' 'int *'; do
11278                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11279                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11280                                         case "$val" in
11281                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11282                                                 if ./protochk "$try" $hdrs; then
11283                                                         echo "Your system accepts $xxx."
11284                                                         val="$xxx"
11285                                                 fi
11286                                                 ;;
11287                                         esac
11288                                 done
11289                         done
11290                 done
11291                 case "$val" in
11292                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11293                         case "$d_fd_set" in
11294                                 $define) dflt="fd_set *" ;;
11295                                 *)              dflt="int *" ;;
11296                         esac
11297                         . ./myread
11298                         val=$ans
11299                         ;;
11300                 esac
11301                 selecttype="$val"
11302                 ;;
11303         *)      : no select, so pick a harmless default
11304                 selecttype='int *'
11305                 ;;
11306         esac
11307         ;;
11308 esac
11309
11310 : check for the select 'width'
11311 case "$selectminbits" in
11312 '') case "$d_select" in
11313         $define)
11314                 $cat <<EOM
11315
11316 Checking to see on how many bits at a time your select() operates...
11317 EOM
11318                 $cat >try.c <<EOCP
11319 #include <sys/types.h>
11320 #$i_time I_TIME
11321 #$i_systime I_SYS_TIME
11322 #$i_systimek I_SYS_TIME_KERNEL
11323 #ifdef I_TIME
11324 #   include <time.h>
11325 #endif
11326 #ifdef I_SYS_TIME
11327 #   ifdef I_SYS_TIME_KERNEL
11328 #       define KERNEL
11329 #   endif
11330 #   include <sys/time.h>
11331 #   ifdef I_SYS_TIME_KERNEL
11332 #       undef KERNEL
11333 #   endif
11334 #endif
11335 #$i_sysselct I_SYS_SELECT
11336 #ifdef I_SYS_SELECT
11337 #include <sys/select.h>
11338 #endif
11339 #include <stdio.h>
11340 $selecttype b;
11341 #define S sizeof(*(b))
11342 #define MINBITS 64
11343 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11344 #define NBITS  (NBYTES * 8)
11345 int main() {
11346     char s[NBYTES];
11347     struct timeval t;
11348     int i;
11349     FILE* fp;
11350     int fd;
11351
11352     fclose(stdin);
11353     fp = fopen("try.c", "r");
11354     if (fp == 0)
11355       exit(1);
11356     fd = fileno(fp);
11357     if (fd < 0)
11358       exit(2);
11359     b = ($selecttype)s;
11360     for (i = 0; i < NBITS; i++)
11361         FD_SET(i, b);
11362     t.tv_sec  = 0;
11363     t.tv_usec = 0;
11364     select(fd + 1, b, 0, 0, &t);
11365     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11366     printf("%d\n", i + 1);
11367     return 0;
11368 }
11369 EOCP
11370                 set try
11371                 if eval $compile_ok; then
11372                         selectminbits=`./try`
11373                         case "$selectminbits" in
11374                         '')     cat >&4 <<EOM
11375 Cannot figure out on how many bits at a time your select() operates.
11376 I'll play safe and guess it is 32 bits.
11377 EOM
11378                                 selectminbits=32
11379                                 bits="32 bits"
11380                                 ;;
11381                         1)      bits="1 bit" ;;
11382                         *)      bits="$selectminbits bits" ;;
11383                         esac
11384                         echo "Your select() operates on $bits at a time." >&4
11385                 else
11386                         rp='What is the minimum number of bits your select() operates on?'
11387                         case "$byteorder" in
11388                         1234|12345678)  dflt=32 ;;
11389                         *)              dflt=1  ;;
11390                         esac
11391                         . ./myread
11392                         val=$ans
11393                         selectminbits="$val"
11394                 fi
11395                 $rm -f try.* try
11396                 ;;
11397         *)      : no select, so pick a harmless default
11398                 selectminbits='32'
11399                 ;;
11400         esac
11401         ;;
11402 esac
11403
11404 : Trace out the files included by signal.h, then look for SIGxxx names.
11405 : Remove SIGARRAYSIZE used by HPUX.
11406 : Remove SIGTYP void lines used by OS2.
11407 xxx=`echo '#include <signal.h>' |
11408         $cppstdin $cppminus $cppflags 2>/dev/null |
11409         $grep '^[       ]*#.*include' | 
11410         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11411 : Check this list of files to be sure we have parsed the cpp output ok.
11412 : This will also avoid potentially non-existent files, such 
11413 : as ../foo/bar.h
11414 xxxfiles=''
11415 for xx in $xxx /dev/null ; do
11416         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11417 done
11418 : If we have found no files, at least try signal.h
11419 case "$xxxfiles" in
11420 '')     xxxfiles=`./findhdr signal.h` ;;
11421 esac
11422 xxx=`awk '
11423 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
11424         print substr($2, 4, 20)
11425 }
11426 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
11427         print substr($3, 4, 20)
11428 }' $xxxfiles`
11429 : Append some common names just in case the awk scan failed.
11430 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11431 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11432 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11433 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11434 : generate a few handy files for later
11435 $cat > signal.c <<'EOCP'
11436 #include <sys/types.h>
11437 #include <signal.h>
11438 #include <stdio.h>
11439 int main() {
11440
11441 /* Strange style to avoid deeply-nested #if/#else/#endif */
11442 #ifndef NSIG
11443 #  ifdef _NSIG
11444 #    define NSIG (_NSIG)
11445 #  endif
11446 #endif
11447
11448 #ifndef NSIG
11449 #  ifdef SIGMAX
11450 #    define NSIG (SIGMAX+1)
11451 #  endif
11452 #endif
11453
11454 #ifndef NSIG
11455 #  ifdef SIG_MAX
11456 #    define NSIG (SIG_MAX+1)
11457 #  endif
11458 #endif
11459
11460 #ifndef NSIG
11461 #  ifdef MAXSIG
11462 #    define NSIG (MAXSIG+1)
11463 #  endif
11464 #endif
11465
11466 #ifndef NSIG
11467 #  ifdef MAX_SIG
11468 #    define NSIG (MAX_SIG+1)
11469 #  endif
11470 #endif
11471
11472 #ifndef NSIG
11473 #  ifdef SIGARRAYSIZE
11474 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11475 #  endif
11476 #endif
11477
11478 #ifndef NSIG
11479 #  ifdef _sys_nsig
11480 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
11481 #  endif
11482 #endif
11483
11484 /* Default to some arbitrary number that's big enough to get most
11485    of the common signals.
11486 */
11487 #ifndef NSIG
11488 #    define NSIG 50
11489 #endif
11490
11491 printf("NSIG %d\n", NSIG);
11492
11493 #ifndef JUST_NSIG
11494
11495 EOCP
11496
11497 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
11498 {
11499         printf "#ifdef SIG"; printf $1; printf "\n"
11500         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11501         printf $1; printf ");\n"
11502         printf "#endif\n"
11503 }
11504 END {
11505         printf "#endif /* JUST_NSIG */\n";
11506         printf "}\n";
11507 }
11508 ' >>signal.c
11509 $cat >signal.awk <<'EOP'
11510 BEGIN { ndups = 0 }
11511 $1 ~ /^NSIG$/ { nsig = $2 }
11512 ($1 !~ /^NSIG$/) && (NF == 2) {
11513     if ($2 > maxsig) { maxsig = $2 }
11514     if (sig_name[$2]) {
11515         dup_name[ndups] = $1
11516         dup_num[ndups] = $2
11517         ndups++ 
11518     }
11519     else {
11520         sig_name[$2] = $1
11521         sig_num[$2] = $2
11522     }
11523
11524 }
11525 END { 
11526     if (nsig == 0) { nsig = maxsig + 1 }
11527         for (n = 1; n < nsig; n++) {
11528                 if (sig_name[n]) {
11529                         printf("%s %d\n", sig_name[n], sig_num[n])
11530                 }
11531                 else {
11532                         printf("NUM%d %d\n", n, n) 
11533                 }
11534         }
11535     for (n = 0; n < ndups; n++) {
11536                 printf("%s %d\n", dup_name[n], dup_num[n])
11537     }
11538 }
11539 EOP
11540 $cat >signal_cmd <<EOS
11541 $startsh
11542 if $test -s signal.lst; then
11543     echo "Using your existing signal.lst file"
11544         exit 0
11545 fi
11546 xxx="$xxx"
11547 EOS
11548 $cat >>signal_cmd <<'EOS'
11549
11550 set signal
11551 if eval $compile_ok; then
11552         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11553 else
11554         echo "(I can't seem be able to compile the whole test program)" >&4
11555         echo "(I'll try it in little pieces.)" >&4
11556         set signal -DJUST_NSIG
11557         if eval $compile_ok; then
11558                 ./signal$_exe > signal.nsg
11559                 $cat signal.nsg
11560         else
11561                 echo "I can't seem to figure out how many signals you have." >&4
11562                 echo "Guessing 50." >&4
11563                 echo 'NSIG 50' > signal.nsg
11564         fi
11565         : Now look at all the signal names, one at a time.
11566         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
11567                 $cat > signal.c <<EOCP
11568 #include <sys/types.h>
11569 #include <signal.h>
11570 #include <stdio.h>
11571 int main() {
11572 printf("$xx %d\n", SIG${xx});
11573 return 0;
11574 }
11575 EOCP
11576                 set signal
11577                 if eval $compile; then
11578                         echo "SIG${xx} found."
11579                         ./signal$_exe  >> signal.ls1
11580                 else
11581                         echo "SIG${xx} NOT found."
11582                 fi
11583         done
11584         if $test -s signal.ls1; then
11585                 $cat signal.nsg signal.ls1 |
11586                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11587         fi
11588
11589 fi
11590 if $test -s signal.lst; then
11591         :
11592 else
11593         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
11594         echo 'kill -l' >signal
11595         set X `csh -f <signal`
11596         $rm -f signal
11597         shift
11598         case $# in
11599         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
11600         esac
11601         echo $@ | $tr ' ' $trnl | \
11602                 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
11603 fi
11604 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
11605 EOS
11606 chmod a+x signal_cmd
11607 $eunicefix signal_cmd
11608
11609 : generate list of signal names
11610 echo " "
11611 case "$sig_name_init" in
11612 '') doinit=yes ;;
11613 *)  case "$sig_num_init" in
11614     ''|*,*) doinit=yes ;;
11615     esac ;;
11616 esac
11617 case "$doinit" in
11618 yes)
11619         echo "Generating a list of signal names and numbers..." >&4
11620         . ./signal_cmd
11621         sig_name=`$awk '{printf "%s ", $1}' signal.lst`
11622         sig_name="ZERO $sig_name"
11623         sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11624                                                 { printf "\"%s\", ", $1 }
11625                                                 END { printf "0\n" }' signal.lst`
11626         sig_num=`$awk '{printf "%d ", $2}' signal.lst`
11627         sig_num="0 $sig_num"
11628         sig_num_init=`$awk 'BEGIN { printf "0, " }
11629                                         { printf "%d, ", $2}
11630                                         END { printf "0\n"}' signal.lst`
11631         ;;
11632 esac
11633 echo "The following signals are available:"
11634 echo " "
11635 echo $sig_name | $awk \
11636 'BEGIN { linelen = 0 }
11637 {
11638         for (i = 1; i <= NF; i++) {
11639                 name = "SIG" $i " "
11640                 linelen = linelen + length(name)
11641                 if (linelen > 70) {
11642                         printf "\n"
11643                         linelen = length(name)
11644                 }
11645                 printf "%s", name
11646         }
11647         printf "\n"
11648 }'
11649 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
11650
11651 : see what type is used for signed size_t
11652 set ssize_t ssizetype int stdio.h sys/types.h
11653 eval $typedef
11654 dflt="$ssizetype"
11655 $cat > ssize.c <<EOM
11656 #include <stdio.h>
11657 #include <sys/types.h>
11658 #define Size_t $sizetype
11659 #define SSize_t $dflt
11660 int main()
11661 {
11662         if (sizeof(Size_t) == sizeof(SSize_t))
11663                 printf("$dflt\n");
11664         else if (sizeof(Size_t) == sizeof(int))
11665                 printf("int\n");
11666         else 
11667                 printf("long\n");
11668         exit(0);
11669 }
11670 EOM
11671 echo " "
11672 set ssize
11673 if eval $compile_ok && ./ssize > /dev/null; then
11674         ssizetype=`./ssize`
11675         echo "I'll be using $ssizetype for functions returning a byte count." >&4
11676 else
11677         $cat >&4 <<EOM
11678 Help! I can't compile and run the ssize_t test program: please enlighten me!
11679 (This is probably a misconfiguration in your system or libraries, and
11680 you really ought to fix it.  Still, I'll try anyway.)
11681
11682 I need a type that is the same size as $sizetype, but is guaranteed to
11683 be signed.  Common values are ssize_t, int and long.
11684
11685 EOM
11686         rp="What signed type is the same size as $sizetype?"
11687         . ./myread
11688         ssizetype="$ans"
11689 fi
11690 $rm -f ssize ssize.*
11691
11692 : see what type of char stdio uses.
11693 echo " "
11694 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11695         echo "Your stdio uses unsigned chars." >&4
11696         stdchar="unsigned char"
11697 else
11698         echo "Your stdio uses signed chars." >&4
11699         stdchar="char"
11700 fi
11701
11702 : see if time exists
11703 echo " "
11704 if test "X$d_time" = X -o X"$timetype" = X; then
11705     if set time val -f d_time; eval $csym; $val; then
11706                 echo 'time() found.' >&4
11707                 val="$define"
11708                 rp="What is the type returned by time() on this system?"
11709                 set time_t timetype long stdio.h sys/types.h
11710                 eval $typedef_ask
11711     else
11712                 echo 'time() not found, hope that will do.' >&4
11713                 val="$undef"
11714                 timetype='int';
11715     fi
11716     set d_time
11717     eval $setvar
11718 fi
11719
11720 : see what type uids are declared as in the kernel
11721 echo " "
11722 echo "Looking for the type for user ids returned by getuid()."
11723 set uid_t uidtype xxx stdio.h sys/types.h
11724 eval $typedef
11725 case "$uidtype" in
11726 xxx)
11727         xxx=`./findhdr sys/user.h`
11728         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11729         case $1 in
11730         unsigned) dflt="$1 $2" ;;
11731         *) dflt="$1" ;;
11732         esac
11733         ;;
11734 *) dflt="$uidtype";;
11735 esac
11736 case "$uidtype" in
11737 uid_t)  echo "uid_t found." ;;
11738 *)      rp="What is the type for user ids returned by getuid()?"
11739         . ./myread
11740         uidtype="$ans"
11741         ;;
11742 esac
11743
11744 : see if dbm.h is available
11745 : see if dbmclose exists
11746 set dbmclose d_dbmclose
11747 eval $inlibc
11748
11749 case "$d_dbmclose" in
11750 $define)
11751         set dbm.h i_dbm
11752         eval $inhdr
11753         case "$i_dbm" in
11754         $define)
11755                 val="$undef"
11756                 set i_rpcsvcdbm
11757                 eval $setvar
11758                 ;;
11759         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11760                 eval $inhdr
11761                 ;;
11762         esac
11763         ;;
11764 *)      echo "We won't be including <dbm.h>"
11765         val="$undef"
11766         set i_dbm
11767         eval $setvar
11768         val="$undef"
11769         set i_rpcsvcdbm
11770         eval $setvar
11771         ;;
11772 esac
11773
11774 : see if this is a sys/file.h system
11775 val=''
11776 set sys/file.h val
11777 eval $inhdr
11778
11779 : do we need to include sys/file.h ?
11780 case "$val" in
11781 "$define")
11782         echo " "
11783         if $h_sysfile; then
11784                 val="$define"
11785                 echo "We'll be including <sys/file.h>." >&4
11786         else
11787                 val="$undef"
11788                 echo "We won't be including <sys/file.h>." >&4
11789         fi
11790         ;;
11791 *)
11792         h_sysfile=false
11793         ;;
11794 esac
11795 set i_sysfile
11796 eval $setvar
11797
11798 : see if fcntl.h is there
11799 val=''
11800 set fcntl.h val
11801 eval $inhdr
11802
11803 : see if we can include fcntl.h
11804 case "$val" in
11805 "$define")
11806         echo " "
11807         if $h_fcntl; then
11808                 val="$define"
11809                 echo "We'll be including <fcntl.h>." >&4
11810         else
11811                 val="$undef"
11812                 if $h_sysfile; then
11813         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11814                 else
11815                         echo "We won't be including <fcntl.h>." >&4
11816                 fi
11817         fi
11818         ;;
11819 *)
11820         h_fcntl=false
11821         val="$undef"
11822         ;;
11823 esac
11824 set i_fcntl
11825 eval $setvar
11826
11827 : see if locale.h is available
11828 set locale.h i_locale
11829 eval $inhdr
11830
11831 : see if mach cthreads are available
11832 if test "X$usethreads" = "X$define"; then
11833         set mach/cthreads.h i_machcthr
11834         eval $inhdr
11835 else
11836         i_machcthr="$undef"
11837 fi
11838
11839
11840
11841 : see if this is a math.h system
11842 set math.h i_math
11843 eval $inhdr
11844
11845 : see if this is a mntent.h system
11846 set mntent.h i_mntent
11847 eval $inhdr
11848
11849 : see if ndbm.h is available
11850 set ndbm.h t_ndbm
11851 eval $inhdr
11852 case "$t_ndbm" in
11853 $define)
11854         : see if dbm_open exists
11855         set dbm_open d_dbm_open
11856         eval $inlibc
11857         case "$d_dbm_open" in
11858         $undef)
11859                 t_ndbm="$undef"
11860                 echo "We won't be including <ndbm.h>"
11861                 ;;
11862         esac
11863         ;;
11864 esac
11865 val="$t_ndbm"
11866 set i_ndbm
11867 eval $setvar
11868
11869 : see if net/errno.h is available
11870 val=''
11871 set net/errno.h val
11872 eval $inhdr
11873
11874 : Unfortunately, it causes problems on some systems.  Arrgh.
11875 case "$val" in
11876 $define)
11877         cat > try.c <<'EOM'
11878 #include <stdio.h>
11879 #include <errno.h>
11880 #include <net/errno.h>
11881 int func()
11882 {
11883         return ENOTSOCK;
11884 }
11885 EOM
11886         if $cc $ccflags -c try.c >/dev/null 2>&1; then
11887                 echo "We'll be including <net/errno.h>." >&4
11888         else
11889                 echo "We won't be including <net/errno.h>." >&4
11890                 val="$undef"
11891         fi
11892         $rm -f try.* try
11893         ;;
11894 esac
11895 set i_neterrno
11896 eval $setvar
11897
11898 : see if this is a poll.h system
11899 set poll.h i_poll
11900 eval $inhdr
11901
11902 : get C preprocessor symbols handy
11903 echo " "
11904 $echo $n "Hmm... $c"
11905 echo $al | $tr ' ' $trnl >Cppsym.know
11906 $cat <<EOSS >Cppsym
11907 $startsh
11908 case "\$1" in
11909 -l) list=true
11910         shift
11911         ;;
11912 esac
11913 unknown=''
11914 case "\$list\$#" in
11915 1|2)
11916         for sym do
11917                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
11918                         exit 0
11919                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
11920                         :
11921                 else
11922                         unknown="\$unknown \$sym"
11923                 fi
11924         done
11925         set X \$unknown
11926         shift
11927         ;;
11928 esac
11929 case \$# in
11930 0) exit 1;;
11931 esac
11932 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
11933 #ifdef \1\\
11934 exit 0; _ _ _ _\1\\      \1\\
11935 #endif\\
11936 /' >Cppsym\$\$
11937 echo "exit 1; _ _ _" >>Cppsym\$\$
11938 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
11939 case "\$list" in
11940 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
11941 *)
11942         sh Cppsym2\$\$
11943         status=\$?
11944         ;;
11945 esac
11946 $rm -f Cppsym\$\$ Cppsym2\$\$
11947 exit \$status
11948 EOSS
11949 chmod +x Cppsym
11950 $eunicefix Cppsym
11951 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
11952
11953 : now check the C compiler for additional symbols
11954 $cat >ccsym <<EOS
11955 $startsh
11956 $cat >tmp.c <<EOF
11957 extern int foo;
11958 EOF
11959 for i in \`$cc -v -c tmp.c 2>&1\`
11960 do
11961         case "\$i" in
11962         -D*) echo "\$i" | $sed 's/^-D//';;
11963         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
11964         esac
11965 done
11966 $rm -f try.c
11967 EOS
11968 chmod +x ccsym
11969 $eunicefix ccsym
11970 ./ccsym > ccsym1.raw
11971 if $test -s ccsym1.raw; then
11972        $sort ccsym1.raw | $uniq >ccsym.raw
11973 else
11974        mv ccsym1.raw ccsym.raw
11975 fi
11976
11977 $awk '/\=/ { print $0; next }
11978         { print $0"=1" }' ccsym.raw >ccsym.list
11979 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
11980 $comm -13 ccsym.true ccsym.list >ccsym.own
11981 $comm -12 ccsym.true ccsym.list >ccsym.com
11982 $comm -23 ccsym.true ccsym.list >ccsym.cpp
11983 also=''
11984 if $test -z ccsym.raw; then
11985         echo "Your C compiler doesn't seem to define any symbols!" >&4
11986         echo " "
11987         echo "However, your C preprocessor defines the following symbols:"
11988         $cat Cppsym.true
11989         ccsymbols=''
11990         cppsymbols=`$cat Cppsym.true`
11991         cppsymbols=`echo $cppsymbols`
11992         cppccsymbols="$cppsymbols"
11993 else
11994         if $test -s ccsym.com; then
11995                 echo "Your C compiler and pre-processor define these symbols:"
11996                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
11997                 also='also '
11998                 symbols='ones'
11999                 cppccsymbols=`$cat ccsym.com`
12000                 cppccsymbols=`echo $cppccsymbols`
12001                 $test "$silent" || sleep 1
12002         fi
12003         if $test -s ccsym.cpp; then
12004                 $test "$also" && echo " "
12005                 echo "Your C pre-processor ${also}defines the following symbols:"
12006                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12007                 also='further '
12008                 cppsymbols=`$cat ccsym.cpp`
12009                 cppsymbols=`echo $cppsymbols`
12010                 $test "$silent" || sleep 1
12011         fi
12012         if $test -s ccsym.own; then
12013                 $test "$also" && echo " "
12014                 echo "Your C compiler ${also}defines the following cpp symbols:"
12015                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12016                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12017                 ccsymbols=`$cat ccsym.own`
12018                 ccsymbols=`echo $ccsymbols`
12019                 $test "$silent" || sleep 1
12020         fi
12021 fi
12022 $rm -f ccsym*
12023
12024 : see if this is a termio system
12025 val="$undef"
12026 val2="$undef"
12027 val3="$undef"
12028 if $test `./findhdr termios.h`; then
12029         set tcsetattr i_termios
12030         eval $inlibc
12031         val3="$i_termios"
12032 fi
12033 echo " "
12034 case "$val3" in
12035 "$define") echo "You have POSIX termios.h... good!" >&4;;
12036 *) if ./Cppsym pyr; then
12037                 case "`/bin/universe`" in
12038                 ucb) if $test `./findhdr sgtty.h`; then
12039                                 val2="$define"
12040                                 echo "<sgtty.h> found." >&4
12041                         else
12042                                 echo "System is pyramid with BSD universe."
12043                                 echo "<sgtty.h> not found--you could have problems." >&4
12044                         fi;;
12045                 *) if $test `./findhdr termio.h`; then
12046                                 val="$define"
12047                                 echo "<termio.h> found." >&4
12048                         else
12049                                 echo "System is pyramid with USG universe."
12050                                 echo "<termio.h> not found--you could have problems." >&4
12051                         fi;;
12052                 esac
12053         elif ./usg; then
12054                 if $test `./findhdr termio.h`; then
12055                         echo "<termio.h> found." >&4
12056                         val="$define"
12057                 elif $test `./findhdr sgtty.h`; then
12058                         echo "<sgtty.h> found." >&4
12059                         val2="$define"
12060                 else
12061 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12062                 fi
12063         else
12064                 if $test `./findhdr sgtty.h`; then
12065                         echo "<sgtty.h> found." >&4
12066                         val2="$define"
12067                 elif $test `./findhdr termio.h`; then
12068                         echo "<termio.h> found." >&4
12069                         val="$define"
12070                 else
12071 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12072                 fi
12073         fi;;
12074 esac
12075 set i_termio; eval $setvar
12076 val=$val2; set i_sgtty; eval $setvar
12077 val=$val3; set i_termios; eval $setvar
12078
12079 : see if stdarg is available
12080 echo " "
12081 if $test `./findhdr stdarg.h`; then
12082         echo "<stdarg.h> found." >&4
12083         valstd="$define"
12084 else
12085         echo "<stdarg.h> NOT found." >&4
12086         valstd="$undef"
12087 fi
12088
12089 : see if varags is available
12090 echo " "
12091 if $test `./findhdr varargs.h`; then
12092         echo "<varargs.h> found." >&4
12093 else
12094         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12095 fi
12096
12097 : set up the varargs testing programs
12098 $cat > varargs.c <<EOP
12099 #ifdef I_STDARG
12100 #include <stdarg.h>
12101 #endif
12102 #ifdef I_VARARGS
12103 #include <varargs.h>
12104 #endif
12105
12106 #ifdef I_STDARG
12107 int f(char *p, ...)
12108 #else
12109 int f(va_alist)
12110 va_dcl
12111 #endif
12112 {
12113         va_list ap;
12114 #ifndef I_STDARG
12115         char *p;
12116 #endif
12117 #ifdef I_STDARG
12118         va_start(ap,p);
12119 #else
12120         va_start(ap);
12121         p = va_arg(ap, char *);
12122 #endif
12123         va_end(ap);
12124 }
12125 EOP
12126 $cat > varargs <<EOP
12127 $startsh
12128 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12129         echo "true"
12130 else
12131         echo "false"
12132 fi
12133 $rm -f varargs$_o
12134 EOP
12135 chmod +x varargs
12136
12137 : now check which varargs header should be included
12138 echo " "
12139 i_varhdr=''
12140 case "$valstd" in
12141 "$define")
12142         if `./varargs I_STDARG`; then
12143                 val='stdarg.h'
12144         elif `./varargs I_VARARGS`; then
12145                 val='varargs.h'
12146         fi
12147         ;;
12148 *)
12149         if `./varargs I_VARARGS`; then
12150                 val='varargs.h'
12151         fi
12152         ;;
12153 esac
12154 case "$val" in
12155 '')
12156 echo "I could not find the definition for va_dcl... You have problems..." >&4
12157         val="$undef"; set i_stdarg; eval $setvar
12158         val="$undef"; set i_varargs; eval $setvar
12159         ;;
12160 *) 
12161         set i_varhdr
12162         eval $setvar
12163         case "$i_varhdr" in
12164         stdarg.h)
12165                 val="$define"; set i_stdarg; eval $setvar
12166                 val="$undef"; set i_varargs; eval $setvar
12167                 ;;
12168         varargs.h)
12169                 val="$undef"; set i_stdarg; eval $setvar
12170                 val="$define"; set i_varargs; eval $setvar
12171                 ;;
12172         esac
12173         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12174 esac
12175 $rm -f varargs*
12176
12177 : see if stddef is available
12178 set stddef.h i_stddef
12179 eval $inhdr
12180
12181 : see if sys/access.h is available
12182 set sys/access.h i_sysaccess
12183 eval $inhdr
12184
12185 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12186 set sys/filio.h i_sysfilio
12187 eval $inhdr
12188 echo " "
12189 if $test `./findhdr sys/ioctl.h`; then
12190         val="$define"
12191         echo '<sys/ioctl.h> found.' >&4
12192 else
12193         val="$undef"
12194         if $test $i_sysfilio = "$define"; then
12195             echo '<sys/ioctl.h> NOT found.' >&4
12196         else
12197                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12198                 $test $i_termio = "$define" && xxx="termio.h"
12199                 $test $i_termios = "$define" && xxx="termios.h"
12200 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12201         fi
12202 fi
12203 set i_sysioctl
12204 eval $setvar
12205
12206 : see if sys/resource.h has to be included
12207 set sys/resource.h i_sysresrc
12208 eval $inhdr
12209
12210 : see if sys/security.h is available
12211 set sys/security.h i_syssecrt
12212 eval $inhdr
12213
12214 : see if this is a sys/statvfs.h system
12215 set sys/statvfs.h i_sysstatvfs
12216 eval $inhdr
12217
12218 : see if this is a sys/un.h system
12219 set sys/un.h i_sysun
12220 eval $inhdr
12221
12222 : see if this is a syswait system
12223 set sys/wait.h i_syswait
12224 eval $inhdr
12225
12226 : see if this is an utime system
12227 set utime.h i_utime
12228 eval $inhdr
12229
12230 : see if this is a values.h system
12231 set values.h i_values
12232 eval $inhdr
12233
12234 : see if this is a vfork system
12235 case "$d_vfork" in
12236 "$define")
12237         set vfork.h i_vfork
12238         eval $inhdr
12239         ;;
12240 *)
12241         i_vfork="$undef"
12242         ;;
12243 esac
12244
12245 : see if gdbm.h is available
12246 set gdbm.h t_gdbm
12247 eval $inhdr
12248 case "$t_gdbm" in
12249 $define)
12250         : see if gdbm_open exists
12251         set gdbm_open d_gdbm_open
12252         eval $inlibc
12253         case "$d_gdbm_open" in
12254         $undef)
12255                 t_gdbm="$undef"
12256                 echo "We won't be including <gdbm.h>"
12257                 ;;
12258         esac
12259         ;;
12260 esac
12261 val="$t_gdbm"
12262 set i_gdbm
12263 eval $setvar
12264
12265 echo " "
12266 echo "Looking for extensions..." >&4
12267 tdir=`pwd`
12268 cd $rsrc/ext
12269 : If we are using the old config.sh, known_extensions may contain
12270 : old or inaccurate or duplicate values.
12271 known_extensions=''
12272 nonxs_extensions=''
12273 : We do not use find because it might not be available.
12274 : We do not just use MANIFEST because the user may have dropped
12275 : some additional extensions into the source tree and expect them
12276 : to be built.
12277 for xxx in * ; do
12278         case "$xxx" in
12279         DynaLoader|dynaload) ;;
12280         *)      if $test -f $xxx/$xxx.xs; then
12281                         known_extensions="$known_extensions $xxx"
12282                 elif $test -f $xxx/Makefile.PL; then
12283                         nonxs_extensions="$nonxs_extensions $xxx"
12284                 else
12285                         if $test -d $xxx; then
12286                                 # Look for nested extensions, eg. Devel/Dprof.
12287                                 cd $xxx
12288                                 for yyy in * ; do
12289                                 if $test -f $yyy/$yyy.xs; then
12290                                         known_extensions="$known_extensions $xxx/$yyy"
12291                                 elif $test -f $yyy/Makefile.PL; then
12292                                         nonxs_extensions="$nonxs_extensions $xxx/$yyy"
12293                                 fi
12294                                 done
12295                                 cd ..
12296                         fi
12297                 fi 
12298                 ;;
12299         esac
12300 done
12301 set X $nonxs_extensions
12302 shift
12303 nonxs_extensions="$*"
12304 set X $known_extensions
12305 shift
12306 known_extensions="$*"
12307 cd $tdir
12308
12309 : Now see which are supported on this system.
12310 avail_ext=''
12311 for xxx in $known_extensions ; do
12312         case "$xxx" in
12313         DB_File|db_file)
12314                 case "$i_db" in
12315                 $define) avail_ext="$avail_ext $xxx" ;;
12316                 esac
12317                 ;;
12318         GDBM_File|gdbm_fil)
12319                 case "$i_gdbm" in 
12320                 $define) avail_ext="$avail_ext $xxx" ;;
12321                 esac
12322                 ;;
12323         NDBM_File|ndbm_fil)
12324                 case "$i_ndbm" in
12325                 $define) avail_ext="$avail_ext $xxx" ;;
12326                 esac
12327                 ;;
12328         ODBM_File|odbm_fil) 
12329                 case "${i_dbm}${i_rpcsvcdbm}" in
12330                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12331                 esac
12332                 ;;
12333         POSIX|posix)
12334                 case "$useposix" in
12335                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12336                 esac
12337                 ;;
12338         Opcode|opcode)
12339                 case "$useopcode" in
12340                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12341                 esac
12342                 ;;
12343         Socket|socket)
12344                 case "$d_socket" in 
12345                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12346                 esac
12347                 ;;
12348         Thread|thread)
12349                 case "$usethreads" in 
12350                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12351                 esac
12352                 ;;
12353         IPC/SysV|ipc/sysv)
12354                 : XXX Do we need a useipcsysv variable here
12355                 case "${d_msg}${d_sem}${d_shm}" in 
12356                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12357                 esac
12358                 ;;
12359         *)      avail_ext="$avail_ext $xxx"
12360                 ;;
12361         esac
12362 done
12363
12364 set X $avail_ext
12365 shift
12366 avail_ext="$*"
12367
12368 : Now see which nonxs extensions are supported on this system.
12369 : For now assume all are.
12370 nonxs_ext=''
12371 for xxx in $nonxs_extensions ; do
12372         case "$xxx" in
12373         *)      nonxs_ext="$nonxs_ext $xxx"
12374                 ;;
12375         esac
12376 done
12377
12378 set X $nonxs_ext
12379 shift
12380 nonxs_ext="$*"
12381
12382 case $usedl in
12383 $define)
12384         $cat <<EOM
12385 A number of extensions are supplied with $package.  You may choose to
12386 compile these extensions for dynamic loading (the default), compile
12387 them into the $package executable (static loading), or not include
12388 them at all.  Answer "none" to include no extensions.
12389 Note that DynaLoader is always built and need not be mentioned here.
12390
12391 EOM
12392         case "$dynamic_ext" in
12393         '') dflt="$avail_ext" ;;
12394         *)      dflt="$dynamic_ext"
12395                 # Perhaps we are reusing an old out-of-date config.sh.
12396                 case "$hint" in
12397                 previous)
12398                         if test X"$dynamic_ext" != X"$avail_ext"; then
12399                                 $cat <<EOM
12400 NOTICE:  Your previous config.sh list may be incorrect. 
12401 The extensions now available to you are 
12402         ${avail_ext}
12403 but the default list from your previous config.sh is
12404         ${dynamic_ext} 
12405
12406 EOM
12407                         fi
12408                         ;;
12409                 esac
12410                 ;;
12411         esac
12412         case "$dflt" in
12413         '')     dflt=none;;
12414         esac
12415         rp="What extensions do you wish to load dynamically?"
12416         . ./myread
12417         case "$ans" in
12418         none) dynamic_ext=' ' ;;
12419         *) dynamic_ext="$ans" ;;
12420         esac
12421
12422         case "$static_ext" in
12423         '')
12424                 : Exclude those already listed in dynamic linking
12425                 dflt=''
12426                 for xxx in $avail_ext; do
12427                         case " $dynamic_ext " in
12428                         *" $xxx "*) ;;
12429                         *) dflt="$dflt $xxx" ;;
12430                         esac
12431                 done
12432                 set X $dflt
12433                 shift
12434                 dflt="$*"
12435                 ;;
12436         *)  dflt="$static_ext" 
12437                 ;;
12438         esac
12439
12440         case "$dflt" in
12441         '')     dflt=none;;
12442         esac
12443         rp="What extensions do you wish to load statically?"
12444         . ./myread
12445         case "$ans" in
12446         none) static_ext=' ' ;;
12447         *) static_ext="$ans" ;;
12448         esac
12449         ;;
12450 *)
12451         $cat <<EOM
12452 A number of extensions are supplied with $package.  Answer "none" 
12453 to include no extensions. 
12454 Note that DynaLoader is always built and need not be mentioned here.
12455
12456 EOM
12457         case "$static_ext" in
12458         '') dflt="$avail_ext" ;;
12459         *)      dflt="$static_ext"
12460                 # Perhaps we are reusing an old out-of-date config.sh.
12461                 case "$hint" in
12462                 previous)
12463                         if test X"$static_ext" != X"$avail_ext"; then
12464                                 $cat <<EOM
12465 NOTICE:  Your previous config.sh list may be incorrect. 
12466 The extensions now available to you are 
12467         ${avail_ext}
12468 but the default list from your previous config.sh is
12469         ${static_ext} 
12470
12471 EOM
12472                         fi
12473                         ;;
12474                 esac
12475                 ;;
12476         esac
12477         : Exclude those that are not xs extensions
12478         case "$dflt" in
12479         '')     dflt=none;;
12480         esac
12481         rp="What extensions do you wish to include?"
12482         . ./myread
12483         case "$ans" in
12484         none) static_ext=' ' ;;
12485         *) static_ext="$ans" ;;
12486         esac
12487         ;;
12488 esac
12489
12490 set X $dynamic_ext $static_ext $nonxs_ext
12491 shift
12492 extensions="$*"
12493
12494 : Remove build directory name from cppstdin so it can be used from
12495 : either the present location or the final installed location.
12496 echo " "
12497 : Get out of the UU directory to get correct path name.
12498 cd ..
12499 case "$cppstdin" in
12500 `pwd`/cppstdin)
12501         echo "Stripping down cppstdin path name"
12502         cppstdin=cppstdin
12503         ;;
12504 esac
12505 cd UU
12506
12507 : end of configuration questions
12508 echo " "
12509 echo "End of configuration questions."
12510 echo " "
12511
12512 : back to where it started
12513 if test -d ../UU; then
12514         cd ..
12515 fi
12516
12517 : configuration may be patched via a 'config.over' file
12518 if $test -f config.over; then
12519         echo " "
12520         dflt=y
12521         rp='I see a config.over file.  Do you wish to load it?'
12522         . UU/myread
12523         case "$ans" in
12524         n*) echo "OK, I'll ignore it.";;
12525         *)      . ./config.over
12526                 echo "Configuration override changes have been loaded."
12527                 ;;
12528         esac
12529 fi
12530
12531 : in case they want portability, strip down executable paths
12532 case "$d_portable" in
12533 "$define")
12534         echo " "
12535         echo "Stripping down executable paths..." >&4
12536         for file in $loclist $trylist; do
12537                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12538                         eval $file="\$file"
12539                 fi
12540         done
12541         ;;
12542 esac
12543
12544 : create config.sh file
12545 echo " "
12546 echo "Creating config.sh..." >&4
12547 $spitshell <<EOT >config.sh
12548 $startsh
12549 #
12550 # This file was produced by running the Configure script. It holds all the
12551 # definitions figured out by Configure. Should you modify one of these values,
12552 # do not forget to propagate your changes by running "Configure -der". You may
12553 # instead choose to run each of the .SH files by yourself, or "Configure -S".
12554 #
12555
12556 # Package name      : $package
12557 # Source directory  : $src
12558 # Configuration time: $cf_time
12559 # Configured by     : $cf_by
12560 # Target system     : $myuname
12561
12562 Author='$Author'
12563 Date='$Date'
12564 Header='$Header'
12565 Id='$Id'
12566 Locker='$Locker'
12567 Log='$Log'
12568 Mcc='$Mcc'
12569 RCSfile='$RCSfile'
12570 Revision='$Revision'
12571 Source='$Source'
12572 State='$State'
12573 _a='$_a'
12574 _exe='$_exe'
12575 _o='$_o'
12576 afs='$afs'
12577 alignbytes='$alignbytes'
12578 ansi2knr='$ansi2knr'
12579 aphostname='$aphostname'
12580 apiversion='$apiversion'
12581 ar='$ar'
12582 archlib='$archlib'
12583 archlibexp='$archlibexp'
12584 archname64='$archname64'
12585 archname='$archname'
12586 archobjs='$archobjs'
12587 awk='$awk'
12588 baserev='$baserev'
12589 bash='$bash'
12590 bin='$bin'
12591 binexp='$binexp'
12592 bison='$bison'
12593 byacc='$byacc'
12594 byteorder='$byteorder'
12595 c='$c'
12596 castflags='$castflags'
12597 cat='$cat'
12598 cc='$cc'
12599 cccdlflags='$cccdlflags'
12600 ccdlflags='$ccdlflags'
12601 ccflags='$ccflags'
12602 ccsymbols='$ccsymbols'
12603 cf_by='$cf_by'
12604 cf_email='$cf_email'
12605 cf_time='$cf_time'
12606 chgrp='$chgrp'
12607 chmod='$chmod'
12608 chown='$chown'
12609 clocktype='$clocktype'
12610 comm='$comm'
12611 compress='$compress'
12612 contains='$contains'
12613 cp='$cp'
12614 cpio='$cpio'
12615 cpp='$cpp'
12616 cpp_stuff='$cpp_stuff'
12617 cppccsymbols='$cppccsymbols'
12618 cppflags='$cppflags'
12619 cpplast='$cpplast'
12620 cppminus='$cppminus'
12621 cpprun='$cpprun'
12622 cppstdin='$cppstdin'
12623 cppsymbols='$cppsymbols'
12624 crosscompile='$crosscompile'
12625 cryptlib='$cryptlib'
12626 csh='$csh'
12627 d_Gconvert='$d_Gconvert'
12628 d_access='$d_access'
12629 d_accessx='$d_accessx'
12630 d_alarm='$d_alarm'
12631 d_archlib='$d_archlib'
12632 d_attribut='$d_attribut'
12633 d_bcmp='$d_bcmp'
12634 d_bcopy='$d_bcopy'
12635 d_bsd='$d_bsd'
12636 d_bsdgetpgrp='$d_bsdgetpgrp'
12637 d_bsdsetpgrp='$d_bsdsetpgrp'
12638 d_bzero='$d_bzero'
12639 d_casti32='$d_casti32'
12640 d_castneg='$d_castneg'
12641 d_charvspr='$d_charvspr'
12642 d_chown='$d_chown'
12643 d_chroot='$d_chroot'
12644 d_chsize='$d_chsize'
12645 d_closedir='$d_closedir'
12646 d_cmsghdr_s='$d_cmsghdr_s'
12647 d_const='$d_const'
12648 d_crypt='$d_crypt'
12649 d_csh='$d_csh'
12650 d_cuserid='$d_cuserid'
12651 d_dbl_dig='$d_dbl_dig'
12652 d_dbmclose64='$d_dbmclose64'
12653 d_dbminit64='$d_dbminit64'
12654 d_delete64='$d_delete64'
12655 d_difftime='$d_difftime'
12656 d_dirent64_s='$d_dirent64_s'
12657 d_dirnamlen='$d_dirnamlen'
12658 d_dlerror='$d_dlerror'
12659 d_dlopen='$d_dlopen'
12660 d_dlsymun='$d_dlsymun'
12661 d_dosuid='$d_dosuid'
12662 d_drand48proto='$d_drand48proto'
12663 d_dup2='$d_dup2'
12664 d_eaccess='$d_eaccess'
12665 d_endgrent='$d_endgrent'
12666 d_endhent='$d_endhent'
12667 d_endnent='$d_endnent'
12668 d_endpent='$d_endpent'
12669 d_endpwent='$d_endpwent'
12670 d_endsent='$d_endsent'
12671 d_eofnblk='$d_eofnblk'
12672 d_eunice='$d_eunice'
12673 d_fchmod='$d_fchmod'
12674 d_fchown='$d_fchown'
12675 d_fcntl='$d_fcntl'
12676 d_fd_macros='$d_fd_macros'
12677 d_fd_set='$d_fd_set'
12678 d_fds_bits='$d_fds_bits'
12679 d_fetch64='$d_fetch64'
12680 d_fgetpos64='$d_fgetpos64'
12681 d_fgetpos='$d_fgetpos'
12682 d_firstkey64='$d_firstkey64'
12683 d_flexfnam='$d_flexfnam'
12684 d_flock64_s='$d_flock64_s'
12685 d_flock='$d_flock'
12686 d_fopen64='$d_fopen64'
12687 d_fork='$d_fork'
12688 d_fpathconf='$d_fpathconf'
12689 d_freopen64='$d_freopen64'
12690 d_fseek64='$d_fseek64'
12691 d_fseeko64='$d_fseeko64'
12692 d_fseeko='$d_fseeko'
12693 d_fsetpos64='$d_fsetpos64'
12694 d_fsetpos='$d_fsetpos'
12695 d_fstat64='$d_fstat64'
12696 d_fstatfs='$d_fstatfs'
12697 d_fstatvfs='$d_fstatvfs'
12698 d_ftell64='$d_ftell64'
12699 d_ftello64='$d_ftello64'
12700 d_ftello='$d_ftello'
12701 d_ftime='$d_ftime'
12702 d_ftruncate64='$d_ftruncate64'
12703 d_getgrent='$d_getgrent'
12704 d_getgrps='$d_getgrps'
12705 d_gethbyaddr='$d_gethbyaddr'
12706 d_gethbyname='$d_gethbyname'
12707 d_gethent='$d_gethent'
12708 d_gethname='$d_gethname'
12709 d_gethostprotos='$d_gethostprotos'
12710 d_getlogin='$d_getlogin'
12711 d_getmntent='$d_getmntent'
12712 d_getnbyaddr='$d_getnbyaddr'
12713 d_getnbyname='$d_getnbyname'
12714 d_getnent='$d_getnent'
12715 d_getnetprotos='$d_getnetprotos'
12716 d_getpbyname='$d_getpbyname'
12717 d_getpbynumber='$d_getpbynumber'
12718 d_getpent='$d_getpent'
12719 d_getpgid='$d_getpgid'
12720 d_getpgrp2='$d_getpgrp2'
12721 d_getpgrp='$d_getpgrp'
12722 d_getppid='$d_getppid'
12723 d_getprior='$d_getprior'
12724 d_getprotoprotos='$d_getprotoprotos'
12725 d_getpwent='$d_getpwent'
12726 d_getsbyname='$d_getsbyname'
12727 d_getsbyport='$d_getsbyport'
12728 d_getsent='$d_getsent'
12729 d_getservprotos='$d_getservprotos'
12730 d_gettimeod='$d_gettimeod'
12731 d_gnulibc='$d_gnulibc'
12732 d_grpasswd='$d_grpasswd'
12733 d_hasmntopt='$d_hasmntopt'
12734 d_htonl='$d_htonl'
12735 d_index='$d_index'
12736 d_inetaton='$d_inetaton'
12737 d_ino64t='$d_ino64t'
12738 d_int64t='$d_int64t'
12739 d_iovec_s='$d_iovec_s'
12740 d_isascii='$d_isascii'
12741 d_killpg='$d_killpg'
12742 d_lchown='$d_lchown'
12743 d_link='$d_link'
12744 d_locconv='$d_locconv'
12745 d_lockf64='$d_lockf64'
12746 d_lockf='$d_lockf'
12747 d_longdbl='$d_longdbl'
12748 d_longlong='$d_longlong'
12749 d_lseek64='$d_lseek64'
12750 d_lstat64='$d_lstat64'
12751 d_lstat='$d_lstat'
12752 d_madvise='$d_madvise'
12753 d_mblen='$d_mblen'
12754 d_mbstowcs='$d_mbstowcs'
12755 d_mbtowc='$d_mbtowc'
12756 d_memcmp='$d_memcmp'
12757 d_memcpy='$d_memcpy'
12758 d_memmove='$d_memmove'
12759 d_memset='$d_memset'
12760 d_mkdir='$d_mkdir'
12761 d_mkfifo='$d_mkfifo'
12762 d_mktime='$d_mktime'
12763 d_mmap='$d_mmap'
12764 d_mprotect='$d_mprotect'
12765 d_msg='$d_msg'
12766 d_msg_ctrunc='$d_msg_ctrunc'
12767 d_msg_dontroute='$d_msg_dontroute'
12768 d_msg_oob='$d_msg_oob'
12769 d_msg_peek='$d_msg_peek'
12770 d_msg_proxy='$d_msg_proxy'
12771 d_msgctl='$d_msgctl'
12772 d_msgget='$d_msgget'
12773 d_msghdr_s='$d_msghdr_s'
12774 d_msgrcv='$d_msgrcv'
12775 d_msgsnd='$d_msgsnd'
12776 d_msync='$d_msync'
12777 d_munmap='$d_munmap'
12778 d_mymalloc='$d_mymalloc'
12779 d_nextkey64='$d_nextkey64'
12780 d_nice='$d_nice'
12781 d_off64t='$d_off64t'
12782 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
12783 d_oldpthreads='$d_oldpthreads'
12784 d_oldsock='$d_oldsock'
12785 d_open3='$d_open3'
12786 d_open64='$d_open64'
12787 d_opendir64='$d_opendir64'
12788 d_pathconf='$d_pathconf'
12789 d_pause='$d_pause'
12790 d_phostname='$d_phostname'
12791 d_pipe='$d_pipe'
12792 d_poll='$d_poll'
12793 d_portable='$d_portable'
12794 d_pthread_yield='$d_pthread_yield'
12795 d_pwage='$d_pwage'
12796 d_pwchange='$d_pwchange'
12797 d_pwclass='$d_pwclass'
12798 d_pwcomment='$d_pwcomment'
12799 d_pwexpire='$d_pwexpire'
12800 d_pwgecos='$d_pwgecos'
12801 d_pwpasswd='$d_pwpasswd'
12802 d_pwquota='$d_pwquota'
12803 d_readdir64='$d_readdir64'
12804 d_readdir='$d_readdir'
12805 d_readlink='$d_readlink'
12806 d_readv='$d_readv'
12807 d_recvmsg='$d_recvmsg'
12808 d_rename='$d_rename'
12809 d_rewinddir='$d_rewinddir'
12810 d_rmdir='$d_rmdir'
12811 d_safebcpy='$d_safebcpy'
12812 d_safemcpy='$d_safemcpy'
12813 d_sanemcmp='$d_sanemcmp'
12814 d_sched_yield='$d_sched_yield'
12815 d_scm_rights='$d_scm_rights'
12816 d_seekdir64='$d_seekdir64'
12817 d_seekdir='$d_seekdir'
12818 d_select='$d_select'
12819 d_sem='$d_sem'
12820 d_semctl='$d_semctl'
12821 d_semctl_semid_ds='$d_semctl_semid_ds'
12822 d_semctl_semun='$d_semctl_semun'
12823 d_semget='$d_semget'
12824 d_semop='$d_semop'
12825 d_sendmsg='$d_sendmsg'
12826 d_setegid='$d_setegid'
12827 d_seteuid='$d_seteuid'
12828 d_setgrent='$d_setgrent'
12829 d_setgrps='$d_setgrps'
12830 d_sethent='$d_sethent'
12831 d_setlinebuf='$d_setlinebuf'
12832 d_setlocale='$d_setlocale'
12833 d_setnent='$d_setnent'
12834 d_setpent='$d_setpent'
12835 d_setpgid='$d_setpgid'
12836 d_setpgrp2='$d_setpgrp2'
12837 d_setpgrp='$d_setpgrp'
12838 d_setprior='$d_setprior'
12839 d_setpwent='$d_setpwent'
12840 d_setregid='$d_setregid'
12841 d_setresgid='$d_setresgid'
12842 d_setresuid='$d_setresuid'
12843 d_setreuid='$d_setreuid'
12844 d_setrgid='$d_setrgid'
12845 d_setruid='$d_setruid'
12846 d_setsent='$d_setsent'
12847 d_setsid='$d_setsid'
12848 d_setvbuf='$d_setvbuf'
12849 d_sfio='$d_sfio'
12850 d_shm='$d_shm'
12851 d_shmat='$d_shmat'
12852 d_shmatprototype='$d_shmatprototype'
12853 d_shmctl='$d_shmctl'
12854 d_shmdt='$d_shmdt'
12855 d_shmget='$d_shmget'
12856 d_sigaction='$d_sigaction'
12857 d_sigsetjmp='$d_sigsetjmp'
12858 d_socket='$d_socket'
12859 d_sockpair='$d_sockpair'
12860 d_stat64='$d_stat64'
12861 d_statblks='$d_statblks'
12862 d_statfs='$d_statfs'
12863 d_statfsflags='$d_statfsflags'
12864 d_statvfs='$d_statvfs'
12865 d_stdio_cnt_lval='$d_stdio_cnt_lval'
12866 d_stdio_ptr_lval='$d_stdio_ptr_lval'
12867 d_stdiobase='$d_stdiobase'
12868 d_stdstdio='$d_stdstdio'
12869 d_store64='$d_store64'
12870 d_strchr='$d_strchr'
12871 d_strcoll='$d_strcoll'
12872 d_strctcpy='$d_strctcpy'
12873 d_strerrm='$d_strerrm'
12874 d_strerror='$d_strerror'
12875 d_strtod='$d_strtod'
12876 d_strtol='$d_strtol'
12877 d_strtoul='$d_strtoul'
12878 d_strxfrm='$d_strxfrm'
12879 d_suidsafe='$d_suidsafe'
12880 d_symlink='$d_symlink'
12881 d_syscall='$d_syscall'
12882 d_sysconf='$d_sysconf'
12883 d_sysernlst='$d_sysernlst'
12884 d_syserrlst='$d_syserrlst'
12885 d_system='$d_system'
12886 d_tcgetpgrp='$d_tcgetpgrp'
12887 d_tcsetpgrp='$d_tcsetpgrp'
12888 d_telldir64='$d_telldir64'
12889 d_telldir='$d_telldir'
12890 d_telldirproto='$d_telldirproto'
12891 d_time='$d_time'
12892 d_times='$d_times'
12893 d_tmpfile64='$d_tmpfile64'
12894 d_truncate64='$d_truncate64'
12895 d_truncate='$d_truncate'
12896 d_tzname='$d_tzname'
12897 d_umask='$d_umask'
12898 d_uname='$d_uname'
12899 d_union_semun='$d_union_semun'
12900 d_vfork='$d_vfork'
12901 d_void_closedir='$d_void_closedir'
12902 d_voidsig='$d_voidsig'
12903 d_voidtty='$d_voidtty'
12904 d_volatile='$d_volatile'
12905 d_vprintf='$d_vprintf'
12906 d_wait4='$d_wait4'
12907 d_waitpid='$d_waitpid'
12908 d_wcstombs='$d_wcstombs'
12909 d_wctomb='$d_wctomb'
12910 d_writev='$d_writev'
12911 d_xenix='$d_xenix'
12912 date='$date'
12913 db_hashtype='$db_hashtype'
12914 db_prefixtype='$db_prefixtype'
12915 defvoidused='$defvoidused'
12916 direntrytype='$direntrytype'
12917 dlext='$dlext'
12918 dlsrc='$dlsrc'
12919 doublesize='$doublesize'
12920 drand01='$drand01'
12921 dynamic_ext='$dynamic_ext'
12922 eagain='$eagain'
12923 ebcdic='$ebcdic'
12924 echo='$echo'
12925 egrep='$egrep'
12926 emacs='$emacs'
12927 eunicefix='$eunicefix'
12928 exe_ext='$exe_ext'
12929 expr='$expr'
12930 extensions='$extensions'
12931 find='$find'
12932 firstmakefile='$firstmakefile'
12933 flex='$flex'
12934 fpostype='$fpostype'
12935 freetype='$freetype'
12936 full_ar='$full_ar'
12937 full_csh='$full_csh'
12938 full_sed='$full_sed'
12939 gccversion='$gccversion'
12940 gidtype='$gidtype'
12941 glibpth='$glibpth'
12942 grep='$grep'
12943 groupcat='$groupcat'
12944 groupstype='$groupstype'
12945 gzip='$gzip'
12946 h_fcntl='$h_fcntl'
12947 h_sysfile='$h_sysfile'
12948 hint='$hint'
12949 hostcat='$hostcat'
12950 huge='$huge'
12951 i_arpainet='$i_arpainet'
12952 i_bsdioctl='$i_bsdioctl'
12953 i_db='$i_db'
12954 i_dbm='$i_dbm'
12955 i_dirent='$i_dirent'
12956 i_dld='$i_dld'
12957 i_dlfcn='$i_dlfcn'
12958 i_fcntl='$i_fcntl'
12959 i_float='$i_float'
12960 i_gdbm='$i_gdbm'
12961 i_grp='$i_grp'
12962 i_inttypes='$i_inttypes'
12963 i_limits='$i_limits'
12964 i_locale='$i_locale'
12965 i_machcthr='$i_machcthr'
12966 i_malloc='$i_malloc'
12967 i_math='$i_math'
12968 i_memory='$i_memory'
12969 i_mntent='$i_mntent'
12970 i_ndbm='$i_ndbm'
12971 i_netdb='$i_netdb'
12972 i_neterrno='$i_neterrno'
12973 i_niin='$i_niin'
12974 i_poll='$i_poll'
12975 i_pwd='$i_pwd'
12976 i_rpcsvcdbm='$i_rpcsvcdbm'
12977 i_sfio='$i_sfio'
12978 i_sgtty='$i_sgtty'
12979 i_stdarg='$i_stdarg'
12980 i_stddef='$i_stddef'
12981 i_stdlib='$i_stdlib'
12982 i_string='$i_string'
12983 i_sysaccess='$i_sysaccess'
12984 i_sysdir='$i_sysdir'
12985 i_sysfile='$i_sysfile'
12986 i_sysfilio='$i_sysfilio'
12987 i_sysin='$i_sysin'
12988 i_sysioctl='$i_sysioctl'
12989 i_sysmman='$i_sysmman'
12990 i_sysmount='$i_sysmount'
12991 i_sysndir='$i_sysndir'
12992 i_sysparam='$i_sysparam'
12993 i_sysresrc='$i_sysresrc'
12994 i_syssecrt='$i_syssecrt'
12995 i_sysselct='$i_sysselct'
12996 i_syssockio='$i_syssockio'
12997 i_sysstat='$i_sysstat'
12998 i_sysstatvfs='$i_sysstatvfs'
12999 i_systime='$i_systime'
13000 i_systimek='$i_systimek'
13001 i_systimes='$i_systimes'
13002 i_systypes='$i_systypes'
13003 i_sysuio='$i_sysuio'
13004 i_sysun='$i_sysun'
13005 i_syswait='$i_syswait'
13006 i_termio='$i_termio'
13007 i_termios='$i_termios'
13008 i_time='$i_time'
13009 i_unistd='$i_unistd'
13010 i_utime='$i_utime'
13011 i_values='$i_values'
13012 i_varargs='$i_varargs'
13013 i_varhdr='$i_varhdr'
13014 i_vfork='$i_vfork'
13015 ignore_versioned_solibs='$ignore_versioned_solibs'
13016 incpath='$incpath'
13017 inews='$inews'
13018 installarchlib='$installarchlib'
13019 installbin='$installbin'
13020 installman1dir='$installman1dir'
13021 installman3dir='$installman3dir'
13022 installprivlib='$installprivlib'
13023 installscript='$installscript'
13024 installsitearch='$installsitearch'
13025 installsitelib='$installsitelib'
13026 installusrbinperl='$installusrbinperl'
13027 intsize='$intsize'
13028 known_extensions='$known_extensions'
13029 ksh='$ksh'
13030 large='$large'
13031 ld='$ld'
13032 lddlflags='$lddlflags'
13033 ldflags='$ldflags'
13034 less='$less'
13035 lib_ext='$lib_ext'
13036 libc='$libc'
13037 libperl='$libperl'
13038 libpth='$libpth'
13039 libs='$libs'
13040 libswanted='$libswanted'
13041 line='$line'
13042 lint='$lint'
13043 lkflags='$lkflags'
13044 ln='$ln'
13045 lns='$lns'
13046 locincpth='$locincpth'
13047 loclibpth='$loclibpth'
13048 longdblsize='$longdblsize'
13049 longlongsize='$longlongsize'
13050 longsize='$longsize'
13051 lp='$lp'
13052 lpr='$lpr'
13053 ls='$ls'
13054 lseeksize='$lseeksize'
13055 lseektype='$lseektype'
13056 mail='$mail'
13057 mailx='$mailx'
13058 make='$make'
13059 make_set_make='$make_set_make'
13060 mallocobj='$mallocobj'
13061 mallocsrc='$mallocsrc'
13062 malloctype='$malloctype'
13063 man1dir='$man1dir'
13064 man1direxp='$man1direxp'
13065 man1ext='$man1ext'
13066 man3dir='$man3dir'
13067 man3direxp='$man3direxp'
13068 man3ext='$man3ext'
13069 medium='$medium'
13070 mips='$mips'
13071 mips_type='$mips_type'
13072 mkdir='$mkdir'
13073 mmaptype='$mmaptype'
13074 models='$models'
13075 modetype='$modetype'
13076 more='$more'
13077 multiarch='$multiarch'
13078 mv='$mv'
13079 myarchname='$myarchname'
13080 mydomain='$mydomain'
13081 myhostname='$myhostname'
13082 myuname='$myuname'
13083 n='$n'
13084 netdb_hlen_type='$netdb_hlen_type'
13085 netdb_host_type='$netdb_host_type'
13086 netdb_name_type='$netdb_name_type'
13087 netdb_net_type='$netdb_net_type'
13088 nm='$nm'
13089 nm_opt='$nm_opt'
13090 nm_so_opt='$nm_so_opt'
13091 nonxs_ext='$nonxs_ext'
13092 nroff='$nroff'
13093 o_nonblock='$o_nonblock'
13094 obj_ext='$obj_ext'
13095 old_pthread_create_joinable='$old_pthread_create_joinable'
13096 optimize='$optimize'
13097 orderlib='$orderlib'
13098 osname='$osname'
13099 osvers='$osvers'
13100 package='$package'
13101 pager='$pager'
13102 passcat='$passcat'
13103 patchlevel='$patchlevel'
13104 path_sep='$path_sep'
13105 perl='$perl'
13106 perladmin='$perladmin'
13107 perlpath='$perlpath'
13108 pg='$pg'
13109 phostname='$phostname'
13110 pidtype='$pidtype'
13111 plibpth='$plibpth'
13112 pmake='$pmake'
13113 pr='$pr'
13114 prefix='$prefix'
13115 prefixexp='$prefixexp'
13116 privlib='$privlib'
13117 privlibexp='$privlibexp'
13118 prototype='$prototype'
13119 ptrsize='$ptrsize'
13120 randbits='$randbits'
13121 randfunc='$randfunc'
13122 randseedtype='$randseedtype'
13123 ranlib='$ranlib'
13124 rd_nodata='$rd_nodata'
13125 rm='$rm'
13126 rmail='$rmail'
13127 runnm='$runnm'
13128 sched_yield='$sched_yield'
13129 scriptdir='$scriptdir'
13130 scriptdirexp='$scriptdirexp'
13131 sed='$sed'
13132 seedfunc='$seedfunc'
13133 selectminbits='$selectminbits'
13134 selecttype='$selecttype'
13135 sendmail='$sendmail'
13136 sh='$sh'
13137 shar='$shar'
13138 sharpbang='$sharpbang'
13139 shmattype='$shmattype'
13140 shortsize='$shortsize'
13141 shrpenv='$shrpenv'
13142 shsharp='$shsharp'
13143 sig_name='$sig_name'
13144 sig_name_init='$sig_name_init'
13145 sig_num='$sig_num'
13146 sig_num_init='$sig_num_init'
13147 signal_t='$signal_t'
13148 sitearch='$sitearch'
13149 sitearchexp='$sitearchexp'
13150 sitelib='$sitelib'
13151 sitelibexp='$sitelibexp'
13152 sizetype='$sizetype'
13153 sleep='$sleep'
13154 smail='$smail'
13155 small='$small'
13156 so='$so'
13157 sockethdr='$sockethdr'
13158 socketlib='$socketlib'
13159 sort='$sort'
13160 spackage='$spackage'
13161 spitshell='$spitshell'
13162 split='$split'
13163 src='$src'
13164 ssizetype='$ssizetype'
13165 startperl='$startperl'
13166 startsh='$startsh'
13167 static_ext='$static_ext'
13168 stdchar='$stdchar'
13169 stdio_base='$stdio_base'
13170 stdio_bufsiz='$stdio_bufsiz'
13171 stdio_cnt='$stdio_cnt'
13172 stdio_filbuf='$stdio_filbuf'
13173 stdio_ptr='$stdio_ptr'
13174 strings='$strings'
13175 submit='$submit'
13176 subversion='$subversion'
13177 sysman='$sysman'
13178 tail='$tail'
13179 tar='$tar'
13180 tbl='$tbl'
13181 tee='$tee'
13182 test='$test'
13183 timeincl='$timeincl'
13184 timetype='$timetype'
13185 touch='$touch'
13186 tr='$tr'
13187 trnl='$trnl'
13188 troff='$troff'
13189 uidtype='$uidtype'
13190 uname='$uname'
13191 uniq='$uniq'
13192 use64bits='$use64bits'
13193 usedl='$usedl'
13194 usemultiplicity='$usemultiplicity'
13195 usemymalloc='$usemymalloc'
13196 usenm='$usenm'
13197 useopcode='$useopcode'
13198 useperlio='$useperlio'
13199 useposix='$useposix'
13200 usesfio='$usesfio'
13201 useshrplib='$useshrplib'
13202 usethreads='$usethreads'
13203 usevfork='$usevfork'
13204 usrinc='$usrinc'
13205 uuname='$uuname'
13206 version='$version'
13207 vi='$vi'
13208 voidflags='$voidflags'
13209 xlibpth='$xlibpth'
13210 zcat='$zcat'
13211 zip='$zip'
13212 EOT
13213
13214 : Add in command line options if available
13215 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13216
13217 : add special variables
13218 $test -f $src/patchlevel.h && \
13219 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13220 echo "CONFIG=true" >>config.sh
13221
13222 : propagate old symbols
13223 if $test -f UU/config.sh; then
13224         <UU/config.sh sort | uniq >UU/oldconfig.sh
13225         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13226         sort | uniq -u >UU/oldsyms
13227         set X `cat UU/oldsyms`
13228         shift
13229         case $# in
13230         0) ;;
13231         *)
13232                 cat <<EOM
13233 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13234 EOM
13235                 echo "# Variables propagated from previous config.sh file." >>config.sh
13236                 for sym in `cat UU/oldsyms`; do
13237                         echo "    Propagating $hint variable "'$'"$sym..."
13238                         eval 'tmp="$'"${sym}"'"'
13239                         echo "$tmp" | \
13240                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13241                 done
13242                 ;;
13243         esac
13244 fi
13245
13246 : Finish up by extracting the .SH files
13247 case "$alldone" in
13248 exit)
13249         $rm -rf UU
13250         echo "Done."
13251         exit 0
13252         ;;
13253 cont)
13254         ;;
13255 '')
13256         dflt=''
13257         nostick=true
13258         $cat <<EOM
13259
13260 If you'd like to make any changes to the config.sh file before I begin
13261 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13262
13263 EOM
13264         rp="Press return or use a shell escape to edit config.sh:"
13265         . UU/myread
13266         nostick=''
13267         case "$ans" in
13268         '') ;;
13269         *) : in case they cannot read
13270                 sh 1>&4 -c "$ans";;
13271         esac
13272         ;;
13273 esac
13274
13275 : if this fails, just run all the .SH files by hand
13276 . ./config.sh
13277
13278 echo " "
13279 exec 1>&4
13280 . ./UU/extract
13281
13282 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13283         dflt=y
13284         case "$silent" in
13285         true) ;;
13286         *)
13287                 $cat <<EOM
13288
13289 Now you need to generate make dependencies by running "$make depend".
13290 You might prefer to run it in background: "$make depend > makedepend.out &"
13291 It can take a while, so you might not want to run it right now.
13292
13293 EOM
13294                 ;;
13295         esac
13296         rp="Run $make depend now?"
13297         . UU/myread
13298         case "$ans" in
13299         y*)
13300                 $make depend && echo "Now you must run a $make."
13301                 ;;
13302         *)
13303                 echo "You must run '$make depend' then '$make'."
13304                 ;;
13305         esac
13306 elif test -f [Mm]akefile; then
13307         echo " "
13308         echo "Now you must run a $make."
13309 else
13310         echo "Done."
13311 fi
13312
13313 if $test -f Policy.sh; then
13314     $cat <<EOM
13315
13316 If you compile $package on a different machine or from a different object
13317 directory, copy the Policy.sh file from this object directory to the
13318 new one before you run Configure -- this will help you with most of
13319 the policy defaults.
13320
13321 EOM
13322 fi
13323 if $test -f config.msg; then
13324     echo "Hmm.  I also noted the following information while running:"
13325     echo " "
13326     $cat config.msg >&4
13327     $rm -f config.msg
13328 fi
13329 $rm -f kit*isdone ark*isdone
13330 $rm -rf UU
13331
13332 : End of Configure
13333