5a541b84e0d7429ed447fb9f6fa1568fe9cef7f2
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Aug  1 20:27:06 EET DST 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 ccflags=''
292 cppflags=''
293 ldflags=''
294 lkflags=''
295 locincpth=''
296 optimize=''
297 cf_email=''
298 cf_by=''
299 cf_time=''
300 charsize=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_fchmod=''
346 d_fchown=''
347 d_fcntl=''
348 d_fd_macros=''
349 d_fd_set=''
350 d_fds_bits=''
351 d_fgetpos=''
352 d_flexfnam=''
353 d_flock=''
354 d_fork=''
355 d_fpos64_t=''
356 d_frexpl=''
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_getcwd=''
366 d_getespwnam=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getprpwnam=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_isnan=''
410 d_isnanl=''
411 d_killpg=''
412 d_lchown=''
413 d_ldbl_dig=''
414 d_link=''
415 d_locconv=''
416 d_lockf=''
417 d_longdbl=''
418 longdblsize=''
419 d_longlong=''
420 longlongsize=''
421 d_lseekproto=''
422 d_lstat=''
423 d_madvise=''
424 d_mblen=''
425 d_mbstowcs=''
426 d_mbtowc=''
427 d_memchr=''
428 d_memcmp=''
429 d_memcpy=''
430 d_memmove=''
431 d_memset=''
432 d_mkdir=''
433 d_mkdtemp=''
434 d_mkfifo=''
435 d_mkstemp=''
436 d_mkstemps=''
437 d_mktime=''
438 d_mmap=''
439 mmaptype=''
440 d_modfl=''
441 d_mprotect=''
442 d_msg=''
443 d_msgctl=''
444 d_msgget=''
445 d_msgrcv=''
446 d_msgsnd=''
447 d_msync=''
448 d_munmap=''
449 d_nice=''
450 d_off64_t=''
451 d_open3=''
452 d_fpathconf=''
453 d_pathconf=''
454 d_pause=''
455 d_pipe=''
456 d_poll=''
457 d_portable=''
458 d_old_pthread_create_joinable=''
459 old_pthread_create_joinable=''
460 d_pthread_yield=''
461 d_sched_yield=''
462 sched_yield=''
463 d_qgcvt=''
464 d_readdir=''
465 d_rewinddir=''
466 d_seekdir=''
467 d_telldir=''
468 d_readlink=''
469 d_rename=''
470 d_rmdir=''
471 d_safebcpy=''
472 d_safemcpy=''
473 d_sanemcmp=''
474 d_select=''
475 d_sem=''
476 d_semctl=''
477 d_semget=''
478 d_semop=''
479 d_setegid=''
480 d_seteuid=''
481 d_setgrent=''
482 d_setgrps=''
483 d_sethent=''
484 d_setlinebuf=''
485 d_setlocale=''
486 d_setnent=''
487 d_setpent=''
488 d_setpgid=''
489 d_setpgrp2=''
490 d_bsdsetpgrp=''
491 d_setpgrp=''
492 d_setprior=''
493 d_setproctitle=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setvbuf=''
504 d_sfio=''
505 usesfio=''
506 d_shm=''
507 d_shmat=''
508 d_shmatprototype=''
509 shmattype=''
510 d_shmctl=''
511 d_shmdt=''
512 d_shmget=''
513 d_sigaction=''
514 d_sigsetjmp=''
515 d_msg_ctrunc=''
516 d_msg_dontroute=''
517 d_msg_oob=''
518 d_msg_peek=''
519 d_msg_proxy=''
520 d_oldsock=''
521 d_scm_rights=''
522 d_socket=''
523 d_sockpair=''
524 sockethdr=''
525 socketlib=''
526 d_socklen_t=''
527 d_sqrtl=''
528 d_statblks=''
529 d_statfs_f_flags=''
530 d_statfs_s=''
531 d_fstatvfs=''
532 d_statvfs=''
533 d_stdio_cnt_lval=''
534 d_stdio_ptr_lval=''
535 d_stdiobase=''
536 d_stdstdio=''
537 stdio_base=''
538 stdio_bufsiz=''
539 stdio_cnt=''
540 stdio_filbuf=''
541 stdio_ptr=''
542 d_index=''
543 d_strchr=''
544 d_strcoll=''
545 d_strctcpy=''
546 d_strerrm=''
547 d_strerror=''
548 d_sysernlst=''
549 d_syserrlst=''
550 d_strtod=''
551 d_strtol=''
552 d_strtold=''
553 d_strtoll=''
554 d_strtoul=''
555 d_strtoull=''
556 d_strtouq=''
557 d_strxfrm=''
558 d_symlink=''
559 d_syscall=''
560 d_sysconf=''
561 d_system=''
562 d_tcgetpgrp=''
563 d_tcsetpgrp=''
564 d_telldirproto=''
565 d_time=''
566 timetype=''
567 clocktype=''
568 d_times=''
569 d_truncate=''
570 d_tzname=''
571 d_umask=''
572 d_semctl_semid_ds=''
573 d_semctl_semun=''
574 d_union_semun=''
575 d_ustat=''
576 d_vfork=''
577 usevfork=''
578 d_voidsig=''
579 signal_t=''
580 d_volatile=''
581 d_charvspr=''
582 d_vprintf=''
583 d_wait4=''
584 d_waitpid=''
585 d_wcstombs=''
586 d_wctomb=''
587 dlext=''
588 cccdlflags=''
589 ccdlflags=''
590 dlsrc=''
591 ld=''
592 lddlflags=''
593 usedl=''
594 doublesize=''
595 ebcdic=''
596 fflushNULL=''
597 fflushall=''
598 fpossize=''
599 fpostype=''
600 gccosandvers=''
601 gccversion=''
602 gidformat=''
603 gidsign=''
604 gidsize=''
605 gidtype=''
606 groupstype=''
607 h_fcntl=''
608 h_sysfile=''
609 i_arpainet=''
610 db_hashtype=''
611 db_prefixtype=''
612 i_db=''
613 i_dbm=''
614 i_rpcsvcdbm=''
615 d_dirnamlen=''
616 direntrytype=''
617 i_dirent=''
618 i_dld=''
619 i_dlfcn=''
620 i_fcntl=''
621 i_float=''
622 i_gdbm=''
623 d_grpasswd=''
624 i_grp=''
625 i_iconv=''
626 i_ieeefp=''
627 i_inttypes=''
628 i_limits=''
629 i_locale=''
630 i_machcthr=''
631 i_malloc=''
632 i_math=''
633 i_memory=''
634 i_mntent=''
635 i_ndbm=''
636 i_netdb=''
637 i_neterrno=''
638 i_netinettcp=''
639 i_niin=''
640 i_sysin=''
641 i_poll=''
642 i_prot=''
643 i_pthread=''
644 d_pwage=''
645 d_pwchange=''
646 d_pwclass=''
647 d_pwcomment=''
648 d_pwexpire=''
649 d_pwgecos=''
650 d_pwpasswd=''
651 d_pwquota=''
652 i_pwd=''
653 i_sfio=''
654 i_shadow=''
655 i_socks=''
656 i_stddef=''
657 i_stdlib=''
658 i_string=''
659 strings=''
660 i_sunmath=''
661 i_sysaccess=''
662 i_sysdir=''
663 i_sysfile=''
664 d_voidtty=''
665 i_bsdioctl=''
666 i_sysfilio=''
667 i_sysioctl=''
668 i_syssockio=''
669 i_syslog=''
670 i_sysmman=''
671 i_sysmode=''
672 i_sysmount=''
673 i_sysndir=''
674 i_sysparam=''
675 i_sysresrc=''
676 i_syssecrt=''
677 i_sysselct=''
678 i_sysstat=''
679 i_sysstatfs=''
680 i_sysstatvfs=''
681 i_systimes=''
682 i_systypes=''
683 i_sysuio=''
684 i_sysun=''
685 i_sysutsname=''
686 i_sysvfs=''
687 i_syswait=''
688 i_sgtty=''
689 i_termio=''
690 i_termios=''
691 i_systime=''
692 i_systimek=''
693 i_time=''
694 timeincl=''
695 i_unistd=''
696 i_ustat=''
697 i_utime=''
698 i_values=''
699 i_stdarg=''
700 i_varargs=''
701 i_varhdr=''
702 i_vfork=''
703 inc_version_list=''
704 inc_version_list_init=''
705 installprefix=''
706 installprefixexp=''
707 installstyle=''
708 installusrbinperl=''
709 intsize=''
710 longsize=''
711 shortsize=''
712 libc=''
713 ldlibpthname=''
714 libperl=''
715 shrpenv=''
716 useshrplib=''
717 glibpth=''
718 libpth=''
719 loclibpth=''
720 plibpth=''
721 xlibpth=''
722 ignore_versioned_solibs=''
723 libs=''
724 libsdirs=''
725 libsfiles=''
726 libsfound=''
727 libspath=''
728 lns=''
729 d_PRIEldbl=''
730 d_PRIFldbl=''
731 d_PRIGldbl=''
732 d_PRIeldbl=''
733 d_PRIfldbl=''
734 d_PRIgldbl=''
735 sPRIEldbl=''
736 sPRIFldbl=''
737 sPRIGldbl=''
738 sPRIeldbl=''
739 sPRIfldbl=''
740 sPRIgldbl=''
741 lseeksize=''
742 lseektype=''
743 make_set_make=''
744 d_mymalloc=''
745 freetype=''
746 mallocobj=''
747 mallocsrc=''
748 malloctype=''
749 usemymalloc=''
750 installman1dir=''
751 man1dir=''
752 man1direxp=''
753 man1ext=''
754 installman3dir=''
755 man3dir=''
756 man3direxp=''
757 man3ext=''
758 huge=''
759 large=''
760 medium=''
761 models=''
762 small=''
763 split=''
764 modetype=''
765 multiarch=''
766 mydomain=''
767 myhostname=''
768 phostname=''
769 c=''
770 n=''
771 d_eofnblk=''
772 eagain=''
773 o_nonblock=''
774 rd_nodata=''
775 netdb_hlen_type=''
776 netdb_host_type=''
777 netdb_name_type=''
778 netdb_net_type=''
779 groupcat=''
780 hostcat=''
781 passcat=''
782 orderlib=''
783 ranlib=''
784 d_perl_otherlibdirs=''
785 otherlibdirs=''
786 package=''
787 spackage=''
788 pager=''
789 api_revision=''
790 api_subversion=''
791 api_version=''
792 api_versionstring=''
793 patchlevel=''
794 revision=''
795 subversion=''
796 version=''
797 perl5=''
798 perladmin=''
799 perlpath=''
800 d_nv_preserves_uv=''
801 d_nv_preserves_uv_bits=''
802 i16size=''
803 i16type=''
804 i32size=''
805 i32type=''
806 i64size=''
807 i64type=''
808 i8size=''
809 i8type=''
810 ivsize=''
811 ivtype=''
812 nvsize=''
813 nvtype=''
814 u16size=''
815 u16type=''
816 u32size=''
817 u32type=''
818 u64size=''
819 u64type=''
820 u8size=''
821 u8type=''
822 uvsize=''
823 uvtype=''
824 ivdformat=''
825 uvoformat=''
826 uvuformat=''
827 uvxformat=''
828 pidtype=''
829 prefix=''
830 prefixexp=''
831 installprivlib=''
832 privlib=''
833 privlibexp=''
834 prototype=''
835 ptrsize=''
836 d_PRIX64=''
837 d_PRId64=''
838 d_PRIi64=''
839 d_PRIo64=''
840 d_PRIu64=''
841 d_PRIx64=''
842 sPRIX64=''
843 sPRId64=''
844 sPRIi64=''
845 sPRIo64=''
846 sPRIu64=''
847 sPRIx64=''
848 d_quad=''
849 quadkind=''
850 quadtype=''
851 uquadtype=''
852 drand01=''
853 randbits=''
854 randfunc=''
855 randseedtype=''
856 seedfunc=''
857 installscript=''
858 scriptdir=''
859 scriptdirexp=''
860 selectminbits=''
861 selecttype=''
862 sh=''
863 sig_count=''
864 sig_name=''
865 sig_name_init=''
866 sig_num=''
867 sig_num_init=''
868 installsitearch=''
869 sitearch=''
870 sitearchexp=''
871 installsitebin=''
872 sitebin=''
873 sitebinexp=''
874 installsitelib=''
875 sitelib=''
876 sitelib_stem=''
877 sitelibexp=''
878 siteprefix=''
879 siteprefixexp=''
880 sizesize=''
881 sizetype=''
882 so=''
883 socksizetype=''
884 sharpbang=''
885 shsharp=''
886 spitshell=''
887 src=''
888 ssizetype=''
889 startperl=''
890 startsh=''
891 stdchar=''
892 d_stdio_stream_array=''
893 stdio_stream_array=''
894 sysman=''
895 trnl=''
896 uidformat=''
897 uidsign=''
898 uidsize=''
899 uidtype=''
900 archname64=''
901 use64bitall=''
902 use64bitint=''
903 uselargefiles=''
904 uselongdouble=''
905 usemorebits=''
906 usemultiplicity=''
907 nm_opt=''
908 nm_so_opt=''
909 runnm=''
910 usenm=''
911 useperlio=''
912 usesocks=''
913 d_oldpthreads=''
914 use5005threads=''
915 useithreads=''
916 usethreads=''
917 incpath=''
918 mips_type=''
919 usrinc=''
920 d_vendorarch=''
921 installvendorarch=''
922 vendorarch=''
923 vendorarchexp=''
924 d_vendorbin=''
925 installvendorbin=''
926 vendorbin=''
927 vendorbinexp=''
928 d_vendorlib=''
929 installvendorlib=''
930 vendorlib=''
931 vendorlib_stem=''
932 vendorlibexp=''
933 usevendorprefix=''
934 vendorprefix=''
935 vendorprefixexp=''
936 defvoidused=''
937 voidflags=''
938 pm_apiversion=''
939 xs_apiversion=''
940 CONFIG=''
941
942 define='define'
943 undef='undef'
944 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
945 rmlist=''
946
947 : We must find out about Eunice early
948 eunicefix=':'
949 if test -f /etc/unixtovms; then
950         eunicefix=/etc/unixtovms
951 fi
952 if test -f /etc/unixtovms.exe; then
953         eunicefix=/etc/unixtovms.exe
954 fi
955
956 i_whoami=''
957 : set useposix=false in your hint file to disable the POSIX extension.
958 useposix=true
959 : set useopcode=false in your hint file to disable the Opcode extension.
960 useopcode=true
961 : Trailing extension.  Override this in a hint file, if needed.
962 _exe=''
963 : Extra object files, if any, needed on this platform.
964 archobjs=''
965 : Possible local include directories to search.
966 : Set locincpth to "" in a hint file to defeat local include searches.
967 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
968 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
969 :
970 : no include file wanted by default
971 inclwanted=''
972
973 groupstype=''
974 : change the next line if compiling for Xenix/286 on Xenix/386
975 xlibpth='/usr/lib/386 /lib/386'
976 : Possible local library directories to search.
977 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
978 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
979
980 : general looking path for locating libraries
981 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
982 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
983 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
984 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
985 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
986
987 : Private path used by Configure to find libraries.  Its value
988 : is prepended to libpth. This variable takes care of special
989 : machines, like the mips.  Usually, it should be empty.
990 plibpth=''
991
992 : default library list
993 libswanted=''
994 : some systems want to use only the non-versioned libso:s
995 ignore_versioned_solibs=''
996 : set usemultiplicity on the Configure command line to enable multiplicity.
997 : set usesocks on the Configure command line to enable socks.
998 : set usethreads on the Configure command line to enable threads.
999 : full support for void wanted by default
1000 defvoidused=15
1001
1002 : List of libraries we want.
1003 : If anyone needs -lnet, put it in a hint file.
1004 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1005 libswanted="$libswanted dld ld sun m c cposix posix"
1006 libswanted="$libswanted ndir dir crypt sec"
1007 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1008 : We probably want to search /usr/shlib before most other libraries.
1009 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1010 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1011 glibpth="/usr/shlib $glibpth"
1012 : Do not use vfork unless overridden by a hint file.
1013 usevfork=false
1014
1015 : Find the basic shell for Bourne shell scripts
1016 case "$sh" in
1017 '')
1018         case "$SYSTYPE" in
1019         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1020         *) xxx='/bin/sh';;
1021         esac
1022         if test -f "$xxx"; then
1023                 sh="$xxx"
1024         else
1025                 : Build up a list and do a single loop so we can 'break' out.
1026                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1027                 for xxx in sh bash ksh pdksh ash; do
1028                         for p in $pth; do
1029                                 try="$try ${p}/${xxx}"
1030                         done
1031                 done
1032                 for xxx in $try; do
1033                         if test -f "$xxx"; then
1034                                 sh="$xxx";
1035                                 break
1036                         elif test -f "$xxx.exe"; then
1037                                 sh="$xxx";
1038                                 break
1039                         fi
1040                 done
1041         fi
1042         ;;
1043 esac
1044
1045 case "$sh" in
1046 '')     cat <<EOM >&2
1047 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1048
1049 Usually it's in /bin/sh.  How did you even get this far?
1050 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1051 we'll try to straighten this all out.
1052 EOM
1053         exit 1
1054         ;;
1055 esac
1056
1057 : see if sh knows # comments
1058 if `$sh -c '#' >/dev/null 2>&1`; then
1059         shsharp=true
1060         spitshell=cat
1061         xcat=/bin/cat
1062         test -f $xcat || xcat=/usr/bin/cat
1063         echo "#!$xcat" >try
1064         $eunicefix try
1065         chmod +x try
1066         ./try > today
1067         if test -s today; then
1068                 sharpbang='#!'
1069         else
1070                 echo "#! $xcat" > try
1071                 $eunicefix try
1072                 chmod +x try
1073                 ./try > today
1074                 if test -s today; then
1075                         sharpbang='#! '
1076                 else
1077                         sharpbang=': use '
1078                 fi
1079         fi
1080 else
1081         echo " "
1082         echo "Your $sh doesn't grok # comments--I will strip them later on."
1083         shsharp=false
1084         cd ..
1085         echo "exec grep -v '^[  ]*#'" >spitshell
1086         chmod +x spitshell
1087         $eunicefix spitshell
1088         spitshell=`pwd`/spitshell
1089         cd UU
1090         echo "I presume that if # doesn't work, #! won't work either!"
1091         sharpbang=': use '
1092 fi
1093 rm -f try today
1094
1095 : figure out how to guarantee sh startup
1096 case "$startsh" in
1097 '') startsh=${sharpbang}${sh} ;;
1098 *)
1099 esac
1100 cat >try <<EOSS
1101 $startsh
1102 set abc
1103 test "$?abc" != 1
1104 EOSS
1105
1106 chmod +x try
1107 $eunicefix try
1108 if ./try; then
1109         : echo "Yup, it does."
1110 else
1111         echo "Hmm... '$startsh' does not guarantee sh startup..."
1112         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1113 fi
1114 rm -f try
1115
1116
1117 : Save command line options in file UU/cmdline.opt for later use in
1118 : generating config.sh.
1119 cat > cmdline.opt <<EOSH
1120 # Configure command line arguments.
1121 config_arg0='$0'
1122 config_args='$*'
1123 config_argc=$#
1124 EOSH
1125 argn=1
1126 for arg in "$@"; do
1127         cat >>cmdline.opt <<EOSH
1128 config_arg$argn='$arg'
1129 EOSH
1130         argn=`expr $argn + 1`
1131 done
1132
1133 : produce awk script to parse command line options
1134 cat >options.awk <<'EOF'
1135 BEGIN {
1136         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1137
1138         len = length(optstr);
1139         for (i = 1; i <= len; i++) {
1140                 c = substr(optstr, i, 1);
1141                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1142                 if (a == ":") {
1143                         arg[c] = 1;
1144                         i++;
1145                 }
1146                 opt[c] = 1;
1147         }
1148 }
1149 {
1150         expect = 0;
1151         str = $0;
1152         if (substr(str, 1, 1) != "-") {
1153                 printf("'%s'\n", str);
1154                 next;
1155         }
1156         len = length($0);
1157         for (i = 2; i <= len; i++) {
1158                 c = substr(str, i, 1);
1159                 if (!opt[c]) {
1160                         printf("-%s\n", substr(str, i));
1161                         next;
1162                 }
1163                 printf("-%s\n", c);
1164                 if (arg[c]) {
1165                         if (i < len)
1166                                 printf("'%s'\n", substr(str, i + 1));
1167                         else
1168                                 expect = 1;
1169                         next;
1170                 }
1171         }
1172 }
1173 END {
1174         if (expect)
1175                 print "?";
1176 }
1177 EOF
1178
1179 : process the command line options
1180 set X `for arg in "$@"; do echo "X$arg"; done |
1181         sed -e s/X// | awk -f options.awk`
1182 eval "set $*"
1183 shift
1184 rm -f options.awk
1185
1186 : set up default values
1187 fastread=''
1188 reuseval=false
1189 config_sh=''
1190 alldone=''
1191 error=''
1192 silent=''
1193 extractsh=''
1194 override=''
1195 knowitall=''
1196 rm -f optdef.sh posthint.sh
1197 cat >optdef.sh <<EOS
1198 $startsh
1199 EOS
1200
1201
1202 : option parsing
1203 while test $# -gt 0; do
1204         case "$1" in
1205         -d) shift; fastread=yes;;
1206         -e) shift; alldone=cont;;
1207         -f)
1208                 shift
1209                 cd ..
1210                 if test -r "$1"; then
1211                         config_sh="$1"
1212                 else
1213                         echo "$me: cannot read config file $1." >&2
1214                         error=true
1215                 fi
1216                 cd UU
1217                 shift;;
1218         -h) shift; error=true;;
1219         -r) shift; reuseval=true;;
1220         -s) shift; silent=true; realsilent=true;;
1221         -E) shift; alldone=exit;;
1222         -K) shift; knowitall=true;;
1223         -O) shift; override=true;;
1224         -S) shift; silent=true; extractsh=true;;
1225         -D)
1226                 shift
1227                 case "$1" in
1228                 *=)
1229                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1230                         echo "$me: ignoring -D $1" >&2
1231                         ;;
1232                 *=*) echo "$1" | \
1233                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1234                 *) echo "$1='define'" >> optdef.sh;;
1235                 esac
1236                 shift
1237                 ;;
1238         -U)
1239                 shift
1240                 case "$1" in
1241                 *=) echo "$1" >> optdef.sh;;
1242                 *=*)
1243                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1244                         echo "$me: ignoring -U $1" >&2
1245                         ;;
1246                 *) echo "$1='undef'" >> optdef.sh;;
1247                 esac
1248                 shift
1249                 ;;
1250         -A)
1251             shift
1252             xxx=''
1253             yyy="$1"
1254             zzz=''
1255             uuu=undef
1256             case "$yyy" in
1257             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1258                  case "$zzz" in
1259                  *:*) zzz='' ;;
1260                  *)   xxx=append
1261                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1262                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1263                  esac
1264                  ;;
1265             esac
1266             case "$xxx" in
1267             '')  case "$yyy" in
1268                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1269                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1270                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1271                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1272                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1273                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1274                  esac
1275                  ;;       
1276             esac
1277             case "$xxx" in
1278             append)
1279                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1280             clear)
1281                 echo "$yyy=''"                  >> posthint.sh ;;
1282             define)
1283                 case "$zzz" in
1284                 '') zzz=define ;;
1285                 esac
1286                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1287             eval)
1288                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1289             prepend)
1290                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1291             undef)
1292                 case "$zzz" in
1293                 '') zzz="$uuu" ;;
1294                 esac
1295                 echo "$yyy=$zzz"                >> posthint.sh ;;
1296             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1297             esac
1298             shift
1299             ;;
1300         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1301             exit 0;;
1302         --) break;;
1303         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1304         *) break;;
1305         esac
1306 done
1307
1308 case "$error" in
1309 true)
1310         cat >&2 <<EOM
1311 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1312                  [-U symbol] [-U symbol=] [-A command:symbol...]
1313   -d : use defaults for all answers.
1314   -e : go on without questioning past the production of config.sh.
1315   -f : specify an alternate default configuration file.
1316   -h : print this help message and exit (with an error status).
1317   -r : reuse C symbols value if possible (skips costly nm extraction).
1318   -s : silent mode, only echoes questions and essential information.
1319   -D : define symbol to have some value:
1320          -D symbol         symbol gets the value 'define'
1321          -D symbol=value   symbol gets the value 'value'
1322   -E : stop at the end of questions, after having produced config.sh.
1323   -K : do not use unless you know what you are doing.
1324   -O : let -D and -U override definitions from loaded configuration file.
1325   -S : perform variable substitutions on all .SH files (can mix with -f)
1326   -U : undefine symbol:
1327          -U symbol    symbol gets the value 'undef'
1328          -U symbol=   symbol gets completely empty
1329   -A : manipulate symbol after the platform specific hints have been applied:
1330          -A symbol=value                append " "value to symbol
1331          -A append:symbol=value         append value to symbol
1332          -A define:symbol=value         define symbol to have value
1333          -A clear:symbol                define symbol to be ''
1334          -A define:symbol               define symbol to be 'define'
1335          -A eval:symbol=value           define symbol to be eval of value
1336          -A prepend:symbol=value        prepend value to symbol
1337          -A undef:symbol                define symbol to be 'undef'
1338          -A undef:symbol=               define symbol to be ''
1339   -V : print version number and exit (with a zero status).
1340 EOM
1341         exit 1
1342         ;;
1343 esac
1344
1345 : Sanity checks
1346 case "$fastread$alldone" in
1347 yescont|yesexit) ;;
1348 *)
1349         case "$extractsh" in
1350         true) ;;
1351         *)
1352                 if test ! -t 0; then
1353                         echo "Say 'sh Configure', not 'sh <Configure'"
1354                         exit 1
1355                 fi
1356                 ;;
1357         esac
1358         ;;
1359 esac
1360
1361 exec 4>&1
1362 case "$silent" in
1363 true) exec 1>/dev/null;;
1364 esac
1365
1366 : run the defines and the undefines, if any, but leave the file out there...
1367 touch optdef.sh
1368 . ./optdef.sh
1369 : create the posthint manipulation script and leave the file out there...
1370 touch posthint.sh
1371
1372 : set package name
1373 package=perl5
1374 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1375 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1376 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1377 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1378 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1379 esac
1380
1381 : Some greps do not return status, grrr.
1382 echo "grimblepritz" >grimble
1383 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1384         contains=contains
1385 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1386         contains=grep
1387 else
1388         contains=contains
1389 fi
1390 rm -f grimble
1391 : the following should work in any shell
1392 case "$contains" in
1393 contains*)
1394         echo " "
1395         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1396         cat >contains <<'EOSS'
1397 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1398 EOSS
1399 chmod +x contains
1400 esac
1401
1402 : Find the path to the source tree
1403 case "$src" in
1404 '') case "$0" in
1405     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1406          case "$src" in
1407          /*)    ;;
1408          *)     src=`cd ../$src && pwd` ;;
1409          esac
1410          ;;
1411     *)   src='.';;
1412     esac;;
1413 esac
1414 case "$src" in
1415 '')     src=/
1416         rsrc=/
1417         ;;
1418 /*) rsrc="$src";;
1419 *) rsrc="../$src";;
1420 esac
1421 if test -f $rsrc/Configure && \
1422         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1423 then
1424    : found it, so we are ok.
1425 else
1426         rsrc=''
1427         for src in . .. ../.. ../../.. ../../../..; do
1428                 if test -f ../$src/Configure && \
1429                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1430                 then
1431                         rsrc=../$src
1432                         break
1433                 fi
1434         done
1435 fi
1436 case "$rsrc" in
1437 '')
1438         cat <<EOM >&4
1439
1440 Sorry, I can't seem to locate the source dir for $package.  Please start
1441 Configure with an explicit path -- i.e. /some/path/Configure.
1442
1443 EOM
1444         exit 1
1445         ;;
1446 ../.)   rsrc='..';;
1447 *)
1448         echo " "
1449         echo "Sources for $package found in \"$src\"." >&4
1450         ;;
1451 esac
1452
1453 : script used to extract .SH files with variable substitutions
1454 cat >extract <<'EOS'
1455 CONFIGDOTSH=true
1456 echo "Doing variable substitutions on .SH files..."
1457 if test -f $src/MANIFEST; then
1458         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1459 else
1460         echo "(Looking for .SH files under the source directory.)"
1461         set x `(cd $src; find . -name "*.SH" -print)`
1462 fi
1463 shift
1464 case $# in
1465 0) set x `(cd $src; echo *.SH)`; shift;;
1466 esac
1467 if test ! -f $src/$1; then
1468         shift
1469 fi
1470 mkdir_p='
1471 name=$1;
1472 create="";
1473 while test $name; do
1474         if test ! -d "$name"; then
1475                 create="$name $create";
1476                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1477                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1478         else
1479                 name="";
1480         fi;
1481 done;
1482 for file in $create; do
1483         mkdir $file;
1484 done
1485 '
1486 for file in $*; do
1487         case "$src" in
1488         ".")
1489                 case "$file" in
1490                 */*)
1491                         dir=`expr X$file : 'X\(.*\)/'`
1492                         file=`expr X$file : 'X.*/\(.*\)'`
1493                         (cd $dir && . ./$file)
1494                         ;;
1495                 *)
1496                         . ./$file
1497                         ;;
1498                 esac
1499                 ;;
1500         *)
1501                 case "$file" in
1502                 */*)
1503                         dir=`expr X$file : 'X\(.*\)/'`
1504                         file=`expr X$file : 'X.*/\(.*\)'`
1505                         (set x $dir; shift; eval $mkdir_p)
1506                         sh <$src/$dir/$file
1507                         ;;
1508                 *)
1509                         sh <$src/$file
1510                         ;;
1511                 esac
1512                 ;;
1513         esac
1514 done
1515 if test -f $src/config_h.SH; then
1516         if test ! -f config.h; then
1517         : oops, they left it out of MANIFEST, probably, so do it anyway.
1518         . $src/config_h.SH
1519         fi
1520 fi
1521 EOS
1522
1523 : extract files and exit if asked to do so
1524 case "$extractsh" in
1525 true)
1526         case "$realsilent" in
1527         true) ;;
1528         *) exec 1>&4;;
1529         esac
1530         case "$config_sh" in
1531         '') config_sh='config.sh';;
1532         esac
1533         echo " "
1534         echo "Fetching answers from $config_sh..."
1535         cd ..
1536         . $config_sh
1537         test "$override" && . ./optdef.sh
1538         echo " "
1539         . UU/extract
1540         rm -rf UU
1541         echo "Done."
1542         exit 0
1543         ;;
1544 esac
1545
1546 : Eunice requires " " instead of "", can you believe it
1547 echo " "
1548 : Here we go...
1549 echo "Beginning of configuration questions for $package."
1550
1551 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1552
1553 : first determine how to suppress newline on echo command
1554 echo " "
1555 echo "Checking echo to see how to suppress newlines..."
1556 (echo "hi there\c" ; echo " ") >.echotmp
1557 if $contains c .echotmp >/dev/null 2>&1 ; then
1558         echo "...using -n."
1559         n='-n'
1560         c=''
1561 else
1562         cat <<'EOM'
1563 ...using \c
1564 EOM
1565         n=''
1566         c='\c'
1567 fi
1568 echo $n "The star should be here-->$c"
1569 echo '*'
1570 rm -f .echotmp
1571
1572 : Now test for existence of everything in MANIFEST
1573 echo " "
1574 if test -f $rsrc/MANIFEST; then
1575         echo "First let's make sure your kit is complete.  Checking..." >&4
1576         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1577         rm -f missing
1578         tmppwd=`pwd`
1579         for filelist in x??; do
1580                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1581         done
1582         if test -s missing; then
1583                 cat missing >&4
1584                 cat >&4 <<'EOM'
1585
1586 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1587
1588 You have the option of continuing the configuration process, despite the
1589 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1590 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1591 and contact the author (perlbug@perl.com).
1592
1593 EOM
1594                 echo $n "Continue? [n] $c" >&4
1595                 read ans
1596                 case "$ans" in
1597                 y*)
1598                         echo "Continuing..." >&4
1599                         rm -f missing
1600                         ;;
1601                 *)
1602                         echo "ABORTING..." >&4
1603                         kill $$
1604                         ;;
1605                 esac
1606         else
1607                 echo "Looks good..."
1608         fi
1609 else
1610         echo "There is no MANIFEST file.  I hope your kit is complete !"
1611 fi
1612 rm -f missing x??
1613
1614 echo " "
1615 : Find the appropriate value for a newline for tr
1616 if test -n "$DJGPP"; then
1617        trnl='\012'
1618 fi
1619 if test X"$trnl" = X; then
1620         case "`echo foo|tr '\n' x 2>/dev/null`" in
1621         foox) trnl='\n' ;;
1622         esac
1623 fi
1624 if test X"$trnl" = X; then
1625         case "`echo foo|tr '\012' x 2>/dev/null`" in
1626         foox) trnl='\012' ;;
1627         esac
1628 fi
1629 if test X"$trnl" = X; then
1630         cat <<EOM >&2
1631
1632 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1633
1634 EOM
1635         exit 1
1636 fi
1637
1638 : compute the number of columns on the terminal for proper question formatting
1639 case "$COLUMNS" in
1640 '') COLUMNS='80';;
1641 esac
1642
1643 : set up the echo used in my read
1644 myecho="case \"\$xxxm\" in
1645 '') echo $n \"\$rp $c\" >&4;;
1646 *) case \"\$rp\" in
1647         '') echo $n \"[\$xxxm] $c\";;
1648         *)
1649                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1650                         echo \"\$rp\" >&4
1651                         echo $n \"[\$xxxm] $c\" >&4
1652                 else
1653                         echo $n \"\$rp [\$xxxm] $c\" >&4
1654                 fi
1655                 ;;
1656         esac;;
1657 esac"
1658
1659 : now set up to do reads with possible shell escape and default assignment
1660 cat <<EOSC >myread
1661 $startsh
1662 xxxm=\$dflt
1663 $myecho
1664 ans='!'
1665 case "\$fastread" in
1666 yes) case "\$dflt" in
1667         '') ;;
1668         *) ans='';
1669                 case "\$silent-\$rp" in
1670                 true-) ;;
1671                 *) echo " " >&4;;
1672                 esac;;
1673         esac;;
1674 *) case "\$silent" in
1675         true) case "\$rp" in
1676                 '') ans='';;
1677                 esac;;
1678         esac;;
1679 esac
1680 while expr "X\$ans" : "X!" >/dev/null; do
1681         read answ
1682         set x \$xxxm
1683         shift
1684         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1685         case  "\$answ" in
1686         "!")
1687                 sh 1>&4
1688                 echo " "
1689                 $myecho
1690                 ;;
1691         !*)
1692                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1693                 shift
1694                 sh 1>&4 -c "\$*"
1695                 echo " "
1696                 $myecho
1697                 ;;
1698         "\$ans")
1699                 case "\$ans" in
1700                 \\&*)
1701                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1702                         shift
1703                         case "\$1" in
1704                         -d)
1705                                 fastread=yes
1706                                 echo "(OK, I'll run with -d after this question.)" >&4
1707                                 ;;
1708                         -*)
1709                                 echo "*** Sorry, \$1 not supported yet." >&4
1710                                 ;;
1711                         esac
1712                         $myecho
1713                         ans=!
1714                         ;;
1715                 esac;;
1716         *)
1717                 case "\$aok" in
1718                 y)
1719                         echo "*** Substitution done -- please confirm."
1720                         xxxm="\$ans"
1721                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1722                         xxxm="\$ans"
1723                         ans=!
1724                         ;;
1725                 *)
1726                         echo "*** Error -- try again."
1727                         ans=!
1728                         ;;
1729                 esac
1730                 $myecho
1731                 ;;
1732         esac
1733         case "\$ans\$xxxm\$nostick" in
1734         '')
1735                 ans=!
1736                 $myecho
1737                 ;;
1738         esac
1739 done
1740 case "\$ans" in
1741 '') ans="\$xxxm";;
1742 esac
1743 EOSC
1744
1745 : create .config dir to save info across Configure sessions
1746 test -d ../.config || mkdir ../.config
1747 cat >../.config/README <<EOF
1748 This directory created by Configure to save information that should
1749 persist across sessions for $package.
1750
1751 You may safely delete it if you wish.
1752 EOF
1753
1754 : general instructions
1755 needman=true
1756 firsttime=true
1757 user=`(logname) 2>/dev/null`
1758 case "$user" in
1759 '') user=`whoami 2>&1`;;
1760 esac
1761 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1762         firsttime=false
1763         echo " "
1764         rp='Would you like to see the instructions?'
1765         dflt=n
1766         . ./myread
1767         case "$ans" in
1768         [yY]*) ;;
1769         *) needman=false;;
1770         esac
1771 fi
1772 if $needman; then
1773         cat <<EOH
1774
1775 This installation shell script will examine your system and ask you questions
1776 to determine how the perl5 package should be installed. If you get
1777 stuck on a question, you may use a ! shell escape to start a subshell or
1778 execute a command.  Many of the questions will have default answers in square
1779 brackets; typing carriage return will give you the default.
1780
1781 On some of the questions which ask for file or directory names you are allowed
1782 to use the ~name construct to specify the login directory belonging to "name",
1783 even if you don't have a shell which knows about that.  Questions where this is
1784 allowed will be marked "(~name ok)".
1785
1786 EOH
1787         rp=''
1788         dflt='Type carriage return to continue'
1789         . ./myread
1790         cat <<'EOH'
1791
1792 The prompter used in this script allows you to use shell variables and
1793 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1794 in the default answer, as if the default line was a set of arguments given to a
1795 script shell.  This means you may also use $* to repeat the whole default line,
1796 so you do not have to re-type everything to add something to the default.
1797
1798 Everytime there is a substitution, you will have to confirm.  If there is an
1799 error (e.g. an unmatched backtick), the default answer will remain unchanged
1800 and you will be prompted again.
1801
1802 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1803 the questions and use the computed defaults (or the previous answers if there
1804 was already a config.sh file). Type 'Configure -h' for a list of options.
1805 You may also start interactively and then answer '& -d' at any prompt to turn
1806 on the non-interactive behaviour for the remainder of the execution.
1807
1808 EOH
1809         . ./myread
1810         cat <<EOH
1811
1812 Much effort has been expended to ensure that this shell script will run on any
1813 Unix system.  If despite that it blows up on yours, your best bet is to edit
1814 Configure and run it again.  If you can't run Configure for some reason,
1815 you'll have to generate a config.sh file by hand.  Whatever problems you
1816 have, let me (perlbug@perl.com) know how I blew it.
1817
1818 This installation script affects things in two ways:
1819
1820 1) it may do direct variable substitutions on some of the files included
1821    in this kit.
1822 2) it builds a config.h file for inclusion in C programs.  You may edit
1823    any of these files as the need arises after running this script.
1824
1825 If you make a mistake on a question, there is no easy way to back up to it
1826 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1827 files.  Configure will offer to let you do this before it runs the SH files.
1828
1829 EOH
1830         dflt='Type carriage return to continue'
1831         . ./myread
1832         case "$firsttime" in
1833         true) echo $user >>../.config/instruct;;
1834         esac
1835 fi
1836
1837 : find out where common programs are
1838 echo " "
1839 echo "Locating common programs..." >&4
1840 cat <<EOSC >loc
1841 $startsh
1842 case \$# in
1843 0) exit 1;;
1844 esac
1845 thing=\$1
1846 shift
1847 dflt=\$1
1848 shift
1849 for dir in \$*; do
1850         case "\$thing" in
1851         .)
1852         if test -d \$dir/\$thing; then
1853                 echo \$dir
1854                 exit 0
1855         fi
1856         ;;
1857         *)
1858         for thisthing in \$dir/\$thing; do
1859                 : just loop through to pick last item
1860         done
1861         if test -f \$thisthing; then
1862                 echo \$thisthing
1863                 exit 0
1864         elif test -f \$dir/\$thing.exe; then
1865                 if test -n "$DJGPP"; then
1866                         echo \$dir/\$thing.exe
1867                 else
1868                         : on Eunice apparently
1869                         echo \$dir/\$thing
1870                 fi
1871                 exit 0
1872         fi
1873         ;;
1874         esac
1875 done
1876 echo \$dflt
1877 exit 1
1878 EOSC
1879 chmod +x loc
1880 $eunicefix loc
1881 loclist="
1882 awk
1883 cat
1884 comm
1885 cp
1886 echo
1887 expr
1888 grep
1889 ls
1890 make
1891 mkdir
1892 rm
1893 sed
1894 sort
1895 touch
1896 tr
1897 uniq
1898 "
1899 trylist="
1900 Mcc
1901 ar
1902 byacc
1903 cpp
1904 csh
1905 date
1906 egrep
1907 gzip
1908 less
1909 ln
1910 more
1911 nm
1912 nroff
1913 pg
1914 test
1915 uname
1916 zip
1917 "
1918 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1919 pth="$pth /lib /usr/lib"
1920 for file in $loclist; do
1921         eval xxx=\$$file
1922         case "$xxx" in
1923         /*|?:[\\/]*)
1924                 if test -f "$xxx"; then
1925                         : ok
1926                 else
1927                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1928                         xxx=`./loc $file $file $pth`
1929                 fi
1930                 ;;
1931         '') xxx=`./loc $file $file $pth`;;
1932         *) xxx=`./loc $xxx $xxx $pth`;;
1933         esac
1934         eval $file=$xxx
1935         eval _$file=$xxx
1936         case "$xxx" in
1937         /*)
1938                 echo $file is in $xxx.
1939                 ;;
1940         ?:[\\/]*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         *)
1944                 echo "I don't know where '$file' is, and my life depends on it." >&4
1945                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1946                 exit 1
1947                 ;;
1948         esac
1949 done
1950 echo " "
1951 echo "Don't worry if any of the following aren't found..."
1952 say=offhand
1953 for file in $trylist; do
1954         eval xxx=\$$file
1955         case "$xxx" in
1956         /*|?:[\\/]*)
1957                 if test -f "$xxx"; then
1958                         : ok
1959                 else
1960                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1961                         xxx=`./loc $file $file $pth`
1962                 fi
1963                 ;;
1964         '') xxx=`./loc $file $file $pth`;;
1965         *) xxx=`./loc $xxx $xxx $pth`;;
1966         esac
1967         eval $file=$xxx
1968         eval _$file=$xxx
1969         case "$xxx" in
1970         /*)
1971                 echo $file is in $xxx.
1972                 ;;
1973         ?:[\\/]*)
1974                 echo $file is in $xxx.
1975                 ;;
1976         *)
1977                 echo "I don't see $file out there, $say."
1978                 say=either
1979                 ;;
1980         esac
1981 done
1982 case "$egrep" in
1983 egrep)
1984         echo "Substituting grep for egrep."
1985         egrep=$grep
1986         ;;
1987 esac
1988 case "$ln" in
1989 ln)
1990         echo "Substituting cp for ln."
1991         ln=$cp
1992         ;;
1993 esac
1994 case "$test" in
1995 test)
1996         echo "Hopefully test is built into your sh."
1997         ;;
1998 *)
1999         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2000                 echo "Using the test built into your sh."
2001                 test=test
2002                 _test=test
2003         fi
2004         ;;
2005 esac
2006 case "$echo" in
2007 echo)
2008         echo "Hopefully echo is built into your sh."
2009         ;;
2010 '') ;;
2011 *)
2012         echo " "
2013 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2014         $echo $n "hi there$c" >foo1
2015         echo $n "hi there$c" >foo2
2016         if cmp foo1 foo2 >/dev/null 2>&1; then
2017                 echo "They are compatible.  In fact, they may be identical."
2018         else
2019                 case "$n" in
2020                 '-n') n='' c='\c';;
2021                 *) n='-n' c='';;
2022                 esac
2023                 cat <<FOO
2024 They are not compatible!  You are probably running ksh on a non-USG system.
2025 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2026 have echo built in and we may have to run some Bourne shell scripts.  That
2027 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2028
2029 FOO
2030                 $echo $n "The star should be here-->$c"
2031                 $echo "*"
2032         fi
2033         $rm -f foo1 foo2
2034         ;;
2035 esac
2036
2037 cat <<EOS >checkcc
2038 $startsh
2039 EOS
2040 cat <<'EOSC' >>checkcc
2041 case "$cc" in
2042 '') ;;
2043 *)  $rm -f try try.*
2044     $cat >try.c <<EOM
2045 int main(int argc, char *argv[]) {
2046   return 0;
2047 }
2048 EOM
2049     if $cc -o try try.c; then
2050        :
2051     else
2052         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2053         despair=yes
2054         trygcc=yes
2055         case "$cc" in
2056         *gcc*) trygcc=no ;;
2057         esac
2058         case "`$cc -v -c try.c 2>&1`" in
2059         *gcc*) trygcc=no ;;
2060         esac
2061         if $test X"$trygcc" = Xyes; then
2062             if gcc -o try -c try.c; then
2063                 echo " "
2064                 echo "You seem to have a working gcc, though." >&4
2065                 rp="Would you like to use it?"
2066                 dflt=y
2067                 if $test -f myread; then
2068                     . ./myread
2069                 else
2070                     if $test -f UU/myread; then
2071                         . ./UU/myread
2072                     else
2073                         echo "Cannot find myread, sorry.  Aborting." >&2
2074                         exit 1
2075                     fi
2076                 fi  
2077                 case "$ans" in
2078                 [yY]*) cc=gcc; ccflags=''; despair=no ;;
2079                 esac
2080             fi
2081         fi
2082         if $test X"$despair" = Xyes; then
2083             echo "You need to find a working C compiler." >&4
2084             echo "I cannot continue any further, aborting." >&4
2085             exit 1
2086         fi
2087     fi
2088     $rm -f try try.*
2089     ;;
2090 esac
2091 EOSC
2092
2093 : determine whether symbolic links are supported
2094 echo " "
2095 $touch blurfl
2096 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2097         echo "Symbolic links are supported." >&4
2098         lns="$ln -s"
2099 else
2100         echo "Symbolic links are NOT supported." >&4
2101         lns="$ln"
2102 fi
2103 $rm -f blurfl sym
2104
2105 : see whether [:lower:] and [:upper:] are supported character classes
2106 echo " "
2107 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2108 ABYZ)
2109         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2110         up='[:upper:]'
2111         low='[:lower:]'
2112         ;;
2113 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2114         # (0xc9 and 0xd1), therefore that is a nice testing point.
2115         if test "X$up" = X -o "X$low" = X; then
2116             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2117             ij) up='[A-Z]'
2118                 low='[a-z]'
2119                 ;;
2120             esac
2121         fi
2122         if test "X$up" = X -o "X$low" = X; then
2123             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2124             ij) up='A-Z'
2125                 low='a-z'
2126                 ;;
2127             esac
2128         fi
2129         if test "X$up" = X -o "X$low" = X; then
2130             case "`echo IJ | od -x 2>/dev/null`" in
2131             *C9D1*|*c9d1*)
2132                 echo "Hey, this might be EBCDIC." >&4
2133                 if test "X$up" = X -o "X$low" = X; then
2134                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2135                     ij) up='[A-IJ-RS-Z]'
2136                         low='[a-ij-rs-z]'
2137                         ;;
2138                     esac
2139                 fi
2140                 if test "X$up" = X -o "X$low" = X; then
2141                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2142                     ij) up='A-IJ-RS-Z'
2143                         low='a-ij-rs-z'
2144                         ;;
2145                     esac
2146                 fi
2147                 ;;
2148             esac
2149         fi
2150 esac
2151 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2152 ij)
2153     echo "Using $up and $low to convert case." >&4
2154     ;;
2155 *)
2156     echo "I don't know how to translate letters from upper to lower case." >&4
2157     echo "Your tr is not acting any way I know of." >&4
2158     exit 1
2159     ;;
2160 esac
2161 : set up the translation script tr, must be called with ./tr of course
2162 cat >tr <<EOSC
2163 $startsh
2164 case "\$1\$2" in
2165 '[A-Z][a-z]') exec $tr '$up' '$low';;
2166 '[a-z][A-Z]') exec $tr '$low' '$up';;
2167 esac
2168 exec $tr "\$@"
2169 EOSC
2170 chmod +x tr
2171 $eunicefix tr
2172
2173 : Try to determine whether config.sh was made on this system
2174 case "$config_sh" in
2175 '')
2176 myuname=`$uname -a 2>/dev/null`
2177 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2178 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2179 # because the A-Z/a-z are not consecutive.
2180 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2181         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2182 newmyuname="$myuname"
2183 dflt=n
2184 case "$knowitall" in
2185 '')
2186         if test -f ../config.sh; then
2187                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2188                         eval "`grep myuname= ../config.sh`"
2189                 fi
2190                 if test "X$myuname" = "X$newmyuname"; then
2191                         dflt=y
2192                 fi
2193         fi
2194         ;;
2195 *) dflt=y;;
2196 esac
2197
2198 : Get old answers from old config file if Configure was run on the
2199 : same system, otherwise use the hints.
2200 hint=default
2201 cd ..
2202 if test -f config.sh; then
2203         echo " "
2204         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2205         . UU/myread
2206         case "$ans" in
2207         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2208         *)  echo "Fetching default answers from your old config.sh file..." >&4
2209                 tmp_n="$n"
2210                 tmp_c="$c"
2211                 tmp_sh="$sh"
2212                 . ./config.sh
2213                 cp config.sh UU
2214                 n="$tmp_n"
2215                 c="$tmp_c"
2216                 : Older versions did not always set $sh.  Catch re-use of such
2217                 : an old config.sh.
2218                 case "$sh" in
2219                 '') sh="$tmp_sh" ;;
2220                 esac
2221                 hint=previous
2222                 ;;
2223         esac
2224 fi
2225 . ./UU/checkcc
2226 if test ! -f config.sh; then
2227         $cat <<EOM
2228
2229 First time through, eh?  I have some defaults handy for some systems
2230 that need some extra help getting the Configure answers right:
2231
2232 EOM
2233         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2234         dflt=''
2235         : Half the following guesses are probably wrong... If you have better
2236         : tests or hints, please send them to perlbug@perl.com
2237         : The metaconfig authors would also appreciate a copy...
2238         $test -f /irix && osname=irix
2239         $test -f /xenix && osname=sco_xenix
2240         $test -f /dynix && osname=dynix
2241         $test -f /dnix && osname=dnix
2242         $test -f /lynx.os && osname=lynxos
2243         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2244         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2245         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2246         $test -f /bin/mips && /bin/mips && osname=mips
2247         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2248                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2249         $test -d /usr/apollo/bin && osname=apollo
2250         $test -f /etc/saf/_sactab && osname=svr4
2251         $test -d /usr/include/minix && osname=minix
2252         if $test -d /MachTen -o -d /MachTen_Folder; then
2253                 osname=machten
2254                 if $test -x /sbin/version; then
2255                         osvers=`/sbin/version | $awk '{print $2}' |
2256                         $sed -e 's/[A-Za-z]$//'`
2257                 elif $test -x /usr/etc/version; then
2258                         osvers=`/usr/etc/version | $awk '{print $2}' |
2259                         $sed -e 's/[A-Za-z]$//'`
2260                 else
2261                         osvers="$2.$3"
2262                 fi
2263         fi
2264
2265         $test -f /sys/posix.dll &&
2266                 $test -f /usr/bin/what &&
2267                 set X `/usr/bin/what /sys/posix.dll` &&
2268                 $test "$3" = UWIN &&
2269                 osname=uwin &&
2270                 osvers="$5"
2271
2272         if $test -f $uname; then
2273                 set X $myuname
2274                 shift
2275
2276                 case "$5" in
2277                 fps*) osname=fps ;;
2278                 mips*)
2279                         case "$4" in
2280                         umips) osname=umips ;;
2281                         *) osname=mips ;;
2282                         esac;;
2283                 [23]100) osname=mips ;;
2284                 next*) osname=next ;;
2285                 i386*)
2286                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2287                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2288                                 osname='sco'
2289                                 osvers=$tmp
2290                         elif $test -f /etc/kconfig; then
2291                                 osname=isc
2292                                 if test "$lns" = "$ln -s"; then
2293                                         osvers=4
2294                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2295                                         osvers=3
2296                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2297                                         osvers=2
2298                                 fi
2299                         fi
2300                         tmp=''
2301                         ;;
2302                 pc*)
2303                         if test -n "$DJGPP"; then
2304                                 osname=dos
2305                                 osvers=djgpp
2306                         fi
2307                         ;;
2308                 esac
2309
2310                 case "$1" in
2311                 aix) osname=aix
2312                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2313                         case "$tmp" in
2314                         'not found') osvers="$4"."$3" ;;
2315                         '<3240'|'<>3240') osvers=3.2.0 ;;
2316                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2317                         '=3250'|'>3250') osvers=3.2.5 ;;
2318                         *) osvers=$tmp;;
2319                         esac
2320                         ;;
2321                 bsd386) osname=bsd386
2322                         osvers=`$uname -r`
2323                         ;;
2324                 cygwin*) osname=cygwin
2325                         osvers="$3"
2326                         ;;
2327                 *dc.osx) osname=dcosx
2328                         osvers="$3"
2329                         ;;
2330                 dnix) osname=dnix
2331                         osvers="$3"
2332                         ;;
2333                 domainos) osname=apollo
2334                         osvers="$3"
2335                         ;;
2336                 dgux) osname=dgux 
2337                         osvers="$3"
2338                         ;;
2339                 dynixptx*) osname=dynixptx
2340                         osvers=`echo "$4"|sed 's/^v//'`
2341                         ;;
2342                 freebsd) osname=freebsd 
2343                         osvers="$3" ;;
2344                 genix) osname=genix ;;
2345                 hp*) osname=hpux 
2346                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2347                         ;;
2348                 irix*) osname=irix
2349                         case "$3" in
2350                         4*) osvers=4 ;;
2351                         5*) osvers=5 ;;
2352                         *)      osvers="$3" ;;
2353                         esac
2354                         ;;
2355                 linux) osname=linux
2356                         case "$3" in
2357                         *)      osvers="$3" ;;
2358                         esac
2359                         ;;
2360                 MiNT) osname=mint
2361                         ;;
2362                 netbsd*) osname=netbsd
2363                         osvers="$3"
2364                         ;;
2365                 news-os) osvers="$3"
2366                         case "$3" in
2367                         4*) osname=newsos4 ;;
2368                         *) osname=newsos ;;
2369                         esac
2370                         ;;
2371                 next*) osname=next ;;
2372                 POSIX-BC | posix-bc ) osname=posix-bc
2373                         osvers="$3"
2374                         ;;
2375                 powerux | power_ux | powermax_os | powermaxos | \
2376                 powerunix | power_unix) osname=powerux
2377                         osvers="$3"
2378                         ;;
2379                 qnx) osname=qnx
2380                         osvers="$4"
2381                         ;;
2382                 solaris) osname=solaris
2383                         case "$3" in
2384                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2385                         *)      osvers="$3" ;;
2386                         esac
2387                         ;;
2388                 sunos) osname=sunos
2389                         case "$3" in
2390                         5*) osname=solaris
2391                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2392                         *)      osvers="$3" ;;
2393                         esac
2394                         ;;
2395                 titanos) osname=titanos
2396                         case "$3" in
2397                         1*) osvers=1 ;;
2398                         2*) osvers=2 ;;
2399                         3*) osvers=3 ;;
2400                         4*) osvers=4 ;;
2401                         *)      osvers="$3" ;;
2402                         esac
2403                         ;;
2404                 ultrix) osname=ultrix
2405                         osvers="$3"
2406                         ;;
2407                 osf1|mls+)      case "$5" in
2408                                 alpha)
2409                                         osname=dec_osf
2410                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2411                                         case "$osvers" in
2412                                         [1-9].[0-9]*) ;;
2413                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2414                                         esac
2415                                         ;;
2416                         hp*)    osname=hp_osf1  ;;
2417                         mips)   osname=mips_osf1 ;;
2418                         esac
2419                         ;;
2420                 unixware) osname=svr5
2421                         osvers="$4"
2422                         ;;
2423                 uts) osname=uts
2424                         osvers="$3"
2425                         ;;
2426                 $2) case "$osname" in
2427                         *isc*) ;;
2428                         *freebsd*) ;;
2429                         svr*)
2430                                 : svr4.x or possibly later
2431                                 case "svr$3" in 
2432                                 ${osname}*)
2433                                         osname=svr$3
2434                                         osvers=$4
2435                                         ;;
2436                                 esac
2437                                 case "$osname" in
2438                                 svr4.0)
2439                                         : Check for ESIX
2440                                         if test -f /stand/boot ; then
2441                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2442                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2443                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2444                                                         if test -n "$isesix"; then
2445                                                                 osname=esix4
2446                                                         fi
2447                                                 fi
2448                                         fi
2449                                         ;;
2450                                 esac
2451                                 ;;
2452                         *)      if test -f /etc/systemid; then
2453                                         osname=sco
2454                                         set `echo $3 | $sed 's/\./ /g'` $4
2455                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2456                                                 osvers=$1.$2.$3
2457                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2458                                                 osvers=$1.$2
2459                                         elif $test -f $src/hints/sco_$1.sh; then
2460                                                 osvers=$1
2461                                         fi
2462                                 else
2463                                         case "$osname" in
2464                                         '') : Still unknown.  Probably a generic Sys V.
2465                                                 osname="sysv"
2466                                                 osvers="$3"
2467                                                 ;;
2468                                         esac
2469                                 fi
2470                                 ;;
2471                         esac
2472                         ;;
2473                 *)      case "$osname" in
2474                         '') : Still unknown.  Probably a generic BSD.
2475                                 osname="$1"
2476                                 osvers="$3"
2477                                 ;;
2478                         esac
2479                         ;;
2480                 esac
2481         else
2482                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2483                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2484                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2485                                 osname=news_os
2486                         fi
2487                         $rm -f UU/kernel.what
2488                 elif test -d c:/.; then
2489                         set X $myuname
2490                         osname=os2
2491                         osvers="$5"
2492                 fi
2493         fi
2494         
2495         : Now look for a hint file osname_osvers, unless one has been
2496         : specified already.
2497         case "$hintfile" in
2498         ''|' ')
2499                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2500                 : Also try without trailing minor version numbers.
2501                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2502                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2503                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2504                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2505                 case "$file" in
2506                 '') dflt=none ;;
2507                 *)  case "$osvers" in
2508                         '') dflt=$file
2509                                 ;;
2510                         *)  if $test -f $src/hints/$file.sh ; then
2511                                         dflt=$file
2512                                 elif $test -f $src/hints/$xfile.sh ; then
2513                                         dflt=$xfile
2514                                 elif $test -f $src/hints/$xxfile.sh ; then
2515                                         dflt=$xxfile
2516                                 elif $test -f $src/hints/$xxxfile.sh ; then
2517                                         dflt=$xxxfile
2518                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2519                                         dflt=$xxxxfile
2520                                 elif $test -f "$src/hints/${osname}.sh" ; then
2521                                         dflt="${osname}"
2522                                 else
2523                                         dflt=none
2524                                 fi
2525                                 ;;
2526                         esac
2527                         ;;
2528                 esac
2529                 if $test -f Policy.sh ; then
2530                         case "$dflt" in
2531                         *Policy*) ;;
2532                         none) dflt="Policy" ;;
2533                         *) dflt="Policy $dflt" ;;
2534                         esac
2535                 fi
2536                 ;;
2537         *)
2538                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2539                 ;;
2540         esac
2541
2542         if $test -f Policy.sh ; then
2543                 $cat <<EOM
2544
2545 There's also a Policy hint file available, which should make the
2546 site-specific (policy) questions easier to answer.
2547 EOM
2548
2549         fi
2550
2551         $cat <<EOM
2552
2553 You may give one or more space-separated answers, or "none" if appropriate.
2554 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2555 is a good thing.  DO NOT give a wrong version or a wrong OS.
2556
2557 EOM
2558
2559         rp="Which of these apply, if any?"
2560         . UU/myread
2561         tans=$ans
2562         for file in $tans; do
2563                 if $test X$file = XPolicy -a -f Policy.sh; then
2564                         . Policy.sh
2565                         $cat Policy.sh >> UU/config.sh
2566                 elif $test -f $src/hints/$file.sh; then
2567                         . $src/hints/$file.sh
2568                         $cat $src/hints/$file.sh >> UU/config.sh
2569                 elif $test X$tans = X -o X$tans = Xnone ; then
2570                         : nothing
2571                 else
2572                         : Give one chance to correct a possible typo.
2573                         echo "$file.sh does not exist"
2574                         dflt=$file
2575                         rp="hint to use instead?"
2576                         . UU/myread
2577                         for file in $ans; do
2578                                 if $test -f "$src/hints/$file.sh"; then
2579                                         . $src/hints/$file.sh
2580                                         $cat $src/hints/$file.sh >> UU/config.sh
2581                                 elif $test X$ans = X -o X$ans = Xnone ; then
2582                                         : nothing
2583                                 else
2584                                         echo "$file.sh does not exist -- ignored."
2585                                 fi
2586                         done
2587                 fi
2588         done
2589
2590         hint=recommended
2591         : Remember our hint file for later.
2592         if $test -f "$src/hints/$file.sh" ; then
2593                 hintfile="$file"
2594         else
2595                 hintfile=''
2596         fi
2597 fi
2598 cd UU
2599 ;;
2600 *)
2601         echo " "
2602         echo "Fetching default answers from $config_sh..." >&4
2603         tmp_n="$n"
2604         tmp_c="$c"
2605         cd ..
2606         cp $config_sh config.sh 2>/dev/null
2607         chmod +w config.sh
2608         . ./config.sh
2609         cd UU
2610         cp ../config.sh .
2611         n="$tmp_n"
2612         c="$tmp_c"
2613         hint=previous
2614         ;;
2615 esac
2616 test "$override" && . ./optdef.sh
2617 myuname="$newmyuname"
2618
2619 : Restore computed paths
2620 for file in $loclist $trylist; do
2621         eval $file="\$_$file"
2622 done
2623
2624 cat << EOM
2625
2626 Configure uses the operating system name and version to set some defaults.
2627 The default value is probably right if the name rings a bell. Otherwise,
2628 since spelling matters for me, either accept the default or answer "none"
2629 to leave it blank.
2630
2631 EOM
2632 case "$osname" in
2633         ''|' ')
2634                 case "$hintfile" in
2635                 ''|' '|none) dflt=none ;;
2636                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2637                 esac
2638                 ;;
2639         *) dflt="$osname" ;;
2640 esac
2641 rp="Operating system name?"
2642 . ./myread
2643 case "$ans" in
2644 none)  osname='' ;;
2645 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2646 esac
2647 echo " "
2648 case "$osvers" in
2649         ''|' ')
2650                 case "$hintfile" in
2651                 ''|' '|none) dflt=none ;;
2652                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2653                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2654                         case "$dflt" in
2655                         ''|' ') dflt=none ;;
2656                         esac
2657                         ;;
2658                 esac
2659                 ;;
2660         *) dflt="$osvers" ;;
2661 esac
2662 rp="Operating system version?"
2663 . ./myread
2664 case "$ans" in
2665 none)  osvers='' ;;
2666 *) osvers="$ans" ;;
2667 esac
2668
2669
2670 . ./posthint.sh
2671
2672 : who configured the system
2673 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2674 cf_by=`(logname) 2>/dev/null`
2675 case "$cf_by" in
2676 "")
2677         cf_by=`(whoami) 2>/dev/null`
2678         case "$cf_by" in
2679         "") cf_by=unknown ;;
2680         esac ;;
2681 esac
2682
2683 : set up the script used to warn in case of inconsistency
2684 cat <<EOS >whoa
2685 $startsh
2686 EOS
2687 cat <<'EOSC' >>whoa
2688 dflt=y
2689 echo " "
2690 echo "*** WHOA THERE!!! ***" >&4
2691 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2692 rp="    Keep the $hint value?"
2693 . ./myread
2694 case "$ans" in
2695 y) td=$was; tu=$was;;
2696 esac
2697 EOSC
2698
2699 : function used to set $1 to $val
2700 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2701 case "$val$was" in
2702 $define$undef) . ./whoa; eval "$var=\$td";;
2703 $undef$define) . ./whoa; eval "$var=\$tu";;
2704 *) eval "$var=$val";;
2705 esac'
2706
2707 case "$usethreads" in
2708 $define|true|[yY]*)     dflt='y';;
2709 *) dflt='n';;
2710 esac
2711 cat <<EOM
2712
2713 Perl can be built to take advantage of threads on some systems.
2714 To do so, Configure can be run with -Dusethreads.
2715
2716 Note that threading is a highly experimental feature, and
2717 some known race conditions still remain.  If you choose to try
2718 it, be very sure to not actually deploy it for production
2719 purposes.  README.threads has more details, and is required
2720 reading if you enable threads.
2721
2722 If this doesn't make any sense to you, just accept the default '$dflt'.
2723 EOM
2724 rp='Build a threading Perl?'
2725 . ./myread
2726 case "$ans" in
2727 y|Y)    val="$define" ;;
2728 *)      val="$undef" ;;
2729 esac
2730 set usethreads
2731 eval $setvar
2732
2733 case "$usethreads" in
2734 $define)
2735         $cat <<EOM
2736
2737 As of 5.5.640, Perl has two different internal threading implementations,
2738 the 5.005 version (5005threads) and an interpreter-based version
2739 (ithreads) that has one interpreter per thread.  Both are very 
2740 experimental.  This arrangement exists to help developers work out
2741 which one is better.
2742
2743 If you're a casual user, you probably don't want interpreter-threads
2744 at this time.  There doesn't yet exist a way to create threads from
2745 within Perl in this model, i.e., "use Thread;" will NOT work.
2746 EOM
2747         : Default to ithreads unless overridden on command line or with
2748         : old config.sh
2749         dflt='y'
2750         case "$use5005threads" in
2751                 $define|true|[yY]*) dflt='n';;
2752         esac
2753         case "$useithreads" in
2754                 $undef|false|[nN]*) dflt='n';;
2755         esac
2756         rp='Use interpreter-based ithreads?'
2757         . ./myread
2758         case "$ans" in
2759         y|Y)    val="$define" ;;
2760         *)      val="$undef" ;;
2761         esac
2762         set useithreads
2763         eval $setvar
2764         : Now set use5005threads to the opposite value.
2765         case "$useithreads" in
2766         $define) val="$undef" ;;
2767         *) val="$define" ;;
2768         esac
2769         set use5005threads
2770         eval $setvar
2771         ;;
2772 *)
2773         useithreads="$undef"
2774         use5005threads="$undef"
2775         ;;
2776 esac
2777
2778 case "$d_oldpthreads" in
2779 '')     : Configure tests would be welcome here.  For now, assume undef.
2780         val="$undef" ;;
2781 *)      val="$d_oldpthreads" ;;
2782 esac
2783 set d_oldpthreads
2784 eval $setvar
2785
2786
2787 case "$usethreads" in
2788 "$define"|true|[yY]*)
2789 : Look for a hint-file generated 'call-back-unit'.  If the
2790 : user has specified that a threading perl is to be built,
2791 : we may need to set or change some other defaults.
2792         if $test -f usethreads.cbu; then
2793                 echo "Your platform has some specific hints for threaded builds, using them..."
2794                 . ./usethreads.cbu
2795         else
2796                 $cat <<EOM
2797 (Your platform doesn't have any specific hints for threaded builds.
2798  Assuming POSIX threads, then.)
2799 EOM
2800         fi
2801         ;;
2802 esac
2803
2804 cat <<EOM
2805
2806 Perl can be built so that multiple Perl interpreters can coexist
2807 within the same Perl executable.
2808 EOM
2809
2810 case "$useithreads" in
2811 $define)
2812         cat <<EOM
2813 This multiple interpreter support is required for interpreter-based threads.
2814 EOM
2815         val="$define"
2816         ;;
2817 *)      case "$usemultiplicity" in
2818         $define|true|[yY]*)     dflt='y';;
2819         *) dflt='n';;
2820         esac
2821         echo " "
2822         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2823         rp='Build Perl for multiplicity?'
2824         . ./myread
2825         case "$ans" in
2826         y|Y)    val="$define" ;;
2827         *)      val="$undef" ;;
2828         esac
2829         ;;
2830 esac
2831 set usemultiplicity
2832 eval $setvar
2833
2834 : determine where manual pages are on this system
2835 echo " "
2836 case "$sysman" in
2837 '') 
2838         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2839         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2840         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2841         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2842         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2843         sysman=`./loc . /usr/man/man1 $syspath`
2844         ;;
2845 esac
2846 if $test -d "$sysman"; then
2847         echo "System manual is in $sysman." >&4
2848 else
2849         echo "Could not find manual pages in source form." >&4
2850 fi
2851
2852 : see what memory models we can support
2853 case "$models" in
2854 '')
2855         $cat >pdp11.c <<'EOP'
2856 int main() {
2857 #ifdef pdp11
2858         exit(0);
2859 #else
2860         exit(1);
2861 #endif
2862 }
2863 EOP
2864         case "$cc" in
2865         '') modelcc="$cc" ;;
2866         *) modelcc="cc" ;;
2867         esac
2868         ( $modelcc -o pdp11 pdp11.c ) >/dev/null 2>&1
2869         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2870                 dflt='unsplit split'
2871         else
2872                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2873                 case "$tans" in
2874                 X) dflt='none';;
2875                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2876                                 dflt='small'
2877                         else
2878                                 dflt=''
2879                         fi
2880                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2881                                 dflt="$dflt medium"
2882                         fi
2883                         if $test -d /lib/large || $test -d /usr/lib/large; then
2884                                 dflt="$dflt large"
2885                         fi
2886                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2887                                 dflt="$dflt huge"
2888                         fi
2889                 esac
2890         fi;;
2891 *) dflt="$models";;
2892 esac
2893 $cat <<EOM
2894  
2895 Some systems have different model sizes.  On most systems they are called
2896 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2897 split.  If your system doesn't support different memory models, say "none".
2898 If you wish to force everything to one memory model, say "none" here and
2899 put the appropriate flags later when it asks you for other cc and ld flags.
2900 Venix systems may wish to put "none" and let the compiler figure things out.
2901 (In the following question multiple model names should be space separated.)
2902
2903 The default for most systems is "none".
2904
2905 EOM
2906 rp="Which memory models are supported?"
2907 . ./myread
2908 models="$ans"
2909
2910 case "$models" in
2911 none)
2912         small=''
2913         medium=''
2914         large=''
2915         huge=''
2916         unsplit=''
2917         split=''
2918         ;;
2919 *split)
2920         case "$split" in
2921         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2922                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2923                         dflt='-i'
2924                 else
2925                         dflt='none'
2926                 fi;;
2927         *) dflt="$split";;
2928         esac
2929         rp="What flag indicates separate I and D space?"
2930         . ./myread
2931         tans="$ans"
2932         case "$tans" in
2933         none) tans='';;
2934         esac
2935         split="$tans"
2936         unsplit='';;
2937 *large*|*small*|*medium*|*huge*)
2938         case "$models" in
2939         *large*)
2940                 case "$large" in
2941                 '') dflt='-Ml';;
2942                 *) dflt="$large";;
2943                 esac
2944         rp="What flag indicates large model?"
2945         . ./myread
2946         tans="$ans"
2947         case "$tans" in
2948         none) tans='';
2949         esac
2950         large="$tans";;
2951         *) large='';;
2952         esac
2953         case "$models" in
2954         *huge*) case "$huge" in
2955                 '') dflt='-Mh';;
2956                 *) dflt="$huge";;
2957                 esac
2958                 rp="What flag indicates huge model?"
2959                 . ./myread
2960                 tans="$ans"
2961                 case "$tans" in
2962                 none) tans='';
2963                 esac
2964                 huge="$tans";;
2965         *) huge="$large";;
2966         esac
2967         case "$models" in
2968         *medium*) case "$medium" in
2969                 '') dflt='-Mm';;
2970                 *) dflt="$medium";;
2971                 esac
2972                 rp="What flag indicates medium model?"
2973                 . ./myread
2974                 tans="$ans"
2975                 case "$tans" in
2976                 none) tans='';
2977                 esac
2978                 medium="$tans";;
2979         *) medium="$large";;
2980         esac
2981         case "$models" in
2982         *small*) case "$small" in
2983                 '') dflt='none';;
2984                 *) dflt="$small";;
2985                 esac
2986                 rp="What flag indicates small model?"
2987                 . ./myread
2988                 tans="$ans"
2989                 case "$tans" in
2990                 none) tans='';
2991                 esac
2992                 small="$tans";;
2993         *) small='';;
2994         esac
2995         ;;
2996 *)
2997         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2998         ;;
2999 esac
3000 $rm -f pdp11.* pdp11
3001
3002 : make some quick guesses about what we are up against
3003 echo " "
3004 $echo $n "Hmm...  $c"
3005 echo exit 1 >bsd
3006 echo exit 1 >usg
3007 echo exit 1 >v7
3008 echo exit 1 >osf1
3009 echo exit 1 >eunice
3010 echo exit 1 >xenix
3011 echo exit 1 >venix
3012 echo exit 1 >os2
3013 d_bsd="$undef"
3014 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3015 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3016 then
3017         echo "Looks kind of like an OSF/1 system, but we'll see..."
3018         echo exit 0 >osf1
3019 elif test `echo abc | tr a-z A-Z` = Abc ; then
3020         xxx=`./loc addbib blurfl $pth`
3021         if $test -f $xxx; then
3022         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3023                 echo exit 0 >bsd
3024                 echo exit 0 >usg
3025         else
3026                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3027                         echo "Looks kind of like an extended USG system, but we'll see..."
3028                 else
3029                         echo "Looks kind of like a USG system, but we'll see..."
3030                 fi
3031                 echo exit 0 >usg
3032         fi
3033 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3034         echo "Looks kind of like a BSD system, but we'll see..."
3035         d_bsd="$define"
3036         echo exit 0 >bsd
3037 else
3038         echo "Looks kind of like a Version 7 system, but we'll see..."
3039         echo exit 0 >v7
3040 fi
3041 case "$eunicefix" in
3042 *unixtovms*)
3043         $cat <<'EOI'
3044 There is, however, a strange, musty smell in the air that reminds me of
3045 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3046 EOI
3047         echo exit 0 >eunice
3048         d_eunice="$define"
3049 : it so happens the Eunice I know will not run shell scripts in Unix format
3050         ;;
3051 *)
3052         echo " "
3053         echo "Congratulations.  You aren't running Eunice."
3054         d_eunice="$undef"
3055         ;;
3056 esac
3057 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3058 case "$p_" in
3059 :) ;;
3060 *)
3061         $cat <<'EOI'
3062 I have the feeling something is not exactly right, however...don't tell me...
3063 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3064 EOI
3065         echo exit 0 >os2
3066         ;;
3067 esac
3068 if test -f /xenix; then
3069         echo "Actually, this looks more like a XENIX system..."
3070         echo exit 0 >xenix
3071         d_xenix="$define"
3072 else
3073         echo " "
3074         echo "It's not Xenix..."
3075         d_xenix="$undef"
3076 fi
3077 chmod +x xenix
3078 $eunicefix xenix
3079 if test -f /venix; then
3080         echo "Actually, this looks more like a VENIX system..."
3081         echo exit 0 >venix
3082 else
3083         echo " "
3084         if ./xenix; then
3085                 : null
3086         else
3087                 echo "Nor is it Venix..."
3088         fi
3089 fi
3090 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3091 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3092 $rm -f foo
3093
3094 : see if we need a special compiler
3095 echo " "
3096 if ./usg; then
3097         case "$cc" in
3098         '') case "$Mcc" in
3099                 /*) dflt='Mcc';;
3100                 *) case "$large" in
3101                         -M*) dflt='cc';;
3102                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3103                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3104                                                 dflt='cc'
3105                                         else
3106                                                 dflt='cc -M'
3107                                         fi
3108                                 else
3109                                         dflt='cc'
3110                                 fi;;
3111                         esac;;
3112                 esac;;
3113         *)  dflt="$cc";;
3114         esac
3115         case "$dflt" in
3116         *M*)    $cat <<'EOM'
3117 On some older systems the default C compiler will not resolve multiple global
3118 references that happen to have the same name.  On some such systems the "Mcc"
3119 command may be used to force these to be resolved.  On other systems a "cc -M"
3120 command is required.  (Note that the -M flag on other systems indicates a
3121 memory model to use!) If you have the Gnu C compiler, you might wish to use
3122 that instead.
3123
3124 EOM
3125         ;;
3126         esac
3127         rp="Use which C compiler?"
3128         . ./myread
3129         cc="$ans"
3130 else
3131         case "$cc" in
3132         '') dflt=cc;;
3133         *) dflt="$cc";;
3134         esac
3135         rp="Use which C compiler?"
3136         . ./myread
3137         cc="$ans"
3138 fi
3139 : Look for a hint-file generated 'call-back-unit'.  Now that the
3140 : user has specified the compiler, we may need to set or change some
3141 : other defaults.
3142 if $test -f cc.cbu; then
3143     . ./cc.cbu
3144 fi
3145 . ./checkcc
3146
3147 echo " "
3148 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3149 $cat >gccvers.c <<EOM
3150 #include <stdio.h>
3151 int main() {
3152 #ifdef __GNUC__
3153 #ifdef __VERSION__
3154         printf("%s\n", __VERSION__);
3155 #else
3156         printf("%s\n", "1");
3157 #endif
3158 #endif
3159         exit(0);
3160 }
3161 EOM
3162 if $cc $ldflags -o gccvers gccvers.c; then
3163         gccversion=`./gccvers`
3164         case "$gccversion" in
3165         '') echo "You are not using GNU cc." ;;
3166         *)  echo "You are using GNU cc $gccversion."
3167             ;;
3168         esac
3169 else
3170         echo " "
3171         echo "*** WHOA THERE!!! ***" >&4
3172         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3173         case "$knowitall" in
3174         '')
3175         echo "    You'd better start hunting for one and let me know about it." >&4
3176                 exit 1
3177                 ;;
3178         esac
3179 fi
3180 $rm -f gccvers*
3181 case "$gccversion" in
3182 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3183 esac
3184 case "$gccversion" in
3185 '') gccosandvers='' ;;
3186 *) gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed 's!.*/[^-]*-[^-]*-\([^/]*\)/'$gccversion'/specs$!\1!'`
3187    case "$gccosandvers" in
3188    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3189    $osname$osvers) ;; # looking good
3190    $osname*) cat <<EOM >&4
3191
3192 *** WHOA THERE!!! ***
3193
3194     Your gcc has not been compiled for the exact release of
3195     your operating system ($gccosandvers versus $osname$osvers).
3196
3197     In general it is a good idea to keep gcc synchronized with
3198     the operating system because otherwise serious problems
3199     may ensue when trying to compile software, like Perl.
3200
3201     I'm trying to be optimistic here, though, and will continue.
3202     If later during the configuration and build icky compilation
3203     problems appear (headerfile conflicts being the most common
3204     manifestation), I suggest reinstalling the gcc to match
3205     your operating system release.
3206
3207 EOM
3208       ;;
3209    *) gccosandvers='' ;; # failed to parse, better be silent
3210    esac
3211    ;;
3212 esac
3213
3214
3215
3216
3217 : see how we invoke the C preprocessor
3218 echo " "
3219 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3220 cat <<'EOT' >testcpp.c
3221 #define ABC abc
3222 #define XYZ xyz
3223 ABC.XYZ
3224 EOT
3225 cd ..
3226 if test ! -f cppstdin; then
3227         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3228                 # AIX cc -E doesn't show the absolute headerfile
3229                 # locations but we'll cheat by using the -M flag.
3230                 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
3231         else
3232                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3233         fi
3234 else
3235         echo "Keeping your $hint cppstdin wrapper."
3236 fi
3237 chmod 755 cppstdin
3238 wrapper=`pwd`/cppstdin
3239 ok='false'
3240 cd UU
3241
3242 if $test "X$cppstdin" != "X" && \
3243         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3244         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3245 then
3246         echo "You used to use $cppstdin $cppminus so we'll use that again."
3247         case "$cpprun" in
3248         '') echo "But let's see if we can live without a wrapper..." ;;
3249         *)
3250                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3251                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3252                 then
3253                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3254                         ok='true'
3255                 else
3256                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3257                 fi
3258                 ;;
3259         esac
3260 else
3261         case "$cppstdin" in
3262         '') ;;
3263         *)
3264                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3265                 ;;
3266         esac
3267 fi
3268
3269 if $ok; then
3270         : nothing
3271 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3272         $cc -E <testcpp.c >testcpp.out 2>&1; \
3273         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3274         echo "Yup, it does."
3275         x_cpp="$cc -E"
3276         x_minus='';
3277 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3278         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3279         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3280         echo "Yup, it does."
3281         x_cpp="$cc -E"
3282         x_minus='-';
3283 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3284         $cc -P <testcpp.c >testcpp.out 2>&1; \
3285         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3286         echo "Yipee, that works!"
3287         x_cpp="$cc -P"
3288         x_minus='';
3289 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3290         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3291         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3292         echo "At long last!"
3293         x_cpp="$cc -P"
3294         x_minus='-';
3295 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3296         $cpp <testcpp.c >testcpp.out 2>&1; \
3297         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3298         echo "It works!"
3299         x_cpp="$cpp"
3300         x_minus='';
3301 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3302         $cpp - <testcpp.c >testcpp.out 2>&1; \
3303         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3304         echo "Hooray, it works!  I was beginning to wonder."
3305         x_cpp="$cpp"
3306         x_minus='-';
3307 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3308         $wrapper <testcpp.c >testcpp.out 2>&1; \
3309         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3310         x_cpp="$wrapper"
3311         x_minus=''
3312         echo "Eureka!"
3313 else
3314         dflt=''
3315         rp="No dice.  I can't find a C preprocessor.  Name one:"
3316         . ./myread
3317         x_cpp="$ans"
3318         x_minus=''
3319         $x_cpp <testcpp.c >testcpp.out 2>&1
3320         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3321                 echo "OK, that will do." >&4
3322         else
3323 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3324                 exit 1
3325         fi
3326 fi
3327
3328 case "$ok" in
3329 false)
3330         cppstdin="$x_cpp"
3331         cppminus="$x_minus"
3332         cpprun="$x_cpp"
3333         cpplast="$x_minus"
3334         set X $x_cpp
3335         shift
3336         case "$1" in
3337         "$cpp")
3338                 echo "Perhaps can we force $cc -E using a wrapper..."
3339                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3340                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3341                 then
3342                         echo "Yup, we can."
3343                         cppstdin="$wrapper"
3344                         cppminus='';
3345                 else
3346                         echo "Nope, we'll have to live without it..."
3347                 fi
3348                 ;;
3349         esac
3350         case "$cpprun" in
3351         "$wrapper")
3352                 cpprun=''
3353                 cpplast=''
3354                 ;;
3355         esac
3356         ;;
3357 esac
3358
3359 case "$cppstdin" in
3360 "$wrapper"|'cppstdin') ;;
3361 *) $rm -f $wrapper;;
3362 esac
3363 $rm -f testcpp.c testcpp.out
3364
3365 : decide how portable to be.  Allow command line overrides.
3366 case "$d_portable" in
3367 "$undef") ;;
3368 *)      d_portable="$define" ;;
3369 esac
3370
3371 : set up shell script to do ~ expansion
3372 cat >filexp <<EOSS
3373 $startsh
3374 : expand filename
3375 case "\$1" in
3376  ~/*|~)
3377         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3378         ;;
3379  ~*)
3380         if $test -f /bin/csh; then
3381                 /bin/csh -f -c "glob \$1"
3382                 failed=\$?
3383                 echo ""
3384                 exit \$failed
3385         else
3386                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3387                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3388                 if $test ! -d "\$dir"; then
3389                         me=\`basename \$0\`
3390                         echo "\$me: can't locate home directory for: \$name" >&2
3391                         exit 1
3392                 fi
3393                 case "\$1" in
3394                 */*)
3395                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3396                         ;;
3397                 *)
3398                         echo \$dir
3399                         ;;
3400                 esac
3401         fi
3402         ;;
3403 *)
3404         echo \$1
3405         ;;
3406 esac
3407 EOSS
3408 chmod +x filexp
3409 $eunicefix filexp
3410
3411 : now set up to get a file name
3412 cat <<EOS >getfile
3413 $startsh
3414 EOS
3415 cat <<'EOSC' >>getfile
3416 tilde=''
3417 fullpath=''
3418 already=''
3419 skip=''
3420 none_ok=''
3421 exp_file=''
3422 nopath_ok=''
3423 orig_rp="$rp"
3424 orig_dflt="$dflt"
3425 case "$gfpth" in
3426 '') gfpth='.' ;;
3427 esac
3428
3429 case "$fn" in
3430 *\(*)
3431         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3432         fn=`echo $fn | sed 's/(.*)//'`
3433         ;;
3434 esac
3435
3436 case "$fn" in
3437 *:*)
3438         loc_file=`expr $fn : '.*:\(.*\)'`
3439         fn=`expr $fn : '\(.*\):.*'`
3440         ;;
3441 esac
3442
3443 case "$fn" in
3444 *~*) tilde=true;;
3445 esac
3446 case "$fn" in
3447 */*) fullpath=true;;
3448 esac
3449 case "$fn" in
3450 *+*) skip=true;;
3451 esac
3452 case "$fn" in
3453 *n*) none_ok=true;;
3454 esac
3455 case "$fn" in
3456 *e*) exp_file=true;;
3457 esac
3458 case "$fn" in
3459 *p*) nopath_ok=true;;
3460 esac
3461
3462 case "$fn" in
3463 *f*) type='File';;
3464 *d*) type='Directory';;
3465 *l*) type='Locate';;
3466 esac
3467
3468 what="$type"
3469 case "$what" in
3470 Locate) what='File';;
3471 esac
3472
3473 case "$exp_file" in
3474 '')
3475         case "$d_portable" in
3476         "$define") ;;
3477         *) exp_file=true;;
3478         esac
3479         ;;
3480 esac
3481
3482 cd ..
3483 while test "$type"; do
3484         redo=''
3485         rp="$orig_rp"
3486         dflt="$orig_dflt"
3487         case "$tilde" in
3488         true) rp="$rp (~name ok)";;
3489         esac
3490         . UU/myread
3491         if test -f UU/getfile.ok && \
3492                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3493         then
3494                 value="$ans"
3495                 ansexp="$ans"
3496                 break
3497         fi
3498         case "$ans" in
3499         none)
3500                 value=''
3501                 ansexp=''
3502                 case "$none_ok" in
3503                 true) type='';;
3504                 esac
3505                 ;;
3506         *)
3507                 case "$tilde" in
3508                 '') value="$ans"
3509                         ansexp="$ans";;
3510                 *)
3511                         value=`UU/filexp $ans`
3512                         case $? in
3513                         0)
3514                                 if test "$ans" != "$value"; then
3515                                         echo "(That expands to $value on this system.)"
3516                                 fi
3517                                 ;;
3518                         *) value="$ans";;
3519                         esac
3520                         ansexp="$value"
3521                         case "$exp_file" in
3522                         '') value="$ans";;
3523                         esac
3524                         ;;
3525                 esac
3526                 case "$fullpath" in
3527                 true)
3528                         case "$ansexp" in
3529                         /*) value="$ansexp" ;;
3530                         [a-zA-Z]:/*) value="$ansexp" ;;
3531                         *)
3532                                 redo=true
3533                                 case "$already" in
3534                                 true)
3535                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3536                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3537                                         ;;
3538                                 *)
3539                                 echo "Please give a full path name, starting with slash." >&4
3540                                         case "$tilde" in
3541                                         true)
3542                                 echo "Note that using ~name is ok provided it expands well." >&4
3543                                                 already=true
3544                                                 ;;
3545                                         esac
3546                                 esac
3547                                 ;;
3548                         esac
3549                         ;;
3550                 esac
3551                 case "$redo" in
3552                 '')
3553                         case "$type" in
3554                         File)
3555                                 for fp in $gfpth; do
3556                                         if test "X$fp" = X.; then
3557                                             pf="$ansexp"
3558                                         else    
3559                                             pf="$fp/$ansexp"
3560                                         fi
3561                                         if test -f "$pf"; then
3562                                                 type=''
3563                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3564                                         then
3565                                                 echo "($value is not a plain file, but that's ok.)"
3566                                                 type=''
3567                                         fi
3568                                         if test X"$type" = X; then
3569                                             value="$pf"
3570                                             break
3571                                         fi
3572                                 done
3573                                 ;;
3574                         Directory)
3575                                 for fp in $gfpth; do
3576                                         if test "X$fp" = X.; then
3577                                             dir="$ans"
3578                                             direxp="$ansexp"
3579                                         else    
3580                                             dir="$fp/$ansexp"
3581                                             direxp="$fp/$ansexp"
3582                                         fi
3583                                         if test -d "$direxp"; then
3584                                                 type=''
3585                                                 value="$dir"
3586                                                 break
3587                                         fi
3588                                 done
3589                                 ;;
3590                         Locate)
3591                                 if test -d "$ansexp"; then
3592                                         echo "(Looking for $loc_file in directory $value.)"
3593                                         value="$value/$loc_file"
3594                                         ansexp="$ansexp/$loc_file"
3595                                 fi
3596                                 if test -f "$ansexp"; then
3597                                         type=''
3598                                 fi
3599                                 case "$nopath_ok" in
3600                                 true)   case "$value" in
3601                                         */*) ;;
3602                                         *)      echo "Assuming $value will be in people's path."
3603                                                 type=''
3604                                                 ;;
3605                                         esac
3606                                         ;;
3607                                 esac
3608                                 ;;
3609                         esac
3610
3611                         case "$skip" in
3612                         true) type='';
3613                         esac
3614
3615                         case "$type" in
3616                         '') ;;
3617                         *)
3618                                 if test "$fastread" = yes; then
3619                                         dflt=y
3620                                 else
3621                                         dflt=n
3622                                 fi
3623                                 rp="$what $value doesn't exist.  Use that name anyway?"
3624                                 . UU/myread
3625                                 dflt=''
3626                                 case "$ans" in
3627                                 y*) type='';;
3628                                 *) echo " ";;
3629                                 esac
3630                                 ;;
3631                         esac
3632                         ;;
3633                 esac
3634                 ;;
3635         esac
3636 done
3637 cd UU
3638 ans="$value"
3639 rp="$orig_rp"
3640 dflt="$orig_dflt"
3641 rm -f getfile.ok
3642 test "X$gfpthkeep" != Xy && gfpth=""
3643 EOSC
3644
3645 : What should the include directory be ?
3646 echo " "
3647 $echo $n "Hmm...  $c"
3648 dflt='/usr/include'
3649 incpath=''
3650 mips_type=''
3651 if $test -f /bin/mips && /bin/mips; then
3652         echo "Looks like a MIPS system..."
3653         $cat >usr.c <<'EOCP'
3654 #ifdef SYSTYPE_BSD43
3655 /bsd43
3656 #endif
3657 EOCP
3658         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3659                 dflt='/bsd43/usr/include'
3660                 incpath='/bsd43'
3661                 mips_type='BSD 4.3'
3662         else
3663                 mips_type='System V'
3664         fi
3665         $rm -f usr.c usr.out
3666         echo "and you're compiling with the $mips_type compiler and libraries."
3667         xxx_prompt=y
3668         echo "exit 0" >mips
3669 else
3670         echo "Doesn't look like a MIPS system."
3671         xxx_prompt=n
3672         echo "exit 1" >mips
3673 fi
3674 chmod +x mips
3675 $eunicefix mips
3676 case "$usrinc" in
3677 '') ;;
3678 *) dflt="$usrinc";;
3679 esac
3680 case "$xxx_prompt" in
3681 y)      fn=d/
3682         echo " "
3683         rp='Where are the include files you want to use?'
3684         . ./getfile
3685         usrinc="$ans"
3686         ;;
3687 *)      usrinc="$dflt"
3688         ;;
3689 esac
3690
3691 : Set private lib path
3692 case "$plibpth" in
3693 '') if ./mips; then
3694                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3695         fi;;
3696 esac
3697 case "$libpth" in
3698 ' ') dlist='';;
3699 '') dlist="$loclibpth $plibpth $glibpth";;
3700 *) dlist="$libpth";;
3701 esac
3702
3703 : Now check and see which directories actually exist, avoiding duplicates
3704 libpth=''
3705 for xxx in $dlist
3706 do
3707     if $test -d $xxx; then
3708                 case " $libpth " in
3709                 *" $xxx "*) ;;
3710                 *) libpth="$libpth $xxx";;
3711                 esac
3712     fi
3713 done
3714 $cat <<'EOM'
3715
3716 Some systems have incompatible or broken versions of libraries.  Among
3717 the directories listed in the question below, please remove any you
3718 know not to be holding relevant libraries, and add any that are needed.
3719 Say "none" for none.
3720
3721 EOM
3722 case "$libpth" in
3723 '') dflt='none';;
3724 *)
3725         set X $libpth
3726         shift
3727         dflt=${1+"$@"}
3728         ;;
3729 esac
3730 rp="Directories to use for library searches?"
3731 . ./myread
3732 case "$ans" in
3733 none) libpth=' ';;
3734 *) libpth="$ans";;
3735 esac
3736
3737 : compute shared library extension
3738 case "$so" in
3739 '')
3740         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3741                 dflt='sl'
3742         else
3743                 dflt='so'
3744         fi
3745         ;;
3746 *) dflt="$so";;
3747 esac
3748 $cat <<EOM
3749
3750 On some systems, shared libraries may be available.  Answer 'none' if
3751 you want to suppress searching of shared libraries for the remainder
3752 of this configuration.
3753
3754 EOM
3755 rp='What is the file extension used for shared libraries?'
3756 . ./myread
3757 so="$ans"
3758
3759 : Define several unixisms.
3760 : Hints files or command line option can be used to override them.
3761 : The convoluted testing is in case hints files set either the old
3762 : or the new name.
3763 case "$_exe" in
3764 '')     case "$exe_ext" in
3765     '') ;;
3766         *)      _exe="$exe_ext" ;;
3767         esac
3768         ;;
3769 esac
3770 case "$_a" in
3771 '')     case "$lib_ext" in
3772     '') _a='.a';;
3773         *)      _a="$lib_ext" ;;
3774         esac
3775         ;;
3776 esac
3777 case "$_o" in
3778 '') case "$obj_ext" in
3779         '')     _o='.o';;
3780         *)      _o="$obj_ext";;
3781         esac
3782         ;;
3783 esac
3784 case "$p_" in
3785 '') case "$path_sep" in
3786         '')     p_=':';;
3787         *)      p_="$path_sep";;
3788         esac
3789         ;;
3790 esac
3791 exe_ext=$_exe
3792 lib_ext=$_a
3793 obj_ext=$_o
3794 path_sep=$p_
3795
3796 : Which makefile gets called first.  This is used by make depend.
3797 case "$firstmakefile" in
3798 '') firstmakefile='makefile';;
3799 esac
3800
3801 case "$usesocks" in
3802 $define|true|[yY]*)     dflt='y';;
3803 *) dflt='n';;
3804 esac
3805 cat <<EOM
3806
3807 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3808 Configure must be run with -Dusesocks.
3809
3810 If this doesn't make any sense to you, just accept the default '$dflt'.
3811 EOM
3812 rp='Build Perl for SOCKS?'
3813 . ./myread
3814 case "$ans" in
3815 y|Y)    val="$define" ;;     
3816 *)      val="$undef" ;;
3817 esac
3818 set usesocks
3819 eval $setvar
3820
3821 : Looking for optional libraries
3822 echo " "
3823 echo "Checking for optional libraries..." >&4
3824 case "$libs" in
3825 ' '|'') dflt='';;
3826 *) dflt="$libs";;
3827 esac
3828 case "$libswanted" in
3829 '') libswanted='c_s';;
3830 esac
3831 case "$usesocks" in
3832 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3833 esac
3834 libsfound=''
3835 libsfiles=''
3836 libsdirs=''
3837 libspath=''
3838 for thisdir in $libpth $xlibpth; do
3839   test -d $thisdir && libspath="$libspath $thisdir"
3840 done
3841 for thislib in $libswanted; do
3842         for thisdir in $libspath; do
3843             xxx=''
3844             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3845                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3846                 $test -f "$xxx" && eval $libscheck
3847                 $test -f "$xxx" && libstyle=shared
3848             fi
3849             if test ! -f "$xxx"; then
3850                 xxx=$thisdir/lib$thislib.$so
3851                 $test -f "$xxx" && eval $libscheck
3852                 $test -f "$xxx" && libstyle=shared
3853             fi  
3854             if test ! -f "$xxx"; then
3855                 xxx=$thisdir/lib$thislib$_a
3856                 $test -f "$xxx" && eval $libscheck
3857                 $test -f "$xxx" && libstyle=static
3858             fi
3859             if test ! -f "$xxx"; then
3860                 xxx=$thisdir/$thislib$_a
3861                 $test -f "$xxx" && eval $libscheck
3862                 $test -f "$xxx" && libstyle=static
3863             fi
3864             if test ! -f "$xxx"; then
3865                 xxx=$thisdir/lib${thislib}_s$_a
3866                 $test -f "$xxx" && eval $libscheck
3867                 $test -f "$xxx" && libstyle=static
3868                 $test -f "$xxx" && thislib=${thislib}_s
3869             fi
3870             if test ! -f "$xxx"; then
3871                 xxx=$thisdir/Slib$thislib$_a
3872                 $test -f "$xxx" && eval $libscheck
3873                 $test -f "$xxx" && libstyle=static
3874             fi
3875             if $test -f "$xxx"; then
3876                 case "$libstyle" in
3877                 shared) echo "Found -l$thislib (shared)." ;;
3878                 static) echo "Found -l$thislib." ;;
3879                 *)      echo "Found -l$thislib ($libstyle)." ;;
3880                 esac
3881                 case " $dflt " in
3882                 *"-l$thislib "*);;
3883                 *) dflt="$dflt -l$thislib"
3884                    libsfound="$libsfound $xxx"
3885                    yyy=`basename $xxx`
3886                    libsfiles="$libsfiles $yyy"
3887                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3888                    case " $libsdirs " in
3889                    *" $yyy "*) ;;
3890                    *) libsdirs="$libsdirs $yyy" ;;
3891                    esac
3892                    ;;
3893                 esac
3894                 break
3895             fi  
3896         done
3897         if $test ! -f "$xxx"; then
3898             echo "No -l$thislib."
3899         fi
3900 done
3901 set X $dflt
3902 shift
3903 dflt="$*"
3904 case "$libs" in
3905 '') dflt="$dflt";;
3906 *) dflt="$libs";;
3907 esac
3908 case "$dflt" in
3909 ' '|'') dflt='none';;
3910 esac
3911
3912 $cat <<EOM
3913
3914 In order to compile $package on your machine, a number of libraries
3915 are usually needed.  Include any other special libraries here as well.
3916 Say "none" for none.  The default list is almost always right.
3917 EOM
3918
3919 echo " "
3920 rp="What libraries to use?"
3921 . ./myread
3922 case "$ans" in
3923 none) libs=' ';;
3924 *) libs="$ans";;
3925 esac
3926
3927 : determine optimization, if desired, or use for debug flag also
3928 case "$optimize" in
3929 ' '|$undef) dflt='none';;
3930 '') dflt='-O';;
3931 *) dflt="$optimize";;
3932 esac
3933 $cat <<EOH
3934
3935 By default, $package compiles with the -O flag to use the optimizer.
3936 Alternately, you might want to use the symbolic debugger, which uses
3937 the -g flag (on traditional Unix systems).  Either flag can be
3938 specified here.  To use neither flag, specify the word "none".
3939
3940 EOH
3941 rp="What optimizer/debugger flag should be used?"
3942 . ./myread
3943 optimize="$ans"
3944 case "$optimize" in
3945 'none') optimize=" ";;
3946 esac
3947
3948 dflt=''
3949 : We will not override a previous value, but we might want to
3950 : augment a hint file
3951 case "$hint" in
3952 default|recommended)
3953         case "$gccversion" in
3954         1*) dflt='-fpcc-struct-return' ;;
3955         esac
3956         case "$optimize" in
3957         *-g*) dflt="$dflt -DDEBUGGING";;
3958         esac
3959         case "$gccversion" in
3960         2*) if test -d /etc/conf/kconfig.d &&
3961                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3962                 then
3963                         dflt="$dflt -posix"
3964                 fi
3965                 ;;
3966         esac
3967         case "$gccversion" in
3968         1*) ;;
3969         2.[0-8]*) ;;
3970         ?*)     echo " "
3971                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3972                 echo 'int main(void) { return 0; }' > gcctest.c
3973                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3974                         echo "Yes, it does." 2>&1
3975                         case "$ccflags" in
3976                         *strict-aliasing*) 
3977                                 echo "Leaving current flags $ccflags alone." 2>&1
3978                                 ;;
3979                         *) dflt="$dflt -fno-strict-aliasing" ;;
3980                         esac
3981                 else
3982                         echo "Nope, it doesn't, but that's ok." 2>&1
3983                 fi
3984                 ;;
3985         esac
3986         ;;
3987 esac
3988
3989 case "$mips_type" in
3990 *BSD*|'') inclwanted="$locincpth $usrinc";;
3991 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3992 esac
3993 for thisincl in $inclwanted; do
3994         if $test -d $thisincl; then
3995                 if $test x$thisincl != x$usrinc; then
3996                         case "$dflt" in
3997                         *$thisincl*);;
3998                         *) dflt="$dflt -I$thisincl";;
3999                         esac
4000                 fi
4001         fi
4002 done
4003
4004 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4005         xxx=true;
4006 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4007         xxx=true;
4008 else
4009         xxx=false;
4010 fi;
4011 if $xxx; then
4012         case "$dflt" in
4013         *$2*);;
4014         *) dflt="$dflt -D$2";;
4015         esac;
4016 fi'
4017
4018 set signal.h LANGUAGE_C; eval $inctest
4019
4020 case "$usesocks" in
4021 $define)
4022         ccflags="$ccflags -DSOCKS"
4023         ;;
4024 esac
4025
4026 case "$hint" in
4027 default|recommended) dflt="$ccflags $dflt" ;;
4028 *) dflt="$ccflags";;
4029 esac
4030
4031 case "$dflt" in
4032 ''|' ') dflt=none;;
4033 esac
4034 $cat <<EOH
4035
4036 Your C compiler may want other flags.  For this question you should include
4037 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4038 but you should NOT include libraries or ld flags like -lwhatever.  If you
4039 want $package to honor its debug switch, you should include -DDEBUGGING here.
4040 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4041
4042 To use no flags, specify the word "none".
4043
4044 EOH
4045 set X $dflt
4046 shift
4047 dflt=${1+"$@"}
4048 rp="Any additional cc flags?"
4049 . ./myread
4050 case "$ans" in
4051 none) ccflags='';;
4052 *) ccflags="$ans";;
4053 esac
4054
4055 : the following weeds options from ccflags that are of no interest to cpp
4056 cppflags="$ccflags"
4057 case "$gccversion" in
4058 1*) cppflags="$cppflags -D__GNUC__"
4059 esac
4060 case "$mips_type" in
4061 '');;
4062 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4063 esac
4064 case "$cppflags" in
4065 '');;
4066 *)
4067         echo " "
4068         echo "Let me guess what the preprocessor flags are..." >&4
4069         set X $cppflags
4070         shift
4071         cppflags=''
4072         $cat >cpp.c <<'EOM'
4073 #define BLURFL foo
4074
4075 BLURFL xx LFRULB
4076 EOM
4077         previous=''
4078         for flag in $*
4079         do
4080                 case "$flag" in
4081                 -*) ftry="$flag";;
4082                 *) ftry="$previous $flag";;
4083                 esac
4084                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4085                         >cpp1.out 2>/dev/null && \
4086                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4087                         >cpp2.out 2>/dev/null && \
4088                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4089                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4090                 then
4091                         cppflags="$cppflags $ftry"
4092                         previous=''
4093                 else
4094                         previous="$flag"
4095                 fi
4096         done
4097         set X $cppflags
4098         shift
4099         cppflags=${1+"$@"}
4100         case "$cppflags" in
4101         *-*)  echo "They appear to be: $cppflags";;
4102         esac
4103         $rm -f cpp.c cpp?.out
4104         ;;
4105 esac
4106
4107 : flags used in final linking phase
4108 case "$ldflags" in
4109 '') if ./venix; then
4110                 dflt='-i -z'
4111         else
4112                 dflt=''
4113         fi
4114         case "$ccflags" in
4115         *-posix*) dflt="$dflt -posix" ;;
4116         esac
4117         ;;
4118 *) dflt="$ldflags";;
4119 esac
4120
4121 : Try to guess additional flags to pick up local libraries.
4122 for thislibdir in $libpth; do
4123         case " $loclibpth " in
4124         *" $thislibdir "*)
4125                 case "$dflt " in 
4126                 *"-L$thislibdir "*) ;;
4127                 *)  dflt="$dflt -L$thislibdir" ;;
4128                 esac
4129                 ;;
4130         esac
4131 done
4132
4133 case "$dflt" in
4134 '') dflt='none' ;;
4135 esac
4136
4137 $cat <<EOH
4138
4139 Your C linker may need flags.  For this question you should
4140 include -L/whatever and any other flags used by the C linker, but you
4141 should NOT include libraries like -lwhatever.
4142
4143 Make sure you include the appropriate -L/path flags if your C linker
4144 does not normally search all of the directories you specified above,
4145 namely
4146         $libpth
4147 To use no flags, specify the word "none".
4148
4149 EOH
4150
4151 rp="Any additional ld flags (NOT including libraries)?"
4152 . ./myread
4153 case "$ans" in
4154 none) ldflags='';;
4155 *) ldflags="$ans";;
4156 esac
4157 rmlist="$rmlist pdp11"
4158
4159 : coherency check
4160 echo " "
4161 echo "Checking your choice of C compiler and flags for coherency..." >&4
4162 $cat > try.c <<'EOF'
4163 #include <stdio.h>
4164 int main() { printf("Ok\n"); exit(0); }
4165 EOF
4166 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4167 shift
4168 $cat >try.msg <<'EOM'
4169 I've tried to compile and run the following simple program:
4170
4171 EOM
4172 $cat try.c >> try.msg
4173
4174 $cat >> try.msg <<EOM
4175
4176 I used the command:
4177
4178         $*
4179         ./try
4180
4181 and I got the following output:
4182
4183 EOM
4184 dflt=y
4185 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4186         if sh -c './try' >>try.msg 2>&1; then
4187                 xxx=`./try`
4188                 case "$xxx" in
4189                 "Ok") dflt=n ;;
4190                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4191                         case " $libs " in
4192                         *" -lsfio "*)
4193                                 cat >> try.msg <<'EOQS'
4194 If $libs contains -lsfio, and sfio is mis-configured, then it
4195 sometimes (apparently) runs and exits with a 0 status, but with no
4196 output!  It may have to do with sfio's use of _exit vs. exit.
4197
4198 EOQS
4199                                 rp="You have a big problem.  Shall I abort Configure"
4200                                 dflt=y
4201                                 ;;
4202                         esac
4203                         ;;
4204                 esac
4205         else
4206                 echo "The program compiled OK, but exited with status $?." >>try.msg
4207                 rp="You have a problem.  Shall I abort Configure"
4208                 dflt=y
4209         fi
4210 else
4211         echo "I can't compile the test program." >>try.msg
4212         rp="You have a BIG problem.  Shall I abort Configure"
4213         dflt=y
4214 fi
4215 case "$dflt" in
4216 y)
4217         $cat try.msg >&4
4218         case "$knowitall" in
4219         '')
4220                 echo "(The supplied flags or libraries might be incorrect.)"
4221                 ;;
4222         *) dflt=n;;
4223         esac
4224         echo " "
4225         . ./myread
4226         case "$ans" in
4227         n*|N*) ;;
4228         *)      echo "Ok.  Stopping Configure." >&4
4229                 exit 1
4230                 ;;
4231         esac
4232         ;;
4233 n) echo "OK, that should do.";;
4234 esac
4235 $rm -f try try.* core
4236
4237 : define an is-a-typedef? function
4238 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4239 case "$inclist" in
4240 "") inclist="sys/types.h";;
4241 esac;
4242 eval "varval=\$$var";
4243 case "$varval" in
4244 "")
4245         $rm -f temp.c;
4246         for inc in $inclist; do
4247                 echo "#include <$inc>" >>temp.c;
4248         done;
4249         echo "#ifdef $type" >> temp.c;
4250         echo "printf(\"We have $type\");" >> temp.c;
4251         echo "#endif" >> temp.c;
4252         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4253         if $contains $type temp.E >/dev/null 2>&1; then
4254                 eval "$var=\$type";
4255         else
4256                 eval "$var=\$def";
4257         fi;
4258         $rm -f temp.?;;
4259 *) eval "$var=\$varval";;
4260 esac'
4261
4262 : define an is-a-typedef? function that prompts if the type is not available.
4263 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4264 case "$inclist" in
4265 "") inclist="sys/types.h";;
4266 esac;
4267 eval "varval=\$$var";
4268 case "$varval" in
4269 "")
4270         $rm -f temp.c;
4271         for inc in $inclist; do
4272                 echo "#include <$inc>" >>temp.c;
4273         done;
4274         echo "#ifdef $type" >> temp.c;
4275         echo "printf(\"We have $type\");" >> temp.c;
4276         echo "#endif" >> temp.c;
4277         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4278         echo " " ;
4279         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4280         if $contains $type temp.E >/dev/null 2>&1; then
4281                 echo "$type found." >&4;
4282                 eval "$var=\$type";
4283         else
4284                 echo "$type NOT found." >&4;
4285                 dflt="$def";
4286                 . ./myread ;
4287                 eval "$var=\$ans";
4288         fi;
4289         $rm -f temp.?;;
4290 *) eval "$var=\$varval";;
4291 esac'
4292
4293 : define a shorthand compile call
4294 compile='
4295 mc_file=$1;
4296 shift;
4297 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4298 : define a shorthand compile call for compilations that should be ok.
4299 compile_ok='
4300 mc_file=$1;
4301 shift;
4302 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4303
4304 : check for lengths of integral types
4305 echo " "
4306 case "$intsize" in
4307 '')
4308         echo "Checking to see how big your integers are..." >&4
4309         $cat >intsize.c <<'EOCP'
4310 #include <stdio.h>
4311 int main()
4312 {
4313         printf("intsize=%d;\n", (int)sizeof(int));
4314         printf("longsize=%d;\n", (int)sizeof(long));
4315         printf("shortsize=%d;\n", (int)sizeof(short));
4316         exit(0);
4317 }
4318 EOCP
4319         set intsize
4320         if eval $compile_ok && ./intsize > /dev/null; then
4321                 eval `./intsize`
4322                 echo "Your integers are $intsize bytes long."
4323                 echo "Your long integers are $longsize bytes long."
4324                 echo "Your short integers are $shortsize bytes long."
4325         else
4326                 $cat >&4 <<EOM
4327 !
4328 Help! I can't compile and run the intsize test program: please enlighten me!
4329 (This is probably a misconfiguration in your system or libraries, and
4330 you really ought to fix it.  Still, I'll try anyway.)
4331 !
4332 EOM
4333                 dflt=4
4334                 rp="What is the size of an integer (in bytes)?"
4335                 . ./myread
4336                 intsize="$ans"
4337                 dflt=$intsize
4338                 rp="What is the size of a long integer (in bytes)?"
4339                 . ./myread
4340                 longsize="$ans"
4341                 dflt=2
4342                 rp="What is the size of a short integer (in bytes)?"
4343                 . ./myread
4344                 shortsize="$ans"
4345         fi
4346         ;;
4347 esac
4348 $rm -f intsize intsize.*
4349
4350 : see what type lseek is declared as in the kernel
4351 rp="What is the type used for lseek's offset on this system?"
4352 set off_t lseektype long stdio.h sys/types.h
4353 eval $typedef_ask
4354
4355 echo " "
4356 echo "Checking to see how big your file offsets are..." >&4
4357 $cat >try.c <<EOCP
4358 #include <sys/types.h>
4359 #include <stdio.h>
4360 int main()
4361 {
4362     printf("%d\n", (int)sizeof($lseektype));
4363     return(0); 
4364 }
4365 EOCP
4366 set try
4367 if eval $compile_ok; then
4368         lseeksize=`./try`
4369         echo "Your file offsets are $lseeksize bytes long."
4370 else
4371         dflt=$longsize
4372         echo " "
4373         echo "(I can't seem to compile the test program.  Guessing...)"
4374         rp="What is the size of your file offsets (in bytes)?"
4375         . ./myread
4376         lseeksize="$ans"
4377 fi
4378 $rm -f try.c try
4379
4380 : see what type file positions are declared as in the library
4381 rp="What is the type for file position used by fsetpos()?"
4382 set fpos_t fpostype long stdio.h sys/types.h
4383 eval $typedef_ask
4384
4385 echo " "
4386 case "$fpostype" in
4387 *_t) zzz="$fpostype"    ;;
4388 *)   zzz="fpos_t"       ;;
4389 esac
4390 echo "Checking the size of $zzz..." >&4 
4391 cat > try.c <<EOCP
4392 #include <sys/types.h>
4393 #include <stdio.h>
4394 int main() {
4395     printf("%d\n", (int)sizeof($fpostype));
4396     exit(0);
4397 }
4398 EOCP
4399 set try
4400 if eval $compile_ok; then
4401         yyy=`./try`
4402         case "$yyy" in
4403         '')     fpossize=4
4404                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4405                 ;;
4406         *)      fpossize=$yyy
4407                 echo "Your $zzz is $fpossize bytes long."
4408                 ;;
4409         esac
4410 else
4411         dflt="$longsize"
4412         echo " " >&4
4413         echo "(I can't compile the test program.  Guessing...)" >&4
4414         rp="What is the size of your file positions (in bytes)?"
4415         . ./myread
4416         fpossize="$ans"
4417 fi
4418
4419
4420
4421 # Backward compatibility (uselfs is deprecated).
4422 case "$uselfs" in
4423 "$define"|true|[yY]*)
4424         cat <<EOM >&4
4425
4426 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4427 EOM
4428         uselargefiles="$define"
4429         ;;
4430 esac                          
4431
4432 case "$lseeksize:$fpossize" in
4433 8:8) cat <<EOM
4434
4435 You can have files larger than 2 gigabytes.
4436 EOM
4437    val="$define" ;;
4438 *)    case "$uselargefiles" in
4439    "$undef"|false|[nN]*) dflt='n' ;;
4440    *)   dflt='y' ;;
4441    esac
4442    cat <<EOM
4443
4444 Perl can be built to understand large files (files larger than 2 gigabytes)
4445 on some systems.  To do so, Configure can be run with -Duselargefiles.
4446
4447 If this doesn't make any sense to you, just accept the default '$dflt'.
4448 EOM
4449    rp='Try to understand large files, if available?'
4450    . ./myread
4451    case "$ans" in
4452    y|Y)         val="$define" ;;
4453    *)           val="$undef"  ;;
4454    esac
4455    ;;
4456 esac
4457 set uselargefiles
4458 eval $setvar
4459 case "$uselargefiles" in
4460 "$define")
4461 : Look for a hint-file generated 'call-back-unit'.  If the
4462 : user has specified that a large files perl is to be built,
4463 : we may need to set or change some other defaults.
4464         if $test -f uselargefiles.cbu; then
4465                 echo "Your platform has some specific hints for large file builds, using them..."
4466                 . ./uselargefiles.cbu
4467                 echo " "
4468                 echo "Rechecking to see how big your file offsets are..." >&4
4469                 $cat >try.c <<EOCP
4470 #include <sys/types.h>
4471 #include <stdio.h>
4472 int main()
4473 {
4474     printf("%d\n", (int)sizeof($lseektype));
4475     return(0); 
4476 }
4477 EOCP
4478                 set try
4479                 if eval $compile_ok; then
4480                         lseeksize=`./try`
4481                         $echo "Your file offsets are now $lseeksize bytes long."
4482                 else
4483                         dflt="$lseeksize"
4484                         echo " "
4485                         echo "(I can't seem to compile the test program.  Guessing...)"
4486                         rp="What is the size of your file offsets (in bytes)?"
4487                         . ./myread
4488                         lseeksize="$ans"
4489                 fi
4490                 case "$fpostype" in
4491                 *_t) zzz="$fpostype"    ;;
4492                 *)   zzz="fpos_t"       ;;
4493                 esac
4494                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4495                 $cat > try.c <<EOCP
4496 #include <sys/types.h>
4497 #include <stdio.h>
4498 int main() {
4499     printf("%d\n", (int)sizeof($fpostype));
4500     exit(0);
4501 }
4502 EOCP
4503                 set try
4504                 if eval $compile_ok; then
4505                         yyy=`./try`
4506                         dflt="$lseeksize"
4507                         case "$yyy" in
4508                         '')     echo " "
4509                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4510                                 ;;
4511                         *)      fpossize=$yyy
4512                                 echo " $fpossize bytes." >&4
4513                                 ;;
4514                         esac
4515                 else
4516                         dflt="$fpossize"
4517                         echo " "
4518                         echo "(I can't compile the test program.  Guessing...)" >&4
4519                         rp="What is the size of your file positions (in bytes)?"
4520                         . ./myread
4521                         fpossize="$ans"
4522                 fi
4523                 $rm -f try.c try
4524         fi
4525         ;;
4526 esac
4527
4528
4529 case "$usemorebits" in
4530 "$define"|true|[yY]*)
4531         use64bitint="$define"
4532         uselongdouble="$define"
4533         usemorebits="$define"
4534         ;;
4535 *)      usemorebits="$undef"
4536         ;;
4537 esac
4538
4539
4540 case "$uselonglong" in
4541 "$define"|true|[yY]*)
4542         cat <<EOM >&4
4543
4544 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4545 EOM
4546         use64bitint="$define"
4547         ;;
4548 esac                          
4549 case "$use64bits" in
4550 "$define"|true|[yY]*)
4551         cat <<EOM >&4
4552
4553 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4554 EOM
4555         use64bitint="$define"
4556         ;;
4557 esac                          
4558 case "$use64bitints" in
4559 "$define"|true|[yY]*)
4560         cat <<EOM >&4
4561
4562 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4563 EOM
4564         use64bitint="$define"
4565         ;;
4566 esac                          
4567 case "$use64bitsint" in
4568 "$define"|true|[yY]*)
4569         cat <<EOM >&4
4570
4571 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4572 EOM
4573         use64bitint="$define"
4574         ;;
4575 esac                          
4576 case "$uselonglongs" in
4577 "$define"|true|[yY]*)
4578         cat <<EOM >&4
4579
4580 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4581 EOM
4582         use64bitint="$define"
4583         ;;
4584 esac                          
4585 case "$use64bitsall" in
4586 "$define"|true|[yY]*)
4587         cat <<EOM >&4
4588
4589 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4590 EOM
4591         use64bitall="$define"
4592         ;;
4593 esac                          
4594
4595 case "$ccflags" in
4596 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4597 esac
4598 case "$use64bitall" in
4599 "$define"|true|[yY]*) use64bitint="$define" ;;
4600 esac
4601
4602 case "$longsize" in
4603 8) cat <<EOM
4604
4605 You have natively 64-bit long integers.
4606 EOM
4607    val="$define"
4608    ;;
4609 *) case "$use64bitint" in
4610    "$define"|true|[yY]*) dflt='y';;
4611    *) dflt='n';;
4612    esac
4613    cat <<EOM
4614
4615 Perl can be built to take advantage of 64-bit integer types
4616 on some systems.  To do so, Configure can be run with -Duse64bitint.
4617 Choosing this option will most probably introduce binary incompatibilities.
4618
4619 If this doesn't make any sense to you, just accept the default '$dflt'.
4620 EOM
4621    rp='Try to use 64-bit integers, if available?'
4622    . ./myread
4623    case "$ans" in
4624    [yY]*) val="$define" ;;
4625    *)     val="$undef"  ;;
4626    esac
4627    ;;
4628 esac
4629 set use64bitint
4630 eval $setvar
4631
4632 case "$use64bitall" in
4633 "$define"|true|[yY]*) dflt='y' ;;
4634 *) case "$longsize" in
4635    8) dflt='y' ;;
4636    *) dflt='n' ;;
4637    esac
4638    ;;
4639 esac    
4640 cat <<EOM
4641
4642 You may also choose to try maximal 64-bitness.  It means using as much
4643 64-bitness as possible on the platform.  This in turn means even more
4644 binary incompatibilities.  On the other hand, your platform may not
4645 have any more 64-bitness available than what you already have chosen.
4646
4647 If this doesn't make any sense to you, just accept the default '$dflt'.
4648 EOM
4649 rp='Try to use maximal 64-bit support, if available?'
4650 . ./myread
4651 case "$ans" in
4652 [yY]*) val="$define" ;;
4653 *)     val="$undef"  ;;
4654 esac
4655 set use64bitall
4656 eval $setvar
4657 case "$use64bitall" in
4658 "$define")
4659         case "$use64bitint" in
4660         "$undef")
4661                 cat <<EOM
4662
4663 Since you have chosen a maximally 64-bit build, I'm also turning on
4664 the use of 64-bit integers.
4665 EOM
4666                 use64bitint="$define" ;;
4667         esac
4668         ;;
4669 esac
4670
4671 case "$use64bitint" in
4672 "$define"|true|[yY]*)
4673 : Look for a hint-file generated 'call-back-unit'.  If the
4674 : user has specified that a 64-bit perl is to be built,
4675 : we may need to set or change some other defaults.
4676         if $test -f use64bitint.cbu; then
4677                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4678                 . ./use64bitint.cbu
4679         fi
4680         case "$longsize" in
4681         4) case "$archname64" in
4682            '') archname64=64int ;;
4683            esac
4684            ;;
4685         esac
4686         ;;
4687 esac
4688
4689 case "$use64bitall" in
4690 "$define"|true|[yY]*)
4691 : Look for a hint-file generated 'call-back-unit'.  If the
4692 : user has specified that a maximally 64-bit perl is to be built,
4693 : we may need to set or change some other defaults.
4694         if $test -f use64bitall.cbu; then
4695                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4696                 . ./use64bitall.cbu
4697         fi
4698         case "$longsize" in
4699         4) case "$archname64" in
4700            ''|64int) archname64=64all ;;
4701            esac
4702            ;;
4703         esac
4704         ;;
4705 esac
4706
4707 : determine the architecture name
4708 echo " "
4709 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4710         tarch=`arch`"-$osname"
4711 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4712         if uname -m > tmparch 2>&1 ; then
4713                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4714                         -e 's/$/'"-$osname/" tmparch`
4715         else
4716                 tarch="$osname"
4717         fi
4718         $rm -f tmparch
4719 else
4720         tarch="$osname"
4721 fi
4722 case "$myarchname" in
4723 ''|"$tarch") ;;
4724 *)
4725         echo "(Your architecture name used to be $myarchname.)"
4726         archname=''
4727         ;;
4728 esac
4729 myarchname="$tarch"
4730 case "$archname" in
4731 '') dflt="$tarch";;
4732 *) dflt="$archname";;
4733 esac
4734 rp='What is your architecture name'
4735 . ./myread
4736 archname="$ans"
4737 case "$usethreads" in
4738 $define)
4739         echo "Threads selected." >&4
4740         case "$archname" in
4741         *-thread*) echo "...and architecture name already has -thread." >&4
4742                 ;;
4743         *)      archname="$archname-thread"
4744                 echo "...setting architecture name to $archname." >&4
4745                 ;;
4746         esac
4747         ;;
4748 esac
4749 case "$usemultiplicity" in
4750 $define)
4751         echo "Multiplicity selected." >&4
4752         case "$archname" in
4753         *-multi*) echo "...and architecture name already has -multi." >&4
4754                 ;;
4755         *)      archname="$archname-multi"
4756                 echo "...setting architecture name to $archname." >&4
4757                 ;;
4758         esac
4759         ;;
4760 esac
4761 case "$use64bitint" in
4762 $define)
4763         case "$archname64" in
4764         '')
4765                 ;;
4766         *)
4767                 case "$archname" in
4768                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4769                         ;;
4770                 *)      archname="$archname-$archname64"
4771                         echo "...setting architecture name to $archname." >&4
4772                         ;;
4773                 esac
4774                 ;;
4775         esac
4776 esac
4777
4778 : determine root of directory hierarchy where package will be installed.
4779 case "$prefix" in
4780 '')
4781         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4782         ;;
4783 *)
4784         dflt="$prefix"
4785         ;;
4786 esac
4787 $cat <<EOM
4788
4789 By default, $package will be installed in $dflt/bin, manual pages
4790 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4791 installation directories. Typically this is something like /usr/local.
4792 If you wish to have binaries under /usr/bin but other parts of the
4793 installation under /usr/local, that's ok: you will be prompted
4794 separately for each of the installation directories, the prefix being
4795 only used to set the defaults.
4796
4797 EOM
4798 fn=d~
4799 rp='Installation prefix to use?'
4800 . ./getfile
4801 oldprefix=''
4802 case "$prefix" in
4803 '') ;;
4804 *)
4805         case "$ans" in
4806         "$prefix") ;;
4807         *) oldprefix="$prefix";;
4808         esac
4809         ;;
4810 esac
4811 prefix="$ans"
4812 prefixexp="$ansexp"
4813
4814 : is AFS running?
4815 echo " "
4816 case "$afs" in
4817 $define|true)   afs=true ;;
4818 $undef|false)   afs=false ;;
4819 *)      if test -d /afs; then
4820                 afs=true
4821         else
4822                 afs=false
4823         fi
4824         ;;
4825 esac
4826 if $afs; then
4827         echo "AFS may be running... I'll be extra cautious then..." >&4
4828 else
4829         echo "AFS does not seem to be running..." >&4
4830 fi
4831
4832 : determine installation prefix for where package is to be installed.
4833 if $afs; then 
4834 $cat <<EOM
4835
4836 Since you are running AFS, I need to distinguish the directory in which
4837 files will reside from the directory in which they are installed (and from
4838 which they are presumably copied to the former directory by occult means).
4839
4840 EOM
4841         case "$installprefix" in
4842         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4843         *) dflt="$installprefix";;
4844         esac
4845 else
4846 $cat <<EOM
4847
4848 In some special cases, particularly when building $package for distribution,
4849 it is convenient to distinguish between the directory in which files should 
4850 be installed from the directory ($prefix) in which they 
4851 will eventually reside.  For most users, these two directories are the same.
4852
4853 EOM
4854         case "$installprefix" in
4855         '') dflt=$prefix ;;
4856         *) dflt=$installprefix;;
4857         esac
4858 fi
4859 fn=d~
4860 rp='What installation prefix should I use for installing files?'
4861 . ./getfile
4862 installprefix="$ans"
4863 installprefixexp="$ansexp"
4864
4865 : set the prefixit variable, to compute a suitable default value
4866 prefixit='case "$3" in
4867 ""|none)
4868         case "$oldprefix" in
4869         "") eval "$1=\"\$$2\"";;
4870         *)
4871                 case "$3" in
4872                 "") eval "$1=";;
4873                 none)
4874                         eval "tp=\"\$$2\"";
4875                         case "$tp" in
4876                         ""|" ") eval "$1=\"\$$2\"";;
4877                         *) eval "$1=";;
4878                         esac;;
4879                 esac;;
4880         esac;;
4881 *)
4882         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4883         case "$tp" in
4884         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4885         /*-$oldprefix/*|\~*-$oldprefix/*)
4886                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4887         *) eval "$1=\"\$$2\"";;
4888         esac;;
4889 esac'
4890
4891
4892 : get the patchlevel
4893 echo " "
4894 echo "Getting the current patchlevel..." >&4
4895 if $test -r $rsrc/patchlevel.h;then
4896         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4897         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4898         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4899         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4900         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4901         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4902 else
4903         revision=0
4904         patchlevel=0
4905         subversion=0
4906         api_revision=0
4907         api_version=0
4908         api_subversion=0
4909 fi
4910 $echo $n "(You have $package revision $revision" $c
4911 $echo $n " patchlevel $patchlevel" $c
4912 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4913 echo ".)"
4914 case "$osname" in
4915 dos|vms)
4916         : XXX Should be a Configure test for double-dots in filenames.
4917         version=`echo $revision $patchlevel $subversion | \
4918                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4919         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4920                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4921         ;;
4922 *)
4923         version=`echo $revision $patchlevel $subversion | \
4924                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4925         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4926                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4927         ;;
4928 esac
4929 : Special case the 5.005_xx maintenance series, which used 5.005
4930 : without any subversion label as a subdirectory in $sitelib
4931 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4932         api_versionstring='5.005'
4933 fi
4934
4935 : determine installation style
4936 : For now, try to deduce it from prefix unless it is already set.
4937 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4938 case "$installstyle" in
4939 '')     case "$prefix" in
4940                 *perl*) dflt='lib';;
4941                 *) dflt='lib/perl5' ;;
4942         esac
4943         ;;
4944 *)      dflt="$installstyle" ;;
4945 esac
4946 : Probably not worth prompting for this since we prompt for all
4947 : the directories individually, and the prompt would be too long and
4948 : confusing anyway.
4949 installstyle=$dflt
4950
4951 : determine where private library files go
4952 : Usual default is /usr/local/lib/perl5/$version.
4953 : Also allow things like /opt/perl/lib/$version, since 
4954 : /opt/perl/lib/perl5... would be redundant.
4955 : The default "style" setting is made in installstyle.U
4956 case "$installstyle" in
4957 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4958 *)       set dflt privlib lib/$version ;;
4959 esac
4960 eval $prefixit
4961 $cat <<EOM
4962
4963 There are some auxiliary files for $package that need to be put into a
4964 private library directory that is accessible by everyone.
4965
4966 EOM
4967 fn=d~+
4968 rp='Pathname where the private library files will reside?'
4969 . ./getfile
4970 privlib="$ans"
4971 privlibexp="$ansexp"
4972 : Change installation prefix, if necessary.
4973 if $test X"$prefix" != X"$installprefix"; then
4974         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4975 else
4976         installprivlib="$privlibexp"
4977 fi
4978
4979 : set the prefixup variable, to restore leading tilda escape
4980 prefixup='case "$prefixexp" in
4981 "$prefix") ;;
4982 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4983 esac'
4984
4985 : determine where public architecture dependent libraries go
4986 set archlib archlib
4987 eval $prefixit
4988 : privlib default is /usr/local/lib/$package/$version
4989 : archlib default is /usr/local/lib/$package/$version/$archname
4990 : privlib may have an optional trailing /share.
4991 tdflt=`echo $privlib | $sed 's,/share$,,'`
4992 tdflt=$tdflt/$archname
4993 case "$archlib" in
4994 '')     dflt=$tdflt
4995         ;;
4996 *)      dflt="$archlib"
4997     ;;
4998 esac
4999 $cat <<EOM
5000
5001 $spackage contains architecture-dependent library files.  If you are
5002 sharing libraries in a heterogeneous environment, you might store
5003 these files in a separate location.  Otherwise, you can just include
5004 them with the rest of the public library files.
5005
5006 EOM
5007 fn=d+~
5008 rp='Where do you want to put the public architecture-dependent libraries?'
5009 . ./getfile
5010 archlib="$ans"
5011 archlibexp="$ansexp"
5012 if $test X"$archlib" = X"$privlib"; then
5013         d_archlib="$undef"
5014 else
5015         d_archlib="$define"
5016 fi
5017 : Change installation prefix, if necessary.
5018 if $test X"$prefix" != X"$installprefix"; then
5019         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5020 else
5021         installarchlib="$archlibexp"
5022 fi
5023
5024
5025 : Binary compatibility with 5.005 is not possible for builds
5026 : with advanced features
5027 case "$usethreads$usemultiplicity" in
5028 *define*)
5029         bincompat5005="$undef"
5030         d_bincompat5005="$undef"
5031         ;;
5032 *)      $cat <<EOM
5033
5034 This version of Perl can be compiled for binary compatibility with 5.005.
5035 If you decide to do so, you will be able to continue using most of the
5036 extensions that were compiled for Perl 5.005.
5037
5038 EOM
5039         case "$bincompat5005$d_bincompat5005" in
5040         *"$undef"*) dflt=n ;;
5041         *) dflt=y ;;
5042         esac
5043         rp='Binary compatibility with Perl 5.005?'
5044         . ./myread
5045         case "$ans" in
5046         y*) val="$define" ;;
5047         *)  val="$undef" ;;
5048         esac
5049         set d_bincompat5005
5050         eval $setvar
5051         case "$d_bincompat5005" in
5052         "$define")
5053                 bincompat5005="$define"
5054                 ;;
5055         *)      bincompat5005="$undef"
5056                 d_bincompat5005="$undef"
5057                 ;;
5058         esac
5059         ;;
5060 esac
5061
5062
5063 : see if setuid scripts can be secure
5064 $cat <<EOM
5065
5066 Some kernels have a bug that prevents setuid #! scripts from being
5067 secure.  Some sites have disabled setuid #! scripts because of this.
5068
5069 First let's decide if your kernel supports secure setuid #! scripts.
5070 (If setuid #! scripts would be secure but have been disabled anyway,
5071 don't say that they are secure if asked.)
5072
5073 EOM
5074
5075 val="$undef"
5076 if $test -d /dev/fd; then
5077         echo "#!$ls" >reflect
5078         chmod +x,u+s reflect
5079         ./reflect >flect 2>&1
5080         if $contains "/dev/fd" flect >/dev/null; then
5081                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5082                 val="$define"
5083         else
5084                 $cat <<EOM
5085 If you are not sure if they are secure, I can check but I'll need a
5086 username and password different from the one you are using right now.
5087 If you don't have such a username or don't want me to test, simply
5088 enter 'none'.
5089
5090 EOM
5091                 rp='Other username to test security of setuid scripts with?'
5092                 dflt='none'
5093                 . ./myread
5094                 case "$ans" in
5095                 n|none)
5096                         case "$d_suidsafe" in
5097                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5098                                 dflt=n;;
5099                         "$undef")
5100                                 echo "Well, the $hint value is *not* secure." >&4
5101                                 dflt=n;;
5102                         *)      echo "Well, the $hint value *is* secure." >&4
5103                                 dflt=y;;
5104                         esac
5105                         ;;
5106                 *)
5107                         $rm -f reflect flect
5108                         echo "#!$ls" >reflect
5109                         chmod +x,u+s reflect
5110                         echo >flect
5111                         chmod a+w flect
5112                         echo '"su" will (probably) prompt you for '"$ans's password."
5113                         su $ans -c './reflect >flect'
5114                         if $contains "/dev/fd" flect >/dev/null; then
5115                                 echo "Okay, it looks like setuid scripts are secure." >&4
5116                                 dflt=y
5117                         else
5118                                 echo "I don't think setuid scripts are secure." >&4
5119                                 dflt=n
5120                         fi
5121                         ;;
5122                 esac
5123                 rp='Does your kernel have *secure* setuid scripts?'
5124                 . ./myread
5125                 case "$ans" in
5126                 [yY]*)  val="$define";;
5127                 *)      val="$undef";;
5128                 esac
5129         fi
5130 else
5131         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5132         echo "(That's for file descriptors, not floppy disks.)"
5133         val="$undef"
5134 fi
5135 set d_suidsafe
5136 eval $setvar
5137
5138 $rm -f reflect flect
5139
5140 : now see if they want to do setuid emulation
5141 echo " "
5142 val="$undef"
5143 case "$d_suidsafe" in
5144 "$define")
5145         val="$undef"
5146         echo "No need to emulate SUID scripts since they are secure here." >& 4
5147         ;;
5148 *)
5149         $cat <<EOM
5150 Some systems have disabled setuid scripts, especially systems where
5151 setuid scripts cannot be secure.  On systems where setuid scripts have
5152 been disabled, the setuid/setgid bits on scripts are currently
5153 useless.  It is possible for $package to detect those bits and emulate
5154 setuid/setgid in a secure fashion.  This emulation will only work if
5155 setuid scripts have been disabled in your kernel.
5156
5157 EOM
5158         case "$d_dosuid" in
5159         "$define") dflt=y ;;
5160         *) dflt=n ;;
5161         esac
5162         rp="Do you want to do setuid/setgid emulation?"
5163         . ./myread
5164         case "$ans" in
5165         [yY]*)  val="$define";;
5166         *)      val="$undef";;
5167         esac
5168         ;;
5169 esac
5170 set d_dosuid
5171 eval $setvar
5172
5173 : determine filename position in cpp output
5174 echo " "
5175 echo "Computing filename position in cpp output for #include directives..." >&4
5176 echo '#include <stdio.h>' > foo.c
5177 $cat >fieldn <<EOF
5178 $startsh
5179 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5180 $grep '^[       ]*#.*stdio\.h' | \
5181 while read cline; do
5182         pos=1
5183         set \$cline
5184         while $test \$# -gt 0; do
5185                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5186                         echo "\$pos"
5187                         exit 0
5188                 fi
5189                 shift
5190                 pos=\`expr \$pos + 1\`
5191         done
5192 done
5193 EOF
5194 chmod +x fieldn
5195 fieldn=`./fieldn`
5196 $rm -f foo.c fieldn
5197 case $fieldn in
5198 '') pos='???';;
5199 1) pos=first;;
5200 2) pos=second;;
5201 3) pos=third;;
5202 *) pos="${fieldn}th";;
5203 esac
5204 echo "Your cpp writes the filename in the $pos field of the line."
5205
5206 : locate header file
5207 $cat >findhdr <<EOF
5208 $startsh
5209 wanted=\$1
5210 name=''
5211 for usrincdir in $usrinc
5212 do
5213         if test -f \$usrincdir/\$wanted; then
5214                 echo "\$usrincdir/\$wanted"
5215                 exit 0
5216         fi
5217 done
5218 awkprg='{ print \$$fieldn }'
5219 echo "#include <\$wanted>" > foo\$\$.c
5220 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5221 $grep "^[       ]*#.*\$wanted" | \
5222 while read cline; do
5223         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5224         case "\$name" in
5225         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5226         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5227         *) exit 2;;
5228         esac;
5229 done;
5230 #
5231 # status = 0: grep returned 0 lines, case statement not executed
5232 # status = 1: headerfile found
5233 # status = 2: while loop executed, no headerfile found
5234 #
5235 status=\$?
5236 $rm -f foo\$\$.c;
5237 if test \$status -eq 1; then
5238         exit 0;
5239 fi
5240 exit 1
5241 EOF
5242 chmod +x findhdr
5243
5244 : define an alternate in-header-list? function
5245 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5246 cont=true; xxf="echo \"<\$1> found.\" >&4";
5247 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5248 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5249 esac;
5250 case $# in 4) instead=instead;; *) instead="at last";; esac;
5251 while $test "$cont"; do
5252         xxx=`./findhdr $1`
5253         var=$2; eval "was=\$$2";
5254         if $test "$xxx" && $test -r "$xxx";
5255         then eval $xxf;
5256         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5257                 cont="";
5258         else eval $xxnf;
5259         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5260         set $yyy; shift; shift; yyy=$@;
5261         case $# in 0) cont="";;
5262         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5263                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5264         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5265                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5266         esac;
5267 done;
5268 while $test "$yyy";
5269 do set $yyy; var=$2; eval "was=\$$2";
5270         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5271         set $yyy; shift; shift; yyy=$@;
5272 done'
5273
5274 : see if this is a malloc.h system
5275 set malloc.h i_malloc
5276 eval $inhdr
5277
5278 : see if stdlib is available
5279 set stdlib.h i_stdlib
5280 eval $inhdr
5281
5282 : determine which malloc to compile in
5283 echo " "
5284 case "$usemymalloc" in
5285 ''|[yY]*|true|$define)  dflt='y' ;;
5286 *)      dflt='n' ;;
5287 esac
5288 rp="Do you wish to attempt to use the malloc that comes with $package?"
5289 . ./myread
5290 usemymalloc="$ans"
5291 case "$ans" in
5292 y*|true)
5293         usemymalloc='y'
5294         mallocsrc='malloc.c'
5295         mallocobj="malloc$_o"
5296         d_mymalloc="$define"
5297         case "$libs" in
5298         *-lmalloc*)
5299                 : Remove malloc from list of libraries to use
5300                 echo "Removing unneeded -lmalloc from library list" >&4
5301                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5302                 shift
5303                 libs="$*"
5304                 echo "libs = $libs" >&4
5305                 ;;
5306         esac
5307         ;;
5308 *)
5309         usemymalloc='n'
5310         mallocsrc=''
5311         mallocobj=''
5312         d_mymalloc="$undef"
5313         ;;
5314 esac
5315
5316 : compute the return types of malloc and free
5317 echo " "
5318 $cat >malloc.c <<END
5319 #$i_malloc I_MALLOC
5320 #$i_stdlib I_STDLIB
5321 #include <stdio.h>
5322 #include <sys/types.h>
5323 #ifdef I_MALLOC
5324 #include <malloc.h>
5325 #endif
5326 #ifdef I_STDLIB
5327 #include <stdlib.h>
5328 #endif
5329 #ifdef TRY_MALLOC
5330 void *malloc();
5331 #endif
5332 #ifdef TRY_FREE
5333 void free();
5334 #endif
5335 END
5336 case "$malloctype" in
5337 '')
5338         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5339                 malloctype='void *'
5340         else
5341                 malloctype='char *'
5342         fi
5343         ;;
5344 esac
5345 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5346
5347 case "$freetype" in
5348 '')
5349         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5350                 freetype='void'
5351         else
5352                 freetype='int'
5353         fi
5354         ;;
5355 esac
5356 echo "Your system uses $freetype free(), it would seem." >&4
5357 $rm -f malloc.[co]
5358 $cat <<EOM
5359
5360 After $package is installed, you may wish to install various
5361 add-on modules and utilities.  Typically, these add-ons will
5362 be installed under $prefix with the rest
5363 of this package.  However, you may wish to install such add-ons
5364 elsewhere under a different prefix.
5365
5366 If you do not wish to put everything under a single prefix, that's
5367 ok.  You will be prompted for the individual locations; this siteprefix
5368 is only used to suggest the defaults.
5369
5370 The default should be fine for most people.
5371
5372 EOM
5373 fn=d~+
5374 rp='Installation prefix to use for add-on modules and utilities?'
5375 : XXX Here might be another good place for an installstyle setting.
5376 case "$siteprefix" in
5377 '') dflt=$prefix ;;
5378 *)  dflt=$siteprefix ;;
5379 esac
5380 . ./getfile
5381 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5382 oldsiteprefix=''
5383 case "$siteprefix" in
5384 '') ;;
5385 *)      case "$ans" in
5386         "$prefix") ;;
5387         *) oldsiteprefix="$prefix";;
5388         esac
5389         ;;
5390 esac
5391 siteprefix="$ans"
5392 siteprefixexp="$ansexp"
5393
5394 : determine where site specific libraries go.
5395 : Usual default is /usr/local/lib/perl5/site_perl/$version
5396 : The default "style" setting is made in installstyle.U
5397 : XXX No longer works with Prefixit stuff.
5398 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5399 case "$sitelib" in
5400 '') case "$installstyle" in
5401         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5402         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5403         esac
5404         ;;
5405 *)      dflt="$sitelib"
5406         ;;
5407 esac
5408 $cat <<EOM
5409
5410 The installation process will create a directory for
5411 site-specific extensions and modules.  Most users find it convenient
5412 to place all site-specific files in this directory rather than in the
5413 main distribution directory.
5414
5415 EOM
5416 fn=d~+
5417 rp='Pathname for the site-specific library files?'
5418 . ./getfile
5419 sitelib="$ans"
5420 sitelibexp="$ansexp"
5421 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5422 : Change installation prefix, if necessary.
5423 if $test X"$prefix" != X"$installprefix"; then
5424         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5425 else
5426         installsitelib="$sitelibexp"
5427 fi
5428
5429 : determine where site specific architecture-dependent libraries go.
5430 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5431 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5432 : sitelib may have an optional trailing /share.
5433 case "$sitearch" in
5434 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5435         dflt="$dflt/$archname"
5436         ;;
5437 *)      dflt="$sitearch"
5438         ;;
5439 esac
5440 set sitearch sitearch none
5441 eval $prefixit
5442 $cat <<EOM
5443
5444 The installation process will also create a directory for
5445 architecture-dependent site-specific extensions and modules.
5446
5447 EOM
5448 fn=d~+
5449 rp='Pathname for the site-specific architecture-dependent library files?'
5450 . ./getfile
5451 sitearch="$ans"
5452 sitearchexp="$ansexp"
5453 : Change installation prefix, if necessary.
5454 if $test X"$prefix" != X"$installprefix"; then
5455         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5456 else
5457         installsitearch="$sitearchexp"
5458 fi
5459
5460 $cat <<EOM
5461
5462 The installation process will also create a directory for
5463 vendor-supplied add-ons.  Vendors who supply perl with their system
5464 may find it convenient to place all vendor-supplied files in this
5465 directory rather than in the main distribution directory.  This will
5466 ease upgrades between binary-compatible maintenance versions of perl.
5467
5468 Of course you may also use these directories in whatever way you see
5469 fit.  For example, you might use them to access modules shared over a
5470 company-wide network.
5471
5472 The default answer should be fine for most people.
5473 This causes further questions about vendor add-ons to be skipped
5474 and no vendor-specific directories will be configured for perl.
5475
5476 EOM
5477 rp='Do you want to configure vendor-specific add-on directories?'
5478 case "$usevendorprefix" in
5479 define|true|[yY]*) dflt=y ;;
5480 *)      : User may have set vendorprefix directly on Configure command line.
5481         case "$vendorprefix" in
5482         ''|' ') dflt=n ;;
5483         *)      dflt=y ;;
5484         esac
5485         ;;
5486 esac
5487 . ./myread
5488 case "$ans" in
5489 [yY]*)  fn=d~+
5490         rp='Installation prefix to use for vendor-supplied add-ons?'
5491         case "$vendorprefix" in
5492         '') dflt='' ;;
5493         *)  dflt=$vendorprefix ;;
5494         esac
5495         . ./getfile
5496         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5497         oldvendorprefix=''
5498         case "$vendorprefix" in
5499         '') ;;
5500         *)      case "$ans" in
5501                 "$prefix") ;;
5502                 *) oldvendorprefix="$prefix";;
5503                 esac
5504                 ;;
5505         esac
5506         usevendorprefix="$define"
5507         vendorprefix="$ans"
5508         vendorprefixexp="$ansexp"
5509         ;;
5510 *)      usevendorprefix="$undef"
5511         vendorprefix=''
5512         vendorprefixexp=''
5513         ;;
5514 esac
5515
5516 case "$vendorprefix" in
5517 '')     d_vendorlib="$undef"
5518         vendorlib=''
5519         vendorlibexp=''
5520         ;;
5521 *)      d_vendorlib="$define"
5522         : determine where vendor-supplied modules go.
5523         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5524         case "$vendorlib" in
5525         '')
5526                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5527                 case "$installstyle" in
5528                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5529                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5530                 esac
5531                 ;;
5532         *)      dflt="$vendorlib"
5533                 ;;
5534         esac
5535         fn=d~+
5536         rp='Pathname for the vendor-supplied library files?'
5537         . ./getfile
5538         vendorlib="$ans"
5539         vendorlibexp="$ansexp"
5540         ;;
5541 esac
5542 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5543 : Change installation prefix, if necessary.
5544 if $test X"$prefix" != X"$installprefix"; then
5545         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5546 else
5547         installvendorlib="$vendorlibexp"
5548 fi
5549
5550 case "$vendorprefix" in
5551 '')     d_vendorarch="$undef"
5552         vendorarch=''
5553         vendorarchexp=''
5554         ;;
5555 *)      d_vendorarch="$define"
5556         : determine where vendor-supplied architecture-dependent libraries go.
5557         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5558         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5559         : vendorlib may have an optional trailing /share.
5560         case "$vendorarch" in
5561         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5562                 dflt="$dflt/$archname"
5563                 ;;
5564         *)      dflt="$vendorarch" ;;
5565         esac
5566         fn=d~+
5567         rp='Pathname for vendor-supplied architecture-dependent files?'
5568         . ./getfile
5569         vendorarch="$ans"
5570         vendorarchexp="$ansexp"
5571         ;;
5572 esac
5573 : Change installation prefix, if necessary.
5574 if $test X"$prefix" != X"$installprefix"; then
5575         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5576 else
5577         installvendorarch="$vendorarchexp"
5578 fi
5579
5580 : Final catch-all directories to search
5581 $cat <<EOM
5582
5583 Lastly, you can have perl look in other directories for extensions and
5584 modules in addition to those already specified.
5585 These directories will be searched after 
5586         $sitearch 
5587         $sitelib 
5588 EOM
5589 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5590 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5591 echo ' '
5592 case "$otherlibdirs" in
5593 ''|' ') dflt='none' ;;
5594 *)      dflt="$otherlibdirs" ;;
5595 esac
5596 $cat <<EOM
5597 Enter a colon-separated set of extra paths to include in perl's @INC
5598 search path, or enter 'none' for no extra paths.
5599
5600 EOM
5601
5602 rp='Colon-separated list of additional directories for perl to search?'
5603 . ./myread
5604 case "$ans" in
5605 ' '|''|none)    otherlibdirs=' ' ;;     
5606 *)      otherlibdirs="$ans" ;;
5607 esac
5608 case "$otherlibdirs" in
5609 ' ') val=$undef ;;
5610 *)      val=$define ;;
5611 esac
5612 set d_perl_otherlibdirs
5613 eval $setvar
5614
5615 : Cruising for prototypes
5616 echo " "
5617 echo "Checking out function prototypes..." >&4
5618 $cat >prototype.c <<'EOCP'
5619 int main(int argc, char *argv[]) {
5620         exit(0);}
5621 EOCP
5622 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5623         echo "Your C compiler appears to support function prototypes."
5624         val="$define"
5625 else
5626         echo "Your C compiler doesn't seem to understand function prototypes."
5627         val="$undef"
5628 fi
5629 set prototype
5630 eval $setvar
5631 $rm -f prototype*
5632
5633 case "$prototype" in
5634 "$define") ;;
5635 *)      ansi2knr='ansi2knr'
5636         echo " "
5637         cat <<EOM >&4
5638
5639 $me:  FATAL ERROR:
5640 This version of $package can only be compiled by a compiler that 
5641 understands function prototypes.  Unfortunately, your C compiler 
5642         $cc $ccflags
5643 doesn't seem to understand them.  Sorry about that.
5644
5645 If GNU cc is available for your system, perhaps you could try that instead.  
5646
5647 Eventually, we hope to support building Perl with pre-ANSI compilers.
5648 If you would like to help in that effort, please contact <perlbug@perl.org>.
5649
5650 Aborting Configure now.
5651 EOM
5652         exit 2
5653         ;;
5654 esac
5655
5656 : determine where public executables go
5657 echo " "
5658 set dflt bin bin
5659 eval $prefixit
5660 fn=d~
5661 rp='Pathname where the public executables will reside?'
5662 . ./getfile
5663 if $test "X$ansexp" != "X$binexp"; then
5664         installbin=''
5665 fi
5666 bin="$ans"
5667 binexp="$ansexp"
5668 : Change installation prefix, if necessary.
5669 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5670 if $test X"$prefix" != X"$installprefix"; then
5671         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5672 else
5673         installbin="$binexp"
5674 fi
5675
5676 : Find perl5.005 or later.
5677 echo "Looking for a previously installed perl5.005 or later... "
5678 case "$perl5" in
5679 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5680                 : Check if this perl is recent and can load a simple module
5681                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5682                         perl5=$tdir/perl
5683                         break;
5684                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5685                         perl5=$tdir/perl
5686                         break;
5687                 fi
5688         done
5689         ;;
5690 *)      perl5="$perl5"
5691         ;;
5692 esac
5693 case "$perl5" in
5694 '')     echo "None found.  That's ok.";;
5695 *)      echo "Using $perl5." ;;
5696 esac
5697
5698 : Determine list of previous versions to include in @INC
5699 $cat > getverlist <<EOPL
5700 #!$perl5 -w
5701 use File::Basename;
5702 \$api_versionstring = "$api_versionstring";
5703 \$version = "$version";
5704 \$stem = "$sitelib_stem";
5705 \$archname = "$archname";
5706 EOPL
5707         $cat >> getverlist <<'EOPL'
5708 # Can't have leading @ because metaconfig interprets it as a command!
5709 ;@inc_version_list=();
5710 # XXX Redo to do opendir/readdir? 
5711 if (-d $stem) {
5712     chdir($stem);
5713     ;@candidates = glob("5.*");
5714 }
5715 else {
5716     ;@candidates = ();
5717 }
5718
5719 # XXX ToDo:  These comparisons must be reworked when two-digit
5720 # subversions come along, so that 5.7.10 compares as greater than
5721 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5722 # widespread that we can use the built-in version vectors rather
5723 # than reinventing them here.  For 5.6.0, however, we must
5724 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5725 foreach $d (@candidates) {
5726     if ($d lt $version) {
5727         if ($d ge $api_versionstring) {
5728             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5729         }
5730         elsif ($d ge "5.005") {
5731             unshift(@inc_version_list, grep { -d } $d);
5732         }
5733     }
5734     else {
5735         # Skip newer version.  I.e. don't look in
5736         # 5.7.0 if we're installing 5.6.1.
5737     }
5738 }
5739
5740 if (@inc_version_list) {
5741     print join(' ', @inc_version_list);
5742 }
5743 else {
5744     # Blank space to preserve value for next Configure run.
5745     print " ";
5746 }
5747 EOPL
5748 chmod +x getverlist
5749 case "$inc_version_list" in
5750 '')     if test -x "$perl5"; then
5751                 dflt=`$perl5 getverlist`
5752         else
5753                 dflt='none'
5754         fi
5755         ;;
5756 $undef) dflt='none' ;;
5757 *)  dflt="$inc_version_list" ;;
5758 esac
5759 case "$dflt" in
5760 ''|' ') dflt=none ;;
5761 esac
5762 $cat <<'EOM'
5763
5764 In order to ease the process of upgrading, this version of perl 
5765 can be configured to use modules built and installed with earlier 
5766 versions of perl that were installed under $prefix.  Specify here
5767 the list of earlier versions that this version of perl should check.
5768 If Configure detected no earlier versions of perl installed under
5769 $prefix, then the list will be empty.  Answer 'none' to tell perl
5770 to not search earlier versions.
5771
5772 The default should almost always be sensible, so if you're not sure,
5773 just accept the default.
5774 EOM
5775
5776 rp='List of earlier versions to include in @INC?'
5777 . ./myread
5778 case "$ans" in
5779 [Nn]one|''|' ') inc_version_list=' ' ;;
5780 *) inc_version_list="$ans" ;;
5781 esac
5782 case "$inc_version_list" in
5783 ''|' ') 
5784         inc_version_list_init='0';;
5785 *)      inc_version_list_init=`echo $inc_version_list |
5786                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5787         ;;
5788 esac
5789 $rm -f getverlist
5790
5791 : determine whether to install perl also as /usr/bin/perl
5792
5793 echo " "
5794 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5795         $cat <<EOM
5796 Many scripts expect perl to be installed as /usr/bin/perl.
5797 I can install the perl you are about to compile also as /usr/bin/perl
5798 (in addition to $installbin/perl).
5799 EOM
5800         case "$installusrbinperl" in
5801         "$undef"|[nN]*) dflt='n';;
5802         *)              dflt='y';;
5803         esac
5804         rp="Do you want to install perl as /usr/bin/perl?"
5805         . ./myread
5806         case "$ans" in
5807         [yY]*)  val="$define";;
5808         *)      val="$undef" ;;
5809         esac
5810 else
5811         val="$undef"
5812 fi
5813 set installusrbinperl
5814 eval $setvar
5815
5816 echo " "
5817 echo "Checking for GNU C Library..." >&4
5818 cat >gnulibc.c <<EOM
5819 #include <stdio.h>
5820 int main()
5821 {
5822 #ifdef __GLIBC__
5823     exit(0);
5824 #else
5825     exit(1);
5826 #endif
5827 }
5828 EOM
5829 set gnulibc
5830 if eval $compile_ok && ./gnulibc; then
5831         val="$define"
5832         echo "You are using the GNU C Library"
5833 else
5834         val="$undef"
5835         echo "You are not using the GNU C Library"
5836 fi
5837 $rm -f gnulibc*
5838 set d_gnulibc
5839 eval $setvar
5840
5841 : see if nm is to be used to determine whether a symbol is defined or not
5842 case "$usenm" in
5843 '')
5844         dflt=''
5845         case "$d_gnulibc" in
5846         "$define")
5847                 echo " "
5848                 echo "nm probably won't work on the GNU C Library." >&4
5849                 dflt=n
5850                 ;;
5851         esac
5852         case "$dflt" in
5853         '') 
5854                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5855                         echo " "
5856                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5857                         echo "'nm' won't be sufficient on this sytem." >&4
5858                         dflt=n
5859                 fi
5860                 ;;
5861         esac
5862         case "$dflt" in
5863         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5864                 if $test $dflt -gt 20; then
5865                         dflt=y
5866                 else
5867                         dflt=n
5868                 fi
5869                 ;;
5870         esac
5871         ;;
5872 *)
5873         case "$usenm" in
5874         true|$define) dflt=y;;
5875         *) dflt=n;;
5876         esac
5877         ;;
5878 esac
5879 $cat <<EOM
5880
5881 I can use $nm to extract the symbols from your C libraries. This
5882 is a time consuming task which may generate huge output on the disk (up
5883 to 3 megabytes) but that should make the symbols extraction faster. The
5884 alternative is to skip the 'nm' extraction part and to compile a small
5885 test program instead to determine whether each symbol is present. If
5886 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5887 this may be the best solution.
5888
5889 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5890
5891 EOM
5892 rp="Shall I use $nm to extract C symbols from the libraries?"
5893 . ./myread
5894 case "$ans" in
5895 [Nn]*) usenm=false;;
5896 *) usenm=true;;
5897 esac
5898
5899 runnm=$usenm
5900 case "$reuseval" in
5901 true) runnm=false;;
5902 esac
5903
5904 : nm options which may be necessary
5905 case "$nm_opt" in
5906 '') if $test -f /mach_boot; then
5907                 nm_opt=''       # Mach
5908         elif $test -d /usr/ccs/lib; then
5909                 nm_opt='-p'     # Solaris (and SunOS?)
5910         elif $test -f /dgux; then
5911                 nm_opt='-p'     # DG-UX
5912         elif $test -f /lib64/rld; then
5913                 nm_opt='-p'     # 64-bit Irix
5914         else
5915                 nm_opt=''
5916         fi;;
5917 esac
5918
5919 : nm options which may be necessary for shared libraries but illegal
5920 : for archive libraries.  Thank you, Linux.
5921 case "$nm_so_opt" in
5922 '')     case "$myuname" in
5923         *linux*)
5924                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5925                         nm_so_opt='--dynamic'
5926                 fi
5927                 ;;
5928         esac
5929         ;;
5930 esac
5931
5932 case "$runnm" in
5933 true)
5934 : get list of predefined functions in a handy place
5935 echo " "
5936 case "$libc" in
5937 '') libc=unknown
5938         case "$libs" in
5939         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5940         esac
5941         ;;
5942 esac
5943 libnames='';
5944 case "$libs" in
5945 '') ;;
5946 *)  for thislib in $libs; do
5947         case "$thislib" in
5948         -lc|-lc_s)
5949                 : Handle C library specially below.
5950                 ;;
5951         -l*)
5952                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5953                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5954                         :
5955                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5956                         :
5957                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5958                         :
5959                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5960                         :
5961                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5962                         :
5963                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5964                         :
5965                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5966                         :
5967                 else
5968                         try=''
5969                 fi
5970                 libnames="$libnames $try"
5971                 ;;
5972         *) libnames="$libnames $thislib" ;;
5973         esac
5974         done
5975         ;;
5976 esac
5977 xxx=normal
5978 case "$libc" in
5979 unknown)
5980         set /lib/libc.$so
5981         for xxx in $libpth; do
5982                 $test -r $1 || set $xxx/libc.$so
5983                 : The messy sed command sorts on library version numbers.
5984                 $test -r $1 || \
5985                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5986                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5987                                 h
5988                                 s/[0-9][0-9]*/0000&/g
5989                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5990                                 G
5991                                 s/\n/ /' | \
5992                          sort | $sed -e 's/^.* //'`
5993                 eval set \$$#
5994         done
5995         $test -r $1 || set /usr/ccs/lib/libc.$so
5996         $test -r $1 || set /lib/libsys_s$_a
5997         ;;
5998 *)
5999         set blurfl
6000         ;;
6001 esac
6002 if $test -r "$1"; then
6003         echo "Your (shared) C library seems to be in $1."
6004         libc="$1"
6005 elif $test -r /lib/libc && $test -r /lib/clib; then
6006         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6007         xxx=apollo
6008         libc='/lib/clib /lib/libc'
6009         if $test -r /lib/syslib; then
6010                 echo "(Your math library is in /lib/syslib.)"
6011                 libc="$libc /lib/syslib"
6012         fi
6013 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6014         echo "Your C library seems to be in $libc, as you said before."
6015 elif $test -r $incpath/usr/lib/libc$_a; then
6016         libc=$incpath/usr/lib/libc$_a;
6017         echo "Your C library seems to be in $libc.  That's fine."
6018 elif $test -r /lib/libc$_a; then
6019         libc=/lib/libc$_a;
6020         echo "Your C library seems to be in $libc.  You're normal."
6021 else
6022         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6023                 :
6024         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6025                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6026         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6027                 :
6028         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6029                 :
6030         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6031                 :
6032         else
6033                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6034         fi
6035         if $test -r "$tans"; then
6036                 echo "Your C library seems to be in $tans, of all places."
6037                 libc=$tans
6038         else
6039                 libc='blurfl'
6040         fi
6041 fi
6042 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6043         dflt="$libc"
6044         cat <<EOM
6045
6046 If the guess above is wrong (which it might be if you're using a strange
6047 compiler, or your machine supports multiple models), you can override it here.
6048
6049 EOM
6050 else
6051         dflt=''
6052         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
6053         cat >&4 <<EOM
6054 I can't seem to find your C library.  I've looked in the following places:
6055
6056 EOM
6057         $sed 's/^/      /' libpath
6058         cat <<EOM
6059
6060 None of these seems to contain your C library. I need to get its name...
6061
6062 EOM
6063 fi
6064 fn=f
6065 rp='Where is your C library?'
6066 . ./getfile
6067 libc="$ans"
6068
6069 echo " "
6070 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
6071 set X `cat libnames`
6072 shift
6073 xxx=files
6074 case $# in 1) xxx=file; esac
6075 echo "Extracting names from the following $xxx for later perusal:" >&4
6076 echo " "
6077 $sed 's/^/      /' libnames >&4
6078 echo " "
6079 $echo $n "This may take a while...$c" >&4
6080
6081 for file in $*; do
6082         case $file in
6083         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6084         *) $nm $nm_opt $file 2>/dev/null;;
6085         esac
6086 done >libc.tmp
6087
6088 $echo $n ".$c"
6089 $grep fprintf libc.tmp > libc.ptf
6090 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6091 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
6092 xxx='[ADTSIW]'
6093 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
6094         eval $xscan;\
6095         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6096                 eval $xrun
6097 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6098         eval $xscan;\
6099         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6100                 eval $xrun
6101 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6102         eval $xscan;\
6103         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6104                 eval $xrun
6105 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6106         eval $xscan;\
6107         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6108                 eval $xrun
6109 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6110         eval $xscan;\
6111         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6112                 eval $xrun
6113 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6114         eval $xscan;\
6115         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6116                 eval $xrun
6117 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6118                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6119         eval $xscan;\
6120         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6121                 eval $xrun
6122 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6123         eval $xscan;\
6124         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6125                 eval $xrun
6126 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6127         eval $xscan;\
6128         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6129                 eval $xrun
6130 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6131         eval $xscan;\
6132         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6133                 eval $xrun
6134 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6135         eval $xscan;\
6136         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6137                 eval $xrun
6138 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6139         eval $xscan;\
6140         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6141                 eval $xrun
6142 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6143         eval $xscan;\
6144         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6145                 eval $xrun
6146 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6147         eval $xscan;\
6148         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6149                 eval $xrun
6150 else
6151         $nm -p $* 2>/dev/null >libc.tmp
6152         $grep fprintf libc.tmp > libc.ptf
6153         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6154                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6155         then
6156                 nm_opt='-p'
6157                 eval $xrun
6158         else
6159                 echo " "
6160                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6161                 com=''
6162                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6163                         for thisname in $libnames $libc; do
6164                                 $ar t $thisname >>libc.tmp
6165                         done
6166                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6167                         echo "Ok." >&4
6168                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6169                         # Repeat libc to extract forwarders to DLL entries too
6170                         for thisname in $libnames $libc; do
6171                                 $ar tv $thisname >>libc.tmp
6172                                 # Revision 50 of EMX has bug in $ar.
6173                                 # it will not extract forwarders to DLL entries
6174                                 # Use emximp which will extract exactly them.
6175                                 emximp -o tmp.imp $thisname \
6176                                     2>/dev/null && \
6177                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6178                                     < tmp.imp >>libc.tmp
6179                                 $rm tmp.imp
6180                         done
6181                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6182                         echo "Ok." >&4
6183                 else
6184                         echo "$ar didn't seem to work right." >&4
6185                         echo "Maybe this is a Cray...trying bld instead..." >&4
6186                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6187                         then
6188                                 for thisname in $libnames; do
6189                                         bld t $libnames | \
6190                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6191                                         $ar t $thisname >>libc.tmp
6192                                 done
6193                                 echo "Ok." >&4
6194                         else
6195                                 echo "That didn't work either.  Giving up." >&4
6196                                 exit 1
6197                         fi
6198                 fi
6199         fi
6200 fi
6201 nm_extract="$com"
6202 if $test -f /lib/syscalls.exp; then
6203         echo " "
6204         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6205         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6206 fi
6207 ;;
6208 esac
6209 $rm -f libnames libpath
6210
6211 : see if dld is available
6212 set dld.h i_dld
6213 eval $inhdr
6214
6215 : is a C symbol defined?
6216 csym='tlook=$1;
6217 case "$3" in
6218 -v) tf=libc.tmp; tc=""; tdc="";;
6219 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6220 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6221 esac;
6222 tx=yes;
6223 case "$reuseval-$4" in
6224 true-) ;;
6225 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6226 esac;
6227 case "$tx" in
6228 yes)
6229         case "$runnm" in
6230         true)
6231                 if $contains $tlook $tf >/dev/null 2>&1;
6232                 then tval=true;
6233                 else tval=false;
6234                 fi;;
6235         *)
6236                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6237                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6238                 then tval=true;
6239                 else tval=false;
6240                 fi;
6241                 $rm -f t t.c;;
6242         esac;;
6243 *)
6244         case "$tval" in
6245         $define) tval=true;;
6246         *) tval=false;;
6247         esac;;
6248 esac;
6249 eval "$2=$tval"'
6250
6251 : define an is-in-libc? function
6252 inlibc='echo " "; td=$define; tu=$undef;
6253 sym=$1; var=$2; eval "was=\$$2";
6254 tx=yes;
6255 case "$reuseval$was" in
6256 true) ;;
6257 true*) tx=no;;
6258 esac;
6259 case "$tx" in
6260 yes)
6261         set $sym tres -f;
6262         eval $csym;
6263         case "$tres" in
6264         true)
6265                 echo "$sym() found." >&4;
6266                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6267         *)
6268                 echo "$sym() NOT found." >&4;
6269                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6270         esac;;
6271 *)
6272         case "$was" in
6273         $define) echo "$sym() found." >&4;;
6274         *) echo "$sym() NOT found." >&4;;
6275         esac;;
6276 esac'
6277
6278 : see if dlopen exists
6279 xxx_runnm="$runnm"
6280 runnm=false
6281 set dlopen d_dlopen
6282 eval $inlibc
6283 runnm="$xxx_runnm"
6284
6285 : determine which dynamic loading, if any, to compile in
6286 echo " "
6287 dldir="ext/DynaLoader"
6288 case "$usedl" in
6289 $define|y|true)
6290         dflt='y'
6291         usedl="$define"
6292         ;;
6293 $undef|n|false)
6294         dflt='n'
6295         usedl="$undef"
6296         ;;
6297 *) 
6298         dflt='n'
6299         case "$d_dlopen" in
6300             $define) dflt='y' ;;
6301         esac
6302         case "$i_dld" in
6303             $define) dflt='y' ;;
6304         esac
6305         : Does a dl_xxx.xs file exist for this operating system
6306         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6307         ;;
6308 esac
6309 rp="Do you wish to use dynamic loading?"
6310 . ./myread
6311 usedl="$ans"
6312 case "$ans" in
6313 y*) usedl="$define"
6314         case "$dlsrc" in
6315         '')
6316                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6317                         dflt="$dldir/dl_${osname}.xs"
6318                 elif $test "$d_dlopen" = "$define" ; then
6319                         dflt="$dldir/dl_dlopen.xs"
6320                 elif $test "$i_dld" = "$define" ; then
6321                         dflt="$dldir/dl_dld.xs"
6322                 else
6323                         dflt=''
6324                 fi
6325                 ;;
6326         *)      dflt="$dldir/$dlsrc"
6327                 ;;
6328         esac
6329     echo "The following dynamic loading files are available:"
6330         : Can not go over to $dldir because getfile has path hard-coded in.
6331         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6332         rp="Source file to use for dynamic loading"
6333         fn="fne"
6334         gfpth="$src"
6335         . ./getfile
6336         usedl="$define"
6337         : emulate basename
6338         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6339
6340         $cat << EOM
6341
6342 Some systems may require passing special flags to $cc -c to
6343 compile modules that will be used to create a shared library.
6344 To use no flags, say "none".
6345
6346 EOM
6347     case "$cccdlflags" in
6348     '') case "$gccversion" in
6349                 '') case "$osname" in
6350                         hpux)   dflt='+z' ;;
6351                         next)   dflt='none' ;;
6352                         irix*)  dflt='-KPIC' ;;
6353                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6354                         sunos)  dflt='-pic' ;;
6355                         *)      dflt='none' ;;
6356                     esac
6357                         ;;
6358                 *)  case "$osname" in
6359                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6360                         *)      dflt='-fpic' ;;
6361                     esac ;;
6362             esac ;;
6363         ' ') dflt='none' ;;
6364     *)  dflt="$cccdlflags" ;;
6365     esac
6366     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6367     . ./myread
6368     case "$ans" in
6369     none) cccdlflags=' ' ;;
6370     *) cccdlflags="$ans" ;;
6371     esac
6372
6373     cat << EOM
6374
6375 Some systems use ld to create libraries that can be dynamically loaded,
6376 while other systems (such as those using ELF) use $cc.
6377
6378 EOM
6379         case "$ld" in
6380         '')     $cat >try.c <<'EOM'
6381 /* Test for whether ELF binaries are produced */
6382 #include <fcntl.h>
6383 #include <stdlib.h>
6384 int main() {
6385         char b[4];
6386         int i = open("a.out",O_RDONLY);
6387         if(i == -1) 
6388                 exit(1); /* fail */
6389         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6390                 exit(0); /* succeed (yes, it's ELF) */
6391         else
6392                 exit(1); /* fail */
6393 }
6394 EOM
6395                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6396                         cat <<EOM
6397 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6398 EOM
6399                         dflt="$cc"
6400                 else
6401                         echo "I'll use ld to build dynamic libraries."
6402                         dflt='ld'
6403                 fi
6404                 rm -f try.c a.out
6405                 ;;
6406         *)      dflt="$ld"
6407                 ;;
6408         esac
6409
6410     rp="What command should be used to create dynamic libraries?"
6411     . ./myread
6412         ld="$ans"
6413
6414     cat << EOM
6415
6416 Some systems may require passing special flags to $ld to create a
6417 library that can be dynamically loaded.  If your ld flags include
6418 -L/other/path options to locate libraries outside your loader's normal
6419 search path, you may need to specify those -L options here as well.  To
6420 use no flags, say "none".
6421
6422 EOM
6423     case "$lddlflags" in
6424     '') case "$osname" in
6425                         beos) dflt='-nostart' ;;
6426                         hpux) dflt='-b';
6427                               case "$gccversion" in
6428                               '') dflt="$dflt +vnocompatwarnings" ;;
6429                               esac
6430                               ;;        
6431                         linux|irix*)    dflt='-shared' ;;
6432                         next)  dflt='none' ;;
6433                         solaris) dflt='-G' ;;
6434                         sunos) dflt='-assert nodefinitions' ;;
6435                         svr4*|esix*) dflt="-G $ldflags" ;;
6436                 *)     dflt='none' ;;
6437                         esac
6438                         ;;
6439     *) dflt="$lddlflags" ;;
6440     esac
6441
6442         : Try to guess additional flags to pick up local libraries.
6443         : Be careful not to append to a plain 'none'
6444         case "$dflt" in
6445         none) dflt='' ;;
6446         esac
6447         for thisflag in $ldflags; do
6448                 case "$thisflag" in
6449                 -L*)
6450                         case " $dflt " in
6451                         *" $thisflag "*) ;;
6452                         *) dflt="$dflt $thisflag" ;;
6453                         esac
6454                         ;;
6455                 esac
6456         done
6457
6458         case "$dflt" in
6459         ''|' ') dflt='none' ;;
6460         esac
6461
6462     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6463     . ./myread
6464     case "$ans" in
6465     none) lddlflags=' ' ;;
6466     *) lddlflags="$ans" ;;
6467     esac
6468
6469         cat <<EOM
6470
6471 Some systems may require passing special flags to $cc to indicate that
6472 the resulting executable will use dynamic linking.  To use no flags,
6473 say "none".
6474
6475 EOM
6476     case "$ccdlflags" in
6477     '') case "$osname" in
6478                 hpux)   dflt='-Wl,-E' ;;
6479                 linux)  dflt='-rdynamic' ;;
6480                 next)   dflt='none' ;;
6481                 sunos)  dflt='none' ;;
6482                 *)      dflt='none' ;;
6483             esac ;;
6484     ' ')  dflt='none' ;;
6485     *)  dflt="$ccdlflags" ;;
6486     esac
6487     rp="Any special flags to pass to $cc to use dynamic linking?"
6488     . ./myread
6489     case "$ans" in
6490     none) ccdlflags=' ' ;;
6491     *) ccdlflags="$ans" ;;
6492     esac
6493     ;;
6494 *)  usedl="$undef"
6495         ld='ld'
6496     dlsrc='dl_none.xs'
6497     lddlflags=''
6498     ccdlflags=''
6499     ;;
6500 esac
6501
6502 also=''
6503 case "$usedl" in
6504 $undef)
6505         # No dynamic loading being used, so don't bother even to prompt.
6506         useshrplib='false'
6507         ;;
6508 *)      case "$useshrplib" in
6509         '')     case "$osname" in
6510                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6511                         dflt=y
6512                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6513                         ;;
6514                 next*)
6515                         case "$osvers" in
6516                         4*)     dflt=y
6517                                 also='Building a shared libperl is needed for MAB support.'
6518                                 ;;
6519                         *)      dflt=n
6520                                 ;;
6521                         esac
6522                         ;;
6523                 *)      dflt=n
6524                         ;;
6525                 esac
6526                 ;;
6527         $define|true|[Yy]*)
6528                 dflt=y
6529                 ;;
6530         *)      dflt=n
6531                 ;;
6532         esac
6533         $cat << EOM
6534
6535 The perl executable is normally obtained by linking perlmain.c with
6536 libperl${_a}, any static extensions (usually just DynaLoader), and
6537 any other libraries needed on this system (such as -lm, etc.).  Since
6538 your system supports dynamic loading, it is probably possible to build
6539 a shared libperl.$so.  If you will have more than one executable linked
6540 to libperl.$so, this will significantly reduce the size of each
6541 executable, but it may have a noticeable affect on performance.  The
6542 default is probably sensible for your system.
6543 $also
6544
6545 EOM
6546         rp="Build a shared libperl.$so (y/n)"
6547         . ./myread
6548         case "$ans" in
6549         true|$define|[Yy]*)
6550                 useshrplib='true'  ;;
6551         *)      useshrplib='false' ;;
6552         esac
6553         ;;
6554 esac
6555
6556 case "$useshrplib" in
6557 true)
6558         case "$libperl" in
6559         '')
6560                 # Figure out a good name for libperl.so.  Since it gets stored in
6561                 # a version-specific architecture-dependent library, the version
6562                 # number isn't really that important, except for making cc/ld happy.
6563                 #
6564                 # A name such as libperl.so.3.1
6565                 majmin="libperl.$so.$patchlevel.$subversion"
6566                 # A name such as libperl.so.301
6567                 majonly=`echo $patchlevel $subversion |
6568                         $awk '{printf "%d%02d", $1, $2}'`
6569                 majonly=libperl.$so.$majonly
6570                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6571                 # rely on figuring it out from the naming of libc.
6572                 case "${osname}${osvers}" in
6573                 next4*)
6574                         dflt=libperl.5.$so
6575                         # XXX How handle the --version stuff for MAB?
6576                         ;;
6577                 linux*)  # ld won't link with a bare -lperl otherwise.
6578                         dflt=libperl.$so
6579                         ;;
6580                 cygwin*) # include version
6581                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6582                         ;;
6583                 *)      # Try to guess based on whether libc has major.minor.
6584                         case "$libc" in
6585                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6586                         *libc.$so.[0-9]*) dflt=$majonly ;;
6587                         *)      dflt=libperl.$so ;;
6588                         esac
6589                         ;;
6590                 esac
6591                 ;;
6592         *)      dflt=$libperl
6593                 ;;
6594         esac
6595         cat << EOM
6596
6597 I need to select a good name for the shared libperl.  If your system uses
6598 library names with major and minor numbers, then you might want something
6599 like $majmin.  Alternatively, if your system uses a single version
6600 number for shared libraries, then you might want to use $majonly.
6601 Or, your system might be quite happy with a simple libperl.$so.
6602
6603 Since the shared libperl will get installed into a version-specific
6604 architecture-dependent directory, the version number of the shared perl
6605 library probably isn't important, so the default should be o.k.
6606
6607 EOM
6608         rp='What name do you want to give to the shared libperl?'
6609         . ./myread
6610         libperl=$ans
6611         echo "Ok, I'll use $libperl"
6612         ;;
6613 *)
6614         libperl="libperl${_a}"
6615         ;;
6616 esac
6617
6618 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6619 case "$shrpdir" in
6620 '') ;;
6621 *)      $cat >&4 <<EOM
6622 WARNING:  Use of the shrpdir variable for the installation location of
6623 the shared $libperl is not supported.  It was never documented and
6624 will not work in this version.  Let me (perlbug@perl.com)
6625 know of any problems this may cause.
6626
6627 EOM
6628         case "$shrpdir" in
6629         "$archlibexp/CORE")
6630                 $cat >&4 <<EOM
6631 But your current setting of $shrpdir is
6632 the default anyway, so it's harmless.
6633 EOM
6634                 ;;
6635         *)
6636                 $cat >&4 <<EOM
6637 Further, your current attempted setting of $shrpdir
6638 conflicts with the value of $archlibexp/CORE
6639 that installperl will use.
6640 EOM
6641                 ;;
6642         esac
6643         ;;
6644 esac
6645
6646 # How will the perl executable find the installed shared $libperl?
6647 # Add $xxx to ccdlflags.
6648 # If we can't figure out a command-line option, use $shrpenv to
6649 # set env LD_RUN_PATH.  The main perl makefile uses this.
6650 shrpdir=$archlibexp/CORE
6651 xxx=''
6652 tmp_shrpenv=''
6653 if "$useshrplib"; then
6654     case "$osname" in 
6655         aix)
6656                 # We'll set it in Makefile.SH...
6657                 ;;
6658         solaris|netbsd)
6659                 xxx="-R $shrpdir"
6660                 ;;
6661         freebsd)
6662                 xxx="-Wl,-R$shrpdir"
6663                 ;;
6664         linux|irix*|dec_osf)
6665                 xxx="-Wl,-rpath,$shrpdir"
6666                 ;;
6667         next)
6668                 # next doesn't like the default...
6669                 ;;
6670         beos)
6671                 # beos doesn't like the default, either.
6672                 ;;
6673         hpux*)
6674                 # hpux doesn't like the default, either.
6675                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6676                 ;;
6677         *)
6678                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6679                 ;;
6680         esac
6681         case "$xxx" in
6682         '') ;;
6683         *)      
6684                 # Only add $xxx if it isn't already in ccdlflags.
6685                 case " $ccdlflags " in
6686                 *" $xxx "*)     ;;
6687                 *)      ccdlflags="$ccdlflags $xxx"
6688                         cat <<EOM >&4
6689
6690 Adding $xxx to the flags
6691 passed to $ld so that the perl executable will find the 
6692 installed shared $libperl.
6693
6694 EOM
6695                         ;;
6696                 esac
6697                 ;;
6698         esac
6699 fi
6700 # Fix ccdlflags in AIX for building external extensions.
6701 # (For building Perl itself bare -bE:perl.exp is needed,
6702 #  Makefile.SH takes care of this.)
6703 case "$osname" in
6704 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6705 esac
6706 # Respect a hint or command-line value.
6707 case "$shrpenv" in
6708 '') shrpenv="$tmp_shrpenv" ;;
6709 esac
6710 case "$ldlibpthname" in
6711 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6712 none)   ldlibpthname='' ;;
6713 esac
6714
6715 : determine where manual pages go
6716 set man1dir man1dir none
6717 eval $prefixit
6718 $cat <<EOM
6719
6720 $spackage has manual pages available in source form.
6721 EOM
6722 case "$nroff" in
6723 nroff)
6724         echo "However, you don't have nroff, so they're probably useless to you."
6725         case "$man1dir" in
6726         '') man1dir="none";;
6727         esac;;
6728 esac
6729 echo "If you don't want the manual sources installed, answer 'none'."
6730 case "$man1dir" in
6731 ' ') dflt=none
6732         ;;
6733 '')
6734         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6735         lookpath="$lookpath $prefixexp/man/p_man/man1"
6736         lookpath="$lookpath $prefixexp/man/u_man/man1"
6737         lookpath="$lookpath $prefixexp/man/man.1"
6738         case "$sysman" in
6739         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6740         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6741         esac
6742         set dflt
6743         eval $prefixup
6744         ;;
6745 *)  dflt="$man1dir"
6746         ;;
6747 esac
6748 echo " "
6749 fn=dn+~
6750 rp="Where do the main $spackage manual pages (source) go?"
6751 . ./getfile
6752 if $test "X$man1direxp" != "X$ansexp"; then
6753         installman1dir=''
6754 fi
6755 man1dir="$ans"
6756 man1direxp="$ansexp"
6757 case "$man1dir" in
6758 '')     man1dir=' '
6759         installman1dir='';;
6760 esac
6761
6762 : Change installation prefix, if necessary.
6763 if $test X"$prefix" != X"$installprefix"; then
6764         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6765 else
6766         installman1dir="$man1direxp"
6767 fi
6768
6769 : What suffix to use on installed man pages
6770
6771 case "$man1dir" in
6772 ' ')
6773         man1ext='0'
6774         ;;
6775 *)
6776         rp="What suffix should be used for the main $spackage man pages?"
6777         case "$man1ext" in
6778         '')     case "$man1dir" in
6779                 *1)  dflt=1 ;;
6780                 *1p) dflt=1p ;;
6781                 *1pm) dflt=1pm ;;
6782                 *l) dflt=l;;
6783                 *n) dflt=n;;
6784                 *o) dflt=o;;
6785                 *p) dflt=p;;
6786                 *C) dflt=C;;
6787                 *L) dflt=L;;
6788                 *L1) dflt=L1;;
6789                 *) dflt=1;;
6790                 esac
6791                 ;;
6792         *)      dflt="$man1ext";;
6793         esac
6794         . ./myread
6795         man1ext="$ans"
6796         ;;
6797 esac
6798
6799 : see if we can have long filenames
6800 echo " "
6801 first=123456789abcdef
6802 $rm -f $first
6803 if (echo hi >$first) 2>/dev/null; then
6804         if $test -f 123456789abcde; then
6805                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6806                 val="$undef"
6807         else
6808                 echo 'You can have filenames longer than 14 characters.'>&4
6809                 val="$define"
6810         fi
6811 else
6812         $cat <<'EOM'
6813 You can't have filenames longer than 14 chars.
6814 You can't even think about them!
6815 EOM
6816         val="$undef"
6817 fi 
6818 set d_flexfnam
6819 eval $setvar
6820 $rm -rf 123456789abcde*
6821
6822 : determine where library module manual pages go
6823 set man3dir man3dir none
6824 eval $prefixit
6825 $cat <<EOM
6826
6827 $spackage has manual pages for many of the library modules.
6828 EOM
6829
6830 case "$nroff" in
6831 nroff)
6832         $cat <<'EOM'
6833 However, you don't have nroff, so they're probably useless to you.
6834 EOM
6835         case "$man3dir" in
6836         '') man3dir="none";;
6837         esac;;
6838 esac
6839
6840 case "$d_flexfnam" in
6841 undef)
6842         $cat <<'EOM'
6843 However, your system can't handle the long file names like File::Basename.3. 
6844 EOM
6845         case "$man3dir" in
6846         '') man3dir="none";;
6847         esac;;
6848 esac
6849
6850 echo "If you don't want the manual sources installed, answer 'none'."
6851 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6852 case "$man3dir" in
6853 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6854         if $test -d "$privlib/man/man3"; then
6855                 cat <<EOM >&4
6856
6857 WARNING:  Previous versions of perl installed man3 pages into
6858 $privlib/man/man3.  This version will suggest a 
6859 new default of $dflt.  
6860 EOM
6861                 tdflt=$dflt
6862                 dflt='n'
6863                 rp='Do you wish to preserve the old behavior?(y/n)'
6864                 . ./myread
6865                 case "$ans" in
6866                 y*) dflt="$privlib/man/man3" ;;
6867                 *)  dflt=$tdflt ;;
6868                 esac
6869     fi
6870         ;;
6871 *)      dflt="$man3dir" ;;
6872 esac
6873 case "$dflt" in
6874 ' ') dflt=none ;;
6875 esac
6876 echo " "
6877 fn=dn+~
6878 rp="Where do the $package library man pages (source) go?"
6879 . ./getfile
6880 man3dir="$ans"
6881 man3direxp="$ansexp"
6882 case "$man3dir" in
6883 '')     man3dir=' '
6884         installman3dir='';;
6885 esac
6886
6887 : Change installation prefix, if necessary.
6888 if $test X"$prefix" != X"$installprefix"; then
6889         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6890 else
6891         installman3dir="$man3direxp"
6892 fi
6893
6894 : What suffix to use on installed man pages
6895 case "$man3dir" in
6896 ' ')
6897         man3ext='0'
6898         ;;
6899 *)
6900         rp="What suffix should be used for the $package library man pages?"
6901         case "$man3ext" in
6902         '')     case "$man3dir" in
6903                 *3)  dflt=3 ;;
6904                 *3p) dflt=3p ;;
6905                 *3pm) dflt=3pm ;;
6906                 *l) dflt=l;;
6907                 *n) dflt=n;;
6908                 *o) dflt=o;;
6909                 *p) dflt=p;;
6910                 *C) dflt=C;;
6911                 *L) dflt=L;;
6912                 *L3) dflt=L3;;
6913                 *) dflt=3;;
6914                 esac
6915                 ;;
6916         *)      dflt="$man3ext";;
6917         esac
6918         . ./myread
6919         man3ext="$ans"
6920         ;;
6921 esac
6922
6923 : see if we have to deal with yellow pages, now NIS.
6924 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6925         if $test -f /usr/etc/nibindd; then
6926                 echo " "
6927                 echo "I'm fairly confident you're on a NeXT."
6928                 echo " "
6929                 rp='Do you get the hosts file via NetInfo?'
6930                 dflt=y
6931                 case "$hostcat" in
6932                 nidump*) ;;
6933                 '') ;;
6934                 *) dflt=n;;
6935                 esac
6936                 . ./myread
6937                 case "$ans" in
6938                 y*) hostcat='nidump hosts .';;
6939                 *)      case "$hostcat" in
6940                         nidump*) hostcat='';;
6941                         esac
6942                         ;;
6943                 esac
6944         fi
6945         case "$hostcat" in
6946         nidump*) ;;
6947         *)
6948                 case "$hostcat" in
6949                 *ypcat*) dflt=y;;
6950                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6951                                 dflt=y
6952                         else
6953                                 dflt=n
6954                         fi;;
6955                 *) dflt=n;;
6956                 esac
6957                 echo " "
6958                 rp='Are you getting the hosts file via yellow pages?'
6959                 . ./myread
6960                 case "$ans" in
6961                 y*) hostcat='ypcat hosts';;
6962                 *) hostcat='cat /etc/hosts';;
6963                 esac
6964                 ;;
6965         esac
6966 fi
6967 case "$hostcat" in
6968 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6969 esac
6970 case "$groupcat" in
6971 '') test -f /etc/group && groupcat='cat /etc/group';;
6972 esac
6973 case "$passcat" in
6974 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6975 esac
6976
6977 : now get the host name
6978 echo " "
6979 echo "Figuring out host name..." >&4
6980 case "$myhostname" in
6981 '') cont=true
6982         echo 'Maybe "hostname" will work...'
6983         if tans=`sh -c hostname 2>&1` ; then
6984                 myhostname=$tans
6985                 phostname=hostname
6986                 cont=''
6987         fi
6988         ;;
6989 *) cont='';;
6990 esac
6991 if $test "$cont"; then
6992         if ./xenix; then
6993                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6994                 if tans=`cat /etc/systemid 2>&1` ; then
6995                         myhostname=$tans
6996                         phostname='cat /etc/systemid'
6997                         echo "Whadyaknow.  Xenix always was a bit strange..."
6998                         cont=''
6999                 fi
7000         elif $test -r /etc/systemid; then
7001                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7002         fi
7003 fi
7004 if $test "$cont"; then
7005         echo 'No, maybe "uuname -l" will work...'
7006         if tans=`sh -c 'uuname -l' 2>&1` ; then
7007                 myhostname=$tans
7008                 phostname='uuname -l'
7009         else
7010                 echo 'Strange.  Maybe "uname -n" will work...'
7011                 if tans=`sh -c 'uname -n' 2>&1` ; then
7012                         myhostname=$tans
7013                         phostname='uname -n'
7014                 else
7015                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7016                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7017                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7018                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7019                         else
7020                                 case "$myhostname" in
7021                                 '') echo "Does this machine have an identity crisis or something?"
7022                                         phostname='';;
7023                                 *)
7024                                         echo "Well, you said $myhostname before..."
7025                                         phostname='echo $myhostname';;
7026                                 esac
7027                         fi
7028                 fi
7029         fi
7030 fi
7031 : you do not want to know about this
7032 set $myhostname
7033 myhostname=$1
7034
7035 : verify guess
7036 if $test "$myhostname" ; then
7037         dflt=y
7038         rp='Your host name appears to be "'$myhostname'".'" Right?"
7039         . ./myread
7040         case "$ans" in
7041         y*) ;;
7042         *) myhostname='';;
7043         esac
7044 fi
7045
7046 : bad guess or no guess
7047 while $test "X$myhostname" = X ; do
7048         dflt=''
7049         rp="Please type the (one word) name of your host:"
7050         . ./myread
7051         myhostname="$ans"
7052 done
7053
7054 : translate upper to lower if necessary
7055 case "$myhostname" in
7056 *[A-Z]*)
7057         echo "(Normalizing case in your host name)"
7058         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7059         ;;
7060 esac
7061
7062 case "$myhostname" in
7063 *.*)
7064         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7065         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7066         echo "(Trimming domain name from host name--host name is now $myhostname)"
7067         ;;
7068 *) case "$mydomain" in
7069         '')
7070                 {
7071                         test "X$hostcat" = "Xypcat hosts" &&
7072                         ypmatch "$myhostname" hosts 2>/dev/null |\
7073                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7074                         $test -s hosts
7075                 } || {
7076                         test "X$hostcat" != "X" &&
7077                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7078                                         /[       ]$myhostname[  . ]/p" > hosts
7079                 }
7080                 tmp_re="[       . ]"
7081                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7082                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7083                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7084                         hosts | $sort | $uniq | \
7085                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7086                 case `$echo X$dflt` in
7087                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
7088                         dflt=.
7089                         ;;
7090                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
7091                         ;;
7092                 esac
7093                 case "$dflt" in
7094                 .)
7095                         tans=`./loc resolv.conf X /etc /usr/etc`
7096                         if $test -f "$tans"; then
7097                                 echo "(Attempting domain name extraction from $tans)"
7098                                 dflt=.`$sed -n -e 's/   / /g' \
7099                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7100                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7101                                 case "$dflt" in
7102                                 .) dflt=.`$sed -n -e 's/        / /g' \
7103                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7104                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7105                                         ;;
7106                                 esac
7107                         fi
7108                         ;;
7109                 esac
7110                 case "$dflt" in
7111                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7112                         dflt=.`sh -c domainname 2>/dev/null`
7113                         case "$dflt" in
7114                         '') dflt='.';;
7115                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7116                         esac
7117                         ;;
7118                 esac
7119                 case "$dflt" in
7120                 .) echo "(Lost all hope -- silly guess then)"
7121                         dflt='.uucp'
7122                         ;;
7123                 esac
7124                 $rm -f hosts
7125                 ;;
7126         *) dflt="$mydomain";;
7127         esac;;
7128 esac
7129 echo " "
7130 rp="What is your domain name?"
7131 . ./myread
7132 tans="$ans"
7133 case "$ans" in
7134 '') ;;
7135 .*) ;;
7136 *) tans=".$tans";;
7137 esac
7138 mydomain="$tans"
7139
7140 : translate upper to lower if necessary
7141 case "$mydomain" in
7142 *[A-Z]*)
7143         echo "(Normalizing case in your domain name)"
7144         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7145         ;;
7146 esac
7147
7148 : a little sanity check here
7149 case "$phostname" in
7150 '') ;;
7151 *)
7152         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7153         $myhostname$mydomain|$myhostname) ;;
7154         *)
7155                 case "$phostname" in
7156                 sed*)
7157                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7158                         ;;
7159                 *)
7160                         echo "(That doesn't agree with your $phostname command, by the way.)"
7161                         ;;
7162                 esac
7163         ;;
7164         esac
7165         ;;
7166 esac
7167
7168 $cat <<EOM
7169
7170 I need to get your e-mail address in Internet format if possible, i.e.
7171 something like user@host.domain. Please answer accurately since I have
7172 no easy means to double check it. The default value provided below
7173 is most probably close to reality but may not be valid from outside
7174 your organization...
7175
7176 EOM
7177 cont=x
7178 while test "$cont"; do
7179         case "$cf_email" in
7180         '') dflt="$cf_by@$myhostname$mydomain";;
7181         *) dflt="$cf_email";;
7182         esac
7183         rp='What is your e-mail address?'
7184         . ./myread
7185         cf_email="$ans"
7186         case "$cf_email" in
7187         *@*.*) cont='' ;;
7188         *)
7189                 rp='Address does not look like an Internet one.  Use it anyway?'
7190                 case "$fastread" in
7191                 yes) dflt=y ;;
7192                 *) dflt=n ;;
7193                 esac
7194                 . ./myread
7195                 case "$ans" in
7196                 y*) cont='' ;;
7197                 *) echo " " ;;
7198                 esac
7199                 ;;
7200         esac
7201 done
7202
7203 $cat <<EOM
7204
7205 If you or somebody else will be maintaining perl at your site, please
7206 fill in the correct e-mail address here so that they may be contacted
7207 if necessary. Currently, the "perlbug" program included with perl
7208 will send mail to this address in addition to perlbug@perl.com. You may
7209 enter "none" for no administrator.
7210
7211 EOM
7212 case "$perladmin" in
7213 '') dflt="$cf_email";;
7214 *) dflt="$perladmin";;
7215 esac
7216 rp='Perl administrator e-mail address'
7217 . ./myread
7218 perladmin="$ans"
7219
7220 : figure out how to guarantee perl startup
7221 case "$startperl" in
7222 '')
7223         case "$sharpbang" in
7224         *!)
7225                 $cat <<EOH
7226
7227 I can use the #! construct to start perl on your system. This will
7228 make startup of perl scripts faster, but may cause problems if you
7229 want to share those scripts and perl is not in a standard place
7230 ($binexp/perl) on all your platforms. The alternative is to force
7231 a shell by starting the script with a single ':' character.
7232
7233 EOH
7234                 dflt="$binexp/perl"
7235                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7236                 . ./myread
7237                 case "$ans" in
7238                 none)   startperl=": # use perl";;
7239                 *)      startperl="#!$ans"
7240                         if $test 30 -lt `echo "$ans" | wc -c`; then
7241                                 $cat >&4 <<EOM
7242
7243 WARNING:  Some systems limit the #! command to 32 characters.
7244 If you experience difficulty running Perl scripts with #!, try
7245 installing Perl in a directory with a shorter pathname.
7246
7247 EOM
7248                         fi ;;
7249                 esac
7250                 ;;
7251         *) startperl=": # use perl"
7252                 ;;
7253         esac
7254         ;;
7255 esac
7256 echo "I'll use $startperl to start perl scripts."
7257
7258 : figure best path for perl in scripts
7259 case "$perlpath" in
7260 '')
7261         perlpath="$binexp/perl"
7262         case "$startperl" in
7263         *!*) ;;
7264         *)
7265                 $cat <<EOH
7266
7267 I will use the "eval 'exec'" idiom to start Perl on your system.
7268 I can use the full path of your Perl binary for this purpose, but
7269 doing so may cause problems if you want to share those scripts and
7270 Perl is not always in a standard place ($binexp/perl).
7271
7272 EOH
7273                 dflt="$binexp/perl"
7274                 rp="What path shall I use in \"eval 'exec'\"?"
7275                 . ./myread
7276                 perlpath="$ans"
7277                 ;;
7278         esac
7279         ;;
7280 esac
7281 case "$startperl" in
7282 *!*)    ;;
7283 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7284 esac
7285
7286 : determine where public executable scripts go
7287 set scriptdir scriptdir
7288 eval $prefixit
7289 case "$scriptdir" in
7290 '')
7291         dflt="$bin"
7292         : guess some guesses
7293         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7294         $test -d /usr/share/bin     && dflt=/usr/share/bin
7295         $test -d /usr/local/script  && dflt=/usr/local/script
7296         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7297         $test -d $prefixexp/script  && dflt=$prefixexp/script
7298         set dflt
7299         eval $prefixup
7300         ;;
7301 *)  dflt="$scriptdir"
7302         ;;
7303 esac
7304 $cat <<EOM
7305  
7306 Some installations have a separate directory just for executable scripts so
7307 that they can mount it across multiple architectures but keep the scripts in
7308 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7309 Or you might just lump your scripts in with all your other executables.
7310  
7311 EOM
7312 fn=d~
7313 rp='Where do you keep publicly executable scripts?'
7314 . ./getfile
7315 if $test "X$ansexp" != "X$scriptdirexp"; then
7316         installscript=''
7317 fi
7318 scriptdir="$ans"
7319 scriptdirexp="$ansexp"
7320 : Change installation prefix, if necessary.
7321 if $test X"$prefix" != X"$installprefix"; then
7322         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7323 else
7324         installscript="$scriptdirexp"
7325 fi
7326
7327 : determine where add-on public executables go
7328 case "$sitebin" in
7329 '')     dflt=$siteprefix/bin ;;
7330 *)      dflt=$sitebin ;;
7331 esac
7332 fn=d~
7333 rp='Pathname where the add-on public executables should be installed?'
7334 . ./getfile
7335 sitebin="$ans"
7336 sitebinexp="$ansexp"
7337 : Change installation prefix, if necessary.
7338 if $test X"$prefix" != X"$installprefix"; then
7339         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7340 else
7341         installsitebin="$sitebinexp"
7342 fi
7343
7344 : see if sqrtl exists
7345 set sqrtl d_sqrtl
7346 eval $inlibc
7347
7348 case "$ccflags" in
7349 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7350 esac
7351
7352 case "$uselongdouble" in
7353 $define|true|[yY]*)     dflt='y';;
7354 *) dflt='n';;
7355 esac
7356 cat <<EOM
7357
7358 Perl can be built to take advantage of long doubles which
7359 (if available) may give more accuracy and range for floating point numbers.
7360
7361 If this doesn't make any sense to you, just accept the default '$dflt'.
7362 EOM
7363 rp='Try to use long doubles if available?'
7364 . ./myread
7365 case "$ans" in
7366 y|Y)    val="$define"   ;;
7367 *)      val="$undef"    ;;
7368 esac
7369 set uselongdouble
7370 eval $setvar
7371
7372 case "$uselongdouble" in
7373 true|[yY]*) uselongdouble="$define" ;;
7374 esac
7375
7376 case "$uselongdouble" in
7377 $define)
7378 : Look for a hint-file generated 'call-back-unit'.  If the
7379 : user has specified that long doubles should be used,
7380 : we may need to set or change some other defaults.
7381         if $test -f uselongdouble.cbu; then
7382                 echo "Your platform has some specific hints for long doubles, using them..."
7383                 . ./uselongdouble.cbu
7384         else
7385                 $cat <<EOM
7386 (Your platform doesn't have any specific hints for long doubles.)
7387 EOM
7388         fi
7389         ;;
7390 esac
7391
7392 case "$uselongdouble:$d_sqrtl" in
7393 $define:$undef)
7394                 $cat <<EOM >&4
7395
7396 *** You requested the use of long doubles but you do not seem to have
7397 *** the mathematic functions for long doubles.  I'm disabling the use
7398 *** of long doubles.
7399
7400 EOM
7401         uselongdouble=$undef
7402         ;;
7403 esac
7404
7405 case "$useperlio" in
7406 $define|true|[yY]*)     dflt='y';;
7407 *) dflt='n';;
7408 esac
7409 cat <<EOM
7410
7411 Previous version of $package used the standard IO mechanisms as defined
7412 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7413 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7414 the default.  This abstraction layer can use AT&T's sfio (if you already
7415 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7416 problems with some extension modules.  Using PerlIO with stdio is safe,
7417 but it is slower than plain stdio and therefore is not the default.
7418
7419 If this doesn't make any sense to you, just accept the default '$dflt'.
7420 EOM
7421 rp='Use the experimental PerlIO abstraction layer?'
7422 . ./myread
7423 case "$ans" in
7424 y|Y) 
7425         val="$define"
7426         ;;     
7427 *)      
7428         echo "Ok, doing things the stdio way"
7429         val="$undef"
7430         ;;
7431 esac
7432 set useperlio
7433 eval $setvar 
7434
7435 case "$vendorprefix" in
7436 '')     d_vendorbin="$undef"
7437         vendorbin=''
7438         vendorbinexp=''
7439         ;;
7440 *)      d_vendorbin="$define"
7441         : determine where vendor-supplied executables go.
7442         case "$vendorbin" in
7443         '') dflt=$vendorprefix/bin ;;
7444         *)      dflt="$vendorbin" ;;
7445         esac
7446         fn=d~+
7447         rp='Pathname for the vendor-supplied executables directory?'
7448         . ./getfile
7449         vendorbin="$ans"
7450         vendorbinexp="$ansexp"
7451         ;;
7452 esac
7453 : Change installation prefix, if necessary.
7454 if $test X"$prefix" != X"$installprefix"; then
7455         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7456 else
7457         installvendorbin="$vendorbinexp"
7458 fi
7459
7460 : see if qgcvt exists
7461 set qgcvt d_qgcvt
7462 eval $inlibc
7463
7464 : check for length of double
7465 echo " "
7466 case "$doublesize" in
7467 '')
7468         echo "Checking to see how big your double precision numbers are..." >&4
7469         $cat >try.c <<'EOCP'
7470 #include <stdio.h>
7471 int main()
7472 {
7473     printf("%d\n", (int)sizeof(double));
7474     exit(0);
7475 }
7476 EOCP
7477         set try
7478         if eval $compile_ok; then
7479                 doublesize=`./try`
7480                 echo "Your double is $doublesize bytes long."
7481         else
7482                 dflt='8'
7483                 echo "(I can't seem to compile the test program.  Guessing...)"
7484                 rp="What is the size of a double precision number (in bytes)?"
7485                 . ./myread
7486                 doublesize="$ans"
7487         fi
7488         ;;
7489 esac
7490 $rm -f try.c try
7491
7492 : check for long doubles
7493 echo " "
7494 echo "Checking to see if you have long double..." >&4
7495 echo 'int main() { long double x = 7.0; }' > try.c
7496 set try
7497 if eval $compile; then
7498         val="$define"
7499         echo "You have long double."
7500 else
7501         val="$undef"
7502         echo "You do not have long double."
7503 fi
7504 $rm try.*
7505 set d_longdbl
7506 eval $setvar
7507
7508 : check for length of long double
7509 case "${d_longdbl}${longdblsize}" in
7510 $define)
7511         echo " "
7512         echo "Checking to see how big your long doubles are..." >&4
7513         $cat >try.c <<'EOCP'
7514 #include <stdio.h>
7515 int main()
7516 {
7517         printf("%d\n", sizeof(long double));
7518 }
7519 EOCP
7520         set try
7521         set try
7522         if eval $compile; then
7523                 longdblsize=`./try$exe_ext`
7524                 echo "Your long doubles are $longdblsize bytes long."
7525         else
7526                 dflt='8'
7527                 echo " "
7528                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7529                 rp="What is the size of a long double (in bytes)?"
7530                 . ./myread
7531                 longdblsize="$ans"
7532         fi
7533         if $test "X$doublesize" = "X$longdblsize"; then
7534                 echo "(That isn't any different from an ordinary double.)"
7535         fi      
7536         ;;
7537 esac
7538 $rm -f try.* try
7539
7540 echo " "
7541
7542 if $test X"$d_longdbl" = X"$define"; then
7543
7544 echo "Checking how to print long doubles..." >&4
7545
7546 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7547         $cat >try.c <<'EOCP'
7548 #include <sys/types.h>
7549 #include <stdio.h>
7550 int main() {
7551   double d = 123.456;
7552   printf("%.3f\n", d);
7553 }
7554 EOCP
7555         set try
7556         if eval $compile; then
7557                 yyy=`./try$exe_ext`
7558                 case "$yyy" in
7559                 123.456)
7560                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7561                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7562                         echo "We will use %f."
7563                         ;;
7564                 esac
7565         fi
7566 fi
7567
7568 if $test X"$sPRIfldbl" = X; then
7569         $cat >try.c <<'EOCP'
7570 #include <sys/types.h>
7571 #include <stdio.h>
7572 int main() {
7573   long double d = 123.456;
7574   printf("%.3llf\n", d);
7575 }
7576 EOCP
7577         set try
7578         if eval $compile; then
7579                 yyy=`./try$exe_ext`
7580                 case "$yyy" in
7581                 123.456)
7582                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7583                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7584                         echo "We will use %llf."
7585                         ;;
7586                 esac
7587         fi
7588 fi
7589
7590 if $test X"$sPRIfldbl" = X; then
7591         $cat >try.c <<'EOCP'
7592 #include <sys/types.h>
7593 #include <stdio.h>
7594 int main() {
7595   long double d = 123.456;
7596   printf("%.3Lf\n", d);
7597 }
7598 EOCP
7599         set try
7600         if eval $compile; then
7601                 yyy=`./try$exe_ext`
7602                 case "$yyy" in
7603                 123.456)
7604                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7605                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7606                         echo "We will use %Lf."
7607                         ;;
7608                 esac
7609         fi
7610 fi
7611
7612 if $test X"$sPRIfldbl" = X; then
7613         $cat >try.c <<'EOCP'
7614 #include <sys/types.h>
7615 #include <stdio.h>
7616 int main() {
7617   long double d = 123.456;
7618   printf("%.3lf\n", d);
7619 }
7620 EOCP
7621         set try
7622         if eval $compile; then
7623                 yyy=`./try$exe_ext`
7624                 case "$yyy" in
7625                 123.456)
7626                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7627                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7628                         echo "We will use %lf."
7629                         ;;
7630                 esac
7631         fi
7632 fi
7633
7634 if $test X"$sPRIfldbl" = X; then
7635         echo "Cannot figure out how to print long doubles." >&4
7636 fi
7637
7638 $rm -f try try.*
7639
7640 fi # d_longdbl
7641
7642 case "$sPRIfldbl" in
7643 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7644         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7645         ;;
7646 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7647         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7648         ;;
7649 esac
7650
7651 : Check how to convert floats to strings.
7652 if test "X$d_Gconvert" = X; then
7653         echo " "
7654         echo "Checking for an efficient way to convert floats to strings."
7655         echo " " > try.c
7656         case "$uselongdouble" in
7657         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7658         esac
7659         case "$d_longdbl" in
7660         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7661         esac
7662         case "$d_PRIgldbl" in
7663         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7664         esac
7665         $cat >>try.c <<EOP
7666 #ifdef TRY_gconvert
7667 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7668 char *myname = "gconvert";
7669 #endif
7670 #ifdef TRY_gcvt
7671 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7672 char *myname = "gcvt";
7673 #endif
7674 #ifdef TRY_qgcvt
7675 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7676 char *myname = "qgcvt";
7677 #define DOUBLETYPE long double
7678 #endif
7679 #ifdef TRY_sprintf
7680 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7681 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7682 #else
7683 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7684 #endif
7685 char *myname = "sprintf";
7686 #endif
7687
7688 #ifndef DOUBLETYPE
7689 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7690 #define DOUBLETYPE long double
7691 #else
7692 #define DOUBLETYPE double
7693 #endif
7694 #endif
7695
7696 #include <stdio.h>
7697
7698 #define I_STDLIB $i_stdlib
7699 #ifdef I_STDLIB
7700 #include <stdlib.h>
7701 #endif
7702
7703 int
7704 checkit(expect, got)
7705 char *expect;
7706 char *got;
7707 {
7708     if (strcmp(expect, got)) {
7709                 printf("%s oddity:  Expected %s, got %s\n",
7710                         myname, expect, got);
7711                 exit(1);
7712         }
7713 }
7714
7715 int main()
7716
7717         char buf[64]; 
7718         buf[63] = '\0';
7719
7720         /* This must be 1st test on (which?) platform */
7721         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7722         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7723         checkit("0.1", buf);
7724
7725         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7726         checkit("1", buf);
7727
7728         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7729         checkit("1.1", buf);
7730
7731         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7732         checkit("1.01", buf);
7733
7734         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7735         checkit("1.001", buf);
7736
7737         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7738         checkit("1.0001", buf);
7739
7740         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7741         checkit("1.00001", buf);
7742
7743         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7744         checkit("1.000001", buf);
7745
7746         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7747         checkit("0", buf);
7748
7749         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7750         checkit("-1", buf);
7751
7752         /* Some Linux gcvt's give 1.e+5 here. */
7753         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7754         checkit("100000", buf);
7755         
7756         /* Some Linux gcvt's give -1.e+5 here. */
7757         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7758         checkit("-100000", buf);
7759
7760         exit(0);
7761 }
7762 EOP
7763         case "$d_Gconvert" in
7764         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7765         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7766         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7767         *) xxx_list='gconvert gcvt sprintf' ;;
7768         esac
7769
7770         case "$d_longdbl$uselongdouble$d_qgcvt" in
7771         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7772         esac
7773
7774         for xxx_convert in $xxx_list; do
7775                 echo "Trying $xxx_convert..."
7776                 $rm -f try try$_o
7777                 set try -DTRY_$xxx_convert
7778                 if eval $compile; then
7779                         echo "$xxx_convert() found." >&4
7780                         if ./try; then
7781                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7782                                 break;
7783                         else
7784                                 echo "...But $xxx_convert didn't work as I expected."
7785                         fi
7786                 else
7787                         echo "$xxx_convert NOT found." >&4
7788                 fi
7789         done
7790                 
7791         case "$xxx_convert" in
7792         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7793         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7794         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7795         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7796            "$define$define$define")
7797               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7798            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7799            esac
7800            ;;  
7801         esac
7802 fi
7803
7804 : Initialize h_fcntl
7805 h_fcntl=false
7806
7807 : Initialize h_sysfile
7808 h_sysfile=false
7809
7810 : access call always available on UNIX
7811 set access d_access
7812 eval $inlibc
7813
7814 : locate the flags for 'access()'
7815 case "$d_access" in
7816 "$define")
7817         echo " "
7818         $cat >access.c <<'EOCP'
7819 #include <sys/types.h>
7820 #ifdef I_FCNTL
7821 #include <fcntl.h>
7822 #endif
7823 #ifdef I_SYS_FILE
7824 #include <sys/file.h>
7825 #endif
7826 #ifdef I_UNISTD
7827 #include <unistd.h>
7828 #endif
7829 int main() {
7830         exit(R_OK);
7831 }
7832 EOCP
7833         : check sys/file.h first, no particular reason here
7834         if $test `./findhdr sys/file.h` && \
7835                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7836                 h_sysfile=true;
7837                 echo "<sys/file.h> defines the *_OK access constants." >&4
7838         elif $test `./findhdr fcntl.h` && \
7839                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7840                 h_fcntl=true;
7841                 echo "<fcntl.h> defines the *_OK access constants." >&4
7842         elif $test `./findhdr unistd.h` && \
7843                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7844                 echo "<unistd.h> defines the *_OK access constants." >&4
7845         else
7846                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7847         fi
7848         ;;
7849 esac
7850 $rm -f access*
7851
7852 : see if accessx exists
7853 set accessx d_accessx
7854 eval $inlibc
7855
7856 : see if alarm exists
7857 set alarm d_alarm
7858 eval $inlibc
7859
7860 : see if atolf exists
7861 set atolf d_atolf
7862 eval $inlibc
7863
7864 : see if atoll exists
7865 set atoll d_atoll
7866 eval $inlibc
7867
7868 : Look for GNU-cc style attribute checking
7869 echo " "
7870 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7871 $cat >attrib.c <<'EOCP'
7872 #include <stdio.h>
7873 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7874 EOCP
7875 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7876         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7877                 echo "Your C compiler doesn't fully support __attribute__."
7878                 val="$undef"
7879         else
7880                 echo "Your C compiler supports __attribute__."
7881                 val="$define"
7882         fi
7883 else
7884         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7885         val="$undef"
7886 fi
7887 set d_attribut
7888 eval $setvar
7889 $rm -f attrib*
7890
7891 : see if bcmp exists
7892 set bcmp d_bcmp
7893 eval $inlibc
7894
7895 : see if bcopy exists
7896 set bcopy d_bcopy
7897 eval $inlibc
7898
7899 : see if this is a unistd.h system
7900 set unistd.h i_unistd
7901 eval $inhdr
7902
7903 : see if getpgrp exists
7904 set getpgrp d_getpgrp
7905 eval $inlibc
7906
7907 case "$d_getpgrp" in
7908 "$define")
7909         echo " "
7910         echo "Checking to see which flavor of getpgrp is in use..."
7911         $cat >set.c <<EOP
7912 #$i_unistd I_UNISTD
7913 #include <sys/types.h>
7914 #ifdef I_UNISTD
7915 #  include <unistd.h>
7916 #endif
7917 int main()
7918 {
7919         if (getuid() == 0) {
7920                 printf("(I see you are running Configure as super-user...)\n");
7921                 setuid(1);
7922         }
7923 #ifdef TRY_BSD_PGRP
7924         if (getpgrp(1) == 0)
7925                 exit(0);
7926 #else
7927         if (getpgrp() > 0)
7928                 exit(0);
7929 #endif
7930         exit(1);
7931 }
7932 EOP
7933         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7934                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7935                 val="$define"
7936         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7937                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7938                 val="$undef"
7939         else
7940                 echo "I can't seem to compile and run the test program."
7941                 if ./usg; then
7942                         xxx="a USG one, i.e. you use getpgrp()."
7943                 else
7944                         # SVR4 systems can appear rather BSD-ish.
7945                         case "$i_unistd" in
7946                         $undef)
7947                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7948                                 val="$define"
7949                                 ;;
7950                         $define)
7951                                 xxx="probably a USG one, i.e. you use getpgrp()."
7952                                 val="$undef"
7953                                 ;;
7954                         esac
7955                 fi
7956                 echo "Assuming your getpgrp is $xxx" >&4
7957         fi
7958         ;;
7959 *) val="$undef";;
7960 esac
7961 set d_bsdgetpgrp
7962 eval $setvar
7963 $rm -f set set.c
7964
7965 : see if setpgrp exists
7966 set setpgrp d_setpgrp
7967 eval $inlibc
7968
7969 case "$d_setpgrp" in
7970 "$define")
7971         echo " "
7972         echo "Checking to see which flavor of setpgrp is in use..."
7973         $cat >set.c <<EOP
7974 #$i_unistd I_UNISTD
7975 #include <sys/types.h>
7976 #ifdef I_UNISTD
7977 #  include <unistd.h>
7978 #endif
7979 int main()
7980 {
7981         if (getuid() == 0) {
7982                 printf("(I see you are running Configure as super-user...)\n");
7983                 setuid(1);
7984         }
7985 #ifdef TRY_BSD_PGRP
7986         if (-1 == setpgrp(1, 1))
7987                 exit(0);
7988 #else
7989         if (setpgrp() != -1)
7990                 exit(0);
7991 #endif
7992         exit(1);
7993 }
7994 EOP
7995         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7996                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7997                 val="$define"
7998         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7999                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8000                 val="$undef"
8001         else
8002                 echo "(I can't seem to compile and run the test program.)"
8003                 if ./usg; then
8004                         xxx="a USG one, i.e. you use setpgrp()."
8005                 else
8006                         # SVR4 systems can appear rather BSD-ish.
8007                         case "$i_unistd" in
8008                         $undef)
8009                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8010                                 val="$define"
8011                                 ;;
8012                         $define)
8013                                 xxx="probably a USG one, i.e. you use setpgrp()."
8014                                 val="$undef"
8015                                 ;;
8016                         esac
8017                 fi
8018                 echo "Assuming your setpgrp is $xxx" >&4
8019         fi
8020         ;;
8021 *) val="$undef";;
8022 esac
8023 set d_bsdsetpgrp
8024 eval $setvar
8025 $rm -f set set.c
8026 : see if bzero exists
8027 set bzero d_bzero
8028 eval $inlibc
8029
8030 : see if signal is declared as pointer to function returning int or void
8031 echo " "
8032 xxx=`./findhdr signal.h`
8033 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8034 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8035         echo "You have int (*signal())() instead of void." >&4
8036         val="$undef"
8037 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8038         echo "You have void (*signal())()." >&4
8039         val="$define"
8040 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8041         echo "You have int (*signal())() instead of void." >&4
8042         val="$undef"
8043 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8044         echo "You have void (*signal())()." >&4
8045         val="$define"
8046 else
8047         case "$d_voidsig" in
8048         '')
8049         echo "I can't determine whether signal handler returns void or int..." >&4
8050                 dflt=void
8051                 rp="What type does your signal handler return?"
8052                 . ./myread
8053                 case "$ans" in
8054                 v*) val="$define";;
8055                 *) val="$undef";;
8056                 esac;;
8057         "$define")
8058                 echo "As you already told me, signal handler returns void." >&4
8059                 val="$define"
8060                 ;;
8061         *)      echo "As you already told me, signal handler returns int." >&4
8062                 val="$undef"
8063                 ;;
8064         esac
8065 fi
8066 set d_voidsig
8067 eval $setvar
8068 case "$d_voidsig" in
8069 "$define") signal_t="void";;
8070 *) signal_t="int";;
8071 esac
8072 $rm -f $$.tmp
8073
8074 : check for ability to cast large floats to 32-bit ints.
8075 echo " "
8076 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8077 if $test "$intsize" -ge 4; then
8078         xxx=int
8079 else
8080         xxx=long
8081 fi
8082 $cat >try.c <<EOCP
8083 #include <stdio.h>
8084 #include <sys/types.h>
8085 #include <signal.h>
8086 $signal_t blech(s) int s; { exit(3); }
8087 int main()
8088 {
8089         $xxx i32;
8090         double f, g;
8091         int result = 0;
8092         char str[16];
8093         signal(SIGFPE, blech);
8094
8095         /* Don't let compiler optimize the test away.  Store the number 
8096            in a writable string for gcc to pass to sscanf under HP/UX.
8097         */
8098         sprintf(str, "2147483647");
8099         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8100         g = 10 * f;
8101         i32  = ($xxx) g;
8102
8103         /* x86 processors will probably give 0x8000 0000, which is a
8104        sign change.  We don't want that.  We want to mimic SPARC
8105            behavior here, which is to preserve the sign and give
8106            back 0x7fff ffff.
8107         */
8108         if (i32 != ($xxx) f)
8109                 result |= 1;
8110         exit(result);
8111 }
8112 EOCP
8113 set try
8114 if eval $compile_ok; then
8115         ./try
8116         yyy=$?
8117 else
8118         echo "(I can't seem to compile the test program--assuming it can't)"
8119         yyy=1
8120 fi
8121 case "$yyy" in
8122 0)      val="$define"
8123         echo "Yup, it can."
8124         ;;
8125 *)      val="$undef"
8126         echo "Nope, it can't."
8127         ;;
8128 esac
8129 set d_casti32
8130 eval $setvar
8131 $rm -f try try.*
8132
8133 : check for ability to cast negative floats to unsigned
8134 echo " "
8135 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8136 $cat >try.c <<EOCP
8137 #include <stdio.h>
8138 #include <sys/types.h>
8139 #include <signal.h>
8140 $signal_t blech(s) int s; { exit(7); }
8141 $signal_t blech_in_list(s) int s; { exit(4); }
8142 unsigned long dummy_long(p) unsigned long p; { return p; }
8143 unsigned int dummy_int(p) unsigned int p; { return p; }
8144 unsigned short dummy_short(p) unsigned short p; { return p; }
8145 int main()
8146 {
8147         double f;
8148         unsigned long along;
8149         unsigned int aint;
8150         unsigned short ashort;
8151         int result = 0;
8152         char str[16];
8153         
8154         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8155            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8156            optimized the whole file away
8157         */
8158         /* Store the number in a writable string for gcc to pass to 
8159            sscanf under HP/UX.
8160         */
8161         sprintf(str, "-123");
8162         sscanf(str, "%lf", &f);  /* f = -123.; */
8163
8164         signal(SIGFPE, blech);
8165         along = (unsigned long)f;
8166         aint = (unsigned int)f;
8167         ashort = (unsigned short)f;
8168         if (along != (unsigned long)-123)
8169                 result |= 1;
8170         if (aint != (unsigned int)-123)
8171                 result |= 1;
8172         if (ashort != (unsigned short)-123)
8173                 result |= 1;
8174         sprintf(str, "1073741824.");
8175         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8176         f = f + f;
8177         along = 0;
8178         along = (unsigned long)f;
8179         if (along != 0x80000000)
8180                 result |= 2;
8181         f -= 1.;
8182         along = 0;
8183         along = (unsigned long)f;
8184         if (along != 0x7fffffff)
8185                 result |= 1;
8186         f += 2.;
8187         along = 0;
8188         along = (unsigned long)f;
8189         if (along != 0x80000001)
8190                 result |= 2;
8191         if (result)
8192                 exit(result);
8193         signal(SIGFPE, blech_in_list);
8194         sprintf(str, "123.");
8195         sscanf(str, "%lf", &f);  /* f = 123.; */
8196         along = dummy_long((unsigned long)f);
8197         aint = dummy_int((unsigned int)f);
8198         ashort = dummy_short((unsigned short)f);
8199         if (along != (unsigned long)123)
8200                 result |= 4;
8201         if (aint != (unsigned int)123)
8202                 result |= 4;
8203         if (ashort != (unsigned short)123)
8204                 result |= 4;
8205         exit(result);
8206
8207 }
8208 EOCP
8209 set try
8210 if eval $compile_ok; then
8211         ./try
8212         castflags=$?
8213 else
8214         echo "(I can't seem to compile the test program--assuming it can't)"
8215         castflags=7
8216 fi
8217 case "$castflags" in
8218 0)      val="$define"
8219         echo "Yup, it can."
8220         ;;
8221 *)      val="$undef"
8222         echo "Nope, it can't."
8223         ;;
8224 esac
8225 set d_castneg
8226 eval $setvar
8227 $rm -f try.*
8228
8229 : see if vprintf exists
8230 echo " "
8231 if set vprintf val -f d_vprintf; eval $csym; $val; then
8232         echo 'vprintf() found.' >&4
8233         val="$define"
8234         $cat >vprintf.c <<'EOF'
8235 #include <varargs.h>
8236
8237 int main() { xxx("foo"); }
8238
8239 xxx(va_alist)
8240 va_dcl
8241 {
8242         va_list args;
8243         char buf[10];
8244
8245         va_start(args);
8246         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8247 }
8248 EOF
8249         set vprintf
8250         if eval $compile && ./vprintf; then
8251                 echo "Your vsprintf() returns (int)." >&4
8252                 val2="$undef"
8253         else
8254                 echo "Your vsprintf() returns (char*)." >&4
8255                 val2="$define"
8256         fi
8257 else
8258         echo 'vprintf() NOT found.' >&4
8259                 val="$undef"
8260                 val2="$undef"
8261 fi
8262 set d_vprintf
8263 eval $setvar
8264 val=$val2
8265 set d_charvspr
8266 eval $setvar
8267
8268 : see if chown exists
8269 set chown d_chown
8270 eval $inlibc
8271
8272 : see if chroot exists
8273 set chroot d_chroot
8274 eval $inlibc
8275
8276 : see if chsize exists
8277 set chsize d_chsize
8278 eval $inlibc
8279
8280 : check for const keyword
8281 echo " "
8282 echo 'Checking to see if your C compiler knows about "const"...' >&4
8283 $cat >const.c <<'EOCP'
8284 typedef struct spug { int drokk; } spug;
8285 int main()
8286 {
8287         const char *foo;
8288         const spug y;
8289 }
8290 EOCP
8291 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8292         val="$define"
8293         echo "Yup, it does."
8294 else
8295         val="$undef"
8296         echo "Nope, it doesn't."
8297 fi
8298 set d_const
8299 eval $setvar
8300
8301 : see if crypt exists
8302 echo " "
8303 if set crypt val -f d_crypt; eval $csym; $val; then
8304         echo 'crypt() found.' >&4
8305         val="$define"
8306         cryptlib=''
8307 else
8308         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8309         if $test -z "$cryptlib"; then
8310                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8311         else
8312                 cryptlib=-lcrypt
8313         fi
8314         if $test -z "$cryptlib"; then
8315                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8316         else
8317                 cryptlib=-lcrypt
8318         fi
8319         if $test -z "$cryptlib"; then
8320                 cryptlib=`./loc libcrypt$_a "" $libpth`
8321         else
8322                 cryptlib=-lcrypt
8323         fi
8324         if $test -z "$cryptlib"; then
8325                 echo 'crypt() NOT found.' >&4
8326                 val="$undef"
8327         else
8328                 val="$define"
8329         fi
8330 fi
8331 set d_crypt
8332 eval $setvar
8333
8334 : get csh whereabouts
8335 case "$csh" in
8336 'csh') val="$undef" ;;
8337 *) val="$define" ;;
8338 esac
8339 set d_csh
8340 eval $setvar
8341 : Respect a hint or command line value for full_csh.
8342 case "$full_csh" in
8343 '') full_csh=$csh ;;
8344 esac
8345
8346 : see if cuserid exists
8347 set cuserid d_cuserid
8348 eval $inlibc
8349
8350 : see if this is a limits.h system
8351 set limits.h i_limits
8352 eval $inhdr
8353
8354 : see if this is a float.h system
8355 set float.h i_float
8356 eval $inhdr
8357
8358 : See if number of significant digits in a double precision number is known
8359 echo " "
8360 $cat >dbl_dig.c <<EOM
8361 #$i_limits I_LIMITS
8362 #$i_float I_FLOAT
8363 #ifdef I_LIMITS
8364 #include <limits.h>
8365 #endif
8366 #ifdef I_FLOAT
8367 #include <float.h>
8368 #endif
8369 #ifdef DBL_DIG
8370 printf("Contains DBL_DIG");
8371 #endif
8372 EOM
8373 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8374 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8375         echo "DBL_DIG found." >&4
8376         val="$define"
8377 else
8378         echo "DBL_DIG NOT found." >&4
8379         val="$undef"
8380 fi
8381 $rm -f dbl_dig.?
8382 set d_dbl_dig
8383 eval $setvar
8384
8385 : see if difftime exists
8386 set difftime d_difftime
8387 eval $inlibc
8388
8389 : see if this is a dirent system
8390 echo " "
8391 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8392         val="$define"
8393         echo "<dirent.h> found." >&4
8394 else
8395         val="$undef"
8396         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8397                 echo "<sys/dir.h> found." >&4
8398                 echo " "
8399         else
8400                 xinc=`./findhdr sys/ndir.h`
8401         fi
8402         echo "<dirent.h> NOT found." >&4
8403 fi
8404 set i_dirent
8405 eval $setvar
8406
8407 : Look for type of directory structure.
8408 echo " "
8409 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8410
8411 case "$direntrytype" in
8412 ''|' ')
8413         case "$i_dirent" in
8414         $define) guess1='struct dirent' ;;
8415         *) guess1='struct direct'  ;;
8416         esac
8417         ;;
8418 *)      guess1="$direntrytype"
8419         ;;
8420 esac
8421
8422 case "$guess1" in
8423 'struct dirent') guess2='struct direct' ;;
8424 *) guess2='struct dirent' ;;
8425 esac
8426                 
8427 if $contains "$guess1" try.c >/dev/null 2>&1; then
8428         direntrytype="$guess1"
8429         echo "Your directory entries are $direntrytype." >&4
8430 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8431         direntrytype="$guess2"
8432         echo "Your directory entries seem to be $direntrytype." >&4
8433 else
8434         echo "I don't recognize your system's directory entries." >&4
8435         rp="What type is used for directory entries on this system?"
8436         dflt="$guess1"
8437         . ./myread
8438         direntrytype="$ans"
8439 fi
8440 $rm -f try.c
8441
8442
8443 : see if the directory entry stores field length
8444 echo " "
8445 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8446 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8447         echo "Good, your directory entry keeps length information in d_namlen." >&4
8448         val="$define"
8449 else
8450         echo "Your directory entry does not know about the d_namlen field." >&4
8451         val="$undef"
8452 fi
8453 set d_dirnamlen
8454 eval $setvar
8455 $rm -f try.c
8456
8457 : see if dlerror exists
8458 xxx_runnm="$runnm"
8459 runnm=false
8460 set dlerror d_dlerror
8461 eval $inlibc
8462 runnm="$xxx_runnm"
8463
8464 : see if dlfcn is available
8465 set dlfcn.h i_dlfcn
8466 eval $inhdr
8467
8468 case "$usedl" in
8469 $define|y|true)
8470         $cat << EOM
8471
8472 On a few systems, the dynamically loaded modules that perl generates and uses
8473 will need a different extension than shared libs. The default will probably
8474 be appropriate.
8475
8476 EOM
8477         case "$dlext" in
8478         '')     dflt="$so" ;;
8479         *)      dflt="$dlext" ;;
8480         esac
8481         rp='What is the extension of dynamically loaded modules'
8482         . ./myread
8483         dlext="$ans"
8484         ;;
8485 *)
8486         dlext="none"
8487         ;;
8488 esac
8489
8490 : Check if dlsym need a leading underscore
8491 echo " "
8492 val="$undef"
8493
8494 case "$dlsrc" in
8495 dl_dlopen.xs)
8496         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8497         $cat >dyna.c <<'EOM'
8498 fred () { }
8499 EOM
8500
8501 $cat >fred.c<<EOM
8502
8503 #include <stdio.h>
8504 #$i_dlfcn I_DLFCN
8505 #ifdef I_DLFCN
8506 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8507 #else
8508 #include <sys/types.h>
8509 #include <nlist.h>
8510 #include <link.h>
8511 #endif
8512
8513 extern int fred() ;
8514
8515 int main()
8516 {
8517     void * handle ;
8518     void * symbol ;
8519 #ifndef RTLD_LAZY
8520     int mode = 1 ;
8521 #else
8522     int mode = RTLD_LAZY ;
8523 #endif
8524     handle = dlopen("./dyna.$dlext", mode) ;
8525     if (handle == NULL) {
8526         printf ("1\n") ;
8527         fflush (stdout) ;
8528         exit(0);
8529     }
8530     symbol = dlsym(handle, "fred") ;
8531     if (symbol == NULL) {
8532         /* try putting a leading underscore */
8533         symbol = dlsym(handle, "_fred") ;
8534         if (symbol == NULL) {
8535             printf ("2\n") ;
8536             fflush (stdout) ;
8537             exit(0);
8538         }
8539         printf ("3\n") ;
8540     }
8541     else
8542         printf ("4\n") ;
8543     fflush (stdout) ;
8544     exit(0);
8545 }
8546 EOM
8547         : Call the object file tmp-dyna.o in case dlext=o.
8548         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8549                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8550                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8551                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8552                 xxx=`./fred`
8553                 case $xxx in
8554                 1)      echo "Test program failed using dlopen." >&4
8555                         echo "Perhaps you should not use dynamic loading." >&4;;
8556                 2)      echo "Test program failed using dlsym." >&4
8557                         echo "Perhaps you should not use dynamic loading." >&4;;
8558                 3)      echo "dlsym needs a leading underscore" >&4
8559                         val="$define" ;;
8560                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8561                 esac
8562         else
8563                 echo "I can't compile and run the test program." >&4
8564                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8565         fi
8566         ;;
8567 esac
8568                 
8569 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8570
8571 set d_dlsymun
8572 eval $setvar
8573
8574 hasproto='varname=$1; func=$2; shift; shift;
8575 while $test $# -ge 2; do
8576         case "$1" in
8577         $define) echo "#include <$2>";;
8578         esac ;
8579     shift 2;
8580 done > try.c;
8581 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8582 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8583         echo "$func() prototype found.";
8584         val="$define";
8585 else
8586         echo "$func() prototype NOT found.";
8587         val="$undef";
8588 fi;
8589 set $varname;
8590 eval $setvar;
8591 $rm -f try.c tryout.c'
8592
8593 : see if prototype for drand48 is available
8594 echo " "
8595 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8596 eval $hasproto
8597
8598 : see if dup2 exists
8599 set dup2 d_dup2
8600 eval $inlibc
8601
8602 : see if eaccess exists
8603 set eaccess d_eaccess
8604 eval $inlibc
8605
8606 : see if endgrent exists
8607 set endgrent d_endgrent
8608 eval $inlibc
8609
8610 : see if endhostent exists
8611 set endhostent d_endhent
8612 eval $inlibc
8613
8614 : see if endnetent exists
8615 set endnetent d_endnent
8616 eval $inlibc
8617
8618 : see if endprotoent exists
8619 set endprotoent d_endpent
8620 eval $inlibc
8621
8622 : see if endpwent exists
8623 set endpwent d_endpwent
8624 eval $inlibc
8625
8626 : see if endservent exists
8627 set endservent d_endsent
8628 eval $inlibc
8629
8630 : Locate the flags for 'open()'
8631 echo " "
8632 $cat >open3.c <<'EOCP'
8633 #include <sys/types.h>
8634 #ifdef I_FCNTL
8635 #include <fcntl.h>
8636 #endif
8637 #ifdef I_SYS_FILE
8638 #include <sys/file.h>
8639 #endif
8640 int main() {
8641         if(O_RDONLY);
8642 #ifdef O_TRUNC
8643         exit(0);
8644 #else
8645         exit(1);
8646 #endif
8647 }
8648 EOCP
8649 : check sys/file.h first to get FREAD on Sun
8650 if $test `./findhdr sys/file.h` && \
8651                 set open3 -DI_SYS_FILE && eval $compile; then
8652         h_sysfile=true;
8653         echo "<sys/file.h> defines the O_* constants..." >&4
8654         if ./open3; then
8655                 echo "and you have the 3 argument form of open()." >&4
8656                 val="$define"
8657         else
8658                 echo "but not the 3 argument form of open().  Oh, well." >&4
8659                 val="$undef"
8660         fi
8661 elif $test `./findhdr fcntl.h` && \
8662                 set open3 -DI_FCNTL && eval $compile; then
8663         h_fcntl=true;
8664         echo "<fcntl.h> defines the O_* constants..." >&4
8665         if ./open3; then
8666                 echo "and you have the 3 argument form of open()." >&4
8667                 val="$define"
8668         else
8669                 echo "but not the 3 argument form of open().  Oh, well." >&4
8670                 val="$undef"
8671         fi
8672 else
8673         val="$undef"
8674         echo "I can't find the O_* constant definitions!  You got problems." >&4
8675 fi
8676 set d_open3
8677 eval $setvar
8678 $rm -f open3*
8679
8680 : see which of string.h or strings.h is needed
8681 echo " "
8682 strings=`./findhdr string.h`
8683 if $test "$strings" && $test -r "$strings"; then
8684         echo "Using <string.h> instead of <strings.h>." >&4
8685         val="$define"
8686 else
8687         val="$undef"
8688         strings=`./findhdr strings.h`
8689         if $test "$strings" && $test -r "$strings"; then
8690                 echo "Using <strings.h> instead of <string.h>." >&4
8691         else
8692                 echo "No string header found -- You'll surely have problems." >&4
8693         fi
8694 fi
8695 set i_string
8696 eval $setvar
8697 case "$i_string" in
8698 "$undef") strings=`./findhdr strings.h`;;
8699 *)        strings=`./findhdr string.h`;;
8700 esac
8701
8702 : check for non-blocking I/O stuff
8703 case "$h_sysfile" in
8704 true) echo "#include <sys/file.h>" > head.c;;
8705 *)
8706         case "$h_fcntl" in
8707         true) echo "#include <fcntl.h>" > head.c;;
8708         *) echo "#include <sys/fcntl.h>" > head.c;;
8709         esac
8710         ;;
8711 esac
8712 echo " "
8713 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8714 case "$o_nonblock" in
8715 '')
8716         $cat head.c > try.c
8717         $cat >>try.c <<'EOCP'
8718 #include <stdio.h>
8719 int main() {
8720 #ifdef O_NONBLOCK
8721         printf("O_NONBLOCK\n");
8722         exit(0);
8723 #endif
8724 #ifdef O_NDELAY
8725         printf("O_NDELAY\n");
8726         exit(0);
8727 #endif
8728 #ifdef FNDELAY
8729         printf("FNDELAY\n");
8730         exit(0);
8731 #endif
8732         exit(0);
8733 }
8734 EOCP
8735         set try
8736         if eval $compile_ok; then
8737                 o_nonblock=`./try`
8738                 case "$o_nonblock" in
8739                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8740                 *) echo "Seems like we can use $o_nonblock.";;
8741                 esac
8742         else
8743                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8744         fi
8745         ;;
8746 *) echo "Using $hint value $o_nonblock.";;
8747 esac
8748 $rm -f try try.* .out core
8749
8750 echo " "
8751 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8752 case "$eagain" in
8753 '')
8754         $cat head.c > try.c
8755         $cat >>try.c <<EOCP
8756 #include <errno.h>
8757 #include <sys/types.h>
8758 #include <signal.h>
8759 #include <stdio.h> 
8760 #define MY_O_NONBLOCK $o_nonblock
8761 #ifndef errno  /* XXX need better Configure test */
8762 extern int errno;
8763 #endif
8764 #$i_unistd I_UNISTD
8765 #ifdef I_UNISTD
8766 #include <unistd.h>
8767 #endif
8768 #$i_string I_STRING
8769 #ifdef I_STRING
8770 #include <string.h>
8771 #else
8772 #include <strings.h>
8773 #endif
8774 $signal_t blech(x) int x; { exit(3); }
8775 EOCP
8776         $cat >> try.c <<'EOCP'
8777 int main()
8778 {
8779         int pd[2];
8780         int pu[2];
8781         char buf[1];
8782         char string[100];
8783
8784         pipe(pd);       /* Down: child -> parent */
8785         pipe(pu);       /* Up: parent -> child */
8786         if (0 != fork()) {
8787                 int ret;
8788                 close(pd[1]);   /* Parent reads from pd[0] */
8789                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8790                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8791                         exit(1);
8792                 signal(SIGALRM, blech);
8793                 alarm(5);
8794                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8795                         exit(2);
8796                 sprintf(string, "%d\n", ret);
8797                 write(2, string, strlen(string));
8798                 alarm(0);
8799 #ifdef EAGAIN
8800                 if (errno == EAGAIN) {
8801                         printf("EAGAIN\n");
8802                         goto ok;
8803                 }
8804 #endif
8805 #ifdef EWOULDBLOCK
8806                 if (errno == EWOULDBLOCK)
8807                         printf("EWOULDBLOCK\n");
8808 #endif
8809         ok:
8810                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8811                 sleep(2);                               /* Give it time to close our pipe */
8812                 alarm(5);
8813                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8814                 alarm(0);
8815                 sprintf(string, "%d\n", ret);
8816                 write(3, string, strlen(string));
8817                 exit(0);
8818         }
8819
8820         close(pd[0]);                   /* We write to pd[1] */
8821         close(pu[1]);                   /* We read from pu[0] */
8822         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8823         close(pd[1]);                   /* Pipe pd is now fully closed! */
8824         exit(0);                                /* Bye bye, thank you for playing! */
8825 }
8826 EOCP
8827         set try
8828         if eval $compile_ok; then
8829                 echo "$startsh" >mtry
8830                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8831                 chmod +x mtry
8832                 ./mtry >/dev/null 2>&1
8833                 case $? in
8834                 0) eagain=`$cat try.out`;;
8835                 1) echo "Could not perform non-blocking setting!";;
8836                 2) echo "I did a successful read() for something that was not there!";;
8837                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8838                 *) echo "Something terribly wrong happened during testing.";;
8839                 esac
8840                 rd_nodata=`$cat try.ret`
8841                 echo "A read() system call with no data present returns $rd_nodata."
8842                 case "$rd_nodata" in
8843                 0|-1) ;;
8844                 *)
8845                         echo "(That's peculiar, fixing that to be -1.)"
8846                         rd_nodata=-1
8847                         ;;
8848                 esac
8849                 case "$eagain" in
8850                 '')
8851                         echo "Forcing errno EAGAIN on read() with no data available."
8852                         eagain=EAGAIN
8853                         ;;
8854                 *)
8855                         echo "Your read() sets errno to $eagain when no data is available."
8856                         ;;
8857                 esac
8858                 status=`$cat try.err`
8859                 case "$status" in
8860                 0) echo "And it correctly returns 0 to signal EOF.";;
8861                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8862                 *) echo "However, your read() returns '$status' on EOF??";;
8863                 esac
8864                 val="$define"
8865                 if test "$status" = "$rd_nodata"; then
8866                         echo "WARNING: you can't distinguish between EOF and no data!"
8867                         val="$undef"
8868                 fi
8869         else
8870                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8871                 eagain=EAGAIN
8872         fi
8873         set d_eofnblk
8874         eval $setvar
8875         ;;
8876 *)
8877         echo "Using $hint value $eagain."
8878         echo "Your read() returns $rd_nodata when no data is present."
8879         case "$d_eofnblk" in
8880         "$define") echo "And you can see EOF because read() returns 0.";;
8881         "$undef") echo "But you can't see EOF status from read() returned value.";;
8882         *)
8883                 echo "(Assuming you can't see EOF status from read anyway.)"
8884                 d_eofnblk=$undef
8885                 ;;
8886         esac
8887         ;;
8888 esac
8889 $rm -f try try.* .out core head.c mtry
8890
8891 : see if fchmod exists
8892 set fchmod d_fchmod
8893 eval $inlibc
8894
8895 : see if fchown exists
8896 set fchown d_fchown
8897 eval $inlibc
8898
8899 : see if this is an fcntl system
8900 set fcntl d_fcntl
8901 eval $inlibc
8902
8903 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8904 while $test $# -ge 2; do
8905         case "$1" in
8906         $define) echo "#include <$2>";;
8907         esac ;
8908     shift 2;
8909 done > try.c;
8910 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8911 set try;
8912 if eval $compile; then
8913         val="$define";
8914 else
8915         val="$undef";
8916 fi;
8917 set $varname;
8918 eval $setvar;
8919 $rm -f try.c try.o'
8920
8921 socketlib=''
8922 sockethdr=''
8923 : see whether socket exists
8924 echo " "
8925 $echo $n "Hmm... $c" >&4
8926 if set socket val -f d_socket; eval $csym; $val; then
8927         echo "Looks like you have Berkeley networking support." >&4
8928         d_socket="$define"
8929         if set setsockopt val -f; eval $csym; $val; then
8930                 d_oldsock="$undef"
8931         else
8932                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8933                 d_oldsock="$define"
8934         fi
8935 else
8936         if $contains socklib libc.list >/dev/null 2>&1; then
8937                 echo "Looks like you have Berkeley networking support." >&4
8938                 d_socket="$define"
8939                 : we will have to assume that it supports the 4.2 BSD interface
8940                 d_oldsock="$undef"
8941         else
8942                 echo "You don't have Berkeley networking in libc$_a..." >&4
8943                 if test "X$d_socket" = "X$define"; then
8944                    echo "...but you seem to believe that you have sockets." >&4
8945                 else
8946                         for net in net socket
8947                         do
8948                                 if test -f /usr/lib/lib$net$_a; then
8949                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8950                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8951                                         if $contains socket libc.list >/dev/null 2>&1; then
8952                                                 d_socket="$define"
8953                                                 socketlib="-l$net"
8954                                                 case "$net" in
8955                                                 net)
8956                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8957                                                         sockethdr="-I/usr/netinclude"
8958                                                         ;;
8959                                                 esac
8960                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8961                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8962                                                         d_oldsock="$undef"
8963                                                 else
8964                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8965                                                         d_oldsock="$define"
8966                                                 fi
8967                                                 break
8968                                         fi
8969                                 fi
8970                         done
8971                         if test "X$d_socket" != "X$define"; then
8972                            echo "or anywhere else I see." >&4
8973                            d_socket="$undef"
8974                            d_oldsock="$undef"
8975                         fi
8976                 fi
8977         fi
8978 fi
8979
8980 : see if socketpair exists
8981 set socketpair d_sockpair
8982 eval $inlibc
8983
8984
8985 echo " "
8986 echo "Checking the availability of certain socket constants..." >& 4
8987 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8988         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8989         $cat >try.c <<EOF
8990 #include <sys/types.h>
8991 #include <sys/socket.h>
8992 int main() {
8993     int i = $ENUM;
8994 }
8995 EOF
8996         val="$undef"
8997         set try; if eval $compile; then
8998                 val="$define"
8999         fi
9000         set d_${enum}; eval $setvar
9001         $rm -f try.c try
9002 done
9003
9004 : see if sys/select.h has to be included
9005 set sys/select.h i_sysselct
9006 eval $inhdr
9007
9008 : see if we should include time.h, sys/time.h, or both
9009 echo " "
9010 if test "X$timeincl" = X; then
9011         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9012         $echo $n "I'm now running the test program...$c"
9013         $cat >try.c <<'EOCP'
9014 #include <sys/types.h>
9015 #ifdef I_TIME
9016 #include <time.h>
9017 #endif
9018 #ifdef I_SYSTIME
9019 #ifdef SYSTIMEKERNEL
9020 #define KERNEL
9021 #endif
9022 #include <sys/time.h>
9023 #endif
9024 #ifdef I_SYSSELECT
9025 #include <sys/select.h>
9026 #endif
9027 int main()
9028 {
9029         struct tm foo;
9030 #ifdef S_TIMEVAL
9031         struct timeval bar;
9032 #endif
9033 #ifdef S_TIMEZONE
9034         struct timezone tzp;
9035 #endif
9036         if (foo.tm_sec == foo.tm_sec)
9037                 exit(0);
9038 #ifdef S_TIMEVAL
9039         if (bar.tv_sec == bar.tv_sec)
9040                 exit(0);
9041 #endif
9042         exit(1);
9043 }
9044 EOCP
9045         flags=''
9046         for s_timezone in '-DS_TIMEZONE' ''; do
9047         sysselect=''
9048         for s_timeval in '-DS_TIMEVAL' ''; do
9049         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9050         for i_time in '' '-DI_TIME'; do
9051         for i_systime in '-DI_SYSTIME' ''; do
9052                 case "$flags" in
9053                 '') $echo $n ".$c"
9054                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9055                         if eval $compile; then
9056                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9057                                 shift
9058                                 flags="$*"
9059                                 echo " "
9060                                 $echo $n "Succeeded with $flags$c"
9061                         fi
9062                         ;;
9063                 esac
9064         done
9065         done
9066         done
9067         done
9068         done
9069         timeincl=''
9070         echo " "
9071         case "$flags" in
9072         *SYSTIMEKERNEL*) i_systimek="$define"
9073                 timeincl=`./findhdr sys/time.h`
9074                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9075         *) i_systimek="$undef";;
9076         esac
9077         case "$flags" in
9078         *I_TIME*) i_time="$define"
9079                 timeincl=`./findhdr time.h`" $timeincl"
9080                 echo "We'll include <time.h>." >&4;;
9081         *) i_time="$undef";;
9082         esac
9083         case "$flags" in
9084         *I_SYSTIME*) i_systime="$define"
9085                 timeincl=`./findhdr sys/time.h`" $timeincl"
9086                 echo "We'll include <sys/time.h>." >&4;;
9087         *) i_systime="$undef";;
9088         esac
9089         $rm -f try.c try
9090 fi
9091
9092 : check for fd_set items
9093 $cat <<EOM
9094
9095 Checking to see how well your C compiler handles fd_set and friends ...
9096 EOM
9097 $cat >fd_set.c <<EOCP
9098 #$i_systime I_SYS_TIME
9099 #$i_sysselct I_SYS_SELECT
9100 #$d_socket HAS_SOCKET
9101 #include <sys/types.h>
9102 #ifdef HAS_SOCKET
9103 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9104 #endif
9105 #ifdef I_SYS_TIME
9106 #include <sys/time.h>
9107 #endif
9108 #ifdef I_SYS_SELECT
9109 #include <sys/select.h>
9110 #endif
9111 int main() {
9112         fd_set fds;
9113
9114 #ifdef TRYBITS
9115         if(fds.fds_bits);
9116 #endif
9117
9118 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9119         exit(0);
9120 #else
9121         exit(1);
9122 #endif
9123 }
9124 EOCP
9125 set fd_set -DTRYBITS
9126 if eval $compile; then
9127         d_fds_bits="$define"
9128         d_fd_set="$define"
9129         echo "Well, your system knows about the normal fd_set typedef..." >&4
9130         if ./fd_set; then
9131                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9132                 d_fd_macros="$define"
9133         else
9134                 $cat >&4 <<'EOM'
9135 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9136 EOM
9137                 d_fd_macros="$undef"
9138         fi
9139 else
9140         $cat <<'EOM'
9141 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9142 EOM
9143         set fd_set
9144         if eval $compile; then
9145                 d_fds_bits="$undef"
9146                 d_fd_set="$define"
9147                 echo "Well, your system has some sort of fd_set available..." >&4
9148                 if ./fd_set; then
9149                         echo "and you have the normal fd_set macros." >&4
9150                         d_fd_macros="$define"
9151                 else
9152                         $cat <<'EOM'
9153 but not the normal fd_set macros!  Gross!  More work for me...
9154 EOM
9155                         d_fd_macros="$undef"
9156                 fi
9157         else
9158         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9159                 d_fd_set="$undef"
9160                 d_fds_bits="$undef"
9161                 d_fd_macros="$undef"
9162         fi
9163 fi
9164 $rm -f fd_set*
9165
9166 : see if fgetpos exists
9167 set fgetpos d_fgetpos
9168 eval $inlibc
9169
9170 : see if flock exists
9171 set flock d_flock
9172 eval $inlibc
9173
9174 : see if fork exists
9175 set fork d_fork
9176 eval $inlibc
9177
9178 : see if pathconf exists
9179 set pathconf d_pathconf
9180 eval $inlibc
9181
9182 : see if fpathconf exists
9183 set fpathconf d_fpathconf
9184 eval $inlibc
9185
9186
9187 : check for fpos64_t
9188 echo " "
9189 echo "Checking to see if you have fpos64_t..." >&4
9190 $cat >try.c <<EOCP
9191 #include <stdio.h>
9192 int main() { fpos64_t x = 7; }
9193 EOCP
9194 set try
9195 if eval $compile; then
9196         val="$define"
9197         echo "You have fpos64_t."
9198 else
9199         val="$undef"
9200         echo "You do not have fpos64_t."
9201         case "$fpossize" in
9202         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9203         esac
9204 fi
9205 $rm -f try.* try
9206 set d_fpos64_t
9207 eval $setvar
9208
9209 : see if frexpl exists
9210 set frexpl d_frexpl
9211 eval $inlibc
9212
9213 hasstruct='varname=$1; struct=$2; shift; shift;
9214 while $test $# -ge 2; do
9215         case "$1" in
9216         $define) echo "#include <$2>";;
9217         esac ;
9218     shift 2;
9219 done > try.c;
9220 echo "int main () { struct $struct foo; }" >> try.c;
9221 set try;
9222 if eval $compile; then
9223         val="$define";
9224 else
9225         val="$undef";
9226 fi;
9227 set $varname;
9228 eval $setvar;
9229 $rm -f try.c try.o'
9230
9231 : see if this is a sys/param system
9232 set sys/param.h i_sysparam
9233 eval $inhdr
9234
9235 : see if this is a sys/mount.h system
9236 set sys/mount.h i_sysmount
9237 eval $inhdr
9238
9239 : see if sys/types.h has to be included
9240 set sys/types.h i_systypes
9241 eval $inhdr
9242
9243
9244 echo " "
9245 echo "Checking to see if your system supports struct fs_data..." >&4
9246 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9247 eval $hasstruct
9248 case "$d_fs_data_s" in
9249 "$define")      echo "Yes, it does."   ;;
9250 *)              echo "No, it doesn't." ;;
9251 esac
9252
9253 : see if fseeko exists
9254 set fseeko d_fseeko
9255 eval $inlibc
9256 case "$longsize" in
9257 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9258 esac
9259
9260 : see if fsetpos exists
9261 set fsetpos d_fsetpos
9262 eval $inlibc
9263
9264
9265 : see if fstatfs exists
9266 set fstatfs d_fstatfs
9267 eval $inlibc
9268
9269
9270 : see if statvfs exists
9271 set statvfs d_statvfs
9272 eval $inlibc
9273
9274 : see if fstatvfs exists
9275 set fstatvfs d_fstatvfs
9276 eval $inlibc
9277
9278
9279 : see if ftello exists
9280 set ftello d_ftello
9281 eval $inlibc
9282 case "$longsize" in
9283 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9284 esac
9285
9286 : see if getcwd exists
9287 set getcwd d_getcwd
9288 eval $inlibc
9289
9290 : see if getespwnam exists
9291 set getespwnam d_getespwnam
9292 eval $inlibc
9293
9294
9295 : see if getfsstat exists
9296 set getfsstat d_getfsstat
9297 eval $inlibc
9298
9299 : see if getgrent exists
9300 set getgrent d_getgrent
9301 eval $inlibc
9302
9303 : see if gethostbyaddr exists
9304 set gethostbyaddr d_gethbyaddr
9305 eval $inlibc
9306
9307 : see if gethostbyname exists
9308 set gethostbyname d_gethbyname
9309 eval $inlibc
9310
9311 : see if gethostent exists
9312 set gethostent d_gethent
9313 eval $inlibc
9314
9315 : see how we will look up host name
9316 echo " "
9317 call=''
9318 if set gethostname val -f d_gethname; eval $csym; $val; then
9319         echo 'gethostname() found.' >&4
9320         d_gethname="$define"
9321         call=gethostname
9322 fi
9323 if set uname val -f d_uname; eval $csym; $val; then
9324         if ./xenix; then
9325                 $cat <<'EOM'
9326 uname() was found, but you're running xenix, and older versions of xenix
9327 have a broken uname(). If you don't really know whether your xenix is old
9328 enough to have a broken system call, use the default answer.
9329
9330 EOM
9331                 dflt=y
9332                 case "$d_uname" in
9333                 "$define") dflt=n;;
9334                 esac
9335                 rp='Is your uname() broken?'
9336                 . ./myread
9337                 case "$ans" in
9338                 n*) d_uname="$define"; call=uname;;
9339                 esac
9340         else
9341                 echo 'uname() found.' >&4
9342                 d_uname="$define"
9343                 case "$call" in
9344                 '') call=uname ;;
9345                 esac
9346         fi
9347 fi
9348 case "$d_gethname" in
9349 '') d_gethname="$undef";;
9350 esac
9351 case "$d_uname" in
9352 '') d_uname="$undef";;
9353 esac
9354 case "$d_uname$d_gethname" in
9355 *define*)
9356         dflt=n
9357         cat <<EOM
9358  
9359 Every now and then someone has a $call() that lies about the hostname
9360 but can't be fixed for political or economic reasons.  If you wish, I can
9361 pretend $call() isn't there and maybe compute hostname at run-time
9362 thanks to the '$phostname' command.
9363
9364 EOM
9365         rp="Shall I ignore $call() from now on?"
9366         . ./myread
9367         case "$ans" in
9368         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9369         esac;;
9370 esac
9371 case "$phostname" in
9372 '') aphostname='';;
9373 *) case "$aphostname" in
9374         /*) ;;
9375         *) set X $phostname
9376                 shift
9377                 file=$1
9378                 shift
9379                 file=`./loc $file $file $pth`
9380                 aphostname=`echo $file $*`
9381                 ;;
9382         esac
9383         ;;
9384 esac
9385 case "$d_uname$d_gethname" in
9386 *define*) ;;
9387 *)
9388         case "$phostname" in
9389         '')
9390                 echo "There will be no way for $package to get your hostname." >&4;;
9391         *)
9392         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9393                 ;;
9394         esac;;
9395 esac
9396 case "$d_phostname" in
9397 '') d_phostname="$undef";;
9398 esac
9399
9400 : see if this is a netdb.h system
9401 set netdb.h i_netdb
9402 eval $inhdr
9403
9404 : see if prototypes for various gethostxxx netdb.h functions are available
9405 echo " "
9406 set d_gethostprotos gethostent $i_netdb netdb.h
9407 eval $hasproto
9408
9409 : see if getlogin exists
9410 set getlogin d_getlogin
9411 eval $inlibc
9412
9413 : see if getmnt exists
9414 set getmnt d_getmnt
9415 eval $inlibc
9416
9417 : see if getmntent exists
9418 set getmntent d_getmntent
9419 eval $inlibc
9420
9421 : see if getnetbyaddr exists
9422 set getnetbyaddr d_getnbyaddr
9423 eval $inlibc
9424
9425 : see if getnetbyname exists
9426 set getnetbyname d_getnbyname
9427 eval $inlibc
9428
9429 : see if getnetent exists
9430 set getnetent d_getnent
9431 eval $inlibc
9432
9433 : see if prototypes for various getnetxxx netdb.h functions are available
9434 echo " "
9435 set d_getnetprotos getnetent $i_netdb netdb.h
9436 eval $hasproto
9437
9438
9439 : see if getprotobyname exists
9440 set getprotobyname d_getpbyname
9441 eval $inlibc
9442
9443 : see if getprotobynumber exists
9444 set getprotobynumber d_getpbynumber
9445 eval $inlibc
9446
9447 : see if getprotoent exists
9448 set getprotoent d_getpent
9449 eval $inlibc
9450
9451 : see if getpgid exists
9452 set getpgid d_getpgid
9453 eval $inlibc
9454
9455 : see if getpgrp2 exists
9456 set getpgrp2 d_getpgrp2
9457 eval $inlibc
9458
9459 : see if getppid exists
9460 set getppid d_getppid
9461 eval $inlibc
9462
9463 : see if getpriority exists
9464 set getpriority d_getprior
9465 eval $inlibc
9466
9467 : see if prototypes for various getprotoxxx netdb.h functions are available
9468 echo " "
9469 set d_getprotoprotos getprotoent $i_netdb netdb.h
9470 eval $hasproto
9471
9472 : see if getprpwnam exists
9473 set getprpwnam d_getprpwnam
9474 eval $inlibc
9475
9476 : see if getpwent exists
9477 set getpwent d_getpwent
9478 eval $inlibc
9479
9480
9481 : see if getservbyname exists
9482 set getservbyname d_getsbyname
9483 eval $inlibc
9484
9485 : see if getservbyport exists
9486 set getservbyport d_getsbyport
9487 eval $inlibc
9488
9489 : see if getservent exists
9490 set getservent d_getsent
9491 eval $inlibc
9492
9493 : see if prototypes for various getservxxx netdb.h functions are available
9494 echo " "
9495 set d_getservprotos getservent $i_netdb netdb.h
9496 eval $hasproto
9497
9498 : see if getspnam exists
9499 set getspnam d_getspnam
9500 eval $inlibc
9501
9502 : see if gettimeofday or ftime exists
9503 set gettimeofday d_gettimeod
9504 eval $inlibc
9505 case "$d_gettimeod" in
9506 "$undef")
9507         set ftime d_ftime 
9508         eval $inlibc
9509         ;;
9510 *)
9511         val="$undef"; set d_ftime; eval $setvar
9512         ;;
9513 esac
9514 case "$d_gettimeod$d_ftime" in
9515 "$undef$undef")
9516         echo " "
9517         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9518         ;;
9519 esac
9520
9521 : see if this is an grp system
9522 set grp.h i_grp
9523 eval $inhdr
9524
9525 case "$i_grp" in
9526 $define)
9527         xxx=`./findhdr grp.h`
9528         $cppstdin $cppflags $cppminus < $xxx >$$.h
9529
9530         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9531                 val="$define"
9532         else
9533                 val="$undef"
9534         fi
9535         set d_grpasswd
9536         eval $setvar
9537
9538         $rm -f $$.h
9539         ;;
9540 *)
9541         val="$undef";
9542         set d_grpasswd; eval $setvar
9543         ;;
9544 esac
9545
9546 : see if hasmntopt exists
9547 set hasmntopt d_hasmntopt
9548 eval $inlibc
9549
9550 : see if this is a netinet/in.h or sys/in.h system
9551 set netinet/in.h i_niin sys/in.h i_sysin
9552 eval $inhdr
9553
9554 : see if arpa/inet.h has to be included
9555 set arpa/inet.h i_arpainet
9556 eval $inhdr
9557
9558 : see if htonl --and friends-- exists
9559 val=''
9560 set htonl val
9561 eval $inlibc
9562
9563 : Maybe they are macros.
9564 case "$val" in
9565 $undef)
9566         $cat >htonl.c <<EOM
9567 #include <stdio.h>
9568 #include <sys/types.h>
9569 #$i_niin I_NETINET_IN
9570 #$i_sysin I_SYS_IN
9571 #$i_arpainet I_ARPA_INET
9572 #ifdef I_NETINET_IN
9573 #include <netinet/in.h>
9574 #endif
9575 #ifdef I_SYS_IN
9576 #include <sys/in.h>
9577 #endif
9578 #ifdef I_ARPA_INET
9579 #include <arpa/inet.h>
9580 #endif
9581 #ifdef htonl
9582 printf("Defined as a macro.");
9583 #endif
9584 EOM
9585         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9586         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9587                 val="$define"
9588                 echo "But it seems to be defined as a macro." >&4
9589         fi
9590         $rm -f htonl.?
9591         ;;
9592 esac
9593 set d_htonl
9594 eval $setvar
9595
9596 : see if iconv exists
9597 set iconv d_iconv
9598 eval $inlibc
9599
9600 : index or strchr
9601 echo " "
9602 if set index val -f; eval $csym; $val; then
9603         if set strchr val -f d_strchr; eval $csym; $val; then
9604                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9605                         val="$define"
9606                         vali="$undef"
9607                         echo "strchr() found." >&4
9608                 else
9609                         val="$undef"
9610                         vali="$define"
9611                         echo "index() found." >&4
9612                 fi
9613         else
9614                 val="$undef"
9615                 vali="$define"
9616                 echo "index() found." >&4
9617         fi
9618 else
9619         if set strchr val -f d_strchr; eval $csym; $val; then
9620                 val="$define"
9621                 vali="$undef"
9622                 echo "strchr() found." >&4
9623         else
9624                 echo "No index() or strchr() found!" >&4
9625                 val="$undef"
9626                 vali="$undef"
9627         fi
9628 fi
9629 set d_strchr; eval $setvar
9630 val="$vali"
9631 set d_index; eval $setvar
9632
9633 : check whether inet_aton exists
9634 set inet_aton d_inetaton
9635 eval $inlibc
9636
9637 : see if inttypes.h is available
9638 : we want a real compile instead of Inhdr because some systems
9639 : have an inttypes.h which includes non-existent headers
9640 echo " "
9641 $cat >try.c <<EOCP
9642 #include <inttypes.h>
9643 int main() {
9644         static int32_t foo32 = 0x12345678;
9645 }
9646 EOCP
9647 set try
9648 if eval $compile; then
9649         echo "<inttypes.h> found." >&4
9650         val="$define"
9651 else
9652         echo "<inttypes.h> NOT found." >&4
9653         val="$undef"
9654 fi
9655 $rm -f try.c try
9656 set i_inttypes
9657 eval $setvar
9658
9659 : check for int64_t
9660 echo " "
9661 echo "Checking to see if you have int64_t..." >&4
9662 $cat >try.c <<EOCP
9663 #include <sys/types.h>
9664 #$i_inttypes I_INTTYPES
9665 #ifdef I_INTTYPES
9666 #include <inttypes.h>
9667 #endif
9668 int main() { int64_t x = 7; }
9669 EOCP
9670 set try
9671 if eval $compile; then
9672         val="$define"
9673         echo "You have int64_t."
9674 else
9675         val="$undef"
9676         echo "You do not have int64_t."
9677 fi
9678 $rm -f try try.*
9679 set d_int64_t
9680 eval $setvar
9681
9682 : Look for isascii
9683 echo " "
9684 $cat >isascii.c <<'EOCP'
9685 #include <stdio.h>
9686 #include <ctype.h>
9687 int main() {
9688         int c = 'A';
9689         if (isascii(c))
9690                 exit(0);
9691         else
9692                 exit(1);
9693 }
9694 EOCP
9695 set isascii
9696 if eval $compile; then
9697         echo "isascii() found." >&4
9698         val="$define"
9699 else
9700         echo "isascii() NOT found." >&4
9701         val="$undef"
9702 fi
9703 set d_isascii
9704 eval $setvar
9705 $rm -f isascii*
9706
9707 : see if isnan exists
9708 set isnan d_isnan
9709 eval $inlibc
9710
9711 : see if isnanl exists
9712 set isnanl d_isnanl
9713 eval $inlibc
9714
9715 : see if killpg exists
9716 set killpg d_killpg
9717 eval $inlibc
9718
9719 : see if lchown exists
9720 echo " "
9721 $cat > try.c <<'EOCP'
9722 /* System header to define __stub macros and hopefully few prototypes,
9723     which can conflict with char lchown(); below.  */
9724 #include <assert.h>
9725 /* Override any gcc2 internal prototype to avoid an error.  */
9726 /* We use char because int might match the return type of a gcc2
9727    builtin and then its argument prototype would still apply.  */
9728 char lchown();
9729 int main() {
9730     /*  The GNU C library defines this for functions which it implements
9731         to always fail with ENOSYS.  Some functions are actually named
9732         something starting with __ and the normal name is an alias.  */
9733 #if defined (__stub_lchown) || defined (__stub___lchown)
9734 choke me
9735 #else
9736 lchown();
9737 #endif
9738 ; return 0; }
9739 EOCP
9740 set try
9741 if eval $compile; then
9742     $echo "lchown() found." >&4
9743     val="$define"
9744 else
9745     $echo "lchown() NOT found." >&4
9746     val="$undef"
9747 fi
9748 set d_lchown
9749 eval $setvar
9750
9751 : See if number of significant digits in a double precision number is known
9752 echo " "
9753 $cat >ldbl_dig.c <<EOM
9754 #$i_limits I_LIMITS
9755 #$i_float I_FLOAT
9756 #ifdef I_LIMITS
9757 #include <limits.h>
9758 #endif
9759 #ifdef I_FLOAT
9760 #include <float.h>
9761 #endif
9762 #ifdef LDBL_DIG
9763 printf("Contains LDBL_DIG");
9764 #endif
9765 EOM
9766 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9767 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9768         echo "LDBL_DIG found." >&4
9769         val="$define"
9770 else
9771         echo "LDBL_DIG NOT found." >&4
9772         val="$undef"
9773 fi
9774 $rm -f ldbl_dig.?
9775 set d_ldbl_dig
9776 eval $setvar
9777
9778 : see if link exists
9779 set link d_link
9780 eval $inlibc
9781
9782 : see if localeconv exists
9783 set localeconv d_locconv
9784 eval $inlibc
9785
9786 : see if lockf exists
9787 set lockf d_lockf
9788 eval $inlibc
9789
9790 : check for long long
9791 echo " "
9792 echo "Checking to see if you have long long..." >&4
9793 echo 'int main() { long long x = 7; return 0; }' > try.c
9794 set try
9795 if eval $compile; then
9796         val="$define"
9797         echo "You have long long."
9798 else
9799         val="$undef"
9800         echo "You do not have long long."
9801 fi
9802 $rm try.*
9803 set d_longlong
9804 eval $setvar
9805
9806 : check for length of long long
9807 case "${d_longlong}${longlongsize}" in
9808 $define)
9809         echo " "
9810         echo "Checking to see how big your long longs are..." >&4
9811         $cat >try.c <<'EOCP'
9812 #include <stdio.h>
9813 int main()
9814 {
9815     printf("%d\n", (int)sizeof(long long));
9816     return(0);
9817 }
9818 EOCP
9819         set try
9820         if eval $compile_ok; then
9821                 longlongsize=`./try$exe_ext`
9822                 echo "Your long longs are $longlongsize bytes long."
9823         else
9824                 dflt='8'
9825                 echo " "
9826                 echo "(I can't seem to compile the test program.  Guessing...)"
9827                 rp="What is the size of a long long (in bytes)?"
9828                 . ./myread
9829                 longlongsize="$ans"
9830         fi
9831         if $test "X$longsize" = "X$longlongsize"; then
9832                 echo "(That isn't any different from an ordinary long.)"
9833         fi      
9834         ;;
9835 esac
9836 $rm -f try.* try
9837
9838 : see if prototype for lseek is available
9839 echo " "
9840 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9841 eval $hasproto
9842
9843 : see if lstat exists
9844 set lstat d_lstat
9845 eval $inlibc
9846
9847 : see if madvise exists
9848 set madvise d_madvise
9849 eval $inlibc
9850
9851 : see if mblen exists
9852 set mblen d_mblen
9853 eval $inlibc
9854
9855 : see if mbstowcs exists
9856 set mbstowcs d_mbstowcs
9857 eval $inlibc
9858
9859 : see if mbtowc exists
9860 set mbtowc d_mbtowc
9861 eval $inlibc
9862
9863 : see if memchr exists
9864 set memchr d_memchr
9865 eval $inlibc
9866
9867 : see if memcmp exists
9868 set memcmp d_memcmp
9869 eval $inlibc
9870
9871 : see if memcpy exists
9872 set memcpy d_memcpy
9873 eval $inlibc
9874
9875 : see if memmove exists
9876 set memmove d_memmove
9877 eval $inlibc
9878
9879 : see if memset exists
9880 set memset d_memset
9881 eval $inlibc
9882
9883 : see if mkdir exists
9884 set mkdir d_mkdir
9885 eval $inlibc
9886
9887 : see if mkdtemp exists
9888 set mkdtemp d_mkdtemp
9889 eval $inlibc
9890
9891 : see if mkfifo exists
9892 set mkfifo d_mkfifo
9893 eval $inlibc
9894
9895 : see if mkstemp exists
9896 set mkstemp d_mkstemp
9897 eval $inlibc
9898
9899 : see if mkstemps exists
9900 set mkstemps d_mkstemps
9901 eval $inlibc
9902
9903 : see if mktime exists
9904 set mktime d_mktime
9905 eval $inlibc
9906
9907 : see if this is a sys/mman.h system
9908 set sys/mman.h i_sysmman
9909 eval $inhdr
9910
9911 : see if mmap exists
9912 set mmap d_mmap
9913 eval $inlibc
9914 : see what shmat returns
9915 : default to something harmless
9916 mmaptype='void *'
9917 case "$i_sysmman$d_mmap" in
9918 "$define$define")
9919         $cat >mmap.c <<'END'
9920 #include <sys/mman.h>
9921 void *mmap();
9922 END
9923         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9924                 mmaptype='void *'
9925         else
9926                 mmaptype='caddr_t'
9927         fi
9928         echo "and it returns ($mmaptype)." >&4
9929         ;;
9930 esac
9931
9932
9933
9934 : see if modfl exists
9935 set modfl d_modfl
9936 eval $inlibc
9937
9938 : see if mprotect exists
9939 set mprotect d_mprotect
9940 eval $inlibc
9941
9942 : see if msgctl exists
9943 set msgctl d_msgctl
9944 eval $inlibc
9945
9946 : see if msgget exists
9947 set msgget d_msgget
9948 eval $inlibc
9949
9950 : see if msgsnd exists
9951 set msgsnd d_msgsnd
9952 eval $inlibc
9953
9954 : see if msgrcv exists
9955 set msgrcv d_msgrcv
9956 eval $inlibc
9957
9958 : see how much of the 'msg*(2)' library is present.
9959 h_msg=true
9960 echo " "
9961 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9962 *"$undef"*) h_msg=false;;
9963 esac
9964 case "$osname" in
9965 freebsd)
9966     case "`ipcs 2>&1`" in
9967     "SVID messages"*"not configured"*)
9968         echo "Your $osname does not have the msg*(2) configured." >&4
9969         h_msg=false
9970         val="$undef"
9971         set msgctl d_msgctl
9972         eval $setvar
9973         set msgget d_msgget
9974         eval $setvar
9975         set msgsnd d_msgsnd
9976         eval $setvar
9977         set msgrcv d_msgrcv
9978         eval $setvar
9979         ;;
9980     esac
9981     ;;
9982 esac
9983 : we could also check for sys/ipc.h ...
9984 if $h_msg && $test `./findhdr sys/msg.h`; then
9985         echo "You have the full msg*(2) library." >&4
9986         val="$define"
9987 else
9988         echo "You don't have the full msg*(2) library." >&4
9989         val="$undef"
9990 fi
9991 set d_msg
9992 eval $setvar
9993
9994 : see if msync exists
9995 set msync d_msync
9996 eval $inlibc
9997
9998 : see if munmap exists
9999 set munmap d_munmap
10000 eval $inlibc
10001
10002 : see if nice exists
10003 set nice d_nice
10004 eval $inlibc
10005
10006
10007 echo " "
10008 echo "Checking which 64-bit integer type we could use..." >&4
10009
10010 case "$intsize" in
10011 8) val=int
10012    set quadtype
10013    eval $setvar
10014    val='"unsigned int"'
10015    set uquadtype
10016    eval $setvar
10017    quadkind=1
10018    ;;
10019 *) case "$longsize" in
10020    8) val=long
10021       set quadtype
10022       eval $setvar
10023       val='"unsigned long"'
10024       set uquadtype
10025       eval $setvar
10026       quadkind=2
10027       ;;
10028    *) case "$d_longlong:$longlongsize" in
10029       define:8)
10030         val='"long long"'
10031         set quadtype
10032         eval $setvar
10033         val='"unsigned long long"'
10034         set uquadtype
10035         eval $setvar
10036         quadkind=3
10037         ;;
10038       *) case "$d_int64_t" in
10039          define)
10040            val=int64_t
10041            set quadtype
10042            eval $setvar
10043            val=uint64_t
10044            set uquadtype
10045            eval $setvar
10046            quadkind=4
10047            ;;
10048          esac
10049          ;;
10050       esac
10051       ;;
10052    esac
10053    ;;
10054 esac
10055
10056 case "$quadtype" in
10057 '')     echo "Alas, no 64-bit integer types in sight." >&4
10058         d_quad="$undef"
10059         ;;
10060 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10061             verb="will"
10062         else
10063             verb="could"
10064         fi
10065         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10066         d_quad="$define"
10067         ;;
10068 esac
10069
10070 : check for length of character
10071 echo " "
10072 case "$charsize" in
10073 '')
10074         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10075         $cat >try.c <<'EOCP'
10076 #include <stdio.h>
10077 int main()
10078 {
10079     printf("%d\n", (int)sizeof(char));
10080     exit(0);
10081 }
10082 EOCP
10083         set try
10084         if eval $compile_ok; then
10085                 dflt=`./try`
10086         else
10087                 dflt='1'
10088                 echo "(I can't seem to compile the test program.  Guessing...)"
10089         fi
10090         ;;
10091 *)
10092         dflt="$charsize"
10093         ;;
10094 esac
10095 rp="What is the size of a character (in bytes)?"
10096 . ./myread
10097 charsize="$ans"
10098 $rm -f try.c try
10099
10100
10101 echo " "
10102 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10103
10104 case "$use64bitint:$d_quad:$quadtype" in
10105 define:define:?*)
10106         ivtype="$quadtype"
10107         uvtype="$uquadtype"
10108         ivsize=8
10109         uvsize=8
10110         ;;
10111 *)      ivtype="long"
10112         uvtype="unsigned long"
10113         ivsize=$longsize
10114         uvsize=$longsize
10115         ;;
10116 esac
10117
10118 case "$uselongdouble:$d_longdbl" in
10119 define:define)
10120         nvtype="long double"
10121         nvsize=$longdblsize
10122         ;;
10123 *)      nvtype=double
10124         nvsize=$doublesize
10125         ;;
10126 esac
10127
10128 $echo "(IV will be "$ivtype", $ivsize bytes)"
10129 $echo "(UV will be "$uvtype", $uvsize bytes)"
10130 $echo "(NV will be "$nvtype", $nvsize bytes)"
10131
10132 $cat >try.c <<EOCP
10133 #$i_inttypes I_INTTYPES
10134 #ifdef I_INTTYPES
10135 #include <inttypes.h>
10136 #endif
10137 #include <stdio.h>
10138 int main() {
10139 #ifdef INT8
10140    int8_t i =  INT8_MAX;
10141   uint8_t u = UINT8_MAX;
10142   printf("int8_t\n");
10143 #endif
10144 #ifdef INT16
10145    int16_t i =  INT16_MAX;
10146   uint16_t i = UINT16_MAX;
10147   printf("int16_t\n");
10148 #endif
10149 #ifdef INT32
10150    int32_t i =  INT32_MAX;
10151   uint32_t u = UINT32_MAX;
10152   printf("int32_t\n");
10153 #endif
10154 }
10155 EOCP
10156
10157 case "$i8type" in
10158 '')     case "$charsize" in
10159         1)      i8type=char
10160                 u8type="unsigned char"
10161                 i8size=$charsize
10162                 u8size=$charsize
10163                 ;;
10164         esac
10165         ;;
10166 esac
10167 case "$i8type" in
10168 '')     set try -DINT8
10169         if eval $compile; then
10170                 case "`./try$exe_ext`" in
10171                 int8_t) i8type=int8_t
10172                         u8type=uint8_t
10173                         i8size=1
10174                         u8size=1
10175                         ;;
10176                 esac
10177         fi
10178         ;;
10179 esac
10180 case "$i8type" in
10181 '')     if $test $charsize -ge 1; then
10182                 i8type=char
10183                 u8type="unsigned char"
10184                 i8size=$charsize
10185                 u8size=$charsize
10186         fi
10187         ;;
10188 esac
10189
10190 case "$i16type" in
10191 '')     case "$shortsize" in
10192         2)      i16type=short
10193                 u16type="unsigned short"
10194                 i16size=$shortsize
10195                 u16size=$shortsize
10196                 ;;
10197         esac
10198         ;;
10199 esac
10200 case "$i16type" in
10201 '')     set try -DINT16
10202         if eval $compile; then
10203                 case "`./try$exe_ext`" in
10204                 int16_t)
10205                         i16type=int16_t
10206                         u16type=uint16_t
10207                         i16size=2
10208                         u16size=2
10209                         ;;
10210                 esac
10211         fi
10212         ;;
10213 esac
10214 case "$i16type" in
10215 '')     if $test $shortsize -ge 2; then
10216                 i16type=short
10217                 u16type="unsigned short"
10218                 i16size=$shortsize
10219                 u16size=$shortsize
10220         fi
10221         ;;
10222 esac
10223
10224 case "$i32type" in
10225 '')     case "$longsize" in
10226         4)      i32type=long
10227                 u32type="unsigned long"
10228                 i32size=$longsize
10229                 u32size=$longsize
10230                 ;;
10231         *)      case "$intsize" in
10232                 4)      i32type=int
10233                         u32type="unsigned int"
10234                         i32size=$intsize
10235                         u32size=$intsize
10236                         ;;
10237                 esac
10238                 ;;
10239         esac
10240         ;;
10241 esac
10242 case "$i32type" in
10243 '')     set try -DINT32
10244         if eval $compile; then
10245                 case "`./try$exe_ext`" in
10246                 int32_t)
10247                         i32type=int32_t
10248                         u32type=uint32_t
10249                         i32size=4
10250                         u32size=4
10251                         ;;
10252                 esac
10253         fi
10254         ;;
10255 esac
10256 case "$i32type" in
10257 '')     if $test $intsize -ge 4; then
10258                 i32type=int
10259                 u32type="unsigned int"
10260                 i32size=$intsize
10261                 u32size=$intsize
10262         fi
10263         ;;
10264 esac
10265
10266 case "$i64type" in
10267 '')     case "$d_quad:$quadtype" in
10268         define:?*)
10269                 i64type="$quadtype"
10270                 u64type="$uquadtype"
10271                 i64size=8
10272                 u64size=8
10273                 ;;
10274         esac
10275         ;;
10276 esac
10277
10278 $echo "Checking whether your NVs can preserve your UVs..." >&4
10279 $cat <<EOP >try.c
10280 #include <stdio.h>
10281 int main() {
10282     $uvtype k = ($uvtype)~0, l;
10283     $nvtype d;
10284     l = k;
10285     d = ($nvtype)l;
10286     l = ($uvtype)d;
10287     if (l == k)
10288        printf("preserve\n");
10289     exit(0);
10290 }
10291 EOP
10292 set try
10293 if eval $compile; then
10294         case "`./try$exe_ext`" in
10295         preserve) d_nv_preserves_uv="$define" ;;
10296         esac
10297 fi      
10298 case "$d_nv_preserves_uv" in
10299 $define) $echo "Yes, they can."  2>&1 ;;
10300 *)       $echo "No, they can't." 2>&1
10301          d_nv_preserves_uv="$undef"
10302          ;;
10303 esac
10304
10305 $rm -f try.* try
10306
10307 case "$d_nv_preserves_uv" in
10308 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10309 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10310         $cat <<EOP >try.c
10311 #include <stdio.h>
10312 int main() {
10313     $uvtype u = 0;
10314     int     n = 8 * $uvsize;
10315     int     i;
10316     for (i = 0; i < n; i++) {
10317       u = u << 1 | ($uvtype)1;
10318       if (($uvtype)($nvtype)u != u)
10319         break;
10320     }
10321     printf("%d\n", i);
10322     exit(0);
10323 }
10324 EOP
10325         set try
10326         if eval $compile; then
10327                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10328         fi
10329         case "$d_nv_preserves_uv_bits" in
10330         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10331         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10332                 d_nv_preserves_uv_bits="$undef"
10333                 ;;
10334         esac
10335         $rm -f try.* try
10336         ;;
10337 esac
10338
10339
10340
10341 : check for off64_t
10342 echo " "
10343 echo "Checking to see if you have off64_t..." >&4
10344 $cat >try.c <<EOCP
10345 #include <sys/types.h>
10346 #include <unistd.h>
10347 int main() { off64_t x = 7; }
10348 EOCP
10349 set try
10350 if eval $compile; then
10351         val="$define"
10352         echo "You have off64_t."
10353 else
10354         val="$undef"
10355         echo "You do not have off64_t."
10356         case "$lseeksize" in
10357         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10358         esac
10359 fi
10360 $rm -f try.* try
10361 set d_off64_t
10362 eval $setvar
10363
10364 : see if POSIX threads are available
10365 set pthread.h i_pthread
10366 eval $inhdr
10367
10368
10369
10370
10371 : how to create joinable pthreads
10372 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10373         echo " "
10374         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10375         $cat >try.c <<'EOCP'
10376 #include <pthread.h>
10377 int main() {
10378     int detachstate = JOINABLE;
10379 }
10380 EOCP
10381         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10382         if eval $compile; then
10383                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10384                 val="$undef" # Yes, undef.
10385                 set d_old_pthread_create_joinable
10386                 eval $setvar
10387                 val=""
10388                 set old_pthread_create_joinable
10389                 eval $setvar
10390         else
10391                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10392                 if eval $compile; then
10393                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10394                         val="$define"
10395                         set d_old_pthread_create_joinable
10396                         eval $setvar
10397                         val=PTHREAD_CREATE_UNDETACHED
10398                         set old_pthread_create_joinable
10399                         eval $setvar
10400                 else            
10401                         set try -DJOINABLE=__UNDETACHED
10402                         if eval $compile; then
10403                                 echo "You seem to use __UNDETACHED." >&4
10404                                 val="$define"
10405                                 set d_old_pthread_create_joinable
10406                                 eval $setvar
10407                                 val=__UNDETACHED
10408                                 set old_pthread_create_joinable
10409                                 eval $setvar
10410                         else
10411                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10412                                 val="$define"
10413                                 set d_old_pthread_create_joinable
10414                                 eval $setvar
10415                                 val=0
10416                                 set old_pthread_create_joinable
10417                                 eval $setvar
10418                         fi
10419                 fi
10420         fi
10421         $rm -f try try.*
10422 else
10423     d_old_pthread_create_joinable="$undef"
10424     old_pthread_create_joinable=""
10425 fi
10426
10427 : see if pause exists
10428 set pause d_pause
10429 eval $inlibc
10430
10431 : see if pipe exists
10432 set pipe d_pipe
10433 eval $inlibc
10434
10435 : see if poll exists
10436 set poll d_poll
10437 eval $inlibc
10438
10439
10440 : see whether the various POSIXish _yields exist
10441 $cat >try.c <<EOP
10442 #include <pthread.h>
10443 #include <stdio.h>
10444 int main() {
10445 #ifdef SCHED_YIELD
10446         sched_yield();
10447 #else
10448 #ifdef PTHREAD_YIELD
10449         pthread_yield();
10450 #else
10451 #ifdef PTHREAD_YIELD_NULL
10452         pthread_yield(NULL);
10453 #endif
10454 #endif
10455 #endif
10456 }
10457 EOP
10458 : see if sched_yield exists
10459 set try -DSCHED_YIELD
10460 if eval $compile; then
10461     val="$define"
10462     sched_yield='sched_yield()'
10463 else
10464     val="$undef"
10465 fi
10466 case "$usethreads" in
10467 $define)
10468         case "$val" in
10469         $define) echo 'sched_yield() found.' >&4        ;;
10470         *)       echo 'sched_yield() NOT found.' >&4    ;;
10471         esac
10472 esac
10473 set d_sched_yield
10474 eval $setvar
10475
10476 : see if pthread_yield exists
10477 set try -DPTHREAD_YIELD
10478 if eval $compile; then
10479     val="$define"
10480     case "$sched_yield" in
10481     '') sched_yield='pthread_yield()' ;;
10482     esac
10483 else
10484     set try -DPTHREAD_YIELD_NULL
10485     if eval $compile; then
10486         val="$define"
10487         case "$sched_yield" in
10488         '') sched_yield='pthread_yield(NULL)' ;;
10489         esac
10490     else
10491         val="$undef"
10492     fi
10493 fi
10494 case "$usethreads" in
10495 $define)
10496         case "$val" in
10497         $define) echo 'pthread_yield() found.' >&4      ;;
10498         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10499         esac
10500         ;;
10501 esac
10502 set d_pthread_yield
10503 eval $setvar
10504
10505 case "$sched_yield" in
10506 '') sched_yield=undef ;;
10507 esac
10508
10509 $rm -f try try.*
10510
10511 : see if this is a pwd.h system
10512 set pwd.h i_pwd
10513 eval $inhdr
10514
10515 case "$i_pwd" in
10516 $define)
10517         xxx=`./findhdr pwd.h`
10518         $cppstdin $cppflags $cppminus < $xxx >$$.h
10519
10520         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10521                 val="$define"
10522         else
10523                 val="$undef"
10524         fi
10525         set d_pwquota
10526         eval $setvar
10527
10528         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10529                 val="$define"
10530         else
10531                 val="$undef"
10532         fi
10533         set d_pwage
10534         eval $setvar
10535
10536         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10537                 val="$define"
10538         else
10539                 val="$undef"
10540         fi
10541         set d_pwchange
10542         eval $setvar
10543
10544         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10545                 val="$define"
10546         else
10547                 val="$undef"
10548         fi
10549         set d_pwclass
10550         eval $setvar
10551
10552         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10553                 val="$define"
10554         else
10555                 val="$undef"
10556         fi
10557         set d_pwexpire
10558         eval $setvar
10559
10560         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10561                 val="$define"
10562         else
10563                 val="$undef"
10564         fi
10565         set d_pwcomment
10566         eval $setvar
10567
10568         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10569                 val="$define"
10570         else
10571                 val="$undef"
10572         fi
10573         set d_pwgecos
10574         eval $setvar
10575
10576         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10577                 val="$define"
10578         else
10579                 val="$undef"
10580         fi
10581         set d_pwpasswd
10582         eval $setvar
10583
10584         $rm -f $$.h
10585         ;;
10586 *)
10587         val="$undef"; 
10588         set d_pwquota; eval $setvar
10589         set d_pwage; eval $setvar
10590         set d_pwchange; eval $setvar
10591         set d_pwclass; eval $setvar
10592         set d_pwexpire; eval $setvar
10593         set d_pwcomment; eval $setvar
10594         set d_pwgecos; eval $setvar
10595         set d_pwpasswd; eval $setvar
10596         ;;
10597 esac
10598
10599 : see if readdir and friends exist
10600 set readdir d_readdir
10601 eval $inlibc
10602 set seekdir d_seekdir
10603 eval $inlibc
10604 set telldir d_telldir
10605 eval $inlibc
10606 set rewinddir d_rewinddir
10607 eval $inlibc
10608
10609 : see if readlink exists
10610 set readlink d_readlink
10611 eval $inlibc
10612
10613 : see if rename exists
10614 set rename d_rename
10615 eval $inlibc
10616
10617 : see if rmdir exists
10618 set rmdir d_rmdir
10619 eval $inlibc
10620
10621 : see if memory.h is available.
10622 val=''
10623 set memory.h val
10624 eval $inhdr
10625
10626 : See if it conflicts with string.h
10627 case "$val" in
10628 $define)
10629         case "$strings" in
10630         '') ;;
10631         *)
10632                 $cppstdin $cppflags $cppminus < $strings > mem.h
10633                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10634                         echo " "
10635                         echo "We won't be including <memory.h>."
10636                         val="$undef"
10637                 fi
10638                 $rm -f mem.h
10639                 ;;
10640         esac
10641 esac
10642 set i_memory
10643 eval $setvar
10644
10645 : can bcopy handle overlapping blocks?
10646 val="$undef"
10647 case "$d_bcopy" in
10648 "$define")
10649         echo " "
10650         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10651         $cat >try.c <<EOCP
10652 #$i_memory I_MEMORY
10653 #$i_stdlib I_STDLIB
10654 #$i_string I_STRING
10655 #$i_unistd I_UNISTD
10656 EOCP
10657         $cat >>try.c <<'EOCP'
10658 #include <stdio.h>
10659 #ifdef I_MEMORY
10660 #  include <memory.h>
10661 #endif
10662 #ifdef I_STDLIB
10663 #  include <stdlib.h>
10664 #endif
10665 #ifdef I_STRING
10666 #  include <string.h>
10667 #else
10668 #  include <strings.h>
10669 #endif
10670 #ifdef I_UNISTD
10671 #  include <unistd.h>  /* Needed for NetBSD */
10672 #endif
10673 int main()
10674 {
10675 char buf[128], abc[128];
10676 char *b;
10677 int len;
10678 int off;
10679 int align;
10680
10681 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10682
10683 for (align = 7; align >= 0; align--) {
10684         for (len = 36; len; len--) {
10685                 b = buf+align;
10686                 bcopy(abc, b, len);
10687                 for (off = 1; off <= len; off++) {
10688                         bcopy(b, b+off, len);
10689                         bcopy(b+off, b, len);
10690                         if (bcmp(b, abc, len))
10691                                 exit(1);
10692                 }
10693         }
10694 }
10695 exit(0);
10696 }
10697 EOCP
10698         set try
10699         if eval $compile_ok; then
10700                 if ./try 2>/dev/null; then
10701                         echo "Yes, it can."
10702                         val="$define"
10703                 else
10704                         echo "It can't, sorry."
10705                         case "$d_memmove" in
10706                         "$define") echo "But that's Ok since you have memmove()." ;;
10707                         esac
10708                 fi
10709         else
10710                 echo "(I can't compile the test program, so we'll assume not...)"
10711                 case "$d_memmove" in
10712                 "$define") echo "But that's Ok since you have memmove()." ;;
10713                 esac
10714         fi
10715         ;;
10716 esac
10717 $rm -f try.* try core
10718 set d_safebcpy
10719 eval $setvar
10720
10721 : can memcpy handle overlapping blocks?
10722 val="$undef"
10723 case "$d_memcpy" in
10724 "$define")
10725         echo " "
10726         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10727         $cat >try.c <<EOCP
10728 #$i_memory I_MEMORY
10729 #$i_stdlib I_STDLIB
10730 #$i_string I_STRING
10731 #$i_unistd I_UNISTD
10732 EOCP
10733         $cat >>try.c <<'EOCP'
10734 #include <stdio.h>
10735 #ifdef I_MEMORY
10736 #  include <memory.h>
10737 #endif
10738 #ifdef I_STDLIB
10739 #  include <stdlib.h>
10740 #endif
10741 #ifdef I_STRING
10742 #  include <string.h>
10743 #else
10744 #  include <strings.h>
10745 #endif
10746 #ifdef I_UNISTD
10747 #  include <unistd.h>  /* Needed for NetBSD */
10748 #endif
10749 int main()
10750 {
10751 char buf[128], abc[128];
10752 char *b;
10753 int len;
10754 int off;
10755 int align;
10756
10757 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10758    try to store the string in read-only memory. */
10759 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10760
10761 for (align = 7; align >= 0; align--) {
10762         for (len = 36; len; len--) {
10763                 b = buf+align;
10764                 memcpy(b, abc, len);
10765                 for (off = 1; off <= len; off++) {
10766                         memcpy(b+off, b, len);
10767                         memcpy(b, b+off, len);
10768                         if (memcmp(b, abc, len))
10769                                 exit(1);
10770                 }
10771         }
10772 }
10773 exit(0);
10774 }
10775 EOCP
10776         set try
10777         if eval $compile_ok; then
10778                 if ./try 2>/dev/null; then
10779                         echo "Yes, it can."
10780                         val="$define"
10781                 else
10782                         echo "It can't, sorry."
10783                         case "$d_memmove" in
10784                         "$define") echo "But that's Ok since you have memmove()." ;;
10785                         esac
10786                 fi
10787         else
10788                 echo "(I can't compile the test program, so we'll assume not...)"
10789                 case "$d_memmove" in
10790                 "$define") echo "But that's Ok since you have memmove()." ;;
10791                 esac
10792         fi
10793         ;;
10794 esac
10795 $rm -f try.* try core
10796 set d_safemcpy
10797 eval $setvar
10798
10799 : can memcmp be trusted to compare relative magnitude?
10800 val="$undef"
10801 case "$d_memcmp" in
10802 "$define")
10803         echo " "
10804         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10805         $cat >try.c <<EOCP
10806 #$i_memory I_MEMORY
10807 #$i_stdlib I_STDLIB
10808 #$i_string I_STRING
10809 #$i_unistd I_UNISTD
10810 EOCP
10811         $cat >>try.c <<'EOCP'
10812 #include <stdio.h>
10813 #ifdef I_MEMORY
10814 #  include <memory.h>
10815 #endif
10816 #ifdef I_STDLIB
10817 #  include <stdlib.h>
10818 #endif
10819 #ifdef I_STRING
10820 #  include <string.h>
10821 #else
10822 #  include <strings.h>
10823 #endif
10824 #ifdef I_UNISTD
10825 #  include <unistd.h>  /* Needed for NetBSD */
10826 #endif
10827 int main()
10828 {
10829 char a = -1;
10830 char b = 0;
10831 if ((a < b) && memcmp(&a, &b, 1) < 0)
10832         exit(1);
10833 exit(0);
10834 }
10835 EOCP
10836         set try
10837         if eval $compile_ok; then
10838                 if ./try 2>/dev/null; then
10839                         echo "Yes, it can."
10840                         val="$define"
10841                 else
10842                         echo "No, it can't (it uses signed chars)."
10843                 fi
10844         else
10845                 echo "(I can't compile the test program, so we'll assume not...)"
10846         fi
10847         ;;
10848 esac
10849 $rm -f try.* try core
10850 set d_sanemcmp
10851 eval $setvar
10852
10853 : see if select exists
10854 set select d_select
10855 eval $inlibc
10856
10857 : see if semctl exists
10858 set semctl d_semctl
10859 eval $inlibc
10860
10861 : see if semget exists
10862 set semget d_semget
10863 eval $inlibc
10864
10865 : see if semop exists
10866 set semop d_semop
10867 eval $inlibc
10868
10869 : see how much of the 'sem*(2)' library is present.
10870 h_sem=true
10871 echo " "
10872 case "$d_semctl$d_semget$d_semop" in
10873 *"$undef"*) h_sem=false;;
10874 esac
10875 case "$osname" in
10876 freebsd)
10877     case "`ipcs 2>&1`" in
10878     "SVID messages"*"not configured"*)
10879         echo "Your $osname does not have the sem*(2) configured." >&4
10880         h_sem=false
10881         val="$undef"
10882         set semctl d_semctl
10883         eval $setvar
10884         set semget d_semget
10885         eval $setvar
10886         set semop d_semop
10887         eval $setvar
10888         ;;
10889     esac
10890     ;;
10891 esac
10892 : we could also check for sys/ipc.h ...
10893 if $h_sem && $test `./findhdr sys/sem.h`; then
10894         echo "You have the full sem*(2) library." >&4
10895         val="$define"
10896 else
10897         echo "You don't have the full sem*(2) library." >&4
10898         val="$undef"
10899 fi
10900 set d_sem
10901 eval $setvar
10902
10903 : see whether sys/sem.h defines union semun
10904 echo " "
10905 $cat > try.c <<'END'
10906 #include <sys/types.h>
10907 #include <sys/ipc.h>
10908 #include <sys/sem.h>
10909 int main () { union semun semun; semun.buf = 0; }
10910 END
10911 set try
10912 if eval $compile; then
10913     echo "You have union semun in <sys/sem.h>." >&4
10914     val="$define"
10915 else
10916     echo "You do not have union semun in <sys/sem.h>." >&4
10917     val="$undef"
10918 fi
10919 $rm -f try try.c try.h
10920 set d_union_semun
10921 eval $setvar
10922
10923 : see how to do semctl IPC_STAT
10924 case "$d_sem" in
10925 $define)
10926     : see whether semctl IPC_STAT can use union semun
10927     echo " "
10928     $cat > try.h <<END
10929 #ifndef S_IRUSR
10930 #   ifdef S_IREAD
10931 #       define S_IRUSR S_IREAD
10932 #       define S_IWUSR S_IWRITE
10933 #       define S_IXUSR S_IEXEC
10934 #   else
10935 #       define S_IRUSR 0400
10936 #       define S_IWUSR 0200
10937 #       define S_IXUSR 0100
10938 #   endif
10939 #   define S_IRGRP (S_IRUSR>>3)
10940 #   define S_IWGRP (S_IWUSR>>3)
10941 #   define S_IXGRP (S_IXUSR>>3)
10942 #   define S_IROTH (S_IRUSR>>6)
10943 #   define S_IWOTH (S_IWUSR>>6)
10944 #   define S_IXOTH (S_IXUSR>>6)
10945 #endif
10946 #ifndef S_IRWXU
10947 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10948 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10949 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10950 #endif
10951 END
10952
10953     $cat > try.c <<END
10954 #include <sys/types.h>
10955 #include <sys/ipc.h>
10956 #include <sys/sem.h>
10957 #include <sys/stat.h>
10958 #include <stdio.h>
10959 #include <errno.h>
10960 #include "try.h"
10961 #ifndef errno
10962 extern int errno;
10963 #endif
10964 #$d_union_semun HAS_UNION_SEMUN
10965 int main() {
10966     union semun
10967 #ifndef HAS_UNION_SEMUN
10968     {
10969         int val;
10970         struct semid_ds *buf;
10971         unsigned short *array;
10972     }
10973 #endif
10974     arg;
10975     int sem, st;
10976
10977 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10978     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10979     if (sem > -1) {
10980         struct semid_ds argbuf;
10981         arg.buf = &argbuf;
10982 #       ifdef IPC_STAT
10983         st = semctl(sem, 0, IPC_STAT, arg);
10984         if (st == 0)
10985             printf("semun\n");
10986         else
10987 #       endif /* IPC_STAT */
10988             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10989 #       ifdef IPC_RMID
10990         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10991 #       endif /* IPC_RMID */
10992             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10993     } else
10994 #endif /* IPC_PRIVATE && ... */
10995         printf("semget failed: errno = %d\n", errno);
10996   return 0;
10997 }
10998 END
10999     val="$undef"
11000     set try
11001     if eval $compile; then
11002         xxx=`./try`
11003         case "$xxx" in
11004         semun) val="$define" ;;
11005         esac
11006     fi
11007     $rm -f try try.c
11008     set d_semctl_semun
11009     eval $setvar
11010     case "$d_semctl_semun" in
11011     $define)
11012         echo "You can use union semun for semctl IPC_STAT." >&4
11013         also='also'
11014         ;;
11015     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11016         also=''
11017         ;;
11018     esac
11019
11020     : see whether semctl IPC_STAT can use struct semid_ds pointer
11021     $cat > try.c <<'END'
11022 #include <sys/types.h>
11023 #include <sys/ipc.h>
11024 #include <sys/sem.h>
11025 #include <sys/stat.h>
11026 #include "try.h"
11027 #include <stdio.h>
11028 #include <errno.h>
11029 #ifndef errno
11030 extern int errno;
11031 #endif
11032 int main() {
11033     struct semid_ds arg;
11034     int sem, st;
11035
11036 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11037     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11038     if (sem > -1) {
11039 #       ifdef IPC_STAT
11040         st = semctl(sem, 0, IPC_STAT, &arg);
11041         if (st == 0)
11042             printf("semid_ds\n");
11043         else
11044 #       endif /* IPC_STAT */
11045             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11046 #       ifdef IPC_RMID
11047         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11048 #       endif /* IPC_RMID */
11049             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11050     } else
11051 #endif /* IPC_PRIVATE && ... */
11052         printf("semget failed: errno = %d\n", errno);
11053
11054     return 0;
11055 }
11056 END
11057     val="$undef"
11058     set try
11059     if eval $compile; then
11060         xxx=`./try`
11061         case "$xxx" in
11062         semid_ds) val="$define" ;;
11063         esac
11064     fi
11065     $rm -f try try.c
11066     set d_semctl_semid_ds
11067     eval $setvar
11068     case "$d_semctl_semid_ds" in
11069     $define)
11070         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11071         ;;
11072     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11073         ;;
11074     esac
11075     $rm -f try.h
11076     ;;
11077 *)  val="$undef"
11078
11079     # We do not have the full sem*(2) library, so assume we can not
11080     # use either.
11081
11082     set d_semctl_semun
11083     eval $setvar
11084
11085     set d_semctl_semid_ds
11086     eval $setvar
11087     ;;
11088 esac
11089
11090 : see if setegid exists
11091 set setegid d_setegid
11092 eval $inlibc
11093
11094 : see if seteuid exists
11095 set seteuid d_seteuid
11096 eval $inlibc
11097
11098 : see if setgrent exists
11099 set setgrent d_setgrent
11100 eval $inlibc
11101
11102 : see if sethostent exists
11103 set sethostent d_sethent
11104 eval $inlibc
11105
11106 : see if setlinebuf exists
11107 set setlinebuf d_setlinebuf
11108 eval $inlibc
11109
11110 : see if setlocale exists
11111 set setlocale d_setlocale
11112 eval $inlibc
11113
11114 : see if setnetent exists
11115 set setnetent d_setnent
11116 eval $inlibc
11117
11118 : see if setprotoent exists
11119 set setprotoent d_setpent
11120 eval $inlibc
11121
11122 : see if setpgid exists
11123 set setpgid d_setpgid
11124 eval $inlibc
11125
11126 : see if setpgrp2 exists
11127 set setpgrp2 d_setpgrp2
11128 eval $inlibc
11129
11130 : see if setpriority exists
11131 set setpriority d_setprior
11132 eval $inlibc
11133
11134 : see if setproctitle exists
11135 set setproctitle d_setproctitle
11136 eval $inlibc
11137
11138 : see if setpwent exists
11139 set setpwent d_setpwent
11140 eval $inlibc
11141
11142 : see if setregid exists
11143 set setregid d_setregid
11144 eval $inlibc
11145 set setresgid d_setresgid
11146 eval $inlibc
11147
11148 : see if setreuid exists
11149 set setreuid d_setreuid
11150 eval $inlibc
11151 set setresuid d_setresuid
11152 eval $inlibc
11153
11154 : see if setrgid exists
11155 set setrgid d_setrgid
11156 eval $inlibc
11157
11158 : see if setruid exists
11159 set setruid d_setruid
11160 eval $inlibc
11161
11162 : see if setservent exists
11163 set setservent d_setsent
11164 eval $inlibc
11165
11166 : see if setsid exists
11167 set setsid d_setsid
11168 eval $inlibc
11169
11170 : see if setvbuf exists
11171 set setvbuf d_setvbuf
11172 eval $inlibc
11173
11174 : see if sfio.h is available
11175 set sfio.h i_sfio
11176 eval $inhdr
11177
11178
11179 : see if sfio library is available
11180 case "$i_sfio" in
11181 $define)
11182         val=''
11183         set sfreserve val
11184         eval $inlibc
11185         ;;
11186 *)
11187         val="$undef"
11188         ;;
11189 esac
11190 : Ok, but do we want to use it.
11191 case "$val" in
11192 $define)
11193         case "$usesfio" in
11194         true|$define|[yY]*) dflt='y';;
11195         *) dflt='n';;
11196         esac
11197         echo "$package can use the sfio library, but it is experimental."
11198         rp="You seem to have sfio available, do you want to try using it?"
11199         . ./myread
11200         case "$ans" in
11201         y|Y) ;;
11202         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11203                 val="$undef"
11204                 : Remove sfio from list of libraries to use
11205                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11206                 shift
11207                 libs="$*"
11208                 echo "libs = $libs" >&4
11209                 ;;
11210         esac
11211         ;;
11212 *)      case "$usesfio" in
11213         true|$define|[yY]*)
11214                 echo "Sorry, cannot find sfio on this machine" >&4
11215                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11216                 ;;
11217         esac
11218         ;;
11219 esac
11220 set d_sfio
11221 eval $setvar
11222 case "$d_sfio" in
11223 $define) usesfio='true';;
11224 *) usesfio='false';;
11225 esac
11226
11227 : see if shmctl exists
11228 set shmctl d_shmctl
11229 eval $inlibc
11230
11231 : see if shmget exists
11232 set shmget d_shmget
11233 eval $inlibc
11234
11235 : see if shmat exists
11236 set shmat d_shmat
11237 eval $inlibc
11238 : see what shmat returns
11239 case "$d_shmat" in
11240 "$define")
11241         $cat >shmat.c <<'END'
11242 #include <sys/shm.h>
11243 void *shmat();
11244 END
11245         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11246                 shmattype='void *'
11247         else
11248                 shmattype='char *'
11249         fi
11250         echo "and it returns ($shmattype)." >&4
11251         : see if a prototype for shmat is available
11252         xxx=`./findhdr sys/shm.h`
11253         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11254         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11255                 val="$define"
11256         else
11257                 val="$undef"
11258         fi
11259         $rm -f shmat.[co]
11260         ;;
11261 *)
11262         val="$undef"
11263         ;;
11264 esac
11265 set d_shmatprototype
11266 eval $setvar
11267
11268 : see if shmdt exists
11269 set shmdt d_shmdt
11270 eval $inlibc
11271
11272 : see how much of the 'shm*(2)' library is present.
11273 h_shm=true
11274 echo " "
11275 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11276 *"$undef"*) h_shm=false;;
11277 esac
11278 case "$osname" in
11279 freebsd)
11280     case "`ipcs 2>&1`" in
11281     "SVID shared memory"*"not configured"*)
11282         echo "Your $osname does not have the shm*(2) configured." >&4
11283         h_shm=false
11284         val="$undef"
11285         set shmctl d_shmctl
11286         evat $setvar
11287         set shmget d_shmget
11288         evat $setvar
11289         set shmat d_shmat
11290         evat $setvar
11291         set shmdt d_shmdt
11292         evat $setvar
11293         ;;
11294     esac
11295     ;;
11296 esac
11297 : we could also check for sys/ipc.h ...
11298 if $h_shm && $test `./findhdr sys/shm.h`; then
11299         echo "You have the full shm*(2) library." >&4
11300         val="$define"
11301 else
11302         echo "You don't have the full shm*(2) library." >&4
11303         val="$undef"
11304 fi
11305 set d_shm
11306 eval $setvar
11307
11308 echo " "
11309 : see if we have sigaction
11310 if set sigaction val -f d_sigaction; eval $csym; $val; then
11311         echo 'sigaction() found.' >&4
11312         $cat > try.c <<'EOP'
11313 #include <stdio.h>
11314 #include <sys/types.h>
11315 #include <signal.h>
11316 int main()
11317 {
11318     struct sigaction act, oact;
11319     act.sa_flags = 0;
11320     oact.sa_handler = 0;
11321     /* so that act and oact are used */
11322     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11323 }
11324 EOP
11325         set try
11326         if eval $compile_ok; then
11327                 val="$define"
11328         else
11329                 echo "But you don't seem to have a useable struct sigaction." >&4
11330                 val="$undef"
11331         fi
11332 else
11333         echo 'sigaction NOT found.' >&4
11334         val="$undef"
11335 fi
11336 set d_sigaction; eval $setvar
11337 $rm -f try try$_o try.c
11338
11339 : see if sigsetjmp exists
11340 echo " "
11341 case "$d_sigsetjmp" in
11342 '')
11343         $cat >try.c <<'EOP'
11344 #include <setjmp.h>
11345 sigjmp_buf env;
11346 int set = 1;
11347 int main()
11348 {
11349         if (sigsetjmp(env,1))
11350                 exit(set);
11351         set = 0;
11352         siglongjmp(env, 1);
11353         exit(1);
11354 }
11355 EOP
11356         set try
11357         if eval $compile; then
11358                 if ./try >/dev/null 2>&1; then
11359                         echo "POSIX sigsetjmp found." >&4
11360                         val="$define"
11361                 else
11362                         $cat >&4 <<EOM
11363 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11364 I'll ignore them.
11365 EOM
11366                         val="$undef"
11367                 fi
11368         else
11369                 echo "sigsetjmp not found." >&4
11370                 val="$undef"
11371         fi
11372         ;;
11373 *) val="$d_sigsetjmp"
11374         case "$d_sigsetjmp" in
11375         $define) echo "POSIX sigsetjmp found." >&4;;
11376         $undef) echo "sigsetjmp not found." >&4;;
11377         esac
11378         ;;
11379 esac
11380 set d_sigsetjmp
11381 eval $setvar
11382 $rm -f try.c try
11383
11384 : see if sys/stat.h is available
11385 set sys/stat.h i_sysstat
11386 eval $inhdr
11387
11388
11389 : see if stat knows about block sizes
11390 echo " "
11391 echo "Checking to see if your struct stat has st_blocks field..." >&4
11392 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11393 eval $hasfield
11394
11395
11396 : see if this is a sys/vfs.h system
11397 set sys/vfs.h i_sysvfs
11398 eval $inhdr
11399
11400
11401 : see if this is a sys/statfs.h system
11402 set sys/statfs.h i_sysstatfs
11403 eval $inhdr
11404
11405
11406 echo " "
11407 echo "Checking to see if your system supports struct statfs..." >&4
11408 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
11409 eval $hasstruct
11410 case "$d_statfs_s" in
11411 "$define")      echo "Yes, it does."   ;;
11412 *)              echo "No, it doesn't." ;;
11413 esac
11414
11415
11416
11417 : see if struct statfs knows about f_flags
11418 case "$d_statfs_s" in
11419 define) 
11420         echo " "
11421         echo "Checking to see if your struct statfs has f_flags field..." >&4
11422         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
11423         eval $hasfield
11424         ;;
11425 *)      val="$undef"
11426         set d_statfs_f_flags
11427         eval $setvar
11428         ;;
11429 esac
11430 case "$d_statfs_f_flags" in
11431 "$define")      echo "Yes, it does."   ;;
11432 *)              echo "No, it doesn't." ;;
11433 esac
11434
11435 : see if _ptr and _cnt from stdio act std
11436 echo " "
11437 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11438         echo "(Looks like you have stdio.h from Linux.)"
11439         case "$stdio_ptr" in
11440         '') stdio_ptr='((fp)->_IO_read_ptr)'
11441                 ptr_lval=$define
11442                 ;;
11443         *)      ptr_lval=$d_stdio_ptr_lval;;
11444         esac
11445         case "$stdio_cnt" in
11446         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11447                 cnt_lval=$undef
11448                 ;;
11449         *)      cnt_lval=$d_stdio_cnt_lval;;
11450         esac
11451         case "$stdio_base" in
11452         '') stdio_base='((fp)->_IO_read_base)';;
11453         esac
11454         case "$stdio_bufsiz" in
11455         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11456         esac
11457 else
11458         case "$stdio_ptr" in
11459         '') stdio_ptr='((fp)->_ptr)'
11460                 ptr_lval=$define
11461                 ;;
11462         *)      ptr_lval=$d_stdio_ptr_lval;;
11463         esac
11464         case "$stdio_cnt" in
11465         '') stdio_cnt='((fp)->_cnt)'
11466                 cnt_lval=$define
11467                 ;;
11468         *)      cnt_lval=$d_stdio_cnt_lval;;
11469         esac
11470         case "$stdio_base" in
11471         '') stdio_base='((fp)->_base)';;
11472         esac
11473         case "$stdio_bufsiz" in
11474         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11475         esac
11476 fi
11477 : test whether _ptr and _cnt really work
11478 echo "Checking how std your stdio is..." >&4
11479 $cat >try.c <<EOP
11480 #include <stdio.h>
11481 #define FILE_ptr(fp)    $stdio_ptr
11482 #define FILE_cnt(fp)    $stdio_cnt
11483 int main() {
11484         FILE *fp = fopen("try.c", "r");
11485         char c = getc(fp);
11486         if (
11487                 18 <= FILE_cnt(fp) &&
11488                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11489         )
11490                 exit(0);
11491         exit(1);
11492 }
11493 EOP
11494 val="$undef"
11495 set try
11496 if eval $compile; then
11497         if ./try; then
11498                 echo "Your stdio acts pretty std."
11499                 val="$define"
11500         else
11501                 echo "Your stdio isn't very std."
11502         fi
11503 else
11504         echo "Your stdio doesn't appear very std."
11505 fi
11506 $rm -f try.c try
11507 set d_stdstdio
11508 eval $setvar
11509
11510 : Can _ptr be used as an lvalue?
11511 case "$d_stdstdio$ptr_lval" in
11512 $define$define) val=$define ;;
11513 *) val=$undef ;;
11514 esac
11515 set d_stdio_ptr_lval
11516 eval $setvar
11517
11518 : Can _cnt be used as an lvalue?
11519 case "$d_stdstdio$cnt_lval" in
11520 $define$define) val=$define ;;
11521 *) val=$undef ;;
11522 esac
11523 set d_stdio_cnt_lval
11524 eval $setvar
11525
11526 : see if _base is also standard
11527 val="$undef"
11528 case "$d_stdstdio" in
11529 $define)
11530         $cat >try.c <<EOP
11531 #include <stdio.h>
11532 #define FILE_base(fp)   $stdio_base
11533 #define FILE_bufsiz(fp) $stdio_bufsiz
11534 int main() {
11535         FILE *fp = fopen("try.c", "r");
11536         char c = getc(fp);
11537         if (
11538                 19 <= FILE_bufsiz(fp) &&
11539                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11540         )
11541                 exit(0);
11542         exit(1);
11543 }
11544 EOP
11545         set try
11546         if eval $compile; then
11547                 if ./try; then
11548                         echo "And its _base field acts std."
11549                         val="$define"
11550                 else
11551                         echo "But its _base field isn't std."
11552                 fi
11553         else
11554                 echo "However, it seems to be lacking the _base field."
11555         fi
11556         $rm -f try.c try
11557         ;;
11558 esac
11559 set d_stdiobase
11560 eval $setvar
11561
11562 $cat >&4 <<EOM
11563 Checking how to access stdio streams by file descriptor number...
11564 EOM
11565 case "$stdio_stream_array" in
11566 '')     $cat >try.c <<EOCP
11567 #include <stdio.h>
11568 int main() {
11569   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11570     printf("yes\n");
11571 }
11572 EOCP
11573         for s in _iob __iob __sF
11574         do
11575                 set try -DSTDIO_STREAM_ARRAY=$s
11576                 if eval $compile; then
11577                         case "`./try$exe_ext`" in
11578                         yes)    stdio_stream_array=$s; break ;;
11579                         esac
11580                 fi
11581         done
11582         $rm -f try.* try$exe_ext
11583 esac
11584 case "$stdio_stream_array" in
11585 '')     $cat >&4 <<EOM
11586 I can't figure out how to access stdio streams by file descriptor number.
11587 EOM
11588         d_stdio_stream_array="$undef"
11589         ;;
11590 *)      $cat >&4 <<EOM
11591 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11592 EOM
11593         d_stdio_stream_array="$define"
11594         ;;
11595 esac
11596
11597 : see if strcoll exists
11598 set strcoll d_strcoll
11599 eval $inlibc
11600
11601 : check for structure copying
11602 echo " "
11603 echo "Checking to see if your C compiler can copy structs..." >&4
11604 $cat >try.c <<'EOCP'
11605 int main()
11606 {
11607         struct blurfl {
11608                 int dyick;
11609         } foo, bar;
11610
11611         foo = bar;
11612 }
11613 EOCP
11614 if $cc -c try.c >/dev/null 2>&1 ; then
11615         val="$define"
11616         echo "Yup, it can."
11617 else
11618         val="$undef"
11619         echo "Nope, it can't."
11620 fi
11621 set d_strctcpy
11622 eval $setvar
11623 $rm -f try.*
11624
11625 : see if strerror and/or sys_errlist[] exist
11626 echo " "
11627 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11628     if set strerror val -f d_strerror; eval $csym; $val; then
11629                 echo 'strerror() found.' >&4
11630                 d_strerror="$define"
11631                 d_strerrm='strerror(e)'
11632                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11633                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11634                         d_syserrlst="$define"
11635                 else
11636                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11637                         d_syserrlst="$undef"
11638                 fi
11639     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11640                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11641                 echo 'strerror() found in string header.' >&4
11642                 d_strerror="$define"
11643                 d_strerrm='strerror(e)'
11644                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11645                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11646                                 d_syserrlst="$define"
11647                 else
11648                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11649                         d_syserrlst="$undef"
11650                 fi
11651     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11652                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11653                 d_strerror="$undef"
11654                 d_syserrlst="$define"
11655                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11656     else
11657                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11658                 d_strerror="$undef"
11659                 d_syserrlst="$undef"
11660                 d_strerrm='"unknown"'
11661     fi
11662 fi
11663
11664 : see if strtod exists
11665 set strtod d_strtod
11666 eval $inlibc
11667
11668 : see if strtol exists
11669 set strtol d_strtol
11670 eval $inlibc
11671
11672 : see if strtold exists
11673 set strtold d_strtold
11674 eval $inlibc
11675
11676 : see if strtoll exists
11677 set strtoll d_strtoll
11678 eval $inlibc
11679
11680 case "$d_longlong-$d_strtoll" in
11681 "$define-$define")
11682         $cat <<EOM
11683 Checking whether your strtoll() works okay...
11684 EOM
11685         $cat >try.c <<'EOCP'
11686 #include <errno.h>
11687 #ifdef __hpux
11688 #define strtoll __strtoll
11689 #endif
11690 #include <stdio.h>
11691 extern long long int strtoll(char *s, char **, int); 
11692 static int bad = 0;
11693 int check(char *s, long long ell, int een) {
11694         long long gll;
11695         errno = 0;
11696         gll = strtoll(s, 0, 10);
11697         if (!((gll == ell) && (errno == een)))
11698                 bad++;
11699 }
11700 int main() {
11701         check(" 1",                                      1LL, 0);
11702         check(" 0",                                      0LL, 0);
11703         check("-1",                                     -1LL, 0);
11704         check("-9223372036854775808", -9223372036854775808LL, 0);
11705         check("-9223372036854775808", -9223372036854775808LL, 0);
11706         check(" 9223372036854775807",  9223372036854775807LL, 0);
11707         check("-9223372036854775808", -9223372036854775808LL, 0);
11708         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11709         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11710         if (!bad)
11711                 printf("ok\n");
11712 }
11713 EOCP
11714         set try
11715         if eval $compile; then
11716                 case "`./try`" in
11717                 ok) echo "Your strtoll() seems to be working okay." ;;
11718                 *) cat <<EOM >&4
11719 Your strtoll() doesn't seem to be working okay.
11720 EOM
11721                    d_strtoll="$undef"
11722                    ;;
11723                 esac
11724         fi
11725         ;;
11726 esac
11727
11728 : see if strtoul exists
11729 set strtoul d_strtoul
11730 eval $inlibc
11731
11732 : see if strtoull exists
11733 set strtoull d_strtoull
11734 eval $inlibc
11735
11736 case "$d_longlong-$d_strtoull" in
11737 "$define-$define")
11738         $cat <<EOM
11739 Checking whether your strtoull() works okay...
11740 EOM
11741         $cat >try.c <<'EOCP'
11742 #include <errno.h>
11743 #ifdef __hpux
11744 #define strtoull __strtoull
11745 #endif
11746 #include <stdio.h>
11747 extern unsigned long long int strtoull(char *s, char **, int); 
11748 static int bad = 0;
11749 int check(char *s, long long eull, int een) {
11750         long long gull;
11751         errno = 0;
11752         gull = strtoull(s, 0, 10);
11753         if (!((gull == eull) && (errno == een)))
11754                 bad++;
11755 }
11756 int main() {
11757         check(" 1",                                       1LL, 0);
11758         check(" 0",                                       0LL, 0);
11759         check("18446744073709551615", 18446744073709551615ULL, 0);
11760         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11761         if (!bad)
11762                 printf("ok\n");
11763 }
11764 EOCP
11765         set try
11766         if eval $compile; then
11767                 case "`./try`" in
11768                 ok) echo "Your strtoull() seems to be working okay." ;;
11769                 *) cat <<EOM >&4
11770 Your strtoull() doesn't seem to be working okay.
11771 EOM
11772                    d_strtoull="$undef"
11773                    ;;
11774                 esac
11775         fi
11776         ;;
11777 esac
11778
11779 : see if strtouq exists
11780 set strtouq d_strtouq
11781 eval $inlibc
11782
11783 : see if strxfrm exists
11784 set strxfrm d_strxfrm
11785 eval $inlibc
11786
11787 : see if symlink exists
11788 set symlink d_symlink
11789 eval $inlibc
11790
11791 : see if syscall exists
11792 set syscall d_syscall
11793 eval $inlibc
11794
11795 : see if sysconf exists
11796 set sysconf d_sysconf
11797 eval $inlibc
11798
11799 : see if system exists
11800 set system d_system
11801 eval $inlibc
11802
11803 : see if tcgetpgrp exists
11804 set tcgetpgrp d_tcgetpgrp
11805 eval $inlibc
11806
11807 : see if tcsetpgrp exists
11808 set tcsetpgrp d_tcsetpgrp
11809 eval $inlibc
11810
11811 : see if prototype for telldir is available
11812 echo " "
11813 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11814 eval $hasproto
11815
11816 : see if this is a sys/times.h system
11817 set sys/times.h i_systimes
11818 eval $inhdr
11819
11820 : see if times exists
11821 echo " "
11822 if set times val -f d_times; eval $csym; $val; then
11823         echo 'times() found.' >&4
11824         d_times="$define"
11825         inc=''
11826         case "$i_systimes" in
11827         "$define") inc='sys/times.h';;
11828         esac
11829         rp="What is the type returned by times() on this system?"
11830         set clock_t clocktype long stdio.h sys/types.h $inc
11831         eval $typedef_ask
11832 else
11833         echo 'times() NOT found, hope that will do.' >&4
11834         d_times="$undef"
11835         clocktype='int'
11836 fi
11837
11838 : see if truncate exists
11839 set truncate d_truncate
11840 eval $inlibc
11841
11842 : see if tzname[] exists
11843 echo " "
11844 if set tzname val -a d_tzname; eval $csym; $val; then
11845         val="$define"
11846         echo 'tzname[] found.' >&4
11847 else
11848         val="$undef"
11849         echo 'tzname[] NOT found.' >&4
11850 fi
11851 set d_tzname
11852 eval $setvar
11853
11854 : see if umask exists
11855 set umask d_umask
11856 eval $inlibc
11857
11858 : see if ustat exists
11859 set ustat d_ustat
11860 eval $inlibc
11861
11862 : backward compatibility for d_hvfork
11863 if test X$d_hvfork != X; then
11864         d_vfork="$d_hvfork"
11865         d_hvfork=''
11866 fi
11867 : see if there is a vfork
11868 val=''
11869 set vfork val
11870 eval $inlibc
11871
11872 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11873 : perl on Solaris 2.x, and probably elsewhere.
11874 case "$val" in
11875 $define)
11876         echo " "
11877         case "$usevfork" in
11878         false) dflt='n';;
11879         *) dflt='y';;
11880         esac
11881         cat <<'EOM'
11882  
11883 Perl can only use a vfork() that doesn't suffer from strict
11884 restrictions on calling functions or modifying global data in
11885 the child.  For example, glibc-2.1 contains such a vfork()
11886 that is unsuitable.  If your system provides a proper fork()
11887 call, chances are that you do NOT want perl to use vfork().
11888
11889 EOM
11890         rp="Do you still want to use vfork()?"
11891         . ./myread
11892         case "$ans" in
11893         y|Y) ;;
11894         *)
11895                 echo "Ok, we won't use vfork()."
11896                 val="$undef"
11897                 ;;
11898         esac
11899         ;;
11900 esac
11901 set d_vfork
11902 eval $setvar
11903 case "$d_vfork" in
11904 $define) usevfork='true';;
11905 *) usevfork='false';;
11906 esac
11907
11908 : see if this is an sysdir system
11909 set sys/dir.h i_sysdir
11910 eval $inhdr
11911
11912 : see if this is an sysndir system
11913 set sys/ndir.h i_sysndir
11914 eval $inhdr
11915
11916 : see if closedir exists
11917 set closedir d_closedir
11918 eval $inlibc
11919
11920 case "$d_closedir" in
11921 "$define")
11922         echo " "
11923         echo "Checking whether closedir() returns a status..." >&4
11924         cat > closedir.c <<EOM
11925 #$i_dirent I_DIRENT             /**/
11926 #$i_sysdir I_SYS_DIR            /**/
11927 #$i_sysndir I_SYS_NDIR          /**/
11928 #$i_systypes I_SYS_TYPES        /**/
11929
11930 #if defined(I_SYS_TYPES)
11931 #include <sys/types.h>
11932 #endif
11933 #if defined(I_DIRENT)
11934 #include <dirent.h>
11935 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11936 #include <sys/dir.h>
11937 #endif
11938 #else
11939 #ifdef I_SYS_NDIR
11940 #include <sys/ndir.h>
11941 #else
11942 #ifdef I_SYS_DIR
11943 #ifdef hp9000s500
11944 #include <ndir.h>       /* may be wrong in the future */
11945 #else
11946 #include <sys/dir.h>
11947 #endif
11948 #endif
11949 #endif
11950 #endif 
11951 int main() { return closedir(opendir(".")); }
11952 EOM
11953         set closedir
11954         if eval $compile_ok; then
11955                 if ./closedir > /dev/null 2>&1 ; then
11956                         echo "Yes, it does."
11957                         val="$undef"
11958                 else
11959                         echo "No, it doesn't."
11960                         val="$define"
11961                 fi
11962         else
11963                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11964                 val="$define"
11965         fi
11966         ;;
11967 *)
11968         val="$undef";
11969         ;;
11970 esac
11971 set d_void_closedir
11972 eval $setvar
11973 $rm -f closedir*
11974 : check for volatile keyword
11975 echo " "
11976 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11977 $cat >try.c <<'EOCP'
11978 int main()
11979 {
11980         typedef struct _goo_struct goo_struct;
11981         goo_struct * volatile goo = ((goo_struct *)0);
11982         struct _goo_struct {
11983                 long long_int;
11984                 int reg_int;
11985                 char char_var;
11986         };
11987         typedef unsigned short foo_t;
11988         char *volatile foo;
11989         volatile int bar;
11990         volatile foo_t blech;
11991         foo = foo;
11992 }
11993 EOCP
11994 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11995         val="$define"
11996         echo "Yup, it does."
11997 else
11998         val="$undef"
11999         echo "Nope, it doesn't."
12000 fi
12001 set d_volatile
12002 eval $setvar
12003 $rm -f try.*
12004
12005 : see if there is a wait4
12006 set wait4 d_wait4
12007 eval $inlibc
12008
12009 : see if waitpid exists
12010 set waitpid d_waitpid
12011 eval $inlibc
12012
12013 : see if wcstombs exists
12014 set wcstombs d_wcstombs
12015 eval $inlibc
12016
12017 : see if wctomb exists
12018 set wctomb d_wctomb
12019 eval $inlibc
12020
12021 : preserve RCS keywords in files with variable substitution, grrr
12022 Date='$Date'
12023 Id='$Id'
12024 Log='$Log'
12025 RCSfile='$RCSfile'
12026 Revision='$Revision'
12027
12028 case "$crosscompile" in
12029 ''|[nN]*) crosscompile="$undef" ;;
12030 esac
12031
12032 case "$osname" in
12033 next|rhapsody|darwin) multiarch="$define" ;;
12034 esac
12035 case "$multiarch" in
12036 ''|[nN]*) multiarch="$undef" ;;
12037 esac
12038
12039 : check for alignment requirements
12040 echo " "
12041 case "$crosscompile$multiarch" in
12042 *$define*)
12043         $cat <<EOM
12044 You seem to be either cross-compiling or doing a multiarchitecture build,
12045 skipping the memory alignment check.
12046
12047 EOM
12048         case "$alignbytes" in
12049         '') alignbytes=8 ;;
12050         esac
12051         ;;
12052 *)
12053         case "$alignbytes" in
12054         '') echo "Checking alignment constraints..." >&4
12055                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12056                         $cat >try.c <<'EOCP'
12057 typedef long double NV;
12058 EOCP
12059                 else
12060                         $cat >try.c <<'EOCP'
12061 typedef double NV;
12062 EOCP
12063                 fi
12064                 $cat >>try.c <<'EOCP'
12065 #include <stdio.h>
12066 struct foobar {
12067         char foo;
12068         NV bar;
12069 } try_algn;
12070 int main()
12071 {
12072     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12073     return(0);
12074 }
12075 EOCP
12076                 set try
12077                 if eval $compile_ok; then
12078                         dflt=`./try`
12079                 else
12080                         dflt='8'
12081                         echo "(I can't seem to compile the test program...)"
12082                 fi
12083                 ;;
12084         *) dflt="$alignbytes"
12085                 ;;
12086         esac
12087         rp="Doubles must be aligned on a how-many-byte boundary?"
12088         . ./myread
12089         alignbytes="$ans"
12090         $rm -f try.c try
12091         ;;
12092 esac
12093
12094
12095 : set the base revision
12096 baserev=5.0
12097
12098 : check for ordering of bytes in a long
12099 echo " "
12100 case "$crosscompile$multiarch" in
12101 *$define*)
12102         $cat <<EOM
12103 You seem to be either cross-compiling or doing a multiarchitecture build,
12104 skipping the byteorder check.
12105
12106 EOM
12107         byteorder='0xffff'
12108         ;;
12109 *)
12110         case "$byteorder" in
12111         '')
12112                 $cat <<'EOM'
12113 In the following, larger digits indicate more significance.  A big-endian
12114 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12115 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12116 machines may have weird orders like 3412.  A Cray will report 87654321,
12117 an Alpha will report 12345678. If the test program works the default is
12118 probably right.
12119 I'm now running the test program...
12120 EOM
12121                 $cat >try.c <<'EOCP'
12122 #include <stdio.h>
12123 int main()
12124 {
12125         int i;
12126         union {
12127                 unsigned long l;
12128                 char c[sizeof(long)];
12129         } u;
12130
12131         if (sizeof(long) > 4)
12132                 u.l = (0x08070605L << 32) | 0x04030201L;
12133         else
12134                 u.l = 0x04030201L;
12135         for (i = 0; i < sizeof(long); i++)
12136                 printf("%c", u.c[i]+'0');
12137         printf("\n");
12138         exit(0);
12139 }
12140 EOCP
12141                 xxx_prompt=y
12142                 set try
12143                 if eval $compile && ./try > /dev/null; then
12144                         dflt=`./try`
12145                         case "$dflt" in
12146                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12147                                 echo "(The test program ran ok.)"
12148                                 echo "byteorder=$dflt"
12149                                 xxx_prompt=n
12150                         ;;
12151                         ????|????????) echo "(The test program ran ok.)" ;;
12152                         *) echo "(The test program didn't run right for some reason.)" ;;
12153                         esac
12154                 else
12155                         dflt='4321'
12156                         cat <<'EOM'
12157 (I can't seem to compile the test program.  Guessing big-endian...)
12158 EOM
12159                 fi
12160                 case "$xxx_prompt" in
12161                 y)
12162                         rp="What is the order of bytes in a long?"
12163                         . ./myread
12164                         byteorder="$ans"
12165                         ;;
12166                 *)      byteorder=$dflt
12167                         ;;
12168                 esac
12169                 ;;
12170         esac
12171         $rm -f try.c try
12172         ;;
12173 esac
12174
12175
12176 : how do we catenate cpp tokens here?
12177 echo " "
12178 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12179 $cat >cpp_stuff.c <<'EOCP'
12180 #define RCAT(a,b)a/**/b
12181 #define ACAT(a,b)a ## b
12182 RCAT(Rei,ser)
12183 ACAT(Cir,cus)
12184 EOCP
12185 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12186 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12187         echo "Oh!  Smells like ANSI's been here." >&4
12188         echo "We can catify or stringify, separately or together!"
12189         cpp_stuff=42
12190 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12191         echo "Ah, yes!  The good old days!" >&4
12192         echo "However, in the good old days we don't know how to stringify and"
12193         echo "catify at the same time."
12194         cpp_stuff=1
12195 else
12196         $cat >&4 <<EOM
12197 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12198 to have to edit the values of CAT[2-5] in config.h...
12199 EOM
12200         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12201 fi
12202 $rm -f cpp_stuff.*
12203
12204 : see if this is a db.h system
12205 set db.h i_db
12206 eval $inhdr
12207
12208 case "$i_db" in
12209 $define)
12210         : Check db version.
12211         echo " "
12212         echo "Checking Berkeley DB version ..." >&4
12213         $cat >try.c <<EOCP
12214 #$d_const HASCONST
12215 #ifndef HASCONST
12216 #define const
12217 #endif
12218 #include <sys/types.h>
12219 #include <stdio.h>
12220 #include <db.h>
12221 int main()
12222 {
12223 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12224     int Major, Minor, Patch ;
12225     unsigned long Version ;
12226     (void)db_version(&Major, &Minor, &Patch) ;
12227     printf("You have Berkeley DB Version 2 or greater\n");
12228
12229     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12230                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12231     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12232                 Major, Minor, Patch) ;
12233
12234     /* check that db.h & libdb are compatible */
12235     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12236         printf("db.h and libdb are incompatible\n") ;
12237         exit(3);        
12238     }
12239
12240     printf("db.h and libdb are compatible\n") ;
12241
12242     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12243                 + DB_VERSION_PATCH ;
12244
12245     /* needs to be >= 2.3.4 */
12246     if (Version < 2003004) {
12247     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12248         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12249         exit(2);        
12250     }
12251
12252     exit(0);
12253 #else
12254 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12255     printf("You have Berkeley DB Version 1\n");
12256     exit(0);    /* DB version < 2: the coast is clear. */
12257 #else
12258     exit(1);    /* <db.h> not Berkeley DB? */
12259 #endif
12260 #endif
12261 }
12262 EOCP
12263         set try
12264         if eval $compile_ok && ./try; then
12265                 echo 'Looks OK.' >&4
12266         else
12267                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12268                 i_db=$undef
12269                 case " $libs " in
12270                 *"-ldb "*)
12271                         : Remove db from list of libraries to use
12272                         echo "Removing unusable -ldb from library list" >&4
12273                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12274                         shift
12275                         libs="$*"
12276                         echo "libs = $libs" >&4
12277                         ;;
12278                 esac
12279         fi
12280         $rm -f try.*
12281         ;;
12282 esac
12283
12284 case "$i_db" in
12285 define)
12286         : Check the return type needed for hash 
12287         echo " "
12288         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12289         $cat >try.c <<EOCP
12290 #$d_const HASCONST
12291 #ifndef HASCONST
12292 #define const
12293 #endif
12294 #include <sys/types.h>
12295 #include <db.h>
12296
12297 #ifndef DB_VERSION_MAJOR
12298 u_int32_t hash_cb (ptr, size)
12299 const void *ptr;
12300 size_t size;
12301 {
12302 }
12303 HASHINFO info;
12304 int main()
12305 {
12306         info.hash = hash_cb;
12307 }
12308 #endif
12309 EOCP
12310         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12311                 if $contains warning try.out >>/dev/null 2>&1 ; then
12312                         db_hashtype='int'
12313                 else
12314                         db_hashtype='u_int32_t'
12315                 fi
12316         else
12317                 : XXX Maybe we should just give up here.
12318                 db_hashtype=u_int32_t
12319                 $cat try.out >&4
12320                 echo "Help:  I can't seem to compile the db test program." >&4
12321                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12322         fi
12323         $rm -f try.*
12324         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12325         ;;
12326 *)      db_hashtype=u_int32_t
12327         ;;
12328 esac
12329 case "$i_db" in
12330 define)
12331         : Check the return type needed for prefix 
12332         echo " "
12333         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12334         cat >try.c <<EOCP
12335 #$d_const HASCONST
12336 #ifndef HASCONST
12337 #define const
12338 #endif
12339 #include <sys/types.h>
12340 #include <db.h>
12341
12342 #ifndef DB_VERSION_MAJOR
12343 size_t prefix_cb (key1, key2)
12344 const DBT *key1;
12345 const DBT *key2;
12346 {
12347 }
12348 BTREEINFO info;
12349 int main()
12350 {
12351         info.prefix = prefix_cb;
12352 }
12353 #endif
12354 EOCP
12355         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12356                 if $contains warning try.out >>/dev/null 2>&1 ; then
12357                         db_prefixtype='int'
12358                 else
12359                         db_prefixtype='size_t'
12360                 fi
12361         else
12362                 db_prefixtype='size_t'
12363                 : XXX Maybe we should just give up here.
12364                 $cat try.out >&4
12365                 echo "Help:  I can't seem to compile the db test program." >&4
12366                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12367         fi
12368         $rm -f try.*
12369         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12370         ;;
12371 *)      db_prefixtype='size_t'
12372         ;;
12373 esac
12374
12375 : check for void type
12376 echo " "
12377 echo "Checking to see how well your C compiler groks the void type..." >&4
12378 case "$voidflags" in
12379 '')
12380         $cat >try.c <<'EOCP'
12381 #if TRY & 1
12382 void sub() {
12383 #else
12384 sub() {
12385 #endif
12386         extern void moo();      /* function returning void */
12387         void (*goo)();          /* ptr to func returning void */
12388 #if TRY & 8
12389         void *hue;              /* generic ptr */
12390 #endif
12391 #if TRY & 2
12392         void (*foo[10])();
12393 #endif
12394
12395 #if TRY & 4
12396         if(goo == moo) {
12397                 exit(0);
12398         }
12399 #endif
12400         exit(0);
12401 }
12402 int main() { sub(); }
12403 EOCP
12404         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12405                 voidflags=$defvoidused
12406         echo "Good.  It appears to support void to the level $package wants.">&4
12407                 if $contains warning .out >/dev/null 2>&1; then
12408                         echo "However, you might get some warnings that look like this:"
12409                         $cat .out
12410                 fi
12411         else
12412 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12413                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12414                         echo "It supports 1..."
12415                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12416                                 echo "It also supports 2..."
12417                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12418                                         voidflags=7
12419                                         echo "And it supports 4 but not 8 definitely."
12420                                 else
12421                                         echo "It doesn't support 4..."
12422                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12423                                                 voidflags=11
12424                                                 echo "But it supports 8."
12425                                         else
12426                                                 voidflags=3
12427                                                 echo "Neither does it support 8."
12428                                         fi
12429                                 fi
12430                         else
12431                                 echo "It does not support 2..."
12432                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12433                                         voidflags=13
12434                                         echo "But it supports 4 and 8."
12435                                 else
12436                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12437                                                 voidflags=5
12438                                                 echo "And it supports 4 but has not heard about 8."
12439                                         else
12440                                                 echo "However it supports 8 but not 4."
12441                                         fi
12442                                 fi
12443                         fi
12444                 else
12445                         echo "There is no support at all for void."
12446                         voidflags=0
12447                 fi
12448         fi
12449 esac
12450 case "$voidflags" in
12451 "$defvoidused") ;;
12452 *)      $cat >&4 <<'EOM'
12453   Support flag bits are:
12454     1: basic void declarations.
12455     2: arrays of pointers to functions returning void.
12456     4: operations between pointers to and addresses of void functions.
12457     8: generic void pointers.
12458 EOM
12459         dflt="$voidflags";
12460         rp="Your void support flags add up to what?"
12461         . ./myread
12462         voidflags="$ans"
12463         ;;
12464 esac
12465 $rm -f try.* .out
12466
12467
12468 : How can we generate normalized random numbers ?
12469 echo " "
12470 echo "Looking for a random number function..." >&4
12471 case "$randfunc" in
12472 '')
12473         if set drand48 val -f; eval $csym; $val; then
12474                 dflt="drand48"
12475                 echo "Good, found drand48()." >&4
12476         elif set random val -f; eval $csym; $val; then
12477                 dflt="random"
12478                 echo "OK, found random()." >&4
12479         else
12480                 dflt="rand"
12481                 echo "Yick, looks like I have to use rand()." >&4
12482         fi
12483         echo " "
12484         ;;
12485 *)
12486         dflt="$randfunc"
12487         ;;
12488 esac
12489 cont=true
12490
12491 case "$ccflags" in
12492 *-Dmy_rand=*|*-Dmy_srand=*)
12493         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12494         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12495         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12496         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12497         ;;
12498 esac
12499
12500 while $test "$cont"; do
12501         rp="Use which function to generate random numbers?"
12502         . ./myread
12503         if $test "$ans" = "$dflt"; then
12504                 : null
12505         else
12506                 randbits=''
12507         fi
12508         randfunc="$ans"
12509         if set $ans val -f; eval $csym; $val; then
12510                 cont=''
12511         else
12512                 dflt=y
12513                 rp="I cannot find function $ans. Use that name anyway?"
12514                 . ./myread
12515                 dflt=rand
12516                 case "$ans" in
12517                         [yY]*) cont='';;
12518                 esac
12519         fi
12520         case "$cont" in
12521         '')
12522                 case "$randfunc" in
12523                 drand48)
12524                         drand01="drand48()"
12525                         seedfunc="srand48"
12526                         randbits=48
12527                         randseedtype=long
12528                         ;;
12529                 rand|random)
12530                         case "$randbits" in
12531                         '')
12532 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12533                                 $cat >try.c <<EOCP
12534 #$i_unistd I_UNISTD
12535 #$i_stdlib I_STDLIB
12536 #include <stdio.h>
12537 #ifdef I_UNISTD
12538 #  include <unistd.h>
12539 #endif
12540 #ifdef I_STDLIB
12541 #  include <stdlib.h>
12542 #endif
12543 int main()
12544 {
12545         register int i;
12546         register unsigned long tmp;
12547         register unsigned long max = 0L;
12548
12549         for (i = 1000; i; i--) {
12550                 tmp = (unsigned long) $randfunc();
12551                 if (tmp > max) max = tmp;
12552         }
12553         for (i = 0; max; i++)
12554                 max /= 2;
12555         printf("%d\n",i);
12556 }
12557 EOCP
12558                                 set try
12559                                 if eval $compile_ok; then
12560                                         dflt=`try`
12561                                 else
12562                                         dflt='?'
12563                                         echo "(I can't seem to compile the test program...)"
12564                                 fi
12565                                 ;;
12566                         *)
12567                                 dflt="$randbits"
12568                                 ;;
12569                         esac
12570                         rp="How many bits does your $randfunc() function produce?"
12571                         . ./myread
12572                         randbits="$ans"
12573                         $rm -f try.c try
12574                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12575                         seedfunc="s$randfunc"
12576                         randseedtype=unsigned
12577                         ;;
12578                 *)
12579                         dflt="31"
12580                         rp="How many bits does your $randfunc() function produce?"
12581                         . ./myread
12582                         randbits="$ans"
12583                         seedfunc="s$randfunc"
12584                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12585                         if set $seedfunc val -f; eval $csym; $val; then
12586                                 echo "(Using $seedfunc() to seed random generator)"
12587                         else
12588                                 echo "(Warning: no $seedfunc() to seed random generator)"
12589                                 seedfunc=rand
12590                         fi
12591                         randseedtype=unsigned
12592                         ;;
12593                 esac
12594                 ;;
12595         esac
12596 done
12597
12598 echo " "
12599 echo "Determining whether or not we are on an EBCDIC system..." >&4
12600 $cat >tebcdic.c <<'EOM'
12601 int main()
12602 {
12603   if ('M'==0xd4) return 0;
12604   return 1;
12605 }
12606 EOM
12607
12608 val=$undef
12609 set tebcdic
12610 if eval $compile_ok; then
12611         if ./tebcdic; then
12612                 echo "You have EBCDIC." >&4
12613                 val="$define"
12614         else
12615                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12616         fi
12617 else
12618         echo "I'm unable to compile the test program." >&4
12619         echo "I'll assume ASCII or some ISO Latin." >&4
12620 fi
12621 $rm -f tebcdic.c tebcdic
12622 set ebcdic
12623 eval $setvar
12624
12625 echo " "
12626 $cat >&4 <<EOM
12627 Checking how to flush all pending stdio output...
12628 EOM
12629 # I only know how to find the first 32 possibly open files on SunOS.
12630 # See also hints/sunos_4_1.sh and util.c  --AD
12631 case "$osname" in
12632 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12633 esac
12634 $cat >>try.c <<EOCP
12635 #include <stdio.h>
12636 #$i_unistd I_UNISTD
12637 #ifdef I_UNISTD
12638 # include <unistd.h>
12639 #endif
12640 #$d_sysconf HAS_SYSCONF
12641 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12642 #ifdef HAS_STDIO_STREAM_ARRAY
12643 # define STDIO_STREAM_ARRAY $stdio_stream_array
12644 #endif
12645 int main() {
12646   FILE* p = fopen("try.out", "w");
12647 #ifdef TRY_FPUTC
12648   fputc('x', p);
12649 #else
12650 # ifdef TRY_FPRINTF
12651   fprintf(p, "x");
12652 # endif
12653 #endif
12654 #ifdef TRY_FFLUSH_NULL
12655   fflush(NULL);
12656 #endif
12657 #ifdef TRY_FFLUSH_ALL
12658   {
12659     long open_max = -1;
12660 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12661     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12662 # else
12663 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12664     open_max = sysconf(_SC_OPEN_MAX);
12665 #  else
12666 #   ifdef FOPEN_MAX
12667     open_max = FOPEN_MAX;
12668 #   else
12669 #    ifdef OPEN_MAX
12670     open_max = OPEN_MAX;
12671 #    else
12672 #     ifdef _NFILE
12673     open_max = _NFILE;
12674 #     endif
12675 #    endif
12676 #   endif
12677 #  endif
12678 # endif 
12679 # ifdef HAS_STDIO_STREAM_ARRAY
12680     if (open_max > 0) {
12681       long i;
12682       for (i = 0; i < open_max; i++)
12683             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12684                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12685                 STDIO_STREAM_ARRAY[i]._flag)
12686                 fflush(&STDIO_STREAM_ARRAY[i]);
12687     }   
12688   }
12689 # endif
12690 #endif
12691   _exit(42);
12692 }
12693 EOCP
12694 : first we have to find out how _not_ to flush
12695 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12696     output=''
12697     set try -DTRY_FPUTC
12698     if eval $compile; then
12699             $rm -f try.out
12700             ./try$exe_ext 2>/dev/null
12701             if $test ! -s try.out -a "X$?" = X42; then
12702                 output=-DTRY_FPUTC
12703             fi
12704     fi
12705     case "$output" in
12706     '')
12707             set try -DTRY_FPRINTF
12708             $rm -f try.out
12709             if eval $compile; then
12710                     $rm -f try.out
12711                     ./try$exe_ext 2>/dev/null
12712                     if $test ! -s try.out -a "X$?" = X42; then
12713                         output=-DTRY_FPRINTF
12714                     fi
12715             fi
12716         ;;
12717     esac
12718 fi
12719 : check for fflush NULL behaviour
12720 case "$fflushNULL" in
12721 '')     set try -DTRY_FFLUSH_NULL $output
12722         if eval $compile; then
12723                 $rm -f try.out
12724                 ./try$exe_ext 2>/dev/null
12725                 code="$?"
12726                 if $test -s try.out -a "X$code" = X42; then
12727                         fflushNULL="`$cat try.out`"
12728                 else
12729                         if $test "X$code" != X42; then
12730                                 $cat >&4 <<EOM
12731 (If this test failed, don't worry, we'll try another method shortly.)
12732 EOM
12733                         fi
12734                 fi
12735         fi
12736         $rm -f core try.core core.try.*
12737         case "$fflushNULL" in
12738         x)      $cat >&4 <<EOM
12739 Your fflush(NULL) works okay for output streams.
12740 Let's see if it clobbers input pipes...
12741 EOM
12742 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12743 # bug that improperly flushes the input end of pipes.  So we avoid the
12744 # autoflush on fork/system/exec support for now. :-(
12745 $cat >tryp.c <<EOCP
12746 #include <stdio.h>
12747 int
12748 main(int argc, char **argv)
12749 {
12750     char buf[1024];
12751     int i;
12752     char *bp = buf;
12753     while (1) {
12754         while ((i = getc(stdin)) != -1
12755                && (*bp++ = i) != '\n'
12756                && bp < &buf[1024])
12757         /* DO NOTHING */ ;
12758         *bp = '\0';
12759         fprintf(stdout, "%s", buf);
12760         fflush(NULL);
12761         if (i == -1)
12762             return 0;
12763         bp = buf;
12764     }
12765 }
12766 EOCP
12767                 fflushNULL="$define"
12768                 set tryp
12769                 if eval $compile; then
12770                     $rm -f tryp.out
12771                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12772                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12773                        $cat >&4 <<EOM
12774 fflush(NULL) seems to behave okay with input streams.
12775 EOM
12776                         fflushNULL="$define"
12777                     else
12778                         $cat >&4 <<EOM
12779 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12780 EOM
12781                         fflushNULL="$undef"
12782                     fi
12783                 fi
12784                 $rm -f core tryp.c tryp.core core.tryp.*
12785                 ;;
12786         '')     $cat >&4 <<EOM
12787 Your fflush(NULL) isn't working (contrary to ANSI C).
12788 EOM
12789                 fflushNULL="$undef"
12790                 ;;
12791         *)      $cat >&4 <<EOM
12792 Cannot figure out whether your fflush(NULL) works or not.
12793 I'm assuming it doesn't (contrary to ANSI C).
12794 EOM
12795                 fflushNULL="$undef"
12796                 ;;
12797         esac
12798         ;;
12799 $define|true|[yY]*)
12800         fflushNULL="$define"
12801         ;;
12802 *)
12803         fflushNULL="$undef"
12804         ;;
12805 esac
12806 : check explicit looping only if NULL did not work, and if the pipe
12807 : bug does not show up on an explicit flush too
12808 case "$fflushNULL" in
12809 "$undef")
12810         $cat >tryp.c <<EOCP
12811 #include <stdio.h>
12812 int
12813 main(int argc, char **argv)
12814 {
12815     char buf[1024];
12816     int i;
12817     char *bp = buf;
12818     while (1) {
12819         while ((i = getc(stdin)) != -1
12820                && (*bp++ = i) != '\n'
12821                && bp < &buf[1024])
12822         /* DO NOTHING */ ;
12823         *bp = '\0';
12824         fprintf(stdout, "%s", buf);
12825         fflush(stdin);
12826         if (i == -1)
12827             return 0;
12828         bp = buf;
12829     }
12830 }
12831 EOCP
12832         set tryp
12833         if eval $compile; then
12834             $rm -f tryp.out
12835             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12836             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12837                $cat >&4 <<EOM
12838 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12839 EOM
12840                 : now check for fflushall behaviour
12841                 case "$fflushall" in
12842                 '')     set try -DTRY_FFLUSH_ALL $output
12843                         if eval $compile; then
12844                                 $cat >&4 <<EOM
12845 (Now testing the other method--but note that this also may fail.)
12846 EOM
12847                                 $rm -f try.out
12848                                 ./try$exe_ext 2>/dev/null
12849                                 if $test -s try.out -a "X$?" = X42; then
12850                                         fflushall="`$cat try.out`"
12851                                 fi
12852                         fi
12853                         $rm -f core try.core core.try.*
12854                         case "$fflushall" in
12855                         x)      $cat >&4 <<EOM
12856 Whew. Flushing explicitly all the stdio streams works.
12857 EOM
12858                                 fflushall="$define"
12859                                 ;;
12860                         '')     $cat >&4 <<EOM
12861 Sigh. Flushing explicitly all the stdio streams doesn't work.
12862 EOM
12863                                 fflushall="$undef"
12864                                 ;;
12865                         *)      $cat >&4 <<EOM
12866 Cannot figure out whether flushing stdio streams explicitly works or not.
12867 I'm assuming it doesn't.
12868 EOM
12869                                 fflushall="$undef"
12870                                 ;;
12871                         esac
12872                         ;;
12873                 "$define"|true|[yY]*)
12874                         fflushall="$define"
12875                         ;;
12876                 *)
12877                         fflushall="$undef"
12878                         ;;
12879                 esac
12880             else
12881                 $cat >&4 <<EOM
12882 All is futile.  Even fflush(stdin) clobbers input pipes!
12883 EOM
12884                 fflushall="$undef"
12885             fi
12886         else
12887             fflushall="$undef"
12888         fi
12889         $rm -f core tryp.c tryp.core core.tryp.*
12890         ;;
12891 *)      fflushall="$undef"
12892         ;;
12893 esac
12894
12895 case "$fflushNULL$fflushall" in
12896 undefundef)
12897         $cat <<EOM
12898 OK, I give up.  I cannot figure out how to flush pending stdio output.
12899 We won't be flushing handles at all before fork/exec/popen.
12900 EOM
12901         ;;
12902 esac
12903 $rm -f try.* try$exe_ext
12904
12905 : Store the full pathname to the ar program for use in the C program
12906 : Respect a hint or command line value for full_ar.
12907 case "$full_ar" in
12908 '') full_ar=$ar ;;
12909 esac
12910
12911 : Store the full pathname to the sed program for use in the C program
12912 full_sed=$sed
12913
12914 : see what type gids are declared as in the kernel
12915 echo " "
12916 echo "Looking for the type for group ids returned by getgid()."
12917 set gid_t gidtype xxx stdio.h sys/types.h
12918 eval $typedef
12919 case "$gidtype" in
12920 xxx)
12921         xxx=`./findhdr sys/user.h`
12922         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12923         case $1 in
12924         unsigned) dflt="$1 $2" ;;
12925         *) dflt="$1" ;;
12926         esac
12927         ;;
12928 *) dflt="$gidtype";;
12929 esac
12930 case "$gidtype" in
12931 gid_t) echo "gid_t found." ;;
12932 *)      rp="What is the type for group ids returned by getgid()?"
12933         . ./myread
12934         gidtype="$ans"
12935         ;;
12936 esac
12937
12938 echo " "
12939 case "$gidtype" in
12940 *_t) zzz="$gidtype"     ;;
12941 *)   zzz="gid"          ;;
12942 esac
12943 echo "Checking the size of $zzz..." >&4 
12944 cat > try.c <<EOCP
12945 #include <sys/types.h>
12946 #include <stdio.h>
12947 int main() {
12948     printf("%d\n", (int)sizeof($gidtype));
12949     exit(0);
12950 }
12951 EOCP
12952 set try
12953 if eval $compile_ok; then
12954         yyy=`./try`
12955         case "$yyy" in
12956         '')     gidsize=4
12957                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12958                 ;;
12959         *)      gidsize=$yyy
12960                 echo "Your $zzz is $gidsize bytes long."
12961                 ;;
12962         esac
12963 else
12964         gidsize=4
12965         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12966 fi
12967
12968
12969 echo " "
12970 case "$gidtype" in
12971 *_t) zzz="$gidtype"     ;;
12972 *)   zzz="gid"          ;;
12973 esac
12974 echo "Checking the sign of $zzz..." >&4 
12975 cat > try.c <<EOCP
12976 #include <sys/types.h>
12977 #include <stdio.h>
12978 int main() {
12979         $gidtype foo = -1;
12980         if (foo < 0)
12981                 printf("-1\n");
12982         else
12983                 printf("1\n");
12984 }
12985 EOCP
12986 set try
12987 if eval $compile; then
12988         yyy=`./try`
12989         case "$yyy" in
12990         '')     gidsign=1
12991                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12992                 ;;
12993         *)      gidsign=$yyy
12994                 case "$gidsign" in
12995                  1) echo "Your $zzz is unsigned." ;;
12996                 -1) echo "Your $zzz is signed."   ;;
12997                 esac
12998                 ;;
12999         esac
13000 else
13001         gidsign=1
13002         echo "(I can't compile the test program--guessing unsigned.)" >&4
13003 fi
13004
13005
13006 echo " "
13007
13008 if $test X"$quadtype" != X; then
13009
13010 echo "Checking how to print 64-bit integers..." >&4
13011
13012 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13013         $cat >try.c <<'EOCP'
13014 #include <sys/types.h>
13015 #include <stdio.h>
13016 int main() {
13017   int q = 12345678901;
13018   printf("%ld\n", q);
13019 }
13020 EOCP
13021         set try
13022         if eval $compile; then
13023                 yyy=`./try$exe_ext`
13024                 case "$yyy" in
13025                 12345678901)
13026                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13027                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
13028                         echo "We will use %d."
13029                         ;;
13030                 esac
13031         fi
13032 fi
13033
13034 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13035         $cat >try.c <<'EOCP'
13036 #include <sys/types.h>
13037 #include <stdio.h>
13038 int main() {
13039   long q = 12345678901;
13040   printf("%ld\n", q);
13041 }
13042 EOCP
13043         set try
13044         if eval $compile; then
13045                 yyy=`./try$exe_ext`
13046                 case "$yyy" in
13047                 12345678901)
13048                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13049                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
13050                         echo "We will use %ld."
13051                         ;;
13052                 esac
13053         fi
13054 fi
13055
13056 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13057         $cat >try.c <<'EOCP'
13058 #include <sys/types.h>
13059 #include <inttypes.h>
13060 #include <stdio.h>
13061 int main() {
13062   int64_t q = 12345678901;
13063   printf("%" PRId64 "\n", q);
13064 }
13065 EOCP
13066         set try
13067         if eval $compile; then
13068                 yyy=`./try$exe_ext`
13069                 case "$yyy" in
13070                 12345678901)
13071                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13072                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
13073                         echo "We will use the C9X style."
13074                         ;;
13075                 esac
13076         fi
13077 fi
13078
13079 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13080         $cat >try.c <<'EOCP'
13081 #include <sys/types.h>
13082 #include <stdio.h>
13083 int main() {
13084   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
13085   printf("%lld\n", q);
13086 }
13087 EOCP
13088         set try
13089         if eval $compile; then
13090                 yyy=`./try$exe_ext`
13091                 case "$yyy" in
13092                 12345678901)
13093                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13094                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
13095                         echo "We will use the %lld style."
13096                         ;;
13097                 esac
13098         fi
13099 fi
13100
13101 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13102         $cat >try.c <<EOCP
13103 #include <sys/types.h>
13104 #include <stdio.h>
13105 int main() {
13106   $quadtype q = 12345678901;
13107   printf("%Ld\n", q);
13108 }
13109 EOCP
13110         set try
13111         if eval $compile; then
13112                 yyy=`./try$exe_ext`
13113                 case "$yyy" in
13114                 12345678901)
13115                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13116                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
13117                         echo "We will use %Ld."
13118                         ;;
13119                 esac
13120         fi
13121 fi
13122
13123 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13124         $cat >try.c <<EOCP
13125 #include <sys/types.h>
13126 #include <stdio.h>
13127 int main() {
13128   $quadtype q = 12345678901;
13129   printf("%qd\n", q);
13130 }
13131 EOCP
13132         set try
13133         if eval $compile; then
13134                 yyy=`./try$exe_ext`
13135                 case "$yyy" in
13136                 12345678901)
13137                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13138                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13139                         echo "We will use %qd."
13140                         ;;
13141                 esac
13142         fi
13143 fi
13144
13145 if $test X"$sPRId64" = X; then
13146         echo "Cannot figure out how to print 64-bit integers." >&4
13147 fi
13148
13149 $rm -f try try.*
13150
13151 fi
13152
13153 case "$sPRId64" in
13154 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13155         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13156         ;;
13157 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13158         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13159         ;;
13160 esac
13161
13162
13163 echo " "
13164 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13165
13166 if $test X"$ivsize" = X8; then
13167         ivdformat="$sPRId64"
13168         uvuformat="$sPRIu64"
13169         uvoformat="$sPRIo64"
13170         uvxformat="$sPRIx64"
13171 else
13172         if $test X"$ivsize" = X"$longsize"; then
13173                 ivdformat='"ld"'
13174                 uvuformat='"lu"'
13175                 uvoformat='"lo"'
13176                 uvxformat='"lx"'
13177         else
13178                 if $test X"$ivsize" = X"$intsize"; then
13179                         ivdformat='"d"'
13180                         uvuformat='"u"'
13181                         uvoformat='"o"'
13182                         uvxformat='"x"'
13183                 else
13184                         : far out
13185                         if $test X"$ivsize" = X"$shortsize"; then
13186                                 ivdformat='"hd"'
13187                                 uvuformat='"hu"'
13188                                 uvoformat='"ho"'
13189                                 uvxformat='"hx"'
13190                         fi
13191                 fi
13192         fi
13193 fi
13194
13195 case "$ivdformat" in
13196 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13197     exit 1
13198     ;;
13199 esac
13200
13201
13202 echo " "
13203 $echo "Checking the format string to be used for gids..." >&4
13204
13205 case "$gidsign" in
13206 -1)     if $test X"$gidsize" = X"$ivsize"; then
13207                 gidformat="$ivdformat"
13208         else
13209                 if $test X"$gidsize" = X"$longsize"; then
13210                         gidformat='"ld"'
13211                 else
13212                         if $test X"$gidsize" = X"$intsize"; then
13213                                 gidformat='"d"'
13214                         else
13215                                 if $test X"$gidsize" = X"$shortsize"; then
13216                                         gidformat='"hd"'
13217                                 fi
13218                         fi
13219                 fi
13220         fi
13221         ;;
13222 *)      if $test X"$gidsize" = X"$uvsize"; then
13223                 gidformat="$uvuformat"
13224         else
13225                 if $test X"$gidsize" = X"$longsize"; then
13226                         gidformat='"lu"'
13227                 else
13228                         if $test X"$gidsize" = X"$intsize"; then
13229                                 gidformat='"u"'
13230                         else
13231                                 if $test X"$gidsize" = X"$shortsize"; then
13232                                         gidformat='"hu"'
13233                                 fi
13234                         fi
13235                 fi
13236         fi
13237         ;;
13238 esac
13239
13240 : see if getgroups exists
13241 set getgroups d_getgrps
13242 eval $inlibc
13243
13244 : see if setgroups exists
13245 set setgroups d_setgrps
13246 eval $inlibc
13247
13248
13249 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13250 echo " "
13251 case "$d_getgrps$d_setgrps" in
13252 *define*)
13253         case "$groupstype" in
13254         '') dflt="$gidtype" ;;
13255         *)  dflt="$groupstype" ;;
13256         esac
13257         $cat <<EOM
13258 What type of pointer is the second argument to getgroups() and setgroups()?
13259 Usually this is the same as group ids, $gidtype, but not always.
13260
13261 EOM
13262         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13263         . ./myread
13264         groupstype="$ans"
13265         ;;
13266 *)  groupstype="$gidtype";;
13267 esac
13268
13269 echo " "
13270 echo "Checking if your $make program sets \$(MAKE)..." >&4
13271 case "$make_set_make" in
13272 '')
13273         $sed 's/^X //' > testmake.mak << 'EOF'
13274 Xall:
13275 X       @echo 'maketemp="$(MAKE)"'
13276 EOF
13277         case "`$make -f testmake.mak 2>/dev/null`" in
13278         *maketemp=*) make_set_make='#' ;;
13279         *)      make_set_make="MAKE=$make" ;;
13280         esac
13281         $rm -f testmake.mak
13282         ;;
13283 esac
13284 case "$make_set_make" in
13285 '#') echo "Yup, it does.";;
13286 *) echo "Nope, it doesn't.";;
13287 esac
13288
13289 : see what type is used for mode_t
13290 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13291 set mode_t modetype int stdio.h sys/types.h
13292 eval $typedef_ask
13293
13294 : define a fucntion to check prototypes
13295 $cat > protochk <<EOSH
13296 $startsh
13297 cc="$cc"
13298 optimize="$optimize"
13299 ccflags="$ccflags"
13300 prototype="$prototype"
13301 define="$define"
13302 rm=$rm
13303 EOSH
13304
13305 $cat >> protochk <<'EOSH'
13306
13307 $rm -f try.c
13308 foo="$1"
13309 shift
13310 while test $# -ge 2; do
13311         case "$1" in
13312                 $define) echo "#include <$2>" >> try.c ;;
13313                 literal) echo "$2" >> try.c ;;
13314         esac
13315     shift 2
13316 done
13317 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13318 cat >> try.c <<'EOCP'
13319 #ifdef CAN_PROTOTYPE
13320 #define _(args) args
13321 #else
13322 #define _(args) ()
13323 #endif
13324 EOCP
13325 echo "$foo" >> try.c
13326 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13327 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13328 status=$?
13329 $rm -f try.[co]
13330 exit $status
13331 EOSH
13332 chmod +x protochk
13333 $eunicefix protochk
13334
13335 : see what type is used for size_t
13336 rp="What is the type used for the length parameter for string functions?"
13337 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13338 eval $typedef_ask
13339
13340 : check for type of arguments to gethostbyaddr. 
13341 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13342         case "$d_gethbyaddr" in
13343         $define)
13344                 $cat <<EOM
13345
13346 Checking to see what type of arguments are accepted by gethostbyaddr().
13347 EOM
13348                 hdrs="$define sys/types.h
13349                         $d_socket sys/socket.h 
13350                         $i_niin netinet/in.h 
13351                         $i_netdb netdb.h
13352                         $i_unistd unistd.h"
13353                 : The first arg can 'char *' or 'void *'
13354                 : The second arg is some of integral type
13355                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13356                         for yyy in size_t long int; do
13357                                 case "$netdb_host_type" in
13358                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13359                                         if ./protochk "$try" $hdrs; then
13360                                                 echo "Your system accepts $xxx for the first arg."
13361                                                 echo "...and $yyy for the second arg."
13362                                                 netdb_host_type="$xxx"
13363                                                 netdb_hlen_type="$yyy"
13364                                         fi
13365                                         ;;
13366                                 esac
13367                         done
13368                 done
13369                 : In case none of those worked, prompt the user.
13370                 case "$netdb_host_type" in
13371                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13372                         dflt='char *'
13373                         . ./myread
13374                         netdb_host_type=$ans
13375                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13376                         dflt="$sizetype"
13377                         . ./myread
13378                         netdb_hlen_type=$ans
13379                         ;;
13380                 esac
13381                 ;;
13382         *)      : no gethostbyaddr, so pick harmless defaults
13383                 netdb_host_type='char *'
13384                 netdb_hlen_type="$sizetype"
13385                 ;;
13386         esac
13387         # Remove the "const" if needed. -- but then we'll have a 
13388         # prototype clash!
13389         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13390 fi
13391
13392 : check for type of argument to gethostbyname. 
13393 if test "X$netdb_name_type" = X ; then
13394         case "$d_gethbyname" in
13395         $define)
13396                 $cat <<EOM
13397
13398 Checking to see what type of argument is accepted by gethostbyname().
13399 EOM
13400                 hdrs="$define sys/types.h
13401                         $d_socket sys/socket.h 
13402                         $i_niin netinet/in.h 
13403                         $i_netdb netdb.h
13404                         $i_unistd unistd.h"
13405                 for xxx in "const char *" "char *"; do
13406                         case "$netdb_name_type" in
13407                         '')     try="extern struct hostent *gethostbyname($xxx);"
13408                                 if ./protochk "$try" $hdrs; then
13409                                         echo "Your system accepts $xxx."
13410                                         netdb_name_type="$xxx"
13411                                 fi
13412                                 ;;
13413                         esac
13414                 done
13415                 : In case none of those worked, prompt the user.
13416                 case "$netdb_name_type" in
13417                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13418                         dflt='char *'
13419                         . ./myread
13420                         netdb_name_type=$ans
13421                         ;;
13422                 esac
13423                 ;;
13424         *)      : no gethostbyname, so pick harmless default
13425                 netdb_name_type='char *'
13426                 ;;
13427         esac
13428 fi
13429
13430 : check for type of 1st argument to getnetbyaddr. 
13431 if test "X$netdb_net_type" = X ; then
13432         case "$d_getnbyaddr" in
13433         $define)
13434                 $cat <<EOM
13435
13436 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13437 EOM
13438                 hdrs="$define sys/types.h
13439                         $d_socket sys/socket.h 
13440                         $i_niin netinet/in.h 
13441                         $i_netdb netdb.h
13442                         $i_unistd unistd.h"
13443                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13444                         case "$netdb_net_type" in
13445                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13446                                 if ./protochk "$try" $hdrs; then
13447                                         echo "Your system accepts $xxx."
13448                                         netdb_net_type="$xxx"
13449                                 fi
13450                                 ;;
13451                         esac
13452                 done
13453                 : In case none of those worked, prompt the user.
13454                 case "$netdb_net_type" in
13455                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13456                         dflt='long'
13457                         . ./myread
13458                         netdb_net_type=$ans
13459                         ;;
13460                 esac
13461                 ;;
13462         *)      : no getnetbyaddr, so pick harmless default
13463                 netdb_net_type='long'
13464                 ;;
13465         esac
13466 fi
13467 : locate the preferred pager for this system
13468 case "$pager" in
13469 '')
13470         dflt=''
13471         case "$pg" in
13472         /*) dflt=$pg;;
13473         esac
13474         case "$more" in
13475         /*) dflt=$more;;
13476         esac
13477         case "$less" in
13478         /*) dflt=$less;;
13479         esac
13480         case "$dflt" in
13481         '') dflt=/usr/ucb/more;;
13482         esac
13483         ;;
13484 *) dflt="$pager";;
13485 esac
13486 echo " "
13487 fn=f/
13488 rp='What pager is used on your system?'
13489 . ./getfile
13490 pager="$ans"
13491
13492 : see what type pids are declared as in the kernel
13493 rp="What is the type of process ids on this system?"
13494 set pid_t pidtype int stdio.h sys/types.h
13495 eval $typedef_ask
13496
13497 : Find earliest binary compatible site_perl subdirectory perl can use.
13498 case "$bincompat5005" in
13499 "$define") xs_apiversion='5.005' ;;
13500 *) xs_apiversion=$version ;;   # The current site_perl version.
13501 esac
13502 : Find earliest pure perl site_perl subdirectory perl can use.
13503 : The versioned directories started at 5.005.
13504 pm_apiversion='5.005'
13505
13506 : check for length of pointer
13507 echo " "
13508 case "$ptrsize" in
13509 '')
13510         echo "Checking to see how big your pointers are..." >&4
13511         if test "$voidflags" -gt 7; then
13512                 echo '#define VOID_PTR char *' > try.c
13513         else
13514                 echo '#define VOID_PTR void *' > try.c
13515         fi
13516         $cat >>try.c <<'EOCP'
13517 #include <stdio.h>
13518 int main()
13519 {
13520     printf("%d\n", (int)sizeof(VOID_PTR));
13521     exit(0);
13522 }
13523 EOCP
13524         set try
13525         if eval $compile_ok; then
13526                 ptrsize=`./try`
13527                 echo "Your pointers are $ptrsize bytes long."
13528         else
13529                 dflt='4'
13530                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13531                 rp="What is the size of a pointer (in bytes)?"
13532                 . ./myread
13533                 ptrsize="$ans"
13534         fi
13535         ;;
13536 esac
13537 $rm -f try.c try
13538
13539 : see if ar generates random libraries by itself
13540 echo " "
13541 echo "Checking how to generate random libraries on your machine..." >&4
13542 echo 'int bar1() { return bar2(); }' > bar1.c
13543 echo 'int bar2() { return 2; }' > bar2.c
13544 $cat > foo.c <<'EOP'
13545 int main() { printf("%d\n", bar1()); exit(0); }
13546 EOP
13547 $cc $ccflags -c bar1.c >/dev/null 2>&1
13548 $cc $ccflags -c bar2.c >/dev/null 2>&1
13549 $cc $ccflags -c foo.c >/dev/null 2>&1
13550 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13551 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13552         ./foobar >/dev/null 2>&1; then
13553         echo "$ar appears to generate random libraries itself."
13554         orderlib=false
13555         ranlib=":"
13556 elif $ar ts bar$_a >/dev/null 2>&1 &&
13557         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13558         ./foobar >/dev/null 2>&1; then
13559                 echo "a table of contents needs to be added with '$ar ts'."
13560                 orderlib=false
13561                 ranlib="$ar ts"
13562 else
13563         case "$ranlib" in
13564         :) ranlib='';;
13565         '')
13566                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13567                 $test -f $ranlib || ranlib=''
13568                 ;;
13569         esac
13570         if $test -n "$ranlib"; then
13571                 echo "your system has '$ranlib'; we'll use that."
13572                 orderlib=false
13573         else
13574                 echo "your system doesn't seem to support random libraries"
13575                 echo "so we'll use lorder and tsort to order the libraries."
13576                 orderlib=true
13577                 ranlib=":"
13578         fi
13579 fi
13580 $rm -f foo* bar* 
13581
13582 : check for type of arguments to select. 
13583 case "$selecttype" in
13584 '') case "$d_select" in
13585         $define)
13586                 echo " "
13587                 $cat <<EOM
13588 Checking to see what type of arguments are accepted by select().
13589 EOM
13590                 hdrs="$define sys/types.h
13591                         $i_systime sys/time.h 
13592                         $i_sysselct sys/select.h
13593                         $d_socket sys/socket.h"
13594                 : The first arg can be int, unsigned, or size_t
13595                 : The last arg may or may not be 'const'
13596                 val=''
13597                 : void pointer has been seen but using that
13598                 : breaks the selectminbits test
13599                 for xxx in 'fd_set *' 'int *'; do
13600                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13601                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13602                                         case "$val" in
13603                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13604                                                 if ./protochk "$try" $hdrs; then
13605                                                         echo "Your system accepts $xxx."
13606                                                         val="$xxx"
13607                                                 fi
13608                                                 ;;
13609                                         esac
13610                                 done
13611                         done
13612                 done
13613                 case "$val" in
13614                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13615                         case "$d_fd_set" in
13616                                 $define) dflt="fd_set *" ;;
13617                                 *)              dflt="int *" ;;
13618                         esac
13619                         . ./myread
13620                         val=$ans
13621                         ;;
13622                 esac
13623                 selecttype="$val"
13624                 ;;
13625         *)      : no select, so pick a harmless default
13626                 selecttype='int *'
13627                 ;;
13628         esac
13629         ;;
13630 esac
13631
13632 : check for the select 'width'
13633 case "$selectminbits" in
13634 '') case "$d_select" in
13635         $define)
13636                 $cat <<EOM
13637
13638 Checking to see on how many bits at a time your select() operates...
13639 EOM
13640                 $cat >try.c <<EOCP
13641 #include <sys/types.h>
13642 #$i_time I_TIME
13643 #$i_systime I_SYS_TIME
13644 #$i_systimek I_SYS_TIME_KERNEL
13645 #ifdef I_TIME
13646 #   include <time.h>
13647 #endif
13648 #ifdef I_SYS_TIME
13649 #   ifdef I_SYS_TIME_KERNEL
13650 #       define KERNEL
13651 #   endif
13652 #   include <sys/time.h>
13653 #   ifdef I_SYS_TIME_KERNEL
13654 #       undef KERNEL
13655 #   endif
13656 #endif
13657 #$i_sysselct I_SYS_SELECT
13658 #ifdef I_SYS_SELECT
13659 #include <sys/select.h>
13660 #endif
13661 #$d_socket HAS_SOCKET
13662 #ifdef HAS_SOCKET
13663 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13664 #endif
13665 #include <stdio.h>
13666 $selecttype b;
13667 #define S sizeof(*(b))
13668 #define MINBITS 64
13669 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13670 #define NBITS  (NBYTES * 8)
13671 int main() {
13672     char s[NBYTES];
13673     struct timeval t;
13674     int i;
13675     FILE* fp;
13676     int fd;
13677
13678     fclose(stdin);
13679     fp = fopen("try.c", "r");
13680     if (fp == 0)
13681       exit(1);
13682     fd = fileno(fp);
13683     if (fd < 0)
13684       exit(2);
13685     b = ($selecttype)s;
13686     for (i = 0; i < NBITS; i++)
13687         FD_SET(i, b);
13688     t.tv_sec  = 0;
13689     t.tv_usec = 0;
13690     select(fd + 1, b, 0, 0, &t);
13691     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13692     printf("%d\n", i + 1);
13693     return 0;
13694 }
13695 EOCP
13696                 set try
13697                 if eval $compile_ok; then
13698                         selectminbits=`./try`
13699                         case "$selectminbits" in
13700                         '')     cat >&4 <<EOM
13701 Cannot figure out on how many bits at a time your select() operates.
13702 I'll play safe and guess it is 32 bits.
13703 EOM
13704                                 selectminbits=32
13705                                 bits="32 bits"
13706                                 ;;
13707                         1)      bits="1 bit" ;;
13708                         *)      bits="$selectminbits bits" ;;
13709                         esac
13710                         echo "Your select() operates on $bits at a time." >&4
13711                 else
13712                         rp='What is the minimum number of bits your select() operates on?'
13713                         case "$byteorder" in
13714                         1234|12345678)  dflt=32 ;;
13715                         *)              dflt=1  ;;
13716                         esac
13717                         . ./myread
13718                         val=$ans
13719                         selectminbits="$val"
13720                 fi
13721                 $rm -f try.* try
13722                 ;;
13723         *)      : no select, so pick a harmless default
13724                 selectminbits='32'
13725                 ;;
13726         esac
13727         ;;
13728 esac
13729
13730 : Trace out the files included by signal.h, then look for SIGxxx names.
13731 : Remove SIGARRAYSIZE used by HPUX.
13732 : Remove SIGSTKSIZE used by Linux.
13733 : Remove SIGSTKSZ used by Posix.
13734 : Remove SIGTYP void lines used by OS2.
13735 : Some cpps, like os390, dont give the file name anywhere
13736 if [ "X$fieldn" = X ]; then
13737         : Just make some guesses.  We check them later.
13738         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13739 else
13740         xxx=`echo '#include <signal.h>' |
13741         $cppstdin $cppminus $cppflags 2>/dev/null |
13742         $grep '^[       ]*#.*include' | 
13743         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13744 fi
13745 : Check this list of files to be sure we have parsed the cpp output ok.
13746 : This will also avoid potentially non-existent files, such 
13747 : as ../foo/bar.h
13748 xxxfiles=''
13749 for xx in $xxx /dev/null ; do
13750         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13751 done
13752 : If we have found no files, at least try signal.h
13753 case "$xxxfiles" in
13754 '')     xxxfiles=`./findhdr signal.h` ;;
13755 esac
13756 xxx=`awk '
13757 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13758         print substr($2, 4, 20)
13759 }
13760 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13761         print substr($3, 4, 20)
13762 }' $xxxfiles`
13763 : Append some common names just in case the awk scan failed.
13764 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13765 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13766 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13767 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13768 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13769
13770 : generate a few handy files for later
13771 $cat > signal.c <<'EOCP'
13772 #include <sys/types.h>
13773 #include <signal.h>
13774 #include <stdio.h>
13775 int main() {
13776
13777 /* Strange style to avoid deeply-nested #if/#else/#endif */
13778 #ifndef NSIG
13779 #  ifdef _NSIG
13780 #    define NSIG (_NSIG)
13781 #  endif
13782 #endif
13783
13784 #ifndef NSIG
13785 #  ifdef SIGMAX
13786 #    define NSIG (SIGMAX+1)
13787 #  endif
13788 #endif
13789
13790 #ifndef NSIG
13791 #  ifdef SIG_MAX
13792 #    define NSIG (SIG_MAX+1)
13793 #  endif
13794 #endif
13795
13796 #ifndef NSIG
13797 #  ifdef MAXSIG
13798 #    define NSIG (MAXSIG+1)
13799 #  endif
13800 #endif
13801
13802 #ifndef NSIG
13803 #  ifdef MAX_SIG
13804 #    define NSIG (MAX_SIG+1)
13805 #  endif
13806 #endif
13807
13808 #ifndef NSIG
13809 #  ifdef SIGARRAYSIZE
13810 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13811 #  endif
13812 #endif
13813
13814 #ifndef NSIG
13815 #  ifdef _sys_nsig
13816 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13817 #  endif
13818 #endif
13819
13820 /* Default to some arbitrary number that's big enough to get most
13821    of the common signals.
13822 */
13823 #ifndef NSIG
13824 #    define NSIG 50
13825 #endif
13826
13827 printf("NSIG %d\n", NSIG);
13828
13829 #ifndef JUST_NSIG
13830
13831 EOCP
13832
13833 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13834 {
13835         printf "#ifdef SIG"; printf $1; printf "\n"
13836         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13837         printf $1; printf ");\n"
13838         printf "#endif\n"
13839 }
13840 END {
13841         printf "#endif /* JUST_NSIG */\n";
13842         printf "exit(0);\n}\n";
13843 }
13844 ' >>signal.c
13845 $cat >signal.awk <<'EOP'
13846 BEGIN { ndups = 0 }
13847 $1 ~ /^NSIG$/ { nsig = $2 }
13848 ($1 !~ /^NSIG$/) && (NF == 2) {
13849     if ($2 > maxsig) { maxsig = $2 }
13850     if (sig_name[$2]) {
13851         dup_name[ndups] = $1
13852         dup_num[ndups] = $2
13853         ndups++ 
13854     }
13855     else {
13856         sig_name[$2] = $1
13857         sig_num[$2] = $2
13858     }
13859 }
13860 END { 
13861     if (nsig == 0) {
13862         nsig = maxsig + 1
13863     }
13864     printf("NSIG %d\n", nsig);
13865     for (n = 1; n < nsig; n++) {
13866         if (sig_name[n]) {
13867             printf("%s %d\n", sig_name[n], sig_num[n])
13868         }
13869         else {
13870             printf("NUM%d %d\n", n, n) 
13871         }
13872     }
13873     for (n = 0; n < ndups; n++) {
13874         printf("%s %d\n", dup_name[n], dup_num[n])
13875     }
13876 }
13877 EOP
13878 $cat >signal_cmd <<EOS
13879 $startsh
13880 if $test -s signal.lst; then
13881     echo "Using your existing signal.lst file"
13882         exit 0
13883 fi
13884 xxx="$xxx"
13885 EOS
13886 $cat >>signal_cmd <<'EOS'
13887
13888 set signal
13889 if eval $compile_ok; then
13890         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13891 else
13892         echo "(I can't seem be able to compile the whole test program)" >&4
13893         echo "(I'll try it in little pieces.)" >&4
13894         set signal -DJUST_NSIG
13895         if eval $compile_ok; then
13896                 ./signal$_exe > signal.nsg
13897                 $cat signal.nsg
13898         else
13899                 echo "I can't seem to figure out how many signals you have." >&4
13900                 echo "Guessing 50." >&4
13901                 echo 'NSIG 50' > signal.nsg
13902         fi
13903         : Now look at all the signal names, one at a time.
13904         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13905                 $cat > signal.c <<EOCP
13906 #include <sys/types.h>
13907 #include <signal.h>
13908 #include <stdio.h>
13909 int main() {
13910 printf("$xx %d\n", SIG${xx});
13911 return 0;
13912 }
13913 EOCP
13914                 set signal
13915                 if eval $compile; then
13916                         echo "SIG${xx} found."
13917                         ./signal$_exe  >> signal.ls1
13918                 else
13919                         echo "SIG${xx} NOT found."
13920                 fi
13921         done
13922         if $test -s signal.ls1; then
13923                 $cat signal.nsg signal.ls1 |
13924                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13925         fi
13926
13927 fi
13928 if $test -s signal.lst; then
13929         :
13930 else
13931         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13932         echo 'kill -l' >signal
13933         set X `csh -f <signal`
13934         $rm -f signal
13935         shift
13936         case $# in
13937         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13938         esac
13939         echo $@ | $tr ' ' $trnl | \
13940             $awk '{ printf "%s %d\n", $1, ++s; }
13941                   END { printf "NSIG %d\n", ++s }' >signal.lst
13942 fi
13943 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13944 EOS
13945 chmod a+x signal_cmd
13946 $eunicefix signal_cmd
13947
13948 : generate list of signal names
13949 echo " "
13950 case "$sig_name_init" in
13951 '') doinit=yes ;;
13952 *)  case "$sig_num_init" in
13953     ''|*,*) doinit=yes ;;
13954     esac ;;
13955 esac
13956 case "$doinit" in
13957 yes)
13958         echo "Generating a list of signal names and numbers..." >&4
13959         . ./signal_cmd
13960         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13961         sig_name=`$awk 'BEGIN { printf "ZERO " }
13962                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13963         sig_num=`$awk  'BEGIN { printf "0 " }
13964                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13965         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13966                              !/^NSIG/   { printf "\"%s\", ", $1 }
13967                              END        { printf "0\n" }' signal.lst`
13968         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13969                              !/^NSIG/   { printf "%d, ", $2}
13970                              END        { printf "0\n"}' signal.lst`
13971         ;;
13972 esac
13973 echo "The following $sig_count signals are available:"
13974 echo " "
13975 echo $sig_name | $awk \
13976 'BEGIN { linelen = 0 }
13977 {
13978         for (i = 1; i <= NF; i++) {
13979                 name = "SIG" $i " "
13980                 linelen = linelen + length(name)
13981                 if (linelen > 70) {
13982                         printf "\n"
13983                         linelen = length(name)
13984                 }
13985                 printf "%s", name
13986         }
13987         printf "\n"
13988 }'
13989 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13990
13991 echo " "
13992 case "$sizetype" in
13993 *_t) zzz="$sizetype"    ;;
13994 *)   zzz="filesize"     ;;
13995 esac
13996 echo "Checking the size of $zzz..." >&4 
13997 cat > try.c <<EOCP
13998 #include <sys/types.h>
13999 #include <stdio.h>
14000 int main() {
14001     printf("%d\n", (int)sizeof($sizetype));
14002     exit(0);
14003 }
14004 EOCP
14005 set try
14006 if eval $compile_ok; then
14007         yyy=`./try`
14008         case "$yyy" in
14009         '')     sizesize=4
14010                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14011                 ;;
14012         *)      sizesize=$yyy
14013                 echo "Your $zzz size is $sizesize bytes."
14014                 ;;
14015         esac
14016 else
14017         sizesize=4
14018         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14019 fi
14020
14021
14022 : check for socklen_t
14023 echo " "
14024 echo "Checking to see if you have socklen_t..." >&4
14025 $cat >try.c <<EOCP
14026 #include <sys/types.h>
14027 #$d_socket HAS_SOCKET
14028 #ifdef HAS_SOCKET
14029 #include <sys/socket.h>
14030 #endif
14031 int main() { socklen_t x = 16; }
14032 EOCP
14033 set try
14034 if eval $compile; then
14035         val="$define"
14036         echo "You have socklen_t."
14037 else
14038         val="$undef"
14039         echo "You do not have socklen_t."
14040         case "$sizetype" in
14041         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14042         esac
14043 fi
14044 $rm -f try try.*
14045 set d_socklen_t
14046 eval $setvar
14047
14048 : check for type of the size argument to socket calls
14049 case "$d_socket" in
14050 "$define")
14051         $cat <<EOM
14052
14053 Checking to see what type is the last argument of accept().
14054 EOM
14055         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14056         yyy=''
14057         case "$d_socklen_t" in
14058         "$define") yyy="$yyy socklen_t"
14059         esac
14060         yyy="$yyy $sizetype int long unsigned"
14061         for xxx in $yyy; do
14062                 case "$socksizetype" in
14063                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14064                         if ./protochk "$try" $hdrs; then
14065                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14066                                 socksizetype="$xxx"
14067                         fi
14068                         ;;
14069                 esac
14070         done
14071 : In case none of those worked, prompt the user.
14072         case "$socksizetype" in
14073         '')     rp='What is the type for socket address structure sizes?'
14074                 dflt='int'
14075                 . ./myread
14076                 socksizetype=$ans
14077                 ;;
14078         esac
14079         ;;
14080 *)      : no sockets, so pick relatively harmless default
14081         socksizetype='int'
14082         ;;
14083 esac
14084
14085 : see what type is used for signed size_t
14086 set ssize_t ssizetype int stdio.h sys/types.h
14087 eval $typedef
14088 dflt="$ssizetype"
14089 $cat > ssize.c <<EOM
14090 #include <stdio.h>
14091 #include <sys/types.h>
14092 #define Size_t $sizetype
14093 #define SSize_t $dflt
14094 int main()
14095 {
14096         if (sizeof(Size_t) == sizeof(SSize_t))
14097                 printf("$dflt\n");
14098         else if (sizeof(Size_t) == sizeof(int))
14099                 printf("int\n");
14100         else 
14101                 printf("long\n");
14102         exit(0);
14103 }
14104 EOM
14105 echo " "
14106 set ssize
14107 if eval $compile_ok && ./ssize > /dev/null; then
14108         ssizetype=`./ssize`
14109         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14110 else
14111         $cat >&4 <<EOM
14112 Help! I can't compile and run the ssize_t test program: please enlighten me!
14113 (This is probably a misconfiguration in your system or libraries, and
14114 you really ought to fix it.  Still, I'll try anyway.)
14115
14116 I need a type that is the same size as $sizetype, but is guaranteed to
14117 be signed.  Common values are ssize_t, int and long.
14118
14119 EOM
14120         rp="What signed type is the same size as $sizetype?"
14121         . ./myread
14122         ssizetype="$ans"
14123 fi
14124 $rm -f ssize ssize.*
14125
14126 : see what type of char stdio uses.
14127 echo " "
14128 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14129         echo "Your stdio uses unsigned chars." >&4
14130         stdchar="unsigned char"
14131 else
14132         echo "Your stdio uses signed chars." >&4
14133         stdchar="char"
14134 fi
14135
14136 : see if time exists
14137 echo " "
14138 if test "X$d_time" = X -o X"$timetype" = X; then
14139     if set time val -f d_time; eval $csym; $val; then
14140                 echo 'time() found.' >&4
14141                 val="$define"
14142                 rp="What is the type returned by time() on this system?"
14143                 set time_t timetype long stdio.h sys/types.h
14144                 eval $typedef_ask
14145     else
14146                 echo 'time() not found, hope that will do.' >&4
14147                 val="$undef"
14148                 timetype='int';
14149     fi
14150     set d_time
14151     eval $setvar
14152 fi
14153
14154 : see what type uids are declared as in the kernel
14155 echo " "
14156 echo "Looking for the type for user ids returned by getuid()."
14157 set uid_t uidtype xxx stdio.h sys/types.h
14158 eval $typedef
14159 case "$uidtype" in
14160 xxx)
14161         xxx=`./findhdr sys/user.h`
14162         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14163         case $1 in
14164         unsigned) dflt="$1 $2" ;;
14165         *) dflt="$1" ;;
14166         esac
14167         ;;
14168 *) dflt="$uidtype";;
14169 esac
14170 case "$uidtype" in
14171 uid_t)  echo "uid_t found." ;;
14172 *)      rp="What is the type for user ids returned by getuid()?"
14173         . ./myread
14174         uidtype="$ans"
14175         ;;
14176 esac
14177
14178 echo " "
14179 case "$uidtype" in
14180 *_t) zzz="$uidtype"     ;;
14181 *)   zzz="uid"          ;;
14182 esac
14183 echo "Checking the size of $zzz..." >&4 
14184 cat > try.c <<EOCP
14185 #include <sys/types.h>
14186 #include <stdio.h>
14187 int main() {
14188     printf("%d\n", (int)sizeof($uidtype));
14189     exit(0);
14190 }
14191 EOCP
14192 set try
14193 if eval $compile_ok; then
14194         yyy=`./try`
14195         case "$yyy" in
14196         '')     uidsize=4
14197                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14198                 ;;
14199         *)      uidsize=$yyy
14200                 echo "Your $zzz is $uidsize bytes long."
14201                 ;;
14202         esac
14203 else
14204         uidsize=4
14205         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14206 fi
14207
14208 echo " "
14209 case "$uidtype" in
14210 *_t) zzz="$uidtype"     ;;
14211 *)   zzz="uid"          ;;
14212 esac
14213 echo "Checking the sign of $zzz..." >&4
14214 cat > try.c <<EOCP
14215 #include <sys/types.h>
14216 #include <stdio.h>
14217 int main() {
14218         $uidtype foo = -1;
14219         if (foo < 0)
14220                 printf("-1\n");
14221         else
14222                 printf("1\n");
14223 }
14224 EOCP
14225 set try
14226 if eval $compile; then
14227         yyy=`./try`
14228         case "$yyy" in
14229         '')     uidsign=1
14230                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14231                 ;;
14232         *)      uidsign=$yyy
14233                 case "$uidsign" in
14234                  1) echo "Your $zzz is unsigned." ;;
14235                 -1) echo "Your $zzz is signed."   ;;
14236                 esac
14237                 ;;
14238         esac
14239 else
14240         uidsign=1
14241         echo "(I can't compile the test program--guessing unsigned.)" >&4
14242 fi
14243
14244
14245
14246 echo " "
14247 $echo "Checking the format string to be used for uids..." >&4
14248
14249 case "$uidsign" in
14250 -1)     if $test X"$uidsize" = X"$ivsize"; then
14251                 uidformat="$ivdformat"
14252         else
14253                 if $test X"$uidsize" = X"$longsize"; then
14254                         uidformat='"ld"'
14255                 else
14256                         if $test X"$uidsize" = X"$intsize"; then
14257                                 uidformat='"d"'
14258                         else
14259                                 if $test X"$uidsize" = X"$shortsize"; then
14260                                         uidformat='"hd"'
14261                                 fi
14262                         fi
14263                 fi
14264         fi
14265         ;;
14266 *)      if $test X"$uidsize" = X"$uvsize"; then
14267                 uidformat="$uvuformat"
14268         else
14269                 if $test X"$uidsize" = X"$longsize"; then
14270                         uidformat='"lu"'
14271                 else
14272                         if $test X"$uidsize" = X"$intsize"; then
14273                                 uidformat='"u"'
14274                         else
14275                                 if $test X"$uidsize" = X"$shortsize"; then
14276                                         uidformat='"hu"'
14277                                 fi
14278                         fi
14279                 fi
14280         fi
14281         ;;
14282 esac
14283
14284 : see if dbm.h is available
14285 : see if dbmclose exists
14286 set dbmclose d_dbmclose
14287 eval $inlibc
14288
14289 case "$d_dbmclose" in
14290 $define)
14291         set dbm.h i_dbm
14292         eval $inhdr
14293         case "$i_dbm" in
14294         $define)
14295                 val="$undef"
14296                 set i_rpcsvcdbm
14297                 eval $setvar
14298                 ;;
14299         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14300                 eval $inhdr
14301                 ;;
14302         esac
14303         ;;
14304 *)      echo "We won't be including <dbm.h>"
14305         val="$undef"
14306         set i_dbm
14307         eval $setvar
14308         val="$undef"
14309         set i_rpcsvcdbm
14310         eval $setvar
14311         ;;
14312 esac
14313
14314 : see if this is a sys/file.h system
14315 val=''
14316 set sys/file.h val
14317 eval $inhdr
14318
14319 : do we need to include sys/file.h ?
14320 case "$val" in
14321 "$define")
14322         echo " "
14323         if $h_sysfile; then
14324                 val="$define"
14325                 echo "We'll be including <sys/file.h>." >&4
14326         else
14327                 val="$undef"
14328                 echo "We won't be including <sys/file.h>." >&4
14329         fi
14330         ;;
14331 *)
14332         h_sysfile=false
14333         ;;
14334 esac
14335 set i_sysfile
14336 eval $setvar
14337
14338 : see if fcntl.h is there
14339 val=''
14340 set fcntl.h val
14341 eval $inhdr
14342
14343 : see if we can include fcntl.h
14344 case "$val" in
14345 "$define")
14346         echo " "
14347         if $h_fcntl; then
14348                 val="$define"
14349                 echo "We'll be including <fcntl.h>." >&4
14350         else
14351                 val="$undef"
14352                 if $h_sysfile; then
14353         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14354                 else
14355                         echo "We won't be including <fcntl.h>." >&4
14356                 fi
14357         fi
14358         ;;
14359 *)
14360         h_fcntl=false
14361         val="$undef"
14362         ;;
14363 esac
14364 set i_fcntl
14365 eval $setvar
14366
14367 : see if this is a iconv.h system
14368 set iconv.h i_iconv
14369 eval $inhdr
14370
14371 : see if this is a ieeefp.h system
14372 set ieeefp.h i_ieeefp
14373 eval $inhdr
14374
14375 : see if locale.h is available
14376 set locale.h i_locale
14377 eval $inhdr
14378
14379 : see if mach cthreads are available
14380 if test "X$usethreads" = "X$define"; then
14381         set mach/cthreads.h i_machcthr
14382         eval $inhdr
14383 else
14384         i_machcthr="$undef"
14385 fi
14386
14387
14388
14389 : see if this is a math.h system
14390 set math.h i_math
14391 eval $inhdr
14392
14393 : see if this is a mntent.h system
14394 set mntent.h i_mntent
14395 eval $inhdr
14396
14397 : see if ndbm.h is available
14398 set ndbm.h t_ndbm
14399 eval $inhdr
14400 case "$t_ndbm" in
14401 $define)
14402         : see if dbm_open exists
14403         set dbm_open d_dbm_open
14404         eval $inlibc
14405         case "$d_dbm_open" in
14406         $undef)
14407                 t_ndbm="$undef"
14408                 echo "We won't be including <ndbm.h>"
14409                 ;;
14410         esac
14411         ;;
14412 esac
14413 val="$t_ndbm"
14414 set i_ndbm
14415 eval $setvar
14416
14417 : see if net/errno.h is available
14418 val=''
14419 set net/errno.h val
14420 eval $inhdr
14421
14422 : Unfortunately, it causes problems on some systems.  Arrgh.
14423 case "$val" in
14424 $define)
14425         cat > try.c <<'EOM'
14426 #include <stdio.h>
14427 #include <errno.h>
14428 #include <net/errno.h>
14429 int func()
14430 {
14431         return ENOTSOCK;
14432 }
14433 EOM
14434         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14435                 echo "We'll be including <net/errno.h>." >&4
14436         else
14437                 echo "We won't be including <net/errno.h>." >&4
14438                 val="$undef"
14439         fi
14440         $rm -f try.* try
14441         ;;
14442 esac
14443 set i_neterrno
14444 eval $setvar
14445
14446 : see if netinet/tcp.h is available
14447 set netinet/tcp.h i_netinettcp
14448 eval $inhdr
14449
14450 : see if this is a poll.h system
14451 set poll.h i_poll
14452 eval $inhdr
14453
14454 : see if this is a prot.h system
14455 set prot.h i_prot
14456 eval $inhdr
14457
14458 echo " "
14459 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14460 $cat <<'EOSH' > Cppsym.know
14461 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14462 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14463 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14464 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14465 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14466 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14467 bull c cadmus clipper CMU COFF COMPILER_VERSION
14468 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14469 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14470 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14471 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14472 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14473 H3050R H3050RX hbullx20 hcx host_mips
14474 hp200 hp300 hp700 HP700 hp800 hp9000
14475 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14476 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14477 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14478 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14479 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14480 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14481 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14482 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14483 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14484 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14485 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14486 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14487 MATH_HAS_NO_SIDE_EFFECTS
14488 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14489 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14490 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14491 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14492 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14493 NetBSD news1500 news1700 news1800 news1900 news3700
14494 news700 news800 news900 NeXT NLS ns16000 ns32000
14495 ns32016 ns32332 ns32k nsc32000
14496 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14497 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14498 pc532 pdp11 PGC PIC plexus PORTAR posix
14499 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14500 POSIX_C_SOURCE POSIX_SOURCE POWER
14501 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14502 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14503 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14504 sony sony_news sonyrisc sparc sparclite spectrum
14505 stardent stdc STDC_EXT stratos sun sun3 sun386
14506 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14507 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14508 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14509 sysV68 sysV88 Tek4132 Tek4300 titan
14510 tower tower32 tower32_200 tower32_600 tower32_700
14511 tower32_800 tower32_850 tss
14512 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14513 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14514 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14515 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14516 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14517 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14518 z8000
14519 EOSH
14520 # Maybe put other stuff here too.
14521 cat <<EOSH >>Cppsym.know
14522 $osname
14523 EOSH
14524 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14525 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14526 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14527 $rm -f Cppsym.a Cppsym.b
14528 cat <<EOSH > Cppsym
14529 $startsh
14530 if $test \$# -gt 0; then
14531     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14532     if $test -s Cppsym.got; then
14533         $rm -f Cppsym.got
14534         exit 0
14535     fi
14536     $rm -f Cppsym.got
14537     exit 1
14538 else
14539     $tr " " "$trnl" | ./Cppsym.try
14540     exit 0
14541 fi
14542 EOSH
14543 chmod +x Cppsym
14544 $eunicefix Cppsym
14545 cat <<EOSH > Cppsym.try
14546 $startsh
14547 cat <<'EOCP' > try.c
14548 #include <stdio.h>
14549 int main() {
14550 EOCP
14551 $awk \\
14552 EOSH
14553 cat <<'EOSH' >> Cppsym.try
14554 'length($1) > 0 {
14555     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14556     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14557     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14558     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14559 }'       >> try.c
14560 echo '}' >> try.c
14561 EOSH
14562 cat <<EOSH >> Cppsym.try
14563 ccflags="$ccflags"
14564 case "$osname-$gccversion" in
14565 irix-) ccflags="\$ccflags -woff 1178" ;;
14566 esac
14567 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14568 EOSH
14569 chmod +x Cppsym.try
14570 $eunicefix Cppsym.try
14571 ./Cppsym < Cppsym.know > Cppsym.true
14572 : now check the C compiler for additional symbols
14573 postprocess_cc_v=''
14574 case "$osname" in
14575 aix) postprocess_cc_v="|$tr , ' '" ;;
14576 esac
14577 $cat >ccsym <<EOS
14578 $startsh
14579 $cat >tmp.c <<EOF
14580 extern int foo;
14581 EOF
14582 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14583 do
14584         case "\$i" in
14585         -D*) echo "\$i" | $sed 's/^-D//';;
14586         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14587         esac
14588 done
14589 $rm -f try.c
14590 EOS
14591 postprocess_cc_v=''
14592 chmod +x ccsym
14593 $eunicefix ccsym
14594 ./ccsym > ccsym1.raw
14595 if $test -s ccsym1.raw; then
14596        $sort ccsym1.raw | $uniq >ccsym.raw
14597 else
14598        mv ccsym1.raw ccsym.raw
14599 fi
14600
14601 $awk '/\=/ { print $0; next }
14602         { print $0"=1" }' ccsym.raw >ccsym.list
14603 $awk '/\=/ { print $0; next }
14604         { print $0"=1" }' Cppsym.true >ccsym.true
14605 $comm -13 ccsym.true ccsym.list >ccsym.own
14606 $comm -12 ccsym.true ccsym.list >ccsym.com
14607 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14608 also=''
14609 if $test -z ccsym.raw; then
14610         echo "Your C compiler doesn't seem to define any symbols!" >&4
14611         echo " "
14612         echo "However, your C preprocessor defines the following symbols:"
14613         $cat Cppsym.true
14614         ccsymbols=''
14615         cppsymbols=`$cat Cppsym.true`
14616         cppsymbols=`echo $cppsymbols`
14617         cppccsymbols="$cppsymbols"
14618 else
14619         if $test -s ccsym.com; then
14620                 echo "Your C compiler and pre-processor define these symbols:"
14621                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14622                 also='also '
14623                 symbols='ones'
14624                 cppccsymbols=`$cat ccsym.com`
14625                 cppccsymbols=`echo $cppccsymbols`
14626                 $test "$silent" || sleep 1
14627         fi
14628         if $test -s ccsym.cpp; then
14629                 $test "$also" && echo " "
14630                 echo "Your C pre-processor ${also}defines the following symbols:"
14631                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14632                 also='further '
14633                 cppsymbols=`$cat ccsym.cpp`
14634                 cppsymbols=`echo $cppsymbols`
14635                 $test "$silent" || sleep 1
14636         fi
14637         if $test -s ccsym.own; then
14638                 $test "$also" && echo " "
14639                 echo "Your C compiler ${also}defines the following cpp symbols:"
14640                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14641                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14642                 ccsymbols=`$cat ccsym.own`
14643                 ccsymbols=`echo $ccsymbols`
14644                 $test "$silent" || sleep 1
14645         fi
14646 fi
14647 $rm -f ccsym*
14648
14649 : see if this is a termio system
14650 val="$undef"
14651 val2="$undef"
14652 val3="$undef"
14653 if $test `./findhdr termios.h`; then
14654         set tcsetattr i_termios
14655         eval $inlibc
14656         val3="$i_termios"
14657 fi
14658 echo " "
14659 case "$val3" in
14660 "$define") echo "You have POSIX termios.h... good!" >&4;;
14661 *) if ./Cppsym pyr; then
14662                 case "`/bin/universe`" in
14663                 ucb) if $test `./findhdr sgtty.h`; then
14664                                 val2="$define"
14665                                 echo "<sgtty.h> found." >&4
14666                         else
14667                                 echo "System is pyramid with BSD universe."
14668                                 echo "<sgtty.h> not found--you could have problems." >&4
14669                         fi;;
14670                 *) if $test `./findhdr termio.h`; then
14671                                 val="$define"
14672                                 echo "<termio.h> found." >&4
14673                         else
14674                                 echo "System is pyramid with USG universe."
14675                                 echo "<termio.h> not found--you could have problems." >&4
14676                         fi;;
14677                 esac
14678         elif ./usg; then
14679                 if $test `./findhdr termio.h`; then
14680                         echo "<termio.h> found." >&4
14681                         val="$define"
14682                 elif $test `./findhdr sgtty.h`; then
14683                         echo "<sgtty.h> found." >&4
14684                         val2="$define"
14685                 else
14686 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14687                 fi
14688         else
14689                 if $test `./findhdr sgtty.h`; then
14690                         echo "<sgtty.h> found." >&4
14691                         val2="$define"
14692                 elif $test `./findhdr termio.h`; then
14693                         echo "<termio.h> found." >&4
14694                         val="$define"
14695                 else
14696 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14697                 fi
14698         fi;;
14699 esac
14700 set i_termio; eval $setvar
14701 val=$val2; set i_sgtty; eval $setvar
14702 val=$val3; set i_termios; eval $setvar
14703
14704 : see if this is a shadow.h system
14705 set shadow.h i_shadow
14706 eval $inhdr
14707
14708 : see if this is a socks.h system
14709 set socks.h i_socks
14710 eval $inhdr
14711
14712 : see if stdarg is available
14713 echo " "
14714 if $test `./findhdr stdarg.h`; then
14715         echo "<stdarg.h> found." >&4
14716         valstd="$define"
14717 else
14718         echo "<stdarg.h> NOT found." >&4
14719         valstd="$undef"
14720 fi
14721
14722 : see if varags is available
14723 echo " "
14724 if $test `./findhdr varargs.h`; then
14725         echo "<varargs.h> found." >&4
14726 else
14727         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14728 fi
14729
14730 : set up the varargs testing programs
14731 $cat > varargs.c <<EOP
14732 #ifdef I_STDARG
14733 #include <stdarg.h>
14734 #endif
14735 #ifdef I_VARARGS
14736 #include <varargs.h>
14737 #endif
14738
14739 #ifdef I_STDARG
14740 int f(char *p, ...)
14741 #else
14742 int f(va_alist)
14743 va_dcl
14744 #endif
14745 {
14746         va_list ap;
14747 #ifndef I_STDARG
14748         char *p;
14749 #endif
14750 #ifdef I_STDARG
14751         va_start(ap,p);
14752 #else
14753         va_start(ap);
14754         p = va_arg(ap, char *);
14755 #endif
14756         va_end(ap);
14757 }
14758 EOP
14759 $cat > varargs <<EOP
14760 $startsh
14761 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14762         echo "true"
14763 else
14764         echo "false"
14765 fi
14766 $rm -f varargs$_o
14767 EOP
14768 chmod +x varargs
14769
14770 : now check which varargs header should be included
14771 echo " "
14772 i_varhdr=''
14773 case "$valstd" in
14774 "$define")
14775         if `./varargs I_STDARG`; then
14776                 val='stdarg.h'
14777         elif `./varargs I_VARARGS`; then
14778                 val='varargs.h'
14779         fi
14780         ;;
14781 *)
14782         if `./varargs I_VARARGS`; then
14783                 val='varargs.h'
14784         fi
14785         ;;
14786 esac
14787 case "$val" in
14788 '')
14789 echo "I could not find the definition for va_dcl... You have problems..." >&4
14790         val="$undef"; set i_stdarg; eval $setvar
14791         val="$undef"; set i_varargs; eval $setvar
14792         ;;
14793 *) 
14794         set i_varhdr
14795         eval $setvar
14796         case "$i_varhdr" in
14797         stdarg.h)
14798                 val="$define"; set i_stdarg; eval $setvar
14799                 val="$undef"; set i_varargs; eval $setvar
14800                 ;;
14801         varargs.h)
14802                 val="$undef"; set i_stdarg; eval $setvar
14803                 val="$define"; set i_varargs; eval $setvar
14804                 ;;
14805         esac
14806         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14807 esac
14808 $rm -f varargs*
14809
14810 : see if stddef is available
14811 set stddef.h i_stddef
14812 eval $inhdr
14813
14814 : see if this is a sunmath.h system
14815 set sunmath.h i_sunmath
14816 eval $inhdr
14817
14818 : see if sys/access.h is available
14819 set sys/access.h i_sysaccess
14820 eval $inhdr
14821
14822 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14823 set sys/filio.h i_sysfilio
14824 eval $inhdr
14825 echo " "
14826 if $test `./findhdr sys/ioctl.h`; then
14827         val="$define"
14828         echo '<sys/ioctl.h> found.' >&4
14829 else
14830         val="$undef"
14831         if $test $i_sysfilio = "$define"; then
14832             echo '<sys/ioctl.h> NOT found.' >&4
14833         else
14834                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14835                 $test $i_termio = "$define" && xxx="termio.h"
14836                 $test $i_termios = "$define" && xxx="termios.h"
14837 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14838         fi
14839 fi
14840 set i_sysioctl
14841 eval $setvar
14842
14843
14844 : see if this is a syslog.h system
14845 set syslog.h i_syslog
14846 eval $inhdr
14847
14848
14849 : see if this is a sys/mode.h system
14850 set sys/mode.h i_sysmode
14851 eval $inhdr
14852
14853 : see if sys/resource.h has to be included
14854 set sys/resource.h i_sysresrc
14855 eval $inhdr
14856
14857 : see if sys/security.h is available
14858 set sys/security.h i_syssecrt
14859 eval $inhdr
14860
14861 : see if this is a sys/statvfs.h system
14862 set sys/statvfs.h i_sysstatvfs
14863 eval $inhdr
14864
14865 : see if this is a sys/uio.h system
14866 set sys/uio.h i_sysuio
14867 eval $inhdr
14868
14869 : see if this is a sys/un.h system
14870 set sys/un.h i_sysun
14871 eval $inhdr
14872
14873
14874 : see if this is a sys/utsname.h system
14875 set sys/utsname.h i_sysutsname
14876 eval $inhdr
14877
14878 : see if this is a syswait system
14879 set sys/wait.h i_syswait
14880 eval $inhdr
14881
14882 : see if this is a ustat.h system
14883 set ustat.h i_ustat
14884 eval $inhdr
14885
14886 : see if this is an utime system
14887 set utime.h i_utime
14888 eval $inhdr
14889
14890 : see if this is a values.h system
14891 set values.h i_values
14892 eval $inhdr
14893
14894 : see if this is a vfork system
14895 case "$d_vfork" in
14896 "$define")
14897         set vfork.h i_vfork
14898         eval $inhdr
14899         ;;
14900 *)
14901         i_vfork="$undef"
14902         ;;
14903 esac
14904
14905 : see if gdbm.h is available
14906 set gdbm.h t_gdbm
14907 eval $inhdr
14908 case "$t_gdbm" in
14909 $define)
14910         : see if gdbm_open exists
14911         set gdbm_open d_gdbm_open
14912         eval $inlibc
14913         case "$d_gdbm_open" in
14914         $undef)
14915                 t_gdbm="$undef"
14916                 echo "We won't be including <gdbm.h>"
14917                 ;;
14918         esac
14919         ;;
14920 esac
14921 val="$t_gdbm"
14922 set i_gdbm
14923 eval $setvar
14924
14925 echo " "
14926 echo "Looking for extensions..." >&4
14927 : If we are using the old config.sh, known_extensions may contain
14928 : old or inaccurate or duplicate values.
14929 known_extensions=''
14930 nonxs_extensions=''
14931 : We do not use find because it might not be available.
14932 : We do not just use MANIFEST because the user may have dropped
14933 : some additional extensions into the source tree and expect them
14934 : to be built.
14935
14936 : Function to recursively find available extensions, ignoring DynaLoader
14937 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14938 find_extensions='
14939     for xxx in *; do
14940        case "$xxx" in
14941            DynaLoader|dynaload) ;;
14942            *)
14943            if $test -f $xxx/$xxx.xs; then
14944                known_extensions="$known_extensions $1$xxx";
14945            elif $test -f $xxx/Makefile.PL; then
14946                nonxs_extensions="$nonxs_extensions $1$xxx";
14947            else
14948                if $test -d $xxx -a $# -lt 10; then
14949                    set $1$xxx/ $*;
14950                    cd $xxx;
14951                    eval $find_extensions;
14952                    cd ..;
14953                    shift;
14954                fi;
14955            fi
14956            ;;
14957        esac;
14958     done'
14959 tdir=`pwd`
14960 cd $rsrc/ext
14961 set X
14962 shift
14963 eval $find_extensions
14964 set X $nonxs_extensions
14965 shift
14966 nonxs_extensions="$*"
14967 set X $known_extensions
14968 shift
14969 known_extensions="$*"
14970 cd $tdir
14971
14972 : Now see which are supported on this system.
14973 avail_ext=''
14974 for xxx in $known_extensions ; do
14975         case "$xxx" in
14976         DB_File|db_file)
14977                 case "$i_db" in
14978                 $define) avail_ext="$avail_ext $xxx" ;;
14979                 esac
14980                 ;;
14981         GDBM_File|gdbm_fil)
14982                 case "$i_gdbm" in 
14983                 $define) avail_ext="$avail_ext $xxx" ;;
14984                 esac
14985                 ;;
14986         NDBM_File|ndbm_fil)
14987                 case "$i_ndbm" in
14988                 $define)
14989                     case "$osname-$use64bitint" in
14990                     hpux-define)
14991                         case "$libs" in
14992                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14993                         esac
14994                         ;;
14995                     *) avail_ext="$avail_ext $xxx" ;;
14996                     esac
14997                     ;;
14998                 esac
14999                 ;;
15000         ODBM_File|odbm_fil) 
15001                 case "${i_dbm}${i_rpcsvcdbm}" in
15002                 *"${define}"*)
15003                     case "$osname-$use64bitint" in
15004                     hpux-define)
15005                         case "$libs" in
15006                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15007                         esac
15008                         ;;
15009                     *) avail_ext="$avail_ext $xxx" ;;
15010                     esac
15011                     ;;
15012                 esac
15013                 ;;
15014         POSIX|posix)
15015                 case "$useposix" in
15016                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15017                 esac
15018                 ;;
15019         Opcode|opcode)
15020                 case "$useopcode" in
15021                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15022                 esac
15023                 ;;
15024         Socket|socket)
15025                 case "$d_socket" in 
15026                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15027                 esac
15028                 ;;
15029         Sys/Syslog|sys/syslog)
15030                 : XXX syslog requires socket
15031                 case "$d_socket" in 
15032                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15033                 esac
15034                 ;;
15035         Thread|thread)
15036                 case "$usethreads" in 
15037                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15038                 esac
15039                 ;;
15040         IPC/SysV|ipc/sysv)
15041                 : XXX Do we need a useipcsysv variable here
15042                 case "${d_msg}${d_sem}${d_shm}" in 
15043                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15044                 esac
15045                 ;;
15046         *)      avail_ext="$avail_ext $xxx"
15047                 ;;
15048         esac
15049 done
15050
15051 set X $avail_ext
15052 shift
15053 avail_ext="$*"
15054
15055 : Now see which nonxs extensions are supported on this system.
15056 : For now assume all are.
15057 nonxs_ext=''
15058 for xxx in $nonxs_extensions ; do
15059         case "$xxx" in
15060         *)      nonxs_ext="$nonxs_ext $xxx"
15061                 ;;
15062         esac
15063 done
15064
15065 set X $nonxs_ext
15066 shift
15067 nonxs_ext="$*"
15068
15069 case $usedl in
15070 $define)
15071         $cat <<EOM
15072 A number of extensions are supplied with $package.  You may choose to
15073 compile these extensions for dynamic loading (the default), compile
15074 them into the $package executable (static loading), or not include
15075 them at all.  Answer "none" to include no extensions.
15076 Note that DynaLoader is always built and need not be mentioned here.
15077
15078 EOM
15079         case "$dynamic_ext" in
15080         '') dflt="$avail_ext" ;;
15081         *)      dflt="$dynamic_ext"
15082                 # Perhaps we are reusing an old out-of-date config.sh.
15083                 case "$hint" in
15084                 previous)
15085                         if test X"$dynamic_ext" != X"$avail_ext"; then
15086                                 $cat <<EOM
15087 NOTICE:  Your previous config.sh list may be incorrect. 
15088 The extensions now available to you are 
15089         ${avail_ext}
15090 but the default list from your previous config.sh is
15091         ${dynamic_ext} 
15092
15093 EOM
15094                         fi
15095                         ;;
15096                 esac
15097                 ;;
15098         esac
15099         case "$dflt" in
15100         '')     dflt=none;;
15101         esac
15102         rp="What extensions do you wish to load dynamically?"
15103         . ./myread
15104         case "$ans" in
15105         none) dynamic_ext=' ' ;;
15106         *) dynamic_ext="$ans" ;;
15107         esac
15108
15109         case "$static_ext" in
15110         '')
15111                 : Exclude those already listed in dynamic linking
15112                 dflt=''
15113                 for xxx in $avail_ext; do
15114                         case " $dynamic_ext " in
15115                         *" $xxx "*) ;;
15116                         *) dflt="$dflt $xxx" ;;
15117                         esac
15118                 done
15119                 set X $dflt
15120                 shift
15121                 dflt="$*"
15122                 ;;
15123         *)  dflt="$static_ext" 
15124                 ;;
15125         esac
15126
15127         case "$dflt" in
15128         '')     dflt=none;;
15129         esac
15130         rp="What extensions do you wish to load statically?"
15131         . ./myread
15132         case "$ans" in
15133         none) static_ext=' ' ;;
15134         *) static_ext="$ans" ;;
15135         esac
15136         ;;
15137 *)
15138         $cat <<EOM
15139 A number of extensions are supplied with $package.  Answer "none" 
15140 to include no extensions. 
15141 Note that DynaLoader is always built and need not be mentioned here.
15142
15143 EOM
15144         case "$static_ext" in
15145         '') dflt="$avail_ext" ;;
15146         *)      dflt="$static_ext"
15147                 # Perhaps we are reusing an old out-of-date config.sh.
15148                 case "$hint" in
15149                 previous)
15150                         if test X"$static_ext" != X"$avail_ext"; then
15151                                 $cat <<EOM
15152 NOTICE:  Your previous config.sh list may be incorrect. 
15153 The extensions now available to you are 
15154         ${avail_ext}
15155 but the default list from your previous config.sh is
15156         ${static_ext} 
15157
15158 EOM
15159                         fi
15160                         ;;
15161                 esac
15162                 ;;
15163         esac
15164         : Exclude those that are not xs extensions
15165         case "$dflt" in
15166         '')     dflt=none;;
15167         esac
15168         rp="What extensions do you wish to include?"
15169         . ./myread
15170         case "$ans" in
15171         none) static_ext=' ' ;;
15172         *) static_ext="$ans" ;;
15173         esac
15174         ;;
15175 esac
15176
15177 set X $dynamic_ext $static_ext $nonxs_ext
15178 shift
15179 extensions="$*"
15180
15181 : Remove build directory name from cppstdin so it can be used from
15182 : either the present location or the final installed location.
15183 echo " "
15184 : Get out of the UU directory to get correct path name.
15185 cd ..
15186 case "$cppstdin" in
15187 `pwd`/cppstdin)
15188         echo "Stripping down cppstdin path name"
15189         cppstdin=cppstdin
15190         ;;
15191 esac
15192 cd UU
15193
15194 : end of configuration questions
15195 echo " "
15196 echo "End of configuration questions."
15197 echo " "
15198
15199 : back to where it started
15200 if test -d ../UU; then
15201         cd ..
15202 fi
15203
15204 : configuration may be patched via a 'config.over' file
15205 if $test -f config.over; then
15206         echo " "
15207         dflt=y
15208         rp='I see a config.over file.  Do you wish to load it?'
15209         . UU/myread
15210         case "$ans" in
15211         n*) echo "OK, I'll ignore it.";;
15212         *)      . ./config.over
15213                 echo "Configuration override changes have been loaded."
15214                 ;;
15215         esac
15216 fi
15217
15218 : in case they want portability, strip down executable paths
15219 case "$d_portable" in
15220 "$define")
15221         echo " "
15222         echo "Stripping down executable paths..." >&4
15223         for file in $loclist $trylist; do
15224                 eval temp=\$$file
15225                 eval $file=`basename $temp`
15226         done
15227         ;;
15228 esac
15229
15230 : create config.sh file
15231 echo " "
15232 echo "Creating config.sh..." >&4
15233 $spitshell <<EOT >config.sh
15234 $startsh
15235 #
15236 # This file was produced by running the Configure script. It holds all the
15237 # definitions figured out by Configure. Should you modify one of these values,
15238 # do not forget to propagate your changes by running "Configure -der". You may
15239 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15240 #
15241
15242 # Package name      : $package
15243 # Source directory  : $src
15244 # Configuration time: $cf_time
15245 # Configured by     : $cf_by
15246 # Target system     : $myuname
15247
15248 Author='$Author'
15249 Date='$Date'
15250 Header='$Header'
15251 Id='$Id'
15252 Locker='$Locker'
15253 Log='$Log'
15254 Mcc='$Mcc'
15255 RCSfile='$RCSfile'
15256 Revision='$Revision'
15257 Source='$Source'
15258 State='$State'
15259 _a='$_a'
15260 _exe='$_exe'
15261 _o='$_o'
15262 afs='$afs'
15263 alignbytes='$alignbytes'
15264 ansi2knr='$ansi2knr'
15265 aphostname='$aphostname'
15266 api_revision='$api_revision'
15267 api_subversion='$api_subversion'
15268 api_version='$api_version'
15269 api_versionstring='$api_versionstring'
15270 ar='$ar'
15271 archlib='$archlib'
15272 archlibexp='$archlibexp'
15273 archname64='$archname64'
15274 archname='$archname'
15275 archobjs='$archobjs'
15276 awk='$awk'
15277 baserev='$baserev'
15278 bash='$bash'
15279 bin='$bin'
15280 bincompat5005='$bincompat5005'
15281 binexp='$binexp'
15282 bison='$bison'
15283 byacc='$byacc'
15284 byteorder='$byteorder'
15285 c='$c'
15286 castflags='$castflags'
15287 cat='$cat'
15288 cc='$cc'
15289 cccdlflags='$cccdlflags'
15290 ccdlflags='$ccdlflags'
15291 ccflags='$ccflags'
15292 ccsymbols='$ccsymbols'
15293 cf_by='$cf_by'
15294 cf_email='$cf_email'
15295 cf_time='$cf_time'
15296 charsize='$charsize'
15297 chgrp='$chgrp'
15298 chmod='$chmod'
15299 chown='$chown'
15300 clocktype='$clocktype'
15301 comm='$comm'
15302 compress='$compress'
15303 contains='$contains'
15304 cp='$cp'
15305 cpio='$cpio'
15306 cpp='$cpp'
15307 cpp_stuff='$cpp_stuff'
15308 cppccsymbols='$cppccsymbols'
15309 cppflags='$cppflags'
15310 cpplast='$cpplast'
15311 cppminus='$cppminus'
15312 cpprun='$cpprun'
15313 cppstdin='$cppstdin'
15314 cppsymbols='$cppsymbols'
15315 crosscompile='$crosscompile'
15316 cryptlib='$cryptlib'
15317 csh='$csh'
15318 d_Gconvert='$d_Gconvert'
15319 d_PRIEldbl='$d_PRIEldbl'
15320 d_PRIFldbl='$d_PRIFldbl'
15321 d_PRIGldbl='$d_PRIGldbl'
15322 d_PRIX64='$d_PRIX64'
15323 d_PRId64='$d_PRId64'
15324 d_PRIeldbl='$d_PRIeldbl'
15325 d_PRIfldbl='$d_PRIfldbl'
15326 d_PRIgldbl='$d_PRIgldbl'
15327 d_PRIi64='$d_PRIi64'
15328 d_PRIo64='$d_PRIo64'
15329 d_PRIu64='$d_PRIu64'
15330 d_PRIx64='$d_PRIx64'
15331 d_access='$d_access'
15332 d_accessx='$d_accessx'
15333 d_alarm='$d_alarm'
15334 d_archlib='$d_archlib'
15335 d_atolf='$d_atolf'
15336 d_atoll='$d_atoll'
15337 d_attribut='$d_attribut'
15338 d_bcmp='$d_bcmp'
15339 d_bcopy='$d_bcopy'
15340 d_bincompat5005='$d_bincompat5005'
15341 d_bsd='$d_bsd'
15342 d_bsdgetpgrp='$d_bsdgetpgrp'
15343 d_bsdsetpgrp='$d_bsdsetpgrp'
15344 d_bzero='$d_bzero'
15345 d_casti32='$d_casti32'
15346 d_castneg='$d_castneg'
15347 d_charvspr='$d_charvspr'
15348 d_chown='$d_chown'
15349 d_chroot='$d_chroot'
15350 d_chsize='$d_chsize'
15351 d_closedir='$d_closedir'
15352 d_const='$d_const'
15353 d_crypt='$d_crypt'
15354 d_csh='$d_csh'
15355 d_cuserid='$d_cuserid'
15356 d_dbl_dig='$d_dbl_dig'
15357 d_difftime='$d_difftime'
15358 d_dirnamlen='$d_dirnamlen'
15359 d_dlerror='$d_dlerror'
15360 d_dlopen='$d_dlopen'
15361 d_dlsymun='$d_dlsymun'
15362 d_dosuid='$d_dosuid'
15363 d_drand48proto='$d_drand48proto'
15364 d_dup2='$d_dup2'
15365 d_eaccess='$d_eaccess'
15366 d_endgrent='$d_endgrent'
15367 d_endhent='$d_endhent'
15368 d_endnent='$d_endnent'
15369 d_endpent='$d_endpent'
15370 d_endpwent='$d_endpwent'
15371 d_endsent='$d_endsent'
15372 d_eofnblk='$d_eofnblk'
15373 d_eunice='$d_eunice'
15374 d_fchmod='$d_fchmod'
15375 d_fchown='$d_fchown'
15376 d_fcntl='$d_fcntl'
15377 d_fd_macros='$d_fd_macros'
15378 d_fd_set='$d_fd_set'
15379 d_fds_bits='$d_fds_bits'
15380 d_fgetpos='$d_fgetpos'
15381 d_flexfnam='$d_flexfnam'
15382 d_flock='$d_flock'
15383 d_fork='$d_fork'
15384 d_fpathconf='$d_fpathconf'
15385 d_fpos64_t='$d_fpos64_t'
15386 d_frexpl='$d_frexpl'
15387 d_fs_data_s='$d_fs_data_s'
15388 d_fseeko='$d_fseeko'
15389 d_fsetpos='$d_fsetpos'
15390 d_fstatfs='$d_fstatfs'
15391 d_fstatvfs='$d_fstatvfs'
15392 d_ftello='$d_ftello'
15393 d_ftime='$d_ftime'
15394 d_getcwd='$d_getcwd'
15395 d_getespwnam='$d_getespwnam'
15396 d_getfsstat='$d_getfsstat'
15397 d_getgrent='$d_getgrent'
15398 d_getgrps='$d_getgrps'
15399 d_gethbyaddr='$d_gethbyaddr'
15400 d_gethbyname='$d_gethbyname'
15401 d_gethent='$d_gethent'
15402 d_gethname='$d_gethname'
15403 d_gethostprotos='$d_gethostprotos'
15404 d_getlogin='$d_getlogin'
15405 d_getmnt='$d_getmnt'
15406 d_getmntent='$d_getmntent'
15407 d_getnbyaddr='$d_getnbyaddr'
15408 d_getnbyname='$d_getnbyname'
15409 d_getnent='$d_getnent'
15410 d_getnetprotos='$d_getnetprotos'
15411 d_getpbyname='$d_getpbyname'
15412 d_getpbynumber='$d_getpbynumber'
15413 d_getpent='$d_getpent'
15414 d_getpgid='$d_getpgid'
15415 d_getpgrp2='$d_getpgrp2'
15416 d_getpgrp='$d_getpgrp'
15417 d_getppid='$d_getppid'
15418 d_getprior='$d_getprior'
15419 d_getprotoprotos='$d_getprotoprotos'
15420 d_getprpwnam='$d_getprpwnam'
15421 d_getpwent='$d_getpwent'
15422 d_getsbyname='$d_getsbyname'
15423 d_getsbyport='$d_getsbyport'
15424 d_getsent='$d_getsent'
15425 d_getservprotos='$d_getservprotos'
15426 d_getspnam='$d_getspnam'
15427 d_gettimeod='$d_gettimeod'
15428 d_gnulibc='$d_gnulibc'
15429 d_grpasswd='$d_grpasswd'
15430 d_hasmntopt='$d_hasmntopt'
15431 d_htonl='$d_htonl'
15432 d_iconv='$d_iconv'
15433 d_index='$d_index'
15434 d_inetaton='$d_inetaton'
15435 d_int64_t='$d_int64_t'
15436 d_isascii='$d_isascii'
15437 d_isnan='$d_isnan'
15438 d_isnanl='$d_isnanl'
15439 d_killpg='$d_killpg'
15440 d_lchown='$d_lchown'
15441 d_ldbl_dig='$d_ldbl_dig'
15442 d_link='$d_link'
15443 d_locconv='$d_locconv'
15444 d_lockf='$d_lockf'
15445 d_longdbl='$d_longdbl'
15446 d_longlong='$d_longlong'
15447 d_lseekproto='$d_lseekproto'
15448 d_lstat='$d_lstat'
15449 d_madvise='$d_madvise'
15450 d_mblen='$d_mblen'
15451 d_mbstowcs='$d_mbstowcs'
15452 d_mbtowc='$d_mbtowc'
15453 d_memchr='$d_memchr'
15454 d_memcmp='$d_memcmp'
15455 d_memcpy='$d_memcpy'
15456 d_memmove='$d_memmove'
15457 d_memset='$d_memset'
15458 d_mkdir='$d_mkdir'
15459 d_mkdtemp='$d_mkdtemp'
15460 d_mkfifo='$d_mkfifo'
15461 d_mkstemp='$d_mkstemp'
15462 d_mkstemps='$d_mkstemps'
15463 d_mktime='$d_mktime'
15464 d_mmap='$d_mmap'
15465 d_modfl='$d_modfl'
15466 d_mprotect='$d_mprotect'
15467 d_msg='$d_msg'
15468 d_msg_ctrunc='$d_msg_ctrunc'
15469 d_msg_dontroute='$d_msg_dontroute'
15470 d_msg_oob='$d_msg_oob'
15471 d_msg_peek='$d_msg_peek'
15472 d_msg_proxy='$d_msg_proxy'
15473 d_msgctl='$d_msgctl'
15474 d_msgget='$d_msgget'
15475 d_msgrcv='$d_msgrcv'
15476 d_msgsnd='$d_msgsnd'
15477 d_msync='$d_msync'
15478 d_munmap='$d_munmap'
15479 d_mymalloc='$d_mymalloc'
15480 d_nice='$d_nice'
15481 d_nv_preserves_uv='$d_nv_preserves_uv'
15482 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15483 d_off64_t='$d_off64_t'
15484 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15485 d_oldpthreads='$d_oldpthreads'
15486 d_oldsock='$d_oldsock'
15487 d_open3='$d_open3'
15488 d_pathconf='$d_pathconf'
15489 d_pause='$d_pause'
15490 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15491 d_phostname='$d_phostname'
15492 d_pipe='$d_pipe'
15493 d_poll='$d_poll'
15494 d_portable='$d_portable'
15495 d_pthread_yield='$d_pthread_yield'
15496 d_pwage='$d_pwage'
15497 d_pwchange='$d_pwchange'
15498 d_pwclass='$d_pwclass'
15499 d_pwcomment='$d_pwcomment'
15500 d_pwexpire='$d_pwexpire'
15501 d_pwgecos='$d_pwgecos'
15502 d_pwpasswd='$d_pwpasswd'
15503 d_pwquota='$d_pwquota'
15504 d_qgcvt='$d_qgcvt'
15505 d_quad='$d_quad'
15506 d_readdir='$d_readdir'
15507 d_readlink='$d_readlink'
15508 d_rename='$d_rename'
15509 d_rewinddir='$d_rewinddir'
15510 d_rmdir='$d_rmdir'
15511 d_safebcpy='$d_safebcpy'
15512 d_safemcpy='$d_safemcpy'
15513 d_sanemcmp='$d_sanemcmp'
15514 d_sched_yield='$d_sched_yield'
15515 d_scm_rights='$d_scm_rights'
15516 d_seekdir='$d_seekdir'
15517 d_select='$d_select'
15518 d_sem='$d_sem'
15519 d_semctl='$d_semctl'
15520 d_semctl_semid_ds='$d_semctl_semid_ds'
15521 d_semctl_semun='$d_semctl_semun'
15522 d_semget='$d_semget'
15523 d_semop='$d_semop'
15524 d_setegid='$d_setegid'
15525 d_seteuid='$d_seteuid'
15526 d_setgrent='$d_setgrent'
15527 d_setgrps='$d_setgrps'
15528 d_sethent='$d_sethent'
15529 d_setlinebuf='$d_setlinebuf'
15530 d_setlocale='$d_setlocale'
15531 d_setnent='$d_setnent'
15532 d_setpent='$d_setpent'
15533 d_setpgid='$d_setpgid'
15534 d_setpgrp2='$d_setpgrp2'
15535 d_setpgrp='$d_setpgrp'
15536 d_setprior='$d_setprior'
15537 d_setproctitle='$d_setproctitle'
15538 d_setpwent='$d_setpwent'
15539 d_setregid='$d_setregid'
15540 d_setresgid='$d_setresgid'
15541 d_setresuid='$d_setresuid'
15542 d_setreuid='$d_setreuid'
15543 d_setrgid='$d_setrgid'
15544 d_setruid='$d_setruid'
15545 d_setsent='$d_setsent'
15546 d_setsid='$d_setsid'
15547 d_setvbuf='$d_setvbuf'
15548 d_sfio='$d_sfio'
15549 d_shm='$d_shm'
15550 d_shmat='$d_shmat'
15551 d_shmatprototype='$d_shmatprototype'
15552 d_shmctl='$d_shmctl'
15553 d_shmdt='$d_shmdt'
15554 d_shmget='$d_shmget'
15555 d_sigaction='$d_sigaction'
15556 d_sigsetjmp='$d_sigsetjmp'
15557 d_socket='$d_socket'
15558 d_socklen_t='$d_socklen_t'
15559 d_sockpair='$d_sockpair'
15560 d_sqrtl='$d_sqrtl'
15561 d_statblks='$d_statblks'
15562 d_statfs_f_flags='$d_statfs_f_flags'
15563 d_statfs_s='$d_statfs_s'
15564 d_statvfs='$d_statvfs'
15565 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15566 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15567 d_stdio_stream_array='$d_stdio_stream_array'
15568 d_stdiobase='$d_stdiobase'
15569 d_stdstdio='$d_stdstdio'
15570 d_strchr='$d_strchr'
15571 d_strcoll='$d_strcoll'
15572 d_strctcpy='$d_strctcpy'
15573 d_strerrm='$d_strerrm'
15574 d_strerror='$d_strerror'
15575 d_strtod='$d_strtod'
15576 d_strtol='$d_strtol'
15577 d_strtold='$d_strtold'
15578 d_strtoll='$d_strtoll'
15579 d_strtoul='$d_strtoul'
15580 d_strtoull='$d_strtoull'
15581 d_strtouq='$d_strtouq'
15582 d_strxfrm='$d_strxfrm'
15583 d_suidsafe='$d_suidsafe'
15584 d_symlink='$d_symlink'
15585 d_syscall='$d_syscall'
15586 d_sysconf='$d_sysconf'
15587 d_sysernlst='$d_sysernlst'
15588 d_syserrlst='$d_syserrlst'
15589 d_system='$d_system'
15590 d_tcgetpgrp='$d_tcgetpgrp'
15591 d_tcsetpgrp='$d_tcsetpgrp'
15592 d_telldir='$d_telldir'
15593 d_telldirproto='$d_telldirproto'
15594 d_time='$d_time'
15595 d_times='$d_times'
15596 d_truncate='$d_truncate'
15597 d_tzname='$d_tzname'
15598 d_umask='$d_umask'
15599 d_uname='$d_uname'
15600 d_union_semun='$d_union_semun'
15601 d_ustat='$d_ustat'
15602 d_vendorarch='$d_vendorarch'
15603 d_vendorbin='$d_vendorbin'
15604 d_vendorlib='$d_vendorlib'
15605 d_vfork='$d_vfork'
15606 d_void_closedir='$d_void_closedir'
15607 d_voidsig='$d_voidsig'
15608 d_voidtty='$d_voidtty'
15609 d_volatile='$d_volatile'
15610 d_vprintf='$d_vprintf'
15611 d_wait4='$d_wait4'
15612 d_waitpid='$d_waitpid'
15613 d_wcstombs='$d_wcstombs'
15614 d_wctomb='$d_wctomb'
15615 d_xenix='$d_xenix'
15616 date='$date'
15617 db_hashtype='$db_hashtype'
15618 db_prefixtype='$db_prefixtype'
15619 defvoidused='$defvoidused'
15620 direntrytype='$direntrytype'
15621 dlext='$dlext'
15622 dlsrc='$dlsrc'
15623 doublesize='$doublesize'
15624 drand01='$drand01'
15625 dynamic_ext='$dynamic_ext'
15626 eagain='$eagain'
15627 ebcdic='$ebcdic'
15628 echo='$echo'
15629 egrep='$egrep'
15630 emacs='$emacs'
15631 eunicefix='$eunicefix'
15632 exe_ext='$exe_ext'
15633 expr='$expr'
15634 extensions='$extensions'
15635 fflushNULL='$fflushNULL'
15636 fflushall='$fflushall'
15637 find='$find'
15638 firstmakefile='$firstmakefile'
15639 flex='$flex'
15640 fpossize='$fpossize'
15641 fpostype='$fpostype'
15642 freetype='$freetype'
15643 full_ar='$full_ar'
15644 full_csh='$full_csh'
15645 full_sed='$full_sed'
15646 gccosandvers='$gccosandvers'
15647 gccversion='$gccversion'
15648 gidformat='$gidformat'
15649 gidsign='$gidsign'
15650 gidsize='$gidsize'
15651 gidtype='$gidtype'
15652 glibpth='$glibpth'
15653 grep='$grep'
15654 groupcat='$groupcat'
15655 groupstype='$groupstype'
15656 gzip='$gzip'
15657 h_fcntl='$h_fcntl'
15658 h_sysfile='$h_sysfile'
15659 hint='$hint'
15660 hostcat='$hostcat'
15661 huge='$huge'
15662 i16size='$i16size'
15663 i16type='$i16type'
15664 i32size='$i32size'
15665 i32type='$i32type'
15666 i64size='$i64size'
15667 i64type='$i64type'
15668 i8size='$i8size'
15669 i8type='$i8type'
15670 i_arpainet='$i_arpainet'
15671 i_bsdioctl='$i_bsdioctl'
15672 i_db='$i_db'
15673 i_dbm='$i_dbm'
15674 i_dirent='$i_dirent'
15675 i_dld='$i_dld'
15676 i_dlfcn='$i_dlfcn'
15677 i_fcntl='$i_fcntl'
15678 i_float='$i_float'
15679 i_gdbm='$i_gdbm'
15680 i_grp='$i_grp'
15681 i_iconv='$i_iconv'
15682 i_ieeefp='$i_ieeefp'
15683 i_inttypes='$i_inttypes'
15684 i_limits='$i_limits'
15685 i_locale='$i_locale'
15686 i_machcthr='$i_machcthr'
15687 i_malloc='$i_malloc'
15688 i_math='$i_math'
15689 i_memory='$i_memory'
15690 i_mntent='$i_mntent'
15691 i_ndbm='$i_ndbm'
15692 i_netdb='$i_netdb'
15693 i_neterrno='$i_neterrno'
15694 i_netinettcp='$i_netinettcp'
15695 i_niin='$i_niin'
15696 i_poll='$i_poll'
15697 i_prot='$i_prot'
15698 i_pthread='$i_pthread'
15699 i_pwd='$i_pwd'
15700 i_rpcsvcdbm='$i_rpcsvcdbm'
15701 i_sfio='$i_sfio'
15702 i_sgtty='$i_sgtty'
15703 i_shadow='$i_shadow'
15704 i_socks='$i_socks'
15705 i_stdarg='$i_stdarg'
15706 i_stddef='$i_stddef'
15707 i_stdlib='$i_stdlib'
15708 i_string='$i_string'
15709 i_sunmath='$i_sunmath'
15710 i_sysaccess='$i_sysaccess'
15711 i_sysdir='$i_sysdir'
15712 i_sysfile='$i_sysfile'
15713 i_sysfilio='$i_sysfilio'
15714 i_sysin='$i_sysin'
15715 i_sysioctl='$i_sysioctl'
15716 i_syslog='$i_syslog'
15717 i_sysmman='$i_sysmman'
15718 i_sysmode='$i_sysmode'
15719 i_sysmount='$i_sysmount'
15720 i_sysndir='$i_sysndir'
15721 i_sysparam='$i_sysparam'
15722 i_sysresrc='$i_sysresrc'
15723 i_syssecrt='$i_syssecrt'
15724 i_sysselct='$i_sysselct'
15725 i_syssockio='$i_syssockio'
15726 i_sysstat='$i_sysstat'
15727 i_sysstatfs='$i_sysstatfs'
15728 i_sysstatvfs='$i_sysstatvfs'
15729 i_systime='$i_systime'
15730 i_systimek='$i_systimek'
15731 i_systimes='$i_systimes'
15732 i_systypes='$i_systypes'
15733 i_sysuio='$i_sysuio'
15734 i_sysun='$i_sysun'
15735 i_sysutsname='$i_sysutsname'
15736 i_sysvfs='$i_sysvfs'
15737 i_syswait='$i_syswait'
15738 i_termio='$i_termio'
15739 i_termios='$i_termios'
15740 i_time='$i_time'
15741 i_unistd='$i_unistd'
15742 i_ustat='$i_ustat'
15743 i_utime='$i_utime'
15744 i_values='$i_values'
15745 i_varargs='$i_varargs'
15746 i_varhdr='$i_varhdr'
15747 i_vfork='$i_vfork'
15748 ignore_versioned_solibs='$ignore_versioned_solibs'
15749 inc_version_list='$inc_version_list'
15750 inc_version_list_init='$inc_version_list_init'
15751 incpath='$incpath'
15752 inews='$inews'
15753 installarchlib='$installarchlib'
15754 installbin='$installbin'
15755 installman1dir='$installman1dir'
15756 installman3dir='$installman3dir'
15757 installprefix='$installprefix'
15758 installprefixexp='$installprefixexp'
15759 installprivlib='$installprivlib'
15760 installscript='$installscript'
15761 installsitearch='$installsitearch'
15762 installsitebin='$installsitebin'
15763 installsitelib='$installsitelib'
15764 installstyle='$installstyle'
15765 installusrbinperl='$installusrbinperl'
15766 installvendorarch='$installvendorarch'
15767 installvendorbin='$installvendorbin'
15768 installvendorlib='$installvendorlib'
15769 intsize='$intsize'
15770 ivdformat='$ivdformat'
15771 ivsize='$ivsize'
15772 ivtype='$ivtype'
15773 known_extensions='$known_extensions'
15774 ksh='$ksh'
15775 large='$large'
15776 ld='$ld'
15777 lddlflags='$lddlflags'
15778 ldflags='$ldflags'
15779 ldlibpthname='$ldlibpthname'
15780 less='$less'
15781 lib_ext='$lib_ext'
15782 libc='$libc'
15783 libperl='$libperl'
15784 libpth='$libpth'
15785 libs='$libs'
15786 libsdirs='$libsdirs'
15787 libsfiles='$libsfiles'
15788 libsfound='$libsfound'
15789 libspath='$libspath'
15790 libswanted='$libswanted'
15791 line='$line'
15792 lint='$lint'
15793 lkflags='$lkflags'
15794 ln='$ln'
15795 lns='$lns'
15796 locincpth='$locincpth'
15797 loclibpth='$loclibpth'
15798 longdblsize='$longdblsize'
15799 longlongsize='$longlongsize'
15800 longsize='$longsize'
15801 lp='$lp'
15802 lpr='$lpr'
15803 ls='$ls'
15804 lseeksize='$lseeksize'
15805 lseektype='$lseektype'
15806 mail='$mail'
15807 mailx='$mailx'
15808 make='$make'
15809 make_set_make='$make_set_make'
15810 mallocobj='$mallocobj'
15811 mallocsrc='$mallocsrc'
15812 malloctype='$malloctype'
15813 man1dir='$man1dir'
15814 man1direxp='$man1direxp'
15815 man1ext='$man1ext'
15816 man3dir='$man3dir'
15817 man3direxp='$man3direxp'
15818 man3ext='$man3ext'
15819 medium='$medium'
15820 mips_type='$mips_type'
15821 mkdir='$mkdir'
15822 mmaptype='$mmaptype'
15823 models='$models'
15824 modetype='$modetype'
15825 more='$more'
15826 multiarch='$multiarch'
15827 mv='$mv'
15828 myarchname='$myarchname'
15829 mydomain='$mydomain'
15830 myhostname='$myhostname'
15831 myuname='$myuname'
15832 n='$n'
15833 netdb_hlen_type='$netdb_hlen_type'
15834 netdb_host_type='$netdb_host_type'
15835 netdb_name_type='$netdb_name_type'
15836 netdb_net_type='$netdb_net_type'
15837 nm='$nm'
15838 nm_opt='$nm_opt'
15839 nm_so_opt='$nm_so_opt'
15840 nonxs_ext='$nonxs_ext'
15841 nroff='$nroff'
15842 nvsize='$nvsize'
15843 nvtype='$nvtype'
15844 o_nonblock='$o_nonblock'
15845 obj_ext='$obj_ext'
15846 old_pthread_create_joinable='$old_pthread_create_joinable'
15847 optimize='$optimize'
15848 orderlib='$orderlib'
15849 osname='$osname'
15850 osvers='$osvers'
15851 otherlibdirs='$otherlibdirs'
15852 package='$package'
15853 pager='$pager'
15854 passcat='$passcat'
15855 patchlevel='$patchlevel'
15856 path_sep='$path_sep'
15857 perl5='$perl5'
15858 perl='$perl'
15859 perladmin='$perladmin'
15860 perlpath='$perlpath'
15861 pg='$pg'
15862 phostname='$phostname'
15863 pidtype='$pidtype'
15864 plibpth='$plibpth'
15865 pm_apiversion='$pm_apiversion'
15866 pmake='$pmake'
15867 pr='$pr'
15868 prefix='$prefix'
15869 prefixexp='$prefixexp'
15870 privlib='$privlib'
15871 privlibexp='$privlibexp'
15872 prototype='$prototype'
15873 ptrsize='$ptrsize'
15874 quadkind='$quadkind'
15875 quadtype='$quadtype'
15876 randbits='$randbits'
15877 randfunc='$randfunc'
15878 randseedtype='$randseedtype'
15879 ranlib='$ranlib'
15880 rd_nodata='$rd_nodata'
15881 revision='$revision'
15882 rm='$rm'
15883 rmail='$rmail'
15884 runnm='$runnm'
15885 sPRIEldbl='$sPRIEldbl'
15886 sPRIFldbl='$sPRIFldbl'
15887 sPRIGldbl='$sPRIGldbl'
15888 sPRIX64='$sPRIX64'
15889 sPRId64='$sPRId64'
15890 sPRIeldbl='$sPRIeldbl'
15891 sPRIfldbl='$sPRIfldbl'
15892 sPRIgldbl='$sPRIgldbl'
15893 sPRIi64='$sPRIi64'
15894 sPRIo64='$sPRIo64'
15895 sPRIu64='$sPRIu64'
15896 sPRIx64='$sPRIx64'
15897 sched_yield='$sched_yield'
15898 scriptdir='$scriptdir'
15899 scriptdirexp='$scriptdirexp'
15900 sed='$sed'
15901 seedfunc='$seedfunc'
15902 selectminbits='$selectminbits'
15903 selecttype='$selecttype'
15904 sendmail='$sendmail'
15905 sh='$sh'
15906 shar='$shar'
15907 sharpbang='$sharpbang'
15908 shmattype='$shmattype'
15909 shortsize='$shortsize'
15910 shrpenv='$shrpenv'
15911 shsharp='$shsharp'
15912 sig_count='$sig_count'
15913 sig_name='$sig_name'
15914 sig_name_init='$sig_name_init'
15915 sig_num='$sig_num'
15916 sig_num_init='$sig_num_init'
15917 signal_t='$signal_t'
15918 sitearch='$sitearch'
15919 sitearchexp='$sitearchexp'
15920 sitebin='$sitebin'
15921 sitebinexp='$sitebinexp'
15922 sitelib='$sitelib'
15923 sitelib_stem='$sitelib_stem'
15924 sitelibexp='$sitelibexp'
15925 siteprefix='$siteprefix'
15926 siteprefixexp='$siteprefixexp'
15927 sizesize='$sizesize'
15928 sizetype='$sizetype'
15929 sleep='$sleep'
15930 smail='$smail'
15931 small='$small'
15932 so='$so'
15933 sockethdr='$sockethdr'
15934 socketlib='$socketlib'
15935 socksizetype='$socksizetype'
15936 sort='$sort'
15937 spackage='$spackage'
15938 spitshell='$spitshell'
15939 split='$split'
15940 src='$src'
15941 ssizetype='$ssizetype'
15942 startperl='$startperl'
15943 startsh='$startsh'
15944 static_ext='$static_ext'
15945 stdchar='$stdchar'
15946 stdio_base='$stdio_base'
15947 stdio_bufsiz='$stdio_bufsiz'
15948 stdio_cnt='$stdio_cnt'
15949 stdio_filbuf='$stdio_filbuf'
15950 stdio_ptr='$stdio_ptr'
15951 stdio_stream_array='$stdio_stream_array'
15952 strings='$strings'
15953 submit='$submit'
15954 subversion='$subversion'
15955 sysman='$sysman'
15956 tail='$tail'
15957 tar='$tar'
15958 tbl='$tbl'
15959 tee='$tee'
15960 test='$test'
15961 timeincl='$timeincl'
15962 timetype='$timetype'
15963 touch='$touch'
15964 tr='$tr'
15965 trnl='$trnl'
15966 troff='$troff'
15967 u16size='$u16size'
15968 u16type='$u16type'
15969 u32size='$u32size'
15970 u32type='$u32type'
15971 u64size='$u64size'
15972 u64type='$u64type'
15973 u8size='$u8size'
15974 u8type='$u8type'
15975 uidformat='$uidformat'
15976 uidsign='$uidsign'
15977 uidsize='$uidsize'
15978 uidtype='$uidtype'
15979 uname='$uname'
15980 uniq='$uniq'
15981 uquadtype='$uquadtype'
15982 use5005threads='$use5005threads'
15983 use64bitall='$use64bitall'
15984 use64bitint='$use64bitint'
15985 usedl='$usedl'
15986 useithreads='$useithreads'
15987 uselargefiles='$uselargefiles'
15988 uselongdouble='$uselongdouble'
15989 usemorebits='$usemorebits'
15990 usemultiplicity='$usemultiplicity'
15991 usemymalloc='$usemymalloc'
15992 usenm='$usenm'
15993 useopcode='$useopcode'
15994 useperlio='$useperlio'
15995 useposix='$useposix'
15996 usesfio='$usesfio'
15997 useshrplib='$useshrplib'
15998 usesocks='$usesocks'
15999 usethreads='$usethreads'
16000 usevendorprefix='$usevendorprefix'
16001 usevfork='$usevfork'
16002 usrinc='$usrinc'
16003 uuname='$uuname'
16004 uvoformat='$uvoformat'
16005 uvsize='$uvsize'
16006 uvtype='$uvtype'
16007 uvuformat='$uvuformat'
16008 uvxformat='$uvxformat'
16009 vendorarch='$vendorarch'
16010 vendorarchexp='$vendorarchexp'
16011 vendorbin='$vendorbin'
16012 vendorbinexp='$vendorbinexp'
16013 vendorlib='$vendorlib'
16014 vendorlib_stem='$vendorlib_stem'
16015 vendorlibexp='$vendorlibexp'
16016 vendorprefix='$vendorprefix'
16017 vendorprefixexp='$vendorprefixexp'
16018 version='$version'
16019 vi='$vi'
16020 voidflags='$voidflags'
16021 xlibpth='$xlibpth'
16022 xs_apiversion='$xs_apiversion'
16023 zcat='$zcat'
16024 zip='$zip'
16025 EOT
16026
16027 : Add in command line options if available
16028 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16029
16030 : add special variables
16031 $test -f $src/patchlevel.h && \
16032 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16033 echo "CONFIGDOTSH=true" >>config.sh
16034
16035 : propagate old symbols
16036 if $test -f UU/config.sh; then
16037         <UU/config.sh sort | uniq >UU/oldconfig.sh
16038         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16039         sort | uniq -u >UU/oldsyms
16040         set X `cat UU/oldsyms`
16041         shift
16042         case $# in
16043         0) ;;
16044         *)
16045                 cat <<EOM
16046 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16047 EOM
16048                 echo "# Variables propagated from previous config.sh file." >>config.sh
16049                 for sym in `cat UU/oldsyms`; do
16050                         echo "    Propagating $hint variable "'$'"$sym..."
16051                         eval 'tmp="$'"${sym}"'"'
16052                         echo "$tmp" | \
16053                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16054                 done
16055                 ;;
16056         esac
16057 fi
16058
16059 : Finish up by extracting the .SH files
16060 case "$alldone" in
16061 exit)
16062         $rm -rf UU
16063         echo "Done."
16064         exit 0
16065         ;;
16066 cont)
16067         ;;
16068 '')
16069         dflt=''
16070         nostick=true
16071         $cat <<EOM
16072
16073 If you'd like to make any changes to the config.sh file before I begin
16074 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16075
16076 EOM
16077         rp="Press return or use a shell escape to edit config.sh:"
16078         . UU/myread
16079         nostick=''
16080         case "$ans" in
16081         '') ;;
16082         *) : in case they cannot read
16083                 sh 1>&4 -c "$ans";;
16084         esac
16085         ;;
16086 esac
16087
16088 : if this fails, just run all the .SH files by hand
16089 . ./config.sh
16090
16091 echo " "
16092 exec 1>&4
16093 . ./UU/extract
16094
16095 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16096         dflt=y
16097         case "$silent" in
16098         true) ;;
16099         *)
16100                 $cat <<EOM
16101
16102 Now you need to generate make dependencies by running "$make depend".
16103 You might prefer to run it in background: "$make depend > makedepend.out &"
16104 It can take a while, so you might not want to run it right now.
16105
16106 EOM
16107                 ;;
16108         esac
16109         rp="Run $make depend now?"
16110         . UU/myread
16111         case "$ans" in
16112         y*)
16113                 $make depend && echo "Now you must run a $make."
16114                 ;;
16115         *)
16116                 echo "You must run '$make depend' then '$make'."
16117                 ;;
16118         esac
16119 elif test -f [Mm]akefile; then
16120         echo " "
16121         echo "Now you must run a $make."
16122 else
16123         echo "Done."
16124 fi
16125
16126 if $test -f Policy.sh; then
16127     $cat <<EOM
16128
16129 If you compile $package on a different machine or from a different object
16130 directory, copy the Policy.sh file from this object directory to the
16131 new one before you run Configure -- this will help you with most of
16132 the policy defaults.
16133
16134 EOM
16135 fi
16136 if $test -f config.msg; then
16137     echo "Hmm.  I also noted the following information while running:"
16138     echo " "
16139     $cat config.msg >&4
16140     $rm -f config.msg
16141 fi
16142 $rm -f kit*isdone ark*isdone
16143 $rm -rf UU
16144
16145 : End of Configure
16146