Add NV_PRESERVES_UV.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Jan 19 19:38:29 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtold=''
533 d_strtoll=''
534 d_strtoul=''
535 d_strtoull=''
536 d_strtouq=''
537 d_strxfrm=''
538 d_symlink=''
539 d_syscall=''
540 d_sysconf=''
541 d_system=''
542 d_tcgetpgrp=''
543 d_tcsetpgrp=''
544 d_telldirproto=''
545 d_time=''
546 timetype=''
547 clocktype=''
548 d_times=''
549 d_truncate=''
550 d_tzname=''
551 d_umask=''
552 d_semctl_semid_ds=''
553 d_semctl_semun=''
554 d_union_semun=''
555 d_ustat=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 dlext=''
568 cccdlflags=''
569 ccdlflags=''
570 dlsrc=''
571 ld=''
572 lddlflags=''
573 usedl=''
574 doublesize=''
575 ebcdic=''
576 fflushNULL=''
577 fflushall=''
578 fpossize=''
579 fpostype=''
580 gidformat=''
581 gidsign=''
582 gidsize=''
583 gidtype=''
584 groupstype=''
585 h_fcntl=''
586 h_sysfile=''
587 i_arpainet=''
588 db_hashtype=''
589 db_prefixtype=''
590 i_db=''
591 i_dbm=''
592 i_rpcsvcdbm=''
593 d_dirnamlen=''
594 direntrytype=''
595 i_dirent=''
596 i_dld=''
597 i_dlfcn=''
598 i_fcntl=''
599 i_float=''
600 i_gdbm=''
601 d_grpasswd=''
602 i_grp=''
603 i_inttypes=''
604 i_limits=''
605 i_locale=''
606 i_machcthr=''
607 i_malloc=''
608 i_math=''
609 i_memory=''
610 i_mntent=''
611 i_ndbm=''
612 i_netdb=''
613 i_neterrno=''
614 i_netinettcp=''
615 i_niin=''
616 i_sysin=''
617 i_poll=''
618 i_pthread=''
619 d_pwage=''
620 d_pwchange=''
621 d_pwclass=''
622 d_pwcomment=''
623 d_pwexpire=''
624 d_pwgecos=''
625 d_pwpasswd=''
626 d_pwquota=''
627 i_pwd=''
628 i_sfio=''
629 i_shadow=''
630 i_socks=''
631 i_stddef=''
632 i_stdlib=''
633 i_string=''
634 strings=''
635 i_sysaccess=''
636 i_sysdir=''
637 i_sysfile=''
638 d_voidtty=''
639 i_bsdioctl=''
640 i_sysfilio=''
641 i_sysioctl=''
642 i_syssockio=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatfs=''
651 i_sysstatvfs=''
652 i_systimes=''
653 i_systypes=''
654 i_sysuio=''
655 i_sysun=''
656 i_sysvfs=''
657 i_syswait=''
658 i_sgtty=''
659 i_termio=''
660 i_termios=''
661 i_systime=''
662 i_systimek=''
663 i_time=''
664 timeincl=''
665 i_unistd=''
666 i_ustat=''
667 i_utime=''
668 i_values=''
669 i_stdarg=''
670 i_varargs=''
671 i_varhdr=''
672 i_vfork=''
673 inc_version_list=''
674 installprefix=''
675 installprefixexp=''
676 installstyle=''
677 installusrbinperl=''
678 intsize=''
679 longsize=''
680 shortsize=''
681 d_fpos64_t=''
682 d_off64_t=''
683 libc=''
684 ldlibpthname=''
685 libperl=''
686 shrpenv=''
687 useshrplib=''
688 glibpth=''
689 libpth=''
690 loclibpth=''
691 plibpth=''
692 xlibpth=''
693 ignore_versioned_solibs=''
694 libs=''
695 lns=''
696 d_PRIEldbl=''
697 d_PRIFldbl=''
698 d_PRIGldbl=''
699 d_PRIeldbl=''
700 d_PRIfldbl=''
701 d_PRIgldbl=''
702 sPRIEldbl=''
703 sPRIFldbl=''
704 sPRIGldbl=''
705 sPRIeldbl=''
706 sPRIfldbl=''
707 sPRIgldbl=''
708 lseeksize=''
709 lseektype=''
710 make_set_make=''
711 d_mymalloc=''
712 freetype=''
713 mallocobj=''
714 mallocsrc=''
715 malloctype=''
716 usemymalloc=''
717 installman1dir=''
718 man1dir=''
719 man1direxp=''
720 man1ext=''
721 installman3dir=''
722 man3dir=''
723 man3direxp=''
724 man3ext=''
725 huge=''
726 large=''
727 medium=''
728 models=''
729 small=''
730 split=''
731 modetype=''
732 multiarch=''
733 mydomain=''
734 myhostname=''
735 phostname=''
736 c=''
737 n=''
738 d_eofnblk=''
739 eagain=''
740 o_nonblock=''
741 rd_nodata=''
742 netdb_hlen_type=''
743 netdb_host_type=''
744 netdb_name_type=''
745 netdb_net_type=''
746 groupcat=''
747 hostcat=''
748 passcat=''
749 orderlib=''
750 ranlib=''
751 package=''
752 spackage=''
753 pager=''
754 api_revision=''
755 api_subversion=''
756 api_version=''
757 api_versionstring=''
758 patchlevel=''
759 subversion=''
760 version=''
761 perladmin=''
762 perlpath=''
763 d_nvpresuv=''
764 i16size=''
765 i16type=''
766 i32size=''
767 i32type=''
768 i64size=''
769 i64type=''
770 i8size=''
771 i8type=''
772 ivsize=''
773 ivtype=''
774 nvsize=''
775 nvtype=''
776 u16size=''
777 u16type=''
778 u32size=''
779 u32type=''
780 u64size=''
781 u64type=''
782 u8size=''
783 u8type=''
784 uvsize=''
785 uvtype=''
786 ivdformat=''
787 uvoformat=''
788 uvuformat=''
789 uvxformat=''
790 pidtype=''
791 prefix=''
792 prefixexp=''
793 installprivlib=''
794 privlib=''
795 privlibexp=''
796 prototype=''
797 ptrsize=''
798 d_PRIX64=''
799 d_PRId64=''
800 d_PRIi64=''
801 d_PRIo64=''
802 d_PRIu64=''
803 d_PRIx64=''
804 sPRIX64=''
805 sPRId64=''
806 sPRIi64=''
807 sPRIo64=''
808 sPRIu64=''
809 sPRIx64=''
810 d_quad=''
811 quadkind=''
812 quadtype=''
813 uquadtype=''
814 drand01=''
815 randbits=''
816 randfunc=''
817 randseedtype=''
818 seedfunc=''
819 installscript=''
820 scriptdir=''
821 scriptdirexp=''
822 selectminbits=''
823 selecttype=''
824 sh=''
825 sig_count=''
826 sig_name=''
827 sig_name_init=''
828 sig_num=''
829 sig_num_init=''
830 installsitearch=''
831 sitearch=''
832 sitearchexp=''
833 installsitebin=''
834 sitebin=''
835 sitebinexp=''
836 installsitelib=''
837 sitelib=''
838 sitelibexp=''
839 siteprefix=''
840 siteprefixexp=''
841 sizetype=''
842 so=''
843 sharpbang=''
844 shsharp=''
845 spitshell=''
846 src=''
847 ssizetype=''
848 startperl=''
849 startsh=''
850 stdchar=''
851 d_stdio_stream_array=''
852 stdio_stream_array=''
853 sysman=''
854 trnl=''
855 uidformat=''
856 uidsign=''
857 uidsize=''
858 uidtype=''
859 archname64=''
860 use64bits=''
861 uselargefiles=''
862 uselongdouble=''
863 uselonglong=''
864 usemorebits=''
865 usemultiplicity=''
866 nm_opt=''
867 nm_so_opt=''
868 runnm=''
869 usenm=''
870 useperlio=''
871 usesocks=''
872 d_oldpthreads=''
873 use5005threads=''
874 useithreads=''
875 usethreads=''
876 incpath=''
877 mips_type=''
878 usrinc=''
879 d_vendorbin=''
880 installvendorbin=''
881 vendorbin=''
882 vendorbinexp=''
883 d_vendorlib=''
884 installvendorlib=''
885 vendorlib=''
886 vendorlibexp=''
887 usevendorprefix=''
888 vendorprefix=''
889 vendorprefixexp=''
890 defvoidused=''
891 voidflags=''
892 CONFIG=''
893
894 define='define'
895 undef='undef'
896 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
897 rmlist=''
898
899 : We must find out about Eunice early
900 eunicefix=':'
901 if test -f /etc/unixtovms; then
902         eunicefix=/etc/unixtovms
903 fi
904 if test -f /etc/unixtovms.exe; then
905         eunicefix=/etc/unixtovms.exe
906 fi
907
908 i_whoami=''
909 : list of known cpp symbols, sorted alphabetically
910 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
911 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
912 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
913 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
914 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
915 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
916 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
917 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
918 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
919 al="$al VMS Xenix286"
920 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
921 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
922 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
923 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
924 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
925 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
926 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
927 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
928 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
929 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
930 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
931 al="$al __SVR4_2__ __UMAXV__"
932 al="$al ____386BSD____ __alpha __alpha__ __amiga"
933 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
934 al="$al __host_mips__"
935 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
936 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
937 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
938 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
939 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
940 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
941 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
942 al="$al __mc88100 __mc88100__ __mips __mips__"
943 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
944 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
945 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
946 al="$al _host_mips _mips _unix"
947 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
948 al="$al apollo ardent att386 att3b"
949 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
950 al="$al cadmus clipper concurrent convex cray ctix"
951 al="$al dmert encore gcos gcx gimpel gould"
952 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
953 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
954 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
955 al="$al i186 i286 i386 i486 i8086"
956 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
957 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
958 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
959 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
960 al="$al mc88000 mc88100 merlin mert mips mvs n16"
961 al="$al ncl_el ncl_mr"
962 al="$al news1500 news1700 news1800 news1900 news3700"
963 al="$al news700 news800 news900 ns16000 ns32000"
964 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
965 al="$al parisc pc532 pdp11 plexus posix pyr"
966 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
967 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
968 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
969 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
970 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
971 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
972 al="$al xenix z8000"
973
974 : set useposix=false in your hint file to disable the POSIX extension.
975 useposix=true
976 : set useopcode=false in your hint file to disable the Opcode extension.
977 useopcode=true
978 : Trailing extension.  Override this in a hint file, if needed.
979 _exe=''
980 : Extra object files, if any, needed on this platform.
981 archobjs=''
982 : Possible local include directories to search.
983 : Set locincpth to "" in a hint file to defeat local include searches.
984 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
985 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
986 :
987 : no include file wanted by default
988 inclwanted=''
989
990 groupstype=''
991 : change the next line if compiling for Xenix/286 on Xenix/386
992 xlibpth='/usr/lib/386 /lib/386'
993
994 : Possible local library directories to search.
995 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
996 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
997
998 : general looking path for locating libraries
999 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
1000 glibpth="$glibpth /lib /usr/lib $xlibpth"
1001 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
1002 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1003
1004 : Private path used by Configure to find libraries.  Its value
1005 : is prepended to libpth. This variable takes care of special
1006 : machines, like the mips.  Usually, it should be empty.
1007 plibpth=''
1008
1009 : default library list
1010 libswanted=''
1011 : some systems want to use only the non-versioned libso:s
1012 ignore_versioned_solibs=''
1013 : set usemultiplicity on the Configure command line to enable multiplicity.
1014 : set usesocks on the Configure command line to enable socks.
1015 : set usethreads on the Configure command line to enable threads.
1016 : full support for void wanted by default
1017 defvoidused=15
1018
1019 : List of libraries we want.
1020 : If anyone needs -lnet, put it in a hint file.
1021 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1022 libswanted="$libswanted dld ld sun m c cposix posix"
1023 libswanted="$libswanted ndir dir crypt sec"
1024 libswanted="$libswanted ucb bsd BSD PW x"
1025 : We probably want to search /usr/shlib before most other libraries.
1026 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1027 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1028 glibpth="/usr/shlib $glibpth"
1029 : Do not use vfork unless overridden by a hint file.
1030 usevfork=false
1031
1032 : Find the basic shell for Bourne shell scripts
1033 case "$sh" in
1034 '')
1035         case "$SYSTYPE" in
1036         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1037         *) xxx='/bin/sh';;
1038         esac
1039         if test -f "$xxx"; then
1040                 sh="$xxx"
1041         else
1042                 : Build up a list and do a single loop so we can 'break' out.
1043                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1044                 for xxx in sh bash ksh pdksh ash; do
1045                         for p in $pth; do
1046                                 try="$try ${p}/${xxx}"
1047                         done
1048                 done
1049                 for xxx in $try; do
1050                         if test -f "$xxx"; then
1051                                 sh="$xxx";
1052                                 break
1053                         elif test -f "$xxx.exe"; then
1054                                 sh="$xxx";
1055                                 break
1056                         fi
1057                 done
1058         fi
1059         ;;
1060 esac
1061
1062 case "$sh" in
1063 '')     cat <<EOM >&2
1064 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1065
1066 Usually it's in /bin/sh.  How did you even get this far?
1067 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1068 we'll try to straighten this all out.
1069 EOM
1070         exit 1
1071         ;;
1072 esac
1073
1074 : see if sh knows # comments
1075 if `$sh -c '#' >/dev/null 2>&1`; then
1076         shsharp=true
1077         spitshell=cat
1078         xcat=/bin/cat
1079         test -f $xcat || xcat=/usr/bin/cat
1080         echo "#!$xcat" >try
1081         $eunicefix try
1082         chmod +x try
1083         ./try > today
1084         if test -s today; then
1085                 sharpbang='#!'
1086         else
1087                 echo "#! $xcat" > try
1088                 $eunicefix try
1089                 chmod +x try
1090                 ./try > today
1091                 if test -s today; then
1092                         sharpbang='#! '
1093                 else
1094                         sharpbang=': use '
1095                 fi
1096         fi
1097 else
1098         echo " "
1099         echo "Your $sh doesn't grok # comments--I will strip them later on."
1100         shsharp=false
1101         cd ..
1102         echo "exec grep -v '^[  ]*#'" >spitshell
1103         chmod +x spitshell
1104         $eunicefix spitshell
1105         spitshell=`pwd`/spitshell
1106         cd UU
1107         echo "I presume that if # doesn't work, #! won't work either!"
1108         sharpbang=': use '
1109 fi
1110 rm -f try today
1111
1112 : figure out how to guarantee sh startup
1113 case "$startsh" in
1114 '') startsh=${sharpbang}${sh} ;;
1115 *)
1116 esac
1117 cat >try <<EOSS
1118 $startsh
1119 set abc
1120 test "$?abc" != 1
1121 EOSS
1122
1123 chmod +x try
1124 $eunicefix try
1125 if ./try; then
1126         : echo "Yup, it does."
1127 else
1128         echo "Hmm... '$startsh' does not guarantee sh startup..."
1129         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1130 fi
1131 rm -f try
1132
1133
1134 : Save command line options in file UU/cmdline.opt for later use in
1135 : generating config.sh.
1136 cat > cmdline.opt <<EOSH
1137 # Configure command line arguments.
1138 config_arg0='$0'
1139 config_args='$*'
1140 config_argc=$#
1141 EOSH
1142 argn=1
1143 for arg in "$@"; do
1144         cat >>cmdline.opt <<EOSH
1145 config_arg$argn='$arg'
1146 EOSH
1147         argn=`expr $argn + 1`
1148 done
1149
1150 : produce awk script to parse command line options
1151 cat >options.awk <<'EOF'
1152 BEGIN {
1153         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1154
1155         len = length(optstr);
1156         for (i = 1; i <= len; i++) {
1157                 c = substr(optstr, i, 1);
1158                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1159                 if (a == ":") {
1160                         arg[c] = 1;
1161                         i++;
1162                 }
1163                 opt[c] = 1;
1164         }
1165 }
1166 {
1167         expect = 0;
1168         str = $0;
1169         if (substr(str, 1, 1) != "-") {
1170                 printf("'%s'\n", str);
1171                 next;
1172         }
1173         len = length($0);
1174         for (i = 2; i <= len; i++) {
1175                 c = substr(str, i, 1);
1176                 if (!opt[c]) {
1177                         printf("-%s\n", substr(str, i));
1178                         next;
1179                 }
1180                 printf("-%s\n", c);
1181                 if (arg[c]) {
1182                         if (i < len)
1183                                 printf("'%s'\n", substr(str, i + 1));
1184                         else
1185                                 expect = 1;
1186                         next;
1187                 }
1188         }
1189 }
1190 END {
1191         if (expect)
1192                 print "?";
1193 }
1194 EOF
1195
1196 : process the command line options
1197 set X `for arg in "$@"; do echo "X$arg"; done |
1198         sed -e s/X// | awk -f options.awk`
1199 eval "set $*"
1200 shift
1201 rm -f options.awk
1202
1203 : set up default values
1204 fastread=''
1205 reuseval=false
1206 config_sh=''
1207 alldone=''
1208 error=''
1209 silent=''
1210 extractsh=''
1211 override=''
1212 knowitall=''
1213 rm -f optdef.sh posthint.sh
1214 cat >optdef.sh <<EOS
1215 $startsh
1216 EOS
1217
1218
1219 : option parsing
1220 while test $# -gt 0; do
1221         case "$1" in
1222         -d) shift; fastread=yes;;
1223         -e) shift; alldone=cont;;
1224         -f)
1225                 shift
1226                 cd ..
1227                 if test -r "$1"; then
1228                         config_sh="$1"
1229                 else
1230                         echo "$me: cannot read config file $1." >&2
1231                         error=true
1232                 fi
1233                 cd UU
1234                 shift;;
1235         -h) shift; error=true;;
1236         -r) shift; reuseval=true;;
1237         -s) shift; silent=true; realsilent=true;;
1238         -E) shift; alldone=exit;;
1239         -K) shift; knowitall=true;;
1240         -O) shift; override=true;;
1241         -S) shift; silent=true; extractsh=true;;
1242         -D)
1243                 shift
1244                 case "$1" in
1245                 *=)
1246                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1247                         echo "$me: ignoring -D $1" >&2
1248                         ;;
1249                 *=*) echo "$1" | \
1250                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1251                 *) echo "$1='define'" >> optdef.sh;;
1252                 esac
1253                 shift
1254                 ;;
1255         -U)
1256                 shift
1257                 case "$1" in
1258                 *=) echo "$1" >> optdef.sh;;
1259                 *=*)
1260                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1261                         echo "$me: ignoring -U $1" >&2
1262                         ;;
1263                 *) echo "$1='undef'" >> optdef.sh;;
1264                 esac
1265                 shift
1266                 ;;
1267         -A)
1268             shift
1269             xxx=''
1270             yyy="$1"
1271             zzz=''
1272             uuu=undef
1273             case "$yyy" in
1274             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1275                  case "$zzz" in
1276                  *:*) zzz='' ;;
1277                  *)   xxx=append
1278                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1279                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1280                  esac
1281                  ;;
1282             esac
1283             case "$xxx" in
1284             '')  case "$yyy" in
1285                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1286                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1287                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1288                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1289                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1290                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1291                  esac
1292                  ;;       
1293             esac
1294             case "$xxx" in
1295             append)
1296                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1297             clear)
1298                 echo "$yyy=''"                  >> posthint.sh ;;
1299             define)
1300                 case "$zzz" in
1301                 '') zzz=define ;;
1302                 esac
1303                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1304             eval)
1305                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1306             prepend)
1307                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1308             undef)
1309                 case "$zzz" in
1310                 '') zzz="$uuu" ;;
1311                 esac
1312                 echo "$yyy=$zzz"                >> posthint.sh ;;
1313             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1314             esac
1315             ;;
1316         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1317             exit 0;;
1318         --) break;;
1319         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1320         *) break;;
1321         esac
1322 done
1323
1324 case "$error" in
1325 true)
1326         cat >&2 <<EOM
1327 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1328                  [-U symbol] [-U symbol=] [-A command:symbol...]
1329   -d : use defaults for all answers.
1330   -e : go on without questioning past the production of config.sh.
1331   -f : specify an alternate default configuration file.
1332   -h : print this help message and exit (with an error status).
1333   -r : reuse C symbols value if possible (skips costly nm extraction).
1334   -s : silent mode, only echoes questions and essential information.
1335   -D : define symbol to have some value:
1336          -D symbol         symbol gets the value 'define'
1337          -D symbol=value   symbol gets the value 'value'
1338   -E : stop at the end of questions, after having produced config.sh.
1339   -K : do not use unless you know what you are doing.
1340   -O : let -D and -U override definitions from loaded configuration file.
1341   -S : perform variable substitutions on all .SH files (can mix with -f)
1342   -U : undefine symbol:
1343          -U symbol    symbol gets the value 'undef'
1344          -U symbol=   symbol gets completely empty
1345   -A : manipulate symbol after the platform specific hints have been applied:
1346          -A symbol=value                append " "value to symbol
1347          -A append:symbol=value         append value to symbol
1348          -A define:symbol=value         define symbol to have value
1349          -A clear:symbol                define symbol to be ''
1350          -A define:symbol               define symbol to be 'define'
1351          -A eval:symbol=value           define symbol to be eval of value
1352          -A prepend:symbol=value        prepend value to symbol
1353          -A undef:symbol                define symbol to be 'undef'
1354          -A undef:symbol=               define symbol to be ''
1355   -V : print version number and exit (with a zero status).
1356 EOM
1357         exit 1
1358         ;;
1359 esac
1360
1361 : Sanity checks
1362 case "$fastread$alldone" in
1363 yescont|yesexit) ;;
1364 *)
1365         if test ! -t 0; then
1366                 echo "Say 'sh Configure', not 'sh <Configure'"
1367                 exit 1
1368         fi
1369         ;;
1370 esac
1371
1372 exec 4>&1
1373 case "$silent" in
1374 true) exec 1>/dev/null;;
1375 esac
1376
1377 : run the defines and the undefines, if any, but leave the file out there...
1378 touch optdef.sh
1379 . ./optdef.sh
1380 : create the posthint manipulation script and leave the file out there...
1381 touch posthint.sh
1382
1383 : set package name
1384 package=perl5
1385 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1386 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1387 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1388 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1389 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1390 esac
1391
1392 : Some greps do not return status, grrr.
1393 echo "grimblepritz" >grimble
1394 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1395         contains=contains
1396 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1397         contains=grep
1398 else
1399         contains=contains
1400 fi
1401 rm -f grimble
1402 : the following should work in any shell
1403 case "$contains" in
1404 contains*)
1405         echo " "
1406         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1407         cat >contains <<'EOSS'
1408 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1409 EOSS
1410 chmod +x contains
1411 esac
1412
1413 : Find the path to the source tree
1414 case "$src" in
1415 '') case "$0" in
1416     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1417          case "$src" in
1418          /*)    ;;
1419          *)     src=`cd ../$src && pwd` ;;
1420          esac
1421          ;;
1422     *)   src='.';;
1423     esac;;
1424 esac
1425 case "$src" in
1426 '')     src=/
1427         rsrc=/
1428         ;;
1429 /*) rsrc="$src";;
1430 *) rsrc="../$src";;
1431 esac
1432 if test -f $rsrc/Configure && \
1433         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1434 then
1435    : found it, so we are ok.
1436 else
1437         rsrc=''
1438         for src in . .. ../.. ../../.. ../../../..; do
1439                 if test -f ../$src/Configure && \
1440                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1441                 then
1442                         rsrc=../$src
1443                         break
1444                 fi
1445         done
1446 fi
1447 case "$rsrc" in
1448 '')
1449         cat <<EOM >&4
1450
1451 Sorry, I can't seem to locate the source dir for $package.  Please start
1452 Configure with an explicit path -- i.e. /some/path/Configure.
1453
1454 EOM
1455         exit 1
1456         ;;
1457 ../.)   rsrc='..';;
1458 *)
1459         echo " "
1460         echo "Sources for $package found in \"$src\"." >&4
1461         ;;
1462 esac
1463
1464 : script used to extract .SH files with variable substitutions
1465 cat >extract <<'EOS'
1466 CONFIGDOTSH=true
1467 echo "Doing variable substitutions on .SH files..."
1468 if test -f $src/MANIFEST; then
1469         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1470 else
1471         echo "(Looking for .SH files under the source directory.)"
1472         set x `(cd $src; find . -name "*.SH" -print)`
1473 fi
1474 shift
1475 case $# in
1476 0) set x `(cd $src; echo *.SH)`; shift;;
1477 esac
1478 if test ! -f $src/$1; then
1479         shift
1480 fi
1481 mkdir_p='
1482 name=$1;
1483 create="";
1484 while test $name; do
1485         if test ! -d "$name"; then
1486                 create="$name $create";
1487                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1488                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1489         else
1490                 name="";
1491         fi;
1492 done;
1493 for file in $create; do
1494         mkdir $file;
1495 done
1496 '
1497 for file in $*; do
1498         case "$src" in
1499         ".")
1500                 case "$file" in
1501                 */*)
1502                         dir=`expr X$file : 'X\(.*\)/'`
1503                         file=`expr X$file : 'X.*/\(.*\)'`
1504                         (cd $dir && . ./$file)
1505                         ;;
1506                 *)
1507                         . ./$file
1508                         ;;
1509                 esac
1510                 ;;
1511         *)
1512                 case "$file" in
1513                 */*)
1514                         dir=`expr X$file : 'X\(.*\)/'`
1515                         file=`expr X$file : 'X.*/\(.*\)'`
1516                         (set x $dir; shift; eval $mkdir_p)
1517                         sh <$src/$dir/$file
1518                         ;;
1519                 *)
1520                         sh <$src/$file
1521                         ;;
1522                 esac
1523                 ;;
1524         esac
1525 done
1526 if test -f $src/config_h.SH; then
1527         if test ! -f config.h; then
1528         : oops, they left it out of MANIFEST, probably, so do it anyway.
1529         . $src/config_h.SH
1530         fi
1531 fi
1532 EOS
1533
1534 : extract files and exit if asked to do so
1535 case "$extractsh" in
1536 true)
1537         case "$realsilent" in
1538         true) ;;
1539         *) exec 1>&4;;
1540         esac
1541         case "$config_sh" in
1542         '') config_sh='config.sh';;
1543         esac
1544         echo " "
1545         echo "Fetching answers from $config_sh..."
1546         cd ..
1547         . $config_sh
1548         test "$override" && . ./optdef.sh
1549         echo " "
1550         . UU/extract
1551         rm -rf UU
1552         echo "Done."
1553         exit 0
1554         ;;
1555 esac
1556
1557 : Eunice requires " " instead of "", can you believe it
1558 echo " "
1559 : Here we go...
1560 echo "Beginning of configuration questions for $package."
1561
1562 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1563
1564 : first determine how to suppress newline on echo command
1565 echo " "
1566 echo "Checking echo to see how to suppress newlines..."
1567 (echo "hi there\c" ; echo " ") >.echotmp
1568 if $contains c .echotmp >/dev/null 2>&1 ; then
1569         echo "...using -n."
1570         n='-n'
1571         c=''
1572 else
1573         cat <<'EOM'
1574 ...using \c
1575 EOM
1576         n=''
1577         c='\c'
1578 fi
1579 echo $n "The star should be here-->$c"
1580 echo '*'
1581 rm -f .echotmp
1582
1583 : Now test for existence of everything in MANIFEST
1584 echo " "
1585 if test -f $rsrc/MANIFEST; then
1586         echo "First let's make sure your kit is complete.  Checking..." >&4
1587         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1588         rm -f missing
1589         tmppwd=`pwd`
1590         for filelist in x??; do
1591                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1592         done
1593         if test -s missing; then
1594                 cat missing >&4
1595                 cat >&4 <<'EOM'
1596
1597 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1598
1599 You have the option of continuing the configuration process, despite the
1600 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1601 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1602 and contact the author (perlbug@perl.com).
1603
1604 EOM
1605                 echo $n "Continue? [n] $c" >&4
1606                 read ans
1607                 case "$ans" in
1608                 y*)
1609                         echo "Continuing..." >&4
1610                         rm -f missing
1611                         ;;
1612                 *)
1613                         echo "ABORTING..." >&4
1614                         kill $$
1615                         ;;
1616                 esac
1617         else
1618                 echo "Looks good..."
1619         fi
1620 else
1621         echo "There is no MANIFEST file.  I hope your kit is complete !"
1622 fi
1623 rm -f missing x??
1624
1625 echo " "
1626 : Find the appropriate value for a newline for tr
1627 if test -n "$DJGPP"; then
1628        trnl='\012'
1629 fi
1630 if test X"$trnl" = X; then
1631         case "`echo foo|tr '\n' x 2>/dev/null`" in
1632         foox) trnl='\n' ;;
1633         esac
1634 fi
1635 if test X"$trnl" = X; then
1636         case "`echo foo|tr '\012' x 2>/dev/null`" in
1637         foox) trnl='\012' ;;
1638         esac
1639 fi
1640 if test X"$trnl" = X; then
1641         cat <<EOM >&2
1642
1643 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1644
1645 EOM
1646         exit 1
1647 fi
1648
1649 : compute the number of columns on the terminal for proper question formatting
1650 case "$COLUMNS" in
1651 '') COLUMNS='80';;
1652 esac
1653
1654 : set up the echo used in my read
1655 myecho="case \"\$xxxm\" in
1656 '') echo $n \"\$rp $c\" >&4;;
1657 *) case \"\$rp\" in
1658         '') echo $n \"[\$xxxm] $c\";;
1659         *)
1660                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1661                         echo \"\$rp\" >&4
1662                         echo $n \"[\$xxxm] $c\" >&4
1663                 else
1664                         echo $n \"\$rp [\$xxxm] $c\" >&4
1665                 fi
1666                 ;;
1667         esac;;
1668 esac"
1669
1670 : now set up to do reads with possible shell escape and default assignment
1671 cat <<EOSC >myread
1672 $startsh
1673 xxxm=\$dflt
1674 $myecho
1675 ans='!'
1676 case "\$fastread" in
1677 yes) case "\$dflt" in
1678         '') ;;
1679         *) ans='';
1680                 case "\$silent-\$rp" in
1681                 true-) ;;
1682                 *) echo " " >&4;;
1683                 esac;;
1684         esac;;
1685 *) case "\$silent" in
1686         true) case "\$rp" in
1687                 '') ans='';;
1688                 esac;;
1689         esac;;
1690 esac
1691 while expr "X\$ans" : "X!" >/dev/null; do
1692         read answ
1693         set x \$xxxm
1694         shift
1695         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1696         case  "\$answ" in
1697         "!")
1698                 sh 1>&4
1699                 echo " "
1700                 $myecho
1701                 ;;
1702         !*)
1703                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1704                 shift
1705                 sh 1>&4 -c "\$*"
1706                 echo " "
1707                 $myecho
1708                 ;;
1709         "\$ans")
1710                 case "\$ans" in
1711                 \\&*)
1712                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1713                         shift
1714                         case "\$1" in
1715                         -d)
1716                                 fastread=yes
1717                                 echo "(OK, I'll run with -d after this question.)" >&4
1718                                 ;;
1719                         -*)
1720                                 echo "*** Sorry, \$1 not supported yet." >&4
1721                                 ;;
1722                         esac
1723                         $myecho
1724                         ans=!
1725                         ;;
1726                 esac;;
1727         *)
1728                 case "\$aok" in
1729                 y)
1730                         echo "*** Substitution done -- please confirm."
1731                         xxxm="\$ans"
1732                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1733                         xxxm="\$ans"
1734                         ans=!
1735                         ;;
1736                 *)
1737                         echo "*** Error -- try again."
1738                         ans=!
1739                         ;;
1740                 esac
1741                 $myecho
1742                 ;;
1743         esac
1744         case "\$ans\$xxxm\$nostick" in
1745         '')
1746                 ans=!
1747                 $myecho
1748                 ;;
1749         esac
1750 done
1751 case "\$ans" in
1752 '') ans="\$xxxm";;
1753 esac
1754 EOSC
1755
1756 : create .config dir to save info across Configure sessions
1757 test -d ../.config || mkdir ../.config
1758 cat >../.config/README <<EOF
1759 This directory created by Configure to save information that should
1760 persist across sessions for $package.
1761
1762 You may safely delete it if you wish.
1763 EOF
1764
1765 : general instructions
1766 needman=true
1767 firsttime=true
1768 user=`(logname) 2>/dev/null`
1769 case "$user" in
1770 '') user=`whoami 2>&1`;;
1771 esac
1772 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1773         firsttime=false
1774         echo " "
1775         rp='Would you like to see the instructions?'
1776         dflt=n
1777         . ./myread
1778         case "$ans" in
1779         [yY]*) ;;
1780         *) needman=false;;
1781         esac
1782 fi
1783 if $needman; then
1784         cat <<EOH
1785
1786 This installation shell script will examine your system and ask you questions
1787 to determine how the perl5 package should be installed. If you get
1788 stuck on a question, you may use a ! shell escape to start a subshell or
1789 execute a command.  Many of the questions will have default answers in square
1790 brackets; typing carriage return will give you the default.
1791
1792 On some of the questions which ask for file or directory names you are allowed
1793 to use the ~name construct to specify the login directory belonging to "name",
1794 even if you don't have a shell which knows about that.  Questions where this is
1795 allowed will be marked "(~name ok)".
1796
1797 EOH
1798         rp=''
1799         dflt='Type carriage return to continue'
1800         . ./myread
1801         cat <<'EOH'
1802
1803 The prompter used in this script allows you to use shell variables and
1804 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1805 in the default answer, as if the default line was a set of arguments given to a
1806 script shell.  This means you may also use $* to repeat the whole default line,
1807 so you do not have to re-type everything to add something to the default.
1808
1809 Everytime there is a substitution, you will have to confirm.  If there is an
1810 error (e.g. an unmatched backtick), the default answer will remain unchanged
1811 and you will be prompted again.
1812
1813 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1814 the questions and use the computed defaults (or the previous answers if there
1815 was already a config.sh file). Type 'Configure -h' for a list of options.
1816 You may also start interactively and then answer '& -d' at any prompt to turn
1817 on the non-interactive behaviour for the remainder of the execution.
1818
1819 EOH
1820         . ./myread
1821         cat <<EOH
1822
1823 Much effort has been expended to ensure that this shell script will run on any
1824 Unix system.  If despite that it blows up on yours, your best bet is to edit
1825 Configure and run it again.  If you can't run Configure for some reason,
1826 you'll have to generate a config.sh file by hand.  Whatever problems you
1827 have, let me (perlbug@perl.com) know how I blew it.
1828
1829 This installation script affects things in two ways:
1830
1831 1) it may do direct variable substitutions on some of the files included
1832    in this kit.
1833 2) it builds a config.h file for inclusion in C programs.  You may edit
1834    any of these files as the need arises after running this script.
1835
1836 If you make a mistake on a question, there is no easy way to back up to it
1837 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1838 files.  Configure will offer to let you do this before it runs the SH files.
1839
1840 EOH
1841         dflt='Type carriage return to continue'
1842         . ./myread
1843         case "$firsttime" in
1844         true) echo $user >>../.config/instruct;;
1845         esac
1846 fi
1847
1848 : find out where common programs are
1849 echo " "
1850 echo "Locating common programs..." >&4
1851 cat <<EOSC >loc
1852 $startsh
1853 case \$# in
1854 0) exit 1;;
1855 esac
1856 thing=\$1
1857 shift
1858 dflt=\$1
1859 shift
1860 for dir in \$*; do
1861         case "\$thing" in
1862         .)
1863         if test -d \$dir/\$thing; then
1864                 echo \$dir
1865                 exit 0
1866         fi
1867         ;;
1868         *)
1869         for thisthing in \$dir/\$thing; do
1870                 : just loop through to pick last item
1871         done
1872         if test -f \$thisthing; then
1873                 echo \$thisthing
1874                 exit 0
1875         elif test -f \$dir/\$thing.exe; then
1876                 if test -n "$DJGPP"; then
1877                         echo \$dir/\$thing.exe
1878                 else
1879                         : on Eunice apparently
1880                         echo \$dir/\$thing
1881                 fi
1882                 exit 0
1883         fi
1884         ;;
1885         esac
1886 done
1887 echo \$dflt
1888 exit 1
1889 EOSC
1890 chmod +x loc
1891 $eunicefix loc
1892 loclist="
1893 awk
1894 cat
1895 comm
1896 cp
1897 echo
1898 expr
1899 grep
1900 ls
1901 make
1902 mkdir
1903 rm
1904 sed
1905 sort
1906 touch
1907 tr
1908 uniq
1909 "
1910 trylist="
1911 Mcc
1912 ar
1913 byacc
1914 cpp
1915 csh
1916 date
1917 egrep
1918 gzip
1919 less
1920 ln
1921 more
1922 nm
1923 nroff
1924 perl
1925 pg
1926 test
1927 uname
1928 zip
1929 "
1930 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1931 pth="$pth /lib /usr/lib"
1932 for file in $loclist; do
1933         eval xxx=\$$file
1934         case "$xxx" in
1935         /*|?:[\\/]*)
1936                 if test -f "$xxx"; then
1937                         : ok
1938                 else
1939                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1940                         xxx=`./loc $file $file $pth`
1941                 fi
1942                 ;;
1943         '') xxx=`./loc $file $file $pth`;;
1944         *) xxx=`./loc $xxx $xxx $pth`;;
1945         esac
1946         eval $file=$xxx
1947         eval _$file=$xxx
1948         case "$xxx" in
1949         /*)
1950                 echo $file is in $xxx.
1951                 ;;
1952         ?:[\\/]*)
1953                 echo $file is in $xxx.
1954                 ;;
1955         *)
1956                 echo "I don't know where '$file' is, and my life depends on it." >&4
1957                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1958                 exit 1
1959                 ;;
1960         esac
1961 done
1962 echo " "
1963 echo "Don't worry if any of the following aren't found..."
1964 say=offhand
1965 for file in $trylist; do
1966         eval xxx=\$$file
1967         case "$xxx" in
1968         /*|?:[\\/]*)
1969                 if test -f "$xxx"; then
1970                         : ok
1971                 else
1972                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1973                         xxx=`./loc $file $file $pth`
1974                 fi
1975                 ;;
1976         '') xxx=`./loc $file $file $pth`;;
1977         *) xxx=`./loc $xxx $xxx $pth`;;
1978         esac
1979         eval $file=$xxx
1980         eval _$file=$xxx
1981         case "$xxx" in
1982         /*)
1983                 echo $file is in $xxx.
1984                 ;;
1985         ?:[\\/]*)
1986                 echo $file is in $xxx.
1987                 ;;
1988         *)
1989                 echo "I don't see $file out there, $say."
1990                 say=either
1991                 ;;
1992         esac
1993 done
1994 case "$egrep" in
1995 egrep)
1996         echo "Substituting grep for egrep."
1997         egrep=$grep
1998         ;;
1999 esac
2000 case "$ln" in
2001 ln)
2002         echo "Substituting cp for ln."
2003         ln=$cp
2004         ;;
2005 esac
2006 case "$test" in
2007 test)
2008         echo "Hopefully test is built into your sh."
2009         ;;
2010 *)
2011         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2012                 echo "Using the test built into your sh."
2013                 test=test
2014                 _test=test
2015         fi
2016         ;;
2017 esac
2018 case "$echo" in
2019 echo)
2020         echo "Hopefully echo is built into your sh."
2021         ;;
2022 '') ;;
2023 *)
2024         echo " "
2025 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2026         $echo $n "hi there$c" >foo1
2027         echo $n "hi there$c" >foo2
2028         if cmp foo1 foo2 >/dev/null 2>&1; then
2029                 echo "They are compatible.  In fact, they may be identical."
2030         else
2031                 case "$n" in
2032                 '-n') n='' c='\c';;
2033                 *) n='-n' c='';;
2034                 esac
2035                 cat <<FOO
2036 They are not compatible!  You are probably running ksh on a non-USG system.
2037 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2038 have echo built in and we may have to run some Bourne shell scripts.  That
2039 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2040
2041 FOO
2042                 $echo $n "The star should be here-->$c"
2043                 $echo "*"
2044         fi
2045         $rm -f foo1 foo2
2046         ;;
2047 esac
2048
2049 : determine whether symbolic links are supported
2050 echo " "
2051 $touch blurfl
2052 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2053         echo "Symbolic links are supported." >&4
2054         lns="$ln -s"
2055 else
2056         echo "Symbolic links are NOT supported." >&4
2057         lns="$ln"
2058 fi
2059 $rm -f blurfl sym
2060
2061 : see whether [:lower:] and [:upper:] are supported character classes
2062 echo " "
2063 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2064 ABYZ)
2065         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2066         up='[:upper:]'
2067         low='[:lower:]'
2068         ;;
2069 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2070         # (0xc9 and 0xd1), therefore that is a nice testing point.
2071         if test "X$up" = X -o "X$low" = X; then
2072             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2073             ij) up='[A-Z]'
2074                 low='[a-z]'
2075                 ;;
2076             esac
2077         fi
2078         if test "X$up" = X -o "X$low" = X; then
2079             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2080             ij) up='A-Z'
2081                 low='a-z'
2082                 ;;
2083             esac
2084         fi
2085         if test "X$up" = X -o "X$low" = X; then
2086             case "`echo IJ | od -x 2>/dev/null`" in
2087             *C9D1*|*c9d1*)
2088                 echo "Hey, this might be EBCDIC." >&4
2089                 if test "X$up" = X -o "X$low" = X; then
2090                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2091                     ij) up='[A-IJ-RS-Z]'
2092                         low='[a-ij-rs-z]'
2093                         ;;
2094                     esac
2095                 fi
2096                 if test "X$up" = X -o "X$low" = X; then
2097                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2098                     ij) up='A-IJ-RS-Z'
2099                         low='a-ij-rs-z'
2100                         ;;
2101                     esac
2102                 fi
2103                 ;;
2104             esac
2105         fi
2106 esac
2107 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2108 ij)
2109     echo "Using $up and $low to convert case." >&4
2110     ;;
2111 *)
2112     echo "I don't know how to translate letters from upper to lower case." >&4
2113     echo "Your tr is not acting any way I know of." >&4
2114     exit 1
2115     ;;
2116 esac
2117 : set up the translation script tr, must be called with ./tr of course
2118 cat >tr <<EOSC
2119 $startsh
2120 case "\$1\$2" in
2121 '[A-Z][a-z]') exec $tr '$up' '$low';;
2122 '[a-z][A-Z]') exec $tr '$low' '$up';;
2123 esac
2124 exec $tr "\$@"
2125 EOSC
2126 chmod +x tr
2127 $eunicefix tr
2128
2129 : Try to determine whether config.sh was made on this system
2130 case "$config_sh" in
2131 '')
2132 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2133 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2134 # because the A-Z/a-z are not consecutive.
2135 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2136         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2137 newmyuname="$myuname"
2138 dflt=n
2139 case "$knowitall" in
2140 '')
2141         if test -f ../config.sh; then
2142                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2143                         eval "`grep myuname= ../config.sh`"
2144                 fi
2145                 if test "X$myuname" = "X$newmyuname"; then
2146                         dflt=y
2147                 fi
2148         fi
2149         ;;
2150 *) dflt=y;;
2151 esac
2152
2153 : Get old answers from old config file if Configure was run on the
2154 : same system, otherwise use the hints.
2155 hint=default
2156 cd ..
2157 if test -f config.sh; then
2158         echo " "
2159         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2160         . UU/myread
2161         case "$ans" in
2162         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2163         *)  echo "Fetching default answers from your old config.sh file..." >&4
2164                 tmp_n="$n"
2165                 tmp_c="$c"
2166                 tmp_sh="$sh"
2167                 . ./config.sh
2168                 cp config.sh UU
2169                 n="$tmp_n"
2170                 c="$tmp_c"
2171                 : Older versions did not always set $sh.  Catch re-use of such
2172                 : an old config.sh.
2173                 case "$sh" in
2174                 '') sh="$tmp_sh" ;;
2175                 esac
2176                 hint=previous
2177                 ;;
2178         esac
2179 fi
2180 if test ! -f config.sh; then
2181         $cat <<EOM
2182
2183 First time through, eh?  I have some defaults handy for some systems
2184 that need some extra help getting the Configure answers right:
2185
2186 EOM
2187         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2188         dflt=''
2189         : Half the following guesses are probably wrong... If you have better
2190         : tests or hints, please send them to perlbug@perl.com
2191         : The metaconfig authors would also appreciate a copy...
2192         $test -f /irix && osname=irix
2193         $test -f /xenix && osname=sco_xenix
2194         $test -f /dynix && osname=dynix
2195         $test -f /dnix && osname=dnix
2196         $test -f /lynx.os && osname=lynxos
2197         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2198         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2199         $test -f /bin/mips && /bin/mips && osname=mips
2200         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2201                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2202         $test -d /usr/apollo/bin && osname=apollo
2203         $test -f /etc/saf/_sactab && osname=svr4
2204         $test -d /usr/include/minix && osname=minix
2205         if $test -d /MachTen -o -d /MachTen_Folder; then
2206                 osname=machten
2207                 if $test -x /sbin/version; then
2208                         osvers=`/sbin/version | $awk '{print $2}' |
2209                         $sed -e 's/[A-Za-z]$//'`
2210                 elif $test -x /usr/etc/version; then
2211                         osvers=`/usr/etc/version | $awk '{print $2}' |
2212                         $sed -e 's/[A-Za-z]$//'`
2213                 else
2214                         osvers="$2.$3"
2215                 fi
2216         fi
2217
2218         $test -f /sys/posix.dll &&
2219                 $test -f /usr/bin/what &&
2220                 set X `/usr/bin/what /sys/posix.dll` &&
2221                 $test "$3" = UWIN &&
2222                 osname=uwin &&
2223                 osvers="$5"
2224
2225         if $test -f $uname; then
2226                 set X $myuname
2227                 shift
2228
2229                 case "$5" in
2230                 fps*) osname=fps ;;
2231                 mips*)
2232                         case "$4" in
2233                         umips) osname=umips ;;
2234                         *) osname=mips ;;
2235                         esac;;
2236                 [23]100) osname=mips ;;
2237                 next*) osname=next ;;
2238                 i386*)
2239                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2240                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2241                                 osname='sco'
2242                                 osvers=$tmp
2243                         elif $test -f /etc/kconfig; then
2244                                 osname=isc
2245                                 if test "$lns" = "$ln -s"; then
2246                                         osvers=4
2247                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2248                                         osvers=3
2249                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2250                                         osvers=2
2251                                 fi
2252                         fi
2253                         tmp=''
2254                         ;;
2255                 pc*)
2256                         if test -n "$DJGPP"; then
2257                                 osname=dos
2258                                 osvers=djgpp
2259                         fi
2260                         ;;
2261                 esac
2262
2263                 case "$1" in
2264                 aix) osname=aix
2265                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2266                         case "$tmp" in
2267                         'not found') osvers="$4"."$3" ;;
2268                         '<3240'|'<>3240') osvers=3.2.0 ;;
2269                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2270                         '=3250'|'>3250') osvers=3.2.5 ;;
2271                         *) osvers=$tmp;;
2272                         esac
2273                         ;;
2274                 bsd386) osname=bsd386
2275                         osvers=`$uname -r`
2276                         ;;
2277                 cygwin*) osname=cygwin
2278                         osvers="$3"
2279                         ;;
2280                 *dc.osx) osname=dcosx
2281                         osvers="$3"
2282                         ;;
2283                 dnix) osname=dnix
2284                         osvers="$3"
2285                         ;;
2286                 domainos) osname=apollo
2287                         osvers="$3"
2288                         ;;
2289                 dgux) osname=dgux 
2290                         osvers="$3"
2291                         ;;
2292                 dynixptx*) osname=dynixptx
2293                         osvers=`echo "$4"|sed 's/^v//'`
2294                         ;;
2295                 freebsd) osname=freebsd 
2296                         osvers="$3" ;;
2297                 genix) osname=genix ;;
2298                 hp*) osname=hpux 
2299                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2300                         ;;
2301                 irix*) osname=irix
2302                         case "$3" in
2303                         4*) osvers=4 ;;
2304                         5*) osvers=5 ;;
2305                         *)      osvers="$3" ;;
2306                         esac
2307                         ;;
2308                 linux) osname=linux
2309                         case "$3" in
2310                         *)      osvers="$3" ;;
2311                         esac
2312                         ;;
2313                 MiNT) osname=mint
2314                         ;;
2315                 netbsd*) osname=netbsd
2316                         osvers="$3"
2317                         ;;
2318                 news-os) osvers="$3"
2319                         case "$3" in
2320                         4*) osname=newsos4 ;;
2321                         *) osname=newsos ;;
2322                         esac
2323                         ;;
2324                 next*) osname=next ;;
2325                 POSIX-BC | posix-bc ) osname=posix-bc
2326                         osvers="$3"
2327                         ;;
2328                 powerux | power_ux | powermax_os | powermaxos | \
2329                 powerunix | power_unix) osname=powerux
2330                         osvers="$3"
2331                         ;;
2332                 qnx) osname=qnx
2333                         osvers="$4"
2334                         ;;
2335                 solaris) osname=solaris
2336                         case "$3" in
2337                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2338                         *)      osvers="$3" ;;
2339                         esac
2340                         ;;
2341                 sunos) osname=sunos
2342                         case "$3" in
2343                         5*) osname=solaris
2344                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2345                         *)      osvers="$3" ;;
2346                         esac
2347                         ;;
2348                 titanos) osname=titanos
2349                         case "$3" in
2350                         1*) osvers=1 ;;
2351                         2*) osvers=2 ;;
2352                         3*) osvers=3 ;;
2353                         4*) osvers=4 ;;
2354                         *)      osvers="$3" ;;
2355                         esac
2356                         ;;
2357                 ultrix) osname=ultrix
2358                         osvers="$3"
2359                         ;;
2360                 osf1|mls+)      case "$5" in
2361                                 alpha)
2362                                         osname=dec_osf
2363                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2364                                         ;;
2365                         hp*)    osname=hp_osf1  ;;
2366                         mips)   osname=mips_osf1 ;;
2367                         esac
2368                         ;;
2369                 unixware) osname=svr5
2370                         osvers="$4"
2371                         ;;
2372                 uts) osname=uts
2373                         osvers="$3"
2374                         ;;
2375                 $2) case "$osname" in
2376                         *isc*) ;;
2377                         *freebsd*) ;;
2378                         svr*)
2379                                 : svr4.x or possibly later
2380                                 case "svr$3" in 
2381                                 ${osname}*)
2382                                         osname=svr$3
2383                                         osvers=$4
2384                                         ;;
2385                                 esac
2386                                 case "$osname" in
2387                                 svr4.0)
2388                                         : Check for ESIX
2389                                         if test -f /stand/boot ; then
2390                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2391                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2392                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2393                                                         if test -n "$isesix"; then
2394                                                                 osname=esix4
2395                                                         fi
2396                                                 fi
2397                                         fi
2398                                         ;;
2399                                 esac
2400                                 ;;
2401                         *)      if test -f /etc/systemid; then
2402                                         osname=sco
2403                                         set `echo $3 | $sed 's/\./ /g'` $4
2404                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2405                                                 osvers=$1.$2.$3
2406                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2407                                                 osvers=$1.$2
2408                                         elif $test -f $src/hints/sco_$1.sh; then
2409                                                 osvers=$1
2410                                         fi
2411                                 else
2412                                         case "$osname" in
2413                                         '') : Still unknown.  Probably a generic Sys V.
2414                                                 osname="sysv"
2415                                                 osvers="$3"
2416                                                 ;;
2417                                         esac
2418                                 fi
2419                                 ;;
2420                         esac
2421                         ;;
2422                 *)      case "$osname" in
2423                         '') : Still unknown.  Probably a generic BSD.
2424                                 osname="$1"
2425                                 osvers="$3"
2426                                 ;;
2427                         esac
2428                         ;;
2429                 esac
2430         else
2431                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2432                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2433                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2434                                 osname=news_os
2435                         fi
2436                         $rm -f UU/kernel.what
2437                 elif test -d c:/.; then
2438                         set X $myuname
2439                         osname=os2
2440                         osvers="$5"
2441                 fi
2442         fi
2443         
2444         : Now look for a hint file osname_osvers, unless one has been
2445         : specified already.
2446         case "$hintfile" in
2447         ''|' ')
2448                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2449                 : Also try without trailing minor version numbers.
2450                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2451                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2452                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2453                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2454                 case "$file" in
2455                 '') dflt=none ;;
2456                 *)  case "$osvers" in
2457                         '') dflt=$file
2458                                 ;;
2459                         *)  if $test -f $src/hints/$file.sh ; then
2460                                         dflt=$file
2461                                 elif $test -f $src/hints/$xfile.sh ; then
2462                                         dflt=$xfile
2463                                 elif $test -f $src/hints/$xxfile.sh ; then
2464                                         dflt=$xxfile
2465                                 elif $test -f $src/hints/$xxxfile.sh ; then
2466                                         dflt=$xxxfile
2467                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2468                                         dflt=$xxxxfile
2469                                 elif $test -f "$src/hints/${osname}.sh" ; then
2470                                         dflt="${osname}"
2471                                 else
2472                                         dflt=none
2473                                 fi
2474                                 ;;
2475                         esac
2476                         ;;
2477                 esac
2478                 if $test -f Policy.sh ; then
2479                         case "$dflt" in
2480                         *Policy*) ;;
2481                         none) dflt="Policy" ;;
2482                         *) dflt="Policy $dflt" ;;
2483                         esac
2484                 fi
2485                 ;;
2486         *)
2487                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2488                 ;;
2489         esac
2490
2491         if $test -f Policy.sh ; then
2492                 $cat <<EOM
2493
2494 There's also a Policy hint file available, which should make the
2495 site-specific (policy) questions easier to answer.
2496 EOM
2497
2498         fi
2499
2500         $cat <<EOM
2501
2502 You may give one or more space-separated answers, or "none" if appropriate.
2503 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2504 is a good thing.  DO NOT give a wrong version or a wrong OS.
2505
2506 EOM
2507
2508         rp="Which of these apply, if any?"
2509         . UU/myread
2510         tans=$ans
2511         for file in $tans; do
2512                 if $test X$file = XPolicy -a -f Policy.sh; then
2513                         . Policy.sh
2514                         $cat Policy.sh >> UU/config.sh
2515                 elif $test -f $src/hints/$file.sh; then
2516                         . $src/hints/$file.sh
2517                         $cat $src/hints/$file.sh >> UU/config.sh
2518                 elif $test X$tans = X -o X$tans = Xnone ; then
2519                         : nothing
2520                 else
2521                         : Give one chance to correct a possible typo.
2522                         echo "$file.sh does not exist"
2523                         dflt=$file
2524                         rp="hint to use instead?"
2525                         . UU/myread
2526                         for file in $ans; do
2527                                 if $test -f "$src/hints/$file.sh"; then
2528                                         . $src/hints/$file.sh
2529                                         $cat $src/hints/$file.sh >> UU/config.sh
2530                                 elif $test X$ans = X -o X$ans = Xnone ; then
2531                                         : nothing
2532                                 else
2533                                         echo "$file.sh does not exist -- ignored."
2534                                 fi
2535                         done
2536                 fi
2537         done
2538
2539         hint=recommended
2540         : Remember our hint file for later.
2541         if $test -f "$src/hints/$file.sh" ; then
2542                 hintfile="$file"
2543         else
2544                 hintfile=''
2545         fi
2546 fi
2547 cd UU
2548 ;;
2549 *)
2550         echo " "
2551         echo "Fetching default answers from $config_sh..." >&4
2552         tmp_n="$n"
2553         tmp_c="$c"
2554         cd ..
2555         cp $config_sh config.sh 2>/dev/null
2556         chmod +w config.sh
2557         . ./config.sh
2558         cd UU
2559         cp ../config.sh .
2560         n="$tmp_n"
2561         c="$tmp_c"
2562         hint=previous
2563         ;;
2564 esac
2565 test "$override" && . ./optdef.sh
2566 myuname="$newmyuname"
2567
2568 : Restore computed paths
2569 for file in $loclist $trylist; do
2570         eval $file="\$_$file"
2571 done
2572
2573 cat << EOM
2574
2575 Configure uses the operating system name and version to set some defaults.
2576 The default value is probably right if the name rings a bell. Otherwise,
2577 since spelling matters for me, either accept the default or answer "none"
2578 to leave it blank.
2579
2580 EOM
2581 case "$osname" in
2582         ''|' ')
2583                 case "$hintfile" in
2584                 ''|' '|none) dflt=none ;;
2585                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2586                 esac
2587                 ;;
2588         *) dflt="$osname" ;;
2589 esac
2590 rp="Operating system name?"
2591 . ./myread
2592 case "$ans" in
2593 none)  osname='' ;;
2594 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2595 esac
2596 echo " "
2597 case "$osvers" in
2598         ''|' ')
2599                 case "$hintfile" in
2600                 ''|' '|none) dflt=none ;;
2601                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2602                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2603                         case "$dflt" in
2604                         ''|' ') dflt=none ;;
2605                         esac
2606                         ;;
2607                 esac
2608                 ;;
2609         *) dflt="$osvers" ;;
2610 esac
2611 rp="Operating system version?"
2612 . ./myread
2613 case "$ans" in
2614 none)  osvers='' ;;
2615 *) osvers="$ans" ;;
2616 esac
2617
2618
2619 . ./posthint.sh
2620
2621 : who configured the system
2622 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2623 cf_by=`(logname) 2>/dev/null`
2624 case "$cf_by" in
2625 "")
2626         cf_by=`(whoami) 2>/dev/null`
2627         case "$cf_by" in
2628         "") cf_by=unknown ;;
2629         esac ;;
2630 esac
2631
2632 : set up the script used to warn in case of inconsistency
2633 cat <<EOS >whoa
2634 $startsh
2635 EOS
2636 cat <<'EOSC' >>whoa
2637 dflt=y
2638 echo " "
2639 echo "*** WHOA THERE!!! ***" >&4
2640 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2641 rp="    Keep the $hint value?"
2642 . ./myread
2643 case "$ans" in
2644 y) td=$was; tu=$was;;
2645 esac
2646 EOSC
2647
2648 : function used to set $1 to $val
2649 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2650 case "$val$was" in
2651 $define$undef) . ./whoa; eval "$var=\$td";;
2652 $undef$define) . ./whoa; eval "$var=\$tu";;
2653 *) eval "$var=$val";;
2654 esac'
2655
2656 cat <<EOM
2657
2658 Perl can be built to take advantage of threads, on some systems.
2659 To do so, Configure must be run with -Dusethreads.
2660
2661 Note that threading is a highly experimental feature, and
2662 some known race conditions still remain.  If you choose to try
2663 it, be very sure to not actually deploy it for production
2664 purposes.  README.threads has more details, and is required
2665 reading if you enable threads.
2666 EOM
2667 case "$usethreads" in
2668 $define|true|[yY]*)     dflt='y';;
2669 *) dflt='n';;
2670 esac
2671 rp='Build a threading Perl?'
2672 . ./myread
2673 case "$ans" in
2674 y|Y)    val="$define" ;;
2675 *)      val="$undef" ;;
2676 esac
2677 set usethreads
2678 eval $setvar
2679
2680 case "$usethreads" in
2681 $define)
2682         $cat <<EOM
2683
2684 As of 5.5.640, Perl has two different internal threading implementations,
2685 the 5.005 version (5005threads) and an interpreter-based version
2686 (ithreads) that has one interpreter per thread.  Both are very 
2687 experimental.  This arrangement exists to help developers work out
2688 which one is better.
2689 EOM
2690         : Default to ithreads unless overridden on command line or with
2691         : old config.sh
2692         dflt='y'
2693         case "$use5005threads" in
2694                 $define|true|[yY]*) dflt='n';;
2695         esac
2696         case "$useithreads" in
2697                 $undef|false|[nN]*) dflt='n';;
2698         esac
2699         rp='Use interpreter-based ithreads?'
2700         . ./myread
2701         case "$ans" in
2702         y|Y)    val="$define" ;;
2703         *)      val="$undef" ;;
2704         esac
2705         set useithreads
2706         eval $setvar
2707         : Now set use5005threads to the opposite value.
2708         case "$useithreads" in
2709         $define) val="$undef" ;;
2710         *) val="$define" ;;
2711         esac
2712         set use5005threads
2713         eval $setvar
2714         ;;
2715 *)
2716         useithreads="$undef"
2717         use5005threads="$undef"
2718         ;;
2719 esac
2720
2721 case "$d_oldpthreads" in
2722 '')     : Configure tests would be welcome here.  For now, assume undef.
2723         val="$undef" ;;
2724 *)      val="$d_oldpthreads" ;;
2725 esac
2726 set d_oldpthreads
2727 eval $setvar
2728
2729
2730 case "$usethreads" in
2731 "$define"|true|[yY]*)
2732 : Look for a hint-file generated 'call-back-unit'.  If the
2733 : user has specified that a threading perl is to be built,
2734 : we may need to set or change some other defaults.
2735         if $test -f usethreads.cbu; then
2736                 echo "Your platform has some specific hints for threaded builds, using them..."
2737                 . ./usethreads.cbu
2738         else
2739                 $cat <<EOM
2740 (Your platform doesn't have any specific hints for threaded builds.
2741  Assuming POSIX threads, then.)
2742 EOM
2743         fi
2744         ;;
2745 esac
2746
2747 cat <<EOM
2748
2749 Perl can be built so that multiple Perl interpreters can coexist
2750 within the same Perl executable.
2751 EOM
2752
2753 case "$useithreads" in
2754 $define)
2755         cat <<EOM
2756 This multiple interpreter support is required for interpreter-based threads.
2757 EOM
2758         val="$define"
2759         ;;
2760 *)
2761         echo 'Normally you do not need this and you should answer no.'
2762         case "$usemultiplicity" in
2763         $define|true|[yY]*)     dflt='y';;
2764         *) dflt='n';;
2765         esac
2766         rp='Build Perl for multiplicity?'
2767         . ./myread
2768         case "$ans" in
2769         y|Y)    val="$define" ;;
2770         *)      val="$undef" ;;
2771         esac
2772         ;;
2773 esac
2774 set usemultiplicity
2775 eval $setvar
2776
2777 : determine where manual pages are on this system
2778 echo " "
2779 case "$sysman" in
2780 '') 
2781         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2782         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2783         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2784         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2785         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2786         sysman=`./loc . /usr/man/man1 $syspath`
2787         ;;
2788 esac
2789 if $test -d "$sysman"; then
2790         echo "System manual is in $sysman." >&4
2791 else
2792         echo "Could not find manual pages in source form." >&4
2793 fi
2794
2795 : see what memory models we can support
2796 case "$models" in
2797 '')
2798         $cat >pdp11.c <<'EOP'
2799 int main() {
2800 #ifdef pdp11
2801         exit(0);
2802 #else
2803         exit(1);
2804 #endif
2805 }
2806 EOP
2807         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2808         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2809                 dflt='unsplit split'
2810         else
2811                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2812                 case "$tans" in
2813                 X) dflt='none';;
2814                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2815                                 dflt='small'
2816                         else
2817                                 dflt=''
2818                         fi
2819                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2820                                 dflt="$dflt medium"
2821                         fi
2822                         if $test -d /lib/large || $test -d /usr/lib/large; then
2823                                 dflt="$dflt large"
2824                         fi
2825                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2826                                 dflt="$dflt huge"
2827                         fi
2828                 esac
2829         fi;;
2830 *) dflt="$models";;
2831 esac
2832 $cat <<EOM
2833  
2834 Some systems have different model sizes.  On most systems they are called
2835 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2836 split.  If your system doesn't support different memory models, say "none".
2837 If you wish to force everything to one memory model, say "none" here and
2838 put the appropriate flags later when it asks you for other cc and ld flags.
2839 Venix systems may wish to put "none" and let the compiler figure things out.
2840 (In the following question multiple model names should be space separated.)
2841
2842 The default for most systems is "none".
2843
2844 EOM
2845 rp="Which memory models are supported?"
2846 . ./myread
2847 models="$ans"
2848
2849 case "$models" in
2850 none)
2851         small=''
2852         medium=''
2853         large=''
2854         huge=''
2855         unsplit=''
2856         split=''
2857         ;;
2858 *split)
2859         case "$split" in
2860         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2861                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2862                         dflt='-i'
2863                 else
2864                         dflt='none'
2865                 fi;;
2866         *) dflt="$split";;
2867         esac
2868         rp="What flag indicates separate I and D space?"
2869         . ./myread
2870         tans="$ans"
2871         case "$tans" in
2872         none) tans='';;
2873         esac
2874         split="$tans"
2875         unsplit='';;
2876 *large*|*small*|*medium*|*huge*)
2877         case "$models" in
2878         *large*)
2879                 case "$large" in
2880                 '') dflt='-Ml';;
2881                 *) dflt="$large";;
2882                 esac
2883         rp="What flag indicates large model?"
2884         . ./myread
2885         tans="$ans"
2886         case "$tans" in
2887         none) tans='';
2888         esac
2889         large="$tans";;
2890         *) large='';;
2891         esac
2892         case "$models" in
2893         *huge*) case "$huge" in
2894                 '') dflt='-Mh';;
2895                 *) dflt="$huge";;
2896                 esac
2897                 rp="What flag indicates huge model?"
2898                 . ./myread
2899                 tans="$ans"
2900                 case "$tans" in
2901                 none) tans='';
2902                 esac
2903                 huge="$tans";;
2904         *) huge="$large";;
2905         esac
2906         case "$models" in
2907         *medium*) case "$medium" in
2908                 '') dflt='-Mm';;
2909                 *) dflt="$medium";;
2910                 esac
2911                 rp="What flag indicates medium model?"
2912                 . ./myread
2913                 tans="$ans"
2914                 case "$tans" in
2915                 none) tans='';
2916                 esac
2917                 medium="$tans";;
2918         *) medium="$large";;
2919         esac
2920         case "$models" in
2921         *small*) case "$small" in
2922                 '') dflt='none';;
2923                 *) dflt="$small";;
2924                 esac
2925                 rp="What flag indicates small model?"
2926                 . ./myread
2927                 tans="$ans"
2928                 case "$tans" in
2929                 none) tans='';
2930                 esac
2931                 small="$tans";;
2932         *) small='';;
2933         esac
2934         ;;
2935 *)
2936         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2937         ;;
2938 esac
2939 $rm -f pdp11.* pdp11
2940
2941 : make some quick guesses about what we are up against
2942 echo " "
2943 $echo $n "Hmm...  $c"
2944 echo exit 1 >bsd
2945 echo exit 1 >usg
2946 echo exit 1 >v7
2947 echo exit 1 >osf1
2948 echo exit 1 >eunice
2949 echo exit 1 >xenix
2950 echo exit 1 >venix
2951 echo exit 1 >os2
2952 d_bsd="$undef"
2953 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2954 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2955 then
2956         echo "Looks kind of like an OSF/1 system, but we'll see..."
2957         echo exit 0 >osf1
2958 elif test `echo abc | tr a-z A-Z` = Abc ; then
2959         xxx=`./loc addbib blurfl $pth`
2960         if $test -f $xxx; then
2961         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2962                 echo exit 0 >bsd
2963                 echo exit 0 >usg
2964         else
2965                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2966                         echo "Looks kind of like an extended USG system, but we'll see..."
2967                 else
2968                         echo "Looks kind of like a USG system, but we'll see..."
2969                 fi
2970                 echo exit 0 >usg
2971         fi
2972 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2973         echo "Looks kind of like a BSD system, but we'll see..."
2974         d_bsd="$define"
2975         echo exit 0 >bsd
2976 else
2977         echo "Looks kind of like a Version 7 system, but we'll see..."
2978         echo exit 0 >v7
2979 fi
2980 case "$eunicefix" in
2981 *unixtovms*)
2982         $cat <<'EOI'
2983 There is, however, a strange, musty smell in the air that reminds me of
2984 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2985 EOI
2986         echo exit 0 >eunice
2987         d_eunice="$define"
2988 : it so happens the Eunice I know will not run shell scripts in Unix format
2989         ;;
2990 *)
2991         echo " "
2992         echo "Congratulations.  You aren't running Eunice."
2993         d_eunice="$undef"
2994         ;;
2995 esac
2996 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2997 case "$p_" in
2998 :) ;;
2999 *)
3000         $cat <<'EOI'
3001 I have the feeling something is not exactly right, however...don't tell me...
3002 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3003 EOI
3004         echo exit 0 >os2
3005         ;;
3006 esac
3007 if test -f /xenix; then
3008         echo "Actually, this looks more like a XENIX system..."
3009         echo exit 0 >xenix
3010         d_xenix="$define"
3011 else
3012         echo " "
3013         echo "It's not Xenix..."
3014         d_xenix="$undef"
3015 fi
3016 chmod +x xenix
3017 $eunicefix xenix
3018 if test -f /venix; then
3019         echo "Actually, this looks more like a VENIX system..."
3020         echo exit 0 >venix
3021 else
3022         echo " "
3023         if ./xenix; then
3024                 : null
3025         else
3026                 echo "Nor is it Venix..."
3027         fi
3028 fi
3029 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3030 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3031 $rm -f foo
3032
3033 : see if we need a special compiler
3034 echo " "
3035 if ./usg; then
3036         case "$cc" in
3037         '') case "$Mcc" in
3038                 /*) dflt='Mcc';;
3039                 *) case "$large" in
3040                         -M*) dflt='cc';;
3041                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3042                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3043                                                 dflt='cc'
3044                                         else
3045                                                 dflt='cc -M'
3046                                         fi
3047                                 else
3048                                         dflt='cc'
3049                                 fi;;
3050                         esac;;
3051                 esac;;
3052         *)  dflt="$cc";;
3053         esac
3054         case "$dflt" in
3055         *M*)    $cat <<'EOM'
3056 On some older systems the default C compiler will not resolve multiple global
3057 references that happen to have the same name.  On some such systems the "Mcc"
3058 command may be used to force these to be resolved.  On other systems a "cc -M"
3059 command is required.  (Note that the -M flag on other systems indicates a
3060 memory model to use!) If you have the Gnu C compiler, you might wish to use
3061 that instead.
3062
3063 EOM
3064         ;;
3065         esac
3066         rp="Use which C compiler?"
3067         . ./myread
3068         cc="$ans"
3069 else
3070         case "$cc" in
3071         '') dflt=cc;;
3072         *) dflt="$cc";;
3073         esac
3074         rp="Use which C compiler?"
3075         . ./myread
3076         cc="$ans"
3077 fi
3078 : Look for a hint-file generated 'call-back-unit'.  Now that the
3079 : user has specified the compiler, we may need to set or change some
3080 : other defaults.
3081 if $test -f cc.cbu; then
3082     . ./cc.cbu
3083 fi
3084 echo " "
3085 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3086 $cat >gccvers.c <<EOM
3087 #include <stdio.h>
3088 int main() {
3089 #ifdef __GNUC__
3090 #ifdef __VERSION__
3091         printf("%s\n", __VERSION__);
3092 #else
3093         printf("%s\n", "1");
3094 #endif
3095 #endif
3096         exit(0);
3097 }
3098 EOM
3099 if $cc -o gccvers gccvers.c; then
3100         gccversion=`./gccvers`
3101         case "$gccversion" in
3102         '') echo "You are not using GNU cc." ;;
3103         *)  echo "You are using GNU cc $gccversion."
3104             ;;
3105         esac
3106 else
3107         echo " "
3108         echo "*** WHOA THERE!!! ***" >&4
3109         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3110         case "$knowitall" in
3111         '')
3112         echo "    You'd better start hunting for one and let me know about it." >&4
3113                 exit 1
3114                 ;;
3115         esac
3116 fi
3117 $rm -f gccvers*
3118 case "$gccversion" in
3119 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3120 esac
3121
3122 : decide how portable to be.  Allow command line overrides.
3123 case "$d_portable" in
3124 "$undef") ;;
3125 *)      d_portable="$define" ;;
3126 esac
3127
3128 : set up shell script to do ~ expansion
3129 cat >filexp <<EOSS
3130 $startsh
3131 : expand filename
3132 case "\$1" in
3133  ~/*|~)
3134         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3135         ;;
3136  ~*)
3137         if $test -f /bin/csh; then
3138                 /bin/csh -f -c "glob \$1"
3139                 failed=\$?
3140                 echo ""
3141                 exit \$failed
3142         else
3143                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3144                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3145                 if $test ! -d "\$dir"; then
3146                         me=\`basename \$0\`
3147                         echo "\$me: can't locate home directory for: \$name" >&2
3148                         exit 1
3149                 fi
3150                 case "\$1" in
3151                 */*)
3152                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3153                         ;;
3154                 *)
3155                         echo \$dir
3156                         ;;
3157                 esac
3158         fi
3159         ;;
3160 *)
3161         echo \$1
3162         ;;
3163 esac
3164 EOSS
3165 chmod +x filexp
3166 $eunicefix filexp
3167
3168 : now set up to get a file name
3169 cat <<EOS >getfile
3170 $startsh
3171 EOS
3172 cat <<'EOSC' >>getfile
3173 tilde=''
3174 fullpath=''
3175 already=''
3176 skip=''
3177 none_ok=''
3178 exp_file=''
3179 nopath_ok=''
3180 orig_rp="$rp"
3181 orig_dflt="$dflt"
3182 case "$gfpth" in
3183 '') gfpth='.' ;;
3184 esac
3185
3186 case "$fn" in
3187 *\(*)
3188         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3189         fn=`echo $fn | sed 's/(.*)//'`
3190         ;;
3191 esac
3192
3193 case "$fn" in
3194 *:*)
3195         loc_file=`expr $fn : '.*:\(.*\)'`
3196         fn=`expr $fn : '\(.*\):.*'`
3197         ;;
3198 esac
3199
3200 case "$fn" in
3201 *~*) tilde=true;;
3202 esac
3203 case "$fn" in
3204 */*) fullpath=true;;
3205 esac
3206 case "$fn" in
3207 *+*) skip=true;;
3208 esac
3209 case "$fn" in
3210 *n*) none_ok=true;;
3211 esac
3212 case "$fn" in
3213 *e*) exp_file=true;;
3214 esac
3215 case "$fn" in
3216 *p*) nopath_ok=true;;
3217 esac
3218
3219 case "$fn" in
3220 *f*) type='File';;
3221 *d*) type='Directory';;
3222 *l*) type='Locate';;
3223 esac
3224
3225 what="$type"
3226 case "$what" in
3227 Locate) what='File';;
3228 esac
3229
3230 case "$exp_file" in
3231 '')
3232         case "$d_portable" in
3233         "$define") ;;
3234         *) exp_file=true;;
3235         esac
3236         ;;
3237 esac
3238
3239 cd ..
3240 while test "$type"; do
3241         redo=''
3242         rp="$orig_rp"
3243         dflt="$orig_dflt"
3244         case "$tilde" in
3245         true) rp="$rp (~name ok)";;
3246         esac
3247         . UU/myread
3248         if test -f UU/getfile.ok && \
3249                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3250         then
3251                 value="$ans"
3252                 ansexp="$ans"
3253                 break
3254         fi
3255         case "$ans" in
3256         none)
3257                 value=''
3258                 ansexp=''
3259                 case "$none_ok" in
3260                 true) type='';;
3261                 esac
3262                 ;;
3263         *)
3264                 case "$tilde" in
3265                 '') value="$ans"
3266                         ansexp="$ans";;
3267                 *)
3268                         value=`UU/filexp $ans`
3269                         case $? in
3270                         0)
3271                                 if test "$ans" != "$value"; then
3272                                         echo "(That expands to $value on this system.)"
3273                                 fi
3274                                 ;;
3275                         *) value="$ans";;
3276                         esac
3277                         ansexp="$value"
3278                         case "$exp_file" in
3279                         '') value="$ans";;
3280                         esac
3281                         ;;
3282                 esac
3283                 case "$fullpath" in
3284                 true)
3285                         case "$ansexp" in
3286                         /*) value="$ansexp" ;;
3287                         *)
3288                                 redo=true
3289                                 case "$already" in
3290                                 true)
3291                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3292                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3293                                         ;;
3294                                 *)
3295                                 echo "Please give a full path name, starting with slash." >&4
3296                                         case "$tilde" in
3297                                         true)
3298                                 echo "Note that using ~name is ok provided it expands well." >&4
3299                                                 already=true
3300                                                 ;;
3301                                         esac
3302                                 esac
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307                 case "$redo" in
3308                 '')
3309                         case "$type" in
3310                         File)
3311                                 for fp in $gfpth; do
3312                                         if test "X$fp" = X.; then
3313                                             pf="$ansexp"
3314                                         else    
3315                                             pf="$fp/$ansexp"
3316                                         fi
3317                                         if test -f "$pf"; then
3318                                                 type=''
3319                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3320                                         then
3321                                                 echo "($value is not a plain file, but that's ok.)"
3322                                                 type=''
3323                                         fi
3324                                         if test X"$type" = X; then
3325                                             value="$pf"
3326                                             break
3327                                         fi
3328                                 done
3329                                 ;;
3330                         Directory)
3331                                 for fp in $gfpth; do
3332                                         if test "X$fp" = X.; then
3333                                             pf="$ansexp"
3334                                         else    
3335                                             pf="$fp/$ansexp"
3336                                         fi
3337                                         if test -d "$pf"; then
3338                                                 type=''
3339                                                 value="$pf"
3340                                                 break
3341                                         fi
3342                                 done
3343                                 ;;
3344                         Locate)
3345                                 if test -d "$ansexp"; then
3346                                         echo "(Looking for $loc_file in directory $value.)"
3347                                         value="$value/$loc_file"
3348                                         ansexp="$ansexp/$loc_file"
3349                                 fi
3350                                 if test -f "$ansexp"; then
3351                                         type=''
3352                                 fi
3353                                 case "$nopath_ok" in
3354                                 true)   case "$value" in
3355                                         */*) ;;
3356                                         *)      echo "Assuming $value will be in people's path."
3357                                                 type=''
3358                                                 ;;
3359                                         esac
3360                                         ;;
3361                                 esac
3362                                 ;;
3363                         esac
3364
3365                         case "$skip" in
3366                         true) type='';
3367                         esac
3368
3369                         case "$type" in
3370                         '') ;;
3371                         *)
3372                                 if test "$fastread" = yes; then
3373                                         dflt=y
3374                                 else
3375                                         dflt=n
3376                                 fi
3377                                 rp="$what $value doesn't exist.  Use that name anyway?"
3378                                 . UU/myread
3379                                 dflt=''
3380                                 case "$ans" in
3381                                 y*) type='';;
3382                                 *) echo " ";;
3383                                 esac
3384                                 ;;
3385                         esac
3386                         ;;
3387                 esac
3388                 ;;
3389         esac
3390 done
3391 cd UU
3392 ans="$value"
3393 rp="$orig_rp"
3394 dflt="$orig_dflt"
3395 rm -f getfile.ok
3396 test "X$gfpthkeep" != Xy && gfpth=""
3397 EOSC
3398
3399 : What should the include directory be ?
3400 echo " "
3401 $echo $n "Hmm...  $c"
3402 dflt='/usr/include'
3403 incpath=''
3404 mips_type=''
3405 if $test -f /bin/mips && /bin/mips; then
3406         echo "Looks like a MIPS system..."
3407         $cat >usr.c <<'EOCP'
3408 #ifdef SYSTYPE_BSD43
3409 /bsd43
3410 #endif
3411 EOCP
3412         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3413                 dflt='/bsd43/usr/include'
3414                 incpath='/bsd43'
3415                 mips_type='BSD 4.3'
3416         else
3417                 mips_type='System V'
3418         fi
3419         $rm -f usr.c usr.out
3420         echo "and you're compiling with the $mips_type compiler and libraries."
3421         xxx_prompt=y
3422         echo "exit 0" >mips
3423 else
3424         echo "Doesn't look like a MIPS system."
3425         xxx_prompt=n
3426         echo "exit 1" >mips
3427 fi
3428 chmod +x mips
3429 $eunicefix mips
3430 case "$usrinc" in
3431 '') ;;
3432 *) dflt="$usrinc";;
3433 esac
3434 case "$xxx_prompt" in
3435 y)      fn=d/
3436         echo " "
3437         rp='Where are the include files you want to use?'
3438         . ./getfile
3439         usrinc="$ans"
3440         ;;
3441 *)      usrinc="$dflt"
3442         ;;
3443 esac
3444
3445 : see how we invoke the C preprocessor
3446 echo " "
3447 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3448 cat <<'EOT' >testcpp.c
3449 #define ABC abc
3450 #define XYZ xyz
3451 ABC.XYZ
3452 EOT
3453 cd ..
3454 if test ! -f cppstdin; then
3455         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3456                 # AIX cc -E doesn't show the absolute headerfile
3457                 # locations but we'll cheat by using the -M flag.
3458                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3459         else
3460                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3461         fi
3462 else
3463         echo "Keeping your $hint cppstdin wrapper."
3464 fi
3465 chmod 755 cppstdin
3466 wrapper=`pwd`/cppstdin
3467 ok='false'
3468 cd UU
3469
3470 if $test "X$cppstdin" != "X" && \
3471         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3473 then
3474         echo "You used to use $cppstdin $cppminus so we'll use that again."
3475         case "$cpprun" in
3476         '') echo "But let's see if we can live without a wrapper..." ;;
3477         *)
3478                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3479                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3480                 then
3481                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3482                         ok='true'
3483                 else
3484                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3485                 fi
3486                 ;;
3487         esac
3488 else
3489         case "$cppstdin" in
3490         '') ;;
3491         *)
3492                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3493                 ;;
3494         esac
3495 fi
3496
3497 if $ok; then
3498         : nothing
3499 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3500         $cc -E <testcpp.c >testcpp.out 2>&1; \
3501         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3502         echo "Yup, it does."
3503         x_cpp="$cc -E"
3504         x_minus='';
3505 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3506         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3507         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3508         echo "Yup, it does."
3509         x_cpp="$cc -E"
3510         x_minus='-';
3511 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3512         $cc -P <testcpp.c >testcpp.out 2>&1; \
3513         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3514         echo "Yipee, that works!"
3515         x_cpp="$cc -P"
3516         x_minus='';
3517 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3518         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3519         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3520         echo "At long last!"
3521         x_cpp="$cc -P"
3522         x_minus='-';
3523 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3524         $cpp <testcpp.c >testcpp.out 2>&1; \
3525         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3526         echo "It works!"
3527         x_cpp="$cpp"
3528         x_minus='';
3529 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3530         $cpp - <testcpp.c >testcpp.out 2>&1; \
3531         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3532         echo "Hooray, it works!  I was beginning to wonder."
3533         x_cpp="$cpp"
3534         x_minus='-';
3535 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3536         $wrapper <testcpp.c >testcpp.out 2>&1; \
3537         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3538         x_cpp="$wrapper"
3539         x_minus=''
3540         echo "Eureka!"
3541 else
3542         dflt=''
3543         rp="No dice.  I can't find a C preprocessor.  Name one:"
3544         . ./myread
3545         x_cpp="$ans"
3546         x_minus=''
3547         $x_cpp <testcpp.c >testcpp.out 2>&1
3548         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3549                 echo "OK, that will do." >&4
3550         else
3551 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3552                 exit 1
3553         fi
3554 fi
3555
3556 case "$ok" in
3557 false)
3558         cppstdin="$x_cpp"
3559         cppminus="$x_minus"
3560         cpprun="$x_cpp"
3561         cpplast="$x_minus"
3562         set X $x_cpp
3563         shift
3564         case "$1" in
3565         "$cpp")
3566                 echo "Perhaps can we force $cc -E using a wrapper..."
3567                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3568                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3569                 then
3570                         echo "Yup, we can."
3571                         cppstdin="$wrapper"
3572                         cppminus='';
3573                 else
3574                         echo "Nope, we'll have to live without it..."
3575                 fi
3576                 ;;
3577         esac
3578         case "$cpprun" in
3579         "$wrapper")
3580                 cpprun=''
3581                 cpplast=''
3582                 ;;
3583         esac
3584         ;;
3585 esac
3586
3587 case "$cppstdin" in
3588 "$wrapper"|'cppstdin') ;;
3589 *) $rm -f $wrapper;;
3590 esac
3591 $rm -f testcpp.c testcpp.out
3592
3593 : Set private lib path
3594 case "$plibpth" in
3595 '') if ./mips; then
3596                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3597         fi;;
3598 esac
3599 case "$libpth" in
3600 ' ') dlist='';;
3601 '') dlist="$loclibpth $plibpth $glibpth";;
3602 *) dlist="$libpth";;
3603 esac
3604
3605 : Now check and see which directories actually exist, avoiding duplicates
3606 libpth=''
3607 for xxx in $dlist
3608 do
3609     if $test -d $xxx; then
3610                 case " $libpth " in
3611                 *" $xxx "*) ;;
3612                 *) libpth="$libpth $xxx";;
3613                 esac
3614     fi
3615 done
3616 $cat <<'EOM'
3617
3618 Some systems have incompatible or broken versions of libraries.  Among
3619 the directories listed in the question below, please remove any you
3620 know not to be holding relevant libraries, and add any that are needed.
3621 Say "none" for none.
3622
3623 EOM
3624 case "$libpth" in
3625 '') dflt='none';;
3626 *)
3627         set X $libpth
3628         shift
3629         dflt=${1+"$@"}
3630         ;;
3631 esac
3632 rp="Directories to use for library searches?"
3633 . ./myread
3634 case "$ans" in
3635 none) libpth=' ';;
3636 *) libpth="$ans";;
3637 esac
3638
3639 : compute shared library extension
3640 case "$so" in
3641 '')
3642         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3643                 dflt='sl'
3644         else
3645                 dflt='so'
3646         fi
3647         ;;
3648 *) dflt="$so";;
3649 esac
3650 $cat <<EOM
3651
3652 On some systems, shared libraries may be available.  Answer 'none' if
3653 you want to suppress searching of shared libraries for the remaining
3654 of this configuration.
3655
3656 EOM
3657 rp='What is the file extension used for shared libraries?'
3658 . ./myread
3659 so="$ans"
3660
3661 : Define several unixisms.
3662 : Hints files or command line option can be used to override them.
3663 : The convoluted testing is in case hints files set either the old
3664 : or the new name.
3665 case "$_exe" in
3666 '')     case "$exe_ext" in
3667     '') ;;
3668         *)      _exe="$exe_ext" ;;
3669         esac
3670         ;;
3671 esac
3672 case "$_a" in
3673 '')     case "$lib_ext" in
3674     '') _a='.a';;
3675         *)      _a="$lib_ext" ;;
3676         esac
3677         ;;
3678 esac
3679 case "$_o" in
3680 '') case "$obj_ext" in
3681         '')     _o='.o';;
3682         *)      _o="$obj_ext";;
3683         esac
3684         ;;
3685 esac
3686 case "$p_" in
3687 '') case "$path_sep" in
3688         '')     p_=':';;
3689         *)      p_="$path_sep";;
3690         esac
3691         ;;
3692 esac
3693 exe_ext=$_exe
3694 lib_ext=$_a
3695 obj_ext=$_o
3696 path_sep=$p_
3697
3698 : Which makefile gets called first.  This is used by make depend.
3699 case "$firstmakefile" in
3700 '') firstmakefile='makefile';;
3701 esac
3702
3703 cat <<EOM
3704
3705 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3706 Configure must be run with -Dusesocks.
3707
3708 Normally you do not need this and you should answer no.
3709
3710 EOM
3711 case "$usesocks" in
3712 $define|true|[yY]*)     dflt='y';;
3713 *) dflt='n';;
3714 esac
3715 rp='Build Perl for SOCKS?'
3716 . ./myread
3717 case "$ans" in
3718 y|Y)    val="$define" ;;     
3719 *)      val="$undef" ;;
3720 esac
3721 set usesocks
3722 eval $setvar
3723
3724 : Looking for optional libraries
3725 echo " "
3726 echo "Checking for optional libraries..." >&4
3727 case "$libs" in
3728 ' '|'') dflt='';;
3729 *) dflt="$libs";;
3730 esac
3731 case "$libswanted" in
3732 '') libswanted='c_s';;
3733 esac
3734 case "$usesocks" in
3735 $define)
3736         libswanted="$libswanted socks5 socks5_sh"
3737         ;;
3738 esac
3739 for thislib in $libswanted; do
3740         
3741         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3742                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3743                 echo "Found -l$thislib (shared)."
3744                 case " $dflt " in
3745                 *"-l$thislib "*);;
3746                 *) dflt="$dflt -l$thislib";;
3747                 esac
3748         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3749                 echo "Found -l$thislib (shared)."
3750                 case " $dflt " in
3751                 *"-l$thislib "*);;
3752                 *) dflt="$dflt -l$thislib";;
3753                 esac
3754         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3755                 echo "Found -l$thislib."
3756                 case " $dflt " in
3757                 *"-l$thislib "*);;
3758                 *) dflt="$dflt -l$thislib";;
3759                 esac
3760         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3761                 echo "Found -l$thislib."
3762                 case " $dflt " in
3763                 *"-l$thislib "*);;
3764                 *) dflt="$dflt -l$thislib";;
3765                 esac
3766         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3767                 echo "Found -l${thislib}_s."
3768                 case " $dflt " in
3769                 *"-l$thislib "*);;
3770                 *) dflt="$dflt -l${thislib}_s";;
3771                 esac
3772         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3773                 echo "Found -l$thislib."
3774                 case " $dflt " in
3775                 *"-l$thislib "*);;
3776                 *) dflt="$dflt -l$thislib";;
3777                 esac
3778         else
3779                 echo "No -l$thislib."
3780         fi
3781 done
3782 set X $dflt
3783 shift
3784 dflt="$*"
3785 case "$libs" in
3786 '') dflt="$dflt";;
3787 *) dflt="$libs";;
3788 esac
3789 case "$dflt" in
3790 ' '|'') dflt='none';;
3791 esac
3792
3793 $cat <<EOM
3794
3795 In order to compile $package on your machine, a number of libraries
3796 are usually needed.  Include any other special libraries here as well.
3797 Say "none" for none.  The default list is almost always right.
3798 EOM
3799
3800 echo " "
3801 rp="What libraries to use?"
3802 . ./myread
3803 case "$ans" in
3804 none) libs=' ';;
3805 *) libs="$ans";;
3806 esac
3807
3808 : determine optimization, if desired, or use for debug flag also
3809 case "$optimize" in
3810 ' '|$undef) dflt='none';;
3811 '') dflt='-O';;
3812 *) dflt="$optimize";;
3813 esac
3814 $cat <<EOH
3815
3816 By default, $package compiles with the -O flag to use the optimizer.
3817 Alternately, you might want to use the symbolic debugger, which uses
3818 the -g flag (on traditional Unix systems).  Either flag can be
3819 specified here.  To use neither flag, specify the word "none".
3820
3821 EOH
3822 rp="What optimizer/debugger flag should be used?"
3823 . ./myread
3824 optimize="$ans"
3825 case "$optimize" in
3826 'none') optimize=" ";;
3827 esac
3828
3829 dflt=''
3830 : We will not override a previous value, but we might want to
3831 : augment a hint file
3832 case "$hint" in
3833 default|recommended)
3834         case "$gccversion" in
3835         1*) dflt='-fpcc-struct-return' ;;
3836         esac
3837         case "$optimize" in
3838         *-g*) dflt="$dflt -DDEBUGGING";;
3839         esac
3840         case "$gccversion" in
3841         2*) if test -d /etc/conf/kconfig.d &&
3842                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3843                 then
3844                         dflt="$dflt -posix"
3845                 fi
3846                 ;;
3847         esac
3848         case "$gccversion" in
3849         1*) ;;
3850         2.[0-8]*) ;;
3851         ?*)     echo " "
3852                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3853                 echo 'int main(void) { return 0; }' > gcctest.c
3854                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3855                         echo "Yes, it does." 2>&1
3856                         case "$ccflags" in
3857                         *strict-aliasing*) 
3858                                 echo "Leaving current flags $ccflags alone." 2>&1
3859                                 ;;
3860                         *) dflt="$dflt -fno-strict-aliasing" ;;
3861                         esac
3862                 else
3863                         echo "Nope, it doesn't, but that's ok." 2>&1
3864                 fi
3865                 ;;
3866         esac
3867         ;;
3868 esac
3869
3870 case "$mips_type" in
3871 *BSD*|'') inclwanted="$locincpth $usrinc";;
3872 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3873 esac
3874 for thisincl in $inclwanted; do
3875         if $test -d $thisincl; then
3876                 if $test x$thisincl != x$usrinc; then
3877                         case "$dflt" in
3878                         *$thisincl*);;
3879                         *) dflt="$dflt -I$thisincl";;
3880                         esac
3881                 fi
3882         fi
3883 done
3884
3885 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3886         xxx=true;
3887 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3888         xxx=true;
3889 else
3890         xxx=false;
3891 fi;
3892 if $xxx; then
3893         case "$dflt" in
3894         *$2*);;
3895         *) dflt="$dflt -D$2";;
3896         esac;
3897 fi'
3898
3899 set signal.h LANGUAGE_C; eval $inctest
3900
3901 case "$usesocks" in
3902 $define)
3903         ccflags="$ccflags -DSOCKS"
3904         ;;
3905 esac
3906
3907 case "$hint" in
3908 default|recommended) dflt="$ccflags $dflt" ;;
3909 *) dflt="$ccflags";;
3910 esac
3911
3912 case "$dflt" in
3913 ''|' ') dflt=none;;
3914 esac
3915 $cat <<EOH
3916
3917 Your C compiler may want other flags.  For this question you should include
3918 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3919 but you should NOT include libraries or ld flags like -lwhatever.  If you
3920 want $package to honor its debug switch, you should include -DDEBUGGING here.
3921 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3922
3923 To use no flags, specify the word "none".
3924
3925 EOH
3926 set X $dflt
3927 shift
3928 dflt=${1+"$@"}
3929 rp="Any additional cc flags?"
3930 . ./myread
3931 case "$ans" in
3932 none) ccflags='';;
3933 *) ccflags="$ans";;
3934 esac
3935
3936 : the following weeds options from ccflags that are of no interest to cpp
3937 cppflags="$ccflags"
3938 case "$gccversion" in
3939 1*) cppflags="$cppflags -D__GNUC__"
3940 esac
3941 case "$mips_type" in
3942 '');;
3943 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3944 esac
3945 case "$cppflags" in
3946 '');;
3947 *)
3948         echo " "
3949         echo "Let me guess what the preprocessor flags are..." >&4
3950         set X $cppflags
3951         shift
3952         cppflags=''
3953         $cat >cpp.c <<'EOM'
3954 #define BLURFL foo
3955
3956 BLURFL xx LFRULB
3957 EOM
3958         previous=''
3959         for flag in $*
3960         do
3961                 case "$flag" in
3962                 -*) ftry="$flag";;
3963                 *) ftry="$previous $flag";;
3964                 esac
3965                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3966                         >cpp1.out 2>/dev/null && \
3967                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3968                         >cpp2.out 2>/dev/null && \
3969                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3970                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3971                 then
3972                         cppflags="$cppflags $ftry"
3973                         previous=''
3974                 else
3975                         previous="$flag"
3976                 fi
3977         done
3978         set X $cppflags
3979         shift
3980         cppflags=${1+"$@"}
3981         case "$cppflags" in
3982         *-*)  echo "They appear to be: $cppflags";;
3983         esac
3984         $rm -f cpp.c cpp?.out
3985         ;;
3986 esac
3987
3988 : flags used in final linking phase
3989 case "$ldflags" in
3990 '') if ./venix; then
3991                 dflt='-i -z'
3992         else
3993                 dflt=''
3994         fi
3995         case "$ccflags" in
3996         *-posix*) dflt="$dflt -posix" ;;
3997         esac
3998         ;;
3999 *) dflt="$ldflags";;
4000 esac
4001
4002 : Try to guess additional flags to pick up local libraries.
4003 for thislibdir in $libpth; do
4004         case " $loclibpth " in
4005         *" $thislibdir "*)
4006                 case "$dflt " in 
4007                 *"-L$thislibdir "*) ;;
4008                 *)  dflt="$dflt -L$thislibdir" ;;
4009                 esac
4010                 ;;
4011         esac
4012 done
4013
4014 case "$dflt" in
4015 '') dflt='none' ;;
4016 esac
4017
4018 $cat <<EOH
4019
4020 Your C linker may need flags.  For this question you should
4021 include -L/whatever and any other flags used by the C linker, but you
4022 should NOT include libraries like -lwhatever.
4023
4024 Make sure you include the appropriate -L/path flags if your C linker
4025 does not normally search all of the directories you specified above,
4026 namely
4027         $libpth
4028 To use no flags, specify the word "none".
4029
4030 EOH
4031
4032 rp="Any additional ld flags (NOT including libraries)?"
4033 . ./myread
4034 case "$ans" in
4035 none) ldflags='';;
4036 *) ldflags="$ans";;
4037 esac
4038 rmlist="$rmlist pdp11"
4039
4040 : coherency check
4041 echo " "
4042 echo "Checking your choice of C compiler and flags for coherency..." >&4
4043 $cat > try.c <<'EOF'
4044 #include <stdio.h>
4045 int main() { printf("Ok\n"); exit(0); }
4046 EOF
4047 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4048 shift
4049 $cat >try.msg <<'EOM'
4050 I've tried to compile and run the following simple program:
4051
4052 EOM
4053 $cat try.c >> try.msg
4054
4055 $cat >> try.msg <<EOM
4056
4057 I used the command:
4058
4059         $*
4060         ./try
4061
4062 and I got the following output:
4063
4064 EOM
4065 dflt=y
4066 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4067         if sh -c './try' >>try.msg 2>&1; then
4068                 xxx=`./try`
4069                 case "$xxx" in
4070                 "Ok") dflt=n ;;
4071                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4072                         case " $libs " in
4073                         *" -lsfio "*)
4074                                 cat >> try.msg <<'EOQS'
4075 If $libs contains -lsfio, and sfio is mis-configured, then it
4076 sometimes (apparently) runs and exits with a 0 status, but with no
4077 output!  It may have to do with sfio's use of _exit vs. exit.
4078
4079 EOQS
4080                                 rp="You have a big problem.  Shall I abort Configure"
4081                                 dflt=y
4082                                 ;;
4083                         esac
4084                         ;;
4085                 esac
4086         else
4087                 echo "The program compiled OK, but exited with status $?." >>try.msg
4088                 rp="You have a problem.  Shall I abort Configure"
4089                 dflt=y
4090         fi
4091 else
4092         echo "I can't compile the test program." >>try.msg
4093         rp="You have a BIG problem.  Shall I abort Configure"
4094         dflt=y
4095 fi
4096 case "$dflt" in
4097 y)
4098         $cat try.msg >&4
4099         case "$knowitall" in
4100         '')
4101                 echo "(The supplied flags or libraries might be incorrect.)"
4102                 ;;
4103         *) dflt=n;;
4104         esac
4105         echo " "
4106         . ./myread
4107         case "$ans" in
4108         n*|N*) ;;
4109         *)      echo "Ok.  Stopping Configure." >&4
4110                 exit 1
4111                 ;;
4112         esac
4113         ;;
4114 n) echo "OK, that should do.";;
4115 esac
4116 $rm -f try try.* core
4117
4118 : define an is-a-typedef? function
4119 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4120 case "$inclist" in
4121 "") inclist="sys/types.h";;
4122 esac;
4123 eval "varval=\$$var";
4124 case "$varval" in
4125 "")
4126         $rm -f temp.c;
4127         for inc in $inclist; do
4128                 echo "#include <$inc>" >>temp.c;
4129         done;
4130         echo "#ifdef $type" >> temp.c;
4131         echo "printf(\"We have $type\");" >> temp.c;
4132         echo "#endif" >> temp.c;
4133         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4134         if $contains $type temp.E >/dev/null 2>&1; then
4135                 eval "$var=\$type";
4136         else
4137                 eval "$var=\$def";
4138         fi;
4139         $rm -f temp.?;;
4140 *) eval "$var=\$varval";;
4141 esac'
4142
4143 : define an is-a-typedef? function that prompts if the type is not available.
4144 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4145 case "$inclist" in
4146 "") inclist="sys/types.h";;
4147 esac;
4148 eval "varval=\$$var";
4149 case "$varval" in
4150 "")
4151         $rm -f temp.c;
4152         for inc in $inclist; do
4153                 echo "#include <$inc>" >>temp.c;
4154         done;
4155         echo "#ifdef $type" >> temp.c;
4156         echo "printf(\"We have $type\");" >> temp.c;
4157         echo "#endif" >> temp.c;
4158         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4159         echo " " ;
4160         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4161         if $contains $type temp.E >/dev/null 2>&1; then
4162                 echo "$type found." >&4;
4163                 eval "$var=\$type";
4164         else
4165                 echo "$type NOT found." >&4;
4166                 dflt="$def";
4167                 . ./myread ;
4168                 eval "$var=\$ans";
4169         fi;
4170         $rm -f temp.?;;
4171 *) eval "$var=\$varval";;
4172 esac'
4173
4174 : define a shorthand compile call
4175 compile='
4176 mc_file=$1;
4177 shift;
4178 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4179 : define a shorthand compile call for compilations that should be ok.
4180 compile_ok='
4181 mc_file=$1;
4182 shift;
4183 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4184
4185 : check for lengths of integral types
4186 echo " "
4187 case "$intsize" in
4188 '')
4189         echo "Checking to see how big your integers are..." >&4
4190         $cat >intsize.c <<'EOCP'
4191 #include <stdio.h>
4192 int main()
4193 {
4194         printf("intsize=%d;\n", (int)sizeof(int));
4195         printf("longsize=%d;\n", (int)sizeof(long));
4196         printf("shortsize=%d;\n", (int)sizeof(short));
4197         exit(0);
4198 }
4199 EOCP
4200         set intsize
4201         if eval $compile_ok && ./intsize > /dev/null; then
4202                 eval `./intsize`
4203                 echo "Your integers are $intsize bytes long."
4204                 echo "Your long integers are $longsize bytes long."
4205                 echo "Your short integers are $shortsize bytes long."
4206         else
4207                 $cat >&4 <<EOM
4208 !
4209 Help! I can't compile and run the intsize test program: please enlighten me!
4210 (This is probably a misconfiguration in your system or libraries, and
4211 you really ought to fix it.  Still, I'll try anyway.)
4212 !
4213 EOM
4214                 dflt=4
4215                 rp="What is the size of an integer (in bytes)?"
4216                 . ./myread
4217                 intsize="$ans"
4218                 dflt=$intsize
4219                 rp="What is the size of a long integer (in bytes)?"
4220                 . ./myread
4221                 longsize="$ans"
4222                 dflt=2
4223                 rp="What is the size of a short integer (in bytes)?"
4224                 . ./myread
4225                 shortsize="$ans"
4226         fi
4227         ;;
4228 esac
4229 $rm -f intsize intsize.*
4230
4231 : see what type lseek is declared as in the kernel
4232 rp="What is the type used for lseek's offset on this system?"
4233 set off_t lseektype long stdio.h sys/types.h
4234 eval $typedef_ask
4235
4236 echo " "
4237 $echo $n "Checking to see how big your file offsets are...$c" >&4
4238 $cat >try.c <<EOCP
4239 #include <sys/types.h>
4240 #include <stdio.h>
4241 int main()
4242 {
4243     printf("%d\n", (int)sizeof($lseektype));
4244     return(0); 
4245 }
4246 EOCP
4247 set try
4248 if eval $compile_ok; then
4249         lseeksize=`./try`
4250         $echo " $lseeksize bytes." >&4
4251 else
4252         dflt=$longsize
4253         echo " "
4254         echo "(I can't seem to compile the test program.  Guessing...)"
4255         rp="What is the size of your file offsets (in bytes)?"
4256         . ./myread
4257         lseeksize="$ans"
4258 fi
4259 $rm -f try.c try
4260
4261 : see what type file positions are declared as in the library
4262 rp="What is the type for file position used by fsetpos()?"
4263 set fpos_t fpostype long stdio.h sys/types.h
4264 eval $typedef_ask
4265
4266 echo " "
4267 case "$fpostype" in
4268 *_t) zzz="$fpostype"    ;;
4269 *)   zzz="fpos_t"       ;;
4270 esac
4271 $echo $n "Checking the size of $zzz...$c" >&4 
4272 cat > try.c <<EOCP
4273 #include <sys/types.h>
4274 #include <stdio.h>
4275 int main() {
4276     printf("%d\n", (int)sizeof($fpostype));
4277     exit(0);
4278 }
4279 EOCP
4280 set try
4281 if eval $compile_ok; then
4282         yyy=`./try`
4283         case "$yyy" in
4284         '')     fpossize=4
4285                 echo " "
4286                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4287                 ;;
4288         *)      fpossize=$yyy
4289                 echo " $fpossize bytes."
4290                 ;;
4291         esac
4292 else
4293         dflt="$longsize"
4294         echo " "
4295         echo "(I can't compile the test program.  Guessing...)" >&4
4296         rp="What is the size of your file positions (in bytes)?"
4297         . ./myread
4298         fpossize="$ans"
4299 fi
4300
4301
4302
4303 case "$lseeksize:$fpossize" in
4304 8:8) cat <<EOM
4305
4306 You can have files larger than 2 gigabytes.
4307 EOM
4308    val="$define" ;;
4309 *) cat <<EOM
4310
4311 Perl can be built to understand large files (files larger than 2 gigabytes)
4312 on some systems.  To do so, Configure must be run with -Duselargefiles.
4313
4314 If this doesn't make any sense to you, just accept the default 'y'.
4315 EOM
4316    case "$uselargefiles" in
4317    "$undef"|false|[nN]*) dflt='n' ;;
4318    *)   dflt='y' ;;
4319    esac
4320    rp='Try to understand large files, if available?'
4321    . ./myread
4322    case "$ans" in
4323    y|Y)         val="$define" ;;
4324    *)           val="$undef"  ;;
4325    esac
4326    ;;
4327 esac
4328 set uselargefiles
4329 eval $setvar
4330 case "$uselargefiles" in
4331 "$define")
4332 : Look for a hint-file generated 'call-back-unit'.  If the
4333 : user has specified that a large files perl is to be built,
4334 : we may need to set or change some other defaults.
4335         if $test -f uselfs.cbu; then
4336                 echo "Your platform has some specific hints for large file builds, using them..."
4337                 . ./uselfs.cbu
4338                 echo " "
4339                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4340                 $cat >try.c <<EOCP
4341 #include <sys/types.h>
4342 #include <stdio.h>
4343 int main()
4344 {
4345     printf("%d\n", (int)sizeof($lseektype));
4346     return(0); 
4347 }
4348 EOCP
4349                 set try
4350                 if eval $compile_ok; then
4351                         lseeksize=`./try`
4352                         $echo " $lseeksize bytes." >&4
4353                 else
4354                         dflt="$lseeksize"
4355                         echo " "
4356                         echo "(I can't seem to compile the test program.  Guessing...)"
4357                         rp="What is the size of your file offsets (in bytes)?"
4358                         . ./myread
4359                         lseeksize="$ans"
4360                 fi
4361                 case "$fpostype" in
4362                 *_t) zzz="$fpostype"    ;;
4363                 *)   zzz="fpos_t"       ;;
4364                 esac
4365                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4366                 $cat > try.c <<EOCP
4367 #include <sys/types.h>
4368 #include <stdio.h>
4369 int main() {
4370     printf("%d\n", (int)sizeof($fpostype));
4371     exit(0);
4372 }
4373 EOCP
4374                 set try
4375                 if eval $compile_ok; then
4376                         yyy=`./try`
4377                         dflt="$lseeksize"
4378                         case "$yyy" in
4379                         '')     echo " "
4380                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4381                                 ;;
4382                         *)      fpossize=$yyy
4383                                 echo " $fpossize bytes."
4384                                 ;;
4385                         esac
4386                 else
4387                         dflt="$fpossize"
4388                         echo " "
4389                         echo "(I can't compile the test program.  Guessing...)" >&4
4390                         rp="What is the size of your file positions (in bytes)?"
4391                         . ./myread
4392                         fpossize="$ans"
4393                 fi
4394                 $rm -f try.c try
4395         fi
4396         ;;
4397 esac
4398
4399
4400 case "$usemorebits" in
4401 "$define"|true|[yY]*)
4402         use64bits="$define"
4403         uselongdouble="$define"
4404         usemorebits="$define"
4405         ;;
4406 *)      usemorebits="$undef"
4407         ;;
4408 esac
4409
4410
4411 case "$intsize:$longsize" in
4412 8:*|*:8) cat <<EOM
4413
4414 You have natively 64-bit integers.
4415 EOM
4416    val="$define" ;;
4417 *) cat <<EOM
4418
4419 Perl can be built to take advantage of 64-bit integer types
4420 on some systems.  To do so, Configure must be run with -Duse64bits.
4421
4422 If this doesn't make any sense to you, just accept the default.
4423 EOM
4424   case "$use64bits" in
4425   $define|true|[yY]*)   dflt='y';;
4426   *) dflt='n';;
4427   esac
4428   rp='Try to use 64-bit integers, if available?'
4429   . ./myread
4430   case "$ans" in
4431   y|Y) val="$define" ;;
4432   *)   val="$undef"  ;;
4433   esac
4434   ;;
4435 esac
4436 set use64bits
4437 eval $setvar
4438
4439 case "$archname64" in
4440 '') archname64='' ;;    # not a typo
4441 esac
4442
4443 case "$use64bits" in
4444 "$define"|true|[yY]*)
4445 : Look for a hint-file generated 'call-back-unit'.  If the
4446 : user has specified that a 64-bit perl is to be built,
4447 : we may need to set or change some other defaults.
4448         if $test -f use64bits.cbu; then
4449                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4450                 . ./use64bits.cbu
4451         else
4452                 $cat <<EOM
4453 (Your platform doesn't have any specific hints for 64-bit builds.)
4454 EOM
4455                 case "$intsize:$longsize" in
4456 8:*|*:8) cat <<EOM
4457 (This is probably okay, as your system is a natively 64-bit system.)
4458 EOM
4459                   ;;
4460                 esac
4461                 case "$gccversion" in
4462                 '')     ;;
4463                 *)      case "$ccflags" in
4464                         *-DUSE_LONG_LONG*) ;;
4465                         *) $cat <<EOM
4466 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4467 to the compilation flags.
4468 EOM
4469                            ccflags="$ccflags -DUSE_LONG_LONG"
4470                            ;;
4471                         esac
4472                         ;;
4473                 esac
4474         fi
4475         ;;
4476 esac
4477
4478 : determine the architecture name
4479 echo " "
4480 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4481         tarch=`arch`"-$osname"
4482 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4483         if uname -m > tmparch 2>&1 ; then
4484                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4485                         -e 's/$/'"-$osname/" tmparch`
4486         else
4487                 tarch="$osname"
4488         fi
4489         $rm -f tmparch
4490 else
4491         tarch="$osname"
4492 fi
4493 case "$myarchname" in
4494 ''|"$tarch") ;;
4495 *)
4496         echo "(Your architecture name used to be $myarchname.)"
4497         archname=''
4498         ;;
4499 esac
4500 myarchname="$tarch"
4501 case "$archname" in
4502 '') dflt="$tarch";;
4503 *) dflt="$archname";;
4504 esac
4505 rp='What is your architecture name'
4506 . ./myread
4507 archname="$ans"
4508 case "$usethreads" in
4509 $define)
4510         echo "Threads selected." >&4
4511         case "$archname" in
4512         *-thread*) echo "...and architecture name already has -thread." >&4
4513                 ;;
4514         *)      archname="$archname-thread"
4515                 echo "...setting architecture name to $archname." >&4
4516                 ;;
4517         esac
4518         ;;
4519 esac
4520 case "$usemultiplicity" in
4521 $define)
4522         echo "Multiplicity selected." >&4
4523         case "$archname" in
4524         *-multi*) echo "...and architecture name already has -multi." >&4
4525                 ;;
4526         *)      archname="$archname-multi"
4527                 echo "...setting architecture name to $archname." >&4
4528                 ;;
4529         esac
4530         ;;
4531 esac
4532 case "$use64bits" in
4533 $define)
4534         case "$archname64" in
4535         '')
4536                 ;;
4537         *)
4538                 case "$archname" in
4539                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4540                         ;;
4541                 *)      archname="$archname-$archname64"
4542                         echo "...setting architecture name to $archname." >&4
4543                         ;;
4544                 esac
4545                 ;;
4546         esac
4547 esac
4548
4549 : determine root of directory hierarchy where package will be installed.
4550 case "$prefix" in
4551 '')
4552         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4553         ;;
4554 *)
4555         dflt="$prefix"
4556         ;;
4557 esac
4558 $cat <<EOM
4559
4560 By default, $package will be installed in $dflt/bin, manual pages
4561 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4562 installation directories. Typically this is something like /usr/local.
4563 If you wish to have binaries under /usr/bin but other parts of the
4564 installation under /usr/local, that's ok: you will be prompted
4565 separately for each of the installation directories, the prefix being
4566 only used to set the defaults.
4567
4568 EOM
4569 fn=d~
4570 rp='Installation prefix to use?'
4571 . ./getfile
4572 oldprefix=''
4573 case "$prefix" in
4574 '') ;;
4575 *)
4576         case "$ans" in
4577         "$prefix") ;;
4578         *) oldprefix="$prefix";;
4579         esac
4580         ;;
4581 esac
4582 prefix="$ans"
4583 prefixexp="$ansexp"
4584
4585 : is AFS running?
4586 echo " "
4587 case "$afs" in
4588 $define|true)   afs=true ;;
4589 $undef|false)   afs=false ;;
4590 *)      if test -d /afs; then
4591                 afs=true
4592         else
4593                 afs=false
4594         fi
4595         ;;
4596 esac
4597 if $afs; then
4598         echo "AFS may be running... I'll be extra cautious then..." >&4
4599 else
4600         echo "AFS does not seem to be running..." >&4
4601 fi
4602
4603 : determine installation prefix for where package is to be installed.
4604 if $afs; then 
4605 $cat <<EOM
4606
4607 Since you are running AFS, I need to distinguish the directory in which
4608 files will reside from the directory in which they are installed (and from
4609 which they are presumably copied to the former directory by occult means).
4610
4611 EOM
4612         case "$installprefix" in
4613         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4614         *) dflt="$installprefix";;
4615         esac
4616 else
4617 $cat <<EOM
4618
4619 In some special cases, particularly when building $package for distribution,
4620 it is convenient to distinguish between the directory in which files should 
4621 be installed from the directory ($prefix) in which they 
4622 will eventually reside.  For most users, these two directories are the same.
4623
4624 EOM
4625         case "$installprefix" in
4626         '') dflt=$prefix ;;
4627         *) dflt=$installprefix;;
4628         esac
4629 fi
4630 fn=d~
4631 rp='What installation prefix should I use for installing files?'
4632 . ./getfile
4633 installprefix="$ans"
4634 installprefixexp="$ansexp"
4635
4636 : set the prefixit variable, to compute a suitable default value
4637 prefixit='case "$3" in
4638 ""|none)
4639         case "$oldprefix" in
4640         "") eval "$1=\"\$$2\"";;
4641         *)
4642                 case "$3" in
4643                 "") eval "$1=";;
4644                 none)
4645                         eval "tp=\"\$$2\"";
4646                         case "$tp" in
4647                         ""|" ") eval "$1=\"\$$2\"";;
4648                         *) eval "$1=";;
4649                         esac;;
4650                 esac;;
4651         esac;;
4652 *)
4653         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4654         case "$tp" in
4655         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4656         /*-$oldprefix/*|\~*-$oldprefix/*)
4657                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4658         *) eval "$1=\"\$$2\"";;
4659         esac;;
4660 esac'
4661
4662 : set the base revision
4663 baserev=5.0
4664
4665
4666 : get the patchlevel
4667 echo " "
4668 echo "Getting the current patchlevel..." >&4
4669 if $test -r $rsrc/patchlevel.h;then
4670         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4671         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4672         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4673         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4674         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4675 else
4676         patchlevel=0
4677         subversion=0
4678         api_revision=0
4679         api_version=0
4680         api_subversion=0
4681 fi
4682 $echo $n "(You have $package" $c
4683 case "$package" in
4684 "*$baserev")    ;;
4685 *)              $echo $n " $baserev" $c ;;
4686 esac
4687 $echo $n " patchlevel $patchlevel" $c
4688 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4689 echo ".)"
4690 case "$osname" in
4691 dos|cygwin|vms|win32)
4692         : XXX Should be a Configure test for double-dots in filenames.
4693         version=`echo $baserev $patchlevel $subversion | \
4694                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4695         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4696                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4697         ;;
4698 *)
4699         version=`echo $baserev $patchlevel $subversion | \
4700                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4701         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4702                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4703         ;;
4704 esac
4705 : Special case the 5.005_xx maintenance series, which used 5.005
4706 : without any subversion label as a subdirectory in $sitelib
4707 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4708         api_versionstring='5.005'
4709 fi
4710
4711 : determine installation style
4712 : For now, try to deduce it from prefix unless it is already set.
4713 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4714 case "$installstyle" in
4715 '')     case "$prefix" in
4716                 *perl*) dflt='lib';;
4717                 *) dflt='lib/perl5' ;;
4718         esac
4719         ;;
4720 *)      dflt='lib/perl5' ;;
4721 esac
4722 : Probably not worth prompting for this since we prompt for all
4723 : the directories individually, and the prompt would be too long and
4724 : confusing anyway.
4725 installstyle=$dflt
4726
4727 : determine where private library files go
4728 : Usual default is /usr/local/lib/perl5/$version.
4729 : Also allow things like /opt/perl/lib/$version, since 
4730 : /opt/perl/lib/perl5... would be redundant.
4731 : The default "style" setting is made in installstyle.U
4732 case "$installstyle" in
4733 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4734 *)       set dflt privlib lib/$version ;;
4735 esac
4736 eval $prefixit
4737 $cat <<EOM
4738
4739 There are some auxiliary files for $package that need to be put into a
4740 private library directory that is accessible by everyone.
4741
4742 EOM
4743 fn=d~+
4744 rp='Pathname where the private library files will reside?'
4745 . ./getfile
4746 privlib="$ans"
4747 privlibexp="$ansexp"
4748 : Change installation prefix, if necessary.
4749 if $test X"$prefix" != X"$installprefix"; then
4750         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4751 else
4752         installprivlib="$privlibexp"
4753 fi
4754
4755 : set the prefixup variable, to restore leading tilda escape
4756 prefixup='case "$prefixexp" in
4757 "$prefix") ;;
4758 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4759 esac'
4760
4761 : determine where public architecture dependent libraries go
4762 set archlib archlib
4763 eval $prefixit
4764 : privlib default is /usr/local/lib/$package/$version
4765 : archlib default is /usr/local/lib/$package/$version/$archname
4766 : privlib may have an optional trailing /share.
4767 tdflt=`echo $privlib | $sed 's,/share$,,'`
4768 tdflt=$tdflt/$archname
4769 case "$archlib" in
4770 '')     dflt=$tdflt
4771         ;;
4772 *)      dflt="$archlib"
4773     ;;
4774 esac
4775 $cat <<EOM
4776
4777 $spackage contains architecture-dependent library files.  If you are
4778 sharing libraries in a heterogeneous environment, you might store
4779 these files in a separate location.  Otherwise, you can just include
4780 them with the rest of the public library files.
4781
4782 EOM
4783 fn=d+~
4784 rp='Where do you want to put the public architecture-dependent libraries?'
4785 . ./getfile
4786 archlib="$ans"
4787 archlibexp="$ansexp"
4788 if $test X"$archlib" = X"$privlib"; then
4789         d_archlib="$undef"
4790 else
4791         d_archlib="$define"
4792 fi
4793 : Change installation prefix, if necessary.
4794 if $test X"$prefix" != X"$installprefix"; then
4795         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4796 else
4797         installarchlib="$archlibexp"
4798 fi
4799
4800
4801 : Binary compatibility with 5.005 is not possible for builds
4802 : with advanced features
4803 case "$usethreads$usemultiplicity" in
4804 *define*)
4805         bincompat5005="$undef"
4806         d_bincompat5005="$undef"
4807         ;;
4808 *)      $cat <<EOM
4809
4810 Perl 5.006 can be compiled for binary compatibility with 5.005.
4811 If you decide to do so, you will be able to continue using most
4812 of the extensions that were compiled for Perl 5.005.
4813
4814 EOM
4815         case "$bincompat5005$d_bincompat5005" in
4816         *"$undef"*) dflt=n ;;
4817         *) dflt=y ;;
4818         esac
4819         rp='Binary compatibility with Perl 5.005?'
4820         . ./myread
4821         case "$ans" in
4822         y*) val="$define" ;;
4823         *)  val="$undef" ;;
4824         esac
4825         set d_bincompat5005
4826         eval $setvar
4827         case "$d_bincompat5005" in
4828         "$define")
4829                 bincompat5005="$define"
4830                 ;;
4831         *)      bincompat5005="$undef"
4832                 d_bincompat5005="$undef"
4833                 ;;
4834         esac
4835         ;;
4836 esac
4837
4838
4839 : see if setuid scripts can be secure
4840 $cat <<EOM
4841
4842 Some kernels have a bug that prevents setuid #! scripts from being
4843 secure.  Some sites have disabled setuid #! scripts because of this.
4844
4845 First let's decide if your kernel supports secure setuid #! scripts.
4846 (If setuid #! scripts would be secure but have been disabled anyway,
4847 don't say that they are secure if asked.)
4848
4849 EOM
4850
4851 val="$undef"
4852 if $test -d /dev/fd; then
4853         echo "#!$ls" >reflect
4854         chmod +x,u+s reflect
4855         ./reflect >flect 2>&1
4856         if $contains "/dev/fd" flect >/dev/null; then
4857                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4858                 val="$define"
4859         else
4860                 $cat <<EOM
4861 If you are not sure if they are secure, I can check but I'll need a
4862 username and password different from the one you are using right now.
4863 If you don't have such a username or don't want me to test, simply
4864 enter 'none'.
4865
4866 EOM
4867                 rp='Other username to test security of setuid scripts with?'
4868                 dflt='none'
4869                 . ./myread
4870                 case "$ans" in
4871                 n|none)
4872                         case "$d_suidsafe" in
4873                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4874                                 dflt=n;;
4875                         "$undef")
4876                                 echo "Well, the $hint value is *not* secure." >&4
4877                                 dflt=n;;
4878                         *)      echo "Well, the $hint value *is* secure." >&4
4879                                 dflt=y;;
4880                         esac
4881                         ;;
4882                 *)
4883                         $rm -f reflect flect
4884                         echo "#!$ls" >reflect
4885                         chmod +x,u+s reflect
4886                         echo >flect
4887                         chmod a+w flect
4888                         echo '"su" will (probably) prompt you for '"$ans's password."
4889                         su $ans -c './reflect >flect'
4890                         if $contains "/dev/fd" flect >/dev/null; then
4891                                 echo "Okay, it looks like setuid scripts are secure." >&4
4892                                 dflt=y
4893                         else
4894                                 echo "I don't think setuid scripts are secure." >&4
4895                                 dflt=n
4896                         fi
4897                         ;;
4898                 esac
4899                 rp='Does your kernel have *secure* setuid scripts?'
4900                 . ./myread
4901                 case "$ans" in
4902                 [yY]*)  val="$define";;
4903                 *)      val="$undef";;
4904                 esac
4905         fi
4906 else
4907         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4908         echo "(That's for file descriptors, not floppy disks.)"
4909         val="$undef"
4910 fi
4911 set d_suidsafe
4912 eval $setvar
4913
4914 $rm -f reflect flect
4915
4916 : now see if they want to do setuid emulation
4917 echo " "
4918 val="$undef"
4919 case "$d_suidsafe" in
4920 "$define")
4921         val="$undef"
4922         echo "No need to emulate SUID scripts since they are secure here." >& 4
4923         ;;
4924 *)
4925         $cat <<EOM
4926 Some systems have disabled setuid scripts, especially systems where
4927 setuid scripts cannot be secure.  On systems where setuid scripts have
4928 been disabled, the setuid/setgid bits on scripts are currently
4929 useless.  It is possible for $package to detect those bits and emulate
4930 setuid/setgid in a secure fashion.  This emulation will only work if
4931 setuid scripts have been disabled in your kernel.
4932
4933 EOM
4934         case "$d_dosuid" in
4935         "$define") dflt=y ;;
4936         *) dflt=n ;;
4937         esac
4938         rp="Do you want to do setuid/setgid emulation?"
4939         . ./myread
4940         case "$ans" in
4941         [yY]*)  val="$define";;
4942         *)      val="$undef";;
4943         esac
4944         ;;
4945 esac
4946 set d_dosuid
4947 eval $setvar
4948
4949 : determine filename position in cpp output
4950 echo " "
4951 echo "Computing filename position in cpp output for #include directives..." >&4
4952 echo '#include <stdio.h>' > foo.c
4953 $cat >fieldn <<EOF
4954 $startsh
4955 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4956 $grep '^[       ]*#.*stdio\.h' | \
4957 while read cline; do
4958         pos=1
4959         set \$cline
4960         while $test \$# -gt 0; do
4961                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4962                         echo "\$pos"
4963                         exit 0
4964                 fi
4965                 shift
4966                 pos=\`expr \$pos + 1\`
4967         done
4968 done
4969 EOF
4970 chmod +x fieldn
4971 fieldn=`./fieldn`
4972 $rm -f foo.c fieldn
4973 case $fieldn in
4974 '') pos='???';;
4975 1) pos=first;;
4976 2) pos=second;;
4977 3) pos=third;;
4978 *) pos="${fieldn}th";;
4979 esac
4980 echo "Your cpp writes the filename in the $pos field of the line."
4981
4982 : locate header file
4983 $cat >findhdr <<EOF
4984 $startsh
4985 wanted=\$1
4986 name=''
4987 for usrincdir in $usrinc
4988 do
4989         if test -f \$usrincdir/\$wanted; then
4990                 echo "\$usrincdir/\$wanted"
4991                 exit 0
4992         fi
4993 done
4994 awkprg='{ print \$$fieldn }'
4995 echo "#include <\$wanted>" > foo\$\$.c
4996 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4997 $grep "^[       ]*#.*\$wanted" | \
4998 while read cline; do
4999         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5000         case "\$name" in
5001         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5002         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5003         *) exit 2;;
5004         esac;
5005 done;
5006 #
5007 # status = 0: grep returned 0 lines, case statement not executed
5008 # status = 1: headerfile found
5009 # status = 2: while loop executed, no headerfile found
5010 #
5011 status=\$?
5012 $rm -f foo\$\$.c;
5013 if test \$status -eq 1; then
5014         exit 0;
5015 fi
5016 exit 1
5017 EOF
5018 chmod +x findhdr
5019
5020 : define an alternate in-header-list? function
5021 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5022 cont=true; xxf="echo \"<\$1> found.\" >&4";
5023 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5024 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5025 esac;
5026 case $# in 4) instead=instead;; *) instead="at last";; esac;
5027 while $test "$cont"; do
5028         xxx=`./findhdr $1`
5029         var=$2; eval "was=\$$2";
5030         if $test "$xxx" && $test -r "$xxx";
5031         then eval $xxf;
5032         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5033                 cont="";
5034         else eval $xxnf;
5035         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5036         set $yyy; shift; shift; yyy=$@;
5037         case $# in 0) cont="";;
5038         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5039                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5040         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5041                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5042         esac;
5043 done;
5044 while $test "$yyy";
5045 do set $yyy; var=$2; eval "was=\$$2";
5046         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5047         set $yyy; shift; shift; yyy=$@;
5048 done'
5049
5050 : see if this is a malloc.h system
5051 set malloc.h i_malloc
5052 eval $inhdr
5053
5054 : see if stdlib is available
5055 set stdlib.h i_stdlib
5056 eval $inhdr
5057
5058 : determine which malloc to compile in
5059 echo " "
5060 case "$usemymalloc" in
5061 ''|[yY]*|true|$define)  dflt='y' ;;
5062 *)      dflt='n' ;;
5063 esac
5064 rp="Do you wish to attempt to use the malloc that comes with $package?"
5065 . ./myread
5066 usemymalloc="$ans"
5067 case "$ans" in
5068 y*|true)
5069         usemymalloc='y'
5070         mallocsrc='malloc.c'
5071         mallocobj="malloc$_o"
5072         d_mymalloc="$define"
5073         case "$libs" in
5074         *-lmalloc*)
5075                 : Remove malloc from list of libraries to use
5076                 echo "Removing unneeded -lmalloc from library list" >&4
5077                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5078                 shift
5079                 libs="$*"
5080                 echo "libs = $libs" >&4
5081                 ;;
5082         esac
5083         ;;
5084 *)
5085         usemymalloc='n'
5086         mallocsrc=''
5087         mallocobj=''
5088         d_mymalloc="$undef"
5089         ;;
5090 esac
5091
5092 : compute the return types of malloc and free
5093 echo " "
5094 $cat >malloc.c <<END
5095 #$i_malloc I_MALLOC
5096 #$i_stdlib I_STDLIB
5097 #include <stdio.h>
5098 #include <sys/types.h>
5099 #ifdef I_MALLOC
5100 #include <malloc.h>
5101 #endif
5102 #ifdef I_STDLIB
5103 #include <stdlib.h>
5104 #endif
5105 #ifdef TRY_MALLOC
5106 void *malloc();
5107 #endif
5108 #ifdef TRY_FREE
5109 void free();
5110 #endif
5111 END
5112 case "$malloctype" in
5113 '')
5114         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5115                 malloctype='void *'
5116         else
5117                 malloctype='char *'
5118         fi
5119         ;;
5120 esac
5121 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5122
5123 case "$freetype" in
5124 '')
5125         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5126                 freetype='void'
5127         else
5128                 freetype='int'
5129         fi
5130         ;;
5131 esac
5132 echo "Your system uses $freetype free(), it would seem." >&4
5133 $rm -f malloc.[co]
5134 $cat <<EOM
5135
5136 The installation process will also create a directory for
5137 vendor-supplied add-ons.  Vendors who supply perl with their system
5138 may find it convenient to place all vendor-supplied files in this
5139 directory rather than in the main distribution directory.  This will
5140 ease upgrades between binary-compatible maintenance versions of perl.
5141
5142 Of course you may also use these directories in whatever way you see
5143 fit.  For example, you might use them to access modules shared over a
5144 company-wide network.
5145
5146 The default answer should be fine for most people.
5147 This causes further questions about vendor add-ons to be skipped
5148 and no vendor-specific directories will be configured for perl.
5149
5150 EOM
5151 rp='Do you want to configure vendor-specific add-on directories?'
5152 case "$usevendorprefix" in
5153 define|true|[yY]*) dflt=y ;;
5154 *) dflt=n ;;
5155 esac
5156 . ./myread
5157 case "$ans" in
5158 [yY]*)  fn=d~+
5159         rp='Installation prefix to use for vendor-supplied add-ons?'
5160         case "$vendorprefix" in
5161         '') dflt='' ;;
5162         *)  dflt=$vendorprefix ;;
5163         esac
5164         . ./getfile
5165         oldvendorprefix=''
5166         case "$vendorprefix" in
5167         '') ;;
5168         *)      case "$ans" in
5169                 "$prefix") ;;
5170                 *) oldvendorprefix="$prefix";;
5171                 esac
5172                 ;;
5173         esac
5174         usevendorprefix="$define"
5175         vendorprefix="$ans"
5176         vendorprefixexp="$ansexp"
5177         ;;
5178 *)      usevendorprefix="$undef"
5179         vendorprefix=''
5180         vendorprefixexp=''
5181         ;;
5182 esac
5183
5184 case "$vendorprefix" in
5185 '')     d_vendorlib="$undef"
5186         vendorlib=''
5187         vendorlibexp=''
5188         ;;
5189 *)      d_vendorlib="$define"
5190         : determine where vendor-supplied modules go.
5191         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5192         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5193         case "$installstyle" in
5194         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5195         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5196         esac
5197         fn=d~+
5198         rp='Pathname for the vendor-supplied library files?'
5199         . ./getfile
5200         vendorlib="$ans"
5201         vendorlibexp="$ansexp"
5202         : Change installation prefix, if necessary.
5203         if $test X"$prefix" != X"$installprefix"; then
5204                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5205         else
5206                 installvendorlib="$vendorlibexp"
5207         fi
5208         ;;
5209 esac
5210
5211 : Cruising for prototypes
5212 echo " "
5213 echo "Checking out function prototypes..." >&4
5214 $cat >prototype.c <<'EOCP'
5215 int main(int argc, char *argv[]) {
5216         exit(0);}
5217 EOCP
5218 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5219         echo "Your C compiler appears to support function prototypes."
5220         val="$define"
5221 else
5222         echo "Your C compiler doesn't seem to understand function prototypes."
5223         val="$undef"
5224 fi
5225 set prototype
5226 eval $setvar
5227 $rm -f prototype*
5228
5229 case "$prototype" in
5230 "$define") ;;
5231 *)      ansi2knr='ansi2knr'
5232         echo " "
5233         cat <<EOM >&4
5234
5235 $me:  FATAL ERROR:
5236 This version of $package can only be compiled by a compiler that 
5237 understands function prototypes.  Unfortunately, your C compiler 
5238         $cc $ccflags
5239 doesn't seem to understand them.  Sorry about that.
5240
5241 If GNU cc is available for your system, perhaps you could try that instead.  
5242
5243 Eventually, we hope to support building Perl with pre-ANSI compilers.
5244 If you would like to help in that effort, please contact <perlbug@perl.org>.
5245
5246 Aborting Configure now.
5247 EOM
5248         exit 2
5249         ;;
5250 esac
5251
5252 : determine where public executables go
5253 echo " "
5254 set dflt bin bin
5255 eval $prefixit
5256 fn=d~
5257 rp='Pathname where the public executables will reside?'
5258 . ./getfile
5259 if $test "X$ansexp" != "X$binexp"; then
5260         installbin=''
5261 fi
5262 bin="$ans"
5263 binexp="$ansexp"
5264 : Change installation prefix, if necessary.
5265 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5266 if $test X"$prefix" != X"$installprefix"; then
5267         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5268 else
5269         installbin="$binexp"
5270 fi
5271
5272 $cat <<EOM
5273
5274 After $package is installed, you may wish to install various
5275 add-on modules and utilities.  Typically, these add-ons will
5276 be installed under $prefix with the rest
5277 of this package.  However, you may wish to install such add-ons
5278 elsewhere under a different prefix.
5279
5280 If you do not wish to put everything under a single prefix, that's
5281 ok.  You will be prompted for the individual locations; this siteprefix
5282 is only used to suggest the defaults.
5283
5284 The default should be fine for most people.
5285
5286 EOM
5287 fn=d~+
5288 rp='Installation prefix to use for add-on modules and utilities?'
5289 : XXX Here might be another good place for an installstyle setting.
5290 case "$siteprefix" in
5291 '') dflt=$prefix ;;
5292 *)  dflt=$siteprefix ;;
5293 esac
5294 . ./getfile
5295 oldsiteprefix=''
5296 case "$siteprefix" in
5297 '') ;;
5298 *)
5299         case "$ans" in
5300         "$prefix") ;;
5301         *) oldsiteprefix="$prefix";;
5302         esac
5303         ;;
5304 esac
5305 siteprefix="$ans"
5306 siteprefixexp="$ansexp"
5307
5308 : determine where site specific libraries go.
5309 : Usual default is /usr/local/lib/perl5/site_perl/$version
5310 : The default "style" setting is made in installstyle.U
5311 : XXX No longer works with Prefixit stuff.
5312 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5313 case "$installstyle" in
5314 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5315 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5316 esac
5317 $cat <<EOM
5318
5319 The installation process will create a directory for
5320 site-specific extensions and modules.  Most users find it convenient
5321 to place all site-specific files in this directory rather than in the
5322 main distribution directory.
5323
5324 EOM
5325 fn=d~+
5326 rp='Pathname for the site-specific library files?'
5327 . ./getfile
5328 sitelib="$ans"
5329 sitelibexp="$ansexp"
5330 : Change installation prefix, if necessary.
5331 if $test X"$prefix" != X"$installprefix"; then
5332         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5333 else
5334         installsitelib="$sitelibexp"
5335 fi
5336
5337 : Determine list of previous versions to include in @INC
5338 $cat > getverlist <<EOPL
5339 #!$perl -w
5340 use File::Basename;
5341 \$api_versionstring = "$api_versionstring";
5342 \$version = "$version";
5343 \$sitelib = "$sitelib";
5344 \$archname = "$archname";
5345 EOPL
5346         $cat >> getverlist <<'EOPL'
5347 # Can't have leading @ because metaconfig interprets it as a command!
5348 ;@inc_version_list=();
5349 $stem=dirname($sitelib);
5350 # Redo to do opendir/readdir? 
5351 if (-d $stem) {
5352     chdir($stem);
5353     ;@candidates = glob("5.*");
5354 }
5355 else {
5356     ;@candidates = ();
5357 }
5358
5359 # XXX ToDo:  These comparisons must be reworked when two-digit
5360 # subversions come along, so that 5.7.10 compares as greater than
5361 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5362 # widespread that we can use the built-in version vectors rather
5363 # than reinventing them here.  For 5.6.0, however, we must
5364 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5365 foreach $d (@candidates) {
5366     if ($d lt $version) {
5367         if ($d ge $api_versionstring) {
5368             unshift(@inc_version_list, "$d/$archname", $d);
5369         }
5370         elsif ($d ge "5.005") {
5371             unshift(@inc_version_list, $d);
5372         }
5373     }
5374     else {
5375         # Skip newer version.  I.e. don't look in
5376         # 5.7.0 if we're installing 5.6.1.
5377     }
5378 }
5379
5380 if (@inc_version_list) {
5381     print '"';
5382     print join('", "', @inc_version_list);
5383     print '"';
5384 }
5385 else {
5386     # Blank space to preserve value for next Configure run.
5387     print " ";
5388 }
5389 EOPL
5390 chmod +x getverlist
5391 case "$inc_version_list" in
5392 '')     if test -x $perl; then
5393                 dflt=`$perl getverlist`
5394         else
5395                 dflt=''
5396         fi
5397         ;;
5398 *)  dflt="$inc_version_list" ;;
5399 esac
5400 $cat <<'EOM'
5401
5402 In order to ease the process of upgrading, this version of perl 
5403 can be configured to use modules built and installed with earlier 
5404 versions of perl that were installed under $prefix.  Specify here
5405 the list of earlier versions that this version of perl should check.
5406 If Configure detected no earlier versions of perl installed under
5407 $prefix, then the list will be empty.
5408
5409 The default should almost always be sensible, so if you're not sure,
5410 just accept the default.
5411 EOM
5412
5413 rp='list of earlier versions to include in @INC?'
5414 . ./myread
5415 inc_version_list="$ans"
5416 $rm -f getverlist
5417
5418 : determine whether to install perl also as /usr/bin/perl
5419
5420 echo " "
5421 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5422         $cat <<EOM
5423 Many scripts expect to perl to be installed as /usr/bin/perl.
5424 I can install the perl you are about to compile also as /usr/bin/perl
5425 (in addition to $installbin/perl).
5426 EOM
5427         case "$installusrbinperl" in
5428         "$undef"|[nN]*) dflt='n';;
5429         *)              dflt='y';;
5430         esac
5431         rp="Do you want to install perl as /usr/bin/perl?"
5432         . ./myread
5433         case "$ans" in
5434         [yY]*)  val="$define";;
5435         *)      val="$undef" ;;
5436         esac
5437 else
5438         val="$undef"
5439 fi
5440 set installusrbinperl
5441 eval $setvar
5442
5443 echo " "
5444 echo "Checking for GNU C Library..." >&4
5445 cat >gnulibc.c <<EOM
5446 #include <stdio.h>
5447 int main()
5448 {
5449 #ifdef __GLIBC__
5450     exit(0);
5451 #else
5452     exit(1);
5453 #endif
5454 }
5455 EOM
5456 set gnulibc
5457 if eval $compile_ok && ./gnulibc; then
5458         val="$define"
5459         echo "You are using the GNU C Library"
5460 else
5461         val="$undef"
5462         echo "You are not using the GNU C Library"
5463 fi
5464 $rm -f gnulibc*
5465 set d_gnulibc
5466 eval $setvar
5467
5468 : see if nm is to be used to determine whether a symbol is defined or not
5469 case "$usenm" in
5470 '')
5471         dflt=''
5472         case "$d_gnulibc" in
5473         "$define")
5474                 echo " "
5475                 echo "nm probably won't work on the GNU C Library." >&4
5476                 dflt=n
5477                 ;;
5478         esac
5479         case "$dflt" in
5480         '') 
5481                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5482                         echo " "
5483                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5484                         echo "'nm' won't be sufficient on this sytem." >&4
5485                         dflt=n
5486                 fi
5487                 ;;
5488         esac
5489         case "$dflt" in
5490         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5491                 if $test $dflt -gt 20; then
5492                         dflt=y
5493                 else
5494                         dflt=n
5495                 fi
5496                 ;;
5497         esac
5498         ;;
5499 *)
5500         case "$usenm" in
5501         true|$define) dflt=y;;
5502         *) dflt=n;;
5503         esac
5504         ;;
5505 esac
5506 $cat <<EOM
5507
5508 I can use $nm to extract the symbols from your C libraries. This
5509 is a time consuming task which may generate huge output on the disk (up
5510 to 3 megabytes) but that should make the symbols extraction faster. The
5511 alternative is to skip the 'nm' extraction part and to compile a small
5512 test program instead to determine whether each symbol is present. If
5513 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5514 this may be the best solution.
5515
5516 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5517
5518 EOM
5519 rp="Shall I use $nm to extract C symbols from the libraries?"
5520 . ./myread
5521 case "$ans" in
5522 [Nn]*) usenm=false;;
5523 *) usenm=true;;
5524 esac
5525
5526 runnm=$usenm
5527 case "$reuseval" in
5528 true) runnm=false;;
5529 esac
5530
5531 : nm options which may be necessary
5532 case "$nm_opt" in
5533 '') if $test -f /mach_boot; then
5534                 nm_opt=''       # Mach
5535         elif $test -d /usr/ccs/lib; then
5536                 nm_opt='-p'     # Solaris (and SunOS?)
5537         elif $test -f /dgux; then
5538                 nm_opt='-p'     # DG-UX
5539         elif $test -f /lib64/rld; then
5540                 nm_opt='-p'     # 64-bit Irix
5541         else
5542                 nm_opt=''
5543         fi;;
5544 esac
5545
5546 : nm options which may be necessary for shared libraries but illegal
5547 : for archive libraries.  Thank you, Linux.
5548 case "$nm_so_opt" in
5549 '')     case "$myuname" in
5550         *linux*)
5551                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5552                         nm_so_opt='--dynamic'
5553                 fi
5554                 ;;
5555         esac
5556         ;;
5557 esac
5558
5559 case "$runnm" in
5560 true)
5561 : get list of predefined functions in a handy place
5562 echo " "
5563 case "$libc" in
5564 '') libc=unknown
5565         case "$libs" in
5566         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5567         esac
5568         ;;
5569 esac
5570 libnames='';
5571 case "$libs" in
5572 '') ;;
5573 *)  for thislib in $libs; do
5574         case "$thislib" in
5575         -lc|-lc_s)
5576                 : Handle C library specially below.
5577                 ;;
5578         -l*)
5579                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5580                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5583                         :
5584                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5585                         :
5586                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5587                         :
5588                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5589                         :
5590                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5591                         :
5592                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5593                         :
5594                 else
5595                         try=''
5596                 fi
5597                 libnames="$libnames $try"
5598                 ;;
5599         *) libnames="$libnames $thislib" ;;
5600         esac
5601         done
5602         ;;
5603 esac
5604 xxx=normal
5605 case "$libc" in
5606 unknown)
5607         set /lib/libc.$so
5608         for xxx in $libpth; do
5609                 $test -r $1 || set $xxx/libc.$so
5610                 : The messy sed command sorts on library version numbers.
5611                 $test -r $1 || \
5612                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5613                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5614                                 h
5615                                 s/[0-9][0-9]*/0000&/g
5616                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5617                                 G
5618                                 s/\n/ /' | \
5619                          sort | $sed -e 's/^.* //'`
5620                 eval set \$$#
5621         done
5622         $test -r $1 || set /usr/ccs/lib/libc.$so
5623         $test -r $1 || set /lib/libsys_s$_a
5624         ;;
5625 *)
5626         set blurfl
5627         ;;
5628 esac
5629 if $test -r "$1"; then
5630         echo "Your (shared) C library seems to be in $1."
5631         libc="$1"
5632 elif $test -r /lib/libc && $test -r /lib/clib; then
5633         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5634         xxx=apollo
5635         libc='/lib/clib /lib/libc'
5636         if $test -r /lib/syslib; then
5637                 echo "(Your math library is in /lib/syslib.)"
5638                 libc="$libc /lib/syslib"
5639         fi
5640 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5641         echo "Your C library seems to be in $libc, as you said before."
5642 elif $test -r $incpath/usr/lib/libc$_a; then
5643         libc=$incpath/usr/lib/libc$_a;
5644         echo "Your C library seems to be in $libc.  That's fine."
5645 elif $test -r /lib/libc$_a; then
5646         libc=/lib/libc$_a;
5647         echo "Your C library seems to be in $libc.  You're normal."
5648 else
5649         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5650                 :
5651         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5652                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5653         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5654                 :
5655         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5656                 :
5657         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5658                 :
5659         else
5660                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5661         fi
5662         if $test -r "$tans"; then
5663                 echo "Your C library seems to be in $tans, of all places."
5664                 libc=$tans
5665         else
5666                 libc='blurfl'
5667         fi
5668 fi
5669 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5670         dflt="$libc"
5671         cat <<EOM
5672
5673 If the guess above is wrong (which it might be if you're using a strange
5674 compiler, or your machine supports multiple models), you can override it here.
5675
5676 EOM
5677 else
5678         dflt=''
5679         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5680         cat >&4 <<EOM
5681 I can't seem to find your C library.  I've looked in the following places:
5682
5683 EOM
5684         $sed 's/^/      /' libpath
5685         cat <<EOM
5686
5687 None of these seems to contain your C library. I need to get its name...
5688
5689 EOM
5690 fi
5691 fn=f
5692 rp='Where is your C library?'
5693 . ./getfile
5694 libc="$ans"
5695
5696 echo " "
5697 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5698 set X `cat libnames`
5699 shift
5700 xxx=files
5701 case $# in 1) xxx=file; esac
5702 echo "Extracting names from the following $xxx for later perusal:" >&4
5703 echo " "
5704 $sed 's/^/      /' libnames >&4
5705 echo " "
5706 $echo $n "This may take a while...$c" >&4
5707
5708 for file in $*; do
5709         case $file in
5710         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5711         *) $nm $nm_opt $file 2>/dev/null;;
5712         esac
5713 done >libc.tmp
5714
5715 $echo $n ".$c"
5716 $grep fprintf libc.tmp > libc.ptf
5717 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5718 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5719 xxx='[ADTSIW]'
5720 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5745                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5770         eval $xscan;\
5771         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772                 eval $xrun
5773 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5774         eval $xscan;\
5775         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5776                 eval $xrun
5777 else
5778         $nm -p $* 2>/dev/null >libc.tmp
5779         $grep fprintf libc.tmp > libc.ptf
5780         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5781                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5782         then
5783                 nm_opt='-p'
5784                 eval $xrun
5785         else
5786                 echo " "
5787                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5788                 com=''
5789                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5790                         for thisname in $libnames $libc; do
5791                                 $ar t $thisname >>libc.tmp
5792                         done
5793                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5794                         echo "Ok." >&4
5795                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5796                         # Repeat libc to extract forwarders to DLL entries too
5797                         for thisname in $libnames $libc; do
5798                                 $ar tv $thisname >>libc.tmp
5799                                 # Revision 50 of EMX has bug in $ar.
5800                                 # it will not extract forwarders to DLL entries
5801                                 # Use emximp which will extract exactly them.
5802                                 emximp -o tmp.imp $thisname \
5803                                     2>/dev/null && \
5804                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5805                                     < tmp.imp >>libc.tmp
5806                                 $rm tmp.imp
5807                         done
5808                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5809                         echo "Ok." >&4
5810                 else
5811                         echo "$ar didn't seem to work right." >&4
5812                         echo "Maybe this is a Cray...trying bld instead..." >&4
5813                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5814                         then
5815                                 for thisname in $libnames; do
5816                                         bld t $libnames | \
5817                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5818                                         $ar t $thisname >>libc.tmp
5819                                 done
5820                                 echo "Ok." >&4
5821                         else
5822                                 echo "That didn't work either.  Giving up." >&4
5823                                 exit 1
5824                         fi
5825                 fi
5826         fi
5827 fi
5828 nm_extract="$com"
5829 if $test -f /lib/syscalls.exp; then
5830         echo " "
5831         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5832         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5833 fi
5834 ;;
5835 esac
5836 $rm -f libnames libpath
5837
5838 : see if dld is available
5839 set dld.h i_dld
5840 eval $inhdr
5841
5842 : is a C symbol defined?
5843 csym='tlook=$1;
5844 case "$3" in
5845 -v) tf=libc.tmp; tc=""; tdc="";;
5846 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5847 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5848 esac;
5849 tx=yes;
5850 case "$reuseval-$4" in
5851 true-) ;;
5852 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5853 esac;
5854 case "$tx" in
5855 yes)
5856         case "$runnm" in
5857         true)
5858                 if $contains $tlook $tf >/dev/null 2>&1;
5859                 then tval=true;
5860                 else tval=false;
5861                 fi;;
5862         *)
5863                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5864                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5865                 then tval=true;
5866                 else tval=false;
5867                 fi;
5868                 $rm -f t t.c;;
5869         esac;;
5870 *)
5871         case "$tval" in
5872         $define) tval=true;;
5873         *) tval=false;;
5874         esac;;
5875 esac;
5876 eval "$2=$tval"'
5877
5878 : define an is-in-libc? function
5879 inlibc='echo " "; td=$define; tu=$undef;
5880 sym=$1; var=$2; eval "was=\$$2";
5881 tx=yes;
5882 case "$reuseval$was" in
5883 true) ;;
5884 true*) tx=no;;
5885 esac;
5886 case "$tx" in
5887 yes)
5888         set $sym tres -f;
5889         eval $csym;
5890         case "$tres" in
5891         true)
5892                 echo "$sym() found." >&4;
5893                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5894         *)
5895                 echo "$sym() NOT found." >&4;
5896                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5897         esac;;
5898 *)
5899         case "$was" in
5900         $define) echo "$sym() found." >&4;;
5901         *) echo "$sym() NOT found." >&4;;
5902         esac;;
5903 esac'
5904
5905 : see if dlopen exists
5906 xxx_runnm="$runnm"
5907 runnm=false
5908 set dlopen d_dlopen
5909 eval $inlibc
5910 runnm="$xxx_runnm"
5911
5912 : determine which dynamic loading, if any, to compile in
5913 echo " "
5914 dldir="ext/DynaLoader"
5915 case "$usedl" in
5916 $define|y|true)
5917         dflt='y'
5918         usedl="$define"
5919         ;;
5920 $undef|n|false)
5921         dflt='n'
5922         usedl="$undef"
5923         ;;
5924 *) 
5925         dflt='n'
5926         case "$d_dlopen" in
5927             $define) dflt='y' ;;
5928         esac
5929         case "$i_dld" in
5930             $define) dflt='y' ;;
5931         esac
5932         : Does a dl_xxx.xs file exist for this operating system
5933         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5934         ;;
5935 esac
5936 rp="Do you wish to use dynamic loading?"
5937 . ./myread
5938 usedl="$ans"
5939 case "$ans" in
5940 y*) usedl="$define"
5941         case "$dlsrc" in
5942         '')
5943                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5944                         dflt="$dldir/dl_${osname}.xs"
5945                 elif $test "$d_dlopen" = "$define" ; then
5946                         dflt="$dldir/dl_dlopen.xs"
5947                 elif $test "$i_dld" = "$define" ; then
5948                         dflt="$dldir/dl_dld.xs"
5949                 else
5950                         dflt=''
5951                 fi
5952                 ;;
5953         *)      dflt="$dldir/$dlsrc"
5954                 ;;
5955         esac
5956     echo "The following dynamic loading files are available:"
5957         : Can not go over to $dldir because getfile has path hard-coded in.
5958         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5959         rp="Source file to use for dynamic loading"
5960         fn="fne"
5961         gfpth="$src"
5962         . ./getfile
5963         usedl="$define"
5964         : emulate basename
5965         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5966
5967         $cat << EOM
5968
5969 Some systems may require passing special flags to $cc -c to
5970 compile modules that will be used to create a shared library.
5971 To use no flags, say "none".
5972
5973 EOM
5974     case "$cccdlflags" in
5975     '') case "$gccversion" in
5976                 '') case "$osname" in
5977                         hpux)   dflt='+z' ;;
5978                         next)   dflt='none' ;;
5979                         irix*)  dflt='-KPIC' ;;
5980                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5981                         sunos)  dflt='-pic' ;;
5982                         *)      dflt='none' ;;
5983                     esac
5984                         ;;
5985                 *)  case "$osname" in
5986                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5987                         *)      dflt='-fpic' ;;
5988                     esac ;;
5989             esac ;;
5990         ' ') dflt='none' ;;
5991     *)  dflt="$cccdlflags" ;;
5992     esac
5993     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5994     . ./myread
5995     case "$ans" in
5996     none) cccdlflags=' ' ;;
5997     *) cccdlflags="$ans" ;;
5998     esac
5999
6000     cat << EOM
6001
6002 Some systems use ld to create libraries that can be dynamically loaded,
6003 while other systems (such as those using ELF) use $cc.
6004
6005 EOM
6006         case "$ld" in
6007         '')     $cat >try.c <<'EOM'
6008 /* Test for whether ELF binaries are produced */
6009 #include <fcntl.h>
6010 #include <stdlib.h>
6011 int main() {
6012         char b[4];
6013         int i = open("a.out",O_RDONLY);
6014         if(i == -1) 
6015                 exit(1); /* fail */
6016         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6017                 exit(0); /* succeed (yes, it's ELF) */
6018         else
6019                 exit(1); /* fail */
6020 }
6021 EOM
6022                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6023                         cat <<EOM
6024 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6025 EOM
6026                         dflt="$cc"
6027                 else
6028                         echo "I'll use ld to build dynamic libraries."
6029                         dflt='ld'
6030                 fi
6031                 rm -f try.c a.out
6032                 ;;
6033         *)      dflt="$ld"
6034                 ;;
6035         esac
6036
6037     rp="What command should be used to create dynamic libraries?"
6038     . ./myread
6039         ld="$ans"
6040
6041     cat << EOM
6042
6043 Some systems may require passing special flags to $ld to create a
6044 library that can be dynamically loaded.  If your ld flags include
6045 -L/other/path options to locate libraries outside your loader's normal
6046 search path, you may need to specify those -L options here as well.  To
6047 use no flags, say "none".
6048
6049 EOM
6050     case "$lddlflags" in
6051     '') case "$osname" in
6052                         beos) dflt='-nostart' ;;
6053                         hpux)  dflt='-b' ;;
6054                         linux|irix*)    dflt='-shared' ;;
6055                         next)  dflt='none' ;;
6056                         solaris) dflt='-G' ;;
6057                         sunos) dflt='-assert nodefinitions' ;;
6058                         svr4*|esix*) dflt="-G $ldflags" ;;
6059                 *)     dflt='none' ;;
6060                         esac
6061                         ;;
6062     *) dflt="$lddlflags" ;;
6063     esac
6064
6065         : Try to guess additional flags to pick up local libraries.
6066         : Be careful not to append to a plain 'none'
6067         case "$dflt" in
6068         none) dflt='' ;;
6069         esac
6070         for thisflag in $ldflags; do
6071                 case "$thisflag" in
6072                 -L*)
6073                         case " $dflt " in
6074                         *" $thisflag "*) ;;
6075                         *) dflt="$dflt $thisflag" ;;
6076                         esac
6077                         ;;
6078                 esac
6079         done
6080
6081         case "$dflt" in
6082         ''|' ') dflt='none' ;;
6083         esac
6084
6085     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6086     . ./myread
6087     case "$ans" in
6088     none) lddlflags=' ' ;;
6089     *) lddlflags="$ans" ;;
6090     esac
6091
6092         cat <<EOM
6093
6094 Some systems may require passing special flags to $cc to indicate that
6095 the resulting executable will use dynamic linking.  To use no flags,
6096 say "none".
6097
6098 EOM
6099     case "$ccdlflags" in
6100     '') case "$osname" in
6101                 hpux)   dflt='-Wl,-E' ;;
6102                 linux)  dflt='-rdynamic' ;;
6103                 next)   dflt='none' ;;
6104                 sunos)  dflt='none' ;;
6105                 *)      dflt='none' ;;
6106             esac ;;
6107     ' ')  dflt='none' ;;
6108     *)  dflt="$ccdlflags" ;;
6109     esac
6110     rp="Any special flags to pass to $cc to use dynamic loading?"
6111     . ./myread
6112     case "$ans" in
6113     none) ccdlflags=' ' ;;
6114     *) ccdlflags="$ans" ;;
6115     esac
6116     ;;
6117 *)  usedl="$undef"
6118         ld='ld'
6119     dlsrc='dl_none.xs'
6120     lddlflags=''
6121     ccdlflags=''
6122     ;;
6123 esac
6124
6125 also=''
6126 case "$usedl" in
6127 $undef)
6128         # No dynamic loading being used, so don't bother even to prompt.
6129         useshrplib='false'
6130         ;;
6131 *)      case "$useshrplib" in
6132         '')     case "$osname" in
6133                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6134                         dflt=y
6135                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6136                         ;;
6137                 next*)
6138                         case "$osvers" in
6139                         4*)     dflt=y
6140                                 also='Building a shared libperl is needed for MAB support.'
6141                                 ;;
6142                         *)      dflt=n
6143                                 ;;
6144                         esac
6145                         ;;
6146                 *)      dflt=n
6147                         ;;
6148                 esac
6149                 ;;
6150         $define|true|[Yy]*)
6151                 dflt=y
6152                 ;;
6153         *)      dflt=n
6154                 ;;
6155         esac
6156         $cat << EOM
6157
6158 The perl executable is normally obtained by linking perlmain.c with
6159 libperl${_a}, any static extensions (usually just DynaLoader), and
6160 any other libraries needed on this system (such as -lm, etc.).  Since
6161 your system supports dynamic loading, it is probably possible to build
6162 a shared libperl.$so.  If you will have more than one executable linked
6163 to libperl.$so, this will significantly reduce the size of each
6164 executable, but it may have a noticeable affect on performance.  The
6165 default is probably sensible for your system.
6166 $also
6167
6168 EOM
6169         rp="Build a shared libperl.$so (y/n)"
6170         . ./myread
6171         case "$ans" in
6172         true|$define|[Yy]*)
6173                 useshrplib='true'  ;;
6174         *)      useshrplib='false' ;;
6175         esac
6176         ;;
6177 esac
6178
6179 case "$useshrplib" in
6180 true)
6181         case "$libperl" in
6182         '')
6183                 # Figure out a good name for libperl.so.  Since it gets stored in
6184                 # a version-specific architecture-dependent library, the version
6185                 # number isn't really that important, except for making cc/ld happy.
6186                 #
6187                 # A name such as libperl.so.3.1
6188                 majmin="libperl.$so.$patchlevel.$subversion"
6189                 # A name such as libperl.so.301
6190                 majonly=`echo $patchlevel $subversion |
6191                         $awk '{printf "%d%02d", $1, $2}'`
6192                 majonly=libperl.$so.$majonly
6193                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6194                 # rely on figuring it out from the naming of libc.
6195                 case "${osname}${osvers}" in
6196                 next4*)
6197                         dflt=libperl.5.$so
6198                         # XXX How handle the --version stuff for MAB?
6199                         ;;
6200                 linux*)  # ld won't link with a bare -lperl otherwise.
6201                         dflt=libperl.$so
6202                         ;;
6203                 cygwin*) # include version
6204                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6205                         ;;
6206                 *)      # Try to guess based on whether libc has major.minor.
6207                         case "$libc" in
6208                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6209                         *libc.$so.[0-9]*) dflt=$majonly ;;
6210                         *)      dflt=libperl.$so ;;
6211                         esac
6212                         ;;
6213                 esac
6214                 ;;
6215         *)      dflt=$libperl
6216                 ;;
6217         esac
6218         cat << EOM
6219
6220 I need to select a good name for the shared libperl.  If your system uses
6221 library names with major and minor numbers, then you might want something
6222 like $majmin.  Alternatively, if your system uses a single version
6223 number for shared libraries, then you might want to use $majonly.
6224 Or, your system might be quite happy with a simple libperl.$so.
6225
6226 Since the shared libperl will get installed into a version-specific
6227 architecture-dependent directory, the version number of the shared perl
6228 library probably isn't important, so the default should be o.k.
6229
6230 EOM
6231         rp='What name do you want to give to the shared libperl?'
6232         . ./myread
6233         libperl=$ans
6234         echo "Ok, I'll use $libperl"
6235         ;;
6236 *)
6237         libperl="libperl${_a}"
6238         ;;
6239 esac
6240
6241 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6242 case "$shrpdir" in
6243 '') ;;
6244 *)      $cat >&4 <<EOM
6245 WARNING:  Use of the shrpdir variable for the installation location of
6246 the shared $libperl is not supported.  It was never documented and
6247 will not work in this version.  Let me (perlbug@perl.com)
6248 know of any problems this may cause.
6249
6250 EOM
6251         case "$shrpdir" in
6252         "$archlibexp/CORE")
6253                 $cat >&4 <<EOM
6254 But your current setting of $shrpdir is
6255 the default anyway, so it's harmless.
6256 EOM
6257                 ;;
6258         *)
6259                 $cat >&4 <<EOM
6260 Further, your current attempted setting of $shrpdir
6261 conflicts with the value of $archlibexp/CORE
6262 that installperl will use.
6263 EOM
6264                 ;;
6265         esac
6266         ;;
6267 esac
6268
6269 # How will the perl executable find the installed shared $libperl?
6270 # Add $xxx to ccdlflags.
6271 # If we can't figure out a command-line option, use $shrpenv to
6272 # set env LD_RUN_PATH.  The main perl makefile uses this.
6273 shrpdir=$archlibexp/CORE
6274 xxx=''
6275 tmp_shrpenv=''
6276 if "$useshrplib"; then
6277     case "$osname" in 
6278         aix)
6279                 # We'll set it in Makefile.SH...
6280                 ;;
6281         solaris|netbsd)
6282                 xxx="-R $shrpdir"
6283                 ;;
6284         freebsd)
6285                 xxx="-Wl,-R$shrpdir"
6286                 ;;
6287         linux|irix*|dec_osf)
6288                 xxx="-Wl,-rpath,$shrpdir"
6289                 ;;
6290         next)
6291                 # next doesn't like the default...
6292                 ;;
6293         beos)
6294                 # beos doesn't like the default, either.
6295                 ;;
6296         hpux*)
6297                 # hpux doesn't like the default, either.
6298                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6299                 ;;
6300         *)
6301                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6302                 ;;
6303         esac
6304         case "$xxx" in
6305         '') ;;
6306         *)      
6307                 # Only add $xxx if it isn't already in ccdlflags.
6308                 case " $ccdlflags " in
6309                 *" $xxx "*)     ;;
6310                 *)      ccdlflags="$ccdlflags $xxx"
6311                         cat <<EOM >&4
6312
6313 Adding $xxx to the flags
6314 passed to $ld so that the perl executable will find the 
6315 installed shared $libperl.
6316
6317 EOM
6318                         ;;
6319                 esac
6320                 ;;
6321         esac
6322 fi
6323 # Fix ccdlflags in AIX for building external extensions.
6324 # (For building Perl itself bare -bE:perl.exp is needed,
6325 #  Makefile.SH takes care of this.)
6326 case "$osname" in
6327 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6328 esac
6329 # Respect a hint or command-line value.
6330 case "$shrpenv" in
6331 '') shrpenv="$tmp_shrpenv" ;;
6332 esac
6333 case "$ldlibpthname" in
6334 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6335 none)   ldlibpthname='' ;;
6336 esac
6337
6338 : determine where manual pages go
6339 set man1dir man1dir none
6340 eval $prefixit
6341 $cat <<EOM
6342
6343 $spackage has manual pages available in source form.
6344 EOM
6345 case "$nroff" in
6346 nroff)
6347         echo "However, you don't have nroff, so they're probably useless to you."
6348         case "$man1dir" in
6349         '') man1dir="none";;
6350         esac;;
6351 esac
6352 echo "If you don't want the manual sources installed, answer 'none'."
6353 case "$man1dir" in
6354 ' ') dflt=none
6355         ;;
6356 '')
6357         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6358         lookpath="$lookpath $prefixexp/man/p_man/man1"
6359         lookpath="$lookpath $prefixexp/man/u_man/man1"
6360         lookpath="$lookpath $prefixexp/man/man.1"
6361         case "$sysman" in
6362         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6363         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6364         esac
6365         set dflt
6366         eval $prefixup
6367         ;;
6368 *)  dflt="$man1dir"
6369         ;;
6370 esac
6371 echo " "
6372 fn=dn+~
6373 rp="Where do the main $spackage manual pages (source) go?"
6374 . ./getfile
6375 if $test "X$man1direxp" != "X$ansexp"; then
6376         installman1dir=''
6377 fi
6378 man1dir="$ans"
6379 man1direxp="$ansexp"
6380 case "$man1dir" in
6381 '')     man1dir=' '
6382         installman1dir='';;
6383 esac
6384
6385 : Change installation prefix, if necessary.
6386 if $test X"$prefix" != X"$installprefix"; then
6387         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6388 else
6389         installman1dir="$man1direxp"
6390 fi
6391
6392 : What suffix to use on installed man pages
6393
6394 case "$man1dir" in
6395 ' ')
6396         man1ext='0'
6397         ;;
6398 *)
6399         rp="What suffix should be used for the main $spackage man pages?"
6400         case "$man1ext" in
6401         '')     case "$man1dir" in
6402                 *1)  dflt=1 ;;
6403                 *1p) dflt=1p ;;
6404                 *1pm) dflt=1pm ;;
6405                 *l) dflt=l;;
6406                 *n) dflt=n;;
6407                 *o) dflt=o;;
6408                 *p) dflt=p;;
6409                 *C) dflt=C;;
6410                 *L) dflt=L;;
6411                 *L1) dflt=L1;;
6412                 *) dflt=1;;
6413                 esac
6414                 ;;
6415         *)      dflt="$man1ext";;
6416         esac
6417         . ./myread
6418         man1ext="$ans"
6419         ;;
6420 esac
6421
6422 : see if we can have long filenames
6423 echo " "
6424 rmlist="$rmlist /tmp/cf$$"
6425 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6426 first=123456789abcdef
6427 second=/tmp/cf$$/$first
6428 $rm -f $first $second
6429 if (echo hi >$first) 2>/dev/null; then
6430         if $test -f 123456789abcde; then
6431                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6432                 val="$undef"
6433         else
6434                 if (echo hi >$second) 2>/dev/null; then
6435                         if $test -f /tmp/cf$$/123456789abcde; then
6436                                 $cat <<'EOM'
6437 That's peculiar... You can have filenames longer than 14 characters, but only
6438 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6439 I shall consider your system cannot support long filenames at all.
6440 EOM
6441                                 val="$undef"
6442                         else
6443                                 echo 'You can have filenames longer than 14 characters.' >&4
6444                                 val="$define"
6445                         fi
6446                 else
6447                         $cat <<'EOM'
6448 How confusing! Some of your filesystems are sane enough to allow filenames
6449 longer than 14 characters but some others like /tmp can't even think about them.
6450 So, for now on, I shall assume your kernel does not allow them at all.
6451 EOM
6452                         val="$undef"
6453                 fi
6454         fi
6455 else
6456         $cat <<'EOM'
6457 You can't have filenames longer than 14 chars.  You can't even think about them!
6458 EOM
6459         val="$undef"
6460 fi 
6461 set d_flexfnam
6462 eval $setvar
6463 $rm -rf /tmp/cf$$ 123456789abcde*
6464
6465 : determine where library module manual pages go
6466 set man3dir man3dir none
6467 eval $prefixit
6468 $cat <<EOM
6469
6470 $spackage has manual pages for many of the library modules.
6471 EOM
6472
6473 case "$nroff" in
6474 nroff)
6475         $cat <<'EOM'
6476 However, you don't have nroff, so they're probably useless to you.
6477 EOM
6478         case "$man3dir" in
6479         '') man3dir="none";;
6480         esac;;
6481 esac
6482
6483 case "$d_flexfnam" in
6484 undef)
6485         $cat <<'EOM'
6486 However, your system can't handle the long file names like File::Basename.3. 
6487 EOM
6488         case "$man3dir" in
6489         '') man3dir="none";;
6490         esac;;
6491 esac
6492
6493 echo "If you don't want the manual sources installed, answer 'none'."
6494 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6495 case "$man3dir" in
6496 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6497         if $test -d "$privlib/man/man3"; then
6498                 cat <<EOM >&4
6499
6500 WARNING:  Previous versions of perl installed man3 pages into
6501 $privlib/man/man3.  This version will suggest a 
6502 new default of $dflt.  
6503 EOM
6504                 tdflt=$dflt
6505                 dflt='n'
6506                 rp='Do you wish to preserve the old behavior?(y/n)'
6507                 . ./myread
6508                 case "$ans" in
6509                 y*) dflt="$privlib/man/man3" ;;
6510                 *)  dflt=$tdflt ;;
6511                 esac
6512     fi
6513         ;;
6514 ' ') dflt=none;;
6515 *)      dflt="$man3dir" ;;
6516 esac
6517 echo " "
6518 fn=dn+~
6519 rp="Where do the $package library man pages (source) go?"
6520 . ./getfile
6521 man3dir="$ans"
6522 man3direxp="$ansexp"
6523 case "$man1dir" in
6524 '')     man3dir=' '
6525         installman3dir='';;
6526 esac
6527
6528 : Change installation prefix, if necessary.
6529 if $test X"$prefix" != X"$installprefix"; then
6530         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6531 else
6532         installman3dir="$man3direxp"
6533 fi
6534
6535 : What suffix to use on installed man pages
6536 case "$man3dir" in
6537 ' ')
6538         man3ext='0'
6539         ;;
6540 *)
6541         rp="What suffix should be used for the $package library man pages?"
6542         case "$man3ext" in
6543         '')     case "$man3dir" in
6544                 *3)  dflt=3 ;;
6545                 *3p) dflt=3p ;;
6546                 *3pm) dflt=3pm ;;
6547                 *l) dflt=l;;
6548                 *n) dflt=n;;
6549                 *o) dflt=o;;
6550                 *p) dflt=p;;
6551                 *C) dflt=C;;
6552                 *L) dflt=L;;
6553                 *L3) dflt=L3;;
6554                 *) dflt=3;;
6555                 esac
6556                 ;;
6557         *)      dflt="$man3ext";;
6558         esac
6559         . ./myread
6560         man3ext="$ans"
6561         ;;
6562 esac
6563
6564 : see if we have to deal with yellow pages, now NIS.
6565 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6566         if $test -f /usr/etc/nibindd; then
6567                 echo " "
6568                 echo "I'm fairly confident you're on a NeXT."
6569                 echo " "
6570                 rp='Do you get the hosts file via NetInfo?'
6571                 dflt=y
6572                 case "$hostcat" in
6573                 nidump*) ;;
6574                 '') ;;
6575                 *) dflt=n;;
6576                 esac
6577                 . ./myread
6578                 case "$ans" in
6579                 y*) hostcat='nidump hosts .';;
6580                 *)      case "$hostcat" in
6581                         nidump*) hostcat='';;
6582                         esac
6583                         ;;
6584                 esac
6585         fi
6586         case "$hostcat" in
6587         nidump*) ;;
6588         *)
6589                 case "$hostcat" in
6590                 *ypcat*) dflt=y;;
6591                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6592                                 dflt=y
6593                         else
6594                                 dflt=n
6595                         fi;;
6596                 *) dflt=n;;
6597                 esac
6598                 echo " "
6599                 rp='Are you getting the hosts file via yellow pages?'
6600                 . ./myread
6601                 case "$ans" in
6602                 y*) hostcat='ypcat hosts';;
6603                 *) hostcat='cat /etc/hosts';;
6604                 esac
6605                 ;;
6606         esac
6607 fi
6608 case "$hostcat" in
6609 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6610 esac
6611 case "$groupcat" in
6612 '') test -f /etc/group && groupcat='cat /etc/group';;
6613 esac
6614 case "$passcat" in
6615 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6616 esac
6617
6618 : now get the host name
6619 echo " "
6620 echo "Figuring out host name..." >&4
6621 case "$myhostname" in
6622 '') cont=true
6623         echo 'Maybe "hostname" will work...'
6624         if tans=`sh -c hostname 2>&1` ; then
6625                 myhostname=$tans
6626                 phostname=hostname
6627                 cont=''
6628         fi
6629         ;;
6630 *) cont='';;
6631 esac
6632 if $test "$cont"; then
6633         if ./xenix; then
6634                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6635                 if tans=`cat /etc/systemid 2>&1` ; then
6636                         myhostname=$tans
6637                         phostname='cat /etc/systemid'
6638                         echo "Whadyaknow.  Xenix always was a bit strange..."
6639                         cont=''
6640                 fi
6641         elif $test -r /etc/systemid; then
6642                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6643         fi
6644 fi
6645 if $test "$cont"; then
6646         echo 'No, maybe "uuname -l" will work...'
6647         if tans=`sh -c 'uuname -l' 2>&1` ; then
6648                 myhostname=$tans
6649                 phostname='uuname -l'
6650         else
6651                 echo 'Strange.  Maybe "uname -n" will work...'
6652                 if tans=`sh -c 'uname -n' 2>&1` ; then
6653                         myhostname=$tans
6654                         phostname='uname -n'
6655                 else
6656                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6657                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6658                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6659                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6660                         else
6661                                 case "$myhostname" in
6662                                 '') echo "Does this machine have an identity crisis or something?"
6663                                         phostname='';;
6664                                 *)
6665                                         echo "Well, you said $myhostname before..."
6666                                         phostname='echo $myhostname';;
6667                                 esac
6668                         fi
6669                 fi
6670         fi
6671 fi
6672 : you do not want to know about this
6673 set $myhostname
6674 myhostname=$1
6675
6676 : verify guess
6677 if $test "$myhostname" ; then
6678         dflt=y
6679         rp='Your host name appears to be "'$myhostname'".'" Right?"
6680         . ./myread
6681         case "$ans" in
6682         y*) ;;
6683         *) myhostname='';;
6684         esac
6685 fi
6686
6687 : bad guess or no guess
6688 while $test "X$myhostname" = X ; do
6689         dflt=''
6690         rp="Please type the (one word) name of your host:"
6691         . ./myread
6692         myhostname="$ans"
6693 done
6694
6695 : translate upper to lower if necessary
6696 case "$myhostname" in
6697 *[A-Z]*)
6698         echo "(Normalizing case in your host name)"
6699         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6700         ;;
6701 esac
6702
6703 case "$myhostname" in
6704 *.*)
6705         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6706         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6707         echo "(Trimming domain name from host name--host name is now $myhostname)"
6708         ;;
6709 *) case "$mydomain" in
6710         '')
6711                 {
6712                         test "X$hostcat" = "Xypcat hosts" &&
6713                         ypmatch "$myhostname" hosts 2>/dev/null |\
6714                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6715                         $test -s hosts
6716                 } || {
6717                         test "X$hostcat" != "X" &&
6718                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6719                                         /[       ]$myhostname[  . ]/p" > hosts
6720                 }
6721                 tmp_re="[       . ]"
6722                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6723                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6724                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6725                         hosts | $sort | $uniq | \
6726                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6727                 case `$echo X$dflt` in
6728                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6729                         dflt=.
6730                         ;;
6731                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6732                         ;;
6733                 esac
6734                 case "$dflt" in
6735                 .)
6736                         tans=`./loc resolv.conf X /etc /usr/etc`
6737                         if $test -f "$tans"; then
6738                                 echo "(Attempting domain name extraction from $tans)"
6739                                 dflt=.`$sed -n -e 's/   / /g' \
6740                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6741                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6742                                 case "$dflt" in
6743                                 .) dflt=.`$sed -n -e 's/        / /g' \
6744                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6745                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6746                                         ;;
6747                                 esac
6748                         fi
6749                         ;;
6750                 esac
6751                 case "$dflt" in
6752                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6753                         dflt=.`sh -c domainname 2>/dev/null`
6754                         case "$dflt" in
6755                         '') dflt='.';;
6756                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6757                         esac
6758                         ;;
6759                 esac
6760                 case "$dflt" in
6761                 .) echo "(Lost all hope -- silly guess then)"
6762                         dflt='.uucp'
6763                         ;;
6764                 esac
6765                 $rm -f hosts
6766                 ;;
6767         *) dflt="$mydomain";;
6768         esac;;
6769 esac
6770 echo " "
6771 rp="What is your domain name?"
6772 . ./myread
6773 tans="$ans"
6774 case "$ans" in
6775 '') ;;
6776 .*) ;;
6777 *) tans=".$tans";;
6778 esac
6779 mydomain="$tans"
6780
6781 : translate upper to lower if necessary
6782 case "$mydomain" in
6783 *[A-Z]*)
6784         echo "(Normalizing case in your domain name)"
6785         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6786         ;;
6787 esac
6788
6789 : a little sanity check here
6790 case "$phostname" in
6791 '') ;;
6792 *)
6793         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6794         $myhostname$mydomain|$myhostname) ;;
6795         *)
6796                 case "$phostname" in
6797                 sed*)
6798                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6799                         ;;
6800                 *)
6801                         echo "(That doesn't agree with your $phostname command, by the way.)"
6802                         ;;
6803                 esac
6804         ;;
6805         esac
6806         ;;
6807 esac
6808
6809 $cat <<EOM
6810
6811 I need to get your e-mail address in Internet format if possible, i.e.
6812 something like user@host.domain. Please answer accurately since I have
6813 no easy means to double check it. The default value provided below
6814 is most probably close to the reality but may not be valid from outside
6815 your organization...
6816
6817 EOM
6818 cont=x
6819 while test "$cont"; do
6820         case "$cf_email" in
6821         '') dflt="$cf_by@$myhostname$mydomain";;
6822         *) dflt="$cf_email";;
6823         esac
6824         rp='What is your e-mail address?'
6825         . ./myread
6826         cf_email="$ans"
6827         case "$cf_email" in
6828         *@*.*) cont='' ;;
6829         *)
6830                 rp='Address does not look like an Internet one.  Use it anyway?'
6831                 case "$fastread" in
6832                 yes) dflt=y ;;
6833                 *) dflt=n ;;
6834                 esac
6835                 . ./myread
6836                 case "$ans" in
6837                 y*) cont='' ;;
6838                 *) echo " " ;;
6839                 esac
6840                 ;;
6841         esac
6842 done
6843
6844 $cat <<EOM
6845
6846 If you or somebody else will be maintaining perl at your site, please
6847 fill in the correct e-mail address here so that they may be contacted
6848 if necessary. Currently, the "perlbug" program included with perl
6849 will send mail to this address in addition to perlbug@perl.com. You may
6850 enter "none" for no administrator.
6851
6852 EOM
6853 case "$perladmin" in
6854 '') dflt="$cf_email";;
6855 *) dflt="$perladmin";;
6856 esac
6857 rp='Perl administrator e-mail address'
6858 . ./myread
6859 perladmin="$ans"
6860
6861 : figure out how to guarantee perl startup
6862 case "$startperl" in
6863 '')
6864         case "$sharpbang" in
6865         *!)
6866                 $cat <<EOH
6867
6868 I can use the #! construct to start perl on your system. This will
6869 make startup of perl scripts faster, but may cause problems if you
6870 want to share those scripts and perl is not in a standard place
6871 ($binexp/perl) on all your platforms. The alternative is to force
6872 a shell by starting the script with a single ':' character.
6873
6874 EOH
6875                 dflt="$binexp/perl"
6876                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6877                 . ./myread
6878                 case "$ans" in
6879                 none)   startperl=": # use perl";;
6880                 *)      startperl="#!$ans"
6881                         if $test 30 -lt `echo "$ans" | wc -c`; then
6882                                 $cat >&4 <<EOM
6883
6884 WARNING:  Some systems limit the #! command to 32 characters.
6885 If you experience difficulty running Perl scripts with #!, try
6886 installing Perl in a directory with a shorter pathname.
6887
6888 EOM
6889                         fi ;;
6890                 esac
6891                 ;;
6892         *) startperl=": # use perl"
6893                 ;;
6894         esac
6895         ;;
6896 esac
6897 echo "I'll use $startperl to start perl scripts."
6898
6899 : figure best path for perl in scripts
6900 case "$perlpath" in
6901 '')
6902         perlpath="$binexp/perl"
6903         case "$startperl" in
6904         *!*) ;;
6905         *)
6906                 $cat <<EOH
6907
6908 I will use the "eval 'exec'" idiom to start Perl on your system.
6909 I can use the full path of your Perl binary for this purpose, but
6910 doing so may cause problems if you want to share those scripts and
6911 Perl is not always in a standard place ($binexp/perl).
6912
6913 EOH
6914                 dflt="$binexp/perl"
6915                 rp="What path shall I use in \"eval 'exec'\"?"
6916                 . ./myread
6917                 perlpath="$ans"
6918                 ;;
6919         esac
6920         ;;
6921 esac
6922 case "$startperl" in
6923 *!*)    ;;
6924 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6925 esac
6926
6927 : determine where public executable scripts go
6928 set scriptdir scriptdir
6929 eval $prefixit
6930 case "$scriptdir" in
6931 '')
6932         dflt="$bin"
6933         : guess some guesses
6934         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6935         $test -d /usr/share/bin     && dflt=/usr/share/bin
6936         $test -d /usr/local/script  && dflt=/usr/local/script
6937         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6938         $test -d $prefixexp/script  && dflt=$prefixexp/script
6939         set dflt
6940         eval $prefixup
6941         ;;
6942 *)  dflt="$scriptdir"
6943         ;;
6944 esac
6945 $cat <<EOM
6946  
6947 Some installations have a separate directory just for executable scripts so
6948 that they can mount it across multiple architectures but keep the scripts in
6949 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6950 Or you might just lump your scripts in with all your other executables.
6951  
6952 EOM
6953 fn=d~
6954 rp='Where do you keep publicly executable scripts?'
6955 . ./getfile
6956 if $test "X$ansexp" != "X$scriptdirexp"; then
6957         installscript=''
6958 fi
6959 scriptdir="$ans"
6960 scriptdirexp="$ansexp"
6961 : Change installation prefix, if necessary.
6962 if $test X"$prefix" != X"$installprefix"; then
6963         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6964 else
6965         installscript="$scriptdirexp"
6966 fi
6967
6968 : determine where site specific architecture-dependent libraries go.
6969 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6970 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6971 : sitelib may have an optional trailing /share.
6972 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6973 tdflt="$tdflt/$archname"
6974 set sitearch sitearch none
6975 eval $prefixit
6976 case "$sitearch" in
6977 '')     dflt="$tdflt" ;;
6978 *)      dflt="$sitearch" ;;
6979 esac
6980 $cat <<EOM
6981
6982 The installation process will also create a directory for
6983 architecture-dependent site-specific extensions and modules.
6984
6985 EOM
6986 fn=nd~+
6987 rp='Pathname for the site-specific architecture-dependent library files?'
6988 . ./getfile
6989 sitearch="$ans"
6990 sitearchexp="$ansexp"
6991 : Change installation prefix, if necessary.
6992 if $test X"$prefix" != X"$installprefix"; then
6993         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6994 else
6995         installsitearch="$sitearchexp"
6996 fi
6997
6998 : determine where add-on public executables go
6999 case "$sitebin" in
7000 '')     dflt=$siteprefix/bin ;;
7001 *)      dflt=$sitebin ;;
7002 esac
7003 fn=d~
7004 rp='Pathname where the add-on public executables should be installed?'
7005 . ./getfile
7006 sitebin="$ans"
7007 sitebinexp="$ansexp"
7008 : Change installation prefix, if necessary.
7009 if $test X"$prefix" != X"$installprefix"; then
7010         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7011 else
7012         installsitebin="$sitebinexp"
7013 fi
7014
7015 cat <<EOM
7016
7017 Perl can be built to take advantage of long doubles which
7018 (if available) may give more accuracy and range for floating point numbers.
7019
7020 If this doesn't make any sense to you, just accept the default 'n'.
7021 EOM
7022
7023 case "$ccflags" in
7024 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7025 esac
7026
7027 case "$uselongdouble" in
7028 $define|true|[yY]*)     dflt='y';;
7029 *) dflt='n';;
7030 esac
7031 rp='Try to use long doubles if available?'
7032 . ./myread
7033 case "$ans" in
7034 y|Y)    val="$define"   ;;
7035 *)      val="$undef"    ;;
7036 esac
7037 set uselongdouble
7038 eval $setvar
7039
7040 case "$uselongdouble" in
7041 true|[yY]*) uselongdouble="$define" ;;
7042 esac
7043
7044 case "$uselongdouble" in
7045 $define)
7046 : Look for a hint-file generated 'call-back-unit'.  If the
7047 : user has specified that long doubles should be used,
7048 : we may need to set or change some other defaults.
7049         if $test -f uselongdouble.cbu; then
7050                 echo "Your platform has some specific hints for long doubles, using them..."
7051                 . ./uselongdouble.cbu
7052         else
7053                 $cat <<EOM
7054 (Your platform doesn't have any specific hints for long doubles.)
7055 EOM
7056         fi
7057         ;;
7058 esac
7059
7060 cat <<EOM
7061
7062 Perl can be built to take advantage of long longs which
7063 (if available) may give more range for integer numbers.
7064
7065 If this doesn't make any sense to you, just accept the default 'n'.
7066 EOM
7067
7068 case "$ccflags" in
7069 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7070 esac
7071
7072 case "$uselonglong" in
7073 $define|true|[yY]*)     dflt='y';;
7074 *) dflt='n';;
7075 esac
7076 rp='Try to use long longs if available?'
7077 . ./myread
7078 case "$ans" in
7079 y|Y)    val="$define"   ;;
7080 *)      val="$undef"    ;;
7081 esac
7082 set uselonglong
7083 eval $setvar
7084
7085 case "$uselonglong" in
7086 true|[yY]*) uselonglong="$define" ;;
7087 esac
7088
7089 case "$uselonglong" in
7090 $define)
7091 : Look for a hint-file generated 'call-back-unit'.  If the
7092 : user has specified that long longs should be used,
7093 : we may need to set or change some other defaults.
7094         if $test -f uselonglong.cbu; then
7095                 echo "Your platform has some specific hints for long longs, using them..."
7096                 . ./uselonglong.cbu
7097         else
7098                 $cat <<EOM
7099 (Your platform doesn't have any specific hints for long longs.)
7100 EOM
7101         fi
7102         ;;
7103 esac
7104
7105 cat <<EOM
7106
7107 Previous version of $package used the standard IO mechanisms as defined
7108 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7109 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7110 the default.  This abstraction layer can use AT&T's sfio (if you already
7111 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7112 problems with some extension modules.  Using PerlIO with stdio is safe,
7113 but it is slower than plain stdio and therefore is not the default.
7114
7115 If this doesn't make any sense to you, just accept the default 'n'.
7116 EOM
7117 case "$useperlio" in
7118 $define|true|[yY]*)     dflt='y';;
7119 *) dflt='n';;
7120 esac
7121 rp='Use the experimental PerlIO abstraction layer?'
7122 . ./myread
7123 case "$ans" in
7124 y|Y) 
7125         val="$define"
7126         ;;     
7127 *)      
7128         echo "Ok, doing things the stdio way"
7129         val="$undef"
7130         ;;
7131 esac
7132 set useperlio
7133 eval $setvar 
7134
7135 case "$vendorprefix" in
7136 '')     d_vendorbin="$undef"
7137         vendorbin=''
7138         vendorbinexp=''
7139         ;;
7140 *)      d_vendorbin="$define"
7141         : determine where vendor-supplied executables go.
7142         dflt=$vendorprefix/bin
7143         fn=d~+
7144         rp='Pathname for the vendor-supplied executables directory?'
7145         . ./getfile
7146         vendorbin="$ans"
7147         vendorbinexp="$ansexp"
7148         : Change installation prefix, if necessary.
7149         if $test X"$prefix" != X"$installprefix"; then
7150                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7151         else
7152                 installvendorbin="$vendorbinexp"
7153         fi
7154         ;;
7155 esac
7156
7157 : check for length of double
7158 echo " "
7159 case "$doublesize" in
7160 '')
7161         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7162         $cat >try.c <<'EOCP'
7163 #include <stdio.h>
7164 int main()
7165 {
7166     printf("%d\n", (int)sizeof(double));
7167     exit(0);
7168 }
7169 EOCP
7170         set try
7171         if eval $compile_ok; then
7172                 doublesize=`./try`
7173                 $echo " $doublesize bytes." >&4
7174         else
7175                 dflt='8'
7176                 echo "(I can't seem to compile the test program.  Guessing...)"
7177                 rp="What is the size of a double precision number (in bytes)?"
7178                 . ./myread
7179                 doublesize="$ans"
7180         fi
7181         ;;
7182 esac
7183 $rm -f try.c try
7184
7185 : check for long doubles
7186 echo " "
7187 $echo $n "Checking to see if your system supports long double..." $c >&4
7188 echo 'int main() { long double x = 7.0; }' > try.c
7189 set try
7190 if eval $compile; then
7191         val="$define"
7192         echo " Yes, it does." >&4
7193 else
7194         val="$undef"
7195         echo " No, it doesn't." >&4
7196 fi
7197 $rm try.*
7198 set d_longdbl
7199 eval $setvar
7200
7201 : check for length of long double
7202 case "${d_longdbl}${longdblsize}" in
7203 $define)
7204         echo " "
7205         $echo $n "Checking to see how big your long doubles are..." $c >&4
7206         $cat >try.c <<'EOCP'
7207 #include <stdio.h>
7208 int main()
7209 {
7210         printf("%d\n", sizeof(long double));
7211 }
7212 EOCP
7213         set try
7214         set try
7215         if eval $compile; then
7216                 longdblsize=`./try$exe_ext`
7217                 $echo " $longdblsize bytes." >&4
7218         else
7219                 dflt='8'
7220                 echo " "
7221                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7222                 rp="What is the size of a long double (in bytes)?"
7223                 . ./myread
7224                 longdblsize="$ans"
7225         fi
7226         if $test "X$doublesize" = "X$longdblsize"; then
7227                 echo "(That isn't any different from an ordinary double.)"
7228         fi      
7229         ;;
7230 esac
7231 $rm -f try.* try
7232
7233 : Check how to convert floats to strings.
7234 if test "X$d_Gconvert" = X; then
7235         echo " "
7236         echo "Checking for an efficient way to convert floats to strings."
7237         $cat >try.c <<EOP
7238 #ifdef TRY_gconvert
7239 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7240 char *myname = "gconvert";
7241 #endif
7242 #ifdef TRY_gcvt
7243 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7244 char *myname = "gcvt";
7245 #endif
7246 #ifdef TRY_qgcvt
7247 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7248 char *myname = "qgcvt";
7249 #define DOUBLETYPE long double
7250 #endif
7251 #ifdef TRY_sprintf
7252 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7253 char *myname = "sprintf";
7254 #endif
7255
7256 #ifndef DOUBLETYPE
7257 #define DOUBLETYPE double
7258 #endif
7259
7260 #include <stdio.h>
7261
7262 #ifdef I_STDLIB
7263 #include <stdlib.h>
7264 #endif
7265
7266 int
7267 checkit(expect, got)
7268 char *expect;
7269 char *got;
7270 {
7271     if (strcmp(expect, got)) {
7272                 printf("%s oddity:  Expected %s, got %s\n",
7273                         myname, expect, got);
7274                 exit(1);
7275         }
7276 }
7277
7278 int main()
7279
7280         char buf[64]; 
7281         buf[63] = '\0';
7282
7283         /* This must be 1st test on (which?) platform */
7284         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7285         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7286         checkit("0.1", buf);
7287
7288         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7289         checkit("1", buf);
7290
7291         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7292         checkit("0", buf);
7293
7294         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7295         checkit("-1", buf);
7296
7297         /* Some Linux gcvt's give 1.e+5 here. */
7298         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7299         checkit("100000", buf);
7300         
7301         /* Some Linux gcvt's give -1.e+5 here. */
7302         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7303         checkit("-100000", buf);
7304
7305         exit(0);
7306 }
7307 EOP
7308         case "$d_Gconvert" in
7309         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7310         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7311         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7312         *) xxx_list='gconvert gcvt sprintf' ;;
7313         esac
7314
7315         case "$d_longdbl$uselongdouble" in
7316         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7317         esac
7318
7319         for xxx_convert in $xxx_list; do
7320                 echo "Trying $xxx_convert..."
7321                 $rm -f try try$_o
7322                 set try -DTRY_$xxx_convert
7323                 if eval $compile; then
7324                         echo "$xxx_convert() found." >&4
7325                         if ./try; then
7326                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7327                                 break;
7328                         else
7329                                 echo "...But $xxx_convert didn't work as I expected."
7330                         fi
7331                 else
7332                         echo "$xxx_convert NOT found." >&4
7333                 fi
7334         done
7335                 
7336         case "$xxx_convert" in
7337         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7338         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7339         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7340         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7341         esac
7342 fi
7343
7344 echo " "
7345
7346 if $test X"$d_longdbl" = X"$define"; then
7347
7348 echo "Checking how to print long doubles..." >&4
7349
7350 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7351         $cat >try.c <<'EOCP'
7352 #include <sys/types.h>
7353 #include <stdio.h>
7354 int main() {
7355   double d = 123.456;
7356   printf("%.3f\n", d);
7357 }
7358 EOCP
7359         set try
7360         if eval $compile; then
7361                 yyy=`./try$exe_ext`
7362                 case "$yyy" in
7363                 123.456)
7364                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7365                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7366                         echo "We will use %f."
7367                         ;;
7368                 esac
7369         fi
7370 fi
7371
7372 if $test X"$sPRIfldbl" = X; then
7373         $cat >try.c <<'EOCP'
7374 #include <sys/types.h>
7375 #include <stdio.h>
7376 int main() {
7377   long double d = 123.456;
7378   printf("%.3llf\n", d);
7379 }
7380 EOCP
7381         set try
7382         if eval $compile; then
7383                 yyy=`./try$exe_ext`
7384                 case "$yyy" in
7385                 123.456)
7386                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7387                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7388                         echo "We will use %llf."
7389                         ;;
7390                 esac
7391         fi
7392 fi
7393
7394 if $test X"$sPRIfldbl" = X; then
7395         $cat >try.c <<'EOCP'
7396 #include <sys/types.h>
7397 #include <stdio.h>
7398 int main() {
7399   long double d = 123.456;
7400   printf("%.3Lf\n", d);
7401 }
7402 EOCP
7403         set try
7404         if eval $compile; then
7405                 yyy=`./try$exe_ext`
7406                 case "$yyy" in
7407                 123.456)
7408                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7409                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7410                         echo "We will use %Lf."
7411                         ;;
7412                 esac
7413         fi
7414 fi
7415
7416 if $test X"$sPRIfldbl" = X; then
7417         $cat >try.c <<'EOCP'
7418 #include <sys/types.h>
7419 #include <stdio.h>
7420 int main() {
7421   long double d = 123.456;
7422   printf("%.3lf\n", d);
7423 }
7424 EOCP
7425         set try
7426         if eval $compile; then
7427                 yyy=`./try$exe_ext`
7428                 case "$yyy" in
7429                 123.456)
7430                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7431                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7432                         echo "We will use %lf."
7433                         ;;
7434                 esac
7435         fi
7436 fi
7437
7438 if $test X"$sPRIfldbl" = X; then
7439         echo "Cannot figure out how to print long doubles." >&4
7440 fi
7441
7442 $rm -f try try.*
7443
7444 fi # d_longdbl
7445
7446 case "$sPRIfldbl" in
7447 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7448         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7449         ;;
7450 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7451         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7452         ;;
7453 esac
7454
7455 : Initialize h_fcntl
7456 h_fcntl=false
7457
7458 : Initialize h_sysfile
7459 h_sysfile=false
7460
7461 : access call always available on UNIX
7462 set access d_access
7463 eval $inlibc
7464
7465 : locate the flags for 'access()'
7466 case "$d_access" in
7467 "$define")
7468         echo " "
7469         $cat >access.c <<'EOCP'
7470 #include <sys/types.h>
7471 #ifdef I_FCNTL
7472 #include <fcntl.h>
7473 #endif
7474 #ifdef I_SYS_FILE
7475 #include <sys/file.h>
7476 #endif
7477 #ifdef I_UNISTD
7478 #include <unistd.h>
7479 #endif
7480 int main() {
7481         exit(R_OK);
7482 }
7483 EOCP
7484         : check sys/file.h first, no particular reason here
7485         if $test `./findhdr sys/file.h` && \
7486                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7487                 h_sysfile=true;
7488                 echo "<sys/file.h> defines the *_OK access constants." >&4
7489         elif $test `./findhdr fcntl.h` && \
7490                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7491                 h_fcntl=true;
7492                 echo "<fcntl.h> defines the *_OK access constants." >&4
7493         elif $test `./findhdr unistd.h` && \
7494                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7495                 echo "<unistd.h> defines the *_OK access constants." >&4
7496         else
7497                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7498         fi
7499         ;;
7500 esac
7501 $rm -f access*
7502
7503 : see if accessx exists
7504 set accessx d_accessx
7505 eval $inlibc
7506
7507 : see if alarm exists
7508 set alarm d_alarm
7509 eval $inlibc
7510
7511 : see if atolf exists
7512 set atolf d_atolf
7513 eval $inlibc
7514
7515 : see if atoll exists
7516 set atoll d_atoll
7517 eval $inlibc
7518
7519 : Look for GNU-cc style attribute checking
7520 echo " "
7521 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7522 $cat >attrib.c <<'EOCP'
7523 #include <stdio.h>
7524 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7525 EOCP
7526 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7527         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7528                 echo "Your C compiler doesn't fully support __attribute__."
7529                 val="$undef"
7530         else
7531                 echo "Your C compiler supports __attribute__."
7532                 val="$define"
7533         fi
7534 else
7535         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7536         val="$undef"
7537 fi
7538 set d_attribut
7539 eval $setvar
7540 $rm -f attrib*
7541
7542 : see if bcmp exists
7543 set bcmp d_bcmp
7544 eval $inlibc
7545
7546 : see if bcopy exists
7547 set bcopy d_bcopy
7548 eval $inlibc
7549
7550 : see if this is a unistd.h system
7551 set unistd.h i_unistd
7552 eval $inhdr
7553
7554 : see if getpgrp exists
7555 set getpgrp d_getpgrp
7556 eval $inlibc
7557
7558 case "$d_getpgrp" in
7559 "$define")
7560         echo " "
7561         echo "Checking to see which flavor of getpgrp is in use..."
7562         $cat >set.c <<EOP
7563 #$i_unistd I_UNISTD
7564 #include <sys/types.h>
7565 #ifdef I_UNISTD
7566 #  include <unistd.h>
7567 #endif
7568 int main()
7569 {
7570         if (getuid() == 0) {
7571                 printf("(I see you are running Configure as super-user...)\n");
7572                 setuid(1);
7573         }
7574 #ifdef TRY_BSD_PGRP
7575         if (getpgrp(1) == 0)
7576                 exit(0);
7577 #else
7578         if (getpgrp() > 0)
7579                 exit(0);
7580 #endif
7581         exit(1);
7582 }
7583 EOP
7584         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7585                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7586                 val="$define"
7587         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7588                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7589                 val="$undef"
7590         else
7591                 echo "I can't seem to compile and run the test program."
7592                 if ./usg; then
7593                         xxx="a USG one, i.e. you use getpgrp()."
7594                 else
7595                         # SVR4 systems can appear rather BSD-ish.
7596                         case "$i_unistd" in
7597                         $undef)
7598                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7599                                 val="$define"
7600                                 ;;
7601                         $define)
7602                                 xxx="probably a USG one, i.e. you use getpgrp()."
7603                                 val="$undef"
7604                                 ;;
7605                         esac
7606                 fi
7607                 echo "Assuming your getpgrp is $xxx" >&4
7608         fi
7609         ;;
7610 *) val="$undef";;
7611 esac
7612 set d_bsdgetpgrp
7613 eval $setvar
7614 $rm -f set set.c
7615
7616 : see if setpgrp exists
7617 set setpgrp d_setpgrp
7618 eval $inlibc
7619
7620 case "$d_setpgrp" in
7621 "$define")
7622         echo " "
7623         echo "Checking to see which flavor of setpgrp is in use..."
7624         $cat >set.c <<EOP
7625 #$i_unistd I_UNISTD
7626 #include <sys/types.h>
7627 #ifdef I_UNISTD
7628 #  include <unistd.h>
7629 #endif
7630 int main()
7631 {
7632         if (getuid() == 0) {
7633                 printf("(I see you are running Configure as super-user...)\n");
7634                 setuid(1);
7635         }
7636 #ifdef TRY_BSD_PGRP
7637         if (-1 == setpgrp(1, 1))
7638                 exit(0);
7639 #else
7640         if (setpgrp() != -1)
7641                 exit(0);
7642 #endif
7643         exit(1);
7644 }
7645 EOP
7646         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7647                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7648                 val="$define"
7649         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7650                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7651                 val="$undef"
7652         else
7653                 echo "(I can't seem to compile and run the test program.)"
7654                 if ./usg; then
7655                         xxx="a USG one, i.e. you use setpgrp()."
7656                 else
7657                         # SVR4 systems can appear rather BSD-ish.
7658                         case "$i_unistd" in
7659                         $undef)
7660                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7661                                 val="$define"
7662                                 ;;
7663                         $define)
7664                                 xxx="probably a USG one, i.e. you use setpgrp()."
7665                                 val="$undef"
7666                                 ;;
7667                         esac
7668                 fi
7669                 echo "Assuming your setpgrp is $xxx" >&4
7670         fi
7671         ;;
7672 *) val="$undef";;
7673 esac
7674 set d_bsdsetpgrp
7675 eval $setvar
7676 $rm -f set set.c
7677 : see if bzero exists
7678 set bzero d_bzero
7679 eval $inlibc
7680
7681 : see if signal is declared as pointer to function returning int or void
7682 echo " "
7683 xxx=`./findhdr signal.h`
7684 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7685 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7686         echo "You have int (*signal())() instead of void." >&4
7687         val="$undef"
7688 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7689         echo "You have void (*signal())()." >&4
7690         val="$define"
7691 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7692         echo "You have int (*signal())() instead of void." >&4
7693         val="$undef"
7694 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7695         echo "You have void (*signal())()." >&4
7696         val="$define"
7697 else
7698         case "$d_voidsig" in
7699         '')
7700         echo "I can't determine whether signal handler returns void or int..." >&4
7701                 dflt=void
7702                 rp="What type does your signal handler return?"
7703                 . ./myread
7704                 case "$ans" in
7705                 v*) val="$define";;
7706                 *) val="$undef";;
7707                 esac;;
7708         "$define")
7709                 echo "As you already told me, signal handler returns void." >&4
7710                 val="$define"
7711                 ;;
7712         *)      echo "As you already told me, signal handler returns int." >&4
7713                 val="$undef"
7714                 ;;
7715         esac
7716 fi
7717 set d_voidsig
7718 eval $setvar
7719 case "$d_voidsig" in
7720 "$define") signal_t="void";;
7721 *) signal_t="int";;
7722 esac
7723 $rm -f $$.tmp
7724
7725 : check for ability to cast large floats to 32-bit ints.
7726 echo " "
7727 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7728 if $test "$intsize" -ge 4; then
7729         xxx=int
7730 else
7731         xxx=long
7732 fi
7733 $cat >try.c <<EOCP
7734 #include <stdio.h>
7735 #include <sys/types.h>
7736 #include <signal.h>
7737 $signal_t blech(s) int s; { exit(3); }
7738 int main()
7739 {
7740         $xxx i32;
7741         double f, g;
7742         int result = 0;
7743         char str[16];
7744         signal(SIGFPE, blech);
7745
7746         /* Don't let compiler optimize the test away.  Store the number 
7747            in a writable string for gcc to pass to sscanf under HP/UX.
7748         */
7749         sprintf(str, "2147483647");
7750         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7751         g = 10 * f;
7752         i32  = ($xxx) g;
7753
7754         /* x86 processors will probably give 0x8000 0000, which is a
7755        sign change.  We don't want that.  We want to mimic SPARC
7756            behavior here, which is to preserve the sign and give
7757            back 0x7fff ffff.
7758         */
7759         if (i32 != ($xxx) f)
7760                 result |= 1;
7761         exit(result);
7762 }
7763 EOCP
7764 set try
7765 if eval $compile_ok; then
7766         ./try
7767         yyy=$?
7768 else
7769         echo "(I can't seem to compile the test program--assuming it can't)"
7770         yyy=1
7771 fi
7772 case "$yyy" in
7773 0)      val="$define"
7774         echo "Yup, it can."
7775         ;;
7776 *)      val="$undef"
7777         echo "Nope, it can't."
7778         ;;
7779 esac
7780 set d_casti32
7781 eval $setvar
7782 $rm -f try try.*
7783
7784 : check for ability to cast negative floats to unsigned
7785 echo " "
7786 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7787 $cat >try.c <<EOCP
7788 #include <stdio.h>
7789 #include <sys/types.h>
7790 #include <signal.h>
7791 $signal_t blech(s) int s; { exit(7); }
7792 $signal_t blech_in_list(s) int s; { exit(4); }
7793 unsigned long dummy_long(p) unsigned long p; { return p; }
7794 unsigned int dummy_int(p) unsigned int p; { return p; }
7795 unsigned short dummy_short(p) unsigned short p; { return p; }
7796 int main()
7797 {
7798         double f;
7799         unsigned long along;
7800         unsigned int aint;
7801         unsigned short ashort;
7802         int result = 0;
7803         char str[16];
7804         
7805         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7806            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7807            optimized the whole file away
7808         */
7809         /* Store the number in a writable string for gcc to pass to 
7810            sscanf under HP/UX.
7811         */
7812         sprintf(str, "-123");
7813         sscanf(str, "%lf", &f);  /* f = -123.; */
7814
7815         signal(SIGFPE, blech);
7816         along = (unsigned long)f;
7817         aint = (unsigned int)f;
7818         ashort = (unsigned short)f;
7819         if (along != (unsigned long)-123)
7820                 result |= 1;
7821         if (aint != (unsigned int)-123)
7822                 result |= 1;
7823         if (ashort != (unsigned short)-123)
7824                 result |= 1;
7825         sprintf(str, "1073741824.");
7826         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7827         f = f + f;
7828         along = 0;
7829         along = (unsigned long)f;
7830         if (along != 0x80000000)
7831                 result |= 2;
7832         f -= 1.;
7833         along = 0;
7834         along = (unsigned long)f;
7835         if (along != 0x7fffffff)
7836                 result |= 1;
7837         f += 2.;
7838         along = 0;
7839         along = (unsigned long)f;
7840         if (along != 0x80000001)
7841                 result |= 2;
7842         if (result)
7843                 exit(result);
7844         signal(SIGFPE, blech_in_list);
7845         sprintf(str, "123.");
7846         sscanf(str, "%lf", &f);  /* f = 123.; */
7847         along = dummy_long((unsigned long)f);
7848         aint = dummy_int((unsigned int)f);
7849         ashort = dummy_short((unsigned short)f);
7850         if (along != (unsigned long)123)
7851                 result |= 4;
7852         if (aint != (unsigned int)123)
7853                 result |= 4;
7854         if (ashort != (unsigned short)123)
7855                 result |= 4;
7856         exit(result);
7857
7858 }
7859 EOCP
7860 set try
7861 if eval $compile_ok; then
7862         ./try
7863         castflags=$?
7864 else
7865         echo "(I can't seem to compile the test program--assuming it can't)"
7866         castflags=7
7867 fi
7868 case "$castflags" in
7869 0)      val="$define"
7870         echo "Yup, it can."
7871         ;;
7872 *)      val="$undef"
7873         echo "Nope, it can't."
7874         ;;
7875 esac
7876 set d_castneg
7877 eval $setvar
7878 $rm -f try.*
7879
7880 : see if vprintf exists
7881 echo " "
7882 if set vprintf val -f d_vprintf; eval $csym; $val; then
7883         echo 'vprintf() found.' >&4
7884         val="$define"
7885         $cat >vprintf.c <<'EOF'
7886 #include <varargs.h>
7887
7888 int main() { xxx("foo"); }
7889
7890 xxx(va_alist)
7891 va_dcl
7892 {
7893         va_list args;
7894         char buf[10];
7895
7896         va_start(args);
7897         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7898 }
7899 EOF
7900         set vprintf
7901         if eval $compile && ./vprintf; then
7902                 echo "Your vsprintf() returns (int)." >&4
7903                 val2="$undef"
7904         else
7905                 echo "Your vsprintf() returns (char*)." >&4
7906                 val2="$define"
7907         fi
7908 else
7909         echo 'vprintf() NOT found.' >&4
7910                 val="$undef"
7911                 val2="$undef"
7912 fi
7913 set d_vprintf
7914 eval $setvar
7915 val=$val2
7916 set d_charvspr
7917 eval $setvar
7918
7919 : see if chown exists
7920 set chown d_chown
7921 eval $inlibc
7922
7923 : see if chroot exists
7924 set chroot d_chroot
7925 eval $inlibc
7926
7927 : see if chsize exists
7928 set chsize d_chsize
7929 eval $inlibc
7930
7931 : check for const keyword
7932 echo " "
7933 echo 'Checking to see if your C compiler knows about "const"...' >&4
7934 $cat >const.c <<'EOCP'
7935 typedef struct spug { int drokk; } spug;
7936 int main()
7937 {
7938         const char *foo;
7939         const spug y;
7940 }
7941 EOCP
7942 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7943         val="$define"
7944         echo "Yup, it does."
7945 else
7946         val="$undef"
7947         echo "Nope, it doesn't."
7948 fi
7949 set d_const
7950 eval $setvar
7951
7952 : see if crypt exists
7953 echo " "
7954 if set crypt val -f d_crypt; eval $csym; $val; then
7955         echo 'crypt() found.' >&4
7956         val="$define"
7957         cryptlib=''
7958 else
7959         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7960         if $test -z "$cryptlib"; then
7961                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7962         else
7963                 cryptlib=-lcrypt
7964         fi
7965         if $test -z "$cryptlib"; then
7966                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7967         else
7968                 cryptlib=-lcrypt
7969         fi
7970         if $test -z "$cryptlib"; then
7971                 cryptlib=`./loc libcrypt$_a "" $libpth`
7972         else
7973                 cryptlib=-lcrypt
7974         fi
7975         if $test -z "$cryptlib"; then
7976                 echo 'crypt() NOT found.' >&4
7977                 val="$undef"
7978         else
7979                 val="$define"
7980         fi
7981 fi
7982 set d_crypt
7983 eval $setvar
7984
7985 : get csh whereabouts
7986 case "$csh" in
7987 'csh') val="$undef" ;;
7988 *) val="$define" ;;
7989 esac
7990 set d_csh
7991 eval $setvar
7992 : Respect a hint or command line value for full_csh.
7993 case "$full_csh" in
7994 '') full_csh=$csh ;;
7995 esac
7996
7997 : see if cuserid exists
7998 set cuserid d_cuserid
7999 eval $inlibc
8000
8001 : see if this is a limits.h system
8002 set limits.h i_limits
8003 eval $inhdr
8004
8005 : see if this is a float.h system
8006 set float.h i_float
8007 eval $inhdr
8008
8009 : See if number of significant digits in a double precision number is known
8010 echo " "
8011 $cat >dbl_dig.c <<EOM
8012 #$i_limits I_LIMITS
8013 #$i_float I_FLOAT
8014 #ifdef I_LIMITS
8015 #include <limits.h>
8016 #endif
8017 #ifdef I_FLOAT
8018 #include <float.h>
8019 #endif
8020 #ifdef DBL_DIG
8021 printf("Contains DBL_DIG");
8022 #endif
8023 EOM
8024 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8025 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8026         echo "DBL_DIG found." >&4
8027         val="$define"
8028 else
8029         echo "DBL_DIG NOT found." >&4
8030         val="$undef"
8031 fi
8032 $rm -f dbl_dig.?
8033 set d_dbl_dig
8034 eval $setvar
8035
8036 : see if difftime exists
8037 set difftime d_difftime
8038 eval $inlibc
8039
8040 : see if this is a dirent system
8041 echo " "
8042 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8043         val="$define"
8044         echo "<dirent.h> found." >&4
8045 else
8046         val="$undef"
8047         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8048                 echo "<sys/dir.h> found." >&4
8049                 echo " "
8050         else
8051                 xinc=`./findhdr sys/ndir.h`
8052         fi
8053         echo "<dirent.h> NOT found." >&4
8054 fi
8055 set i_dirent
8056 eval $setvar
8057
8058 : Look for type of directory structure.
8059 echo " "
8060 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8061
8062 case "$direntrytype" in
8063 ''|' ')
8064         case "$i_dirent" in
8065         $define) guess1='struct dirent' ;;
8066         *) guess1='struct direct'  ;;
8067         esac
8068         ;;
8069 *)      guess1="$direntrytype"
8070         ;;
8071 esac
8072
8073 case "$guess1" in
8074 'struct dirent') guess2='struct direct' ;;
8075 *) guess2='struct dirent' ;;
8076 esac
8077                 
8078 if $contains "$guess1" try.c >/dev/null 2>&1; then
8079         direntrytype="$guess1"
8080         echo "Your directory entries are $direntrytype." >&4
8081 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8082         direntrytype="$guess2"
8083         echo "Your directory entries seem to be $direntrytype." >&4
8084 else
8085         echo "I don't recognize your system's directory entries." >&4
8086         rp="What type is used for directory entries on this system?"
8087         dflt="$guess1"
8088         . ./myread
8089         direntrytype="$ans"
8090 fi
8091 $rm -f try.c
8092
8093
8094 : see if the directory entry stores field length
8095 echo " "
8096 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8097 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8098         echo "Good, your directory entry keeps length information in d_namlen." >&4
8099         val="$define"
8100 else
8101         echo "Your directory entry does not know about the d_namlen field." >&4
8102         val="$undef"
8103 fi
8104 set d_dirnamlen
8105 eval $setvar
8106 $rm -f try.c
8107
8108 : see if dlerror exists
8109 xxx_runnm="$runnm"
8110 runnm=false
8111 set dlerror d_dlerror
8112 eval $inlibc
8113 runnm="$xxx_runnm"
8114
8115 : see if dlfcn is available
8116 set dlfcn.h i_dlfcn
8117 eval $inhdr
8118
8119 case "$usedl" in
8120 $define|y|true)
8121         $cat << EOM
8122
8123 On a few systems, the dynamically loaded modules that perl generates and uses
8124 will need a different extension than shared libs. The default will probably
8125 be appropriate.
8126
8127 EOM
8128         case "$dlext" in
8129         '')     dflt="$so" ;;
8130         *)      dflt="$dlext" ;;
8131         esac
8132         rp='What is the extension of dynamically loaded modules'
8133         . ./myread
8134         dlext="$ans"
8135         ;;
8136 *)
8137         dlext="none"
8138         ;;
8139 esac
8140
8141 : Check if dlsym need a leading underscore
8142 echo " "
8143 val="$undef"
8144
8145 case "$dlsrc" in
8146 dl_dlopen.xs)
8147         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8148         $cat >dyna.c <<'EOM'
8149 fred () { }
8150 EOM
8151
8152 $cat >fred.c<<EOM
8153
8154 #include <stdio.h>
8155 #$i_dlfcn I_DLFCN
8156 #ifdef I_DLFCN
8157 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8158 #else
8159 #include <sys/types.h>
8160 #include <nlist.h>
8161 #include <link.h>
8162 #endif
8163
8164 extern int fred() ;
8165
8166 int main()
8167 {
8168     void * handle ;
8169     void * symbol ;
8170 #ifndef RTLD_LAZY
8171     int mode = 1 ;
8172 #else
8173     int mode = RTLD_LAZY ;
8174 #endif
8175     handle = dlopen("./dyna.$dlext", mode) ;
8176     if (handle == NULL) {
8177         printf ("1\n") ;
8178         fflush (stdout) ;
8179         exit(0);
8180     }
8181     symbol = dlsym(handle, "fred") ;
8182     if (symbol == NULL) {
8183         /* try putting a leading underscore */
8184         symbol = dlsym(handle, "_fred") ;
8185         if (symbol == NULL) {
8186             printf ("2\n") ;
8187             fflush (stdout) ;
8188             exit(0);
8189         }
8190         printf ("3\n") ;
8191     }
8192     else
8193         printf ("4\n") ;
8194     fflush (stdout) ;
8195     exit(0);
8196 }
8197 EOM
8198         : Call the object file tmp-dyna.o in case dlext=o.
8199         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8200                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8201                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8202                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8203                 xxx=`./fred`
8204                 case $xxx in
8205                 1)      echo "Test program failed using dlopen." >&4
8206                         echo "Perhaps you should not use dynamic loading." >&4;;
8207                 2)      echo "Test program failed using dlsym." >&4
8208                         echo "Perhaps you should not use dynamic loading." >&4;;
8209                 3)      echo "dlsym needs a leading underscore" >&4
8210                         val="$define" ;;
8211                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8212                 esac
8213         else
8214                 echo "I can't compile and run the test program." >&4
8215                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8216         fi
8217         ;;
8218 esac
8219                 
8220 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8221
8222 set d_dlsymun
8223 eval $setvar
8224
8225 hasproto='varname=$1; func=$2; shift; shift;
8226 while $test $# -ge 2; do
8227         case "$1" in
8228         $define) echo "#include <$2>";;
8229         esac ;
8230     shift 2;
8231 done > try.c;
8232 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8233 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8234         echo "$func() prototype found.";
8235         val="$define";
8236 else
8237         echo "$func() prototype NOT found.";
8238         val="$undef";
8239 fi;
8240 set $varname;
8241 eval $setvar;
8242 $rm -f try.c tryout.c'
8243
8244 : see if prototype for drand48 is available
8245 echo " "
8246 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8247 eval $hasproto
8248
8249 : see if dup2 exists
8250 set dup2 d_dup2
8251 eval $inlibc
8252
8253 : see if eaccess exists
8254 set eaccess d_eaccess
8255 eval $inlibc
8256
8257 : see if endgrent exists
8258 set endgrent d_endgrent
8259 eval $inlibc
8260
8261 : see if endhostent exists
8262 set endhostent d_endhent
8263 eval $inlibc
8264
8265 : see if endnetent exists
8266 set endnetent d_endnent
8267 eval $inlibc
8268
8269 : see if endprotoent exists
8270 set endprotoent d_endpent
8271 eval $inlibc
8272
8273 : see if endpwent exists
8274 set endpwent d_endpwent
8275 eval $inlibc
8276
8277 : see if endservent exists
8278 set endservent d_endsent
8279 eval $inlibc
8280
8281 : see if endspent exists
8282 set endspent d_endspent
8283 eval $inlibc
8284
8285 : Locate the flags for 'open()'
8286 echo " "
8287 $cat >open3.c <<'EOCP'
8288 #include <sys/types.h>
8289 #ifdef I_FCNTL
8290 #include <fcntl.h>
8291 #endif
8292 #ifdef I_SYS_FILE
8293 #include <sys/file.h>
8294 #endif
8295 int main() {
8296         if(O_RDONLY);
8297 #ifdef O_TRUNC
8298         exit(0);
8299 #else
8300         exit(1);
8301 #endif
8302 }
8303 EOCP
8304 : check sys/file.h first to get FREAD on Sun
8305 if $test `./findhdr sys/file.h` && \
8306                 set open3 -DI_SYS_FILE && eval $compile; then
8307         h_sysfile=true;
8308         echo "<sys/file.h> defines the O_* constants..." >&4
8309         if ./open3; then
8310                 echo "and you have the 3 argument form of open()." >&4
8311                 val="$define"
8312         else
8313                 echo "but not the 3 argument form of open().  Oh, well." >&4
8314                 val="$undef"
8315         fi
8316 elif $test `./findhdr fcntl.h` && \
8317                 set open3 -DI_FCNTL && eval $compile; then
8318         h_fcntl=true;
8319         echo "<fcntl.h> defines the O_* constants..." >&4
8320         if ./open3; then
8321                 echo "and you have the 3 argument form of open()." >&4
8322                 val="$define"
8323         else
8324                 echo "but not the 3 argument form of open().  Oh, well." >&4
8325                 val="$undef"
8326         fi
8327 else
8328         val="$undef"
8329         echo "I can't find the O_* constant definitions!  You got problems." >&4
8330 fi
8331 set d_open3
8332 eval $setvar
8333 $rm -f open3*
8334
8335 : see which of string.h or strings.h is needed
8336 echo " "
8337 strings=`./findhdr string.h`
8338 if $test "$strings" && $test -r "$strings"; then
8339         echo "Using <string.h> instead of <strings.h>." >&4
8340         val="$define"
8341 else
8342         val="$undef"
8343         strings=`./findhdr strings.h`
8344         if $test "$strings" && $test -r "$strings"; then
8345                 echo "Using <strings.h> instead of <string.h>." >&4
8346         else
8347                 echo "No string header found -- You'll surely have problems." >&4
8348         fi
8349 fi
8350 set i_string
8351 eval $setvar
8352 case "$i_string" in
8353 "$undef") strings=`./findhdr strings.h`;;
8354 *)        strings=`./findhdr string.h`;;
8355 esac
8356
8357 : check for non-blocking I/O stuff
8358 case "$h_sysfile" in
8359 true) echo "#include <sys/file.h>" > head.c;;
8360 *)
8361         case "$h_fcntl" in
8362         true) echo "#include <fcntl.h>" > head.c;;
8363         *) echo "#include <sys/fcntl.h>" > head.c;;
8364         esac
8365         ;;
8366 esac
8367 echo " "
8368 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8369 case "$o_nonblock" in
8370 '')
8371         $cat head.c > try.c
8372         $cat >>try.c <<'EOCP'
8373 #include <stdio.h>
8374 int main() {
8375 #ifdef O_NONBLOCK
8376         printf("O_NONBLOCK\n");
8377         exit(0);
8378 #endif
8379 #ifdef O_NDELAY
8380         printf("O_NDELAY\n");
8381         exit(0);
8382 #endif
8383 #ifdef FNDELAY
8384         printf("FNDELAY\n");
8385         exit(0);
8386 #endif
8387         exit(0);
8388 }
8389 EOCP
8390         set try
8391         if eval $compile_ok; then
8392                 o_nonblock=`./try`
8393                 case "$o_nonblock" in
8394                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8395                 *) echo "Seems like we can use $o_nonblock.";;
8396                 esac
8397         else
8398                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8399         fi
8400         ;;
8401 *) echo "Using $hint value $o_nonblock.";;
8402 esac
8403 $rm -f try try.* .out core
8404
8405 echo " "
8406 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8407 case "$eagain" in
8408 '')
8409         $cat head.c > try.c
8410         $cat >>try.c <<EOCP
8411 #include <errno.h>
8412 #include <sys/types.h>
8413 #include <signal.h>
8414 #include <stdio.h> 
8415 #define MY_O_NONBLOCK $o_nonblock
8416 #ifndef errno  /* XXX need better Configure test */
8417 extern int errno;
8418 #endif
8419 #$i_unistd I_UNISTD
8420 #ifdef I_UNISTD
8421 #include <unistd.h>
8422 #endif
8423 #ifdef $i_string
8424 #include <string.h>
8425 #else
8426 #include <strings.h>
8427 #endif
8428 $signal_t blech(x) int x; { exit(3); }
8429 EOCP
8430         $cat >> try.c <<'EOCP'
8431 int main()
8432 {
8433         int pd[2];
8434         int pu[2];
8435         char buf[1];
8436         char string[100];
8437
8438         pipe(pd);       /* Down: child -> parent */
8439         pipe(pu);       /* Up: parent -> child */
8440         if (0 != fork()) {
8441                 int ret;
8442                 close(pd[1]);   /* Parent reads from pd[0] */
8443                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8444                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8445                         exit(1);
8446                 signal(SIGALRM, blech);
8447                 alarm(5);
8448                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8449                         exit(2);
8450                 sprintf(string, "%d\n", ret);
8451                 write(2, string, strlen(string));
8452                 alarm(0);
8453 #ifdef EAGAIN
8454                 if (errno == EAGAIN) {
8455                         printf("EAGAIN\n");
8456                         goto ok;
8457                 }
8458 #endif
8459 #ifdef EWOULDBLOCK
8460                 if (errno == EWOULDBLOCK)
8461                         printf("EWOULDBLOCK\n");
8462 #endif
8463         ok:
8464                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8465                 sleep(2);                               /* Give it time to close our pipe */
8466                 alarm(5);
8467                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8468                 alarm(0);
8469                 sprintf(string, "%d\n", ret);
8470                 write(3, string, strlen(string));
8471                 exit(0);
8472         }
8473
8474         close(pd[0]);                   /* We write to pd[1] */
8475         close(pu[1]);                   /* We read from pu[0] */
8476         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8477         close(pd[1]);                   /* Pipe pd is now fully closed! */
8478         exit(0);                                /* Bye bye, thank you for playing! */
8479 }
8480 EOCP
8481         set try
8482         if eval $compile_ok; then
8483                 echo "$startsh" >mtry
8484                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8485                 chmod +x mtry
8486                 ./mtry >/dev/null 2>&1
8487                 case $? in
8488                 0) eagain=`$cat try.out`;;
8489                 1) echo "Could not perform non-blocking setting!";;
8490                 2) echo "I did a successful read() for something that was not there!";;
8491                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8492                 *) echo "Something terribly wrong happened during testing.";;
8493                 esac
8494                 rd_nodata=`$cat try.ret`
8495                 echo "A read() system call with no data present returns $rd_nodata."
8496                 case "$rd_nodata" in
8497                 0|-1) ;;
8498                 *)
8499                         echo "(That's peculiar, fixing that to be -1.)"
8500                         rd_nodata=-1
8501                         ;;
8502                 esac
8503                 case "$eagain" in
8504                 '')
8505                         echo "Forcing errno EAGAIN on read() with no data available."
8506                         eagain=EAGAIN
8507                         ;;
8508                 *)
8509                         echo "Your read() sets errno to $eagain when no data is available."
8510                         ;;
8511                 esac
8512                 status=`$cat try.err`
8513                 case "$status" in
8514                 0) echo "And it correctly returns 0 to signal EOF.";;
8515                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8516                 *) echo "However, your read() returns '$status' on EOF??";;
8517                 esac
8518                 val="$define"
8519                 if test "$status" = "$rd_nodata"; then
8520                         echo "WARNING: you can't distinguish between EOF and no data!"
8521                         val="$undef"
8522                 fi
8523         else
8524                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8525                 eagain=EAGAIN
8526         fi
8527         set d_eofnblk
8528         eval $setvar
8529         ;;
8530 *)
8531         echo "Using $hint value $eagain."
8532         echo "Your read() returns $rd_nodata when no data is present."
8533         case "$d_eofnblk" in
8534         "$define") echo "And you can see EOF because read() returns 0.";;
8535         "$undef") echo "But you can't see EOF status from read() returned value.";;
8536         *)
8537                 echo "(Assuming you can't see EOF status from read anyway.)"
8538                 d_eofnblk=$undef
8539                 ;;
8540         esac
8541         ;;
8542 esac
8543 $rm -f try try.* .out core head.c mtry
8544
8545 : see if fchmod exists
8546 set fchmod d_fchmod
8547 eval $inlibc
8548
8549 : see if fchown exists
8550 set fchown d_fchown
8551 eval $inlibc
8552
8553 : see if this is an fcntl system
8554 set fcntl d_fcntl
8555 eval $inlibc
8556
8557 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8558 while $test $# -ge 2; do
8559         case "$1" in
8560         $define) echo "#include <$2>";;
8561         esac ;
8562     shift 2;
8563 done > try.c;
8564 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8565 set try;
8566 if eval $compile; then
8567         val="$define";
8568 else
8569         val="$undef";
8570 fi;
8571 set $varname;
8572 eval $setvar;
8573 $rm -f try.c try.o'
8574
8575 socketlib=''
8576 sockethdr=''
8577 : see whether socket exists
8578 echo " "
8579 $echo $n "Hmm... $c" >&4
8580 if set socket val -f d_socket; eval $csym; $val; then
8581         echo "Looks like you have Berkeley networking support." >&4
8582         d_socket="$define"
8583         if set setsockopt val -f; eval $csym; $val; then
8584                 d_oldsock="$undef"
8585         else
8586                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8587                 d_oldsock="$define"
8588         fi
8589 else
8590         if $contains socklib libc.list >/dev/null 2>&1; then
8591                 echo "Looks like you have Berkeley networking support." >&4
8592                 d_socket="$define"
8593                 : we will have to assume that it supports the 4.2 BSD interface
8594                 d_oldsock="$undef"
8595         else
8596                 echo "You don't have Berkeley networking in libc$_a..." >&4
8597                 if test "X$d_socket" = "X$define"; then
8598                    echo "...but you seem to believe that you have sockets." >&4
8599                 else
8600                         for net in net socket
8601                         do
8602                                 if test -f /usr/lib/lib$net$_a; then
8603                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8604                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8605                                         if $contains socket libc.list >/dev/null 2>&1; then
8606                                                 d_socket="$define"
8607                                                 socketlib="-l$net"
8608                                                 case "$net" in
8609                                                 net)
8610                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8611                                                         sockethdr="-I/usr/netinclude"
8612                                                         ;;
8613                                                 esac
8614                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8615                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8616                                                         d_oldsock="$undef"
8617                                                 else
8618                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8619                                                         d_oldsock="$define"
8620                                                 fi
8621                                                 break
8622                                         fi
8623                                 fi
8624                         done
8625                         if test "X$d_socket" != "X$define"; then
8626                            echo "or anywhere else I see." >&4
8627                            d_socket="$undef"
8628                            d_oldsock="$undef"
8629                         fi
8630                 fi
8631         fi
8632 fi
8633
8634 : see if socketpair exists
8635 set socketpair d_sockpair
8636 eval $inlibc
8637
8638
8639 echo " "
8640 echo "Checking the availability of certain socket constants..." >& 4
8641 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8642         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8643         $cat >try.c <<EOF
8644 #include <sys/types.h>
8645 #include <sys/socket.h>
8646 int main() {
8647     int i = $ENUM;
8648 }
8649 EOF
8650         val="$undef"
8651         set try; if eval $compile; then
8652                 val="$define"
8653         fi
8654         set d_${enum}; eval $setvar
8655         $rm -f try.c try
8656 done
8657
8658 : see if sys/select.h has to be included
8659 set sys/select.h i_sysselct
8660 eval $inhdr
8661
8662 : see if we should include time.h, sys/time.h, or both
8663 echo " "
8664 if test "X$timeincl" = X; then
8665         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8666         $echo $n "I'm now running the test program...$c"
8667         $cat >try.c <<'EOCP'
8668 #include <sys/types.h>
8669 #ifdef I_TIME
8670 #include <time.h>
8671 #endif
8672 #ifdef I_SYSTIME
8673 #ifdef SYSTIMEKERNEL
8674 #define KERNEL
8675 #endif
8676 #include <sys/time.h>
8677 #endif
8678 #ifdef I_SYSSELECT
8679 #include <sys/select.h>
8680 #endif
8681 int main()
8682 {
8683         struct tm foo;
8684 #ifdef S_TIMEVAL
8685         struct timeval bar;
8686 #endif
8687 #ifdef S_TIMEZONE
8688         struct timezone tzp;
8689 #endif
8690         if (foo.tm_sec == foo.tm_sec)
8691                 exit(0);
8692 #ifdef S_TIMEVAL
8693         if (bar.tv_sec == bar.tv_sec)
8694                 exit(0);
8695 #endif
8696         exit(1);
8697 }
8698 EOCP
8699         flags=''
8700         for s_timezone in '-DS_TIMEZONE' ''; do
8701         sysselect=''
8702         for s_timeval in '-DS_TIMEVAL' ''; do
8703         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8704         for i_time in '' '-DI_TIME'; do
8705         for i_systime in '-DI_SYSTIME' ''; do
8706                 case "$flags" in
8707                 '') $echo $n ".$c"
8708                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8709                         if eval $compile; then
8710                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8711                                 shift
8712                                 flags="$*"
8713                                 echo " "
8714                                 $echo $n "Succeeded with $flags$c"
8715                         fi
8716                         ;;
8717                 esac
8718         done
8719         done
8720         done
8721         done
8722         done
8723         timeincl=''
8724         echo " "
8725         case "$flags" in
8726         *SYSTIMEKERNEL*) i_systimek="$define"
8727                 timeincl=`./findhdr sys/time.h`
8728                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8729         *) i_systimek="$undef";;
8730         esac
8731         case "$flags" in
8732         *I_TIME*) i_time="$define"
8733                 timeincl=`./findhdr time.h`" $timeincl"
8734                 echo "We'll include <time.h>." >&4;;
8735         *) i_time="$undef";;
8736         esac
8737         case "$flags" in
8738         *I_SYSTIME*) i_systime="$define"
8739                 timeincl=`./findhdr sys/time.h`" $timeincl"
8740                 echo "We'll include <sys/time.h>." >&4;;
8741         *) i_systime="$undef";;
8742         esac
8743         $rm -f try.c try
8744 fi
8745
8746 : check for fd_set items
8747 $cat <<EOM
8748
8749 Checking to see how well your C compiler handles fd_set and friends ...
8750 EOM
8751 $cat >fd_set.c <<EOCP
8752 #$i_systime I_SYS_TIME
8753 #$i_sysselct I_SYS_SELECT
8754 #$d_socket HAS_SOCKET
8755 #include <sys/types.h>
8756 #ifdef HAS_SOCKET
8757 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8758 #endif
8759 #ifdef I_SYS_TIME
8760 #include <sys/time.h>
8761 #endif
8762 #ifdef I_SYS_SELECT
8763 #include <sys/select.h>
8764 #endif
8765 int main() {
8766         fd_set fds;
8767
8768 #ifdef TRYBITS
8769         if(fds.fds_bits);
8770 #endif
8771
8772 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8773         exit(0);
8774 #else
8775         exit(1);
8776 #endif
8777 }
8778 EOCP
8779 set fd_set -DTRYBITS
8780 if eval $compile; then
8781         d_fds_bits="$define"
8782         d_fd_set="$define"
8783         echo "Well, your system knows about the normal fd_set typedef..." >&4
8784         if ./fd_set; then
8785                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8786                 d_fd_macros="$define"
8787         else
8788                 $cat >&4 <<'EOM'
8789 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8790 EOM
8791                 d_fd_macros="$undef"
8792         fi
8793 else
8794         $cat <<'EOM'
8795 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8796 EOM
8797         set fd_set
8798         if eval $compile; then
8799                 d_fds_bits="$undef"
8800                 d_fd_set="$define"
8801                 echo "Well, your system has some sort of fd_set available..." >&4
8802                 if ./fd_set; then
8803                         echo "and you have the normal fd_set macros." >&4
8804                         d_fd_macros="$define"
8805                 else
8806                         $cat <<'EOM'
8807 but not the normal fd_set macros!  Gross!  More work for me...
8808 EOM
8809                         d_fd_macros="$undef"
8810                 fi
8811         else
8812         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8813                 d_fd_set="$undef"
8814                 d_fds_bits="$undef"
8815                 d_fd_macros="$undef"
8816         fi
8817 fi
8818 $rm -f fd_set*
8819
8820 : see if fgetpos exists
8821 set fgetpos d_fgetpos
8822 eval $inlibc
8823
8824 : see if flock exists
8825 set flock d_flock
8826 eval $inlibc
8827
8828 : see if fork exists
8829 set fork d_fork
8830 eval $inlibc
8831
8832 : see if pathconf exists
8833 set pathconf d_pathconf
8834 eval $inlibc
8835
8836 : see if fpathconf exists
8837 set fpathconf d_fpathconf
8838 eval $inlibc
8839
8840
8841 : check for off64_t
8842 echo " "
8843 echo "Checking to see if your system supports off64_t..." >&4
8844 $cat >try.c <<EOCP
8845 #include <sys/types.h>
8846 #include <unistd.h>
8847 int main() { off64_t x = 7; }'
8848 EOCP
8849 set try
8850 if eval $compile; then
8851         val="$define"
8852         echo "Yes, it does."
8853 else
8854         val="$undef"
8855         echo "No, it doesn't."
8856         case "$lseeksize" in
8857         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8858         esac
8859 fi
8860 $rm -f try.* try
8861 set d_off64_t
8862 eval $setvar
8863
8864 : check for fpos64_t
8865 echo " "
8866 echo "Checking to see if your system supports fpos64_t..." >&4
8867 $cat >try.c <<EOCP
8868 #include <sys/stdio.h>
8869 int main() { fpos64_t x x = 7; }'
8870 EOCP
8871 set try
8872 if eval $compile; then
8873         val="$define"
8874         echo "Yes, it does."
8875 else
8876         val="$undef"
8877         echo "No, it doesn't."
8878         case "$fpossize" in
8879         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8880         esac
8881 fi
8882 $rm -f try.* try
8883 set d_fpos64_t
8884 eval $setvar
8885
8886 hasstruct='varname=$1; struct=$2; shift; shift;
8887 while $test $# -ge 2; do
8888         case "$1" in
8889         $define) echo "#include <$2>";;
8890         esac ;
8891     shift 2;
8892 done > try.c;
8893 echo "int main () { struct $struct foo; }" >> try.c;
8894 set try;
8895 if eval $compile; then
8896         val="$define";
8897 else
8898         val="$undef";
8899 fi;
8900 set $varname;
8901 eval $setvar;
8902 $rm -f try.c try.o'
8903
8904 : see if this is a sys/param system
8905 set sys/param.h i_sysparam
8906 eval $inhdr
8907
8908 : see if this is a sys/mount.h system
8909 set sys/mount.h i_sysmount
8910 eval $inhdr
8911
8912 : see if sys/types.h has to be included
8913 set sys/types.h i_systypes
8914 eval $inhdr
8915
8916
8917 echo " "
8918 echo "Checking to see if your system supports struct fs_data..." >&4
8919 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8920 eval $hasstruct
8921 case "$d_fs_data_s" in
8922 "$define")      echo "Yes, it does."   ;;
8923 *)              echo "No, it doesn't." ;;
8924 esac
8925
8926 : see if fseeko exists
8927 set fseeko d_fseeko
8928 eval $inlibc
8929 case "$longsize" in
8930 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8931 esac
8932
8933 : see if fsetpos exists
8934 set fsetpos d_fsetpos
8935 eval $inlibc
8936
8937
8938 : see if fstatfs exists
8939 set fstatfs d_fstatfs
8940 eval $inlibc
8941
8942
8943 : see if statvfs exists
8944 set statvfs d_statvfs
8945 eval $inlibc
8946
8947 : see if fstatvfs exists
8948 set fstatvfs d_fstatvfs
8949 eval $inlibc
8950
8951
8952 : see if ftello exists
8953 set ftello d_ftello
8954 eval $inlibc
8955 case "$longsize" in
8956 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8957 esac
8958
8959 : see if getgrent exists
8960 set getgrent d_getgrent
8961 eval $inlibc
8962
8963 : see if gethostbyaddr exists
8964 set gethostbyaddr d_gethbyaddr
8965 eval $inlibc
8966
8967 : see if gethostbyname exists
8968 set gethostbyname d_gethbyname
8969 eval $inlibc
8970
8971 : see if gethostent exists
8972 set gethostent d_gethent
8973 eval $inlibc
8974
8975 : see how we will look up host name
8976 echo " "
8977 call=''
8978 if set gethostname val -f d_gethname; eval $csym; $val; then
8979         echo 'gethostname() found.' >&4
8980         d_gethname="$define"
8981         call=gethostname
8982 fi
8983 if set uname val -f d_uname; eval $csym; $val; then
8984         if ./xenix; then
8985                 $cat <<'EOM'
8986 uname() was found, but you're running xenix, and older versions of xenix
8987 have a broken uname(). If you don't really know whether your xenix is old
8988 enough to have a broken system call, use the default answer.
8989
8990 EOM
8991                 dflt=y
8992                 case "$d_uname" in
8993                 "$define") dflt=n;;
8994                 esac
8995                 rp='Is your uname() broken?'
8996                 . ./myread
8997                 case "$ans" in
8998                 n*) d_uname="$define"; call=uname;;
8999                 esac
9000         else
9001                 echo 'uname() found.' >&4
9002                 d_uname="$define"
9003                 case "$call" in
9004                 '') call=uname ;;
9005                 esac
9006         fi
9007 fi
9008 case "$d_gethname" in
9009 '') d_gethname="$undef";;
9010 esac
9011 case "$d_uname" in
9012 '') d_uname="$undef";;
9013 esac
9014 case "$d_uname$d_gethname" in
9015 *define*)
9016         dflt=n
9017         cat <<EOM
9018  
9019 Every now and then someone has a $call() that lies about the hostname
9020 but can't be fixed for political or economic reasons.  If you wish, I can
9021 pretend $call() isn't there and maybe compute hostname at run-time
9022 thanks to the '$phostname' command.
9023
9024 EOM
9025         rp="Shall I ignore $call() from now on?"
9026         . ./myread
9027         case "$ans" in
9028         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9029         esac;;
9030 esac
9031 case "$phostname" in
9032 '') aphostname='';;
9033 *) case "$aphostname" in
9034         /*) ;;
9035         *) set X $phostname
9036                 shift
9037                 file=$1
9038                 shift
9039                 file=`./loc $file $file $pth`
9040                 aphostname=`echo $file $*`
9041                 ;;
9042         esac
9043         ;;
9044 esac
9045 case "$d_uname$d_gethname" in
9046 *define*) ;;
9047 *)
9048         case "$phostname" in
9049         '')
9050                 echo "There will be no way for $package to get your hostname." >&4;;
9051         *)
9052         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9053                 ;;
9054         esac;;
9055 esac
9056 case "$d_phostname" in
9057 '') d_phostname="$undef";;
9058 esac
9059
9060 : see if this is a netdb.h system
9061 set netdb.h i_netdb
9062 eval $inhdr
9063
9064 : see if prototypes for various gethostxxx netdb.h functions are available
9065 echo " "
9066 set d_gethostprotos gethostent $i_netdb netdb.h
9067 eval $hasproto
9068
9069 : see if getlogin exists
9070 set getlogin d_getlogin
9071 eval $inlibc
9072
9073 : see if getmnt exists
9074 set getmnt d_getmnt
9075 eval $inlibc
9076
9077 : see if getmntent exists
9078 set getmntent d_getmntent
9079 eval $inlibc
9080
9081 : see if getnetbyaddr exists
9082 set getnetbyaddr d_getnbyaddr
9083 eval $inlibc
9084
9085 : see if getnetbyname exists
9086 set getnetbyname d_getnbyname
9087 eval $inlibc
9088
9089 : see if getnetent exists
9090 set getnetent d_getnent
9091 eval $inlibc
9092
9093 : see if prototypes for various getnetxxx netdb.h functions are available
9094 echo " "
9095 set d_getnetprotos getnetent $i_netdb netdb.h
9096 eval $hasproto
9097
9098
9099 : see if getprotobyname exists
9100 set getprotobyname d_getpbyname
9101 eval $inlibc
9102
9103 : see if getprotobynumber exists
9104 set getprotobynumber d_getpbynumber
9105 eval $inlibc
9106
9107 : see if getprotoent exists
9108 set getprotoent d_getpent
9109 eval $inlibc
9110
9111 : see if getpgid exists
9112 set getpgid d_getpgid
9113 eval $inlibc
9114
9115 : see if getpgrp2 exists
9116 set getpgrp2 d_getpgrp2
9117 eval $inlibc
9118
9119 : see if getppid exists
9120 set getppid d_getppid
9121 eval $inlibc
9122
9123 : see if getpriority exists
9124 set getpriority d_getprior
9125 eval $inlibc
9126
9127 : see if prototypes for various getprotoxxx netdb.h functions are available
9128 echo " "
9129 set d_getprotoprotos getprotoent $i_netdb netdb.h
9130 eval $hasproto
9131
9132 : see if getpwent exists
9133 set getpwent d_getpwent
9134 eval $inlibc
9135
9136
9137 : see if getservbyname exists
9138 set getservbyname d_getsbyname
9139 eval $inlibc
9140
9141 : see if getservbyport exists
9142 set getservbyport d_getsbyport
9143 eval $inlibc
9144
9145 : see if getservent exists
9146 set getservent d_getsent
9147 eval $inlibc
9148
9149 : see if prototypes for various getservxxx netdb.h functions are available
9150 echo " "
9151 set d_getservprotos getservent $i_netdb netdb.h
9152 eval $hasproto
9153
9154 : see if getspent exists
9155 set getspent d_getspent
9156 eval $inlibc
9157
9158 : see if getspnam exists
9159 set getspnam d_getspnam
9160 eval $inlibc
9161
9162 : see if gettimeofday or ftime exists
9163 set gettimeofday d_gettimeod
9164 eval $inlibc
9165 case "$d_gettimeod" in
9166 "$undef")
9167         set ftime d_ftime 
9168         eval $inlibc
9169         ;;
9170 *)
9171         val="$undef"; set d_ftime; eval $setvar
9172         ;;
9173 esac
9174 case "$d_gettimeod$d_ftime" in
9175 "$undef$undef")
9176         echo " "
9177         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9178         ;;
9179 esac
9180
9181 : see if this is an grp system
9182 set grp.h i_grp
9183 eval $inhdr
9184
9185 case "$i_grp" in
9186 $define)
9187         xxx=`./findhdr grp.h`
9188         $cppstdin $cppflags $cppminus < $xxx >$$.h
9189
9190         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9191                 val="$define"
9192         else
9193                 val="$undef"
9194         fi
9195         set d_grpasswd
9196         eval $setvar
9197
9198         $rm -f $$.h
9199         ;;
9200 *)
9201         val="$undef";
9202         set d_grpasswd; eval $setvar
9203         ;;
9204 esac
9205
9206 : see if hasmntopt exists
9207 set hasmntopt d_hasmntopt
9208 eval $inlibc
9209
9210 : see if this is a netinet/in.h or sys/in.h system
9211 set netinet/in.h i_niin sys/in.h i_sysin
9212 eval $inhdr
9213
9214 : see if arpa/inet.h has to be included
9215 set arpa/inet.h i_arpainet
9216 eval $inhdr
9217
9218 : see if htonl --and friends-- exists
9219 val=''
9220 set htonl val
9221 eval $inlibc
9222
9223 : Maybe they are macros.
9224 case "$val" in
9225 $undef)
9226         $cat >htonl.c <<EOM
9227 #include <stdio.h>
9228 #include <sys/types.h>
9229 #$i_niin I_NETINET_IN
9230 #$i_sysin I_SYS_IN
9231 #$i_arpainet I_ARPA_INET
9232 #ifdef I_NETINET_IN
9233 #include <netinet/in.h>
9234 #endif
9235 #ifdef I_SYS_IN
9236 #include <sys/in.h>
9237 #endif
9238 #ifdef I_ARPA_INET
9239 #include <arpa/inet.h>
9240 #endif
9241 #ifdef htonl
9242 printf("Defined as a macro.");
9243 #endif
9244 EOM
9245         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9246         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9247                 val="$define"
9248                 echo "But it seems to be defined as a macro." >&4
9249         fi
9250         $rm -f htonl.?
9251         ;;
9252 esac
9253 set d_htonl
9254 eval $setvar
9255
9256 : index or strchr
9257 echo " "
9258 if set index val -f; eval $csym; $val; then
9259         if set strchr val -f d_strchr; eval $csym; $val; then
9260                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9261                         val="$define"
9262                         vali="$undef"
9263                         echo "strchr() found." >&4
9264                 else
9265                         val="$undef"
9266                         vali="$define"
9267                         echo "index() found." >&4
9268                 fi
9269         else
9270                 val="$undef"
9271                 vali="$define"
9272                 echo "index() found." >&4
9273         fi
9274 else
9275         if set strchr val -f d_strchr; eval $csym; $val; then
9276                 val="$define"
9277                 vali="$undef"
9278                 echo "strchr() found." >&4
9279         else
9280                 echo "No index() or strchr() found!" >&4
9281                 val="$undef"
9282                 vali="$undef"
9283         fi
9284 fi
9285 set d_strchr; eval $setvar
9286 val="$vali"
9287 set d_index; eval $setvar
9288
9289 : check whether inet_aton exists
9290 set inet_aton d_inetaton
9291 eval $inlibc
9292
9293 : Look for isascii
9294 echo " "
9295 $cat >isascii.c <<'EOCP'
9296 #include <stdio.h>
9297 #include <ctype.h>
9298 int main() {
9299         int c = 'A';
9300         if (isascii(c))
9301                 exit(0);
9302         else
9303                 exit(1);
9304 }
9305 EOCP
9306 set isascii
9307 if eval $compile; then
9308         echo "isascii() found." >&4
9309         val="$define"
9310 else
9311         echo "isascii() NOT found." >&4
9312         val="$undef"
9313 fi
9314 set d_isascii
9315 eval $setvar
9316 $rm -f isascii*
9317
9318 : see if killpg exists
9319 set killpg d_killpg
9320 eval $inlibc
9321
9322 : see if lchown exists
9323 echo " "
9324 $cat > try.c <<'EOCP'
9325 /* System header to define __stub macros and hopefully few prototypes,
9326     which can conflict with char lchown(); below.  */
9327 #include <assert.h>
9328 /* Override any gcc2 internal prototype to avoid an error.  */
9329 /* We use char because int might match the return type of a gcc2
9330    builtin and then its argument prototype would still apply.  */
9331 char lchown();
9332 int main() {
9333     /*  The GNU C library defines this for functions which it implements
9334         to always fail with ENOSYS.  Some functions are actually named
9335         something starting with __ and the normal name is an alias.  */
9336 #if defined (__stub_lchown) || defined (__stub___lchown)
9337 choke me
9338 #else
9339 lchown();
9340 #endif
9341 ; return 0; }
9342 EOCP
9343 set try
9344 if eval $compile; then
9345     $echo "lchown() found." >&4
9346     val="$define"
9347 else
9348     $echo "lchown() NOT found." >&4
9349     val="$undef"
9350 fi
9351 set d_lchown
9352 eval $setvar
9353
9354 : See if number of significant digits in a double precision number is known
9355 echo " "
9356 $cat >ldbl_dig.c <<EOM
9357 #$i_limits I_LIMITS
9358 #$i_float I_FLOAT
9359 #ifdef I_LIMITS
9360 #include <limits.h>
9361 #endif
9362 #ifdef I_FLOAT
9363 #include <float.h>
9364 #endif
9365 #ifdef LDBL_DIG
9366 printf("Contains LDBL_DIG");
9367 #endif
9368 EOM
9369 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9370 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9371         echo "LDBL_DIG found." >&4
9372         val="$define"
9373 else
9374         echo "LDBL_DIG NOT found." >&4
9375         val="$undef"
9376 fi
9377 $rm -f ldbl_dig.?
9378 set d_ldbl_dig
9379 eval $setvar
9380
9381 : see if link exists
9382 set link d_link
9383 eval $inlibc
9384
9385 : see if localeconv exists
9386 set localeconv d_locconv
9387 eval $inlibc
9388
9389 : see if lockf exists
9390 set lockf d_lockf
9391 eval $inlibc
9392
9393 : check for long long
9394 echo " "
9395 $echo $n "Checking to see if your system supports long long..." $c >&4
9396 echo 'int main() { long long x = 7; return 0; }' > try.c
9397 set try
9398 if eval $compile; then
9399         val="$define"
9400         echo " Yes, it does." >&4
9401 else
9402         val="$undef"
9403         echo " No, it doesn't." >&4
9404 fi
9405 $rm try.*
9406 set d_longlong
9407 eval $setvar
9408
9409 : check for length of long long
9410 case "${d_longlong}${longlongsize}" in
9411 $define)
9412         echo " "
9413         $echo $n "Checking to see how big your long longs are..." $c >&4
9414         $cat >try.c <<'EOCP'
9415 #include <stdio.h>
9416 int main()
9417 {
9418     printf("%d\n", (int)sizeof(long long));
9419     return(0);
9420 }
9421 EOCP
9422         set try
9423         if eval $compile_ok; then
9424                 longlongsize=`./try$exe_ext`
9425                 $echo " $longlongsize bytes." >&4
9426         else
9427                 dflt='8'
9428                 echo " "
9429                 echo "(I can't seem to compile the test program.  Guessing...)"
9430                 rp="What is the size of a long long (in bytes)?"
9431                 . ./myread
9432                 longlongsize="$ans"
9433         fi
9434         if $test "X$longsize" = "X$longlongsize"; then
9435                 echo "(That isn't any different from an ordinary long.)"
9436         fi      
9437         ;;
9438 esac
9439 $rm -f try.* try
9440
9441 : see if lstat exists
9442 set lstat d_lstat
9443 eval $inlibc
9444
9445 : see if mblen exists
9446 set mblen d_mblen
9447 eval $inlibc
9448
9449 : see if mbstowcs exists
9450 set mbstowcs d_mbstowcs
9451 eval $inlibc
9452
9453 : see if mbtowc exists
9454 set mbtowc d_mbtowc
9455 eval $inlibc
9456
9457 : see if memchr exists
9458 set memchr d_memchr
9459 eval $inlibc
9460
9461 : see if memcmp exists
9462 set memcmp d_memcmp
9463 eval $inlibc
9464
9465 : see if memcpy exists
9466 set memcpy d_memcpy
9467 eval $inlibc
9468
9469 : see if memmove exists
9470 set memmove d_memmove
9471 eval $inlibc
9472
9473 : see if memset exists
9474 set memset d_memset
9475 eval $inlibc
9476
9477 : see if mkdir exists
9478 set mkdir d_mkdir
9479 eval $inlibc
9480
9481 : see if mkfifo exists
9482 set mkfifo d_mkfifo
9483 eval $inlibc
9484
9485 : see if mktime exists
9486 set mktime d_mktime
9487 eval $inlibc
9488
9489 : see if msgctl exists
9490 set msgctl d_msgctl
9491 eval $inlibc
9492
9493 : see if msgget exists
9494 set msgget d_msgget
9495 eval $inlibc
9496
9497 : see if msgsnd exists
9498 set msgsnd d_msgsnd
9499 eval $inlibc
9500
9501 : see if msgrcv exists
9502 set msgrcv d_msgrcv
9503 eval $inlibc
9504
9505 : see how much of the 'msg*(2)' library is present.
9506 h_msg=true
9507 echo " "
9508 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9509 *"$undef"*) h_msg=false;;
9510 esac
9511 case "$osname" in
9512 freebsd)
9513     case "`ipcs 2>&1`" in
9514     "SVID messages"*"not configured"*)
9515         echo "Your $osname does not have the msg*(2) configured." >&4
9516         h_msg=false
9517         val="$undef"
9518         set msgctl d_msgctl
9519         eval $setvar
9520         set msgget d_msgget
9521         eval $setvar
9522         set msgsnd d_msgsnd
9523         eval $setvar
9524         set msgrcv d_msgrcv
9525         eval $setvar
9526         ;;
9527     esac
9528     ;;
9529 esac
9530 : we could also check for sys/ipc.h ...
9531 if $h_msg && $test `./findhdr sys/msg.h`; then
9532         echo "You have the full msg*(2) library." >&4
9533         val="$define"
9534 else
9535         echo "You don't have the full msg*(2) library." >&4
9536         val="$undef"
9537 fi
9538 set d_msg
9539 eval $setvar
9540
9541 : see if nice exists
9542 set nice d_nice
9543 eval $inlibc
9544
9545 : see if inttypes.h is available
9546 : we want a real compile instead of Inhdr because some systems
9547 : have an inttypes.h which includes non-existent headers
9548 echo " "
9549 $cat >try.c <<EOCP
9550 #include <inttypes.h>
9551 int main() {
9552         static int32_t foo32 = 0x12345678;
9553 }
9554 EOCP
9555 set try
9556 if eval $compile; then
9557         echo "<inttypes.h> found." >&4
9558         val="$define"
9559 else
9560         echo "<inttypes.h> NOT found." >&4
9561         val="$undef"
9562 fi
9563 $rm -f try.c try
9564 set i_inttypes
9565 eval $setvar
9566
9567 : check for int64_t
9568 echo " "
9569 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9570 $cat >try.c <<EOCP
9571 #include <sys/types.h>
9572 #$i_inttypes I_INTTYPES
9573 #ifdef I_INTTYPES
9574 #include <inttypes.h>
9575 #endif
9576 int main() { int64_t x = 7; }
9577 EOCP
9578 set try
9579 if eval $compile; then
9580         val="$define"
9581         echo " Yes, it does." >&4
9582 else
9583         val="$undef"
9584         echo " No, it doesn't." >&4
9585 fi
9586 $rm -f try try.*
9587 set d_int64t
9588 eval $setvar
9589
9590
9591 echo " "
9592 echo "Checking which 64-bit integer type we could use..." >&4
9593
9594 case "$intsize" in
9595 8) val=int
9596    set quadtype
9597    eval $setvar
9598    val='"unsigned int"'
9599    set uquadtype
9600    eval $setvar
9601    quadkind=1
9602    ;;
9603 *) case "$longsize" in
9604    8) val=long
9605       set quadtype
9606       eval $setvar
9607       val='"unsigned long"'
9608       set uquadtype
9609       eval $setvar
9610       quadkind=2
9611       ;;
9612    *) case "$uselonglong:$d_longlong:$longlongsize" in
9613       define:define:8)
9614         val='"long long"'
9615         set quadtype
9616         eval $setvar
9617         val='"unsigned long long"'
9618         set uquadtype
9619         eval $setvar
9620         quadkind=3
9621         ;;
9622       *) case "$d_int64t" in
9623          define)
9624            val=int64_t
9625            set quadtype
9626            eval $setvar
9627            val=uint64_t
9628            set uquadtype
9629            eval $setvar
9630            quadkind=4
9631            ;;
9632          esac
9633          ;;
9634       esac
9635       ;;
9636    esac
9637    ;;
9638 esac
9639
9640 case "$quadtype" in
9641 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9642         undef:define:8)
9643            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9644         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9645         esac
9646         d_quad="$undef"
9647         ;;
9648 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9649             verb="will"
9650         else
9651             verb="could"
9652         fi
9653         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9654         d_quad="$define"
9655         ;;
9656 esac
9657
9658 : check for length of character
9659 echo " "
9660 case "$charsize" in
9661 '')
9662         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9663         $cat >try.c <<'EOCP'
9664 #include <stdio.h>
9665 int main()
9666 {
9667     printf("%d\n", (int)sizeof(char));
9668     exit(0);
9669 }
9670 EOCP
9671         set try
9672         if eval $compile_ok; then
9673                 dflt=`./try`
9674         else
9675                 dflt='1'
9676                 echo "(I can't seem to compile the test program.  Guessing...)"
9677         fi
9678         ;;
9679 *)
9680         dflt="$charsize"
9681         ;;
9682 esac
9683 rp="What is the size of a character (in bytes)?"
9684 . ./myread
9685 charsize="$ans"
9686 $rm -f try.c try
9687
9688
9689 echo " "
9690 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9691
9692 case "$use64bits:$d_quad:$quadtype" in
9693 define:define:?*)
9694         ivtype="$quadtype"
9695         uvtype="$uquadtype"
9696         ivsize=8
9697         uvsize=8
9698         ;;
9699 *)      ivtype="long"
9700         uvtype="unsigned long"
9701         ivsize=$longsize
9702         uvsize=$longsize
9703         ;;
9704 esac
9705
9706 case "$uselongdouble:$d_longdbl" in
9707 define:define)
9708         nvtype="long double"
9709         nvsize=$longdblsize
9710         ;;
9711 *)      nvtype=double
9712         nvsize=$doublesize
9713         ;;
9714 esac
9715
9716 $echo "(IV will be "$ivtype", $ivsize bytes)"
9717 $echo "(UV will be "$uvtype", $uvsize bytes)"
9718 $echo "(NV will be "$nvtype", $nvsize bytes)"
9719
9720 $cat >try.c <<EOCP
9721 #$i_inttypes I_INTTYPES
9722 #ifdef I_INTTYPES
9723 #include <inttypes.h>
9724 #endif
9725 #include <stdio.h>
9726 int main() {
9727 #ifdef INT8
9728    int8_t i =  INT8_MAX;
9729   uint8_t u = UINT8_MAX;
9730   printf("int8_t\n");
9731 #endif
9732 #ifdef INT16
9733    int16_t i =  INT16_MAX;
9734   uint16_t i = UINT16_MAX;
9735   printf("int16_t\n");
9736 #endif
9737 #ifdef INT32
9738    int32_t i =  INT32_MAX;
9739   uint32_t u = UINT32_MAX;
9740   printf("int32_t\n");
9741 #endif
9742 }
9743 EOCP
9744
9745 case "$i8type" in
9746 '')     case "$charsize" in
9747         1)      i8type=char
9748                 u8type="unsigned char"
9749                 i8size=$charsize
9750                 u8size=$charsize
9751                 ;;
9752         esac
9753         ;;
9754 esac
9755 case "$i8type" in
9756 '')     set try -DINT8
9757         if eval $compile; then
9758                 case "`./try$exe_ext`" in
9759                 int8_t) i8type=int8_t
9760                         u8type=uint8_t
9761                         i8size=1
9762                         u8size=1
9763                         ;;
9764                 esac
9765         fi
9766         ;;
9767 esac
9768 case "$i8type" in
9769 '')     if $test $charsize -ge 1; then
9770                 i8type=char
9771                 u8type="unsigned char"
9772                 i8size=$charsize
9773                 u8size=$charsize
9774         fi
9775         ;;
9776 esac
9777
9778 case "$i16type" in
9779 '')     case "$shortsize" in
9780         2)      i16type=short
9781                 u16type="unsigned short"
9782                 i16size=$shortsize
9783                 u16size=$shortsize
9784                 ;;
9785         esac
9786         ;;
9787 esac
9788 case "$i16type" in
9789 '')     set try -DINT16
9790         if eval $compile; then
9791                 case "`./try$exe_ext`" in
9792                 int16_t)
9793                         i16type=int16_t
9794                         u16type=uint16_t
9795                         i16size=2
9796                         u16size=2
9797                         ;;
9798                 esac
9799         fi
9800         ;;
9801 esac
9802 case "$i16type" in
9803 '')     if $test $shortsize -ge 2; then
9804                 i16type=short
9805                 u16type="unsigned short"
9806                 i16size=$shortsize
9807                 u16size=$shortsize
9808         fi
9809         ;;
9810 esac
9811
9812 case "$i32type" in
9813 '')     case "$longsize" in
9814         4)      i32type=long
9815                 u32type="unsigned long"
9816                 i32size=$longsize
9817                 u32size=$longsize
9818                 ;;
9819         *)      case "$intsize" in
9820                 4)      i32type=int
9821                         u32type="unsigned int"
9822                         i32size=$intsize
9823                         u32size=$intsize
9824                         ;;
9825                 esac
9826                 ;;
9827         esac
9828         ;;
9829 esac
9830 case "$i32type" in
9831 '')     set try -DINT32
9832         if eval $compile; then
9833                 case "`./try$exe_ext`" in
9834                 int32_t)
9835                         i32type=int32_t
9836                         u32type=uint32_t
9837                         i32size=4
9838                         u32size=4
9839                         ;;
9840                 esac
9841         fi
9842         ;;
9843 esac
9844 case "$i32type" in
9845 '')     if $test $intsize -ge 4; then
9846                 i32type=int
9847                 u32type="unsigned int"
9848                 i32size=$intsize
9849                 u32size=$intsize
9850         fi
9851         ;;
9852 esac
9853
9854 case "$i64type" in
9855 '')     case "$d_quad:$quadtype" in
9856         define:?*)
9857                 i64type="$quadtype"
9858                 u64type="$uquadtype"
9859                 i64size=8
9860                 u64size=8
9861                 ;;
9862         esac
9863         ;;
9864 esac
9865
9866 $echo "Checking whether your NVs can preserve your UVs..." >&4
9867 $cat <<EOP >try.c
9868 #include <stdio.h>
9869 int main() {
9870     $uvtype k = ($uvtype)~0, l;
9871     $nvtype d;
9872     l = k;
9873     d = ($nvtype)l;
9874     l = ($uvtype)d;
9875     if (l == k)
9876        printf("preserve\n");
9877     exit(0);
9878 }
9879 EOP
9880 set try
9881 if eval $compile; then
9882         case "`./try$exe_ext`" in
9883         preserve) d_nvpresuv="$define" ;;
9884         esac
9885 fi      
9886 case "$d_nvpresuv" in
9887 $define) $echo "Yes, they can."  2>&1 ;;
9888 *)       $echo "No, they can't." 2>&1
9889          d_nvpresuv="$undef"
9890          ;;
9891 esac
9892
9893 $rm -f try.* try
9894
9895 : see if POSIX threads are available
9896 set pthread.h i_pthread
9897 eval $inhdr
9898
9899
9900
9901
9902 : how to create joinable pthreads
9903 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9904         echo " "
9905         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9906         $cat >try.c <<'EOCP'
9907 #include <pthread.h>
9908 int main() {
9909     int detachstate = JOINABLE;
9910 }
9911 EOCP
9912         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9913         if eval $compile; then
9914                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9915                 val="$undef" # Yes, undef.
9916                 set d_old_pthread_create_joinable
9917                 eval $setvar
9918                 val=""
9919                 set old_pthread_create_joinable
9920                 eval $setvar
9921         else
9922                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9923                 if eval $compile; then
9924                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9925                         val="$define"
9926                         set d_old_pthread_create_joinable
9927                         eval $setvar
9928                         val=PTHREAD_CREATE_UNDETACHED
9929                         set old_pthread_create_joinable
9930                         eval $setvar
9931                 else            
9932                         set try -DJOINABLE=__UNDETACHED
9933                         if eval $compile; then
9934                                 echo "You seem to use __UNDETACHED." >&4
9935                                 val="$define"
9936                                 set d_old_pthread_create_joinable
9937                                 eval $setvar
9938                                 val=__UNDETACHED
9939                                 set old_pthread_create_joinable
9940                                 eval $setvar
9941                         else
9942                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9943                                 val="$define"
9944                                 set d_old_pthread_create_joinable
9945                                 eval $setvar
9946                                 val=0
9947                                 set old_pthread_create_joinable
9948                                 eval $setvar
9949                         fi
9950                 fi
9951         fi
9952         $rm -f try try.*
9953 else
9954     d_old_pthread_create_joinable="$undef"
9955     old_pthread_create_joinable=""
9956 fi
9957
9958 : see if pause exists
9959 set pause d_pause
9960 eval $inlibc
9961
9962 : see if pipe exists
9963 set pipe d_pipe
9964 eval $inlibc
9965
9966 : see if poll exists
9967 set poll d_poll
9968 eval $inlibc
9969
9970
9971 : see whether the various POSIXish _yields exist
9972 $cat >try.c <<EOP
9973 #include <pthread.h>
9974 #include <stdio.h>
9975 int main() {
9976 #ifdef SCHED_YIELD
9977         sched_yield();
9978 #else
9979 #ifdef PTHREAD_YIELD
9980         pthread_yield();
9981 #else
9982 #ifdef PTHREAD_YIELD_NULL
9983         pthread_yield(NULL);
9984 #endif
9985 #endif
9986 #endif
9987 }
9988 EOP
9989 : see if sched_yield exists
9990 set try -DSCHED_YIELD
9991 if eval $compile; then
9992     val="$define"
9993     sched_yield='sched_yield()'
9994 else
9995     val="$undef"
9996 fi
9997 case "$usethreads" in
9998 $define)
9999         case "$val" in
10000         $define) echo 'sched_yield() found.' >&4        ;;
10001         *)       echo 'sched_yield() NOT found.' >&4    ;;
10002         esac
10003 esac
10004 set d_sched_yield
10005 eval $setvar
10006
10007 : see if pthread_yield exists
10008 set try -DPTHREAD_YIELD
10009 if eval $compile; then
10010     val="$define"
10011     case "$sched_yield" in
10012     '') sched_yield='pthread_yield()' ;;
10013     esac
10014 else
10015     set try -DPTHREAD_YIELD_NULL
10016     if eval $compile; then
10017         val="$define"
10018         case "$sched_yield" in
10019         '') sched_yield='pthread_yield(NULL)' ;;
10020         esac
10021     else
10022         val="$undef"
10023     fi
10024 fi
10025 case "$usethreads" in
10026 $define)
10027         case "$val" in
10028         $define) echo 'pthread_yield() found.' >&4      ;;
10029         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10030         esac
10031         ;;
10032 esac
10033 set d_pthread_yield
10034 eval $setvar
10035
10036 case "$sched_yield" in
10037 '') sched_yield=undef ;;
10038 esac
10039
10040 $rm -f try try.*
10041
10042 : see if this is a pwd.h system
10043 set pwd.h i_pwd
10044 eval $inhdr
10045
10046 case "$i_pwd" in
10047 $define)
10048         xxx=`./findhdr pwd.h`
10049         $cppstdin $cppflags $cppminus < $xxx >$$.h
10050
10051         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10052                 val="$define"
10053         else
10054                 val="$undef"
10055         fi
10056         set d_pwquota
10057         eval $setvar
10058
10059         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10060                 val="$define"
10061         else
10062                 val="$undef"
10063         fi
10064         set d_pwage
10065         eval $setvar
10066
10067         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10068                 val="$define"
10069         else
10070                 val="$undef"
10071         fi
10072         set d_pwchange
10073         eval $setvar
10074
10075         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10076                 val="$define"
10077         else
10078                 val="$undef"
10079         fi
10080         set d_pwclass
10081         eval $setvar
10082
10083         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10084                 val="$define"
10085         else
10086                 val="$undef"
10087         fi
10088         set d_pwexpire
10089         eval $setvar
10090
10091         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10092                 val="$define"
10093         else
10094                 val="$undef"
10095         fi
10096         set d_pwcomment
10097         eval $setvar
10098
10099         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10100                 val="$define"
10101         else
10102                 val="$undef"
10103         fi
10104         set d_pwgecos
10105         eval $setvar
10106
10107         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10108                 val="$define"
10109         else
10110                 val="$undef"
10111         fi
10112         set d_pwpasswd
10113         eval $setvar
10114
10115         $rm -f $$.h
10116         ;;
10117 *)
10118         val="$undef"; 
10119         set d_pwquota; eval $setvar
10120         set d_pwage; eval $setvar
10121         set d_pwchange; eval $setvar
10122         set d_pwclass; eval $setvar
10123         set d_pwexpire; eval $setvar
10124         set d_pwcomment; eval $setvar
10125         set d_pwgecos; eval $setvar
10126         set d_pwpasswd; eval $setvar
10127         ;;
10128 esac
10129
10130 : see if readdir and friends exist
10131 set readdir d_readdir
10132 eval $inlibc
10133 set seekdir d_seekdir
10134 eval $inlibc
10135 set telldir d_telldir
10136 eval $inlibc
10137 set rewinddir d_rewinddir
10138 eval $inlibc
10139
10140 : see if readlink exists
10141 set readlink d_readlink
10142 eval $inlibc
10143
10144 : see if rename exists
10145 set rename d_rename
10146 eval $inlibc
10147
10148 : see if rmdir exists
10149 set rmdir d_rmdir
10150 eval $inlibc
10151
10152 : see if memory.h is available.
10153 val=''
10154 set memory.h val
10155 eval $inhdr
10156
10157 : See if it conflicts with string.h
10158 case "$val" in
10159 $define)
10160         case "$strings" in
10161         '') ;;
10162         *)
10163                 $cppstdin $cppflags $cppminus < $strings > mem.h
10164                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10165                         echo " "
10166                         echo "We won't be including <memory.h>."
10167                         val="$undef"
10168                 fi
10169                 $rm -f mem.h
10170                 ;;
10171         esac
10172 esac
10173 set i_memory
10174 eval $setvar
10175
10176 : can bcopy handle overlapping blocks?
10177 val="$undef"
10178 case "$d_bcopy" in
10179 "$define")
10180         echo " "
10181         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10182         $cat >try.c <<EOCP
10183 #$i_memory I_MEMORY
10184 #$i_stdlib I_STDLIB
10185 #$i_string I_STRING
10186 #$i_unistd I_UNISTD
10187 EOCP
10188         $cat >>try.c <<'EOCP'
10189 #include <stdio.h>
10190 #ifdef I_MEMORY
10191 #  include <memory.h>
10192 #endif
10193 #ifdef I_STDLIB
10194 #  include <stdlib.h>
10195 #endif
10196 #ifdef I_STRING
10197 #  include <string.h>
10198 #else
10199 #  include <strings.h>
10200 #endif
10201 #ifdef I_UNISTD
10202 #  include <unistd.h>  /* Needed for NetBSD */
10203 #endif
10204 int main()
10205 {
10206 char buf[128], abc[128];
10207 char *b;
10208 int len;
10209 int off;
10210 int align;
10211
10212 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10213
10214 for (align = 7; align >= 0; align--) {
10215         for (len = 36; len; len--) {
10216                 b = buf+align;
10217                 bcopy(abc, b, len);
10218                 for (off = 1; off <= len; off++) {
10219                         bcopy(b, b+off, len);
10220                         bcopy(b+off, b, len);
10221                         if (bcmp(b, abc, len))
10222                                 exit(1);
10223                 }
10224         }
10225 }
10226 exit(0);
10227 }
10228 EOCP
10229         set try
10230         if eval $compile_ok; then
10231                 if ./try 2>/dev/null; then
10232                         echo "Yes, it can."
10233                         val="$define"
10234                 else
10235                         echo "It can't, sorry."
10236                         case "$d_memmove" in
10237                         "$define") echo "But that's Ok since you have memmove()." ;;
10238                         esac
10239                 fi
10240         else
10241                 echo "(I can't compile the test program, so we'll assume not...)"
10242                 case "$d_memmove" in
10243                 "$define") echo "But that's Ok since you have memmove()." ;;
10244                 esac
10245         fi
10246         ;;
10247 esac
10248 $rm -f try.* try core
10249 set d_safebcpy
10250 eval $setvar
10251
10252 : can memcpy handle overlapping blocks?
10253 val="$undef"
10254 case "$d_memcpy" in
10255 "$define")
10256         echo " "
10257         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10258         $cat >try.c <<EOCP
10259 #$i_memory I_MEMORY
10260 #$i_stdlib I_STDLIB
10261 #$i_string I_STRING
10262 #$i_unistd I_UNISTD
10263 EOCP
10264         $cat >>try.c <<'EOCP'
10265 #include <stdio.h>
10266 #ifdef I_MEMORY
10267 #  include <memory.h>
10268 #endif
10269 #ifdef I_STDLIB
10270 #  include <stdlib.h>
10271 #endif
10272 #ifdef I_STRING
10273 #  include <string.h>
10274 #else
10275 #  include <strings.h>
10276 #endif
10277 #ifdef I_UNISTD
10278 #  include <unistd.h>  /* Needed for NetBSD */
10279 #endif
10280 int main()
10281 {
10282 char buf[128], abc[128];
10283 char *b;
10284 int len;
10285 int off;
10286 int align;
10287
10288 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10289    try to store the string in read-only memory. */
10290 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10291
10292 for (align = 7; align >= 0; align--) {
10293         for (len = 36; len; len--) {
10294                 b = buf+align;
10295                 memcpy(b, abc, len);
10296                 for (off = 1; off <= len; off++) {
10297                         memcpy(b+off, b, len);
10298                         memcpy(b, b+off, len);
10299                         if (memcmp(b, abc, len))
10300                                 exit(1);
10301                 }
10302         }
10303 }
10304 exit(0);
10305 }
10306 EOCP
10307         set try
10308         if eval $compile_ok; then
10309                 if ./try 2>/dev/null; then
10310                         echo "Yes, it can."
10311                         val="$define"
10312                 else
10313                         echo "It can't, sorry."
10314                         case "$d_memmove" in
10315                         "$define") echo "But that's Ok since you have memmove()." ;;
10316                         esac
10317                 fi
10318         else
10319                 echo "(I can't compile the test program, so we'll assume not...)"
10320                 case "$d_memmove" in
10321                 "$define") echo "But that's Ok since you have memmove()." ;;
10322                 esac
10323         fi
10324         ;;
10325 esac
10326 $rm -f try.* try core
10327 set d_safemcpy
10328 eval $setvar
10329
10330 : can memcmp be trusted to compare relative magnitude?
10331 val="$undef"
10332 case "$d_memcmp" in
10333 "$define")
10334         echo " "
10335         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10336         $cat >try.c <<EOCP
10337 #$i_memory I_MEMORY
10338 #$i_stdlib I_STDLIB
10339 #$i_string I_STRING
10340 #$i_unistd I_UNISTD
10341 EOCP
10342         $cat >>try.c <<'EOCP'
10343 #include <stdio.h>
10344 #ifdef I_MEMORY
10345 #  include <memory.h>
10346 #endif
10347 #ifdef I_STDLIB
10348 #  include <stdlib.h>
10349 #endif
10350 #ifdef I_STRING
10351 #  include <string.h>
10352 #else
10353 #  include <strings.h>
10354 #endif
10355 #ifdef I_UNISTD
10356 #  include <unistd.h>  /* Needed for NetBSD */
10357 #endif
10358 int main()
10359 {
10360 char a = -1;
10361 char b = 0;
10362 if ((a < b) && memcmp(&a, &b, 1) < 0)
10363         exit(1);
10364 exit(0);
10365 }
10366 EOCP
10367         set try
10368         if eval $compile_ok; then
10369                 if ./try 2>/dev/null; then
10370                         echo "Yes, it can."
10371                         val="$define"
10372                 else
10373                         echo "No, it can't (it uses signed chars)."
10374                 fi
10375         else
10376                 echo "(I can't compile the test program, so we'll assume not...)"
10377         fi
10378         ;;
10379 esac
10380 $rm -f try.* try core
10381 set d_sanemcmp
10382 eval $setvar
10383
10384 : see if select exists
10385 set select d_select
10386 eval $inlibc
10387
10388 : see if semctl exists
10389 set semctl d_semctl
10390 eval $inlibc
10391
10392 : see if semget exists
10393 set semget d_semget
10394 eval $inlibc
10395
10396 : see if semop exists
10397 set semop d_semop
10398 eval $inlibc
10399
10400 : see how much of the 'sem*(2)' library is present.
10401 h_sem=true
10402 echo " "
10403 case "$d_semctl$d_semget$d_semop" in
10404 *"$undef"*) h_sem=false;;
10405 esac
10406 case "$osname" in
10407 freebsd)
10408     case "`ipcs 2>&1`" in
10409     "SVID messages"*"not configured"*)
10410         echo "Your $osname does not have the sem*(2) configured." >&4
10411         h_sem=false
10412         val="$undef"
10413         set semctl d_semctl
10414         eval $setvar
10415         set semget d_semget
10416         eval $setvar
10417         set semop d_semop
10418         eval $setvar
10419         ;;
10420     esac
10421     ;;
10422 esac
10423 : we could also check for sys/ipc.h ...
10424 if $h_sem && $test `./findhdr sys/sem.h`; then
10425         echo "You have the full sem*(2) library." >&4
10426         val="$define"
10427 else
10428         echo "You don't have the full sem*(2) library." >&4
10429         val="$undef"
10430 fi
10431 set d_sem
10432 eval $setvar
10433
10434 : see whether sys/sem.h defines union semun
10435 echo " "
10436 $cat > try.c <<'END'
10437 #include <sys/types.h>
10438 #include <sys/ipc.h>
10439 #include <sys/sem.h>
10440 int main () { union semun semun; semun.buf = 0; }
10441 END
10442 set try
10443 if eval $compile; then
10444     echo "You have union semun in <sys/sem.h>." >&4
10445     val="$define"
10446 else
10447     echo "You do not have union semun in <sys/sem.h>." >&4
10448     val="$undef"
10449 fi
10450 $rm -f try try.c try.h
10451 set d_union_semun
10452 eval $setvar
10453
10454 : see how to do semctl IPC_STAT
10455 case "$d_sem" in
10456 $define)
10457     : see whether semctl IPC_STAT can use union semun
10458     echo " "
10459     $cat > try.h <<END
10460 #ifndef S_IRUSR
10461 #   ifdef S_IREAD
10462 #       define S_IRUSR S_IREAD
10463 #       define S_IWUSR S_IWRITE
10464 #       define S_IXUSR S_IEXEC
10465 #   else
10466 #       define S_IRUSR 0400
10467 #       define S_IWUSR 0200
10468 #       define S_IXUSR 0100
10469 #   endif
10470 #   define S_IRGRP (S_IRUSR>>3)
10471 #   define S_IWGRP (S_IWUSR>>3)
10472 #   define S_IXGRP (S_IXUSR>>3)
10473 #   define S_IROTH (S_IRUSR>>6)
10474 #   define S_IWOTH (S_IWUSR>>6)
10475 #   define S_IXOTH (S_IXUSR>>6)
10476 #endif
10477 #ifndef S_IRWXU
10478 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10479 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10480 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10481 #endif
10482 END
10483
10484     $cat > try.c <<END
10485 #include <sys/types.h>
10486 #include <sys/ipc.h>
10487 #include <sys/sem.h>
10488 #include <sys/stat.h>
10489 #include <stdio.h>
10490 #include <errno.h>
10491 #include "try.h"
10492 #ifndef errno
10493 extern int errno;
10494 #endif
10495 #$d_union_semun HAS_UNION_SEMUN
10496 int main() {
10497     union semun
10498 #ifndef HAS_UNION_SEMUN
10499     {
10500         int val;
10501         struct semid_ds *buf;
10502         unsigned short *array;
10503     }
10504 #endif
10505     arg;
10506     int sem, st;
10507
10508 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10509     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10510     if (sem > -1) {
10511         struct semid_ds argbuf;
10512         arg.buf = &argbuf;
10513 #       ifdef IPC_STAT
10514         st = semctl(sem, 0, IPC_STAT, arg);
10515         if (st == 0)
10516             printf("semun\n");
10517         else
10518 #       endif /* IPC_STAT */
10519             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10520 #       ifdef IPC_RMID
10521         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10522 #       endif /* IPC_RMID */
10523             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10524     } else
10525 #endif /* IPC_PRIVATE && ... */
10526         printf("semget failed: errno = %d\n", errno);
10527   return 0;
10528 }
10529 END
10530     val="$undef"
10531     set try
10532     if eval $compile; then
10533         xxx=`./try`
10534         case "$xxx" in
10535         semun) val="$define" ;;
10536         esac
10537     fi
10538     $rm -f try try.c
10539     set d_semctl_semun
10540     eval $setvar
10541     case "$d_semctl_semun" in
10542     $define)
10543         echo "You can use union semun for semctl IPC_STAT." >&4
10544         also='also'
10545         ;;
10546     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10547         also=''
10548         ;;
10549     esac
10550
10551     : see whether semctl IPC_STAT can use struct semid_ds pointer
10552     $cat > try.c <<'END'
10553 #include <sys/types.h>
10554 #include <sys/ipc.h>
10555 #include <sys/sem.h>
10556 #include <sys/stat.h>
10557 #include "try.h"
10558 #include <stdio.h>
10559 #include <errno.h>
10560 #ifndef errno
10561 extern int errno;
10562 #endif
10563 int main() {
10564     struct semid_ds arg;
10565     int sem, st;
10566
10567 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10568     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10569     if (sem > -1) {
10570 #       ifdef IPC_STAT
10571         st = semctl(sem, 0, IPC_STAT, &arg);
10572         if (st == 0)
10573             printf("semid_ds\n");
10574         else
10575 #       endif /* IPC_STAT */
10576             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10577 #       ifdef IPC_RMID
10578         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10579 #       endif /* IPC_RMID */
10580             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10581     } else
10582 #endif /* IPC_PRIVATE && ... */
10583         printf("semget failed: errno = %d\n", errno);
10584
10585     return 0;
10586 }
10587 END
10588     val="$undef"
10589     set try
10590     if eval $compile; then
10591         xxx=`./try`
10592         case "$xxx" in
10593         semid_ds) val="$define" ;;
10594         esac
10595     fi
10596     $rm -f try try.c
10597     set d_semctl_semid_ds
10598     eval $setvar
10599     case "$d_semctl_semid_ds" in
10600     $define)
10601         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10602         ;;
10603     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10604         ;;
10605     esac
10606     $rm -f try.h
10607     ;;
10608 *)  val="$undef"
10609
10610     # We do not have the full sem*(2) library, so assume we can not
10611     # use either.
10612
10613     set d_semctl_semun
10614     eval $setvar
10615
10616     set d_semctl_semid_ds
10617     eval $setvar
10618     ;;
10619 esac
10620
10621 : see if setegid exists
10622 set setegid d_setegid
10623 eval $inlibc
10624
10625 : see if seteuid exists
10626 set seteuid d_seteuid
10627 eval $inlibc
10628
10629 : see if setgrent exists
10630 set setgrent d_setgrent
10631 eval $inlibc
10632
10633 : see if sethostent exists
10634 set sethostent d_sethent
10635 eval $inlibc
10636
10637 : see if setlinebuf exists
10638 set setlinebuf d_setlinebuf
10639 eval $inlibc
10640
10641 : see if setlocale exists
10642 set setlocale d_setlocale
10643 eval $inlibc
10644
10645 : see if setnetent exists
10646 set setnetent d_setnent
10647 eval $inlibc
10648
10649 : see if setprotoent exists
10650 set setprotoent d_setpent
10651 eval $inlibc
10652
10653 : see if setpgid exists
10654 set setpgid d_setpgid
10655 eval $inlibc
10656
10657 : see if setpgrp2 exists
10658 set setpgrp2 d_setpgrp2
10659 eval $inlibc
10660
10661 : see if setpriority exists
10662 set setpriority d_setprior
10663 eval $inlibc
10664
10665 : see if setpwent exists
10666 set setpwent d_setpwent
10667 eval $inlibc
10668
10669 : see if setregid exists
10670 set setregid d_setregid
10671 eval $inlibc
10672 set setresgid d_setresgid
10673 eval $inlibc
10674
10675 : see if setreuid exists
10676 set setreuid d_setreuid
10677 eval $inlibc
10678 set setresuid d_setresuid
10679 eval $inlibc
10680
10681 : see if setrgid exists
10682 set setrgid d_setrgid
10683 eval $inlibc
10684
10685 : see if setruid exists
10686 set setruid d_setruid
10687 eval $inlibc
10688
10689 : see if setservent exists
10690 set setservent d_setsent
10691 eval $inlibc
10692
10693 : see if setsid exists
10694 set setsid d_setsid
10695 eval $inlibc
10696
10697 : see if setspent exists
10698 set setspent d_setspent
10699 eval $inlibc
10700
10701 : see if setvbuf exists
10702 set setvbuf d_setvbuf
10703 eval $inlibc
10704
10705 : see if sfio.h is available
10706 set sfio.h i_sfio
10707 eval $inhdr
10708
10709
10710 : see if sfio library is available
10711 case "$i_sfio" in
10712 $define)
10713         val=''
10714         set sfreserve val
10715         eval $inlibc
10716         ;;
10717 *)
10718         val="$undef"
10719         ;;
10720 esac
10721 : Ok, but do we want to use it.
10722 case "$val" in
10723 $define)
10724         case "$usesfio" in
10725         true|$define|[yY]*) dflt='y';;
10726         *) dflt='n';;
10727         esac
10728         echo "$package can use the sfio library, but it is experimental."
10729         rp="You seem to have sfio available, do you want to try using it?"
10730         . ./myread
10731         case "$ans" in
10732         y|Y) ;;
10733         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10734                 val="$undef"
10735                 : Remove sfio from list of libraries to use
10736                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10737                 shift
10738                 libs="$*"
10739                 echo "libs = $libs" >&4
10740                 ;;
10741         esac
10742         ;;
10743 *)      case "$usesfio" in
10744         true|$define|[yY]*)
10745                 echo "Sorry, cannot find sfio on this machine" >&4
10746                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10747                 ;;
10748         esac
10749         ;;
10750 esac
10751 set d_sfio
10752 eval $setvar
10753 case "$d_sfio" in
10754 $define) usesfio='true';;
10755 *) usesfio='false';;
10756 esac
10757
10758 : see if shmctl exists
10759 set shmctl d_shmctl
10760 eval $inlibc
10761
10762 : see if shmget exists
10763 set shmget d_shmget
10764 eval $inlibc
10765
10766 : see if shmat exists
10767 set shmat d_shmat
10768 eval $inlibc
10769 : see what shmat returns
10770 case "$d_shmat" in
10771 "$define")
10772         $cat >shmat.c <<'END'
10773 #include <sys/shm.h>
10774 void *shmat();
10775 END
10776         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10777                 shmattype='void *'
10778         else
10779                 shmattype='char *'
10780         fi
10781         echo "and it returns ($shmattype)." >&4
10782         : see if a prototype for shmat is available
10783         xxx=`./findhdr sys/shm.h`
10784         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10785         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10786                 val="$define"
10787         else
10788                 val="$undef"
10789         fi
10790         $rm -f shmat.[co]
10791         ;;
10792 *)
10793         val="$undef"
10794         ;;
10795 esac
10796 set d_shmatprototype
10797 eval $setvar
10798
10799 : see if shmdt exists
10800 set shmdt d_shmdt
10801 eval $inlibc
10802
10803 : see how much of the 'shm*(2)' library is present.
10804 h_shm=true
10805 echo " "
10806 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10807 *"$undef"*) h_shm=false;;
10808 esac
10809 case "$osname" in
10810 freebsd)
10811     case "`ipcs 2>&1`" in
10812     "SVID shared memory"*"not configured"*)
10813         echo "Your $osname does not have the shm*(2) configured." >&4
10814         h_shm=false
10815         val="$undef"
10816         set shmctl d_shmctl
10817         evat $setvar
10818         set shmget d_shmget
10819         evat $setvar
10820         set shmat d_shmat
10821         evat $setvar
10822         set shmdt d_shmdt
10823         evat $setvar
10824         ;;
10825     esac
10826     ;;
10827 esac
10828 : we could also check for sys/ipc.h ...
10829 if $h_shm && $test `./findhdr sys/shm.h`; then
10830         echo "You have the full shm*(2) library." >&4
10831         val="$define"
10832 else
10833         echo "You don't have the full shm*(2) library." >&4
10834         val="$undef"
10835 fi
10836 set d_shm
10837 eval $setvar
10838
10839 echo " "
10840 : see if we have sigaction
10841 if set sigaction val -f d_sigaction; eval $csym; $val; then
10842         echo 'sigaction() found.' >&4
10843         $cat > try.c <<'EOP'
10844 #include <stdio.h>
10845 #include <sys/types.h>
10846 #include <signal.h>
10847 int main()
10848 {
10849     struct sigaction act, oact;
10850     act.sa_flags = 0;
10851     oact.sa_handler = 0;
10852     /* so that act and oact are used */
10853     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10854 }
10855 EOP
10856         set try
10857         if eval $compile_ok; then
10858                 val="$define"
10859         else
10860                 echo "But you don't seem to have a useable struct sigaction." >&4
10861                 val="$undef"
10862         fi
10863 else
10864         echo 'sigaction NOT found.' >&4
10865         val="$undef"
10866 fi
10867 set d_sigaction; eval $setvar
10868 $rm -f try try$_o try.c
10869
10870 : see if sigsetjmp exists
10871 echo " "
10872 case "$d_sigsetjmp" in
10873 '')
10874         $cat >try.c <<'EOP'
10875 #include <setjmp.h>
10876 sigjmp_buf env;
10877 int set = 1;
10878 int main()
10879 {
10880         if (sigsetjmp(env,1))
10881                 exit(set);
10882         set = 0;
10883         siglongjmp(env, 1);
10884         exit(1);
10885 }
10886 EOP
10887         set try
10888         if eval $compile; then
10889                 if ./try >/dev/null 2>&1; then
10890                         echo "POSIX sigsetjmp found." >&4
10891                         val="$define"
10892                 else
10893                         $cat >&4 <<EOM
10894 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10895 I'll ignore them.
10896 EOM
10897                         val="$undef"
10898                 fi
10899         else
10900                 echo "sigsetjmp not found." >&4
10901                 val="$undef"
10902         fi
10903         ;;
10904 *) val="$d_sigsetjmp"
10905         case "$d_sigsetjmp" in
10906         $define) echo "POSIX sigsetjmp found." >&4;;
10907         $undef) echo "sigsetjmp not found." >&4;;
10908         esac
10909         ;;
10910 esac
10911 set d_sigsetjmp
10912 eval $setvar
10913 $rm -f try.c try
10914
10915 : see if sqrtl exists
10916 set sqrtl d_sqrtl
10917 eval $inlibc
10918
10919 : see if sys/stat.h is available
10920 set sys/stat.h i_sysstat
10921 eval $inhdr
10922
10923
10924 : see if stat knows about block sizes
10925 echo " "
10926 echo "Checking to see if your struct stat has st_blocks field..." >&4
10927 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10928 eval $hasfield
10929
10930
10931 : see if this is a sys/vfs.h system
10932 set sys/vfs.h i_sysvfs
10933 eval $inhdr
10934
10935
10936 : see if this is a sys/statfs.h system
10937 set sys/statfs.h i_sysstatfs
10938 eval $inhdr
10939
10940
10941 echo " "
10942 echo "Checking to see if your system supports struct statfs..." >&4
10943 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
10944 eval $hasstruct
10945 case "$d_statfs_s" in
10946 "$define")      echo "Yes, it does."   ;;
10947 *)              echo "No, it doesn't." ;;
10948 esac
10949
10950
10951
10952 : see if struct statfs knows about f_flags
10953 case "$d_statfs_s" in
10954 define) 
10955         echo " "
10956         echo "Checking to see if your struct statfs has f_flags field..." >&4
10957         set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
10958         eval $hasfield
10959         ;;
10960 *)      val="$undef"
10961         set d_statfs_f_flags
10962         eval $setvar
10963         ;;
10964 esac
10965 case "$d_statfs_f_flags" in
10966 "$define")      echo "Yes, it does."   ;;
10967 *)              echo "No, it doesn't." ;;
10968 esac
10969
10970 : see if _ptr and _cnt from stdio act std
10971 echo " "
10972 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10973         echo "(Looks like you have stdio.h from Linux.)"
10974         case "$stdio_ptr" in
10975         '') stdio_ptr='((fp)->_IO_read_ptr)'
10976                 ptr_lval=$define
10977                 ;;
10978         *)      ptr_lval=$d_stdio_ptr_lval;;
10979         esac
10980         case "$stdio_cnt" in
10981         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10982                 cnt_lval=$undef
10983                 ;;
10984         *)      cnt_lval=$d_stdio_cnt_lval;;
10985         esac
10986         case "$stdio_base" in
10987         '') stdio_base='((fp)->_IO_read_base)';;
10988         esac
10989         case "$stdio_bufsiz" in
10990         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10991         esac
10992 else
10993         case "$stdio_ptr" in
10994         '') stdio_ptr='((fp)->_ptr)'
10995                 ptr_lval=$define
10996                 ;;
10997         *)      ptr_lval=$d_stdio_ptr_lval;;
10998         esac
10999         case "$stdio_cnt" in
11000         '') stdio_cnt='((fp)->_cnt)'
11001                 cnt_lval=$define
11002                 ;;
11003         *)      cnt_lval=$d_stdio_cnt_lval;;
11004         esac
11005         case "$stdio_base" in
11006         '') stdio_base='((fp)->_base)';;
11007         esac
11008         case "$stdio_bufsiz" in
11009         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11010         esac
11011 fi
11012 : test whether _ptr and _cnt really work
11013 echo "Checking how std your stdio is..." >&4
11014 $cat >try.c <<EOP
11015 #include <stdio.h>
11016 #define FILE_ptr(fp)    $stdio_ptr
11017 #define FILE_cnt(fp)    $stdio_cnt
11018 int main() {
11019         FILE *fp = fopen("try.c", "r");
11020         char c = getc(fp);
11021         if (
11022                 18 <= FILE_cnt(fp) &&
11023                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11024         )
11025                 exit(0);
11026         exit(1);
11027 }
11028 EOP
11029 val="$undef"
11030 set try
11031 if eval $compile; then
11032         if ./try; then
11033                 echo "Your stdio acts pretty std."
11034                 val="$define"
11035         else
11036                 echo "Your stdio isn't very std."
11037         fi
11038 else
11039         echo "Your stdio doesn't appear very std."
11040 fi
11041 $rm -f try.c try
11042 set d_stdstdio
11043 eval $setvar
11044
11045 : Can _ptr be used as an lvalue?
11046 case "$d_stdstdio$ptr_lval" in
11047 $define$define) val=$define ;;
11048 *) val=$undef ;;
11049 esac
11050 set d_stdio_ptr_lval
11051 eval $setvar
11052
11053 : Can _cnt be used as an lvalue?
11054 case "$d_stdstdio$cnt_lval" in
11055 $define$define) val=$define ;;
11056 *) val=$undef ;;
11057 esac
11058 set d_stdio_cnt_lval
11059 eval $setvar
11060
11061 : see if _base is also standard
11062 val="$undef"
11063 case "$d_stdstdio" in
11064 $define)
11065         $cat >try.c <<EOP
11066 #include <stdio.h>
11067 #define FILE_base(fp)   $stdio_base
11068 #define FILE_bufsiz(fp) $stdio_bufsiz
11069 int main() {
11070         FILE *fp = fopen("try.c", "r");
11071         char c = getc(fp);
11072         if (
11073                 19 <= FILE_bufsiz(fp) &&
11074                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11075         )
11076                 exit(0);
11077         exit(1);
11078 }
11079 EOP
11080         set try
11081         if eval $compile; then
11082                 if ./try; then
11083                         echo "And its _base field acts std."
11084                         val="$define"
11085                 else
11086                         echo "But its _base field isn't std."
11087                 fi
11088         else
11089                 echo "However, it seems to be lacking the _base field."
11090         fi
11091         $rm -f try.c try
11092         ;;
11093 esac
11094 set d_stdiobase
11095 eval $setvar
11096
11097 $cat >&4 <<EOM
11098 Checking how to access stdio streams by file descriptor number...
11099 EOM
11100 case "$stdio_stream_array" in
11101 '')     $cat >try.c <<EOCP
11102 #include <stdio.h>
11103 int main() {
11104   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11105     printf("yes\n");
11106 }
11107 EOCP
11108         for s in _iob __iob __sF
11109         do
11110                 set try -DSTDIO_STREAM_ARRAY=$s
11111                 if eval $compile; then
11112                         case "`./try$exe_ext`" in
11113                         yes)    stdio_stream_array=$s; break ;;
11114                         esac
11115                 fi
11116         done
11117         $rm -f try.* try$exe_ext
11118 esac
11119 case "$stdio_stream_array" in
11120 '')     $cat >&4 <<EOM
11121 I can't figure out how to access stdio streams by file descriptor number.
11122 EOM
11123         d_stdio_stream_array="$undef"
11124         ;;
11125 *)      $cat >&4 <<EOM
11126 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11127 EOM
11128         d_stdio_stream_array="$define"
11129         ;;
11130 esac
11131
11132 : see if strcoll exists
11133 set strcoll d_strcoll
11134 eval $inlibc
11135
11136 : check for structure copying
11137 echo " "
11138 echo "Checking to see if your C compiler can copy structs..." >&4
11139 $cat >try.c <<'EOCP'
11140 int main()
11141 {
11142         struct blurfl {
11143                 int dyick;
11144         } foo, bar;
11145
11146         foo = bar;
11147 }
11148 EOCP
11149 if $cc -c try.c >/dev/null 2>&1 ; then
11150         val="$define"
11151         echo "Yup, it can."
11152 else
11153         val="$undef"
11154         echo "Nope, it can't."
11155 fi
11156 set d_strctcpy
11157 eval $setvar
11158 $rm -f try.*
11159
11160 : see if strerror and/or sys_errlist[] exist
11161 echo " "
11162 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11163     if set strerror val -f d_strerror; eval $csym; $val; then
11164                 echo 'strerror() found.' >&4
11165                 d_strerror="$define"
11166                 d_strerrm='strerror(e)'
11167                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11168                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11169                         d_syserrlst="$define"
11170                 else
11171                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11172                         d_syserrlst="$undef"
11173                 fi
11174     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11175                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11176                 echo 'strerror() found in string header.' >&4
11177                 d_strerror="$define"
11178                 d_strerrm='strerror(e)'
11179                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11180                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11181                                 d_syserrlst="$define"
11182                 else
11183                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11184                         d_syserrlst="$undef"
11185                 fi
11186     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11187                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11188                 d_strerror="$undef"
11189                 d_syserrlst="$define"
11190                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11191     else
11192                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11193                 d_strerror="$undef"
11194                 d_syserrlst="$undef"
11195                 d_strerrm='"unknown"'
11196     fi
11197 fi
11198
11199 : see if strtod exists
11200 set strtod d_strtod
11201 eval $inlibc
11202
11203 : see if strtol exists
11204 set strtol d_strtol
11205 eval $inlibc
11206
11207 : see if strtold exists
11208 set strtold d_strtold
11209 eval $inlibc
11210
11211 : see if strtoll exists
11212 set strtoll d_strtoll
11213 eval $inlibc
11214
11215 : see if strtoul exists
11216 set strtoul d_strtoul
11217 eval $inlibc
11218
11219 : see if strtoull exists
11220 set strtoull d_strtoull
11221 eval $inlibc
11222
11223 : see if strtouq exists
11224 set strtouq d_strtouq
11225 eval $inlibc
11226
11227 : see if strxfrm exists
11228 set strxfrm d_strxfrm
11229 eval $inlibc
11230
11231 : see if symlink exists
11232 set symlink d_symlink
11233 eval $inlibc
11234
11235 : see if syscall exists
11236 set syscall d_syscall
11237 eval $inlibc
11238
11239 : see if sysconf exists
11240 set sysconf d_sysconf
11241 eval $inlibc
11242
11243 : see if system exists
11244 set system d_system
11245 eval $inlibc
11246
11247 : see if tcgetpgrp exists
11248 set tcgetpgrp d_tcgetpgrp
11249 eval $inlibc
11250
11251 : see if tcsetpgrp exists
11252 set tcsetpgrp d_tcsetpgrp
11253 eval $inlibc
11254
11255 : see if prototype for telldir is available
11256 echo " "
11257 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11258 eval $hasproto
11259
11260 : see if this is a sys/times.h system
11261 set sys/times.h i_systimes
11262 eval $inhdr
11263
11264 : see if times exists
11265 echo " "
11266 if set times val -f d_times; eval $csym; $val; then
11267         echo 'times() found.' >&4
11268         d_times="$define"
11269         inc=''
11270         case "$i_systimes" in
11271         "$define") inc='sys/times.h';;
11272         esac
11273         rp="What is the type returned by times() on this system?"
11274         set clock_t clocktype long stdio.h sys/types.h $inc
11275         eval $typedef_ask
11276 else
11277         echo 'times() NOT found, hope that will do.' >&4
11278         d_times="$undef"
11279         clocktype='int'
11280 fi
11281
11282 : see if truncate exists
11283 set truncate d_truncate
11284 eval $inlibc
11285
11286 : see if tzname[] exists
11287 echo " "
11288 if set tzname val -a d_tzname; eval $csym; $val; then
11289         val="$define"
11290         echo 'tzname[] found.' >&4
11291 else
11292         val="$undef"
11293         echo 'tzname[] NOT found.' >&4
11294 fi
11295 set d_tzname
11296 eval $setvar
11297
11298 : see if umask exists
11299 set umask d_umask
11300 eval $inlibc
11301
11302 : see if ustat exists
11303 set ustat d_ustat
11304 eval $inlibc
11305
11306 : backward compatibility for d_hvfork
11307 if test X$d_hvfork != X; then
11308         d_vfork="$d_hvfork"
11309         d_hvfork=''
11310 fi
11311 : see if there is a vfork
11312 val=''
11313 set vfork val
11314 eval $inlibc
11315
11316 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11317 : perl on Solaris 2.x, and probably elsewhere.
11318 case "$val" in
11319 $define)
11320         echo " "
11321         case "$usevfork" in
11322         false) dflt='n';;
11323         *) dflt='y';;
11324         esac
11325         cat <<'EOM'
11326  
11327 Perl can only use a vfork() that doesn't suffer from strict
11328 restrictions on calling functions or modifying global data in
11329 the child.  For example, glibc-2.1 contains such a vfork()
11330 that is unsuitable.  If your system provides a proper fork()
11331 call, chances are that you do NOT want perl to use vfork().
11332
11333 EOM
11334         rp="Do you still want to use vfork()?"
11335         . ./myread
11336         case "$ans" in
11337         y|Y) ;;
11338         *)
11339                 echo "Ok, we won't use vfork()."
11340                 val="$undef"
11341                 ;;
11342         esac
11343         ;;
11344 esac
11345 set d_vfork
11346 eval $setvar
11347 case "$d_vfork" in
11348 $define) usevfork='true';;
11349 *) usevfork='false';;
11350 esac
11351
11352 : see if this is an sysdir system
11353 set sys/dir.h i_sysdir
11354 eval $inhdr
11355
11356 : see if this is an sysndir system
11357 set sys/ndir.h i_sysndir
11358 eval $inhdr
11359
11360 : see if closedir exists
11361 set closedir d_closedir
11362 eval $inlibc
11363
11364 case "$d_closedir" in
11365 "$define")
11366         echo " "
11367         echo "Checking whether closedir() returns a status..." >&4
11368         cat > closedir.c <<EOM
11369 #$i_dirent I_DIRENT             /**/
11370 #$i_sysdir I_SYS_DIR            /**/
11371 #$i_sysndir I_SYS_NDIR          /**/
11372 #$i_systypes I_SYS_TYPES        /**/
11373
11374 #if defined(I_SYS_TYPES)
11375 #include <sys/types.h>
11376 #endif
11377 #if defined(I_DIRENT)
11378 #include <dirent.h>
11379 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11380 #include <sys/dir.h>
11381 #endif
11382 #else
11383 #ifdef I_SYS_NDIR
11384 #include <sys/ndir.h>
11385 #else
11386 #ifdef I_SYS_DIR
11387 #ifdef hp9000s500
11388 #include <ndir.h>       /* may be wrong in the future */
11389 #else
11390 #include <sys/dir.h>
11391 #endif
11392 #endif
11393 #endif
11394 #endif 
11395 int main() { return closedir(opendir(".")); }
11396 EOM
11397         set closedir
11398         if eval $compile_ok; then
11399                 if ./closedir > /dev/null 2>&1 ; then
11400                         echo "Yes, it does."
11401                         val="$undef"
11402                 else
11403                         echo "No, it doesn't."
11404                         val="$define"
11405                 fi
11406         else
11407                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11408                 val="$define"
11409         fi
11410         ;;
11411 *)
11412         val="$undef";
11413         ;;
11414 esac
11415 set d_void_closedir
11416 eval $setvar
11417 $rm -f closedir*
11418 : check for volatile keyword
11419 echo " "
11420 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11421 $cat >try.c <<'EOCP'
11422 int main()
11423 {
11424         typedef struct _goo_struct goo_struct;
11425         goo_struct * volatile goo = ((goo_struct *)0);
11426         struct _goo_struct {
11427                 long long_int;
11428                 int reg_int;
11429                 char char_var;
11430         };
11431         typedef unsigned short foo_t;
11432         char *volatile foo;
11433         volatile int bar;
11434         volatile foo_t blech;
11435         foo = foo;
11436 }
11437 EOCP
11438 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11439         val="$define"
11440         echo "Yup, it does."
11441 else
11442         val="$undef"
11443         echo "Nope, it doesn't."
11444 fi
11445 set d_volatile
11446 eval $setvar
11447 $rm -f try.*
11448
11449 : see if there is a wait4
11450 set wait4 d_wait4
11451 eval $inlibc
11452
11453 : see if waitpid exists
11454 set waitpid d_waitpid
11455 eval $inlibc
11456
11457 : see if wcstombs exists
11458 set wcstombs d_wcstombs
11459 eval $inlibc
11460
11461 : see if wctomb exists
11462 set wctomb d_wctomb
11463 eval $inlibc
11464
11465 : preserve RCS keywords in files with variable substitution, grrr
11466 Date='$Date'
11467 Id='$Id'
11468 Log='$Log'
11469 RCSfile='$RCSfile'
11470 Revision='$Revision'
11471
11472 case "$crosscompile" in
11473 ''|[nN]*) crosscompile="$undef" ;;
11474 esac
11475
11476 case "$osname" in
11477 next|rhapsody) multiarch="$define" ;;
11478 esac
11479 case "$multiarch" in
11480 ''|[nN]*) multiarch="$undef" ;;
11481 esac
11482
11483 : check for alignment requirements
11484 echo " "
11485 case "$crosscompile$multiarch" in
11486 *$define*)
11487         $cat <<EOM
11488 You seem to be either cross-compiling or doing a multiarchitecture build,
11489 skipping the memory alignment check.
11490
11491 EOM
11492         case "$alignbytes" in
11493         '') alignbytes=8 ;;
11494         esac
11495         ;;
11496 *)
11497         case "$alignbytes" in
11498         '') echo "Checking alignment constraints..." >&4
11499                 $cat >try.c <<'EOCP'
11500 #include <stdio.h>
11501 struct foobar {
11502         char foo;
11503         double bar;
11504 } try_algn;
11505 int main()
11506 {
11507     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11508     return(0);
11509 }
11510 EOCP
11511                 set try
11512                 if eval $compile_ok; then
11513                         dflt=`./try`
11514                 else
11515                         dflt='8'
11516                         echo "(I can't seem to compile the test program...)"
11517                 fi
11518                 ;;
11519         *) dflt="$alignbytes"
11520                 ;;
11521         esac
11522         rp="Doubles must be aligned on a how-many-byte boundary?"
11523         . ./myread
11524         alignbytes="$ans"
11525         $rm -f try.c try
11526         ;;
11527 esac
11528
11529
11530 : check for ordering of bytes in a long
11531 echo " "
11532 case "$crosscompile$multiarch" in
11533 *$define*)
11534         $cat <<EOM
11535 You seem to be either cross-compiling or doing a multiarchitecture build,
11536 skipping the byteorder check.
11537
11538 EOM
11539         byteorder='0xffff'
11540         ;;
11541 *)
11542         case "$byteorder" in
11543         '')
11544                 $cat <<'EOM'
11545 In the following, larger digits indicate more significance.  A big-endian
11546 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11547 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11548 machines may have weird orders like 3412.  A Cray will report 87654321,
11549 an Alpha will report 12345678. If the test program works the default is
11550 probably right.
11551 I'm now running the test program...
11552 EOM
11553                 $cat >try.c <<'EOCP'
11554 #include <stdio.h>
11555 int main()
11556 {
11557         int i;
11558         union {
11559                 unsigned long l;
11560                 char c[sizeof(long)];
11561         } u;
11562
11563         if (sizeof(long) > 4)
11564                 u.l = (0x08070605L << 32) | 0x04030201L;
11565         else
11566                 u.l = 0x04030201L;
11567         for (i = 0; i < sizeof(long); i++)
11568                 printf("%c", u.c[i]+'0');
11569         printf("\n");
11570         exit(0);
11571 }
11572 EOCP
11573                 xxx_prompt=y
11574                 set try
11575                 if eval $compile && ./try > /dev/null; then
11576                         dflt=`./try`
11577                         case "$dflt" in
11578                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11579                                 echo "(The test program ran ok.)"
11580                                 echo "byteorder=$dflt"
11581                                 xxx_prompt=n
11582                         ;;
11583                         ????|????????) echo "(The test program ran ok.)" ;;
11584                         *) echo "(The test program didn't run right for some reason.)" ;;
11585                         esac
11586                 else
11587                         dflt='4321'
11588                         cat <<'EOM'
11589 (I can't seem to compile the test program.  Guessing big-endian...)
11590 EOM
11591                 fi
11592                 case "$xxx_prompt" in
11593                 y)
11594                         rp="What is the order of bytes in a long?"
11595                         . ./myread
11596                         byteorder="$ans"
11597                         ;;
11598                 *)      byteorder=$dflt
11599                         ;;
11600                 esac
11601                 ;;
11602         esac
11603         $rm -f try.c try
11604         ;;
11605 esac
11606
11607
11608 : how do we catenate cpp tokens here?
11609 echo " "
11610 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11611 $cat >cpp_stuff.c <<'EOCP'
11612 #define RCAT(a,b)a/**/b
11613 #define ACAT(a,b)a ## b
11614 RCAT(Rei,ser)
11615 ACAT(Cir,cus)
11616 EOCP
11617 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11618 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11619         echo "Oh!  Smells like ANSI's been here." >&4
11620         echo "We can catify or stringify, separately or together!"
11621         cpp_stuff=42
11622 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11623         echo "Ah, yes!  The good old days!" >&4
11624         echo "However, in the good old days we don't know how to stringify and"
11625         echo "catify at the same time."
11626         cpp_stuff=1
11627 else
11628         $cat >&4 <<EOM
11629 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11630 to have to edit the values of CAT[2-5] in config.h...
11631 EOM
11632         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11633 fi
11634 $rm -f cpp_stuff.*
11635
11636 : see if this is a db.h system
11637 set db.h i_db
11638 eval $inhdr
11639
11640 case "$i_db" in
11641 $define)
11642         : Check db version.
11643         echo " "
11644         echo "Checking Berkeley DB version ..." >&4
11645         $cat >try.c <<EOCP
11646 #$d_const HASCONST
11647 #ifndef HASCONST
11648 #define const
11649 #endif
11650 #include <sys/types.h>
11651 #include <stdio.h>
11652 #include <db.h>
11653 int main()
11654 {
11655 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11656     int Major, Minor, Patch ;
11657     unsigned long Version ;
11658     (void)db_version(&Major, &Minor, &Patch) ;
11659     printf("You have Berkeley DB Version 2 or greater\n");
11660
11661     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11662                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11663     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11664                 Major, Minor, Patch) ;
11665
11666     /* check that db.h & libdb are compatible */
11667     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11668         printf("db.h and libdb are incompatible\n") ;
11669         exit(3);        
11670     }
11671
11672     printf("db.h and libdb are compatible\n") ;
11673
11674     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11675                 + DB_VERSION_PATCH ;
11676
11677     /* needs to be >= 2.3.4 */
11678     if (Version < 2003004) {
11679     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11680         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11681         exit(2);        
11682     }
11683
11684     exit(0);
11685 #else
11686 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11687     printf("You have Berkeley DB Version 1\n");
11688     exit(0);    /* DB version < 2: the coast is clear. */
11689 #else
11690     exit(1);    /* <db.h> not Berkeley DB? */
11691 #endif
11692 #endif
11693 }
11694 EOCP
11695         set try
11696         if eval $compile_ok && ./try; then
11697                 echo 'Looks OK.' >&4
11698         else
11699                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11700                 i_db=$undef
11701                 case " $libs " in
11702                 *"-ldb "*)
11703                         : Remove db from list of libraries to use
11704                         echo "Removing unusable -ldb from library list" >&4
11705                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11706                         shift
11707                         libs="$*"
11708                         echo "libs = $libs" >&4
11709                         ;;
11710                 esac
11711         fi
11712         $rm -f try.*
11713         ;;
11714 esac
11715
11716 case "$i_db" in
11717 define)
11718         : Check the return type needed for hash 
11719         echo " "
11720         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11721         $cat >try.c <<EOCP
11722 #$d_const HASCONST
11723 #ifndef HASCONST
11724 #define const
11725 #endif
11726 #include <sys/types.h>
11727 #include <db.h>
11728
11729 #ifndef DB_VERSION_MAJOR
11730 u_int32_t hash_cb (ptr, size)
11731 const void *ptr;
11732 size_t size;
11733 {
11734 }
11735 HASHINFO info;
11736 int main()
11737 {
11738         info.hash = hash_cb;
11739 }
11740 #endif
11741 EOCP
11742         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11743                 if $contains warning try.out >>/dev/null 2>&1 ; then
11744                         db_hashtype='int'
11745                 else
11746                         db_hashtype='u_int32_t'
11747                 fi
11748         else
11749                 : XXX Maybe we should just give up here.
11750                 db_hashtype=u_int32_t
11751                 $cat try.out >&4
11752                 echo "Help:  I can't seem to compile the db test program." >&4
11753                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11754         fi
11755         $rm -f try.*
11756         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11757         ;;
11758 *)      db_hashtype=u_int32_t
11759         ;;
11760 esac
11761 case "$i_db" in
11762 define)
11763         : Check the return type needed for prefix 
11764         echo " "
11765         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11766         cat >try.c <<EOCP
11767 #$d_const HASCONST
11768 #ifndef HASCONST
11769 #define const
11770 #endif
11771 #include <sys/types.h>
11772 #include <db.h>
11773
11774 #ifndef DB_VERSION_MAJOR
11775 size_t prefix_cb (key1, key2)
11776 const DBT *key1;
11777 const DBT *key2;
11778 {
11779 }
11780 BTREEINFO info;
11781 int main()
11782 {
11783         info.prefix = prefix_cb;
11784 }
11785 #endif
11786 EOCP
11787         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11788                 if $contains warning try.out >>/dev/null 2>&1 ; then
11789                         db_prefixtype='int'
11790                 else
11791                         db_prefixtype='size_t'
11792                 fi
11793         else
11794                 db_prefixtype='size_t'
11795                 : XXX Maybe we should just give up here.
11796                 $cat try.out >&4
11797                 echo "Help:  I can't seem to compile the db test program." >&4
11798                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11799         fi
11800         $rm -f try.*
11801         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11802         ;;
11803 *)      db_prefixtype='size_t'
11804         ;;
11805 esac
11806
11807 : check for void type
11808 echo " "
11809 echo "Checking to see how well your C compiler groks the void type..." >&4
11810 case "$voidflags" in
11811 '')
11812         $cat >try.c <<'EOCP'
11813 #if TRY & 1
11814 void sub() {
11815 #else
11816 sub() {
11817 #endif
11818         extern void moo();      /* function returning void */
11819         void (*goo)();          /* ptr to func returning void */
11820 #if TRY & 8
11821         void *hue;              /* generic ptr */
11822 #endif
11823 #if TRY & 2
11824         void (*foo[10])();
11825 #endif
11826
11827 #if TRY & 4
11828         if(goo == moo) {
11829                 exit(0);
11830         }
11831 #endif
11832         exit(0);
11833 }
11834 int main() { sub(); }
11835 EOCP
11836         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11837                 voidflags=$defvoidused
11838         echo "Good.  It appears to support void to the level $package wants.">&4
11839                 if $contains warning .out >/dev/null 2>&1; then
11840                         echo "However, you might get some warnings that look like this:"
11841                         $cat .out
11842                 fi
11843         else
11844 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11845                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11846                         echo "It supports 1..."
11847                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11848                                 echo "It also supports 2..."
11849                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11850                                         voidflags=7
11851                                         echo "And it supports 4 but not 8 definitely."
11852                                 else
11853                                         echo "It doesn't support 4..."
11854                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11855                                                 voidflags=11
11856                                                 echo "But it supports 8."
11857                                         else
11858                                                 voidflags=3
11859                                                 echo "Neither does it support 8."
11860                                         fi
11861                                 fi
11862                         else
11863                                 echo "It does not support 2..."
11864                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11865                                         voidflags=13
11866                                         echo "But it supports 4 and 8."
11867                                 else
11868                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11869                                                 voidflags=5
11870                                                 echo "And it supports 4 but has not heard about 8."
11871                                         else
11872                                                 echo "However it supports 8 but not 4."
11873                                         fi
11874                                 fi
11875                         fi
11876                 else
11877                         echo "There is no support at all for void."
11878                         voidflags=0
11879                 fi
11880         fi
11881 esac
11882 case "$voidflags" in
11883 "$defvoidused") ;;
11884 *)      $cat >&4 <<'EOM'
11885   Support flag bits are:
11886     1: basic void declarations.
11887     2: arrays of pointers to functions returning void.
11888     4: operations between pointers to and addresses of void functions.
11889     8: generic void pointers.
11890 EOM
11891         dflt="$voidflags";
11892         rp="Your void support flags add up to what?"
11893         . ./myread
11894         voidflags="$ans"
11895         ;;
11896 esac
11897 $rm -f try.* .out
11898
11899
11900 : How can we generate normalized random numbers ?
11901 echo " "
11902 echo "Looking for a random number function..." >&4
11903 case "$randfunc" in
11904 '')
11905         if set drand48 val -f; eval $csym; $val; then
11906                 dflt="drand48"
11907                 echo "Good, found drand48()." >&4
11908         elif set random val -f; eval $csym; $val; then
11909                 dflt="random"
11910                 echo "OK, found random()." >&4
11911         else
11912                 dflt="rand"
11913                 echo "Yick, looks like I have to use rand()." >&4
11914         fi
11915         echo " "
11916         ;;
11917 *)
11918         dflt="$randfunc"
11919         ;;
11920 esac
11921 cont=true
11922
11923 case "$ccflags" in
11924 *-Dmy_rand=*|*-Dmy_srand=*)
11925         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11926         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11927         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11928         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11929         ;;
11930 esac
11931
11932 while $test "$cont"; do
11933         rp="Use which function to generate random numbers?"
11934         . ./myread
11935         if $test "$ans" = "$dflt"; then
11936                 : null
11937         else
11938                 randbits=''
11939         fi
11940         randfunc="$ans"
11941         if set $ans val -f; eval $csym; $val; then
11942                 cont=''
11943         else
11944                 dflt=y
11945                 rp="I cannot find function $ans. Use that name anyway?"
11946                 . ./myread
11947                 dflt=rand
11948                 case "$ans" in
11949                         [yY]*) cont='';;
11950                 esac
11951         fi
11952         case "$cont" in
11953         '')
11954                 case "$randfunc" in
11955                 drand48)
11956                         drand01="drand48()"
11957                         seedfunc="srand48"
11958                         randbits=48
11959                         randseedtype=long
11960                         ;;
11961                 rand|random)
11962                         case "$randbits" in
11963                         '')
11964 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11965                                 $cat >try.c <<EOCP
11966 #$i_unistd I_UNISTD
11967 #$i_stdlib I_STDLIB
11968 #include <stdio.h>
11969 #ifdef I_UNISTD
11970 #  include <unistd.h>
11971 #endif
11972 #ifdef I_STDLIB
11973 #  include <stdlib.h>
11974 #endif
11975 int main()
11976 {
11977         register int i;
11978         register unsigned long tmp;
11979         register unsigned long max = 0L;
11980
11981         for (i = 1000; i; i--) {
11982                 tmp = (unsigned long) $randfunc();
11983                 if (tmp > max) max = tmp;
11984         }
11985         for (i = 0; max; i++)
11986                 max /= 2;
11987         printf("%d\n",i);
11988 }
11989 EOCP
11990                                 set try
11991                                 if eval $compile_ok; then
11992                                         dflt=`try`
11993                                 else
11994                                         dflt='?'
11995                                         echo "(I can't seem to compile the test program...)"
11996                                 fi
11997                                 ;;
11998                         *)
11999                                 dflt="$randbits"
12000                                 ;;
12001                         esac
12002                         rp="How many bits does your $randfunc() function produce?"
12003                         . ./myread
12004                         randbits="$ans"
12005                         $rm -f try.c try
12006                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12007                         seedfunc="s$randfunc"
12008                         randseedtype=unsigned
12009                         ;;
12010                 *)
12011                         dflt="31"
12012                         rp="How many bits does your $randfunc() function produce?"
12013                         . ./myread
12014                         randbits="$ans"
12015                         seedfunc="s$randfunc"
12016                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12017                         if set $seedfunc val -f; eval $csym; $val; then
12018                                 echo "(Using $seedfunc() to seed random generator)"
12019                         else
12020                                 echo "(Warning: no $seedfunc() to seed random generator)"
12021                                 seedfunc=rand
12022                         fi
12023                         randseedtype=unsigned
12024                         ;;
12025                 esac
12026                 ;;
12027         esac
12028 done
12029
12030 echo " "
12031 echo "Determining whether or not we are on an EBCDIC system..." >&4
12032 $cat >tebcdic.c <<'EOM'
12033 int main()
12034 {
12035   if ('M'==0xd4) return 0;
12036   return 1;
12037 }
12038 EOM
12039
12040 val=$undef
12041 set tebcdic
12042 if eval $compile_ok; then
12043         if ./tebcdic; then
12044                 echo "You have EBCDIC." >&4
12045                 val="$define"
12046         else
12047                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12048         fi
12049 else
12050         echo "I'm unable to compile the test program." >&4
12051         echo "I'll assume ASCII or some ISO Latin." >&4
12052 fi
12053 $rm -f tebcdic.c tebcdic
12054 set ebcdic
12055 eval $setvar
12056
12057 echo " "
12058 $cat >&4 <<EOM
12059 Checking how to flush all pending stdio output...
12060 EOM
12061 # I only know how to find the first 32 possibly open files on SunOS.
12062 # See also hints/sunos_4_1.sh and util.c  --AD
12063 case "$osname" in
12064 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12065 esac
12066 $cat >>try.c <<EOCP
12067 #include <stdio.h>
12068 #$i_unistd I_UNISTD
12069 #ifdef I_UNISTD
12070 # include <unistd.h>
12071 #endif
12072 #$d_sysconf HAS_SYSCONF
12073 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12074 #ifdef HAS_STDIO_STREAM_ARRAY
12075 # define STDIO_STREAM_ARRAY $stdio_stream_array
12076 #endif
12077 int main() {
12078   FILE* p = fopen("try.out", "w");
12079 #ifdef TRY_FPUTC
12080   fputc('x', p);
12081 #else
12082 # ifdef TRY_FPRINTF
12083   fprintf(p, "x");
12084 # endif
12085 #endif
12086 #ifdef TRY_FFLUSH_NULL
12087   fflush(NULL);
12088 #endif
12089 #ifdef TRY_FFLUSH_ALL
12090   {
12091     long open_max = -1;
12092 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12093     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12094 # else
12095 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12096     open_max = sysconf(_SC_OPEN_MAX);
12097 #  else
12098 #   ifdef FOPEN_MAX
12099     open_max = FOPEN_MAX;
12100 #   else
12101 #    ifdef OPEN_MAX
12102     open_max = OPEN_MAX;
12103 #    else
12104 #     ifdef _NFILE
12105     open_max = _NFILE;
12106 #     endif
12107 #    endif
12108 #   endif
12109 #  endif
12110 # endif 
12111 # ifdef HAS_STDIO_STREAM_ARRAY
12112     if (open_max > 0) {
12113       long i;
12114       for (i = 0; i < open_max; i++)
12115             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12116                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12117                 STDIO_STREAM_ARRAY[i]._flag)
12118                 fflush(&STDIO_STREAM_ARRAY[i]);
12119     }   
12120   }
12121 # endif
12122 #endif
12123   _exit(42);
12124 }
12125 EOCP
12126 : first we have to find out how _not_ to flush
12127 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12128     output=''
12129     set try -DTRY_FPUTC
12130     if eval $compile; then
12131             $rm -f try.out
12132             ./try$exe_ext 2>/dev/null
12133             if $test ! -s try.out -a "X$?" = X42; then
12134                 output=-DTRY_FPUTC
12135             fi
12136     fi
12137     case "$output" in
12138     '')
12139             set try -DTRY_FPRINTF
12140             $rm -f try.out
12141             if eval $compile; then
12142                     $rm -f try.out
12143                     ./try$exe_ext 2>/dev/null
12144                     if $test ! -s try.out -a "X$?" = X42; then
12145                         output=-DTRY_FPRINTF
12146                     fi
12147             fi
12148         ;;
12149     esac
12150 fi
12151 : check for fflush NULL behaviour
12152 case "$fflushNULL" in
12153 '')     set try -DTRY_FFLUSH_NULL $output
12154         if eval $compile; then
12155                 $rm -f try.out
12156                 ./try$exe_ext 2>/dev/null
12157                 code="$?"
12158                 if $test -s try.out -a "X$code" = X42; then
12159                         fflushNULL="`$cat try.out`"
12160                 else
12161                         if $test "X$code" != X42; then
12162                                 $cat >&4 <<EOM
12163 (If this test failed, don't worry, we'll try another method shortly.)
12164 EOM
12165                         fi
12166                 fi
12167         fi
12168         $rm -f core try.core core.try.*
12169         case "$fflushNULL" in
12170         x)      $cat >&4 <<EOM
12171 Your fflush(NULL) works okay.
12172 EOM
12173                 fflushNULL="$define"
12174                 ;;
12175         '')     $cat >&4 <<EOM
12176 Your fflush(NULL) isn't working (contrary to ANSI C).
12177 EOM
12178                 fflushNULL="$undef"
12179                 ;;
12180         *)      $cat >&4 <<EOM
12181 Cannot figure out whether your fflush(NULL) works or not.
12182 I'm assuming it doesn't (contrary to ANSI C).
12183 EOM
12184                 fflushNULL="$undef"
12185                 ;;
12186         esac
12187         ;;
12188 $define|true|[yY]*)
12189         fflushNULL="$define"
12190         ;;
12191 *)
12192         fflushNULL="$undef"
12193         ;;
12194 esac
12195 : check explicit looping only if NULL did not work
12196 case "$fflushNULL" in
12197 "$undef")
12198         : check for fflush all behaviour
12199         case "$fflushall" in
12200         '')     set try -DTRY_FFLUSH_ALL $output
12201                 if eval $compile; then
12202                         $cat >&4 <<EOM
12203 (Now testing the other method--but note that also this may fail.)
12204 EOM
12205                         $rm -f try.out
12206                         ./try$exe_ext 2>/dev/null
12207                         if $test -s try.out -a "X$?" = X42; then
12208                                 fflushall="`$cat try.out`"
12209                         fi
12210                 fi
12211                 $rm -f core try.core core.try.*
12212                 case "$fflushall" in
12213                 x)      $cat >&4 <<EOM
12214 Whew. Flushing explicitly all the stdio streams works.
12215 EOM
12216                         fflushall="$define"
12217                         ;;
12218                 '')     $cat >&4 <<EOM
12219 Sigh. Flushing explicitly all the stdio streams doesn't work.
12220 EOM
12221                         fflushall="$undef"
12222                         ;;
12223                 *)      $cat >&4 <<EOM
12224 Cannot figure out whether flushing stdio streams explicitly works or not.
12225 I'm assuming it doesn't.
12226 EOM
12227                         fflushall="$undef"
12228                         ;;
12229                 esac
12230                 ;;
12231         "$define"|true|[yY]*)
12232                 fflushall="$define"
12233                 ;;
12234         *)
12235                 fflushall="$undef"
12236                 ;;
12237         esac
12238         ;;
12239 *)      fflushall="$undef"      
12240         ;;
12241 esac
12242 case "$fflushNULL$fflushall" in
12243 undefundef)
12244         $cat <<EOM
12245 I cannot figure out how to flush pending stdio output.
12246 EOM
12247         ;;
12248 esac
12249 $rm -f try.* try$exe_ext
12250
12251 : Store the full pathname to the ar program for use in the C program
12252 : Respect a hint or command line value for full_ar.
12253 case "$full_ar" in
12254 '') full_ar=$ar ;;
12255 esac
12256
12257 : Store the full pathname to the sed program for use in the C program
12258 full_sed=$sed
12259
12260 : see what type gids are declared as in the kernel
12261 echo " "
12262 echo "Looking for the type for group ids returned by getgid()."
12263 set gid_t gidtype xxx stdio.h sys/types.h
12264 eval $typedef
12265 case "$gidtype" in
12266 xxx)
12267         xxx=`./findhdr sys/user.h`
12268         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12269         case $1 in
12270         unsigned) dflt="$1 $2" ;;
12271         *) dflt="$1" ;;
12272         esac
12273         ;;
12274 *) dflt="$gidtype";;
12275 esac
12276 case "$gidtype" in
12277 gid_t) echo "gid_t found." ;;
12278 *)      rp="What is the type for group ids returned by getgid()?"
12279         . ./myread
12280         gidtype="$ans"
12281         ;;
12282 esac
12283
12284 echo " "
12285 case "$gidtype" in
12286 *_t) zzz="$gidtype"     ;;
12287 *)   zzz="gid"          ;;
12288 esac
12289 echo "Checking the size of $zzz..." >&4 
12290 cat > try.c <<EOCP
12291 #include <sys/types.h>
12292 #include <stdio.h>
12293 int main() {
12294     printf("%d\n", (int)sizeof($gidtype));
12295     exit(0);
12296 }
12297 EOCP
12298 set try
12299 if eval $compile_ok; then
12300         yyy=`./try`
12301         case "$yyy" in
12302         '')     gidsize=4
12303                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12304                 ;;
12305         *)      gidsize=$yyy
12306                 echo "Your $zzz size is $gidsize bytes."
12307                 ;;
12308         esac
12309 else
12310         gidsize=4
12311         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12312 fi
12313
12314
12315 echo " "
12316 case "$gidtype" in
12317 *_t) zzz="$gidtype"     ;;
12318 *)   zzz="gid"          ;;
12319 esac
12320 echo "Checking the sign of $zzz..." >&4 
12321 cat > try.c <<EOCP
12322 #include <sys/types.h>
12323 #include <stdio.h>
12324 int main() {
12325         $gidtype foo = -1;
12326         if (foo < 0)
12327                 printf("-1\n");
12328         else
12329                 printf("1\n");
12330 }
12331 EOCP
12332 set try
12333 if eval $compile; then
12334         yyy=`./try`
12335         case "$yyy" in
12336         '')     gidsign=1
12337                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12338                 ;;
12339         *)      gidsign=$yyy
12340                 case "$gidsign" in
12341                  1) echo "Your $zzz is unsigned." ;;
12342                 -1) echo "Your $zzz is signed."   ;;
12343                 esac
12344                 ;;
12345         esac
12346 else
12347         gidsign=1
12348         echo "(I can't compile the test program--guessing unsigned.)" >&4
12349 fi
12350
12351
12352 echo " "
12353
12354 if $test X"$quadtype" != X; then
12355
12356 echo "Checking how to print 64-bit integers..." >&4
12357
12358 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12359         $cat >try.c <<'EOCP'
12360 #include <sys/types.h>
12361 #include <stdio.h>
12362 int main() {
12363   int q = 12345678901;
12364   printf("%ld\n", q);
12365 }
12366 EOCP
12367         set try
12368         if eval $compile; then
12369                 yyy=`./try$exe_ext`
12370                 case "$yyy" in
12371                 12345678901)
12372                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12373                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12374                         echo "We will use %d."
12375                         ;;
12376                 esac
12377         fi
12378 fi
12379
12380 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12381         $cat >try.c <<'EOCP'
12382 #include <sys/types.h>
12383 #include <stdio.h>
12384 int main() {
12385   long q = 12345678901;
12386   printf("%ld\n", q);
12387 }
12388 EOCP
12389         set try
12390         if eval $compile; then
12391                 yyy=`./try$exe_ext`
12392                 case "$yyy" in
12393                 12345678901)
12394                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12395                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12396                         echo "We will use %ld."
12397                         ;;
12398                 esac
12399         fi
12400 fi
12401
12402 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12403         $cat >try.c <<'EOCP'
12404 #include <sys/types.h>
12405 #include <inttypes.h>
12406 #include <stdio.h>
12407 int main() {
12408   int64_t q = 12345678901;
12409   printf("%" PRId64 "\n", q);
12410 }
12411 EOCP
12412         set try
12413         if eval $compile; then
12414                 yyy=`./try$exe_ext`
12415                 case "$yyy" in
12416                 12345678901)
12417                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12418                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12419                         echo "We will use the C9X style."
12420                         ;;
12421                 esac
12422         fi
12423 fi
12424
12425 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12426         $cat >try.c <<'EOCP'
12427 #include <sys/types.h>
12428 #include <stdio.h>
12429 int main() {
12430   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12431   printf("%lld\n", q);
12432 }
12433 EOCP
12434         set try
12435         if eval $compile; then
12436                 yyy=`./try$exe_ext`
12437                 case "$yyy" in
12438                 12345678901)
12439                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12440                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12441                         echo "We will use the %lld style."
12442                         ;;
12443                 esac
12444         fi
12445 fi
12446
12447 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12448         $cat >try.c <<EOCP
12449 #include <sys/types.h>
12450 #include <stdio.h>
12451 int main() {
12452   $quadtype q = 12345678901;
12453   printf("%Ld\n", q);
12454 }
12455 EOCP
12456         set try
12457         if eval $compile; then
12458                 yyy=`./try$exe_ext`
12459                 case "$yyy" in
12460                 12345678901)
12461                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12462                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12463                         echo "We will use %Ld."
12464                         ;;
12465                 esac
12466         fi
12467 fi
12468
12469 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12470         $cat >try.c <<EOCP
12471 #include <sys/types.h>
12472 #include <stdio.h>
12473 int main() {
12474   $quadtype q = 12345678901;
12475   printf("%qd\n", q);
12476 }
12477 EOCP
12478         set try
12479         if eval $compile; then
12480                 yyy=`./try$exe_ext`
12481                 case "$yyy" in
12482                 12345678901)
12483                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12484                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12485                         echo "We will use %qd."
12486                         ;;
12487                 esac
12488         fi
12489 fi
12490
12491 if $test X"$sPRId64" = X; then
12492         echo "Cannot figure out how to print 64-bit integers." >&4
12493 fi
12494
12495 $rm -f try try.*
12496
12497 fi
12498
12499 case "$sPRId64" in
12500 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12501         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12502         ;;
12503 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12504         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12505         ;;
12506 esac
12507
12508
12509 echo " "
12510 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12511
12512 if $test X"$ivsize" = X8; then
12513         ivdformat="$sPRId64"
12514         uvuformat="$sPRIu64"
12515         uvoformat="$sPRIo64"
12516         uvxformat="$sPRIx64"
12517 else
12518         if $test X"$ivsize" = X"$longsize"; then
12519                 ivdformat='"ld"'
12520                 uvuformat='"lu"'
12521                 uvoformat='"lo"'
12522                 uvxformat='"lx"'
12523         else
12524                 if $test X"$ivsize" = X"$intsize"; then
12525                         ivdformat='"d"'
12526                         uvuformat='"u"'
12527                         uvoformat='"o"'
12528                         uvxformat='"x"'
12529                 else
12530                         : far out
12531                         if $test X"$ivsize" = X"$shortsize"; then
12532                                 ivdformat='"hd"'
12533                                 uvuformat='"hu"'
12534                                 uvoformat='"ho"'
12535                                 uvxformat='"hx"'
12536                         fi
12537                 fi
12538         fi
12539 fi
12540
12541 case "$ivdformat" in
12542 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12543     exit 1
12544     ;;
12545 esac
12546
12547
12548 echo " "
12549 $echo "Checking the format string to be used for gids..." >&4
12550
12551 case "$gidsign" in
12552 -1)     if $test X"$gidsize" = X"$ivsize"; then
12553                 gidformat="$ivdformat"
12554         else
12555                 if $test X"$gidsize" = X"$longsize"; then
12556                         gidformat='"ld"'
12557                 else
12558                         if $test X"$gidsize" = X"$intsize"; then
12559                                 gidformat='"d"'
12560                         else
12561                                 if $test X"$gidsize" = X"$shortsize"; then
12562                                         gidformat='"hd"'
12563                                 fi
12564                         fi
12565                 fi
12566         fi
12567         ;;
12568 *)      if $test X"$gidsize" = X"$uvsize"; then
12569                 gidformat="$uvuformat"
12570         else
12571                 if $test X"$gidsize" = X"$longsize"; then
12572                         gidformat='"lu"'
12573                 else
12574                         if $test X"$gidsize" = X"$intsize"; then
12575                                 gidformat='"u"'
12576                         else
12577                                 if $test X"$gidsize" = X"$shortsize"; then
12578                                         gidformat='"hu"'
12579                                 fi
12580                         fi
12581                 fi
12582         fi
12583         ;;
12584 esac
12585
12586 : see if getgroups exists
12587 set getgroups d_getgrps
12588 eval $inlibc
12589
12590 : see if setgroups exists
12591 set setgroups d_setgrps
12592 eval $inlibc
12593
12594
12595 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12596 echo " "
12597 case "$d_getgrps$d_setgrps" in
12598 *define*)
12599         case "$groupstype" in
12600         '') dflt="$gidtype" ;;
12601         *)  dflt="$groupstype" ;;
12602         esac
12603         $cat <<EOM
12604 What type of pointer is the second argument to getgroups() and setgroups()?
12605 Usually this is the same as group ids, $gidtype, but not always.
12606
12607 EOM
12608         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12609         . ./myread
12610         groupstype="$ans"
12611         ;;
12612 *)  groupstype="$gidtype";;
12613 esac
12614
12615 echo " "
12616 echo "Checking if your $make program sets \$(MAKE)..." >&4
12617 case "$make_set_make" in
12618 '')
12619         $sed 's/^X //' > testmake.mak << 'EOF'
12620 Xall:
12621 X       @echo 'maketemp="$(MAKE)"'
12622 EOF
12623         case "`$make -f testmake.mak 2>/dev/null`" in
12624         *maketemp=*) make_set_make='#' ;;
12625         *)      make_set_make="MAKE=$make" ;;
12626         esac
12627         $rm -f testmake.mak
12628         ;;
12629 esac
12630 case "$make_set_make" in
12631 '#') echo "Yup, it does.";;
12632 *) echo "Nope, it doesn't.";;
12633 esac
12634
12635 : see what type is used for mode_t
12636 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12637 set mode_t modetype int stdio.h sys/types.h
12638 eval $typedef_ask
12639
12640 : define a fucntion to check prototypes
12641 $cat > protochk <<EOSH
12642 $startsh
12643 cc="$cc"
12644 optimize="$optimize"
12645 ccflags="$ccflags"
12646 prototype="$prototype"
12647 define="$define"
12648 rm=$rm
12649 EOSH
12650
12651 $cat >> protochk <<'EOSH'
12652
12653 $rm -f try.c
12654 foo="$1"
12655 shift
12656 while test $# -ge 2; do
12657         case "$1" in
12658                 $define) echo "#include <$2>" >> try.c ;;
12659                 literal) echo "$2" >> try.c ;;
12660         esac
12661     shift 2
12662 done
12663 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12664 cat >> try.c <<'EOCP'
12665 #ifdef CAN_PROTOTYPE
12666 #define _(args) args
12667 #else
12668 #define _(args) ()
12669 #endif
12670 EOCP
12671 echo "$foo" >> try.c
12672 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12673 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12674 status=$?
12675 $rm -f try.[co]
12676 exit $status
12677 EOSH
12678 chmod +x protochk
12679 $eunicefix protochk
12680
12681 : see what type is used for size_t
12682 rp="What is the type used for the length parameter for string functions?"
12683 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12684 eval $typedef_ask
12685
12686 : check for type of arguments to gethostbyaddr. 
12687 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12688         case "$d_gethbyaddr" in
12689         $define)
12690                 $cat <<EOM
12691
12692 Checking to see what type of arguments are accepted by gethostbyaddr().
12693 EOM
12694                 hdrs="$define sys/types.h
12695                         $d_socket sys/socket.h 
12696                         $i_niin netinet/in.h 
12697                         $i_netdb netdb.h
12698                         $i_unistd unistd.h"
12699                 : The first arg can 'char *' or 'void *'
12700                 : The second arg is some of integral type
12701                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12702                         for yyy in size_t long int; do
12703                                 case "$netdb_host_type" in
12704                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12705                                         if ./protochk "$try" $hdrs; then
12706                                                 echo "Your system accepts $xxx for the first arg."
12707                                                 echo "...and $yyy for the second arg."
12708                                                 netdb_host_type="$xxx"
12709                                                 netdb_hlen_type="$yyy"
12710                                         fi
12711                                         ;;
12712                                 esac
12713                         done
12714                 done
12715                 : In case none of those worked, prompt the user.
12716                 case "$netdb_host_type" in
12717                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12718                         dflt='char *'
12719                         . ./myread
12720                         netdb_host_type=$ans
12721                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12722                         dflt="$sizetype"
12723                         . ./myread
12724                         netdb_hlen_type=$ans
12725                         ;;
12726                 esac
12727                 ;;
12728         *)      : no gethostbyaddr, so pick harmless defaults
12729                 netdb_host_type='char *'
12730                 netdb_hlen_type="$sizetype"
12731                 ;;
12732         esac
12733         # Remove the "const" if needed. -- but then we'll have a 
12734         # prototype clash!
12735         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12736 fi
12737
12738 : check for type of argument to gethostbyname. 
12739 if test "X$netdb_name_type" = X ; then
12740         case "$d_gethbyname" in
12741         $define)
12742                 $cat <<EOM
12743
12744 Checking to see what type of argument is accepted by gethostbyname().
12745 EOM
12746                 hdrs="$define sys/types.h
12747                         $d_socket sys/socket.h 
12748                         $i_niin netinet/in.h 
12749                         $i_netdb netdb.h
12750                         $i_unistd unistd.h"
12751                 for xxx in "const char *" "char *"; do
12752                         case "$netdb_name_type" in
12753                         '')     try="extern struct hostent *gethostbyname($xxx);"
12754                                 if ./protochk "$try" $hdrs; then
12755                                         echo "Your system accepts $xxx."
12756                                         netdb_name_type="$xxx"
12757                                 fi
12758                                 ;;
12759                         esac
12760                 done
12761                 : In case none of those worked, prompt the user.
12762                 case "$netdb_name_type" in
12763                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12764                         dflt='char *'
12765                         . ./myread
12766                         netdb_name_type=$ans
12767                         ;;
12768                 esac
12769                 ;;
12770         *)      : no gethostbyname, so pick harmless default
12771                 netdb_name_type='char *'
12772                 ;;
12773         esac
12774 fi
12775
12776 : check for type of 1st argument to getnetbyaddr. 
12777 if test "X$netdb_net_type" = X ; then
12778         case "$d_getnbyaddr" in
12779         $define)
12780                 $cat <<EOM
12781
12782 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12783 EOM
12784                 hdrs="$define sys/types.h
12785                         $d_socket sys/socket.h 
12786                         $i_niin netinet/in.h 
12787                         $i_netdb netdb.h
12788                         $i_unistd unistd.h"
12789                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12790                         case "$netdb_net_type" in
12791                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12792                                 if ./protochk "$try" $hdrs; then
12793                                         echo "Your system accepts $xxx."
12794                                         netdb_net_type="$xxx"
12795                                 fi
12796                                 ;;
12797                         esac
12798                 done
12799                 : In case none of those worked, prompt the user.
12800                 case "$netdb_net_type" in
12801                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12802                         dflt='long'
12803                         . ./myread
12804                         netdb_net_type=$ans
12805                         ;;
12806                 esac
12807                 ;;
12808         *)      : no getnetbyaddr, so pick harmless default
12809                 netdb_net_type='long'
12810                 ;;
12811         esac
12812 fi
12813 : locate the preferred pager for this system
12814 case "$pager" in
12815 '')
12816         dflt=''
12817         case "$pg" in
12818         /*) dflt=$pg;;
12819         esac
12820         case "$more" in
12821         /*) dflt=$more;;
12822         esac
12823         case "$less" in
12824         /*) dflt=$less;;
12825         esac
12826         case "$dflt" in
12827         '') dflt=/usr/ucb/more;;
12828         esac
12829         ;;
12830 *) dflt="$pager";;
12831 esac
12832 echo " "
12833 fn=f/
12834 rp='What pager is used on your system?'
12835 . ./getfile
12836 pager="$ans"
12837
12838 : see what type pids are declared as in the kernel
12839 rp="What is the type of process ids on this system?"
12840 set pid_t pidtype int stdio.h sys/types.h
12841 eval $typedef_ask
12842
12843 : check for length of pointer
12844 echo " "
12845 case "$ptrsize" in
12846 '')
12847         $echo $n "Checking to see how big your pointers are...$c" >&4
12848         if test "$voidflags" -gt 7; then
12849                 echo '#define VOID_PTR char *' > try.c
12850         else
12851                 echo '#define VOID_PTR void *' > try.c
12852         fi
12853         $cat >>try.c <<'EOCP'
12854 #include <stdio.h>
12855 int main()
12856 {
12857     printf("%d\n", (int)sizeof(VOID_PTR));
12858     exit(0);
12859 }
12860 EOCP
12861         set try
12862         if eval $compile_ok; then
12863                 ptrsize=`./try`
12864                 $echo " $ptrsize bytes." >&4
12865         else
12866                 dflt='4'
12867                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12868                 rp="What is the size of a pointer (in bytes)?"
12869                 . ./myread
12870                 ptrsize="$ans"
12871         fi
12872         ;;
12873 esac
12874 $rm -f try.c try
12875
12876 : see if ar generates random libraries by itself
12877 echo " "
12878 echo "Checking how to generate random libraries on your machine..." >&4
12879 echo 'int bar1() { return bar2(); }' > bar1.c
12880 echo 'int bar2() { return 2; }' > bar2.c
12881 $cat > foo.c <<'EOP'
12882 int main() { printf("%d\n", bar1()); exit(0); }
12883 EOP
12884 $cc $ccflags -c bar1.c >/dev/null 2>&1
12885 $cc $ccflags -c bar2.c >/dev/null 2>&1
12886 $cc $ccflags -c foo.c >/dev/null 2>&1
12887 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12888 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12889         ./foobar >/dev/null 2>&1; then
12890         echo "$ar appears to generate random libraries itself."
12891         orderlib=false
12892         ranlib=":"
12893 elif $ar ts bar$_a >/dev/null 2>&1 &&
12894         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12895         ./foobar >/dev/null 2>&1; then
12896                 echo "a table of contents needs to be added with '$ar ts'."
12897                 orderlib=false
12898                 ranlib="$ar ts"
12899 else
12900         case "$ranlib" in
12901         :) ranlib='';;
12902         '')
12903                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12904                 $test -f $ranlib || ranlib=''
12905                 ;;
12906         esac
12907         if $test -n "$ranlib"; then
12908                 echo "your system has '$ranlib'; we'll use that."
12909                 orderlib=false
12910         else
12911                 echo "your system doesn't seem to support random libraries"
12912                 echo "so we'll use lorder and tsort to order the libraries."
12913                 orderlib=true
12914                 ranlib=":"
12915         fi
12916 fi
12917 $rm -f foo* bar* 
12918
12919 : check for type of arguments to select. 
12920 case "$selecttype" in
12921 '') case "$d_select" in
12922         $define)
12923                 echo " "
12924                 $cat <<EOM
12925 Checking to see what type of arguments are accepted by select().
12926 EOM
12927                 hdrs="$define sys/types.h
12928                         $i_systime sys/time.h 
12929                         $i_sysselct sys/select.h
12930                         $d_socket sys/socket.h"
12931                 : The first arg can be int, unsigned, or size_t
12932                 : The last arg may or may not be 'const'
12933                 val=''
12934                 : void pointer has been seen but using that
12935                 : breaks the selectminbits test
12936                 for xxx in 'fd_set *' 'int *'; do
12937                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12938                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12939                                         case "$val" in
12940                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12941                                                 if ./protochk "$try" $hdrs; then
12942                                                         echo "Your system accepts $xxx."
12943                                                         val="$xxx"
12944                                                 fi
12945                                                 ;;
12946                                         esac
12947                                 done
12948                         done
12949                 done
12950                 case "$val" in
12951                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12952                         case "$d_fd_set" in
12953                                 $define) dflt="fd_set *" ;;
12954                                 *)              dflt="int *" ;;
12955                         esac
12956                         . ./myread
12957                         val=$ans
12958                         ;;
12959                 esac
12960                 selecttype="$val"
12961                 ;;
12962         *)      : no select, so pick a harmless default
12963                 selecttype='int *'
12964                 ;;
12965         esac
12966         ;;
12967 esac
12968
12969 : check for the select 'width'
12970 case "$selectminbits" in
12971 '') case "$d_select" in
12972         $define)
12973                 $cat <<EOM
12974
12975 Checking to see on how many bits at a time your select() operates...
12976 EOM
12977                 $cat >try.c <<EOCP
12978 #include <sys/types.h>
12979 #$i_time I_TIME
12980 #$i_systime I_SYS_TIME
12981 #$i_systimek I_SYS_TIME_KERNEL
12982 #ifdef I_TIME
12983 #   include <time.h>
12984 #endif
12985 #ifdef I_SYS_TIME
12986 #   ifdef I_SYS_TIME_KERNEL
12987 #       define KERNEL
12988 #   endif
12989 #   include <sys/time.h>
12990 #   ifdef I_SYS_TIME_KERNEL
12991 #       undef KERNEL
12992 #   endif
12993 #endif
12994 #$i_sysselct I_SYS_SELECT
12995 #ifdef I_SYS_SELECT
12996 #include <sys/select.h>
12997 #endif
12998 #$d_socket HAS_SOCKET
12999 #ifdef HAS_SOCKET
13000 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13001 #endif
13002 #include <stdio.h>
13003 $selecttype b;
13004 #define S sizeof(*(b))
13005 #define MINBITS 64
13006 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13007 #define NBITS  (NBYTES * 8)
13008 int main() {
13009     char s[NBYTES];
13010     struct timeval t;
13011     int i;
13012     FILE* fp;
13013     int fd;
13014
13015     fclose(stdin);
13016     fp = fopen("try.c", "r");
13017     if (fp == 0)
13018       exit(1);
13019     fd = fileno(fp);
13020     if (fd < 0)
13021       exit(2);
13022     b = ($selecttype)s;
13023     for (i = 0; i < NBITS; i++)
13024         FD_SET(i, b);
13025     t.tv_sec  = 0;
13026     t.tv_usec = 0;
13027     select(fd + 1, b, 0, 0, &t);
13028     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13029     printf("%d\n", i + 1);
13030     return 0;
13031 }
13032 EOCP
13033                 set try
13034                 if eval $compile_ok; then
13035                         selectminbits=`./try`
13036                         case "$selectminbits" in
13037                         '')     cat >&4 <<EOM
13038 Cannot figure out on how many bits at a time your select() operates.
13039 I'll play safe and guess it is 32 bits.
13040 EOM
13041                                 selectminbits=32
13042                                 bits="32 bits"
13043                                 ;;
13044                         1)      bits="1 bit" ;;
13045                         *)      bits="$selectminbits bits" ;;
13046                         esac
13047                         echo "Your select() operates on $bits at a time." >&4
13048                 else
13049                         rp='What is the minimum number of bits your select() operates on?'
13050                         case "$byteorder" in
13051                         1234|12345678)  dflt=32 ;;
13052                         *)              dflt=1  ;;
13053                         esac
13054                         . ./myread
13055                         val=$ans
13056                         selectminbits="$val"
13057                 fi
13058                 $rm -f try.* try
13059                 ;;
13060         *)      : no select, so pick a harmless default
13061                 selectminbits='32'
13062                 ;;
13063         esac
13064         ;;
13065 esac
13066
13067 : Trace out the files included by signal.h, then look for SIGxxx names.
13068 : Remove SIGARRAYSIZE used by HPUX.
13069 : Remove SIGSTKSIZE used by Linux.
13070 : Remove SIGSTKSZ used by Posix.
13071 : Remove SIGTYP void lines used by OS2.
13072 : Some cpps, like os390, dont give the file name anywhere
13073 if [ "X$fieldn" = X ]; then
13074         : Just make some guesses.  We check them later.
13075         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13076 else
13077         xxx=`echo '#include <signal.h>' |
13078         $cppstdin $cppminus $cppflags 2>/dev/null |
13079         $grep '^[       ]*#.*include' | 
13080         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13081 fi
13082 : Check this list of files to be sure we have parsed the cpp output ok.
13083 : This will also avoid potentially non-existent files, such 
13084 : as ../foo/bar.h
13085 xxxfiles=''
13086 for xx in $xxx /dev/null ; do
13087         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13088 done
13089 : If we have found no files, at least try signal.h
13090 case "$xxxfiles" in
13091 '')     xxxfiles=`./findhdr signal.h` ;;
13092 esac
13093 xxx=`awk '
13094 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13095         print substr($2, 4, 20)
13096 }
13097 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13098         print substr($3, 4, 20)
13099 }' $xxxfiles`
13100 : Append some common names just in case the awk scan failed.
13101 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13102 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13103 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13104 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13105 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13106
13107 : generate a few handy files for later
13108 $cat > signal.c <<'EOCP'
13109 #include <sys/types.h>
13110 #include <signal.h>
13111 #include <stdio.h>
13112 int main() {
13113
13114 /* Strange style to avoid deeply-nested #if/#else/#endif */
13115 #ifndef NSIG
13116 #  ifdef _NSIG
13117 #    define NSIG (_NSIG)
13118 #  endif
13119 #endif
13120
13121 #ifndef NSIG
13122 #  ifdef SIGMAX
13123 #    define NSIG (SIGMAX+1)
13124 #  endif
13125 #endif
13126
13127 #ifndef NSIG
13128 #  ifdef SIG_MAX
13129 #    define NSIG (SIG_MAX+1)
13130 #  endif
13131 #endif
13132
13133 #ifndef NSIG
13134 #  ifdef MAXSIG
13135 #    define NSIG (MAXSIG+1)
13136 #  endif
13137 #endif
13138
13139 #ifndef NSIG
13140 #  ifdef MAX_SIG
13141 #    define NSIG (MAX_SIG+1)
13142 #  endif
13143 #endif
13144
13145 #ifndef NSIG
13146 #  ifdef SIGARRAYSIZE
13147 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13148 #  endif
13149 #endif
13150
13151 #ifndef NSIG
13152 #  ifdef _sys_nsig
13153 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13154 #  endif
13155 #endif
13156
13157 /* Default to some arbitrary number that's big enough to get most
13158    of the common signals.
13159 */
13160 #ifndef NSIG
13161 #    define NSIG 50
13162 #endif
13163
13164 printf("NSIG %d\n", NSIG);
13165
13166 #ifndef JUST_NSIG
13167
13168 EOCP
13169
13170 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13171 {
13172         printf "#ifdef SIG"; printf $1; printf "\n"
13173         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13174         printf $1; printf ");\n"
13175         printf "#endif\n"
13176 }
13177 END {
13178         printf "#endif /* JUST_NSIG */\n";
13179         printf "exit(0);\n}\n";
13180 }
13181 ' >>signal.c
13182 $cat >signal.awk <<'EOP'
13183 BEGIN { ndups = 0 }
13184 $1 ~ /^NSIG$/ { nsig = $2 }
13185 ($1 !~ /^NSIG$/) && (NF == 2) {
13186     if ($2 > maxsig) { maxsig = $2 }
13187     if (sig_name[$2]) {
13188         dup_name[ndups] = $1
13189         dup_num[ndups] = $2
13190         ndups++ 
13191     }
13192     else {
13193         sig_name[$2] = $1
13194         sig_num[$2] = $2
13195     }
13196 }
13197 END { 
13198     if (nsig == 0) {
13199         nsig = maxsig + 1
13200     }
13201     printf("NSIG %d\n", nsig);
13202     for (n = 1; n < nsig; n++) {
13203         if (sig_name[n]) {
13204             printf("%s %d\n", sig_name[n], sig_num[n])
13205         }
13206         else {
13207             printf("NUM%d %d\n", n, n) 
13208         }
13209     }
13210     for (n = 0; n < ndups; n++) {
13211         printf("%s %d\n", dup_name[n], dup_num[n])
13212     }
13213 }
13214 EOP
13215 $cat >signal_cmd <<EOS
13216 $startsh
13217 if $test -s signal.lst; then
13218     echo "Using your existing signal.lst file"
13219         exit 0
13220 fi
13221 xxx="$xxx"
13222 EOS
13223 $cat >>signal_cmd <<'EOS'
13224
13225 set signal
13226 if eval $compile_ok; then
13227         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13228 else
13229         echo "(I can't seem be able to compile the whole test program)" >&4
13230         echo "(I'll try it in little pieces.)" >&4
13231         set signal -DJUST_NSIG
13232         if eval $compile_ok; then
13233                 ./signal$_exe > signal.nsg
13234                 $cat signal.nsg
13235         else
13236                 echo "I can't seem to figure out how many signals you have." >&4
13237                 echo "Guessing 50." >&4
13238                 echo 'NSIG 50' > signal.nsg
13239         fi
13240         : Now look at all the signal names, one at a time.
13241         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13242                 $cat > signal.c <<EOCP
13243 #include <sys/types.h>
13244 #include <signal.h>
13245 #include <stdio.h>
13246 int main() {
13247 printf("$xx %d\n", SIG${xx});
13248 return 0;
13249 }
13250 EOCP
13251                 set signal
13252                 if eval $compile; then
13253                         echo "SIG${xx} found."
13254                         ./signal$_exe  >> signal.ls1
13255                 else
13256                         echo "SIG${xx} NOT found."
13257                 fi
13258         done
13259         if $test -s signal.ls1; then
13260                 $cat signal.nsg signal.ls1 |
13261                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13262         fi
13263
13264 fi
13265 if $test -s signal.lst; then
13266         :
13267 else
13268         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13269         echo 'kill -l' >signal
13270         set X `csh -f <signal`
13271         $rm -f signal
13272         shift
13273         case $# in
13274         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13275         esac
13276         echo $@ | $tr ' ' $trnl | \
13277             $awk '{ printf "%s %d\n", $1, ++s; }
13278                   END { printf "NSIG %d\n", ++s }' >signal.lst
13279 fi
13280 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13281 EOS
13282 chmod a+x signal_cmd
13283 $eunicefix signal_cmd
13284
13285 : generate list of signal names
13286 echo " "
13287 case "$sig_name_init" in
13288 '') doinit=yes ;;
13289 *)  case "$sig_num_init" in
13290     ''|*,*) doinit=yes ;;
13291     esac ;;
13292 esac
13293 case "$doinit" in
13294 yes)
13295         echo "Generating a list of signal names and numbers..." >&4
13296         . ./signal_cmd
13297         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13298         sig_name=`$awk 'BEGIN { printf "ZERO " }
13299                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13300         sig_num=`$awk  'BEGIN { printf "0 " }
13301                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13302         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13303                              !/^NSIG/   { printf "\"%s\", ", $1 }
13304                              END        { printf "0\n" }' signal.lst`
13305         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13306                              !/^NSIG/   { printf "%d, ", $2}
13307                              END        { printf "0\n"}' signal.lst`
13308         ;;
13309 esac
13310 echo "The following $sig_count signals are available:"
13311 echo " "
13312 echo $sig_name | $awk \
13313 'BEGIN { linelen = 0 }
13314 {
13315         for (i = 1; i <= NF; i++) {
13316                 name = "SIG" $i " "
13317                 linelen = linelen + length(name)
13318                 if (linelen > 70) {
13319                         printf "\n"
13320                         linelen = length(name)
13321                 }
13322                 printf "%s", name
13323         }
13324         printf "\n"
13325 }'
13326 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13327
13328 : see what type is used for signed size_t
13329 set ssize_t ssizetype int stdio.h sys/types.h
13330 eval $typedef
13331 dflt="$ssizetype"
13332 $cat > ssize.c <<EOM
13333 #include <stdio.h>
13334 #include <sys/types.h>
13335 #define Size_t $sizetype
13336 #define SSize_t $dflt
13337 int main()
13338 {
13339         if (sizeof(Size_t) == sizeof(SSize_t))
13340                 printf("$dflt\n");
13341         else if (sizeof(Size_t) == sizeof(int))
13342                 printf("int\n");
13343         else 
13344                 printf("long\n");
13345         exit(0);
13346 }
13347 EOM
13348 echo " "
13349 set ssize
13350 if eval $compile_ok && ./ssize > /dev/null; then
13351         ssizetype=`./ssize`
13352         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13353 else
13354         $cat >&4 <<EOM
13355 Help! I can't compile and run the ssize_t test program: please enlighten me!
13356 (This is probably a misconfiguration in your system or libraries, and
13357 you really ought to fix it.  Still, I'll try anyway.)
13358
13359 I need a type that is the same size as $sizetype, but is guaranteed to
13360 be signed.  Common values are ssize_t, int and long.
13361
13362 EOM
13363         rp="What signed type is the same size as $sizetype?"
13364         . ./myread
13365         ssizetype="$ans"
13366 fi
13367 $rm -f ssize ssize.*
13368
13369 : see what type of char stdio uses.
13370 echo " "
13371 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13372         echo "Your stdio uses unsigned chars." >&4
13373         stdchar="unsigned char"
13374 else
13375         echo "Your stdio uses signed chars." >&4
13376         stdchar="char"
13377 fi
13378
13379 : see if time exists
13380 echo " "
13381 if test "X$d_time" = X -o X"$timetype" = X; then
13382     if set time val -f d_time; eval $csym; $val; then
13383                 echo 'time() found.' >&4
13384                 val="$define"
13385                 rp="What is the type returned by time() on this system?"
13386                 set time_t timetype long stdio.h sys/types.h
13387                 eval $typedef_ask
13388     else
13389                 echo 'time() not found, hope that will do.' >&4
13390                 val="$undef"
13391                 timetype='int';
13392     fi
13393     set d_time
13394     eval $setvar
13395 fi
13396
13397 : see what type uids are declared as in the kernel
13398 echo " "
13399 echo "Looking for the type for user ids returned by getuid()."
13400 set uid_t uidtype xxx stdio.h sys/types.h
13401 eval $typedef
13402 case "$uidtype" in
13403 xxx)
13404         xxx=`./findhdr sys/user.h`
13405         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13406         case $1 in
13407         unsigned) dflt="$1 $2" ;;
13408         *) dflt="$1" ;;
13409         esac
13410         ;;
13411 *) dflt="$uidtype";;
13412 esac
13413 case "$uidtype" in
13414 uid_t)  echo "uid_t found." ;;
13415 *)      rp="What is the type for user ids returned by getuid()?"
13416         . ./myread
13417         uidtype="$ans"
13418         ;;
13419 esac
13420
13421 echo " "
13422 case "$uidtype" in
13423 *_t) zzz="$uidtype"     ;;
13424 *)   zzz="uid"          ;;
13425 esac
13426 echo "Checking the size of $zzz..." >&4 
13427 cat > try.c <<EOCP
13428 #include <sys/types.h>
13429 #include <stdio.h>
13430 int main() {
13431     printf("%d\n", (int)sizeof($uidtype));
13432     exit(0);
13433 }
13434 EOCP
13435 set try
13436 if eval $compile_ok; then
13437         yyy=`./try`
13438         case "$yyy" in
13439         '')     uidsize=4
13440                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13441                 ;;
13442         *)      uidsize=$yyy
13443                 echo "Your $zzz size is $uidsize bytes."
13444                 ;;
13445         esac
13446 else
13447         uidsize=4
13448         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13449 fi
13450
13451 echo " "
13452 case "$uidtype" in
13453 *_t) zzz="$uidtype"     ;;
13454 *)   zzz="uid"          ;;
13455 esac
13456 echo "Checking the sign of $zzz..." >&4
13457 cat > try.c <<EOCP
13458 #include <sys/types.h>
13459 #include <stdio.h>
13460 int main() {
13461         $uidtype foo = -1;
13462         if (foo < 0)
13463                 printf("-1\n");
13464         else
13465                 printf("1\n");
13466 }
13467 EOCP
13468 set try
13469 if eval $compile; then
13470         yyy=`./try`
13471         case "$yyy" in
13472         '')     uidsign=1
13473                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13474                 ;;
13475         *)      uidsign=$yyy
13476                 case "$uidsign" in
13477                  1) echo "Your $zzz is unsigned." ;;
13478                 -1) echo "Your $zzz is signed."   ;;
13479                 esac
13480                 ;;
13481         esac
13482 else
13483         uidsign=1
13484         echo "(I can't compile the test program--guessing unsigned.)" >&4
13485 fi
13486
13487
13488
13489 echo " "
13490 $echo "Checking the format string to be used for uids..." >&4
13491
13492 case "$uidsign" in
13493 -1)     if $test X"$uidsize" = X"$ivsize"; then
13494                 uidformat="$ivdformat"
13495         else
13496                 if $test X"$uidsize" = X"$longsize"; then
13497                         uidformat='"ld"'
13498                 else
13499                         if $test X"$uidsize" = X"$intsize"; then
13500                                 uidformat='"d"'
13501                         else
13502                                 if $test X"$uidsize" = X"$shortsize"; then
13503                                         uidformat='"hd"'
13504                                 fi
13505                         fi
13506                 fi
13507         fi
13508         ;;
13509 *)      if $test X"$uidsize" = X"$uvsize"; then
13510                 uidformat="$uvuformat"
13511         else
13512                 if $test X"$uidsize" = X"$longsize"; then
13513                         uidformat='"lu"'
13514                 else
13515                         if $test X"$uidsize" = X"$intsize"; then
13516                                 uidformat='"u"'
13517                         else
13518                                 if $test X"$uidsize" = X"$shortsize"; then
13519                                         uidformat='"hu"'
13520                                 fi
13521                         fi
13522                 fi
13523         fi
13524         ;;
13525 esac
13526
13527 : see if dbm.h is available
13528 : see if dbmclose exists
13529 set dbmclose d_dbmclose
13530 eval $inlibc
13531
13532 case "$d_dbmclose" in
13533 $define)
13534         set dbm.h i_dbm
13535         eval $inhdr
13536         case "$i_dbm" in
13537         $define)
13538                 val="$undef"
13539                 set i_rpcsvcdbm
13540                 eval $setvar
13541                 ;;
13542         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13543                 eval $inhdr
13544                 ;;
13545         esac
13546         ;;
13547 *)      echo "We won't be including <dbm.h>"
13548         val="$undef"
13549         set i_dbm
13550         eval $setvar
13551         val="$undef"
13552         set i_rpcsvcdbm
13553         eval $setvar
13554         ;;
13555 esac
13556
13557 : see if this is a sys/file.h system
13558 val=''
13559 set sys/file.h val
13560 eval $inhdr
13561
13562 : do we need to include sys/file.h ?
13563 case "$val" in
13564 "$define")
13565         echo " "
13566         if $h_sysfile; then
13567                 val="$define"
13568                 echo "We'll be including <sys/file.h>." >&4
13569         else
13570                 val="$undef"
13571                 echo "We won't be including <sys/file.h>." >&4
13572         fi
13573         ;;
13574 *)
13575         h_sysfile=false
13576         ;;
13577 esac
13578 set i_sysfile
13579 eval $setvar
13580
13581 : see if fcntl.h is there
13582 val=''
13583 set fcntl.h val
13584 eval $inhdr
13585
13586 : see if we can include fcntl.h
13587 case "$val" in
13588 "$define")
13589         echo " "
13590         if $h_fcntl; then
13591                 val="$define"
13592                 echo "We'll be including <fcntl.h>." >&4
13593         else
13594                 val="$undef"
13595                 if $h_sysfile; then
13596         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13597                 else
13598                         echo "We won't be including <fcntl.h>." >&4
13599                 fi
13600         fi
13601         ;;
13602 *)
13603         h_fcntl=false
13604         val="$undef"
13605         ;;
13606 esac
13607 set i_fcntl
13608 eval $setvar
13609
13610 : see if locale.h is available
13611 set locale.h i_locale
13612 eval $inhdr
13613
13614 : see if mach cthreads are available
13615 if test "X$usethreads" = "X$define"; then
13616         set mach/cthreads.h i_machcthr
13617         eval $inhdr
13618 else
13619         i_machcthr="$undef"
13620 fi
13621
13622
13623
13624 : see if this is a math.h system
13625 set math.h i_math
13626 eval $inhdr
13627
13628 : see if this is a mntent.h system
13629 set mntent.h i_mntent
13630 eval $inhdr
13631
13632 : see if ndbm.h is available
13633 set ndbm.h t_ndbm
13634 eval $inhdr
13635 case "$t_ndbm" in
13636 $define)
13637         : see if dbm_open exists
13638         set dbm_open d_dbm_open
13639         eval $inlibc
13640         case "$d_dbm_open" in
13641         $undef)
13642                 t_ndbm="$undef"
13643                 echo "We won't be including <ndbm.h>"
13644                 ;;
13645         esac
13646         ;;
13647 esac
13648 val="$t_ndbm"
13649 set i_ndbm
13650 eval $setvar
13651
13652 : see if net/errno.h is available
13653 val=''
13654 set net/errno.h val
13655 eval $inhdr
13656
13657 : Unfortunately, it causes problems on some systems.  Arrgh.
13658 case "$val" in
13659 $define)
13660         cat > try.c <<'EOM'
13661 #include <stdio.h>
13662 #include <errno.h>
13663 #include <net/errno.h>
13664 int func()
13665 {
13666         return ENOTSOCK;
13667 }
13668 EOM
13669         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13670                 echo "We'll be including <net/errno.h>." >&4
13671         else
13672                 echo "We won't be including <net/errno.h>." >&4
13673                 val="$undef"
13674         fi
13675         $rm -f try.* try
13676         ;;
13677 esac
13678 set i_neterrno
13679 eval $setvar
13680
13681 : see if netinet/tcp.h is available
13682 set netinet/tcp.h i_netinettcp
13683 eval $inhdr
13684
13685 : see if this is a poll.h system
13686 set poll.h i_poll
13687 eval $inhdr
13688
13689 : get C preprocessor symbols handy
13690 echo " "
13691 $echo $n "Hmm... $c"
13692 echo $al | $tr ' ' $trnl >Cppsym.know
13693 $cat <<EOSS >Cppsym
13694 $startsh
13695 case "\$1" in
13696 -l) list=true
13697         shift
13698         ;;
13699 esac
13700 unknown=''
13701 case "\$list\$#" in
13702 1|2)
13703         for sym do
13704                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13705                         exit 0
13706                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13707                         :
13708                 else
13709                         unknown="\$unknown \$sym"
13710                 fi
13711         done
13712         set X \$unknown
13713         shift
13714         ;;
13715 esac
13716 case \$# in
13717 0) exit 1;;
13718 esac
13719 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13720 #ifdef \1\\
13721 exit 0; _ _ _ _\1\\      \1\\
13722 #endif\\
13723 /' >Cppsym\$\$
13724 echo "exit 1; _ _ _" >>Cppsym\$\$
13725 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13726 case "\$list" in
13727 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13728 *)
13729         sh Cppsym2\$\$
13730         status=\$?
13731         ;;
13732 esac
13733 $rm -f Cppsym\$\$ Cppsym2\$\$
13734 exit \$status
13735 EOSS
13736 chmod +x Cppsym
13737 $eunicefix Cppsym
13738 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13739
13740 : now check the C compiler for additional symbols
13741 postprocess_cc_v=''
13742 case "$osname" in
13743 aix) postprocess_cc_v="|$tr , ' '" ;;
13744 esac
13745 $cat >ccsym <<EOS
13746 $startsh
13747 $cat >tmp.c <<EOF
13748 extern int foo;
13749 EOF
13750 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13751 do
13752         case "\$i" in
13753         -D*) echo "\$i" | $sed 's/^-D//';;
13754         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13755         esac
13756 done
13757 $rm -f try.c
13758 EOS
13759 postprocess_cc_v=''
13760 chmod +x ccsym
13761 $eunicefix ccsym
13762 ./ccsym > ccsym1.raw
13763 if $test -s ccsym1.raw; then
13764        $sort ccsym1.raw | $uniq >ccsym.raw
13765 else
13766        mv ccsym1.raw ccsym.raw
13767 fi
13768
13769 $awk '/\=/ { print $0; next }
13770         { print $0"=1" }' ccsym.raw >ccsym.list
13771 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13772 $comm -13 ccsym.true ccsym.list >ccsym.own
13773 $comm -12 ccsym.true ccsym.list >ccsym.com
13774 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13775 also=''
13776 if $test -z ccsym.raw; then
13777         echo "Your C compiler doesn't seem to define any symbols!" >&4
13778         echo " "
13779         echo "However, your C preprocessor defines the following symbols:"
13780         $cat Cppsym.true
13781         ccsymbols=''
13782         cppsymbols=`$cat Cppsym.true`
13783         cppsymbols=`echo $cppsymbols`
13784         cppccsymbols="$cppsymbols"
13785 else
13786         if $test -s ccsym.com; then
13787                 echo "Your C compiler and pre-processor define these symbols:"
13788                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13789                 also='also '
13790                 symbols='ones'
13791                 cppccsymbols=`$cat ccsym.com`
13792                 cppccsymbols=`echo $cppccsymbols`
13793                 $test "$silent" || sleep 1
13794         fi
13795         if $test -s ccsym.cpp; then
13796                 $test "$also" && echo " "
13797                 echo "Your C pre-processor ${also}defines the following symbols:"
13798                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13799                 also='further '
13800                 cppsymbols=`$cat ccsym.cpp`
13801                 cppsymbols=`echo $cppsymbols`
13802                 $test "$silent" || sleep 1
13803         fi
13804         if $test -s ccsym.own; then
13805                 $test "$also" && echo " "
13806                 echo "Your C compiler ${also}defines the following cpp symbols:"
13807                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13808                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13809                 ccsymbols=`$cat ccsym.own`
13810                 ccsymbols=`echo $ccsymbols`
13811                 $test "$silent" || sleep 1
13812         fi
13813 fi
13814 $rm -f ccsym*
13815
13816 : see if this is a termio system
13817 val="$undef"
13818 val2="$undef"
13819 val3="$undef"
13820 if $test `./findhdr termios.h`; then
13821         set tcsetattr i_termios
13822         eval $inlibc
13823         val3="$i_termios"
13824 fi
13825 echo " "
13826 case "$val3" in
13827 "$define") echo "You have POSIX termios.h... good!" >&4;;
13828 *) if ./Cppsym pyr; then
13829                 case "`/bin/universe`" in
13830                 ucb) if $test `./findhdr sgtty.h`; then
13831                                 val2="$define"
13832                                 echo "<sgtty.h> found." >&4
13833                         else
13834                                 echo "System is pyramid with BSD universe."
13835                                 echo "<sgtty.h> not found--you could have problems." >&4
13836                         fi;;
13837                 *) if $test `./findhdr termio.h`; then
13838                                 val="$define"
13839                                 echo "<termio.h> found." >&4
13840                         else
13841                                 echo "System is pyramid with USG universe."
13842                                 echo "<termio.h> not found--you could have problems." >&4
13843                         fi;;
13844                 esac
13845         elif ./usg; then
13846                 if $test `./findhdr termio.h`; then
13847                         echo "<termio.h> found." >&4
13848                         val="$define"
13849                 elif $test `./findhdr sgtty.h`; then
13850                         echo "<sgtty.h> found." >&4
13851                         val2="$define"
13852                 else
13853 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13854                 fi
13855         else
13856                 if $test `./findhdr sgtty.h`; then
13857                         echo "<sgtty.h> found." >&4
13858                         val2="$define"
13859                 elif $test `./findhdr termio.h`; then
13860                         echo "<termio.h> found." >&4
13861                         val="$define"
13862                 else
13863 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13864                 fi
13865         fi;;
13866 esac
13867 set i_termio; eval $setvar
13868 val=$val2; set i_sgtty; eval $setvar
13869 val=$val3; set i_termios; eval $setvar
13870
13871 : see if this is a shadow.h system
13872 set shadow.h i_shadow
13873 eval $inhdr
13874
13875 : see if this is a socks.h system
13876 set socks.h i_socks
13877 eval $inhdr
13878
13879 : see if stdarg is available
13880 echo " "
13881 if $test `./findhdr stdarg.h`; then
13882         echo "<stdarg.h> found." >&4
13883         valstd="$define"
13884 else
13885         echo "<stdarg.h> NOT found." >&4
13886         valstd="$undef"
13887 fi
13888
13889 : see if varags is available
13890 echo " "
13891 if $test `./findhdr varargs.h`; then
13892         echo "<varargs.h> found." >&4
13893 else
13894         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13895 fi
13896
13897 : set up the varargs testing programs
13898 $cat > varargs.c <<EOP
13899 #ifdef I_STDARG
13900 #include <stdarg.h>
13901 #endif
13902 #ifdef I_VARARGS
13903 #include <varargs.h>
13904 #endif
13905
13906 #ifdef I_STDARG
13907 int f(char *p, ...)
13908 #else
13909 int f(va_alist)
13910 va_dcl
13911 #endif
13912 {
13913         va_list ap;
13914 #ifndef I_STDARG
13915         char *p;
13916 #endif
13917 #ifdef I_STDARG
13918         va_start(ap,p);
13919 #else
13920         va_start(ap);
13921         p = va_arg(ap, char *);
13922 #endif
13923         va_end(ap);
13924 }
13925 EOP
13926 $cat > varargs <<EOP
13927 $startsh
13928 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13929         echo "true"
13930 else
13931         echo "false"
13932 fi
13933 $rm -f varargs$_o
13934 EOP
13935 chmod +x varargs
13936
13937 : now check which varargs header should be included
13938 echo " "
13939 i_varhdr=''
13940 case "$valstd" in
13941 "$define")
13942         if `./varargs I_STDARG`; then
13943                 val='stdarg.h'
13944         elif `./varargs I_VARARGS`; then
13945                 val='varargs.h'
13946         fi
13947         ;;
13948 *)
13949         if `./varargs I_VARARGS`; then
13950                 val='varargs.h'
13951         fi
13952         ;;
13953 esac
13954 case "$val" in
13955 '')
13956 echo "I could not find the definition for va_dcl... You have problems..." >&4
13957         val="$undef"; set i_stdarg; eval $setvar
13958         val="$undef"; set i_varargs; eval $setvar
13959         ;;
13960 *) 
13961         set i_varhdr
13962         eval $setvar
13963         case "$i_varhdr" in
13964         stdarg.h)
13965                 val="$define"; set i_stdarg; eval $setvar
13966                 val="$undef"; set i_varargs; eval $setvar
13967                 ;;
13968         varargs.h)
13969                 val="$undef"; set i_stdarg; eval $setvar
13970                 val="$define"; set i_varargs; eval $setvar
13971                 ;;
13972         esac
13973         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13974 esac
13975 $rm -f varargs*
13976
13977 : see if stddef is available
13978 set stddef.h i_stddef
13979 eval $inhdr
13980
13981 : see if sys/access.h is available
13982 set sys/access.h i_sysaccess
13983 eval $inhdr
13984
13985 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13986 set sys/filio.h i_sysfilio
13987 eval $inhdr
13988 echo " "
13989 if $test `./findhdr sys/ioctl.h`; then
13990         val="$define"
13991         echo '<sys/ioctl.h> found.' >&4
13992 else
13993         val="$undef"
13994         if $test $i_sysfilio = "$define"; then
13995             echo '<sys/ioctl.h> NOT found.' >&4
13996         else
13997                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13998                 $test $i_termio = "$define" && xxx="termio.h"
13999                 $test $i_termios = "$define" && xxx="termios.h"
14000 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14001         fi
14002 fi
14003 set i_sysioctl
14004 eval $setvar
14005
14006 : see if sys/resource.h has to be included
14007 set sys/resource.h i_sysresrc
14008 eval $inhdr
14009
14010 : see if sys/security.h is available
14011 set sys/security.h i_syssecrt
14012 eval $inhdr
14013
14014 : see if this is a sys/statvfs.h system
14015 set sys/statvfs.h i_sysstatvfs
14016 eval $inhdr
14017
14018 : see if this is a sys/uio.h system
14019 set sys/uio.h i_sysuio
14020 eval $inhdr
14021
14022 : see if this is a sys/un.h system
14023 set sys/un.h i_sysun
14024 eval $inhdr
14025
14026 : see if this is a syswait system
14027 set sys/wait.h i_syswait
14028 eval $inhdr
14029
14030 : see if this is a ustat.h system
14031 set ustat.h i_ustat
14032 eval $inhdr
14033
14034 : see if this is an utime system
14035 set utime.h i_utime
14036 eval $inhdr
14037
14038 : see if this is a values.h system
14039 set values.h i_values
14040 eval $inhdr
14041
14042 : see if this is a vfork system
14043 case "$d_vfork" in
14044 "$define")
14045         set vfork.h i_vfork
14046         eval $inhdr
14047         ;;
14048 *)
14049         i_vfork="$undef"
14050         ;;
14051 esac
14052
14053 : see if gdbm.h is available
14054 set gdbm.h t_gdbm
14055 eval $inhdr
14056 case "$t_gdbm" in
14057 $define)
14058         : see if gdbm_open exists
14059         set gdbm_open d_gdbm_open
14060         eval $inlibc
14061         case "$d_gdbm_open" in
14062         $undef)
14063                 t_gdbm="$undef"
14064                 echo "We won't be including <gdbm.h>"
14065                 ;;
14066         esac
14067         ;;
14068 esac
14069 val="$t_gdbm"
14070 set i_gdbm
14071 eval $setvar
14072
14073 echo " "
14074 echo "Looking for extensions..." >&4
14075 : If we are using the old config.sh, known_extensions may contain
14076 : old or inaccurate or duplicate values.
14077 known_extensions=''
14078 nonxs_extensions=''
14079 : We do not use find because it might not be available.
14080 : We do not just use MANIFEST because the user may have dropped
14081 : some additional extensions into the source tree and expect them
14082 : to be built.
14083
14084 : Function to recursively find available extensions, ignoring DynaLoader
14085 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14086 find_extensions='
14087     for xxx in *; do
14088        case "$xxx" in
14089            DynaLoader|dynaload) ;;
14090            *)
14091            if $test -f $xxx/$xxx.xs; then
14092                known_extensions="$known_extensions $1$xxx";
14093            elif $test -f $xxx/Makefile.PL; then
14094                nonxs_extensions="$nonxs_extensions $1$xxx";
14095            else
14096                if $test -d $xxx -a $# -lt 10; then
14097                    set $1$xxx/ $*;
14098                    cd $xxx;
14099                    eval $find_extensions;
14100                    cd ..;
14101                    shift;
14102                fi;
14103            fi
14104            ;;
14105        esac;
14106     done'
14107 tdir=`pwd`
14108 cd $rsrc/ext
14109 set X
14110 shift
14111 eval $find_extensions
14112 set X $nonxs_extensions
14113 shift
14114 nonxs_extensions="$*"
14115 set X $known_extensions
14116 shift
14117 known_extensions="$*"
14118 cd $tdir
14119
14120 : Now see which are supported on this system.
14121 avail_ext=''
14122 for xxx in $known_extensions ; do
14123         case "$xxx" in
14124         DB_File|db_file)
14125                 case "$i_db" in
14126                 $define) avail_ext="$avail_ext $xxx" ;;
14127                 esac
14128                 ;;
14129         GDBM_File|gdbm_fil)
14130                 case "$i_gdbm" in 
14131                 $define) avail_ext="$avail_ext $xxx" ;;
14132                 esac
14133                 ;;
14134         NDBM_File|ndbm_fil)
14135                 case "$i_ndbm" in
14136                 $define) avail_ext="$avail_ext $xxx" ;;
14137                 esac
14138                 ;;
14139         ODBM_File|odbm_fil) 
14140                 case "${i_dbm}${i_rpcsvcdbm}" in
14141                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14142                 esac
14143                 ;;
14144         POSIX|posix)
14145                 case "$useposix" in
14146                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14147                 esac
14148                 ;;
14149         Opcode|opcode)
14150                 case "$useopcode" in
14151                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14152                 esac
14153                 ;;
14154         Socket|socket)
14155                 case "$d_socket" in 
14156                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14157                 esac
14158                 ;;
14159         Thread|thread)
14160                 case "$usethreads" in 
14161                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14162                 esac
14163                 ;;
14164         IPC/SysV|ipc/sysv)
14165                 : XXX Do we need a useipcsysv variable here
14166                 case "${d_msg}${d_sem}${d_shm}" in 
14167                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14168                 esac
14169                 ;;
14170         *)      avail_ext="$avail_ext $xxx"
14171                 ;;
14172         esac
14173 done
14174
14175 set X $avail_ext
14176 shift
14177 avail_ext="$*"
14178
14179 : Now see which nonxs extensions are supported on this system.
14180 : For now assume all are.
14181 nonxs_ext=''
14182 for xxx in $nonxs_extensions ; do
14183         case "$xxx" in
14184         *)      nonxs_ext="$nonxs_ext $xxx"
14185                 ;;
14186         esac
14187 done
14188
14189 set X $nonxs_ext
14190 shift
14191 nonxs_ext="$*"
14192
14193 case $usedl in
14194 $define)
14195         $cat <<EOM
14196 A number of extensions are supplied with $package.  You may choose to
14197 compile these extensions for dynamic loading (the default), compile
14198 them into the $package executable (static loading), or not include
14199 them at all.  Answer "none" to include no extensions.
14200 Note that DynaLoader is always built and need not be mentioned here.
14201
14202 EOM
14203         case "$dynamic_ext" in
14204         '') dflt="$avail_ext" ;;
14205         *)      dflt="$dynamic_ext"
14206                 # Perhaps we are reusing an old out-of-date config.sh.
14207                 case "$hint" in
14208                 previous)
14209                         if test X"$dynamic_ext" != X"$avail_ext"; then
14210                                 $cat <<EOM
14211 NOTICE:  Your previous config.sh list may be incorrect. 
14212 The extensions now available to you are 
14213         ${avail_ext}
14214 but the default list from your previous config.sh is
14215         ${dynamic_ext} 
14216
14217 EOM
14218                         fi
14219                         ;;
14220                 esac
14221                 ;;
14222         esac
14223         case "$dflt" in
14224         '')     dflt=none;;
14225         esac
14226         rp="What extensions do you wish to load dynamically?"
14227         . ./myread
14228         case "$ans" in
14229         none) dynamic_ext=' ' ;;
14230         *) dynamic_ext="$ans" ;;
14231         esac
14232
14233         case "$static_ext" in
14234         '')
14235                 : Exclude those already listed in dynamic linking
14236                 dflt=''
14237                 for xxx in $avail_ext; do
14238                         case " $dynamic_ext " in
14239                         *" $xxx "*) ;;
14240                         *) dflt="$dflt $xxx" ;;
14241                         esac
14242                 done
14243                 set X $dflt
14244                 shift
14245                 dflt="$*"
14246                 ;;
14247         *)  dflt="$static_ext" 
14248                 ;;
14249         esac
14250
14251         case "$dflt" in
14252         '')     dflt=none;;
14253         esac
14254         rp="What extensions do you wish to load statically?"
14255         . ./myread
14256         case "$ans" in
14257         none) static_ext=' ' ;;
14258         *) static_ext="$ans" ;;
14259         esac
14260         ;;
14261 *)
14262         $cat <<EOM
14263 A number of extensions are supplied with $package.  Answer "none" 
14264 to include no extensions. 
14265 Note that DynaLoader is always built and need not be mentioned here.
14266
14267 EOM
14268         case "$static_ext" in
14269         '') dflt="$avail_ext" ;;
14270         *)      dflt="$static_ext"
14271                 # Perhaps we are reusing an old out-of-date config.sh.
14272                 case "$hint" in
14273                 previous)
14274                         if test X"$static_ext" != X"$avail_ext"; then
14275                                 $cat <<EOM
14276 NOTICE:  Your previous config.sh list may be incorrect. 
14277 The extensions now available to you are 
14278         ${avail_ext}
14279 but the default list from your previous config.sh is
14280         ${static_ext} 
14281
14282 EOM
14283                         fi
14284                         ;;
14285                 esac
14286                 ;;
14287         esac
14288         : Exclude those that are not xs extensions
14289         case "$dflt" in
14290         '')     dflt=none;;
14291         esac
14292         rp="What extensions do you wish to include?"
14293         . ./myread
14294         case "$ans" in
14295         none) static_ext=' ' ;;
14296         *) static_ext="$ans" ;;
14297         esac
14298         ;;
14299 esac
14300
14301 set X $dynamic_ext $static_ext $nonxs_ext
14302 shift
14303 extensions="$*"
14304
14305 : Remove build directory name from cppstdin so it can be used from
14306 : either the present location or the final installed location.
14307 echo " "
14308 : Get out of the UU directory to get correct path name.
14309 cd ..
14310 case "$cppstdin" in
14311 `pwd`/cppstdin)
14312         echo "Stripping down cppstdin path name"
14313         cppstdin=cppstdin
14314         ;;
14315 esac
14316 cd UU
14317
14318 : end of configuration questions
14319 echo " "
14320 echo "End of configuration questions."
14321 echo " "
14322
14323 : back to where it started
14324 if test -d ../UU; then
14325         cd ..
14326 fi
14327
14328 : configuration may be patched via a 'config.over' file
14329 if $test -f config.over; then
14330         echo " "
14331         dflt=y
14332         rp='I see a config.over file.  Do you wish to load it?'
14333         . UU/myread
14334         case "$ans" in
14335         n*) echo "OK, I'll ignore it.";;
14336         *)      . ./config.over
14337                 echo "Configuration override changes have been loaded."
14338                 ;;
14339         esac
14340 fi
14341
14342 : in case they want portability, strip down executable paths
14343 case "$d_portable" in
14344 "$define")
14345         echo " "
14346         echo "Stripping down executable paths..." >&4
14347         for file in $loclist $trylist; do
14348                 eval temp=\$$file
14349                 eval $file=`basename $temp`
14350         done
14351         ;;
14352 esac
14353
14354 : create config.sh file
14355 echo " "
14356 echo "Creating config.sh..." >&4
14357 $spitshell <<EOT >config.sh
14358 $startsh
14359 #
14360 # This file was produced by running the Configure script. It holds all the
14361 # definitions figured out by Configure. Should you modify one of these values,
14362 # do not forget to propagate your changes by running "Configure -der". You may
14363 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14364 #
14365
14366 # Package name      : $package
14367 # Source directory  : $src
14368 # Configuration time: $cf_time
14369 # Configured by     : $cf_by
14370 # Target system     : $myuname
14371
14372 Author='$Author'
14373 Date='$Date'
14374 Header='$Header'
14375 Id='$Id'
14376 Locker='$Locker'
14377 Log='$Log'
14378 Mcc='$Mcc'
14379 RCSfile='$RCSfile'
14380 Revision='$Revision'
14381 Source='$Source'
14382 State='$State'
14383 _a='$_a'
14384 _exe='$_exe'
14385 _o='$_o'
14386 afs='$afs'
14387 alignbytes='$alignbytes'
14388 ansi2knr='$ansi2knr'
14389 aphostname='$aphostname'
14390 api_revision='$api_revision'
14391 api_subversion='$api_subversion'
14392 api_version='$api_version'
14393 api_versionstring='$api_versionstring'
14394 ar='$ar'
14395 archlib='$archlib'
14396 archlibexp='$archlibexp'
14397 archname64='$archname64'
14398 archname='$archname'
14399 archobjs='$archobjs'
14400 awk='$awk'
14401 baserev='$baserev'
14402 bash='$bash'
14403 bin='$bin'
14404 bincompat5005='$bincompat5005'
14405 binexp='$binexp'
14406 bison='$bison'
14407 byacc='$byacc'
14408 byteorder='$byteorder'
14409 c='$c'
14410 castflags='$castflags'
14411 cat='$cat'
14412 cc='$cc'
14413 cccdlflags='$cccdlflags'
14414 ccdlflags='$ccdlflags'
14415 ccflags='$ccflags'
14416 ccsymbols='$ccsymbols'
14417 cf_by='$cf_by'
14418 cf_email='$cf_email'
14419 cf_time='$cf_time'
14420 charsize='$charsize'
14421 chgrp='$chgrp'
14422 chmod='$chmod'
14423 chown='$chown'
14424 clocktype='$clocktype'
14425 comm='$comm'
14426 compress='$compress'
14427 contains='$contains'
14428 cp='$cp'
14429 cpio='$cpio'
14430 cpp='$cpp'
14431 cpp_stuff='$cpp_stuff'
14432 cppccsymbols='$cppccsymbols'
14433 cppflags='$cppflags'
14434 cpplast='$cpplast'
14435 cppminus='$cppminus'
14436 cpprun='$cpprun'
14437 cppstdin='$cppstdin'
14438 cppsymbols='$cppsymbols'
14439 crosscompile='$crosscompile'
14440 cryptlib='$cryptlib'
14441 csh='$csh'
14442 d_Gconvert='$d_Gconvert'
14443 d_PRIEldbl='$d_PRIEldbl'
14444 d_PRIFldbl='$d_PRIFldbl'
14445 d_PRIGldbl='$d_PRIGldbl'
14446 d_PRIX64='$d_PRIX64'
14447 d_PRId64='$d_PRId64'
14448 d_PRIeldbl='$d_PRIeldbl'
14449 d_PRIfldbl='$d_PRIfldbl'
14450 d_PRIgldbl='$d_PRIgldbl'
14451 d_PRIi64='$d_PRIi64'
14452 d_PRIo64='$d_PRIo64'
14453 d_PRIu64='$d_PRIu64'
14454 d_PRIx64='$d_PRIx64'
14455 d_access='$d_access'
14456 d_accessx='$d_accessx'
14457 d_alarm='$d_alarm'
14458 d_archlib='$d_archlib'
14459 d_atolf='$d_atolf'
14460 d_atoll='$d_atoll'
14461 d_attribut='$d_attribut'
14462 d_bcmp='$d_bcmp'
14463 d_bcopy='$d_bcopy'
14464 d_bincompat5005='$d_bincompat5005'
14465 d_bsd='$d_bsd'
14466 d_bsdgetpgrp='$d_bsdgetpgrp'
14467 d_bsdsetpgrp='$d_bsdsetpgrp'
14468 d_bzero='$d_bzero'
14469 d_casti32='$d_casti32'
14470 d_castneg='$d_castneg'
14471 d_charvspr='$d_charvspr'
14472 d_chown='$d_chown'
14473 d_chroot='$d_chroot'
14474 d_chsize='$d_chsize'
14475 d_closedir='$d_closedir'
14476 d_const='$d_const'
14477 d_crypt='$d_crypt'
14478 d_csh='$d_csh'
14479 d_cuserid='$d_cuserid'
14480 d_dbl_dig='$d_dbl_dig'
14481 d_difftime='$d_difftime'
14482 d_dirnamlen='$d_dirnamlen'
14483 d_dlerror='$d_dlerror'
14484 d_dlopen='$d_dlopen'
14485 d_dlsymun='$d_dlsymun'
14486 d_dosuid='$d_dosuid'
14487 d_drand48proto='$d_drand48proto'
14488 d_dup2='$d_dup2'
14489 d_eaccess='$d_eaccess'
14490 d_endgrent='$d_endgrent'
14491 d_endhent='$d_endhent'
14492 d_endnent='$d_endnent'
14493 d_endpent='$d_endpent'
14494 d_endpwent='$d_endpwent'
14495 d_endsent='$d_endsent'
14496 d_endspent='$d_endspent'
14497 d_eofnblk='$d_eofnblk'
14498 d_eunice='$d_eunice'
14499 d_fchmod='$d_fchmod'
14500 d_fchown='$d_fchown'
14501 d_fcntl='$d_fcntl'
14502 d_fd_macros='$d_fd_macros'
14503 d_fd_set='$d_fd_set'
14504 d_fds_bits='$d_fds_bits'
14505 d_fgetpos='$d_fgetpos'
14506 d_flexfnam='$d_flexfnam'
14507 d_flock='$d_flock'
14508 d_fork='$d_fork'
14509 d_fpathconf='$d_fpathconf'
14510 d_fpos64_t='$d_fpos64_t'
14511 d_fs_data_s='$d_fs_data_s'
14512 d_fseeko='$d_fseeko'
14513 d_fsetpos='$d_fsetpos'
14514 d_fstatfs='$d_fstatfs'
14515 d_fstatvfs='$d_fstatvfs'
14516 d_ftello='$d_ftello'
14517 d_ftime='$d_ftime'
14518 d_getgrent='$d_getgrent'
14519 d_getgrps='$d_getgrps'
14520 d_gethbyaddr='$d_gethbyaddr'
14521 d_gethbyname='$d_gethbyname'
14522 d_gethent='$d_gethent'
14523 d_gethname='$d_gethname'
14524 d_gethostprotos='$d_gethostprotos'
14525 d_getlogin='$d_getlogin'
14526 d_getmnt='$d_getmnt'
14527 d_getmntent='$d_getmntent'
14528 d_getnbyaddr='$d_getnbyaddr'
14529 d_getnbyname='$d_getnbyname'
14530 d_getnent='$d_getnent'
14531 d_getnetprotos='$d_getnetprotos'
14532 d_getpbyname='$d_getpbyname'
14533 d_getpbynumber='$d_getpbynumber'
14534 d_getpent='$d_getpent'
14535 d_getpgid='$d_getpgid'
14536 d_getpgrp2='$d_getpgrp2'
14537 d_getpgrp='$d_getpgrp'
14538 d_getppid='$d_getppid'
14539 d_getprior='$d_getprior'
14540 d_getprotoprotos='$d_getprotoprotos'
14541 d_getpwent='$d_getpwent'
14542 d_getsbyname='$d_getsbyname'
14543 d_getsbyport='$d_getsbyport'
14544 d_getsent='$d_getsent'
14545 d_getservprotos='$d_getservprotos'
14546 d_getspent='$d_getspent'
14547 d_getspnam='$d_getspnam'
14548 d_gettimeod='$d_gettimeod'
14549 d_gnulibc='$d_gnulibc'
14550 d_grpasswd='$d_grpasswd'
14551 d_hasmntopt='$d_hasmntopt'
14552 d_htonl='$d_htonl'
14553 d_index='$d_index'
14554 d_inetaton='$d_inetaton'
14555 d_int64t='$d_int64t'
14556 d_isascii='$d_isascii'
14557 d_killpg='$d_killpg'
14558 d_lchown='$d_lchown'
14559 d_ldbl_dig='$d_ldbl_dig'
14560 d_link='$d_link'
14561 d_locconv='$d_locconv'
14562 d_lockf='$d_lockf'
14563 d_longdbl='$d_longdbl'
14564 d_longlong='$d_longlong'
14565 d_lstat='$d_lstat'
14566 d_mblen='$d_mblen'
14567 d_mbstowcs='$d_mbstowcs'
14568 d_mbtowc='$d_mbtowc'
14569 d_memchr='$d_memchr'
14570 d_memcmp='$d_memcmp'
14571 d_memcpy='$d_memcpy'
14572 d_memmove='$d_memmove'
14573 d_memset='$d_memset'
14574 d_mkdir='$d_mkdir'
14575 d_mkfifo='$d_mkfifo'
14576 d_mktime='$d_mktime'
14577 d_msg='$d_msg'
14578 d_msg_ctrunc='$d_msg_ctrunc'
14579 d_msg_dontroute='$d_msg_dontroute'
14580 d_msg_oob='$d_msg_oob'
14581 d_msg_peek='$d_msg_peek'
14582 d_msg_proxy='$d_msg_proxy'
14583 d_msgctl='$d_msgctl'
14584 d_msgget='$d_msgget'
14585 d_msgrcv='$d_msgrcv'
14586 d_msgsnd='$d_msgsnd'
14587 d_mymalloc='$d_mymalloc'
14588 d_nice='$d_nice'
14589 d_nvpresuv='$d_nvpresuv'
14590 d_off64_t='$d_off64_t'
14591 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14592 d_oldpthreads='$d_oldpthreads'
14593 d_oldsock='$d_oldsock'
14594 d_open3='$d_open3'
14595 d_pathconf='$d_pathconf'
14596 d_pause='$d_pause'
14597 d_phostname='$d_phostname'
14598 d_pipe='$d_pipe'
14599 d_poll='$d_poll'
14600 d_portable='$d_portable'
14601 d_pthread_yield='$d_pthread_yield'
14602 d_pwage='$d_pwage'
14603 d_pwchange='$d_pwchange'
14604 d_pwclass='$d_pwclass'
14605 d_pwcomment='$d_pwcomment'
14606 d_pwexpire='$d_pwexpire'
14607 d_pwgecos='$d_pwgecos'
14608 d_pwpasswd='$d_pwpasswd'
14609 d_pwquota='$d_pwquota'
14610 d_quad='$d_quad'
14611 d_readdir='$d_readdir'
14612 d_readlink='$d_readlink'
14613 d_rename='$d_rename'
14614 d_rewinddir='$d_rewinddir'
14615 d_rmdir='$d_rmdir'
14616 d_safebcpy='$d_safebcpy'
14617 d_safemcpy='$d_safemcpy'
14618 d_sanemcmp='$d_sanemcmp'
14619 d_sched_yield='$d_sched_yield'
14620 d_scm_rights='$d_scm_rights'
14621 d_seekdir='$d_seekdir'
14622 d_select='$d_select'
14623 d_sem='$d_sem'
14624 d_semctl='$d_semctl'
14625 d_semctl_semid_ds='$d_semctl_semid_ds'
14626 d_semctl_semun='$d_semctl_semun'
14627 d_semget='$d_semget'
14628 d_semop='$d_semop'
14629 d_setegid='$d_setegid'
14630 d_seteuid='$d_seteuid'
14631 d_setgrent='$d_setgrent'
14632 d_setgrps='$d_setgrps'
14633 d_sethent='$d_sethent'
14634 d_setlinebuf='$d_setlinebuf'
14635 d_setlocale='$d_setlocale'
14636 d_setnent='$d_setnent'
14637 d_setpent='$d_setpent'
14638 d_setpgid='$d_setpgid'
14639 d_setpgrp2='$d_setpgrp2'
14640 d_setpgrp='$d_setpgrp'
14641 d_setprior='$d_setprior'
14642 d_setpwent='$d_setpwent'
14643 d_setregid='$d_setregid'
14644 d_setresgid='$d_setresgid'
14645 d_setresuid='$d_setresuid'
14646 d_setreuid='$d_setreuid'
14647 d_setrgid='$d_setrgid'
14648 d_setruid='$d_setruid'
14649 d_setsent='$d_setsent'
14650 d_setsid='$d_setsid'
14651 d_setspent='$d_setspent'
14652 d_setvbuf='$d_setvbuf'
14653 d_sfio='$d_sfio'
14654 d_shm='$d_shm'
14655 d_shmat='$d_shmat'
14656 d_shmatprototype='$d_shmatprototype'
14657 d_shmctl='$d_shmctl'
14658 d_shmdt='$d_shmdt'
14659 d_shmget='$d_shmget'
14660 d_sigaction='$d_sigaction'
14661 d_sigsetjmp='$d_sigsetjmp'
14662 d_socket='$d_socket'
14663 d_sockpair='$d_sockpair'
14664 d_sqrtl='$d_sqrtl'
14665 d_statblks='$d_statblks'
14666 d_statfs_f_flags='$d_statfs_f_flags'
14667 d_statfs_s='$d_statfs_s'
14668 d_statvfs='$d_statvfs'
14669 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14670 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14671 d_stdio_stream_array='$d_stdio_stream_array'
14672 d_stdiobase='$d_stdiobase'
14673 d_stdstdio='$d_stdstdio'
14674 d_strchr='$d_strchr'
14675 d_strcoll='$d_strcoll'
14676 d_strctcpy='$d_strctcpy'
14677 d_strerrm='$d_strerrm'
14678 d_strerror='$d_strerror'
14679 d_strtod='$d_strtod'
14680 d_strtol='$d_strtol'
14681 d_strtold='$d_strtold'
14682 d_strtoll='$d_strtoll'
14683 d_strtoul='$d_strtoul'
14684 d_strtoull='$d_strtoull'
14685 d_strtouq='$d_strtouq'
14686 d_strxfrm='$d_strxfrm'
14687 d_suidsafe='$d_suidsafe'
14688 d_symlink='$d_symlink'
14689 d_syscall='$d_syscall'
14690 d_sysconf='$d_sysconf'
14691 d_sysernlst='$d_sysernlst'
14692 d_syserrlst='$d_syserrlst'
14693 d_system='$d_system'
14694 d_tcgetpgrp='$d_tcgetpgrp'
14695 d_tcsetpgrp='$d_tcsetpgrp'
14696 d_telldir='$d_telldir'
14697 d_telldirproto='$d_telldirproto'
14698 d_time='$d_time'
14699 d_times='$d_times'
14700 d_truncate='$d_truncate'
14701 d_tzname='$d_tzname'
14702 d_umask='$d_umask'
14703 d_uname='$d_uname'
14704 d_union_semun='$d_union_semun'
14705 d_ustat='$d_ustat'
14706 d_vendorbin='$d_vendorbin'
14707 d_vendorlib='$d_vendorlib'
14708 d_vfork='$d_vfork'
14709 d_void_closedir='$d_void_closedir'
14710 d_voidsig='$d_voidsig'
14711 d_voidtty='$d_voidtty'
14712 d_volatile='$d_volatile'
14713 d_vprintf='$d_vprintf'
14714 d_wait4='$d_wait4'
14715 d_waitpid='$d_waitpid'
14716 d_wcstombs='$d_wcstombs'
14717 d_wctomb='$d_wctomb'
14718 d_xenix='$d_xenix'
14719 date='$date'
14720 db_hashtype='$db_hashtype'
14721 db_prefixtype='$db_prefixtype'
14722 defvoidused='$defvoidused'
14723 direntrytype='$direntrytype'
14724 dlext='$dlext'
14725 dlsrc='$dlsrc'
14726 doublesize='$doublesize'
14727 drand01='$drand01'
14728 dynamic_ext='$dynamic_ext'
14729 eagain='$eagain'
14730 ebcdic='$ebcdic'
14731 echo='$echo'
14732 egrep='$egrep'
14733 emacs='$emacs'
14734 eunicefix='$eunicefix'
14735 exe_ext='$exe_ext'
14736 expr='$expr'
14737 extensions='$extensions'
14738 fflushNULL='$fflushNULL'
14739 fflushall='$fflushall'
14740 find='$find'
14741 firstmakefile='$firstmakefile'
14742 flex='$flex'
14743 fpossize='$fpossize'
14744 fpostype='$fpostype'
14745 freetype='$freetype'
14746 full_ar='$full_ar'
14747 full_csh='$full_csh'
14748 full_sed='$full_sed'
14749 gccversion='$gccversion'
14750 gidformat='$gidformat'
14751 gidsign='$gidsign'
14752 gidsize='$gidsize'
14753 gidtype='$gidtype'
14754 glibpth='$glibpth'
14755 grep='$grep'
14756 groupcat='$groupcat'
14757 groupstype='$groupstype'
14758 gzip='$gzip'
14759 h_fcntl='$h_fcntl'
14760 h_sysfile='$h_sysfile'
14761 hint='$hint'
14762 hostcat='$hostcat'
14763 huge='$huge'
14764 i16size='$i16size'
14765 i16type='$i16type'
14766 i32size='$i32size'
14767 i32type='$i32type'
14768 i64size='$i64size'
14769 i64type='$i64type'
14770 i8size='$i8size'
14771 i8type='$i8type'
14772 i_arpainet='$i_arpainet'
14773 i_bsdioctl='$i_bsdioctl'
14774 i_db='$i_db'
14775 i_dbm='$i_dbm'
14776 i_dirent='$i_dirent'
14777 i_dld='$i_dld'
14778 i_dlfcn='$i_dlfcn'
14779 i_fcntl='$i_fcntl'
14780 i_float='$i_float'
14781 i_gdbm='$i_gdbm'
14782 i_grp='$i_grp'
14783 i_inttypes='$i_inttypes'
14784 i_limits='$i_limits'
14785 i_locale='$i_locale'
14786 i_machcthr='$i_machcthr'
14787 i_malloc='$i_malloc'
14788 i_math='$i_math'
14789 i_memory='$i_memory'
14790 i_mntent='$i_mntent'
14791 i_ndbm='$i_ndbm'
14792 i_netdb='$i_netdb'
14793 i_neterrno='$i_neterrno'
14794 i_netinettcp='$i_netinettcp'
14795 i_niin='$i_niin'
14796 i_poll='$i_poll'
14797 i_pthread='$i_pthread'
14798 i_pwd='$i_pwd'
14799 i_rpcsvcdbm='$i_rpcsvcdbm'
14800 i_sfio='$i_sfio'
14801 i_sgtty='$i_sgtty'
14802 i_shadow='$i_shadow'
14803 i_socks='$i_socks'
14804 i_stdarg='$i_stdarg'
14805 i_stddef='$i_stddef'
14806 i_stdlib='$i_stdlib'
14807 i_string='$i_string'
14808 i_sysaccess='$i_sysaccess'
14809 i_sysdir='$i_sysdir'
14810 i_sysfile='$i_sysfile'
14811 i_sysfilio='$i_sysfilio'
14812 i_sysin='$i_sysin'
14813 i_sysioctl='$i_sysioctl'
14814 i_sysmount='$i_sysmount'
14815 i_sysndir='$i_sysndir'
14816 i_sysparam='$i_sysparam'
14817 i_sysresrc='$i_sysresrc'
14818 i_syssecrt='$i_syssecrt'
14819 i_sysselct='$i_sysselct'
14820 i_syssockio='$i_syssockio'
14821 i_sysstat='$i_sysstat'
14822 i_sysstatfs='$i_sysstatfs'
14823 i_sysstatvfs='$i_sysstatvfs'
14824 i_systime='$i_systime'
14825 i_systimek='$i_systimek'
14826 i_systimes='$i_systimes'
14827 i_systypes='$i_systypes'
14828 i_sysuio='$i_sysuio'
14829 i_sysun='$i_sysun'
14830 i_sysvfs='$i_sysvfs'
14831 i_syswait='$i_syswait'
14832 i_termio='$i_termio'
14833 i_termios='$i_termios'
14834 i_time='$i_time'
14835 i_unistd='$i_unistd'
14836 i_ustat='$i_ustat'
14837 i_utime='$i_utime'
14838 i_values='$i_values'
14839 i_varargs='$i_varargs'
14840 i_varhdr='$i_varhdr'
14841 i_vfork='$i_vfork'
14842 ignore_versioned_solibs='$ignore_versioned_solibs'
14843 inc_version_list='$inc_version_list'
14844 incpath='$incpath'
14845 inews='$inews'
14846 installarchlib='$installarchlib'
14847 installbin='$installbin'
14848 installman1dir='$installman1dir'
14849 installman3dir='$installman3dir'
14850 installprefix='$installprefix'
14851 installprefixexp='$installprefixexp'
14852 installprivlib='$installprivlib'
14853 installscript='$installscript'
14854 installsitearch='$installsitearch'
14855 installsitebin='$installsitebin'
14856 installsitelib='$installsitelib'
14857 installstyle='$installstyle'
14858 installusrbinperl='$installusrbinperl'
14859 installvendorbin='$installvendorbin'
14860 installvendorlib='$installvendorlib'
14861 intsize='$intsize'
14862 ivdformat='$ivdformat'
14863 ivsize='$ivsize'
14864 ivtype='$ivtype'
14865 known_extensions='$known_extensions'
14866 ksh='$ksh'
14867 large='$large'
14868 ld='$ld'
14869 lddlflags='$lddlflags'
14870 ldflags='$ldflags'
14871 ldlibpthname='$ldlibpthname'
14872 less='$less'
14873 lib_ext='$lib_ext'
14874 libc='$libc'
14875 libperl='$libperl'
14876 libpth='$libpth'
14877 libs='$libs'
14878 libswanted='$libswanted'
14879 line='$line'
14880 lint='$lint'
14881 lkflags='$lkflags'
14882 ln='$ln'
14883 lns='$lns'
14884 locincpth='$locincpth'
14885 loclibpth='$loclibpth'
14886 longdblsize='$longdblsize'
14887 longlongsize='$longlongsize'
14888 longsize='$longsize'
14889 lp='$lp'
14890 lpr='$lpr'
14891 ls='$ls'
14892 lseeksize='$lseeksize'
14893 lseektype='$lseektype'
14894 mail='$mail'
14895 mailx='$mailx'
14896 make='$make'
14897 make_set_make='$make_set_make'
14898 mallocobj='$mallocobj'
14899 mallocsrc='$mallocsrc'
14900 malloctype='$malloctype'
14901 man1dir='$man1dir'
14902 man1direxp='$man1direxp'
14903 man1ext='$man1ext'
14904 man3dir='$man3dir'
14905 man3direxp='$man3direxp'
14906 man3ext='$man3ext'
14907 medium='$medium'
14908 mips_type='$mips_type'
14909 mkdir='$mkdir'
14910 models='$models'
14911 modetype='$modetype'
14912 more='$more'
14913 multiarch='$multiarch'
14914 mv='$mv'
14915 myarchname='$myarchname'
14916 mydomain='$mydomain'
14917 myhostname='$myhostname'
14918 myuname='$myuname'
14919 n='$n'
14920 netdb_hlen_type='$netdb_hlen_type'
14921 netdb_host_type='$netdb_host_type'
14922 netdb_name_type='$netdb_name_type'
14923 netdb_net_type='$netdb_net_type'
14924 nm='$nm'
14925 nm_opt='$nm_opt'
14926 nm_so_opt='$nm_so_opt'
14927 nonxs_ext='$nonxs_ext'
14928 nroff='$nroff'
14929 nvsize='$nvsize'
14930 nvtype='$nvtype'
14931 o_nonblock='$o_nonblock'
14932 obj_ext='$obj_ext'
14933 old_pthread_create_joinable='$old_pthread_create_joinable'
14934 optimize='$optimize'
14935 orderlib='$orderlib'
14936 osname='$osname'
14937 osvers='$osvers'
14938 package='$package'
14939 pager='$pager'
14940 passcat='$passcat'
14941 patchlevel='$patchlevel'
14942 path_sep='$path_sep'
14943 perl='$perl'
14944 perladmin='$perladmin'
14945 perlpath='$perlpath'
14946 pg='$pg'
14947 phostname='$phostname'
14948 pidtype='$pidtype'
14949 plibpth='$plibpth'
14950 pmake='$pmake'
14951 pr='$pr'
14952 prefix='$prefix'
14953 prefixexp='$prefixexp'
14954 privlib='$privlib'
14955 privlibexp='$privlibexp'
14956 prototype='$prototype'
14957 ptrsize='$ptrsize'
14958 quadkind='$quadkind'
14959 quadtype='$quadtype'
14960 randbits='$randbits'
14961 randfunc='$randfunc'
14962 randseedtype='$randseedtype'
14963 ranlib='$ranlib'
14964 rd_nodata='$rd_nodata'
14965 rm='$rm'
14966 rmail='$rmail'
14967 runnm='$runnm'
14968 sPRIEldbl='$sPRIEldbl'
14969 sPRIFldbl='$sPRIFldbl'
14970 sPRIGldbl='$sPRIGldbl'
14971 sPRIX64='$sPRIX64'
14972 sPRId64='$sPRId64'
14973 sPRIeldbl='$sPRIeldbl'
14974 sPRIfldbl='$sPRIfldbl'
14975 sPRIgldbl='$sPRIgldbl'
14976 sPRIi64='$sPRIi64'
14977 sPRIo64='$sPRIo64'
14978 sPRIu64='$sPRIu64'
14979 sPRIx64='$sPRIx64'
14980 sched_yield='$sched_yield'
14981 scriptdir='$scriptdir'
14982 scriptdirexp='$scriptdirexp'
14983 sed='$sed'
14984 seedfunc='$seedfunc'
14985 selectminbits='$selectminbits'
14986 selecttype='$selecttype'
14987 sendmail='$sendmail'
14988 sh='$sh'
14989 shar='$shar'
14990 sharpbang='$sharpbang'
14991 shmattype='$shmattype'
14992 shortsize='$shortsize'
14993 shrpenv='$shrpenv'
14994 shsharp='$shsharp'
14995 sig_count='$sig_count'
14996 sig_name='$sig_name'
14997 sig_name_init='$sig_name_init'
14998 sig_num='$sig_num'
14999 sig_num_init='$sig_num_init'
15000 signal_t='$signal_t'
15001 sitearch='$sitearch'
15002 sitearchexp='$sitearchexp'
15003 sitebin='$sitebin'
15004 sitebinexp='$sitebinexp'
15005 sitelib='$sitelib'
15006 sitelibexp='$sitelibexp'
15007 siteprefix='$siteprefix'
15008 siteprefixexp='$siteprefixexp'
15009 sizetype='$sizetype'
15010 sleep='$sleep'
15011 smail='$smail'
15012 small='$small'
15013 so='$so'
15014 sockethdr='$sockethdr'
15015 socketlib='$socketlib'
15016 sort='$sort'
15017 spackage='$spackage'
15018 spitshell='$spitshell'
15019 split='$split'
15020 src='$src'
15021 ssizetype='$ssizetype'
15022 startperl='$startperl'
15023 startsh='$startsh'
15024 static_ext='$static_ext'
15025 stdchar='$stdchar'
15026 stdio_base='$stdio_base'
15027 stdio_bufsiz='$stdio_bufsiz'
15028 stdio_cnt='$stdio_cnt'
15029 stdio_filbuf='$stdio_filbuf'
15030 stdio_ptr='$stdio_ptr'
15031 stdio_stream_array='$stdio_stream_array'
15032 strings='$strings'
15033 submit='$submit'
15034 subversion='$subversion'
15035 sysman='$sysman'
15036 tail='$tail'
15037 tar='$tar'
15038 tbl='$tbl'
15039 tee='$tee'
15040 test='$test'
15041 timeincl='$timeincl'
15042 timetype='$timetype'
15043 touch='$touch'
15044 tr='$tr'
15045 trnl='$trnl'
15046 troff='$troff'
15047 u16size='$u16size'
15048 u16type='$u16type'
15049 u32size='$u32size'
15050 u32type='$u32type'
15051 u64size='$u64size'
15052 u64type='$u64type'
15053 u8size='$u8size'
15054 u8type='$u8type'
15055 uidformat='$uidformat'
15056 uidsign='$uidsign'
15057 uidsize='$uidsize'
15058 uidtype='$uidtype'
15059 uname='$uname'
15060 uniq='$uniq'
15061 uquadtype='$uquadtype'
15062 use5005threads='$use5005threads'
15063 use64bits='$use64bits'
15064 usedl='$usedl'
15065 useithreads='$useithreads'
15066 uselargefiles='$uselargefiles'
15067 uselongdouble='$uselongdouble'
15068 uselonglong='$uselonglong'
15069 usemorebits='$usemorebits'
15070 usemultiplicity='$usemultiplicity'
15071 usemymalloc='$usemymalloc'
15072 usenm='$usenm'
15073 useopcode='$useopcode'
15074 useperlio='$useperlio'
15075 useposix='$useposix'
15076 usesfio='$usesfio'
15077 useshrplib='$useshrplib'
15078 usesocks='$usesocks'
15079 usethreads='$usethreads'
15080 usevendorprefix='$usevendorprefix'
15081 usevfork='$usevfork'
15082 usrinc='$usrinc'
15083 uuname='$uuname'
15084 uvoformat='$uvoformat'
15085 uvsize='$uvsize'
15086 uvtype='$uvtype'
15087 uvuformat='$uvuformat'
15088 uvxformat='$uvxformat'
15089 vendorbin='$vendorbin'
15090 vendorbinexp='$vendorbinexp'
15091 vendorlib='$vendorlib'
15092 vendorlibexp='$vendorlibexp'
15093 vendorprefix='$vendorprefix'
15094 vendorprefixexp='$vendorprefixexp'
15095 version='$version'
15096 vi='$vi'
15097 voidflags='$voidflags'
15098 xlibpth='$xlibpth'
15099 zcat='$zcat'
15100 zip='$zip'
15101 EOT
15102
15103 : Add in command line options if available
15104 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15105
15106 : add special variables
15107 $test -f $src/patchlevel.h && \
15108 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15109 echo "CONFIGDOTSH=true" >>config.sh
15110
15111 : propagate old symbols
15112 if $test -f UU/config.sh; then
15113         <UU/config.sh sort | uniq >UU/oldconfig.sh
15114         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15115         sort | uniq -u >UU/oldsyms
15116         set X `cat UU/oldsyms`
15117         shift
15118         case $# in
15119         0) ;;
15120         *)
15121                 cat <<EOM
15122 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15123 EOM
15124                 echo "# Variables propagated from previous config.sh file." >>config.sh
15125                 for sym in `cat UU/oldsyms`; do
15126                         echo "    Propagating $hint variable "'$'"$sym..."
15127                         eval 'tmp="$'"${sym}"'"'
15128                         echo "$tmp" | \
15129                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15130                 done
15131                 ;;
15132         esac
15133 fi
15134
15135 : Finish up by extracting the .SH files
15136 case "$alldone" in
15137 exit)
15138         $rm -rf UU
15139         echo "Done."
15140         exit 0
15141         ;;
15142 cont)
15143         ;;
15144 '')
15145         dflt=''
15146         nostick=true
15147         $cat <<EOM
15148
15149 If you'd like to make any changes to the config.sh file before I begin
15150 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15151
15152 EOM
15153         rp="Press return or use a shell escape to edit config.sh:"
15154         . UU/myread
15155         nostick=''
15156         case "$ans" in
15157         '') ;;
15158         *) : in case they cannot read
15159                 sh 1>&4 -c "$ans";;
15160         esac
15161         ;;
15162 esac
15163
15164 : if this fails, just run all the .SH files by hand
15165 . ./config.sh
15166
15167 echo " "
15168 exec 1>&4
15169 . ./UU/extract
15170
15171 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15172         dflt=y
15173         case "$silent" in
15174         true) ;;
15175         *)
15176                 $cat <<EOM
15177
15178 Now you need to generate make dependencies by running "$make depend".
15179 You might prefer to run it in background: "$make depend > makedepend.out &"
15180 It can take a while, so you might not want to run it right now.
15181
15182 EOM
15183                 ;;
15184         esac
15185         rp="Run $make depend now?"
15186         . UU/myread
15187         case "$ans" in
15188         y*)
15189                 $make depend && echo "Now you must run a $make."
15190                 ;;
15191         *)
15192                 echo "You must run '$make depend' then '$make'."
15193                 ;;
15194         esac
15195 elif test -f [Mm]akefile; then
15196         echo " "
15197         echo "Now you must run a $make."
15198 else
15199         echo "Done."
15200 fi
15201
15202 if $test -f Policy.sh; then
15203     $cat <<EOM
15204
15205 If you compile $package on a different machine or from a different object
15206 directory, copy the Policy.sh file from this object directory to the
15207 new one before you run Configure -- this will help you with most of
15208 the policy defaults.
15209
15210 EOM
15211 fi
15212 if $test -f config.msg; then
15213     echo "Hmm.  I also noted the following information while running:"
15214     echo " "
15215     $cat config.msg >&4
15216     $rm -f config.msg
15217 fi
15218 $rm -f kit*isdone ark*isdone
15219 $rm -rf UU
15220
15221 : End of Configure
15222