1d0c88c3d3c5e3bd94dd523f01e77f70a58f5c7e
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Feb  9 04:05:32 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_iconv=''
403 d_inetaton=''
404 d_int64t=''
405 d_isascii=''
406 d_killpg=''
407 d_lchown=''
408 d_ldbl_dig=''
409 d_link=''
410 d_locconv=''
411 d_lockf=''
412 d_longdbl=''
413 longdblsize=''
414 d_longlong=''
415 longlongsize=''
416 d_lstat=''
417 d_mblen=''
418 d_mbstowcs=''
419 d_mbtowc=''
420 d_memchr=''
421 d_memcmp=''
422 d_memcpy=''
423 d_memmove=''
424 d_memset=''
425 d_mkdir=''
426 d_mkdtemp=''
427 d_mkfifo=''
428 d_mkstemp=''
429 d_mkstemps=''
430 d_mktime=''
431 d_mmap=''
432 mmaptype=''
433 d_mprotect=''
434 d_msg=''
435 d_msgctl=''
436 d_msgget=''
437 d_msgrcv=''
438 d_msgsnd=''
439 d_msync=''
440 d_munmap=''
441 d_nice=''
442 d_open3=''
443 d_fpathconf=''
444 d_pathconf=''
445 d_pause=''
446 d_pipe=''
447 d_poll=''
448 d_portable=''
449 d_old_pthread_create_joinable=''
450 old_pthread_create_joinable=''
451 d_pthread_yield=''
452 d_sched_yield=''
453 sched_yield=''
454 d_readdir=''
455 d_rewinddir=''
456 d_seekdir=''
457 d_telldir=''
458 d_readlink=''
459 d_rename=''
460 d_rmdir=''
461 d_safebcpy=''
462 d_safemcpy=''
463 d_sanemcmp=''
464 d_select=''
465 d_sem=''
466 d_semctl=''
467 d_semget=''
468 d_semop=''
469 d_setegid=''
470 d_seteuid=''
471 d_setgrent=''
472 d_setgrps=''
473 d_sethent=''
474 d_setlinebuf=''
475 d_setlocale=''
476 d_setnent=''
477 d_setpent=''
478 d_setpgid=''
479 d_setpgrp2=''
480 d_bsdsetpgrp=''
481 d_setpgrp=''
482 d_setprior=''
483 d_setpwent=''
484 d_setregid=''
485 d_setresgid=''
486 d_setresuid=''
487 d_setreuid=''
488 d_setrgid=''
489 d_setruid=''
490 d_setsent=''
491 d_setsid=''
492 d_setspent=''
493 d_setvbuf=''
494 d_sfio=''
495 usesfio=''
496 d_shm=''
497 d_shmat=''
498 d_shmatprototype=''
499 shmattype=''
500 d_shmctl=''
501 d_shmdt=''
502 d_shmget=''
503 d_sigaction=''
504 d_sigsetjmp=''
505 d_msg_ctrunc=''
506 d_msg_dontroute=''
507 d_msg_oob=''
508 d_msg_peek=''
509 d_msg_proxy=''
510 d_oldsock=''
511 d_scm_rights=''
512 d_socket=''
513 d_sockpair=''
514 sockethdr=''
515 socketlib=''
516 d_sqrtl=''
517 d_statblks=''
518 d_statfs_f_flags=''
519 d_statfs_s=''
520 d_fstatvfs=''
521 d_statvfs=''
522 d_stdio_cnt_lval=''
523 d_stdio_ptr_lval=''
524 d_stdiobase=''
525 d_stdstdio=''
526 stdio_base=''
527 stdio_bufsiz=''
528 stdio_cnt=''
529 stdio_filbuf=''
530 stdio_ptr=''
531 d_index=''
532 d_strchr=''
533 d_strcoll=''
534 d_strctcpy=''
535 d_strerrm=''
536 d_strerror=''
537 d_sysernlst=''
538 d_syserrlst=''
539 d_strtod=''
540 d_strtol=''
541 d_strtold=''
542 d_strtoll=''
543 d_strtoul=''
544 d_strtoull=''
545 d_strtouq=''
546 d_strxfrm=''
547 d_symlink=''
548 d_syscall=''
549 d_sysconf=''
550 d_system=''
551 d_tcgetpgrp=''
552 d_tcsetpgrp=''
553 d_telldirproto=''
554 d_time=''
555 timetype=''
556 clocktype=''
557 d_times=''
558 d_truncate=''
559 d_tzname=''
560 d_umask=''
561 d_semctl_semid_ds=''
562 d_semctl_semun=''
563 d_union_semun=''
564 d_ustat=''
565 d_vfork=''
566 usevfork=''
567 d_voidsig=''
568 signal_t=''
569 d_volatile=''
570 d_charvspr=''
571 d_vprintf=''
572 d_wait4=''
573 d_waitpid=''
574 d_wcstombs=''
575 d_wctomb=''
576 dlext=''
577 cccdlflags=''
578 ccdlflags=''
579 dlsrc=''
580 ld=''
581 lddlflags=''
582 usedl=''
583 doublesize=''
584 ebcdic=''
585 fflushNULL=''
586 fflushall=''
587 fpossize=''
588 fpostype=''
589 gidformat=''
590 gidsign=''
591 gidsize=''
592 gidtype=''
593 groupstype=''
594 h_fcntl=''
595 h_sysfile=''
596 i_arpainet=''
597 db_hashtype=''
598 db_prefixtype=''
599 i_db=''
600 i_dbm=''
601 i_rpcsvcdbm=''
602 d_dirnamlen=''
603 direntrytype=''
604 i_dirent=''
605 i_dld=''
606 i_dlfcn=''
607 i_fcntl=''
608 i_float=''
609 i_gdbm=''
610 d_grpasswd=''
611 i_grp=''
612 i_iconv=''
613 i_inttypes=''
614 i_limits=''
615 i_locale=''
616 i_machcthr=''
617 i_malloc=''
618 i_math=''
619 i_memory=''
620 i_mntent=''
621 i_ndbm=''
622 i_netdb=''
623 i_neterrno=''
624 i_netinettcp=''
625 i_niin=''
626 i_sysin=''
627 i_poll=''
628 i_pthread=''
629 d_pwage=''
630 d_pwchange=''
631 d_pwclass=''
632 d_pwcomment=''
633 d_pwexpire=''
634 d_pwgecos=''
635 d_pwpasswd=''
636 d_pwquota=''
637 i_pwd=''
638 i_sfio=''
639 i_shadow=''
640 i_socks=''
641 i_stddef=''
642 i_stdlib=''
643 i_string=''
644 strings=''
645 i_sysaccess=''
646 i_sysdir=''
647 i_sysfile=''
648 d_voidtty=''
649 i_bsdioctl=''
650 i_sysfilio=''
651 i_sysioctl=''
652 i_syssockio=''
653 i_sysmman=''
654 i_sysmount=''
655 i_sysndir=''
656 i_sysparam=''
657 i_sysresrc=''
658 i_syssecrt=''
659 i_sysselct=''
660 i_sysstat=''
661 i_sysstatfs=''
662 i_sysstatvfs=''
663 i_systimes=''
664 i_systypes=''
665 i_sysuio=''
666 i_sysun=''
667 i_sysvfs=''
668 i_syswait=''
669 i_sgtty=''
670 i_termio=''
671 i_termios=''
672 i_systime=''
673 i_systimek=''
674 i_time=''
675 timeincl=''
676 i_unistd=''
677 i_ustat=''
678 i_utime=''
679 i_values=''
680 i_stdarg=''
681 i_varargs=''
682 i_varhdr=''
683 i_vfork=''
684 inc_version_list=''
685 inc_version_list_init=''
686 installprefix=''
687 installprefixexp=''
688 installstyle=''
689 installusrbinperl=''
690 intsize=''
691 longsize=''
692 shortsize=''
693 d_fpos64_t=''
694 d_off64_t=''
695 libc=''
696 ldlibpthname=''
697 libperl=''
698 shrpenv=''
699 useshrplib=''
700 glibpth=''
701 libpth=''
702 loclibpth=''
703 plibpth=''
704 xlibpth=''
705 ignore_versioned_solibs=''
706 libs=''
707 libsdirs=''
708 libsfiles=''
709 libsfound=''
710 lns=''
711 d_PRIEldbl=''
712 d_PRIFldbl=''
713 d_PRIGldbl=''
714 d_PRIeldbl=''
715 d_PRIfldbl=''
716 d_PRIgldbl=''
717 sPRIEldbl=''
718 sPRIFldbl=''
719 sPRIGldbl=''
720 sPRIeldbl=''
721 sPRIfldbl=''
722 sPRIgldbl=''
723 lseeksize=''
724 lseektype=''
725 make_set_make=''
726 d_mymalloc=''
727 freetype=''
728 mallocobj=''
729 mallocsrc=''
730 malloctype=''
731 usemymalloc=''
732 installman1dir=''
733 man1dir=''
734 man1direxp=''
735 man1ext=''
736 installman3dir=''
737 man3dir=''
738 man3direxp=''
739 man3ext=''
740 huge=''
741 large=''
742 medium=''
743 models=''
744 small=''
745 split=''
746 modetype=''
747 multiarch=''
748 mydomain=''
749 myhostname=''
750 phostname=''
751 c=''
752 n=''
753 d_eofnblk=''
754 eagain=''
755 o_nonblock=''
756 rd_nodata=''
757 netdb_hlen_type=''
758 netdb_host_type=''
759 netdb_name_type=''
760 netdb_net_type=''
761 groupcat=''
762 hostcat=''
763 passcat=''
764 orderlib=''
765 ranlib=''
766 package=''
767 spackage=''
768 pager=''
769 api_revision=''
770 api_subversion=''
771 api_version=''
772 api_versionstring=''
773 patchlevel=''
774 subversion=''
775 version=''
776 perladmin=''
777 perlpath=''
778 d_nv_preserves_uv=''
779 i16size=''
780 i16type=''
781 i32size=''
782 i32type=''
783 i64size=''
784 i64type=''
785 i8size=''
786 i8type=''
787 ivsize=''
788 ivtype=''
789 nvsize=''
790 nvtype=''
791 u16size=''
792 u16type=''
793 u32size=''
794 u32type=''
795 u64size=''
796 u64type=''
797 u8size=''
798 u8type=''
799 uvsize=''
800 uvtype=''
801 ivdformat=''
802 uvoformat=''
803 uvuformat=''
804 uvxformat=''
805 pidtype=''
806 prefix=''
807 prefixexp=''
808 installprivlib=''
809 privlib=''
810 privlibexp=''
811 prototype=''
812 ptrsize=''
813 d_PRIX64=''
814 d_PRId64=''
815 d_PRIi64=''
816 d_PRIo64=''
817 d_PRIu64=''
818 d_PRIx64=''
819 sPRIX64=''
820 sPRId64=''
821 sPRIi64=''
822 sPRIo64=''
823 sPRIu64=''
824 sPRIx64=''
825 d_quad=''
826 quadkind=''
827 quadtype=''
828 uquadtype=''
829 drand01=''
830 randbits=''
831 randfunc=''
832 randseedtype=''
833 seedfunc=''
834 installscript=''
835 scriptdir=''
836 scriptdirexp=''
837 selectminbits=''
838 selecttype=''
839 sh=''
840 sig_count=''
841 sig_name=''
842 sig_name_init=''
843 sig_num=''
844 sig_num_init=''
845 installsitearch=''
846 sitearch=''
847 sitearchexp=''
848 installsitebin=''
849 sitebin=''
850 sitebinexp=''
851 installsitelib=''
852 sitelib=''
853 sitelibexp=''
854 siteprefix=''
855 siteprefixexp=''
856 sizetype=''
857 so=''
858 sharpbang=''
859 shsharp=''
860 spitshell=''
861 src=''
862 ssizetype=''
863 startperl=''
864 startsh=''
865 stdchar=''
866 d_stdio_stream_array=''
867 stdio_stream_array=''
868 sysman=''
869 trnl=''
870 uidformat=''
871 uidsign=''
872 uidsize=''
873 uidtype=''
874 archname64=''
875 use64bits=''
876 uselargefiles=''
877 uselongdouble=''
878 uselonglong=''
879 usemorebits=''
880 usemultiplicity=''
881 nm_opt=''
882 nm_so_opt=''
883 runnm=''
884 usenm=''
885 useperlio=''
886 usesocks=''
887 d_oldpthreads=''
888 use5005threads=''
889 useithreads=''
890 usethreads=''
891 incpath=''
892 mips_type=''
893 usrinc=''
894 d_vendorbin=''
895 installvendorbin=''
896 vendorbin=''
897 vendorbinexp=''
898 d_vendorlib=''
899 installvendorlib=''
900 vendorlib=''
901 vendorlibexp=''
902 usevendorprefix=''
903 vendorprefix=''
904 vendorprefixexp=''
905 defvoidused=''
906 voidflags=''
907 pm_apiversion=''
908 xs_apiversion=''
909 CONFIG=''
910
911 define='define'
912 undef='undef'
913 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
914 rmlist=''
915
916 : We must find out about Eunice early
917 eunicefix=':'
918 if test -f /etc/unixtovms; then
919         eunicefix=/etc/unixtovms
920 fi
921 if test -f /etc/unixtovms.exe; then
922         eunicefix=/etc/unixtovms.exe
923 fi
924
925 i_whoami=''
926 : set useposix=false in your hint file to disable the POSIX extension.
927 useposix=true
928 : set useopcode=false in your hint file to disable the Opcode extension.
929 useopcode=true
930 : Trailing extension.  Override this in a hint file, if needed.
931 _exe=''
932 : Extra object files, if any, needed on this platform.
933 archobjs=''
934 : Possible local include directories to search.
935 : Set locincpth to "" in a hint file to defeat local include searches.
936 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
937 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
938 :
939 : no include file wanted by default
940 inclwanted=''
941
942 groupstype=''
943 : change the next line if compiling for Xenix/286 on Xenix/386
944 xlibpth='/usr/lib/386 /lib/386'
945
946 : Possible local library directories to search.
947 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
948 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
949
950 : general looking path for locating libraries
951 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
952 glibpth="$glibpth /lib /usr/lib $xlibpth"
953 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
954 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
955
956 : Private path used by Configure to find libraries.  Its value
957 : is prepended to libpth. This variable takes care of special
958 : machines, like the mips.  Usually, it should be empty.
959 plibpth=''
960
961 : default library list
962 libswanted=''
963 : some systems want to use only the non-versioned libso:s
964 ignore_versioned_solibs=''
965 : set usemultiplicity on the Configure command line to enable multiplicity.
966 : set usesocks on the Configure command line to enable socks.
967 : set usethreads on the Configure command line to enable threads.
968 : full support for void wanted by default
969 defvoidused=15
970
971 : List of libraries we want.
972 : If anyone needs -lnet, put it in a hint file.
973 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
974 libswanted="$libswanted dld ld sun m c cposix posix"
975 libswanted="$libswanted ndir dir crypt sec"
976 libswanted="$libswanted ucb bsd BSD PW x"
977 : We probably want to search /usr/shlib before most other libraries.
978 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
979 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
980 glibpth="/usr/shlib $glibpth"
981 : Do not use vfork unless overridden by a hint file.
982 usevfork=false
983
984 : Find the basic shell for Bourne shell scripts
985 case "$sh" in
986 '')
987         case "$SYSTYPE" in
988         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
989         *) xxx='/bin/sh';;
990         esac
991         if test -f "$xxx"; then
992                 sh="$xxx"
993         else
994                 : Build up a list and do a single loop so we can 'break' out.
995                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
996                 for xxx in sh bash ksh pdksh ash; do
997                         for p in $pth; do
998                                 try="$try ${p}/${xxx}"
999                         done
1000                 done
1001                 for xxx in $try; do
1002                         if test -f "$xxx"; then
1003                                 sh="$xxx";
1004                                 break
1005                         elif test -f "$xxx.exe"; then
1006                                 sh="$xxx";
1007                                 break
1008                         fi
1009                 done
1010         fi
1011         ;;
1012 esac
1013
1014 case "$sh" in
1015 '')     cat <<EOM >&2
1016 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1017
1018 Usually it's in /bin/sh.  How did you even get this far?
1019 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1020 we'll try to straighten this all out.
1021 EOM
1022         exit 1
1023         ;;
1024 esac
1025
1026 : see if sh knows # comments
1027 if `$sh -c '#' >/dev/null 2>&1`; then
1028         shsharp=true
1029         spitshell=cat
1030         xcat=/bin/cat
1031         test -f $xcat || xcat=/usr/bin/cat
1032         echo "#!$xcat" >try
1033         $eunicefix try
1034         chmod +x try
1035         ./try > today
1036         if test -s today; then
1037                 sharpbang='#!'
1038         else
1039                 echo "#! $xcat" > try
1040                 $eunicefix try
1041                 chmod +x try
1042                 ./try > today
1043                 if test -s today; then
1044                         sharpbang='#! '
1045                 else
1046                         sharpbang=': use '
1047                 fi
1048         fi
1049 else
1050         echo " "
1051         echo "Your $sh doesn't grok # comments--I will strip them later on."
1052         shsharp=false
1053         cd ..
1054         echo "exec grep -v '^[  ]*#'" >spitshell
1055         chmod +x spitshell
1056         $eunicefix spitshell
1057         spitshell=`pwd`/spitshell
1058         cd UU
1059         echo "I presume that if # doesn't work, #! won't work either!"
1060         sharpbang=': use '
1061 fi
1062 rm -f try today
1063
1064 : figure out how to guarantee sh startup
1065 case "$startsh" in
1066 '') startsh=${sharpbang}${sh} ;;
1067 *)
1068 esac
1069 cat >try <<EOSS
1070 $startsh
1071 set abc
1072 test "$?abc" != 1
1073 EOSS
1074
1075 chmod +x try
1076 $eunicefix try
1077 if ./try; then
1078         : echo "Yup, it does."
1079 else
1080         echo "Hmm... '$startsh' does not guarantee sh startup..."
1081         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1082 fi
1083 rm -f try
1084
1085
1086 : Save command line options in file UU/cmdline.opt for later use in
1087 : generating config.sh.
1088 cat > cmdline.opt <<EOSH
1089 # Configure command line arguments.
1090 config_arg0='$0'
1091 config_args='$*'
1092 config_argc=$#
1093 EOSH
1094 argn=1
1095 for arg in "$@"; do
1096         cat >>cmdline.opt <<EOSH
1097 config_arg$argn='$arg'
1098 EOSH
1099         argn=`expr $argn + 1`
1100 done
1101
1102 : produce awk script to parse command line options
1103 cat >options.awk <<'EOF'
1104 BEGIN {
1105         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1106
1107         len = length(optstr);
1108         for (i = 1; i <= len; i++) {
1109                 c = substr(optstr, i, 1);
1110                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1111                 if (a == ":") {
1112                         arg[c] = 1;
1113                         i++;
1114                 }
1115                 opt[c] = 1;
1116         }
1117 }
1118 {
1119         expect = 0;
1120         str = $0;
1121         if (substr(str, 1, 1) != "-") {
1122                 printf("'%s'\n", str);
1123                 next;
1124         }
1125         len = length($0);
1126         for (i = 2; i <= len; i++) {
1127                 c = substr(str, i, 1);
1128                 if (!opt[c]) {
1129                         printf("-%s\n", substr(str, i));
1130                         next;
1131                 }
1132                 printf("-%s\n", c);
1133                 if (arg[c]) {
1134                         if (i < len)
1135                                 printf("'%s'\n", substr(str, i + 1));
1136                         else
1137                                 expect = 1;
1138                         next;
1139                 }
1140         }
1141 }
1142 END {
1143         if (expect)
1144                 print "?";
1145 }
1146 EOF
1147
1148 : process the command line options
1149 set X `for arg in "$@"; do echo "X$arg"; done |
1150         sed -e s/X// | awk -f options.awk`
1151 eval "set $*"
1152 shift
1153 rm -f options.awk
1154
1155 : set up default values
1156 fastread=''
1157 reuseval=false
1158 config_sh=''
1159 alldone=''
1160 error=''
1161 silent=''
1162 extractsh=''
1163 override=''
1164 knowitall=''
1165 rm -f optdef.sh posthint.sh
1166 cat >optdef.sh <<EOS
1167 $startsh
1168 EOS
1169
1170
1171 : option parsing
1172 while test $# -gt 0; do
1173         case "$1" in
1174         -d) shift; fastread=yes;;
1175         -e) shift; alldone=cont;;
1176         -f)
1177                 shift
1178                 cd ..
1179                 if test -r "$1"; then
1180                         config_sh="$1"
1181                 else
1182                         echo "$me: cannot read config file $1." >&2
1183                         error=true
1184                 fi
1185                 cd UU
1186                 shift;;
1187         -h) shift; error=true;;
1188         -r) shift; reuseval=true;;
1189         -s) shift; silent=true; realsilent=true;;
1190         -E) shift; alldone=exit;;
1191         -K) shift; knowitall=true;;
1192         -O) shift; override=true;;
1193         -S) shift; silent=true; extractsh=true;;
1194         -D)
1195                 shift
1196                 case "$1" in
1197                 *=)
1198                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1199                         echo "$me: ignoring -D $1" >&2
1200                         ;;
1201                 *=*) echo "$1" | \
1202                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1203                 *) echo "$1='define'" >> optdef.sh;;
1204                 esac
1205                 shift
1206                 ;;
1207         -U)
1208                 shift
1209                 case "$1" in
1210                 *=) echo "$1" >> optdef.sh;;
1211                 *=*)
1212                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1213                         echo "$me: ignoring -U $1" >&2
1214                         ;;
1215                 *) echo "$1='undef'" >> optdef.sh;;
1216                 esac
1217                 shift
1218                 ;;
1219         -A)
1220             shift
1221             xxx=''
1222             yyy="$1"
1223             zzz=''
1224             uuu=undef
1225             case "$yyy" in
1226             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1227                  case "$zzz" in
1228                  *:*) zzz='' ;;
1229                  *)   xxx=append
1230                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1231                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1232                  esac
1233                  ;;
1234             esac
1235             case "$xxx" in
1236             '')  case "$yyy" in
1237                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1238                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1239                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1240                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1241                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1242                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1243                  esac
1244                  ;;       
1245             esac
1246             case "$xxx" in
1247             append)
1248                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1249             clear)
1250                 echo "$yyy=''"                  >> posthint.sh ;;
1251             define)
1252                 case "$zzz" in
1253                 '') zzz=define ;;
1254                 esac
1255                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1256             eval)
1257                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1258             prepend)
1259                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1260             undef)
1261                 case "$zzz" in
1262                 '') zzz="$uuu" ;;
1263                 esac
1264                 echo "$yyy=$zzz"                >> posthint.sh ;;
1265             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1266             esac
1267             ;;
1268         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1269             exit 0;;
1270         --) break;;
1271         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1272         *) break;;
1273         esac
1274 done
1275
1276 case "$error" in
1277 true)
1278         cat >&2 <<EOM
1279 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1280                  [-U symbol] [-U symbol=] [-A command:symbol...]
1281   -d : use defaults for all answers.
1282   -e : go on without questioning past the production of config.sh.
1283   -f : specify an alternate default configuration file.
1284   -h : print this help message and exit (with an error status).
1285   -r : reuse C symbols value if possible (skips costly nm extraction).
1286   -s : silent mode, only echoes questions and essential information.
1287   -D : define symbol to have some value:
1288          -D symbol         symbol gets the value 'define'
1289          -D symbol=value   symbol gets the value 'value'
1290   -E : stop at the end of questions, after having produced config.sh.
1291   -K : do not use unless you know what you are doing.
1292   -O : let -D and -U override definitions from loaded configuration file.
1293   -S : perform variable substitutions on all .SH files (can mix with -f)
1294   -U : undefine symbol:
1295          -U symbol    symbol gets the value 'undef'
1296          -U symbol=   symbol gets completely empty
1297   -A : manipulate symbol after the platform specific hints have been applied:
1298          -A symbol=value                append " "value to symbol
1299          -A append:symbol=value         append value to symbol
1300          -A define:symbol=value         define symbol to have value
1301          -A clear:symbol                define symbol to be ''
1302          -A define:symbol               define symbol to be 'define'
1303          -A eval:symbol=value           define symbol to be eval of value
1304          -A prepend:symbol=value        prepend value to symbol
1305          -A undef:symbol                define symbol to be 'undef'
1306          -A undef:symbol=               define symbol to be ''
1307   -V : print version number and exit (with a zero status).
1308 EOM
1309         exit 1
1310         ;;
1311 esac
1312
1313 : Sanity checks
1314 case "$fastread$alldone" in
1315 yescont|yesexit) ;;
1316 *)
1317         if test ! -t 0; then
1318                 echo "Say 'sh Configure', not 'sh <Configure'"
1319                 exit 1
1320         fi
1321         ;;
1322 esac
1323
1324 exec 4>&1
1325 case "$silent" in
1326 true) exec 1>/dev/null;;
1327 esac
1328
1329 : run the defines and the undefines, if any, but leave the file out there...
1330 touch optdef.sh
1331 . ./optdef.sh
1332 : create the posthint manipulation script and leave the file out there...
1333 touch posthint.sh
1334
1335 : set package name
1336 package=perl5
1337 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1338 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1339 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1340 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1341 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1342 esac
1343
1344 : Some greps do not return status, grrr.
1345 echo "grimblepritz" >grimble
1346 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1347         contains=contains
1348 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1349         contains=grep
1350 else
1351         contains=contains
1352 fi
1353 rm -f grimble
1354 : the following should work in any shell
1355 case "$contains" in
1356 contains*)
1357         echo " "
1358         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1359         cat >contains <<'EOSS'
1360 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1361 EOSS
1362 chmod +x contains
1363 esac
1364
1365 : Find the path to the source tree
1366 case "$src" in
1367 '') case "$0" in
1368     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1369          case "$src" in
1370          /*)    ;;
1371          *)     src=`cd ../$src && pwd` ;;
1372          esac
1373          ;;
1374     *)   src='.';;
1375     esac;;
1376 esac
1377 case "$src" in
1378 '')     src=/
1379         rsrc=/
1380         ;;
1381 /*) rsrc="$src";;
1382 *) rsrc="../$src";;
1383 esac
1384 if test -f $rsrc/Configure && \
1385         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1386 then
1387    : found it, so we are ok.
1388 else
1389         rsrc=''
1390         for src in . .. ../.. ../../.. ../../../..; do
1391                 if test -f ../$src/Configure && \
1392                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1393                 then
1394                         rsrc=../$src
1395                         break
1396                 fi
1397         done
1398 fi
1399 case "$rsrc" in
1400 '')
1401         cat <<EOM >&4
1402
1403 Sorry, I can't seem to locate the source dir for $package.  Please start
1404 Configure with an explicit path -- i.e. /some/path/Configure.
1405
1406 EOM
1407         exit 1
1408         ;;
1409 ../.)   rsrc='..';;
1410 *)
1411         echo " "
1412         echo "Sources for $package found in \"$src\"." >&4
1413         ;;
1414 esac
1415
1416 : script used to extract .SH files with variable substitutions
1417 cat >extract <<'EOS'
1418 CONFIGDOTSH=true
1419 echo "Doing variable substitutions on .SH files..."
1420 if test -f $src/MANIFEST; then
1421         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1422 else
1423         echo "(Looking for .SH files under the source directory.)"
1424         set x `(cd $src; find . -name "*.SH" -print)`
1425 fi
1426 shift
1427 case $# in
1428 0) set x `(cd $src; echo *.SH)`; shift;;
1429 esac
1430 if test ! -f $src/$1; then
1431         shift
1432 fi
1433 mkdir_p='
1434 name=$1;
1435 create="";
1436 while test $name; do
1437         if test ! -d "$name"; then
1438                 create="$name $create";
1439                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1440                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1441         else
1442                 name="";
1443         fi;
1444 done;
1445 for file in $create; do
1446         mkdir $file;
1447 done
1448 '
1449 for file in $*; do
1450         case "$src" in
1451         ".")
1452                 case "$file" in
1453                 */*)
1454                         dir=`expr X$file : 'X\(.*\)/'`
1455                         file=`expr X$file : 'X.*/\(.*\)'`
1456                         (cd $dir && . ./$file)
1457                         ;;
1458                 *)
1459                         . ./$file
1460                         ;;
1461                 esac
1462                 ;;
1463         *)
1464                 case "$file" in
1465                 */*)
1466                         dir=`expr X$file : 'X\(.*\)/'`
1467                         file=`expr X$file : 'X.*/\(.*\)'`
1468                         (set x $dir; shift; eval $mkdir_p)
1469                         sh <$src/$dir/$file
1470                         ;;
1471                 *)
1472                         sh <$src/$file
1473                         ;;
1474                 esac
1475                 ;;
1476         esac
1477 done
1478 if test -f $src/config_h.SH; then
1479         if test ! -f config.h; then
1480         : oops, they left it out of MANIFEST, probably, so do it anyway.
1481         . $src/config_h.SH
1482         fi
1483 fi
1484 EOS
1485
1486 : extract files and exit if asked to do so
1487 case "$extractsh" in
1488 true)
1489         case "$realsilent" in
1490         true) ;;
1491         *) exec 1>&4;;
1492         esac
1493         case "$config_sh" in
1494         '') config_sh='config.sh';;
1495         esac
1496         echo " "
1497         echo "Fetching answers from $config_sh..."
1498         cd ..
1499         . $config_sh
1500         test "$override" && . ./optdef.sh
1501         echo " "
1502         . UU/extract
1503         rm -rf UU
1504         echo "Done."
1505         exit 0
1506         ;;
1507 esac
1508
1509 : Eunice requires " " instead of "", can you believe it
1510 echo " "
1511 : Here we go...
1512 echo "Beginning of configuration questions for $package."
1513
1514 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1515
1516 : first determine how to suppress newline on echo command
1517 echo " "
1518 echo "Checking echo to see how to suppress newlines..."
1519 (echo "hi there\c" ; echo " ") >.echotmp
1520 if $contains c .echotmp >/dev/null 2>&1 ; then
1521         echo "...using -n."
1522         n='-n'
1523         c=''
1524 else
1525         cat <<'EOM'
1526 ...using \c
1527 EOM
1528         n=''
1529         c='\c'
1530 fi
1531 echo $n "The star should be here-->$c"
1532 echo '*'
1533 rm -f .echotmp
1534
1535 : Now test for existence of everything in MANIFEST
1536 echo " "
1537 if test -f $rsrc/MANIFEST; then
1538         echo "First let's make sure your kit is complete.  Checking..." >&4
1539         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1540         rm -f missing
1541         tmppwd=`pwd`
1542         for filelist in x??; do
1543                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1544         done
1545         if test -s missing; then
1546                 cat missing >&4
1547                 cat >&4 <<'EOM'
1548
1549 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1550
1551 You have the option of continuing the configuration process, despite the
1552 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1553 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1554 and contact the author (perlbug@perl.com).
1555
1556 EOM
1557                 echo $n "Continue? [n] $c" >&4
1558                 read ans
1559                 case "$ans" in
1560                 y*)
1561                         echo "Continuing..." >&4
1562                         rm -f missing
1563                         ;;
1564                 *)
1565                         echo "ABORTING..." >&4
1566                         kill $$
1567                         ;;
1568                 esac
1569         else
1570                 echo "Looks good..."
1571         fi
1572 else
1573         echo "There is no MANIFEST file.  I hope your kit is complete !"
1574 fi
1575 rm -f missing x??
1576
1577 echo " "
1578 : Find the appropriate value for a newline for tr
1579 if test -n "$DJGPP"; then
1580        trnl='\012'
1581 fi
1582 if test X"$trnl" = X; then
1583         case "`echo foo|tr '\n' x 2>/dev/null`" in
1584         foox) trnl='\n' ;;
1585         esac
1586 fi
1587 if test X"$trnl" = X; then
1588         case "`echo foo|tr '\012' x 2>/dev/null`" in
1589         foox) trnl='\012' ;;
1590         esac
1591 fi
1592 if test X"$trnl" = X; then
1593         cat <<EOM >&2
1594
1595 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1596
1597 EOM
1598         exit 1
1599 fi
1600
1601 : compute the number of columns on the terminal for proper question formatting
1602 case "$COLUMNS" in
1603 '') COLUMNS='80';;
1604 esac
1605
1606 : set up the echo used in my read
1607 myecho="case \"\$xxxm\" in
1608 '') echo $n \"\$rp $c\" >&4;;
1609 *) case \"\$rp\" in
1610         '') echo $n \"[\$xxxm] $c\";;
1611         *)
1612                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1613                         echo \"\$rp\" >&4
1614                         echo $n \"[\$xxxm] $c\" >&4
1615                 else
1616                         echo $n \"\$rp [\$xxxm] $c\" >&4
1617                 fi
1618                 ;;
1619         esac;;
1620 esac"
1621
1622 : now set up to do reads with possible shell escape and default assignment
1623 cat <<EOSC >myread
1624 $startsh
1625 xxxm=\$dflt
1626 $myecho
1627 ans='!'
1628 case "\$fastread" in
1629 yes) case "\$dflt" in
1630         '') ;;
1631         *) ans='';
1632                 case "\$silent-\$rp" in
1633                 true-) ;;
1634                 *) echo " " >&4;;
1635                 esac;;
1636         esac;;
1637 *) case "\$silent" in
1638         true) case "\$rp" in
1639                 '') ans='';;
1640                 esac;;
1641         esac;;
1642 esac
1643 while expr "X\$ans" : "X!" >/dev/null; do
1644         read answ
1645         set x \$xxxm
1646         shift
1647         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1648         case  "\$answ" in
1649         "!")
1650                 sh 1>&4
1651                 echo " "
1652                 $myecho
1653                 ;;
1654         !*)
1655                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1656                 shift
1657                 sh 1>&4 -c "\$*"
1658                 echo " "
1659                 $myecho
1660                 ;;
1661         "\$ans")
1662                 case "\$ans" in
1663                 \\&*)
1664                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1665                         shift
1666                         case "\$1" in
1667                         -d)
1668                                 fastread=yes
1669                                 echo "(OK, I'll run with -d after this question.)" >&4
1670                                 ;;
1671                         -*)
1672                                 echo "*** Sorry, \$1 not supported yet." >&4
1673                                 ;;
1674                         esac
1675                         $myecho
1676                         ans=!
1677                         ;;
1678                 esac;;
1679         *)
1680                 case "\$aok" in
1681                 y)
1682                         echo "*** Substitution done -- please confirm."
1683                         xxxm="\$ans"
1684                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1685                         xxxm="\$ans"
1686                         ans=!
1687                         ;;
1688                 *)
1689                         echo "*** Error -- try again."
1690                         ans=!
1691                         ;;
1692                 esac
1693                 $myecho
1694                 ;;
1695         esac
1696         case "\$ans\$xxxm\$nostick" in
1697         '')
1698                 ans=!
1699                 $myecho
1700                 ;;
1701         esac
1702 done
1703 case "\$ans" in
1704 '') ans="\$xxxm";;
1705 esac
1706 EOSC
1707
1708 : create .config dir to save info across Configure sessions
1709 test -d ../.config || mkdir ../.config
1710 cat >../.config/README <<EOF
1711 This directory created by Configure to save information that should
1712 persist across sessions for $package.
1713
1714 You may safely delete it if you wish.
1715 EOF
1716
1717 : general instructions
1718 needman=true
1719 firsttime=true
1720 user=`(logname) 2>/dev/null`
1721 case "$user" in
1722 '') user=`whoami 2>&1`;;
1723 esac
1724 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1725         firsttime=false
1726         echo " "
1727         rp='Would you like to see the instructions?'
1728         dflt=n
1729         . ./myread
1730         case "$ans" in
1731         [yY]*) ;;
1732         *) needman=false;;
1733         esac
1734 fi
1735 if $needman; then
1736         cat <<EOH
1737
1738 This installation shell script will examine your system and ask you questions
1739 to determine how the perl5 package should be installed. If you get
1740 stuck on a question, you may use a ! shell escape to start a subshell or
1741 execute a command.  Many of the questions will have default answers in square
1742 brackets; typing carriage return will give you the default.
1743
1744 On some of the questions which ask for file or directory names you are allowed
1745 to use the ~name construct to specify the login directory belonging to "name",
1746 even if you don't have a shell which knows about that.  Questions where this is
1747 allowed will be marked "(~name ok)".
1748
1749 EOH
1750         rp=''
1751         dflt='Type carriage return to continue'
1752         . ./myread
1753         cat <<'EOH'
1754
1755 The prompter used in this script allows you to use shell variables and
1756 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1757 in the default answer, as if the default line was a set of arguments given to a
1758 script shell.  This means you may also use $* to repeat the whole default line,
1759 so you do not have to re-type everything to add something to the default.
1760
1761 Everytime there is a substitution, you will have to confirm.  If there is an
1762 error (e.g. an unmatched backtick), the default answer will remain unchanged
1763 and you will be prompted again.
1764
1765 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1766 the questions and use the computed defaults (or the previous answers if there
1767 was already a config.sh file). Type 'Configure -h' for a list of options.
1768 You may also start interactively and then answer '& -d' at any prompt to turn
1769 on the non-interactive behaviour for the remainder of the execution.
1770
1771 EOH
1772         . ./myread
1773         cat <<EOH
1774
1775 Much effort has been expended to ensure that this shell script will run on any
1776 Unix system.  If despite that it blows up on yours, your best bet is to edit
1777 Configure and run it again.  If you can't run Configure for some reason,
1778 you'll have to generate a config.sh file by hand.  Whatever problems you
1779 have, let me (perlbug@perl.com) know how I blew it.
1780
1781 This installation script affects things in two ways:
1782
1783 1) it may do direct variable substitutions on some of the files included
1784    in this kit.
1785 2) it builds a config.h file for inclusion in C programs.  You may edit
1786    any of these files as the need arises after running this script.
1787
1788 If you make a mistake on a question, there is no easy way to back up to it
1789 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1790 files.  Configure will offer to let you do this before it runs the SH files.
1791
1792 EOH
1793         dflt='Type carriage return to continue'
1794         . ./myread
1795         case "$firsttime" in
1796         true) echo $user >>../.config/instruct;;
1797         esac
1798 fi
1799
1800 : find out where common programs are
1801 echo " "
1802 echo "Locating common programs..." >&4
1803 cat <<EOSC >loc
1804 $startsh
1805 case \$# in
1806 0) exit 1;;
1807 esac
1808 thing=\$1
1809 shift
1810 dflt=\$1
1811 shift
1812 for dir in \$*; do
1813         case "\$thing" in
1814         .)
1815         if test -d \$dir/\$thing; then
1816                 echo \$dir
1817                 exit 0
1818         fi
1819         ;;
1820         *)
1821         for thisthing in \$dir/\$thing; do
1822                 : just loop through to pick last item
1823         done
1824         if test -f \$thisthing; then
1825                 echo \$thisthing
1826                 exit 0
1827         elif test -f \$dir/\$thing.exe; then
1828                 if test -n "$DJGPP"; then
1829                         echo \$dir/\$thing.exe
1830                 else
1831                         : on Eunice apparently
1832                         echo \$dir/\$thing
1833                 fi
1834                 exit 0
1835         fi
1836         ;;
1837         esac
1838 done
1839 echo \$dflt
1840 exit 1
1841 EOSC
1842 chmod +x loc
1843 $eunicefix loc
1844 loclist="
1845 awk
1846 cat
1847 comm
1848 cp
1849 echo
1850 expr
1851 grep
1852 ls
1853 make
1854 mkdir
1855 rm
1856 sed
1857 sort
1858 touch
1859 tr
1860 uniq
1861 "
1862 trylist="
1863 Mcc
1864 ar
1865 byacc
1866 cpp
1867 csh
1868 date
1869 egrep
1870 gzip
1871 less
1872 ln
1873 more
1874 nm
1875 nroff
1876 perl
1877 pg
1878 test
1879 uname
1880 zip
1881 "
1882 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1883 pth="$pth /lib /usr/lib"
1884 for file in $loclist; do
1885         eval xxx=\$$file
1886         case "$xxx" in
1887         /*|?:[\\/]*)
1888                 if test -f "$xxx"; then
1889                         : ok
1890                 else
1891                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1892                         xxx=`./loc $file $file $pth`
1893                 fi
1894                 ;;
1895         '') xxx=`./loc $file $file $pth`;;
1896         *) xxx=`./loc $xxx $xxx $pth`;;
1897         esac
1898         eval $file=$xxx
1899         eval _$file=$xxx
1900         case "$xxx" in
1901         /*)
1902                 echo $file is in $xxx.
1903                 ;;
1904         ?:[\\/]*)
1905                 echo $file is in $xxx.
1906                 ;;
1907         *)
1908                 echo "I don't know where '$file' is, and my life depends on it." >&4
1909                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1910                 exit 1
1911                 ;;
1912         esac
1913 done
1914 echo " "
1915 echo "Don't worry if any of the following aren't found..."
1916 say=offhand
1917 for file in $trylist; do
1918         eval xxx=\$$file
1919         case "$xxx" in
1920         /*|?:[\\/]*)
1921                 if test -f "$xxx"; then
1922                         : ok
1923                 else
1924                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1925                         xxx=`./loc $file $file $pth`
1926                 fi
1927                 ;;
1928         '') xxx=`./loc $file $file $pth`;;
1929         *) xxx=`./loc $xxx $xxx $pth`;;
1930         esac
1931         eval $file=$xxx
1932         eval _$file=$xxx
1933         case "$xxx" in
1934         /*)
1935                 echo $file is in $xxx.
1936                 ;;
1937         ?:[\\/]*)
1938                 echo $file is in $xxx.
1939                 ;;
1940         *)
1941                 echo "I don't see $file out there, $say."
1942                 say=either
1943                 ;;
1944         esac
1945 done
1946 case "$egrep" in
1947 egrep)
1948         echo "Substituting grep for egrep."
1949         egrep=$grep
1950         ;;
1951 esac
1952 case "$ln" in
1953 ln)
1954         echo "Substituting cp for ln."
1955         ln=$cp
1956         ;;
1957 esac
1958 case "$test" in
1959 test)
1960         echo "Hopefully test is built into your sh."
1961         ;;
1962 *)
1963         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1964                 echo "Using the test built into your sh."
1965                 test=test
1966                 _test=test
1967         fi
1968         ;;
1969 esac
1970 case "$echo" in
1971 echo)
1972         echo "Hopefully echo is built into your sh."
1973         ;;
1974 '') ;;
1975 *)
1976         echo " "
1977 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1978         $echo $n "hi there$c" >foo1
1979         echo $n "hi there$c" >foo2
1980         if cmp foo1 foo2 >/dev/null 2>&1; then
1981                 echo "They are compatible.  In fact, they may be identical."
1982         else
1983                 case "$n" in
1984                 '-n') n='' c='\c';;
1985                 *) n='-n' c='';;
1986                 esac
1987                 cat <<FOO
1988 They are not compatible!  You are probably running ksh on a non-USG system.
1989 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1990 have echo built in and we may have to run some Bourne shell scripts.  That
1991 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1992
1993 FOO
1994                 $echo $n "The star should be here-->$c"
1995                 $echo "*"
1996         fi
1997         $rm -f foo1 foo2
1998         ;;
1999 esac
2000
2001 : determine whether symbolic links are supported
2002 echo " "
2003 $touch blurfl
2004 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2005         echo "Symbolic links are supported." >&4
2006         lns="$ln -s"
2007 else
2008         echo "Symbolic links are NOT supported." >&4
2009         lns="$ln"
2010 fi
2011 $rm -f blurfl sym
2012
2013 : see whether [:lower:] and [:upper:] are supported character classes
2014 echo " "
2015 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2016 ABYZ)
2017         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2018         up='[:upper:]'
2019         low='[:lower:]'
2020         ;;
2021 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2022         # (0xc9 and 0xd1), therefore that is a nice testing point.
2023         if test "X$up" = X -o "X$low" = X; then
2024             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2025             ij) up='[A-Z]'
2026                 low='[a-z]'
2027                 ;;
2028             esac
2029         fi
2030         if test "X$up" = X -o "X$low" = X; then
2031             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2032             ij) up='A-Z'
2033                 low='a-z'
2034                 ;;
2035             esac
2036         fi
2037         if test "X$up" = X -o "X$low" = X; then
2038             case "`echo IJ | od -x 2>/dev/null`" in
2039             *C9D1*|*c9d1*)
2040                 echo "Hey, this might be EBCDIC." >&4
2041                 if test "X$up" = X -o "X$low" = X; then
2042                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2043                     ij) up='[A-IJ-RS-Z]'
2044                         low='[a-ij-rs-z]'
2045                         ;;
2046                     esac
2047                 fi
2048                 if test "X$up" = X -o "X$low" = X; then
2049                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2050                     ij) up='A-IJ-RS-Z'
2051                         low='a-ij-rs-z'
2052                         ;;
2053                     esac
2054                 fi
2055                 ;;
2056             esac
2057         fi
2058 esac
2059 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2060 ij)
2061     echo "Using $up and $low to convert case." >&4
2062     ;;
2063 *)
2064     echo "I don't know how to translate letters from upper to lower case." >&4
2065     echo "Your tr is not acting any way I know of." >&4
2066     exit 1
2067     ;;
2068 esac
2069 : set up the translation script tr, must be called with ./tr of course
2070 cat >tr <<EOSC
2071 $startsh
2072 case "\$1\$2" in
2073 '[A-Z][a-z]') exec $tr '$up' '$low';;
2074 '[a-z][A-Z]') exec $tr '$low' '$up';;
2075 esac
2076 exec $tr "\$@"
2077 EOSC
2078 chmod +x tr
2079 $eunicefix tr
2080
2081 : Try to determine whether config.sh was made on this system
2082 case "$config_sh" in
2083 '')
2084 myuname=`$uname -a 2>/dev/null`
2085 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2086 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2087 # because the A-Z/a-z are not consecutive.
2088 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2089         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2090 newmyuname="$myuname"
2091 dflt=n
2092 case "$knowitall" in
2093 '')
2094         if test -f ../config.sh; then
2095                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2096                         eval "`grep myuname= ../config.sh`"
2097                 fi
2098                 if test "X$myuname" = "X$newmyuname"; then
2099                         dflt=y
2100                 fi
2101         fi
2102         ;;
2103 *) dflt=y;;
2104 esac
2105
2106 : Get old answers from old config file if Configure was run on the
2107 : same system, otherwise use the hints.
2108 hint=default
2109 cd ..
2110 if test -f config.sh; then
2111         echo " "
2112         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2113         . UU/myread
2114         case "$ans" in
2115         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2116         *)  echo "Fetching default answers from your old config.sh file..." >&4
2117                 tmp_n="$n"
2118                 tmp_c="$c"
2119                 tmp_sh="$sh"
2120                 . ./config.sh
2121                 cp config.sh UU
2122                 n="$tmp_n"
2123                 c="$tmp_c"
2124                 : Older versions did not always set $sh.  Catch re-use of such
2125                 : an old config.sh.
2126                 case "$sh" in
2127                 '') sh="$tmp_sh" ;;
2128                 esac
2129                 hint=previous
2130                 ;;
2131         esac
2132 fi
2133 if test ! -f config.sh; then
2134         $cat <<EOM
2135
2136 First time through, eh?  I have some defaults handy for some systems
2137 that need some extra help getting the Configure answers right:
2138
2139 EOM
2140         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2141         dflt=''
2142         : Half the following guesses are probably wrong... If you have better
2143         : tests or hints, please send them to perlbug@perl.com
2144         : The metaconfig authors would also appreciate a copy...
2145         $test -f /irix && osname=irix
2146         $test -f /xenix && osname=sco_xenix
2147         $test -f /dynix && osname=dynix
2148         $test -f /dnix && osname=dnix
2149         $test -f /lynx.os && osname=lynxos
2150         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2151         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2152         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2153         $test -f /bin/mips && /bin/mips && osname=mips
2154         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2155                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2156         $test -d /usr/apollo/bin && osname=apollo
2157         $test -f /etc/saf/_sactab && osname=svr4
2158         $test -d /usr/include/minix && osname=minix
2159         if $test -d /MachTen -o -d /MachTen_Folder; then
2160                 osname=machten
2161                 if $test -x /sbin/version; then
2162                         osvers=`/sbin/version | $awk '{print $2}' |
2163                         $sed -e 's/[A-Za-z]$//'`
2164                 elif $test -x /usr/etc/version; then
2165                         osvers=`/usr/etc/version | $awk '{print $2}' |
2166                         $sed -e 's/[A-Za-z]$//'`
2167                 else
2168                         osvers="$2.$3"
2169                 fi
2170         fi
2171
2172         $test -f /sys/posix.dll &&
2173                 $test -f /usr/bin/what &&
2174                 set X `/usr/bin/what /sys/posix.dll` &&
2175                 $test "$3" = UWIN &&
2176                 osname=uwin &&
2177                 osvers="$5"
2178
2179         if $test -f $uname; then
2180                 set X $myuname
2181                 shift
2182
2183                 case "$5" in
2184                 fps*) osname=fps ;;
2185                 mips*)
2186                         case "$4" in
2187                         umips) osname=umips ;;
2188                         *) osname=mips ;;
2189                         esac;;
2190                 [23]100) osname=mips ;;
2191                 next*) osname=next ;;
2192                 i386*)
2193                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2194                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2195                                 osname='sco'
2196                                 osvers=$tmp
2197                         elif $test -f /etc/kconfig; then
2198                                 osname=isc
2199                                 if test "$lns" = "$ln -s"; then
2200                                         osvers=4
2201                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2202                                         osvers=3
2203                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2204                                         osvers=2
2205                                 fi
2206                         fi
2207                         tmp=''
2208                         ;;
2209                 pc*)
2210                         if test -n "$DJGPP"; then
2211                                 osname=dos
2212                                 osvers=djgpp
2213                         fi
2214                         ;;
2215                 esac
2216
2217                 case "$1" in
2218                 aix) osname=aix
2219                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2220                         case "$tmp" in
2221                         'not found') osvers="$4"."$3" ;;
2222                         '<3240'|'<>3240') osvers=3.2.0 ;;
2223                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2224                         '=3250'|'>3250') osvers=3.2.5 ;;
2225                         *) osvers=$tmp;;
2226                         esac
2227                         ;;
2228                 bsd386) osname=bsd386
2229                         osvers=`$uname -r`
2230                         ;;
2231                 cygwin*) osname=cygwin
2232                         osvers="$3"
2233                         ;;
2234                 *dc.osx) osname=dcosx
2235                         osvers="$3"
2236                         ;;
2237                 dnix) osname=dnix
2238                         osvers="$3"
2239                         ;;
2240                 domainos) osname=apollo
2241                         osvers="$3"
2242                         ;;
2243                 dgux) osname=dgux 
2244                         osvers="$3"
2245                         ;;
2246                 dynixptx*) osname=dynixptx
2247                         osvers=`echo "$4"|sed 's/^v//'`
2248                         ;;
2249                 freebsd) osname=freebsd 
2250                         osvers="$3" ;;
2251                 genix) osname=genix ;;
2252                 hp*) osname=hpux 
2253                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2254                         ;;
2255                 irix*) osname=irix
2256                         case "$3" in
2257                         4*) osvers=4 ;;
2258                         5*) osvers=5 ;;
2259                         *)      osvers="$3" ;;
2260                         esac
2261                         ;;
2262                 linux) osname=linux
2263                         case "$3" in
2264                         *)      osvers="$3" ;;
2265                         esac
2266                         ;;
2267                 MiNT) osname=mint
2268                         ;;
2269                 netbsd*) osname=netbsd
2270                         osvers="$3"
2271                         ;;
2272                 news-os) osvers="$3"
2273                         case "$3" in
2274                         4*) osname=newsos4 ;;
2275                         *) osname=newsos ;;
2276                         esac
2277                         ;;
2278                 next*) osname=next ;;
2279                 POSIX-BC | posix-bc ) osname=posix-bc
2280                         osvers="$3"
2281                         ;;
2282                 powerux | power_ux | powermax_os | powermaxos | \
2283                 powerunix | power_unix) osname=powerux
2284                         osvers="$3"
2285                         ;;
2286                 qnx) osname=qnx
2287                         osvers="$4"
2288                         ;;
2289                 solaris) osname=solaris
2290                         case "$3" in
2291                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2292                         *)      osvers="$3" ;;
2293                         esac
2294                         ;;
2295                 sunos) osname=sunos
2296                         case "$3" in
2297                         5*) osname=solaris
2298                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2299                         *)      osvers="$3" ;;
2300                         esac
2301                         ;;
2302                 titanos) osname=titanos
2303                         case "$3" in
2304                         1*) osvers=1 ;;
2305                         2*) osvers=2 ;;
2306                         3*) osvers=3 ;;
2307                         4*) osvers=4 ;;
2308                         *)      osvers="$3" ;;
2309                         esac
2310                         ;;
2311                 ultrix) osname=ultrix
2312                         osvers="$3"
2313                         ;;
2314                 osf1|mls+)      case "$5" in
2315                                 alpha)
2316                                         osname=dec_osf
2317                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2318                                         ;;
2319                         hp*)    osname=hp_osf1  ;;
2320                         mips)   osname=mips_osf1 ;;
2321                         esac
2322                         ;;
2323                 unixware) osname=svr5
2324                         osvers="$4"
2325                         ;;
2326                 uts) osname=uts
2327                         osvers="$3"
2328                         ;;
2329                 $2) case "$osname" in
2330                         *isc*) ;;
2331                         *freebsd*) ;;
2332                         svr*)
2333                                 : svr4.x or possibly later
2334                                 case "svr$3" in 
2335                                 ${osname}*)
2336                                         osname=svr$3
2337                                         osvers=$4
2338                                         ;;
2339                                 esac
2340                                 case "$osname" in
2341                                 svr4.0)
2342                                         : Check for ESIX
2343                                         if test -f /stand/boot ; then
2344                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2345                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2346                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2347                                                         if test -n "$isesix"; then
2348                                                                 osname=esix4
2349                                                         fi
2350                                                 fi
2351                                         fi
2352                                         ;;
2353                                 esac
2354                                 ;;
2355                         *)      if test -f /etc/systemid; then
2356                                         osname=sco
2357                                         set `echo $3 | $sed 's/\./ /g'` $4
2358                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2359                                                 osvers=$1.$2.$3
2360                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2361                                                 osvers=$1.$2
2362                                         elif $test -f $src/hints/sco_$1.sh; then
2363                                                 osvers=$1
2364                                         fi
2365                                 else
2366                                         case "$osname" in
2367                                         '') : Still unknown.  Probably a generic Sys V.
2368                                                 osname="sysv"
2369                                                 osvers="$3"
2370                                                 ;;
2371                                         esac
2372                                 fi
2373                                 ;;
2374                         esac
2375                         ;;
2376                 *)      case "$osname" in
2377                         '') : Still unknown.  Probably a generic BSD.
2378                                 osname="$1"
2379                                 osvers="$3"
2380                                 ;;
2381                         esac
2382                         ;;
2383                 esac
2384         else
2385                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2386                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2387                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2388                                 osname=news_os
2389                         fi
2390                         $rm -f UU/kernel.what
2391                 elif test -d c:/.; then
2392                         set X $myuname
2393                         osname=os2
2394                         osvers="$5"
2395                 fi
2396         fi
2397         
2398         : Now look for a hint file osname_osvers, unless one has been
2399         : specified already.
2400         case "$hintfile" in
2401         ''|' ')
2402                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2403                 : Also try without trailing minor version numbers.
2404                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2405                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2406                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2407                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2408                 case "$file" in
2409                 '') dflt=none ;;
2410                 *)  case "$osvers" in
2411                         '') dflt=$file
2412                                 ;;
2413                         *)  if $test -f $src/hints/$file.sh ; then
2414                                         dflt=$file
2415                                 elif $test -f $src/hints/$xfile.sh ; then
2416                                         dflt=$xfile
2417                                 elif $test -f $src/hints/$xxfile.sh ; then
2418                                         dflt=$xxfile
2419                                 elif $test -f $src/hints/$xxxfile.sh ; then
2420                                         dflt=$xxxfile
2421                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2422                                         dflt=$xxxxfile
2423                                 elif $test -f "$src/hints/${osname}.sh" ; then
2424                                         dflt="${osname}"
2425                                 else
2426                                         dflt=none
2427                                 fi
2428                                 ;;
2429                         esac
2430                         ;;
2431                 esac
2432                 if $test -f Policy.sh ; then
2433                         case "$dflt" in
2434                         *Policy*) ;;
2435                         none) dflt="Policy" ;;
2436                         *) dflt="Policy $dflt" ;;
2437                         esac
2438                 fi
2439                 ;;
2440         *)
2441                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2442                 ;;
2443         esac
2444
2445         if $test -f Policy.sh ; then
2446                 $cat <<EOM
2447
2448 There's also a Policy hint file available, which should make the
2449 site-specific (policy) questions easier to answer.
2450 EOM
2451
2452         fi
2453
2454         $cat <<EOM
2455
2456 You may give one or more space-separated answers, or "none" if appropriate.
2457 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2458 is a good thing.  DO NOT give a wrong version or a wrong OS.
2459
2460 EOM
2461
2462         rp="Which of these apply, if any?"
2463         . UU/myread
2464         tans=$ans
2465         for file in $tans; do
2466                 if $test X$file = XPolicy -a -f Policy.sh; then
2467                         . Policy.sh
2468                         $cat Policy.sh >> UU/config.sh
2469                 elif $test -f $src/hints/$file.sh; then
2470                         . $src/hints/$file.sh
2471                         $cat $src/hints/$file.sh >> UU/config.sh
2472                 elif $test X$tans = X -o X$tans = Xnone ; then
2473                         : nothing
2474                 else
2475                         : Give one chance to correct a possible typo.
2476                         echo "$file.sh does not exist"
2477                         dflt=$file
2478                         rp="hint to use instead?"
2479                         . UU/myread
2480                         for file in $ans; do
2481                                 if $test -f "$src/hints/$file.sh"; then
2482                                         . $src/hints/$file.sh
2483                                         $cat $src/hints/$file.sh >> UU/config.sh
2484                                 elif $test X$ans = X -o X$ans = Xnone ; then
2485                                         : nothing
2486                                 else
2487                                         echo "$file.sh does not exist -- ignored."
2488                                 fi
2489                         done
2490                 fi
2491         done
2492
2493         hint=recommended
2494         : Remember our hint file for later.
2495         if $test -f "$src/hints/$file.sh" ; then
2496                 hintfile="$file"
2497         else
2498                 hintfile=''
2499         fi
2500 fi
2501 cd UU
2502 ;;
2503 *)
2504         echo " "
2505         echo "Fetching default answers from $config_sh..." >&4
2506         tmp_n="$n"
2507         tmp_c="$c"
2508         cd ..
2509         cp $config_sh config.sh 2>/dev/null
2510         chmod +w config.sh
2511         . ./config.sh
2512         cd UU
2513         cp ../config.sh .
2514         n="$tmp_n"
2515         c="$tmp_c"
2516         hint=previous
2517         ;;
2518 esac
2519 test "$override" && . ./optdef.sh
2520 myuname="$newmyuname"
2521
2522 : Restore computed paths
2523 for file in $loclist $trylist; do
2524         eval $file="\$_$file"
2525 done
2526
2527 cat << EOM
2528
2529 Configure uses the operating system name and version to set some defaults.
2530 The default value is probably right if the name rings a bell. Otherwise,
2531 since spelling matters for me, either accept the default or answer "none"
2532 to leave it blank.
2533
2534 EOM
2535 case "$osname" in
2536         ''|' ')
2537                 case "$hintfile" in
2538                 ''|' '|none) dflt=none ;;
2539                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2540                 esac
2541                 ;;
2542         *) dflt="$osname" ;;
2543 esac
2544 rp="Operating system name?"
2545 . ./myread
2546 case "$ans" in
2547 none)  osname='' ;;
2548 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2549 esac
2550 echo " "
2551 case "$osvers" in
2552         ''|' ')
2553                 case "$hintfile" in
2554                 ''|' '|none) dflt=none ;;
2555                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2556                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2557                         case "$dflt" in
2558                         ''|' ') dflt=none ;;
2559                         esac
2560                         ;;
2561                 esac
2562                 ;;
2563         *) dflt="$osvers" ;;
2564 esac
2565 rp="Operating system version?"
2566 . ./myread
2567 case "$ans" in
2568 none)  osvers='' ;;
2569 *) osvers="$ans" ;;
2570 esac
2571
2572
2573 . ./posthint.sh
2574
2575 : who configured the system
2576 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2577 cf_by=`(logname) 2>/dev/null`
2578 case "$cf_by" in
2579 "")
2580         cf_by=`(whoami) 2>/dev/null`
2581         case "$cf_by" in
2582         "") cf_by=unknown ;;
2583         esac ;;
2584 esac
2585
2586 : set up the script used to warn in case of inconsistency
2587 cat <<EOS >whoa
2588 $startsh
2589 EOS
2590 cat <<'EOSC' >>whoa
2591 dflt=y
2592 echo " "
2593 echo "*** WHOA THERE!!! ***" >&4
2594 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2595 rp="    Keep the $hint value?"
2596 . ./myread
2597 case "$ans" in
2598 y) td=$was; tu=$was;;
2599 esac
2600 EOSC
2601
2602 : function used to set $1 to $val
2603 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2604 case "$val$was" in
2605 $define$undef) . ./whoa; eval "$var=\$td";;
2606 $undef$define) . ./whoa; eval "$var=\$tu";;
2607 *) eval "$var=$val";;
2608 esac'
2609
2610 cat <<EOM
2611
2612 Perl can be built to take advantage of threads on some systems.
2613 To do so, Configure must be run with -Dusethreads.
2614
2615 Note that threading is a highly experimental feature, and
2616 some known race conditions still remain.  If you choose to try
2617 it, be very sure to not actually deploy it for production
2618 purposes.  README.threads has more details, and is required
2619 reading if you enable threads.
2620 EOM
2621 case "$usethreads" in
2622 $define|true|[yY]*)     dflt='y';;
2623 *) dflt='n';;
2624 esac
2625 rp='Build a threading Perl?'
2626 . ./myread
2627 case "$ans" in
2628 y|Y)    val="$define" ;;
2629 *)      val="$undef" ;;
2630 esac
2631 set usethreads
2632 eval $setvar
2633
2634 case "$usethreads" in
2635 $define)
2636         $cat <<EOM
2637
2638 As of 5.5.640, Perl has two different internal threading implementations,
2639 the 5.005 version (5005threads) and an interpreter-based version
2640 (ithreads) that has one interpreter per thread.  Both are very 
2641 experimental.  This arrangement exists to help developers work out
2642 which one is better.
2643
2644 If you're a casual user, you probably don't want interpreter-threads
2645 at this time.  There doesn't yet exist a way to create threads from
2646 within Perl in this model, i.e., "use Thread;" will NOT work.
2647 EOM
2648         : Default to ithreads unless overridden on command line or with
2649         : old config.sh
2650         dflt='y'
2651         case "$use5005threads" in
2652                 $define|true|[yY]*) dflt='n';;
2653         esac
2654         case "$useithreads" in
2655                 $undef|false|[nN]*) dflt='n';;
2656         esac
2657         rp='Use interpreter-based ithreads?'
2658         . ./myread
2659         case "$ans" in
2660         y|Y)    val="$define" ;;
2661         *)      val="$undef" ;;
2662         esac
2663         set useithreads
2664         eval $setvar
2665         : Now set use5005threads to the opposite value.
2666         case "$useithreads" in
2667         $define) val="$undef" ;;
2668         *) val="$define" ;;
2669         esac
2670         set use5005threads
2671         eval $setvar
2672         ;;
2673 *)
2674         useithreads="$undef"
2675         use5005threads="$undef"
2676         ;;
2677 esac
2678
2679 case "$d_oldpthreads" in
2680 '')     : Configure tests would be welcome here.  For now, assume undef.
2681         val="$undef" ;;
2682 *)      val="$d_oldpthreads" ;;
2683 esac
2684 set d_oldpthreads
2685 eval $setvar
2686
2687
2688 case "$usethreads" in
2689 "$define"|true|[yY]*)
2690 : Look for a hint-file generated 'call-back-unit'.  If the
2691 : user has specified that a threading perl is to be built,
2692 : we may need to set or change some other defaults.
2693         if $test -f usethreads.cbu; then
2694                 echo "Your platform has some specific hints for threaded builds, using them..."
2695                 . ./usethreads.cbu
2696         else
2697                 $cat <<EOM
2698 (Your platform doesn't have any specific hints for threaded builds.
2699  Assuming POSIX threads, then.)
2700 EOM
2701         fi
2702         ;;
2703 esac
2704
2705 cat <<EOM
2706
2707 Perl can be built so that multiple Perl interpreters can coexist
2708 within the same Perl executable.
2709 EOM
2710
2711 case "$useithreads" in
2712 $define)
2713         cat <<EOM
2714 This multiple interpreter support is required for interpreter-based threads.
2715 EOM
2716         val="$define"
2717         ;;
2718 *)
2719         echo 'Normally you do not need this and you should answer no.'
2720         case "$usemultiplicity" in
2721         $define|true|[yY]*)     dflt='y';;
2722         *) dflt='n';;
2723         esac
2724         rp='Build Perl for multiplicity?'
2725         . ./myread
2726         case "$ans" in
2727         y|Y)    val="$define" ;;
2728         *)      val="$undef" ;;
2729         esac
2730         ;;
2731 esac
2732 set usemultiplicity
2733 eval $setvar
2734
2735 : determine where manual pages are on this system
2736 echo " "
2737 case "$sysman" in
2738 '') 
2739         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2740         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2741         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2742         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2743         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2744         sysman=`./loc . /usr/man/man1 $syspath`
2745         ;;
2746 esac
2747 if $test -d "$sysman"; then
2748         echo "System manual is in $sysman." >&4
2749 else
2750         echo "Could not find manual pages in source form." >&4
2751 fi
2752
2753 : see what memory models we can support
2754 case "$models" in
2755 '')
2756         $cat >pdp11.c <<'EOP'
2757 int main() {
2758 #ifdef pdp11
2759         exit(0);
2760 #else
2761         exit(1);
2762 #endif
2763 }
2764 EOP
2765         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2766         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2767                 dflt='unsplit split'
2768         else
2769                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2770                 case "$tans" in
2771                 X) dflt='none';;
2772                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2773                                 dflt='small'
2774                         else
2775                                 dflt=''
2776                         fi
2777                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2778                                 dflt="$dflt medium"
2779                         fi
2780                         if $test -d /lib/large || $test -d /usr/lib/large; then
2781                                 dflt="$dflt large"
2782                         fi
2783                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2784                                 dflt="$dflt huge"
2785                         fi
2786                 esac
2787         fi;;
2788 *) dflt="$models";;
2789 esac
2790 $cat <<EOM
2791  
2792 Some systems have different model sizes.  On most systems they are called
2793 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2794 split.  If your system doesn't support different memory models, say "none".
2795 If you wish to force everything to one memory model, say "none" here and
2796 put the appropriate flags later when it asks you for other cc and ld flags.
2797 Venix systems may wish to put "none" and let the compiler figure things out.
2798 (In the following question multiple model names should be space separated.)
2799
2800 The default for most systems is "none".
2801
2802 EOM
2803 rp="Which memory models are supported?"
2804 . ./myread
2805 models="$ans"
2806
2807 case "$models" in
2808 none)
2809         small=''
2810         medium=''
2811         large=''
2812         huge=''
2813         unsplit=''
2814         split=''
2815         ;;
2816 *split)
2817         case "$split" in
2818         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2819                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2820                         dflt='-i'
2821                 else
2822                         dflt='none'
2823                 fi;;
2824         *) dflt="$split";;
2825         esac
2826         rp="What flag indicates separate I and D space?"
2827         . ./myread
2828         tans="$ans"
2829         case "$tans" in
2830         none) tans='';;
2831         esac
2832         split="$tans"
2833         unsplit='';;
2834 *large*|*small*|*medium*|*huge*)
2835         case "$models" in
2836         *large*)
2837                 case "$large" in
2838                 '') dflt='-Ml';;
2839                 *) dflt="$large";;
2840                 esac
2841         rp="What flag indicates large model?"
2842         . ./myread
2843         tans="$ans"
2844         case "$tans" in
2845         none) tans='';
2846         esac
2847         large="$tans";;
2848         *) large='';;
2849         esac
2850         case "$models" in
2851         *huge*) case "$huge" in
2852                 '') dflt='-Mh';;
2853                 *) dflt="$huge";;
2854                 esac
2855                 rp="What flag indicates huge model?"
2856                 . ./myread
2857                 tans="$ans"
2858                 case "$tans" in
2859                 none) tans='';
2860                 esac
2861                 huge="$tans";;
2862         *) huge="$large";;
2863         esac
2864         case "$models" in
2865         *medium*) case "$medium" in
2866                 '') dflt='-Mm';;
2867                 *) dflt="$medium";;
2868                 esac
2869                 rp="What flag indicates medium model?"
2870                 . ./myread
2871                 tans="$ans"
2872                 case "$tans" in
2873                 none) tans='';
2874                 esac
2875                 medium="$tans";;
2876         *) medium="$large";;
2877         esac
2878         case "$models" in
2879         *small*) case "$small" in
2880                 '') dflt='none';;
2881                 *) dflt="$small";;
2882                 esac
2883                 rp="What flag indicates small model?"
2884                 . ./myread
2885                 tans="$ans"
2886                 case "$tans" in
2887                 none) tans='';
2888                 esac
2889                 small="$tans";;
2890         *) small='';;
2891         esac
2892         ;;
2893 *)
2894         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2895         ;;
2896 esac
2897 $rm -f pdp11.* pdp11
2898
2899 : make some quick guesses about what we are up against
2900 echo " "
2901 $echo $n "Hmm...  $c"
2902 echo exit 1 >bsd
2903 echo exit 1 >usg
2904 echo exit 1 >v7
2905 echo exit 1 >osf1
2906 echo exit 1 >eunice
2907 echo exit 1 >xenix
2908 echo exit 1 >venix
2909 echo exit 1 >os2
2910 d_bsd="$undef"
2911 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2912 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2913 then
2914         echo "Looks kind of like an OSF/1 system, but we'll see..."
2915         echo exit 0 >osf1
2916 elif test `echo abc | tr a-z A-Z` = Abc ; then
2917         xxx=`./loc addbib blurfl $pth`
2918         if $test -f $xxx; then
2919         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2920                 echo exit 0 >bsd
2921                 echo exit 0 >usg
2922         else
2923                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2924                         echo "Looks kind of like an extended USG system, but we'll see..."
2925                 else
2926                         echo "Looks kind of like a USG system, but we'll see..."
2927                 fi
2928                 echo exit 0 >usg
2929         fi
2930 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931         echo "Looks kind of like a BSD system, but we'll see..."
2932         d_bsd="$define"
2933         echo exit 0 >bsd
2934 else
2935         echo "Looks kind of like a Version 7 system, but we'll see..."
2936         echo exit 0 >v7
2937 fi
2938 case "$eunicefix" in
2939 *unixtovms*)
2940         $cat <<'EOI'
2941 There is, however, a strange, musty smell in the air that reminds me of
2942 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2943 EOI
2944         echo exit 0 >eunice
2945         d_eunice="$define"
2946 : it so happens the Eunice I know will not run shell scripts in Unix format
2947         ;;
2948 *)
2949         echo " "
2950         echo "Congratulations.  You aren't running Eunice."
2951         d_eunice="$undef"
2952         ;;
2953 esac
2954 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2955 case "$p_" in
2956 :) ;;
2957 *)
2958         $cat <<'EOI'
2959 I have the feeling something is not exactly right, however...don't tell me...
2960 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2961 EOI
2962         echo exit 0 >os2
2963         ;;
2964 esac
2965 if test -f /xenix; then
2966         echo "Actually, this looks more like a XENIX system..."
2967         echo exit 0 >xenix
2968         d_xenix="$define"
2969 else
2970         echo " "
2971         echo "It's not Xenix..."
2972         d_xenix="$undef"
2973 fi
2974 chmod +x xenix
2975 $eunicefix xenix
2976 if test -f /venix; then
2977         echo "Actually, this looks more like a VENIX system..."
2978         echo exit 0 >venix
2979 else
2980         echo " "
2981         if ./xenix; then
2982                 : null
2983         else
2984                 echo "Nor is it Venix..."
2985         fi
2986 fi
2987 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2988 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2989 $rm -f foo
2990
2991 : see if we need a special compiler
2992 echo " "
2993 if ./usg; then
2994         case "$cc" in
2995         '') case "$Mcc" in
2996                 /*) dflt='Mcc';;
2997                 *) case "$large" in
2998                         -M*) dflt='cc';;
2999                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3000                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3001                                                 dflt='cc'
3002                                         else
3003                                                 dflt='cc -M'
3004                                         fi
3005                                 else
3006                                         dflt='cc'
3007                                 fi;;
3008                         esac;;
3009                 esac;;
3010         *)  dflt="$cc";;
3011         esac
3012         case "$dflt" in
3013         *M*)    $cat <<'EOM'
3014 On some older systems the default C compiler will not resolve multiple global
3015 references that happen to have the same name.  On some such systems the "Mcc"
3016 command may be used to force these to be resolved.  On other systems a "cc -M"
3017 command is required.  (Note that the -M flag on other systems indicates a
3018 memory model to use!) If you have the Gnu C compiler, you might wish to use
3019 that instead.
3020
3021 EOM
3022         ;;
3023         esac
3024         rp="Use which C compiler?"
3025         . ./myread
3026         cc="$ans"
3027 else
3028         case "$cc" in
3029         '') dflt=cc;;
3030         *) dflt="$cc";;
3031         esac
3032         rp="Use which C compiler?"
3033         . ./myread
3034         cc="$ans"
3035 fi
3036 : Look for a hint-file generated 'call-back-unit'.  Now that the
3037 : user has specified the compiler, we may need to set or change some
3038 : other defaults.
3039 if $test -f cc.cbu; then
3040     . ./cc.cbu
3041 fi
3042 echo " "
3043 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3044 $cat >gccvers.c <<EOM
3045 #include <stdio.h>
3046 int main() {
3047 #ifdef __GNUC__
3048 #ifdef __VERSION__
3049         printf("%s\n", __VERSION__);
3050 #else
3051         printf("%s\n", "1");
3052 #endif
3053 #endif
3054         exit(0);
3055 }
3056 EOM
3057 if $cc -o gccvers gccvers.c; then
3058         gccversion=`./gccvers`
3059         case "$gccversion" in
3060         '') echo "You are not using GNU cc." ;;
3061         *)  echo "You are using GNU cc $gccversion."
3062             ;;
3063         esac
3064 else
3065         echo " "
3066         echo "*** WHOA THERE!!! ***" >&4
3067         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3068         case "$knowitall" in
3069         '')
3070         echo "    You'd better start hunting for one and let me know about it." >&4
3071                 exit 1
3072                 ;;
3073         esac
3074 fi
3075 $rm -f gccvers*
3076 case "$gccversion" in
3077 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3078 esac
3079
3080 : decide how portable to be.  Allow command line overrides.
3081 case "$d_portable" in
3082 "$undef") ;;
3083 *)      d_portable="$define" ;;
3084 esac
3085
3086 : set up shell script to do ~ expansion
3087 cat >filexp <<EOSS
3088 $startsh
3089 : expand filename
3090 case "\$1" in
3091  ~/*|~)
3092         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3093         ;;
3094  ~*)
3095         if $test -f /bin/csh; then
3096                 /bin/csh -f -c "glob \$1"
3097                 failed=\$?
3098                 echo ""
3099                 exit \$failed
3100         else
3101                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3102                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3103                 if $test ! -d "\$dir"; then
3104                         me=\`basename \$0\`
3105                         echo "\$me: can't locate home directory for: \$name" >&2
3106                         exit 1
3107                 fi
3108                 case "\$1" in
3109                 */*)
3110                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3111                         ;;
3112                 *)
3113                         echo \$dir
3114                         ;;
3115                 esac
3116         fi
3117         ;;
3118 *)
3119         echo \$1
3120         ;;
3121 esac
3122 EOSS
3123 chmod +x filexp
3124 $eunicefix filexp
3125
3126 : now set up to get a file name
3127 cat <<EOS >getfile
3128 $startsh
3129 EOS
3130 cat <<'EOSC' >>getfile
3131 tilde=''
3132 fullpath=''
3133 already=''
3134 skip=''
3135 none_ok=''
3136 exp_file=''
3137 nopath_ok=''
3138 orig_rp="$rp"
3139 orig_dflt="$dflt"
3140 case "$gfpth" in
3141 '') gfpth='.' ;;
3142 esac
3143
3144 case "$fn" in
3145 *\(*)
3146         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3147         fn=`echo $fn | sed 's/(.*)//'`
3148         ;;
3149 esac
3150
3151 case "$fn" in
3152 *:*)
3153         loc_file=`expr $fn : '.*:\(.*\)'`
3154         fn=`expr $fn : '\(.*\):.*'`
3155         ;;
3156 esac
3157
3158 case "$fn" in
3159 *~*) tilde=true;;
3160 esac
3161 case "$fn" in
3162 */*) fullpath=true;;
3163 esac
3164 case "$fn" in
3165 *+*) skip=true;;
3166 esac
3167 case "$fn" in
3168 *n*) none_ok=true;;
3169 esac
3170 case "$fn" in
3171 *e*) exp_file=true;;
3172 esac
3173 case "$fn" in
3174 *p*) nopath_ok=true;;
3175 esac
3176
3177 case "$fn" in
3178 *f*) type='File';;
3179 *d*) type='Directory';;
3180 *l*) type='Locate';;
3181 esac
3182
3183 what="$type"
3184 case "$what" in
3185 Locate) what='File';;
3186 esac
3187
3188 case "$exp_file" in
3189 '')
3190         case "$d_portable" in
3191         "$define") ;;
3192         *) exp_file=true;;
3193         esac
3194         ;;
3195 esac
3196
3197 cd ..
3198 while test "$type"; do
3199         redo=''
3200         rp="$orig_rp"
3201         dflt="$orig_dflt"
3202         case "$tilde" in
3203         true) rp="$rp (~name ok)";;
3204         esac
3205         . UU/myread
3206         if test -f UU/getfile.ok && \
3207                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3208         then
3209                 value="$ans"
3210                 ansexp="$ans"
3211                 break
3212         fi
3213         case "$ans" in
3214         none)
3215                 value=''
3216                 ansexp=''
3217                 case "$none_ok" in
3218                 true) type='';;
3219                 esac
3220                 ;;
3221         *)
3222                 case "$tilde" in
3223                 '') value="$ans"
3224                         ansexp="$ans";;
3225                 *)
3226                         value=`UU/filexp $ans`
3227                         case $? in
3228                         0)
3229                                 if test "$ans" != "$value"; then
3230                                         echo "(That expands to $value on this system.)"
3231                                 fi
3232                                 ;;
3233                         *) value="$ans";;
3234                         esac
3235                         ansexp="$value"
3236                         case "$exp_file" in
3237                         '') value="$ans";;
3238                         esac
3239                         ;;
3240                 esac
3241                 case "$fullpath" in
3242                 true)
3243                         case "$ansexp" in
3244                         /*) value="$ansexp" ;;
3245                         *)
3246                                 redo=true
3247                                 case "$already" in
3248                                 true)
3249                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3250                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3251                                         ;;
3252                                 *)
3253                                 echo "Please give a full path name, starting with slash." >&4
3254                                         case "$tilde" in
3255                                         true)
3256                                 echo "Note that using ~name is ok provided it expands well." >&4
3257                                                 already=true
3258                                                 ;;
3259                                         esac
3260                                 esac
3261                                 ;;
3262                         esac
3263                         ;;
3264                 esac
3265                 case "$redo" in
3266                 '')
3267                         case "$type" in
3268                         File)
3269                                 for fp in $gfpth; do
3270                                         if test "X$fp" = X.; then
3271                                             pf="$ansexp"
3272                                         else    
3273                                             pf="$fp/$ansexp"
3274                                         fi
3275                                         if test -f "$pf"; then
3276                                                 type=''
3277                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3278                                         then
3279                                                 echo "($value is not a plain file, but that's ok.)"
3280                                                 type=''
3281                                         fi
3282                                         if test X"$type" = X; then
3283                                             value="$pf"
3284                                             break
3285                                         fi
3286                                 done
3287                                 ;;
3288                         Directory)
3289                                 for fp in $gfpth; do
3290                                         if test "X$fp" = X.; then
3291                                             pf="$ansexp"
3292                                         else    
3293                                             pf="$fp/$ansexp"
3294                                         fi
3295                                         if test -d "$pf"; then
3296                                                 type=''
3297                                                 value="$pf"
3298                                                 break
3299                                         fi
3300                                 done
3301                                 ;;
3302                         Locate)
3303                                 if test -d "$ansexp"; then
3304                                         echo "(Looking for $loc_file in directory $value.)"
3305                                         value="$value/$loc_file"
3306                                         ansexp="$ansexp/$loc_file"
3307                                 fi
3308                                 if test -f "$ansexp"; then
3309                                         type=''
3310                                 fi
3311                                 case "$nopath_ok" in
3312                                 true)   case "$value" in
3313                                         */*) ;;
3314                                         *)      echo "Assuming $value will be in people's path."
3315                                                 type=''
3316                                                 ;;
3317                                         esac
3318                                         ;;
3319                                 esac
3320                                 ;;
3321                         esac
3322
3323                         case "$skip" in
3324                         true) type='';
3325                         esac
3326
3327                         case "$type" in
3328                         '') ;;
3329                         *)
3330                                 if test "$fastread" = yes; then
3331                                         dflt=y
3332                                 else
3333                                         dflt=n
3334                                 fi
3335                                 rp="$what $value doesn't exist.  Use that name anyway?"
3336                                 . UU/myread
3337                                 dflt=''
3338                                 case "$ans" in
3339                                 y*) type='';;
3340                                 *) echo " ";;
3341                                 esac
3342                                 ;;
3343                         esac
3344                         ;;
3345                 esac
3346                 ;;
3347         esac
3348 done
3349 cd UU
3350 ans="$value"
3351 rp="$orig_rp"
3352 dflt="$orig_dflt"
3353 rm -f getfile.ok
3354 test "X$gfpthkeep" != Xy && gfpth=""
3355 EOSC
3356
3357 : What should the include directory be ?
3358 echo " "
3359 $echo $n "Hmm...  $c"
3360 dflt='/usr/include'
3361 incpath=''
3362 mips_type=''
3363 if $test -f /bin/mips && /bin/mips; then
3364         echo "Looks like a MIPS system..."
3365         $cat >usr.c <<'EOCP'
3366 #ifdef SYSTYPE_BSD43
3367 /bsd43
3368 #endif
3369 EOCP
3370         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3371                 dflt='/bsd43/usr/include'
3372                 incpath='/bsd43'
3373                 mips_type='BSD 4.3'
3374         else
3375                 mips_type='System V'
3376         fi
3377         $rm -f usr.c usr.out
3378         echo "and you're compiling with the $mips_type compiler and libraries."
3379         xxx_prompt=y
3380         echo "exit 0" >mips
3381 else
3382         echo "Doesn't look like a MIPS system."
3383         xxx_prompt=n
3384         echo "exit 1" >mips
3385 fi
3386 chmod +x mips
3387 $eunicefix mips
3388 case "$usrinc" in
3389 '') ;;
3390 *) dflt="$usrinc";;
3391 esac
3392 case "$xxx_prompt" in
3393 y)      fn=d/
3394         echo " "
3395         rp='Where are the include files you want to use?'
3396         . ./getfile
3397         usrinc="$ans"
3398         ;;
3399 *)      usrinc="$dflt"
3400         ;;
3401 esac
3402
3403 : see how we invoke the C preprocessor
3404 echo " "
3405 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3406 cat <<'EOT' >testcpp.c
3407 #define ABC abc
3408 #define XYZ xyz
3409 ABC.XYZ
3410 EOT
3411 cd ..
3412 if test ! -f cppstdin; then
3413         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3414                 # AIX cc -E doesn't show the absolute headerfile
3415                 # locations but we'll cheat by using the -M flag.
3416                 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
3417         else
3418                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3419         fi
3420 else
3421         echo "Keeping your $hint cppstdin wrapper."
3422 fi
3423 chmod 755 cppstdin
3424 wrapper=`pwd`/cppstdin
3425 ok='false'
3426 cd UU
3427
3428 if $test "X$cppstdin" != "X" && \
3429         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3430         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3431 then
3432         echo "You used to use $cppstdin $cppminus so we'll use that again."
3433         case "$cpprun" in
3434         '') echo "But let's see if we can live without a wrapper..." ;;
3435         *)
3436                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3437                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3438                 then
3439                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3440                         ok='true'
3441                 else
3442                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3443                 fi
3444                 ;;
3445         esac
3446 else
3447         case "$cppstdin" in
3448         '') ;;
3449         *)
3450                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3451                 ;;
3452         esac
3453 fi
3454
3455 if $ok; then
3456         : nothing
3457 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3458         $cc -E <testcpp.c >testcpp.out 2>&1; \
3459         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3460         echo "Yup, it does."
3461         x_cpp="$cc -E"
3462         x_minus='';
3463 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3464         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3465         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3466         echo "Yup, it does."
3467         x_cpp="$cc -E"
3468         x_minus='-';
3469 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3470         $cc -P <testcpp.c >testcpp.out 2>&1; \
3471         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3472         echo "Yipee, that works!"
3473         x_cpp="$cc -P"
3474         x_minus='';
3475 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3476         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3477         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3478         echo "At long last!"
3479         x_cpp="$cc -P"
3480         x_minus='-';
3481 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3482         $cpp <testcpp.c >testcpp.out 2>&1; \
3483         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3484         echo "It works!"
3485         x_cpp="$cpp"
3486         x_minus='';
3487 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3488         $cpp - <testcpp.c >testcpp.out 2>&1; \
3489         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3490         echo "Hooray, it works!  I was beginning to wonder."
3491         x_cpp="$cpp"
3492         x_minus='-';
3493 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3494         $wrapper <testcpp.c >testcpp.out 2>&1; \
3495         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496         x_cpp="$wrapper"
3497         x_minus=''
3498         echo "Eureka!"
3499 else
3500         dflt=''
3501         rp="No dice.  I can't find a C preprocessor.  Name one:"
3502         . ./myread
3503         x_cpp="$ans"
3504         x_minus=''
3505         $x_cpp <testcpp.c >testcpp.out 2>&1
3506         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3507                 echo "OK, that will do." >&4
3508         else
3509 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3510                 exit 1
3511         fi
3512 fi
3513
3514 case "$ok" in
3515 false)
3516         cppstdin="$x_cpp"
3517         cppminus="$x_minus"
3518         cpprun="$x_cpp"
3519         cpplast="$x_minus"
3520         set X $x_cpp
3521         shift
3522         case "$1" in
3523         "$cpp")
3524                 echo "Perhaps can we force $cc -E using a wrapper..."
3525                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3526                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3527                 then
3528                         echo "Yup, we can."
3529                         cppstdin="$wrapper"
3530                         cppminus='';
3531                 else
3532                         echo "Nope, we'll have to live without it..."
3533                 fi
3534                 ;;
3535         esac
3536         case "$cpprun" in
3537         "$wrapper")
3538                 cpprun=''
3539                 cpplast=''
3540                 ;;
3541         esac
3542         ;;
3543 esac
3544
3545 case "$cppstdin" in
3546 "$wrapper"|'cppstdin') ;;
3547 *) $rm -f $wrapper;;
3548 esac
3549 $rm -f testcpp.c testcpp.out
3550
3551 : Set private lib path
3552 case "$plibpth" in
3553 '') if ./mips; then
3554                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3555         fi;;
3556 esac
3557 case "$libpth" in
3558 ' ') dlist='';;
3559 '') dlist="$loclibpth $plibpth $glibpth";;
3560 *) dlist="$libpth";;
3561 esac
3562
3563 : Now check and see which directories actually exist, avoiding duplicates
3564 libpth=''
3565 for xxx in $dlist
3566 do
3567     if $test -d $xxx; then
3568                 case " $libpth " in
3569                 *" $xxx "*) ;;
3570                 *) libpth="$libpth $xxx";;
3571                 esac
3572     fi
3573 done
3574 $cat <<'EOM'
3575
3576 Some systems have incompatible or broken versions of libraries.  Among
3577 the directories listed in the question below, please remove any you
3578 know not to be holding relevant libraries, and add any that are needed.
3579 Say "none" for none.
3580
3581 EOM
3582 case "$libpth" in
3583 '') dflt='none';;
3584 *)
3585         set X $libpth
3586         shift
3587         dflt=${1+"$@"}
3588         ;;
3589 esac
3590 rp="Directories to use for library searches?"
3591 . ./myread
3592 case "$ans" in
3593 none) libpth=' ';;
3594 *) libpth="$ans";;
3595 esac
3596
3597 : compute shared library extension
3598 case "$so" in
3599 '')
3600         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3601                 dflt='sl'
3602         else
3603                 dflt='so'
3604         fi
3605         ;;
3606 *) dflt="$so";;
3607 esac
3608 $cat <<EOM
3609
3610 On some systems, shared libraries may be available.  Answer 'none' if
3611 you want to suppress searching of shared libraries for the remainder
3612 of this configuration.
3613
3614 EOM
3615 rp='What is the file extension used for shared libraries?'
3616 . ./myread
3617 so="$ans"
3618
3619 : Define several unixisms.
3620 : Hints files or command line option can be used to override them.
3621 : The convoluted testing is in case hints files set either the old
3622 : or the new name.
3623 case "$_exe" in
3624 '')     case "$exe_ext" in
3625     '') ;;
3626         *)      _exe="$exe_ext" ;;
3627         esac
3628         ;;
3629 esac
3630 case "$_a" in
3631 '')     case "$lib_ext" in
3632     '') _a='.a';;
3633         *)      _a="$lib_ext" ;;
3634         esac
3635         ;;
3636 esac
3637 case "$_o" in
3638 '') case "$obj_ext" in
3639         '')     _o='.o';;
3640         *)      _o="$obj_ext";;
3641         esac
3642         ;;
3643 esac
3644 case "$p_" in
3645 '') case "$path_sep" in
3646         '')     p_=':';;
3647         *)      p_="$path_sep";;
3648         esac
3649         ;;
3650 esac
3651 exe_ext=$_exe
3652 lib_ext=$_a
3653 obj_ext=$_o
3654 path_sep=$p_
3655
3656 : Which makefile gets called first.  This is used by make depend.
3657 case "$firstmakefile" in
3658 '') firstmakefile='makefile';;
3659 esac
3660
3661 cat <<EOM
3662
3663 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3664 Configure must be run with -Dusesocks.
3665
3666 Normally you do not need this and you should answer no.
3667
3668 EOM
3669 case "$usesocks" in
3670 $define|true|[yY]*)     dflt='y';;
3671 *) dflt='n';;
3672 esac
3673 rp='Build Perl for SOCKS?'
3674 . ./myread
3675 case "$ans" in
3676 y|Y)    val="$define" ;;     
3677 *)      val="$undef" ;;
3678 esac
3679 set usesocks
3680 eval $setvar
3681
3682 : Looking for optional libraries
3683 echo " "
3684 echo "Checking for optional libraries..." >&4
3685 case "$libs" in
3686 ' '|'') dflt='';;
3687 *) dflt="$libs";;
3688 esac
3689 case "$libswanted" in
3690 '') libswanted='c_s';;
3691 esac
3692 case "$usesocks" in
3693 $define)
3694         libswanted="$libswanted socks5 socks5_sh"
3695         ;;
3696 esac
3697 for thislib in $libswanted; do
3698         
3699         libname="$thislib"
3700         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3701                 if $test "X$ignore_versioned_solibs" = "X"; then
3702                         xxx=/ignored$xxx
3703                 else
3704                         libstyle=shared
3705                 fi
3706         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3707                 libstyle=shared
3708         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3709                 libstyle=static
3710         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3711                 libstyle=static
3712         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3713                 libstyle=static
3714                 libname=${thislib}_s
3715         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3716                 libstyle="static"
3717         fi
3718         if $test -f "$xxx"; then
3719                 eval $libscheck
3720         fi
3721         if $test -f "$xxx"; then
3722                 case "$libstyle" in
3723                 shared) echo "Found -l$libname (shared)." ;;
3724                 static) echo "Found -l$libname." ;;
3725                 *)      echo "Found -l$libname ($libstyle)." ;;
3726                 esac
3727                 case " $dflt " in
3728                 *"-l$thislib "*);;
3729                 *) dflt="$dflt -l$libname"
3730                    libsfound="$libsfound $xxx"
3731                    yyy=`basename $xxx`
3732                    libsfiles="$libsfiles $yyy"
3733                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3734                    case " $libsdirs " in
3735                    *" $yyy "*) ;;
3736                    *) libsdirs="$libsdirs $yyy" ;;
3737                    esac
3738                    ;;
3739                 esac
3740         else
3741                 echo "No -l$thislib."
3742         fi
3743 done
3744 set X $dflt
3745 shift
3746 dflt="$*"
3747 case "$libs" in
3748 '') dflt="$dflt";;
3749 *) dflt="$libs";;
3750 esac
3751 case "$dflt" in
3752 ' '|'') dflt='none';;
3753 esac
3754
3755 $cat <<EOM
3756
3757 In order to compile $package on your machine, a number of libraries
3758 are usually needed.  Include any other special libraries here as well.
3759 Say "none" for none.  The default list is almost always right.
3760 EOM
3761
3762 echo " "
3763 rp="What libraries to use?"
3764 . ./myread
3765 case "$ans" in
3766 none) libs=' ';;
3767 *) libs="$ans";;
3768 esac
3769
3770 : determine optimization, if desired, or use for debug flag also
3771 case "$optimize" in
3772 ' '|$undef) dflt='none';;
3773 '') dflt='-O';;
3774 *) dflt="$optimize";;
3775 esac
3776 $cat <<EOH
3777
3778 By default, $package compiles with the -O flag to use the optimizer.
3779 Alternately, you might want to use the symbolic debugger, which uses
3780 the -g flag (on traditional Unix systems).  Either flag can be
3781 specified here.  To use neither flag, specify the word "none".
3782
3783 EOH
3784 rp="What optimizer/debugger flag should be used?"
3785 . ./myread
3786 optimize="$ans"
3787 case "$optimize" in
3788 'none') optimize=" ";;
3789 esac
3790
3791 dflt=''
3792 : We will not override a previous value, but we might want to
3793 : augment a hint file
3794 case "$hint" in
3795 default|recommended)
3796         case "$gccversion" in
3797         1*) dflt='-fpcc-struct-return' ;;
3798         esac
3799         case "$optimize" in
3800         *-g*) dflt="$dflt -DDEBUGGING";;
3801         esac
3802         case "$gccversion" in
3803         2*) if test -d /etc/conf/kconfig.d &&
3804                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3805                 then
3806                         dflt="$dflt -posix"
3807                 fi
3808                 ;;
3809         esac
3810         case "$gccversion" in
3811         1*) ;;
3812         2.[0-8]*) ;;
3813         ?*)     echo " "
3814                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3815                 echo 'int main(void) { return 0; }' > gcctest.c
3816                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3817                         echo "Yes, it does." 2>&1
3818                         case "$ccflags" in
3819                         *strict-aliasing*) 
3820                                 echo "Leaving current flags $ccflags alone." 2>&1
3821                                 ;;
3822                         *) dflt="$dflt -fno-strict-aliasing" ;;
3823                         esac
3824                 else
3825                         echo "Nope, it doesn't, but that's ok." 2>&1
3826                 fi
3827                 ;;
3828         esac
3829         ;;
3830 esac
3831
3832 case "$mips_type" in
3833 *BSD*|'') inclwanted="$locincpth $usrinc";;
3834 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3835 esac
3836 for thisincl in $inclwanted; do
3837         if $test -d $thisincl; then
3838                 if $test x$thisincl != x$usrinc; then
3839                         case "$dflt" in
3840                         *$thisincl*);;
3841                         *) dflt="$dflt -I$thisincl";;
3842                         esac
3843                 fi
3844         fi
3845 done
3846
3847 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3848         xxx=true;
3849 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3850         xxx=true;
3851 else
3852         xxx=false;
3853 fi;
3854 if $xxx; then
3855         case "$dflt" in
3856         *$2*);;
3857         *) dflt="$dflt -D$2";;
3858         esac;
3859 fi'
3860
3861 set signal.h LANGUAGE_C; eval $inctest
3862
3863 case "$usesocks" in
3864 $define)
3865         ccflags="$ccflags -DSOCKS"
3866         ;;
3867 esac
3868
3869 case "$hint" in
3870 default|recommended) dflt="$ccflags $dflt" ;;
3871 *) dflt="$ccflags";;
3872 esac
3873
3874 case "$dflt" in
3875 ''|' ') dflt=none;;
3876 esac
3877 $cat <<EOH
3878
3879 Your C compiler may want other flags.  For this question you should include
3880 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3881 but you should NOT include libraries or ld flags like -lwhatever.  If you
3882 want $package to honor its debug switch, you should include -DDEBUGGING here.
3883 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3884
3885 To use no flags, specify the word "none".
3886
3887 EOH
3888 set X $dflt
3889 shift
3890 dflt=${1+"$@"}
3891 rp="Any additional cc flags?"
3892 . ./myread
3893 case "$ans" in
3894 none) ccflags='';;
3895 *) ccflags="$ans";;
3896 esac
3897
3898 : the following weeds options from ccflags that are of no interest to cpp
3899 cppflags="$ccflags"
3900 case "$gccversion" in
3901 1*) cppflags="$cppflags -D__GNUC__"
3902 esac
3903 case "$mips_type" in
3904 '');;
3905 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3906 esac
3907 case "$cppflags" in
3908 '');;
3909 *)
3910         echo " "
3911         echo "Let me guess what the preprocessor flags are..." >&4
3912         set X $cppflags
3913         shift
3914         cppflags=''
3915         $cat >cpp.c <<'EOM'
3916 #define BLURFL foo
3917
3918 BLURFL xx LFRULB
3919 EOM
3920         previous=''
3921         for flag in $*
3922         do
3923                 case "$flag" in
3924                 -*) ftry="$flag";;
3925                 *) ftry="$previous $flag";;
3926                 esac
3927                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3928                         >cpp1.out 2>/dev/null && \
3929                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3930                         >cpp2.out 2>/dev/null && \
3931                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3932                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3933                 then
3934                         cppflags="$cppflags $ftry"
3935                         previous=''
3936                 else
3937                         previous="$flag"
3938                 fi
3939         done
3940         set X $cppflags
3941         shift
3942         cppflags=${1+"$@"}
3943         case "$cppflags" in
3944         *-*)  echo "They appear to be: $cppflags";;
3945         esac
3946         $rm -f cpp.c cpp?.out
3947         ;;
3948 esac
3949
3950 : flags used in final linking phase
3951 case "$ldflags" in
3952 '') if ./venix; then
3953                 dflt='-i -z'
3954         else
3955                 dflt=''
3956         fi
3957         case "$ccflags" in
3958         *-posix*) dflt="$dflt -posix" ;;
3959         esac
3960         ;;
3961 *) dflt="$ldflags";;
3962 esac
3963
3964 : Try to guess additional flags to pick up local libraries.
3965 for thislibdir in $libpth; do
3966         case " $loclibpth " in
3967         *" $thislibdir "*)
3968                 case "$dflt " in 
3969                 *"-L$thislibdir "*) ;;
3970                 *)  dflt="$dflt -L$thislibdir" ;;
3971                 esac
3972                 ;;
3973         esac
3974 done
3975
3976 case "$dflt" in
3977 '') dflt='none' ;;
3978 esac
3979
3980 $cat <<EOH
3981
3982 Your C linker may need flags.  For this question you should
3983 include -L/whatever and any other flags used by the C linker, but you
3984 should NOT include libraries like -lwhatever.
3985
3986 Make sure you include the appropriate -L/path flags if your C linker
3987 does not normally search all of the directories you specified above,
3988 namely
3989         $libpth
3990 To use no flags, specify the word "none".
3991
3992 EOH
3993
3994 rp="Any additional ld flags (NOT including libraries)?"
3995 . ./myread
3996 case "$ans" in
3997 none) ldflags='';;
3998 *) ldflags="$ans";;
3999 esac
4000 rmlist="$rmlist pdp11"
4001
4002 : coherency check
4003 echo " "
4004 echo "Checking your choice of C compiler and flags for coherency..." >&4
4005 $cat > try.c <<'EOF'
4006 #include <stdio.h>
4007 int main() { printf("Ok\n"); exit(0); }
4008 EOF
4009 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4010 shift
4011 $cat >try.msg <<'EOM'
4012 I've tried to compile and run the following simple program:
4013
4014 EOM
4015 $cat try.c >> try.msg
4016
4017 $cat >> try.msg <<EOM
4018
4019 I used the command:
4020
4021         $*
4022         ./try
4023
4024 and I got the following output:
4025
4026 EOM
4027 dflt=y
4028 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4029         if sh -c './try' >>try.msg 2>&1; then
4030                 xxx=`./try`
4031                 case "$xxx" in
4032                 "Ok") dflt=n ;;
4033                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4034                         case " $libs " in
4035                         *" -lsfio "*)
4036                                 cat >> try.msg <<'EOQS'
4037 If $libs contains -lsfio, and sfio is mis-configured, then it
4038 sometimes (apparently) runs and exits with a 0 status, but with no
4039 output!  It may have to do with sfio's use of _exit vs. exit.
4040
4041 EOQS
4042                                 rp="You have a big problem.  Shall I abort Configure"
4043                                 dflt=y
4044                                 ;;
4045                         esac
4046                         ;;
4047                 esac
4048         else
4049                 echo "The program compiled OK, but exited with status $?." >>try.msg
4050                 rp="You have a problem.  Shall I abort Configure"
4051                 dflt=y
4052         fi
4053 else
4054         echo "I can't compile the test program." >>try.msg
4055         rp="You have a BIG problem.  Shall I abort Configure"
4056         dflt=y
4057 fi
4058 case "$dflt" in
4059 y)
4060         $cat try.msg >&4
4061         case "$knowitall" in
4062         '')
4063                 echo "(The supplied flags or libraries might be incorrect.)"
4064                 ;;
4065         *) dflt=n;;
4066         esac
4067         echo " "
4068         . ./myread
4069         case "$ans" in
4070         n*|N*) ;;
4071         *)      echo "Ok.  Stopping Configure." >&4
4072                 exit 1
4073                 ;;
4074         esac
4075         ;;
4076 n) echo "OK, that should do.";;
4077 esac
4078 $rm -f try try.* core
4079
4080 : define an is-a-typedef? function
4081 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4082 case "$inclist" in
4083 "") inclist="sys/types.h";;
4084 esac;
4085 eval "varval=\$$var";
4086 case "$varval" in
4087 "")
4088         $rm -f temp.c;
4089         for inc in $inclist; do
4090                 echo "#include <$inc>" >>temp.c;
4091         done;
4092         echo "#ifdef $type" >> temp.c;
4093         echo "printf(\"We have $type\");" >> temp.c;
4094         echo "#endif" >> temp.c;
4095         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4096         if $contains $type temp.E >/dev/null 2>&1; then
4097                 eval "$var=\$type";
4098         else
4099                 eval "$var=\$def";
4100         fi;
4101         $rm -f temp.?;;
4102 *) eval "$var=\$varval";;
4103 esac'
4104
4105 : define an is-a-typedef? function that prompts if the type is not available.
4106 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4107 case "$inclist" in
4108 "") inclist="sys/types.h";;
4109 esac;
4110 eval "varval=\$$var";
4111 case "$varval" in
4112 "")
4113         $rm -f temp.c;
4114         for inc in $inclist; do
4115                 echo "#include <$inc>" >>temp.c;
4116         done;
4117         echo "#ifdef $type" >> temp.c;
4118         echo "printf(\"We have $type\");" >> temp.c;
4119         echo "#endif" >> temp.c;
4120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4121         echo " " ;
4122         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4123         if $contains $type temp.E >/dev/null 2>&1; then
4124                 echo "$type found." >&4;
4125                 eval "$var=\$type";
4126         else
4127                 echo "$type NOT found." >&4;
4128                 dflt="$def";
4129                 . ./myread ;
4130                 eval "$var=\$ans";
4131         fi;
4132         $rm -f temp.?;;
4133 *) eval "$var=\$varval";;
4134 esac'
4135
4136 : define a shorthand compile call
4137 compile='
4138 mc_file=$1;
4139 shift;
4140 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4141 : define a shorthand compile call for compilations that should be ok.
4142 compile_ok='
4143 mc_file=$1;
4144 shift;
4145 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4146
4147 : check for lengths of integral types
4148 echo " "
4149 case "$intsize" in
4150 '')
4151         echo "Checking to see how big your integers are..." >&4
4152         $cat >intsize.c <<'EOCP'
4153 #include <stdio.h>
4154 int main()
4155 {
4156         printf("intsize=%d;\n", (int)sizeof(int));
4157         printf("longsize=%d;\n", (int)sizeof(long));
4158         printf("shortsize=%d;\n", (int)sizeof(short));
4159         exit(0);
4160 }
4161 EOCP
4162         set intsize
4163         if eval $compile_ok && ./intsize > /dev/null; then
4164                 eval `./intsize`
4165                 echo "Your integers are $intsize bytes long."
4166                 echo "Your long integers are $longsize bytes long."
4167                 echo "Your short integers are $shortsize bytes long."
4168         else
4169                 $cat >&4 <<EOM
4170 !
4171 Help! I can't compile and run the intsize test program: please enlighten me!
4172 (This is probably a misconfiguration in your system or libraries, and
4173 you really ought to fix it.  Still, I'll try anyway.)
4174 !
4175 EOM
4176                 dflt=4
4177                 rp="What is the size of an integer (in bytes)?"
4178                 . ./myread
4179                 intsize="$ans"
4180                 dflt=$intsize
4181                 rp="What is the size of a long integer (in bytes)?"
4182                 . ./myread
4183                 longsize="$ans"
4184                 dflt=2
4185                 rp="What is the size of a short integer (in bytes)?"
4186                 . ./myread
4187                 shortsize="$ans"
4188         fi
4189         ;;
4190 esac
4191 $rm -f intsize intsize.*
4192
4193 : see what type lseek is declared as in the kernel
4194 rp="What is the type used for lseek's offset on this system?"
4195 set off_t lseektype long stdio.h sys/types.h
4196 eval $typedef_ask
4197
4198 echo " "
4199 $echo $n "Checking to see how big your file offsets are...$c" >&4
4200 $cat >try.c <<EOCP
4201 #include <sys/types.h>
4202 #include <stdio.h>
4203 int main()
4204 {
4205     printf("%d\n", (int)sizeof($lseektype));
4206     return(0); 
4207 }
4208 EOCP
4209 set try
4210 if eval $compile_ok; then
4211         lseeksize=`./try`
4212         $echo " $lseeksize bytes." >&4
4213 else
4214         dflt=$longsize
4215         echo " "
4216         echo "(I can't seem to compile the test program.  Guessing...)"
4217         rp="What is the size of your file offsets (in bytes)?"
4218         . ./myread
4219         lseeksize="$ans"
4220 fi
4221 $rm -f try.c try
4222
4223 : see what type file positions are declared as in the library
4224 rp="What is the type for file position used by fsetpos()?"
4225 set fpos_t fpostype long stdio.h sys/types.h
4226 eval $typedef_ask
4227
4228 echo " "
4229 case "$fpostype" in
4230 *_t) zzz="$fpostype"    ;;
4231 *)   zzz="fpos_t"       ;;
4232 esac
4233 $echo $n "Checking the size of $zzz...$c" >&4 
4234 cat > try.c <<EOCP
4235 #include <sys/types.h>
4236 #include <stdio.h>
4237 int main() {
4238     printf("%d\n", (int)sizeof($fpostype));
4239     exit(0);
4240 }
4241 EOCP
4242 set try
4243 if eval $compile_ok; then
4244         yyy=`./try`
4245         case "$yyy" in
4246         '')     fpossize=4
4247                 echo " "
4248                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4249                 ;;
4250         *)      fpossize=$yyy
4251                 echo " $fpossize bytes."
4252                 ;;
4253         esac
4254 else
4255         dflt="$longsize"
4256         echo " "
4257         echo "(I can't compile the test program.  Guessing...)" >&4
4258         rp="What is the size of your file positions (in bytes)?"
4259         . ./myread
4260         fpossize="$ans"
4261 fi
4262
4263
4264
4265 case "$lseeksize:$fpossize" in
4266 8:8) cat <<EOM
4267
4268 You can have files larger than 2 gigabytes.
4269 EOM
4270    val="$define" ;;
4271 *) cat <<EOM
4272
4273 Perl can be built to understand large files (files larger than 2 gigabytes)
4274 on some systems.  To do so, Configure must be run with -Duselargefiles.
4275
4276 If this doesn't make any sense to you, just accept the default 'y'.
4277 EOM
4278    case "$uselargefiles" in
4279    "$undef"|false|[nN]*) dflt='n' ;;
4280    *)   dflt='y' ;;
4281    esac
4282    rp='Try to understand large files, if available?'
4283    . ./myread
4284    case "$ans" in
4285    y|Y)         val="$define" ;;
4286    *)           val="$undef"  ;;
4287    esac
4288    ;;
4289 esac
4290 set uselargefiles
4291 eval $setvar
4292 case "$uselargefiles" in
4293 "$define")
4294 : Look for a hint-file generated 'call-back-unit'.  If the
4295 : user has specified that a large files perl is to be built,
4296 : we may need to set or change some other defaults.
4297         if $test -f uselfs.cbu; then
4298                 echo "Your platform has some specific hints for large file builds, using them..."
4299                 . ./uselfs.cbu
4300                 echo " "
4301                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4302                 $cat >try.c <<EOCP
4303 #include <sys/types.h>
4304 #include <stdio.h>
4305 int main()
4306 {
4307     printf("%d\n", (int)sizeof($lseektype));
4308     return(0); 
4309 }
4310 EOCP
4311                 set try
4312                 if eval $compile_ok; then
4313                         lseeksize=`./try`
4314                         $echo " $lseeksize bytes." >&4
4315                 else
4316                         dflt="$lseeksize"
4317                         echo " "
4318                         echo "(I can't seem to compile the test program.  Guessing...)"
4319                         rp="What is the size of your file offsets (in bytes)?"
4320                         . ./myread
4321                         lseeksize="$ans"
4322                 fi
4323                 case "$fpostype" in
4324                 *_t) zzz="$fpostype"    ;;
4325                 *)   zzz="fpos_t"       ;;
4326                 esac
4327                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4328                 $cat > try.c <<EOCP
4329 #include <sys/types.h>
4330 #include <stdio.h>
4331 int main() {
4332     printf("%d\n", (int)sizeof($fpostype));
4333     exit(0);
4334 }
4335 EOCP
4336                 set try
4337                 if eval $compile_ok; then
4338                         yyy=`./try`
4339                         dflt="$lseeksize"
4340                         case "$yyy" in
4341                         '')     echo " "
4342                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4343                                 ;;
4344                         *)      fpossize=$yyy
4345                                 echo " $fpossize bytes."
4346                                 ;;
4347                         esac
4348                 else
4349                         dflt="$fpossize"
4350                         echo " "
4351                         echo "(I can't compile the test program.  Guessing...)" >&4
4352                         rp="What is the size of your file positions (in bytes)?"
4353                         . ./myread
4354                         fpossize="$ans"
4355                 fi
4356                 $rm -f try.c try
4357         fi
4358         ;;
4359 esac
4360
4361
4362 case "$usemorebits" in
4363 "$define"|true|[yY]*)
4364         use64bits="$define"
4365         uselongdouble="$define"
4366         usemorebits="$define"
4367         ;;
4368 *)      usemorebits="$undef"
4369         ;;
4370 esac
4371
4372
4373 case "$intsize:$longsize" in
4374 8:*|*:8) cat <<EOM
4375
4376 You have natively 64-bit integers.
4377 EOM
4378    val="$define" ;;
4379 *) cat <<EOM
4380
4381 Perl can be built to take advantage of 64-bit integer types
4382 on some systems.  To do so, Configure must be run with -Duse64bits.
4383
4384 If this doesn't make any sense to you, just accept the default.
4385 EOM
4386   case "$use64bits" in
4387   $define|true|[yY]*)   dflt='y';;
4388   *) dflt='n';;
4389   esac
4390   rp='Try to use 64-bit integers, if available?'
4391   . ./myread
4392   case "$ans" in
4393   y|Y) val="$define" ;;
4394   *)   val="$undef"  ;;
4395   esac
4396   ;;
4397 esac
4398 set use64bits
4399 eval $setvar
4400
4401 case "$archname64" in
4402 '') archname64='' ;;    # not a typo
4403 esac
4404
4405 case "$use64bits" in
4406 "$define"|true|[yY]*)
4407 : Look for a hint-file generated 'call-back-unit'.  If the
4408 : user has specified that a 64-bit perl is to be built,
4409 : we may need to set or change some other defaults.
4410         if $test -f use64bits.cbu; then
4411                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4412                 . ./use64bits.cbu
4413         else
4414                 $cat <<EOM
4415 (Your platform doesn't have any specific hints for 64-bit builds.)
4416 EOM
4417                 case "$intsize:$longsize" in
4418 8:*|*:8) cat <<EOM
4419 (This is probably okay, as your system is a natively 64-bit system.)
4420 EOM
4421                   ;;
4422                 esac
4423                 case "$gccversion" in
4424                 '')     ;;
4425                 *)      case "$ccflags" in
4426                         *-DUSE_LONG_LONG*) ;;
4427                         *) $cat <<EOM
4428 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4429 to the compilation flags.
4430 EOM
4431                            ccflags="$ccflags -DUSE_LONG_LONG"
4432                            ;;
4433                         esac
4434                         ;;
4435                 esac
4436         fi
4437         ;;
4438 esac
4439
4440 : determine the architecture name
4441 echo " "
4442 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4443         tarch=`arch`"-$osname"
4444 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4445         if uname -m > tmparch 2>&1 ; then
4446                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4447                         -e 's/$/'"-$osname/" tmparch`
4448         else
4449                 tarch="$osname"
4450         fi
4451         $rm -f tmparch
4452 else
4453         tarch="$osname"
4454 fi
4455 case "$myarchname" in
4456 ''|"$tarch") ;;
4457 *)
4458         echo "(Your architecture name used to be $myarchname.)"
4459         archname=''
4460         ;;
4461 esac
4462 myarchname="$tarch"
4463 case "$archname" in
4464 '') dflt="$tarch";;
4465 *) dflt="$archname";;
4466 esac
4467 rp='What is your architecture name'
4468 . ./myread
4469 archname="$ans"
4470 case "$usethreads" in
4471 $define)
4472         echo "Threads selected." >&4
4473         case "$archname" in
4474         *-thread*) echo "...and architecture name already has -thread." >&4
4475                 ;;
4476         *)      archname="$archname-thread"
4477                 echo "...setting architecture name to $archname." >&4
4478                 ;;
4479         esac
4480         ;;
4481 esac
4482 case "$usemultiplicity" in
4483 $define)
4484         echo "Multiplicity selected." >&4
4485         case "$archname" in
4486         *-multi*) echo "...and architecture name already has -multi." >&4
4487                 ;;
4488         *)      archname="$archname-multi"
4489                 echo "...setting architecture name to $archname." >&4
4490                 ;;
4491         esac
4492         ;;
4493 esac
4494 case "$use64bits" in
4495 $define)
4496         case "$archname64" in
4497         '')
4498                 ;;
4499         *)
4500                 case "$archname" in
4501                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4502                         ;;
4503                 *)      archname="$archname-$archname64"
4504                         echo "...setting architecture name to $archname." >&4
4505                         ;;
4506                 esac
4507                 ;;
4508         esac
4509 esac
4510
4511 : determine root of directory hierarchy where package will be installed.
4512 case "$prefix" in
4513 '')
4514         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4515         ;;
4516 *)
4517         dflt="$prefix"
4518         ;;
4519 esac
4520 $cat <<EOM
4521
4522 By default, $package will be installed in $dflt/bin, manual pages
4523 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4524 installation directories. Typically this is something like /usr/local.
4525 If you wish to have binaries under /usr/bin but other parts of the
4526 installation under /usr/local, that's ok: you will be prompted
4527 separately for each of the installation directories, the prefix being
4528 only used to set the defaults.
4529
4530 EOM
4531 fn=d~
4532 rp='Installation prefix to use?'
4533 . ./getfile
4534 oldprefix=''
4535 case "$prefix" in
4536 '') ;;
4537 *)
4538         case "$ans" in
4539         "$prefix") ;;
4540         *) oldprefix="$prefix";;
4541         esac
4542         ;;
4543 esac
4544 prefix="$ans"
4545 prefixexp="$ansexp"
4546
4547 : is AFS running?
4548 echo " "
4549 case "$afs" in
4550 $define|true)   afs=true ;;
4551 $undef|false)   afs=false ;;
4552 *)      if test -d /afs; then
4553                 afs=true
4554         else
4555                 afs=false
4556         fi
4557         ;;
4558 esac
4559 if $afs; then
4560         echo "AFS may be running... I'll be extra cautious then..." >&4
4561 else
4562         echo "AFS does not seem to be running..." >&4
4563 fi
4564
4565 : determine installation prefix for where package is to be installed.
4566 if $afs; then 
4567 $cat <<EOM
4568
4569 Since you are running AFS, I need to distinguish the directory in which
4570 files will reside from the directory in which they are installed (and from
4571 which they are presumably copied to the former directory by occult means).
4572
4573 EOM
4574         case "$installprefix" in
4575         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4576         *) dflt="$installprefix";;
4577         esac
4578 else
4579 $cat <<EOM
4580
4581 In some special cases, particularly when building $package for distribution,
4582 it is convenient to distinguish between the directory in which files should 
4583 be installed from the directory ($prefix) in which they 
4584 will eventually reside.  For most users, these two directories are the same.
4585
4586 EOM
4587         case "$installprefix" in
4588         '') dflt=$prefix ;;
4589         *) dflt=$installprefix;;
4590         esac
4591 fi
4592 fn=d~
4593 rp='What installation prefix should I use for installing files?'
4594 . ./getfile
4595 installprefix="$ans"
4596 installprefixexp="$ansexp"
4597
4598 : set the prefixit variable, to compute a suitable default value
4599 prefixit='case "$3" in
4600 ""|none)
4601         case "$oldprefix" in
4602         "") eval "$1=\"\$$2\"";;
4603         *)
4604                 case "$3" in
4605                 "") eval "$1=";;
4606                 none)
4607                         eval "tp=\"\$$2\"";
4608                         case "$tp" in
4609                         ""|" ") eval "$1=\"\$$2\"";;
4610                         *) eval "$1=";;
4611                         esac;;
4612                 esac;;
4613         esac;;
4614 *)
4615         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4616         case "$tp" in
4617         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4618         /*-$oldprefix/*|\~*-$oldprefix/*)
4619                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4620         *) eval "$1=\"\$$2\"";;
4621         esac;;
4622 esac'
4623
4624 : set the base revision
4625 baserev=5.0
4626
4627
4628 : get the patchlevel
4629 echo " "
4630 echo "Getting the current patchlevel..." >&4
4631 if $test -r $rsrc/patchlevel.h;then
4632         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4633         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4634         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4635         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4636         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4637 else
4638         patchlevel=0
4639         subversion=0
4640         api_revision=0
4641         api_version=0
4642         api_subversion=0
4643 fi
4644 $echo $n "(You have $package" $c
4645 case "$package" in
4646 "*$baserev")    ;;
4647 *)              $echo $n " $baserev" $c ;;
4648 esac
4649 $echo $n " patchlevel $patchlevel" $c
4650 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4651 echo ".)"
4652 case "$osname" in
4653 dos|vms)
4654         : XXX Should be a Configure test for double-dots in filenames.
4655         version=`echo $baserev $patchlevel $subversion | \
4656                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4657         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4658                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4659         ;;
4660 *)
4661         version=`echo $baserev $patchlevel $subversion | \
4662                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4663         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4664                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4665         ;;
4666 esac
4667 : Special case the 5.005_xx maintenance series, which used 5.005
4668 : without any subversion label as a subdirectory in $sitelib
4669 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4670         api_versionstring='5.005'
4671 fi
4672
4673 : determine installation style
4674 : For now, try to deduce it from prefix unless it is already set.
4675 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4676 case "$installstyle" in
4677 '')     case "$prefix" in
4678                 *perl*) dflt='lib';;
4679                 *) dflt='lib/perl5' ;;
4680         esac
4681         ;;
4682 *)      dflt='lib/perl5' ;;
4683 esac
4684 : Probably not worth prompting for this since we prompt for all
4685 : the directories individually, and the prompt would be too long and
4686 : confusing anyway.
4687 installstyle=$dflt
4688
4689 : determine where private library files go
4690 : Usual default is /usr/local/lib/perl5/$version.
4691 : Also allow things like /opt/perl/lib/$version, since 
4692 : /opt/perl/lib/perl5... would be redundant.
4693 : The default "style" setting is made in installstyle.U
4694 case "$installstyle" in
4695 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4696 *)       set dflt privlib lib/$version ;;
4697 esac
4698 eval $prefixit
4699 $cat <<EOM
4700
4701 There are some auxiliary files for $package that need to be put into a
4702 private library directory that is accessible by everyone.
4703
4704 EOM
4705 fn=d~+
4706 rp='Pathname where the private library files will reside?'
4707 . ./getfile
4708 privlib="$ans"
4709 privlibexp="$ansexp"
4710 : Change installation prefix, if necessary.
4711 if $test X"$prefix" != X"$installprefix"; then
4712         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4713 else
4714         installprivlib="$privlibexp"
4715 fi
4716
4717 : set the prefixup variable, to restore leading tilda escape
4718 prefixup='case "$prefixexp" in
4719 "$prefix") ;;
4720 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4721 esac'
4722
4723 : determine where public architecture dependent libraries go
4724 set archlib archlib
4725 eval $prefixit
4726 : privlib default is /usr/local/lib/$package/$version
4727 : archlib default is /usr/local/lib/$package/$version/$archname
4728 : privlib may have an optional trailing /share.
4729 tdflt=`echo $privlib | $sed 's,/share$,,'`
4730 tdflt=$tdflt/$archname
4731 case "$archlib" in
4732 '')     dflt=$tdflt
4733         ;;
4734 *)      dflt="$archlib"
4735     ;;
4736 esac
4737 $cat <<EOM
4738
4739 $spackage contains architecture-dependent library files.  If you are
4740 sharing libraries in a heterogeneous environment, you might store
4741 these files in a separate location.  Otherwise, you can just include
4742 them with the rest of the public library files.
4743
4744 EOM
4745 fn=d+~
4746 rp='Where do you want to put the public architecture-dependent libraries?'
4747 . ./getfile
4748 archlib="$ans"
4749 archlibexp="$ansexp"
4750 if $test X"$archlib" = X"$privlib"; then
4751         d_archlib="$undef"
4752 else
4753         d_archlib="$define"
4754 fi
4755 : Change installation prefix, if necessary.
4756 if $test X"$prefix" != X"$installprefix"; then
4757         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4758 else
4759         installarchlib="$archlibexp"
4760 fi
4761
4762
4763 : Binary compatibility with 5.005 is not possible for builds
4764 : with advanced features
4765 case "$usethreads$usemultiplicity" in
4766 *define*)
4767         bincompat5005="$undef"
4768         d_bincompat5005="$undef"
4769         ;;
4770 *)      $cat <<EOM
4771
4772 Perl 5.006 can be compiled for binary compatibility with 5.005.
4773 If you decide to do so, you will be able to continue using most
4774 of the extensions that were compiled for Perl 5.005.
4775
4776 EOM
4777         case "$bincompat5005$d_bincompat5005" in
4778         *"$undef"*) dflt=n ;;
4779         *) dflt=y ;;
4780         esac
4781         rp='Binary compatibility with Perl 5.005?'
4782         . ./myread
4783         case "$ans" in
4784         y*) val="$define" ;;
4785         *)  val="$undef" ;;
4786         esac
4787         set d_bincompat5005
4788         eval $setvar
4789         case "$d_bincompat5005" in
4790         "$define")
4791                 bincompat5005="$define"
4792                 ;;
4793         *)      bincompat5005="$undef"
4794                 d_bincompat5005="$undef"
4795                 ;;
4796         esac
4797         ;;
4798 esac
4799
4800
4801 : see if setuid scripts can be secure
4802 $cat <<EOM
4803
4804 Some kernels have a bug that prevents setuid #! scripts from being
4805 secure.  Some sites have disabled setuid #! scripts because of this.
4806
4807 First let's decide if your kernel supports secure setuid #! scripts.
4808 (If setuid #! scripts would be secure but have been disabled anyway,
4809 don't say that they are secure if asked.)
4810
4811 EOM
4812
4813 val="$undef"
4814 if $test -d /dev/fd; then
4815         echo "#!$ls" >reflect
4816         chmod +x,u+s reflect
4817         ./reflect >flect 2>&1
4818         if $contains "/dev/fd" flect >/dev/null; then
4819                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4820                 val="$define"
4821         else
4822                 $cat <<EOM
4823 If you are not sure if they are secure, I can check but I'll need a
4824 username and password different from the one you are using right now.
4825 If you don't have such a username or don't want me to test, simply
4826 enter 'none'.
4827
4828 EOM
4829                 rp='Other username to test security of setuid scripts with?'
4830                 dflt='none'
4831                 . ./myread
4832                 case "$ans" in
4833                 n|none)
4834                         case "$d_suidsafe" in
4835                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4836                                 dflt=n;;
4837                         "$undef")
4838                                 echo "Well, the $hint value is *not* secure." >&4
4839                                 dflt=n;;
4840                         *)      echo "Well, the $hint value *is* secure." >&4
4841                                 dflt=y;;
4842                         esac
4843                         ;;
4844                 *)
4845                         $rm -f reflect flect
4846                         echo "#!$ls" >reflect
4847                         chmod +x,u+s reflect
4848                         echo >flect
4849                         chmod a+w flect
4850                         echo '"su" will (probably) prompt you for '"$ans's password."
4851                         su $ans -c './reflect >flect'
4852                         if $contains "/dev/fd" flect >/dev/null; then
4853                                 echo "Okay, it looks like setuid scripts are secure." >&4
4854                                 dflt=y
4855                         else
4856                                 echo "I don't think setuid scripts are secure." >&4
4857                                 dflt=n
4858                         fi
4859                         ;;
4860                 esac
4861                 rp='Does your kernel have *secure* setuid scripts?'
4862                 . ./myread
4863                 case "$ans" in
4864                 [yY]*)  val="$define";;
4865                 *)      val="$undef";;
4866                 esac
4867         fi
4868 else
4869         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4870         echo "(That's for file descriptors, not floppy disks.)"
4871         val="$undef"
4872 fi
4873 set d_suidsafe
4874 eval $setvar
4875
4876 $rm -f reflect flect
4877
4878 : now see if they want to do setuid emulation
4879 echo " "
4880 val="$undef"
4881 case "$d_suidsafe" in
4882 "$define")
4883         val="$undef"
4884         echo "No need to emulate SUID scripts since they are secure here." >& 4
4885         ;;
4886 *)
4887         $cat <<EOM
4888 Some systems have disabled setuid scripts, especially systems where
4889 setuid scripts cannot be secure.  On systems where setuid scripts have
4890 been disabled, the setuid/setgid bits on scripts are currently
4891 useless.  It is possible for $package to detect those bits and emulate
4892 setuid/setgid in a secure fashion.  This emulation will only work if
4893 setuid scripts have been disabled in your kernel.
4894
4895 EOM
4896         case "$d_dosuid" in
4897         "$define") dflt=y ;;
4898         *) dflt=n ;;
4899         esac
4900         rp="Do you want to do setuid/setgid emulation?"
4901         . ./myread
4902         case "$ans" in
4903         [yY]*)  val="$define";;
4904         *)      val="$undef";;
4905         esac
4906         ;;
4907 esac
4908 set d_dosuid
4909 eval $setvar
4910
4911 : determine filename position in cpp output
4912 echo " "
4913 echo "Computing filename position in cpp output for #include directives..." >&4
4914 echo '#include <stdio.h>' > foo.c
4915 $cat >fieldn <<EOF
4916 $startsh
4917 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4918 $grep '^[       ]*#.*stdio\.h' | \
4919 while read cline; do
4920         pos=1
4921         set \$cline
4922         while $test \$# -gt 0; do
4923                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4924                         echo "\$pos"
4925                         exit 0
4926                 fi
4927                 shift
4928                 pos=\`expr \$pos + 1\`
4929         done
4930 done
4931 EOF
4932 chmod +x fieldn
4933 fieldn=`./fieldn`
4934 $rm -f foo.c fieldn
4935 case $fieldn in
4936 '') pos='???';;
4937 1) pos=first;;
4938 2) pos=second;;
4939 3) pos=third;;
4940 *) pos="${fieldn}th";;
4941 esac
4942 echo "Your cpp writes the filename in the $pos field of the line."
4943
4944 : locate header file
4945 $cat >findhdr <<EOF
4946 $startsh
4947 wanted=\$1
4948 name=''
4949 for usrincdir in $usrinc
4950 do
4951         if test -f \$usrincdir/\$wanted; then
4952                 echo "\$usrincdir/\$wanted"
4953                 exit 0
4954         fi
4955 done
4956 awkprg='{ print \$$fieldn }'
4957 echo "#include <\$wanted>" > foo\$\$.c
4958 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4959 $grep "^[       ]*#.*\$wanted" | \
4960 while read cline; do
4961         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4962         case "\$name" in
4963         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4964         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4965         *) exit 2;;
4966         esac;
4967 done;
4968 #
4969 # status = 0: grep returned 0 lines, case statement not executed
4970 # status = 1: headerfile found
4971 # status = 2: while loop executed, no headerfile found
4972 #
4973 status=\$?
4974 $rm -f foo\$\$.c;
4975 if test \$status -eq 1; then
4976         exit 0;
4977 fi
4978 exit 1
4979 EOF
4980 chmod +x findhdr
4981
4982 : define an alternate in-header-list? function
4983 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4984 cont=true; xxf="echo \"<\$1> found.\" >&4";
4985 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4986 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4987 esac;
4988 case $# in 4) instead=instead;; *) instead="at last";; esac;
4989 while $test "$cont"; do
4990         xxx=`./findhdr $1`
4991         var=$2; eval "was=\$$2";
4992         if $test "$xxx" && $test -r "$xxx";
4993         then eval $xxf;
4994         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4995                 cont="";
4996         else eval $xxnf;
4997         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4998         set $yyy; shift; shift; yyy=$@;
4999         case $# in 0) cont="";;
5000         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5001                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5002         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5003                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5004         esac;
5005 done;
5006 while $test "$yyy";
5007 do set $yyy; var=$2; eval "was=\$$2";
5008         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5009         set $yyy; shift; shift; yyy=$@;
5010 done'
5011
5012 : see if this is a malloc.h system
5013 set malloc.h i_malloc
5014 eval $inhdr
5015
5016 : see if stdlib is available
5017 set stdlib.h i_stdlib
5018 eval $inhdr
5019
5020 : determine which malloc to compile in
5021 echo " "
5022 case "$usemymalloc" in
5023 ''|[yY]*|true|$define)  dflt='y' ;;
5024 *)      dflt='n' ;;
5025 esac
5026 rp="Do you wish to attempt to use the malloc that comes with $package?"
5027 . ./myread
5028 usemymalloc="$ans"
5029 case "$ans" in
5030 y*|true)
5031         usemymalloc='y'
5032         mallocsrc='malloc.c'
5033         mallocobj="malloc$_o"
5034         d_mymalloc="$define"
5035         case "$libs" in
5036         *-lmalloc*)
5037                 : Remove malloc from list of libraries to use
5038                 echo "Removing unneeded -lmalloc from library list" >&4
5039                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5040                 shift
5041                 libs="$*"
5042                 echo "libs = $libs" >&4
5043                 ;;
5044         esac
5045         ;;
5046 *)
5047         usemymalloc='n'
5048         mallocsrc=''
5049         mallocobj=''
5050         d_mymalloc="$undef"
5051         ;;
5052 esac
5053
5054 : compute the return types of malloc and free
5055 echo " "
5056 $cat >malloc.c <<END
5057 #$i_malloc I_MALLOC
5058 #$i_stdlib I_STDLIB
5059 #include <stdio.h>
5060 #include <sys/types.h>
5061 #ifdef I_MALLOC
5062 #include <malloc.h>
5063 #endif
5064 #ifdef I_STDLIB
5065 #include <stdlib.h>
5066 #endif
5067 #ifdef TRY_MALLOC
5068 void *malloc();
5069 #endif
5070 #ifdef TRY_FREE
5071 void free();
5072 #endif
5073 END
5074 case "$malloctype" in
5075 '')
5076         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5077                 malloctype='void *'
5078         else
5079                 malloctype='char *'
5080         fi
5081         ;;
5082 esac
5083 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5084
5085 case "$freetype" in
5086 '')
5087         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5088                 freetype='void'
5089         else
5090                 freetype='int'
5091         fi
5092         ;;
5093 esac
5094 echo "Your system uses $freetype free(), it would seem." >&4
5095 $rm -f malloc.[co]
5096 $cat <<EOM
5097
5098 The installation process will also create a directory for
5099 vendor-supplied add-ons.  Vendors who supply perl with their system
5100 may find it convenient to place all vendor-supplied files in this
5101 directory rather than in the main distribution directory.  This will
5102 ease upgrades between binary-compatible maintenance versions of perl.
5103
5104 Of course you may also use these directories in whatever way you see
5105 fit.  For example, you might use them to access modules shared over a
5106 company-wide network.
5107
5108 The default answer should be fine for most people.
5109 This causes further questions about vendor add-ons to be skipped
5110 and no vendor-specific directories will be configured for perl.
5111
5112 EOM
5113 rp='Do you want to configure vendor-specific add-on directories?'
5114 case "$usevendorprefix" in
5115 define|true|[yY]*) dflt=y ;;
5116 *) dflt=n ;;
5117 esac
5118 . ./myread
5119 case "$ans" in
5120 [yY]*)  fn=d~+
5121         rp='Installation prefix to use for vendor-supplied add-ons?'
5122         case "$vendorprefix" in
5123         '') dflt='' ;;
5124         *)  dflt=$vendorprefix ;;
5125         esac
5126         . ./getfile
5127         oldvendorprefix=''
5128         case "$vendorprefix" in
5129         '') ;;
5130         *)      case "$ans" in
5131                 "$prefix") ;;
5132                 *) oldvendorprefix="$prefix";;
5133                 esac
5134                 ;;
5135         esac
5136         usevendorprefix="$define"
5137         vendorprefix="$ans"
5138         vendorprefixexp="$ansexp"
5139         ;;
5140 *)      usevendorprefix="$undef"
5141         vendorprefix=''
5142         vendorprefixexp=''
5143         ;;
5144 esac
5145
5146 case "$vendorprefix" in
5147 '')     d_vendorlib="$undef"
5148         vendorlib=''
5149         vendorlibexp=''
5150         ;;
5151 *)      d_vendorlib="$define"
5152         : determine where vendor-supplied modules go.
5153         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5154         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5155         case "$installstyle" in
5156         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5157         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5158         esac
5159         fn=d~+
5160         rp='Pathname for the vendor-supplied library files?'
5161         . ./getfile
5162         vendorlib="$ans"
5163         vendorlibexp="$ansexp"
5164         : Change installation prefix, if necessary.
5165         if $test X"$prefix" != X"$installprefix"; then
5166                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5167         else
5168                 installvendorlib="$vendorlibexp"
5169         fi
5170         ;;
5171 esac
5172
5173 : Cruising for prototypes
5174 echo " "
5175 echo "Checking out function prototypes..." >&4
5176 $cat >prototype.c <<'EOCP'
5177 int main(int argc, char *argv[]) {
5178         exit(0);}
5179 EOCP
5180 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5181         echo "Your C compiler appears to support function prototypes."
5182         val="$define"
5183 else
5184         echo "Your C compiler doesn't seem to understand function prototypes."
5185         val="$undef"
5186 fi
5187 set prototype
5188 eval $setvar
5189 $rm -f prototype*
5190
5191 case "$prototype" in
5192 "$define") ;;
5193 *)      ansi2knr='ansi2knr'
5194         echo " "
5195         cat <<EOM >&4
5196
5197 $me:  FATAL ERROR:
5198 This version of $package can only be compiled by a compiler that 
5199 understands function prototypes.  Unfortunately, your C compiler 
5200         $cc $ccflags
5201 doesn't seem to understand them.  Sorry about that.
5202
5203 If GNU cc is available for your system, perhaps you could try that instead.  
5204
5205 Eventually, we hope to support building Perl with pre-ANSI compilers.
5206 If you would like to help in that effort, please contact <perlbug@perl.org>.
5207
5208 Aborting Configure now.
5209 EOM
5210         exit 2
5211         ;;
5212 esac
5213
5214 : determine where public executables go
5215 echo " "
5216 set dflt bin bin
5217 eval $prefixit
5218 fn=d~
5219 rp='Pathname where the public executables will reside?'
5220 . ./getfile
5221 if $test "X$ansexp" != "X$binexp"; then
5222         installbin=''
5223 fi
5224 bin="$ans"
5225 binexp="$ansexp"
5226 : Change installation prefix, if necessary.
5227 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5228 if $test X"$prefix" != X"$installprefix"; then
5229         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5230 else
5231         installbin="$binexp"
5232 fi
5233
5234 $cat <<EOM
5235
5236 After $package is installed, you may wish to install various
5237 add-on modules and utilities.  Typically, these add-ons will
5238 be installed under $prefix with the rest
5239 of this package.  However, you may wish to install such add-ons
5240 elsewhere under a different prefix.
5241
5242 If you do not wish to put everything under a single prefix, that's
5243 ok.  You will be prompted for the individual locations; this siteprefix
5244 is only used to suggest the defaults.
5245
5246 The default should be fine for most people.
5247
5248 EOM
5249 fn=d~+
5250 rp='Installation prefix to use for add-on modules and utilities?'
5251 : XXX Here might be another good place for an installstyle setting.
5252 case "$siteprefix" in
5253 '') dflt=$prefix ;;
5254 *)  dflt=$siteprefix ;;
5255 esac
5256 . ./getfile
5257 oldsiteprefix=''
5258 case "$siteprefix" in
5259 '') ;;
5260 *)
5261         case "$ans" in
5262         "$prefix") ;;
5263         *) oldsiteprefix="$prefix";;
5264         esac
5265         ;;
5266 esac
5267 siteprefix="$ans"
5268 siteprefixexp="$ansexp"
5269
5270 : determine where site specific libraries go.
5271 : Usual default is /usr/local/lib/perl5/site_perl/$version
5272 : The default "style" setting is made in installstyle.U
5273 : XXX No longer works with Prefixit stuff.
5274 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5275 case "$installstyle" in
5276 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5277 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5278 esac
5279 $cat <<EOM
5280
5281 The installation process will create a directory for
5282 site-specific extensions and modules.  Most users find it convenient
5283 to place all site-specific files in this directory rather than in the
5284 main distribution directory.
5285
5286 EOM
5287 fn=d~+
5288 rp='Pathname for the site-specific library files?'
5289 . ./getfile
5290 sitelib="$ans"
5291 sitelibexp="$ansexp"
5292 : Change installation prefix, if necessary.
5293 if $test X"$prefix" != X"$installprefix"; then
5294         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5295 else
5296         installsitelib="$sitelibexp"
5297 fi
5298
5299 : Determine list of previous versions to include in @INC
5300 $cat > getverlist <<EOPL
5301 #!$perl -w
5302 use File::Basename;
5303 \$api_versionstring = "$api_versionstring";
5304 \$version = "$version";
5305 \$sitelib = "$sitelib";
5306 \$archname = "$archname";
5307 EOPL
5308         $cat >> getverlist <<'EOPL'
5309 # Can't have leading @ because metaconfig interprets it as a command!
5310 ;@inc_version_list=();
5311 $stem=dirname($sitelib);
5312 # Redo to do opendir/readdir? 
5313 if (-d $stem) {
5314     chdir($stem);
5315     ;@candidates = glob("5.*");
5316 }
5317 else {
5318     ;@candidates = ();
5319 }
5320
5321 # XXX ToDo:  These comparisons must be reworked when two-digit
5322 # subversions come along, so that 5.7.10 compares as greater than
5323 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5324 # widespread that we can use the built-in version vectors rather
5325 # than reinventing them here.  For 5.6.0, however, we must
5326 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5327 foreach $d (@candidates) {
5328     if ($d lt $version) {
5329         if ($d ge $api_versionstring) {
5330             unshift(@inc_version_list, "$d/$archname", $d);
5331         }
5332         elsif ($d ge "5.005") {
5333             unshift(@inc_version_list, $d);
5334         }
5335     }
5336     else {
5337         # Skip newer version.  I.e. don't look in
5338         # 5.7.0 if we're installing 5.6.1.
5339     }
5340 }
5341
5342 if (@inc_version_list) {
5343     print join(' ', @inc_version_list);
5344 }
5345 else {
5346     # Blank space to preserve value for next Configure run.
5347     print " ";
5348 }
5349 EOPL
5350 chmod +x getverlist
5351 case "$inc_version_list" in
5352 '')     if test -x $perl; then
5353                 dflt=`$perl getverlist`
5354         else
5355                 dflt='none'
5356         fi
5357         ;;
5358 $undef) dflt='none' ;;
5359 *)  dflt="$inc_version_list" ;;
5360 esac
5361 $cat <<'EOM'
5362
5363 In order to ease the process of upgrading, this version of perl 
5364 can be configured to use modules built and installed with earlier 
5365 versions of perl that were installed under $prefix.  Specify here
5366 the list of earlier versions that this version of perl should check.
5367 If Configure detected no earlier versions of perl installed under
5368 $prefix, then the list will be empty.  Answer 'none' to tell perl
5369 to not search earlier versions.
5370
5371 The default should almost always be sensible, so if you're not sure,
5372 just accept the default.
5373 EOM
5374
5375 rp='List of earlier versions to include in @INC?'
5376 . ./myread
5377 case "$ans" in
5378 [Nn]one) inc_version_list=' ' ;;
5379 *) inc_version_list="$ans" ;;
5380 esac
5381 case "$inc_version_list" in
5382 ''|' ') 
5383         inc_version_list_init='""';;
5384 *)      inc_version_list_init=`echo $inc_version_list |
5385                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/"/'`
5386         ;;
5387 esac
5388 $rm -f getverlist
5389
5390 : determine whether to install perl also as /usr/bin/perl
5391
5392 echo " "
5393 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5394         $cat <<EOM
5395 Many scripts expect to perl to be installed as /usr/bin/perl.
5396 I can install the perl you are about to compile also as /usr/bin/perl
5397 (in addition to $installbin/perl).
5398 EOM
5399         case "$installusrbinperl" in
5400         "$undef"|[nN]*) dflt='n';;
5401         *)              dflt='y';;
5402         esac
5403         rp="Do you want to install perl as /usr/bin/perl?"
5404         . ./myread
5405         case "$ans" in
5406         [yY]*)  val="$define";;
5407         *)      val="$undef" ;;
5408         esac
5409 else
5410         val="$undef"
5411 fi
5412 set installusrbinperl
5413 eval $setvar
5414
5415 echo " "
5416 echo "Checking for GNU C Library..." >&4
5417 cat >gnulibc.c <<EOM
5418 #include <stdio.h>
5419 int main()
5420 {
5421 #ifdef __GLIBC__
5422     exit(0);
5423 #else
5424     exit(1);
5425 #endif
5426 }
5427 EOM
5428 set gnulibc
5429 if eval $compile_ok && ./gnulibc; then
5430         val="$define"
5431         echo "You are using the GNU C Library"
5432 else
5433         val="$undef"
5434         echo "You are not using the GNU C Library"
5435 fi
5436 $rm -f gnulibc*
5437 set d_gnulibc
5438 eval $setvar
5439
5440 : see if nm is to be used to determine whether a symbol is defined or not
5441 case "$usenm" in
5442 '')
5443         dflt=''
5444         case "$d_gnulibc" in
5445         "$define")
5446                 echo " "
5447                 echo "nm probably won't work on the GNU C Library." >&4
5448                 dflt=n
5449                 ;;
5450         esac
5451         case "$dflt" in
5452         '') 
5453                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5454                         echo " "
5455                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5456                         echo "'nm' won't be sufficient on this sytem." >&4
5457                         dflt=n
5458                 fi
5459                 ;;
5460         esac
5461         case "$dflt" in
5462         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5463                 if $test $dflt -gt 20; then
5464                         dflt=y
5465                 else
5466                         dflt=n
5467                 fi
5468                 ;;
5469         esac
5470         ;;
5471 *)
5472         case "$usenm" in
5473         true|$define) dflt=y;;
5474         *) dflt=n;;
5475         esac
5476         ;;
5477 esac
5478 $cat <<EOM
5479
5480 I can use $nm to extract the symbols from your C libraries. This
5481 is a time consuming task which may generate huge output on the disk (up
5482 to 3 megabytes) but that should make the symbols extraction faster. The
5483 alternative is to skip the 'nm' extraction part and to compile a small
5484 test program instead to determine whether each symbol is present. If
5485 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5486 this may be the best solution.
5487
5488 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5489
5490 EOM
5491 rp="Shall I use $nm to extract C symbols from the libraries?"
5492 . ./myread
5493 case "$ans" in
5494 [Nn]*) usenm=false;;
5495 *) usenm=true;;
5496 esac
5497
5498 runnm=$usenm
5499 case "$reuseval" in
5500 true) runnm=false;;
5501 esac
5502
5503 : nm options which may be necessary
5504 case "$nm_opt" in
5505 '') if $test -f /mach_boot; then
5506                 nm_opt=''       # Mach
5507         elif $test -d /usr/ccs/lib; then
5508                 nm_opt='-p'     # Solaris (and SunOS?)
5509         elif $test -f /dgux; then
5510                 nm_opt='-p'     # DG-UX
5511         elif $test -f /lib64/rld; then
5512                 nm_opt='-p'     # 64-bit Irix
5513         else
5514                 nm_opt=''
5515         fi;;
5516 esac
5517
5518 : nm options which may be necessary for shared libraries but illegal
5519 : for archive libraries.  Thank you, Linux.
5520 case "$nm_so_opt" in
5521 '')     case "$myuname" in
5522         *linux*)
5523                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5524                         nm_so_opt='--dynamic'
5525                 fi
5526                 ;;
5527         esac
5528         ;;
5529 esac
5530
5531 case "$runnm" in
5532 true)
5533 : get list of predefined functions in a handy place
5534 echo " "
5535 case "$libc" in
5536 '') libc=unknown
5537         case "$libs" in
5538         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5539         esac
5540         ;;
5541 esac
5542 libnames='';
5543 case "$libs" in
5544 '') ;;
5545 *)  for thislib in $libs; do
5546         case "$thislib" in
5547         -lc|-lc_s)
5548                 : Handle C library specially below.
5549                 ;;
5550         -l*)
5551                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5552                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5553                         :
5554                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5555                         :
5556                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5557                         :
5558                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5559                         :
5560                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5561                         :
5562                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5563                         :
5564                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5565                         :
5566                 else
5567                         try=''
5568                 fi
5569                 libnames="$libnames $try"
5570                 ;;
5571         *) libnames="$libnames $thislib" ;;
5572         esac
5573         done
5574         ;;
5575 esac
5576 xxx=normal
5577 case "$libc" in
5578 unknown)
5579         set /lib/libc.$so
5580         for xxx in $libpth; do
5581                 $test -r $1 || set $xxx/libc.$so
5582                 : The messy sed command sorts on library version numbers.
5583                 $test -r $1 || \
5584                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5585                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5586                                 h
5587                                 s/[0-9][0-9]*/0000&/g
5588                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5589                                 G
5590                                 s/\n/ /' | \
5591                          sort | $sed -e 's/^.* //'`
5592                 eval set \$$#
5593         done
5594         $test -r $1 || set /usr/ccs/lib/libc.$so
5595         $test -r $1 || set /lib/libsys_s$_a
5596         ;;
5597 *)
5598         set blurfl
5599         ;;
5600 esac
5601 if $test -r "$1"; then
5602         echo "Your (shared) C library seems to be in $1."
5603         libc="$1"
5604 elif $test -r /lib/libc && $test -r /lib/clib; then
5605         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5606         xxx=apollo
5607         libc='/lib/clib /lib/libc'
5608         if $test -r /lib/syslib; then
5609                 echo "(Your math library is in /lib/syslib.)"
5610                 libc="$libc /lib/syslib"
5611         fi
5612 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5613         echo "Your C library seems to be in $libc, as you said before."
5614 elif $test -r $incpath/usr/lib/libc$_a; then
5615         libc=$incpath/usr/lib/libc$_a;
5616         echo "Your C library seems to be in $libc.  That's fine."
5617 elif $test -r /lib/libc$_a; then
5618         libc=/lib/libc$_a;
5619         echo "Your C library seems to be in $libc.  You're normal."
5620 else
5621         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5622                 :
5623         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5624                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5625         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5626                 :
5627         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5628                 :
5629         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5630                 :
5631         else
5632                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5633         fi
5634         if $test -r "$tans"; then
5635                 echo "Your C library seems to be in $tans, of all places."
5636                 libc=$tans
5637         else
5638                 libc='blurfl'
5639         fi
5640 fi
5641 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5642         dflt="$libc"
5643         cat <<EOM
5644
5645 If the guess above is wrong (which it might be if you're using a strange
5646 compiler, or your machine supports multiple models), you can override it here.
5647
5648 EOM
5649 else
5650         dflt=''
5651         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5652         cat >&4 <<EOM
5653 I can't seem to find your C library.  I've looked in the following places:
5654
5655 EOM
5656         $sed 's/^/      /' libpath
5657         cat <<EOM
5658
5659 None of these seems to contain your C library. I need to get its name...
5660
5661 EOM
5662 fi
5663 fn=f
5664 rp='Where is your C library?'
5665 . ./getfile
5666 libc="$ans"
5667
5668 echo " "
5669 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5670 set X `cat libnames`
5671 shift
5672 xxx=files
5673 case $# in 1) xxx=file; esac
5674 echo "Extracting names from the following $xxx for later perusal:" >&4
5675 echo " "
5676 $sed 's/^/      /' libnames >&4
5677 echo " "
5678 $echo $n "This may take a while...$c" >&4
5679
5680 for file in $*; do
5681         case $file in
5682         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5683         *) $nm $nm_opt $file 2>/dev/null;;
5684         esac
5685 done >libc.tmp
5686
5687 $echo $n ".$c"
5688 $grep fprintf libc.tmp > libc.ptf
5689 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5690 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5691 xxx='[ADTSIW]'
5692 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5693         eval $xscan;\
5694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5695                 eval $xrun
5696 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5697         eval $xscan;\
5698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5699                 eval $xrun
5700 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5701         eval $xscan;\
5702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5703                 eval $xrun
5704 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5705         eval $xscan;\
5706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5707                 eval $xrun
5708 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5709         eval $xscan;\
5710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5711                 eval $xrun
5712 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5717                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5718         eval $xscan;\
5719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720                 eval $xrun
5721 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5722         eval $xscan;\
5723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724                 eval $xrun
5725 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 else
5750         $nm -p $* 2>/dev/null >libc.tmp
5751         $grep fprintf libc.tmp > libc.ptf
5752         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5753                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5754         then
5755                 nm_opt='-p'
5756                 eval $xrun
5757         else
5758                 echo " "
5759                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5760                 com=''
5761                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5762                         for thisname in $libnames $libc; do
5763                                 $ar t $thisname >>libc.tmp
5764                         done
5765                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5766                         echo "Ok." >&4
5767                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5768                         # Repeat libc to extract forwarders to DLL entries too
5769                         for thisname in $libnames $libc; do
5770                                 $ar tv $thisname >>libc.tmp
5771                                 # Revision 50 of EMX has bug in $ar.
5772                                 # it will not extract forwarders to DLL entries
5773                                 # Use emximp which will extract exactly them.
5774                                 emximp -o tmp.imp $thisname \
5775                                     2>/dev/null && \
5776                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5777                                     < tmp.imp >>libc.tmp
5778                                 $rm tmp.imp
5779                         done
5780                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5781                         echo "Ok." >&4
5782                 else
5783                         echo "$ar didn't seem to work right." >&4
5784                         echo "Maybe this is a Cray...trying bld instead..." >&4
5785                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5786                         then
5787                                 for thisname in $libnames; do
5788                                         bld t $libnames | \
5789                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5790                                         $ar t $thisname >>libc.tmp
5791                                 done
5792                                 echo "Ok." >&4
5793                         else
5794                                 echo "That didn't work either.  Giving up." >&4
5795                                 exit 1
5796                         fi
5797                 fi
5798         fi
5799 fi
5800 nm_extract="$com"
5801 if $test -f /lib/syscalls.exp; then
5802         echo " "
5803         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5804         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5805 fi
5806 ;;
5807 esac
5808 $rm -f libnames libpath
5809
5810 : see if dld is available
5811 set dld.h i_dld
5812 eval $inhdr
5813
5814 : is a C symbol defined?
5815 csym='tlook=$1;
5816 case "$3" in
5817 -v) tf=libc.tmp; tc=""; tdc="";;
5818 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5819 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5820 esac;
5821 tx=yes;
5822 case "$reuseval-$4" in
5823 true-) ;;
5824 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5825 esac;
5826 case "$tx" in
5827 yes)
5828         case "$runnm" in
5829         true)
5830                 if $contains $tlook $tf >/dev/null 2>&1;
5831                 then tval=true;
5832                 else tval=false;
5833                 fi;;
5834         *)
5835                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5836                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5837                 then tval=true;
5838                 else tval=false;
5839                 fi;
5840                 $rm -f t t.c;;
5841         esac;;
5842 *)
5843         case "$tval" in
5844         $define) tval=true;;
5845         *) tval=false;;
5846         esac;;
5847 esac;
5848 eval "$2=$tval"'
5849
5850 : define an is-in-libc? function
5851 inlibc='echo " "; td=$define; tu=$undef;
5852 sym=$1; var=$2; eval "was=\$$2";
5853 tx=yes;
5854 case "$reuseval$was" in
5855 true) ;;
5856 true*) tx=no;;
5857 esac;
5858 case "$tx" in
5859 yes)
5860         set $sym tres -f;
5861         eval $csym;
5862         case "$tres" in
5863         true)
5864                 echo "$sym() found." >&4;
5865                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5866         *)
5867                 echo "$sym() NOT found." >&4;
5868                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5869         esac;;
5870 *)
5871         case "$was" in
5872         $define) echo "$sym() found." >&4;;
5873         *) echo "$sym() NOT found." >&4;;
5874         esac;;
5875 esac'
5876
5877 : see if dlopen exists
5878 xxx_runnm="$runnm"
5879 runnm=false
5880 set dlopen d_dlopen
5881 eval $inlibc
5882 runnm="$xxx_runnm"
5883
5884 : determine which dynamic loading, if any, to compile in
5885 echo " "
5886 dldir="ext/DynaLoader"
5887 case "$usedl" in
5888 $define|y|true)
5889         dflt='y'
5890         usedl="$define"
5891         ;;
5892 $undef|n|false)
5893         dflt='n'
5894         usedl="$undef"
5895         ;;
5896 *) 
5897         dflt='n'
5898         case "$d_dlopen" in
5899             $define) dflt='y' ;;
5900         esac
5901         case "$i_dld" in
5902             $define) dflt='y' ;;
5903         esac
5904         : Does a dl_xxx.xs file exist for this operating system
5905         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5906         ;;
5907 esac
5908 rp="Do you wish to use dynamic loading?"
5909 . ./myread
5910 usedl="$ans"
5911 case "$ans" in
5912 y*) usedl="$define"
5913         case "$dlsrc" in
5914         '')
5915                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5916                         dflt="$dldir/dl_${osname}.xs"
5917                 elif $test "$d_dlopen" = "$define" ; then
5918                         dflt="$dldir/dl_dlopen.xs"
5919                 elif $test "$i_dld" = "$define" ; then
5920                         dflt="$dldir/dl_dld.xs"
5921                 else
5922                         dflt=''
5923                 fi
5924                 ;;
5925         *)      dflt="$dldir/$dlsrc"
5926                 ;;
5927         esac
5928     echo "The following dynamic loading files are available:"
5929         : Can not go over to $dldir because getfile has path hard-coded in.
5930         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5931         rp="Source file to use for dynamic loading"
5932         fn="fne"
5933         gfpth="$src"
5934         . ./getfile
5935         usedl="$define"
5936         : emulate basename
5937         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5938
5939         $cat << EOM
5940
5941 Some systems may require passing special flags to $cc -c to
5942 compile modules that will be used to create a shared library.
5943 To use no flags, say "none".
5944
5945 EOM
5946     case "$cccdlflags" in
5947     '') case "$gccversion" in
5948                 '') case "$osname" in
5949                         hpux)   dflt='+z' ;;
5950                         next)   dflt='none' ;;
5951                         irix*)  dflt='-KPIC' ;;
5952                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5953                         sunos)  dflt='-pic' ;;
5954                         *)      dflt='none' ;;
5955                     esac
5956                         ;;
5957                 *)  case "$osname" in
5958                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5959                         *)      dflt='-fpic' ;;
5960                     esac ;;
5961             esac ;;
5962         ' ') dflt='none' ;;
5963     *)  dflt="$cccdlflags" ;;
5964     esac
5965     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5966     . ./myread
5967     case "$ans" in
5968     none) cccdlflags=' ' ;;
5969     *) cccdlflags="$ans" ;;
5970     esac
5971
5972     cat << EOM
5973
5974 Some systems use ld to create libraries that can be dynamically loaded,
5975 while other systems (such as those using ELF) use $cc.
5976
5977 EOM
5978         case "$ld" in
5979         '')     $cat >try.c <<'EOM'
5980 /* Test for whether ELF binaries are produced */
5981 #include <fcntl.h>
5982 #include <stdlib.h>
5983 int main() {
5984         char b[4];
5985         int i = open("a.out",O_RDONLY);
5986         if(i == -1) 
5987                 exit(1); /* fail */
5988         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5989                 exit(0); /* succeed (yes, it's ELF) */
5990         else
5991                 exit(1); /* fail */
5992 }
5993 EOM
5994                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5995                         cat <<EOM
5996 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5997 EOM
5998                         dflt="$cc"
5999                 else
6000                         echo "I'll use ld to build dynamic libraries."
6001                         dflt='ld'
6002                 fi
6003                 rm -f try.c a.out
6004                 ;;
6005         *)      dflt="$ld"
6006                 ;;
6007         esac
6008
6009     rp="What command should be used to create dynamic libraries?"
6010     . ./myread
6011         ld="$ans"
6012
6013     cat << EOM
6014
6015 Some systems may require passing special flags to $ld to create a
6016 library that can be dynamically loaded.  If your ld flags include
6017 -L/other/path options to locate libraries outside your loader's normal
6018 search path, you may need to specify those -L options here as well.  To
6019 use no flags, say "none".
6020
6021 EOM
6022     case "$lddlflags" in
6023     '') case "$osname" in
6024                         beos) dflt='-nostart' ;;
6025                         hpux)  dflt='-b' ;;
6026                         linux|irix*)    dflt='-shared' ;;
6027                         next)  dflt='none' ;;
6028                         solaris) dflt='-G' ;;
6029                         sunos) dflt='-assert nodefinitions' ;;
6030                         svr4*|esix*) dflt="-G $ldflags" ;;
6031                 *)     dflt='none' ;;
6032                         esac
6033                         ;;
6034     *) dflt="$lddlflags" ;;
6035     esac
6036
6037         : Try to guess additional flags to pick up local libraries.
6038         : Be careful not to append to a plain 'none'
6039         case "$dflt" in
6040         none) dflt='' ;;
6041         esac
6042         for thisflag in $ldflags; do
6043                 case "$thisflag" in
6044                 -L*)
6045                         case " $dflt " in
6046                         *" $thisflag "*) ;;
6047                         *) dflt="$dflt $thisflag" ;;
6048                         esac
6049                         ;;
6050                 esac
6051         done
6052
6053         case "$dflt" in
6054         ''|' ') dflt='none' ;;
6055         esac
6056
6057     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6058     . ./myread
6059     case "$ans" in
6060     none) lddlflags=' ' ;;
6061     *) lddlflags="$ans" ;;
6062     esac
6063
6064         cat <<EOM
6065
6066 Some systems may require passing special flags to $cc to indicate that
6067 the resulting executable will use dynamic linking.  To use no flags,
6068 say "none".
6069
6070 EOM
6071     case "$ccdlflags" in
6072     '') case "$osname" in
6073                 hpux)   dflt='-Wl,-E' ;;
6074                 linux)  dflt='-rdynamic' ;;
6075                 next)   dflt='none' ;;
6076                 sunos)  dflt='none' ;;
6077                 *)      dflt='none' ;;
6078             esac ;;
6079     ' ')  dflt='none' ;;
6080     *)  dflt="$ccdlflags" ;;
6081     esac
6082     rp="Any special flags to pass to $cc to use dynamic linking?"
6083     . ./myread
6084     case "$ans" in
6085     none) ccdlflags=' ' ;;
6086     *) ccdlflags="$ans" ;;
6087     esac
6088     ;;
6089 *)  usedl="$undef"
6090         ld='ld'
6091     dlsrc='dl_none.xs'
6092     lddlflags=''
6093     ccdlflags=''
6094     ;;
6095 esac
6096
6097 also=''
6098 case "$usedl" in
6099 $undef)
6100         # No dynamic loading being used, so don't bother even to prompt.
6101         useshrplib='false'
6102         ;;
6103 *)      case "$useshrplib" in
6104         '')     case "$osname" in
6105                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6106                         dflt=y
6107                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6108                         ;;
6109                 next*)
6110                         case "$osvers" in
6111                         4*)     dflt=y
6112                                 also='Building a shared libperl is needed for MAB support.'
6113                                 ;;
6114                         *)      dflt=n
6115                                 ;;
6116                         esac
6117                         ;;
6118                 *)      dflt=n
6119                         ;;
6120                 esac
6121                 ;;
6122         $define|true|[Yy]*)
6123                 dflt=y
6124                 ;;
6125         *)      dflt=n
6126                 ;;
6127         esac
6128         $cat << EOM
6129
6130 The perl executable is normally obtained by linking perlmain.c with
6131 libperl${_a}, any static extensions (usually just DynaLoader), and
6132 any other libraries needed on this system (such as -lm, etc.).  Since
6133 your system supports dynamic loading, it is probably possible to build
6134 a shared libperl.$so.  If you will have more than one executable linked
6135 to libperl.$so, this will significantly reduce the size of each
6136 executable, but it may have a noticeable affect on performance.  The
6137 default is probably sensible for your system.
6138 $also
6139
6140 EOM
6141         rp="Build a shared libperl.$so (y/n)"
6142         . ./myread
6143         case "$ans" in
6144         true|$define|[Yy]*)
6145                 useshrplib='true'  ;;
6146         *)      useshrplib='false' ;;
6147         esac
6148         ;;
6149 esac
6150
6151 case "$useshrplib" in
6152 true)
6153         case "$libperl" in
6154         '')
6155                 # Figure out a good name for libperl.so.  Since it gets stored in
6156                 # a version-specific architecture-dependent library, the version
6157                 # number isn't really that important, except for making cc/ld happy.
6158                 #
6159                 # A name such as libperl.so.3.1
6160                 majmin="libperl.$so.$patchlevel.$subversion"
6161                 # A name such as libperl.so.301
6162                 majonly=`echo $patchlevel $subversion |
6163                         $awk '{printf "%d%02d", $1, $2}'`
6164                 majonly=libperl.$so.$majonly
6165                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6166                 # rely on figuring it out from the naming of libc.
6167                 case "${osname}${osvers}" in
6168                 next4*)
6169                         dflt=libperl.5.$so
6170                         # XXX How handle the --version stuff for MAB?
6171                         ;;
6172                 linux*)  # ld won't link with a bare -lperl otherwise.
6173                         dflt=libperl.$so
6174                         ;;
6175                 cygwin*) # include version
6176                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6177                         ;;
6178                 *)      # Try to guess based on whether libc has major.minor.
6179                         case "$libc" in
6180                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6181                         *libc.$so.[0-9]*) dflt=$majonly ;;
6182                         *)      dflt=libperl.$so ;;
6183                         esac
6184                         ;;
6185                 esac
6186                 ;;
6187         *)      dflt=$libperl
6188                 ;;
6189         esac
6190         cat << EOM
6191
6192 I need to select a good name for the shared libperl.  If your system uses
6193 library names with major and minor numbers, then you might want something
6194 like $majmin.  Alternatively, if your system uses a single version
6195 number for shared libraries, then you might want to use $majonly.
6196 Or, your system might be quite happy with a simple libperl.$so.
6197
6198 Since the shared libperl will get installed into a version-specific
6199 architecture-dependent directory, the version number of the shared perl
6200 library probably isn't important, so the default should be o.k.
6201
6202 EOM
6203         rp='What name do you want to give to the shared libperl?'
6204         . ./myread
6205         libperl=$ans
6206         echo "Ok, I'll use $libperl"
6207         ;;
6208 *)
6209         libperl="libperl${_a}"
6210         ;;
6211 esac
6212
6213 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6214 case "$shrpdir" in
6215 '') ;;
6216 *)      $cat >&4 <<EOM
6217 WARNING:  Use of the shrpdir variable for the installation location of
6218 the shared $libperl is not supported.  It was never documented and
6219 will not work in this version.  Let me (perlbug@perl.com)
6220 know of any problems this may cause.
6221
6222 EOM
6223         case "$shrpdir" in
6224         "$archlibexp/CORE")
6225                 $cat >&4 <<EOM
6226 But your current setting of $shrpdir is
6227 the default anyway, so it's harmless.
6228 EOM
6229                 ;;
6230         *)
6231                 $cat >&4 <<EOM
6232 Further, your current attempted setting of $shrpdir
6233 conflicts with the value of $archlibexp/CORE
6234 that installperl will use.
6235 EOM
6236                 ;;
6237         esac
6238         ;;
6239 esac
6240
6241 # How will the perl executable find the installed shared $libperl?
6242 # Add $xxx to ccdlflags.
6243 # If we can't figure out a command-line option, use $shrpenv to
6244 # set env LD_RUN_PATH.  The main perl makefile uses this.
6245 shrpdir=$archlibexp/CORE
6246 xxx=''
6247 tmp_shrpenv=''
6248 if "$useshrplib"; then
6249     case "$osname" in 
6250         aix)
6251                 # We'll set it in Makefile.SH...
6252                 ;;
6253         solaris|netbsd)
6254                 xxx="-R $shrpdir"
6255                 ;;
6256         freebsd)
6257                 xxx="-Wl,-R$shrpdir"
6258                 ;;
6259         linux|irix*|dec_osf)
6260                 xxx="-Wl,-rpath,$shrpdir"
6261                 ;;
6262         next)
6263                 # next doesn't like the default...
6264                 ;;
6265         beos)
6266                 # beos doesn't like the default, either.
6267                 ;;
6268         hpux*)
6269                 # hpux doesn't like the default, either.
6270                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6271                 ;;
6272         *)
6273                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6274                 ;;
6275         esac
6276         case "$xxx" in
6277         '') ;;
6278         *)      
6279                 # Only add $xxx if it isn't already in ccdlflags.
6280                 case " $ccdlflags " in
6281                 *" $xxx "*)     ;;
6282                 *)      ccdlflags="$ccdlflags $xxx"
6283                         cat <<EOM >&4
6284
6285 Adding $xxx to the flags
6286 passed to $ld so that the perl executable will find the 
6287 installed shared $libperl.
6288
6289 EOM
6290                         ;;
6291                 esac
6292                 ;;
6293         esac
6294 fi
6295 # Fix ccdlflags in AIX for building external extensions.
6296 # (For building Perl itself bare -bE:perl.exp is needed,
6297 #  Makefile.SH takes care of this.)
6298 case "$osname" in
6299 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6300 esac
6301 # Respect a hint or command-line value.
6302 case "$shrpenv" in
6303 '') shrpenv="$tmp_shrpenv" ;;
6304 esac
6305 case "$ldlibpthname" in
6306 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6307 none)   ldlibpthname='' ;;
6308 esac
6309
6310 : determine where manual pages go
6311 set man1dir man1dir none
6312 eval $prefixit
6313 $cat <<EOM
6314
6315 $spackage has manual pages available in source form.
6316 EOM
6317 case "$nroff" in
6318 nroff)
6319         echo "However, you don't have nroff, so they're probably useless to you."
6320         case "$man1dir" in
6321         '') man1dir="none";;
6322         esac;;
6323 esac
6324 echo "If you don't want the manual sources installed, answer 'none'."
6325 case "$man1dir" in
6326 ' ') dflt=none
6327         ;;
6328 '')
6329         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6330         lookpath="$lookpath $prefixexp/man/p_man/man1"
6331         lookpath="$lookpath $prefixexp/man/u_man/man1"
6332         lookpath="$lookpath $prefixexp/man/man.1"
6333         case "$sysman" in
6334         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6335         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6336         esac
6337         set dflt
6338         eval $prefixup
6339         ;;
6340 *)  dflt="$man1dir"
6341         ;;
6342 esac
6343 echo " "
6344 fn=dn+~
6345 rp="Where do the main $spackage manual pages (source) go?"
6346 . ./getfile
6347 if $test "X$man1direxp" != "X$ansexp"; then
6348         installman1dir=''
6349 fi
6350 man1dir="$ans"
6351 man1direxp="$ansexp"
6352 case "$man1dir" in
6353 '')     man1dir=' '
6354         installman1dir='';;
6355 esac
6356
6357 : Change installation prefix, if necessary.
6358 if $test X"$prefix" != X"$installprefix"; then
6359         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6360 else
6361         installman1dir="$man1direxp"
6362 fi
6363
6364 : What suffix to use on installed man pages
6365
6366 case "$man1dir" in
6367 ' ')
6368         man1ext='0'
6369         ;;
6370 *)
6371         rp="What suffix should be used for the main $spackage man pages?"
6372         case "$man1ext" in
6373         '')     case "$man1dir" in
6374                 *1)  dflt=1 ;;
6375                 *1p) dflt=1p ;;
6376                 *1pm) dflt=1pm ;;
6377                 *l) dflt=l;;
6378                 *n) dflt=n;;
6379                 *o) dflt=o;;
6380                 *p) dflt=p;;
6381                 *C) dflt=C;;
6382                 *L) dflt=L;;
6383                 *L1) dflt=L1;;
6384                 *) dflt=1;;
6385                 esac
6386                 ;;
6387         *)      dflt="$man1ext";;
6388         esac
6389         . ./myread
6390         man1ext="$ans"
6391         ;;
6392 esac
6393
6394 : see if we can have long filenames
6395 echo " "
6396 rmlist="$rmlist /tmp/cf$$"
6397 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6398 first=123456789abcdef
6399 second=/tmp/cf$$/$first
6400 $rm -f $first $second
6401 if (echo hi >$first) 2>/dev/null; then
6402         if $test -f 123456789abcde; then
6403                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6404                 val="$undef"
6405         else
6406                 if (echo hi >$second) 2>/dev/null; then
6407                         if $test -f /tmp/cf$$/123456789abcde; then
6408                                 $cat <<'EOM'
6409 That's peculiar... You can have filenames longer than 14 characters, but only
6410 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6411 I shall consider your system cannot support long filenames at all.
6412 EOM
6413                                 val="$undef"
6414                         else
6415                                 echo 'You can have filenames longer than 14 characters.' >&4
6416                                 val="$define"
6417                         fi
6418                 else
6419                         $cat <<'EOM'
6420 How confusing! Some of your filesystems are sane enough to allow filenames
6421 longer than 14 characters but some others like /tmp can't even think about them.
6422 So, for now on, I shall assume your kernel does not allow them at all.
6423 EOM
6424                         val="$undef"
6425                 fi
6426         fi
6427 else
6428         $cat <<'EOM'
6429 You can't have filenames longer than 14 chars.  You can't even think about them!
6430 EOM
6431         val="$undef"
6432 fi 
6433 set d_flexfnam
6434 eval $setvar
6435 $rm -rf /tmp/cf$$ 123456789abcde*
6436
6437 : determine where library module manual pages go
6438 set man3dir man3dir none
6439 eval $prefixit
6440 $cat <<EOM
6441
6442 $spackage has manual pages for many of the library modules.
6443 EOM
6444
6445 case "$nroff" in
6446 nroff)
6447         $cat <<'EOM'
6448 However, you don't have nroff, so they're probably useless to you.
6449 EOM
6450         case "$man3dir" in
6451         '') man3dir="none";;
6452         esac;;
6453 esac
6454
6455 case "$d_flexfnam" in
6456 undef)
6457         $cat <<'EOM'
6458 However, your system can't handle the long file names like File::Basename.3. 
6459 EOM
6460         case "$man3dir" in
6461         '') man3dir="none";;
6462         esac;;
6463 esac
6464
6465 echo "If you don't want the manual sources installed, answer 'none'."
6466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467 case "$man3dir" in
6468 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6469         if $test -d "$privlib/man/man3"; then
6470                 cat <<EOM >&4
6471
6472 WARNING:  Previous versions of perl installed man3 pages into
6473 $privlib/man/man3.  This version will suggest a 
6474 new default of $dflt.  
6475 EOM
6476                 tdflt=$dflt
6477                 dflt='n'
6478                 rp='Do you wish to preserve the old behavior?(y/n)'
6479                 . ./myread
6480                 case "$ans" in
6481                 y*) dflt="$privlib/man/man3" ;;
6482                 *)  dflt=$tdflt ;;
6483                 esac
6484     fi
6485         ;;
6486 ' ') dflt=none;;
6487 *)      dflt="$man3dir" ;;
6488 esac
6489 echo " "
6490 fn=dn+~
6491 rp="Where do the $package library man pages (source) go?"
6492 . ./getfile
6493 man3dir="$ans"
6494 man3direxp="$ansexp"
6495 case "$man1dir" in
6496 '')     man3dir=' '
6497         installman3dir='';;
6498 esac
6499
6500 : Change installation prefix, if necessary.
6501 if $test X"$prefix" != X"$installprefix"; then
6502         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6503 else
6504         installman3dir="$man3direxp"
6505 fi
6506
6507 : What suffix to use on installed man pages
6508 case "$man3dir" in
6509 ' ')
6510         man3ext='0'
6511         ;;
6512 *)
6513         rp="What suffix should be used for the $package library man pages?"
6514         case "$man3ext" in
6515         '')     case "$man3dir" in
6516                 *3)  dflt=3 ;;
6517                 *3p) dflt=3p ;;
6518                 *3pm) dflt=3pm ;;
6519                 *l) dflt=l;;
6520                 *n) dflt=n;;
6521                 *o) dflt=o;;
6522                 *p) dflt=p;;
6523                 *C) dflt=C;;
6524                 *L) dflt=L;;
6525                 *L3) dflt=L3;;
6526                 *) dflt=3;;
6527                 esac
6528                 ;;
6529         *)      dflt="$man3ext";;
6530         esac
6531         . ./myread
6532         man3ext="$ans"
6533         ;;
6534 esac
6535
6536 : see if we have to deal with yellow pages, now NIS.
6537 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6538         if $test -f /usr/etc/nibindd; then
6539                 echo " "
6540                 echo "I'm fairly confident you're on a NeXT."
6541                 echo " "
6542                 rp='Do you get the hosts file via NetInfo?'
6543                 dflt=y
6544                 case "$hostcat" in
6545                 nidump*) ;;
6546                 '') ;;
6547                 *) dflt=n;;
6548                 esac
6549                 . ./myread
6550                 case "$ans" in
6551                 y*) hostcat='nidump hosts .';;
6552                 *)      case "$hostcat" in
6553                         nidump*) hostcat='';;
6554                         esac
6555                         ;;
6556                 esac
6557         fi
6558         case "$hostcat" in
6559         nidump*) ;;
6560         *)
6561                 case "$hostcat" in
6562                 *ypcat*) dflt=y;;
6563                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6564                                 dflt=y
6565                         else
6566                                 dflt=n
6567                         fi;;
6568                 *) dflt=n;;
6569                 esac
6570                 echo " "
6571                 rp='Are you getting the hosts file via yellow pages?'
6572                 . ./myread
6573                 case "$ans" in
6574                 y*) hostcat='ypcat hosts';;
6575                 *) hostcat='cat /etc/hosts';;
6576                 esac
6577                 ;;
6578         esac
6579 fi
6580 case "$hostcat" in
6581 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6582 esac
6583 case "$groupcat" in
6584 '') test -f /etc/group && groupcat='cat /etc/group';;
6585 esac
6586 case "$passcat" in
6587 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6588 esac
6589
6590 : now get the host name
6591 echo " "
6592 echo "Figuring out host name..." >&4
6593 case "$myhostname" in
6594 '') cont=true
6595         echo 'Maybe "hostname" will work...'
6596         if tans=`sh -c hostname 2>&1` ; then
6597                 myhostname=$tans
6598                 phostname=hostname
6599                 cont=''
6600         fi
6601         ;;
6602 *) cont='';;
6603 esac
6604 if $test "$cont"; then
6605         if ./xenix; then
6606                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6607                 if tans=`cat /etc/systemid 2>&1` ; then
6608                         myhostname=$tans
6609                         phostname='cat /etc/systemid'
6610                         echo "Whadyaknow.  Xenix always was a bit strange..."
6611                         cont=''
6612                 fi
6613         elif $test -r /etc/systemid; then
6614                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6615         fi
6616 fi
6617 if $test "$cont"; then
6618         echo 'No, maybe "uuname -l" will work...'
6619         if tans=`sh -c 'uuname -l' 2>&1` ; then
6620                 myhostname=$tans
6621                 phostname='uuname -l'
6622         else
6623                 echo 'Strange.  Maybe "uname -n" will work...'
6624                 if tans=`sh -c 'uname -n' 2>&1` ; then
6625                         myhostname=$tans
6626                         phostname='uname -n'
6627                 else
6628                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6629                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6630                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6631                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6632                         else
6633                                 case "$myhostname" in
6634                                 '') echo "Does this machine have an identity crisis or something?"
6635                                         phostname='';;
6636                                 *)
6637                                         echo "Well, you said $myhostname before..."
6638                                         phostname='echo $myhostname';;
6639                                 esac
6640                         fi
6641                 fi
6642         fi
6643 fi
6644 : you do not want to know about this
6645 set $myhostname
6646 myhostname=$1
6647
6648 : verify guess
6649 if $test "$myhostname" ; then
6650         dflt=y
6651         rp='Your host name appears to be "'$myhostname'".'" Right?"
6652         . ./myread
6653         case "$ans" in
6654         y*) ;;
6655         *) myhostname='';;
6656         esac
6657 fi
6658
6659 : bad guess or no guess
6660 while $test "X$myhostname" = X ; do
6661         dflt=''
6662         rp="Please type the (one word) name of your host:"
6663         . ./myread
6664         myhostname="$ans"
6665 done
6666
6667 : translate upper to lower if necessary
6668 case "$myhostname" in
6669 *[A-Z]*)
6670         echo "(Normalizing case in your host name)"
6671         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6672         ;;
6673 esac
6674
6675 case "$myhostname" in
6676 *.*)
6677         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6678         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6679         echo "(Trimming domain name from host name--host name is now $myhostname)"
6680         ;;
6681 *) case "$mydomain" in
6682         '')
6683                 {
6684                         test "X$hostcat" = "Xypcat hosts" &&
6685                         ypmatch "$myhostname" hosts 2>/dev/null |\
6686                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6687                         $test -s hosts
6688                 } || {
6689                         test "X$hostcat" != "X" &&
6690                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6691                                         /[       ]$myhostname[  . ]/p" > hosts
6692                 }
6693                 tmp_re="[       . ]"
6694                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6695                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6696                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6697                         hosts | $sort | $uniq | \
6698                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6699                 case `$echo X$dflt` in
6700                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6701                         dflt=.
6702                         ;;
6703                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6704                         ;;
6705                 esac
6706                 case "$dflt" in
6707                 .)
6708                         tans=`./loc resolv.conf X /etc /usr/etc`
6709                         if $test -f "$tans"; then
6710                                 echo "(Attempting domain name extraction from $tans)"
6711                                 dflt=.`$sed -n -e 's/   / /g' \
6712                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6713                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6714                                 case "$dflt" in
6715                                 .) dflt=.`$sed -n -e 's/        / /g' \
6716                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6717                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6718                                         ;;
6719                                 esac
6720                         fi
6721                         ;;
6722                 esac
6723                 case "$dflt" in
6724                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6725                         dflt=.`sh -c domainname 2>/dev/null`
6726                         case "$dflt" in
6727                         '') dflt='.';;
6728                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6729                         esac
6730                         ;;
6731                 esac
6732                 case "$dflt" in
6733                 .) echo "(Lost all hope -- silly guess then)"
6734                         dflt='.uucp'
6735                         ;;
6736                 esac
6737                 $rm -f hosts
6738                 ;;
6739         *) dflt="$mydomain";;
6740         esac;;
6741 esac
6742 echo " "
6743 rp="What is your domain name?"
6744 . ./myread
6745 tans="$ans"
6746 case "$ans" in
6747 '') ;;
6748 .*) ;;
6749 *) tans=".$tans";;
6750 esac
6751 mydomain="$tans"
6752
6753 : translate upper to lower if necessary
6754 case "$mydomain" in
6755 *[A-Z]*)
6756         echo "(Normalizing case in your domain name)"
6757         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6758         ;;
6759 esac
6760
6761 : a little sanity check here
6762 case "$phostname" in
6763 '') ;;
6764 *)
6765         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6766         $myhostname$mydomain|$myhostname) ;;
6767         *)
6768                 case "$phostname" in
6769                 sed*)
6770                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6771                         ;;
6772                 *)
6773                         echo "(That doesn't agree with your $phostname command, by the way.)"
6774                         ;;
6775                 esac
6776         ;;
6777         esac
6778         ;;
6779 esac
6780
6781 $cat <<EOM
6782
6783 I need to get your e-mail address in Internet format if possible, i.e.
6784 something like user@host.domain. Please answer accurately since I have
6785 no easy means to double check it. The default value provided below
6786 is most probably close to reality but may not be valid from outside
6787 your organization...
6788
6789 EOM
6790 cont=x
6791 while test "$cont"; do
6792         case "$cf_email" in
6793         '') dflt="$cf_by@$myhostname$mydomain";;
6794         *) dflt="$cf_email";;
6795         esac
6796         rp='What is your e-mail address?'
6797         . ./myread
6798         cf_email="$ans"
6799         case "$cf_email" in
6800         *@*.*) cont='' ;;
6801         *)
6802                 rp='Address does not look like an Internet one.  Use it anyway?'
6803                 case "$fastread" in
6804                 yes) dflt=y ;;
6805                 *) dflt=n ;;
6806                 esac
6807                 . ./myread
6808                 case "$ans" in
6809                 y*) cont='' ;;
6810                 *) echo " " ;;
6811                 esac
6812                 ;;
6813         esac
6814 done
6815
6816 $cat <<EOM
6817
6818 If you or somebody else will be maintaining perl at your site, please
6819 fill in the correct e-mail address here so that they may be contacted
6820 if necessary. Currently, the "perlbug" program included with perl
6821 will send mail to this address in addition to perlbug@perl.com. You may
6822 enter "none" for no administrator.
6823
6824 EOM
6825 case "$perladmin" in
6826 '') dflt="$cf_email";;
6827 *) dflt="$perladmin";;
6828 esac
6829 rp='Perl administrator e-mail address'
6830 . ./myread
6831 perladmin="$ans"
6832
6833 : figure out how to guarantee perl startup
6834 case "$startperl" in
6835 '')
6836         case "$sharpbang" in
6837         *!)
6838                 $cat <<EOH
6839
6840 I can use the #! construct to start perl on your system. This will
6841 make startup of perl scripts faster, but may cause problems if you
6842 want to share those scripts and perl is not in a standard place
6843 ($binexp/perl) on all your platforms. The alternative is to force
6844 a shell by starting the script with a single ':' character.
6845
6846 EOH
6847                 dflt="$binexp/perl"
6848                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6849                 . ./myread
6850                 case "$ans" in
6851                 none)   startperl=": # use perl";;
6852                 *)      startperl="#!$ans"
6853                         if $test 30 -lt `echo "$ans" | wc -c`; then
6854                                 $cat >&4 <<EOM
6855
6856 WARNING:  Some systems limit the #! command to 32 characters.
6857 If you experience difficulty running Perl scripts with #!, try
6858 installing Perl in a directory with a shorter pathname.
6859
6860 EOM
6861                         fi ;;
6862                 esac
6863                 ;;
6864         *) startperl=": # use perl"
6865                 ;;
6866         esac
6867         ;;
6868 esac
6869 echo "I'll use $startperl to start perl scripts."
6870
6871 : figure best path for perl in scripts
6872 case "$perlpath" in
6873 '')
6874         perlpath="$binexp/perl"
6875         case "$startperl" in
6876         *!*) ;;
6877         *)
6878                 $cat <<EOH
6879
6880 I will use the "eval 'exec'" idiom to start Perl on your system.
6881 I can use the full path of your Perl binary for this purpose, but
6882 doing so may cause problems if you want to share those scripts and
6883 Perl is not always in a standard place ($binexp/perl).
6884
6885 EOH
6886                 dflt="$binexp/perl"
6887                 rp="What path shall I use in \"eval 'exec'\"?"
6888                 . ./myread
6889                 perlpath="$ans"
6890                 ;;
6891         esac
6892         ;;
6893 esac
6894 case "$startperl" in
6895 *!*)    ;;
6896 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6897 esac
6898
6899 : determine where public executable scripts go
6900 set scriptdir scriptdir
6901 eval $prefixit
6902 case "$scriptdir" in
6903 '')
6904         dflt="$bin"
6905         : guess some guesses
6906         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6907         $test -d /usr/share/bin     && dflt=/usr/share/bin
6908         $test -d /usr/local/script  && dflt=/usr/local/script
6909         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6910         $test -d $prefixexp/script  && dflt=$prefixexp/script
6911         set dflt
6912         eval $prefixup
6913         ;;
6914 *)  dflt="$scriptdir"
6915         ;;
6916 esac
6917 $cat <<EOM
6918  
6919 Some installations have a separate directory just for executable scripts so
6920 that they can mount it across multiple architectures but keep the scripts in
6921 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6922 Or you might just lump your scripts in with all your other executables.
6923  
6924 EOM
6925 fn=d~
6926 rp='Where do you keep publicly executable scripts?'
6927 . ./getfile
6928 if $test "X$ansexp" != "X$scriptdirexp"; then
6929         installscript=''
6930 fi
6931 scriptdir="$ans"
6932 scriptdirexp="$ansexp"
6933 : Change installation prefix, if necessary.
6934 if $test X"$prefix" != X"$installprefix"; then
6935         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6936 else
6937         installscript="$scriptdirexp"
6938 fi
6939
6940 : determine where site specific architecture-dependent libraries go.
6941 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6942 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6943 : sitelib may have an optional trailing /share.
6944 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6945 tdflt="$tdflt/$archname"
6946 set sitearch sitearch none
6947 eval $prefixit
6948 case "$sitearch" in
6949 '')     dflt="$tdflt" ;;
6950 *)      dflt="$sitearch" ;;
6951 esac
6952 $cat <<EOM
6953
6954 The installation process will also create a directory for
6955 architecture-dependent site-specific extensions and modules.
6956
6957 EOM
6958 fn=nd~+
6959 rp='Pathname for the site-specific architecture-dependent library files?'
6960 . ./getfile
6961 sitearch="$ans"
6962 sitearchexp="$ansexp"
6963 : Change installation prefix, if necessary.
6964 if $test X"$prefix" != X"$installprefix"; then
6965         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6966 else
6967         installsitearch="$sitearchexp"
6968 fi
6969
6970 : determine where add-on public executables go
6971 case "$sitebin" in
6972 '')     dflt=$siteprefix/bin ;;
6973 *)      dflt=$sitebin ;;
6974 esac
6975 fn=d~
6976 rp='Pathname where the add-on public executables should be installed?'
6977 . ./getfile
6978 sitebin="$ans"
6979 sitebinexp="$ansexp"
6980 : Change installation prefix, if necessary.
6981 if $test X"$prefix" != X"$installprefix"; then
6982         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6983 else
6984         installsitebin="$sitebinexp"
6985 fi
6986
6987 : see if sqrtl exists
6988 set sqrtl d_sqrtl
6989 eval $inlibc
6990
6991 cat <<EOM
6992
6993 Perl can be built to take advantage of long doubles which
6994 (if available) may give more accuracy and range for floating point numbers.
6995
6996 If this doesn't make any sense to you, just accept the default 'n'.
6997 EOM
6998
6999 case "$ccflags" in
7000 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7001 esac
7002
7003 case "$uselongdouble" in
7004 $define|true|[yY]*)     dflt='y';;
7005 *) dflt='n';;
7006 esac
7007 rp='Try to use long doubles if available?'
7008 . ./myread
7009 case "$ans" in
7010 y|Y)    val="$define"   ;;
7011 *)      val="$undef"    ;;
7012 esac
7013 set uselongdouble
7014 eval $setvar
7015
7016 case "$uselongdouble" in
7017 true|[yY]*) uselongdouble="$define" ;;
7018 esac
7019
7020 case "$uselongdouble" in
7021 $define)
7022 : Look for a hint-file generated 'call-back-unit'.  If the
7023 : user has specified that long doubles should be used,
7024 : we may need to set or change some other defaults.
7025         if $test -f uselongdouble.cbu; then
7026                 echo "Your platform has some specific hints for long doubles, using them..."
7027                 . ./uselongdouble.cbu
7028         else
7029                 $cat <<EOM
7030 (Your platform doesn't have any specific hints for long doubles.)
7031 EOM
7032         fi
7033         ;;
7034 esac
7035
7036 case "$uselongdouble:$d_sqrtl" in
7037 $define:$undef)
7038                 $cat <<EOM >&4
7039
7040 You requested the use of long doubles but you do not seem to have
7041 the mathematic functions for long doubles.  I'm disabling the use
7042 of long doubles.
7043 EOM
7044         uselongdouble=$undef
7045         ;;
7046 esac
7047
7048 cat <<EOM
7049
7050 Perl can be built to take advantage of long longs which
7051 (if available) may give more range for integer numbers.
7052
7053 If this doesn't make any sense to you, just accept the default 'n'.
7054 EOM
7055
7056 case "$ccflags" in
7057 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7058 esac
7059
7060 case "$uselonglong" in
7061 '')     dflt='y';;
7062 esac
7063 rp='Try to use long longs if available?'
7064 . ./myread
7065 case "$ans" in
7066 y|Y)    val="$define"   ;;
7067 *)      val="$undef"    ;;
7068 esac
7069 set uselonglong
7070 eval $setvar
7071
7072 case "$uselonglong" in
7073 true|[yY]*) uselonglong="$define" ;;
7074 esac
7075
7076 case "$uselonglong" in
7077 $define)
7078 : Look for a hint-file generated 'call-back-unit'.  If the
7079 : user has specified that long longs should be used,
7080 : we may need to set or change some other defaults.
7081         if $test -f uselonglong.cbu; then
7082                 echo "Your platform has some specific hints for long longs, using them..."
7083                 . ./uselonglong.cbu
7084         else
7085                 $cat <<EOM
7086 (Your platform doesn't have any specific hints for long longs.)
7087 EOM
7088         fi
7089         ;;
7090 esac
7091
7092 cat <<EOM
7093
7094 Previous version of $package used the standard IO mechanisms as defined
7095 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7096 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7097 the default.  This abstraction layer can use AT&T's sfio (if you already
7098 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7099 problems with some extension modules.  Using PerlIO with stdio is safe,
7100 but it is slower than plain stdio and therefore is not the default.
7101
7102 If this doesn't make any sense to you, just accept the default 'n'.
7103 EOM
7104 case "$useperlio" in
7105 $define|true|[yY]*)     dflt='y';;
7106 *) dflt='n';;
7107 esac
7108 rp='Use the experimental PerlIO abstraction layer?'
7109 . ./myread
7110 case "$ans" in
7111 y|Y) 
7112         val="$define"
7113         ;;     
7114 *)      
7115         echo "Ok, doing things the stdio way"
7116         val="$undef"
7117         ;;
7118 esac
7119 set useperlio
7120 eval $setvar 
7121
7122 case "$vendorprefix" in
7123 '')     d_vendorbin="$undef"
7124         vendorbin=''
7125         vendorbinexp=''
7126         ;;
7127 *)      d_vendorbin="$define"
7128         : determine where vendor-supplied executables go.
7129         dflt=$vendorprefix/bin
7130         fn=d~+
7131         rp='Pathname for the vendor-supplied executables directory?'
7132         . ./getfile
7133         vendorbin="$ans"
7134         vendorbinexp="$ansexp"
7135         : Change installation prefix, if necessary.
7136         if $test X"$prefix" != X"$installprefix"; then
7137                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7138         else
7139                 installvendorbin="$vendorbinexp"
7140         fi
7141         ;;
7142 esac
7143
7144 : check for length of double
7145 echo " "
7146 case "$doublesize" in
7147 '')
7148         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7149         $cat >try.c <<'EOCP'
7150 #include <stdio.h>
7151 int main()
7152 {
7153     printf("%d\n", (int)sizeof(double));
7154     exit(0);
7155 }
7156 EOCP
7157         set try
7158         if eval $compile_ok; then
7159                 doublesize=`./try`
7160                 $echo " $doublesize bytes." >&4
7161         else
7162                 dflt='8'
7163                 echo "(I can't seem to compile the test program.  Guessing...)"
7164                 rp="What is the size of a double precision number (in bytes)?"
7165                 . ./myread
7166                 doublesize="$ans"
7167         fi
7168         ;;
7169 esac
7170 $rm -f try.c try
7171
7172 : check for long doubles
7173 echo " "
7174 $echo $n "Checking to see if your system supports long double..." $c >&4
7175 echo 'int main() { long double x = 7.0; }' > try.c
7176 set try
7177 if eval $compile; then
7178         val="$define"
7179         echo " Yes, it does." >&4
7180 else
7181         val="$undef"
7182         echo " No, it doesn't." >&4
7183 fi
7184 $rm try.*
7185 set d_longdbl
7186 eval $setvar
7187
7188 : check for length of long double
7189 case "${d_longdbl}${longdblsize}" in
7190 $define)
7191         echo " "
7192         $echo $n "Checking to see how big your long doubles are..." $c >&4
7193         $cat >try.c <<'EOCP'
7194 #include <stdio.h>
7195 int main()
7196 {
7197         printf("%d\n", sizeof(long double));
7198 }
7199 EOCP
7200         set try
7201         set try
7202         if eval $compile; then
7203                 longdblsize=`./try$exe_ext`
7204                 $echo " $longdblsize bytes." >&4
7205         else
7206                 dflt='8'
7207                 echo " "
7208                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7209                 rp="What is the size of a long double (in bytes)?"
7210                 . ./myread
7211                 longdblsize="$ans"
7212         fi
7213         if $test "X$doublesize" = "X$longdblsize"; then
7214                 echo "(That isn't any different from an ordinary double.)"
7215         fi      
7216         ;;
7217 esac
7218 $rm -f try.* try
7219
7220 : Check how to convert floats to strings.
7221 if test "X$d_Gconvert" = X; then
7222         echo " "
7223         echo "Checking for an efficient way to convert floats to strings."
7224         $cat >try.c <<EOP
7225 #ifdef TRY_gconvert
7226 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7227 char *myname = "gconvert";
7228 #endif
7229 #ifdef TRY_gcvt
7230 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7231 char *myname = "gcvt";
7232 #endif
7233 #ifdef TRY_qgcvt
7234 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7235 char *myname = "qgcvt";
7236 #define DOUBLETYPE long double
7237 #endif
7238 #ifdef TRY_sprintf
7239 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7240 char *myname = "sprintf";
7241 #endif
7242
7243 #ifndef DOUBLETYPE
7244 #define DOUBLETYPE double
7245 #endif
7246
7247 #include <stdio.h>
7248
7249 #define I_STDLIB $i_stdlib
7250 #ifdef I_STDLIB
7251 #include <stdlib.h>
7252 #endif
7253
7254 int
7255 checkit(expect, got)
7256 char *expect;
7257 char *got;
7258 {
7259     if (strcmp(expect, got)) {
7260                 printf("%s oddity:  Expected %s, got %s\n",
7261                         myname, expect, got);
7262                 exit(1);
7263         }
7264 }
7265
7266 int main()
7267
7268         char buf[64]; 
7269         buf[63] = '\0';
7270
7271         /* This must be 1st test on (which?) platform */
7272         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7273         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7274         checkit("0.1", buf);
7275
7276         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7277         checkit("1", buf);
7278
7279         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7280         checkit("0", buf);
7281
7282         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7283         checkit("-1", buf);
7284
7285         /* Some Linux gcvt's give 1.e+5 here. */
7286         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7287         checkit("100000", buf);
7288         
7289         /* Some Linux gcvt's give -1.e+5 here. */
7290         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7291         checkit("-100000", buf);
7292
7293         exit(0);
7294 }
7295 EOP
7296         case "$d_Gconvert" in
7297         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7298         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7299         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7300         *) xxx_list='gconvert gcvt sprintf' ;;
7301         esac
7302
7303         case "$d_longdbl$uselongdouble" in
7304         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7305         esac
7306
7307         for xxx_convert in $xxx_list; do
7308                 echo "Trying $xxx_convert..."
7309                 $rm -f try try$_o
7310                 set try -DTRY_$xxx_convert
7311                 if eval $compile; then
7312                         echo "$xxx_convert() found." >&4
7313                         if ./try; then
7314                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7315                                 break;
7316                         else
7317                                 echo "...But $xxx_convert didn't work as I expected."
7318                         fi
7319                 else
7320                         echo "$xxx_convert NOT found." >&4
7321                 fi
7322         done
7323                 
7324         case "$xxx_convert" in
7325         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7326         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7327         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7328         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7329         esac
7330 fi
7331
7332 echo " "
7333
7334 if $test X"$d_longdbl" = X"$define"; then
7335
7336 echo "Checking how to print long doubles..." >&4
7337
7338 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7339         $cat >try.c <<'EOCP'
7340 #include <sys/types.h>
7341 #include <stdio.h>
7342 int main() {
7343   double d = 123.456;
7344   printf("%.3f\n", d);
7345 }
7346 EOCP
7347         set try
7348         if eval $compile; then
7349                 yyy=`./try$exe_ext`
7350                 case "$yyy" in
7351                 123.456)
7352                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7353                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7354                         echo "We will use %f."
7355                         ;;
7356                 esac
7357         fi
7358 fi
7359
7360 if $test X"$sPRIfldbl" = X; then
7361         $cat >try.c <<'EOCP'
7362 #include <sys/types.h>
7363 #include <stdio.h>
7364 int main() {
7365   long double d = 123.456;
7366   printf("%.3llf\n", d);
7367 }
7368 EOCP
7369         set try
7370         if eval $compile; then
7371                 yyy=`./try$exe_ext`
7372                 case "$yyy" in
7373                 123.456)
7374                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7375                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7376                         echo "We will use %llf."
7377                         ;;
7378                 esac
7379         fi
7380 fi
7381
7382 if $test X"$sPRIfldbl" = X; then
7383         $cat >try.c <<'EOCP'
7384 #include <sys/types.h>
7385 #include <stdio.h>
7386 int main() {
7387   long double d = 123.456;
7388   printf("%.3Lf\n", d);
7389 }
7390 EOCP
7391         set try
7392         if eval $compile; then
7393                 yyy=`./try$exe_ext`
7394                 case "$yyy" in
7395                 123.456)
7396                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7397                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7398                         echo "We will use %Lf."
7399                         ;;
7400                 esac
7401         fi
7402 fi
7403
7404 if $test X"$sPRIfldbl" = X; then
7405         $cat >try.c <<'EOCP'
7406 #include <sys/types.h>
7407 #include <stdio.h>
7408 int main() {
7409   long double d = 123.456;
7410   printf("%.3lf\n", d);
7411 }
7412 EOCP
7413         set try
7414         if eval $compile; then
7415                 yyy=`./try$exe_ext`
7416                 case "$yyy" in
7417                 123.456)
7418                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7419                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7420                         echo "We will use %lf."
7421                         ;;
7422                 esac
7423         fi
7424 fi
7425
7426 if $test X"$sPRIfldbl" = X; then
7427         echo "Cannot figure out how to print long doubles." >&4
7428 fi
7429
7430 $rm -f try try.*
7431
7432 fi # d_longdbl
7433
7434 case "$sPRIfldbl" in
7435 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7436         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7437         ;;
7438 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7439         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7440         ;;
7441 esac
7442
7443 : Initialize h_fcntl
7444 h_fcntl=false
7445
7446 : Initialize h_sysfile
7447 h_sysfile=false
7448
7449 : access call always available on UNIX
7450 set access d_access
7451 eval $inlibc
7452
7453 : locate the flags for 'access()'
7454 case "$d_access" in
7455 "$define")
7456         echo " "
7457         $cat >access.c <<'EOCP'
7458 #include <sys/types.h>
7459 #ifdef I_FCNTL
7460 #include <fcntl.h>
7461 #endif
7462 #ifdef I_SYS_FILE
7463 #include <sys/file.h>
7464 #endif
7465 #ifdef I_UNISTD
7466 #include <unistd.h>
7467 #endif
7468 int main() {
7469         exit(R_OK);
7470 }
7471 EOCP
7472         : check sys/file.h first, no particular reason here
7473         if $test `./findhdr sys/file.h` && \
7474                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7475                 h_sysfile=true;
7476                 echo "<sys/file.h> defines the *_OK access constants." >&4
7477         elif $test `./findhdr fcntl.h` && \
7478                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7479                 h_fcntl=true;
7480                 echo "<fcntl.h> defines the *_OK access constants." >&4
7481         elif $test `./findhdr unistd.h` && \
7482                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7483                 echo "<unistd.h> defines the *_OK access constants." >&4
7484         else
7485                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7486         fi
7487         ;;
7488 esac
7489 $rm -f access*
7490
7491 : see if accessx exists
7492 set accessx d_accessx
7493 eval $inlibc
7494
7495 : see if alarm exists
7496 set alarm d_alarm
7497 eval $inlibc
7498
7499 : see if atolf exists
7500 set atolf d_atolf
7501 eval $inlibc
7502
7503 : see if atoll exists
7504 set atoll d_atoll
7505 eval $inlibc
7506
7507 : Look for GNU-cc style attribute checking
7508 echo " "
7509 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7510 $cat >attrib.c <<'EOCP'
7511 #include <stdio.h>
7512 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7513 EOCP
7514 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7515         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7516                 echo "Your C compiler doesn't fully support __attribute__."
7517                 val="$undef"
7518         else
7519                 echo "Your C compiler supports __attribute__."
7520                 val="$define"
7521         fi
7522 else
7523         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7524         val="$undef"
7525 fi
7526 set d_attribut
7527 eval $setvar
7528 $rm -f attrib*
7529
7530 : see if bcmp exists
7531 set bcmp d_bcmp
7532 eval $inlibc
7533
7534 : see if bcopy exists
7535 set bcopy d_bcopy
7536 eval $inlibc
7537
7538 : see if this is a unistd.h system
7539 set unistd.h i_unistd
7540 eval $inhdr
7541
7542 : see if getpgrp exists
7543 set getpgrp d_getpgrp
7544 eval $inlibc
7545
7546 case "$d_getpgrp" in
7547 "$define")
7548         echo " "
7549         echo "Checking to see which flavor of getpgrp is in use..."
7550         $cat >set.c <<EOP
7551 #$i_unistd I_UNISTD
7552 #include <sys/types.h>
7553 #ifdef I_UNISTD
7554 #  include <unistd.h>
7555 #endif
7556 int main()
7557 {
7558         if (getuid() == 0) {
7559                 printf("(I see you are running Configure as super-user...)\n");
7560                 setuid(1);
7561         }
7562 #ifdef TRY_BSD_PGRP
7563         if (getpgrp(1) == 0)
7564                 exit(0);
7565 #else
7566         if (getpgrp() > 0)
7567                 exit(0);
7568 #endif
7569         exit(1);
7570 }
7571 EOP
7572         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7573                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7574                 val="$define"
7575         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7576                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7577                 val="$undef"
7578         else
7579                 echo "I can't seem to compile and run the test program."
7580                 if ./usg; then
7581                         xxx="a USG one, i.e. you use getpgrp()."
7582                 else
7583                         # SVR4 systems can appear rather BSD-ish.
7584                         case "$i_unistd" in
7585                         $undef)
7586                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7587                                 val="$define"
7588                                 ;;
7589                         $define)
7590                                 xxx="probably a USG one, i.e. you use getpgrp()."
7591                                 val="$undef"
7592                                 ;;
7593                         esac
7594                 fi
7595                 echo "Assuming your getpgrp is $xxx" >&4
7596         fi
7597         ;;
7598 *) val="$undef";;
7599 esac
7600 set d_bsdgetpgrp
7601 eval $setvar
7602 $rm -f set set.c
7603
7604 : see if setpgrp exists
7605 set setpgrp d_setpgrp
7606 eval $inlibc
7607
7608 case "$d_setpgrp" in
7609 "$define")
7610         echo " "
7611         echo "Checking to see which flavor of setpgrp is in use..."
7612         $cat >set.c <<EOP
7613 #$i_unistd I_UNISTD
7614 #include <sys/types.h>
7615 #ifdef I_UNISTD
7616 #  include <unistd.h>
7617 #endif
7618 int main()
7619 {
7620         if (getuid() == 0) {
7621                 printf("(I see you are running Configure as super-user...)\n");
7622                 setuid(1);
7623         }
7624 #ifdef TRY_BSD_PGRP
7625         if (-1 == setpgrp(1, 1))
7626                 exit(0);
7627 #else
7628         if (setpgrp() != -1)
7629                 exit(0);
7630 #endif
7631         exit(1);
7632 }
7633 EOP
7634         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7635                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7636                 val="$define"
7637         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7638                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7639                 val="$undef"
7640         else
7641                 echo "(I can't seem to compile and run the test program.)"
7642                 if ./usg; then
7643                         xxx="a USG one, i.e. you use setpgrp()."
7644                 else
7645                         # SVR4 systems can appear rather BSD-ish.
7646                         case "$i_unistd" in
7647                         $undef)
7648                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7649                                 val="$define"
7650                                 ;;
7651                         $define)
7652                                 xxx="probably a USG one, i.e. you use setpgrp()."
7653                                 val="$undef"
7654                                 ;;
7655                         esac
7656                 fi
7657                 echo "Assuming your setpgrp is $xxx" >&4
7658         fi
7659         ;;
7660 *) val="$undef";;
7661 esac
7662 set d_bsdsetpgrp
7663 eval $setvar
7664 $rm -f set set.c
7665 : see if bzero exists
7666 set bzero d_bzero
7667 eval $inlibc
7668
7669 : see if signal is declared as pointer to function returning int or void
7670 echo " "
7671 xxx=`./findhdr signal.h`
7672 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7673 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7674         echo "You have int (*signal())() instead of void." >&4
7675         val="$undef"
7676 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7677         echo "You have void (*signal())()." >&4
7678         val="$define"
7679 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7680         echo "You have int (*signal())() instead of void." >&4
7681         val="$undef"
7682 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7683         echo "You have void (*signal())()." >&4
7684         val="$define"
7685 else
7686         case "$d_voidsig" in
7687         '')
7688         echo "I can't determine whether signal handler returns void or int..." >&4
7689                 dflt=void
7690                 rp="What type does your signal handler return?"
7691                 . ./myread
7692                 case "$ans" in
7693                 v*) val="$define";;
7694                 *) val="$undef";;
7695                 esac;;
7696         "$define")
7697                 echo "As you already told me, signal handler returns void." >&4
7698                 val="$define"
7699                 ;;
7700         *)      echo "As you already told me, signal handler returns int." >&4
7701                 val="$undef"
7702                 ;;
7703         esac
7704 fi
7705 set d_voidsig
7706 eval $setvar
7707 case "$d_voidsig" in
7708 "$define") signal_t="void";;
7709 *) signal_t="int";;
7710 esac
7711 $rm -f $$.tmp
7712
7713 : check for ability to cast large floats to 32-bit ints.
7714 echo " "
7715 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7716 if $test "$intsize" -ge 4; then
7717         xxx=int
7718 else
7719         xxx=long
7720 fi
7721 $cat >try.c <<EOCP
7722 #include <stdio.h>
7723 #include <sys/types.h>
7724 #include <signal.h>
7725 $signal_t blech(s) int s; { exit(3); }
7726 int main()
7727 {
7728         $xxx i32;
7729         double f, g;
7730         int result = 0;
7731         char str[16];
7732         signal(SIGFPE, blech);
7733
7734         /* Don't let compiler optimize the test away.  Store the number 
7735            in a writable string for gcc to pass to sscanf under HP/UX.
7736         */
7737         sprintf(str, "2147483647");
7738         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7739         g = 10 * f;
7740         i32  = ($xxx) g;
7741
7742         /* x86 processors will probably give 0x8000 0000, which is a
7743        sign change.  We don't want that.  We want to mimic SPARC
7744            behavior here, which is to preserve the sign and give
7745            back 0x7fff ffff.
7746         */
7747         if (i32 != ($xxx) f)
7748                 result |= 1;
7749         exit(result);
7750 }
7751 EOCP
7752 set try
7753 if eval $compile_ok; then
7754         ./try
7755         yyy=$?
7756 else
7757         echo "(I can't seem to compile the test program--assuming it can't)"
7758         yyy=1
7759 fi
7760 case "$yyy" in
7761 0)      val="$define"
7762         echo "Yup, it can."
7763         ;;
7764 *)      val="$undef"
7765         echo "Nope, it can't."
7766         ;;
7767 esac
7768 set d_casti32
7769 eval $setvar
7770 $rm -f try try.*
7771
7772 : check for ability to cast negative floats to unsigned
7773 echo " "
7774 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7775 $cat >try.c <<EOCP
7776 #include <stdio.h>
7777 #include <sys/types.h>
7778 #include <signal.h>
7779 $signal_t blech(s) int s; { exit(7); }
7780 $signal_t blech_in_list(s) int s; { exit(4); }
7781 unsigned long dummy_long(p) unsigned long p; { return p; }
7782 unsigned int dummy_int(p) unsigned int p; { return p; }
7783 unsigned short dummy_short(p) unsigned short p; { return p; }
7784 int main()
7785 {
7786         double f;
7787         unsigned long along;
7788         unsigned int aint;
7789         unsigned short ashort;
7790         int result = 0;
7791         char str[16];
7792         
7793         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7794            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7795            optimized the whole file away
7796         */
7797         /* Store the number in a writable string for gcc to pass to 
7798            sscanf under HP/UX.
7799         */
7800         sprintf(str, "-123");
7801         sscanf(str, "%lf", &f);  /* f = -123.; */
7802
7803         signal(SIGFPE, blech);
7804         along = (unsigned long)f;
7805         aint = (unsigned int)f;
7806         ashort = (unsigned short)f;
7807         if (along != (unsigned long)-123)
7808                 result |= 1;
7809         if (aint != (unsigned int)-123)
7810                 result |= 1;
7811         if (ashort != (unsigned short)-123)
7812                 result |= 1;
7813         sprintf(str, "1073741824.");
7814         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7815         f = f + f;
7816         along = 0;
7817         along = (unsigned long)f;
7818         if (along != 0x80000000)
7819                 result |= 2;
7820         f -= 1.;
7821         along = 0;
7822         along = (unsigned long)f;
7823         if (along != 0x7fffffff)
7824                 result |= 1;
7825         f += 2.;
7826         along = 0;
7827         along = (unsigned long)f;
7828         if (along != 0x80000001)
7829                 result |= 2;
7830         if (result)
7831                 exit(result);
7832         signal(SIGFPE, blech_in_list);
7833         sprintf(str, "123.");
7834         sscanf(str, "%lf", &f);  /* f = 123.; */
7835         along = dummy_long((unsigned long)f);
7836         aint = dummy_int((unsigned int)f);
7837         ashort = dummy_short((unsigned short)f);
7838         if (along != (unsigned long)123)
7839                 result |= 4;
7840         if (aint != (unsigned int)123)
7841                 result |= 4;
7842         if (ashort != (unsigned short)123)
7843                 result |= 4;
7844         exit(result);
7845
7846 }
7847 EOCP
7848 set try
7849 if eval $compile_ok; then
7850         ./try
7851         castflags=$?
7852 else
7853         echo "(I can't seem to compile the test program--assuming it can't)"
7854         castflags=7
7855 fi
7856 case "$castflags" in
7857 0)      val="$define"
7858         echo "Yup, it can."
7859         ;;
7860 *)      val="$undef"
7861         echo "Nope, it can't."
7862         ;;
7863 esac
7864 set d_castneg
7865 eval $setvar
7866 $rm -f try.*
7867
7868 : see if vprintf exists
7869 echo " "
7870 if set vprintf val -f d_vprintf; eval $csym; $val; then
7871         echo 'vprintf() found.' >&4
7872         val="$define"
7873         $cat >vprintf.c <<'EOF'
7874 #include <varargs.h>
7875
7876 int main() { xxx("foo"); }
7877
7878 xxx(va_alist)
7879 va_dcl
7880 {
7881         va_list args;
7882         char buf[10];
7883
7884         va_start(args);
7885         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7886 }
7887 EOF
7888         set vprintf
7889         if eval $compile && ./vprintf; then
7890                 echo "Your vsprintf() returns (int)." >&4
7891                 val2="$undef"
7892         else
7893                 echo "Your vsprintf() returns (char*)." >&4
7894                 val2="$define"
7895         fi
7896 else
7897         echo 'vprintf() NOT found.' >&4
7898                 val="$undef"
7899                 val2="$undef"
7900 fi
7901 set d_vprintf
7902 eval $setvar
7903 val=$val2
7904 set d_charvspr
7905 eval $setvar
7906
7907 : see if chown exists
7908 set chown d_chown
7909 eval $inlibc
7910
7911 : see if chroot exists
7912 set chroot d_chroot
7913 eval $inlibc
7914
7915 : see if chsize exists
7916 set chsize d_chsize
7917 eval $inlibc
7918
7919 : check for const keyword
7920 echo " "
7921 echo 'Checking to see if your C compiler knows about "const"...' >&4
7922 $cat >const.c <<'EOCP'
7923 typedef struct spug { int drokk; } spug;
7924 int main()
7925 {
7926         const char *foo;
7927         const spug y;
7928 }
7929 EOCP
7930 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7931         val="$define"
7932         echo "Yup, it does."
7933 else
7934         val="$undef"
7935         echo "Nope, it doesn't."
7936 fi
7937 set d_const
7938 eval $setvar
7939
7940 : see if crypt exists
7941 echo " "
7942 if set crypt val -f d_crypt; eval $csym; $val; then
7943         echo 'crypt() found.' >&4
7944         val="$define"
7945         cryptlib=''
7946 else
7947         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7948         if $test -z "$cryptlib"; then
7949                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7950         else
7951                 cryptlib=-lcrypt
7952         fi
7953         if $test -z "$cryptlib"; then
7954                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7955         else
7956                 cryptlib=-lcrypt
7957         fi
7958         if $test -z "$cryptlib"; then
7959                 cryptlib=`./loc libcrypt$_a "" $libpth`
7960         else
7961                 cryptlib=-lcrypt
7962         fi
7963         if $test -z "$cryptlib"; then
7964                 echo 'crypt() NOT found.' >&4
7965                 val="$undef"
7966         else
7967                 val="$define"
7968         fi
7969 fi
7970 set d_crypt
7971 eval $setvar
7972
7973 : get csh whereabouts
7974 case "$csh" in
7975 'csh') val="$undef" ;;
7976 *) val="$define" ;;
7977 esac
7978 set d_csh
7979 eval $setvar
7980 : Respect a hint or command line value for full_csh.
7981 case "$full_csh" in
7982 '') full_csh=$csh ;;
7983 esac
7984
7985 : see if cuserid exists
7986 set cuserid d_cuserid
7987 eval $inlibc
7988
7989 : see if this is a limits.h system
7990 set limits.h i_limits
7991 eval $inhdr
7992
7993 : see if this is a float.h system
7994 set float.h i_float
7995 eval $inhdr
7996
7997 : See if number of significant digits in a double precision number is known
7998 echo " "
7999 $cat >dbl_dig.c <<EOM
8000 #$i_limits I_LIMITS
8001 #$i_float I_FLOAT
8002 #ifdef I_LIMITS
8003 #include <limits.h>
8004 #endif
8005 #ifdef I_FLOAT
8006 #include <float.h>
8007 #endif
8008 #ifdef DBL_DIG
8009 printf("Contains DBL_DIG");
8010 #endif
8011 EOM
8012 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8013 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8014         echo "DBL_DIG found." >&4
8015         val="$define"
8016 else
8017         echo "DBL_DIG NOT found." >&4
8018         val="$undef"
8019 fi
8020 $rm -f dbl_dig.?
8021 set d_dbl_dig
8022 eval $setvar
8023
8024 : see if difftime exists
8025 set difftime d_difftime
8026 eval $inlibc
8027
8028 : see if this is a dirent system
8029 echo " "
8030 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8031         val="$define"
8032         echo "<dirent.h> found." >&4
8033 else
8034         val="$undef"
8035         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8036                 echo "<sys/dir.h> found." >&4
8037                 echo " "
8038         else
8039                 xinc=`./findhdr sys/ndir.h`
8040         fi
8041         echo "<dirent.h> NOT found." >&4
8042 fi
8043 set i_dirent
8044 eval $setvar
8045
8046 : Look for type of directory structure.
8047 echo " "
8048 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8049
8050 case "$direntrytype" in
8051 ''|' ')
8052         case "$i_dirent" in
8053         $define) guess1='struct dirent' ;;
8054         *) guess1='struct direct'  ;;
8055         esac
8056         ;;
8057 *)      guess1="$direntrytype"
8058         ;;
8059 esac
8060
8061 case "$guess1" in
8062 'struct dirent') guess2='struct direct' ;;
8063 *) guess2='struct dirent' ;;
8064 esac
8065                 
8066 if $contains "$guess1" try.c >/dev/null 2>&1; then
8067         direntrytype="$guess1"
8068         echo "Your directory entries are $direntrytype." >&4
8069 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8070         direntrytype="$guess2"
8071         echo "Your directory entries seem to be $direntrytype." >&4
8072 else
8073         echo "I don't recognize your system's directory entries." >&4
8074         rp="What type is used for directory entries on this system?"
8075         dflt="$guess1"
8076         . ./myread
8077         direntrytype="$ans"
8078 fi
8079 $rm -f try.c
8080
8081
8082 : see if the directory entry stores field length
8083 echo " "
8084 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8085 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8086         echo "Good, your directory entry keeps length information in d_namlen." >&4
8087         val="$define"
8088 else
8089         echo "Your directory entry does not know about the d_namlen field." >&4
8090         val="$undef"
8091 fi
8092 set d_dirnamlen
8093 eval $setvar
8094 $rm -f try.c
8095
8096 : see if dlerror exists
8097 xxx_runnm="$runnm"
8098 runnm=false
8099 set dlerror d_dlerror
8100 eval $inlibc
8101 runnm="$xxx_runnm"
8102
8103 : see if dlfcn is available
8104 set dlfcn.h i_dlfcn
8105 eval $inhdr
8106
8107 case "$usedl" in
8108 $define|y|true)
8109         $cat << EOM
8110
8111 On a few systems, the dynamically loaded modules that perl generates and uses
8112 will need a different extension than shared libs. The default will probably
8113 be appropriate.
8114
8115 EOM
8116         case "$dlext" in
8117         '')     dflt="$so" ;;
8118         *)      dflt="$dlext" ;;
8119         esac
8120         rp='What is the extension of dynamically loaded modules'
8121         . ./myread
8122         dlext="$ans"
8123         ;;
8124 *)
8125         dlext="none"
8126         ;;
8127 esac
8128
8129 : Check if dlsym need a leading underscore
8130 echo " "
8131 val="$undef"
8132
8133 case "$dlsrc" in
8134 dl_dlopen.xs)
8135         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8136         $cat >dyna.c <<'EOM'
8137 fred () { }
8138 EOM
8139
8140 $cat >fred.c<<EOM
8141
8142 #include <stdio.h>
8143 #$i_dlfcn I_DLFCN
8144 #ifdef I_DLFCN
8145 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8146 #else
8147 #include <sys/types.h>
8148 #include <nlist.h>
8149 #include <link.h>
8150 #endif
8151
8152 extern int fred() ;
8153
8154 int main()
8155 {
8156     void * handle ;
8157     void * symbol ;
8158 #ifndef RTLD_LAZY
8159     int mode = 1 ;
8160 #else
8161     int mode = RTLD_LAZY ;
8162 #endif
8163     handle = dlopen("./dyna.$dlext", mode) ;
8164     if (handle == NULL) {
8165         printf ("1\n") ;
8166         fflush (stdout) ;
8167         exit(0);
8168     }
8169     symbol = dlsym(handle, "fred") ;
8170     if (symbol == NULL) {
8171         /* try putting a leading underscore */
8172         symbol = dlsym(handle, "_fred") ;
8173         if (symbol == NULL) {
8174             printf ("2\n") ;
8175             fflush (stdout) ;
8176             exit(0);
8177         }
8178         printf ("3\n") ;
8179     }
8180     else
8181         printf ("4\n") ;
8182     fflush (stdout) ;
8183     exit(0);
8184 }
8185 EOM
8186         : Call the object file tmp-dyna.o in case dlext=o.
8187         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8188                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8189                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8190                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8191                 xxx=`./fred`
8192                 case $xxx in
8193                 1)      echo "Test program failed using dlopen." >&4
8194                         echo "Perhaps you should not use dynamic loading." >&4;;
8195                 2)      echo "Test program failed using dlsym." >&4
8196                         echo "Perhaps you should not use dynamic loading." >&4;;
8197                 3)      echo "dlsym needs a leading underscore" >&4
8198                         val="$define" ;;
8199                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8200                 esac
8201         else
8202                 echo "I can't compile and run the test program." >&4
8203                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8204         fi
8205         ;;
8206 esac
8207                 
8208 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8209
8210 set d_dlsymun
8211 eval $setvar
8212
8213 hasproto='varname=$1; func=$2; shift; shift;
8214 while $test $# -ge 2; do
8215         case "$1" in
8216         $define) echo "#include <$2>";;
8217         esac ;
8218     shift 2;
8219 done > try.c;
8220 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8221 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8222         echo "$func() prototype found.";
8223         val="$define";
8224 else
8225         echo "$func() prototype NOT found.";
8226         val="$undef";
8227 fi;
8228 set $varname;
8229 eval $setvar;
8230 $rm -f try.c tryout.c'
8231
8232 : see if prototype for drand48 is available
8233 echo " "
8234 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8235 eval $hasproto
8236
8237 : see if dup2 exists
8238 set dup2 d_dup2
8239 eval $inlibc
8240
8241 : see if eaccess exists
8242 set eaccess d_eaccess
8243 eval $inlibc
8244
8245 : see if endgrent exists
8246 set endgrent d_endgrent
8247 eval $inlibc
8248
8249 : see if endhostent exists
8250 set endhostent d_endhent
8251 eval $inlibc
8252
8253 : see if endnetent exists
8254 set endnetent d_endnent
8255 eval $inlibc
8256
8257 : see if endprotoent exists
8258 set endprotoent d_endpent
8259 eval $inlibc
8260
8261 : see if endpwent exists
8262 set endpwent d_endpwent
8263 eval $inlibc
8264
8265 : see if endservent exists
8266 set endservent d_endsent
8267 eval $inlibc
8268
8269 : see if endspent exists
8270 set endspent d_endspent
8271 eval $inlibc
8272
8273 : Locate the flags for 'open()'
8274 echo " "
8275 $cat >open3.c <<'EOCP'
8276 #include <sys/types.h>
8277 #ifdef I_FCNTL
8278 #include <fcntl.h>
8279 #endif
8280 #ifdef I_SYS_FILE
8281 #include <sys/file.h>
8282 #endif
8283 int main() {
8284         if(O_RDONLY);
8285 #ifdef O_TRUNC
8286         exit(0);
8287 #else
8288         exit(1);
8289 #endif
8290 }
8291 EOCP
8292 : check sys/file.h first to get FREAD on Sun
8293 if $test `./findhdr sys/file.h` && \
8294                 set open3 -DI_SYS_FILE && eval $compile; then
8295         h_sysfile=true;
8296         echo "<sys/file.h> defines the O_* constants..." >&4
8297         if ./open3; then
8298                 echo "and you have the 3 argument form of open()." >&4
8299                 val="$define"
8300         else
8301                 echo "but not the 3 argument form of open().  Oh, well." >&4
8302                 val="$undef"
8303         fi
8304 elif $test `./findhdr fcntl.h` && \
8305                 set open3 -DI_FCNTL && eval $compile; then
8306         h_fcntl=true;
8307         echo "<fcntl.h> defines the O_* constants..." >&4
8308         if ./open3; then
8309                 echo "and you have the 3 argument form of open()." >&4
8310                 val="$define"
8311         else
8312                 echo "but not the 3 argument form of open().  Oh, well." >&4
8313                 val="$undef"
8314         fi
8315 else
8316         val="$undef"
8317         echo "I can't find the O_* constant definitions!  You got problems." >&4
8318 fi
8319 set d_open3
8320 eval $setvar
8321 $rm -f open3*
8322
8323 : see which of string.h or strings.h is needed
8324 echo " "
8325 strings=`./findhdr string.h`
8326 if $test "$strings" && $test -r "$strings"; then
8327         echo "Using <string.h> instead of <strings.h>." >&4
8328         val="$define"
8329 else
8330         val="$undef"
8331         strings=`./findhdr strings.h`
8332         if $test "$strings" && $test -r "$strings"; then
8333                 echo "Using <strings.h> instead of <string.h>." >&4
8334         else
8335                 echo "No string header found -- You'll surely have problems." >&4
8336         fi
8337 fi
8338 set i_string
8339 eval $setvar
8340 case "$i_string" in
8341 "$undef") strings=`./findhdr strings.h`;;
8342 *)        strings=`./findhdr string.h`;;
8343 esac
8344
8345 : check for non-blocking I/O stuff
8346 case "$h_sysfile" in
8347 true) echo "#include <sys/file.h>" > head.c;;
8348 *)
8349         case "$h_fcntl" in
8350         true) echo "#include <fcntl.h>" > head.c;;
8351         *) echo "#include <sys/fcntl.h>" > head.c;;
8352         esac
8353         ;;
8354 esac
8355 echo " "
8356 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8357 case "$o_nonblock" in
8358 '')
8359         $cat head.c > try.c
8360         $cat >>try.c <<'EOCP'
8361 #include <stdio.h>
8362 int main() {
8363 #ifdef O_NONBLOCK
8364         printf("O_NONBLOCK\n");
8365         exit(0);
8366 #endif
8367 #ifdef O_NDELAY
8368         printf("O_NDELAY\n");
8369         exit(0);
8370 #endif
8371 #ifdef FNDELAY
8372         printf("FNDELAY\n");
8373         exit(0);
8374 #endif
8375         exit(0);
8376 }
8377 EOCP
8378         set try
8379         if eval $compile_ok; then
8380                 o_nonblock=`./try`
8381                 case "$o_nonblock" in
8382                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8383                 *) echo "Seems like we can use $o_nonblock.";;
8384                 esac
8385         else
8386                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8387         fi
8388         ;;
8389 *) echo "Using $hint value $o_nonblock.";;
8390 esac
8391 $rm -f try try.* .out core
8392
8393 echo " "
8394 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8395 case "$eagain" in
8396 '')
8397         $cat head.c > try.c
8398         $cat >>try.c <<EOCP
8399 #include <errno.h>
8400 #include <sys/types.h>
8401 #include <signal.h>
8402 #include <stdio.h> 
8403 #define MY_O_NONBLOCK $o_nonblock
8404 #ifndef errno  /* XXX need better Configure test */
8405 extern int errno;
8406 #endif
8407 #$i_unistd I_UNISTD
8408 #ifdef I_UNISTD
8409 #include <unistd.h>
8410 #endif
8411 #ifdef $i_string
8412 #include <string.h>
8413 #else
8414 #include <strings.h>
8415 #endif
8416 $signal_t blech(x) int x; { exit(3); }
8417 EOCP
8418         $cat >> try.c <<'EOCP'
8419 int main()
8420 {
8421         int pd[2];
8422         int pu[2];
8423         char buf[1];
8424         char string[100];
8425
8426         pipe(pd);       /* Down: child -> parent */
8427         pipe(pu);       /* Up: parent -> child */
8428         if (0 != fork()) {
8429                 int ret;
8430                 close(pd[1]);   /* Parent reads from pd[0] */
8431                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8432                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8433                         exit(1);
8434                 signal(SIGALRM, blech);
8435                 alarm(5);
8436                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8437                         exit(2);
8438                 sprintf(string, "%d\n", ret);
8439                 write(2, string, strlen(string));
8440                 alarm(0);
8441 #ifdef EAGAIN
8442                 if (errno == EAGAIN) {
8443                         printf("EAGAIN\n");
8444                         goto ok;
8445                 }
8446 #endif
8447 #ifdef EWOULDBLOCK
8448                 if (errno == EWOULDBLOCK)
8449                         printf("EWOULDBLOCK\n");
8450 #endif
8451         ok:
8452                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8453                 sleep(2);                               /* Give it time to close our pipe */
8454                 alarm(5);
8455                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8456                 alarm(0);
8457                 sprintf(string, "%d\n", ret);
8458                 write(3, string, strlen(string));
8459                 exit(0);
8460         }
8461
8462         close(pd[0]);                   /* We write to pd[1] */
8463         close(pu[1]);                   /* We read from pu[0] */
8464         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8465         close(pd[1]);                   /* Pipe pd is now fully closed! */
8466         exit(0);                                /* Bye bye, thank you for playing! */
8467 }
8468 EOCP
8469         set try
8470         if eval $compile_ok; then
8471                 echo "$startsh" >mtry
8472                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8473                 chmod +x mtry
8474                 ./mtry >/dev/null 2>&1
8475                 case $? in
8476                 0) eagain=`$cat try.out`;;
8477                 1) echo "Could not perform non-blocking setting!";;
8478                 2) echo "I did a successful read() for something that was not there!";;
8479                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8480                 *) echo "Something terribly wrong happened during testing.";;
8481                 esac
8482                 rd_nodata=`$cat try.ret`
8483                 echo "A read() system call with no data present returns $rd_nodata."
8484                 case "$rd_nodata" in
8485                 0|-1) ;;
8486                 *)
8487                         echo "(That's peculiar, fixing that to be -1.)"
8488                         rd_nodata=-1
8489                         ;;
8490                 esac
8491                 case "$eagain" in
8492                 '')
8493                         echo "Forcing errno EAGAIN on read() with no data available."
8494                         eagain=EAGAIN
8495                         ;;
8496                 *)
8497                         echo "Your read() sets errno to $eagain when no data is available."
8498                         ;;
8499                 esac
8500                 status=`$cat try.err`
8501                 case "$status" in
8502                 0) echo "And it correctly returns 0 to signal EOF.";;
8503                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8504                 *) echo "However, your read() returns '$status' on EOF??";;
8505                 esac
8506                 val="$define"
8507                 if test "$status" = "$rd_nodata"; then
8508                         echo "WARNING: you can't distinguish between EOF and no data!"
8509                         val="$undef"
8510                 fi
8511         else
8512                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8513                 eagain=EAGAIN
8514         fi
8515         set d_eofnblk
8516         eval $setvar
8517         ;;
8518 *)
8519         echo "Using $hint value $eagain."
8520         echo "Your read() returns $rd_nodata when no data is present."
8521         case "$d_eofnblk" in
8522         "$define") echo "And you can see EOF because read() returns 0.";;
8523         "$undef") echo "But you can't see EOF status from read() returned value.";;
8524         *)
8525                 echo "(Assuming you can't see EOF status from read anyway.)"
8526                 d_eofnblk=$undef
8527                 ;;
8528         esac
8529         ;;
8530 esac
8531 $rm -f try try.* .out core head.c mtry
8532
8533 : see if fchmod exists
8534 set fchmod d_fchmod
8535 eval $inlibc
8536
8537 : see if fchown exists
8538 set fchown d_fchown
8539 eval $inlibc
8540
8541 : see if this is an fcntl system
8542 set fcntl d_fcntl
8543 eval $inlibc
8544
8545 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8546 while $test $# -ge 2; do
8547         case "$1" in
8548         $define) echo "#include <$2>";;
8549         esac ;
8550     shift 2;
8551 done > try.c;
8552 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8553 set try;
8554 if eval $compile; then
8555         val="$define";
8556 else
8557         val="$undef";
8558 fi;
8559 set $varname;
8560 eval $setvar;
8561 $rm -f try.c try.o'
8562
8563 socketlib=''
8564 sockethdr=''
8565 : see whether socket exists
8566 echo " "
8567 $echo $n "Hmm... $c" >&4
8568 if set socket val -f d_socket; eval $csym; $val; then
8569         echo "Looks like you have Berkeley networking support." >&4
8570         d_socket="$define"
8571         if set setsockopt val -f; eval $csym; $val; then
8572                 d_oldsock="$undef"
8573         else
8574                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8575                 d_oldsock="$define"
8576         fi
8577 else
8578         if $contains socklib libc.list >/dev/null 2>&1; then
8579                 echo "Looks like you have Berkeley networking support." >&4
8580                 d_socket="$define"
8581                 : we will have to assume that it supports the 4.2 BSD interface
8582                 d_oldsock="$undef"
8583         else
8584                 echo "You don't have Berkeley networking in libc$_a..." >&4
8585                 if test "X$d_socket" = "X$define"; then
8586                    echo "...but you seem to believe that you have sockets." >&4
8587                 else
8588                         for net in net socket
8589                         do
8590                                 if test -f /usr/lib/lib$net$_a; then
8591                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8592                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8593                                         if $contains socket libc.list >/dev/null 2>&1; then
8594                                                 d_socket="$define"
8595                                                 socketlib="-l$net"
8596                                                 case "$net" in
8597                                                 net)
8598                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8599                                                         sockethdr="-I/usr/netinclude"
8600                                                         ;;
8601                                                 esac
8602                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8603                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8604                                                         d_oldsock="$undef"
8605                                                 else
8606                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8607                                                         d_oldsock="$define"
8608                                                 fi
8609                                                 break
8610                                         fi
8611                                 fi
8612                         done
8613                         if test "X$d_socket" != "X$define"; then
8614                            echo "or anywhere else I see." >&4
8615                            d_socket="$undef"
8616                            d_oldsock="$undef"
8617                         fi
8618                 fi
8619         fi
8620 fi
8621
8622 : see if socketpair exists
8623 set socketpair d_sockpair
8624 eval $inlibc
8625
8626
8627 echo " "
8628 echo "Checking the availability of certain socket constants..." >& 4
8629 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8630         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8631         $cat >try.c <<EOF
8632 #include <sys/types.h>
8633 #include <sys/socket.h>
8634 int main() {
8635     int i = $ENUM;
8636 }
8637 EOF
8638         val="$undef"
8639         set try; if eval $compile; then
8640                 val="$define"
8641         fi
8642         set d_${enum}; eval $setvar
8643         $rm -f try.c try
8644 done
8645
8646 : see if sys/select.h has to be included
8647 set sys/select.h i_sysselct
8648 eval $inhdr
8649
8650 : see if we should include time.h, sys/time.h, or both
8651 echo " "
8652 if test "X$timeincl" = X; then
8653         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8654         $echo $n "I'm now running the test program...$c"
8655         $cat >try.c <<'EOCP'
8656 #include <sys/types.h>
8657 #ifdef I_TIME
8658 #include <time.h>
8659 #endif
8660 #ifdef I_SYSTIME
8661 #ifdef SYSTIMEKERNEL
8662 #define KERNEL
8663 #endif
8664 #include <sys/time.h>
8665 #endif
8666 #ifdef I_SYSSELECT
8667 #include <sys/select.h>
8668 #endif
8669 int main()
8670 {
8671         struct tm foo;
8672 #ifdef S_TIMEVAL
8673         struct timeval bar;
8674 #endif
8675 #ifdef S_TIMEZONE
8676         struct timezone tzp;
8677 #endif
8678         if (foo.tm_sec == foo.tm_sec)
8679                 exit(0);
8680 #ifdef S_TIMEVAL
8681         if (bar.tv_sec == bar.tv_sec)
8682                 exit(0);
8683 #endif
8684         exit(1);
8685 }
8686 EOCP
8687         flags=''
8688         for s_timezone in '-DS_TIMEZONE' ''; do
8689         sysselect=''
8690         for s_timeval in '-DS_TIMEVAL' ''; do
8691         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8692         for i_time in '' '-DI_TIME'; do
8693         for i_systime in '-DI_SYSTIME' ''; do
8694                 case "$flags" in
8695                 '') $echo $n ".$c"
8696                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8697                         if eval $compile; then
8698                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8699                                 shift
8700                                 flags="$*"
8701                                 echo " "
8702                                 $echo $n "Succeeded with $flags$c"
8703                         fi
8704                         ;;
8705                 esac
8706         done
8707         done
8708         done
8709         done
8710         done
8711         timeincl=''
8712         echo " "
8713         case "$flags" in
8714         *SYSTIMEKERNEL*) i_systimek="$define"
8715                 timeincl=`./findhdr sys/time.h`
8716                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8717         *) i_systimek="$undef";;
8718         esac
8719         case "$flags" in
8720         *I_TIME*) i_time="$define"
8721                 timeincl=`./findhdr time.h`" $timeincl"
8722                 echo "We'll include <time.h>." >&4;;
8723         *) i_time="$undef";;
8724         esac
8725         case "$flags" in
8726         *I_SYSTIME*) i_systime="$define"
8727                 timeincl=`./findhdr sys/time.h`" $timeincl"
8728                 echo "We'll include <sys/time.h>." >&4;;
8729         *) i_systime="$undef";;
8730         esac
8731         $rm -f try.c try
8732 fi
8733
8734 : check for fd_set items
8735 $cat <<EOM
8736
8737 Checking to see how well your C compiler handles fd_set and friends ...
8738 EOM
8739 $cat >fd_set.c <<EOCP
8740 #$i_systime I_SYS_TIME
8741 #$i_sysselct I_SYS_SELECT
8742 #$d_socket HAS_SOCKET
8743 #include <sys/types.h>
8744 #ifdef HAS_SOCKET
8745 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8746 #endif
8747 #ifdef I_SYS_TIME
8748 #include <sys/time.h>
8749 #endif
8750 #ifdef I_SYS_SELECT
8751 #include <sys/select.h>
8752 #endif
8753 int main() {
8754         fd_set fds;
8755
8756 #ifdef TRYBITS
8757         if(fds.fds_bits);
8758 #endif
8759
8760 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8761         exit(0);
8762 #else
8763         exit(1);
8764 #endif
8765 }
8766 EOCP
8767 set fd_set -DTRYBITS
8768 if eval $compile; then
8769         d_fds_bits="$define"
8770         d_fd_set="$define"
8771         echo "Well, your system knows about the normal fd_set typedef..." >&4
8772         if ./fd_set; then
8773                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8774                 d_fd_macros="$define"
8775         else
8776                 $cat >&4 <<'EOM'
8777 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8778 EOM
8779                 d_fd_macros="$undef"
8780         fi
8781 else
8782         $cat <<'EOM'
8783 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8784 EOM
8785         set fd_set
8786         if eval $compile; then
8787                 d_fds_bits="$undef"
8788                 d_fd_set="$define"
8789                 echo "Well, your system has some sort of fd_set available..." >&4
8790                 if ./fd_set; then
8791                         echo "and you have the normal fd_set macros." >&4
8792                         d_fd_macros="$define"
8793                 else
8794                         $cat <<'EOM'
8795 but not the normal fd_set macros!  Gross!  More work for me...
8796 EOM
8797                         d_fd_macros="$undef"
8798                 fi
8799         else
8800         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8801                 d_fd_set="$undef"
8802                 d_fds_bits="$undef"
8803                 d_fd_macros="$undef"
8804         fi
8805 fi
8806 $rm -f fd_set*
8807
8808 : see if fgetpos exists
8809 set fgetpos d_fgetpos
8810 eval $inlibc
8811
8812 : see if flock exists
8813 set flock d_flock
8814 eval $inlibc
8815
8816 : see if fork exists
8817 set fork d_fork
8818 eval $inlibc
8819
8820 : see if pathconf exists
8821 set pathconf d_pathconf
8822 eval $inlibc
8823
8824 : see if fpathconf exists
8825 set fpathconf d_fpathconf
8826 eval $inlibc
8827
8828
8829 : check for off64_t
8830 echo " "
8831 echo "Checking to see if your system supports off64_t..." >&4
8832 $cat >try.c <<EOCP
8833 #include <sys/types.h>
8834 #include <unistd.h>
8835 int main() { off64_t x = 7; }'
8836 EOCP
8837 set try
8838 if eval $compile; then
8839         val="$define"
8840         echo "Yes, it does."
8841 else
8842         val="$undef"
8843         echo "No, it doesn't."
8844         case "$lseeksize" in
8845         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8846         esac
8847 fi
8848 $rm -f try.* try
8849 set d_off64_t
8850 eval $setvar
8851
8852 : check for fpos64_t
8853 echo " "
8854 echo "Checking to see if your system supports fpos64_t..." >&4
8855 $cat >try.c <<EOCP
8856 #include <sys/stdio.h>
8857 int main() { fpos64_t x x = 7; }'
8858 EOCP
8859 set try
8860 if eval $compile; then
8861         val="$define"
8862         echo "Yes, it does."
8863 else
8864         val="$undef"
8865         echo "No, it doesn't."
8866         case "$fpossize" in
8867         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8868         esac
8869 fi
8870 $rm -f try.* try
8871 set d_fpos64_t
8872 eval $setvar
8873
8874 hasstruct='varname=$1; struct=$2; shift; shift;
8875 while $test $# -ge 2; do
8876         case "$1" in
8877         $define) echo "#include <$2>";;
8878         esac ;
8879     shift 2;
8880 done > try.c;
8881 echo "int main () { struct $struct foo; }" >> try.c;
8882 set try;
8883 if eval $compile; then
8884         val="$define";
8885 else
8886         val="$undef";
8887 fi;
8888 set $varname;
8889 eval $setvar;
8890 $rm -f try.c try.o'
8891
8892 : see if this is a sys/param system
8893 set sys/param.h i_sysparam
8894 eval $inhdr
8895
8896 : see if this is a sys/mount.h system
8897 set sys/mount.h i_sysmount
8898 eval $inhdr
8899
8900 : see if sys/types.h has to be included
8901 set sys/types.h i_systypes
8902 eval $inhdr
8903
8904
8905 echo " "
8906 echo "Checking to see if your system supports struct fs_data..." >&4
8907 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8908 eval $hasstruct
8909 case "$d_fs_data_s" in
8910 "$define")      echo "Yes, it does."   ;;
8911 *)              echo "No, it doesn't." ;;
8912 esac
8913
8914 : see if fseeko exists
8915 set fseeko d_fseeko
8916 eval $inlibc
8917 case "$longsize" in
8918 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8919 esac
8920
8921 : see if fsetpos exists
8922 set fsetpos d_fsetpos
8923 eval $inlibc
8924
8925
8926 : see if fstatfs exists
8927 set fstatfs d_fstatfs
8928 eval $inlibc
8929
8930
8931 : see if statvfs exists
8932 set statvfs d_statvfs
8933 eval $inlibc
8934
8935 : see if fstatvfs exists
8936 set fstatvfs d_fstatvfs
8937 eval $inlibc
8938
8939
8940 : see if ftello exists
8941 set ftello d_ftello
8942 eval $inlibc
8943 case "$longsize" in
8944 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8945 esac
8946
8947 : see if getgrent exists
8948 set getgrent d_getgrent
8949 eval $inlibc
8950
8951 : see if gethostbyaddr exists
8952 set gethostbyaddr d_gethbyaddr
8953 eval $inlibc
8954
8955 : see if gethostbyname exists
8956 set gethostbyname d_gethbyname
8957 eval $inlibc
8958
8959 : see if gethostent exists
8960 set gethostent d_gethent
8961 eval $inlibc
8962
8963 : see how we will look up host name
8964 echo " "
8965 call=''
8966 if set gethostname val -f d_gethname; eval $csym; $val; then
8967         echo 'gethostname() found.' >&4
8968         d_gethname="$define"
8969         call=gethostname
8970 fi
8971 if set uname val -f d_uname; eval $csym; $val; then
8972         if ./xenix; then
8973                 $cat <<'EOM'
8974 uname() was found, but you're running xenix, and older versions of xenix
8975 have a broken uname(). If you don't really know whether your xenix is old
8976 enough to have a broken system call, use the default answer.
8977
8978 EOM
8979                 dflt=y
8980                 case "$d_uname" in
8981                 "$define") dflt=n;;
8982                 esac
8983                 rp='Is your uname() broken?'
8984                 . ./myread
8985                 case "$ans" in
8986                 n*) d_uname="$define"; call=uname;;
8987                 esac
8988         else
8989                 echo 'uname() found.' >&4
8990                 d_uname="$define"
8991                 case "$call" in
8992                 '') call=uname ;;
8993                 esac
8994         fi
8995 fi
8996 case "$d_gethname" in
8997 '') d_gethname="$undef";;
8998 esac
8999 case "$d_uname" in
9000 '') d_uname="$undef";;
9001 esac
9002 case "$d_uname$d_gethname" in
9003 *define*)
9004         dflt=n
9005         cat <<EOM
9006  
9007 Every now and then someone has a $call() that lies about the hostname
9008 but can't be fixed for political or economic reasons.  If you wish, I can
9009 pretend $call() isn't there and maybe compute hostname at run-time
9010 thanks to the '$phostname' command.
9011
9012 EOM
9013         rp="Shall I ignore $call() from now on?"
9014         . ./myread
9015         case "$ans" in
9016         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9017         esac;;
9018 esac
9019 case "$phostname" in
9020 '') aphostname='';;
9021 *) case "$aphostname" in
9022         /*) ;;
9023         *) set X $phostname
9024                 shift
9025                 file=$1
9026                 shift
9027                 file=`./loc $file $file $pth`
9028                 aphostname=`echo $file $*`
9029                 ;;
9030         esac
9031         ;;
9032 esac
9033 case "$d_uname$d_gethname" in
9034 *define*) ;;
9035 *)
9036         case "$phostname" in
9037         '')
9038                 echo "There will be no way for $package to get your hostname." >&4;;
9039         *)
9040         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9041                 ;;
9042         esac;;
9043 esac
9044 case "$d_phostname" in
9045 '') d_phostname="$undef";;
9046 esac
9047
9048 : see if this is a netdb.h system
9049 set netdb.h i_netdb
9050 eval $inhdr
9051
9052 : see if prototypes for various gethostxxx netdb.h functions are available
9053 echo " "
9054 set d_gethostprotos gethostent $i_netdb netdb.h
9055 eval $hasproto
9056
9057 : see if getlogin exists
9058 set getlogin d_getlogin
9059 eval $inlibc
9060
9061 : see if getmnt exists
9062 set getmnt d_getmnt
9063 eval $inlibc
9064
9065 : see if getmntent exists
9066 set getmntent d_getmntent
9067 eval $inlibc
9068
9069 : see if getnetbyaddr exists
9070 set getnetbyaddr d_getnbyaddr
9071 eval $inlibc
9072
9073 : see if getnetbyname exists
9074 set getnetbyname d_getnbyname
9075 eval $inlibc
9076
9077 : see if getnetent exists
9078 set getnetent d_getnent
9079 eval $inlibc
9080
9081 : see if prototypes for various getnetxxx netdb.h functions are available
9082 echo " "
9083 set d_getnetprotos getnetent $i_netdb netdb.h
9084 eval $hasproto
9085
9086
9087 : see if getprotobyname exists
9088 set getprotobyname d_getpbyname
9089 eval $inlibc
9090
9091 : see if getprotobynumber exists
9092 set getprotobynumber d_getpbynumber
9093 eval $inlibc
9094
9095 : see if getprotoent exists
9096 set getprotoent d_getpent
9097 eval $inlibc
9098
9099 : see if getpgid exists
9100 set getpgid d_getpgid
9101 eval $inlibc
9102
9103 : see if getpgrp2 exists
9104 set getpgrp2 d_getpgrp2
9105 eval $inlibc
9106
9107 : see if getppid exists
9108 set getppid d_getppid
9109 eval $inlibc
9110
9111 : see if getpriority exists
9112 set getpriority d_getprior
9113 eval $inlibc
9114
9115 : see if prototypes for various getprotoxxx netdb.h functions are available
9116 echo " "
9117 set d_getprotoprotos getprotoent $i_netdb netdb.h
9118 eval $hasproto
9119
9120 : see if getpwent exists
9121 set getpwent d_getpwent
9122 eval $inlibc
9123
9124
9125 : see if getservbyname exists
9126 set getservbyname d_getsbyname
9127 eval $inlibc
9128
9129 : see if getservbyport exists
9130 set getservbyport d_getsbyport
9131 eval $inlibc
9132
9133 : see if getservent exists
9134 set getservent d_getsent
9135 eval $inlibc
9136
9137 : see if prototypes for various getservxxx netdb.h functions are available
9138 echo " "
9139 set d_getservprotos getservent $i_netdb netdb.h
9140 eval $hasproto
9141
9142 : see if getspent exists
9143 set getspent d_getspent
9144 eval $inlibc
9145
9146 : see if getspnam exists
9147 set getspnam d_getspnam
9148 eval $inlibc
9149
9150 : see if gettimeofday or ftime exists
9151 set gettimeofday d_gettimeod
9152 eval $inlibc
9153 case "$d_gettimeod" in
9154 "$undef")
9155         set ftime d_ftime 
9156         eval $inlibc
9157         ;;
9158 *)
9159         val="$undef"; set d_ftime; eval $setvar
9160         ;;
9161 esac
9162 case "$d_gettimeod$d_ftime" in
9163 "$undef$undef")
9164         echo " "
9165         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9166         ;;
9167 esac
9168
9169 : see if this is an grp system
9170 set grp.h i_grp
9171 eval $inhdr
9172
9173 case "$i_grp" in
9174 $define)
9175         xxx=`./findhdr grp.h`
9176         $cppstdin $cppflags $cppminus < $xxx >$$.h
9177
9178         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9179                 val="$define"
9180         else
9181                 val="$undef"
9182         fi
9183         set d_grpasswd
9184         eval $setvar
9185
9186         $rm -f $$.h
9187         ;;
9188 *)
9189         val="$undef";
9190         set d_grpasswd; eval $setvar
9191         ;;
9192 esac
9193
9194 : see if hasmntopt exists
9195 set hasmntopt d_hasmntopt
9196 eval $inlibc
9197
9198 : see if this is a netinet/in.h or sys/in.h system
9199 set netinet/in.h i_niin sys/in.h i_sysin
9200 eval $inhdr
9201
9202 : see if arpa/inet.h has to be included
9203 set arpa/inet.h i_arpainet
9204 eval $inhdr
9205
9206 : see if htonl --and friends-- exists
9207 val=''
9208 set htonl val
9209 eval $inlibc
9210
9211 : Maybe they are macros.
9212 case "$val" in
9213 $undef)
9214         $cat >htonl.c <<EOM
9215 #include <stdio.h>
9216 #include <sys/types.h>
9217 #$i_niin I_NETINET_IN
9218 #$i_sysin I_SYS_IN
9219 #$i_arpainet I_ARPA_INET
9220 #ifdef I_NETINET_IN
9221 #include <netinet/in.h>
9222 #endif
9223 #ifdef I_SYS_IN
9224 #include <sys/in.h>
9225 #endif
9226 #ifdef I_ARPA_INET
9227 #include <arpa/inet.h>
9228 #endif
9229 #ifdef htonl
9230 printf("Defined as a macro.");
9231 #endif
9232 EOM
9233         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9234         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9235                 val="$define"
9236                 echo "But it seems to be defined as a macro." >&4
9237         fi
9238         $rm -f htonl.?
9239         ;;
9240 esac
9241 set d_htonl
9242 eval $setvar
9243
9244 : see if iconv exists
9245 set iconv d_iconv
9246 eval $inlibc
9247
9248 : index or strchr
9249 echo " "
9250 if set index val -f; eval $csym; $val; then
9251         if set strchr val -f d_strchr; eval $csym; $val; then
9252                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9253                         val="$define"
9254                         vali="$undef"
9255                         echo "strchr() found." >&4
9256                 else
9257                         val="$undef"
9258                         vali="$define"
9259                         echo "index() found." >&4
9260                 fi
9261         else
9262                 val="$undef"
9263                 vali="$define"
9264                 echo "index() found." >&4
9265         fi
9266 else
9267         if set strchr val -f d_strchr; eval $csym; $val; then
9268                 val="$define"
9269                 vali="$undef"
9270                 echo "strchr() found." >&4
9271         else
9272                 echo "No index() or strchr() found!" >&4
9273                 val="$undef"
9274                 vali="$undef"
9275         fi
9276 fi
9277 set d_strchr; eval $setvar
9278 val="$vali"
9279 set d_index; eval $setvar
9280
9281 : check whether inet_aton exists
9282 set inet_aton d_inetaton
9283 eval $inlibc
9284
9285 : see if inttypes.h is available
9286 : we want a real compile instead of Inhdr because some systems
9287 : have an inttypes.h which includes non-existent headers
9288 echo " "
9289 $cat >try.c <<EOCP
9290 #include <inttypes.h>
9291 int main() {
9292         static int32_t foo32 = 0x12345678;
9293 }
9294 EOCP
9295 set try
9296 if eval $compile; then
9297         echo "<inttypes.h> found." >&4
9298         val="$define"
9299 else
9300         echo "<inttypes.h> NOT found." >&4
9301         val="$undef"
9302 fi
9303 $rm -f try.c try
9304 set i_inttypes
9305 eval $setvar
9306
9307 : check for int64_t
9308 echo " "
9309 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9310 $cat >try.c <<EOCP
9311 #include <sys/types.h>
9312 #$i_inttypes I_INTTYPES
9313 #ifdef I_INTTYPES
9314 #include <inttypes.h>
9315 #endif
9316 int main() { int64_t x = 7; }
9317 EOCP
9318 set try
9319 if eval $compile; then
9320         val="$define"
9321         echo " Yes, it does." >&4
9322 else
9323         val="$undef"
9324         echo " No, it doesn't." >&4
9325 fi
9326 $rm -f try try.*
9327 set d_int64t
9328 eval $setvar
9329
9330 : Look for isascii
9331 echo " "
9332 $cat >isascii.c <<'EOCP'
9333 #include <stdio.h>
9334 #include <ctype.h>
9335 int main() {
9336         int c = 'A';
9337         if (isascii(c))
9338                 exit(0);
9339         else
9340                 exit(1);
9341 }
9342 EOCP
9343 set isascii
9344 if eval $compile; then
9345         echo "isascii() found." >&4
9346         val="$define"
9347 else
9348         echo "isascii() NOT found." >&4
9349         val="$undef"
9350 fi
9351 set d_isascii
9352 eval $setvar
9353 $rm -f isascii*
9354
9355 : see if killpg exists
9356 set killpg d_killpg
9357 eval $inlibc
9358
9359 : see if lchown exists
9360 echo " "
9361 $cat > try.c <<'EOCP'
9362 /* System header to define __stub macros and hopefully few prototypes,
9363     which can conflict with char lchown(); below.  */
9364 #include <assert.h>
9365 /* Override any gcc2 internal prototype to avoid an error.  */
9366 /* We use char because int might match the return type of a gcc2
9367    builtin and then its argument prototype would still apply.  */
9368 char lchown();
9369 int main() {
9370     /*  The GNU C library defines this for functions which it implements
9371         to always fail with ENOSYS.  Some functions are actually named
9372         something starting with __ and the normal name is an alias.  */
9373 #if defined (__stub_lchown) || defined (__stub___lchown)
9374 choke me
9375 #else
9376 lchown();
9377 #endif
9378 ; return 0; }
9379 EOCP
9380 set try
9381 if eval $compile; then
9382     $echo "lchown() found." >&4
9383     val="$define"
9384 else
9385     $echo "lchown() NOT found." >&4
9386     val="$undef"
9387 fi
9388 set d_lchown
9389 eval $setvar
9390
9391 : See if number of significant digits in a double precision number is known
9392 echo " "
9393 $cat >ldbl_dig.c <<EOM
9394 #$i_limits I_LIMITS
9395 #$i_float I_FLOAT
9396 #ifdef I_LIMITS
9397 #include <limits.h>
9398 #endif
9399 #ifdef I_FLOAT
9400 #include <float.h>
9401 #endif
9402 #ifdef LDBL_DIG
9403 printf("Contains LDBL_DIG");
9404 #endif
9405 EOM
9406 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9407 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9408         echo "LDBL_DIG found." >&4
9409         val="$define"
9410 else
9411         echo "LDBL_DIG NOT found." >&4
9412         val="$undef"
9413 fi
9414 $rm -f ldbl_dig.?
9415 set d_ldbl_dig
9416 eval $setvar
9417
9418 : see if link exists
9419 set link d_link
9420 eval $inlibc
9421
9422 : see if localeconv exists
9423 set localeconv d_locconv
9424 eval $inlibc
9425
9426 : see if lockf exists
9427 set lockf d_lockf
9428 eval $inlibc
9429
9430 : check for long long
9431 echo " "
9432 $echo $n "Checking to see if your system supports long long..." $c >&4
9433 echo 'int main() { long long x = 7; return 0; }' > try.c
9434 set try
9435 if eval $compile; then
9436         val="$define"
9437         echo " Yes, it does." >&4
9438 else
9439         val="$undef"
9440         echo " No, it doesn't." >&4
9441 fi
9442 $rm try.*
9443 set d_longlong
9444 eval $setvar
9445
9446 : check for length of long long
9447 case "${d_longlong}${longlongsize}" in
9448 $define)
9449         echo " "
9450         $echo $n "Checking to see how big your long longs are..." $c >&4
9451         $cat >try.c <<'EOCP'
9452 #include <stdio.h>
9453 int main()
9454 {
9455     printf("%d\n", (int)sizeof(long long));
9456     return(0);
9457 }
9458 EOCP
9459         set try
9460         if eval $compile_ok; then
9461                 longlongsize=`./try$exe_ext`
9462                 $echo " $longlongsize bytes." >&4
9463         else
9464                 dflt='8'
9465                 echo " "
9466                 echo "(I can't seem to compile the test program.  Guessing...)"
9467                 rp="What is the size of a long long (in bytes)?"
9468                 . ./myread
9469                 longlongsize="$ans"
9470         fi
9471         if $test "X$longsize" = "X$longlongsize"; then
9472                 echo "(That isn't any different from an ordinary long.)"
9473         fi      
9474         ;;
9475 esac
9476 $rm -f try.* try
9477
9478 : see if lstat exists
9479 set lstat d_lstat
9480 eval $inlibc
9481
9482 : see if mblen exists
9483 set mblen d_mblen
9484 eval $inlibc
9485
9486 : see if mbstowcs exists
9487 set mbstowcs d_mbstowcs
9488 eval $inlibc
9489
9490 : see if mbtowc exists
9491 set mbtowc d_mbtowc
9492 eval $inlibc
9493
9494 : see if memchr exists
9495 set memchr d_memchr
9496 eval $inlibc
9497
9498 : see if memcmp exists
9499 set memcmp d_memcmp
9500 eval $inlibc
9501
9502 : see if memcpy exists
9503 set memcpy d_memcpy
9504 eval $inlibc
9505
9506 : see if memmove exists
9507 set memmove d_memmove
9508 eval $inlibc
9509
9510 : see if memset exists
9511 set memset d_memset
9512 eval $inlibc
9513
9514 : see if mkdir exists
9515 set mkdir d_mkdir
9516 eval $inlibc
9517
9518 : see if mkdtemp exists
9519 set mkdtemp d_mkdtemp
9520 eval $inlibc
9521
9522 : see if mkfifo exists
9523 set mkfifo d_mkfifo
9524 eval $inlibc
9525
9526 : see if mkstemp exists
9527 set mkstemp d_mkstemp
9528 eval $inlibc
9529
9530 : see if mkstemps exists
9531 set mkstemps d_mkstemps
9532 eval $inlibc
9533
9534 : see if mktime exists
9535 set mktime d_mktime
9536 eval $inlibc
9537
9538 : see if mprotect exists
9539 set mprotect d_mprotect
9540 eval $inlibc
9541
9542 : see if msgctl exists
9543 set msgctl d_msgctl
9544 eval $inlibc
9545
9546 : see if msgget exists
9547 set msgget d_msgget
9548 eval $inlibc
9549
9550 : see if msgsnd exists
9551 set msgsnd d_msgsnd
9552 eval $inlibc
9553
9554 : see if msgrcv exists
9555 set msgrcv d_msgrcv
9556 eval $inlibc
9557
9558 : see how much of the 'msg*(2)' library is present.
9559 h_msg=true
9560 echo " "
9561 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9562 *"$undef"*) h_msg=false;;
9563 esac
9564 case "$osname" in
9565 freebsd)
9566     case "`ipcs 2>&1`" in
9567     "SVID messages"*"not configured"*)
9568         echo "Your $osname does not have the msg*(2) configured." >&4
9569         h_msg=false
9570         val="$undef"
9571         set msgctl d_msgctl
9572         eval $setvar
9573         set msgget d_msgget
9574         eval $setvar
9575         set msgsnd d_msgsnd
9576         eval $setvar
9577         set msgrcv d_msgrcv
9578         eval $setvar
9579         ;;
9580     esac
9581     ;;
9582 esac
9583 : we could also check for sys/ipc.h ...
9584 if $h_msg && $test `./findhdr sys/msg.h`; then
9585         echo "You have the full msg*(2) library." >&4
9586         val="$define"
9587 else
9588         echo "You don't have the full msg*(2) library." >&4
9589         val="$undef"
9590 fi
9591 set d_msg
9592 eval $setvar
9593
9594 : see if msync exists
9595 set msync d_msync
9596 eval $inlibc
9597
9598 : see if munmap exists
9599 set munmap d_munmap
9600 eval $inlibc
9601
9602 : see if nice exists
9603 set nice d_nice
9604 eval $inlibc
9605
9606
9607 echo " "
9608 echo "Checking which 64-bit integer type we could use..." >&4
9609
9610 case "$intsize" in
9611 8) val=int
9612    set quadtype
9613    eval $setvar
9614    val='"unsigned int"'
9615    set uquadtype
9616    eval $setvar
9617    quadkind=1
9618    ;;
9619 *) case "$longsize" in
9620    8) val=long
9621       set quadtype
9622       eval $setvar
9623       val='"unsigned long"'
9624       set uquadtype
9625       eval $setvar
9626       quadkind=2
9627       ;;
9628    *) case "$d_longlong:$longlongsize" in
9629       define:8)
9630         val='"long long"'
9631         set quadtype
9632         eval $setvar
9633         val='"unsigned long long"'
9634         set uquadtype
9635         eval $setvar
9636         quadkind=3
9637         ;;
9638       *) case "$d_int64t" in
9639          define)
9640            val=int64_t
9641            set quadtype
9642            eval $setvar
9643            val=uint64_t
9644            set uquadtype
9645            eval $setvar
9646            quadkind=4
9647            ;;
9648          esac
9649          ;;
9650       esac
9651       ;;
9652    esac
9653    ;;
9654 esac
9655
9656 case "$quadtype" in
9657 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9658         undef:define:8)
9659            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9660         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9661         esac
9662         d_quad="$undef"
9663         ;;
9664 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9665             verb="will"
9666         else
9667             verb="could"
9668         fi
9669         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9670         d_quad="$define"
9671         ;;
9672 esac
9673
9674 : check for length of character
9675 echo " "
9676 case "$charsize" in
9677 '')
9678         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9679         $cat >try.c <<'EOCP'
9680 #include <stdio.h>
9681 int main()
9682 {
9683     printf("%d\n", (int)sizeof(char));
9684     exit(0);
9685 }
9686 EOCP
9687         set try
9688         if eval $compile_ok; then
9689                 dflt=`./try`
9690         else
9691                 dflt='1'
9692                 echo "(I can't seem to compile the test program.  Guessing...)"
9693         fi
9694         ;;
9695 *)
9696         dflt="$charsize"
9697         ;;
9698 esac
9699 rp="What is the size of a character (in bytes)?"
9700 . ./myread
9701 charsize="$ans"
9702 $rm -f try.c try
9703
9704
9705 echo " "
9706 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9707
9708 case "$use64bits:$d_quad:$quadtype" in
9709 define:define:?*)
9710         ivtype="$quadtype"
9711         uvtype="$uquadtype"
9712         ivsize=8
9713         uvsize=8
9714         ;;
9715 *)      ivtype="long"
9716         uvtype="unsigned long"
9717         ivsize=$longsize
9718         uvsize=$longsize
9719         ;;
9720 esac
9721
9722 case "$uselongdouble:$d_longdbl" in
9723 define:define)
9724         nvtype="long double"
9725         nvsize=$longdblsize
9726         ;;
9727 *)      nvtype=double
9728         nvsize=$doublesize
9729         ;;
9730 esac
9731
9732 $echo "(IV will be "$ivtype", $ivsize bytes)"
9733 $echo "(UV will be "$uvtype", $uvsize bytes)"
9734 $echo "(NV will be "$nvtype", $nvsize bytes)"
9735
9736 $cat >try.c <<EOCP
9737 #$i_inttypes I_INTTYPES
9738 #ifdef I_INTTYPES
9739 #include <inttypes.h>
9740 #endif
9741 #include <stdio.h>
9742 int main() {
9743 #ifdef INT8
9744    int8_t i =  INT8_MAX;
9745   uint8_t u = UINT8_MAX;
9746   printf("int8_t\n");
9747 #endif
9748 #ifdef INT16
9749    int16_t i =  INT16_MAX;
9750   uint16_t i = UINT16_MAX;
9751   printf("int16_t\n");
9752 #endif
9753 #ifdef INT32
9754    int32_t i =  INT32_MAX;
9755   uint32_t u = UINT32_MAX;
9756   printf("int32_t\n");
9757 #endif
9758 }
9759 EOCP
9760
9761 case "$i8type" in
9762 '')     case "$charsize" in
9763         1)      i8type=char
9764                 u8type="unsigned char"
9765                 i8size=$charsize
9766                 u8size=$charsize
9767                 ;;
9768         esac
9769         ;;
9770 esac
9771 case "$i8type" in
9772 '')     set try -DINT8
9773         if eval $compile; then
9774                 case "`./try$exe_ext`" in
9775                 int8_t) i8type=int8_t
9776                         u8type=uint8_t
9777                         i8size=1
9778                         u8size=1
9779                         ;;
9780                 esac
9781         fi
9782         ;;
9783 esac
9784 case "$i8type" in
9785 '')     if $test $charsize -ge 1; then
9786                 i8type=char
9787                 u8type="unsigned char"
9788                 i8size=$charsize
9789                 u8size=$charsize
9790         fi
9791         ;;
9792 esac
9793
9794 case "$i16type" in
9795 '')     case "$shortsize" in
9796         2)      i16type=short
9797                 u16type="unsigned short"
9798                 i16size=$shortsize
9799                 u16size=$shortsize
9800                 ;;
9801         esac
9802         ;;
9803 esac
9804 case "$i16type" in
9805 '')     set try -DINT16
9806         if eval $compile; then
9807                 case "`./try$exe_ext`" in
9808                 int16_t)
9809                         i16type=int16_t
9810                         u16type=uint16_t
9811                         i16size=2
9812                         u16size=2
9813                         ;;
9814                 esac
9815         fi
9816         ;;
9817 esac
9818 case "$i16type" in
9819 '')     if $test $shortsize -ge 2; then
9820                 i16type=short
9821                 u16type="unsigned short"
9822                 i16size=$shortsize
9823                 u16size=$shortsize
9824         fi
9825         ;;
9826 esac
9827
9828 case "$i32type" in
9829 '')     case "$longsize" in
9830         4)      i32type=long
9831                 u32type="unsigned long"
9832                 i32size=$longsize
9833                 u32size=$longsize
9834                 ;;
9835         *)      case "$intsize" in
9836                 4)      i32type=int
9837                         u32type="unsigned int"
9838                         i32size=$intsize
9839                         u32size=$intsize
9840                         ;;
9841                 esac
9842                 ;;
9843         esac
9844         ;;
9845 esac
9846 case "$i32type" in
9847 '')     set try -DINT32
9848         if eval $compile; then
9849                 case "`./try$exe_ext`" in
9850                 int32_t)
9851                         i32type=int32_t
9852                         u32type=uint32_t
9853                         i32size=4
9854                         u32size=4
9855                         ;;
9856                 esac
9857         fi
9858         ;;
9859 esac
9860 case "$i32type" in
9861 '')     if $test $intsize -ge 4; then
9862                 i32type=int
9863                 u32type="unsigned int"
9864                 i32size=$intsize
9865                 u32size=$intsize
9866         fi
9867         ;;
9868 esac
9869
9870 case "$i64type" in
9871 '')     case "$d_quad:$quadtype" in
9872         define:?*)
9873                 i64type="$quadtype"
9874                 u64type="$uquadtype"
9875                 i64size=8
9876                 u64size=8
9877                 ;;
9878         esac
9879         ;;
9880 esac
9881
9882 $echo "Checking whether your NVs can preserve your UVs..." >&4
9883 $cat <<EOP >try.c
9884 #include <stdio.h>
9885 int main() {
9886     $uvtype k = ($uvtype)~0, l;
9887     $nvtype d;
9888     l = k;
9889     d = ($nvtype)l;
9890     l = ($uvtype)d;
9891     if (l == k)
9892        printf("preserve\n");
9893     exit(0);
9894 }
9895 EOP
9896 set try
9897 if eval $compile; then
9898         case "`./try$exe_ext`" in
9899         preserve) d_nv_preserves_uv="$define" ;;
9900         esac
9901 fi      
9902 case "$d_nv_preserves_uv" in
9903 $define) $echo "Yes, they can."  2>&1 ;;
9904 *)       $echo "No, they can't." 2>&1
9905          d_nv_preserves_uv="$undef"
9906          ;;
9907 esac
9908
9909 $rm -f try.* try
9910
9911 : see if POSIX threads are available
9912 set pthread.h i_pthread
9913 eval $inhdr
9914
9915
9916
9917
9918 : how to create joinable pthreads
9919 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9920         echo " "
9921         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9922         $cat >try.c <<'EOCP'
9923 #include <pthread.h>
9924 int main() {
9925     int detachstate = JOINABLE;
9926 }
9927 EOCP
9928         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9929         if eval $compile; then
9930                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9931                 val="$undef" # Yes, undef.
9932                 set d_old_pthread_create_joinable
9933                 eval $setvar
9934                 val=""
9935                 set old_pthread_create_joinable
9936                 eval $setvar
9937         else
9938                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9939                 if eval $compile; then
9940                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9941                         val="$define"
9942                         set d_old_pthread_create_joinable
9943                         eval $setvar
9944                         val=PTHREAD_CREATE_UNDETACHED
9945                         set old_pthread_create_joinable
9946                         eval $setvar
9947                 else            
9948                         set try -DJOINABLE=__UNDETACHED
9949                         if eval $compile; then
9950                                 echo "You seem to use __UNDETACHED." >&4
9951                                 val="$define"
9952                                 set d_old_pthread_create_joinable
9953                                 eval $setvar
9954                                 val=__UNDETACHED
9955                                 set old_pthread_create_joinable
9956                                 eval $setvar
9957                         else
9958                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9959                                 val="$define"
9960                                 set d_old_pthread_create_joinable
9961                                 eval $setvar
9962                                 val=0
9963                                 set old_pthread_create_joinable
9964                                 eval $setvar
9965                         fi
9966                 fi
9967         fi
9968         $rm -f try try.*
9969 else
9970     d_old_pthread_create_joinable="$undef"
9971     old_pthread_create_joinable=""
9972 fi
9973
9974 : see if pause exists
9975 set pause d_pause
9976 eval $inlibc
9977
9978 : see if pipe exists
9979 set pipe d_pipe
9980 eval $inlibc
9981
9982 : see if poll exists
9983 set poll d_poll
9984 eval $inlibc
9985
9986
9987 : see whether the various POSIXish _yields exist
9988 $cat >try.c <<EOP
9989 #include <pthread.h>
9990 #include <stdio.h>
9991 int main() {
9992 #ifdef SCHED_YIELD
9993         sched_yield();
9994 #else
9995 #ifdef PTHREAD_YIELD
9996         pthread_yield();
9997 #else
9998 #ifdef PTHREAD_YIELD_NULL
9999         pthread_yield(NULL);
10000 #endif
10001 #endif
10002 #endif
10003 }
10004 EOP
10005 : see if sched_yield exists
10006 set try -DSCHED_YIELD
10007 if eval $compile; then
10008     val="$define"
10009     sched_yield='sched_yield()'
10010 else
10011     val="$undef"
10012 fi
10013 case "$usethreads" in
10014 $define)
10015         case "$val" in
10016         $define) echo 'sched_yield() found.' >&4        ;;
10017         *)       echo 'sched_yield() NOT found.' >&4    ;;
10018         esac
10019 esac
10020 set d_sched_yield
10021 eval $setvar
10022
10023 : see if pthread_yield exists
10024 set try -DPTHREAD_YIELD
10025 if eval $compile; then
10026     val="$define"
10027     case "$sched_yield" in
10028     '') sched_yield='pthread_yield()' ;;
10029     esac
10030 else
10031     set try -DPTHREAD_YIELD_NULL
10032     if eval $compile; then
10033         val="$define"
10034         case "$sched_yield" in
10035         '') sched_yield='pthread_yield(NULL)' ;;
10036         esac
10037     else
10038         val="$undef"
10039     fi
10040 fi
10041 case "$usethreads" in
10042 $define)
10043         case "$val" in
10044         $define) echo 'pthread_yield() found.' >&4      ;;
10045         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10046         esac
10047         ;;
10048 esac
10049 set d_pthread_yield
10050 eval $setvar
10051
10052 case "$sched_yield" in
10053 '') sched_yield=undef ;;
10054 esac
10055
10056 $rm -f try try.*
10057
10058 : see if this is a pwd.h system
10059 set pwd.h i_pwd
10060 eval $inhdr
10061
10062 case "$i_pwd" in
10063 $define)
10064         xxx=`./findhdr pwd.h`
10065         $cppstdin $cppflags $cppminus < $xxx >$$.h
10066
10067         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10068                 val="$define"
10069         else
10070                 val="$undef"
10071         fi
10072         set d_pwquota
10073         eval $setvar
10074
10075         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10076                 val="$define"
10077         else
10078                 val="$undef"
10079         fi
10080         set d_pwage
10081         eval $setvar
10082
10083         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10084                 val="$define"
10085         else
10086                 val="$undef"
10087         fi
10088         set d_pwchange
10089         eval $setvar
10090
10091         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10092                 val="$define"
10093         else
10094                 val="$undef"
10095         fi
10096         set d_pwclass
10097         eval $setvar
10098
10099         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10100                 val="$define"
10101         else
10102                 val="$undef"
10103         fi
10104         set d_pwexpire
10105         eval $setvar
10106
10107         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10108                 val="$define"
10109         else
10110                 val="$undef"
10111         fi
10112         set d_pwcomment
10113         eval $setvar
10114
10115         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10116                 val="$define"
10117         else
10118                 val="$undef"
10119         fi
10120         set d_pwgecos
10121         eval $setvar
10122
10123         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10124                 val="$define"
10125         else
10126                 val="$undef"
10127         fi
10128         set d_pwpasswd
10129         eval $setvar
10130
10131         $rm -f $$.h
10132         ;;
10133 *)
10134         val="$undef"; 
10135         set d_pwquota; eval $setvar
10136         set d_pwage; eval $setvar
10137         set d_pwchange; eval $setvar
10138         set d_pwclass; eval $setvar
10139         set d_pwexpire; eval $setvar
10140         set d_pwcomment; eval $setvar
10141         set d_pwgecos; eval $setvar
10142         set d_pwpasswd; eval $setvar
10143         ;;
10144 esac
10145
10146 : see if readdir and friends exist
10147 set readdir d_readdir
10148 eval $inlibc
10149 set seekdir d_seekdir
10150 eval $inlibc
10151 set telldir d_telldir
10152 eval $inlibc
10153 set rewinddir d_rewinddir
10154 eval $inlibc
10155
10156 : see if readlink exists
10157 set readlink d_readlink
10158 eval $inlibc
10159
10160 : see if rename exists
10161 set rename d_rename
10162 eval $inlibc
10163
10164 : see if rmdir exists
10165 set rmdir d_rmdir
10166 eval $inlibc
10167
10168 : see if memory.h is available.
10169 val=''
10170 set memory.h val
10171 eval $inhdr
10172
10173 : See if it conflicts with string.h
10174 case "$val" in
10175 $define)
10176         case "$strings" in
10177         '') ;;
10178         *)
10179                 $cppstdin $cppflags $cppminus < $strings > mem.h
10180                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10181                         echo " "
10182                         echo "We won't be including <memory.h>."
10183                         val="$undef"
10184                 fi
10185                 $rm -f mem.h
10186                 ;;
10187         esac
10188 esac
10189 set i_memory
10190 eval $setvar
10191
10192 : can bcopy handle overlapping blocks?
10193 val="$undef"
10194 case "$d_bcopy" in
10195 "$define")
10196         echo " "
10197         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10198         $cat >try.c <<EOCP
10199 #$i_memory I_MEMORY
10200 #$i_stdlib I_STDLIB
10201 #$i_string I_STRING
10202 #$i_unistd I_UNISTD
10203 EOCP
10204         $cat >>try.c <<'EOCP'
10205 #include <stdio.h>
10206 #ifdef I_MEMORY
10207 #  include <memory.h>
10208 #endif
10209 #ifdef I_STDLIB
10210 #  include <stdlib.h>
10211 #endif
10212 #ifdef I_STRING
10213 #  include <string.h>
10214 #else
10215 #  include <strings.h>
10216 #endif
10217 #ifdef I_UNISTD
10218 #  include <unistd.h>  /* Needed for NetBSD */
10219 #endif
10220 int main()
10221 {
10222 char buf[128], abc[128];
10223 char *b;
10224 int len;
10225 int off;
10226 int align;
10227
10228 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10229
10230 for (align = 7; align >= 0; align--) {
10231         for (len = 36; len; len--) {
10232                 b = buf+align;
10233                 bcopy(abc, b, len);
10234                 for (off = 1; off <= len; off++) {
10235                         bcopy(b, b+off, len);
10236                         bcopy(b+off, b, len);
10237                         if (bcmp(b, abc, len))
10238                                 exit(1);
10239                 }
10240         }
10241 }
10242 exit(0);
10243 }
10244 EOCP
10245         set try
10246         if eval $compile_ok; then
10247                 if ./try 2>/dev/null; then
10248                         echo "Yes, it can."
10249                         val="$define"
10250                 else
10251                         echo "It can't, sorry."
10252                         case "$d_memmove" in
10253                         "$define") echo "But that's Ok since you have memmove()." ;;
10254                         esac
10255                 fi
10256         else
10257                 echo "(I can't compile the test program, so we'll assume not...)"
10258                 case "$d_memmove" in
10259                 "$define") echo "But that's Ok since you have memmove()." ;;
10260                 esac
10261         fi
10262         ;;
10263 esac
10264 $rm -f try.* try core
10265 set d_safebcpy
10266 eval $setvar
10267
10268 : can memcpy handle overlapping blocks?
10269 val="$undef"
10270 case "$d_memcpy" in
10271 "$define")
10272         echo " "
10273         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10274         $cat >try.c <<EOCP
10275 #$i_memory I_MEMORY
10276 #$i_stdlib I_STDLIB
10277 #$i_string I_STRING
10278 #$i_unistd I_UNISTD
10279 EOCP
10280         $cat >>try.c <<'EOCP'
10281 #include <stdio.h>
10282 #ifdef I_MEMORY
10283 #  include <memory.h>
10284 #endif
10285 #ifdef I_STDLIB
10286 #  include <stdlib.h>
10287 #endif
10288 #ifdef I_STRING
10289 #  include <string.h>
10290 #else
10291 #  include <strings.h>
10292 #endif
10293 #ifdef I_UNISTD
10294 #  include <unistd.h>  /* Needed for NetBSD */
10295 #endif
10296 int main()
10297 {
10298 char buf[128], abc[128];
10299 char *b;
10300 int len;
10301 int off;
10302 int align;
10303
10304 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10305    try to store the string in read-only memory. */
10306 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10307
10308 for (align = 7; align >= 0; align--) {
10309         for (len = 36; len; len--) {
10310                 b = buf+align;
10311                 memcpy(b, abc, len);
10312                 for (off = 1; off <= len; off++) {
10313                         memcpy(b+off, b, len);
10314                         memcpy(b, b+off, len);
10315                         if (memcmp(b, abc, len))
10316                                 exit(1);
10317                 }
10318         }
10319 }
10320 exit(0);
10321 }
10322 EOCP
10323         set try
10324         if eval $compile_ok; then
10325                 if ./try 2>/dev/null; then
10326                         echo "Yes, it can."
10327                         val="$define"
10328                 else
10329                         echo "It can't, sorry."
10330                         case "$d_memmove" in
10331                         "$define") echo "But that's Ok since you have memmove()." ;;
10332                         esac
10333                 fi
10334         else
10335                 echo "(I can't compile the test program, so we'll assume not...)"
10336                 case "$d_memmove" in
10337                 "$define") echo "But that's Ok since you have memmove()." ;;
10338                 esac
10339         fi
10340         ;;
10341 esac
10342 $rm -f try.* try core
10343 set d_safemcpy
10344 eval $setvar
10345
10346 : can memcmp be trusted to compare relative magnitude?
10347 val="$undef"
10348 case "$d_memcmp" in
10349 "$define")
10350         echo " "
10351         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10352         $cat >try.c <<EOCP
10353 #$i_memory I_MEMORY
10354 #$i_stdlib I_STDLIB
10355 #$i_string I_STRING
10356 #$i_unistd I_UNISTD
10357 EOCP
10358         $cat >>try.c <<'EOCP'
10359 #include <stdio.h>
10360 #ifdef I_MEMORY
10361 #  include <memory.h>
10362 #endif
10363 #ifdef I_STDLIB
10364 #  include <stdlib.h>
10365 #endif
10366 #ifdef I_STRING
10367 #  include <string.h>
10368 #else
10369 #  include <strings.h>
10370 #endif
10371 #ifdef I_UNISTD
10372 #  include <unistd.h>  /* Needed for NetBSD */
10373 #endif
10374 int main()
10375 {
10376 char a = -1;
10377 char b = 0;
10378 if ((a < b) && memcmp(&a, &b, 1) < 0)
10379         exit(1);
10380 exit(0);
10381 }
10382 EOCP
10383         set try
10384         if eval $compile_ok; then
10385                 if ./try 2>/dev/null; then
10386                         echo "Yes, it can."
10387                         val="$define"
10388                 else
10389                         echo "No, it can't (it uses signed chars)."
10390                 fi
10391         else
10392                 echo "(I can't compile the test program, so we'll assume not...)"
10393         fi
10394         ;;
10395 esac
10396 $rm -f try.* try core
10397 set d_sanemcmp
10398 eval $setvar
10399
10400 : see if select exists
10401 set select d_select
10402 eval $inlibc
10403
10404 : see if semctl exists
10405 set semctl d_semctl
10406 eval $inlibc
10407
10408 : see if semget exists
10409 set semget d_semget
10410 eval $inlibc
10411
10412 : see if semop exists
10413 set semop d_semop
10414 eval $inlibc
10415
10416 : see how much of the 'sem*(2)' library is present.
10417 h_sem=true
10418 echo " "
10419 case "$d_semctl$d_semget$d_semop" in
10420 *"$undef"*) h_sem=false;;
10421 esac
10422 case "$osname" in
10423 freebsd)
10424     case "`ipcs 2>&1`" in
10425     "SVID messages"*"not configured"*)
10426         echo "Your $osname does not have the sem*(2) configured." >&4
10427         h_sem=false
10428         val="$undef"
10429         set semctl d_semctl
10430         eval $setvar
10431         set semget d_semget
10432         eval $setvar
10433         set semop d_semop
10434         eval $setvar
10435         ;;
10436     esac
10437     ;;
10438 esac
10439 : we could also check for sys/ipc.h ...
10440 if $h_sem && $test `./findhdr sys/sem.h`; then
10441         echo "You have the full sem*(2) library." >&4
10442         val="$define"
10443 else
10444         echo "You don't have the full sem*(2) library." >&4
10445         val="$undef"
10446 fi
10447 set d_sem
10448 eval $setvar
10449
10450 : see whether sys/sem.h defines union semun
10451 echo " "
10452 $cat > try.c <<'END'
10453 #include <sys/types.h>
10454 #include <sys/ipc.h>
10455 #include <sys/sem.h>
10456 int main () { union semun semun; semun.buf = 0; }
10457 END
10458 set try
10459 if eval $compile; then
10460     echo "You have union semun in <sys/sem.h>." >&4
10461     val="$define"
10462 else
10463     echo "You do not have union semun in <sys/sem.h>." >&4
10464     val="$undef"
10465 fi
10466 $rm -f try try.c try.h
10467 set d_union_semun
10468 eval $setvar
10469
10470 : see how to do semctl IPC_STAT
10471 case "$d_sem" in
10472 $define)
10473     : see whether semctl IPC_STAT can use union semun
10474     echo " "
10475     $cat > try.h <<END
10476 #ifndef S_IRUSR
10477 #   ifdef S_IREAD
10478 #       define S_IRUSR S_IREAD
10479 #       define S_IWUSR S_IWRITE
10480 #       define S_IXUSR S_IEXEC
10481 #   else
10482 #       define S_IRUSR 0400
10483 #       define S_IWUSR 0200
10484 #       define S_IXUSR 0100
10485 #   endif
10486 #   define S_IRGRP (S_IRUSR>>3)
10487 #   define S_IWGRP (S_IWUSR>>3)
10488 #   define S_IXGRP (S_IXUSR>>3)
10489 #   define S_IROTH (S_IRUSR>>6)
10490 #   define S_IWOTH (S_IWUSR>>6)
10491 #   define S_IXOTH (S_IXUSR>>6)
10492 #endif
10493 #ifndef S_IRWXU
10494 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10495 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10496 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10497 #endif
10498 END
10499
10500     $cat > try.c <<END
10501 #include <sys/types.h>
10502 #include <sys/ipc.h>
10503 #include <sys/sem.h>
10504 #include <sys/stat.h>
10505 #include <stdio.h>
10506 #include <errno.h>
10507 #include "try.h"
10508 #ifndef errno
10509 extern int errno;
10510 #endif
10511 #$d_union_semun HAS_UNION_SEMUN
10512 int main() {
10513     union semun
10514 #ifndef HAS_UNION_SEMUN
10515     {
10516         int val;
10517         struct semid_ds *buf;
10518         unsigned short *array;
10519     }
10520 #endif
10521     arg;
10522     int sem, st;
10523
10524 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10525     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10526     if (sem > -1) {
10527         struct semid_ds argbuf;
10528         arg.buf = &argbuf;
10529 #       ifdef IPC_STAT
10530         st = semctl(sem, 0, IPC_STAT, arg);
10531         if (st == 0)
10532             printf("semun\n");
10533         else
10534 #       endif /* IPC_STAT */
10535             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10536 #       ifdef IPC_RMID
10537         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10538 #       endif /* IPC_RMID */
10539             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10540     } else
10541 #endif /* IPC_PRIVATE && ... */
10542         printf("semget failed: errno = %d\n", errno);
10543   return 0;
10544 }
10545 END
10546     val="$undef"
10547     set try
10548     if eval $compile; then
10549         xxx=`./try`
10550         case "$xxx" in
10551         semun) val="$define" ;;
10552         esac
10553     fi
10554     $rm -f try try.c
10555     set d_semctl_semun
10556     eval $setvar
10557     case "$d_semctl_semun" in
10558     $define)
10559         echo "You can use union semun for semctl IPC_STAT." >&4
10560         also='also'
10561         ;;
10562     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10563         also=''
10564         ;;
10565     esac
10566
10567     : see whether semctl IPC_STAT can use struct semid_ds pointer
10568     $cat > try.c <<'END'
10569 #include <sys/types.h>
10570 #include <sys/ipc.h>
10571 #include <sys/sem.h>
10572 #include <sys/stat.h>
10573 #include "try.h"
10574 #include <stdio.h>
10575 #include <errno.h>
10576 #ifndef errno
10577 extern int errno;
10578 #endif
10579 int main() {
10580     struct semid_ds arg;
10581     int sem, st;
10582
10583 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10584     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10585     if (sem > -1) {
10586 #       ifdef IPC_STAT
10587         st = semctl(sem, 0, IPC_STAT, &arg);
10588         if (st == 0)
10589             printf("semid_ds\n");
10590         else
10591 #       endif /* IPC_STAT */
10592             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10593 #       ifdef IPC_RMID
10594         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10595 #       endif /* IPC_RMID */
10596             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10597     } else
10598 #endif /* IPC_PRIVATE && ... */
10599         printf("semget failed: errno = %d\n", errno);
10600
10601     return 0;
10602 }
10603 END
10604     val="$undef"
10605     set try
10606     if eval $compile; then
10607         xxx=`./try`
10608         case "$xxx" in
10609         semid_ds) val="$define" ;;
10610         esac
10611     fi
10612     $rm -f try try.c
10613     set d_semctl_semid_ds
10614     eval $setvar
10615     case "$d_semctl_semid_ds" in
10616     $define)
10617         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10618         ;;
10619     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10620         ;;
10621     esac
10622     $rm -f try.h
10623     ;;
10624 *)  val="$undef"
10625
10626     # We do not have the full sem*(2) library, so assume we can not
10627     # use either.
10628
10629     set d_semctl_semun
10630     eval $setvar
10631
10632     set d_semctl_semid_ds
10633     eval $setvar
10634     ;;
10635 esac
10636
10637 : see if setegid exists
10638 set setegid d_setegid
10639 eval $inlibc
10640
10641 : see if seteuid exists
10642 set seteuid d_seteuid
10643 eval $inlibc
10644
10645 : see if setgrent exists
10646 set setgrent d_setgrent
10647 eval $inlibc
10648
10649 : see if sethostent exists
10650 set sethostent d_sethent
10651 eval $inlibc
10652
10653 : see if setlinebuf exists
10654 set setlinebuf d_setlinebuf
10655 eval $inlibc
10656
10657 : see if setlocale exists
10658 set setlocale d_setlocale
10659 eval $inlibc
10660
10661 : see if setnetent exists
10662 set setnetent d_setnent
10663 eval $inlibc
10664
10665 : see if setprotoent exists
10666 set setprotoent d_setpent
10667 eval $inlibc
10668
10669 : see if setpgid exists
10670 set setpgid d_setpgid
10671 eval $inlibc
10672
10673 : see if setpgrp2 exists
10674 set setpgrp2 d_setpgrp2
10675 eval $inlibc
10676
10677 : see if setpriority exists
10678 set setpriority d_setprior
10679 eval $inlibc
10680
10681 : see if setpwent exists
10682 set setpwent d_setpwent
10683 eval $inlibc
10684
10685 : see if setregid exists
10686 set setregid d_setregid
10687 eval $inlibc
10688 set setresgid d_setresgid
10689 eval $inlibc
10690
10691 : see if setreuid exists
10692 set setreuid d_setreuid
10693 eval $inlibc
10694 set setresuid d_setresuid
10695 eval $inlibc
10696
10697 : see if setrgid exists
10698 set setrgid d_setrgid
10699 eval $inlibc
10700
10701 : see if setruid exists
10702 set setruid d_setruid
10703 eval $inlibc
10704
10705 : see if setservent exists
10706 set setservent d_setsent
10707 eval $inlibc
10708
10709 : see if setsid exists
10710 set setsid d_setsid
10711 eval $inlibc
10712
10713 : see if setspent exists
10714 set setspent d_setspent
10715 eval $inlibc
10716
10717 : see if setvbuf exists
10718 set setvbuf d_setvbuf
10719 eval $inlibc
10720
10721 : see if sfio.h is available
10722 set sfio.h i_sfio
10723 eval $inhdr
10724
10725
10726 : see if sfio library is available
10727 case "$i_sfio" in
10728 $define)
10729         val=''
10730         set sfreserve val
10731         eval $inlibc
10732         ;;
10733 *)
10734         val="$undef"
10735         ;;
10736 esac
10737 : Ok, but do we want to use it.
10738 case "$val" in
10739 $define)
10740         case "$usesfio" in
10741         true|$define|[yY]*) dflt='y';;
10742         *) dflt='n';;
10743         esac
10744         echo "$package can use the sfio library, but it is experimental."
10745         rp="You seem to have sfio available, do you want to try using it?"
10746         . ./myread
10747         case "$ans" in
10748         y|Y) ;;
10749         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10750                 val="$undef"
10751                 : Remove sfio from list of libraries to use
10752                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10753                 shift
10754                 libs="$*"
10755                 echo "libs = $libs" >&4
10756                 ;;
10757         esac
10758         ;;
10759 *)      case "$usesfio" in
10760         true|$define|[yY]*)
10761                 echo "Sorry, cannot find sfio on this machine" >&4
10762                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10763                 ;;
10764         esac
10765         ;;
10766 esac
10767 set d_sfio
10768 eval $setvar
10769 case "$d_sfio" in
10770 $define) usesfio='true';;
10771 *) usesfio='false';;
10772 esac
10773
10774 : see if shmctl exists
10775 set shmctl d_shmctl
10776 eval $inlibc
10777
10778 : see if shmget exists
10779 set shmget d_shmget
10780 eval $inlibc
10781
10782 : see if shmat exists
10783 set shmat d_shmat
10784 eval $inlibc
10785 : see what shmat returns
10786 case "$d_shmat" in
10787 "$define")
10788         $cat >shmat.c <<'END'
10789 #include <sys/shm.h>
10790 void *shmat();
10791 END
10792         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10793                 shmattype='void *'
10794         else
10795                 shmattype='char *'
10796         fi
10797         echo "and it returns ($shmattype)." >&4
10798         : see if a prototype for shmat is available
10799         xxx=`./findhdr sys/shm.h`
10800         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10801         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10802                 val="$define"
10803         else
10804                 val="$undef"
10805         fi
10806         $rm -f shmat.[co]
10807         ;;
10808 *)
10809         val="$undef"
10810         ;;
10811 esac
10812 set d_shmatprototype
10813 eval $setvar
10814
10815 : see if shmdt exists
10816 set shmdt d_shmdt
10817 eval $inlibc
10818
10819 : see how much of the 'shm*(2)' library is present.
10820 h_shm=true
10821 echo " "
10822 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10823 *"$undef"*) h_shm=false;;
10824 esac
10825 case "$osname" in
10826 freebsd)
10827     case "`ipcs 2>&1`" in
10828     "SVID shared memory"*"not configured"*)
10829         echo "Your $osname does not have the shm*(2) configured." >&4
10830         h_shm=false
10831         val="$undef"
10832         set shmctl d_shmctl
10833         evat $setvar
10834         set shmget d_shmget
10835         evat $setvar
10836         set shmat d_shmat
10837         evat $setvar
10838         set shmdt d_shmdt
10839         evat $setvar
10840         ;;
10841     esac
10842     ;;
10843 esac
10844 : we could also check for sys/ipc.h ...
10845 if $h_shm && $test `./findhdr sys/shm.h`; then
10846         echo "You have the full shm*(2) library." >&4
10847         val="$define"
10848 else
10849         echo "You don't have the full shm*(2) library." >&4
10850         val="$undef"
10851 fi
10852 set d_shm
10853 eval $setvar
10854
10855 echo " "
10856 : see if we have sigaction
10857 if set sigaction val -f d_sigaction; eval $csym; $val; then
10858         echo 'sigaction() found.' >&4
10859         $cat > try.c <<'EOP'
10860 #include <stdio.h>
10861 #include <sys/types.h>
10862 #include <signal.h>
10863 int main()
10864 {
10865     struct sigaction act, oact;
10866     act.sa_flags = 0;
10867     oact.sa_handler = 0;
10868     /* so that act and oact are used */
10869     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10870 }
10871 EOP
10872         set try
10873         if eval $compile_ok; then
10874                 val="$define"
10875         else
10876                 echo "But you don't seem to have a useable struct sigaction." >&4
10877                 val="$undef"
10878         fi
10879 else
10880         echo 'sigaction NOT found.' >&4
10881         val="$undef"
10882 fi
10883 set d_sigaction; eval $setvar
10884 $rm -f try try$_o try.c
10885
10886 : see if sigsetjmp exists
10887 echo " "
10888 case "$d_sigsetjmp" in
10889 '')
10890         $cat >try.c <<'EOP'
10891 #include <setjmp.h>
10892 sigjmp_buf env;
10893 int set = 1;
10894 int main()
10895 {
10896         if (sigsetjmp(env,1))
10897                 exit(set);
10898         set = 0;
10899         siglongjmp(env, 1);
10900         exit(1);
10901 }
10902 EOP
10903         set try
10904         if eval $compile; then
10905                 if ./try >/dev/null 2>&1; then
10906                         echo "POSIX sigsetjmp found." >&4
10907                         val="$define"
10908                 else
10909                         $cat >&4 <<EOM
10910 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10911 I'll ignore them.
10912 EOM
10913                         val="$undef"
10914                 fi
10915         else
10916                 echo "sigsetjmp not found." >&4
10917                 val="$undef"
10918         fi
10919         ;;
10920 *) val="$d_sigsetjmp"
10921         case "$d_sigsetjmp" in
10922         $define) echo "POSIX sigsetjmp found." >&4;;
10923         $undef) echo "sigsetjmp not found." >&4;;
10924         esac
10925         ;;
10926 esac
10927 set d_sigsetjmp
10928 eval $setvar
10929 $rm -f try.c try
10930
10931 : see if sys/stat.h is available
10932 set sys/stat.h i_sysstat
10933 eval $inhdr
10934
10935
10936 : see if stat knows about block sizes
10937 echo " "
10938 echo "Checking to see if your struct stat has st_blocks field..." >&4
10939 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10940 eval $hasfield
10941
10942
10943 : see if this is a sys/vfs.h system
10944 set sys/vfs.h i_sysvfs
10945 eval $inhdr
10946
10947
10948 : see if this is a sys/statfs.h system
10949 set sys/statfs.h i_sysstatfs
10950 eval $inhdr
10951
10952
10953 echo " "
10954 echo "Checking to see if your system supports struct statfs..." >&4
10955 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
10956 eval $hasstruct
10957 case "$d_statfs_s" in
10958 "$define")      echo "Yes, it does."   ;;
10959 *)              echo "No, it doesn't." ;;
10960 esac
10961
10962
10963
10964 : see if struct statfs knows about f_flags
10965 case "$d_statfs_s" in
10966 define) 
10967         echo " "
10968         echo "Checking to see if your struct statfs has f_flags field..." >&4
10969         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
10970         eval $hasfield
10971         ;;
10972 *)      val="$undef"
10973         set d_statfs_f_flags
10974         eval $setvar
10975         ;;
10976 esac
10977 case "$d_statfs_f_flags" in
10978 "$define")      echo "Yes, it does."   ;;
10979 *)              echo "No, it doesn't." ;;
10980 esac
10981
10982 : see if _ptr and _cnt from stdio act std
10983 echo " "
10984 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10985         echo "(Looks like you have stdio.h from Linux.)"
10986         case "$stdio_ptr" in
10987         '') stdio_ptr='((fp)->_IO_read_ptr)'
10988                 ptr_lval=$define
10989                 ;;
10990         *)      ptr_lval=$d_stdio_ptr_lval;;
10991         esac
10992         case "$stdio_cnt" in
10993         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10994                 cnt_lval=$undef
10995                 ;;
10996         *)      cnt_lval=$d_stdio_cnt_lval;;
10997         esac
10998         case "$stdio_base" in
10999         '') stdio_base='((fp)->_IO_read_base)';;
11000         esac
11001         case "$stdio_bufsiz" in
11002         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11003         esac
11004 else
11005         case "$stdio_ptr" in
11006         '') stdio_ptr='((fp)->_ptr)'
11007                 ptr_lval=$define
11008                 ;;
11009         *)      ptr_lval=$d_stdio_ptr_lval;;
11010         esac
11011         case "$stdio_cnt" in
11012         '') stdio_cnt='((fp)->_cnt)'
11013                 cnt_lval=$define
11014                 ;;
11015         *)      cnt_lval=$d_stdio_cnt_lval;;
11016         esac
11017         case "$stdio_base" in
11018         '') stdio_base='((fp)->_base)';;
11019         esac
11020         case "$stdio_bufsiz" in
11021         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11022         esac
11023 fi
11024 : test whether _ptr and _cnt really work
11025 echo "Checking how std your stdio is..." >&4
11026 $cat >try.c <<EOP
11027 #include <stdio.h>
11028 #define FILE_ptr(fp)    $stdio_ptr
11029 #define FILE_cnt(fp)    $stdio_cnt
11030 int main() {
11031         FILE *fp = fopen("try.c", "r");
11032         char c = getc(fp);
11033         if (
11034                 18 <= FILE_cnt(fp) &&
11035                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11036         )
11037                 exit(0);
11038         exit(1);
11039 }
11040 EOP
11041 val="$undef"
11042 set try
11043 if eval $compile; then
11044         if ./try; then
11045                 echo "Your stdio acts pretty std."
11046                 val="$define"
11047         else
11048                 echo "Your stdio isn't very std."
11049         fi
11050 else
11051         echo "Your stdio doesn't appear very std."
11052 fi
11053 $rm -f try.c try
11054 set d_stdstdio
11055 eval $setvar
11056
11057 : Can _ptr be used as an lvalue?
11058 case "$d_stdstdio$ptr_lval" in
11059 $define$define) val=$define ;;
11060 *) val=$undef ;;
11061 esac
11062 set d_stdio_ptr_lval
11063 eval $setvar
11064
11065 : Can _cnt be used as an lvalue?
11066 case "$d_stdstdio$cnt_lval" in
11067 $define$define) val=$define ;;
11068 *) val=$undef ;;
11069 esac
11070 set d_stdio_cnt_lval
11071 eval $setvar
11072
11073 : see if _base is also standard
11074 val="$undef"
11075 case "$d_stdstdio" in
11076 $define)
11077         $cat >try.c <<EOP
11078 #include <stdio.h>
11079 #define FILE_base(fp)   $stdio_base
11080 #define FILE_bufsiz(fp) $stdio_bufsiz
11081 int main() {
11082         FILE *fp = fopen("try.c", "r");
11083         char c = getc(fp);
11084         if (
11085                 19 <= FILE_bufsiz(fp) &&
11086                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11087         )
11088                 exit(0);
11089         exit(1);
11090 }
11091 EOP
11092         set try
11093         if eval $compile; then
11094                 if ./try; then
11095                         echo "And its _base field acts std."
11096                         val="$define"
11097                 else
11098                         echo "But its _base field isn't std."
11099                 fi
11100         else
11101                 echo "However, it seems to be lacking the _base field."
11102         fi
11103         $rm -f try.c try
11104         ;;
11105 esac
11106 set d_stdiobase
11107 eval $setvar
11108
11109 $cat >&4 <<EOM
11110 Checking how to access stdio streams by file descriptor number...
11111 EOM
11112 case "$stdio_stream_array" in
11113 '')     $cat >try.c <<EOCP
11114 #include <stdio.h>
11115 int main() {
11116   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11117     printf("yes\n");
11118 }
11119 EOCP
11120         for s in _iob __iob __sF
11121         do
11122                 set try -DSTDIO_STREAM_ARRAY=$s
11123                 if eval $compile; then
11124                         case "`./try$exe_ext`" in
11125                         yes)    stdio_stream_array=$s; break ;;
11126                         esac
11127                 fi
11128         done
11129         $rm -f try.* try$exe_ext
11130 esac
11131 case "$stdio_stream_array" in
11132 '')     $cat >&4 <<EOM
11133 I can't figure out how to access stdio streams by file descriptor number.
11134 EOM
11135         d_stdio_stream_array="$undef"
11136         ;;
11137 *)      $cat >&4 <<EOM
11138 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11139 EOM
11140         d_stdio_stream_array="$define"
11141         ;;
11142 esac
11143
11144 : see if strcoll exists
11145 set strcoll d_strcoll
11146 eval $inlibc
11147
11148 : check for structure copying
11149 echo " "
11150 echo "Checking to see if your C compiler can copy structs..." >&4
11151 $cat >try.c <<'EOCP'
11152 int main()
11153 {
11154         struct blurfl {
11155                 int dyick;
11156         } foo, bar;
11157
11158         foo = bar;
11159 }
11160 EOCP
11161 if $cc -c try.c >/dev/null 2>&1 ; then
11162         val="$define"
11163         echo "Yup, it can."
11164 else
11165         val="$undef"
11166         echo "Nope, it can't."
11167 fi
11168 set d_strctcpy
11169 eval $setvar
11170 $rm -f try.*
11171
11172 : see if strerror and/or sys_errlist[] exist
11173 echo " "
11174 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11175     if set strerror val -f d_strerror; eval $csym; $val; then
11176                 echo 'strerror() found.' >&4
11177                 d_strerror="$define"
11178                 d_strerrm='strerror(e)'
11179                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11180                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11181                         d_syserrlst="$define"
11182                 else
11183                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11184                         d_syserrlst="$undef"
11185                 fi
11186     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11187                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11188                 echo 'strerror() found in string header.' >&4
11189                 d_strerror="$define"
11190                 d_strerrm='strerror(e)'
11191                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11192                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11193                                 d_syserrlst="$define"
11194                 else
11195                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11196                         d_syserrlst="$undef"
11197                 fi
11198     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11199                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11200                 d_strerror="$undef"
11201                 d_syserrlst="$define"
11202                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11203     else
11204                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11205                 d_strerror="$undef"
11206                 d_syserrlst="$undef"
11207                 d_strerrm='"unknown"'
11208     fi
11209 fi
11210
11211 : see if strtod exists
11212 set strtod d_strtod
11213 eval $inlibc
11214
11215 : see if strtol exists
11216 set strtol d_strtol
11217 eval $inlibc
11218
11219 : see if strtold exists
11220 set strtold d_strtold
11221 eval $inlibc
11222
11223 : see if strtoll exists
11224 set strtoll d_strtoll
11225 eval $inlibc
11226
11227 : see if strtoul exists
11228 set strtoul d_strtoul
11229 eval $inlibc
11230
11231 : see if strtoull exists
11232 set strtoull d_strtoull
11233 eval $inlibc
11234
11235 : see if strtouq exists
11236 set strtouq d_strtouq
11237 eval $inlibc
11238
11239 : see if strxfrm exists
11240 set strxfrm d_strxfrm
11241 eval $inlibc
11242
11243 : see if symlink exists
11244 set symlink d_symlink
11245 eval $inlibc
11246
11247 : see if syscall exists
11248 set syscall d_syscall
11249 eval $inlibc
11250
11251 : see if sysconf exists
11252 set sysconf d_sysconf
11253 eval $inlibc
11254
11255 : see if system exists
11256 set system d_system
11257 eval $inlibc
11258
11259 : see if tcgetpgrp exists
11260 set tcgetpgrp d_tcgetpgrp
11261 eval $inlibc
11262
11263 : see if tcsetpgrp exists
11264 set tcsetpgrp d_tcsetpgrp
11265 eval $inlibc
11266
11267 : see if prototype for telldir is available
11268 echo " "
11269 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11270 eval $hasproto
11271
11272 : see if this is a sys/times.h system
11273 set sys/times.h i_systimes
11274 eval $inhdr
11275
11276 : see if times exists
11277 echo " "
11278 if set times val -f d_times; eval $csym; $val; then
11279         echo 'times() found.' >&4
11280         d_times="$define"
11281         inc=''
11282         case "$i_systimes" in
11283         "$define") inc='sys/times.h';;
11284         esac
11285         rp="What is the type returned by times() on this system?"
11286         set clock_t clocktype long stdio.h sys/types.h $inc
11287         eval $typedef_ask
11288 else
11289         echo 'times() NOT found, hope that will do.' >&4
11290         d_times="$undef"
11291         clocktype='int'
11292 fi
11293
11294 : see if truncate exists
11295 set truncate d_truncate
11296 eval $inlibc
11297
11298 : see if tzname[] exists
11299 echo " "
11300 if set tzname val -a d_tzname; eval $csym; $val; then
11301         val="$define"
11302         echo 'tzname[] found.' >&4
11303 else
11304         val="$undef"
11305         echo 'tzname[] NOT found.' >&4
11306 fi
11307 set d_tzname
11308 eval $setvar
11309
11310 : see if umask exists
11311 set umask d_umask
11312 eval $inlibc
11313
11314 : see if ustat exists
11315 set ustat d_ustat
11316 eval $inlibc
11317
11318 : backward compatibility for d_hvfork
11319 if test X$d_hvfork != X; then
11320         d_vfork="$d_hvfork"
11321         d_hvfork=''
11322 fi
11323 : see if there is a vfork
11324 val=''
11325 set vfork val
11326 eval $inlibc
11327
11328 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11329 : perl on Solaris 2.x, and probably elsewhere.
11330 case "$val" in
11331 $define)
11332         echo " "
11333         case "$usevfork" in
11334         false) dflt='n';;
11335         *) dflt='y';;
11336         esac
11337         cat <<'EOM'
11338  
11339 Perl can only use a vfork() that doesn't suffer from strict
11340 restrictions on calling functions or modifying global data in
11341 the child.  For example, glibc-2.1 contains such a vfork()
11342 that is unsuitable.  If your system provides a proper fork()
11343 call, chances are that you do NOT want perl to use vfork().
11344
11345 EOM
11346         rp="Do you still want to use vfork()?"
11347         . ./myread
11348         case "$ans" in
11349         y|Y) ;;
11350         *)
11351                 echo "Ok, we won't use vfork()."
11352                 val="$undef"
11353                 ;;
11354         esac
11355         ;;
11356 esac
11357 set d_vfork
11358 eval $setvar
11359 case "$d_vfork" in
11360 $define) usevfork='true';;
11361 *) usevfork='false';;
11362 esac
11363
11364 : see if this is an sysdir system
11365 set sys/dir.h i_sysdir
11366 eval $inhdr
11367
11368 : see if this is an sysndir system
11369 set sys/ndir.h i_sysndir
11370 eval $inhdr
11371
11372 : see if closedir exists
11373 set closedir d_closedir
11374 eval $inlibc
11375
11376 case "$d_closedir" in
11377 "$define")
11378         echo " "
11379         echo "Checking whether closedir() returns a status..." >&4
11380         cat > closedir.c <<EOM
11381 #$i_dirent I_DIRENT             /**/
11382 #$i_sysdir I_SYS_DIR            /**/
11383 #$i_sysndir I_SYS_NDIR          /**/
11384 #$i_systypes I_SYS_TYPES        /**/
11385
11386 #if defined(I_SYS_TYPES)
11387 #include <sys/types.h>
11388 #endif
11389 #if defined(I_DIRENT)
11390 #include <dirent.h>
11391 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11392 #include <sys/dir.h>
11393 #endif
11394 #else
11395 #ifdef I_SYS_NDIR
11396 #include <sys/ndir.h>
11397 #else
11398 #ifdef I_SYS_DIR
11399 #ifdef hp9000s500
11400 #include <ndir.h>       /* may be wrong in the future */
11401 #else
11402 #include <sys/dir.h>
11403 #endif
11404 #endif
11405 #endif
11406 #endif 
11407 int main() { return closedir(opendir(".")); }
11408 EOM
11409         set closedir
11410         if eval $compile_ok; then
11411                 if ./closedir > /dev/null 2>&1 ; then
11412                         echo "Yes, it does."
11413                         val="$undef"
11414                 else
11415                         echo "No, it doesn't."
11416                         val="$define"
11417                 fi
11418         else
11419                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11420                 val="$define"
11421         fi
11422         ;;
11423 *)
11424         val="$undef";
11425         ;;
11426 esac
11427 set d_void_closedir
11428 eval $setvar
11429 $rm -f closedir*
11430 : check for volatile keyword
11431 echo " "
11432 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11433 $cat >try.c <<'EOCP'
11434 int main()
11435 {
11436         typedef struct _goo_struct goo_struct;
11437         goo_struct * volatile goo = ((goo_struct *)0);
11438         struct _goo_struct {
11439                 long long_int;
11440                 int reg_int;
11441                 char char_var;
11442         };
11443         typedef unsigned short foo_t;
11444         char *volatile foo;
11445         volatile int bar;
11446         volatile foo_t blech;
11447         foo = foo;
11448 }
11449 EOCP
11450 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11451         val="$define"
11452         echo "Yup, it does."
11453 else
11454         val="$undef"
11455         echo "Nope, it doesn't."
11456 fi
11457 set d_volatile
11458 eval $setvar
11459 $rm -f try.*
11460
11461 : see if there is a wait4
11462 set wait4 d_wait4
11463 eval $inlibc
11464
11465 : see if waitpid exists
11466 set waitpid d_waitpid
11467 eval $inlibc
11468
11469 : see if wcstombs exists
11470 set wcstombs d_wcstombs
11471 eval $inlibc
11472
11473 : see if wctomb exists
11474 set wctomb d_wctomb
11475 eval $inlibc
11476
11477 : preserve RCS keywords in files with variable substitution, grrr
11478 Date='$Date'
11479 Id='$Id'
11480 Log='$Log'
11481 RCSfile='$RCSfile'
11482 Revision='$Revision'
11483
11484 case "$crosscompile" in
11485 ''|[nN]*) crosscompile="$undef" ;;
11486 esac
11487
11488 case "$osname" in
11489 next|rhapsody) multiarch="$define" ;;
11490 esac
11491 case "$multiarch" in
11492 ''|[nN]*) multiarch="$undef" ;;
11493 esac
11494
11495 : check for alignment requirements
11496 echo " "
11497 case "$crosscompile$multiarch" in
11498 *$define*)
11499         $cat <<EOM
11500 You seem to be either cross-compiling or doing a multiarchitecture build,
11501 skipping the memory alignment check.
11502
11503 EOM
11504         case "$alignbytes" in
11505         '') alignbytes=8 ;;
11506         esac
11507         ;;
11508 *)
11509         case "$alignbytes" in
11510         '') echo "Checking alignment constraints..." >&4
11511                 $cat >try.c <<'EOCP'
11512 #include <stdio.h>
11513 struct foobar {
11514         char foo;
11515         double bar;
11516 } try_algn;
11517 int main()
11518 {
11519     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11520     return(0);
11521 }
11522 EOCP
11523                 set try
11524                 if eval $compile_ok; then
11525                         dflt=`./try`
11526                 else
11527                         dflt='8'
11528                         echo "(I can't seem to compile the test program...)"
11529                 fi
11530                 ;;
11531         *) dflt="$alignbytes"
11532                 ;;
11533         esac
11534         rp="Doubles must be aligned on a how-many-byte boundary?"
11535         . ./myread
11536         alignbytes="$ans"
11537         $rm -f try.c try
11538         ;;
11539 esac
11540
11541
11542 : check for ordering of bytes in a long
11543 echo " "
11544 case "$crosscompile$multiarch" in
11545 *$define*)
11546         $cat <<EOM
11547 You seem to be either cross-compiling or doing a multiarchitecture build,
11548 skipping the byteorder check.
11549
11550 EOM
11551         byteorder='0xffff'
11552         ;;
11553 *)
11554         case "$byteorder" in
11555         '')
11556                 $cat <<'EOM'
11557 In the following, larger digits indicate more significance.  A big-endian
11558 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11559 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11560 machines may have weird orders like 3412.  A Cray will report 87654321,
11561 an Alpha will report 12345678. If the test program works the default is
11562 probably right.
11563 I'm now running the test program...
11564 EOM
11565                 $cat >try.c <<'EOCP'
11566 #include <stdio.h>
11567 int main()
11568 {
11569         int i;
11570         union {
11571                 unsigned long l;
11572                 char c[sizeof(long)];
11573         } u;
11574
11575         if (sizeof(long) > 4)
11576                 u.l = (0x08070605L << 32) | 0x04030201L;
11577         else
11578                 u.l = 0x04030201L;
11579         for (i = 0; i < sizeof(long); i++)
11580                 printf("%c", u.c[i]+'0');
11581         printf("\n");
11582         exit(0);
11583 }
11584 EOCP
11585                 xxx_prompt=y
11586                 set try
11587                 if eval $compile && ./try > /dev/null; then
11588                         dflt=`./try`
11589                         case "$dflt" in
11590                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11591                                 echo "(The test program ran ok.)"
11592                                 echo "byteorder=$dflt"
11593                                 xxx_prompt=n
11594                         ;;
11595                         ????|????????) echo "(The test program ran ok.)" ;;
11596                         *) echo "(The test program didn't run right for some reason.)" ;;
11597                         esac
11598                 else
11599                         dflt='4321'
11600                         cat <<'EOM'
11601 (I can't seem to compile the test program.  Guessing big-endian...)
11602 EOM
11603                 fi
11604                 case "$xxx_prompt" in
11605                 y)
11606                         rp="What is the order of bytes in a long?"
11607                         . ./myread
11608                         byteorder="$ans"
11609                         ;;
11610                 *)      byteorder=$dflt
11611                         ;;
11612                 esac
11613                 ;;
11614         esac
11615         $rm -f try.c try
11616         ;;
11617 esac
11618
11619
11620 : how do we catenate cpp tokens here?
11621 echo " "
11622 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11623 $cat >cpp_stuff.c <<'EOCP'
11624 #define RCAT(a,b)a/**/b
11625 #define ACAT(a,b)a ## b
11626 RCAT(Rei,ser)
11627 ACAT(Cir,cus)
11628 EOCP
11629 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11630 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11631         echo "Oh!  Smells like ANSI's been here." >&4
11632         echo "We can catify or stringify, separately or together!"
11633         cpp_stuff=42
11634 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11635         echo "Ah, yes!  The good old days!" >&4
11636         echo "However, in the good old days we don't know how to stringify and"
11637         echo "catify at the same time."
11638         cpp_stuff=1
11639 else
11640         $cat >&4 <<EOM
11641 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11642 to have to edit the values of CAT[2-5] in config.h...
11643 EOM
11644         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11645 fi
11646 $rm -f cpp_stuff.*
11647
11648 : see if this is a db.h system
11649 set db.h i_db
11650 eval $inhdr
11651
11652 case "$i_db" in
11653 $define)
11654         : Check db version.
11655         echo " "
11656         echo "Checking Berkeley DB version ..." >&4
11657         $cat >try.c <<EOCP
11658 #$d_const HASCONST
11659 #ifndef HASCONST
11660 #define const
11661 #endif
11662 #include <sys/types.h>
11663 #include <stdio.h>
11664 #include <db.h>
11665 int main()
11666 {
11667 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11668     int Major, Minor, Patch ;
11669     unsigned long Version ;
11670     (void)db_version(&Major, &Minor, &Patch) ;
11671     printf("You have Berkeley DB Version 2 or greater\n");
11672
11673     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11674                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11675     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11676                 Major, Minor, Patch) ;
11677
11678     /* check that db.h & libdb are compatible */
11679     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11680         printf("db.h and libdb are incompatible\n") ;
11681         exit(3);        
11682     }
11683
11684     printf("db.h and libdb are compatible\n") ;
11685
11686     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11687                 + DB_VERSION_PATCH ;
11688
11689     /* needs to be >= 2.3.4 */
11690     if (Version < 2003004) {
11691     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11692         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11693         exit(2);        
11694     }
11695
11696     exit(0);
11697 #else
11698 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11699     printf("You have Berkeley DB Version 1\n");
11700     exit(0);    /* DB version < 2: the coast is clear. */
11701 #else
11702     exit(1);    /* <db.h> not Berkeley DB? */
11703 #endif
11704 #endif
11705 }
11706 EOCP
11707         set try
11708         if eval $compile_ok && ./try; then
11709                 echo 'Looks OK.' >&4
11710         else
11711                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11712                 i_db=$undef
11713                 case " $libs " in
11714                 *"-ldb "*)
11715                         : Remove db from list of libraries to use
11716                         echo "Removing unusable -ldb from library list" >&4
11717                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11718                         shift
11719                         libs="$*"
11720                         echo "libs = $libs" >&4
11721                         ;;
11722                 esac
11723         fi
11724         $rm -f try.*
11725         ;;
11726 esac
11727
11728 case "$i_db" in
11729 define)
11730         : Check the return type needed for hash 
11731         echo " "
11732         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11733         $cat >try.c <<EOCP
11734 #$d_const HASCONST
11735 #ifndef HASCONST
11736 #define const
11737 #endif
11738 #include <sys/types.h>
11739 #include <db.h>
11740
11741 #ifndef DB_VERSION_MAJOR
11742 u_int32_t hash_cb (ptr, size)
11743 const void *ptr;
11744 size_t size;
11745 {
11746 }
11747 HASHINFO info;
11748 int main()
11749 {
11750         info.hash = hash_cb;
11751 }
11752 #endif
11753 EOCP
11754         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11755                 if $contains warning try.out >>/dev/null 2>&1 ; then
11756                         db_hashtype='int'
11757                 else
11758                         db_hashtype='u_int32_t'
11759                 fi
11760         else
11761                 : XXX Maybe we should just give up here.
11762                 db_hashtype=u_int32_t
11763                 $cat try.out >&4
11764                 echo "Help:  I can't seem to compile the db test program." >&4
11765                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11766         fi
11767         $rm -f try.*
11768         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11769         ;;
11770 *)      db_hashtype=u_int32_t
11771         ;;
11772 esac
11773 case "$i_db" in
11774 define)
11775         : Check the return type needed for prefix 
11776         echo " "
11777         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11778         cat >try.c <<EOCP
11779 #$d_const HASCONST
11780 #ifndef HASCONST
11781 #define const
11782 #endif
11783 #include <sys/types.h>
11784 #include <db.h>
11785
11786 #ifndef DB_VERSION_MAJOR
11787 size_t prefix_cb (key1, key2)
11788 const DBT *key1;
11789 const DBT *key2;
11790 {
11791 }
11792 BTREEINFO info;
11793 int main()
11794 {
11795         info.prefix = prefix_cb;
11796 }
11797 #endif
11798 EOCP
11799         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11800                 if $contains warning try.out >>/dev/null 2>&1 ; then
11801                         db_prefixtype='int'
11802                 else
11803                         db_prefixtype='size_t'
11804                 fi
11805         else
11806                 db_prefixtype='size_t'
11807                 : XXX Maybe we should just give up here.
11808                 $cat try.out >&4
11809                 echo "Help:  I can't seem to compile the db test program." >&4
11810                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11811         fi
11812         $rm -f try.*
11813         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11814         ;;
11815 *)      db_prefixtype='size_t'
11816         ;;
11817 esac
11818
11819 : check for void type
11820 echo " "
11821 echo "Checking to see how well your C compiler groks the void type..." >&4
11822 case "$voidflags" in
11823 '')
11824         $cat >try.c <<'EOCP'
11825 #if TRY & 1
11826 void sub() {
11827 #else
11828 sub() {
11829 #endif
11830         extern void moo();      /* function returning void */
11831         void (*goo)();          /* ptr to func returning void */
11832 #if TRY & 8
11833         void *hue;              /* generic ptr */
11834 #endif
11835 #if TRY & 2
11836         void (*foo[10])();
11837 #endif
11838
11839 #if TRY & 4
11840         if(goo == moo) {
11841                 exit(0);
11842         }
11843 #endif
11844         exit(0);
11845 }
11846 int main() { sub(); }
11847 EOCP
11848         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11849                 voidflags=$defvoidused
11850         echo "Good.  It appears to support void to the level $package wants.">&4
11851                 if $contains warning .out >/dev/null 2>&1; then
11852                         echo "However, you might get some warnings that look like this:"
11853                         $cat .out
11854                 fi
11855         else
11856 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11857                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11858                         echo "It supports 1..."
11859                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11860                                 echo "It also supports 2..."
11861                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11862                                         voidflags=7
11863                                         echo "And it supports 4 but not 8 definitely."
11864                                 else
11865                                         echo "It doesn't support 4..."
11866                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11867                                                 voidflags=11
11868                                                 echo "But it supports 8."
11869                                         else
11870                                                 voidflags=3
11871                                                 echo "Neither does it support 8."
11872                                         fi
11873                                 fi
11874                         else
11875                                 echo "It does not support 2..."
11876                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11877                                         voidflags=13
11878                                         echo "But it supports 4 and 8."
11879                                 else
11880                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11881                                                 voidflags=5
11882                                                 echo "And it supports 4 but has not heard about 8."
11883                                         else
11884                                                 echo "However it supports 8 but not 4."
11885                                         fi
11886                                 fi
11887                         fi
11888                 else
11889                         echo "There is no support at all for void."
11890                         voidflags=0
11891                 fi
11892         fi
11893 esac
11894 case "$voidflags" in
11895 "$defvoidused") ;;
11896 *)      $cat >&4 <<'EOM'
11897   Support flag bits are:
11898     1: basic void declarations.
11899     2: arrays of pointers to functions returning void.
11900     4: operations between pointers to and addresses of void functions.
11901     8: generic void pointers.
11902 EOM
11903         dflt="$voidflags";
11904         rp="Your void support flags add up to what?"
11905         . ./myread
11906         voidflags="$ans"
11907         ;;
11908 esac
11909 $rm -f try.* .out
11910
11911
11912 : How can we generate normalized random numbers ?
11913 echo " "
11914 echo "Looking for a random number function..." >&4
11915 case "$randfunc" in
11916 '')
11917         if set drand48 val -f; eval $csym; $val; then
11918                 dflt="drand48"
11919                 echo "Good, found drand48()." >&4
11920         elif set random val -f; eval $csym; $val; then
11921                 dflt="random"
11922                 echo "OK, found random()." >&4
11923         else
11924                 dflt="rand"
11925                 echo "Yick, looks like I have to use rand()." >&4
11926         fi
11927         echo " "
11928         ;;
11929 *)
11930         dflt="$randfunc"
11931         ;;
11932 esac
11933 cont=true
11934
11935 case "$ccflags" in
11936 *-Dmy_rand=*|*-Dmy_srand=*)
11937         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11938         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11939         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11940         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11941         ;;
11942 esac
11943
11944 while $test "$cont"; do
11945         rp="Use which function to generate random numbers?"
11946         . ./myread
11947         if $test "$ans" = "$dflt"; then
11948                 : null
11949         else
11950                 randbits=''
11951         fi
11952         randfunc="$ans"
11953         if set $ans val -f; eval $csym; $val; then
11954                 cont=''
11955         else
11956                 dflt=y
11957                 rp="I cannot find function $ans. Use that name anyway?"
11958                 . ./myread
11959                 dflt=rand
11960                 case "$ans" in
11961                         [yY]*) cont='';;
11962                 esac
11963         fi
11964         case "$cont" in
11965         '')
11966                 case "$randfunc" in
11967                 drand48)
11968                         drand01="drand48()"
11969                         seedfunc="srand48"
11970                         randbits=48
11971                         randseedtype=long
11972                         ;;
11973                 rand|random)
11974                         case "$randbits" in
11975                         '')
11976 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11977                                 $cat >try.c <<EOCP
11978 #$i_unistd I_UNISTD
11979 #$i_stdlib I_STDLIB
11980 #include <stdio.h>
11981 #ifdef I_UNISTD
11982 #  include <unistd.h>
11983 #endif
11984 #ifdef I_STDLIB
11985 #  include <stdlib.h>
11986 #endif
11987 int main()
11988 {
11989         register int i;
11990         register unsigned long tmp;
11991         register unsigned long max = 0L;
11992
11993         for (i = 1000; i; i--) {
11994                 tmp = (unsigned long) $randfunc();
11995                 if (tmp > max) max = tmp;
11996         }
11997         for (i = 0; max; i++)
11998                 max /= 2;
11999         printf("%d\n",i);
12000 }
12001 EOCP
12002                                 set try
12003                                 if eval $compile_ok; then
12004                                         dflt=`try`
12005                                 else
12006                                         dflt='?'
12007                                         echo "(I can't seem to compile the test program...)"
12008                                 fi
12009                                 ;;
12010                         *)
12011                                 dflt="$randbits"
12012                                 ;;
12013                         esac
12014                         rp="How many bits does your $randfunc() function produce?"
12015                         . ./myread
12016                         randbits="$ans"
12017                         $rm -f try.c try
12018                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12019                         seedfunc="s$randfunc"
12020                         randseedtype=unsigned
12021                         ;;
12022                 *)
12023                         dflt="31"
12024                         rp="How many bits does your $randfunc() function produce?"
12025                         . ./myread
12026                         randbits="$ans"
12027                         seedfunc="s$randfunc"
12028                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12029                         if set $seedfunc val -f; eval $csym; $val; then
12030                                 echo "(Using $seedfunc() to seed random generator)"
12031                         else
12032                                 echo "(Warning: no $seedfunc() to seed random generator)"
12033                                 seedfunc=rand
12034                         fi
12035                         randseedtype=unsigned
12036                         ;;
12037                 esac
12038                 ;;
12039         esac
12040 done
12041
12042 echo " "
12043 echo "Determining whether or not we are on an EBCDIC system..." >&4
12044 $cat >tebcdic.c <<'EOM'
12045 int main()
12046 {
12047   if ('M'==0xd4) return 0;
12048   return 1;
12049 }
12050 EOM
12051
12052 val=$undef
12053 set tebcdic
12054 if eval $compile_ok; then
12055         if ./tebcdic; then
12056                 echo "You have EBCDIC." >&4
12057                 val="$define"
12058         else
12059                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12060         fi
12061 else
12062         echo "I'm unable to compile the test program." >&4
12063         echo "I'll assume ASCII or some ISO Latin." >&4
12064 fi
12065 $rm -f tebcdic.c tebcdic
12066 set ebcdic
12067 eval $setvar
12068
12069 echo " "
12070 $cat >&4 <<EOM
12071 Checking how to flush all pending stdio output...
12072 EOM
12073 # I only know how to find the first 32 possibly open files on SunOS.
12074 # See also hints/sunos_4_1.sh and util.c  --AD
12075 case "$osname" in
12076 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12077 esac
12078 $cat >>try.c <<EOCP
12079 #include <stdio.h>
12080 #$i_unistd I_UNISTD
12081 #ifdef I_UNISTD
12082 # include <unistd.h>
12083 #endif
12084 #$d_sysconf HAS_SYSCONF
12085 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12086 #ifdef HAS_STDIO_STREAM_ARRAY
12087 # define STDIO_STREAM_ARRAY $stdio_stream_array
12088 #endif
12089 int main() {
12090   FILE* p = fopen("try.out", "w");
12091 #ifdef TRY_FPUTC
12092   fputc('x', p);
12093 #else
12094 # ifdef TRY_FPRINTF
12095   fprintf(p, "x");
12096 # endif
12097 #endif
12098 #ifdef TRY_FFLUSH_NULL
12099   fflush(NULL);
12100 #endif
12101 #ifdef TRY_FFLUSH_ALL
12102   {
12103     long open_max = -1;
12104 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12105     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12106 # else
12107 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12108     open_max = sysconf(_SC_OPEN_MAX);
12109 #  else
12110 #   ifdef FOPEN_MAX
12111     open_max = FOPEN_MAX;
12112 #   else
12113 #    ifdef OPEN_MAX
12114     open_max = OPEN_MAX;
12115 #    else
12116 #     ifdef _NFILE
12117     open_max = _NFILE;
12118 #     endif
12119 #    endif
12120 #   endif
12121 #  endif
12122 # endif 
12123 # ifdef HAS_STDIO_STREAM_ARRAY
12124     if (open_max > 0) {
12125       long i;
12126       for (i = 0; i < open_max; i++)
12127             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12128                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12129                 STDIO_STREAM_ARRAY[i]._flag)
12130                 fflush(&STDIO_STREAM_ARRAY[i]);
12131     }   
12132   }
12133 # endif
12134 #endif
12135   _exit(42);
12136 }
12137 EOCP
12138 : first we have to find out how _not_ to flush
12139 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12140     output=''
12141     set try -DTRY_FPUTC
12142     if eval $compile; then
12143             $rm -f try.out
12144             ./try$exe_ext 2>/dev/null
12145             if $test ! -s try.out -a "X$?" = X42; then
12146                 output=-DTRY_FPUTC
12147             fi
12148     fi
12149     case "$output" in
12150     '')
12151             set try -DTRY_FPRINTF
12152             $rm -f try.out
12153             if eval $compile; then
12154                     $rm -f try.out
12155                     ./try$exe_ext 2>/dev/null
12156                     if $test ! -s try.out -a "X$?" = X42; then
12157                         output=-DTRY_FPRINTF
12158                     fi
12159             fi
12160         ;;
12161     esac
12162 fi
12163 : check for fflush NULL behaviour
12164 case "$fflushNULL" in
12165 '')     set try -DTRY_FFLUSH_NULL $output
12166         if eval $compile; then
12167                 $rm -f try.out
12168                 ./try$exe_ext 2>/dev/null
12169                 code="$?"
12170                 if $test -s try.out -a "X$code" = X42; then
12171                         fflushNULL="`$cat try.out`"
12172                 else
12173                         if $test "X$code" != X42; then
12174                                 $cat >&4 <<EOM
12175 (If this test failed, don't worry, we'll try another method shortly.)
12176 EOM
12177                         fi
12178                 fi
12179         fi
12180         $rm -f core try.core core.try.*
12181         case "$fflushNULL" in
12182         x)      $cat >&4 <<EOM
12183 Your fflush(NULL) works okay.
12184 EOM
12185                 fflushNULL="$define"
12186                 ;;
12187         '')     $cat >&4 <<EOM
12188 Your fflush(NULL) isn't working (contrary to ANSI C).
12189 EOM
12190                 fflushNULL="$undef"
12191                 ;;
12192         *)      $cat >&4 <<EOM
12193 Cannot figure out whether your fflush(NULL) works or not.
12194 I'm assuming it doesn't (contrary to ANSI C).
12195 EOM
12196                 fflushNULL="$undef"
12197                 ;;
12198         esac
12199         ;;
12200 $define|true|[yY]*)
12201         fflushNULL="$define"
12202         ;;
12203 *)
12204         fflushNULL="$undef"
12205         ;;
12206 esac
12207 : check explicit looping only if NULL did not work
12208 case "$fflushNULL" in
12209 "$undef")
12210         : check for fflush all behaviour
12211         case "$fflushall" in
12212         '')     set try -DTRY_FFLUSH_ALL $output
12213                 if eval $compile; then
12214                         $cat >&4 <<EOM
12215 (Now testing the other method--but note that also this may fail.)
12216 EOM
12217                         $rm -f try.out
12218                         ./try$exe_ext 2>/dev/null
12219                         if $test -s try.out -a "X$?" = X42; then
12220                                 fflushall="`$cat try.out`"
12221                         fi
12222                 fi
12223                 $rm -f core try.core core.try.*
12224                 case "$fflushall" in
12225                 x)      $cat >&4 <<EOM
12226 Whew. Flushing explicitly all the stdio streams works.
12227 EOM
12228                         fflushall="$define"
12229                         ;;
12230                 '')     $cat >&4 <<EOM
12231 Sigh. Flushing explicitly all the stdio streams doesn't work.
12232 EOM
12233                         fflushall="$undef"
12234                         ;;
12235                 *)      $cat >&4 <<EOM
12236 Cannot figure out whether flushing stdio streams explicitly works or not.
12237 I'm assuming it doesn't.
12238 EOM
12239                         fflushall="$undef"
12240                         ;;
12241                 esac
12242                 ;;
12243         "$define"|true|[yY]*)
12244                 fflushall="$define"
12245                 ;;
12246         *)
12247                 fflushall="$undef"
12248                 ;;
12249         esac
12250         ;;
12251 *)      fflushall="$undef"      
12252         ;;
12253 esac
12254 case "$fflushNULL$fflushall" in
12255 undefundef)
12256         $cat <<EOM
12257 I cannot figure out how to flush pending stdio output.
12258 EOM
12259         ;;
12260 esac
12261 $rm -f try.* try$exe_ext
12262
12263 : Store the full pathname to the ar program for use in the C program
12264 : Respect a hint or command line value for full_ar.
12265 case "$full_ar" in
12266 '') full_ar=$ar ;;
12267 esac
12268
12269 : Store the full pathname to the sed program for use in the C program
12270 full_sed=$sed
12271
12272 : see what type gids are declared as in the kernel
12273 echo " "
12274 echo "Looking for the type for group ids returned by getgid()."
12275 set gid_t gidtype xxx stdio.h sys/types.h
12276 eval $typedef
12277 case "$gidtype" in
12278 xxx)
12279         xxx=`./findhdr sys/user.h`
12280         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12281         case $1 in
12282         unsigned) dflt="$1 $2" ;;
12283         *) dflt="$1" ;;
12284         esac
12285         ;;
12286 *) dflt="$gidtype";;
12287 esac
12288 case "$gidtype" in
12289 gid_t) echo "gid_t found." ;;
12290 *)      rp="What is the type for group ids returned by getgid()?"
12291         . ./myread
12292         gidtype="$ans"
12293         ;;
12294 esac
12295
12296 echo " "
12297 case "$gidtype" in
12298 *_t) zzz="$gidtype"     ;;
12299 *)   zzz="gid"          ;;
12300 esac
12301 echo "Checking the size of $zzz..." >&4 
12302 cat > try.c <<EOCP
12303 #include <sys/types.h>
12304 #include <stdio.h>
12305 int main() {
12306     printf("%d\n", (int)sizeof($gidtype));
12307     exit(0);
12308 }
12309 EOCP
12310 set try
12311 if eval $compile_ok; then
12312         yyy=`./try`
12313         case "$yyy" in
12314         '')     gidsize=4
12315                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12316                 ;;
12317         *)      gidsize=$yyy
12318                 echo "Your $zzz size is $gidsize bytes."
12319                 ;;
12320         esac
12321 else
12322         gidsize=4
12323         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12324 fi
12325
12326
12327 echo " "
12328 case "$gidtype" in
12329 *_t) zzz="$gidtype"     ;;
12330 *)   zzz="gid"          ;;
12331 esac
12332 echo "Checking the sign of $zzz..." >&4 
12333 cat > try.c <<EOCP
12334 #include <sys/types.h>
12335 #include <stdio.h>
12336 int main() {
12337         $gidtype foo = -1;
12338         if (foo < 0)
12339                 printf("-1\n");
12340         else
12341                 printf("1\n");
12342 }
12343 EOCP
12344 set try
12345 if eval $compile; then
12346         yyy=`./try`
12347         case "$yyy" in
12348         '')     gidsign=1
12349                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12350                 ;;
12351         *)      gidsign=$yyy
12352                 case "$gidsign" in
12353                  1) echo "Your $zzz is unsigned." ;;
12354                 -1) echo "Your $zzz is signed."   ;;
12355                 esac
12356                 ;;
12357         esac
12358 else
12359         gidsign=1
12360         echo "(I can't compile the test program--guessing unsigned.)" >&4
12361 fi
12362
12363
12364 echo " "
12365
12366 if $test X"$quadtype" != X; then
12367
12368 echo "Checking how to print 64-bit integers..." >&4
12369
12370 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12371         $cat >try.c <<'EOCP'
12372 #include <sys/types.h>
12373 #include <stdio.h>
12374 int main() {
12375   int q = 12345678901;
12376   printf("%ld\n", q);
12377 }
12378 EOCP
12379         set try
12380         if eval $compile; then
12381                 yyy=`./try$exe_ext`
12382                 case "$yyy" in
12383                 12345678901)
12384                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12385                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12386                         echo "We will use %d."
12387                         ;;
12388                 esac
12389         fi
12390 fi
12391
12392 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12393         $cat >try.c <<'EOCP'
12394 #include <sys/types.h>
12395 #include <stdio.h>
12396 int main() {
12397   long q = 12345678901;
12398   printf("%ld\n", q);
12399 }
12400 EOCP
12401         set try
12402         if eval $compile; then
12403                 yyy=`./try$exe_ext`
12404                 case "$yyy" in
12405                 12345678901)
12406                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12407                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12408                         echo "We will use %ld."
12409                         ;;
12410                 esac
12411         fi
12412 fi
12413
12414 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12415         $cat >try.c <<'EOCP'
12416 #include <sys/types.h>
12417 #include <inttypes.h>
12418 #include <stdio.h>
12419 int main() {
12420   int64_t q = 12345678901;
12421   printf("%" PRId64 "\n", q);
12422 }
12423 EOCP
12424         set try
12425         if eval $compile; then
12426                 yyy=`./try$exe_ext`
12427                 case "$yyy" in
12428                 12345678901)
12429                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12430                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12431                         echo "We will use the C9X style."
12432                         ;;
12433                 esac
12434         fi
12435 fi
12436
12437 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12438         $cat >try.c <<'EOCP'
12439 #include <sys/types.h>
12440 #include <stdio.h>
12441 int main() {
12442   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12443   printf("%lld\n", q);
12444 }
12445 EOCP
12446         set try
12447         if eval $compile; then
12448                 yyy=`./try$exe_ext`
12449                 case "$yyy" in
12450                 12345678901)
12451                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12452                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12453                         echo "We will use the %lld style."
12454                         ;;
12455                 esac
12456         fi
12457 fi
12458
12459 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12460         $cat >try.c <<EOCP
12461 #include <sys/types.h>
12462 #include <stdio.h>
12463 int main() {
12464   $quadtype q = 12345678901;
12465   printf("%Ld\n", q);
12466 }
12467 EOCP
12468         set try
12469         if eval $compile; then
12470                 yyy=`./try$exe_ext`
12471                 case "$yyy" in
12472                 12345678901)
12473                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12474                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12475                         echo "We will use %Ld."
12476                         ;;
12477                 esac
12478         fi
12479 fi
12480
12481 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12482         $cat >try.c <<EOCP
12483 #include <sys/types.h>
12484 #include <stdio.h>
12485 int main() {
12486   $quadtype q = 12345678901;
12487   printf("%qd\n", q);
12488 }
12489 EOCP
12490         set try
12491         if eval $compile; then
12492                 yyy=`./try$exe_ext`
12493                 case "$yyy" in
12494                 12345678901)
12495                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12496                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12497                         echo "We will use %qd."
12498                         ;;
12499                 esac
12500         fi
12501 fi
12502
12503 if $test X"$sPRId64" = X; then
12504         echo "Cannot figure out how to print 64-bit integers." >&4
12505 fi
12506
12507 $rm -f try try.*
12508
12509 fi
12510
12511 case "$sPRId64" in
12512 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12513         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12514         ;;
12515 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12516         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12517         ;;
12518 esac
12519
12520
12521 echo " "
12522 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12523
12524 if $test X"$ivsize" = X8; then
12525         ivdformat="$sPRId64"
12526         uvuformat="$sPRIu64"
12527         uvoformat="$sPRIo64"
12528         uvxformat="$sPRIx64"
12529 else
12530         if $test X"$ivsize" = X"$longsize"; then
12531                 ivdformat='"ld"'
12532                 uvuformat='"lu"'
12533                 uvoformat='"lo"'
12534                 uvxformat='"lx"'
12535         else
12536                 if $test X"$ivsize" = X"$intsize"; then
12537                         ivdformat='"d"'
12538                         uvuformat='"u"'
12539                         uvoformat='"o"'
12540                         uvxformat='"x"'
12541                 else
12542                         : far out
12543                         if $test X"$ivsize" = X"$shortsize"; then
12544                                 ivdformat='"hd"'
12545                                 uvuformat='"hu"'
12546                                 uvoformat='"ho"'
12547                                 uvxformat='"hx"'
12548                         fi
12549                 fi
12550         fi
12551 fi
12552
12553 case "$ivdformat" in
12554 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12555     exit 1
12556     ;;
12557 esac
12558
12559
12560 echo " "
12561 $echo "Checking the format string to be used for gids..." >&4
12562
12563 case "$gidsign" in
12564 -1)     if $test X"$gidsize" = X"$ivsize"; then
12565                 gidformat="$ivdformat"
12566         else
12567                 if $test X"$gidsize" = X"$longsize"; then
12568                         gidformat='"ld"'
12569                 else
12570                         if $test X"$gidsize" = X"$intsize"; then
12571                                 gidformat='"d"'
12572                         else
12573                                 if $test X"$gidsize" = X"$shortsize"; then
12574                                         gidformat='"hd"'
12575                                 fi
12576                         fi
12577                 fi
12578         fi
12579         ;;
12580 *)      if $test X"$gidsize" = X"$uvsize"; then
12581                 gidformat="$uvuformat"
12582         else
12583                 if $test X"$gidsize" = X"$longsize"; then
12584                         gidformat='"lu"'
12585                 else
12586                         if $test X"$gidsize" = X"$intsize"; then
12587                                 gidformat='"u"'
12588                         else
12589                                 if $test X"$gidsize" = X"$shortsize"; then
12590                                         gidformat='"hu"'
12591                                 fi
12592                         fi
12593                 fi
12594         fi
12595         ;;
12596 esac
12597
12598 : see if getgroups exists
12599 set getgroups d_getgrps
12600 eval $inlibc
12601
12602 : see if setgroups exists
12603 set setgroups d_setgrps
12604 eval $inlibc
12605
12606
12607 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12608 echo " "
12609 case "$d_getgrps$d_setgrps" in
12610 *define*)
12611         case "$groupstype" in
12612         '') dflt="$gidtype" ;;
12613         *)  dflt="$groupstype" ;;
12614         esac
12615         $cat <<EOM
12616 What type of pointer is the second argument to getgroups() and setgroups()?
12617 Usually this is the same as group ids, $gidtype, but not always.
12618
12619 EOM
12620         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12621         . ./myread
12622         groupstype="$ans"
12623         ;;
12624 *)  groupstype="$gidtype";;
12625 esac
12626
12627 echo " "
12628 echo "Checking if your $make program sets \$(MAKE)..." >&4
12629 case "$make_set_make" in
12630 '')
12631         $sed 's/^X //' > testmake.mak << 'EOF'
12632 Xall:
12633 X       @echo 'maketemp="$(MAKE)"'
12634 EOF
12635         case "`$make -f testmake.mak 2>/dev/null`" in
12636         *maketemp=*) make_set_make='#' ;;
12637         *)      make_set_make="MAKE=$make" ;;
12638         esac
12639         $rm -f testmake.mak
12640         ;;
12641 esac
12642 case "$make_set_make" in
12643 '#') echo "Yup, it does.";;
12644 *) echo "Nope, it doesn't.";;
12645 esac
12646
12647 : see if this is a sys/mman.h system
12648 set sys/mman.h i_sysmman
12649 eval $inhdr
12650
12651 : see if mmap exists
12652 set mmap d_mmap
12653 eval $inlibc
12654 : see what shmat returns
12655 : default to something harmless
12656 mmaptype='void *'
12657 case "$i_sysmman$d_mmap" in
12658 "$define$define")
12659         $cat >mmap.c <<'END'
12660 #include <sys/mman.h>
12661 void *mmap();
12662 END
12663         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
12664                 mmaptype='void *'
12665         else
12666                 mmaptype='caddr_t'
12667         fi
12668         echo "and it returns ($mmaptype)." >&4
12669         ;;
12670 esac
12671
12672
12673
12674 : see what type is used for mode_t
12675 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12676 set mode_t modetype int stdio.h sys/types.h
12677 eval $typedef_ask
12678
12679 : define a fucntion to check prototypes
12680 $cat > protochk <<EOSH
12681 $startsh
12682 cc="$cc"
12683 optimize="$optimize"
12684 ccflags="$ccflags"
12685 prototype="$prototype"
12686 define="$define"
12687 rm=$rm
12688 EOSH
12689
12690 $cat >> protochk <<'EOSH'
12691
12692 $rm -f try.c
12693 foo="$1"
12694 shift
12695 while test $# -ge 2; do
12696         case "$1" in
12697                 $define) echo "#include <$2>" >> try.c ;;
12698                 literal) echo "$2" >> try.c ;;
12699         esac
12700     shift 2
12701 done
12702 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12703 cat >> try.c <<'EOCP'
12704 #ifdef CAN_PROTOTYPE
12705 #define _(args) args
12706 #else
12707 #define _(args) ()
12708 #endif
12709 EOCP
12710 echo "$foo" >> try.c
12711 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12712 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12713 status=$?
12714 $rm -f try.[co]
12715 exit $status
12716 EOSH
12717 chmod +x protochk
12718 $eunicefix protochk
12719
12720 : see what type is used for size_t
12721 rp="What is the type used for the length parameter for string functions?"
12722 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12723 eval $typedef_ask
12724
12725 : check for type of arguments to gethostbyaddr. 
12726 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12727         case "$d_gethbyaddr" in
12728         $define)
12729                 $cat <<EOM
12730
12731 Checking to see what type of arguments are accepted by gethostbyaddr().
12732 EOM
12733                 hdrs="$define sys/types.h
12734                         $d_socket sys/socket.h 
12735                         $i_niin netinet/in.h 
12736                         $i_netdb netdb.h
12737                         $i_unistd unistd.h"
12738                 : The first arg can 'char *' or 'void *'
12739                 : The second arg is some of integral type
12740                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12741                         for yyy in size_t long int; do
12742                                 case "$netdb_host_type" in
12743                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12744                                         if ./protochk "$try" $hdrs; then
12745                                                 echo "Your system accepts $xxx for the first arg."
12746                                                 echo "...and $yyy for the second arg."
12747                                                 netdb_host_type="$xxx"
12748                                                 netdb_hlen_type="$yyy"
12749                                         fi
12750                                         ;;
12751                                 esac
12752                         done
12753                 done
12754                 : In case none of those worked, prompt the user.
12755                 case "$netdb_host_type" in
12756                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12757                         dflt='char *'
12758                         . ./myread
12759                         netdb_host_type=$ans
12760                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12761                         dflt="$sizetype"
12762                         . ./myread
12763                         netdb_hlen_type=$ans
12764                         ;;
12765                 esac
12766                 ;;
12767         *)      : no gethostbyaddr, so pick harmless defaults
12768                 netdb_host_type='char *'
12769                 netdb_hlen_type="$sizetype"
12770                 ;;
12771         esac
12772         # Remove the "const" if needed. -- but then we'll have a 
12773         # prototype clash!
12774         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12775 fi
12776
12777 : check for type of argument to gethostbyname. 
12778 if test "X$netdb_name_type" = X ; then
12779         case "$d_gethbyname" in
12780         $define)
12781                 $cat <<EOM
12782
12783 Checking to see what type of argument is accepted by gethostbyname().
12784 EOM
12785                 hdrs="$define sys/types.h
12786                         $d_socket sys/socket.h 
12787                         $i_niin netinet/in.h 
12788                         $i_netdb netdb.h
12789                         $i_unistd unistd.h"
12790                 for xxx in "const char *" "char *"; do
12791                         case "$netdb_name_type" in
12792                         '')     try="extern struct hostent *gethostbyname($xxx);"
12793                                 if ./protochk "$try" $hdrs; then
12794                                         echo "Your system accepts $xxx."
12795                                         netdb_name_type="$xxx"
12796                                 fi
12797                                 ;;
12798                         esac
12799                 done
12800                 : In case none of those worked, prompt the user.
12801                 case "$netdb_name_type" in
12802                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12803                         dflt='char *'
12804                         . ./myread
12805                         netdb_name_type=$ans
12806                         ;;
12807                 esac
12808                 ;;
12809         *)      : no gethostbyname, so pick harmless default
12810                 netdb_name_type='char *'
12811                 ;;
12812         esac
12813 fi
12814
12815 : check for type of 1st argument to getnetbyaddr. 
12816 if test "X$netdb_net_type" = X ; then
12817         case "$d_getnbyaddr" in
12818         $define)
12819                 $cat <<EOM
12820
12821 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12822 EOM
12823                 hdrs="$define sys/types.h
12824                         $d_socket sys/socket.h 
12825                         $i_niin netinet/in.h 
12826                         $i_netdb netdb.h
12827                         $i_unistd unistd.h"
12828                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12829                         case "$netdb_net_type" in
12830                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12831                                 if ./protochk "$try" $hdrs; then
12832                                         echo "Your system accepts $xxx."
12833                                         netdb_net_type="$xxx"
12834                                 fi
12835                                 ;;
12836                         esac
12837                 done
12838                 : In case none of those worked, prompt the user.
12839                 case "$netdb_net_type" in
12840                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12841                         dflt='long'
12842                         . ./myread
12843                         netdb_net_type=$ans
12844                         ;;
12845                 esac
12846                 ;;
12847         *)      : no getnetbyaddr, so pick harmless default
12848                 netdb_net_type='long'
12849                 ;;
12850         esac
12851 fi
12852 : locate the preferred pager for this system
12853 case "$pager" in
12854 '')
12855         dflt=''
12856         case "$pg" in
12857         /*) dflt=$pg;;
12858         esac
12859         case "$more" in
12860         /*) dflt=$more;;
12861         esac
12862         case "$less" in
12863         /*) dflt=$less;;
12864         esac
12865         case "$dflt" in
12866         '') dflt=/usr/ucb/more;;
12867         esac
12868         ;;
12869 *) dflt="$pager";;
12870 esac
12871 echo " "
12872 fn=f/
12873 rp='What pager is used on your system?'
12874 . ./getfile
12875 pager="$ans"
12876
12877 : see what type pids are declared as in the kernel
12878 rp="What is the type of process ids on this system?"
12879 set pid_t pidtype int stdio.h sys/types.h
12880 eval $typedef_ask
12881
12882 : Find earliest binary compatible site_perl subdirectory perl can use.
12883 case "$bincompat5005" in
12884 "$define") xs_apiversion='5.005' ;;
12885 *) xs_apiversion=$version ;;   # The current site_perl version.
12886 esac
12887 : Find earliest pure perl site_perl subdirectory perl can use.
12888 : The versioned directories started at 5.005.
12889 pm_apiversion='5.005'
12890
12891 : check for length of pointer
12892 echo " "
12893 case "$ptrsize" in
12894 '')
12895         $echo $n "Checking to see how big your pointers are...$c" >&4
12896         if test "$voidflags" -gt 7; then
12897                 echo '#define VOID_PTR char *' > try.c
12898         else
12899                 echo '#define VOID_PTR void *' > try.c
12900         fi
12901         $cat >>try.c <<'EOCP'
12902 #include <stdio.h>
12903 int main()
12904 {
12905     printf("%d\n", (int)sizeof(VOID_PTR));
12906     exit(0);
12907 }
12908 EOCP
12909         set try
12910         if eval $compile_ok; then
12911                 ptrsize=`./try`
12912                 $echo " $ptrsize bytes." >&4
12913         else
12914                 dflt='4'
12915                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12916                 rp="What is the size of a pointer (in bytes)?"
12917                 . ./myread
12918                 ptrsize="$ans"
12919         fi
12920         ;;
12921 esac
12922 $rm -f try.c try
12923
12924 : see if ar generates random libraries by itself
12925 echo " "
12926 echo "Checking how to generate random libraries on your machine..." >&4
12927 echo 'int bar1() { return bar2(); }' > bar1.c
12928 echo 'int bar2() { return 2; }' > bar2.c
12929 $cat > foo.c <<'EOP'
12930 int main() { printf("%d\n", bar1()); exit(0); }
12931 EOP
12932 $cc $ccflags -c bar1.c >/dev/null 2>&1
12933 $cc $ccflags -c bar2.c >/dev/null 2>&1
12934 $cc $ccflags -c foo.c >/dev/null 2>&1
12935 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12936 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12937         ./foobar >/dev/null 2>&1; then
12938         echo "$ar appears to generate random libraries itself."
12939         orderlib=false
12940         ranlib=":"
12941 elif $ar ts bar$_a >/dev/null 2>&1 &&
12942         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12943         ./foobar >/dev/null 2>&1; then
12944                 echo "a table of contents needs to be added with '$ar ts'."
12945                 orderlib=false
12946                 ranlib="$ar ts"
12947 else
12948         case "$ranlib" in
12949         :) ranlib='';;
12950         '')
12951                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12952                 $test -f $ranlib || ranlib=''
12953                 ;;
12954         esac
12955         if $test -n "$ranlib"; then
12956                 echo "your system has '$ranlib'; we'll use that."
12957                 orderlib=false
12958         else
12959                 echo "your system doesn't seem to support random libraries"
12960                 echo "so we'll use lorder and tsort to order the libraries."
12961                 orderlib=true
12962                 ranlib=":"
12963         fi
12964 fi
12965 $rm -f foo* bar* 
12966
12967 : check for type of arguments to select. 
12968 case "$selecttype" in
12969 '') case "$d_select" in
12970         $define)
12971                 echo " "
12972                 $cat <<EOM
12973 Checking to see what type of arguments are accepted by select().
12974 EOM
12975                 hdrs="$define sys/types.h
12976                         $i_systime sys/time.h 
12977                         $i_sysselct sys/select.h
12978                         $d_socket sys/socket.h"
12979                 : The first arg can be int, unsigned, or size_t
12980                 : The last arg may or may not be 'const'
12981                 val=''
12982                 : void pointer has been seen but using that
12983                 : breaks the selectminbits test
12984                 for xxx in 'fd_set *' 'int *'; do
12985                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12986                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12987                                         case "$val" in
12988                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12989                                                 if ./protochk "$try" $hdrs; then
12990                                                         echo "Your system accepts $xxx."
12991                                                         val="$xxx"
12992                                                 fi
12993                                                 ;;
12994                                         esac
12995                                 done
12996                         done
12997                 done
12998                 case "$val" in
12999                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13000                         case "$d_fd_set" in
13001                                 $define) dflt="fd_set *" ;;
13002                                 *)              dflt="int *" ;;
13003                         esac
13004                         . ./myread
13005                         val=$ans
13006                         ;;
13007                 esac
13008                 selecttype="$val"
13009                 ;;
13010         *)      : no select, so pick a harmless default
13011                 selecttype='int *'
13012                 ;;
13013         esac
13014         ;;
13015 esac
13016
13017 : check for the select 'width'
13018 case "$selectminbits" in
13019 '') case "$d_select" in
13020         $define)
13021                 $cat <<EOM
13022
13023 Checking to see on how many bits at a time your select() operates...
13024 EOM
13025                 $cat >try.c <<EOCP
13026 #include <sys/types.h>
13027 #$i_time I_TIME
13028 #$i_systime I_SYS_TIME
13029 #$i_systimek I_SYS_TIME_KERNEL
13030 #ifdef I_TIME
13031 #   include <time.h>
13032 #endif
13033 #ifdef I_SYS_TIME
13034 #   ifdef I_SYS_TIME_KERNEL
13035 #       define KERNEL
13036 #   endif
13037 #   include <sys/time.h>
13038 #   ifdef I_SYS_TIME_KERNEL
13039 #       undef KERNEL
13040 #   endif
13041 #endif
13042 #$i_sysselct I_SYS_SELECT
13043 #ifdef I_SYS_SELECT
13044 #include <sys/select.h>
13045 #endif
13046 #$d_socket HAS_SOCKET
13047 #ifdef HAS_SOCKET
13048 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13049 #endif
13050 #include <stdio.h>
13051 $selecttype b;
13052 #define S sizeof(*(b))
13053 #define MINBITS 64
13054 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13055 #define NBITS  (NBYTES * 8)
13056 int main() {
13057     char s[NBYTES];
13058     struct timeval t;
13059     int i;
13060     FILE* fp;
13061     int fd;
13062
13063     fclose(stdin);
13064     fp = fopen("try.c", "r");
13065     if (fp == 0)
13066       exit(1);
13067     fd = fileno(fp);
13068     if (fd < 0)
13069       exit(2);
13070     b = ($selecttype)s;
13071     for (i = 0; i < NBITS; i++)
13072         FD_SET(i, b);
13073     t.tv_sec  = 0;
13074     t.tv_usec = 0;
13075     select(fd + 1, b, 0, 0, &t);
13076     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13077     printf("%d\n", i + 1);
13078     return 0;
13079 }
13080 EOCP
13081                 set try
13082                 if eval $compile_ok; then
13083                         selectminbits=`./try`
13084                         case "$selectminbits" in
13085                         '')     cat >&4 <<EOM
13086 Cannot figure out on how many bits at a time your select() operates.
13087 I'll play safe and guess it is 32 bits.
13088 EOM
13089                                 selectminbits=32
13090                                 bits="32 bits"
13091                                 ;;
13092                         1)      bits="1 bit" ;;
13093                         *)      bits="$selectminbits bits" ;;
13094                         esac
13095                         echo "Your select() operates on $bits at a time." >&4
13096                 else
13097                         rp='What is the minimum number of bits your select() operates on?'
13098                         case "$byteorder" in
13099                         1234|12345678)  dflt=32 ;;
13100                         *)              dflt=1  ;;
13101                         esac
13102                         . ./myread
13103                         val=$ans
13104                         selectminbits="$val"
13105                 fi
13106                 $rm -f try.* try
13107                 ;;
13108         *)      : no select, so pick a harmless default
13109                 selectminbits='32'
13110                 ;;
13111         esac
13112         ;;
13113 esac
13114
13115 : Trace out the files included by signal.h, then look for SIGxxx names.
13116 : Remove SIGARRAYSIZE used by HPUX.
13117 : Remove SIGSTKSIZE used by Linux.
13118 : Remove SIGSTKSZ used by Posix.
13119 : Remove SIGTYP void lines used by OS2.
13120 : Some cpps, like os390, dont give the file name anywhere
13121 if [ "X$fieldn" = X ]; then
13122         : Just make some guesses.  We check them later.
13123         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13124 else
13125         xxx=`echo '#include <signal.h>' |
13126         $cppstdin $cppminus $cppflags 2>/dev/null |
13127         $grep '^[       ]*#.*include' | 
13128         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13129 fi
13130 : Check this list of files to be sure we have parsed the cpp output ok.
13131 : This will also avoid potentially non-existent files, such 
13132 : as ../foo/bar.h
13133 xxxfiles=''
13134 for xx in $xxx /dev/null ; do
13135         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13136 done
13137 : If we have found no files, at least try signal.h
13138 case "$xxxfiles" in
13139 '')     xxxfiles=`./findhdr signal.h` ;;
13140 esac
13141 xxx=`awk '
13142 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13143         print substr($2, 4, 20)
13144 }
13145 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13146         print substr($3, 4, 20)
13147 }' $xxxfiles`
13148 : Append some common names just in case the awk scan failed.
13149 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13150 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13151 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13152 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13153 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13154
13155 : generate a few handy files for later
13156 $cat > signal.c <<'EOCP'
13157 #include <sys/types.h>
13158 #include <signal.h>
13159 #include <stdio.h>
13160 int main() {
13161
13162 /* Strange style to avoid deeply-nested #if/#else/#endif */
13163 #ifndef NSIG
13164 #  ifdef _NSIG
13165 #    define NSIG (_NSIG)
13166 #  endif
13167 #endif
13168
13169 #ifndef NSIG
13170 #  ifdef SIGMAX
13171 #    define NSIG (SIGMAX+1)
13172 #  endif
13173 #endif
13174
13175 #ifndef NSIG
13176 #  ifdef SIG_MAX
13177 #    define NSIG (SIG_MAX+1)
13178 #  endif
13179 #endif
13180
13181 #ifndef NSIG
13182 #  ifdef MAXSIG
13183 #    define NSIG (MAXSIG+1)
13184 #  endif
13185 #endif
13186
13187 #ifndef NSIG
13188 #  ifdef MAX_SIG
13189 #    define NSIG (MAX_SIG+1)
13190 #  endif
13191 #endif
13192
13193 #ifndef NSIG
13194 #  ifdef SIGARRAYSIZE
13195 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13196 #  endif
13197 #endif
13198
13199 #ifndef NSIG
13200 #  ifdef _sys_nsig
13201 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13202 #  endif
13203 #endif
13204
13205 /* Default to some arbitrary number that's big enough to get most
13206    of the common signals.
13207 */
13208 #ifndef NSIG
13209 #    define NSIG 50
13210 #endif
13211
13212 printf("NSIG %d\n", NSIG);
13213
13214 #ifndef JUST_NSIG
13215
13216 EOCP
13217
13218 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13219 {
13220         printf "#ifdef SIG"; printf $1; printf "\n"
13221         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13222         printf $1; printf ");\n"
13223         printf "#endif\n"
13224 }
13225 END {
13226         printf "#endif /* JUST_NSIG */\n";
13227         printf "exit(0);\n}\n";
13228 }
13229 ' >>signal.c
13230 $cat >signal.awk <<'EOP'
13231 BEGIN { ndups = 0 }
13232 $1 ~ /^NSIG$/ { nsig = $2 }
13233 ($1 !~ /^NSIG$/) && (NF == 2) {
13234     if ($2 > maxsig) { maxsig = $2 }
13235     if (sig_name[$2]) {
13236         dup_name[ndups] = $1
13237         dup_num[ndups] = $2
13238         ndups++ 
13239     }
13240     else {
13241         sig_name[$2] = $1
13242         sig_num[$2] = $2
13243     }
13244 }
13245 END { 
13246     if (nsig == 0) {
13247         nsig = maxsig + 1
13248     }
13249     printf("NSIG %d\n", nsig);
13250     for (n = 1; n < nsig; n++) {
13251         if (sig_name[n]) {
13252             printf("%s %d\n", sig_name[n], sig_num[n])
13253         }
13254         else {
13255             printf("NUM%d %d\n", n, n) 
13256         }
13257     }
13258     for (n = 0; n < ndups; n++) {
13259         printf("%s %d\n", dup_name[n], dup_num[n])
13260     }
13261 }
13262 EOP
13263 $cat >signal_cmd <<EOS
13264 $startsh
13265 if $test -s signal.lst; then
13266     echo "Using your existing signal.lst file"
13267         exit 0
13268 fi
13269 xxx="$xxx"
13270 EOS
13271 $cat >>signal_cmd <<'EOS'
13272
13273 set signal
13274 if eval $compile_ok; then
13275         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13276 else
13277         echo "(I can't seem be able to compile the whole test program)" >&4
13278         echo "(I'll try it in little pieces.)" >&4
13279         set signal -DJUST_NSIG
13280         if eval $compile_ok; then
13281                 ./signal$_exe > signal.nsg
13282                 $cat signal.nsg
13283         else
13284                 echo "I can't seem to figure out how many signals you have." >&4
13285                 echo "Guessing 50." >&4
13286                 echo 'NSIG 50' > signal.nsg
13287         fi
13288         : Now look at all the signal names, one at a time.
13289         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13290                 $cat > signal.c <<EOCP
13291 #include <sys/types.h>
13292 #include <signal.h>
13293 #include <stdio.h>
13294 int main() {
13295 printf("$xx %d\n", SIG${xx});
13296 return 0;
13297 }
13298 EOCP
13299                 set signal
13300                 if eval $compile; then
13301                         echo "SIG${xx} found."
13302                         ./signal$_exe  >> signal.ls1
13303                 else
13304                         echo "SIG${xx} NOT found."
13305                 fi
13306         done
13307         if $test -s signal.ls1; then
13308                 $cat signal.nsg signal.ls1 |
13309                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13310         fi
13311
13312 fi
13313 if $test -s signal.lst; then
13314         :
13315 else
13316         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13317         echo 'kill -l' >signal
13318         set X `csh -f <signal`
13319         $rm -f signal
13320         shift
13321         case $# in
13322         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13323         esac
13324         echo $@ | $tr ' ' $trnl | \
13325             $awk '{ printf "%s %d\n", $1, ++s; }
13326                   END { printf "NSIG %d\n", ++s }' >signal.lst
13327 fi
13328 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13329 EOS
13330 chmod a+x signal_cmd
13331 $eunicefix signal_cmd
13332
13333 : generate list of signal names
13334 echo " "
13335 case "$sig_name_init" in
13336 '') doinit=yes ;;
13337 *)  case "$sig_num_init" in
13338     ''|*,*) doinit=yes ;;
13339     esac ;;
13340 esac
13341 case "$doinit" in
13342 yes)
13343         echo "Generating a list of signal names and numbers..." >&4
13344         . ./signal_cmd
13345         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13346         sig_name=`$awk 'BEGIN { printf "ZERO " }
13347                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13348         sig_num=`$awk  'BEGIN { printf "0 " }
13349                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13350         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13351                              !/^NSIG/   { printf "\"%s\", ", $1 }
13352                              END        { printf "0\n" }' signal.lst`
13353         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13354                              !/^NSIG/   { printf "%d, ", $2}
13355                              END        { printf "0\n"}' signal.lst`
13356         ;;
13357 esac
13358 echo "The following $sig_count signals are available:"
13359 echo " "
13360 echo $sig_name | $awk \
13361 'BEGIN { linelen = 0 }
13362 {
13363         for (i = 1; i <= NF; i++) {
13364                 name = "SIG" $i " "
13365                 linelen = linelen + length(name)
13366                 if (linelen > 70) {
13367                         printf "\n"
13368                         linelen = length(name)
13369                 }
13370                 printf "%s", name
13371         }
13372         printf "\n"
13373 }'
13374 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13375
13376 : see what type is used for signed size_t
13377 set ssize_t ssizetype int stdio.h sys/types.h
13378 eval $typedef
13379 dflt="$ssizetype"
13380 $cat > ssize.c <<EOM
13381 #include <stdio.h>
13382 #include <sys/types.h>
13383 #define Size_t $sizetype
13384 #define SSize_t $dflt
13385 int main()
13386 {
13387         if (sizeof(Size_t) == sizeof(SSize_t))
13388                 printf("$dflt\n");
13389         else if (sizeof(Size_t) == sizeof(int))
13390                 printf("int\n");
13391         else 
13392                 printf("long\n");
13393         exit(0);
13394 }
13395 EOM
13396 echo " "
13397 set ssize
13398 if eval $compile_ok && ./ssize > /dev/null; then
13399         ssizetype=`./ssize`
13400         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13401 else
13402         $cat >&4 <<EOM
13403 Help! I can't compile and run the ssize_t test program: please enlighten me!
13404 (This is probably a misconfiguration in your system or libraries, and
13405 you really ought to fix it.  Still, I'll try anyway.)
13406
13407 I need a type that is the same size as $sizetype, but is guaranteed to
13408 be signed.  Common values are ssize_t, int and long.
13409
13410 EOM
13411         rp="What signed type is the same size as $sizetype?"
13412         . ./myread
13413         ssizetype="$ans"
13414 fi
13415 $rm -f ssize ssize.*
13416
13417 : see what type of char stdio uses.
13418 echo " "
13419 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13420         echo "Your stdio uses unsigned chars." >&4
13421         stdchar="unsigned char"
13422 else
13423         echo "Your stdio uses signed chars." >&4
13424         stdchar="char"
13425 fi
13426
13427 : see if time exists
13428 echo " "
13429 if test "X$d_time" = X -o X"$timetype" = X; then
13430     if set time val -f d_time; eval $csym; $val; then
13431                 echo 'time() found.' >&4
13432                 val="$define"
13433                 rp="What is the type returned by time() on this system?"
13434                 set time_t timetype long stdio.h sys/types.h
13435                 eval $typedef_ask
13436     else
13437                 echo 'time() not found, hope that will do.' >&4
13438                 val="$undef"
13439                 timetype='int';
13440     fi
13441     set d_time
13442     eval $setvar
13443 fi
13444
13445 : see what type uids are declared as in the kernel
13446 echo " "
13447 echo "Looking for the type for user ids returned by getuid()."
13448 set uid_t uidtype xxx stdio.h sys/types.h
13449 eval $typedef
13450 case "$uidtype" in
13451 xxx)
13452         xxx=`./findhdr sys/user.h`
13453         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13454         case $1 in
13455         unsigned) dflt="$1 $2" ;;
13456         *) dflt="$1" ;;
13457         esac
13458         ;;
13459 *) dflt="$uidtype";;
13460 esac
13461 case "$uidtype" in
13462 uid_t)  echo "uid_t found." ;;
13463 *)      rp="What is the type for user ids returned by getuid()?"
13464         . ./myread
13465         uidtype="$ans"
13466         ;;
13467 esac
13468
13469 echo " "
13470 case "$uidtype" in
13471 *_t) zzz="$uidtype"     ;;
13472 *)   zzz="uid"          ;;
13473 esac
13474 echo "Checking the size of $zzz..." >&4 
13475 cat > try.c <<EOCP
13476 #include <sys/types.h>
13477 #include <stdio.h>
13478 int main() {
13479     printf("%d\n", (int)sizeof($uidtype));
13480     exit(0);
13481 }
13482 EOCP
13483 set try
13484 if eval $compile_ok; then
13485         yyy=`./try`
13486         case "$yyy" in
13487         '')     uidsize=4
13488                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13489                 ;;
13490         *)      uidsize=$yyy
13491                 echo "Your $zzz size is $uidsize bytes."
13492                 ;;
13493         esac
13494 else
13495         uidsize=4
13496         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13497 fi
13498
13499 echo " "
13500 case "$uidtype" in
13501 *_t) zzz="$uidtype"     ;;
13502 *)   zzz="uid"          ;;
13503 esac
13504 echo "Checking the sign of $zzz..." >&4
13505 cat > try.c <<EOCP
13506 #include <sys/types.h>
13507 #include <stdio.h>
13508 int main() {
13509         $uidtype foo = -1;
13510         if (foo < 0)
13511                 printf("-1\n");
13512         else
13513                 printf("1\n");
13514 }
13515 EOCP
13516 set try
13517 if eval $compile; then
13518         yyy=`./try`
13519         case "$yyy" in
13520         '')     uidsign=1
13521                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13522                 ;;
13523         *)      uidsign=$yyy
13524                 case "$uidsign" in
13525                  1) echo "Your $zzz is unsigned." ;;
13526                 -1) echo "Your $zzz is signed."   ;;
13527                 esac
13528                 ;;
13529         esac
13530 else
13531         uidsign=1
13532         echo "(I can't compile the test program--guessing unsigned.)" >&4
13533 fi
13534
13535
13536
13537 echo " "
13538 $echo "Checking the format string to be used for uids..." >&4
13539
13540 case "$uidsign" in
13541 -1)     if $test X"$uidsize" = X"$ivsize"; then
13542                 uidformat="$ivdformat"
13543         else
13544                 if $test X"$uidsize" = X"$longsize"; then
13545                         uidformat='"ld"'
13546                 else
13547                         if $test X"$uidsize" = X"$intsize"; then
13548                                 uidformat='"d"'
13549                         else
13550                                 if $test X"$uidsize" = X"$shortsize"; then
13551                                         uidformat='"hd"'
13552                                 fi
13553                         fi
13554                 fi
13555         fi
13556         ;;
13557 *)      if $test X"$uidsize" = X"$uvsize"; then
13558                 uidformat="$uvuformat"
13559         else
13560                 if $test X"$uidsize" = X"$longsize"; then
13561                         uidformat='"lu"'
13562                 else
13563                         if $test X"$uidsize" = X"$intsize"; then
13564                                 uidformat='"u"'
13565                         else
13566                                 if $test X"$uidsize" = X"$shortsize"; then
13567                                         uidformat='"hu"'
13568                                 fi
13569                         fi
13570                 fi
13571         fi
13572         ;;
13573 esac
13574
13575 : see if dbm.h is available
13576 : see if dbmclose exists
13577 set dbmclose d_dbmclose
13578 eval $inlibc
13579
13580 case "$d_dbmclose" in
13581 $define)
13582         set dbm.h i_dbm
13583         eval $inhdr
13584         case "$i_dbm" in
13585         $define)
13586                 val="$undef"
13587                 set i_rpcsvcdbm
13588                 eval $setvar
13589                 ;;
13590         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13591                 eval $inhdr
13592                 ;;
13593         esac
13594         ;;
13595 *)      echo "We won't be including <dbm.h>"
13596         val="$undef"
13597         set i_dbm
13598         eval $setvar
13599         val="$undef"
13600         set i_rpcsvcdbm
13601         eval $setvar
13602         ;;
13603 esac
13604
13605 : see if this is a sys/file.h system
13606 val=''
13607 set sys/file.h val
13608 eval $inhdr
13609
13610 : do we need to include sys/file.h ?
13611 case "$val" in
13612 "$define")
13613         echo " "
13614         if $h_sysfile; then
13615                 val="$define"
13616                 echo "We'll be including <sys/file.h>." >&4
13617         else
13618                 val="$undef"
13619                 echo "We won't be including <sys/file.h>." >&4
13620         fi
13621         ;;
13622 *)
13623         h_sysfile=false
13624         ;;
13625 esac
13626 set i_sysfile
13627 eval $setvar
13628
13629 : see if fcntl.h is there
13630 val=''
13631 set fcntl.h val
13632 eval $inhdr
13633
13634 : see if we can include fcntl.h
13635 case "$val" in
13636 "$define")
13637         echo " "
13638         if $h_fcntl; then
13639                 val="$define"
13640                 echo "We'll be including <fcntl.h>." >&4
13641         else
13642                 val="$undef"
13643                 if $h_sysfile; then
13644         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13645                 else
13646                         echo "We won't be including <fcntl.h>." >&4
13647                 fi
13648         fi
13649         ;;
13650 *)
13651         h_fcntl=false
13652         val="$undef"
13653         ;;
13654 esac
13655 set i_fcntl
13656 eval $setvar
13657
13658 : see if this is a iconv.h system
13659 set iconv.h i_iconv
13660 eval $inhdr
13661
13662 : see if locale.h is available
13663 set locale.h i_locale
13664 eval $inhdr
13665
13666 : see if mach cthreads are available
13667 if test "X$usethreads" = "X$define"; then
13668         set mach/cthreads.h i_machcthr
13669         eval $inhdr
13670 else
13671         i_machcthr="$undef"
13672 fi
13673
13674
13675
13676 : see if this is a math.h system
13677 set math.h i_math
13678 eval $inhdr
13679
13680 : see if this is a mntent.h system
13681 set mntent.h i_mntent
13682 eval $inhdr
13683
13684 : see if ndbm.h is available
13685 set ndbm.h t_ndbm
13686 eval $inhdr
13687 case "$t_ndbm" in
13688 $define)
13689         : see if dbm_open exists
13690         set dbm_open d_dbm_open
13691         eval $inlibc
13692         case "$d_dbm_open" in
13693         $undef)
13694                 t_ndbm="$undef"
13695                 echo "We won't be including <ndbm.h>"
13696                 ;;
13697         esac
13698         ;;
13699 esac
13700 val="$t_ndbm"
13701 set i_ndbm
13702 eval $setvar
13703
13704 : see if net/errno.h is available
13705 val=''
13706 set net/errno.h val
13707 eval $inhdr
13708
13709 : Unfortunately, it causes problems on some systems.  Arrgh.
13710 case "$val" in
13711 $define)
13712         cat > try.c <<'EOM'
13713 #include <stdio.h>
13714 #include <errno.h>
13715 #include <net/errno.h>
13716 int func()
13717 {
13718         return ENOTSOCK;
13719 }
13720 EOM
13721         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13722                 echo "We'll be including <net/errno.h>." >&4
13723         else
13724                 echo "We won't be including <net/errno.h>." >&4
13725                 val="$undef"
13726         fi
13727         $rm -f try.* try
13728         ;;
13729 esac
13730 set i_neterrno
13731 eval $setvar
13732
13733 : see if netinet/tcp.h is available
13734 set netinet/tcp.h i_netinettcp
13735 eval $inhdr
13736
13737 : see if this is a poll.h system
13738 set poll.h i_poll
13739 eval $inhdr
13740
13741 echo " "
13742 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13743 $cat <<'EOSH' > Cppsym.know
13744 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13745 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13746 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13747 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13748 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13749 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13750 bull c cadmus clipper CMU COFF COMPILER_VERSION
13751 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13752 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13753 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13754 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13755 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13756 H3050R H3050RX hbullx20 hcx host_mips
13757 hp200 hp300 hp700 HP700 hp800 hp9000
13758 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13759 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13760 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13761 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13762 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13763 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13764 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13765 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13766 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13767 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13768 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13769 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13770 MATH_HAS_NO_SIDE_EFFECTS
13771 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13772 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13773 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13774 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13775 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13776 NetBSD news1500 news1700 news1800 news1900 news3700
13777 news700 news800 news900 NeXT NLS ns16000 ns32000
13778 ns32016 ns32332 ns32k nsc32000
13779 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13780 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13781 pc532 pdp11 PGC PIC plexus PORTAR posix
13782 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13783 POSIX_C_SOURCE POSIX_SOURCE POWER
13784 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13785 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13786 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13787 sony sony_news sonyrisc sparc sparclite spectrum
13788 stardent stdc STDC_EXT stratos sun sun3 sun386
13789 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13790 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13791 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13792 sysV68 sysV88 Tek4132 Tek4300 titan
13793 tower tower32 tower32_200 tower32_600 tower32_700
13794 tower32_800 tower32_850 tss
13795 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13796 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13797 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13798 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13799 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13800 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13801 z8000
13802 EOSH
13803 # Maybe put other stuff here too.
13804 cat <<EOSH >>Cppsym.know
13805 $osname
13806 EOSH
13807 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13808 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13809 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13810 $rm -f Cppsym.a Cppsym.b
13811 cat <<EOSH > Cppsym
13812 $startsh
13813 if $test \$# -gt 0; then
13814     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13815     if $test -s Cppsym.got; then
13816         $rm -f Cppsym.got
13817         exit 0
13818     fi
13819     $rm -f Cppsym.got
13820     exit 1
13821 else
13822     $tr " " "$trnl" | ./Cppsym.try
13823     exit 0
13824 fi
13825 EOSH
13826 chmod +x Cppsym
13827 $eunicefix Cppsym
13828 cat <<EOSH > Cppsym.try
13829 $startsh
13830 cat <<'EOCP' > try.c
13831 #include <stdio.h>
13832 int main() {
13833 EOCP
13834 $awk \\
13835 EOSH
13836 cat <<'EOSH' >> Cppsym.try
13837 'length($1) > 0 {
13838     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
13839     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
13840     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
13841     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
13842 }'       >> try.c
13843 echo '}' >> try.c
13844 EOSH
13845 cat <<EOSH >> Cppsym.try
13846 cc="$cc"
13847 optimize="$optimize"
13848 ccflags="$ccflags"
13849 ldflags="$ldflags"
13850 libs="$libs"
13851 exe_ext="$exe_ext"
13852 $cc $optimize $ccflags $ldflags -o try$exe_ext try.c $libs && ./try$exe_ext
13853 EOSH
13854 chmod +x Cppsym.try
13855 $eunicefix Cppsym.try
13856 ./Cppsym < Cppsym.know > Cppsym.true
13857 : now check the C compiler for additional symbols
13858 postprocess_cc_v=''
13859 case "$osname" in
13860 aix) postprocess_cc_v="|$tr , ' '" ;;
13861 esac
13862 $cat >ccsym <<EOS
13863 $startsh
13864 $cat >tmp.c <<EOF
13865 extern int foo;
13866 EOF
13867 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13868 do
13869         case "\$i" in
13870         -D*) echo "\$i" | $sed 's/^-D//';;
13871         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13872         esac
13873 done
13874 $rm -f try.c
13875 EOS
13876 postprocess_cc_v=''
13877 chmod +x ccsym
13878 $eunicefix ccsym
13879 ./ccsym > ccsym1.raw
13880 if $test -s ccsym1.raw; then
13881        $sort ccsym1.raw | $uniq >ccsym.raw
13882 else
13883        mv ccsym1.raw ccsym.raw
13884 fi
13885
13886 $awk '/\=/ { print $0; next }
13887         { print $0"=1" }' ccsym.raw >ccsym.list
13888 $awk '/\=/ { print $0; next }
13889         { print $0"=1" }' Cppsym.true >ccsym.true
13890 $comm -13 ccsym.true ccsym.list >ccsym.own
13891 $comm -12 ccsym.true ccsym.list >ccsym.com
13892 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13893 also=''
13894 if $test -z ccsym.raw; then
13895         echo "Your C compiler doesn't seem to define any symbols!" >&4
13896         echo " "
13897         echo "However, your C preprocessor defines the following symbols:"
13898         $cat Cppsym.true
13899         ccsymbols=''
13900         cppsymbols=`$cat Cppsym.true`
13901         cppsymbols=`echo $cppsymbols`
13902         cppccsymbols="$cppsymbols"
13903 else
13904         if $test -s ccsym.com; then
13905                 echo "Your C compiler and pre-processor define these symbols:"
13906                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13907                 also='also '
13908                 symbols='ones'
13909                 cppccsymbols=`$cat ccsym.com`
13910                 cppccsymbols=`echo $cppccsymbols`
13911                 $test "$silent" || sleep 1
13912         fi
13913         if $test -s ccsym.cpp; then
13914                 $test "$also" && echo " "
13915                 echo "Your C pre-processor ${also}defines the following symbols:"
13916                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13917                 also='further '
13918                 cppsymbols=`$cat ccsym.cpp`
13919                 cppsymbols=`echo $cppsymbols`
13920                 $test "$silent" || sleep 1
13921         fi
13922         if $test -s ccsym.own; then
13923                 $test "$also" && echo " "
13924                 echo "Your C compiler ${also}defines the following cpp symbols:"
13925                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13926                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13927                 ccsymbols=`$cat ccsym.own`
13928                 ccsymbols=`echo $ccsymbols`
13929                 $test "$silent" || sleep 1
13930         fi
13931 fi
13932 $rm -f ccsym*
13933
13934 : see if this is a termio system
13935 val="$undef"
13936 val2="$undef"
13937 val3="$undef"
13938 if $test `./findhdr termios.h`; then
13939         set tcsetattr i_termios
13940         eval $inlibc
13941         val3="$i_termios"
13942 fi
13943 echo " "
13944 case "$val3" in
13945 "$define") echo "You have POSIX termios.h... good!" >&4;;
13946 *) if ./Cppsym pyr; then
13947                 case "`/bin/universe`" in
13948                 ucb) if $test `./findhdr sgtty.h`; then
13949                                 val2="$define"
13950                                 echo "<sgtty.h> found." >&4
13951                         else
13952                                 echo "System is pyramid with BSD universe."
13953                                 echo "<sgtty.h> not found--you could have problems." >&4
13954                         fi;;
13955                 *) if $test `./findhdr termio.h`; then
13956                                 val="$define"
13957                                 echo "<termio.h> found." >&4
13958                         else
13959                                 echo "System is pyramid with USG universe."
13960                                 echo "<termio.h> not found--you could have problems." >&4
13961                         fi;;
13962                 esac
13963         elif ./usg; then
13964                 if $test `./findhdr termio.h`; then
13965                         echo "<termio.h> found." >&4
13966                         val="$define"
13967                 elif $test `./findhdr sgtty.h`; then
13968                         echo "<sgtty.h> found." >&4
13969                         val2="$define"
13970                 else
13971 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13972                 fi
13973         else
13974                 if $test `./findhdr sgtty.h`; then
13975                         echo "<sgtty.h> found." >&4
13976                         val2="$define"
13977                 elif $test `./findhdr termio.h`; then
13978                         echo "<termio.h> found." >&4
13979                         val="$define"
13980                 else
13981 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13982                 fi
13983         fi;;
13984 esac
13985 set i_termio; eval $setvar
13986 val=$val2; set i_sgtty; eval $setvar
13987 val=$val3; set i_termios; eval $setvar
13988
13989 : see if this is a shadow.h system
13990 set shadow.h i_shadow
13991 eval $inhdr
13992
13993 : see if this is a socks.h system
13994 set socks.h i_socks
13995 eval $inhdr
13996
13997 : see if stdarg is available
13998 echo " "
13999 if $test `./findhdr stdarg.h`; then
14000         echo "<stdarg.h> found." >&4
14001         valstd="$define"
14002 else
14003         echo "<stdarg.h> NOT found." >&4
14004         valstd="$undef"
14005 fi
14006
14007 : see if varags is available
14008 echo " "
14009 if $test `./findhdr varargs.h`; then
14010         echo "<varargs.h> found." >&4
14011 else
14012         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14013 fi
14014
14015 : set up the varargs testing programs
14016 $cat > varargs.c <<EOP
14017 #ifdef I_STDARG
14018 #include <stdarg.h>
14019 #endif
14020 #ifdef I_VARARGS
14021 #include <varargs.h>
14022 #endif
14023
14024 #ifdef I_STDARG
14025 int f(char *p, ...)
14026 #else
14027 int f(va_alist)
14028 va_dcl
14029 #endif
14030 {
14031         va_list ap;
14032 #ifndef I_STDARG
14033         char *p;
14034 #endif
14035 #ifdef I_STDARG
14036         va_start(ap,p);
14037 #else
14038         va_start(ap);
14039         p = va_arg(ap, char *);
14040 #endif
14041         va_end(ap);
14042 }
14043 EOP
14044 $cat > varargs <<EOP
14045 $startsh
14046 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14047         echo "true"
14048 else
14049         echo "false"
14050 fi
14051 $rm -f varargs$_o
14052 EOP
14053 chmod +x varargs
14054
14055 : now check which varargs header should be included
14056 echo " "
14057 i_varhdr=''
14058 case "$valstd" in
14059 "$define")
14060         if `./varargs I_STDARG`; then
14061                 val='stdarg.h'
14062         elif `./varargs I_VARARGS`; then
14063                 val='varargs.h'
14064         fi
14065         ;;
14066 *)
14067         if `./varargs I_VARARGS`; then
14068                 val='varargs.h'
14069         fi
14070         ;;
14071 esac
14072 case "$val" in
14073 '')
14074 echo "I could not find the definition for va_dcl... You have problems..." >&4
14075         val="$undef"; set i_stdarg; eval $setvar
14076         val="$undef"; set i_varargs; eval $setvar
14077         ;;
14078 *) 
14079         set i_varhdr
14080         eval $setvar
14081         case "$i_varhdr" in
14082         stdarg.h)
14083                 val="$define"; set i_stdarg; eval $setvar
14084                 val="$undef"; set i_varargs; eval $setvar
14085                 ;;
14086         varargs.h)
14087                 val="$undef"; set i_stdarg; eval $setvar
14088                 val="$define"; set i_varargs; eval $setvar
14089                 ;;
14090         esac
14091         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14092 esac
14093 $rm -f varargs*
14094
14095 : see if stddef is available
14096 set stddef.h i_stddef
14097 eval $inhdr
14098
14099 : see if sys/access.h is available
14100 set sys/access.h i_sysaccess
14101 eval $inhdr
14102
14103 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14104 set sys/filio.h i_sysfilio
14105 eval $inhdr
14106 echo " "
14107 if $test `./findhdr sys/ioctl.h`; then
14108         val="$define"
14109         echo '<sys/ioctl.h> found.' >&4
14110 else
14111         val="$undef"
14112         if $test $i_sysfilio = "$define"; then
14113             echo '<sys/ioctl.h> NOT found.' >&4
14114         else
14115                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14116                 $test $i_termio = "$define" && xxx="termio.h"
14117                 $test $i_termios = "$define" && xxx="termios.h"
14118 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14119         fi
14120 fi
14121 set i_sysioctl
14122 eval $setvar
14123
14124 : see if sys/resource.h has to be included
14125 set sys/resource.h i_sysresrc
14126 eval $inhdr
14127
14128 : see if sys/security.h is available
14129 set sys/security.h i_syssecrt
14130 eval $inhdr
14131
14132 : see if this is a sys/statvfs.h system
14133 set sys/statvfs.h i_sysstatvfs
14134 eval $inhdr
14135
14136 : see if this is a sys/uio.h system
14137 set sys/uio.h i_sysuio
14138 eval $inhdr
14139
14140 : see if this is a sys/un.h system
14141 set sys/un.h i_sysun
14142 eval $inhdr
14143
14144 : see if this is a syswait system
14145 set sys/wait.h i_syswait
14146 eval $inhdr
14147
14148 : see if this is a ustat.h system
14149 set ustat.h i_ustat
14150 eval $inhdr
14151
14152 : see if this is an utime system
14153 set utime.h i_utime
14154 eval $inhdr
14155
14156 : see if this is a values.h system
14157 set values.h i_values
14158 eval $inhdr
14159
14160 : see if this is a vfork system
14161 case "$d_vfork" in
14162 "$define")
14163         set vfork.h i_vfork
14164         eval $inhdr
14165         ;;
14166 *)
14167         i_vfork="$undef"
14168         ;;
14169 esac
14170
14171 : see if gdbm.h is available
14172 set gdbm.h t_gdbm
14173 eval $inhdr
14174 case "$t_gdbm" in
14175 $define)
14176         : see if gdbm_open exists
14177         set gdbm_open d_gdbm_open
14178         eval $inlibc
14179         case "$d_gdbm_open" in
14180         $undef)
14181                 t_gdbm="$undef"
14182                 echo "We won't be including <gdbm.h>"
14183                 ;;
14184         esac
14185         ;;
14186 esac
14187 val="$t_gdbm"
14188 set i_gdbm
14189 eval $setvar
14190
14191 echo " "
14192 echo "Looking for extensions..." >&4
14193 : If we are using the old config.sh, known_extensions may contain
14194 : old or inaccurate or duplicate values.
14195 known_extensions=''
14196 nonxs_extensions=''
14197 : We do not use find because it might not be available.
14198 : We do not just use MANIFEST because the user may have dropped
14199 : some additional extensions into the source tree and expect them
14200 : to be built.
14201
14202 : Function to recursively find available extensions, ignoring DynaLoader
14203 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14204 find_extensions='
14205     for xxx in *; do
14206        case "$xxx" in
14207            DynaLoader|dynaload) ;;
14208            *)
14209            if $test -f $xxx/$xxx.xs; then
14210                known_extensions="$known_extensions $1$xxx";
14211            elif $test -f $xxx/Makefile.PL; then
14212                nonxs_extensions="$nonxs_extensions $1$xxx";
14213            else
14214                if $test -d $xxx -a $# -lt 10; then
14215                    set $1$xxx/ $*;
14216                    cd $xxx;
14217                    eval $find_extensions;
14218                    cd ..;
14219                    shift;
14220                fi;
14221            fi
14222            ;;
14223        esac;
14224     done'
14225 tdir=`pwd`
14226 cd $rsrc/ext
14227 set X
14228 shift
14229 eval $find_extensions
14230 set X $nonxs_extensions
14231 shift
14232 nonxs_extensions="$*"
14233 set X $known_extensions
14234 shift
14235 known_extensions="$*"
14236 cd $tdir
14237
14238 : Now see which are supported on this system.
14239 avail_ext=''
14240 for xxx in $known_extensions ; do
14241         case "$xxx" in
14242         DB_File|db_file)
14243                 case "$i_db" in
14244                 $define) avail_ext="$avail_ext $xxx" ;;
14245                 esac
14246                 ;;
14247         GDBM_File|gdbm_fil)
14248                 case "$i_gdbm" in 
14249                 $define) avail_ext="$avail_ext $xxx" ;;
14250                 esac
14251                 ;;
14252         NDBM_File|ndbm_fil)
14253                 case "$i_ndbm" in
14254                 $define) avail_ext="$avail_ext $xxx" ;;
14255                 esac
14256                 ;;
14257         ODBM_File|odbm_fil) 
14258                 case "${i_dbm}${i_rpcsvcdbm}" in
14259                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14260                 esac
14261                 ;;
14262         POSIX|posix)
14263                 case "$useposix" in
14264                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14265                 esac
14266                 ;;
14267         Opcode|opcode)
14268                 case "$useopcode" in
14269                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14270                 esac
14271                 ;;
14272         Socket|socket)
14273                 case "$d_socket" in 
14274                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14275                 esac
14276                 ;;
14277         Thread|thread)
14278                 case "$usethreads" in 
14279                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14280                 esac
14281                 ;;
14282         IPC/SysV|ipc/sysv)
14283                 : XXX Do we need a useipcsysv variable here
14284                 case "${d_msg}${d_sem}${d_shm}" in 
14285                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14286                 esac
14287                 ;;
14288         *)      avail_ext="$avail_ext $xxx"
14289                 ;;
14290         esac
14291 done
14292
14293 set X $avail_ext
14294 shift
14295 avail_ext="$*"
14296
14297 : Now see which nonxs extensions are supported on this system.
14298 : For now assume all are.
14299 nonxs_ext=''
14300 for xxx in $nonxs_extensions ; do
14301         case "$xxx" in
14302         *)      nonxs_ext="$nonxs_ext $xxx"
14303                 ;;
14304         esac
14305 done
14306
14307 set X $nonxs_ext
14308 shift
14309 nonxs_ext="$*"
14310
14311 case $usedl in
14312 $define)
14313         $cat <<EOM
14314 A number of extensions are supplied with $package.  You may choose to
14315 compile these extensions for dynamic loading (the default), compile
14316 them into the $package executable (static loading), or not include
14317 them at all.  Answer "none" to include no extensions.
14318 Note that DynaLoader is always built and need not be mentioned here.
14319
14320 EOM
14321         case "$dynamic_ext" in
14322         '') dflt="$avail_ext" ;;
14323         *)      dflt="$dynamic_ext"
14324                 # Perhaps we are reusing an old out-of-date config.sh.
14325                 case "$hint" in
14326                 previous)
14327                         if test X"$dynamic_ext" != X"$avail_ext"; then
14328                                 $cat <<EOM
14329 NOTICE:  Your previous config.sh list may be incorrect. 
14330 The extensions now available to you are 
14331         ${avail_ext}
14332 but the default list from your previous config.sh is
14333         ${dynamic_ext} 
14334
14335 EOM
14336                         fi
14337                         ;;
14338                 esac
14339                 ;;
14340         esac
14341         case "$dflt" in
14342         '')     dflt=none;;
14343         esac
14344         rp="What extensions do you wish to load dynamically?"
14345         . ./myread
14346         case "$ans" in
14347         none) dynamic_ext=' ' ;;
14348         *) dynamic_ext="$ans" ;;
14349         esac
14350
14351         case "$static_ext" in
14352         '')
14353                 : Exclude those already listed in dynamic linking
14354                 dflt=''
14355                 for xxx in $avail_ext; do
14356                         case " $dynamic_ext " in
14357                         *" $xxx "*) ;;
14358                         *) dflt="$dflt $xxx" ;;
14359                         esac
14360                 done
14361                 set X $dflt
14362                 shift
14363                 dflt="$*"
14364                 ;;
14365         *)  dflt="$static_ext" 
14366                 ;;
14367         esac
14368
14369         case "$dflt" in
14370         '')     dflt=none;;
14371         esac
14372         rp="What extensions do you wish to load statically?"
14373         . ./myread
14374         case "$ans" in
14375         none) static_ext=' ' ;;
14376         *) static_ext="$ans" ;;
14377         esac
14378         ;;
14379 *)
14380         $cat <<EOM
14381 A number of extensions are supplied with $package.  Answer "none" 
14382 to include no extensions. 
14383 Note that DynaLoader is always built and need not be mentioned here.
14384
14385 EOM
14386         case "$static_ext" in
14387         '') dflt="$avail_ext" ;;
14388         *)      dflt="$static_ext"
14389                 # Perhaps we are reusing an old out-of-date config.sh.
14390                 case "$hint" in
14391                 previous)
14392                         if test X"$static_ext" != X"$avail_ext"; then
14393                                 $cat <<EOM
14394 NOTICE:  Your previous config.sh list may be incorrect. 
14395 The extensions now available to you are 
14396         ${avail_ext}
14397 but the default list from your previous config.sh is
14398         ${static_ext} 
14399
14400 EOM
14401                         fi
14402                         ;;
14403                 esac
14404                 ;;
14405         esac
14406         : Exclude those that are not xs extensions
14407         case "$dflt" in
14408         '')     dflt=none;;
14409         esac
14410         rp="What extensions do you wish to include?"
14411         . ./myread
14412         case "$ans" in
14413         none) static_ext=' ' ;;
14414         *) static_ext="$ans" ;;
14415         esac
14416         ;;
14417 esac
14418
14419 set X $dynamic_ext $static_ext $nonxs_ext
14420 shift
14421 extensions="$*"
14422
14423 : Remove build directory name from cppstdin so it can be used from
14424 : either the present location or the final installed location.
14425 echo " "
14426 : Get out of the UU directory to get correct path name.
14427 cd ..
14428 case "$cppstdin" in
14429 `pwd`/cppstdin)
14430         echo "Stripping down cppstdin path name"
14431         cppstdin=cppstdin
14432         ;;
14433 esac
14434 cd UU
14435
14436 : end of configuration questions
14437 echo " "
14438 echo "End of configuration questions."
14439 echo " "
14440
14441 : back to where it started
14442 if test -d ../UU; then
14443         cd ..
14444 fi
14445
14446 : configuration may be patched via a 'config.over' file
14447 if $test -f config.over; then
14448         echo " "
14449         dflt=y
14450         rp='I see a config.over file.  Do you wish to load it?'
14451         . UU/myread
14452         case "$ans" in
14453         n*) echo "OK, I'll ignore it.";;
14454         *)      . ./config.over
14455                 echo "Configuration override changes have been loaded."
14456                 ;;
14457         esac
14458 fi
14459
14460 : in case they want portability, strip down executable paths
14461 case "$d_portable" in
14462 "$define")
14463         echo " "
14464         echo "Stripping down executable paths..." >&4
14465         for file in $loclist $trylist; do
14466                 eval temp=\$$file
14467                 eval $file=`basename $temp`
14468         done
14469         ;;
14470 esac
14471
14472 : create config.sh file
14473 echo " "
14474 echo "Creating config.sh..." >&4
14475 $spitshell <<EOT >config.sh
14476 $startsh
14477 #
14478 # This file was produced by running the Configure script. It holds all the
14479 # definitions figured out by Configure. Should you modify one of these values,
14480 # do not forget to propagate your changes by running "Configure -der". You may
14481 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14482 #
14483
14484 # Package name      : $package
14485 # Source directory  : $src
14486 # Configuration time: $cf_time
14487 # Configured by     : $cf_by
14488 # Target system     : $myuname
14489
14490 Author='$Author'
14491 Date='$Date'
14492 Header='$Header'
14493 Id='$Id'
14494 Locker='$Locker'
14495 Log='$Log'
14496 Mcc='$Mcc'
14497 RCSfile='$RCSfile'
14498 Revision='$Revision'
14499 Source='$Source'
14500 State='$State'
14501 _a='$_a'
14502 _exe='$_exe'
14503 _o='$_o'
14504 afs='$afs'
14505 alignbytes='$alignbytes'
14506 ansi2knr='$ansi2knr'
14507 aphostname='$aphostname'
14508 api_revision='$api_revision'
14509 api_subversion='$api_subversion'
14510 api_version='$api_version'
14511 api_versionstring='$api_versionstring'
14512 ar='$ar'
14513 archlib='$archlib'
14514 archlibexp='$archlibexp'
14515 archname64='$archname64'
14516 archname='$archname'
14517 archobjs='$archobjs'
14518 awk='$awk'
14519 baserev='$baserev'
14520 bash='$bash'
14521 bin='$bin'
14522 bincompat5005='$bincompat5005'
14523 binexp='$binexp'
14524 bison='$bison'
14525 byacc='$byacc'
14526 byteorder='$byteorder'
14527 c='$c'
14528 castflags='$castflags'
14529 cat='$cat'
14530 cc='$cc'
14531 cccdlflags='$cccdlflags'
14532 ccdlflags='$ccdlflags'
14533 ccflags='$ccflags'
14534 ccsymbols='$ccsymbols'
14535 cf_by='$cf_by'
14536 cf_email='$cf_email'
14537 cf_time='$cf_time'
14538 charsize='$charsize'
14539 chgrp='$chgrp'
14540 chmod='$chmod'
14541 chown='$chown'
14542 clocktype='$clocktype'
14543 comm='$comm'
14544 compress='$compress'
14545 contains='$contains'
14546 cp='$cp'
14547 cpio='$cpio'
14548 cpp='$cpp'
14549 cpp_stuff='$cpp_stuff'
14550 cppccsymbols='$cppccsymbols'
14551 cppflags='$cppflags'
14552 cpplast='$cpplast'
14553 cppminus='$cppminus'
14554 cpprun='$cpprun'
14555 cppstdin='$cppstdin'
14556 cppsymbols='$cppsymbols'
14557 crosscompile='$crosscompile'
14558 cryptlib='$cryptlib'
14559 csh='$csh'
14560 d_Gconvert='$d_Gconvert'
14561 d_PRIEldbl='$d_PRIEldbl'
14562 d_PRIFldbl='$d_PRIFldbl'
14563 d_PRIGldbl='$d_PRIGldbl'
14564 d_PRIX64='$d_PRIX64'
14565 d_PRId64='$d_PRId64'
14566 d_PRIeldbl='$d_PRIeldbl'
14567 d_PRIfldbl='$d_PRIfldbl'
14568 d_PRIgldbl='$d_PRIgldbl'
14569 d_PRIi64='$d_PRIi64'
14570 d_PRIo64='$d_PRIo64'
14571 d_PRIu64='$d_PRIu64'
14572 d_PRIx64='$d_PRIx64'
14573 d_access='$d_access'
14574 d_accessx='$d_accessx'
14575 d_alarm='$d_alarm'
14576 d_archlib='$d_archlib'
14577 d_atolf='$d_atolf'
14578 d_atoll='$d_atoll'
14579 d_attribut='$d_attribut'
14580 d_bcmp='$d_bcmp'
14581 d_bcopy='$d_bcopy'
14582 d_bincompat5005='$d_bincompat5005'
14583 d_bsd='$d_bsd'
14584 d_bsdgetpgrp='$d_bsdgetpgrp'
14585 d_bsdsetpgrp='$d_bsdsetpgrp'
14586 d_bzero='$d_bzero'
14587 d_casti32='$d_casti32'
14588 d_castneg='$d_castneg'
14589 d_charvspr='$d_charvspr'
14590 d_chown='$d_chown'
14591 d_chroot='$d_chroot'
14592 d_chsize='$d_chsize'
14593 d_closedir='$d_closedir'
14594 d_const='$d_const'
14595 d_crypt='$d_crypt'
14596 d_csh='$d_csh'
14597 d_cuserid='$d_cuserid'
14598 d_dbl_dig='$d_dbl_dig'
14599 d_difftime='$d_difftime'
14600 d_dirnamlen='$d_dirnamlen'
14601 d_dlerror='$d_dlerror'
14602 d_dlopen='$d_dlopen'
14603 d_dlsymun='$d_dlsymun'
14604 d_dosuid='$d_dosuid'
14605 d_drand48proto='$d_drand48proto'
14606 d_dup2='$d_dup2'
14607 d_eaccess='$d_eaccess'
14608 d_endgrent='$d_endgrent'
14609 d_endhent='$d_endhent'
14610 d_endnent='$d_endnent'
14611 d_endpent='$d_endpent'
14612 d_endpwent='$d_endpwent'
14613 d_endsent='$d_endsent'
14614 d_endspent='$d_endspent'
14615 d_eofnblk='$d_eofnblk'
14616 d_eunice='$d_eunice'
14617 d_fchmod='$d_fchmod'
14618 d_fchown='$d_fchown'
14619 d_fcntl='$d_fcntl'
14620 d_fd_macros='$d_fd_macros'
14621 d_fd_set='$d_fd_set'
14622 d_fds_bits='$d_fds_bits'
14623 d_fgetpos='$d_fgetpos'
14624 d_flexfnam='$d_flexfnam'
14625 d_flock='$d_flock'
14626 d_fork='$d_fork'
14627 d_fpathconf='$d_fpathconf'
14628 d_fpos64_t='$d_fpos64_t'
14629 d_fs_data_s='$d_fs_data_s'
14630 d_fseeko='$d_fseeko'
14631 d_fsetpos='$d_fsetpos'
14632 d_fstatfs='$d_fstatfs'
14633 d_fstatvfs='$d_fstatvfs'
14634 d_ftello='$d_ftello'
14635 d_ftime='$d_ftime'
14636 d_getgrent='$d_getgrent'
14637 d_getgrps='$d_getgrps'
14638 d_gethbyaddr='$d_gethbyaddr'
14639 d_gethbyname='$d_gethbyname'
14640 d_gethent='$d_gethent'
14641 d_gethname='$d_gethname'
14642 d_gethostprotos='$d_gethostprotos'
14643 d_getlogin='$d_getlogin'
14644 d_getmnt='$d_getmnt'
14645 d_getmntent='$d_getmntent'
14646 d_getnbyaddr='$d_getnbyaddr'
14647 d_getnbyname='$d_getnbyname'
14648 d_getnent='$d_getnent'
14649 d_getnetprotos='$d_getnetprotos'
14650 d_getpbyname='$d_getpbyname'
14651 d_getpbynumber='$d_getpbynumber'
14652 d_getpent='$d_getpent'
14653 d_getpgid='$d_getpgid'
14654 d_getpgrp2='$d_getpgrp2'
14655 d_getpgrp='$d_getpgrp'
14656 d_getppid='$d_getppid'
14657 d_getprior='$d_getprior'
14658 d_getprotoprotos='$d_getprotoprotos'
14659 d_getpwent='$d_getpwent'
14660 d_getsbyname='$d_getsbyname'
14661 d_getsbyport='$d_getsbyport'
14662 d_getsent='$d_getsent'
14663 d_getservprotos='$d_getservprotos'
14664 d_getspent='$d_getspent'
14665 d_getspnam='$d_getspnam'
14666 d_gettimeod='$d_gettimeod'
14667 d_gnulibc='$d_gnulibc'
14668 d_grpasswd='$d_grpasswd'
14669 d_hasmntopt='$d_hasmntopt'
14670 d_htonl='$d_htonl'
14671 d_iconv='$d_iconv'
14672 d_index='$d_index'
14673 d_inetaton='$d_inetaton'
14674 d_int64t='$d_int64t'
14675 d_isascii='$d_isascii'
14676 d_killpg='$d_killpg'
14677 d_lchown='$d_lchown'
14678 d_ldbl_dig='$d_ldbl_dig'
14679 d_link='$d_link'
14680 d_locconv='$d_locconv'
14681 d_lockf='$d_lockf'
14682 d_longdbl='$d_longdbl'
14683 d_longlong='$d_longlong'
14684 d_lstat='$d_lstat'
14685 d_mblen='$d_mblen'
14686 d_mbstowcs='$d_mbstowcs'
14687 d_mbtowc='$d_mbtowc'
14688 d_memchr='$d_memchr'
14689 d_memcmp='$d_memcmp'
14690 d_memcpy='$d_memcpy'
14691 d_memmove='$d_memmove'
14692 d_memset='$d_memset'
14693 d_mkdir='$d_mkdir'
14694 d_mkdtemp='$d_mkdtemp'
14695 d_mkfifo='$d_mkfifo'
14696 d_mkstemp='$d_mkstemp'
14697 d_mkstemps='$d_mkstemps'
14698 d_mktime='$d_mktime'
14699 d_mmap='$d_mmap'
14700 d_mprotect='$d_mprotect'
14701 d_msg='$d_msg'
14702 d_msg_ctrunc='$d_msg_ctrunc'
14703 d_msg_dontroute='$d_msg_dontroute'
14704 d_msg_oob='$d_msg_oob'
14705 d_msg_peek='$d_msg_peek'
14706 d_msg_proxy='$d_msg_proxy'
14707 d_msgctl='$d_msgctl'
14708 d_msgget='$d_msgget'
14709 d_msgrcv='$d_msgrcv'
14710 d_msgsnd='$d_msgsnd'
14711 d_msync='$d_msync'
14712 d_munmap='$d_munmap'
14713 d_mymalloc='$d_mymalloc'
14714 d_nice='$d_nice'
14715 d_nv_preserves_uv='$d_nv_preserves_uv'
14716 d_off64_t='$d_off64_t'
14717 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14718 d_oldpthreads='$d_oldpthreads'
14719 d_oldsock='$d_oldsock'
14720 d_open3='$d_open3'
14721 d_pathconf='$d_pathconf'
14722 d_pause='$d_pause'
14723 d_phostname='$d_phostname'
14724 d_pipe='$d_pipe'
14725 d_poll='$d_poll'
14726 d_portable='$d_portable'
14727 d_pthread_yield='$d_pthread_yield'
14728 d_pwage='$d_pwage'
14729 d_pwchange='$d_pwchange'
14730 d_pwclass='$d_pwclass'
14731 d_pwcomment='$d_pwcomment'
14732 d_pwexpire='$d_pwexpire'
14733 d_pwgecos='$d_pwgecos'
14734 d_pwpasswd='$d_pwpasswd'
14735 d_pwquota='$d_pwquota'
14736 d_quad='$d_quad'
14737 d_readdir='$d_readdir'
14738 d_readlink='$d_readlink'
14739 d_rename='$d_rename'
14740 d_rewinddir='$d_rewinddir'
14741 d_rmdir='$d_rmdir'
14742 d_safebcpy='$d_safebcpy'
14743 d_safemcpy='$d_safemcpy'
14744 d_sanemcmp='$d_sanemcmp'
14745 d_sched_yield='$d_sched_yield'
14746 d_scm_rights='$d_scm_rights'
14747 d_seekdir='$d_seekdir'
14748 d_select='$d_select'
14749 d_sem='$d_sem'
14750 d_semctl='$d_semctl'
14751 d_semctl_semid_ds='$d_semctl_semid_ds'
14752 d_semctl_semun='$d_semctl_semun'
14753 d_semget='$d_semget'
14754 d_semop='$d_semop'
14755 d_setegid='$d_setegid'
14756 d_seteuid='$d_seteuid'
14757 d_setgrent='$d_setgrent'
14758 d_setgrps='$d_setgrps'
14759 d_sethent='$d_sethent'
14760 d_setlinebuf='$d_setlinebuf'
14761 d_setlocale='$d_setlocale'
14762 d_setnent='$d_setnent'
14763 d_setpent='$d_setpent'
14764 d_setpgid='$d_setpgid'
14765 d_setpgrp2='$d_setpgrp2'
14766 d_setpgrp='$d_setpgrp'
14767 d_setprior='$d_setprior'
14768 d_setpwent='$d_setpwent'
14769 d_setregid='$d_setregid'
14770 d_setresgid='$d_setresgid'
14771 d_setresuid='$d_setresuid'
14772 d_setreuid='$d_setreuid'
14773 d_setrgid='$d_setrgid'
14774 d_setruid='$d_setruid'
14775 d_setsent='$d_setsent'
14776 d_setsid='$d_setsid'
14777 d_setspent='$d_setspent'
14778 d_setvbuf='$d_setvbuf'
14779 d_sfio='$d_sfio'
14780 d_shm='$d_shm'
14781 d_shmat='$d_shmat'
14782 d_shmatprototype='$d_shmatprototype'
14783 d_shmctl='$d_shmctl'
14784 d_shmdt='$d_shmdt'
14785 d_shmget='$d_shmget'
14786 d_sigaction='$d_sigaction'
14787 d_sigsetjmp='$d_sigsetjmp'
14788 d_socket='$d_socket'
14789 d_sockpair='$d_sockpair'
14790 d_sqrtl='$d_sqrtl'
14791 d_statblks='$d_statblks'
14792 d_statfs_f_flags='$d_statfs_f_flags'
14793 d_statfs_s='$d_statfs_s'
14794 d_statvfs='$d_statvfs'
14795 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14796 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14797 d_stdio_stream_array='$d_stdio_stream_array'
14798 d_stdiobase='$d_stdiobase'
14799 d_stdstdio='$d_stdstdio'
14800 d_strchr='$d_strchr'
14801 d_strcoll='$d_strcoll'
14802 d_strctcpy='$d_strctcpy'
14803 d_strerrm='$d_strerrm'
14804 d_strerror='$d_strerror'
14805 d_strtod='$d_strtod'
14806 d_strtol='$d_strtol'
14807 d_strtold='$d_strtold'
14808 d_strtoll='$d_strtoll'
14809 d_strtoul='$d_strtoul'
14810 d_strtoull='$d_strtoull'
14811 d_strtouq='$d_strtouq'
14812 d_strxfrm='$d_strxfrm'
14813 d_suidsafe='$d_suidsafe'
14814 d_symlink='$d_symlink'
14815 d_syscall='$d_syscall'
14816 d_sysconf='$d_sysconf'
14817 d_sysernlst='$d_sysernlst'
14818 d_syserrlst='$d_syserrlst'
14819 d_system='$d_system'
14820 d_tcgetpgrp='$d_tcgetpgrp'
14821 d_tcsetpgrp='$d_tcsetpgrp'
14822 d_telldir='$d_telldir'
14823 d_telldirproto='$d_telldirproto'
14824 d_time='$d_time'
14825 d_times='$d_times'
14826 d_truncate='$d_truncate'
14827 d_tzname='$d_tzname'
14828 d_umask='$d_umask'
14829 d_uname='$d_uname'
14830 d_union_semun='$d_union_semun'
14831 d_ustat='$d_ustat'
14832 d_vendorbin='$d_vendorbin'
14833 d_vendorlib='$d_vendorlib'
14834 d_vfork='$d_vfork'
14835 d_void_closedir='$d_void_closedir'
14836 d_voidsig='$d_voidsig'
14837 d_voidtty='$d_voidtty'
14838 d_volatile='$d_volatile'
14839 d_vprintf='$d_vprintf'
14840 d_wait4='$d_wait4'
14841 d_waitpid='$d_waitpid'
14842 d_wcstombs='$d_wcstombs'
14843 d_wctomb='$d_wctomb'
14844 d_xenix='$d_xenix'
14845 date='$date'
14846 db_hashtype='$db_hashtype'
14847 db_prefixtype='$db_prefixtype'
14848 defvoidused='$defvoidused'
14849 direntrytype='$direntrytype'
14850 dlext='$dlext'
14851 dlsrc='$dlsrc'
14852 doublesize='$doublesize'
14853 drand01='$drand01'
14854 dynamic_ext='$dynamic_ext'
14855 eagain='$eagain'
14856 ebcdic='$ebcdic'
14857 echo='$echo'
14858 egrep='$egrep'
14859 emacs='$emacs'
14860 eunicefix='$eunicefix'
14861 exe_ext='$exe_ext'
14862 expr='$expr'
14863 extensions='$extensions'
14864 fflushNULL='$fflushNULL'
14865 fflushall='$fflushall'
14866 find='$find'
14867 firstmakefile='$firstmakefile'
14868 flex='$flex'
14869 fpossize='$fpossize'
14870 fpostype='$fpostype'
14871 freetype='$freetype'
14872 full_ar='$full_ar'
14873 full_csh='$full_csh'
14874 full_sed='$full_sed'
14875 gccversion='$gccversion'
14876 gidformat='$gidformat'
14877 gidsign='$gidsign'
14878 gidsize='$gidsize'
14879 gidtype='$gidtype'
14880 glibpth='$glibpth'
14881 grep='$grep'
14882 groupcat='$groupcat'
14883 groupstype='$groupstype'
14884 gzip='$gzip'
14885 h_fcntl='$h_fcntl'
14886 h_sysfile='$h_sysfile'
14887 hint='$hint'
14888 hostcat='$hostcat'
14889 huge='$huge'
14890 i16size='$i16size'
14891 i16type='$i16type'
14892 i32size='$i32size'
14893 i32type='$i32type'
14894 i64size='$i64size'
14895 i64type='$i64type'
14896 i8size='$i8size'
14897 i8type='$i8type'
14898 i_arpainet='$i_arpainet'
14899 i_bsdioctl='$i_bsdioctl'
14900 i_db='$i_db'
14901 i_dbm='$i_dbm'
14902 i_dirent='$i_dirent'
14903 i_dld='$i_dld'
14904 i_dlfcn='$i_dlfcn'
14905 i_fcntl='$i_fcntl'
14906 i_float='$i_float'
14907 i_gdbm='$i_gdbm'
14908 i_grp='$i_grp'
14909 i_iconv='$i_iconv'
14910 i_inttypes='$i_inttypes'
14911 i_limits='$i_limits'
14912 i_locale='$i_locale'
14913 i_machcthr='$i_machcthr'
14914 i_malloc='$i_malloc'
14915 i_math='$i_math'
14916 i_memory='$i_memory'
14917 i_mntent='$i_mntent'
14918 i_ndbm='$i_ndbm'
14919 i_netdb='$i_netdb'
14920 i_neterrno='$i_neterrno'
14921 i_netinettcp='$i_netinettcp'
14922 i_niin='$i_niin'
14923 i_poll='$i_poll'
14924 i_pthread='$i_pthread'
14925 i_pwd='$i_pwd'
14926 i_rpcsvcdbm='$i_rpcsvcdbm'
14927 i_sfio='$i_sfio'
14928 i_sgtty='$i_sgtty'
14929 i_shadow='$i_shadow'
14930 i_socks='$i_socks'
14931 i_stdarg='$i_stdarg'
14932 i_stddef='$i_stddef'
14933 i_stdlib='$i_stdlib'
14934 i_string='$i_string'
14935 i_sysaccess='$i_sysaccess'
14936 i_sysdir='$i_sysdir'
14937 i_sysfile='$i_sysfile'
14938 i_sysfilio='$i_sysfilio'
14939 i_sysin='$i_sysin'
14940 i_sysioctl='$i_sysioctl'
14941 i_sysmman='$i_sysmman'
14942 i_sysmount='$i_sysmount'
14943 i_sysndir='$i_sysndir'
14944 i_sysparam='$i_sysparam'
14945 i_sysresrc='$i_sysresrc'
14946 i_syssecrt='$i_syssecrt'
14947 i_sysselct='$i_sysselct'
14948 i_syssockio='$i_syssockio'
14949 i_sysstat='$i_sysstat'
14950 i_sysstatfs='$i_sysstatfs'
14951 i_sysstatvfs='$i_sysstatvfs'
14952 i_systime='$i_systime'
14953 i_systimek='$i_systimek'
14954 i_systimes='$i_systimes'
14955 i_systypes='$i_systypes'
14956 i_sysuio='$i_sysuio'
14957 i_sysun='$i_sysun'
14958 i_sysvfs='$i_sysvfs'
14959 i_syswait='$i_syswait'
14960 i_termio='$i_termio'
14961 i_termios='$i_termios'
14962 i_time='$i_time'
14963 i_unistd='$i_unistd'
14964 i_ustat='$i_ustat'
14965 i_utime='$i_utime'
14966 i_values='$i_values'
14967 i_varargs='$i_varargs'
14968 i_varhdr='$i_varhdr'
14969 i_vfork='$i_vfork'
14970 ignore_versioned_solibs='$ignore_versioned_solibs'
14971 inc_version_list='$inc_version_list'
14972 inc_version_list_init='$inc_version_list_init'
14973 incpath='$incpath'
14974 inews='$inews'
14975 installarchlib='$installarchlib'
14976 installbin='$installbin'
14977 installman1dir='$installman1dir'
14978 installman3dir='$installman3dir'
14979 installprefix='$installprefix'
14980 installprefixexp='$installprefixexp'
14981 installprivlib='$installprivlib'
14982 installscript='$installscript'
14983 installsitearch='$installsitearch'
14984 installsitebin='$installsitebin'
14985 installsitelib='$installsitelib'
14986 installstyle='$installstyle'
14987 installusrbinperl='$installusrbinperl'
14988 installvendorbin='$installvendorbin'
14989 installvendorlib='$installvendorlib'
14990 intsize='$intsize'
14991 ivdformat='$ivdformat'
14992 ivsize='$ivsize'
14993 ivtype='$ivtype'
14994 known_extensions='$known_extensions'
14995 ksh='$ksh'
14996 large='$large'
14997 ld='$ld'
14998 lddlflags='$lddlflags'
14999 ldflags='$ldflags'
15000 ldlibpthname='$ldlibpthname'
15001 less='$less'
15002 lib_ext='$lib_ext'
15003 libc='$libc'
15004 libperl='$libperl'
15005 libpth='$libpth'
15006 libs='$libs'
15007 libsdirs='$libsdirs'
15008 libsfiles='$libsfiles'
15009 libsfound='$libsfound'
15010 libswanted='$libswanted'
15011 line='$line'
15012 lint='$lint'
15013 lkflags='$lkflags'
15014 ln='$ln'
15015 lns='$lns'
15016 locincpth='$locincpth'
15017 loclibpth='$loclibpth'
15018 longdblsize='$longdblsize'
15019 longlongsize='$longlongsize'
15020 longsize='$longsize'
15021 lp='$lp'
15022 lpr='$lpr'
15023 ls='$ls'
15024 lseeksize='$lseeksize'
15025 lseektype='$lseektype'
15026 mail='$mail'
15027 mailx='$mailx'
15028 make='$make'
15029 make_set_make='$make_set_make'
15030 mallocobj='$mallocobj'
15031 mallocsrc='$mallocsrc'
15032 malloctype='$malloctype'
15033 man1dir='$man1dir'
15034 man1direxp='$man1direxp'
15035 man1ext='$man1ext'
15036 man3dir='$man3dir'
15037 man3direxp='$man3direxp'
15038 man3ext='$man3ext'
15039 medium='$medium'
15040 mips_type='$mips_type'
15041 mkdir='$mkdir'
15042 mmaptype='$mmaptype'
15043 models='$models'
15044 modetype='$modetype'
15045 more='$more'
15046 multiarch='$multiarch'
15047 mv='$mv'
15048 myarchname='$myarchname'
15049 mydomain='$mydomain'
15050 myhostname='$myhostname'
15051 myuname='$myuname'
15052 n='$n'
15053 netdb_hlen_type='$netdb_hlen_type'
15054 netdb_host_type='$netdb_host_type'
15055 netdb_name_type='$netdb_name_type'
15056 netdb_net_type='$netdb_net_type'
15057 nm='$nm'
15058 nm_opt='$nm_opt'
15059 nm_so_opt='$nm_so_opt'
15060 nonxs_ext='$nonxs_ext'
15061 nroff='$nroff'
15062 nvsize='$nvsize'
15063 nvtype='$nvtype'
15064 o_nonblock='$o_nonblock'
15065 obj_ext='$obj_ext'
15066 old_pthread_create_joinable='$old_pthread_create_joinable'
15067 optimize='$optimize'
15068 orderlib='$orderlib'
15069 osname='$osname'
15070 osvers='$osvers'
15071 package='$package'
15072 pager='$pager'
15073 passcat='$passcat'
15074 patchlevel='$patchlevel'
15075 path_sep='$path_sep'
15076 perl='$perl'
15077 perladmin='$perladmin'
15078 perlpath='$perlpath'
15079 pg='$pg'
15080 phostname='$phostname'
15081 pidtype='$pidtype'
15082 plibpth='$plibpth'
15083 pm_apiversion='$pm_apiversion'
15084 pmake='$pmake'
15085 pr='$pr'
15086 prefix='$prefix'
15087 prefixexp='$prefixexp'
15088 privlib='$privlib'
15089 privlibexp='$privlibexp'
15090 prototype='$prototype'
15091 ptrsize='$ptrsize'
15092 quadkind='$quadkind'
15093 quadtype='$quadtype'
15094 randbits='$randbits'
15095 randfunc='$randfunc'
15096 randseedtype='$randseedtype'
15097 ranlib='$ranlib'
15098 rd_nodata='$rd_nodata'
15099 rm='$rm'
15100 rmail='$rmail'
15101 runnm='$runnm'
15102 sPRIEldbl='$sPRIEldbl'
15103 sPRIFldbl='$sPRIFldbl'
15104 sPRIGldbl='$sPRIGldbl'
15105 sPRIX64='$sPRIX64'
15106 sPRId64='$sPRId64'
15107 sPRIeldbl='$sPRIeldbl'
15108 sPRIfldbl='$sPRIfldbl'
15109 sPRIgldbl='$sPRIgldbl'
15110 sPRIi64='$sPRIi64'
15111 sPRIo64='$sPRIo64'
15112 sPRIu64='$sPRIu64'
15113 sPRIx64='$sPRIx64'
15114 sched_yield='$sched_yield'
15115 scriptdir='$scriptdir'
15116 scriptdirexp='$scriptdirexp'
15117 sed='$sed'
15118 seedfunc='$seedfunc'
15119 selectminbits='$selectminbits'
15120 selecttype='$selecttype'
15121 sendmail='$sendmail'
15122 sh='$sh'
15123 shar='$shar'
15124 sharpbang='$sharpbang'
15125 shmattype='$shmattype'
15126 shortsize='$shortsize'
15127 shrpenv='$shrpenv'
15128 shsharp='$shsharp'
15129 sig_count='$sig_count'
15130 sig_name='$sig_name'
15131 sig_name_init='$sig_name_init'
15132 sig_num='$sig_num'
15133 sig_num_init='$sig_num_init'
15134 signal_t='$signal_t'
15135 sitearch='$sitearch'
15136 sitearchexp='$sitearchexp'
15137 sitebin='$sitebin'
15138 sitebinexp='$sitebinexp'
15139 sitelib='$sitelib'
15140 sitelibexp='$sitelibexp'
15141 siteprefix='$siteprefix'
15142 siteprefixexp='$siteprefixexp'
15143 sizetype='$sizetype'
15144 sleep='$sleep'
15145 smail='$smail'
15146 small='$small'
15147 so='$so'
15148 sockethdr='$sockethdr'
15149 socketlib='$socketlib'
15150 sort='$sort'
15151 spackage='$spackage'
15152 spitshell='$spitshell'
15153 split='$split'
15154 src='$src'
15155 ssizetype='$ssizetype'
15156 startperl='$startperl'
15157 startsh='$startsh'
15158 static_ext='$static_ext'
15159 stdchar='$stdchar'
15160 stdio_base='$stdio_base'
15161 stdio_bufsiz='$stdio_bufsiz'
15162 stdio_cnt='$stdio_cnt'
15163 stdio_filbuf='$stdio_filbuf'
15164 stdio_ptr='$stdio_ptr'
15165 stdio_stream_array='$stdio_stream_array'
15166 strings='$strings'
15167 submit='$submit'
15168 subversion='$subversion'
15169 sysman='$sysman'
15170 tail='$tail'
15171 tar='$tar'
15172 tbl='$tbl'
15173 tee='$tee'
15174 test='$test'
15175 timeincl='$timeincl'
15176 timetype='$timetype'
15177 touch='$touch'
15178 tr='$tr'
15179 trnl='$trnl'
15180 troff='$troff'
15181 u16size='$u16size'
15182 u16type='$u16type'
15183 u32size='$u32size'
15184 u32type='$u32type'
15185 u64size='$u64size'
15186 u64type='$u64type'
15187 u8size='$u8size'
15188 u8type='$u8type'
15189 uidformat='$uidformat'
15190 uidsign='$uidsign'
15191 uidsize='$uidsize'
15192 uidtype='$uidtype'
15193 uname='$uname'
15194 uniq='$uniq'
15195 uquadtype='$uquadtype'
15196 use5005threads='$use5005threads'
15197 use64bits='$use64bits'
15198 usedl='$usedl'
15199 useithreads='$useithreads'
15200 uselargefiles='$uselargefiles'
15201 uselongdouble='$uselongdouble'
15202 uselonglong='$uselonglong'
15203 usemorebits='$usemorebits'
15204 usemultiplicity='$usemultiplicity'
15205 usemymalloc='$usemymalloc'
15206 usenm='$usenm'
15207 useopcode='$useopcode'
15208 useperlio='$useperlio'
15209 useposix='$useposix'
15210 usesfio='$usesfio'
15211 useshrplib='$useshrplib'
15212 usesocks='$usesocks'
15213 usethreads='$usethreads'
15214 usevendorprefix='$usevendorprefix'
15215 usevfork='$usevfork'
15216 usrinc='$usrinc'
15217 uuname='$uuname'
15218 uvoformat='$uvoformat'
15219 uvsize='$uvsize'
15220 uvtype='$uvtype'
15221 uvuformat='$uvuformat'
15222 uvxformat='$uvxformat'
15223 vendorbin='$vendorbin'
15224 vendorbinexp='$vendorbinexp'
15225 vendorlib='$vendorlib'
15226 vendorlibexp='$vendorlibexp'
15227 vendorprefix='$vendorprefix'
15228 vendorprefixexp='$vendorprefixexp'
15229 version='$version'
15230 vi='$vi'
15231 voidflags='$voidflags'
15232 xlibpth='$xlibpth'
15233 xs_apiversion='$xs_apiversion'
15234 zcat='$zcat'
15235 zip='$zip'
15236 EOT
15237
15238 : Add in command line options if available
15239 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15240
15241 : add special variables
15242 $test -f $src/patchlevel.h && \
15243 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15244 echo "CONFIGDOTSH=true" >>config.sh
15245
15246 : propagate old symbols
15247 if $test -f UU/config.sh; then
15248         <UU/config.sh sort | uniq >UU/oldconfig.sh
15249         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15250         sort | uniq -u >UU/oldsyms
15251         set X `cat UU/oldsyms`
15252         shift
15253         case $# in
15254         0) ;;
15255         *)
15256                 cat <<EOM
15257 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15258 EOM
15259                 echo "# Variables propagated from previous config.sh file." >>config.sh
15260                 for sym in `cat UU/oldsyms`; do
15261                         echo "    Propagating $hint variable "'$'"$sym..."
15262                         eval 'tmp="$'"${sym}"'"'
15263                         echo "$tmp" | \
15264                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15265                 done
15266                 ;;
15267         esac
15268 fi
15269
15270 : Finish up by extracting the .SH files
15271 case "$alldone" in
15272 exit)
15273         $rm -rf UU
15274         echo "Done."
15275         exit 0
15276         ;;
15277 cont)
15278         ;;
15279 '')
15280         dflt=''
15281         nostick=true
15282         $cat <<EOM
15283
15284 If you'd like to make any changes to the config.sh file before I begin
15285 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15286
15287 EOM
15288         rp="Press return or use a shell escape to edit config.sh:"
15289         . UU/myread
15290         nostick=''
15291         case "$ans" in
15292         '') ;;
15293         *) : in case they cannot read
15294                 sh 1>&4 -c "$ans";;
15295         esac
15296         ;;
15297 esac
15298
15299 : if this fails, just run all the .SH files by hand
15300 . ./config.sh
15301
15302 echo " "
15303 exec 1>&4
15304 . ./UU/extract
15305
15306 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15307         dflt=y
15308         case "$silent" in
15309         true) ;;
15310         *)
15311                 $cat <<EOM
15312
15313 Now you need to generate make dependencies by running "$make depend".
15314 You might prefer to run it in background: "$make depend > makedepend.out &"
15315 It can take a while, so you might not want to run it right now.
15316
15317 EOM
15318                 ;;
15319         esac
15320         rp="Run $make depend now?"
15321         . UU/myread
15322         case "$ans" in
15323         y*)
15324                 $make depend && echo "Now you must run a $make."
15325                 ;;
15326         *)
15327                 echo "You must run '$make depend' then '$make'."
15328                 ;;
15329         esac
15330 elif test -f [Mm]akefile; then
15331         echo " "
15332         echo "Now you must run a $make."
15333 else
15334         echo "Done."
15335 fi
15336
15337 if $test -f Policy.sh; then
15338     $cat <<EOM
15339
15340 If you compile $package on a different machine or from a different object
15341 directory, copy the Policy.sh file from this object directory to the
15342 new one before you run Configure -- this will help you with most of
15343 the policy defaults.
15344
15345 EOM
15346 fi
15347 if $test -f config.msg; then
15348     echo "Hmm.  I also noted the following information while running:"
15349     echo " "
15350     $cat config.msg >&4
15351     $rm -f config.msg
15352 fi
15353 $rm -f kit*isdone ark*isdone
15354 $rm -rf UU
15355
15356 : End of Configure
15357