OS/2 gcc doesn't like -o foo.exe and -Zexe simultaneously
[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 05:56:14 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_getcwd=''
366 d_getgrent=''
367 d_getgrps=''
368 d_gethbyaddr=''
369 d_gethbyname=''
370 d_gethent=''
371 aphostname=''
372 d_gethname=''
373 d_phostname=''
374 d_uname=''
375 d_gethostprotos=''
376 d_getlogin=''
377 d_getmnt=''
378 d_getmntent=''
379 d_getnbyaddr=''
380 d_getnbyname=''
381 d_getnent=''
382 d_getnetprotos=''
383 d_getpent=''
384 d_getpgid=''
385 d_getpgrp2=''
386 d_bsdgetpgrp=''
387 d_getpgrp=''
388 d_getppid=''
389 d_getprior=''
390 d_getpbyname=''
391 d_getpbynumber=''
392 d_getprotoprotos=''
393 d_getpwent=''
394 d_getsent=''
395 d_getservprotos=''
396 d_getspent=''
397 d_getspnam=''
398 d_getsbyname=''
399 d_getsbyport=''
400 d_gnulibc=''
401 d_hasmntopt=''
402 d_htonl=''
403 d_iconv=''
404 d_inetaton=''
405 d_int64t=''
406 d_isascii=''
407 d_killpg=''
408 d_lchown=''
409 d_ldbl_dig=''
410 d_link=''
411 d_locconv=''
412 d_lockf=''
413 d_longdbl=''
414 longdblsize=''
415 d_longlong=''
416 longlongsize=''
417 d_lstat=''
418 d_mblen=''
419 d_mbstowcs=''
420 d_mbtowc=''
421 d_memchr=''
422 d_memcmp=''
423 d_memcpy=''
424 d_memmove=''
425 d_memset=''
426 d_mkdir=''
427 d_mkdtemp=''
428 d_mkfifo=''
429 d_mkstemp=''
430 d_mkstemps=''
431 d_mktime=''
432 d_mmap=''
433 mmaptype=''
434 d_mprotect=''
435 d_msg=''
436 d_msgctl=''
437 d_msgget=''
438 d_msgrcv=''
439 d_msgsnd=''
440 d_msync=''
441 d_munmap=''
442 d_nice=''
443 d_open3=''
444 d_fpathconf=''
445 d_pathconf=''
446 d_pause=''
447 d_pipe=''
448 d_poll=''
449 d_portable=''
450 d_old_pthread_create_joinable=''
451 old_pthread_create_joinable=''
452 d_pthread_yield=''
453 d_sched_yield=''
454 sched_yield=''
455 d_readdir=''
456 d_rewinddir=''
457 d_seekdir=''
458 d_telldir=''
459 d_readlink=''
460 d_rename=''
461 d_rmdir=''
462 d_safebcpy=''
463 d_safemcpy=''
464 d_sanemcmp=''
465 d_select=''
466 d_sem=''
467 d_semctl=''
468 d_semget=''
469 d_semop=''
470 d_setegid=''
471 d_seteuid=''
472 d_setgrent=''
473 d_setgrps=''
474 d_sethent=''
475 d_setlinebuf=''
476 d_setlocale=''
477 d_setnent=''
478 d_setpent=''
479 d_setpgid=''
480 d_setpgrp2=''
481 d_bsdsetpgrp=''
482 d_setpgrp=''
483 d_setprior=''
484 d_setpwent=''
485 d_setregid=''
486 d_setresgid=''
487 d_setresuid=''
488 d_setreuid=''
489 d_setrgid=''
490 d_setruid=''
491 d_setsent=''
492 d_setsid=''
493 d_setspent=''
494 d_setvbuf=''
495 d_sfio=''
496 usesfio=''
497 d_shm=''
498 d_shmat=''
499 d_shmatprototype=''
500 shmattype=''
501 d_shmctl=''
502 d_shmdt=''
503 d_shmget=''
504 d_sigaction=''
505 d_sigsetjmp=''
506 d_msg_ctrunc=''
507 d_msg_dontroute=''
508 d_msg_oob=''
509 d_msg_peek=''
510 d_msg_proxy=''
511 d_oldsock=''
512 d_scm_rights=''
513 d_socket=''
514 d_sockpair=''
515 sockethdr=''
516 socketlib=''
517 d_sqrtl=''
518 d_statblks=''
519 d_statfs_f_flags=''
520 d_statfs_s=''
521 d_fstatvfs=''
522 d_statvfs=''
523 d_stdio_cnt_lval=''
524 d_stdio_ptr_lval=''
525 d_stdiobase=''
526 d_stdstdio=''
527 stdio_base=''
528 stdio_bufsiz=''
529 stdio_cnt=''
530 stdio_filbuf=''
531 stdio_ptr=''
532 d_index=''
533 d_strchr=''
534 d_strcoll=''
535 d_strctcpy=''
536 d_strerrm=''
537 d_strerror=''
538 d_sysernlst=''
539 d_syserrlst=''
540 d_strtod=''
541 d_strtol=''
542 d_strtold=''
543 d_strtoll=''
544 d_strtoul=''
545 d_strtoull=''
546 d_strtouq=''
547 d_strxfrm=''
548 d_symlink=''
549 d_syscall=''
550 d_sysconf=''
551 d_system=''
552 d_tcgetpgrp=''
553 d_tcsetpgrp=''
554 d_telldirproto=''
555 d_time=''
556 timetype=''
557 clocktype=''
558 d_times=''
559 d_truncate=''
560 d_tzname=''
561 d_umask=''
562 d_semctl_semid_ds=''
563 d_semctl_semun=''
564 d_union_semun=''
565 d_ustat=''
566 d_vfork=''
567 usevfork=''
568 d_voidsig=''
569 signal_t=''
570 d_volatile=''
571 d_charvspr=''
572 d_vprintf=''
573 d_wait4=''
574 d_waitpid=''
575 d_wcstombs=''
576 d_wctomb=''
577 dlext=''
578 cccdlflags=''
579 ccdlflags=''
580 dlsrc=''
581 ld=''
582 lddlflags=''
583 usedl=''
584 doublesize=''
585 ebcdic=''
586 fflushNULL=''
587 fflushall=''
588 fpossize=''
589 fpostype=''
590 gidformat=''
591 gidsign=''
592 gidsize=''
593 gidtype=''
594 groupstype=''
595 h_fcntl=''
596 h_sysfile=''
597 i_arpainet=''
598 db_hashtype=''
599 db_prefixtype=''
600 i_db=''
601 i_dbm=''
602 i_rpcsvcdbm=''
603 d_dirnamlen=''
604 direntrytype=''
605 i_dirent=''
606 i_dld=''
607 i_dlfcn=''
608 i_fcntl=''
609 i_float=''
610 i_gdbm=''
611 d_grpasswd=''
612 i_grp=''
613 i_iconv=''
614 i_inttypes=''
615 i_limits=''
616 i_locale=''
617 i_machcthr=''
618 i_malloc=''
619 i_math=''
620 i_memory=''
621 i_mntent=''
622 i_ndbm=''
623 i_netdb=''
624 i_neterrno=''
625 i_netinettcp=''
626 i_niin=''
627 i_sysin=''
628 i_poll=''
629 i_pthread=''
630 d_pwage=''
631 d_pwchange=''
632 d_pwclass=''
633 d_pwcomment=''
634 d_pwexpire=''
635 d_pwgecos=''
636 d_pwpasswd=''
637 d_pwquota=''
638 i_pwd=''
639 i_sfio=''
640 i_shadow=''
641 i_socks=''
642 i_stddef=''
643 i_stdlib=''
644 i_string=''
645 strings=''
646 i_sysaccess=''
647 i_sysdir=''
648 i_sysfile=''
649 d_voidtty=''
650 i_bsdioctl=''
651 i_sysfilio=''
652 i_sysioctl=''
653 i_syssockio=''
654 i_sysmman=''
655 i_sysmount=''
656 i_sysndir=''
657 i_sysparam=''
658 i_sysresrc=''
659 i_syssecrt=''
660 i_sysselct=''
661 i_sysstat=''
662 i_sysstatfs=''
663 i_sysstatvfs=''
664 i_systimes=''
665 i_systypes=''
666 i_sysuio=''
667 i_sysun=''
668 i_sysvfs=''
669 i_syswait=''
670 i_sgtty=''
671 i_termio=''
672 i_termios=''
673 i_systime=''
674 i_systimek=''
675 i_time=''
676 timeincl=''
677 i_unistd=''
678 i_ustat=''
679 i_utime=''
680 i_values=''
681 i_stdarg=''
682 i_varargs=''
683 i_varhdr=''
684 i_vfork=''
685 inc_version_list=''
686 inc_version_list_init=''
687 installprefix=''
688 installprefixexp=''
689 installstyle=''
690 installusrbinperl=''
691 intsize=''
692 longsize=''
693 shortsize=''
694 d_fpos64_t=''
695 d_off64_t=''
696 libc=''
697 ldlibpthname=''
698 libperl=''
699 shrpenv=''
700 useshrplib=''
701 glibpth=''
702 libpth=''
703 loclibpth=''
704 plibpth=''
705 xlibpth=''
706 ignore_versioned_solibs=''
707 libs=''
708 libsdirs=''
709 libsfiles=''
710 libsfound=''
711 lns=''
712 d_PRIEldbl=''
713 d_PRIFldbl=''
714 d_PRIGldbl=''
715 d_PRIeldbl=''
716 d_PRIfldbl=''
717 d_PRIgldbl=''
718 sPRIEldbl=''
719 sPRIFldbl=''
720 sPRIGldbl=''
721 sPRIeldbl=''
722 sPRIfldbl=''
723 sPRIgldbl=''
724 lseeksize=''
725 lseektype=''
726 make_set_make=''
727 d_mymalloc=''
728 freetype=''
729 mallocobj=''
730 mallocsrc=''
731 malloctype=''
732 usemymalloc=''
733 installman1dir=''
734 man1dir=''
735 man1direxp=''
736 man1ext=''
737 installman3dir=''
738 man3dir=''
739 man3direxp=''
740 man3ext=''
741 huge=''
742 large=''
743 medium=''
744 models=''
745 small=''
746 split=''
747 modetype=''
748 multiarch=''
749 mydomain=''
750 myhostname=''
751 phostname=''
752 c=''
753 n=''
754 d_eofnblk=''
755 eagain=''
756 o_nonblock=''
757 rd_nodata=''
758 netdb_hlen_type=''
759 netdb_host_type=''
760 netdb_name_type=''
761 netdb_net_type=''
762 groupcat=''
763 hostcat=''
764 passcat=''
765 orderlib=''
766 ranlib=''
767 package=''
768 spackage=''
769 pager=''
770 api_revision=''
771 api_subversion=''
772 api_version=''
773 api_versionstring=''
774 patchlevel=''
775 subversion=''
776 version=''
777 perladmin=''
778 perlpath=''
779 d_nv_preserves_uv=''
780 i16size=''
781 i16type=''
782 i32size=''
783 i32type=''
784 i64size=''
785 i64type=''
786 i8size=''
787 i8type=''
788 ivsize=''
789 ivtype=''
790 nvsize=''
791 nvtype=''
792 u16size=''
793 u16type=''
794 u32size=''
795 u32type=''
796 u64size=''
797 u64type=''
798 u8size=''
799 u8type=''
800 uvsize=''
801 uvtype=''
802 ivdformat=''
803 uvoformat=''
804 uvuformat=''
805 uvxformat=''
806 pidtype=''
807 prefix=''
808 prefixexp=''
809 installprivlib=''
810 privlib=''
811 privlibexp=''
812 prototype=''
813 ptrsize=''
814 d_PRIX64=''
815 d_PRId64=''
816 d_PRIi64=''
817 d_PRIo64=''
818 d_PRIu64=''
819 d_PRIx64=''
820 sPRIX64=''
821 sPRId64=''
822 sPRIi64=''
823 sPRIo64=''
824 sPRIu64=''
825 sPRIx64=''
826 d_quad=''
827 quadkind=''
828 quadtype=''
829 uquadtype=''
830 drand01=''
831 randbits=''
832 randfunc=''
833 randseedtype=''
834 seedfunc=''
835 installscript=''
836 scriptdir=''
837 scriptdirexp=''
838 selectminbits=''
839 selecttype=''
840 sh=''
841 sig_count=''
842 sig_name=''
843 sig_name_init=''
844 sig_num=''
845 sig_num_init=''
846 installsitearch=''
847 sitearch=''
848 sitearchexp=''
849 installsitebin=''
850 sitebin=''
851 sitebinexp=''
852 installsitelib=''
853 sitelib=''
854 sitelibexp=''
855 siteprefix=''
856 siteprefixexp=''
857 sizetype=''
858 so=''
859 sharpbang=''
860 shsharp=''
861 spitshell=''
862 src=''
863 ssizetype=''
864 startperl=''
865 startsh=''
866 stdchar=''
867 d_stdio_stream_array=''
868 stdio_stream_array=''
869 sysman=''
870 trnl=''
871 uidformat=''
872 uidsign=''
873 uidsize=''
874 uidtype=''
875 archname64=''
876 use64bits=''
877 uselargefiles=''
878 uselongdouble=''
879 uselonglong=''
880 usemorebits=''
881 usemultiplicity=''
882 nm_opt=''
883 nm_so_opt=''
884 runnm=''
885 usenm=''
886 useperlio=''
887 usesocks=''
888 d_oldpthreads=''
889 use5005threads=''
890 useithreads=''
891 usethreads=''
892 incpath=''
893 mips_type=''
894 usrinc=''
895 d_vendorbin=''
896 installvendorbin=''
897 vendorbin=''
898 vendorbinexp=''
899 d_vendorlib=''
900 installvendorlib=''
901 vendorlib=''
902 vendorlibexp=''
903 usevendorprefix=''
904 vendorprefix=''
905 vendorprefixexp=''
906 defvoidused=''
907 voidflags=''
908 pm_apiversion=''
909 xs_apiversion=''
910 CONFIG=''
911
912 define='define'
913 undef='undef'
914 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
915 rmlist=''
916
917 : We must find out about Eunice early
918 eunicefix=':'
919 if test -f /etc/unixtovms; then
920         eunicefix=/etc/unixtovms
921 fi
922 if test -f /etc/unixtovms.exe; then
923         eunicefix=/etc/unixtovms.exe
924 fi
925
926 i_whoami=''
927 : set useposix=false in your hint file to disable the POSIX extension.
928 useposix=true
929 : set useopcode=false in your hint file to disable the Opcode extension.
930 useopcode=true
931 : Trailing extension.  Override this in a hint file, if needed.
932 _exe=''
933 : Extra object files, if any, needed on this platform.
934 archobjs=''
935 : Possible local include directories to search.
936 : Set locincpth to "" in a hint file to defeat local include searches.
937 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
938 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
939 :
940 : no include file wanted by default
941 inclwanted=''
942
943 groupstype=''
944 : change the next line if compiling for Xenix/286 on Xenix/386
945 xlibpth='/usr/lib/386 /lib/386'
946
947 : Possible local library directories to search.
948 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
949 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
950
951 : general looking path for locating libraries
952 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
953 glibpth="$glibpth /lib /usr/lib $xlibpth"
954 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
955 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
956
957 : Private path used by Configure to find libraries.  Its value
958 : is prepended to libpth. This variable takes care of special
959 : machines, like the mips.  Usually, it should be empty.
960 plibpth=''
961
962 : default library list
963 libswanted=''
964 : some systems want to use only the non-versioned libso:s
965 ignore_versioned_solibs=''
966 : set usemultiplicity on the Configure command line to enable multiplicity.
967 : set usesocks on the Configure command line to enable socks.
968 : set usethreads on the Configure command line to enable threads.
969 : full support for void wanted by default
970 defvoidused=15
971
972 : List of libraries we want.
973 : If anyone needs -lnet, put it in a hint file.
974 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
975 libswanted="$libswanted dld ld sun m c cposix posix"
976 libswanted="$libswanted ndir dir crypt sec"
977 libswanted="$libswanted ucb bsd BSD PW x"
978 : We probably want to search /usr/shlib before most other libraries.
979 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
980 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
981 glibpth="/usr/shlib $glibpth"
982 : Do not use vfork unless overridden by a hint file.
983 usevfork=false
984
985 : Find the basic shell for Bourne shell scripts
986 case "$sh" in
987 '')
988         case "$SYSTYPE" in
989         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
990         *) xxx='/bin/sh';;
991         esac
992         if test -f "$xxx"; then
993                 sh="$xxx"
994         else
995                 : Build up a list and do a single loop so we can 'break' out.
996                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
997                 for xxx in sh bash ksh pdksh ash; do
998                         for p in $pth; do
999                                 try="$try ${p}/${xxx}"
1000                         done
1001                 done
1002                 for xxx in $try; do
1003                         if test -f "$xxx"; then
1004                                 sh="$xxx";
1005                                 break
1006                         elif test -f "$xxx.exe"; then
1007                                 sh="$xxx";
1008                                 break
1009                         fi
1010                 done
1011         fi
1012         ;;
1013 esac
1014
1015 case "$sh" in
1016 '')     cat <<EOM >&2
1017 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1018
1019 Usually it's in /bin/sh.  How did you even get this far?
1020 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1021 we'll try to straighten this all out.
1022 EOM
1023         exit 1
1024         ;;
1025 esac
1026
1027 : see if sh knows # comments
1028 if `$sh -c '#' >/dev/null 2>&1`; then
1029         shsharp=true
1030         spitshell=cat
1031         xcat=/bin/cat
1032         test -f $xcat || xcat=/usr/bin/cat
1033         echo "#!$xcat" >try
1034         $eunicefix try
1035         chmod +x try
1036         ./try > today
1037         if test -s today; then
1038                 sharpbang='#!'
1039         else
1040                 echo "#! $xcat" > try
1041                 $eunicefix try
1042                 chmod +x try
1043                 ./try > today
1044                 if test -s today; then
1045                         sharpbang='#! '
1046                 else
1047                         sharpbang=': use '
1048                 fi
1049         fi
1050 else
1051         echo " "
1052         echo "Your $sh doesn't grok # comments--I will strip them later on."
1053         shsharp=false
1054         cd ..
1055         echo "exec grep -v '^[  ]*#'" >spitshell
1056         chmod +x spitshell
1057         $eunicefix spitshell
1058         spitshell=`pwd`/spitshell
1059         cd UU
1060         echo "I presume that if # doesn't work, #! won't work either!"
1061         sharpbang=': use '
1062 fi
1063 rm -f try today
1064
1065 : figure out how to guarantee sh startup
1066 case "$startsh" in
1067 '') startsh=${sharpbang}${sh} ;;
1068 *)
1069 esac
1070 cat >try <<EOSS
1071 $startsh
1072 set abc
1073 test "$?abc" != 1
1074 EOSS
1075
1076 chmod +x try
1077 $eunicefix try
1078 if ./try; then
1079         : echo "Yup, it does."
1080 else
1081         echo "Hmm... '$startsh' does not guarantee sh startup..."
1082         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1083 fi
1084 rm -f try
1085
1086
1087 : Save command line options in file UU/cmdline.opt for later use in
1088 : generating config.sh.
1089 cat > cmdline.opt <<EOSH
1090 # Configure command line arguments.
1091 config_arg0='$0'
1092 config_args='$*'
1093 config_argc=$#
1094 EOSH
1095 argn=1
1096 for arg in "$@"; do
1097         cat >>cmdline.opt <<EOSH
1098 config_arg$argn='$arg'
1099 EOSH
1100         argn=`expr $argn + 1`
1101 done
1102
1103 : produce awk script to parse command line options
1104 cat >options.awk <<'EOF'
1105 BEGIN {
1106         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1107
1108         len = length(optstr);
1109         for (i = 1; i <= len; i++) {
1110                 c = substr(optstr, i, 1);
1111                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1112                 if (a == ":") {
1113                         arg[c] = 1;
1114                         i++;
1115                 }
1116                 opt[c] = 1;
1117         }
1118 }
1119 {
1120         expect = 0;
1121         str = $0;
1122         if (substr(str, 1, 1) != "-") {
1123                 printf("'%s'\n", str);
1124                 next;
1125         }
1126         len = length($0);
1127         for (i = 2; i <= len; i++) {
1128                 c = substr(str, i, 1);
1129                 if (!opt[c]) {
1130                         printf("-%s\n", substr(str, i));
1131                         next;
1132                 }
1133                 printf("-%s\n", c);
1134                 if (arg[c]) {
1135                         if (i < len)
1136                                 printf("'%s'\n", substr(str, i + 1));
1137                         else
1138                                 expect = 1;
1139                         next;
1140                 }
1141         }
1142 }
1143 END {
1144         if (expect)
1145                 print "?";
1146 }
1147 EOF
1148
1149 : process the command line options
1150 set X `for arg in "$@"; do echo "X$arg"; done |
1151         sed -e s/X// | awk -f options.awk`
1152 eval "set $*"
1153 shift
1154 rm -f options.awk
1155
1156 : set up default values
1157 fastread=''
1158 reuseval=false
1159 config_sh=''
1160 alldone=''
1161 error=''
1162 silent=''
1163 extractsh=''
1164 override=''
1165 knowitall=''
1166 rm -f optdef.sh posthint.sh
1167 cat >optdef.sh <<EOS
1168 $startsh
1169 EOS
1170
1171
1172 : option parsing
1173 while test $# -gt 0; do
1174         case "$1" in
1175         -d) shift; fastread=yes;;
1176         -e) shift; alldone=cont;;
1177         -f)
1178                 shift
1179                 cd ..
1180                 if test -r "$1"; then
1181                         config_sh="$1"
1182                 else
1183                         echo "$me: cannot read config file $1." >&2
1184                         error=true
1185                 fi
1186                 cd UU
1187                 shift;;
1188         -h) shift; error=true;;
1189         -r) shift; reuseval=true;;
1190         -s) shift; silent=true; realsilent=true;;
1191         -E) shift; alldone=exit;;
1192         -K) shift; knowitall=true;;
1193         -O) shift; override=true;;
1194         -S) shift; silent=true; extractsh=true;;
1195         -D)
1196                 shift
1197                 case "$1" in
1198                 *=)
1199                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1200                         echo "$me: ignoring -D $1" >&2
1201                         ;;
1202                 *=*) echo "$1" | \
1203                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1204                 *) echo "$1='define'" >> optdef.sh;;
1205                 esac
1206                 shift
1207                 ;;
1208         -U)
1209                 shift
1210                 case "$1" in
1211                 *=) echo "$1" >> optdef.sh;;
1212                 *=*)
1213                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1214                         echo "$me: ignoring -U $1" >&2
1215                         ;;
1216                 *) echo "$1='undef'" >> optdef.sh;;
1217                 esac
1218                 shift
1219                 ;;
1220         -A)
1221             shift
1222             xxx=''
1223             yyy="$1"
1224             zzz=''
1225             uuu=undef
1226             case "$yyy" in
1227             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1228                  case "$zzz" in
1229                  *:*) zzz='' ;;
1230                  *)   xxx=append
1231                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1232                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1233                  esac
1234                  ;;
1235             esac
1236             case "$xxx" in
1237             '')  case "$yyy" in
1238                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1239                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1240                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1241                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1242                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1243                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1244                  esac
1245                  ;;       
1246             esac
1247             case "$xxx" in
1248             append)
1249                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1250             clear)
1251                 echo "$yyy=''"                  >> posthint.sh ;;
1252             define)
1253                 case "$zzz" in
1254                 '') zzz=define ;;
1255                 esac
1256                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1257             eval)
1258                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1259             prepend)
1260                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1261             undef)
1262                 case "$zzz" in
1263                 '') zzz="$uuu" ;;
1264                 esac
1265                 echo "$yyy=$zzz"                >> posthint.sh ;;
1266             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1267             esac
1268             ;;
1269         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1270             exit 0;;
1271         --) break;;
1272         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1273         *) break;;
1274         esac
1275 done
1276
1277 case "$error" in
1278 true)
1279         cat >&2 <<EOM
1280 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1281                  [-U symbol] [-U symbol=] [-A command:symbol...]
1282   -d : use defaults for all answers.
1283   -e : go on without questioning past the production of config.sh.
1284   -f : specify an alternate default configuration file.
1285   -h : print this help message and exit (with an error status).
1286   -r : reuse C symbols value if possible (skips costly nm extraction).
1287   -s : silent mode, only echoes questions and essential information.
1288   -D : define symbol to have some value:
1289          -D symbol         symbol gets the value 'define'
1290          -D symbol=value   symbol gets the value 'value'
1291   -E : stop at the end of questions, after having produced config.sh.
1292   -K : do not use unless you know what you are doing.
1293   -O : let -D and -U override definitions from loaded configuration file.
1294   -S : perform variable substitutions on all .SH files (can mix with -f)
1295   -U : undefine symbol:
1296          -U symbol    symbol gets the value 'undef'
1297          -U symbol=   symbol gets completely empty
1298   -A : manipulate symbol after the platform specific hints have been applied:
1299          -A symbol=value                append " "value to symbol
1300          -A append:symbol=value         append value to symbol
1301          -A define:symbol=value         define symbol to have value
1302          -A clear:symbol                define symbol to be ''
1303          -A define:symbol               define symbol to be 'define'
1304          -A eval:symbol=value           define symbol to be eval of value
1305          -A prepend:symbol=value        prepend value to symbol
1306          -A undef:symbol                define symbol to be 'undef'
1307          -A undef:symbol=               define symbol to be ''
1308   -V : print version number and exit (with a zero status).
1309 EOM
1310         exit 1
1311         ;;
1312 esac
1313
1314 : Sanity checks
1315 case "$fastread$alldone" in
1316 yescont|yesexit) ;;
1317 *)
1318         if test ! -t 0; then
1319                 echo "Say 'sh Configure', not 'sh <Configure'"
1320                 exit 1
1321         fi
1322         ;;
1323 esac
1324
1325 exec 4>&1
1326 case "$silent" in
1327 true) exec 1>/dev/null;;
1328 esac
1329
1330 : run the defines and the undefines, if any, but leave the file out there...
1331 touch optdef.sh
1332 . ./optdef.sh
1333 : create the posthint manipulation script and leave the file out there...
1334 touch posthint.sh
1335
1336 : set package name
1337 package=perl5
1338 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1339 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1340 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1341 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1342 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1343 esac
1344
1345 : Some greps do not return status, grrr.
1346 echo "grimblepritz" >grimble
1347 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1348         contains=contains
1349 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1350         contains=grep
1351 else
1352         contains=contains
1353 fi
1354 rm -f grimble
1355 : the following should work in any shell
1356 case "$contains" in
1357 contains*)
1358         echo " "
1359         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1360         cat >contains <<'EOSS'
1361 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1362 EOSS
1363 chmod +x contains
1364 esac
1365
1366 : Find the path to the source tree
1367 case "$src" in
1368 '') case "$0" in
1369     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1370          case "$src" in
1371          /*)    ;;
1372          *)     src=`cd ../$src && pwd` ;;
1373          esac
1374          ;;
1375     *)   src='.';;
1376     esac;;
1377 esac
1378 case "$src" in
1379 '')     src=/
1380         rsrc=/
1381         ;;
1382 /*) rsrc="$src";;
1383 *) rsrc="../$src";;
1384 esac
1385 if test -f $rsrc/Configure && \
1386         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1387 then
1388    : found it, so we are ok.
1389 else
1390         rsrc=''
1391         for src in . .. ../.. ../../.. ../../../..; do
1392                 if test -f ../$src/Configure && \
1393                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1394                 then
1395                         rsrc=../$src
1396                         break
1397                 fi
1398         done
1399 fi
1400 case "$rsrc" in
1401 '')
1402         cat <<EOM >&4
1403
1404 Sorry, I can't seem to locate the source dir for $package.  Please start
1405 Configure with an explicit path -- i.e. /some/path/Configure.
1406
1407 EOM
1408         exit 1
1409         ;;
1410 ../.)   rsrc='..';;
1411 *)
1412         echo " "
1413         echo "Sources for $package found in \"$src\"." >&4
1414         ;;
1415 esac
1416
1417 : script used to extract .SH files with variable substitutions
1418 cat >extract <<'EOS'
1419 CONFIGDOTSH=true
1420 echo "Doing variable substitutions on .SH files..."
1421 if test -f $src/MANIFEST; then
1422         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1423 else
1424         echo "(Looking for .SH files under the source directory.)"
1425         set x `(cd $src; find . -name "*.SH" -print)`
1426 fi
1427 shift
1428 case $# in
1429 0) set x `(cd $src; echo *.SH)`; shift;;
1430 esac
1431 if test ! -f $src/$1; then
1432         shift
1433 fi
1434 mkdir_p='
1435 name=$1;
1436 create="";
1437 while test $name; do
1438         if test ! -d "$name"; then
1439                 create="$name $create";
1440                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1441                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1442         else
1443                 name="";
1444         fi;
1445 done;
1446 for file in $create; do
1447         mkdir $file;
1448 done
1449 '
1450 for file in $*; do
1451         case "$src" in
1452         ".")
1453                 case "$file" in
1454                 */*)
1455                         dir=`expr X$file : 'X\(.*\)/'`
1456                         file=`expr X$file : 'X.*/\(.*\)'`
1457                         (cd $dir && . ./$file)
1458                         ;;
1459                 *)
1460                         . ./$file
1461                         ;;
1462                 esac
1463                 ;;
1464         *)
1465                 case "$file" in
1466                 */*)
1467                         dir=`expr X$file : 'X\(.*\)/'`
1468                         file=`expr X$file : 'X.*/\(.*\)'`
1469                         (set x $dir; shift; eval $mkdir_p)
1470                         sh <$src/$dir/$file
1471                         ;;
1472                 *)
1473                         sh <$src/$file
1474                         ;;
1475                 esac
1476                 ;;
1477         esac
1478 done
1479 if test -f $src/config_h.SH; then
1480         if test ! -f config.h; then
1481         : oops, they left it out of MANIFEST, probably, so do it anyway.
1482         . $src/config_h.SH
1483         fi
1484 fi
1485 EOS
1486
1487 : extract files and exit if asked to do so
1488 case "$extractsh" in
1489 true)
1490         case "$realsilent" in
1491         true) ;;
1492         *) exec 1>&4;;
1493         esac
1494         case "$config_sh" in
1495         '') config_sh='config.sh';;
1496         esac
1497         echo " "
1498         echo "Fetching answers from $config_sh..."
1499         cd ..
1500         . $config_sh
1501         test "$override" && . ./optdef.sh
1502         echo " "
1503         . UU/extract
1504         rm -rf UU
1505         echo "Done."
1506         exit 0
1507         ;;
1508 esac
1509
1510 : Eunice requires " " instead of "", can you believe it
1511 echo " "
1512 : Here we go...
1513 echo "Beginning of configuration questions for $package."
1514
1515 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1516
1517 : first determine how to suppress newline on echo command
1518 echo " "
1519 echo "Checking echo to see how to suppress newlines..."
1520 (echo "hi there\c" ; echo " ") >.echotmp
1521 if $contains c .echotmp >/dev/null 2>&1 ; then
1522         echo "...using -n."
1523         n='-n'
1524         c=''
1525 else
1526         cat <<'EOM'
1527 ...using \c
1528 EOM
1529         n=''
1530         c='\c'
1531 fi
1532 echo $n "The star should be here-->$c"
1533 echo '*'
1534 rm -f .echotmp
1535
1536 : Now test for existence of everything in MANIFEST
1537 echo " "
1538 if test -f $rsrc/MANIFEST; then
1539         echo "First let's make sure your kit is complete.  Checking..." >&4
1540         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1541         rm -f missing
1542         tmppwd=`pwd`
1543         for filelist in x??; do
1544                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1545         done
1546         if test -s missing; then
1547                 cat missing >&4
1548                 cat >&4 <<'EOM'
1549
1550 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1551
1552 You have the option of continuing the configuration process, despite the
1553 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1554 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1555 and contact the author (perlbug@perl.com).
1556
1557 EOM
1558                 echo $n "Continue? [n] $c" >&4
1559                 read ans
1560                 case "$ans" in
1561                 y*)
1562                         echo "Continuing..." >&4
1563                         rm -f missing
1564                         ;;
1565                 *)
1566                         echo "ABORTING..." >&4
1567                         kill $$
1568                         ;;
1569                 esac
1570         else
1571                 echo "Looks good..."
1572         fi
1573 else
1574         echo "There is no MANIFEST file.  I hope your kit is complete !"
1575 fi
1576 rm -f missing x??
1577
1578 echo " "
1579 : Find the appropriate value for a newline for tr
1580 if test -n "$DJGPP"; then
1581        trnl='\012'
1582 fi
1583 if test X"$trnl" = X; then
1584         case "`echo foo|tr '\n' x 2>/dev/null`" in
1585         foox) trnl='\n' ;;
1586         esac
1587 fi
1588 if test X"$trnl" = X; then
1589         case "`echo foo|tr '\012' x 2>/dev/null`" in
1590         foox) trnl='\012' ;;
1591         esac
1592 fi
1593 if test X"$trnl" = X; then
1594         cat <<EOM >&2
1595
1596 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1597
1598 EOM
1599         exit 1
1600 fi
1601
1602 : compute the number of columns on the terminal for proper question formatting
1603 case "$COLUMNS" in
1604 '') COLUMNS='80';;
1605 esac
1606
1607 : set up the echo used in my read
1608 myecho="case \"\$xxxm\" in
1609 '') echo $n \"\$rp $c\" >&4;;
1610 *) case \"\$rp\" in
1611         '') echo $n \"[\$xxxm] $c\";;
1612         *)
1613                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1614                         echo \"\$rp\" >&4
1615                         echo $n \"[\$xxxm] $c\" >&4
1616                 else
1617                         echo $n \"\$rp [\$xxxm] $c\" >&4
1618                 fi
1619                 ;;
1620         esac;;
1621 esac"
1622
1623 : now set up to do reads with possible shell escape and default assignment
1624 cat <<EOSC >myread
1625 $startsh
1626 xxxm=\$dflt
1627 $myecho
1628 ans='!'
1629 case "\$fastread" in
1630 yes) case "\$dflt" in
1631         '') ;;
1632         *) ans='';
1633                 case "\$silent-\$rp" in
1634                 true-) ;;
1635                 *) echo " " >&4;;
1636                 esac;;
1637         esac;;
1638 *) case "\$silent" in
1639         true) case "\$rp" in
1640                 '') ans='';;
1641                 esac;;
1642         esac;;
1643 esac
1644 while expr "X\$ans" : "X!" >/dev/null; do
1645         read answ
1646         set x \$xxxm
1647         shift
1648         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1649         case  "\$answ" in
1650         "!")
1651                 sh 1>&4
1652                 echo " "
1653                 $myecho
1654                 ;;
1655         !*)
1656                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1657                 shift
1658                 sh 1>&4 -c "\$*"
1659                 echo " "
1660                 $myecho
1661                 ;;
1662         "\$ans")
1663                 case "\$ans" in
1664                 \\&*)
1665                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1666                         shift
1667                         case "\$1" in
1668                         -d)
1669                                 fastread=yes
1670                                 echo "(OK, I'll run with -d after this question.)" >&4
1671                                 ;;
1672                         -*)
1673                                 echo "*** Sorry, \$1 not supported yet." >&4
1674                                 ;;
1675                         esac
1676                         $myecho
1677                         ans=!
1678                         ;;
1679                 esac;;
1680         *)
1681                 case "\$aok" in
1682                 y)
1683                         echo "*** Substitution done -- please confirm."
1684                         xxxm="\$ans"
1685                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1686                         xxxm="\$ans"
1687                         ans=!
1688                         ;;
1689                 *)
1690                         echo "*** Error -- try again."
1691                         ans=!
1692                         ;;
1693                 esac
1694                 $myecho
1695                 ;;
1696         esac
1697         case "\$ans\$xxxm\$nostick" in
1698         '')
1699                 ans=!
1700                 $myecho
1701                 ;;
1702         esac
1703 done
1704 case "\$ans" in
1705 '') ans="\$xxxm";;
1706 esac
1707 EOSC
1708
1709 : create .config dir to save info across Configure sessions
1710 test -d ../.config || mkdir ../.config
1711 cat >../.config/README <<EOF
1712 This directory created by Configure to save information that should
1713 persist across sessions for $package.
1714
1715 You may safely delete it if you wish.
1716 EOF
1717
1718 : general instructions
1719 needman=true
1720 firsttime=true
1721 user=`(logname) 2>/dev/null`
1722 case "$user" in
1723 '') user=`whoami 2>&1`;;
1724 esac
1725 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1726         firsttime=false
1727         echo " "
1728         rp='Would you like to see the instructions?'
1729         dflt=n
1730         . ./myread
1731         case "$ans" in
1732         [yY]*) ;;
1733         *) needman=false;;
1734         esac
1735 fi
1736 if $needman; then
1737         cat <<EOH
1738
1739 This installation shell script will examine your system and ask you questions
1740 to determine how the perl5 package should be installed. If you get
1741 stuck on a question, you may use a ! shell escape to start a subshell or
1742 execute a command.  Many of the questions will have default answers in square
1743 brackets; typing carriage return will give you the default.
1744
1745 On some of the questions which ask for file or directory names you are allowed
1746 to use the ~name construct to specify the login directory belonging to "name",
1747 even if you don't have a shell which knows about that.  Questions where this is
1748 allowed will be marked "(~name ok)".
1749
1750 EOH
1751         rp=''
1752         dflt='Type carriage return to continue'
1753         . ./myread
1754         cat <<'EOH'
1755
1756 The prompter used in this script allows you to use shell variables and
1757 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1758 in the default answer, as if the default line was a set of arguments given to a
1759 script shell.  This means you may also use $* to repeat the whole default line,
1760 so you do not have to re-type everything to add something to the default.
1761
1762 Everytime there is a substitution, you will have to confirm.  If there is an
1763 error (e.g. an unmatched backtick), the default answer will remain unchanged
1764 and you will be prompted again.
1765
1766 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1767 the questions and use the computed defaults (or the previous answers if there
1768 was already a config.sh file). Type 'Configure -h' for a list of options.
1769 You may also start interactively and then answer '& -d' at any prompt to turn
1770 on the non-interactive behaviour for the remainder of the execution.
1771
1772 EOH
1773         . ./myread
1774         cat <<EOH
1775
1776 Much effort has been expended to ensure that this shell script will run on any
1777 Unix system.  If despite that it blows up on yours, your best bet is to edit
1778 Configure and run it again.  If you can't run Configure for some reason,
1779 you'll have to generate a config.sh file by hand.  Whatever problems you
1780 have, let me (perlbug@perl.com) know how I blew it.
1781
1782 This installation script affects things in two ways:
1783
1784 1) it may do direct variable substitutions on some of the files included
1785    in this kit.
1786 2) it builds a config.h file for inclusion in C programs.  You may edit
1787    any of these files as the need arises after running this script.
1788
1789 If you make a mistake on a question, there is no easy way to back up to it
1790 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1791 files.  Configure will offer to let you do this before it runs the SH files.
1792
1793 EOH
1794         dflt='Type carriage return to continue'
1795         . ./myread
1796         case "$firsttime" in
1797         true) echo $user >>../.config/instruct;;
1798         esac
1799 fi
1800
1801 : find out where common programs are
1802 echo " "
1803 echo "Locating common programs..." >&4
1804 cat <<EOSC >loc
1805 $startsh
1806 case \$# in
1807 0) exit 1;;
1808 esac
1809 thing=\$1
1810 shift
1811 dflt=\$1
1812 shift
1813 for dir in \$*; do
1814         case "\$thing" in
1815         .)
1816         if test -d \$dir/\$thing; then
1817                 echo \$dir
1818                 exit 0
1819         fi
1820         ;;
1821         *)
1822         for thisthing in \$dir/\$thing; do
1823                 : just loop through to pick last item
1824         done
1825         if test -f \$thisthing; then
1826                 echo \$thisthing
1827                 exit 0
1828         elif test -f \$dir/\$thing.exe; then
1829                 if test -n "$DJGPP"; then
1830                         echo \$dir/\$thing.exe
1831                 else
1832                         : on Eunice apparently
1833                         echo \$dir/\$thing
1834                 fi
1835                 exit 0
1836         fi
1837         ;;
1838         esac
1839 done
1840 echo \$dflt
1841 exit 1
1842 EOSC
1843 chmod +x loc
1844 $eunicefix loc
1845 loclist="
1846 awk
1847 cat
1848 comm
1849 cp
1850 echo
1851 expr
1852 grep
1853 ls
1854 make
1855 mkdir
1856 rm
1857 sed
1858 sort
1859 touch
1860 tr
1861 uniq
1862 "
1863 trylist="
1864 Mcc
1865 ar
1866 byacc
1867 cpp
1868 csh
1869 date
1870 egrep
1871 gzip
1872 less
1873 ln
1874 more
1875 nm
1876 nroff
1877 perl
1878 pg
1879 test
1880 uname
1881 zip
1882 "
1883 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1884 pth="$pth /lib /usr/lib"
1885 for file in $loclist; do
1886         eval xxx=\$$file
1887         case "$xxx" in
1888         /*|?:[\\/]*)
1889                 if test -f "$xxx"; then
1890                         : ok
1891                 else
1892                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1893                         xxx=`./loc $file $file $pth`
1894                 fi
1895                 ;;
1896         '') xxx=`./loc $file $file $pth`;;
1897         *) xxx=`./loc $xxx $xxx $pth`;;
1898         esac
1899         eval $file=$xxx
1900         eval _$file=$xxx
1901         case "$xxx" in
1902         /*)
1903                 echo $file is in $xxx.
1904                 ;;
1905         ?:[\\/]*)
1906                 echo $file is in $xxx.
1907                 ;;
1908         *)
1909                 echo "I don't know where '$file' is, and my life depends on it." >&4
1910                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1911                 exit 1
1912                 ;;
1913         esac
1914 done
1915 echo " "
1916 echo "Don't worry if any of the following aren't found..."
1917 say=offhand
1918 for file in $trylist; do
1919         eval xxx=\$$file
1920         case "$xxx" in
1921         /*|?:[\\/]*)
1922                 if test -f "$xxx"; then
1923                         : ok
1924                 else
1925                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1926                         xxx=`./loc $file $file $pth`
1927                 fi
1928                 ;;
1929         '') xxx=`./loc $file $file $pth`;;
1930         *) xxx=`./loc $xxx $xxx $pth`;;
1931         esac
1932         eval $file=$xxx
1933         eval _$file=$xxx
1934         case "$xxx" in
1935         /*)
1936                 echo $file is in $xxx.
1937                 ;;
1938         ?:[\\/]*)
1939                 echo $file is in $xxx.
1940                 ;;
1941         *)
1942                 echo "I don't see $file out there, $say."
1943                 say=either
1944                 ;;
1945         esac
1946 done
1947 case "$egrep" in
1948 egrep)
1949         echo "Substituting grep for egrep."
1950         egrep=$grep
1951         ;;
1952 esac
1953 case "$ln" in
1954 ln)
1955         echo "Substituting cp for ln."
1956         ln=$cp
1957         ;;
1958 esac
1959 case "$test" in
1960 test)
1961         echo "Hopefully test is built into your sh."
1962         ;;
1963 *)
1964         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1965                 echo "Using the test built into your sh."
1966                 test=test
1967                 _test=test
1968         fi
1969         ;;
1970 esac
1971 case "$echo" in
1972 echo)
1973         echo "Hopefully echo is built into your sh."
1974         ;;
1975 '') ;;
1976 *)
1977         echo " "
1978 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1979         $echo $n "hi there$c" >foo1
1980         echo $n "hi there$c" >foo2
1981         if cmp foo1 foo2 >/dev/null 2>&1; then
1982                 echo "They are compatible.  In fact, they may be identical."
1983         else
1984                 case "$n" in
1985                 '-n') n='' c='\c';;
1986                 *) n='-n' c='';;
1987                 esac
1988                 cat <<FOO
1989 They are not compatible!  You are probably running ksh on a non-USG system.
1990 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1991 have echo built in and we may have to run some Bourne shell scripts.  That
1992 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1993
1994 FOO
1995                 $echo $n "The star should be here-->$c"
1996                 $echo "*"
1997         fi
1998         $rm -f foo1 foo2
1999         ;;
2000 esac
2001
2002 : determine whether symbolic links are supported
2003 echo " "
2004 $touch blurfl
2005 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2006         echo "Symbolic links are supported." >&4
2007         lns="$ln -s"
2008 else
2009         echo "Symbolic links are NOT supported." >&4
2010         lns="$ln"
2011 fi
2012 $rm -f blurfl sym
2013
2014 : see whether [:lower:] and [:upper:] are supported character classes
2015 echo " "
2016 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2017 ABYZ)
2018         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2019         up='[:upper:]'
2020         low='[:lower:]'
2021         ;;
2022 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2023         # (0xc9 and 0xd1), therefore that is a nice testing point.
2024         if test "X$up" = X -o "X$low" = X; then
2025             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2026             ij) up='[A-Z]'
2027                 low='[a-z]'
2028                 ;;
2029             esac
2030         fi
2031         if test "X$up" = X -o "X$low" = X; then
2032             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2033             ij) up='A-Z'
2034                 low='a-z'
2035                 ;;
2036             esac
2037         fi
2038         if test "X$up" = X -o "X$low" = X; then
2039             case "`echo IJ | od -x 2>/dev/null`" in
2040             *C9D1*|*c9d1*)
2041                 echo "Hey, this might be EBCDIC." >&4
2042                 if test "X$up" = X -o "X$low" = X; then
2043                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2044                     ij) up='[A-IJ-RS-Z]'
2045                         low='[a-ij-rs-z]'
2046                         ;;
2047                     esac
2048                 fi
2049                 if test "X$up" = X -o "X$low" = X; then
2050                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2051                     ij) up='A-IJ-RS-Z'
2052                         low='a-ij-rs-z'
2053                         ;;
2054                     esac
2055                 fi
2056                 ;;
2057             esac
2058         fi
2059 esac
2060 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2061 ij)
2062     echo "Using $up and $low to convert case." >&4
2063     ;;
2064 *)
2065     echo "I don't know how to translate letters from upper to lower case." >&4
2066     echo "Your tr is not acting any way I know of." >&4
2067     exit 1
2068     ;;
2069 esac
2070 : set up the translation script tr, must be called with ./tr of course
2071 cat >tr <<EOSC
2072 $startsh
2073 case "\$1\$2" in
2074 '[A-Z][a-z]') exec $tr '$up' '$low';;
2075 '[a-z][A-Z]') exec $tr '$low' '$up';;
2076 esac
2077 exec $tr "\$@"
2078 EOSC
2079 chmod +x tr
2080 $eunicefix tr
2081
2082 : Try to determine whether config.sh was made on this system
2083 case "$config_sh" in
2084 '')
2085 myuname=`$uname -a 2>/dev/null`
2086 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2087 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2088 # because the A-Z/a-z are not consecutive.
2089 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2090         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2091 newmyuname="$myuname"
2092 dflt=n
2093 case "$knowitall" in
2094 '')
2095         if test -f ../config.sh; then
2096                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2097                         eval "`grep myuname= ../config.sh`"
2098                 fi
2099                 if test "X$myuname" = "X$newmyuname"; then
2100                         dflt=y
2101                 fi
2102         fi
2103         ;;
2104 *) dflt=y;;
2105 esac
2106
2107 : Get old answers from old config file if Configure was run on the
2108 : same system, otherwise use the hints.
2109 hint=default
2110 cd ..
2111 if test -f config.sh; then
2112         echo " "
2113         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2114         . UU/myread
2115         case "$ans" in
2116         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2117         *)  echo "Fetching default answers from your old config.sh file..." >&4
2118                 tmp_n="$n"
2119                 tmp_c="$c"
2120                 tmp_sh="$sh"
2121                 . ./config.sh
2122                 cp config.sh UU
2123                 n="$tmp_n"
2124                 c="$tmp_c"
2125                 : Older versions did not always set $sh.  Catch re-use of such
2126                 : an old config.sh.
2127                 case "$sh" in
2128                 '') sh="$tmp_sh" ;;
2129                 esac
2130                 hint=previous
2131                 ;;
2132         esac
2133 fi
2134 if test ! -f config.sh; then
2135         $cat <<EOM
2136
2137 First time through, eh?  I have some defaults handy for some systems
2138 that need some extra help getting the Configure answers right:
2139
2140 EOM
2141         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2142         dflt=''
2143         : Half the following guesses are probably wrong... If you have better
2144         : tests or hints, please send them to perlbug@perl.com
2145         : The metaconfig authors would also appreciate a copy...
2146         $test -f /irix && osname=irix
2147         $test -f /xenix && osname=sco_xenix
2148         $test -f /dynix && osname=dynix
2149         $test -f /dnix && osname=dnix
2150         $test -f /lynx.os && osname=lynxos
2151         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2152         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2153         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2154         $test -f /bin/mips && /bin/mips && osname=mips
2155         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2156                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2157         $test -d /usr/apollo/bin && osname=apollo
2158         $test -f /etc/saf/_sactab && osname=svr4
2159         $test -d /usr/include/minix && osname=minix
2160         if $test -d /MachTen -o -d /MachTen_Folder; then
2161                 osname=machten
2162                 if $test -x /sbin/version; then
2163                         osvers=`/sbin/version | $awk '{print $2}' |
2164                         $sed -e 's/[A-Za-z]$//'`
2165                 elif $test -x /usr/etc/version; then
2166                         osvers=`/usr/etc/version | $awk '{print $2}' |
2167                         $sed -e 's/[A-Za-z]$//'`
2168                 else
2169                         osvers="$2.$3"
2170                 fi
2171         fi
2172
2173         $test -f /sys/posix.dll &&
2174                 $test -f /usr/bin/what &&
2175                 set X `/usr/bin/what /sys/posix.dll` &&
2176                 $test "$3" = UWIN &&
2177                 osname=uwin &&
2178                 osvers="$5"
2179
2180         if $test -f $uname; then
2181                 set X $myuname
2182                 shift
2183
2184                 case "$5" in
2185                 fps*) osname=fps ;;
2186                 mips*)
2187                         case "$4" in
2188                         umips) osname=umips ;;
2189                         *) osname=mips ;;
2190                         esac;;
2191                 [23]100) osname=mips ;;
2192                 next*) osname=next ;;
2193                 i386*)
2194                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2195                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2196                                 osname='sco'
2197                                 osvers=$tmp
2198                         elif $test -f /etc/kconfig; then
2199                                 osname=isc
2200                                 if test "$lns" = "$ln -s"; then
2201                                         osvers=4
2202                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2203                                         osvers=3
2204                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2205                                         osvers=2
2206                                 fi
2207                         fi
2208                         tmp=''
2209                         ;;
2210                 pc*)
2211                         if test -n "$DJGPP"; then
2212                                 osname=dos
2213                                 osvers=djgpp
2214                         fi
2215                         ;;
2216                 esac
2217
2218                 case "$1" in
2219                 aix) osname=aix
2220                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2221                         case "$tmp" in
2222                         'not found') osvers="$4"."$3" ;;
2223                         '<3240'|'<>3240') osvers=3.2.0 ;;
2224                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2225                         '=3250'|'>3250') osvers=3.2.5 ;;
2226                         *) osvers=$tmp;;
2227                         esac
2228                         ;;
2229                 bsd386) osname=bsd386
2230                         osvers=`$uname -r`
2231                         ;;
2232                 cygwin*) osname=cygwin
2233                         osvers="$3"
2234                         ;;
2235                 *dc.osx) osname=dcosx
2236                         osvers="$3"
2237                         ;;
2238                 dnix) osname=dnix
2239                         osvers="$3"
2240                         ;;
2241                 domainos) osname=apollo
2242                         osvers="$3"
2243                         ;;
2244                 dgux) osname=dgux 
2245                         osvers="$3"
2246                         ;;
2247                 dynixptx*) osname=dynixptx
2248                         osvers=`echo "$4"|sed 's/^v//'`
2249                         ;;
2250                 freebsd) osname=freebsd 
2251                         osvers="$3" ;;
2252                 genix) osname=genix ;;
2253                 hp*) osname=hpux 
2254                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2255                         ;;
2256                 irix*) osname=irix
2257                         case "$3" in
2258                         4*) osvers=4 ;;
2259                         5*) osvers=5 ;;
2260                         *)      osvers="$3" ;;
2261                         esac
2262                         ;;
2263                 linux) osname=linux
2264                         case "$3" in
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 MiNT) osname=mint
2269                         ;;
2270                 netbsd*) osname=netbsd
2271                         osvers="$3"
2272                         ;;
2273                 news-os) osvers="$3"
2274                         case "$3" in
2275                         4*) osname=newsos4 ;;
2276                         *) osname=newsos ;;
2277                         esac
2278                         ;;
2279                 next*) osname=next ;;
2280                 POSIX-BC | posix-bc ) osname=posix-bc
2281                         osvers="$3"
2282                         ;;
2283                 powerux | power_ux | powermax_os | powermaxos | \
2284                 powerunix | power_unix) osname=powerux
2285                         osvers="$3"
2286                         ;;
2287                 qnx) osname=qnx
2288                         osvers="$4"
2289                         ;;
2290                 solaris) osname=solaris
2291                         case "$3" in
2292                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 sunos) osname=sunos
2297                         case "$3" in
2298                         5*) osname=solaris
2299                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2300                         *)      osvers="$3" ;;
2301                         esac
2302                         ;;
2303                 titanos) osname=titanos
2304                         case "$3" in
2305                         1*) osvers=1 ;;
2306                         2*) osvers=2 ;;
2307                         3*) osvers=3 ;;
2308                         4*) osvers=4 ;;
2309                         *)      osvers="$3" ;;
2310                         esac
2311                         ;;
2312                 ultrix) osname=ultrix
2313                         osvers="$3"
2314                         ;;
2315                 osf1|mls+)      case "$5" in
2316                                 alpha)
2317                                         osname=dec_osf
2318                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2319                                         ;;
2320                         hp*)    osname=hp_osf1  ;;
2321                         mips)   osname=mips_osf1 ;;
2322                         esac
2323                         ;;
2324                 unixware) osname=svr5
2325                         osvers="$4"
2326                         ;;
2327                 uts) osname=uts
2328                         osvers="$3"
2329                         ;;
2330                 $2) case "$osname" in
2331                         *isc*) ;;
2332                         *freebsd*) ;;
2333                         svr*)
2334                                 : svr4.x or possibly later
2335                                 case "svr$3" in 
2336                                 ${osname}*)
2337                                         osname=svr$3
2338                                         osvers=$4
2339                                         ;;
2340                                 esac
2341                                 case "$osname" in
2342                                 svr4.0)
2343                                         : Check for ESIX
2344                                         if test -f /stand/boot ; then
2345                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2346                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2347                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2348                                                         if test -n "$isesix"; then
2349                                                                 osname=esix4
2350                                                         fi
2351                                                 fi
2352                                         fi
2353                                         ;;
2354                                 esac
2355                                 ;;
2356                         *)      if test -f /etc/systemid; then
2357                                         osname=sco
2358                                         set `echo $3 | $sed 's/\./ /g'` $4
2359                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2360                                                 osvers=$1.$2.$3
2361                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2362                                                 osvers=$1.$2
2363                                         elif $test -f $src/hints/sco_$1.sh; then
2364                                                 osvers=$1
2365                                         fi
2366                                 else
2367                                         case "$osname" in
2368                                         '') : Still unknown.  Probably a generic Sys V.
2369                                                 osname="sysv"
2370                                                 osvers="$3"
2371                                                 ;;
2372                                         esac
2373                                 fi
2374                                 ;;
2375                         esac
2376                         ;;
2377                 *)      case "$osname" in
2378                         '') : Still unknown.  Probably a generic BSD.
2379                                 osname="$1"
2380                                 osvers="$3"
2381                                 ;;
2382                         esac
2383                         ;;
2384                 esac
2385         else
2386                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2387                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2388                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2389                                 osname=news_os
2390                         fi
2391                         $rm -f UU/kernel.what
2392                 elif test -d c:/.; then
2393                         set X $myuname
2394                         osname=os2
2395                         osvers="$5"
2396                 fi
2397         fi
2398         
2399         : Now look for a hint file osname_osvers, unless one has been
2400         : specified already.
2401         case "$hintfile" in
2402         ''|' ')
2403                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2404                 : Also try without trailing minor version numbers.
2405                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2406                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2407                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2408                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2409                 case "$file" in
2410                 '') dflt=none ;;
2411                 *)  case "$osvers" in
2412                         '') dflt=$file
2413                                 ;;
2414                         *)  if $test -f $src/hints/$file.sh ; then
2415                                         dflt=$file
2416                                 elif $test -f $src/hints/$xfile.sh ; then
2417                                         dflt=$xfile
2418                                 elif $test -f $src/hints/$xxfile.sh ; then
2419                                         dflt=$xxfile
2420                                 elif $test -f $src/hints/$xxxfile.sh ; then
2421                                         dflt=$xxxfile
2422                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2423                                         dflt=$xxxxfile
2424                                 elif $test -f "$src/hints/${osname}.sh" ; then
2425                                         dflt="${osname}"
2426                                 else
2427                                         dflt=none
2428                                 fi
2429                                 ;;
2430                         esac
2431                         ;;
2432                 esac
2433                 if $test -f Policy.sh ; then
2434                         case "$dflt" in
2435                         *Policy*) ;;
2436                         none) dflt="Policy" ;;
2437                         *) dflt="Policy $dflt" ;;
2438                         esac
2439                 fi
2440                 ;;
2441         *)
2442                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2443                 ;;
2444         esac
2445
2446         if $test -f Policy.sh ; then
2447                 $cat <<EOM
2448
2449 There's also a Policy hint file available, which should make the
2450 site-specific (policy) questions easier to answer.
2451 EOM
2452
2453         fi
2454
2455         $cat <<EOM
2456
2457 You may give one or more space-separated answers, or "none" if appropriate.
2458 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2459 is a good thing.  DO NOT give a wrong version or a wrong OS.
2460
2461 EOM
2462
2463         rp="Which of these apply, if any?"
2464         . UU/myread
2465         tans=$ans
2466         for file in $tans; do
2467                 if $test X$file = XPolicy -a -f Policy.sh; then
2468                         . Policy.sh
2469                         $cat Policy.sh >> UU/config.sh
2470                 elif $test -f $src/hints/$file.sh; then
2471                         . $src/hints/$file.sh
2472                         $cat $src/hints/$file.sh >> UU/config.sh
2473                 elif $test X$tans = X -o X$tans = Xnone ; then
2474                         : nothing
2475                 else
2476                         : Give one chance to correct a possible typo.
2477                         echo "$file.sh does not exist"
2478                         dflt=$file
2479                         rp="hint to use instead?"
2480                         . UU/myread
2481                         for file in $ans; do
2482                                 if $test -f "$src/hints/$file.sh"; then
2483                                         . $src/hints/$file.sh
2484                                         $cat $src/hints/$file.sh >> UU/config.sh
2485                                 elif $test X$ans = X -o X$ans = Xnone ; then
2486                                         : nothing
2487                                 else
2488                                         echo "$file.sh does not exist -- ignored."
2489                                 fi
2490                         done
2491                 fi
2492         done
2493
2494         hint=recommended
2495         : Remember our hint file for later.
2496         if $test -f "$src/hints/$file.sh" ; then
2497                 hintfile="$file"
2498         else
2499                 hintfile=''
2500         fi
2501 fi
2502 cd UU
2503 ;;
2504 *)
2505         echo " "
2506         echo "Fetching default answers from $config_sh..." >&4
2507         tmp_n="$n"
2508         tmp_c="$c"
2509         cd ..
2510         cp $config_sh config.sh 2>/dev/null
2511         chmod +w config.sh
2512         . ./config.sh
2513         cd UU
2514         cp ../config.sh .
2515         n="$tmp_n"
2516         c="$tmp_c"
2517         hint=previous
2518         ;;
2519 esac
2520 test "$override" && . ./optdef.sh
2521 myuname="$newmyuname"
2522
2523 : Restore computed paths
2524 for file in $loclist $trylist; do
2525         eval $file="\$_$file"
2526 done
2527
2528 cat << EOM
2529
2530 Configure uses the operating system name and version to set some defaults.
2531 The default value is probably right if the name rings a bell. Otherwise,
2532 since spelling matters for me, either accept the default or answer "none"
2533 to leave it blank.
2534
2535 EOM
2536 case "$osname" in
2537         ''|' ')
2538                 case "$hintfile" in
2539                 ''|' '|none) dflt=none ;;
2540                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2541                 esac
2542                 ;;
2543         *) dflt="$osname" ;;
2544 esac
2545 rp="Operating system name?"
2546 . ./myread
2547 case "$ans" in
2548 none)  osname='' ;;
2549 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2550 esac
2551 echo " "
2552 case "$osvers" in
2553         ''|' ')
2554                 case "$hintfile" in
2555                 ''|' '|none) dflt=none ;;
2556                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2557                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2558                         case "$dflt" in
2559                         ''|' ') dflt=none ;;
2560                         esac
2561                         ;;
2562                 esac
2563                 ;;
2564         *) dflt="$osvers" ;;
2565 esac
2566 rp="Operating system version?"
2567 . ./myread
2568 case "$ans" in
2569 none)  osvers='' ;;
2570 *) osvers="$ans" ;;
2571 esac
2572
2573
2574 . ./posthint.sh
2575
2576 : who configured the system
2577 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2578 cf_by=`(logname) 2>/dev/null`
2579 case "$cf_by" in
2580 "")
2581         cf_by=`(whoami) 2>/dev/null`
2582         case "$cf_by" in
2583         "") cf_by=unknown ;;
2584         esac ;;
2585 esac
2586
2587 : set up the script used to warn in case of inconsistency
2588 cat <<EOS >whoa
2589 $startsh
2590 EOS
2591 cat <<'EOSC' >>whoa
2592 dflt=y
2593 echo " "
2594 echo "*** WHOA THERE!!! ***" >&4
2595 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2596 rp="    Keep the $hint value?"
2597 . ./myread
2598 case "$ans" in
2599 y) td=$was; tu=$was;;
2600 esac
2601 EOSC
2602
2603 : function used to set $1 to $val
2604 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2605 case "$val$was" in
2606 $define$undef) . ./whoa; eval "$var=\$td";;
2607 $undef$define) . ./whoa; eval "$var=\$tu";;
2608 *) eval "$var=$val";;
2609 esac'
2610
2611 cat <<EOM
2612
2613 Perl can be built to take advantage of threads on some systems.
2614 To do so, Configure must be run with -Dusethreads.
2615
2616 Note that threading is a highly experimental feature, and
2617 some known race conditions still remain.  If you choose to try
2618 it, be very sure to not actually deploy it for production
2619 purposes.  README.threads has more details, and is required
2620 reading if you enable threads.
2621 EOM
2622 case "$usethreads" in
2623 $define|true|[yY]*)     dflt='y';;
2624 *) dflt='n';;
2625 esac
2626 rp='Build a threading Perl?'
2627 . ./myread
2628 case "$ans" in
2629 y|Y)    val="$define" ;;
2630 *)      val="$undef" ;;
2631 esac
2632 set usethreads
2633 eval $setvar
2634
2635 case "$usethreads" in
2636 $define)
2637         $cat <<EOM
2638
2639 As of 5.5.640, Perl has two different internal threading implementations,
2640 the 5.005 version (5005threads) and an interpreter-based version
2641 (ithreads) that has one interpreter per thread.  Both are very 
2642 experimental.  This arrangement exists to help developers work out
2643 which one is better.
2644
2645 If you're a casual user, you probably don't want interpreter-threads
2646 at this time.  There doesn't yet exist a way to create threads from
2647 within Perl in this model, i.e., "use Thread;" will NOT work.
2648 EOM
2649         : Default to ithreads unless overridden on command line or with
2650         : old config.sh
2651         dflt='y'
2652         case "$use5005threads" in
2653                 $define|true|[yY]*) dflt='n';;
2654         esac
2655         case "$useithreads" in
2656                 $undef|false|[nN]*) dflt='n';;
2657         esac
2658         rp='Use interpreter-based ithreads?'
2659         . ./myread
2660         case "$ans" in
2661         y|Y)    val="$define" ;;
2662         *)      val="$undef" ;;
2663         esac
2664         set useithreads
2665         eval $setvar
2666         : Now set use5005threads to the opposite value.
2667         case "$useithreads" in
2668         $define) val="$undef" ;;
2669         *) val="$define" ;;
2670         esac
2671         set use5005threads
2672         eval $setvar
2673         ;;
2674 *)
2675         useithreads="$undef"
2676         use5005threads="$undef"
2677         ;;
2678 esac
2679
2680 case "$d_oldpthreads" in
2681 '')     : Configure tests would be welcome here.  For now, assume undef.
2682         val="$undef" ;;
2683 *)      val="$d_oldpthreads" ;;
2684 esac
2685 set d_oldpthreads
2686 eval $setvar
2687
2688
2689 case "$usethreads" in
2690 "$define"|true|[yY]*)
2691 : Look for a hint-file generated 'call-back-unit'.  If the
2692 : user has specified that a threading perl is to be built,
2693 : we may need to set or change some other defaults.
2694         if $test -f usethreads.cbu; then
2695                 echo "Your platform has some specific hints for threaded builds, using them..."
2696                 . ./usethreads.cbu
2697         else
2698                 $cat <<EOM
2699 (Your platform doesn't have any specific hints for threaded builds.
2700  Assuming POSIX threads, then.)
2701 EOM
2702         fi
2703         ;;
2704 esac
2705
2706 cat <<EOM
2707
2708 Perl can be built so that multiple Perl interpreters can coexist
2709 within the same Perl executable.
2710 EOM
2711
2712 case "$useithreads" in
2713 $define)
2714         cat <<EOM
2715 This multiple interpreter support is required for interpreter-based threads.
2716 EOM
2717         val="$define"
2718         ;;
2719 *)
2720         echo 'Normally you do not need this and you should answer no.'
2721         case "$usemultiplicity" in
2722         $define|true|[yY]*)     dflt='y';;
2723         *) dflt='n';;
2724         esac
2725         rp='Build Perl for multiplicity?'
2726         . ./myread
2727         case "$ans" in
2728         y|Y)    val="$define" ;;
2729         *)      val="$undef" ;;
2730         esac
2731         ;;
2732 esac
2733 set usemultiplicity
2734 eval $setvar
2735
2736 : determine where manual pages are on this system
2737 echo " "
2738 case "$sysman" in
2739 '') 
2740         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2741         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2742         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2743         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2744         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2745         sysman=`./loc . /usr/man/man1 $syspath`
2746         ;;
2747 esac
2748 if $test -d "$sysman"; then
2749         echo "System manual is in $sysman." >&4
2750 else
2751         echo "Could not find manual pages in source form." >&4
2752 fi
2753
2754 : see what memory models we can support
2755 case "$models" in
2756 '')
2757         $cat >pdp11.c <<'EOP'
2758 int main() {
2759 #ifdef pdp11
2760         exit(0);
2761 #else
2762         exit(1);
2763 #endif
2764 }
2765 EOP
2766         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2767         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2768                 dflt='unsplit split'
2769         else
2770                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2771                 case "$tans" in
2772                 X) dflt='none';;
2773                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2774                                 dflt='small'
2775                         else
2776                                 dflt=''
2777                         fi
2778                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2779                                 dflt="$dflt medium"
2780                         fi
2781                         if $test -d /lib/large || $test -d /usr/lib/large; then
2782                                 dflt="$dflt large"
2783                         fi
2784                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2785                                 dflt="$dflt huge"
2786                         fi
2787                 esac
2788         fi;;
2789 *) dflt="$models";;
2790 esac
2791 $cat <<EOM
2792  
2793 Some systems have different model sizes.  On most systems they are called
2794 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2795 split.  If your system doesn't support different memory models, say "none".
2796 If you wish to force everything to one memory model, say "none" here and
2797 put the appropriate flags later when it asks you for other cc and ld flags.
2798 Venix systems may wish to put "none" and let the compiler figure things out.
2799 (In the following question multiple model names should be space separated.)
2800
2801 The default for most systems is "none".
2802
2803 EOM
2804 rp="Which memory models are supported?"
2805 . ./myread
2806 models="$ans"
2807
2808 case "$models" in
2809 none)
2810         small=''
2811         medium=''
2812         large=''
2813         huge=''
2814         unsplit=''
2815         split=''
2816         ;;
2817 *split)
2818         case "$split" in
2819         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2820                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2821                         dflt='-i'
2822                 else
2823                         dflt='none'
2824                 fi;;
2825         *) dflt="$split";;
2826         esac
2827         rp="What flag indicates separate I and D space?"
2828         . ./myread
2829         tans="$ans"
2830         case "$tans" in
2831         none) tans='';;
2832         esac
2833         split="$tans"
2834         unsplit='';;
2835 *large*|*small*|*medium*|*huge*)
2836         case "$models" in
2837         *large*)
2838                 case "$large" in
2839                 '') dflt='-Ml';;
2840                 *) dflt="$large";;
2841                 esac
2842         rp="What flag indicates large model?"
2843         . ./myread
2844         tans="$ans"
2845         case "$tans" in
2846         none) tans='';
2847         esac
2848         large="$tans";;
2849         *) large='';;
2850         esac
2851         case "$models" in
2852         *huge*) case "$huge" in
2853                 '') dflt='-Mh';;
2854                 *) dflt="$huge";;
2855                 esac
2856                 rp="What flag indicates huge model?"
2857                 . ./myread
2858                 tans="$ans"
2859                 case "$tans" in
2860                 none) tans='';
2861                 esac
2862                 huge="$tans";;
2863         *) huge="$large";;
2864         esac
2865         case "$models" in
2866         *medium*) case "$medium" in
2867                 '') dflt='-Mm';;
2868                 *) dflt="$medium";;
2869                 esac
2870                 rp="What flag indicates medium model?"
2871                 . ./myread
2872                 tans="$ans"
2873                 case "$tans" in
2874                 none) tans='';
2875                 esac
2876                 medium="$tans";;
2877         *) medium="$large";;
2878         esac
2879         case "$models" in
2880         *small*) case "$small" in
2881                 '') dflt='none';;
2882                 *) dflt="$small";;
2883                 esac
2884                 rp="What flag indicates small model?"
2885                 . ./myread
2886                 tans="$ans"
2887                 case "$tans" in
2888                 none) tans='';
2889                 esac
2890                 small="$tans";;
2891         *) small='';;
2892         esac
2893         ;;
2894 *)
2895         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2896         ;;
2897 esac
2898 $rm -f pdp11.* pdp11
2899
2900 : make some quick guesses about what we are up against
2901 echo " "
2902 $echo $n "Hmm...  $c"
2903 echo exit 1 >bsd
2904 echo exit 1 >usg
2905 echo exit 1 >v7
2906 echo exit 1 >osf1
2907 echo exit 1 >eunice
2908 echo exit 1 >xenix
2909 echo exit 1 >venix
2910 echo exit 1 >os2
2911 d_bsd="$undef"
2912 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2913 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2914 then
2915         echo "Looks kind of like an OSF/1 system, but we'll see..."
2916         echo exit 0 >osf1
2917 elif test `echo abc | tr a-z A-Z` = Abc ; then
2918         xxx=`./loc addbib blurfl $pth`
2919         if $test -f $xxx; then
2920         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2921                 echo exit 0 >bsd
2922                 echo exit 0 >usg
2923         else
2924                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2925                         echo "Looks kind of like an extended USG system, but we'll see..."
2926                 else
2927                         echo "Looks kind of like a USG system, but we'll see..."
2928                 fi
2929                 echo exit 0 >usg
2930         fi
2931 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2932         echo "Looks kind of like a BSD system, but we'll see..."
2933         d_bsd="$define"
2934         echo exit 0 >bsd
2935 else
2936         echo "Looks kind of like a Version 7 system, but we'll see..."
2937         echo exit 0 >v7
2938 fi
2939 case "$eunicefix" in
2940 *unixtovms*)
2941         $cat <<'EOI'
2942 There is, however, a strange, musty smell in the air that reminds me of
2943 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2944 EOI
2945         echo exit 0 >eunice
2946         d_eunice="$define"
2947 : it so happens the Eunice I know will not run shell scripts in Unix format
2948         ;;
2949 *)
2950         echo " "
2951         echo "Congratulations.  You aren't running Eunice."
2952         d_eunice="$undef"
2953         ;;
2954 esac
2955 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2956 case "$p_" in
2957 :) ;;
2958 *)
2959         $cat <<'EOI'
2960 I have the feeling something is not exactly right, however...don't tell me...
2961 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2962 EOI
2963         echo exit 0 >os2
2964         ;;
2965 esac
2966 if test -f /xenix; then
2967         echo "Actually, this looks more like a XENIX system..."
2968         echo exit 0 >xenix
2969         d_xenix="$define"
2970 else
2971         echo " "
2972         echo "It's not Xenix..."
2973         d_xenix="$undef"
2974 fi
2975 chmod +x xenix
2976 $eunicefix xenix
2977 if test -f /venix; then
2978         echo "Actually, this looks more like a VENIX system..."
2979         echo exit 0 >venix
2980 else
2981         echo " "
2982         if ./xenix; then
2983                 : null
2984         else
2985                 echo "Nor is it Venix..."
2986         fi
2987 fi
2988 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2989 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2990 $rm -f foo
2991
2992 : see if we need a special compiler
2993 echo " "
2994 if ./usg; then
2995         case "$cc" in
2996         '') case "$Mcc" in
2997                 /*) dflt='Mcc';;
2998                 *) case "$large" in
2999                         -M*) dflt='cc';;
3000                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3001                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3002                                                 dflt='cc'
3003                                         else
3004                                                 dflt='cc -M'
3005                                         fi
3006                                 else
3007                                         dflt='cc'
3008                                 fi;;
3009                         esac;;
3010                 esac;;
3011         *)  dflt="$cc";;
3012         esac
3013         case "$dflt" in
3014         *M*)    $cat <<'EOM'
3015 On some older systems the default C compiler will not resolve multiple global
3016 references that happen to have the same name.  On some such systems the "Mcc"
3017 command may be used to force these to be resolved.  On other systems a "cc -M"
3018 command is required.  (Note that the -M flag on other systems indicates a
3019 memory model to use!) If you have the Gnu C compiler, you might wish to use
3020 that instead.
3021
3022 EOM
3023         ;;
3024         esac
3025         rp="Use which C compiler?"
3026         . ./myread
3027         cc="$ans"
3028 else
3029         case "$cc" in
3030         '') dflt=cc;;
3031         *) dflt="$cc";;
3032         esac
3033         rp="Use which C compiler?"
3034         . ./myread
3035         cc="$ans"
3036 fi
3037 : Look for a hint-file generated 'call-back-unit'.  Now that the
3038 : user has specified the compiler, we may need to set or change some
3039 : other defaults.
3040 if $test -f cc.cbu; then
3041     . ./cc.cbu
3042 fi
3043 echo " "
3044 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3045 $cat >gccvers.c <<EOM
3046 #include <stdio.h>
3047 int main() {
3048 #ifdef __GNUC__
3049 #ifdef __VERSION__
3050         printf("%s\n", __VERSION__);
3051 #else
3052         printf("%s\n", "1");
3053 #endif
3054 #endif
3055         exit(0);
3056 }
3057 EOM
3058 if $cc -o gccvers gccvers.c; then
3059         gccversion=`./gccvers`
3060         case "$gccversion" in
3061         '') echo "You are not using GNU cc." ;;
3062         *)  echo "You are using GNU cc $gccversion."
3063             ;;
3064         esac
3065 else
3066         echo " "
3067         echo "*** WHOA THERE!!! ***" >&4
3068         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3069         case "$knowitall" in
3070         '')
3071         echo "    You'd better start hunting for one and let me know about it." >&4
3072                 exit 1
3073                 ;;
3074         esac
3075 fi
3076 $rm -f gccvers*
3077 case "$gccversion" in
3078 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3079 esac
3080
3081 : decide how portable to be.  Allow command line overrides.
3082 case "$d_portable" in
3083 "$undef") ;;
3084 *)      d_portable="$define" ;;
3085 esac
3086
3087 : set up shell script to do ~ expansion
3088 cat >filexp <<EOSS
3089 $startsh
3090 : expand filename
3091 case "\$1" in
3092  ~/*|~)
3093         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3094         ;;
3095  ~*)
3096         if $test -f /bin/csh; then
3097                 /bin/csh -f -c "glob \$1"
3098                 failed=\$?
3099                 echo ""
3100                 exit \$failed
3101         else
3102                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3103                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3104                 if $test ! -d "\$dir"; then
3105                         me=\`basename \$0\`
3106                         echo "\$me: can't locate home directory for: \$name" >&2
3107                         exit 1
3108                 fi
3109                 case "\$1" in
3110                 */*)
3111                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3112                         ;;
3113                 *)
3114                         echo \$dir
3115                         ;;
3116                 esac
3117         fi
3118         ;;
3119 *)
3120         echo \$1
3121         ;;
3122 esac
3123 EOSS
3124 chmod +x filexp
3125 $eunicefix filexp
3126
3127 : now set up to get a file name
3128 cat <<EOS >getfile
3129 $startsh
3130 EOS
3131 cat <<'EOSC' >>getfile
3132 tilde=''
3133 fullpath=''
3134 already=''
3135 skip=''
3136 none_ok=''
3137 exp_file=''
3138 nopath_ok=''
3139 orig_rp="$rp"
3140 orig_dflt="$dflt"
3141 case "$gfpth" in
3142 '') gfpth='.' ;;
3143 esac
3144
3145 case "$fn" in
3146 *\(*)
3147         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3148         fn=`echo $fn | sed 's/(.*)//'`
3149         ;;
3150 esac
3151
3152 case "$fn" in
3153 *:*)
3154         loc_file=`expr $fn : '.*:\(.*\)'`
3155         fn=`expr $fn : '\(.*\):.*'`
3156         ;;
3157 esac
3158
3159 case "$fn" in
3160 *~*) tilde=true;;
3161 esac
3162 case "$fn" in
3163 */*) fullpath=true;;
3164 esac
3165 case "$fn" in
3166 *+*) skip=true;;
3167 esac
3168 case "$fn" in
3169 *n*) none_ok=true;;
3170 esac
3171 case "$fn" in
3172 *e*) exp_file=true;;
3173 esac
3174 case "$fn" in
3175 *p*) nopath_ok=true;;
3176 esac
3177
3178 case "$fn" in
3179 *f*) type='File';;
3180 *d*) type='Directory';;
3181 *l*) type='Locate';;
3182 esac
3183
3184 what="$type"
3185 case "$what" in
3186 Locate) what='File';;
3187 esac
3188
3189 case "$exp_file" in
3190 '')
3191         case "$d_portable" in
3192         "$define") ;;
3193         *) exp_file=true;;
3194         esac
3195         ;;
3196 esac
3197
3198 cd ..
3199 while test "$type"; do
3200         redo=''
3201         rp="$orig_rp"
3202         dflt="$orig_dflt"
3203         case "$tilde" in
3204         true) rp="$rp (~name ok)";;
3205         esac
3206         . UU/myread
3207         if test -f UU/getfile.ok && \
3208                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3209         then
3210                 value="$ans"
3211                 ansexp="$ans"
3212                 break
3213         fi
3214         case "$ans" in
3215         none)
3216                 value=''
3217                 ansexp=''
3218                 case "$none_ok" in
3219                 true) type='';;
3220                 esac
3221                 ;;
3222         *)
3223                 case "$tilde" in
3224                 '') value="$ans"
3225                         ansexp="$ans";;
3226                 *)
3227                         value=`UU/filexp $ans`
3228                         case $? in
3229                         0)
3230                                 if test "$ans" != "$value"; then
3231                                         echo "(That expands to $value on this system.)"
3232                                 fi
3233                                 ;;
3234                         *) value="$ans";;
3235                         esac
3236                         ansexp="$value"
3237                         case "$exp_file" in
3238                         '') value="$ans";;
3239                         esac
3240                         ;;
3241                 esac
3242                 case "$fullpath" in
3243                 true)
3244                         case "$ansexp" in
3245                         /*) value="$ansexp" ;;
3246                         *)
3247                                 redo=true
3248                                 case "$already" in
3249                                 true)
3250                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3251                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3252                                         ;;
3253                                 *)
3254                                 echo "Please give a full path name, starting with slash." >&4
3255                                         case "$tilde" in
3256                                         true)
3257                                 echo "Note that using ~name is ok provided it expands well." >&4
3258                                                 already=true
3259                                                 ;;
3260                                         esac
3261                                 esac
3262                                 ;;
3263                         esac
3264                         ;;
3265                 esac
3266                 case "$redo" in
3267                 '')
3268                         case "$type" in
3269                         File)
3270                                 for fp in $gfpth; do
3271                                         if test "X$fp" = X.; then
3272                                             pf="$ansexp"
3273                                         else    
3274                                             pf="$fp/$ansexp"
3275                                         fi
3276                                         if test -f "$pf"; then
3277                                                 type=''
3278                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3279                                         then
3280                                                 echo "($value is not a plain file, but that's ok.)"
3281                                                 type=''
3282                                         fi
3283                                         if test X"$type" = X; then
3284                                             value="$pf"
3285                                             break
3286                                         fi
3287                                 done
3288                                 ;;
3289                         Directory)
3290                                 for fp in $gfpth; do
3291                                         if test "X$fp" = X.; then
3292                                             pf="$ansexp"
3293                                         else    
3294                                             pf="$fp/$ansexp"
3295                                         fi
3296                                         if test -d "$pf"; then
3297                                                 type=''
3298                                                 value="$pf"
3299                                                 break
3300                                         fi
3301                                 done
3302                                 ;;
3303                         Locate)
3304                                 if test -d "$ansexp"; then
3305                                         echo "(Looking for $loc_file in directory $value.)"
3306                                         value="$value/$loc_file"
3307                                         ansexp="$ansexp/$loc_file"
3308                                 fi
3309                                 if test -f "$ansexp"; then
3310                                         type=''
3311                                 fi
3312                                 case "$nopath_ok" in
3313                                 true)   case "$value" in
3314                                         */*) ;;
3315                                         *)      echo "Assuming $value will be in people's path."
3316                                                 type=''
3317                                                 ;;
3318                                         esac
3319                                         ;;
3320                                 esac
3321                                 ;;
3322                         esac
3323
3324                         case "$skip" in
3325                         true) type='';
3326                         esac
3327
3328                         case "$type" in
3329                         '') ;;
3330                         *)
3331                                 if test "$fastread" = yes; then
3332                                         dflt=y
3333                                 else
3334                                         dflt=n
3335                                 fi
3336                                 rp="$what $value doesn't exist.  Use that name anyway?"
3337                                 . UU/myread
3338                                 dflt=''
3339                                 case "$ans" in
3340                                 y*) type='';;
3341                                 *) echo " ";;
3342                                 esac
3343                                 ;;
3344                         esac
3345                         ;;
3346                 esac
3347                 ;;
3348         esac
3349 done
3350 cd UU
3351 ans="$value"
3352 rp="$orig_rp"
3353 dflt="$orig_dflt"
3354 rm -f getfile.ok
3355 test "X$gfpthkeep" != Xy && gfpth=""
3356 EOSC
3357
3358 : What should the include directory be ?
3359 echo " "
3360 $echo $n "Hmm...  $c"
3361 dflt='/usr/include'
3362 incpath=''
3363 mips_type=''
3364 if $test -f /bin/mips && /bin/mips; then
3365         echo "Looks like a MIPS system..."
3366         $cat >usr.c <<'EOCP'
3367 #ifdef SYSTYPE_BSD43
3368 /bsd43
3369 #endif
3370 EOCP
3371         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3372                 dflt='/bsd43/usr/include'
3373                 incpath='/bsd43'
3374                 mips_type='BSD 4.3'
3375         else
3376                 mips_type='System V'
3377         fi
3378         $rm -f usr.c usr.out
3379         echo "and you're compiling with the $mips_type compiler and libraries."
3380         xxx_prompt=y
3381         echo "exit 0" >mips
3382 else
3383         echo "Doesn't look like a MIPS system."
3384         xxx_prompt=n
3385         echo "exit 1" >mips
3386 fi
3387 chmod +x mips
3388 $eunicefix mips
3389 case "$usrinc" in
3390 '') ;;
3391 *) dflt="$usrinc";;
3392 esac
3393 case "$xxx_prompt" in
3394 y)      fn=d/
3395         echo " "
3396         rp='Where are the include files you want to use?'
3397         . ./getfile
3398         usrinc="$ans"
3399         ;;
3400 *)      usrinc="$dflt"
3401         ;;
3402 esac
3403
3404 : see how we invoke the C preprocessor
3405 echo " "
3406 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3407 cat <<'EOT' >testcpp.c
3408 #define ABC abc
3409 #define XYZ xyz
3410 ABC.XYZ
3411 EOT
3412 cd ..
3413 if test ! -f cppstdin; then
3414         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3415                 # AIX cc -E doesn't show the absolute headerfile
3416                 # locations but we'll cheat by using the -M flag.
3417                 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
3418         else
3419                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3420         fi
3421 else
3422         echo "Keeping your $hint cppstdin wrapper."
3423 fi
3424 chmod 755 cppstdin
3425 wrapper=`pwd`/cppstdin
3426 ok='false'
3427 cd UU
3428
3429 if $test "X$cppstdin" != "X" && \
3430         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3431         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3432 then
3433         echo "You used to use $cppstdin $cppminus so we'll use that again."
3434         case "$cpprun" in
3435         '') echo "But let's see if we can live without a wrapper..." ;;
3436         *)
3437                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3438                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3439                 then
3440                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3441                         ok='true'
3442                 else
3443                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3444                 fi
3445                 ;;
3446         esac
3447 else
3448         case "$cppstdin" in
3449         '') ;;
3450         *)
3451                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3452                 ;;
3453         esac
3454 fi
3455
3456 if $ok; then
3457         : nothing
3458 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3459         $cc -E <testcpp.c >testcpp.out 2>&1; \
3460         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3461         echo "Yup, it does."
3462         x_cpp="$cc -E"
3463         x_minus='';
3464 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3465         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3466         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3467         echo "Yup, it does."
3468         x_cpp="$cc -E"
3469         x_minus='-';
3470 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3471         $cc -P <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "Yipee, that works!"
3474         x_cpp="$cc -P"
3475         x_minus='';
3476 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3477         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "At long last!"
3480         x_cpp="$cc -P"
3481         x_minus='-';
3482 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3483         $cpp <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         echo "It works!"
3486         x_cpp="$cpp"
3487         x_minus='';
3488 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3489         $cpp - <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "Hooray, it works!  I was beginning to wonder."
3492         x_cpp="$cpp"
3493         x_minus='-';
3494 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3495         $wrapper <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         x_cpp="$wrapper"
3498         x_minus=''
3499         echo "Eureka!"
3500 else
3501         dflt=''
3502         rp="No dice.  I can't find a C preprocessor.  Name one:"
3503         . ./myread
3504         x_cpp="$ans"
3505         x_minus=''
3506         $x_cpp <testcpp.c >testcpp.out 2>&1
3507         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3508                 echo "OK, that will do." >&4
3509         else
3510 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3511                 exit 1
3512         fi
3513 fi
3514
3515 case "$ok" in
3516 false)
3517         cppstdin="$x_cpp"
3518         cppminus="$x_minus"
3519         cpprun="$x_cpp"
3520         cpplast="$x_minus"
3521         set X $x_cpp
3522         shift
3523         case "$1" in
3524         "$cpp")
3525                 echo "Perhaps can we force $cc -E using a wrapper..."
3526                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3527                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3528                 then
3529                         echo "Yup, we can."
3530                         cppstdin="$wrapper"
3531                         cppminus='';
3532                 else
3533                         echo "Nope, we'll have to live without it..."
3534                 fi
3535                 ;;
3536         esac
3537         case "$cpprun" in
3538         "$wrapper")
3539                 cpprun=''
3540                 cpplast=''
3541                 ;;
3542         esac
3543         ;;
3544 esac
3545
3546 case "$cppstdin" in
3547 "$wrapper"|'cppstdin') ;;
3548 *) $rm -f $wrapper;;
3549 esac
3550 $rm -f testcpp.c testcpp.out
3551
3552 : Set private lib path
3553 case "$plibpth" in
3554 '') if ./mips; then
3555                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3556         fi;;
3557 esac
3558 case "$libpth" in
3559 ' ') dlist='';;
3560 '') dlist="$loclibpth $plibpth $glibpth";;
3561 *) dlist="$libpth";;
3562 esac
3563
3564 : Now check and see which directories actually exist, avoiding duplicates
3565 libpth=''
3566 for xxx in $dlist
3567 do
3568     if $test -d $xxx; then
3569                 case " $libpth " in
3570                 *" $xxx "*) ;;
3571                 *) libpth="$libpth $xxx";;
3572                 esac
3573     fi
3574 done
3575 $cat <<'EOM'
3576
3577 Some systems have incompatible or broken versions of libraries.  Among
3578 the directories listed in the question below, please remove any you
3579 know not to be holding relevant libraries, and add any that are needed.
3580 Say "none" for none.
3581
3582 EOM
3583 case "$libpth" in
3584 '') dflt='none';;
3585 *)
3586         set X $libpth
3587         shift
3588         dflt=${1+"$@"}
3589         ;;
3590 esac
3591 rp="Directories to use for library searches?"
3592 . ./myread
3593 case "$ans" in
3594 none) libpth=' ';;
3595 *) libpth="$ans";;
3596 esac
3597
3598 : compute shared library extension
3599 case "$so" in
3600 '')
3601         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3602                 dflt='sl'
3603         else
3604                 dflt='so'
3605         fi
3606         ;;
3607 *) dflt="$so";;
3608 esac
3609 $cat <<EOM
3610
3611 On some systems, shared libraries may be available.  Answer 'none' if
3612 you want to suppress searching of shared libraries for the remainder
3613 of this configuration.
3614
3615 EOM
3616 rp='What is the file extension used for shared libraries?'
3617 . ./myread
3618 so="$ans"
3619
3620 : Define several unixisms.
3621 : Hints files or command line option can be used to override them.
3622 : The convoluted testing is in case hints files set either the old
3623 : or the new name.
3624 case "$_exe" in
3625 '')     case "$exe_ext" in
3626     '') ;;
3627         *)      _exe="$exe_ext" ;;
3628         esac
3629         ;;
3630 esac
3631 case "$_a" in
3632 '')     case "$lib_ext" in
3633     '') _a='.a';;
3634         *)      _a="$lib_ext" ;;
3635         esac
3636         ;;
3637 esac
3638 case "$_o" in
3639 '') case "$obj_ext" in
3640         '')     _o='.o';;
3641         *)      _o="$obj_ext";;
3642         esac
3643         ;;
3644 esac
3645 case "$p_" in
3646 '') case "$path_sep" in
3647         '')     p_=':';;
3648         *)      p_="$path_sep";;
3649         esac
3650         ;;
3651 esac
3652 exe_ext=$_exe
3653 lib_ext=$_a
3654 obj_ext=$_o
3655 path_sep=$p_
3656
3657 : Which makefile gets called first.  This is used by make depend.
3658 case "$firstmakefile" in
3659 '') firstmakefile='makefile';;
3660 esac
3661
3662 cat <<EOM
3663
3664 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3665 Configure must be run with -Dusesocks.
3666
3667 Normally you do not need this and you should answer no.
3668
3669 EOM
3670 case "$usesocks" in
3671 $define|true|[yY]*)     dflt='y';;
3672 *) dflt='n';;
3673 esac
3674 rp='Build Perl for SOCKS?'
3675 . ./myread
3676 case "$ans" in
3677 y|Y)    val="$define" ;;     
3678 *)      val="$undef" ;;
3679 esac
3680 set usesocks
3681 eval $setvar
3682
3683 : Looking for optional libraries
3684 echo " "
3685 echo "Checking for optional libraries..." >&4
3686 case "$libs" in
3687 ' '|'') dflt='';;
3688 *) dflt="$libs";;
3689 esac
3690 case "$libswanted" in
3691 '') libswanted='c_s';;
3692 esac
3693 case "$usesocks" in
3694 $define)
3695         libswanted="$libswanted socks5 socks5_sh"
3696         ;;
3697 esac
3698 for thislib in $libswanted; do
3699         
3700         libname="$thislib"
3701         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`
3702            $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X" ; then
3703                 libstyle=shared
3704         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3705                 libstyle=shared
3706         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3707                 libstyle=static
3708         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3709                 libstyle=static
3710         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3711                 libstyle=static
3712                 libname=${thislib}_s
3713         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3714                 libstyle="static"
3715         fi
3716         if $test -f "$xxx"; then
3717                 eval $libscheck
3718         fi
3719         if $test -f "$xxx"; then
3720                 case "$libstyle" in
3721                 shared) echo "Found -l$libname (shared)." ;;
3722                 static) echo "Found -l$libname." ;;
3723                 *)      echo "Found -l$libname ($libstyle)." ;;
3724                 esac
3725                 case " $dflt " in
3726                 *"-l$thislib "*);;
3727                 *) dflt="$dflt -l$libname"
3728                    libsfound="$libsfound $xxx"
3729                    yyy=`basename $xxx`
3730                    libsfiles="$libsfiles $yyy"
3731                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3732                    case " $libsdirs " in
3733                    *" $yyy "*) ;;
3734                    *) libsdirs="$libsdirs $yyy" ;;
3735                    esac
3736                    ;;
3737                 esac
3738         else
3739                 echo "No -l$thislib."
3740         fi
3741 done
3742 set X $dflt
3743 shift
3744 dflt="$*"
3745 case "$libs" in
3746 '') dflt="$dflt";;
3747 *) dflt="$libs";;
3748 esac
3749 case "$dflt" in
3750 ' '|'') dflt='none';;
3751 esac
3752
3753 $cat <<EOM
3754
3755 In order to compile $package on your machine, a number of libraries
3756 are usually needed.  Include any other special libraries here as well.
3757 Say "none" for none.  The default list is almost always right.
3758 EOM
3759
3760 echo " "
3761 rp="What libraries to use?"
3762 . ./myread
3763 case "$ans" in
3764 none) libs=' ';;
3765 *) libs="$ans";;
3766 esac
3767
3768 : determine optimization, if desired, or use for debug flag also
3769 case "$optimize" in
3770 ' '|$undef) dflt='none';;
3771 '') dflt='-O';;
3772 *) dflt="$optimize";;
3773 esac
3774 $cat <<EOH
3775
3776 By default, $package compiles with the -O flag to use the optimizer.
3777 Alternately, you might want to use the symbolic debugger, which uses
3778 the -g flag (on traditional Unix systems).  Either flag can be
3779 specified here.  To use neither flag, specify the word "none".
3780
3781 EOH
3782 rp="What optimizer/debugger flag should be used?"
3783 . ./myread
3784 optimize="$ans"
3785 case "$optimize" in
3786 'none') optimize=" ";;
3787 esac
3788
3789 dflt=''
3790 : We will not override a previous value, but we might want to
3791 : augment a hint file
3792 case "$hint" in
3793 default|recommended)
3794         case "$gccversion" in
3795         1*) dflt='-fpcc-struct-return' ;;
3796         esac
3797         case "$optimize" in
3798         *-g*) dflt="$dflt -DDEBUGGING";;
3799         esac
3800         case "$gccversion" in
3801         2*) if test -d /etc/conf/kconfig.d &&
3802                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3803                 then
3804                         dflt="$dflt -posix"
3805                 fi
3806                 ;;
3807         esac
3808         case "$gccversion" in
3809         1*) ;;
3810         2.[0-8]*) ;;
3811         ?*)     echo " "
3812                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3813                 echo 'int main(void) { return 0; }' > gcctest.c
3814                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3815                         echo "Yes, it does." 2>&1
3816                         case "$ccflags" in
3817                         *strict-aliasing*) 
3818                                 echo "Leaving current flags $ccflags alone." 2>&1
3819                                 ;;
3820                         *) dflt="$dflt -fno-strict-aliasing" ;;
3821                         esac
3822                 else
3823                         echo "Nope, it doesn't, but that's ok." 2>&1
3824                 fi
3825                 ;;
3826         esac
3827         ;;
3828 esac
3829
3830 case "$mips_type" in
3831 *BSD*|'') inclwanted="$locincpth $usrinc";;
3832 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3833 esac
3834 for thisincl in $inclwanted; do
3835         if $test -d $thisincl; then
3836                 if $test x$thisincl != x$usrinc; then
3837                         case "$dflt" in
3838                         *$thisincl*);;
3839                         *) dflt="$dflt -I$thisincl";;
3840                         esac
3841                 fi
3842         fi
3843 done
3844
3845 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3846         xxx=true;
3847 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3848         xxx=true;
3849 else
3850         xxx=false;
3851 fi;
3852 if $xxx; then
3853         case "$dflt" in
3854         *$2*);;
3855         *) dflt="$dflt -D$2";;
3856         esac;
3857 fi'
3858
3859 set signal.h LANGUAGE_C; eval $inctest
3860
3861 case "$usesocks" in
3862 $define)
3863         ccflags="$ccflags -DSOCKS"
3864         ;;
3865 esac
3866
3867 case "$hint" in
3868 default|recommended) dflt="$ccflags $dflt" ;;
3869 *) dflt="$ccflags";;
3870 esac
3871
3872 case "$dflt" in
3873 ''|' ') dflt=none;;
3874 esac
3875 $cat <<EOH
3876
3877 Your C compiler may want other flags.  For this question you should include
3878 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3879 but you should NOT include libraries or ld flags like -lwhatever.  If you
3880 want $package to honor its debug switch, you should include -DDEBUGGING here.
3881 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3882
3883 To use no flags, specify the word "none".
3884
3885 EOH
3886 set X $dflt
3887 shift
3888 dflt=${1+"$@"}
3889 rp="Any additional cc flags?"
3890 . ./myread
3891 case "$ans" in
3892 none) ccflags='';;
3893 *) ccflags="$ans";;
3894 esac
3895
3896 : the following weeds options from ccflags that are of no interest to cpp
3897 cppflags="$ccflags"
3898 case "$gccversion" in
3899 1*) cppflags="$cppflags -D__GNUC__"
3900 esac
3901 case "$mips_type" in
3902 '');;
3903 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3904 esac
3905 case "$cppflags" in
3906 '');;
3907 *)
3908         echo " "
3909         echo "Let me guess what the preprocessor flags are..." >&4
3910         set X $cppflags
3911         shift
3912         cppflags=''
3913         $cat >cpp.c <<'EOM'
3914 #define BLURFL foo
3915
3916 BLURFL xx LFRULB
3917 EOM
3918         previous=''
3919         for flag in $*
3920         do
3921                 case "$flag" in
3922                 -*) ftry="$flag";;
3923                 *) ftry="$previous $flag";;
3924                 esac
3925                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3926                         >cpp1.out 2>/dev/null && \
3927                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3928                         >cpp2.out 2>/dev/null && \
3929                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3930                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3931                 then
3932                         cppflags="$cppflags $ftry"
3933                         previous=''
3934                 else
3935                         previous="$flag"
3936                 fi
3937         done
3938         set X $cppflags
3939         shift
3940         cppflags=${1+"$@"}
3941         case "$cppflags" in
3942         *-*)  echo "They appear to be: $cppflags";;
3943         esac
3944         $rm -f cpp.c cpp?.out
3945         ;;
3946 esac
3947
3948 : flags used in final linking phase
3949 case "$ldflags" in
3950 '') if ./venix; then
3951                 dflt='-i -z'
3952         else
3953                 dflt=''
3954         fi
3955         case "$ccflags" in
3956         *-posix*) dflt="$dflt -posix" ;;
3957         esac
3958         ;;
3959 *) dflt="$ldflags";;
3960 esac
3961
3962 : Try to guess additional flags to pick up local libraries.
3963 for thislibdir in $libpth; do
3964         case " $loclibpth " in
3965         *" $thislibdir "*)
3966                 case "$dflt " in 
3967                 *"-L$thislibdir "*) ;;
3968                 *)  dflt="$dflt -L$thislibdir" ;;
3969                 esac
3970                 ;;
3971         esac
3972 done
3973
3974 case "$dflt" in
3975 '') dflt='none' ;;
3976 esac
3977
3978 $cat <<EOH
3979
3980 Your C linker may need flags.  For this question you should
3981 include -L/whatever and any other flags used by the C linker, but you
3982 should NOT include libraries like -lwhatever.
3983
3984 Make sure you include the appropriate -L/path flags if your C linker
3985 does not normally search all of the directories you specified above,
3986 namely
3987         $libpth
3988 To use no flags, specify the word "none".
3989
3990 EOH
3991
3992 rp="Any additional ld flags (NOT including libraries)?"
3993 . ./myread
3994 case "$ans" in
3995 none) ldflags='';;
3996 *) ldflags="$ans";;
3997 esac
3998 rmlist="$rmlist pdp11"
3999
4000 : coherency check
4001 echo " "
4002 echo "Checking your choice of C compiler and flags for coherency..." >&4
4003 $cat > try.c <<'EOF'
4004 #include <stdio.h>
4005 int main() { printf("Ok\n"); exit(0); }
4006 EOF
4007 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4008 shift
4009 $cat >try.msg <<'EOM'
4010 I've tried to compile and run the following simple program:
4011
4012 EOM
4013 $cat try.c >> try.msg
4014
4015 $cat >> try.msg <<EOM
4016
4017 I used the command:
4018
4019         $*
4020         ./try
4021
4022 and I got the following output:
4023
4024 EOM
4025 dflt=y
4026 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4027         if sh -c './try' >>try.msg 2>&1; then
4028                 xxx=`./try`
4029                 case "$xxx" in
4030                 "Ok") dflt=n ;;
4031                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4032                         case " $libs " in
4033                         *" -lsfio "*)
4034                                 cat >> try.msg <<'EOQS'
4035 If $libs contains -lsfio, and sfio is mis-configured, then it
4036 sometimes (apparently) runs and exits with a 0 status, but with no
4037 output!  It may have to do with sfio's use of _exit vs. exit.
4038
4039 EOQS
4040                                 rp="You have a big problem.  Shall I abort Configure"
4041                                 dflt=y
4042                                 ;;
4043                         esac
4044                         ;;
4045                 esac
4046         else
4047                 echo "The program compiled OK, but exited with status $?." >>try.msg
4048                 rp="You have a problem.  Shall I abort Configure"
4049                 dflt=y
4050         fi
4051 else
4052         echo "I can't compile the test program." >>try.msg
4053         rp="You have a BIG problem.  Shall I abort Configure"
4054         dflt=y
4055 fi
4056 case "$dflt" in
4057 y)
4058         $cat try.msg >&4
4059         case "$knowitall" in
4060         '')
4061                 echo "(The supplied flags or libraries might be incorrect.)"
4062                 ;;
4063         *) dflt=n;;
4064         esac
4065         echo " "
4066         . ./myread
4067         case "$ans" in
4068         n*|N*) ;;
4069         *)      echo "Ok.  Stopping Configure." >&4
4070                 exit 1
4071                 ;;
4072         esac
4073         ;;
4074 n) echo "OK, that should do.";;
4075 esac
4076 $rm -f try try.* core
4077
4078 : define an is-a-typedef? function
4079 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4080 case "$inclist" in
4081 "") inclist="sys/types.h";;
4082 esac;
4083 eval "varval=\$$var";
4084 case "$varval" in
4085 "")
4086         $rm -f temp.c;
4087         for inc in $inclist; do
4088                 echo "#include <$inc>" >>temp.c;
4089         done;
4090         echo "#ifdef $type" >> temp.c;
4091         echo "printf(\"We have $type\");" >> temp.c;
4092         echo "#endif" >> temp.c;
4093         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4094         if $contains $type temp.E >/dev/null 2>&1; then
4095                 eval "$var=\$type";
4096         else
4097                 eval "$var=\$def";
4098         fi;
4099         $rm -f temp.?;;
4100 *) eval "$var=\$varval";;
4101 esac'
4102
4103 : define an is-a-typedef? function that prompts if the type is not available.
4104 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4105 case "$inclist" in
4106 "") inclist="sys/types.h";;
4107 esac;
4108 eval "varval=\$$var";
4109 case "$varval" in
4110 "")
4111         $rm -f temp.c;
4112         for inc in $inclist; do
4113                 echo "#include <$inc>" >>temp.c;
4114         done;
4115         echo "#ifdef $type" >> temp.c;
4116         echo "printf(\"We have $type\");" >> temp.c;
4117         echo "#endif" >> temp.c;
4118         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4119         echo " " ;
4120         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4121         if $contains $type temp.E >/dev/null 2>&1; then
4122                 echo "$type found." >&4;
4123                 eval "$var=\$type";
4124         else
4125                 echo "$type NOT found." >&4;
4126                 dflt="$def";
4127                 . ./myread ;
4128                 eval "$var=\$ans";
4129         fi;
4130         $rm -f temp.?;;
4131 *) eval "$var=\$varval";;
4132 esac'
4133
4134 : define a shorthand compile call
4135 compile='
4136 mc_file=$1;
4137 shift;
4138 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4139 : define a shorthand compile call for compilations that should be ok.
4140 compile_ok='
4141 mc_file=$1;
4142 shift;
4143 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4144
4145 : check for lengths of integral types
4146 echo " "
4147 case "$intsize" in
4148 '')
4149         echo "Checking to see how big your integers are..." >&4
4150         $cat >intsize.c <<'EOCP'
4151 #include <stdio.h>
4152 int main()
4153 {
4154         printf("intsize=%d;\n", (int)sizeof(int));
4155         printf("longsize=%d;\n", (int)sizeof(long));
4156         printf("shortsize=%d;\n", (int)sizeof(short));
4157         exit(0);
4158 }
4159 EOCP
4160         set intsize
4161         if eval $compile_ok && ./intsize > /dev/null; then
4162                 eval `./intsize`
4163                 echo "Your integers are $intsize bytes long."
4164                 echo "Your long integers are $longsize bytes long."
4165                 echo "Your short integers are $shortsize bytes long."
4166         else
4167                 $cat >&4 <<EOM
4168 !
4169 Help! I can't compile and run the intsize test program: please enlighten me!
4170 (This is probably a misconfiguration in your system or libraries, and
4171 you really ought to fix it.  Still, I'll try anyway.)
4172 !
4173 EOM
4174                 dflt=4
4175                 rp="What is the size of an integer (in bytes)?"
4176                 . ./myread
4177                 intsize="$ans"
4178                 dflt=$intsize
4179                 rp="What is the size of a long integer (in bytes)?"
4180                 . ./myread
4181                 longsize="$ans"
4182                 dflt=2
4183                 rp="What is the size of a short integer (in bytes)?"
4184                 . ./myread
4185                 shortsize="$ans"
4186         fi
4187         ;;
4188 esac
4189 $rm -f intsize intsize.*
4190
4191 : see what type lseek is declared as in the kernel
4192 rp="What is the type used for lseek's offset on this system?"
4193 set off_t lseektype long stdio.h sys/types.h
4194 eval $typedef_ask
4195
4196 echo " "
4197 $echo $n "Checking to see how big your file offsets are...$c" >&4
4198 $cat >try.c <<EOCP
4199 #include <sys/types.h>
4200 #include <stdio.h>
4201 int main()
4202 {
4203     printf("%d\n", (int)sizeof($lseektype));
4204     return(0); 
4205 }
4206 EOCP
4207 set try
4208 if eval $compile_ok; then
4209         lseeksize=`./try`
4210         $echo " $lseeksize bytes." >&4
4211 else
4212         dflt=$longsize
4213         echo " "
4214         echo "(I can't seem to compile the test program.  Guessing...)"
4215         rp="What is the size of your file offsets (in bytes)?"
4216         . ./myread
4217         lseeksize="$ans"
4218 fi
4219 $rm -f try.c try
4220
4221 : see what type file positions are declared as in the library
4222 rp="What is the type for file position used by fsetpos()?"
4223 set fpos_t fpostype long stdio.h sys/types.h
4224 eval $typedef_ask
4225
4226 echo " "
4227 case "$fpostype" in
4228 *_t) zzz="$fpostype"    ;;
4229 *)   zzz="fpos_t"       ;;
4230 esac
4231 $echo $n "Checking the size of $zzz...$c" >&4 
4232 cat > try.c <<EOCP
4233 #include <sys/types.h>
4234 #include <stdio.h>
4235 int main() {
4236     printf("%d\n", (int)sizeof($fpostype));
4237     exit(0);
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         yyy=`./try`
4243         case "$yyy" in
4244         '')     fpossize=4
4245                 echo " "
4246                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4247                 ;;
4248         *)      fpossize=$yyy
4249                 echo " $fpossize bytes."
4250                 ;;
4251         esac
4252 else
4253         dflt="$longsize"
4254         echo " "
4255         echo "(I can't compile the test program.  Guessing...)" >&4
4256         rp="What is the size of your file positions (in bytes)?"
4257         . ./myread
4258         fpossize="$ans"
4259 fi
4260
4261
4262
4263 case "$lseeksize:$fpossize" in
4264 8:8) cat <<EOM
4265
4266 You can have files larger than 2 gigabytes.
4267 EOM
4268    val="$define" ;;
4269 *) cat <<EOM
4270
4271 Perl can be built to understand large files (files larger than 2 gigabytes)
4272 on some systems.  To do so, Configure must be run with -Duselargefiles.
4273
4274 If this doesn't make any sense to you, just accept the default 'y'.
4275 EOM
4276    case "$uselargefiles" in
4277    "$undef"|false|[nN]*) dflt='n' ;;
4278    *)   dflt='y' ;;
4279    esac
4280    rp='Try to understand large files, if available?'
4281    . ./myread
4282    case "$ans" in
4283    y|Y)         val="$define" ;;
4284    *)           val="$undef"  ;;
4285    esac
4286    ;;
4287 esac
4288 set uselargefiles
4289 eval $setvar
4290 case "$uselargefiles" in
4291 "$define")
4292 : Look for a hint-file generated 'call-back-unit'.  If the
4293 : user has specified that a large files perl is to be built,
4294 : we may need to set or change some other defaults.
4295         if $test -f uselfs.cbu; then
4296                 echo "Your platform has some specific hints for large file builds, using them..."
4297                 . ./uselfs.cbu
4298                 echo " "
4299                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4300                 $cat >try.c <<EOCP
4301 #include <sys/types.h>
4302 #include <stdio.h>
4303 int main()
4304 {
4305     printf("%d\n", (int)sizeof($lseektype));
4306     return(0); 
4307 }
4308 EOCP
4309                 set try
4310                 if eval $compile_ok; then
4311                         lseeksize=`./try`
4312                         $echo " $lseeksize bytes." >&4
4313                 else
4314                         dflt="$lseeksize"
4315                         echo " "
4316                         echo "(I can't seem to compile the test program.  Guessing...)"
4317                         rp="What is the size of your file offsets (in bytes)?"
4318                         . ./myread
4319                         lseeksize="$ans"
4320                 fi
4321                 case "$fpostype" in
4322                 *_t) zzz="$fpostype"    ;;
4323                 *)   zzz="fpos_t"       ;;
4324                 esac
4325                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4326                 $cat > try.c <<EOCP
4327 #include <sys/types.h>
4328 #include <stdio.h>
4329 int main() {
4330     printf("%d\n", (int)sizeof($fpostype));
4331     exit(0);
4332 }
4333 EOCP
4334                 set try
4335                 if eval $compile_ok; then
4336                         yyy=`./try`
4337                         dflt="$lseeksize"
4338                         case "$yyy" in
4339                         '')     echo " "
4340                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4341                                 ;;
4342                         *)      fpossize=$yyy
4343                                 echo " $fpossize bytes."
4344                                 ;;
4345                         esac
4346                 else
4347                         dflt="$fpossize"
4348                         echo " "
4349                         echo "(I can't compile the test program.  Guessing...)" >&4
4350                         rp="What is the size of your file positions (in bytes)?"
4351                         . ./myread
4352                         fpossize="$ans"
4353                 fi
4354                 $rm -f try.c try
4355         fi
4356         ;;
4357 esac
4358
4359
4360 case "$usemorebits" in
4361 "$define"|true|[yY]*)
4362         use64bits="$define"
4363         uselongdouble="$define"
4364         usemorebits="$define"
4365         ;;
4366 *)      usemorebits="$undef"
4367         ;;
4368 esac
4369
4370
4371 case "$intsize:$longsize" in
4372 8:*|*:8) cat <<EOM
4373
4374 You have natively 64-bit integers.
4375 EOM
4376    val="$define" ;;
4377 *) cat <<EOM
4378
4379 Perl can be built to take advantage of 64-bit integer types
4380 on some systems.  To do so, Configure must be run with -Duse64bits.
4381
4382 If this doesn't make any sense to you, just accept the default.
4383 EOM
4384   case "$use64bits" in
4385   $define|true|[yY]*)   dflt='y';;
4386   *) dflt='n';;
4387   esac
4388   rp='Try to use 64-bit integers, if available?'
4389   . ./myread
4390   case "$ans" in
4391   y|Y) val="$define" ;;
4392   *)   val="$undef"  ;;
4393   esac
4394   ;;
4395 esac
4396 set use64bits
4397 eval $setvar
4398
4399 case "$archname64" in
4400 '') archname64='' ;;    # not a typo
4401 esac
4402
4403 case "$use64bits" in
4404 "$define"|true|[yY]*)
4405 : Look for a hint-file generated 'call-back-unit'.  If the
4406 : user has specified that a 64-bit perl is to be built,
4407 : we may need to set or change some other defaults.
4408         if $test -f use64bits.cbu; then
4409                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4410                 . ./use64bits.cbu
4411         else
4412                 $cat <<EOM
4413 (Your platform doesn't have any specific hints for 64-bit builds.)
4414 EOM
4415                 case "$intsize:$longsize" in
4416 8:*|*:8) cat <<EOM
4417 (This is probably okay, as your system is a natively 64-bit system.)
4418 EOM
4419                   ;;
4420                 esac
4421                 case "$gccversion" in
4422                 '')     ;;
4423                 *)      case "$ccflags" in
4424                         *-DUSE_LONG_LONG*) ;;
4425                         *) $cat <<EOM
4426 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4427 to the compilation flags.
4428 EOM
4429                            ccflags="$ccflags -DUSE_LONG_LONG"
4430                            ;;
4431                         esac
4432                         ;;
4433                 esac
4434         fi
4435         ;;
4436 esac
4437
4438 : determine the architecture name
4439 echo " "
4440 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4441         tarch=`arch`"-$osname"
4442 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4443         if uname -m > tmparch 2>&1 ; then
4444                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4445                         -e 's/$/'"-$osname/" tmparch`
4446         else
4447                 tarch="$osname"
4448         fi
4449         $rm -f tmparch
4450 else
4451         tarch="$osname"
4452 fi
4453 case "$myarchname" in
4454 ''|"$tarch") ;;
4455 *)
4456         echo "(Your architecture name used to be $myarchname.)"
4457         archname=''
4458         ;;
4459 esac
4460 myarchname="$tarch"
4461 case "$archname" in
4462 '') dflt="$tarch";;
4463 *) dflt="$archname";;
4464 esac
4465 rp='What is your architecture name'
4466 . ./myread
4467 archname="$ans"
4468 case "$usethreads" in
4469 $define)
4470         echo "Threads selected." >&4
4471         case "$archname" in
4472         *-thread*) echo "...and architecture name already has -thread." >&4
4473                 ;;
4474         *)      archname="$archname-thread"
4475                 echo "...setting architecture name to $archname." >&4
4476                 ;;
4477         esac
4478         ;;
4479 esac
4480 case "$usemultiplicity" in
4481 $define)
4482         echo "Multiplicity selected." >&4
4483         case "$archname" in
4484         *-multi*) echo "...and architecture name already has -multi." >&4
4485                 ;;
4486         *)      archname="$archname-multi"
4487                 echo "...setting architecture name to $archname." >&4
4488                 ;;
4489         esac
4490         ;;
4491 esac
4492 case "$use64bits" in
4493 $define)
4494         case "$archname64" in
4495         '')
4496                 ;;
4497         *)
4498                 case "$archname" in
4499                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4500                         ;;
4501                 *)      archname="$archname-$archname64"
4502                         echo "...setting architecture name to $archname." >&4
4503                         ;;
4504                 esac
4505                 ;;
4506         esac
4507 esac
4508
4509 : determine root of directory hierarchy where package will be installed.
4510 case "$prefix" in
4511 '')
4512         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4513         ;;
4514 *)
4515         dflt="$prefix"
4516         ;;
4517 esac
4518 $cat <<EOM
4519
4520 By default, $package will be installed in $dflt/bin, manual pages
4521 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4522 installation directories. Typically this is something like /usr/local.
4523 If you wish to have binaries under /usr/bin but other parts of the
4524 installation under /usr/local, that's ok: you will be prompted
4525 separately for each of the installation directories, the prefix being
4526 only used to set the defaults.
4527
4528 EOM
4529 fn=d~
4530 rp='Installation prefix to use?'
4531 . ./getfile
4532 oldprefix=''
4533 case "$prefix" in
4534 '') ;;
4535 *)
4536         case "$ans" in
4537         "$prefix") ;;
4538         *) oldprefix="$prefix";;
4539         esac
4540         ;;
4541 esac
4542 prefix="$ans"
4543 prefixexp="$ansexp"
4544
4545 : is AFS running?
4546 echo " "
4547 case "$afs" in
4548 $define|true)   afs=true ;;
4549 $undef|false)   afs=false ;;
4550 *)      if test -d /afs; then
4551                 afs=true
4552         else
4553                 afs=false
4554         fi
4555         ;;
4556 esac
4557 if $afs; then
4558         echo "AFS may be running... I'll be extra cautious then..." >&4
4559 else
4560         echo "AFS does not seem to be running..." >&4
4561 fi
4562
4563 : determine installation prefix for where package is to be installed.
4564 if $afs; then 
4565 $cat <<EOM
4566
4567 Since you are running AFS, I need to distinguish the directory in which
4568 files will reside from the directory in which they are installed (and from
4569 which they are presumably copied to the former directory by occult means).
4570
4571 EOM
4572         case "$installprefix" in
4573         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4574         *) dflt="$installprefix";;
4575         esac
4576 else
4577 $cat <<EOM
4578
4579 In some special cases, particularly when building $package for distribution,
4580 it is convenient to distinguish between the directory in which files should 
4581 be installed from the directory ($prefix) in which they 
4582 will eventually reside.  For most users, these two directories are the same.
4583
4584 EOM
4585         case "$installprefix" in
4586         '') dflt=$prefix ;;
4587         *) dflt=$installprefix;;
4588         esac
4589 fi
4590 fn=d~
4591 rp='What installation prefix should I use for installing files?'
4592 . ./getfile
4593 installprefix="$ans"
4594 installprefixexp="$ansexp"
4595
4596 : set the prefixit variable, to compute a suitable default value
4597 prefixit='case "$3" in
4598 ""|none)
4599         case "$oldprefix" in
4600         "") eval "$1=\"\$$2\"";;
4601         *)
4602                 case "$3" in
4603                 "") eval "$1=";;
4604                 none)
4605                         eval "tp=\"\$$2\"";
4606                         case "$tp" in
4607                         ""|" ") eval "$1=\"\$$2\"";;
4608                         *) eval "$1=";;
4609                         esac;;
4610                 esac;;
4611         esac;;
4612 *)
4613         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4614         case "$tp" in
4615         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4616         /*-$oldprefix/*|\~*-$oldprefix/*)
4617                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4618         *) eval "$1=\"\$$2\"";;
4619         esac;;
4620 esac'
4621
4622 : set the base revision
4623 baserev=5.0
4624
4625
4626 : get the patchlevel
4627 echo " "
4628 echo "Getting the current patchlevel..." >&4
4629 if $test -r $rsrc/patchlevel.h;then
4630         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4631         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4632         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4633         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4634         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4635 else
4636         patchlevel=0
4637         subversion=0
4638         api_revision=0
4639         api_version=0
4640         api_subversion=0
4641 fi
4642 $echo $n "(You have $package" $c
4643 case "$package" in
4644 "*$baserev")    ;;
4645 *)              $echo $n " $baserev" $c ;;
4646 esac
4647 $echo $n " patchlevel $patchlevel" $c
4648 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4649 echo ".)"
4650 case "$osname" in
4651 dos|vms)
4652         : XXX Should be a Configure test for double-dots in filenames.
4653         version=`echo $baserev $patchlevel $subversion | \
4654                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4655         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4656                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4657         ;;
4658 *)
4659         version=`echo $baserev $patchlevel $subversion | \
4660                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4661         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4662                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4663         ;;
4664 esac
4665 : Special case the 5.005_xx maintenance series, which used 5.005
4666 : without any subversion label as a subdirectory in $sitelib
4667 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4668         api_versionstring='5.005'
4669 fi
4670
4671 : determine installation style
4672 : For now, try to deduce it from prefix unless it is already set.
4673 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4674 case "$installstyle" in
4675 '')     case "$prefix" in
4676                 *perl*) dflt='lib';;
4677                 *) dflt='lib/perl5' ;;
4678         esac
4679         ;;
4680 *)      dflt='lib/perl5' ;;
4681 esac
4682 : Probably not worth prompting for this since we prompt for all
4683 : the directories individually, and the prompt would be too long and
4684 : confusing anyway.
4685 installstyle=$dflt
4686
4687 : determine where private library files go
4688 : Usual default is /usr/local/lib/perl5/$version.
4689 : Also allow things like /opt/perl/lib/$version, since 
4690 : /opt/perl/lib/perl5... would be redundant.
4691 : The default "style" setting is made in installstyle.U
4692 case "$installstyle" in
4693 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4694 *)       set dflt privlib lib/$version ;;
4695 esac
4696 eval $prefixit
4697 $cat <<EOM
4698
4699 There are some auxiliary files for $package that need to be put into a
4700 private library directory that is accessible by everyone.
4701
4702 EOM
4703 fn=d~+
4704 rp='Pathname where the private library files will reside?'
4705 . ./getfile
4706 privlib="$ans"
4707 privlibexp="$ansexp"
4708 : Change installation prefix, if necessary.
4709 if $test X"$prefix" != X"$installprefix"; then
4710         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4711 else
4712         installprivlib="$privlibexp"
4713 fi
4714
4715 : set the prefixup variable, to restore leading tilda escape
4716 prefixup='case "$prefixexp" in
4717 "$prefix") ;;
4718 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4719 esac'
4720
4721 : determine where public architecture dependent libraries go
4722 set archlib archlib
4723 eval $prefixit
4724 : privlib default is /usr/local/lib/$package/$version
4725 : archlib default is /usr/local/lib/$package/$version/$archname
4726 : privlib may have an optional trailing /share.
4727 tdflt=`echo $privlib | $sed 's,/share$,,'`
4728 tdflt=$tdflt/$archname
4729 case "$archlib" in
4730 '')     dflt=$tdflt
4731         ;;
4732 *)      dflt="$archlib"
4733     ;;
4734 esac
4735 $cat <<EOM
4736
4737 $spackage contains architecture-dependent library files.  If you are
4738 sharing libraries in a heterogeneous environment, you might store
4739 these files in a separate location.  Otherwise, you can just include
4740 them with the rest of the public library files.
4741
4742 EOM
4743 fn=d+~
4744 rp='Where do you want to put the public architecture-dependent libraries?'
4745 . ./getfile
4746 archlib="$ans"
4747 archlibexp="$ansexp"
4748 if $test X"$archlib" = X"$privlib"; then
4749         d_archlib="$undef"
4750 else
4751         d_archlib="$define"
4752 fi
4753 : Change installation prefix, if necessary.
4754 if $test X"$prefix" != X"$installprefix"; then
4755         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4756 else
4757         installarchlib="$archlibexp"
4758 fi
4759
4760
4761 : Binary compatibility with 5.005 is not possible for builds
4762 : with advanced features
4763 case "$usethreads$usemultiplicity" in
4764 *define*)
4765         bincompat5005="$undef"
4766         d_bincompat5005="$undef"
4767         ;;
4768 *)      $cat <<EOM
4769
4770 Perl 5.006 can be compiled for binary compatibility with 5.005.
4771 If you decide to do so, you will be able to continue using most
4772 of the extensions that were compiled for Perl 5.005.
4773
4774 EOM
4775         case "$bincompat5005$d_bincompat5005" in
4776         *"$undef"*) dflt=n ;;
4777         *) dflt=y ;;
4778         esac
4779         rp='Binary compatibility with Perl 5.005?'
4780         . ./myread
4781         case "$ans" in
4782         y*) val="$define" ;;
4783         *)  val="$undef" ;;
4784         esac
4785         set d_bincompat5005
4786         eval $setvar
4787         case "$d_bincompat5005" in
4788         "$define")
4789                 bincompat5005="$define"
4790                 ;;
4791         *)      bincompat5005="$undef"
4792                 d_bincompat5005="$undef"
4793                 ;;
4794         esac
4795         ;;
4796 esac
4797
4798
4799 : see if setuid scripts can be secure
4800 $cat <<EOM
4801
4802 Some kernels have a bug that prevents setuid #! scripts from being
4803 secure.  Some sites have disabled setuid #! scripts because of this.
4804
4805 First let's decide if your kernel supports secure setuid #! scripts.
4806 (If setuid #! scripts would be secure but have been disabled anyway,
4807 don't say that they are secure if asked.)
4808
4809 EOM
4810
4811 val="$undef"
4812 if $test -d /dev/fd; then
4813         echo "#!$ls" >reflect
4814         chmod +x,u+s reflect
4815         ./reflect >flect 2>&1
4816         if $contains "/dev/fd" flect >/dev/null; then
4817                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4818                 val="$define"
4819         else
4820                 $cat <<EOM
4821 If you are not sure if they are secure, I can check but I'll need a
4822 username and password different from the one you are using right now.
4823 If you don't have such a username or don't want me to test, simply
4824 enter 'none'.
4825
4826 EOM
4827                 rp='Other username to test security of setuid scripts with?'
4828                 dflt='none'
4829                 . ./myread
4830                 case "$ans" in
4831                 n|none)
4832                         case "$d_suidsafe" in
4833                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4834                                 dflt=n;;
4835                         "$undef")
4836                                 echo "Well, the $hint value is *not* secure." >&4
4837                                 dflt=n;;
4838                         *)      echo "Well, the $hint value *is* secure." >&4
4839                                 dflt=y;;
4840                         esac
4841                         ;;
4842                 *)
4843                         $rm -f reflect flect
4844                         echo "#!$ls" >reflect
4845                         chmod +x,u+s reflect
4846                         echo >flect
4847                         chmod a+w flect
4848                         echo '"su" will (probably) prompt you for '"$ans's password."
4849                         su $ans -c './reflect >flect'
4850                         if $contains "/dev/fd" flect >/dev/null; then
4851                                 echo "Okay, it looks like setuid scripts are secure." >&4
4852                                 dflt=y
4853                         else
4854                                 echo "I don't think setuid scripts are secure." >&4
4855                                 dflt=n
4856                         fi
4857                         ;;
4858                 esac
4859                 rp='Does your kernel have *secure* setuid scripts?'
4860                 . ./myread
4861                 case "$ans" in
4862                 [yY]*)  val="$define";;
4863                 *)      val="$undef";;
4864                 esac
4865         fi
4866 else
4867         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4868         echo "(That's for file descriptors, not floppy disks.)"
4869         val="$undef"
4870 fi
4871 set d_suidsafe
4872 eval $setvar
4873
4874 $rm -f reflect flect
4875
4876 : now see if they want to do setuid emulation
4877 echo " "
4878 val="$undef"
4879 case "$d_suidsafe" in
4880 "$define")
4881         val="$undef"
4882         echo "No need to emulate SUID scripts since they are secure here." >& 4
4883         ;;
4884 *)
4885         $cat <<EOM
4886 Some systems have disabled setuid scripts, especially systems where
4887 setuid scripts cannot be secure.  On systems where setuid scripts have
4888 been disabled, the setuid/setgid bits on scripts are currently
4889 useless.  It is possible for $package to detect those bits and emulate
4890 setuid/setgid in a secure fashion.  This emulation will only work if
4891 setuid scripts have been disabled in your kernel.
4892
4893 EOM
4894         case "$d_dosuid" in
4895         "$define") dflt=y ;;
4896         *) dflt=n ;;
4897         esac
4898         rp="Do you want to do setuid/setgid emulation?"
4899         . ./myread
4900         case "$ans" in
4901         [yY]*)  val="$define";;
4902         *)      val="$undef";;
4903         esac
4904         ;;
4905 esac
4906 set d_dosuid
4907 eval $setvar
4908
4909 : determine filename position in cpp output
4910 echo " "
4911 echo "Computing filename position in cpp output for #include directives..." >&4
4912 echo '#include <stdio.h>' > foo.c
4913 $cat >fieldn <<EOF
4914 $startsh
4915 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4916 $grep '^[       ]*#.*stdio\.h' | \
4917 while read cline; do
4918         pos=1
4919         set \$cline
4920         while $test \$# -gt 0; do
4921                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4922                         echo "\$pos"
4923                         exit 0
4924                 fi
4925                 shift
4926                 pos=\`expr \$pos + 1\`
4927         done
4928 done
4929 EOF
4930 chmod +x fieldn
4931 fieldn=`./fieldn`
4932 $rm -f foo.c fieldn
4933 case $fieldn in
4934 '') pos='???';;
4935 1) pos=first;;
4936 2) pos=second;;
4937 3) pos=third;;
4938 *) pos="${fieldn}th";;
4939 esac
4940 echo "Your cpp writes the filename in the $pos field of the line."
4941
4942 : locate header file
4943 $cat >findhdr <<EOF
4944 $startsh
4945 wanted=\$1
4946 name=''
4947 for usrincdir in $usrinc
4948 do
4949         if test -f \$usrincdir/\$wanted; then
4950                 echo "\$usrincdir/\$wanted"
4951                 exit 0
4952         fi
4953 done
4954 awkprg='{ print \$$fieldn }'
4955 echo "#include <\$wanted>" > foo\$\$.c
4956 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4957 $grep "^[       ]*#.*\$wanted" | \
4958 while read cline; do
4959         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4960         case "\$name" in
4961         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4962         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4963         *) exit 2;;
4964         esac;
4965 done;
4966 #
4967 # status = 0: grep returned 0 lines, case statement not executed
4968 # status = 1: headerfile found
4969 # status = 2: while loop executed, no headerfile found
4970 #
4971 status=\$?
4972 $rm -f foo\$\$.c;
4973 if test \$status -eq 1; then
4974         exit 0;
4975 fi
4976 exit 1
4977 EOF
4978 chmod +x findhdr
4979
4980 : define an alternate in-header-list? function
4981 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4982 cont=true; xxf="echo \"<\$1> found.\" >&4";
4983 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4984 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4985 esac;
4986 case $# in 4) instead=instead;; *) instead="at last";; esac;
4987 while $test "$cont"; do
4988         xxx=`./findhdr $1`
4989         var=$2; eval "was=\$$2";
4990         if $test "$xxx" && $test -r "$xxx";
4991         then eval $xxf;
4992         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4993                 cont="";
4994         else eval $xxnf;
4995         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4996         set $yyy; shift; shift; yyy=$@;
4997         case $# in 0) cont="";;
4998         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4999                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5000         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5001                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5002         esac;
5003 done;
5004 while $test "$yyy";
5005 do set $yyy; var=$2; eval "was=\$$2";
5006         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5007         set $yyy; shift; shift; yyy=$@;
5008 done'
5009
5010 : see if this is a malloc.h system
5011 set malloc.h i_malloc
5012 eval $inhdr
5013
5014 : see if stdlib is available
5015 set stdlib.h i_stdlib
5016 eval $inhdr
5017
5018 : determine which malloc to compile in
5019 echo " "
5020 case "$usemymalloc" in
5021 ''|[yY]*|true|$define)  dflt='y' ;;
5022 *)      dflt='n' ;;
5023 esac
5024 rp="Do you wish to attempt to use the malloc that comes with $package?"
5025 . ./myread
5026 usemymalloc="$ans"
5027 case "$ans" in
5028 y*|true)
5029         usemymalloc='y'
5030         mallocsrc='malloc.c'
5031         mallocobj="malloc$_o"
5032         d_mymalloc="$define"
5033         case "$libs" in
5034         *-lmalloc*)
5035                 : Remove malloc from list of libraries to use
5036                 echo "Removing unneeded -lmalloc from library list" >&4
5037                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5038                 shift
5039                 libs="$*"
5040                 echo "libs = $libs" >&4
5041                 ;;
5042         esac
5043         ;;
5044 *)
5045         usemymalloc='n'
5046         mallocsrc=''
5047         mallocobj=''
5048         d_mymalloc="$undef"
5049         ;;
5050 esac
5051
5052 : compute the return types of malloc and free
5053 echo " "
5054 $cat >malloc.c <<END
5055 #$i_malloc I_MALLOC
5056 #$i_stdlib I_STDLIB
5057 #include <stdio.h>
5058 #include <sys/types.h>
5059 #ifdef I_MALLOC
5060 #include <malloc.h>
5061 #endif
5062 #ifdef I_STDLIB
5063 #include <stdlib.h>
5064 #endif
5065 #ifdef TRY_MALLOC
5066 void *malloc();
5067 #endif
5068 #ifdef TRY_FREE
5069 void free();
5070 #endif
5071 END
5072 case "$malloctype" in
5073 '')
5074         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5075                 malloctype='void *'
5076         else
5077                 malloctype='char *'
5078         fi
5079         ;;
5080 esac
5081 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5082
5083 case "$freetype" in
5084 '')
5085         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5086                 freetype='void'
5087         else
5088                 freetype='int'
5089         fi
5090         ;;
5091 esac
5092 echo "Your system uses $freetype free(), it would seem." >&4
5093 $rm -f malloc.[co]
5094 $cat <<EOM
5095
5096 The installation process will also create a directory for
5097 vendor-supplied add-ons.  Vendors who supply perl with their system
5098 may find it convenient to place all vendor-supplied files in this
5099 directory rather than in the main distribution directory.  This will
5100 ease upgrades between binary-compatible maintenance versions of perl.
5101
5102 Of course you may also use these directories in whatever way you see
5103 fit.  For example, you might use them to access modules shared over a
5104 company-wide network.
5105
5106 The default answer should be fine for most people.
5107 This causes further questions about vendor add-ons to be skipped
5108 and no vendor-specific directories will be configured for perl.
5109
5110 EOM
5111 rp='Do you want to configure vendor-specific add-on directories?'
5112 case "$usevendorprefix" in
5113 define|true|[yY]*) dflt=y ;;
5114 *) dflt=n ;;
5115 esac
5116 . ./myread
5117 case "$ans" in
5118 [yY]*)  fn=d~+
5119         rp='Installation prefix to use for vendor-supplied add-ons?'
5120         case "$vendorprefix" in
5121         '') dflt='' ;;
5122         *)  dflt=$vendorprefix ;;
5123         esac
5124         . ./getfile
5125         oldvendorprefix=''
5126         case "$vendorprefix" in
5127         '') ;;
5128         *)      case "$ans" in
5129                 "$prefix") ;;
5130                 *) oldvendorprefix="$prefix";;
5131                 esac
5132                 ;;
5133         esac
5134         usevendorprefix="$define"
5135         vendorprefix="$ans"
5136         vendorprefixexp="$ansexp"
5137         ;;
5138 *)      usevendorprefix="$undef"
5139         vendorprefix=''
5140         vendorprefixexp=''
5141         ;;
5142 esac
5143
5144 case "$vendorprefix" in
5145 '')     d_vendorlib="$undef"
5146         vendorlib=''
5147         vendorlibexp=''
5148         ;;
5149 *)      d_vendorlib="$define"
5150         : determine where vendor-supplied modules go.
5151         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5152         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5153         case "$installstyle" in
5154         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5155         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5156         esac
5157         fn=d~+
5158         rp='Pathname for the vendor-supplied library files?'
5159         . ./getfile
5160         vendorlib="$ans"
5161         vendorlibexp="$ansexp"
5162         : Change installation prefix, if necessary.
5163         if $test X"$prefix" != X"$installprefix"; then
5164                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5165         else
5166                 installvendorlib="$vendorlibexp"
5167         fi
5168         ;;
5169 esac
5170
5171 : Cruising for prototypes
5172 echo " "
5173 echo "Checking out function prototypes..." >&4
5174 $cat >prototype.c <<'EOCP'
5175 int main(int argc, char *argv[]) {
5176         exit(0);}
5177 EOCP
5178 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5179         echo "Your C compiler appears to support function prototypes."
5180         val="$define"
5181 else
5182         echo "Your C compiler doesn't seem to understand function prototypes."
5183         val="$undef"
5184 fi
5185 set prototype
5186 eval $setvar
5187 $rm -f prototype*
5188
5189 case "$prototype" in
5190 "$define") ;;
5191 *)      ansi2knr='ansi2knr'
5192         echo " "
5193         cat <<EOM >&4
5194
5195 $me:  FATAL ERROR:
5196 This version of $package can only be compiled by a compiler that 
5197 understands function prototypes.  Unfortunately, your C compiler 
5198         $cc $ccflags
5199 doesn't seem to understand them.  Sorry about that.
5200
5201 If GNU cc is available for your system, perhaps you could try that instead.  
5202
5203 Eventually, we hope to support building Perl with pre-ANSI compilers.
5204 If you would like to help in that effort, please contact <perlbug@perl.org>.
5205
5206 Aborting Configure now.
5207 EOM
5208         exit 2
5209         ;;
5210 esac
5211
5212 : determine where public executables go
5213 echo " "
5214 set dflt bin bin
5215 eval $prefixit
5216 fn=d~
5217 rp='Pathname where the public executables will reside?'
5218 . ./getfile
5219 if $test "X$ansexp" != "X$binexp"; then
5220         installbin=''
5221 fi
5222 bin="$ans"
5223 binexp="$ansexp"
5224 : Change installation prefix, if necessary.
5225 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5226 if $test X"$prefix" != X"$installprefix"; then
5227         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5228 else
5229         installbin="$binexp"
5230 fi
5231
5232 $cat <<EOM
5233
5234 After $package is installed, you may wish to install various
5235 add-on modules and utilities.  Typically, these add-ons will
5236 be installed under $prefix with the rest
5237 of this package.  However, you may wish to install such add-ons
5238 elsewhere under a different prefix.
5239
5240 If you do not wish to put everything under a single prefix, that's
5241 ok.  You will be prompted for the individual locations; this siteprefix
5242 is only used to suggest the defaults.
5243
5244 The default should be fine for most people.
5245
5246 EOM
5247 fn=d~+
5248 rp='Installation prefix to use for add-on modules and utilities?'
5249 : XXX Here might be another good place for an installstyle setting.
5250 case "$siteprefix" in
5251 '') dflt=$prefix ;;
5252 *)  dflt=$siteprefix ;;
5253 esac
5254 . ./getfile
5255 oldsiteprefix=''
5256 case "$siteprefix" in
5257 '') ;;
5258 *)
5259         case "$ans" in
5260         "$prefix") ;;
5261         *) oldsiteprefix="$prefix";;
5262         esac
5263         ;;
5264 esac
5265 siteprefix="$ans"
5266 siteprefixexp="$ansexp"
5267
5268 : determine where site specific libraries go.
5269 : Usual default is /usr/local/lib/perl5/site_perl/$version
5270 : The default "style" setting is made in installstyle.U
5271 : XXX No longer works with Prefixit stuff.
5272 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5273 case "$installstyle" in
5274 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5275 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5276 esac
5277 $cat <<EOM
5278
5279 The installation process will create a directory for
5280 site-specific extensions and modules.  Most users find it convenient
5281 to place all site-specific files in this directory rather than in the
5282 main distribution directory.
5283
5284 EOM
5285 fn=d~+
5286 rp='Pathname for the site-specific library files?'
5287 . ./getfile
5288 sitelib="$ans"
5289 sitelibexp="$ansexp"
5290 : Change installation prefix, if necessary.
5291 if $test X"$prefix" != X"$installprefix"; then
5292         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5293 else
5294         installsitelib="$sitelibexp"
5295 fi
5296
5297 : Determine list of previous versions to include in @INC
5298 $cat > getverlist <<EOPL
5299 #!$perl -w
5300 use File::Basename;
5301 \$api_versionstring = "$api_versionstring";
5302 \$version = "$version";
5303 \$sitelib = "$sitelib";
5304 \$archname = "$archname";
5305 EOPL
5306         $cat >> getverlist <<'EOPL'
5307 # Can't have leading @ because metaconfig interprets it as a command!
5308 ;@inc_version_list=();
5309 $stem=dirname($sitelib);
5310 # Redo to do opendir/readdir? 
5311 if (-d $stem) {
5312     chdir($stem);
5313     ;@candidates = glob("5.*");
5314 }
5315 else {
5316     ;@candidates = ();
5317 }
5318
5319 # XXX ToDo:  These comparisons must be reworked when two-digit
5320 # subversions come along, so that 5.7.10 compares as greater than
5321 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5322 # widespread that we can use the built-in version vectors rather
5323 # than reinventing them here.  For 5.6.0, however, we must
5324 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5325 foreach $d (@candidates) {
5326     if ($d lt $version) {
5327         if ($d ge $api_versionstring) {
5328             unshift(@inc_version_list, "$d/$archname", $d);
5329         }
5330         elsif ($d ge "5.005") {
5331             unshift(@inc_version_list, $d);
5332         }
5333     }
5334     else {
5335         # Skip newer version.  I.e. don't look in
5336         # 5.7.0 if we're installing 5.6.1.
5337     }
5338 }
5339
5340 if (@inc_version_list) {
5341     print join(' ', @inc_version_list);
5342 }
5343 else {
5344     # Blank space to preserve value for next Configure run.
5345     print " ";
5346 }
5347 EOPL
5348 chmod +x getverlist
5349 case "$inc_version_list" in
5350 '')     if test -x $perl; then
5351                 dflt=`$perl getverlist`
5352         else
5353                 dflt='none'
5354         fi
5355         ;;
5356 $undef) dflt='none' ;;
5357 *)  dflt="$inc_version_list" ;;
5358 esac
5359 $cat <<'EOM'
5360
5361 In order to ease the process of upgrading, this version of perl 
5362 can be configured to use modules built and installed with earlier 
5363 versions of perl that were installed under $prefix.  Specify here
5364 the list of earlier versions that this version of perl should check.
5365 If Configure detected no earlier versions of perl installed under
5366 $prefix, then the list will be empty.  Answer 'none' to tell perl
5367 to not search earlier versions.
5368
5369 The default should almost always be sensible, so if you're not sure,
5370 just accept the default.
5371 EOM
5372
5373 rp='List of earlier versions to include in @INC?'
5374 . ./myread
5375 case "$ans" in
5376 [Nn]one) inc_version_list=' ' ;;
5377 *) inc_version_list="$ans" ;;
5378 esac
5379 case "$inc_version_list" in
5380 ''|' ') 
5381         inc_version_list_init='0';;
5382 *)      inc_version_list_init=`echo $inc_version_list |
5383                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5384         ;;
5385 esac
5386 $rm -f getverlist
5387
5388 : determine whether to install perl also as /usr/bin/perl
5389
5390 echo " "
5391 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5392         $cat <<EOM
5393 Many scripts expect to perl to be installed as /usr/bin/perl.
5394 I can install the perl you are about to compile also as /usr/bin/perl
5395 (in addition to $installbin/perl).
5396 EOM
5397         case "$installusrbinperl" in
5398         "$undef"|[nN]*) dflt='n';;
5399         *)              dflt='y';;
5400         esac
5401         rp="Do you want to install perl as /usr/bin/perl?"
5402         . ./myread
5403         case "$ans" in
5404         [yY]*)  val="$define";;
5405         *)      val="$undef" ;;
5406         esac
5407 else
5408         val="$undef"
5409 fi
5410 set installusrbinperl
5411 eval $setvar
5412
5413 echo " "
5414 echo "Checking for GNU C Library..." >&4
5415 cat >gnulibc.c <<EOM
5416 #include <stdio.h>
5417 int main()
5418 {
5419 #ifdef __GLIBC__
5420     exit(0);
5421 #else
5422     exit(1);
5423 #endif
5424 }
5425 EOM
5426 set gnulibc
5427 if eval $compile_ok && ./gnulibc; then
5428         val="$define"
5429         echo "You are using the GNU C Library"
5430 else
5431         val="$undef"
5432         echo "You are not using the GNU C Library"
5433 fi
5434 $rm -f gnulibc*
5435 set d_gnulibc
5436 eval $setvar
5437
5438 : see if nm is to be used to determine whether a symbol is defined or not
5439 case "$usenm" in
5440 '')
5441         dflt=''
5442         case "$d_gnulibc" in
5443         "$define")
5444                 echo " "
5445                 echo "nm probably won't work on the GNU C Library." >&4
5446                 dflt=n
5447                 ;;
5448         esac
5449         case "$dflt" in
5450         '') 
5451                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5452                         echo " "
5453                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5454                         echo "'nm' won't be sufficient on this sytem." >&4
5455                         dflt=n
5456                 fi
5457                 ;;
5458         esac
5459         case "$dflt" in
5460         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5461                 if $test $dflt -gt 20; then
5462                         dflt=y
5463                 else
5464                         dflt=n
5465                 fi
5466                 ;;
5467         esac
5468         ;;
5469 *)
5470         case "$usenm" in
5471         true|$define) dflt=y;;
5472         *) dflt=n;;
5473         esac
5474         ;;
5475 esac
5476 $cat <<EOM
5477
5478 I can use $nm to extract the symbols from your C libraries. This
5479 is a time consuming task which may generate huge output on the disk (up
5480 to 3 megabytes) but that should make the symbols extraction faster. The
5481 alternative is to skip the 'nm' extraction part and to compile a small
5482 test program instead to determine whether each symbol is present. If
5483 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5484 this may be the best solution.
5485
5486 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5487
5488 EOM
5489 rp="Shall I use $nm to extract C symbols from the libraries?"
5490 . ./myread
5491 case "$ans" in
5492 [Nn]*) usenm=false;;
5493 *) usenm=true;;
5494 esac
5495
5496 runnm=$usenm
5497 case "$reuseval" in
5498 true) runnm=false;;
5499 esac
5500
5501 : nm options which may be necessary
5502 case "$nm_opt" in
5503 '') if $test -f /mach_boot; then
5504                 nm_opt=''       # Mach
5505         elif $test -d /usr/ccs/lib; then
5506                 nm_opt='-p'     # Solaris (and SunOS?)
5507         elif $test -f /dgux; then
5508                 nm_opt='-p'     # DG-UX
5509         elif $test -f /lib64/rld; then
5510                 nm_opt='-p'     # 64-bit Irix
5511         else
5512                 nm_opt=''
5513         fi;;
5514 esac
5515
5516 : nm options which may be necessary for shared libraries but illegal
5517 : for archive libraries.  Thank you, Linux.
5518 case "$nm_so_opt" in
5519 '')     case "$myuname" in
5520         *linux*)
5521                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5522                         nm_so_opt='--dynamic'
5523                 fi
5524                 ;;
5525         esac
5526         ;;
5527 esac
5528
5529 case "$runnm" in
5530 true)
5531 : get list of predefined functions in a handy place
5532 echo " "
5533 case "$libc" in
5534 '') libc=unknown
5535         case "$libs" in
5536         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5537         esac
5538         ;;
5539 esac
5540 libnames='';
5541 case "$libs" in
5542 '') ;;
5543 *)  for thislib in $libs; do
5544         case "$thislib" in
5545         -lc|-lc_s)
5546                 : Handle C library specially below.
5547                 ;;
5548         -l*)
5549                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5550                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5551                         :
5552                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5553                         :
5554                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5555                         :
5556                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5557                         :
5558                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5559                         :
5560                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5561                         :
5562                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5563                         :
5564                 else
5565                         try=''
5566                 fi
5567                 libnames="$libnames $try"
5568                 ;;
5569         *) libnames="$libnames $thislib" ;;
5570         esac
5571         done
5572         ;;
5573 esac
5574 xxx=normal
5575 case "$libc" in
5576 unknown)
5577         set /lib/libc.$so
5578         for xxx in $libpth; do
5579                 $test -r $1 || set $xxx/libc.$so
5580                 : The messy sed command sorts on library version numbers.
5581                 $test -r $1 || \
5582                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5583                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5584                                 h
5585                                 s/[0-9][0-9]*/0000&/g
5586                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5587                                 G
5588                                 s/\n/ /' | \
5589                          sort | $sed -e 's/^.* //'`
5590                 eval set \$$#
5591         done
5592         $test -r $1 || set /usr/ccs/lib/libc.$so
5593         $test -r $1 || set /lib/libsys_s$_a
5594         ;;
5595 *)
5596         set blurfl
5597         ;;
5598 esac
5599 if $test -r "$1"; then
5600         echo "Your (shared) C library seems to be in $1."
5601         libc="$1"
5602 elif $test -r /lib/libc && $test -r /lib/clib; then
5603         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5604         xxx=apollo
5605         libc='/lib/clib /lib/libc'
5606         if $test -r /lib/syslib; then
5607                 echo "(Your math library is in /lib/syslib.)"
5608                 libc="$libc /lib/syslib"
5609         fi
5610 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5611         echo "Your C library seems to be in $libc, as you said before."
5612 elif $test -r $incpath/usr/lib/libc$_a; then
5613         libc=$incpath/usr/lib/libc$_a;
5614         echo "Your C library seems to be in $libc.  That's fine."
5615 elif $test -r /lib/libc$_a; then
5616         libc=/lib/libc$_a;
5617         echo "Your C library seems to be in $libc.  You're normal."
5618 else
5619         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5620                 :
5621         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5622                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5623         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5624                 :
5625         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5626                 :
5627         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5628                 :
5629         else
5630                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5631         fi
5632         if $test -r "$tans"; then
5633                 echo "Your C library seems to be in $tans, of all places."
5634                 libc=$tans
5635         else
5636                 libc='blurfl'
5637         fi
5638 fi
5639 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5640         dflt="$libc"
5641         cat <<EOM
5642
5643 If the guess above is wrong (which it might be if you're using a strange
5644 compiler, or your machine supports multiple models), you can override it here.
5645
5646 EOM
5647 else
5648         dflt=''
5649         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5650         cat >&4 <<EOM
5651 I can't seem to find your C library.  I've looked in the following places:
5652
5653 EOM
5654         $sed 's/^/      /' libpath
5655         cat <<EOM
5656
5657 None of these seems to contain your C library. I need to get its name...
5658
5659 EOM
5660 fi
5661 fn=f
5662 rp='Where is your C library?'
5663 . ./getfile
5664 libc="$ans"
5665
5666 echo " "
5667 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5668 set X `cat libnames`
5669 shift
5670 xxx=files
5671 case $# in 1) xxx=file; esac
5672 echo "Extracting names from the following $xxx for later perusal:" >&4
5673 echo " "
5674 $sed 's/^/      /' libnames >&4
5675 echo " "
5676 $echo $n "This may take a while...$c" >&4
5677
5678 for file in $*; do
5679         case $file in
5680         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5681         *) $nm $nm_opt $file 2>/dev/null;;
5682         esac
5683 done >libc.tmp
5684
5685 $echo $n ".$c"
5686 $grep fprintf libc.tmp > libc.ptf
5687 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5688 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5689 xxx='[ADTSIW]'
5690 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5691         eval $xscan;\
5692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5693                 eval $xrun
5694 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5695         eval $xscan;\
5696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5697                 eval $xrun
5698 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5699         eval $xscan;\
5700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5701                 eval $xrun
5702 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5703         eval $xscan;\
5704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5705                 eval $xrun
5706 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5707         eval $xscan;\
5708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5709                 eval $xrun
5710 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5711         eval $xscan;\
5712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5713                 eval $xrun
5714 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5715                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5744         eval $xscan;\
5745         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5746                 eval $xrun
5747 else
5748         $nm -p $* 2>/dev/null >libc.tmp
5749         $grep fprintf libc.tmp > libc.ptf
5750         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5751                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5752         then
5753                 nm_opt='-p'
5754                 eval $xrun
5755         else
5756                 echo " "
5757                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5758                 com=''
5759                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5760                         for thisname in $libnames $libc; do
5761                                 $ar t $thisname >>libc.tmp
5762                         done
5763                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5764                         echo "Ok." >&4
5765                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5766                         # Repeat libc to extract forwarders to DLL entries too
5767                         for thisname in $libnames $libc; do
5768                                 $ar tv $thisname >>libc.tmp
5769                                 # Revision 50 of EMX has bug in $ar.
5770                                 # it will not extract forwarders to DLL entries
5771                                 # Use emximp which will extract exactly them.
5772                                 emximp -o tmp.imp $thisname \
5773                                     2>/dev/null && \
5774                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5775                                     < tmp.imp >>libc.tmp
5776                                 $rm tmp.imp
5777                         done
5778                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5779                         echo "Ok." >&4
5780                 else
5781                         echo "$ar didn't seem to work right." >&4
5782                         echo "Maybe this is a Cray...trying bld instead..." >&4
5783                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5784                         then
5785                                 for thisname in $libnames; do
5786                                         bld t $libnames | \
5787                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5788                                         $ar t $thisname >>libc.tmp
5789                                 done
5790                                 echo "Ok." >&4
5791                         else
5792                                 echo "That didn't work either.  Giving up." >&4
5793                                 exit 1
5794                         fi
5795                 fi
5796         fi
5797 fi
5798 nm_extract="$com"
5799 if $test -f /lib/syscalls.exp; then
5800         echo " "
5801         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5802         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5803 fi
5804 ;;
5805 esac
5806 $rm -f libnames libpath
5807
5808 : see if dld is available
5809 set dld.h i_dld
5810 eval $inhdr
5811
5812 : is a C symbol defined?
5813 csym='tlook=$1;
5814 case "$3" in
5815 -v) tf=libc.tmp; tc=""; tdc="";;
5816 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5817 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5818 esac;
5819 tx=yes;
5820 case "$reuseval-$4" in
5821 true-) ;;
5822 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5823 esac;
5824 case "$tx" in
5825 yes)
5826         case "$runnm" in
5827         true)
5828                 if $contains $tlook $tf >/dev/null 2>&1;
5829                 then tval=true;
5830                 else tval=false;
5831                 fi;;
5832         *)
5833                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5834                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5835                 then tval=true;
5836                 else tval=false;
5837                 fi;
5838                 $rm -f t t.c;;
5839         esac;;
5840 *)
5841         case "$tval" in
5842         $define) tval=true;;
5843         *) tval=false;;
5844         esac;;
5845 esac;
5846 eval "$2=$tval"'
5847
5848 : define an is-in-libc? function
5849 inlibc='echo " "; td=$define; tu=$undef;
5850 sym=$1; var=$2; eval "was=\$$2";
5851 tx=yes;
5852 case "$reuseval$was" in
5853 true) ;;
5854 true*) tx=no;;
5855 esac;
5856 case "$tx" in
5857 yes)
5858         set $sym tres -f;
5859         eval $csym;
5860         case "$tres" in
5861         true)
5862                 echo "$sym() found." >&4;
5863                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5864         *)
5865                 echo "$sym() NOT found." >&4;
5866                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5867         esac;;
5868 *)
5869         case "$was" in
5870         $define) echo "$sym() found." >&4;;
5871         *) echo "$sym() NOT found." >&4;;
5872         esac;;
5873 esac'
5874
5875 : see if dlopen exists
5876 xxx_runnm="$runnm"
5877 runnm=false
5878 set dlopen d_dlopen
5879 eval $inlibc
5880 runnm="$xxx_runnm"
5881
5882 : determine which dynamic loading, if any, to compile in
5883 echo " "
5884 dldir="ext/DynaLoader"
5885 case "$usedl" in
5886 $define|y|true)
5887         dflt='y'
5888         usedl="$define"
5889         ;;
5890 $undef|n|false)
5891         dflt='n'
5892         usedl="$undef"
5893         ;;
5894 *) 
5895         dflt='n'
5896         case "$d_dlopen" in
5897             $define) dflt='y' ;;
5898         esac
5899         case "$i_dld" in
5900             $define) dflt='y' ;;
5901         esac
5902         : Does a dl_xxx.xs file exist for this operating system
5903         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5904         ;;
5905 esac
5906 rp="Do you wish to use dynamic loading?"
5907 . ./myread
5908 usedl="$ans"
5909 case "$ans" in
5910 y*) usedl="$define"
5911         case "$dlsrc" in
5912         '')
5913                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5914                         dflt="$dldir/dl_${osname}.xs"
5915                 elif $test "$d_dlopen" = "$define" ; then
5916                         dflt="$dldir/dl_dlopen.xs"
5917                 elif $test "$i_dld" = "$define" ; then
5918                         dflt="$dldir/dl_dld.xs"
5919                 else
5920                         dflt=''
5921                 fi
5922                 ;;
5923         *)      dflt="$dldir/$dlsrc"
5924                 ;;
5925         esac
5926     echo "The following dynamic loading files are available:"
5927         : Can not go over to $dldir because getfile has path hard-coded in.
5928         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5929         rp="Source file to use for dynamic loading"
5930         fn="fne"
5931         gfpth="$src"
5932         . ./getfile
5933         usedl="$define"
5934         : emulate basename
5935         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5936
5937         $cat << EOM
5938
5939 Some systems may require passing special flags to $cc -c to
5940 compile modules that will be used to create a shared library.
5941 To use no flags, say "none".
5942
5943 EOM
5944     case "$cccdlflags" in
5945     '') case "$gccversion" in
5946                 '') case "$osname" in
5947                         hpux)   dflt='+z' ;;
5948                         next)   dflt='none' ;;
5949                         irix*)  dflt='-KPIC' ;;
5950                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5951                         sunos)  dflt='-pic' ;;
5952                         *)      dflt='none' ;;
5953                     esac
5954                         ;;
5955                 *)  case "$osname" in
5956                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5957                         *)      dflt='-fpic' ;;
5958                     esac ;;
5959             esac ;;
5960         ' ') dflt='none' ;;
5961     *)  dflt="$cccdlflags" ;;
5962     esac
5963     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5964     . ./myread
5965     case "$ans" in
5966     none) cccdlflags=' ' ;;
5967     *) cccdlflags="$ans" ;;
5968     esac
5969
5970     cat << EOM
5971
5972 Some systems use ld to create libraries that can be dynamically loaded,
5973 while other systems (such as those using ELF) use $cc.
5974
5975 EOM
5976         case "$ld" in
5977         '')     $cat >try.c <<'EOM'
5978 /* Test for whether ELF binaries are produced */
5979 #include <fcntl.h>
5980 #include <stdlib.h>
5981 int main() {
5982         char b[4];
5983         int i = open("a.out",O_RDONLY);
5984         if(i == -1) 
5985                 exit(1); /* fail */
5986         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5987                 exit(0); /* succeed (yes, it's ELF) */
5988         else
5989                 exit(1); /* fail */
5990 }
5991 EOM
5992                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5993                         cat <<EOM
5994 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5995 EOM
5996                         dflt="$cc"
5997                 else
5998                         echo "I'll use ld to build dynamic libraries."
5999                         dflt='ld'
6000                 fi
6001                 rm -f try.c a.out
6002                 ;;
6003         *)      dflt="$ld"
6004                 ;;
6005         esac
6006
6007     rp="What command should be used to create dynamic libraries?"
6008     . ./myread
6009         ld="$ans"
6010
6011     cat << EOM
6012
6013 Some systems may require passing special flags to $ld to create a
6014 library that can be dynamically loaded.  If your ld flags include
6015 -L/other/path options to locate libraries outside your loader's normal
6016 search path, you may need to specify those -L options here as well.  To
6017 use no flags, say "none".
6018
6019 EOM
6020     case "$lddlflags" in
6021     '') case "$osname" in
6022                         beos) dflt='-nostart' ;;
6023                         hpux)  dflt='-b' ;;
6024                         linux|irix*)    dflt='-shared' ;;
6025                         next)  dflt='none' ;;
6026                         solaris) dflt='-G' ;;
6027                         sunos) dflt='-assert nodefinitions' ;;
6028                         svr4*|esix*) dflt="-G $ldflags" ;;
6029                 *)     dflt='none' ;;
6030                         esac
6031                         ;;
6032     *) dflt="$lddlflags" ;;
6033     esac
6034
6035         : Try to guess additional flags to pick up local libraries.
6036         : Be careful not to append to a plain 'none'
6037         case "$dflt" in
6038         none) dflt='' ;;
6039         esac
6040         for thisflag in $ldflags; do
6041                 case "$thisflag" in
6042                 -L*)
6043                         case " $dflt " in
6044                         *" $thisflag "*) ;;
6045                         *) dflt="$dflt $thisflag" ;;
6046                         esac
6047                         ;;
6048                 esac
6049         done
6050
6051         case "$dflt" in
6052         ''|' ') dflt='none' ;;
6053         esac
6054
6055     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6056     . ./myread
6057     case "$ans" in
6058     none) lddlflags=' ' ;;
6059     *) lddlflags="$ans" ;;
6060     esac
6061
6062         cat <<EOM
6063
6064 Some systems may require passing special flags to $cc to indicate that
6065 the resulting executable will use dynamic linking.  To use no flags,
6066 say "none".
6067
6068 EOM
6069     case "$ccdlflags" in
6070     '') case "$osname" in
6071                 hpux)   dflt='-Wl,-E' ;;
6072                 linux)  dflt='-rdynamic' ;;
6073                 next)   dflt='none' ;;
6074                 sunos)  dflt='none' ;;
6075                 *)      dflt='none' ;;
6076             esac ;;
6077     ' ')  dflt='none' ;;
6078     *)  dflt="$ccdlflags" ;;
6079     esac
6080     rp="Any special flags to pass to $cc to use dynamic linking?"
6081     . ./myread
6082     case "$ans" in
6083     none) ccdlflags=' ' ;;
6084     *) ccdlflags="$ans" ;;
6085     esac
6086     ;;
6087 *)  usedl="$undef"
6088         ld='ld'
6089     dlsrc='dl_none.xs'
6090     lddlflags=''
6091     ccdlflags=''
6092     ;;
6093 esac
6094
6095 also=''
6096 case "$usedl" in
6097 $undef)
6098         # No dynamic loading being used, so don't bother even to prompt.
6099         useshrplib='false'
6100         ;;
6101 *)      case "$useshrplib" in
6102         '')     case "$osname" in
6103                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6104                         dflt=y
6105                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6106                         ;;
6107                 next*)
6108                         case "$osvers" in
6109                         4*)     dflt=y
6110                                 also='Building a shared libperl is needed for MAB support.'
6111                                 ;;
6112                         *)      dflt=n
6113                                 ;;
6114                         esac
6115                         ;;
6116                 *)      dflt=n
6117                         ;;
6118                 esac
6119                 ;;
6120         $define|true|[Yy]*)
6121                 dflt=y
6122                 ;;
6123         *)      dflt=n
6124                 ;;
6125         esac
6126         $cat << EOM
6127
6128 The perl executable is normally obtained by linking perlmain.c with
6129 libperl${_a}, any static extensions (usually just DynaLoader), and
6130 any other libraries needed on this system (such as -lm, etc.).  Since
6131 your system supports dynamic loading, it is probably possible to build
6132 a shared libperl.$so.  If you will have more than one executable linked
6133 to libperl.$so, this will significantly reduce the size of each
6134 executable, but it may have a noticeable affect on performance.  The
6135 default is probably sensible for your system.
6136 $also
6137
6138 EOM
6139         rp="Build a shared libperl.$so (y/n)"
6140         . ./myread
6141         case "$ans" in
6142         true|$define|[Yy]*)
6143                 useshrplib='true'  ;;
6144         *)      useshrplib='false' ;;
6145         esac
6146         ;;
6147 esac
6148
6149 case "$useshrplib" in
6150 true)
6151         case "$libperl" in
6152         '')
6153                 # Figure out a good name for libperl.so.  Since it gets stored in
6154                 # a version-specific architecture-dependent library, the version
6155                 # number isn't really that important, except for making cc/ld happy.
6156                 #
6157                 # A name such as libperl.so.3.1
6158                 majmin="libperl.$so.$patchlevel.$subversion"
6159                 # A name such as libperl.so.301
6160                 majonly=`echo $patchlevel $subversion |
6161                         $awk '{printf "%d%02d", $1, $2}'`
6162                 majonly=libperl.$so.$majonly
6163                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6164                 # rely on figuring it out from the naming of libc.
6165                 case "${osname}${osvers}" in
6166                 next4*)
6167                         dflt=libperl.5.$so
6168                         # XXX How handle the --version stuff for MAB?
6169                         ;;
6170                 linux*)  # ld won't link with a bare -lperl otherwise.
6171                         dflt=libperl.$so
6172                         ;;
6173                 cygwin*) # include version
6174                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6175                         ;;
6176                 *)      # Try to guess based on whether libc has major.minor.
6177                         case "$libc" in
6178                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6179                         *libc.$so.[0-9]*) dflt=$majonly ;;
6180                         *)      dflt=libperl.$so ;;
6181                         esac
6182                         ;;
6183                 esac
6184                 ;;
6185         *)      dflt=$libperl
6186                 ;;
6187         esac
6188         cat << EOM
6189
6190 I need to select a good name for the shared libperl.  If your system uses
6191 library names with major and minor numbers, then you might want something
6192 like $majmin.  Alternatively, if your system uses a single version
6193 number for shared libraries, then you might want to use $majonly.
6194 Or, your system might be quite happy with a simple libperl.$so.
6195
6196 Since the shared libperl will get installed into a version-specific
6197 architecture-dependent directory, the version number of the shared perl
6198 library probably isn't important, so the default should be o.k.
6199
6200 EOM
6201         rp='What name do you want to give to the shared libperl?'
6202         . ./myread
6203         libperl=$ans
6204         echo "Ok, I'll use $libperl"
6205         ;;
6206 *)
6207         libperl="libperl${_a}"
6208         ;;
6209 esac
6210
6211 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6212 case "$shrpdir" in
6213 '') ;;
6214 *)      $cat >&4 <<EOM
6215 WARNING:  Use of the shrpdir variable for the installation location of
6216 the shared $libperl is not supported.  It was never documented and
6217 will not work in this version.  Let me (perlbug@perl.com)
6218 know of any problems this may cause.
6219
6220 EOM
6221         case "$shrpdir" in
6222         "$archlibexp/CORE")
6223                 $cat >&4 <<EOM
6224 But your current setting of $shrpdir is
6225 the default anyway, so it's harmless.
6226 EOM
6227                 ;;
6228         *)
6229                 $cat >&4 <<EOM
6230 Further, your current attempted setting of $shrpdir
6231 conflicts with the value of $archlibexp/CORE
6232 that installperl will use.
6233 EOM
6234                 ;;
6235         esac
6236         ;;
6237 esac
6238
6239 # How will the perl executable find the installed shared $libperl?
6240 # Add $xxx to ccdlflags.
6241 # If we can't figure out a command-line option, use $shrpenv to
6242 # set env LD_RUN_PATH.  The main perl makefile uses this.
6243 shrpdir=$archlibexp/CORE
6244 xxx=''
6245 tmp_shrpenv=''
6246 if "$useshrplib"; then
6247     case "$osname" in 
6248         aix)
6249                 # We'll set it in Makefile.SH...
6250                 ;;
6251         solaris|netbsd)
6252                 xxx="-R $shrpdir"
6253                 ;;
6254         freebsd)
6255                 xxx="-Wl,-R$shrpdir"
6256                 ;;
6257         linux|irix*|dec_osf)
6258                 xxx="-Wl,-rpath,$shrpdir"
6259                 ;;
6260         next)
6261                 # next doesn't like the default...
6262                 ;;
6263         beos)
6264                 # beos doesn't like the default, either.
6265                 ;;
6266         hpux*)
6267                 # hpux doesn't like the default, either.
6268                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6269                 ;;
6270         *)
6271                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6272                 ;;
6273         esac
6274         case "$xxx" in
6275         '') ;;
6276         *)      
6277                 # Only add $xxx if it isn't already in ccdlflags.
6278                 case " $ccdlflags " in
6279                 *" $xxx "*)     ;;
6280                 *)      ccdlflags="$ccdlflags $xxx"
6281                         cat <<EOM >&4
6282
6283 Adding $xxx to the flags
6284 passed to $ld so that the perl executable will find the 
6285 installed shared $libperl.
6286
6287 EOM
6288                         ;;
6289                 esac
6290                 ;;
6291         esac
6292 fi
6293 # Fix ccdlflags in AIX for building external extensions.
6294 # (For building Perl itself bare -bE:perl.exp is needed,
6295 #  Makefile.SH takes care of this.)
6296 case "$osname" in
6297 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6298 esac
6299 # Respect a hint or command-line value.
6300 case "$shrpenv" in
6301 '') shrpenv="$tmp_shrpenv" ;;
6302 esac
6303 case "$ldlibpthname" in
6304 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6305 none)   ldlibpthname='' ;;
6306 esac
6307
6308 : determine where manual pages go
6309 set man1dir man1dir none
6310 eval $prefixit
6311 $cat <<EOM
6312
6313 $spackage has manual pages available in source form.
6314 EOM
6315 case "$nroff" in
6316 nroff)
6317         echo "However, you don't have nroff, so they're probably useless to you."
6318         case "$man1dir" in
6319         '') man1dir="none";;
6320         esac;;
6321 esac
6322 echo "If you don't want the manual sources installed, answer 'none'."
6323 case "$man1dir" in
6324 ' ') dflt=none
6325         ;;
6326 '')
6327         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6328         lookpath="$lookpath $prefixexp/man/p_man/man1"
6329         lookpath="$lookpath $prefixexp/man/u_man/man1"
6330         lookpath="$lookpath $prefixexp/man/man.1"
6331         case "$sysman" in
6332         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6333         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6334         esac
6335         set dflt
6336         eval $prefixup
6337         ;;
6338 *)  dflt="$man1dir"
6339         ;;
6340 esac
6341 echo " "
6342 fn=dn+~
6343 rp="Where do the main $spackage manual pages (source) go?"
6344 . ./getfile
6345 if $test "X$man1direxp" != "X$ansexp"; then
6346         installman1dir=''
6347 fi
6348 man1dir="$ans"
6349 man1direxp="$ansexp"
6350 case "$man1dir" in
6351 '')     man1dir=' '
6352         installman1dir='';;
6353 esac
6354
6355 : Change installation prefix, if necessary.
6356 if $test X"$prefix" != X"$installprefix"; then
6357         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6358 else
6359         installman1dir="$man1direxp"
6360 fi
6361
6362 : What suffix to use on installed man pages
6363
6364 case "$man1dir" in
6365 ' ')
6366         man1ext='0'
6367         ;;
6368 *)
6369         rp="What suffix should be used for the main $spackage man pages?"
6370         case "$man1ext" in
6371         '')     case "$man1dir" in
6372                 *1)  dflt=1 ;;
6373                 *1p) dflt=1p ;;
6374                 *1pm) dflt=1pm ;;
6375                 *l) dflt=l;;
6376                 *n) dflt=n;;
6377                 *o) dflt=o;;
6378                 *p) dflt=p;;
6379                 *C) dflt=C;;
6380                 *L) dflt=L;;
6381                 *L1) dflt=L1;;
6382                 *) dflt=1;;
6383                 esac
6384                 ;;
6385         *)      dflt="$man1ext";;
6386         esac
6387         . ./myread
6388         man1ext="$ans"
6389         ;;
6390 esac
6391
6392 : see if we can have long filenames
6393 echo " "
6394 rmlist="$rmlist /tmp/cf$$"
6395 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6396 first=123456789abcdef
6397 second=/tmp/cf$$/$first
6398 $rm -f $first $second
6399 if (echo hi >$first) 2>/dev/null; then
6400         if $test -f 123456789abcde; then
6401                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6402                 val="$undef"
6403         else
6404                 if (echo hi >$second) 2>/dev/null; then
6405                         if $test -f /tmp/cf$$/123456789abcde; then
6406                                 $cat <<'EOM'
6407 That's peculiar... You can have filenames longer than 14 characters, but only
6408 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6409 I shall consider your system cannot support long filenames at all.
6410 EOM
6411                                 val="$undef"
6412                         else
6413                                 echo 'You can have filenames longer than 14 characters.' >&4
6414                                 val="$define"
6415                         fi
6416                 else
6417                         $cat <<'EOM'
6418 How confusing! Some of your filesystems are sane enough to allow filenames
6419 longer than 14 characters but some others like /tmp can't even think about them.
6420 So, for now on, I shall assume your kernel does not allow them at all.
6421 EOM
6422                         val="$undef"
6423                 fi
6424         fi
6425 else
6426         $cat <<'EOM'
6427 You can't have filenames longer than 14 chars.  You can't even think about them!
6428 EOM
6429         val="$undef"
6430 fi 
6431 set d_flexfnam
6432 eval $setvar
6433 $rm -rf /tmp/cf$$ 123456789abcde*
6434
6435 : determine where library module manual pages go
6436 set man3dir man3dir none
6437 eval $prefixit
6438 $cat <<EOM
6439
6440 $spackage has manual pages for many of the library modules.
6441 EOM
6442
6443 case "$nroff" in
6444 nroff)
6445         $cat <<'EOM'
6446 However, you don't have nroff, so they're probably useless to you.
6447 EOM
6448         case "$man3dir" in
6449         '') man3dir="none";;
6450         esac;;
6451 esac
6452
6453 case "$d_flexfnam" in
6454 undef)
6455         $cat <<'EOM'
6456 However, your system can't handle the long file names like File::Basename.3. 
6457 EOM
6458         case "$man3dir" in
6459         '') man3dir="none";;
6460         esac;;
6461 esac
6462
6463 echo "If you don't want the manual sources installed, answer 'none'."
6464 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6465 case "$man3dir" in
6466 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6467         if $test -d "$privlib/man/man3"; then
6468                 cat <<EOM >&4
6469
6470 WARNING:  Previous versions of perl installed man3 pages into
6471 $privlib/man/man3.  This version will suggest a 
6472 new default of $dflt.  
6473 EOM
6474                 tdflt=$dflt
6475                 dflt='n'
6476                 rp='Do you wish to preserve the old behavior?(y/n)'
6477                 . ./myread
6478                 case "$ans" in
6479                 y*) dflt="$privlib/man/man3" ;;
6480                 *)  dflt=$tdflt ;;
6481                 esac
6482     fi
6483         ;;
6484 ' ') dflt=none;;
6485 *)      dflt="$man3dir" ;;
6486 esac
6487 echo " "
6488 fn=dn+~
6489 rp="Where do the $package library man pages (source) go?"
6490 . ./getfile
6491 man3dir="$ans"
6492 man3direxp="$ansexp"
6493 case "$man1dir" in
6494 '')     man3dir=' '
6495         installman3dir='';;
6496 esac
6497
6498 : Change installation prefix, if necessary.
6499 if $test X"$prefix" != X"$installprefix"; then
6500         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6501 else
6502         installman3dir="$man3direxp"
6503 fi
6504
6505 : What suffix to use on installed man pages
6506 case "$man3dir" in
6507 ' ')
6508         man3ext='0'
6509         ;;
6510 *)
6511         rp="What suffix should be used for the $package library man pages?"
6512         case "$man3ext" in
6513         '')     case "$man3dir" in
6514                 *3)  dflt=3 ;;
6515                 *3p) dflt=3p ;;
6516                 *3pm) dflt=3pm ;;
6517                 *l) dflt=l;;
6518                 *n) dflt=n;;
6519                 *o) dflt=o;;
6520                 *p) dflt=p;;
6521                 *C) dflt=C;;
6522                 *L) dflt=L;;
6523                 *L3) dflt=L3;;
6524                 *) dflt=3;;
6525                 esac
6526                 ;;
6527         *)      dflt="$man3ext";;
6528         esac
6529         . ./myread
6530         man3ext="$ans"
6531         ;;
6532 esac
6533
6534 : see if we have to deal with yellow pages, now NIS.
6535 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6536         if $test -f /usr/etc/nibindd; then
6537                 echo " "
6538                 echo "I'm fairly confident you're on a NeXT."
6539                 echo " "
6540                 rp='Do you get the hosts file via NetInfo?'
6541                 dflt=y
6542                 case "$hostcat" in
6543                 nidump*) ;;
6544                 '') ;;
6545                 *) dflt=n;;
6546                 esac
6547                 . ./myread
6548                 case "$ans" in
6549                 y*) hostcat='nidump hosts .';;
6550                 *)      case "$hostcat" in
6551                         nidump*) hostcat='';;
6552                         esac
6553                         ;;
6554                 esac
6555         fi
6556         case "$hostcat" in
6557         nidump*) ;;
6558         *)
6559                 case "$hostcat" in
6560                 *ypcat*) dflt=y;;
6561                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6562                                 dflt=y
6563                         else
6564                                 dflt=n
6565                         fi;;
6566                 *) dflt=n;;
6567                 esac
6568                 echo " "
6569                 rp='Are you getting the hosts file via yellow pages?'
6570                 . ./myread
6571                 case "$ans" in
6572                 y*) hostcat='ypcat hosts';;
6573                 *) hostcat='cat /etc/hosts';;
6574                 esac
6575                 ;;
6576         esac
6577 fi
6578 case "$hostcat" in
6579 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6580 esac
6581 case "$groupcat" in
6582 '') test -f /etc/group && groupcat='cat /etc/group';;
6583 esac
6584 case "$passcat" in
6585 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6586 esac
6587
6588 : now get the host name
6589 echo " "
6590 echo "Figuring out host name..." >&4
6591 case "$myhostname" in
6592 '') cont=true
6593         echo 'Maybe "hostname" will work...'
6594         if tans=`sh -c hostname 2>&1` ; then
6595                 myhostname=$tans
6596                 phostname=hostname
6597                 cont=''
6598         fi
6599         ;;
6600 *) cont='';;
6601 esac
6602 if $test "$cont"; then
6603         if ./xenix; then
6604                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6605                 if tans=`cat /etc/systemid 2>&1` ; then
6606                         myhostname=$tans
6607                         phostname='cat /etc/systemid'
6608                         echo "Whadyaknow.  Xenix always was a bit strange..."
6609                         cont=''
6610                 fi
6611         elif $test -r /etc/systemid; then
6612                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6613         fi
6614 fi
6615 if $test "$cont"; then
6616         echo 'No, maybe "uuname -l" will work...'
6617         if tans=`sh -c 'uuname -l' 2>&1` ; then
6618                 myhostname=$tans
6619                 phostname='uuname -l'
6620         else
6621                 echo 'Strange.  Maybe "uname -n" will work...'
6622                 if tans=`sh -c 'uname -n' 2>&1` ; then
6623                         myhostname=$tans
6624                         phostname='uname -n'
6625                 else
6626                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6627                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6628                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6629                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6630                         else
6631                                 case "$myhostname" in
6632                                 '') echo "Does this machine have an identity crisis or something?"
6633                                         phostname='';;
6634                                 *)
6635                                         echo "Well, you said $myhostname before..."
6636                                         phostname='echo $myhostname';;
6637                                 esac
6638                         fi
6639                 fi
6640         fi
6641 fi
6642 : you do not want to know about this
6643 set $myhostname
6644 myhostname=$1
6645
6646 : verify guess
6647 if $test "$myhostname" ; then
6648         dflt=y
6649         rp='Your host name appears to be "'$myhostname'".'" Right?"
6650         . ./myread
6651         case "$ans" in
6652         y*) ;;
6653         *) myhostname='';;
6654         esac
6655 fi
6656
6657 : bad guess or no guess
6658 while $test "X$myhostname" = X ; do
6659         dflt=''
6660         rp="Please type the (one word) name of your host:"
6661         . ./myread
6662         myhostname="$ans"
6663 done
6664
6665 : translate upper to lower if necessary
6666 case "$myhostname" in
6667 *[A-Z]*)
6668         echo "(Normalizing case in your host name)"
6669         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6670         ;;
6671 esac
6672
6673 case "$myhostname" in
6674 *.*)
6675         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6676         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6677         echo "(Trimming domain name from host name--host name is now $myhostname)"
6678         ;;
6679 *) case "$mydomain" in
6680         '')
6681                 {
6682                         test "X$hostcat" = "Xypcat hosts" &&
6683                         ypmatch "$myhostname" hosts 2>/dev/null |\
6684                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6685                         $test -s hosts
6686                 } || {
6687                         test "X$hostcat" != "X" &&
6688                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6689                                         /[       ]$myhostname[  . ]/p" > hosts
6690                 }
6691                 tmp_re="[       . ]"
6692                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6693                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6694                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6695                         hosts | $sort | $uniq | \
6696                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6697                 case `$echo X$dflt` in
6698                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6699                         dflt=.
6700                         ;;
6701                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6702                         ;;
6703                 esac
6704                 case "$dflt" in
6705                 .)
6706                         tans=`./loc resolv.conf X /etc /usr/etc`
6707                         if $test -f "$tans"; then
6708                                 echo "(Attempting domain name extraction from $tans)"
6709                                 dflt=.`$sed -n -e 's/   / /g' \
6710                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6711                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6712                                 case "$dflt" in
6713                                 .) dflt=.`$sed -n -e 's/        / /g' \
6714                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6715                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6716                                         ;;
6717                                 esac
6718                         fi
6719                         ;;
6720                 esac
6721                 case "$dflt" in
6722                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6723                         dflt=.`sh -c domainname 2>/dev/null`
6724                         case "$dflt" in
6725                         '') dflt='.';;
6726                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6727                         esac
6728                         ;;
6729                 esac
6730                 case "$dflt" in
6731                 .) echo "(Lost all hope -- silly guess then)"
6732                         dflt='.uucp'
6733                         ;;
6734                 esac
6735                 $rm -f hosts
6736                 ;;
6737         *) dflt="$mydomain";;
6738         esac;;
6739 esac
6740 echo " "
6741 rp="What is your domain name?"
6742 . ./myread
6743 tans="$ans"
6744 case "$ans" in
6745 '') ;;
6746 .*) ;;
6747 *) tans=".$tans";;
6748 esac
6749 mydomain="$tans"
6750
6751 : translate upper to lower if necessary
6752 case "$mydomain" in
6753 *[A-Z]*)
6754         echo "(Normalizing case in your domain name)"
6755         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6756         ;;
6757 esac
6758
6759 : a little sanity check here
6760 case "$phostname" in
6761 '') ;;
6762 *)
6763         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6764         $myhostname$mydomain|$myhostname) ;;
6765         *)
6766                 case "$phostname" in
6767                 sed*)
6768                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6769                         ;;
6770                 *)
6771                         echo "(That doesn't agree with your $phostname command, by the way.)"
6772                         ;;
6773                 esac
6774         ;;
6775         esac
6776         ;;
6777 esac
6778
6779 $cat <<EOM
6780
6781 I need to get your e-mail address in Internet format if possible, i.e.
6782 something like user@host.domain. Please answer accurately since I have
6783 no easy means to double check it. The default value provided below
6784 is most probably close to reality but may not be valid from outside
6785 your organization...
6786
6787 EOM
6788 cont=x
6789 while test "$cont"; do
6790         case "$cf_email" in
6791         '') dflt="$cf_by@$myhostname$mydomain";;
6792         *) dflt="$cf_email";;
6793         esac
6794         rp='What is your e-mail address?'
6795         . ./myread
6796         cf_email="$ans"
6797         case "$cf_email" in
6798         *@*.*) cont='' ;;
6799         *)
6800                 rp='Address does not look like an Internet one.  Use it anyway?'
6801                 case "$fastread" in
6802                 yes) dflt=y ;;
6803                 *) dflt=n ;;
6804                 esac
6805                 . ./myread
6806                 case "$ans" in
6807                 y*) cont='' ;;
6808                 *) echo " " ;;
6809                 esac
6810                 ;;
6811         esac
6812 done
6813
6814 $cat <<EOM
6815
6816 If you or somebody else will be maintaining perl at your site, please
6817 fill in the correct e-mail address here so that they may be contacted
6818 if necessary. Currently, the "perlbug" program included with perl
6819 will send mail to this address in addition to perlbug@perl.com. You may
6820 enter "none" for no administrator.
6821
6822 EOM
6823 case "$perladmin" in
6824 '') dflt="$cf_email";;
6825 *) dflt="$perladmin";;
6826 esac
6827 rp='Perl administrator e-mail address'
6828 . ./myread
6829 perladmin="$ans"
6830
6831 : figure out how to guarantee perl startup
6832 case "$startperl" in
6833 '')
6834         case "$sharpbang" in
6835         *!)
6836                 $cat <<EOH
6837
6838 I can use the #! construct to start perl on your system. This will
6839 make startup of perl scripts faster, but may cause problems if you
6840 want to share those scripts and perl is not in a standard place
6841 ($binexp/perl) on all your platforms. The alternative is to force
6842 a shell by starting the script with a single ':' character.
6843
6844 EOH
6845                 dflt="$binexp/perl"
6846                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6847                 . ./myread
6848                 case "$ans" in
6849                 none)   startperl=": # use perl";;
6850                 *)      startperl="#!$ans"
6851                         if $test 30 -lt `echo "$ans" | wc -c`; then
6852                                 $cat >&4 <<EOM
6853
6854 WARNING:  Some systems limit the #! command to 32 characters.
6855 If you experience difficulty running Perl scripts with #!, try
6856 installing Perl in a directory with a shorter pathname.
6857
6858 EOM
6859                         fi ;;
6860                 esac
6861                 ;;
6862         *) startperl=": # use perl"
6863                 ;;
6864         esac
6865         ;;
6866 esac
6867 echo "I'll use $startperl to start perl scripts."
6868
6869 : figure best path for perl in scripts
6870 case "$perlpath" in
6871 '')
6872         perlpath="$binexp/perl"
6873         case "$startperl" in
6874         *!*) ;;
6875         *)
6876                 $cat <<EOH
6877
6878 I will use the "eval 'exec'" idiom to start Perl on your system.
6879 I can use the full path of your Perl binary for this purpose, but
6880 doing so may cause problems if you want to share those scripts and
6881 Perl is not always in a standard place ($binexp/perl).
6882
6883 EOH
6884                 dflt="$binexp/perl"
6885                 rp="What path shall I use in \"eval 'exec'\"?"
6886                 . ./myread
6887                 perlpath="$ans"
6888                 ;;
6889         esac
6890         ;;
6891 esac
6892 case "$startperl" in
6893 *!*)    ;;
6894 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6895 esac
6896
6897 : determine where public executable scripts go
6898 set scriptdir scriptdir
6899 eval $prefixit
6900 case "$scriptdir" in
6901 '')
6902         dflt="$bin"
6903         : guess some guesses
6904         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6905         $test -d /usr/share/bin     && dflt=/usr/share/bin
6906         $test -d /usr/local/script  && dflt=/usr/local/script
6907         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6908         $test -d $prefixexp/script  && dflt=$prefixexp/script
6909         set dflt
6910         eval $prefixup
6911         ;;
6912 *)  dflt="$scriptdir"
6913         ;;
6914 esac
6915 $cat <<EOM
6916  
6917 Some installations have a separate directory just for executable scripts so
6918 that they can mount it across multiple architectures but keep the scripts in
6919 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6920 Or you might just lump your scripts in with all your other executables.
6921  
6922 EOM
6923 fn=d~
6924 rp='Where do you keep publicly executable scripts?'
6925 . ./getfile
6926 if $test "X$ansexp" != "X$scriptdirexp"; then
6927         installscript=''
6928 fi
6929 scriptdir="$ans"
6930 scriptdirexp="$ansexp"
6931 : Change installation prefix, if necessary.
6932 if $test X"$prefix" != X"$installprefix"; then
6933         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6934 else
6935         installscript="$scriptdirexp"
6936 fi
6937
6938 : determine where site specific architecture-dependent libraries go.
6939 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6940 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6941 : sitelib may have an optional trailing /share.
6942 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6943 tdflt="$tdflt/$archname"
6944 set sitearch sitearch none
6945 eval $prefixit
6946 case "$sitearch" in
6947 '')     dflt="$tdflt" ;;
6948 *)      dflt="$sitearch" ;;
6949 esac
6950 $cat <<EOM
6951
6952 The installation process will also create a directory for
6953 architecture-dependent site-specific extensions and modules.
6954
6955 EOM
6956 fn=nd~+
6957 rp='Pathname for the site-specific architecture-dependent library files?'
6958 . ./getfile
6959 sitearch="$ans"
6960 sitearchexp="$ansexp"
6961 : Change installation prefix, if necessary.
6962 if $test X"$prefix" != X"$installprefix"; then
6963         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6964 else
6965         installsitearch="$sitearchexp"
6966 fi
6967
6968 : determine where add-on public executables go
6969 case "$sitebin" in
6970 '')     dflt=$siteprefix/bin ;;
6971 *)      dflt=$sitebin ;;
6972 esac
6973 fn=d~
6974 rp='Pathname where the add-on public executables should be installed?'
6975 . ./getfile
6976 sitebin="$ans"
6977 sitebinexp="$ansexp"
6978 : Change installation prefix, if necessary.
6979 if $test X"$prefix" != X"$installprefix"; then
6980         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6981 else
6982         installsitebin="$sitebinexp"
6983 fi
6984
6985 : see if sqrtl exists
6986 set sqrtl d_sqrtl
6987 eval $inlibc
6988
6989 cat <<EOM
6990
6991 Perl can be built to take advantage of long doubles which
6992 (if available) may give more accuracy and range for floating point numbers.
6993
6994 If this doesn't make any sense to you, just accept the default 'n'.
6995 EOM
6996
6997 case "$ccflags" in
6998 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6999 esac
7000
7001 case "$uselongdouble" in
7002 $define|true|[yY]*)     dflt='y';;
7003 *) dflt='n';;
7004 esac
7005 rp='Try to use long doubles if available?'
7006 . ./myread
7007 case "$ans" in
7008 y|Y)    val="$define"   ;;
7009 *)      val="$undef"    ;;
7010 esac
7011 set uselongdouble
7012 eval $setvar
7013
7014 case "$uselongdouble" in
7015 true|[yY]*) uselongdouble="$define" ;;
7016 esac
7017
7018 case "$uselongdouble" in
7019 $define)
7020 : Look for a hint-file generated 'call-back-unit'.  If the
7021 : user has specified that long doubles should be used,
7022 : we may need to set or change some other defaults.
7023         if $test -f uselongdouble.cbu; then
7024                 echo "Your platform has some specific hints for long doubles, using them..."
7025                 . ./uselongdouble.cbu
7026         else
7027                 $cat <<EOM
7028 (Your platform doesn't have any specific hints for long doubles.)
7029 EOM
7030         fi
7031         ;;
7032 esac
7033
7034 case "$uselongdouble:$d_sqrtl" in
7035 $define:$undef)
7036                 $cat <<EOM >&4
7037
7038 You requested the use of long doubles but you do not seem to have
7039 the mathematic functions for long doubles.  I'm disabling the use
7040 of long doubles.
7041 EOM
7042         uselongdouble=$undef
7043         ;;
7044 esac
7045
7046 cat <<EOM
7047
7048 Perl can be built to take advantage of long longs which
7049 (if available) may give more range for integer numbers.
7050
7051 If this doesn't make any sense to you, just accept the default 'n'.
7052 EOM
7053
7054 case "$ccflags" in
7055 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7056 esac
7057
7058 case "$uselonglong" in
7059 '')     dflt='y';;
7060 esac
7061 rp='Try to use long longs if available?'
7062 . ./myread
7063 case "$ans" in
7064 y|Y)    val="$define"   ;;
7065 *)      val="$undef"    ;;
7066 esac
7067 set uselonglong
7068 eval $setvar
7069
7070 case "$uselonglong" in
7071 true|[yY]*) uselonglong="$define" ;;
7072 esac
7073
7074 case "$uselonglong" in
7075 $define)
7076 : Look for a hint-file generated 'call-back-unit'.  If the
7077 : user has specified that long longs should be used,
7078 : we may need to set or change some other defaults.
7079         if $test -f uselonglong.cbu; then
7080                 echo "Your platform has some specific hints for long longs, using them..."
7081                 . ./uselonglong.cbu
7082         else
7083                 $cat <<EOM
7084 (Your platform doesn't have any specific hints for long longs.)
7085 EOM
7086         fi
7087         ;;
7088 esac
7089
7090 cat <<EOM
7091
7092 Previous version of $package used the standard IO mechanisms as defined
7093 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7094 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7095 the default.  This abstraction layer can use AT&T's sfio (if you already
7096 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7097 problems with some extension modules.  Using PerlIO with stdio is safe,
7098 but it is slower than plain stdio and therefore is not the default.
7099
7100 If this doesn't make any sense to you, just accept the default 'n'.
7101 EOM
7102 case "$useperlio" in
7103 $define|true|[yY]*)     dflt='y';;
7104 *) dflt='n';;
7105 esac
7106 rp='Use the experimental PerlIO abstraction layer?'
7107 . ./myread
7108 case "$ans" in
7109 y|Y) 
7110         val="$define"
7111         ;;     
7112 *)      
7113         echo "Ok, doing things the stdio way"
7114         val="$undef"
7115         ;;
7116 esac
7117 set useperlio
7118 eval $setvar 
7119
7120 case "$vendorprefix" in
7121 '')     d_vendorbin="$undef"
7122         vendorbin=''
7123         vendorbinexp=''
7124         ;;
7125 *)      d_vendorbin="$define"
7126         : determine where vendor-supplied executables go.
7127         dflt=$vendorprefix/bin
7128         fn=d~+
7129         rp='Pathname for the vendor-supplied executables directory?'
7130         . ./getfile
7131         vendorbin="$ans"
7132         vendorbinexp="$ansexp"
7133         : Change installation prefix, if necessary.
7134         if $test X"$prefix" != X"$installprefix"; then
7135                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7136         else
7137                 installvendorbin="$vendorbinexp"
7138         fi
7139         ;;
7140 esac
7141
7142 : check for length of double
7143 echo " "
7144 case "$doublesize" in
7145 '')
7146         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7147         $cat >try.c <<'EOCP'
7148 #include <stdio.h>
7149 int main()
7150 {
7151     printf("%d\n", (int)sizeof(double));
7152     exit(0);
7153 }
7154 EOCP
7155         set try
7156         if eval $compile_ok; then
7157                 doublesize=`./try`
7158                 $echo " $doublesize bytes." >&4
7159         else
7160                 dflt='8'
7161                 echo "(I can't seem to compile the test program.  Guessing...)"
7162                 rp="What is the size of a double precision number (in bytes)?"
7163                 . ./myread
7164                 doublesize="$ans"
7165         fi
7166         ;;
7167 esac
7168 $rm -f try.c try
7169
7170 : check for long doubles
7171 echo " "
7172 $echo $n "Checking to see if your system supports long double..." $c >&4
7173 echo 'int main() { long double x = 7.0; }' > try.c
7174 set try
7175 if eval $compile; then
7176         val="$define"
7177         echo " Yes, it does." >&4
7178 else
7179         val="$undef"
7180         echo " No, it doesn't." >&4
7181 fi
7182 $rm try.*
7183 set d_longdbl
7184 eval $setvar
7185
7186 : check for length of long double
7187 case "${d_longdbl}${longdblsize}" in
7188 $define)
7189         echo " "
7190         $echo $n "Checking to see how big your long doubles are..." $c >&4
7191         $cat >try.c <<'EOCP'
7192 #include <stdio.h>
7193 int main()
7194 {
7195         printf("%d\n", sizeof(long double));
7196 }
7197 EOCP
7198         set try
7199         set try
7200         if eval $compile; then
7201                 longdblsize=`./try$exe_ext`
7202                 $echo " $longdblsize bytes." >&4
7203         else
7204                 dflt='8'
7205                 echo " "
7206                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7207                 rp="What is the size of a long double (in bytes)?"
7208                 . ./myread
7209                 longdblsize="$ans"
7210         fi
7211         if $test "X$doublesize" = "X$longdblsize"; then
7212                 echo "(That isn't any different from an ordinary double.)"
7213         fi      
7214         ;;
7215 esac
7216 $rm -f try.* try
7217
7218 : Check how to convert floats to strings.
7219 if test "X$d_Gconvert" = X; then
7220         echo " "
7221         echo "Checking for an efficient way to convert floats to strings."
7222         $cat >try.c <<EOP
7223 #ifdef TRY_gconvert
7224 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7225 char *myname = "gconvert";
7226 #endif
7227 #ifdef TRY_gcvt
7228 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7229 char *myname = "gcvt";
7230 #endif
7231 #ifdef TRY_qgcvt
7232 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7233 char *myname = "qgcvt";
7234 #define DOUBLETYPE long double
7235 #endif
7236 #ifdef TRY_sprintf
7237 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7238 char *myname = "sprintf";
7239 #endif
7240
7241 #ifndef DOUBLETYPE
7242 #define DOUBLETYPE double
7243 #endif
7244
7245 #include <stdio.h>
7246
7247 #define I_STDLIB $i_stdlib
7248 #ifdef I_STDLIB
7249 #include <stdlib.h>
7250 #endif
7251
7252 int
7253 checkit(expect, got)
7254 char *expect;
7255 char *got;
7256 {
7257     if (strcmp(expect, got)) {
7258                 printf("%s oddity:  Expected %s, got %s\n",
7259                         myname, expect, got);
7260                 exit(1);
7261         }
7262 }
7263
7264 int main()
7265
7266         char buf[64]; 
7267         buf[63] = '\0';
7268
7269         /* This must be 1st test on (which?) platform */
7270         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7271         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7272         checkit("0.1", buf);
7273
7274         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7275         checkit("1", buf);
7276
7277         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7278         checkit("0", buf);
7279
7280         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7281         checkit("-1", buf);
7282
7283         /* Some Linux gcvt's give 1.e+5 here. */
7284         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7285         checkit("100000", buf);
7286         
7287         /* Some Linux gcvt's give -1.e+5 here. */
7288         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7289         checkit("-100000", buf);
7290
7291         exit(0);
7292 }
7293 EOP
7294         case "$d_Gconvert" in
7295         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7296         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7297         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7298         *) xxx_list='gconvert gcvt sprintf' ;;
7299         esac
7300
7301         case "$d_longdbl$uselongdouble" in
7302         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7303         esac
7304
7305         for xxx_convert in $xxx_list; do
7306                 echo "Trying $xxx_convert..."
7307                 $rm -f try try$_o
7308                 set try -DTRY_$xxx_convert
7309                 if eval $compile; then
7310                         echo "$xxx_convert() found." >&4
7311                         if ./try; then
7312                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7313                                 break;
7314                         else
7315                                 echo "...But $xxx_convert didn't work as I expected."
7316                         fi
7317                 else
7318                         echo "$xxx_convert NOT found." >&4
7319                 fi
7320         done
7321                 
7322         case "$xxx_convert" in
7323         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7324         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7325         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7326         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7327         esac
7328 fi
7329
7330 echo " "
7331
7332 if $test X"$d_longdbl" = X"$define"; then
7333
7334 echo "Checking how to print long doubles..." >&4
7335
7336 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7337         $cat >try.c <<'EOCP'
7338 #include <sys/types.h>
7339 #include <stdio.h>
7340 int main() {
7341   double d = 123.456;
7342   printf("%.3f\n", d);
7343 }
7344 EOCP
7345         set try
7346         if eval $compile; then
7347                 yyy=`./try$exe_ext`
7348                 case "$yyy" in
7349                 123.456)
7350                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7351                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7352                         echo "We will use %f."
7353                         ;;
7354                 esac
7355         fi
7356 fi
7357
7358 if $test X"$sPRIfldbl" = X; then
7359         $cat >try.c <<'EOCP'
7360 #include <sys/types.h>
7361 #include <stdio.h>
7362 int main() {
7363   long double d = 123.456;
7364   printf("%.3llf\n", d);
7365 }
7366 EOCP
7367         set try
7368         if eval $compile; then
7369                 yyy=`./try$exe_ext`
7370                 case "$yyy" in
7371                 123.456)
7372                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7373                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7374                         echo "We will use %llf."
7375                         ;;
7376                 esac
7377         fi
7378 fi
7379
7380 if $test X"$sPRIfldbl" = X; then
7381         $cat >try.c <<'EOCP'
7382 #include <sys/types.h>
7383 #include <stdio.h>
7384 int main() {
7385   long double d = 123.456;
7386   printf("%.3Lf\n", d);
7387 }
7388 EOCP
7389         set try
7390         if eval $compile; then
7391                 yyy=`./try$exe_ext`
7392                 case "$yyy" in
7393                 123.456)
7394                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7395                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7396                         echo "We will use %Lf."
7397                         ;;
7398                 esac
7399         fi
7400 fi
7401
7402 if $test X"$sPRIfldbl" = X; then
7403         $cat >try.c <<'EOCP'
7404 #include <sys/types.h>
7405 #include <stdio.h>
7406 int main() {
7407   long double d = 123.456;
7408   printf("%.3lf\n", d);
7409 }
7410 EOCP
7411         set try
7412         if eval $compile; then
7413                 yyy=`./try$exe_ext`
7414                 case "$yyy" in
7415                 123.456)
7416                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7417                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7418                         echo "We will use %lf."
7419                         ;;
7420                 esac
7421         fi
7422 fi
7423
7424 if $test X"$sPRIfldbl" = X; then
7425         echo "Cannot figure out how to print long doubles." >&4
7426 fi
7427
7428 $rm -f try try.*
7429
7430 fi # d_longdbl
7431
7432 case "$sPRIfldbl" in
7433 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7434         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7435         ;;
7436 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7437         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7438         ;;
7439 esac
7440
7441 : Initialize h_fcntl
7442 h_fcntl=false
7443
7444 : Initialize h_sysfile
7445 h_sysfile=false
7446
7447 : access call always available on UNIX
7448 set access d_access
7449 eval $inlibc
7450
7451 : locate the flags for 'access()'
7452 case "$d_access" in
7453 "$define")
7454         echo " "
7455         $cat >access.c <<'EOCP'
7456 #include <sys/types.h>
7457 #ifdef I_FCNTL
7458 #include <fcntl.h>
7459 #endif
7460 #ifdef I_SYS_FILE
7461 #include <sys/file.h>
7462 #endif
7463 #ifdef I_UNISTD
7464 #include <unistd.h>
7465 #endif
7466 int main() {
7467         exit(R_OK);
7468 }
7469 EOCP
7470         : check sys/file.h first, no particular reason here
7471         if $test `./findhdr sys/file.h` && \
7472                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7473                 h_sysfile=true;
7474                 echo "<sys/file.h> defines the *_OK access constants." >&4
7475         elif $test `./findhdr fcntl.h` && \
7476                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7477                 h_fcntl=true;
7478                 echo "<fcntl.h> defines the *_OK access constants." >&4
7479         elif $test `./findhdr unistd.h` && \
7480                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7481                 echo "<unistd.h> defines the *_OK access constants." >&4
7482         else
7483                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7484         fi
7485         ;;
7486 esac
7487 $rm -f access*
7488
7489 : see if accessx exists
7490 set accessx d_accessx
7491 eval $inlibc
7492
7493 : see if alarm exists
7494 set alarm d_alarm
7495 eval $inlibc
7496
7497 : see if atolf exists
7498 set atolf d_atolf
7499 eval $inlibc
7500
7501 : see if atoll exists
7502 set atoll d_atoll
7503 eval $inlibc
7504
7505 : Look for GNU-cc style attribute checking
7506 echo " "
7507 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7508 $cat >attrib.c <<'EOCP'
7509 #include <stdio.h>
7510 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7511 EOCP
7512 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7513         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7514                 echo "Your C compiler doesn't fully support __attribute__."
7515                 val="$undef"
7516         else
7517                 echo "Your C compiler supports __attribute__."
7518                 val="$define"
7519         fi
7520 else
7521         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7522         val="$undef"
7523 fi
7524 set d_attribut
7525 eval $setvar
7526 $rm -f attrib*
7527
7528 : see if bcmp exists
7529 set bcmp d_bcmp
7530 eval $inlibc
7531
7532 : see if bcopy exists
7533 set bcopy d_bcopy
7534 eval $inlibc
7535
7536 : see if this is a unistd.h system
7537 set unistd.h i_unistd
7538 eval $inhdr
7539
7540 : see if getpgrp exists
7541 set getpgrp d_getpgrp
7542 eval $inlibc
7543
7544 case "$d_getpgrp" in
7545 "$define")
7546         echo " "
7547         echo "Checking to see which flavor of getpgrp is in use..."
7548         $cat >set.c <<EOP
7549 #$i_unistd I_UNISTD
7550 #include <sys/types.h>
7551 #ifdef I_UNISTD
7552 #  include <unistd.h>
7553 #endif
7554 int main()
7555 {
7556         if (getuid() == 0) {
7557                 printf("(I see you are running Configure as super-user...)\n");
7558                 setuid(1);
7559         }
7560 #ifdef TRY_BSD_PGRP
7561         if (getpgrp(1) == 0)
7562                 exit(0);
7563 #else
7564         if (getpgrp() > 0)
7565                 exit(0);
7566 #endif
7567         exit(1);
7568 }
7569 EOP
7570         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7571                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7572                 val="$define"
7573         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7574                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7575                 val="$undef"
7576         else
7577                 echo "I can't seem to compile and run the test program."
7578                 if ./usg; then
7579                         xxx="a USG one, i.e. you use getpgrp()."
7580                 else
7581                         # SVR4 systems can appear rather BSD-ish.
7582                         case "$i_unistd" in
7583                         $undef)
7584                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7585                                 val="$define"
7586                                 ;;
7587                         $define)
7588                                 xxx="probably a USG one, i.e. you use getpgrp()."
7589                                 val="$undef"
7590                                 ;;
7591                         esac
7592                 fi
7593                 echo "Assuming your getpgrp is $xxx" >&4
7594         fi
7595         ;;
7596 *) val="$undef";;
7597 esac
7598 set d_bsdgetpgrp
7599 eval $setvar
7600 $rm -f set set.c
7601
7602 : see if setpgrp exists
7603 set setpgrp d_setpgrp
7604 eval $inlibc
7605
7606 case "$d_setpgrp" in
7607 "$define")
7608         echo " "
7609         echo "Checking to see which flavor of setpgrp is in use..."
7610         $cat >set.c <<EOP
7611 #$i_unistd I_UNISTD
7612 #include <sys/types.h>
7613 #ifdef I_UNISTD
7614 #  include <unistd.h>
7615 #endif
7616 int main()
7617 {
7618         if (getuid() == 0) {
7619                 printf("(I see you are running Configure as super-user...)\n");
7620                 setuid(1);
7621         }
7622 #ifdef TRY_BSD_PGRP
7623         if (-1 == setpgrp(1, 1))
7624                 exit(0);
7625 #else
7626         if (setpgrp() != -1)
7627                 exit(0);
7628 #endif
7629         exit(1);
7630 }
7631 EOP
7632         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7633                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7634                 val="$define"
7635         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7636                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7637                 val="$undef"
7638         else
7639                 echo "(I can't seem to compile and run the test program.)"
7640                 if ./usg; then
7641                         xxx="a USG one, i.e. you use setpgrp()."
7642                 else
7643                         # SVR4 systems can appear rather BSD-ish.
7644                         case "$i_unistd" in
7645                         $undef)
7646                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7647                                 val="$define"
7648                                 ;;
7649                         $define)
7650                                 xxx="probably a USG one, i.e. you use setpgrp()."
7651                                 val="$undef"
7652                                 ;;
7653                         esac
7654                 fi
7655                 echo "Assuming your setpgrp is $xxx" >&4
7656         fi
7657         ;;
7658 *) val="$undef";;
7659 esac
7660 set d_bsdsetpgrp
7661 eval $setvar
7662 $rm -f set set.c
7663 : see if bzero exists
7664 set bzero d_bzero
7665 eval $inlibc
7666
7667 : see if signal is declared as pointer to function returning int or void
7668 echo " "
7669 xxx=`./findhdr signal.h`
7670 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7671 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7672         echo "You have int (*signal())() instead of void." >&4
7673         val="$undef"
7674 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7675         echo "You have void (*signal())()." >&4
7676         val="$define"
7677 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7678         echo "You have int (*signal())() instead of void." >&4
7679         val="$undef"
7680 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7681         echo "You have void (*signal())()." >&4
7682         val="$define"
7683 else
7684         case "$d_voidsig" in
7685         '')
7686         echo "I can't determine whether signal handler returns void or int..." >&4
7687                 dflt=void
7688                 rp="What type does your signal handler return?"
7689                 . ./myread
7690                 case "$ans" in
7691                 v*) val="$define";;
7692                 *) val="$undef";;
7693                 esac;;
7694         "$define")
7695                 echo "As you already told me, signal handler returns void." >&4
7696                 val="$define"
7697                 ;;
7698         *)      echo "As you already told me, signal handler returns int." >&4
7699                 val="$undef"
7700                 ;;
7701         esac
7702 fi
7703 set d_voidsig
7704 eval $setvar
7705 case "$d_voidsig" in
7706 "$define") signal_t="void";;
7707 *) signal_t="int";;
7708 esac
7709 $rm -f $$.tmp
7710
7711 : check for ability to cast large floats to 32-bit ints.
7712 echo " "
7713 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7714 if $test "$intsize" -ge 4; then
7715         xxx=int
7716 else
7717         xxx=long
7718 fi
7719 $cat >try.c <<EOCP
7720 #include <stdio.h>
7721 #include <sys/types.h>
7722 #include <signal.h>
7723 $signal_t blech(s) int s; { exit(3); }
7724 int main()
7725 {
7726         $xxx i32;
7727         double f, g;
7728         int result = 0;
7729         char str[16];
7730         signal(SIGFPE, blech);
7731
7732         /* Don't let compiler optimize the test away.  Store the number 
7733            in a writable string for gcc to pass to sscanf under HP/UX.
7734         */
7735         sprintf(str, "2147483647");
7736         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7737         g = 10 * f;
7738         i32  = ($xxx) g;
7739
7740         /* x86 processors will probably give 0x8000 0000, which is a
7741        sign change.  We don't want that.  We want to mimic SPARC
7742            behavior here, which is to preserve the sign and give
7743            back 0x7fff ffff.
7744         */
7745         if (i32 != ($xxx) f)
7746                 result |= 1;
7747         exit(result);
7748 }
7749 EOCP
7750 set try
7751 if eval $compile_ok; then
7752         ./try
7753         yyy=$?
7754 else
7755         echo "(I can't seem to compile the test program--assuming it can't)"
7756         yyy=1
7757 fi
7758 case "$yyy" in
7759 0)      val="$define"
7760         echo "Yup, it can."
7761         ;;
7762 *)      val="$undef"
7763         echo "Nope, it can't."
7764         ;;
7765 esac
7766 set d_casti32
7767 eval $setvar
7768 $rm -f try try.*
7769
7770 : check for ability to cast negative floats to unsigned
7771 echo " "
7772 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7773 $cat >try.c <<EOCP
7774 #include <stdio.h>
7775 #include <sys/types.h>
7776 #include <signal.h>
7777 $signal_t blech(s) int s; { exit(7); }
7778 $signal_t blech_in_list(s) int s; { exit(4); }
7779 unsigned long dummy_long(p) unsigned long p; { return p; }
7780 unsigned int dummy_int(p) unsigned int p; { return p; }
7781 unsigned short dummy_short(p) unsigned short p; { return p; }
7782 int main()
7783 {
7784         double f;
7785         unsigned long along;
7786         unsigned int aint;
7787         unsigned short ashort;
7788         int result = 0;
7789         char str[16];
7790         
7791         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7792            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7793            optimized the whole file away
7794         */
7795         /* Store the number in a writable string for gcc to pass to 
7796            sscanf under HP/UX.
7797         */
7798         sprintf(str, "-123");
7799         sscanf(str, "%lf", &f);  /* f = -123.; */
7800
7801         signal(SIGFPE, blech);
7802         along = (unsigned long)f;
7803         aint = (unsigned int)f;
7804         ashort = (unsigned short)f;
7805         if (along != (unsigned long)-123)
7806                 result |= 1;
7807         if (aint != (unsigned int)-123)
7808                 result |= 1;
7809         if (ashort != (unsigned short)-123)
7810                 result |= 1;
7811         sprintf(str, "1073741824.");
7812         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7813         f = f + f;
7814         along = 0;
7815         along = (unsigned long)f;
7816         if (along != 0x80000000)
7817                 result |= 2;
7818         f -= 1.;
7819         along = 0;
7820         along = (unsigned long)f;
7821         if (along != 0x7fffffff)
7822                 result |= 1;
7823         f += 2.;
7824         along = 0;
7825         along = (unsigned long)f;
7826         if (along != 0x80000001)
7827                 result |= 2;
7828         if (result)
7829                 exit(result);
7830         signal(SIGFPE, blech_in_list);
7831         sprintf(str, "123.");
7832         sscanf(str, "%lf", &f);  /* f = 123.; */
7833         along = dummy_long((unsigned long)f);
7834         aint = dummy_int((unsigned int)f);
7835         ashort = dummy_short((unsigned short)f);
7836         if (along != (unsigned long)123)
7837                 result |= 4;
7838         if (aint != (unsigned int)123)
7839                 result |= 4;
7840         if (ashort != (unsigned short)123)
7841                 result |= 4;
7842         exit(result);
7843
7844 }
7845 EOCP
7846 set try
7847 if eval $compile_ok; then
7848         ./try
7849         castflags=$?
7850 else
7851         echo "(I can't seem to compile the test program--assuming it can't)"
7852         castflags=7
7853 fi
7854 case "$castflags" in
7855 0)      val="$define"
7856         echo "Yup, it can."
7857         ;;
7858 *)      val="$undef"
7859         echo "Nope, it can't."
7860         ;;
7861 esac
7862 set d_castneg
7863 eval $setvar
7864 $rm -f try.*
7865
7866 : see if vprintf exists
7867 echo " "
7868 if set vprintf val -f d_vprintf; eval $csym; $val; then
7869         echo 'vprintf() found.' >&4
7870         val="$define"
7871         $cat >vprintf.c <<'EOF'
7872 #include <varargs.h>
7873
7874 int main() { xxx("foo"); }
7875
7876 xxx(va_alist)
7877 va_dcl
7878 {
7879         va_list args;
7880         char buf[10];
7881
7882         va_start(args);
7883         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7884 }
7885 EOF
7886         set vprintf
7887         if eval $compile && ./vprintf; then
7888                 echo "Your vsprintf() returns (int)." >&4
7889                 val2="$undef"
7890         else
7891                 echo "Your vsprintf() returns (char*)." >&4
7892                 val2="$define"
7893         fi
7894 else
7895         echo 'vprintf() NOT found.' >&4
7896                 val="$undef"
7897                 val2="$undef"
7898 fi
7899 set d_vprintf
7900 eval $setvar
7901 val=$val2
7902 set d_charvspr
7903 eval $setvar
7904
7905 : see if chown exists
7906 set chown d_chown
7907 eval $inlibc
7908
7909 : see if chroot exists
7910 set chroot d_chroot
7911 eval $inlibc
7912
7913 : see if chsize exists
7914 set chsize d_chsize
7915 eval $inlibc
7916
7917 : check for const keyword
7918 echo " "
7919 echo 'Checking to see if your C compiler knows about "const"...' >&4
7920 $cat >const.c <<'EOCP'
7921 typedef struct spug { int drokk; } spug;
7922 int main()
7923 {
7924         const char *foo;
7925         const spug y;
7926 }
7927 EOCP
7928 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7929         val="$define"
7930         echo "Yup, it does."
7931 else
7932         val="$undef"
7933         echo "Nope, it doesn't."
7934 fi
7935 set d_const
7936 eval $setvar
7937
7938 : see if crypt exists
7939 echo " "
7940 if set crypt val -f d_crypt; eval $csym; $val; then
7941         echo 'crypt() found.' >&4
7942         val="$define"
7943         cryptlib=''
7944 else
7945         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7946         if $test -z "$cryptlib"; then
7947                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7948         else
7949                 cryptlib=-lcrypt
7950         fi
7951         if $test -z "$cryptlib"; then
7952                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7953         else
7954                 cryptlib=-lcrypt
7955         fi
7956         if $test -z "$cryptlib"; then
7957                 cryptlib=`./loc libcrypt$_a "" $libpth`
7958         else
7959                 cryptlib=-lcrypt
7960         fi
7961         if $test -z "$cryptlib"; then
7962                 echo 'crypt() NOT found.' >&4
7963                 val="$undef"
7964         else
7965                 val="$define"
7966         fi
7967 fi
7968 set d_crypt
7969 eval $setvar
7970
7971 : get csh whereabouts
7972 case "$csh" in
7973 'csh') val="$undef" ;;
7974 *) val="$define" ;;
7975 esac
7976 set d_csh
7977 eval $setvar
7978 : Respect a hint or command line value for full_csh.
7979 case "$full_csh" in
7980 '') full_csh=$csh ;;
7981 esac
7982
7983 : see if cuserid exists
7984 set cuserid d_cuserid
7985 eval $inlibc
7986
7987 : see if this is a limits.h system
7988 set limits.h i_limits
7989 eval $inhdr
7990
7991 : see if this is a float.h system
7992 set float.h i_float
7993 eval $inhdr
7994
7995 : See if number of significant digits in a double precision number is known
7996 echo " "
7997 $cat >dbl_dig.c <<EOM
7998 #$i_limits I_LIMITS
7999 #$i_float I_FLOAT
8000 #ifdef I_LIMITS
8001 #include <limits.h>
8002 #endif
8003 #ifdef I_FLOAT
8004 #include <float.h>
8005 #endif
8006 #ifdef DBL_DIG
8007 printf("Contains DBL_DIG");
8008 #endif
8009 EOM
8010 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8011 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8012         echo "DBL_DIG found." >&4
8013         val="$define"
8014 else
8015         echo "DBL_DIG NOT found." >&4
8016         val="$undef"
8017 fi
8018 $rm -f dbl_dig.?
8019 set d_dbl_dig
8020 eval $setvar
8021
8022 : see if difftime exists
8023 set difftime d_difftime
8024 eval $inlibc
8025
8026 : see if this is a dirent system
8027 echo " "
8028 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8029         val="$define"
8030         echo "<dirent.h> found." >&4
8031 else
8032         val="$undef"
8033         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8034                 echo "<sys/dir.h> found." >&4
8035                 echo " "
8036         else
8037                 xinc=`./findhdr sys/ndir.h`
8038         fi
8039         echo "<dirent.h> NOT found." >&4
8040 fi
8041 set i_dirent
8042 eval $setvar
8043
8044 : Look for type of directory structure.
8045 echo " "
8046 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8047
8048 case "$direntrytype" in
8049 ''|' ')
8050         case "$i_dirent" in
8051         $define) guess1='struct dirent' ;;
8052         *) guess1='struct direct'  ;;
8053         esac
8054         ;;
8055 *)      guess1="$direntrytype"
8056         ;;
8057 esac
8058
8059 case "$guess1" in
8060 'struct dirent') guess2='struct direct' ;;
8061 *) guess2='struct dirent' ;;
8062 esac
8063                 
8064 if $contains "$guess1" try.c >/dev/null 2>&1; then
8065         direntrytype="$guess1"
8066         echo "Your directory entries are $direntrytype." >&4
8067 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8068         direntrytype="$guess2"
8069         echo "Your directory entries seem to be $direntrytype." >&4
8070 else
8071         echo "I don't recognize your system's directory entries." >&4
8072         rp="What type is used for directory entries on this system?"
8073         dflt="$guess1"
8074         . ./myread
8075         direntrytype="$ans"
8076 fi
8077 $rm -f try.c
8078
8079
8080 : see if the directory entry stores field length
8081 echo " "
8082 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8083 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8084         echo "Good, your directory entry keeps length information in d_namlen." >&4
8085         val="$define"
8086 else
8087         echo "Your directory entry does not know about the d_namlen field." >&4
8088         val="$undef"
8089 fi
8090 set d_dirnamlen
8091 eval $setvar
8092 $rm -f try.c
8093
8094 : see if dlerror exists
8095 xxx_runnm="$runnm"
8096 runnm=false
8097 set dlerror d_dlerror
8098 eval $inlibc
8099 runnm="$xxx_runnm"
8100
8101 : see if dlfcn is available
8102 set dlfcn.h i_dlfcn
8103 eval $inhdr
8104
8105 case "$usedl" in
8106 $define|y|true)
8107         $cat << EOM
8108
8109 On a few systems, the dynamically loaded modules that perl generates and uses
8110 will need a different extension than shared libs. The default will probably
8111 be appropriate.
8112
8113 EOM
8114         case "$dlext" in
8115         '')     dflt="$so" ;;
8116         *)      dflt="$dlext" ;;
8117         esac
8118         rp='What is the extension of dynamically loaded modules'
8119         . ./myread
8120         dlext="$ans"
8121         ;;
8122 *)
8123         dlext="none"
8124         ;;
8125 esac
8126
8127 : Check if dlsym need a leading underscore
8128 echo " "
8129 val="$undef"
8130
8131 case "$dlsrc" in
8132 dl_dlopen.xs)
8133         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8134         $cat >dyna.c <<'EOM'
8135 fred () { }
8136 EOM
8137
8138 $cat >fred.c<<EOM
8139
8140 #include <stdio.h>
8141 #$i_dlfcn I_DLFCN
8142 #ifdef I_DLFCN
8143 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8144 #else
8145 #include <sys/types.h>
8146 #include <nlist.h>
8147 #include <link.h>
8148 #endif
8149
8150 extern int fred() ;
8151
8152 int main()
8153 {
8154     void * handle ;
8155     void * symbol ;
8156 #ifndef RTLD_LAZY
8157     int mode = 1 ;
8158 #else
8159     int mode = RTLD_LAZY ;
8160 #endif
8161     handle = dlopen("./dyna.$dlext", mode) ;
8162     if (handle == NULL) {
8163         printf ("1\n") ;
8164         fflush (stdout) ;
8165         exit(0);
8166     }
8167     symbol = dlsym(handle, "fred") ;
8168     if (symbol == NULL) {
8169         /* try putting a leading underscore */
8170         symbol = dlsym(handle, "_fred") ;
8171         if (symbol == NULL) {
8172             printf ("2\n") ;
8173             fflush (stdout) ;
8174             exit(0);
8175         }
8176         printf ("3\n") ;
8177     }
8178     else
8179         printf ("4\n") ;
8180     fflush (stdout) ;
8181     exit(0);
8182 }
8183 EOM
8184         : Call the object file tmp-dyna.o in case dlext=o.
8185         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8186                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8187                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8188                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8189                 xxx=`./fred`
8190                 case $xxx in
8191                 1)      echo "Test program failed using dlopen." >&4
8192                         echo "Perhaps you should not use dynamic loading." >&4;;
8193                 2)      echo "Test program failed using dlsym." >&4
8194                         echo "Perhaps you should not use dynamic loading." >&4;;
8195                 3)      echo "dlsym needs a leading underscore" >&4
8196                         val="$define" ;;
8197                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8198                 esac
8199         else
8200                 echo "I can't compile and run the test program." >&4
8201                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8202         fi
8203         ;;
8204 esac
8205                 
8206 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8207
8208 set d_dlsymun
8209 eval $setvar
8210
8211 hasproto='varname=$1; func=$2; shift; shift;
8212 while $test $# -ge 2; do
8213         case "$1" in
8214         $define) echo "#include <$2>";;
8215         esac ;
8216     shift 2;
8217 done > try.c;
8218 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8219 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8220         echo "$func() prototype found.";
8221         val="$define";
8222 else
8223         echo "$func() prototype NOT found.";
8224         val="$undef";
8225 fi;
8226 set $varname;
8227 eval $setvar;
8228 $rm -f try.c tryout.c'
8229
8230 : see if prototype for drand48 is available
8231 echo " "
8232 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8233 eval $hasproto
8234
8235 : see if dup2 exists
8236 set dup2 d_dup2
8237 eval $inlibc
8238
8239 : see if eaccess exists
8240 set eaccess d_eaccess
8241 eval $inlibc
8242
8243 : see if endgrent exists
8244 set endgrent d_endgrent
8245 eval $inlibc
8246
8247 : see if endhostent exists
8248 set endhostent d_endhent
8249 eval $inlibc
8250
8251 : see if endnetent exists
8252 set endnetent d_endnent
8253 eval $inlibc
8254
8255 : see if endprotoent exists
8256 set endprotoent d_endpent
8257 eval $inlibc
8258
8259 : see if endpwent exists
8260 set endpwent d_endpwent
8261 eval $inlibc
8262
8263 : see if endservent exists
8264 set endservent d_endsent
8265 eval $inlibc
8266
8267 : see if endspent exists
8268 set endspent d_endspent
8269 eval $inlibc
8270
8271 : Locate the flags for 'open()'
8272 echo " "
8273 $cat >open3.c <<'EOCP'
8274 #include <sys/types.h>
8275 #ifdef I_FCNTL
8276 #include <fcntl.h>
8277 #endif
8278 #ifdef I_SYS_FILE
8279 #include <sys/file.h>
8280 #endif
8281 int main() {
8282         if(O_RDONLY);
8283 #ifdef O_TRUNC
8284         exit(0);
8285 #else
8286         exit(1);
8287 #endif
8288 }
8289 EOCP
8290 : check sys/file.h first to get FREAD on Sun
8291 if $test `./findhdr sys/file.h` && \
8292                 set open3 -DI_SYS_FILE && eval $compile; then
8293         h_sysfile=true;
8294         echo "<sys/file.h> defines the O_* constants..." >&4
8295         if ./open3; then
8296                 echo "and you have the 3 argument form of open()." >&4
8297                 val="$define"
8298         else
8299                 echo "but not the 3 argument form of open().  Oh, well." >&4
8300                 val="$undef"
8301         fi
8302 elif $test `./findhdr fcntl.h` && \
8303                 set open3 -DI_FCNTL && eval $compile; then
8304         h_fcntl=true;
8305         echo "<fcntl.h> defines the O_* constants..." >&4
8306         if ./open3; then
8307                 echo "and you have the 3 argument form of open()." >&4
8308                 val="$define"
8309         else
8310                 echo "but not the 3 argument form of open().  Oh, well." >&4
8311                 val="$undef"
8312         fi
8313 else
8314         val="$undef"
8315         echo "I can't find the O_* constant definitions!  You got problems." >&4
8316 fi
8317 set d_open3
8318 eval $setvar
8319 $rm -f open3*
8320
8321 : see which of string.h or strings.h is needed
8322 echo " "
8323 strings=`./findhdr string.h`
8324 if $test "$strings" && $test -r "$strings"; then
8325         echo "Using <string.h> instead of <strings.h>." >&4
8326         val="$define"
8327 else
8328         val="$undef"
8329         strings=`./findhdr strings.h`
8330         if $test "$strings" && $test -r "$strings"; then
8331                 echo "Using <strings.h> instead of <string.h>." >&4
8332         else
8333                 echo "No string header found -- You'll surely have problems." >&4
8334         fi
8335 fi
8336 set i_string
8337 eval $setvar
8338 case "$i_string" in
8339 "$undef") strings=`./findhdr strings.h`;;
8340 *)        strings=`./findhdr string.h`;;
8341 esac
8342
8343 : check for non-blocking I/O stuff
8344 case "$h_sysfile" in
8345 true) echo "#include <sys/file.h>" > head.c;;
8346 *)
8347         case "$h_fcntl" in
8348         true) echo "#include <fcntl.h>" > head.c;;
8349         *) echo "#include <sys/fcntl.h>" > head.c;;
8350         esac
8351         ;;
8352 esac
8353 echo " "
8354 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8355 case "$o_nonblock" in
8356 '')
8357         $cat head.c > try.c
8358         $cat >>try.c <<'EOCP'
8359 #include <stdio.h>
8360 int main() {
8361 #ifdef O_NONBLOCK
8362         printf("O_NONBLOCK\n");
8363         exit(0);
8364 #endif
8365 #ifdef O_NDELAY
8366         printf("O_NDELAY\n");
8367         exit(0);
8368 #endif
8369 #ifdef FNDELAY
8370         printf("FNDELAY\n");
8371         exit(0);
8372 #endif
8373         exit(0);
8374 }
8375 EOCP
8376         set try
8377         if eval $compile_ok; then
8378                 o_nonblock=`./try`
8379                 case "$o_nonblock" in
8380                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8381                 *) echo "Seems like we can use $o_nonblock.";;
8382                 esac
8383         else
8384                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8385         fi
8386         ;;
8387 *) echo "Using $hint value $o_nonblock.";;
8388 esac
8389 $rm -f try try.* .out core
8390
8391 echo " "
8392 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8393 case "$eagain" in
8394 '')
8395         $cat head.c > try.c
8396         $cat >>try.c <<EOCP
8397 #include <errno.h>
8398 #include <sys/types.h>
8399 #include <signal.h>
8400 #include <stdio.h> 
8401 #define MY_O_NONBLOCK $o_nonblock
8402 #ifndef errno  /* XXX need better Configure test */
8403 extern int errno;
8404 #endif
8405 #$i_unistd I_UNISTD
8406 #ifdef I_UNISTD
8407 #include <unistd.h>
8408 #endif
8409 #ifdef $i_string
8410 #include <string.h>
8411 #else
8412 #include <strings.h>
8413 #endif
8414 $signal_t blech(x) int x; { exit(3); }
8415 EOCP
8416         $cat >> try.c <<'EOCP'
8417 int main()
8418 {
8419         int pd[2];
8420         int pu[2];
8421         char buf[1];
8422         char string[100];
8423
8424         pipe(pd);       /* Down: child -> parent */
8425         pipe(pu);       /* Up: parent -> child */
8426         if (0 != fork()) {
8427                 int ret;
8428                 close(pd[1]);   /* Parent reads from pd[0] */
8429                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8430                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8431                         exit(1);
8432                 signal(SIGALRM, blech);
8433                 alarm(5);
8434                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8435                         exit(2);
8436                 sprintf(string, "%d\n", ret);
8437                 write(2, string, strlen(string));
8438                 alarm(0);
8439 #ifdef EAGAIN
8440                 if (errno == EAGAIN) {
8441                         printf("EAGAIN\n");
8442                         goto ok;
8443                 }
8444 #endif
8445 #ifdef EWOULDBLOCK
8446                 if (errno == EWOULDBLOCK)
8447                         printf("EWOULDBLOCK\n");
8448 #endif
8449         ok:
8450                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8451                 sleep(2);                               /* Give it time to close our pipe */
8452                 alarm(5);
8453                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8454                 alarm(0);
8455                 sprintf(string, "%d\n", ret);
8456                 write(3, string, strlen(string));
8457                 exit(0);
8458         }
8459
8460         close(pd[0]);                   /* We write to pd[1] */
8461         close(pu[1]);                   /* We read from pu[0] */
8462         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8463         close(pd[1]);                   /* Pipe pd is now fully closed! */
8464         exit(0);                                /* Bye bye, thank you for playing! */
8465 }
8466 EOCP
8467         set try
8468         if eval $compile_ok; then
8469                 echo "$startsh" >mtry
8470                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8471                 chmod +x mtry
8472                 ./mtry >/dev/null 2>&1
8473                 case $? in
8474                 0) eagain=`$cat try.out`;;
8475                 1) echo "Could not perform non-blocking setting!";;
8476                 2) echo "I did a successful read() for something that was not there!";;
8477                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8478                 *) echo "Something terribly wrong happened during testing.";;
8479                 esac
8480                 rd_nodata=`$cat try.ret`
8481                 echo "A read() system call with no data present returns $rd_nodata."
8482                 case "$rd_nodata" in
8483                 0|-1) ;;
8484                 *)
8485                         echo "(That's peculiar, fixing that to be -1.)"
8486                         rd_nodata=-1
8487                         ;;
8488                 esac
8489                 case "$eagain" in
8490                 '')
8491                         echo "Forcing errno EAGAIN on read() with no data available."
8492                         eagain=EAGAIN
8493                         ;;
8494                 *)
8495                         echo "Your read() sets errno to $eagain when no data is available."
8496                         ;;
8497                 esac
8498                 status=`$cat try.err`
8499                 case "$status" in
8500                 0) echo "And it correctly returns 0 to signal EOF.";;
8501                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8502                 *) echo "However, your read() returns '$status' on EOF??";;
8503                 esac
8504                 val="$define"
8505                 if test "$status" = "$rd_nodata"; then
8506                         echo "WARNING: you can't distinguish between EOF and no data!"
8507                         val="$undef"
8508                 fi
8509         else
8510                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8511                 eagain=EAGAIN
8512         fi
8513         set d_eofnblk
8514         eval $setvar
8515         ;;
8516 *)
8517         echo "Using $hint value $eagain."
8518         echo "Your read() returns $rd_nodata when no data is present."
8519         case "$d_eofnblk" in
8520         "$define") echo "And you can see EOF because read() returns 0.";;
8521         "$undef") echo "But you can't see EOF status from read() returned value.";;
8522         *)
8523                 echo "(Assuming you can't see EOF status from read anyway.)"
8524                 d_eofnblk=$undef
8525                 ;;
8526         esac
8527         ;;
8528 esac
8529 $rm -f try try.* .out core head.c mtry
8530
8531 : see if fchmod exists
8532 set fchmod d_fchmod
8533 eval $inlibc
8534
8535 : see if fchown exists
8536 set fchown d_fchown
8537 eval $inlibc
8538
8539 : see if this is an fcntl system
8540 set fcntl d_fcntl
8541 eval $inlibc
8542
8543 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8544 while $test $# -ge 2; do
8545         case "$1" in
8546         $define) echo "#include <$2>";;
8547         esac ;
8548     shift 2;
8549 done > try.c;
8550 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8551 set try;
8552 if eval $compile; then
8553         val="$define";
8554 else
8555         val="$undef";
8556 fi;
8557 set $varname;
8558 eval $setvar;
8559 $rm -f try.c try.o'
8560
8561 socketlib=''
8562 sockethdr=''
8563 : see whether socket exists
8564 echo " "
8565 $echo $n "Hmm... $c" >&4
8566 if set socket val -f d_socket; eval $csym; $val; then
8567         echo "Looks like you have Berkeley networking support." >&4
8568         d_socket="$define"
8569         if set setsockopt val -f; eval $csym; $val; then
8570                 d_oldsock="$undef"
8571         else
8572                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8573                 d_oldsock="$define"
8574         fi
8575 else
8576         if $contains socklib libc.list >/dev/null 2>&1; then
8577                 echo "Looks like you have Berkeley networking support." >&4
8578                 d_socket="$define"
8579                 : we will have to assume that it supports the 4.2 BSD interface
8580                 d_oldsock="$undef"
8581         else
8582                 echo "You don't have Berkeley networking in libc$_a..." >&4
8583                 if test "X$d_socket" = "X$define"; then
8584                    echo "...but you seem to believe that you have sockets." >&4
8585                 else
8586                         for net in net socket
8587                         do
8588                                 if test -f /usr/lib/lib$net$_a; then
8589                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8590                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8591                                         if $contains socket libc.list >/dev/null 2>&1; then
8592                                                 d_socket="$define"
8593                                                 socketlib="-l$net"
8594                                                 case "$net" in
8595                                                 net)
8596                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8597                                                         sockethdr="-I/usr/netinclude"
8598                                                         ;;
8599                                                 esac
8600                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8601                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8602                                                         d_oldsock="$undef"
8603                                                 else
8604                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8605                                                         d_oldsock="$define"
8606                                                 fi
8607                                                 break
8608                                         fi
8609                                 fi
8610                         done
8611                         if test "X$d_socket" != "X$define"; then
8612                            echo "or anywhere else I see." >&4
8613                            d_socket="$undef"
8614                            d_oldsock="$undef"
8615                         fi
8616                 fi
8617         fi
8618 fi
8619
8620 : see if socketpair exists
8621 set socketpair d_sockpair
8622 eval $inlibc
8623
8624
8625 echo " "
8626 echo "Checking the availability of certain socket constants..." >& 4
8627 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8628         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8629         $cat >try.c <<EOF
8630 #include <sys/types.h>
8631 #include <sys/socket.h>
8632 int main() {
8633     int i = $ENUM;
8634 }
8635 EOF
8636         val="$undef"
8637         set try; if eval $compile; then
8638                 val="$define"
8639         fi
8640         set d_${enum}; eval $setvar
8641         $rm -f try.c try
8642 done
8643
8644 : see if sys/select.h has to be included
8645 set sys/select.h i_sysselct
8646 eval $inhdr
8647
8648 : see if we should include time.h, sys/time.h, or both
8649 echo " "
8650 if test "X$timeincl" = X; then
8651         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8652         $echo $n "I'm now running the test program...$c"
8653         $cat >try.c <<'EOCP'
8654 #include <sys/types.h>
8655 #ifdef I_TIME
8656 #include <time.h>
8657 #endif
8658 #ifdef I_SYSTIME
8659 #ifdef SYSTIMEKERNEL
8660 #define KERNEL
8661 #endif
8662 #include <sys/time.h>
8663 #endif
8664 #ifdef I_SYSSELECT
8665 #include <sys/select.h>
8666 #endif
8667 int main()
8668 {
8669         struct tm foo;
8670 #ifdef S_TIMEVAL
8671         struct timeval bar;
8672 #endif
8673 #ifdef S_TIMEZONE
8674         struct timezone tzp;
8675 #endif
8676         if (foo.tm_sec == foo.tm_sec)
8677                 exit(0);
8678 #ifdef S_TIMEVAL
8679         if (bar.tv_sec == bar.tv_sec)
8680                 exit(0);
8681 #endif
8682         exit(1);
8683 }
8684 EOCP
8685         flags=''
8686         for s_timezone in '-DS_TIMEZONE' ''; do
8687         sysselect=''
8688         for s_timeval in '-DS_TIMEVAL' ''; do
8689         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8690         for i_time in '' '-DI_TIME'; do
8691         for i_systime in '-DI_SYSTIME' ''; do
8692                 case "$flags" in
8693                 '') $echo $n ".$c"
8694                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8695                         if eval $compile; then
8696                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8697                                 shift
8698                                 flags="$*"
8699                                 echo " "
8700                                 $echo $n "Succeeded with $flags$c"
8701                         fi
8702                         ;;
8703                 esac
8704         done
8705         done
8706         done
8707         done
8708         done
8709         timeincl=''
8710         echo " "
8711         case "$flags" in
8712         *SYSTIMEKERNEL*) i_systimek="$define"
8713                 timeincl=`./findhdr sys/time.h`
8714                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8715         *) i_systimek="$undef";;
8716         esac
8717         case "$flags" in
8718         *I_TIME*) i_time="$define"
8719                 timeincl=`./findhdr time.h`" $timeincl"
8720                 echo "We'll include <time.h>." >&4;;
8721         *) i_time="$undef";;
8722         esac
8723         case "$flags" in
8724         *I_SYSTIME*) i_systime="$define"
8725                 timeincl=`./findhdr sys/time.h`" $timeincl"
8726                 echo "We'll include <sys/time.h>." >&4;;
8727         *) i_systime="$undef";;
8728         esac
8729         $rm -f try.c try
8730 fi
8731
8732 : check for fd_set items
8733 $cat <<EOM
8734
8735 Checking to see how well your C compiler handles fd_set and friends ...
8736 EOM
8737 $cat >fd_set.c <<EOCP
8738 #$i_systime I_SYS_TIME
8739 #$i_sysselct I_SYS_SELECT
8740 #$d_socket HAS_SOCKET
8741 #include <sys/types.h>
8742 #ifdef HAS_SOCKET
8743 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8744 #endif
8745 #ifdef I_SYS_TIME
8746 #include <sys/time.h>
8747 #endif
8748 #ifdef I_SYS_SELECT
8749 #include <sys/select.h>
8750 #endif
8751 int main() {
8752         fd_set fds;
8753
8754 #ifdef TRYBITS
8755         if(fds.fds_bits);
8756 #endif
8757
8758 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8759         exit(0);
8760 #else
8761         exit(1);
8762 #endif
8763 }
8764 EOCP
8765 set fd_set -DTRYBITS
8766 if eval $compile; then
8767         d_fds_bits="$define"
8768         d_fd_set="$define"
8769         echo "Well, your system knows about the normal fd_set typedef..." >&4
8770         if ./fd_set; then
8771                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8772                 d_fd_macros="$define"
8773         else
8774                 $cat >&4 <<'EOM'
8775 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8776 EOM
8777                 d_fd_macros="$undef"
8778         fi
8779 else
8780         $cat <<'EOM'
8781 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8782 EOM
8783         set fd_set
8784         if eval $compile; then
8785                 d_fds_bits="$undef"
8786                 d_fd_set="$define"
8787                 echo "Well, your system has some sort of fd_set available..." >&4
8788                 if ./fd_set; then
8789                         echo "and you have the normal fd_set macros." >&4
8790                         d_fd_macros="$define"
8791                 else
8792                         $cat <<'EOM'
8793 but not the normal fd_set macros!  Gross!  More work for me...
8794 EOM
8795                         d_fd_macros="$undef"
8796                 fi
8797         else
8798         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8799                 d_fd_set="$undef"
8800                 d_fds_bits="$undef"
8801                 d_fd_macros="$undef"
8802         fi
8803 fi
8804 $rm -f fd_set*
8805
8806 : see if fgetpos exists
8807 set fgetpos d_fgetpos
8808 eval $inlibc
8809
8810 : see if flock exists
8811 set flock d_flock
8812 eval $inlibc
8813
8814 : see if fork exists
8815 set fork d_fork
8816 eval $inlibc
8817
8818 : see if pathconf exists
8819 set pathconf d_pathconf
8820 eval $inlibc
8821
8822 : see if fpathconf exists
8823 set fpathconf d_fpathconf
8824 eval $inlibc
8825
8826
8827 : check for off64_t
8828 echo " "
8829 echo "Checking to see if your system supports off64_t..." >&4
8830 $cat >try.c <<EOCP
8831 #include <sys/types.h>
8832 #include <unistd.h>
8833 int main() { off64_t x = 7; }'
8834 EOCP
8835 set try
8836 if eval $compile; then
8837         val="$define"
8838         echo "Yes, it does."
8839 else
8840         val="$undef"
8841         echo "No, it doesn't."
8842         case "$lseeksize" in
8843         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8844         esac
8845 fi
8846 $rm -f try.* try
8847 set d_off64_t
8848 eval $setvar
8849
8850 : check for fpos64_t
8851 echo " "
8852 echo "Checking to see if your system supports fpos64_t..." >&4
8853 $cat >try.c <<EOCP
8854 #include <sys/stdio.h>
8855 int main() { fpos64_t x x = 7; }'
8856 EOCP
8857 set try
8858 if eval $compile; then
8859         val="$define"
8860         echo "Yes, it does."
8861 else
8862         val="$undef"
8863         echo "No, it doesn't."
8864         case "$fpossize" in
8865         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8866         esac
8867 fi
8868 $rm -f try.* try
8869 set d_fpos64_t
8870 eval $setvar
8871
8872 hasstruct='varname=$1; struct=$2; shift; shift;
8873 while $test $# -ge 2; do
8874         case "$1" in
8875         $define) echo "#include <$2>";;
8876         esac ;
8877     shift 2;
8878 done > try.c;
8879 echo "int main () { struct $struct foo; }" >> try.c;
8880 set try;
8881 if eval $compile; then
8882         val="$define";
8883 else
8884         val="$undef";
8885 fi;
8886 set $varname;
8887 eval $setvar;
8888 $rm -f try.c try.o'
8889
8890 : see if this is a sys/param system
8891 set sys/param.h i_sysparam
8892 eval $inhdr
8893
8894 : see if this is a sys/mount.h system
8895 set sys/mount.h i_sysmount
8896 eval $inhdr
8897
8898 : see if sys/types.h has to be included
8899 set sys/types.h i_systypes
8900 eval $inhdr
8901
8902
8903 echo " "
8904 echo "Checking to see if your system supports struct fs_data..." >&4
8905 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8906 eval $hasstruct
8907 case "$d_fs_data_s" in
8908 "$define")      echo "Yes, it does."   ;;
8909 *)              echo "No, it doesn't." ;;
8910 esac
8911
8912 : see if fseeko exists
8913 set fseeko d_fseeko
8914 eval $inlibc
8915 case "$longsize" in
8916 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8917 esac
8918
8919 : see if fsetpos exists
8920 set fsetpos d_fsetpos
8921 eval $inlibc
8922
8923
8924 : see if fstatfs exists
8925 set fstatfs d_fstatfs
8926 eval $inlibc
8927
8928
8929 : see if statvfs exists
8930 set statvfs d_statvfs
8931 eval $inlibc
8932
8933 : see if fstatvfs exists
8934 set fstatvfs d_fstatvfs
8935 eval $inlibc
8936
8937
8938 : see if ftello exists
8939 set ftello d_ftello
8940 eval $inlibc
8941 case "$longsize" in
8942 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8943 esac
8944
8945 : see if getcwd exists
8946 set getcwd d_getcwd
8947 eval $inlibc
8948
8949 : see if getgrent exists
8950 set getgrent d_getgrent
8951 eval $inlibc
8952
8953 : see if gethostbyaddr exists
8954 set gethostbyaddr d_gethbyaddr
8955 eval $inlibc
8956
8957 : see if gethostbyname exists
8958 set gethostbyname d_gethbyname
8959 eval $inlibc
8960
8961 : see if gethostent exists
8962 set gethostent d_gethent
8963 eval $inlibc
8964
8965 : see how we will look up host name
8966 echo " "
8967 call=''
8968 if set gethostname val -f d_gethname; eval $csym; $val; then
8969         echo 'gethostname() found.' >&4
8970         d_gethname="$define"
8971         call=gethostname
8972 fi
8973 if set uname val -f d_uname; eval $csym; $val; then
8974         if ./xenix; then
8975                 $cat <<'EOM'
8976 uname() was found, but you're running xenix, and older versions of xenix
8977 have a broken uname(). If you don't really know whether your xenix is old
8978 enough to have a broken system call, use the default answer.
8979
8980 EOM
8981                 dflt=y
8982                 case "$d_uname" in
8983                 "$define") dflt=n;;
8984                 esac
8985                 rp='Is your uname() broken?'
8986                 . ./myread
8987                 case "$ans" in
8988                 n*) d_uname="$define"; call=uname;;
8989                 esac
8990         else
8991                 echo 'uname() found.' >&4
8992                 d_uname="$define"
8993                 case "$call" in
8994                 '') call=uname ;;
8995                 esac
8996         fi
8997 fi
8998 case "$d_gethname" in
8999 '') d_gethname="$undef";;
9000 esac
9001 case "$d_uname" in
9002 '') d_uname="$undef";;
9003 esac
9004 case "$d_uname$d_gethname" in
9005 *define*)
9006         dflt=n
9007         cat <<EOM
9008  
9009 Every now and then someone has a $call() that lies about the hostname
9010 but can't be fixed for political or economic reasons.  If you wish, I can
9011 pretend $call() isn't there and maybe compute hostname at run-time
9012 thanks to the '$phostname' command.
9013
9014 EOM
9015         rp="Shall I ignore $call() from now on?"
9016         . ./myread
9017         case "$ans" in
9018         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9019         esac;;
9020 esac
9021 case "$phostname" in
9022 '') aphostname='';;
9023 *) case "$aphostname" in
9024         /*) ;;
9025         *) set X $phostname
9026                 shift
9027                 file=$1
9028                 shift
9029                 file=`./loc $file $file $pth`
9030                 aphostname=`echo $file $*`
9031                 ;;
9032         esac
9033         ;;
9034 esac
9035 case "$d_uname$d_gethname" in
9036 *define*) ;;
9037 *)
9038         case "$phostname" in
9039         '')
9040                 echo "There will be no way for $package to get your hostname." >&4;;
9041         *)
9042         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9043                 ;;
9044         esac;;
9045 esac
9046 case "$d_phostname" in
9047 '') d_phostname="$undef";;
9048 esac
9049
9050 : see if this is a netdb.h system
9051 set netdb.h i_netdb
9052 eval $inhdr
9053
9054 : see if prototypes for various gethostxxx netdb.h functions are available
9055 echo " "
9056 set d_gethostprotos gethostent $i_netdb netdb.h
9057 eval $hasproto
9058
9059 : see if getlogin exists
9060 set getlogin d_getlogin
9061 eval $inlibc
9062
9063 : see if getmnt exists
9064 set getmnt d_getmnt
9065 eval $inlibc
9066
9067 : see if getmntent exists
9068 set getmntent d_getmntent
9069 eval $inlibc
9070
9071 : see if getnetbyaddr exists
9072 set getnetbyaddr d_getnbyaddr
9073 eval $inlibc
9074
9075 : see if getnetbyname exists
9076 set getnetbyname d_getnbyname
9077 eval $inlibc
9078
9079 : see if getnetent exists
9080 set getnetent d_getnent
9081 eval $inlibc
9082
9083 : see if prototypes for various getnetxxx netdb.h functions are available
9084 echo " "
9085 set d_getnetprotos getnetent $i_netdb netdb.h
9086 eval $hasproto
9087
9088
9089 : see if getprotobyname exists
9090 set getprotobyname d_getpbyname
9091 eval $inlibc
9092
9093 : see if getprotobynumber exists
9094 set getprotobynumber d_getpbynumber
9095 eval $inlibc
9096
9097 : see if getprotoent exists
9098 set getprotoent d_getpent
9099 eval $inlibc
9100
9101 : see if getpgid exists
9102 set getpgid d_getpgid
9103 eval $inlibc
9104
9105 : see if getpgrp2 exists
9106 set getpgrp2 d_getpgrp2
9107 eval $inlibc
9108
9109 : see if getppid exists
9110 set getppid d_getppid
9111 eval $inlibc
9112
9113 : see if getpriority exists
9114 set getpriority d_getprior
9115 eval $inlibc
9116
9117 : see if prototypes for various getprotoxxx netdb.h functions are available
9118 echo " "
9119 set d_getprotoprotos getprotoent $i_netdb netdb.h
9120 eval $hasproto
9121
9122 : see if getpwent exists
9123 set getpwent d_getpwent
9124 eval $inlibc
9125
9126
9127 : see if getservbyname exists
9128 set getservbyname d_getsbyname
9129 eval $inlibc
9130
9131 : see if getservbyport exists
9132 set getservbyport d_getsbyport
9133 eval $inlibc
9134
9135 : see if getservent exists
9136 set getservent d_getsent
9137 eval $inlibc
9138
9139 : see if prototypes for various getservxxx netdb.h functions are available
9140 echo " "
9141 set d_getservprotos getservent $i_netdb netdb.h
9142 eval $hasproto
9143
9144 : see if getspent exists
9145 set getspent d_getspent
9146 eval $inlibc
9147
9148 : see if getspnam exists
9149 set getspnam d_getspnam
9150 eval $inlibc
9151
9152 : see if gettimeofday or ftime exists
9153 set gettimeofday d_gettimeod
9154 eval $inlibc
9155 case "$d_gettimeod" in
9156 "$undef")
9157         set ftime d_ftime 
9158         eval $inlibc
9159         ;;
9160 *)
9161         val="$undef"; set d_ftime; eval $setvar
9162         ;;
9163 esac
9164 case "$d_gettimeod$d_ftime" in
9165 "$undef$undef")
9166         echo " "
9167         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9168         ;;
9169 esac
9170
9171 : see if this is an grp system
9172 set grp.h i_grp
9173 eval $inhdr
9174
9175 case "$i_grp" in
9176 $define)
9177         xxx=`./findhdr grp.h`
9178         $cppstdin $cppflags $cppminus < $xxx >$$.h
9179
9180         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9181                 val="$define"
9182         else
9183                 val="$undef"
9184         fi
9185         set d_grpasswd
9186         eval $setvar
9187
9188         $rm -f $$.h
9189         ;;
9190 *)
9191         val="$undef";
9192         set d_grpasswd; eval $setvar
9193         ;;
9194 esac
9195
9196 : see if hasmntopt exists
9197 set hasmntopt d_hasmntopt
9198 eval $inlibc
9199
9200 : see if this is a netinet/in.h or sys/in.h system
9201 set netinet/in.h i_niin sys/in.h i_sysin
9202 eval $inhdr
9203
9204 : see if arpa/inet.h has to be included
9205 set arpa/inet.h i_arpainet
9206 eval $inhdr
9207
9208 : see if htonl --and friends-- exists
9209 val=''
9210 set htonl val
9211 eval $inlibc
9212
9213 : Maybe they are macros.
9214 case "$val" in
9215 $undef)
9216         $cat >htonl.c <<EOM
9217 #include <stdio.h>
9218 #include <sys/types.h>
9219 #$i_niin I_NETINET_IN
9220 #$i_sysin I_SYS_IN
9221 #$i_arpainet I_ARPA_INET
9222 #ifdef I_NETINET_IN
9223 #include <netinet/in.h>
9224 #endif
9225 #ifdef I_SYS_IN
9226 #include <sys/in.h>
9227 #endif
9228 #ifdef I_ARPA_INET
9229 #include <arpa/inet.h>
9230 #endif
9231 #ifdef htonl
9232 printf("Defined as a macro.");
9233 #endif
9234 EOM
9235         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9236         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9237                 val="$define"
9238                 echo "But it seems to be defined as a macro." >&4
9239         fi
9240         $rm -f htonl.?
9241         ;;
9242 esac
9243 set d_htonl
9244 eval $setvar
9245
9246 : see if iconv exists
9247 set iconv d_iconv
9248 eval $inlibc
9249
9250 : index or strchr
9251 echo " "
9252 if set index val -f; eval $csym; $val; then
9253         if set strchr val -f d_strchr; eval $csym; $val; then
9254                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9255                         val="$define"
9256                         vali="$undef"
9257                         echo "strchr() found." >&4
9258                 else
9259                         val="$undef"
9260                         vali="$define"
9261                         echo "index() found." >&4
9262                 fi
9263         else
9264                 val="$undef"
9265                 vali="$define"
9266                 echo "index() found." >&4
9267         fi
9268 else
9269         if set strchr val -f d_strchr; eval $csym; $val; then
9270                 val="$define"
9271                 vali="$undef"
9272                 echo "strchr() found." >&4
9273         else
9274                 echo "No index() or strchr() found!" >&4
9275                 val="$undef"
9276                 vali="$undef"
9277         fi
9278 fi
9279 set d_strchr; eval $setvar
9280 val="$vali"
9281 set d_index; eval $setvar
9282
9283 : check whether inet_aton exists
9284 set inet_aton d_inetaton
9285 eval $inlibc
9286
9287 : see if inttypes.h is available
9288 : we want a real compile instead of Inhdr because some systems
9289 : have an inttypes.h which includes non-existent headers
9290 echo " "
9291 $cat >try.c <<EOCP
9292 #include <inttypes.h>
9293 int main() {
9294         static int32_t foo32 = 0x12345678;
9295 }
9296 EOCP
9297 set try
9298 if eval $compile; then
9299         echo "<inttypes.h> found." >&4
9300         val="$define"
9301 else
9302         echo "<inttypes.h> NOT found." >&4
9303         val="$undef"
9304 fi
9305 $rm -f try.c try
9306 set i_inttypes
9307 eval $setvar
9308
9309 : check for int64_t
9310 echo " "
9311 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9312 $cat >try.c <<EOCP
9313 #include <sys/types.h>
9314 #$i_inttypes I_INTTYPES
9315 #ifdef I_INTTYPES
9316 #include <inttypes.h>
9317 #endif
9318 int main() { int64_t x = 7; }
9319 EOCP
9320 set try
9321 if eval $compile; then
9322         val="$define"
9323         echo " Yes, it does." >&4
9324 else
9325         val="$undef"
9326         echo " No, it doesn't." >&4
9327 fi
9328 $rm -f try try.*
9329 set d_int64t
9330 eval $setvar
9331
9332 : Look for isascii
9333 echo " "
9334 $cat >isascii.c <<'EOCP'
9335 #include <stdio.h>
9336 #include <ctype.h>
9337 int main() {
9338         int c = 'A';
9339         if (isascii(c))
9340                 exit(0);
9341         else
9342                 exit(1);
9343 }
9344 EOCP
9345 set isascii
9346 if eval $compile; then
9347         echo "isascii() found." >&4
9348         val="$define"
9349 else
9350         echo "isascii() NOT found." >&4
9351         val="$undef"
9352 fi
9353 set d_isascii
9354 eval $setvar
9355 $rm -f isascii*
9356
9357 : see if killpg exists
9358 set killpg d_killpg
9359 eval $inlibc
9360
9361 : see if lchown exists
9362 echo " "
9363 $cat > try.c <<'EOCP'
9364 /* System header to define __stub macros and hopefully few prototypes,
9365     which can conflict with char lchown(); below.  */
9366 #include <assert.h>
9367 /* Override any gcc2 internal prototype to avoid an error.  */
9368 /* We use char because int might match the return type of a gcc2
9369    builtin and then its argument prototype would still apply.  */
9370 char lchown();
9371 int main() {
9372     /*  The GNU C library defines this for functions which it implements
9373         to always fail with ENOSYS.  Some functions are actually named
9374         something starting with __ and the normal name is an alias.  */
9375 #if defined (__stub_lchown) || defined (__stub___lchown)
9376 choke me
9377 #else
9378 lchown();
9379 #endif
9380 ; return 0; }
9381 EOCP
9382 set try
9383 if eval $compile; then
9384     $echo "lchown() found." >&4
9385     val="$define"
9386 else
9387     $echo "lchown() NOT found." >&4
9388     val="$undef"
9389 fi
9390 set d_lchown
9391 eval $setvar
9392
9393 : See if number of significant digits in a double precision number is known
9394 echo " "
9395 $cat >ldbl_dig.c <<EOM
9396 #$i_limits I_LIMITS
9397 #$i_float I_FLOAT
9398 #ifdef I_LIMITS
9399 #include <limits.h>
9400 #endif
9401 #ifdef I_FLOAT
9402 #include <float.h>
9403 #endif
9404 #ifdef LDBL_DIG
9405 printf("Contains LDBL_DIG");
9406 #endif
9407 EOM
9408 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9409 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9410         echo "LDBL_DIG found." >&4
9411         val="$define"
9412 else
9413         echo "LDBL_DIG NOT found." >&4
9414         val="$undef"
9415 fi
9416 $rm -f ldbl_dig.?
9417 set d_ldbl_dig
9418 eval $setvar
9419
9420 : see if link exists
9421 set link d_link
9422 eval $inlibc
9423
9424 : see if localeconv exists
9425 set localeconv d_locconv
9426 eval $inlibc
9427
9428 : see if lockf exists
9429 set lockf d_lockf
9430 eval $inlibc
9431
9432 : check for long long
9433 echo " "
9434 $echo $n "Checking to see if your system supports long long..." $c >&4
9435 echo 'int main() { long long x = 7; return 0; }' > try.c
9436 set try
9437 if eval $compile; then
9438         val="$define"
9439         echo " Yes, it does." >&4
9440 else
9441         val="$undef"
9442         echo " No, it doesn't." >&4
9443 fi
9444 $rm try.*
9445 set d_longlong
9446 eval $setvar
9447
9448 : check for length of long long
9449 case "${d_longlong}${longlongsize}" in
9450 $define)
9451         echo " "
9452         $echo $n "Checking to see how big your long longs are..." $c >&4
9453         $cat >try.c <<'EOCP'
9454 #include <stdio.h>
9455 int main()
9456 {
9457     printf("%d\n", (int)sizeof(long long));
9458     return(0);
9459 }
9460 EOCP
9461         set try
9462         if eval $compile_ok; then
9463                 longlongsize=`./try$exe_ext`
9464                 $echo " $longlongsize bytes." >&4
9465         else
9466                 dflt='8'
9467                 echo " "
9468                 echo "(I can't seem to compile the test program.  Guessing...)"
9469                 rp="What is the size of a long long (in bytes)?"
9470                 . ./myread
9471                 longlongsize="$ans"
9472         fi
9473         if $test "X$longsize" = "X$longlongsize"; then
9474                 echo "(That isn't any different from an ordinary long.)"
9475         fi      
9476         ;;
9477 esac
9478 $rm -f try.* try
9479
9480 : see if lstat exists
9481 set lstat d_lstat
9482 eval $inlibc
9483
9484 : see if mblen exists
9485 set mblen d_mblen
9486 eval $inlibc
9487
9488 : see if mbstowcs exists
9489 set mbstowcs d_mbstowcs
9490 eval $inlibc
9491
9492 : see if mbtowc exists
9493 set mbtowc d_mbtowc
9494 eval $inlibc
9495
9496 : see if memchr exists
9497 set memchr d_memchr
9498 eval $inlibc
9499
9500 : see if memcmp exists
9501 set memcmp d_memcmp
9502 eval $inlibc
9503
9504 : see if memcpy exists
9505 set memcpy d_memcpy
9506 eval $inlibc
9507
9508 : see if memmove exists
9509 set memmove d_memmove
9510 eval $inlibc
9511
9512 : see if memset exists
9513 set memset d_memset
9514 eval $inlibc
9515
9516 : see if mkdir exists
9517 set mkdir d_mkdir
9518 eval $inlibc
9519
9520 : see if mkdtemp exists
9521 set mkdtemp d_mkdtemp
9522 eval $inlibc
9523
9524 : see if mkfifo exists
9525 set mkfifo d_mkfifo
9526 eval $inlibc
9527
9528 : see if mkstemp exists
9529 set mkstemp d_mkstemp
9530 eval $inlibc
9531
9532 : see if mkstemps exists
9533 set mkstemps d_mkstemps
9534 eval $inlibc
9535
9536 : see if mktime exists
9537 set mktime d_mktime
9538 eval $inlibc
9539
9540 : see if mprotect exists
9541 set mprotect d_mprotect
9542 eval $inlibc
9543
9544 : see if msgctl exists
9545 set msgctl d_msgctl
9546 eval $inlibc
9547
9548 : see if msgget exists
9549 set msgget d_msgget
9550 eval $inlibc
9551
9552 : see if msgsnd exists
9553 set msgsnd d_msgsnd
9554 eval $inlibc
9555
9556 : see if msgrcv exists
9557 set msgrcv d_msgrcv
9558 eval $inlibc
9559
9560 : see how much of the 'msg*(2)' library is present.
9561 h_msg=true
9562 echo " "
9563 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9564 *"$undef"*) h_msg=false;;
9565 esac
9566 case "$osname" in
9567 freebsd)
9568     case "`ipcs 2>&1`" in
9569     "SVID messages"*"not configured"*)
9570         echo "Your $osname does not have the msg*(2) configured." >&4
9571         h_msg=false
9572         val="$undef"
9573         set msgctl d_msgctl
9574         eval $setvar
9575         set msgget d_msgget
9576         eval $setvar
9577         set msgsnd d_msgsnd
9578         eval $setvar
9579         set msgrcv d_msgrcv
9580         eval $setvar
9581         ;;
9582     esac
9583     ;;
9584 esac
9585 : we could also check for sys/ipc.h ...
9586 if $h_msg && $test `./findhdr sys/msg.h`; then
9587         echo "You have the full msg*(2) library." >&4
9588         val="$define"
9589 else
9590         echo "You don't have the full msg*(2) library." >&4
9591         val="$undef"
9592 fi
9593 set d_msg
9594 eval $setvar
9595
9596 : see if msync exists
9597 set msync d_msync
9598 eval $inlibc
9599
9600 : see if munmap exists
9601 set munmap d_munmap
9602 eval $inlibc
9603
9604 : see if nice exists
9605 set nice d_nice
9606 eval $inlibc
9607
9608
9609 echo " "
9610 echo "Checking which 64-bit integer type we could use..." >&4
9611
9612 case "$intsize" in
9613 8) val=int
9614    set quadtype
9615    eval $setvar
9616    val='"unsigned int"'
9617    set uquadtype
9618    eval $setvar
9619    quadkind=1
9620    ;;
9621 *) case "$longsize" in
9622    8) val=long
9623       set quadtype
9624       eval $setvar
9625       val='"unsigned long"'
9626       set uquadtype
9627       eval $setvar
9628       quadkind=2
9629       ;;
9630    *) case "$d_longlong:$longlongsize" in
9631       define:8)
9632         val='"long long"'
9633         set quadtype
9634         eval $setvar
9635         val='"unsigned long long"'
9636         set uquadtype
9637         eval $setvar
9638         quadkind=3
9639         ;;
9640       *) case "$d_int64t" in
9641          define)
9642            val=int64_t
9643            set quadtype
9644            eval $setvar
9645            val=uint64_t
9646            set uquadtype
9647            eval $setvar
9648            quadkind=4
9649            ;;
9650          esac
9651          ;;
9652       esac
9653       ;;
9654    esac
9655    ;;
9656 esac
9657
9658 case "$quadtype" in
9659 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9660         undef:define:8)
9661            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9662         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9663         esac
9664         d_quad="$undef"
9665         ;;
9666 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9667             verb="will"
9668         else
9669             verb="could"
9670         fi
9671         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9672         d_quad="$define"
9673         ;;
9674 esac
9675
9676 : check for length of character
9677 echo " "
9678 case "$charsize" in
9679 '')
9680         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9681         $cat >try.c <<'EOCP'
9682 #include <stdio.h>
9683 int main()
9684 {
9685     printf("%d\n", (int)sizeof(char));
9686     exit(0);
9687 }
9688 EOCP
9689         set try
9690         if eval $compile_ok; then
9691                 dflt=`./try`
9692         else
9693                 dflt='1'
9694                 echo "(I can't seem to compile the test program.  Guessing...)"
9695         fi
9696         ;;
9697 *)
9698         dflt="$charsize"
9699         ;;
9700 esac
9701 rp="What is the size of a character (in bytes)?"
9702 . ./myread
9703 charsize="$ans"
9704 $rm -f try.c try
9705
9706
9707 echo " "
9708 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9709
9710 case "$use64bits:$d_quad:$quadtype" in
9711 define:define:?*)
9712         ivtype="$quadtype"
9713         uvtype="$uquadtype"
9714         ivsize=8
9715         uvsize=8
9716         ;;
9717 *)      ivtype="long"
9718         uvtype="unsigned long"
9719         ivsize=$longsize
9720         uvsize=$longsize
9721         ;;
9722 esac
9723
9724 case "$uselongdouble:$d_longdbl" in
9725 define:define)
9726         nvtype="long double"
9727         nvsize=$longdblsize
9728         ;;
9729 *)      nvtype=double
9730         nvsize=$doublesize
9731         ;;
9732 esac
9733
9734 $echo "(IV will be "$ivtype", $ivsize bytes)"
9735 $echo "(UV will be "$uvtype", $uvsize bytes)"
9736 $echo "(NV will be "$nvtype", $nvsize bytes)"
9737
9738 $cat >try.c <<EOCP
9739 #$i_inttypes I_INTTYPES
9740 #ifdef I_INTTYPES
9741 #include <inttypes.h>
9742 #endif
9743 #include <stdio.h>
9744 int main() {
9745 #ifdef INT8
9746    int8_t i =  INT8_MAX;
9747   uint8_t u = UINT8_MAX;
9748   printf("int8_t\n");
9749 #endif
9750 #ifdef INT16
9751    int16_t i =  INT16_MAX;
9752   uint16_t i = UINT16_MAX;
9753   printf("int16_t\n");
9754 #endif
9755 #ifdef INT32
9756    int32_t i =  INT32_MAX;
9757   uint32_t u = UINT32_MAX;
9758   printf("int32_t\n");
9759 #endif
9760 }
9761 EOCP
9762
9763 case "$i8type" in
9764 '')     case "$charsize" in
9765         1)      i8type=char
9766                 u8type="unsigned char"
9767                 i8size=$charsize
9768                 u8size=$charsize
9769                 ;;
9770         esac
9771         ;;
9772 esac
9773 case "$i8type" in
9774 '')     set try -DINT8
9775         if eval $compile; then
9776                 case "`./try$exe_ext`" in
9777                 int8_t) i8type=int8_t
9778                         u8type=uint8_t
9779                         i8size=1
9780                         u8size=1
9781                         ;;
9782                 esac
9783         fi
9784         ;;
9785 esac
9786 case "$i8type" in
9787 '')     if $test $charsize -ge 1; then
9788                 i8type=char
9789                 u8type="unsigned char"
9790                 i8size=$charsize
9791                 u8size=$charsize
9792         fi
9793         ;;
9794 esac
9795
9796 case "$i16type" in
9797 '')     case "$shortsize" in
9798         2)      i16type=short
9799                 u16type="unsigned short"
9800                 i16size=$shortsize
9801                 u16size=$shortsize
9802                 ;;
9803         esac
9804         ;;
9805 esac
9806 case "$i16type" in
9807 '')     set try -DINT16
9808         if eval $compile; then
9809                 case "`./try$exe_ext`" in
9810                 int16_t)
9811                         i16type=int16_t
9812                         u16type=uint16_t
9813                         i16size=2
9814                         u16size=2
9815                         ;;
9816                 esac
9817         fi
9818         ;;
9819 esac
9820 case "$i16type" in
9821 '')     if $test $shortsize -ge 2; then
9822                 i16type=short
9823                 u16type="unsigned short"
9824                 i16size=$shortsize
9825                 u16size=$shortsize
9826         fi
9827         ;;
9828 esac
9829
9830 case "$i32type" in
9831 '')     case "$longsize" in
9832         4)      i32type=long
9833                 u32type="unsigned long"
9834                 i32size=$longsize
9835                 u32size=$longsize
9836                 ;;
9837         *)      case "$intsize" in
9838                 4)      i32type=int
9839                         u32type="unsigned int"
9840                         i32size=$intsize
9841                         u32size=$intsize
9842                         ;;
9843                 esac
9844                 ;;
9845         esac
9846         ;;
9847 esac
9848 case "$i32type" in
9849 '')     set try -DINT32
9850         if eval $compile; then
9851                 case "`./try$exe_ext`" in
9852                 int32_t)
9853                         i32type=int32_t
9854                         u32type=uint32_t
9855                         i32size=4
9856                         u32size=4
9857                         ;;
9858                 esac
9859         fi
9860         ;;
9861 esac
9862 case "$i32type" in
9863 '')     if $test $intsize -ge 4; then
9864                 i32type=int
9865                 u32type="unsigned int"
9866                 i32size=$intsize
9867                 u32size=$intsize
9868         fi
9869         ;;
9870 esac
9871
9872 case "$i64type" in
9873 '')     case "$d_quad:$quadtype" in
9874         define:?*)
9875                 i64type="$quadtype"
9876                 u64type="$uquadtype"
9877                 i64size=8
9878                 u64size=8
9879                 ;;
9880         esac
9881         ;;
9882 esac
9883
9884 $echo "Checking whether your NVs can preserve your UVs..." >&4
9885 $cat <<EOP >try.c
9886 #include <stdio.h>
9887 int main() {
9888     $uvtype k = ($uvtype)~0, l;
9889     $nvtype d;
9890     l = k;
9891     d = ($nvtype)l;
9892     l = ($uvtype)d;
9893     if (l == k)
9894        printf("preserve\n");
9895     exit(0);
9896 }
9897 EOP
9898 set try
9899 if eval $compile; then
9900         case "`./try$exe_ext`" in
9901         preserve) d_nv_preserves_uv="$define" ;;
9902         esac
9903 fi      
9904 case "$d_nv_preserves_uv" in
9905 $define) $echo "Yes, they can."  2>&1 ;;
9906 *)       $echo "No, they can't." 2>&1
9907          d_nv_preserves_uv="$undef"
9908          ;;
9909 esac
9910
9911 $rm -f try.* try
9912
9913 : see if POSIX threads are available
9914 set pthread.h i_pthread
9915 eval $inhdr
9916
9917
9918
9919
9920 : how to create joinable pthreads
9921 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9922         echo " "
9923         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9924         $cat >try.c <<'EOCP'
9925 #include <pthread.h>
9926 int main() {
9927     int detachstate = JOINABLE;
9928 }
9929 EOCP
9930         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9931         if eval $compile; then
9932                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9933                 val="$undef" # Yes, undef.
9934                 set d_old_pthread_create_joinable
9935                 eval $setvar
9936                 val=""
9937                 set old_pthread_create_joinable
9938                 eval $setvar
9939         else
9940                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9941                 if eval $compile; then
9942                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9943                         val="$define"
9944                         set d_old_pthread_create_joinable
9945                         eval $setvar
9946                         val=PTHREAD_CREATE_UNDETACHED
9947                         set old_pthread_create_joinable
9948                         eval $setvar
9949                 else            
9950                         set try -DJOINABLE=__UNDETACHED
9951                         if eval $compile; then
9952                                 echo "You seem to use __UNDETACHED." >&4
9953                                 val="$define"
9954                                 set d_old_pthread_create_joinable
9955                                 eval $setvar
9956                                 val=__UNDETACHED
9957                                 set old_pthread_create_joinable
9958                                 eval $setvar
9959                         else
9960                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9961                                 val="$define"
9962                                 set d_old_pthread_create_joinable
9963                                 eval $setvar
9964                                 val=0
9965                                 set old_pthread_create_joinable
9966                                 eval $setvar
9967                         fi
9968                 fi
9969         fi
9970         $rm -f try try.*
9971 else
9972     d_old_pthread_create_joinable="$undef"
9973     old_pthread_create_joinable=""
9974 fi
9975
9976 : see if pause exists
9977 set pause d_pause
9978 eval $inlibc
9979
9980 : see if pipe exists
9981 set pipe d_pipe
9982 eval $inlibc
9983
9984 : see if poll exists
9985 set poll d_poll
9986 eval $inlibc
9987
9988
9989 : see whether the various POSIXish _yields exist
9990 $cat >try.c <<EOP
9991 #include <pthread.h>
9992 #include <stdio.h>
9993 int main() {
9994 #ifdef SCHED_YIELD
9995         sched_yield();
9996 #else
9997 #ifdef PTHREAD_YIELD
9998         pthread_yield();
9999 #else
10000 #ifdef PTHREAD_YIELD_NULL
10001         pthread_yield(NULL);
10002 #endif
10003 #endif
10004 #endif
10005 }
10006 EOP
10007 : see if sched_yield exists
10008 set try -DSCHED_YIELD
10009 if eval $compile; then
10010     val="$define"
10011     sched_yield='sched_yield()'
10012 else
10013     val="$undef"
10014 fi
10015 case "$usethreads" in
10016 $define)
10017         case "$val" in
10018         $define) echo 'sched_yield() found.' >&4        ;;
10019         *)       echo 'sched_yield() NOT found.' >&4    ;;
10020         esac
10021 esac
10022 set d_sched_yield
10023 eval $setvar
10024
10025 : see if pthread_yield exists
10026 set try -DPTHREAD_YIELD
10027 if eval $compile; then
10028     val="$define"
10029     case "$sched_yield" in
10030     '') sched_yield='pthread_yield()' ;;
10031     esac
10032 else
10033     set try -DPTHREAD_YIELD_NULL
10034     if eval $compile; then
10035         val="$define"
10036         case "$sched_yield" in
10037         '') sched_yield='pthread_yield(NULL)' ;;
10038         esac
10039     else
10040         val="$undef"
10041     fi
10042 fi
10043 case "$usethreads" in
10044 $define)
10045         case "$val" in
10046         $define) echo 'pthread_yield() found.' >&4      ;;
10047         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10048         esac
10049         ;;
10050 esac
10051 set d_pthread_yield
10052 eval $setvar
10053
10054 case "$sched_yield" in
10055 '') sched_yield=undef ;;
10056 esac
10057
10058 $rm -f try try.*
10059
10060 : see if this is a pwd.h system
10061 set pwd.h i_pwd
10062 eval $inhdr
10063
10064 case "$i_pwd" in
10065 $define)
10066         xxx=`./findhdr pwd.h`
10067         $cppstdin $cppflags $cppminus < $xxx >$$.h
10068
10069         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10070                 val="$define"
10071         else
10072                 val="$undef"
10073         fi
10074         set d_pwquota
10075         eval $setvar
10076
10077         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10078                 val="$define"
10079         else
10080                 val="$undef"
10081         fi
10082         set d_pwage
10083         eval $setvar
10084
10085         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10086                 val="$define"
10087         else
10088                 val="$undef"
10089         fi
10090         set d_pwchange
10091         eval $setvar
10092
10093         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10094                 val="$define"
10095         else
10096                 val="$undef"
10097         fi
10098         set d_pwclass
10099         eval $setvar
10100
10101         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10102                 val="$define"
10103         else
10104                 val="$undef"
10105         fi
10106         set d_pwexpire
10107         eval $setvar
10108
10109         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10110                 val="$define"
10111         else
10112                 val="$undef"
10113         fi
10114         set d_pwcomment
10115         eval $setvar
10116
10117         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10118                 val="$define"
10119         else
10120                 val="$undef"
10121         fi
10122         set d_pwgecos
10123         eval $setvar
10124
10125         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10126                 val="$define"
10127         else
10128                 val="$undef"
10129         fi
10130         set d_pwpasswd
10131         eval $setvar
10132
10133         $rm -f $$.h
10134         ;;
10135 *)
10136         val="$undef"; 
10137         set d_pwquota; eval $setvar
10138         set d_pwage; eval $setvar
10139         set d_pwchange; eval $setvar
10140         set d_pwclass; eval $setvar
10141         set d_pwexpire; eval $setvar
10142         set d_pwcomment; eval $setvar
10143         set d_pwgecos; eval $setvar
10144         set d_pwpasswd; eval $setvar
10145         ;;
10146 esac
10147
10148 : see if readdir and friends exist
10149 set readdir d_readdir
10150 eval $inlibc
10151 set seekdir d_seekdir
10152 eval $inlibc
10153 set telldir d_telldir
10154 eval $inlibc
10155 set rewinddir d_rewinddir
10156 eval $inlibc
10157
10158 : see if readlink exists
10159 set readlink d_readlink
10160 eval $inlibc
10161
10162 : see if rename exists
10163 set rename d_rename
10164 eval $inlibc
10165
10166 : see if rmdir exists
10167 set rmdir d_rmdir
10168 eval $inlibc
10169
10170 : see if memory.h is available.
10171 val=''
10172 set memory.h val
10173 eval $inhdr
10174
10175 : See if it conflicts with string.h
10176 case "$val" in
10177 $define)
10178         case "$strings" in
10179         '') ;;
10180         *)
10181                 $cppstdin $cppflags $cppminus < $strings > mem.h
10182                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10183                         echo " "
10184                         echo "We won't be including <memory.h>."
10185                         val="$undef"
10186                 fi
10187                 $rm -f mem.h
10188                 ;;
10189         esac
10190 esac
10191 set i_memory
10192 eval $setvar
10193
10194 : can bcopy handle overlapping blocks?
10195 val="$undef"
10196 case "$d_bcopy" in
10197 "$define")
10198         echo " "
10199         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10200         $cat >try.c <<EOCP
10201 #$i_memory I_MEMORY
10202 #$i_stdlib I_STDLIB
10203 #$i_string I_STRING
10204 #$i_unistd I_UNISTD
10205 EOCP
10206         $cat >>try.c <<'EOCP'
10207 #include <stdio.h>
10208 #ifdef I_MEMORY
10209 #  include <memory.h>
10210 #endif
10211 #ifdef I_STDLIB
10212 #  include <stdlib.h>
10213 #endif
10214 #ifdef I_STRING
10215 #  include <string.h>
10216 #else
10217 #  include <strings.h>
10218 #endif
10219 #ifdef I_UNISTD
10220 #  include <unistd.h>  /* Needed for NetBSD */
10221 #endif
10222 int main()
10223 {
10224 char buf[128], abc[128];
10225 char *b;
10226 int len;
10227 int off;
10228 int align;
10229
10230 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10231
10232 for (align = 7; align >= 0; align--) {
10233         for (len = 36; len; len--) {
10234                 b = buf+align;
10235                 bcopy(abc, b, len);
10236                 for (off = 1; off <= len; off++) {
10237                         bcopy(b, b+off, len);
10238                         bcopy(b+off, b, len);
10239                         if (bcmp(b, abc, len))
10240                                 exit(1);
10241                 }
10242         }
10243 }
10244 exit(0);
10245 }
10246 EOCP
10247         set try
10248         if eval $compile_ok; then
10249                 if ./try 2>/dev/null; then
10250                         echo "Yes, it can."
10251                         val="$define"
10252                 else
10253                         echo "It can't, sorry."
10254                         case "$d_memmove" in
10255                         "$define") echo "But that's Ok since you have memmove()." ;;
10256                         esac
10257                 fi
10258         else
10259                 echo "(I can't compile the test program, so we'll assume not...)"
10260                 case "$d_memmove" in
10261                 "$define") echo "But that's Ok since you have memmove()." ;;
10262                 esac
10263         fi
10264         ;;
10265 esac
10266 $rm -f try.* try core
10267 set d_safebcpy
10268 eval $setvar
10269
10270 : can memcpy handle overlapping blocks?
10271 val="$undef"
10272 case "$d_memcpy" in
10273 "$define")
10274         echo " "
10275         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10276         $cat >try.c <<EOCP
10277 #$i_memory I_MEMORY
10278 #$i_stdlib I_STDLIB
10279 #$i_string I_STRING
10280 #$i_unistd I_UNISTD
10281 EOCP
10282         $cat >>try.c <<'EOCP'
10283 #include <stdio.h>
10284 #ifdef I_MEMORY
10285 #  include <memory.h>
10286 #endif
10287 #ifdef I_STDLIB
10288 #  include <stdlib.h>
10289 #endif
10290 #ifdef I_STRING
10291 #  include <string.h>
10292 #else
10293 #  include <strings.h>
10294 #endif
10295 #ifdef I_UNISTD
10296 #  include <unistd.h>  /* Needed for NetBSD */
10297 #endif
10298 int main()
10299 {
10300 char buf[128], abc[128];
10301 char *b;
10302 int len;
10303 int off;
10304 int align;
10305
10306 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10307    try to store the string in read-only memory. */
10308 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10309
10310 for (align = 7; align >= 0; align--) {
10311         for (len = 36; len; len--) {
10312                 b = buf+align;
10313                 memcpy(b, abc, len);
10314                 for (off = 1; off <= len; off++) {
10315                         memcpy(b+off, b, len);
10316                         memcpy(b, b+off, len);
10317                         if (memcmp(b, abc, len))
10318                                 exit(1);
10319                 }
10320         }
10321 }
10322 exit(0);
10323 }
10324 EOCP
10325         set try
10326         if eval $compile_ok; then
10327                 if ./try 2>/dev/null; then
10328                         echo "Yes, it can."
10329                         val="$define"
10330                 else
10331                         echo "It can't, sorry."
10332                         case "$d_memmove" in
10333                         "$define") echo "But that's Ok since you have memmove()." ;;
10334                         esac
10335                 fi
10336         else
10337                 echo "(I can't compile the test program, so we'll assume not...)"
10338                 case "$d_memmove" in
10339                 "$define") echo "But that's Ok since you have memmove()." ;;
10340                 esac
10341         fi
10342         ;;
10343 esac
10344 $rm -f try.* try core
10345 set d_safemcpy
10346 eval $setvar
10347
10348 : can memcmp be trusted to compare relative magnitude?
10349 val="$undef"
10350 case "$d_memcmp" in
10351 "$define")
10352         echo " "
10353         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10354         $cat >try.c <<EOCP
10355 #$i_memory I_MEMORY
10356 #$i_stdlib I_STDLIB
10357 #$i_string I_STRING
10358 #$i_unistd I_UNISTD
10359 EOCP
10360         $cat >>try.c <<'EOCP'
10361 #include <stdio.h>
10362 #ifdef I_MEMORY
10363 #  include <memory.h>
10364 #endif
10365 #ifdef I_STDLIB
10366 #  include <stdlib.h>
10367 #endif
10368 #ifdef I_STRING
10369 #  include <string.h>
10370 #else
10371 #  include <strings.h>
10372 #endif
10373 #ifdef I_UNISTD
10374 #  include <unistd.h>  /* Needed for NetBSD */
10375 #endif
10376 int main()
10377 {
10378 char a = -1;
10379 char b = 0;
10380 if ((a < b) && memcmp(&a, &b, 1) < 0)
10381         exit(1);
10382 exit(0);
10383 }
10384 EOCP
10385         set try
10386         if eval $compile_ok; then
10387                 if ./try 2>/dev/null; then
10388                         echo "Yes, it can."
10389                         val="$define"
10390                 else
10391                         echo "No, it can't (it uses signed chars)."
10392                 fi
10393         else
10394                 echo "(I can't compile the test program, so we'll assume not...)"
10395         fi
10396         ;;
10397 esac
10398 $rm -f try.* try core
10399 set d_sanemcmp
10400 eval $setvar
10401
10402 : see if select exists
10403 set select d_select
10404 eval $inlibc
10405
10406 : see if semctl exists
10407 set semctl d_semctl
10408 eval $inlibc
10409
10410 : see if semget exists
10411 set semget d_semget
10412 eval $inlibc
10413
10414 : see if semop exists
10415 set semop d_semop
10416 eval $inlibc
10417
10418 : see how much of the 'sem*(2)' library is present.
10419 h_sem=true
10420 echo " "
10421 case "$d_semctl$d_semget$d_semop" in
10422 *"$undef"*) h_sem=false;;
10423 esac
10424 case "$osname" in
10425 freebsd)
10426     case "`ipcs 2>&1`" in
10427     "SVID messages"*"not configured"*)
10428         echo "Your $osname does not have the sem*(2) configured." >&4
10429         h_sem=false
10430         val="$undef"
10431         set semctl d_semctl
10432         eval $setvar
10433         set semget d_semget
10434         eval $setvar
10435         set semop d_semop
10436         eval $setvar
10437         ;;
10438     esac
10439     ;;
10440 esac
10441 : we could also check for sys/ipc.h ...
10442 if $h_sem && $test `./findhdr sys/sem.h`; then
10443         echo "You have the full sem*(2) library." >&4
10444         val="$define"
10445 else
10446         echo "You don't have the full sem*(2) library." >&4
10447         val="$undef"
10448 fi
10449 set d_sem
10450 eval $setvar
10451
10452 : see whether sys/sem.h defines union semun
10453 echo " "
10454 $cat > try.c <<'END'
10455 #include <sys/types.h>
10456 #include <sys/ipc.h>
10457 #include <sys/sem.h>
10458 int main () { union semun semun; semun.buf = 0; }
10459 END
10460 set try
10461 if eval $compile; then
10462     echo "You have union semun in <sys/sem.h>." >&4
10463     val="$define"
10464 else
10465     echo "You do not have union semun in <sys/sem.h>." >&4
10466     val="$undef"
10467 fi
10468 $rm -f try try.c try.h
10469 set d_union_semun
10470 eval $setvar
10471
10472 : see how to do semctl IPC_STAT
10473 case "$d_sem" in
10474 $define)
10475     : see whether semctl IPC_STAT can use union semun
10476     echo " "
10477     $cat > try.h <<END
10478 #ifndef S_IRUSR
10479 #   ifdef S_IREAD
10480 #       define S_IRUSR S_IREAD
10481 #       define S_IWUSR S_IWRITE
10482 #       define S_IXUSR S_IEXEC
10483 #   else
10484 #       define S_IRUSR 0400
10485 #       define S_IWUSR 0200
10486 #       define S_IXUSR 0100
10487 #   endif
10488 #   define S_IRGRP (S_IRUSR>>3)
10489 #   define S_IWGRP (S_IWUSR>>3)
10490 #   define S_IXGRP (S_IXUSR>>3)
10491 #   define S_IROTH (S_IRUSR>>6)
10492 #   define S_IWOTH (S_IWUSR>>6)
10493 #   define S_IXOTH (S_IXUSR>>6)
10494 #endif
10495 #ifndef S_IRWXU
10496 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10497 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10498 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10499 #endif
10500 END
10501
10502     $cat > try.c <<END
10503 #include <sys/types.h>
10504 #include <sys/ipc.h>
10505 #include <sys/sem.h>
10506 #include <sys/stat.h>
10507 #include <stdio.h>
10508 #include <errno.h>
10509 #include "try.h"
10510 #ifndef errno
10511 extern int errno;
10512 #endif
10513 #$d_union_semun HAS_UNION_SEMUN
10514 int main() {
10515     union semun
10516 #ifndef HAS_UNION_SEMUN
10517     {
10518         int val;
10519         struct semid_ds *buf;
10520         unsigned short *array;
10521     }
10522 #endif
10523     arg;
10524     int sem, st;
10525
10526 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10527     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10528     if (sem > -1) {
10529         struct semid_ds argbuf;
10530         arg.buf = &argbuf;
10531 #       ifdef IPC_STAT
10532         st = semctl(sem, 0, IPC_STAT, arg);
10533         if (st == 0)
10534             printf("semun\n");
10535         else
10536 #       endif /* IPC_STAT */
10537             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10538 #       ifdef IPC_RMID
10539         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10540 #       endif /* IPC_RMID */
10541             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10542     } else
10543 #endif /* IPC_PRIVATE && ... */
10544         printf("semget failed: errno = %d\n", errno);
10545   return 0;
10546 }
10547 END
10548     val="$undef"
10549     set try
10550     if eval $compile; then
10551         xxx=`./try`
10552         case "$xxx" in
10553         semun) val="$define" ;;
10554         esac
10555     fi
10556     $rm -f try try.c
10557     set d_semctl_semun
10558     eval $setvar
10559     case "$d_semctl_semun" in
10560     $define)
10561         echo "You can use union semun for semctl IPC_STAT." >&4
10562         also='also'
10563         ;;
10564     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10565         also=''
10566         ;;
10567     esac
10568
10569     : see whether semctl IPC_STAT can use struct semid_ds pointer
10570     $cat > try.c <<'END'
10571 #include <sys/types.h>
10572 #include <sys/ipc.h>
10573 #include <sys/sem.h>
10574 #include <sys/stat.h>
10575 #include "try.h"
10576 #include <stdio.h>
10577 #include <errno.h>
10578 #ifndef errno
10579 extern int errno;
10580 #endif
10581 int main() {
10582     struct semid_ds arg;
10583     int sem, st;
10584
10585 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10586     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10587     if (sem > -1) {
10588 #       ifdef IPC_STAT
10589         st = semctl(sem, 0, IPC_STAT, &arg);
10590         if (st == 0)
10591             printf("semid_ds\n");
10592         else
10593 #       endif /* IPC_STAT */
10594             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10595 #       ifdef IPC_RMID
10596         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10597 #       endif /* IPC_RMID */
10598             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10599     } else
10600 #endif /* IPC_PRIVATE && ... */
10601         printf("semget failed: errno = %d\n", errno);
10602
10603     return 0;
10604 }
10605 END
10606     val="$undef"
10607     set try
10608     if eval $compile; then
10609         xxx=`./try`
10610         case "$xxx" in
10611         semid_ds) val="$define" ;;
10612         esac
10613     fi
10614     $rm -f try try.c
10615     set d_semctl_semid_ds
10616     eval $setvar
10617     case "$d_semctl_semid_ds" in
10618     $define)
10619         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10620         ;;
10621     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10622         ;;
10623     esac
10624     $rm -f try.h
10625     ;;
10626 *)  val="$undef"
10627
10628     # We do not have the full sem*(2) library, so assume we can not
10629     # use either.
10630
10631     set d_semctl_semun
10632     eval $setvar
10633
10634     set d_semctl_semid_ds
10635     eval $setvar
10636     ;;
10637 esac
10638
10639 : see if setegid exists
10640 set setegid d_setegid
10641 eval $inlibc
10642
10643 : see if seteuid exists
10644 set seteuid d_seteuid
10645 eval $inlibc
10646
10647 : see if setgrent exists
10648 set setgrent d_setgrent
10649 eval $inlibc
10650
10651 : see if sethostent exists
10652 set sethostent d_sethent
10653 eval $inlibc
10654
10655 : see if setlinebuf exists
10656 set setlinebuf d_setlinebuf
10657 eval $inlibc
10658
10659 : see if setlocale exists
10660 set setlocale d_setlocale
10661 eval $inlibc
10662
10663 : see if setnetent exists
10664 set setnetent d_setnent
10665 eval $inlibc
10666
10667 : see if setprotoent exists
10668 set setprotoent d_setpent
10669 eval $inlibc
10670
10671 : see if setpgid exists
10672 set setpgid d_setpgid
10673 eval $inlibc
10674
10675 : see if setpgrp2 exists
10676 set setpgrp2 d_setpgrp2
10677 eval $inlibc
10678
10679 : see if setpriority exists
10680 set setpriority d_setprior
10681 eval $inlibc
10682
10683 : see if setpwent exists
10684 set setpwent d_setpwent
10685 eval $inlibc
10686
10687 : see if setregid exists
10688 set setregid d_setregid
10689 eval $inlibc
10690 set setresgid d_setresgid
10691 eval $inlibc
10692
10693 : see if setreuid exists
10694 set setreuid d_setreuid
10695 eval $inlibc
10696 set setresuid d_setresuid
10697 eval $inlibc
10698
10699 : see if setrgid exists
10700 set setrgid d_setrgid
10701 eval $inlibc
10702
10703 : see if setruid exists
10704 set setruid d_setruid
10705 eval $inlibc
10706
10707 : see if setservent exists
10708 set setservent d_setsent
10709 eval $inlibc
10710
10711 : see if setsid exists
10712 set setsid d_setsid
10713 eval $inlibc
10714
10715 : see if setspent exists
10716 set setspent d_setspent
10717 eval $inlibc
10718
10719 : see if setvbuf exists
10720 set setvbuf d_setvbuf
10721 eval $inlibc
10722
10723 : see if sfio.h is available
10724 set sfio.h i_sfio
10725 eval $inhdr
10726
10727
10728 : see if sfio library is available
10729 case "$i_sfio" in
10730 $define)
10731         val=''
10732         set sfreserve val
10733         eval $inlibc
10734         ;;
10735 *)
10736         val="$undef"
10737         ;;
10738 esac
10739 : Ok, but do we want to use it.
10740 case "$val" in
10741 $define)
10742         case "$usesfio" in
10743         true|$define|[yY]*) dflt='y';;
10744         *) dflt='n';;
10745         esac
10746         echo "$package can use the sfio library, but it is experimental."
10747         rp="You seem to have sfio available, do you want to try using it?"
10748         . ./myread
10749         case "$ans" in
10750         y|Y) ;;
10751         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10752                 val="$undef"
10753                 : Remove sfio from list of libraries to use
10754                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10755                 shift
10756                 libs="$*"
10757                 echo "libs = $libs" >&4
10758                 ;;
10759         esac
10760         ;;
10761 *)      case "$usesfio" in
10762         true|$define|[yY]*)
10763                 echo "Sorry, cannot find sfio on this machine" >&4
10764                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10765                 ;;
10766         esac
10767         ;;
10768 esac
10769 set d_sfio
10770 eval $setvar
10771 case "$d_sfio" in
10772 $define) usesfio='true';;
10773 *) usesfio='false';;
10774 esac
10775
10776 : see if shmctl exists
10777 set shmctl d_shmctl
10778 eval $inlibc
10779
10780 : see if shmget exists
10781 set shmget d_shmget
10782 eval $inlibc
10783
10784 : see if shmat exists
10785 set shmat d_shmat
10786 eval $inlibc
10787 : see what shmat returns
10788 case "$d_shmat" in
10789 "$define")
10790         $cat >shmat.c <<'END'
10791 #include <sys/shm.h>
10792 void *shmat();
10793 END
10794         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10795                 shmattype='void *'
10796         else
10797                 shmattype='char *'
10798         fi
10799         echo "and it returns ($shmattype)." >&4
10800         : see if a prototype for shmat is available
10801         xxx=`./findhdr sys/shm.h`
10802         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10803         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10804                 val="$define"
10805         else
10806                 val="$undef"
10807         fi
10808         $rm -f shmat.[co]
10809         ;;
10810 *)
10811         val="$undef"
10812         ;;
10813 esac
10814 set d_shmatprototype
10815 eval $setvar
10816
10817 : see if shmdt exists
10818 set shmdt d_shmdt
10819 eval $inlibc
10820
10821 : see how much of the 'shm*(2)' library is present.
10822 h_shm=true
10823 echo " "
10824 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10825 *"$undef"*) h_shm=false;;
10826 esac
10827 case "$osname" in
10828 freebsd)
10829     case "`ipcs 2>&1`" in
10830     "SVID shared memory"*"not configured"*)
10831         echo "Your $osname does not have the shm*(2) configured." >&4
10832         h_shm=false
10833         val="$undef"
10834         set shmctl d_shmctl
10835         evat $setvar
10836         set shmget d_shmget
10837         evat $setvar
10838         set shmat d_shmat
10839         evat $setvar
10840         set shmdt d_shmdt
10841         evat $setvar
10842         ;;
10843     esac
10844     ;;
10845 esac
10846 : we could also check for sys/ipc.h ...
10847 if $h_shm && $test `./findhdr sys/shm.h`; then
10848         echo "You have the full shm*(2) library." >&4
10849         val="$define"
10850 else
10851         echo "You don't have the full shm*(2) library." >&4
10852         val="$undef"
10853 fi
10854 set d_shm
10855 eval $setvar
10856
10857 echo " "
10858 : see if we have sigaction
10859 if set sigaction val -f d_sigaction; eval $csym; $val; then
10860         echo 'sigaction() found.' >&4
10861         $cat > try.c <<'EOP'
10862 #include <stdio.h>
10863 #include <sys/types.h>
10864 #include <signal.h>
10865 int main()
10866 {
10867     struct sigaction act, oact;
10868     act.sa_flags = 0;
10869     oact.sa_handler = 0;
10870     /* so that act and oact are used */
10871     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10872 }
10873 EOP
10874         set try
10875         if eval $compile_ok; then
10876                 val="$define"
10877         else
10878                 echo "But you don't seem to have a useable struct sigaction." >&4
10879                 val="$undef"
10880         fi
10881 else
10882         echo 'sigaction NOT found.' >&4
10883         val="$undef"
10884 fi
10885 set d_sigaction; eval $setvar
10886 $rm -f try try$_o try.c
10887
10888 : see if sigsetjmp exists
10889 echo " "
10890 case "$d_sigsetjmp" in
10891 '')
10892         $cat >try.c <<'EOP'
10893 #include <setjmp.h>
10894 sigjmp_buf env;
10895 int set = 1;
10896 int main()
10897 {
10898         if (sigsetjmp(env,1))
10899                 exit(set);
10900         set = 0;
10901         siglongjmp(env, 1);
10902         exit(1);
10903 }
10904 EOP
10905         set try
10906         if eval $compile; then
10907                 if ./try >/dev/null 2>&1; then
10908                         echo "POSIX sigsetjmp found." >&4
10909                         val="$define"
10910                 else
10911                         $cat >&4 <<EOM
10912 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10913 I'll ignore them.
10914 EOM
10915                         val="$undef"
10916                 fi
10917         else
10918                 echo "sigsetjmp not found." >&4
10919                 val="$undef"
10920         fi
10921         ;;
10922 *) val="$d_sigsetjmp"
10923         case "$d_sigsetjmp" in
10924         $define) echo "POSIX sigsetjmp found." >&4;;
10925         $undef) echo "sigsetjmp not found." >&4;;
10926         esac
10927         ;;
10928 esac
10929 set d_sigsetjmp
10930 eval $setvar
10931 $rm -f try.c try
10932
10933 : see if sys/stat.h is available
10934 set sys/stat.h i_sysstat
10935 eval $inhdr
10936
10937
10938 : see if stat knows about block sizes
10939 echo " "
10940 echo "Checking to see if your struct stat has st_blocks field..." >&4
10941 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10942 eval $hasfield
10943
10944
10945 : see if this is a sys/vfs.h system
10946 set sys/vfs.h i_sysvfs
10947 eval $inhdr
10948
10949
10950 : see if this is a sys/statfs.h system
10951 set sys/statfs.h i_sysstatfs
10952 eval $inhdr
10953
10954
10955 echo " "
10956 echo "Checking to see if your system supports struct statfs..." >&4
10957 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
10958 eval $hasstruct
10959 case "$d_statfs_s" in
10960 "$define")      echo "Yes, it does."   ;;
10961 *)              echo "No, it doesn't." ;;
10962 esac
10963
10964
10965
10966 : see if struct statfs knows about f_flags
10967 case "$d_statfs_s" in
10968 define) 
10969         echo " "
10970         echo "Checking to see if your struct statfs has f_flags field..." >&4
10971         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
10972         eval $hasfield
10973         ;;
10974 *)      val="$undef"
10975         set d_statfs_f_flags
10976         eval $setvar
10977         ;;
10978 esac
10979 case "$d_statfs_f_flags" in
10980 "$define")      echo "Yes, it does."   ;;
10981 *)              echo "No, it doesn't." ;;
10982 esac
10983
10984 : see if _ptr and _cnt from stdio act std
10985 echo " "
10986 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10987         echo "(Looks like you have stdio.h from Linux.)"
10988         case "$stdio_ptr" in
10989         '') stdio_ptr='((fp)->_IO_read_ptr)'
10990                 ptr_lval=$define
10991                 ;;
10992         *)      ptr_lval=$d_stdio_ptr_lval;;
10993         esac
10994         case "$stdio_cnt" in
10995         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10996                 cnt_lval=$undef
10997                 ;;
10998         *)      cnt_lval=$d_stdio_cnt_lval;;
10999         esac
11000         case "$stdio_base" in
11001         '') stdio_base='((fp)->_IO_read_base)';;
11002         esac
11003         case "$stdio_bufsiz" in
11004         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11005         esac
11006 else
11007         case "$stdio_ptr" in
11008         '') stdio_ptr='((fp)->_ptr)'
11009                 ptr_lval=$define
11010                 ;;
11011         *)      ptr_lval=$d_stdio_ptr_lval;;
11012         esac
11013         case "$stdio_cnt" in
11014         '') stdio_cnt='((fp)->_cnt)'
11015                 cnt_lval=$define
11016                 ;;
11017         *)      cnt_lval=$d_stdio_cnt_lval;;
11018         esac
11019         case "$stdio_base" in
11020         '') stdio_base='((fp)->_base)';;
11021         esac
11022         case "$stdio_bufsiz" in
11023         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11024         esac
11025 fi
11026 : test whether _ptr and _cnt really work
11027 echo "Checking how std your stdio is..." >&4
11028 $cat >try.c <<EOP
11029 #include <stdio.h>
11030 #define FILE_ptr(fp)    $stdio_ptr
11031 #define FILE_cnt(fp)    $stdio_cnt
11032 int main() {
11033         FILE *fp = fopen("try.c", "r");
11034         char c = getc(fp);
11035         if (
11036                 18 <= FILE_cnt(fp) &&
11037                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11038         )
11039                 exit(0);
11040         exit(1);
11041 }
11042 EOP
11043 val="$undef"
11044 set try
11045 if eval $compile; then
11046         if ./try; then
11047                 echo "Your stdio acts pretty std."
11048                 val="$define"
11049         else
11050                 echo "Your stdio isn't very std."
11051         fi
11052 else
11053         echo "Your stdio doesn't appear very std."
11054 fi
11055 $rm -f try.c try
11056 set d_stdstdio
11057 eval $setvar
11058
11059 : Can _ptr be used as an lvalue?
11060 case "$d_stdstdio$ptr_lval" in
11061 $define$define) val=$define ;;
11062 *) val=$undef ;;
11063 esac
11064 set d_stdio_ptr_lval
11065 eval $setvar
11066
11067 : Can _cnt be used as an lvalue?
11068 case "$d_stdstdio$cnt_lval" in
11069 $define$define) val=$define ;;
11070 *) val=$undef ;;
11071 esac
11072 set d_stdio_cnt_lval
11073 eval $setvar
11074
11075 : see if _base is also standard
11076 val="$undef"
11077 case "$d_stdstdio" in
11078 $define)
11079         $cat >try.c <<EOP
11080 #include <stdio.h>
11081 #define FILE_base(fp)   $stdio_base
11082 #define FILE_bufsiz(fp) $stdio_bufsiz
11083 int main() {
11084         FILE *fp = fopen("try.c", "r");
11085         char c = getc(fp);
11086         if (
11087                 19 <= FILE_bufsiz(fp) &&
11088                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11089         )
11090                 exit(0);
11091         exit(1);
11092 }
11093 EOP
11094         set try
11095         if eval $compile; then
11096                 if ./try; then
11097                         echo "And its _base field acts std."
11098                         val="$define"
11099                 else
11100                         echo "But its _base field isn't std."
11101                 fi
11102         else
11103                 echo "However, it seems to be lacking the _base field."
11104         fi
11105         $rm -f try.c try
11106         ;;
11107 esac
11108 set d_stdiobase
11109 eval $setvar
11110
11111 $cat >&4 <<EOM
11112 Checking how to access stdio streams by file descriptor number...
11113 EOM
11114 case "$stdio_stream_array" in
11115 '')     $cat >try.c <<EOCP
11116 #include <stdio.h>
11117 int main() {
11118   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11119     printf("yes\n");
11120 }
11121 EOCP
11122         for s in _iob __iob __sF
11123         do
11124                 set try -DSTDIO_STREAM_ARRAY=$s
11125                 if eval $compile; then
11126                         case "`./try$exe_ext`" in
11127                         yes)    stdio_stream_array=$s; break ;;
11128                         esac
11129                 fi
11130         done
11131         $rm -f try.* try$exe_ext
11132 esac
11133 case "$stdio_stream_array" in
11134 '')     $cat >&4 <<EOM
11135 I can't figure out how to access stdio streams by file descriptor number.
11136 EOM
11137         d_stdio_stream_array="$undef"
11138         ;;
11139 *)      $cat >&4 <<EOM
11140 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11141 EOM
11142         d_stdio_stream_array="$define"
11143         ;;
11144 esac
11145
11146 : see if strcoll exists
11147 set strcoll d_strcoll
11148 eval $inlibc
11149
11150 : check for structure copying
11151 echo " "
11152 echo "Checking to see if your C compiler can copy structs..." >&4
11153 $cat >try.c <<'EOCP'
11154 int main()
11155 {
11156         struct blurfl {
11157                 int dyick;
11158         } foo, bar;
11159
11160         foo = bar;
11161 }
11162 EOCP
11163 if $cc -c try.c >/dev/null 2>&1 ; then
11164         val="$define"
11165         echo "Yup, it can."
11166 else
11167         val="$undef"
11168         echo "Nope, it can't."
11169 fi
11170 set d_strctcpy
11171 eval $setvar
11172 $rm -f try.*
11173
11174 : see if strerror and/or sys_errlist[] exist
11175 echo " "
11176 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11177     if set strerror val -f d_strerror; eval $csym; $val; then
11178                 echo 'strerror() found.' >&4
11179                 d_strerror="$define"
11180                 d_strerrm='strerror(e)'
11181                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11182                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11183                         d_syserrlst="$define"
11184                 else
11185                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11186                         d_syserrlst="$undef"
11187                 fi
11188     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11189                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11190                 echo 'strerror() found in string header.' >&4
11191                 d_strerror="$define"
11192                 d_strerrm='strerror(e)'
11193                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11194                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11195                                 d_syserrlst="$define"
11196                 else
11197                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11198                         d_syserrlst="$undef"
11199                 fi
11200     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11201                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11202                 d_strerror="$undef"
11203                 d_syserrlst="$define"
11204                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11205     else
11206                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11207                 d_strerror="$undef"
11208                 d_syserrlst="$undef"
11209                 d_strerrm='"unknown"'
11210     fi
11211 fi
11212
11213 : see if strtod exists
11214 set strtod d_strtod
11215 eval $inlibc
11216
11217 : see if strtol exists
11218 set strtol d_strtol
11219 eval $inlibc
11220
11221 : see if strtold exists
11222 set strtold d_strtold
11223 eval $inlibc
11224
11225 : see if strtoll exists
11226 set strtoll d_strtoll
11227 eval $inlibc
11228
11229 : see if strtoul exists
11230 set strtoul d_strtoul
11231 eval $inlibc
11232
11233 : see if strtoull exists
11234 set strtoull d_strtoull
11235 eval $inlibc
11236
11237 : see if strtouq exists
11238 set strtouq d_strtouq
11239 eval $inlibc
11240
11241 : see if strxfrm exists
11242 set strxfrm d_strxfrm
11243 eval $inlibc
11244
11245 : see if symlink exists
11246 set symlink d_symlink
11247 eval $inlibc
11248
11249 : see if syscall exists
11250 set syscall d_syscall
11251 eval $inlibc
11252
11253 : see if sysconf exists
11254 set sysconf d_sysconf
11255 eval $inlibc
11256
11257 : see if system exists
11258 set system d_system
11259 eval $inlibc
11260
11261 : see if tcgetpgrp exists
11262 set tcgetpgrp d_tcgetpgrp
11263 eval $inlibc
11264
11265 : see if tcsetpgrp exists
11266 set tcsetpgrp d_tcsetpgrp
11267 eval $inlibc
11268
11269 : see if prototype for telldir is available
11270 echo " "
11271 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11272 eval $hasproto
11273
11274 : see if this is a sys/times.h system
11275 set sys/times.h i_systimes
11276 eval $inhdr
11277
11278 : see if times exists
11279 echo " "
11280 if set times val -f d_times; eval $csym; $val; then
11281         echo 'times() found.' >&4
11282         d_times="$define"
11283         inc=''
11284         case "$i_systimes" in
11285         "$define") inc='sys/times.h';;
11286         esac
11287         rp="What is the type returned by times() on this system?"
11288         set clock_t clocktype long stdio.h sys/types.h $inc
11289         eval $typedef_ask
11290 else
11291         echo 'times() NOT found, hope that will do.' >&4
11292         d_times="$undef"
11293         clocktype='int'
11294 fi
11295
11296 : see if truncate exists
11297 set truncate d_truncate
11298 eval $inlibc
11299
11300 : see if tzname[] exists
11301 echo " "
11302 if set tzname val -a d_tzname; eval $csym; $val; then
11303         val="$define"
11304         echo 'tzname[] found.' >&4
11305 else
11306         val="$undef"
11307         echo 'tzname[] NOT found.' >&4
11308 fi
11309 set d_tzname
11310 eval $setvar
11311
11312 : see if umask exists
11313 set umask d_umask
11314 eval $inlibc
11315
11316 : see if ustat exists
11317 set ustat d_ustat
11318 eval $inlibc
11319
11320 : backward compatibility for d_hvfork
11321 if test X$d_hvfork != X; then
11322         d_vfork="$d_hvfork"
11323         d_hvfork=''
11324 fi
11325 : see if there is a vfork
11326 val=''
11327 set vfork val
11328 eval $inlibc
11329
11330 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11331 : perl on Solaris 2.x, and probably elsewhere.
11332 case "$val" in
11333 $define)
11334         echo " "
11335         case "$usevfork" in
11336         false) dflt='n';;
11337         *) dflt='y';;
11338         esac
11339         cat <<'EOM'
11340  
11341 Perl can only use a vfork() that doesn't suffer from strict
11342 restrictions on calling functions or modifying global data in
11343 the child.  For example, glibc-2.1 contains such a vfork()
11344 that is unsuitable.  If your system provides a proper fork()
11345 call, chances are that you do NOT want perl to use vfork().
11346
11347 EOM
11348         rp="Do you still want to use vfork()?"
11349         . ./myread
11350         case "$ans" in
11351         y|Y) ;;
11352         *)
11353                 echo "Ok, we won't use vfork()."
11354                 val="$undef"
11355                 ;;
11356         esac
11357         ;;
11358 esac
11359 set d_vfork
11360 eval $setvar
11361 case "$d_vfork" in
11362 $define) usevfork='true';;
11363 *) usevfork='false';;
11364 esac
11365
11366 : see if this is an sysdir system
11367 set sys/dir.h i_sysdir
11368 eval $inhdr
11369
11370 : see if this is an sysndir system
11371 set sys/ndir.h i_sysndir
11372 eval $inhdr
11373
11374 : see if closedir exists
11375 set closedir d_closedir
11376 eval $inlibc
11377
11378 case "$d_closedir" in
11379 "$define")
11380         echo " "
11381         echo "Checking whether closedir() returns a status..." >&4
11382         cat > closedir.c <<EOM
11383 #$i_dirent I_DIRENT             /**/
11384 #$i_sysdir I_SYS_DIR            /**/
11385 #$i_sysndir I_SYS_NDIR          /**/
11386 #$i_systypes I_SYS_TYPES        /**/
11387
11388 #if defined(I_SYS_TYPES)
11389 #include <sys/types.h>
11390 #endif
11391 #if defined(I_DIRENT)
11392 #include <dirent.h>
11393 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11394 #include <sys/dir.h>
11395 #endif
11396 #else
11397 #ifdef I_SYS_NDIR
11398 #include <sys/ndir.h>
11399 #else
11400 #ifdef I_SYS_DIR
11401 #ifdef hp9000s500
11402 #include <ndir.h>       /* may be wrong in the future */
11403 #else
11404 #include <sys/dir.h>
11405 #endif
11406 #endif
11407 #endif
11408 #endif 
11409 int main() { return closedir(opendir(".")); }
11410 EOM
11411         set closedir
11412         if eval $compile_ok; then
11413                 if ./closedir > /dev/null 2>&1 ; then
11414                         echo "Yes, it does."
11415                         val="$undef"
11416                 else
11417                         echo "No, it doesn't."
11418                         val="$define"
11419                 fi
11420         else
11421                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11422                 val="$define"
11423         fi
11424         ;;
11425 *)
11426         val="$undef";
11427         ;;
11428 esac
11429 set d_void_closedir
11430 eval $setvar
11431 $rm -f closedir*
11432 : check for volatile keyword
11433 echo " "
11434 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11435 $cat >try.c <<'EOCP'
11436 int main()
11437 {
11438         typedef struct _goo_struct goo_struct;
11439         goo_struct * volatile goo = ((goo_struct *)0);
11440         struct _goo_struct {
11441                 long long_int;
11442                 int reg_int;
11443                 char char_var;
11444         };
11445         typedef unsigned short foo_t;
11446         char *volatile foo;
11447         volatile int bar;
11448         volatile foo_t blech;
11449         foo = foo;
11450 }
11451 EOCP
11452 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11453         val="$define"
11454         echo "Yup, it does."
11455 else
11456         val="$undef"
11457         echo "Nope, it doesn't."
11458 fi
11459 set d_volatile
11460 eval $setvar
11461 $rm -f try.*
11462
11463 : see if there is a wait4
11464 set wait4 d_wait4
11465 eval $inlibc
11466
11467 : see if waitpid exists
11468 set waitpid d_waitpid
11469 eval $inlibc
11470
11471 : see if wcstombs exists
11472 set wcstombs d_wcstombs
11473 eval $inlibc
11474
11475 : see if wctomb exists
11476 set wctomb d_wctomb
11477 eval $inlibc
11478
11479 : preserve RCS keywords in files with variable substitution, grrr
11480 Date='$Date'
11481 Id='$Id'
11482 Log='$Log'
11483 RCSfile='$RCSfile'
11484 Revision='$Revision'
11485
11486 case "$crosscompile" in
11487 ''|[nN]*) crosscompile="$undef" ;;
11488 esac
11489
11490 case "$osname" in
11491 next|rhapsody) multiarch="$define" ;;
11492 esac
11493 case "$multiarch" in
11494 ''|[nN]*) multiarch="$undef" ;;
11495 esac
11496
11497 : check for alignment requirements
11498 echo " "
11499 case "$crosscompile$multiarch" in
11500 *$define*)
11501         $cat <<EOM
11502 You seem to be either cross-compiling or doing a multiarchitecture build,
11503 skipping the memory alignment check.
11504
11505 EOM
11506         case "$alignbytes" in
11507         '') alignbytes=8 ;;
11508         esac
11509         ;;
11510 *)
11511         case "$alignbytes" in
11512         '') echo "Checking alignment constraints..." >&4
11513                 $cat >try.c <<'EOCP'
11514 #include <stdio.h>
11515 struct foobar {
11516         char foo;
11517         double bar;
11518 } try_algn;
11519 int main()
11520 {
11521     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11522     return(0);
11523 }
11524 EOCP
11525                 set try
11526                 if eval $compile_ok; then
11527                         dflt=`./try`
11528                 else
11529                         dflt='8'
11530                         echo "(I can't seem to compile the test program...)"
11531                 fi
11532                 ;;
11533         *) dflt="$alignbytes"
11534                 ;;
11535         esac
11536         rp="Doubles must be aligned on a how-many-byte boundary?"
11537         . ./myread
11538         alignbytes="$ans"
11539         $rm -f try.c try
11540         ;;
11541 esac
11542
11543
11544 : check for ordering of bytes in a long
11545 echo " "
11546 case "$crosscompile$multiarch" in
11547 *$define*)
11548         $cat <<EOM
11549 You seem to be either cross-compiling or doing a multiarchitecture build,
11550 skipping the byteorder check.
11551
11552 EOM
11553         byteorder='0xffff'
11554         ;;
11555 *)
11556         case "$byteorder" in
11557         '')
11558                 $cat <<'EOM'
11559 In the following, larger digits indicate more significance.  A big-endian
11560 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11561 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11562 machines may have weird orders like 3412.  A Cray will report 87654321,
11563 an Alpha will report 12345678. If the test program works the default is
11564 probably right.
11565 I'm now running the test program...
11566 EOM
11567                 $cat >try.c <<'EOCP'
11568 #include <stdio.h>
11569 int main()
11570 {
11571         int i;
11572         union {
11573                 unsigned long l;
11574                 char c[sizeof(long)];
11575         } u;
11576
11577         if (sizeof(long) > 4)
11578                 u.l = (0x08070605L << 32) | 0x04030201L;
11579         else
11580                 u.l = 0x04030201L;
11581         for (i = 0; i < sizeof(long); i++)
11582                 printf("%c", u.c[i]+'0');
11583         printf("\n");
11584         exit(0);
11585 }
11586 EOCP
11587                 xxx_prompt=y
11588                 set try
11589                 if eval $compile && ./try > /dev/null; then
11590                         dflt=`./try`
11591                         case "$dflt" in
11592                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11593                                 echo "(The test program ran ok.)"
11594                                 echo "byteorder=$dflt"
11595                                 xxx_prompt=n
11596                         ;;
11597                         ????|????????) echo "(The test program ran ok.)" ;;
11598                         *) echo "(The test program didn't run right for some reason.)" ;;
11599                         esac
11600                 else
11601                         dflt='4321'
11602                         cat <<'EOM'
11603 (I can't seem to compile the test program.  Guessing big-endian...)
11604 EOM
11605                 fi
11606                 case "$xxx_prompt" in
11607                 y)
11608                         rp="What is the order of bytes in a long?"
11609                         . ./myread
11610                         byteorder="$ans"
11611                         ;;
11612                 *)      byteorder=$dflt
11613                         ;;
11614                 esac
11615                 ;;
11616         esac
11617         $rm -f try.c try
11618         ;;
11619 esac
11620
11621
11622 : how do we catenate cpp tokens here?
11623 echo " "
11624 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11625 $cat >cpp_stuff.c <<'EOCP'
11626 #define RCAT(a,b)a/**/b
11627 #define ACAT(a,b)a ## b
11628 RCAT(Rei,ser)
11629 ACAT(Cir,cus)
11630 EOCP
11631 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11632 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11633         echo "Oh!  Smells like ANSI's been here." >&4
11634         echo "We can catify or stringify, separately or together!"
11635         cpp_stuff=42
11636 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11637         echo "Ah, yes!  The good old days!" >&4
11638         echo "However, in the good old days we don't know how to stringify and"
11639         echo "catify at the same time."
11640         cpp_stuff=1
11641 else
11642         $cat >&4 <<EOM
11643 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11644 to have to edit the values of CAT[2-5] in config.h...
11645 EOM
11646         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11647 fi
11648 $rm -f cpp_stuff.*
11649
11650 : see if this is a db.h system
11651 set db.h i_db
11652 eval $inhdr
11653
11654 case "$i_db" in
11655 $define)
11656         : Check db version.
11657         echo " "
11658         echo "Checking Berkeley DB version ..." >&4
11659         $cat >try.c <<EOCP
11660 #$d_const HASCONST
11661 #ifndef HASCONST
11662 #define const
11663 #endif
11664 #include <sys/types.h>
11665 #include <stdio.h>
11666 #include <db.h>
11667 int main()
11668 {
11669 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11670     int Major, Minor, Patch ;
11671     unsigned long Version ;
11672     (void)db_version(&Major, &Minor, &Patch) ;
11673     printf("You have Berkeley DB Version 2 or greater\n");
11674
11675     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11676                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11677     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11678                 Major, Minor, Patch) ;
11679
11680     /* check that db.h & libdb are compatible */
11681     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11682         printf("db.h and libdb are incompatible\n") ;
11683         exit(3);        
11684     }
11685
11686     printf("db.h and libdb are compatible\n") ;
11687
11688     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11689                 + DB_VERSION_PATCH ;
11690
11691     /* needs to be >= 2.3.4 */
11692     if (Version < 2003004) {
11693     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11694         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11695         exit(2);        
11696     }
11697
11698     exit(0);
11699 #else
11700 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11701     printf("You have Berkeley DB Version 1\n");
11702     exit(0);    /* DB version < 2: the coast is clear. */
11703 #else
11704     exit(1);    /* <db.h> not Berkeley DB? */
11705 #endif
11706 #endif
11707 }
11708 EOCP
11709         set try
11710         if eval $compile_ok && ./try; then
11711                 echo 'Looks OK.' >&4
11712         else
11713                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11714                 i_db=$undef
11715                 case " $libs " in
11716                 *"-ldb "*)
11717                         : Remove db from list of libraries to use
11718                         echo "Removing unusable -ldb from library list" >&4
11719                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11720                         shift
11721                         libs="$*"
11722                         echo "libs = $libs" >&4
11723                         ;;
11724                 esac
11725         fi
11726         $rm -f try.*
11727         ;;
11728 esac
11729
11730 case "$i_db" in
11731 define)
11732         : Check the return type needed for hash 
11733         echo " "
11734         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11735         $cat >try.c <<EOCP
11736 #$d_const HASCONST
11737 #ifndef HASCONST
11738 #define const
11739 #endif
11740 #include <sys/types.h>
11741 #include <db.h>
11742
11743 #ifndef DB_VERSION_MAJOR
11744 u_int32_t hash_cb (ptr, size)
11745 const void *ptr;
11746 size_t size;
11747 {
11748 }
11749 HASHINFO info;
11750 int main()
11751 {
11752         info.hash = hash_cb;
11753 }
11754 #endif
11755 EOCP
11756         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11757                 if $contains warning try.out >>/dev/null 2>&1 ; then
11758                         db_hashtype='int'
11759                 else
11760                         db_hashtype='u_int32_t'
11761                 fi
11762         else
11763                 : XXX Maybe we should just give up here.
11764                 db_hashtype=u_int32_t
11765                 $cat try.out >&4
11766                 echo "Help:  I can't seem to compile the db test program." >&4
11767                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11768         fi
11769         $rm -f try.*
11770         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11771         ;;
11772 *)      db_hashtype=u_int32_t
11773         ;;
11774 esac
11775 case "$i_db" in
11776 define)
11777         : Check the return type needed for prefix 
11778         echo " "
11779         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11780         cat >try.c <<EOCP
11781 #$d_const HASCONST
11782 #ifndef HASCONST
11783 #define const
11784 #endif
11785 #include <sys/types.h>
11786 #include <db.h>
11787
11788 #ifndef DB_VERSION_MAJOR
11789 size_t prefix_cb (key1, key2)
11790 const DBT *key1;
11791 const DBT *key2;
11792 {
11793 }
11794 BTREEINFO info;
11795 int main()
11796 {
11797         info.prefix = prefix_cb;
11798 }
11799 #endif
11800 EOCP
11801         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11802                 if $contains warning try.out >>/dev/null 2>&1 ; then
11803                         db_prefixtype='int'
11804                 else
11805                         db_prefixtype='size_t'
11806                 fi
11807         else
11808                 db_prefixtype='size_t'
11809                 : XXX Maybe we should just give up here.
11810                 $cat try.out >&4
11811                 echo "Help:  I can't seem to compile the db test program." >&4
11812                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11813         fi
11814         $rm -f try.*
11815         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11816         ;;
11817 *)      db_prefixtype='size_t'
11818         ;;
11819 esac
11820
11821 : check for void type
11822 echo " "
11823 echo "Checking to see how well your C compiler groks the void type..." >&4
11824 case "$voidflags" in
11825 '')
11826         $cat >try.c <<'EOCP'
11827 #if TRY & 1
11828 void sub() {
11829 #else
11830 sub() {
11831 #endif
11832         extern void moo();      /* function returning void */
11833         void (*goo)();          /* ptr to func returning void */
11834 #if TRY & 8
11835         void *hue;              /* generic ptr */
11836 #endif
11837 #if TRY & 2
11838         void (*foo[10])();
11839 #endif
11840
11841 #if TRY & 4
11842         if(goo == moo) {
11843                 exit(0);
11844         }
11845 #endif
11846         exit(0);
11847 }
11848 int main() { sub(); }
11849 EOCP
11850         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11851                 voidflags=$defvoidused
11852         echo "Good.  It appears to support void to the level $package wants.">&4
11853                 if $contains warning .out >/dev/null 2>&1; then
11854                         echo "However, you might get some warnings that look like this:"
11855                         $cat .out
11856                 fi
11857         else
11858 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11859                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11860                         echo "It supports 1..."
11861                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11862                                 echo "It also supports 2..."
11863                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11864                                         voidflags=7
11865                                         echo "And it supports 4 but not 8 definitely."
11866                                 else
11867                                         echo "It doesn't support 4..."
11868                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11869                                                 voidflags=11
11870                                                 echo "But it supports 8."
11871                                         else
11872                                                 voidflags=3
11873                                                 echo "Neither does it support 8."
11874                                         fi
11875                                 fi
11876                         else
11877                                 echo "It does not support 2..."
11878                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11879                                         voidflags=13
11880                                         echo "But it supports 4 and 8."
11881                                 else
11882                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11883                                                 voidflags=5
11884                                                 echo "And it supports 4 but has not heard about 8."
11885                                         else
11886                                                 echo "However it supports 8 but not 4."
11887                                         fi
11888                                 fi
11889                         fi
11890                 else
11891                         echo "There is no support at all for void."
11892                         voidflags=0
11893                 fi
11894         fi
11895 esac
11896 case "$voidflags" in
11897 "$defvoidused") ;;
11898 *)      $cat >&4 <<'EOM'
11899   Support flag bits are:
11900     1: basic void declarations.
11901     2: arrays of pointers to functions returning void.
11902     4: operations between pointers to and addresses of void functions.
11903     8: generic void pointers.
11904 EOM
11905         dflt="$voidflags";
11906         rp="Your void support flags add up to what?"
11907         . ./myread
11908         voidflags="$ans"
11909         ;;
11910 esac
11911 $rm -f try.* .out
11912
11913
11914 : How can we generate normalized random numbers ?
11915 echo " "
11916 echo "Looking for a random number function..." >&4
11917 case "$randfunc" in
11918 '')
11919         if set drand48 val -f; eval $csym; $val; then
11920                 dflt="drand48"
11921                 echo "Good, found drand48()." >&4
11922         elif set random val -f; eval $csym; $val; then
11923                 dflt="random"
11924                 echo "OK, found random()." >&4
11925         else
11926                 dflt="rand"
11927                 echo "Yick, looks like I have to use rand()." >&4
11928         fi
11929         echo " "
11930         ;;
11931 *)
11932         dflt="$randfunc"
11933         ;;
11934 esac
11935 cont=true
11936
11937 case "$ccflags" in
11938 *-Dmy_rand=*|*-Dmy_srand=*)
11939         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11940         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11941         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11942         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11943         ;;
11944 esac
11945
11946 while $test "$cont"; do
11947         rp="Use which function to generate random numbers?"
11948         . ./myread
11949         if $test "$ans" = "$dflt"; then
11950                 : null
11951         else
11952                 randbits=''
11953         fi
11954         randfunc="$ans"
11955         if set $ans val -f; eval $csym; $val; then
11956                 cont=''
11957         else
11958                 dflt=y
11959                 rp="I cannot find function $ans. Use that name anyway?"
11960                 . ./myread
11961                 dflt=rand
11962                 case "$ans" in
11963                         [yY]*) cont='';;
11964                 esac
11965         fi
11966         case "$cont" in
11967         '')
11968                 case "$randfunc" in
11969                 drand48)
11970                         drand01="drand48()"
11971                         seedfunc="srand48"
11972                         randbits=48
11973                         randseedtype=long
11974                         ;;
11975                 rand|random)
11976                         case "$randbits" in
11977                         '')
11978 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11979                                 $cat >try.c <<EOCP
11980 #$i_unistd I_UNISTD
11981 #$i_stdlib I_STDLIB
11982 #include <stdio.h>
11983 #ifdef I_UNISTD
11984 #  include <unistd.h>
11985 #endif
11986 #ifdef I_STDLIB
11987 #  include <stdlib.h>
11988 #endif
11989 int main()
11990 {
11991         register int i;
11992         register unsigned long tmp;
11993         register unsigned long max = 0L;
11994
11995         for (i = 1000; i; i--) {
11996                 tmp = (unsigned long) $randfunc();
11997                 if (tmp > max) max = tmp;
11998         }
11999         for (i = 0; max; i++)
12000                 max /= 2;
12001         printf("%d\n",i);
12002 }
12003 EOCP
12004                                 set try
12005                                 if eval $compile_ok; then
12006                                         dflt=`try`
12007                                 else
12008                                         dflt='?'
12009                                         echo "(I can't seem to compile the test program...)"
12010                                 fi
12011                                 ;;
12012                         *)
12013                                 dflt="$randbits"
12014                                 ;;
12015                         esac
12016                         rp="How many bits does your $randfunc() function produce?"
12017                         . ./myread
12018                         randbits="$ans"
12019                         $rm -f try.c try
12020                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12021                         seedfunc="s$randfunc"
12022                         randseedtype=unsigned
12023                         ;;
12024                 *)
12025                         dflt="31"
12026                         rp="How many bits does your $randfunc() function produce?"
12027                         . ./myread
12028                         randbits="$ans"
12029                         seedfunc="s$randfunc"
12030                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12031                         if set $seedfunc val -f; eval $csym; $val; then
12032                                 echo "(Using $seedfunc() to seed random generator)"
12033                         else
12034                                 echo "(Warning: no $seedfunc() to seed random generator)"
12035                                 seedfunc=rand
12036                         fi
12037                         randseedtype=unsigned
12038                         ;;
12039                 esac
12040                 ;;
12041         esac
12042 done
12043
12044 echo " "
12045 echo "Determining whether or not we are on an EBCDIC system..." >&4
12046 $cat >tebcdic.c <<'EOM'
12047 int main()
12048 {
12049   if ('M'==0xd4) return 0;
12050   return 1;
12051 }
12052 EOM
12053
12054 val=$undef
12055 set tebcdic
12056 if eval $compile_ok; then
12057         if ./tebcdic; then
12058                 echo "You have EBCDIC." >&4
12059                 val="$define"
12060         else
12061                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12062         fi
12063 else
12064         echo "I'm unable to compile the test program." >&4
12065         echo "I'll assume ASCII or some ISO Latin." >&4
12066 fi
12067 $rm -f tebcdic.c tebcdic
12068 set ebcdic
12069 eval $setvar
12070
12071 echo " "
12072 $cat >&4 <<EOM
12073 Checking how to flush all pending stdio output...
12074 EOM
12075 # I only know how to find the first 32 possibly open files on SunOS.
12076 # See also hints/sunos_4_1.sh and util.c  --AD
12077 case "$osname" in
12078 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12079 esac
12080 $cat >>try.c <<EOCP
12081 #include <stdio.h>
12082 #$i_unistd I_UNISTD
12083 #ifdef I_UNISTD
12084 # include <unistd.h>
12085 #endif
12086 #$d_sysconf HAS_SYSCONF
12087 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12088 #ifdef HAS_STDIO_STREAM_ARRAY
12089 # define STDIO_STREAM_ARRAY $stdio_stream_array
12090 #endif
12091 int main() {
12092   FILE* p = fopen("try.out", "w");
12093 #ifdef TRY_FPUTC
12094   fputc('x', p);
12095 #else
12096 # ifdef TRY_FPRINTF
12097   fprintf(p, "x");
12098 # endif
12099 #endif
12100 #ifdef TRY_FFLUSH_NULL
12101   fflush(NULL);
12102 #endif
12103 #ifdef TRY_FFLUSH_ALL
12104   {
12105     long open_max = -1;
12106 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12107     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12108 # else
12109 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12110     open_max = sysconf(_SC_OPEN_MAX);
12111 #  else
12112 #   ifdef FOPEN_MAX
12113     open_max = FOPEN_MAX;
12114 #   else
12115 #    ifdef OPEN_MAX
12116     open_max = OPEN_MAX;
12117 #    else
12118 #     ifdef _NFILE
12119     open_max = _NFILE;
12120 #     endif
12121 #    endif
12122 #   endif
12123 #  endif
12124 # endif 
12125 # ifdef HAS_STDIO_STREAM_ARRAY
12126     if (open_max > 0) {
12127       long i;
12128       for (i = 0; i < open_max; i++)
12129             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12130                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12131                 STDIO_STREAM_ARRAY[i]._flag)
12132                 fflush(&STDIO_STREAM_ARRAY[i]);
12133     }   
12134   }
12135 # endif
12136 #endif
12137   _exit(42);
12138 }
12139 EOCP
12140 : first we have to find out how _not_ to flush
12141 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12142     output=''
12143     set try -DTRY_FPUTC
12144     if eval $compile; then
12145             $rm -f try.out
12146             ./try$exe_ext 2>/dev/null
12147             if $test ! -s try.out -a "X$?" = X42; then
12148                 output=-DTRY_FPUTC
12149             fi
12150     fi
12151     case "$output" in
12152     '')
12153             set try -DTRY_FPRINTF
12154             $rm -f try.out
12155             if eval $compile; then
12156                     $rm -f try.out
12157                     ./try$exe_ext 2>/dev/null
12158                     if $test ! -s try.out -a "X$?" = X42; then
12159                         output=-DTRY_FPRINTF
12160                     fi
12161             fi
12162         ;;
12163     esac
12164 fi
12165 : check for fflush NULL behaviour
12166 case "$fflushNULL" in
12167 '')     set try -DTRY_FFLUSH_NULL $output
12168         if eval $compile; then
12169                 $rm -f try.out
12170                 ./try$exe_ext 2>/dev/null
12171                 code="$?"
12172                 if $test -s try.out -a "X$code" = X42; then
12173                         fflushNULL="`$cat try.out`"
12174                 else
12175                         if $test "X$code" != X42; then
12176                                 $cat >&4 <<EOM
12177 (If this test failed, don't worry, we'll try another method shortly.)
12178 EOM
12179                         fi
12180                 fi
12181         fi
12182         $rm -f core try.core core.try.*
12183         case "$fflushNULL" in
12184         x)      $cat >&4 <<EOM
12185 Your fflush(NULL) works okay.
12186 EOM
12187                 fflushNULL="$define"
12188                 ;;
12189         '')     $cat >&4 <<EOM
12190 Your fflush(NULL) isn't working (contrary to ANSI C).
12191 EOM
12192                 fflushNULL="$undef"
12193                 ;;
12194         *)      $cat >&4 <<EOM
12195 Cannot figure out whether your fflush(NULL) works or not.
12196 I'm assuming it doesn't (contrary to ANSI C).
12197 EOM
12198                 fflushNULL="$undef"
12199                 ;;
12200         esac
12201         ;;
12202 $define|true|[yY]*)
12203         fflushNULL="$define"
12204         ;;
12205 *)
12206         fflushNULL="$undef"
12207         ;;
12208 esac
12209 : check explicit looping only if NULL did not work
12210 case "$fflushNULL" in
12211 "$undef")
12212         : check for fflush all behaviour
12213         case "$fflushall" in
12214         '')     set try -DTRY_FFLUSH_ALL $output
12215                 if eval $compile; then
12216                         $cat >&4 <<EOM
12217 (Now testing the other method--but note that also this may fail.)
12218 EOM
12219                         $rm -f try.out
12220                         ./try$exe_ext 2>/dev/null
12221                         if $test -s try.out -a "X$?" = X42; then
12222                                 fflushall="`$cat try.out`"
12223                         fi
12224                 fi
12225                 $rm -f core try.core core.try.*
12226                 case "$fflushall" in
12227                 x)      $cat >&4 <<EOM
12228 Whew. Flushing explicitly all the stdio streams works.
12229 EOM
12230                         fflushall="$define"
12231                         ;;
12232                 '')     $cat >&4 <<EOM
12233 Sigh. Flushing explicitly all the stdio streams doesn't work.
12234 EOM
12235                         fflushall="$undef"
12236                         ;;
12237                 *)      $cat >&4 <<EOM
12238 Cannot figure out whether flushing stdio streams explicitly works or not.
12239 I'm assuming it doesn't.
12240 EOM
12241                         fflushall="$undef"
12242                         ;;
12243                 esac
12244                 ;;
12245         "$define"|true|[yY]*)
12246                 fflushall="$define"
12247                 ;;
12248         *)
12249                 fflushall="$undef"
12250                 ;;
12251         esac
12252         ;;
12253 *)      fflushall="$undef"      
12254         ;;
12255 esac
12256 case "$fflushNULL$fflushall" in
12257 undefundef)
12258         $cat <<EOM
12259 I cannot figure out how to flush pending stdio output.
12260 EOM
12261         ;;
12262 esac
12263 $rm -f try.* try$exe_ext
12264
12265 : Store the full pathname to the ar program for use in the C program
12266 : Respect a hint or command line value for full_ar.
12267 case "$full_ar" in
12268 '') full_ar=$ar ;;
12269 esac
12270
12271 : Store the full pathname to the sed program for use in the C program
12272 full_sed=$sed
12273
12274 : see what type gids are declared as in the kernel
12275 echo " "
12276 echo "Looking for the type for group ids returned by getgid()."
12277 set gid_t gidtype xxx stdio.h sys/types.h
12278 eval $typedef
12279 case "$gidtype" in
12280 xxx)
12281         xxx=`./findhdr sys/user.h`
12282         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12283         case $1 in
12284         unsigned) dflt="$1 $2" ;;
12285         *) dflt="$1" ;;
12286         esac
12287         ;;
12288 *) dflt="$gidtype";;
12289 esac
12290 case "$gidtype" in
12291 gid_t) echo "gid_t found." ;;
12292 *)      rp="What is the type for group ids returned by getgid()?"
12293         . ./myread
12294         gidtype="$ans"
12295         ;;
12296 esac
12297
12298 echo " "
12299 case "$gidtype" in
12300 *_t) zzz="$gidtype"     ;;
12301 *)   zzz="gid"          ;;
12302 esac
12303 echo "Checking the size of $zzz..." >&4 
12304 cat > try.c <<EOCP
12305 #include <sys/types.h>
12306 #include <stdio.h>
12307 int main() {
12308     printf("%d\n", (int)sizeof($gidtype));
12309     exit(0);
12310 }
12311 EOCP
12312 set try
12313 if eval $compile_ok; then
12314         yyy=`./try`
12315         case "$yyy" in
12316         '')     gidsize=4
12317                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12318                 ;;
12319         *)      gidsize=$yyy
12320                 echo "Your $zzz size is $gidsize bytes."
12321                 ;;
12322         esac
12323 else
12324         gidsize=4
12325         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12326 fi
12327
12328
12329 echo " "
12330 case "$gidtype" in
12331 *_t) zzz="$gidtype"     ;;
12332 *)   zzz="gid"          ;;
12333 esac
12334 echo "Checking the sign of $zzz..." >&4 
12335 cat > try.c <<EOCP
12336 #include <sys/types.h>
12337 #include <stdio.h>
12338 int main() {
12339         $gidtype foo = -1;
12340         if (foo < 0)
12341                 printf("-1\n");
12342         else
12343                 printf("1\n");
12344 }
12345 EOCP
12346 set try
12347 if eval $compile; then
12348         yyy=`./try`
12349         case "$yyy" in
12350         '')     gidsign=1
12351                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12352                 ;;
12353         *)      gidsign=$yyy
12354                 case "$gidsign" in
12355                  1) echo "Your $zzz is unsigned." ;;
12356                 -1) echo "Your $zzz is signed."   ;;
12357                 esac
12358                 ;;
12359         esac
12360 else
12361         gidsign=1
12362         echo "(I can't compile the test program--guessing unsigned.)" >&4
12363 fi
12364
12365
12366 echo " "
12367
12368 if $test X"$quadtype" != X; then
12369
12370 echo "Checking how to print 64-bit integers..." >&4
12371
12372 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12373         $cat >try.c <<'EOCP'
12374 #include <sys/types.h>
12375 #include <stdio.h>
12376 int main() {
12377   int q = 12345678901;
12378   printf("%ld\n", q);
12379 }
12380 EOCP
12381         set try
12382         if eval $compile; then
12383                 yyy=`./try$exe_ext`
12384                 case "$yyy" in
12385                 12345678901)
12386                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12387                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12388                         echo "We will use %d."
12389                         ;;
12390                 esac
12391         fi
12392 fi
12393
12394 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12395         $cat >try.c <<'EOCP'
12396 #include <sys/types.h>
12397 #include <stdio.h>
12398 int main() {
12399   long q = 12345678901;
12400   printf("%ld\n", q);
12401 }
12402 EOCP
12403         set try
12404         if eval $compile; then
12405                 yyy=`./try$exe_ext`
12406                 case "$yyy" in
12407                 12345678901)
12408                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12409                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12410                         echo "We will use %ld."
12411                         ;;
12412                 esac
12413         fi
12414 fi
12415
12416 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12417         $cat >try.c <<'EOCP'
12418 #include <sys/types.h>
12419 #include <inttypes.h>
12420 #include <stdio.h>
12421 int main() {
12422   int64_t q = 12345678901;
12423   printf("%" PRId64 "\n", q);
12424 }
12425 EOCP
12426         set try
12427         if eval $compile; then
12428                 yyy=`./try$exe_ext`
12429                 case "$yyy" in
12430                 12345678901)
12431                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12432                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12433                         echo "We will use the C9X style."
12434                         ;;
12435                 esac
12436         fi
12437 fi
12438
12439 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12440         $cat >try.c <<'EOCP'
12441 #include <sys/types.h>
12442 #include <stdio.h>
12443 int main() {
12444   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12445   printf("%lld\n", q);
12446 }
12447 EOCP
12448         set try
12449         if eval $compile; then
12450                 yyy=`./try$exe_ext`
12451                 case "$yyy" in
12452                 12345678901)
12453                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12454                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12455                         echo "We will use the %lld style."
12456                         ;;
12457                 esac
12458         fi
12459 fi
12460
12461 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12462         $cat >try.c <<EOCP
12463 #include <sys/types.h>
12464 #include <stdio.h>
12465 int main() {
12466   $quadtype q = 12345678901;
12467   printf("%Ld\n", q);
12468 }
12469 EOCP
12470         set try
12471         if eval $compile; then
12472                 yyy=`./try$exe_ext`
12473                 case "$yyy" in
12474                 12345678901)
12475                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12476                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12477                         echo "We will use %Ld."
12478                         ;;
12479                 esac
12480         fi
12481 fi
12482
12483 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12484         $cat >try.c <<EOCP
12485 #include <sys/types.h>
12486 #include <stdio.h>
12487 int main() {
12488   $quadtype q = 12345678901;
12489   printf("%qd\n", q);
12490 }
12491 EOCP
12492         set try
12493         if eval $compile; then
12494                 yyy=`./try$exe_ext`
12495                 case "$yyy" in
12496                 12345678901)
12497                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12498                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12499                         echo "We will use %qd."
12500                         ;;
12501                 esac
12502         fi
12503 fi
12504
12505 if $test X"$sPRId64" = X; then
12506         echo "Cannot figure out how to print 64-bit integers." >&4
12507 fi
12508
12509 $rm -f try try.*
12510
12511 fi
12512
12513 case "$sPRId64" in
12514 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12515         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12516         ;;
12517 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12518         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12519         ;;
12520 esac
12521
12522
12523 echo " "
12524 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12525
12526 if $test X"$ivsize" = X8; then
12527         ivdformat="$sPRId64"
12528         uvuformat="$sPRIu64"
12529         uvoformat="$sPRIo64"
12530         uvxformat="$sPRIx64"
12531 else
12532         if $test X"$ivsize" = X"$longsize"; then
12533                 ivdformat='"ld"'
12534                 uvuformat='"lu"'
12535                 uvoformat='"lo"'
12536                 uvxformat='"lx"'
12537         else
12538                 if $test X"$ivsize" = X"$intsize"; then
12539                         ivdformat='"d"'
12540                         uvuformat='"u"'
12541                         uvoformat='"o"'
12542                         uvxformat='"x"'
12543                 else
12544                         : far out
12545                         if $test X"$ivsize" = X"$shortsize"; then
12546                                 ivdformat='"hd"'
12547                                 uvuformat='"hu"'
12548                                 uvoformat='"ho"'
12549                                 uvxformat='"hx"'
12550                         fi
12551                 fi
12552         fi
12553 fi
12554
12555 case "$ivdformat" in
12556 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12557     exit 1
12558     ;;
12559 esac
12560
12561
12562 echo " "
12563 $echo "Checking the format string to be used for gids..." >&4
12564
12565 case "$gidsign" in
12566 -1)     if $test X"$gidsize" = X"$ivsize"; then
12567                 gidformat="$ivdformat"
12568         else
12569                 if $test X"$gidsize" = X"$longsize"; then
12570                         gidformat='"ld"'
12571                 else
12572                         if $test X"$gidsize" = X"$intsize"; then
12573                                 gidformat='"d"'
12574                         else
12575                                 if $test X"$gidsize" = X"$shortsize"; then
12576                                         gidformat='"hd"'
12577                                 fi
12578                         fi
12579                 fi
12580         fi
12581         ;;
12582 *)      if $test X"$gidsize" = X"$uvsize"; then
12583                 gidformat="$uvuformat"
12584         else
12585                 if $test X"$gidsize" = X"$longsize"; then
12586                         gidformat='"lu"'
12587                 else
12588                         if $test X"$gidsize" = X"$intsize"; then
12589                                 gidformat='"u"'
12590                         else
12591                                 if $test X"$gidsize" = X"$shortsize"; then
12592                                         gidformat='"hu"'
12593                                 fi
12594                         fi
12595                 fi
12596         fi
12597         ;;
12598 esac
12599
12600 : see if getgroups exists
12601 set getgroups d_getgrps
12602 eval $inlibc
12603
12604 : see if setgroups exists
12605 set setgroups d_setgrps
12606 eval $inlibc
12607
12608
12609 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12610 echo " "
12611 case "$d_getgrps$d_setgrps" in
12612 *define*)
12613         case "$groupstype" in
12614         '') dflt="$gidtype" ;;
12615         *)  dflt="$groupstype" ;;
12616         esac
12617         $cat <<EOM
12618 What type of pointer is the second argument to getgroups() and setgroups()?
12619 Usually this is the same as group ids, $gidtype, but not always.
12620
12621 EOM
12622         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12623         . ./myread
12624         groupstype="$ans"
12625         ;;
12626 *)  groupstype="$gidtype";;
12627 esac
12628
12629 echo " "
12630 echo "Checking if your $make program sets \$(MAKE)..." >&4
12631 case "$make_set_make" in
12632 '')
12633         $sed 's/^X //' > testmake.mak << 'EOF'
12634 Xall:
12635 X       @echo 'maketemp="$(MAKE)"'
12636 EOF
12637         case "`$make -f testmake.mak 2>/dev/null`" in
12638         *maketemp=*) make_set_make='#' ;;
12639         *)      make_set_make="MAKE=$make" ;;
12640         esac
12641         $rm -f testmake.mak
12642         ;;
12643 esac
12644 case "$make_set_make" in
12645 '#') echo "Yup, it does.";;
12646 *) echo "Nope, it doesn't.";;
12647 esac
12648
12649 : see if this is a sys/mman.h system
12650 set sys/mman.h i_sysmman
12651 eval $inhdr
12652
12653 : see if mmap exists
12654 set mmap d_mmap
12655 eval $inlibc
12656 : see what shmat returns
12657 : default to something harmless
12658 mmaptype='void *'
12659 case "$i_sysmman$d_mmap" in
12660 "$define$define")
12661         $cat >mmap.c <<'END'
12662 #include <sys/mman.h>
12663 void *mmap();
12664 END
12665         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
12666                 mmaptype='void *'
12667         else
12668                 mmaptype='caddr_t'
12669         fi
12670         echo "and it returns ($mmaptype)." >&4
12671         ;;
12672 esac
12673
12674
12675
12676 : see what type is used for mode_t
12677 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12678 set mode_t modetype int stdio.h sys/types.h
12679 eval $typedef_ask
12680
12681 : define a fucntion to check prototypes
12682 $cat > protochk <<EOSH
12683 $startsh
12684 cc="$cc"
12685 optimize="$optimize"
12686 ccflags="$ccflags"
12687 prototype="$prototype"
12688 define="$define"
12689 rm=$rm
12690 EOSH
12691
12692 $cat >> protochk <<'EOSH'
12693
12694 $rm -f try.c
12695 foo="$1"
12696 shift
12697 while test $# -ge 2; do
12698         case "$1" in
12699                 $define) echo "#include <$2>" >> try.c ;;
12700                 literal) echo "$2" >> try.c ;;
12701         esac
12702     shift 2
12703 done
12704 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12705 cat >> try.c <<'EOCP'
12706 #ifdef CAN_PROTOTYPE
12707 #define _(args) args
12708 #else
12709 #define _(args) ()
12710 #endif
12711 EOCP
12712 echo "$foo" >> try.c
12713 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12714 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12715 status=$?
12716 $rm -f try.[co]
12717 exit $status
12718 EOSH
12719 chmod +x protochk
12720 $eunicefix protochk
12721
12722 : see what type is used for size_t
12723 rp="What is the type used for the length parameter for string functions?"
12724 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12725 eval $typedef_ask
12726
12727 : check for type of arguments to gethostbyaddr. 
12728 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12729         case "$d_gethbyaddr" in
12730         $define)
12731                 $cat <<EOM
12732
12733 Checking to see what type of arguments are accepted by gethostbyaddr().
12734 EOM
12735                 hdrs="$define sys/types.h
12736                         $d_socket sys/socket.h 
12737                         $i_niin netinet/in.h 
12738                         $i_netdb netdb.h
12739                         $i_unistd unistd.h"
12740                 : The first arg can 'char *' or 'void *'
12741                 : The second arg is some of integral type
12742                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12743                         for yyy in size_t long int; do
12744                                 case "$netdb_host_type" in
12745                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12746                                         if ./protochk "$try" $hdrs; then
12747                                                 echo "Your system accepts $xxx for the first arg."
12748                                                 echo "...and $yyy for the second arg."
12749                                                 netdb_host_type="$xxx"
12750                                                 netdb_hlen_type="$yyy"
12751                                         fi
12752                                         ;;
12753                                 esac
12754                         done
12755                 done
12756                 : In case none of those worked, prompt the user.
12757                 case "$netdb_host_type" in
12758                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12759                         dflt='char *'
12760                         . ./myread
12761                         netdb_host_type=$ans
12762                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12763                         dflt="$sizetype"
12764                         . ./myread
12765                         netdb_hlen_type=$ans
12766                         ;;
12767                 esac
12768                 ;;
12769         *)      : no gethostbyaddr, so pick harmless defaults
12770                 netdb_host_type='char *'
12771                 netdb_hlen_type="$sizetype"
12772                 ;;
12773         esac
12774         # Remove the "const" if needed. -- but then we'll have a 
12775         # prototype clash!
12776         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12777 fi
12778
12779 : check for type of argument to gethostbyname. 
12780 if test "X$netdb_name_type" = X ; then
12781         case "$d_gethbyname" in
12782         $define)
12783                 $cat <<EOM
12784
12785 Checking to see what type of argument is accepted by gethostbyname().
12786 EOM
12787                 hdrs="$define sys/types.h
12788                         $d_socket sys/socket.h 
12789                         $i_niin netinet/in.h 
12790                         $i_netdb netdb.h
12791                         $i_unistd unistd.h"
12792                 for xxx in "const char *" "char *"; do
12793                         case "$netdb_name_type" in
12794                         '')     try="extern struct hostent *gethostbyname($xxx);"
12795                                 if ./protochk "$try" $hdrs; then
12796                                         echo "Your system accepts $xxx."
12797                                         netdb_name_type="$xxx"
12798                                 fi
12799                                 ;;
12800                         esac
12801                 done
12802                 : In case none of those worked, prompt the user.
12803                 case "$netdb_name_type" in
12804                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12805                         dflt='char *'
12806                         . ./myread
12807                         netdb_name_type=$ans
12808                         ;;
12809                 esac
12810                 ;;
12811         *)      : no gethostbyname, so pick harmless default
12812                 netdb_name_type='char *'
12813                 ;;
12814         esac
12815 fi
12816
12817 : check for type of 1st argument to getnetbyaddr. 
12818 if test "X$netdb_net_type" = X ; then
12819         case "$d_getnbyaddr" in
12820         $define)
12821                 $cat <<EOM
12822
12823 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12824 EOM
12825                 hdrs="$define sys/types.h
12826                         $d_socket sys/socket.h 
12827                         $i_niin netinet/in.h 
12828                         $i_netdb netdb.h
12829                         $i_unistd unistd.h"
12830                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12831                         case "$netdb_net_type" in
12832                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12833                                 if ./protochk "$try" $hdrs; then
12834                                         echo "Your system accepts $xxx."
12835                                         netdb_net_type="$xxx"
12836                                 fi
12837                                 ;;
12838                         esac
12839                 done
12840                 : In case none of those worked, prompt the user.
12841                 case "$netdb_net_type" in
12842                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12843                         dflt='long'
12844                         . ./myread
12845                         netdb_net_type=$ans
12846                         ;;
12847                 esac
12848                 ;;
12849         *)      : no getnetbyaddr, so pick harmless default
12850                 netdb_net_type='long'
12851                 ;;
12852         esac
12853 fi
12854 : locate the preferred pager for this system
12855 case "$pager" in
12856 '')
12857         dflt=''
12858         case "$pg" in
12859         /*) dflt=$pg;;
12860         esac
12861         case "$more" in
12862         /*) dflt=$more;;
12863         esac
12864         case "$less" in
12865         /*) dflt=$less;;
12866         esac
12867         case "$dflt" in
12868         '') dflt=/usr/ucb/more;;
12869         esac
12870         ;;
12871 *) dflt="$pager";;
12872 esac
12873 echo " "
12874 fn=f/
12875 rp='What pager is used on your system?'
12876 . ./getfile
12877 pager="$ans"
12878
12879 : see what type pids are declared as in the kernel
12880 rp="What is the type of process ids on this system?"
12881 set pid_t pidtype int stdio.h sys/types.h
12882 eval $typedef_ask
12883
12884 : Find earliest binary compatible site_perl subdirectory perl can use.
12885 case "$bincompat5005" in
12886 "$define") xs_apiversion='5.005' ;;
12887 *) xs_apiversion=$version ;;   # The current site_perl version.
12888 esac
12889 : Find earliest pure perl site_perl subdirectory perl can use.
12890 : The versioned directories started at 5.005.
12891 pm_apiversion='5.005'
12892
12893 : check for length of pointer
12894 echo " "
12895 case "$ptrsize" in
12896 '')
12897         $echo $n "Checking to see how big your pointers are...$c" >&4
12898         if test "$voidflags" -gt 7; then
12899                 echo '#define VOID_PTR char *' > try.c
12900         else
12901                 echo '#define VOID_PTR void *' > try.c
12902         fi
12903         $cat >>try.c <<'EOCP'
12904 #include <stdio.h>
12905 int main()
12906 {
12907     printf("%d\n", (int)sizeof(VOID_PTR));
12908     exit(0);
12909 }
12910 EOCP
12911         set try
12912         if eval $compile_ok; then
12913                 ptrsize=`./try`
12914                 $echo " $ptrsize bytes." >&4
12915         else
12916                 dflt='4'
12917                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12918                 rp="What is the size of a pointer (in bytes)?"
12919                 . ./myread
12920                 ptrsize="$ans"
12921         fi
12922         ;;
12923 esac
12924 $rm -f try.c try
12925
12926 : see if ar generates random libraries by itself
12927 echo " "
12928 echo "Checking how to generate random libraries on your machine..." >&4
12929 echo 'int bar1() { return bar2(); }' > bar1.c
12930 echo 'int bar2() { return 2; }' > bar2.c
12931 $cat > foo.c <<'EOP'
12932 int main() { printf("%d\n", bar1()); exit(0); }
12933 EOP
12934 $cc $ccflags -c bar1.c >/dev/null 2>&1
12935 $cc $ccflags -c bar2.c >/dev/null 2>&1
12936 $cc $ccflags -c foo.c >/dev/null 2>&1
12937 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12938 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12939         ./foobar >/dev/null 2>&1; then
12940         echo "$ar appears to generate random libraries itself."
12941         orderlib=false
12942         ranlib=":"
12943 elif $ar ts bar$_a >/dev/null 2>&1 &&
12944         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12945         ./foobar >/dev/null 2>&1; then
12946                 echo "a table of contents needs to be added with '$ar ts'."
12947                 orderlib=false
12948                 ranlib="$ar ts"
12949 else
12950         case "$ranlib" in
12951         :) ranlib='';;
12952         '')
12953                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12954                 $test -f $ranlib || ranlib=''
12955                 ;;
12956         esac
12957         if $test -n "$ranlib"; then
12958                 echo "your system has '$ranlib'; we'll use that."
12959                 orderlib=false
12960         else
12961                 echo "your system doesn't seem to support random libraries"
12962                 echo "so we'll use lorder and tsort to order the libraries."
12963                 orderlib=true
12964                 ranlib=":"
12965         fi
12966 fi
12967 $rm -f foo* bar* 
12968
12969 : check for type of arguments to select. 
12970 case "$selecttype" in
12971 '') case "$d_select" in
12972         $define)
12973                 echo " "
12974                 $cat <<EOM
12975 Checking to see what type of arguments are accepted by select().
12976 EOM
12977                 hdrs="$define sys/types.h
12978                         $i_systime sys/time.h 
12979                         $i_sysselct sys/select.h
12980                         $d_socket sys/socket.h"
12981                 : The first arg can be int, unsigned, or size_t
12982                 : The last arg may or may not be 'const'
12983                 val=''
12984                 : void pointer has been seen but using that
12985                 : breaks the selectminbits test
12986                 for xxx in 'fd_set *' 'int *'; do
12987                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12988                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12989                                         case "$val" in
12990                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12991                                                 if ./protochk "$try" $hdrs; then
12992                                                         echo "Your system accepts $xxx."
12993                                                         val="$xxx"
12994                                                 fi
12995                                                 ;;
12996                                         esac
12997                                 done
12998                         done
12999                 done
13000                 case "$val" in
13001                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13002                         case "$d_fd_set" in
13003                                 $define) dflt="fd_set *" ;;
13004                                 *)              dflt="int *" ;;
13005                         esac
13006                         . ./myread
13007                         val=$ans
13008                         ;;
13009                 esac
13010                 selecttype="$val"
13011                 ;;
13012         *)      : no select, so pick a harmless default
13013                 selecttype='int *'
13014                 ;;
13015         esac
13016         ;;
13017 esac
13018
13019 : check for the select 'width'
13020 case "$selectminbits" in
13021 '') case "$d_select" in
13022         $define)
13023                 $cat <<EOM
13024
13025 Checking to see on how many bits at a time your select() operates...
13026 EOM
13027                 $cat >try.c <<EOCP
13028 #include <sys/types.h>
13029 #$i_time I_TIME
13030 #$i_systime I_SYS_TIME
13031 #$i_systimek I_SYS_TIME_KERNEL
13032 #ifdef I_TIME
13033 #   include <time.h>
13034 #endif
13035 #ifdef I_SYS_TIME
13036 #   ifdef I_SYS_TIME_KERNEL
13037 #       define KERNEL
13038 #   endif
13039 #   include <sys/time.h>
13040 #   ifdef I_SYS_TIME_KERNEL
13041 #       undef KERNEL
13042 #   endif
13043 #endif
13044 #$i_sysselct I_SYS_SELECT
13045 #ifdef I_SYS_SELECT
13046 #include <sys/select.h>
13047 #endif
13048 #$d_socket HAS_SOCKET
13049 #ifdef HAS_SOCKET
13050 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13051 #endif
13052 #include <stdio.h>
13053 $selecttype b;
13054 #define S sizeof(*(b))
13055 #define MINBITS 64
13056 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13057 #define NBITS  (NBYTES * 8)
13058 int main() {
13059     char s[NBYTES];
13060     struct timeval t;
13061     int i;
13062     FILE* fp;
13063     int fd;
13064
13065     fclose(stdin);
13066     fp = fopen("try.c", "r");
13067     if (fp == 0)
13068       exit(1);
13069     fd = fileno(fp);
13070     if (fd < 0)
13071       exit(2);
13072     b = ($selecttype)s;
13073     for (i = 0; i < NBITS; i++)
13074         FD_SET(i, b);
13075     t.tv_sec  = 0;
13076     t.tv_usec = 0;
13077     select(fd + 1, b, 0, 0, &t);
13078     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13079     printf("%d\n", i + 1);
13080     return 0;
13081 }
13082 EOCP
13083                 set try
13084                 if eval $compile_ok; then
13085                         selectminbits=`./try`
13086                         case "$selectminbits" in
13087                         '')     cat >&4 <<EOM
13088 Cannot figure out on how many bits at a time your select() operates.
13089 I'll play safe and guess it is 32 bits.
13090 EOM
13091                                 selectminbits=32
13092                                 bits="32 bits"
13093                                 ;;
13094                         1)      bits="1 bit" ;;
13095                         *)      bits="$selectminbits bits" ;;
13096                         esac
13097                         echo "Your select() operates on $bits at a time." >&4
13098                 else
13099                         rp='What is the minimum number of bits your select() operates on?'
13100                         case "$byteorder" in
13101                         1234|12345678)  dflt=32 ;;
13102                         *)              dflt=1  ;;
13103                         esac
13104                         . ./myread
13105                         val=$ans
13106                         selectminbits="$val"
13107                 fi
13108                 $rm -f try.* try
13109                 ;;
13110         *)      : no select, so pick a harmless default
13111                 selectminbits='32'
13112                 ;;
13113         esac
13114         ;;
13115 esac
13116
13117 : Trace out the files included by signal.h, then look for SIGxxx names.
13118 : Remove SIGARRAYSIZE used by HPUX.
13119 : Remove SIGSTKSIZE used by Linux.
13120 : Remove SIGSTKSZ used by Posix.
13121 : Remove SIGTYP void lines used by OS2.
13122 : Some cpps, like os390, dont give the file name anywhere
13123 if [ "X$fieldn" = X ]; then
13124         : Just make some guesses.  We check them later.
13125         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13126 else
13127         xxx=`echo '#include <signal.h>' |
13128         $cppstdin $cppminus $cppflags 2>/dev/null |
13129         $grep '^[       ]*#.*include' | 
13130         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13131 fi
13132 : Check this list of files to be sure we have parsed the cpp output ok.
13133 : This will also avoid potentially non-existent files, such 
13134 : as ../foo/bar.h
13135 xxxfiles=''
13136 for xx in $xxx /dev/null ; do
13137         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13138 done
13139 : If we have found no files, at least try signal.h
13140 case "$xxxfiles" in
13141 '')     xxxfiles=`./findhdr signal.h` ;;
13142 esac
13143 xxx=`awk '
13144 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13145         print substr($2, 4, 20)
13146 }
13147 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13148         print substr($3, 4, 20)
13149 }' $xxxfiles`
13150 : Append some common names just in case the awk scan failed.
13151 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13152 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13153 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13154 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13155 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13156
13157 : generate a few handy files for later
13158 $cat > signal.c <<'EOCP'
13159 #include <sys/types.h>
13160 #include <signal.h>
13161 #include <stdio.h>
13162 int main() {
13163
13164 /* Strange style to avoid deeply-nested #if/#else/#endif */
13165 #ifndef NSIG
13166 #  ifdef _NSIG
13167 #    define NSIG (_NSIG)
13168 #  endif
13169 #endif
13170
13171 #ifndef NSIG
13172 #  ifdef SIGMAX
13173 #    define NSIG (SIGMAX+1)
13174 #  endif
13175 #endif
13176
13177 #ifndef NSIG
13178 #  ifdef SIG_MAX
13179 #    define NSIG (SIG_MAX+1)
13180 #  endif
13181 #endif
13182
13183 #ifndef NSIG
13184 #  ifdef MAXSIG
13185 #    define NSIG (MAXSIG+1)
13186 #  endif
13187 #endif
13188
13189 #ifndef NSIG
13190 #  ifdef MAX_SIG
13191 #    define NSIG (MAX_SIG+1)
13192 #  endif
13193 #endif
13194
13195 #ifndef NSIG
13196 #  ifdef SIGARRAYSIZE
13197 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13198 #  endif
13199 #endif
13200
13201 #ifndef NSIG
13202 #  ifdef _sys_nsig
13203 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13204 #  endif
13205 #endif
13206
13207 /* Default to some arbitrary number that's big enough to get most
13208    of the common signals.
13209 */
13210 #ifndef NSIG
13211 #    define NSIG 50
13212 #endif
13213
13214 printf("NSIG %d\n", NSIG);
13215
13216 #ifndef JUST_NSIG
13217
13218 EOCP
13219
13220 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13221 {
13222         printf "#ifdef SIG"; printf $1; printf "\n"
13223         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13224         printf $1; printf ");\n"
13225         printf "#endif\n"
13226 }
13227 END {
13228         printf "#endif /* JUST_NSIG */\n";
13229         printf "exit(0);\n}\n";
13230 }
13231 ' >>signal.c
13232 $cat >signal.awk <<'EOP'
13233 BEGIN { ndups = 0 }
13234 $1 ~ /^NSIG$/ { nsig = $2 }
13235 ($1 !~ /^NSIG$/) && (NF == 2) {
13236     if ($2 > maxsig) { maxsig = $2 }
13237     if (sig_name[$2]) {
13238         dup_name[ndups] = $1
13239         dup_num[ndups] = $2
13240         ndups++ 
13241     }
13242     else {
13243         sig_name[$2] = $1
13244         sig_num[$2] = $2
13245     }
13246 }
13247 END { 
13248     if (nsig == 0) {
13249         nsig = maxsig + 1
13250     }
13251     printf("NSIG %d\n", nsig);
13252     for (n = 1; n < nsig; n++) {
13253         if (sig_name[n]) {
13254             printf("%s %d\n", sig_name[n], sig_num[n])
13255         }
13256         else {
13257             printf("NUM%d %d\n", n, n) 
13258         }
13259     }
13260     for (n = 0; n < ndups; n++) {
13261         printf("%s %d\n", dup_name[n], dup_num[n])
13262     }
13263 }
13264 EOP
13265 $cat >signal_cmd <<EOS
13266 $startsh
13267 if $test -s signal.lst; then
13268     echo "Using your existing signal.lst file"
13269         exit 0
13270 fi
13271 xxx="$xxx"
13272 EOS
13273 $cat >>signal_cmd <<'EOS'
13274
13275 set signal
13276 if eval $compile_ok; then
13277         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13278 else
13279         echo "(I can't seem be able to compile the whole test program)" >&4
13280         echo "(I'll try it in little pieces.)" >&4
13281         set signal -DJUST_NSIG
13282         if eval $compile_ok; then
13283                 ./signal$_exe > signal.nsg
13284                 $cat signal.nsg
13285         else
13286                 echo "I can't seem to figure out how many signals you have." >&4
13287                 echo "Guessing 50." >&4
13288                 echo 'NSIG 50' > signal.nsg
13289         fi
13290         : Now look at all the signal names, one at a time.
13291         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13292                 $cat > signal.c <<EOCP
13293 #include <sys/types.h>
13294 #include <signal.h>
13295 #include <stdio.h>
13296 int main() {
13297 printf("$xx %d\n", SIG${xx});
13298 return 0;
13299 }
13300 EOCP
13301                 set signal
13302                 if eval $compile; then
13303                         echo "SIG${xx} found."
13304                         ./signal$_exe  >> signal.ls1
13305                 else
13306                         echo "SIG${xx} NOT found."
13307                 fi
13308         done
13309         if $test -s signal.ls1; then
13310                 $cat signal.nsg signal.ls1 |
13311                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13312         fi
13313
13314 fi
13315 if $test -s signal.lst; then
13316         :
13317 else
13318         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13319         echo 'kill -l' >signal
13320         set X `csh -f <signal`
13321         $rm -f signal
13322         shift
13323         case $# in
13324         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13325         esac
13326         echo $@ | $tr ' ' $trnl | \
13327             $awk '{ printf "%s %d\n", $1, ++s; }
13328                   END { printf "NSIG %d\n", ++s }' >signal.lst
13329 fi
13330 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13331 EOS
13332 chmod a+x signal_cmd
13333 $eunicefix signal_cmd
13334
13335 : generate list of signal names
13336 echo " "
13337 case "$sig_name_init" in
13338 '') doinit=yes ;;
13339 *)  case "$sig_num_init" in
13340     ''|*,*) doinit=yes ;;
13341     esac ;;
13342 esac
13343 case "$doinit" in
13344 yes)
13345         echo "Generating a list of signal names and numbers..." >&4
13346         . ./signal_cmd
13347         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13348         sig_name=`$awk 'BEGIN { printf "ZERO " }
13349                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13350         sig_num=`$awk  'BEGIN { printf "0 " }
13351                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13352         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13353                              !/^NSIG/   { printf "\"%s\", ", $1 }
13354                              END        { printf "0\n" }' signal.lst`
13355         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13356                              !/^NSIG/   { printf "%d, ", $2}
13357                              END        { printf "0\n"}' signal.lst`
13358         ;;
13359 esac
13360 echo "The following $sig_count signals are available:"
13361 echo " "
13362 echo $sig_name | $awk \
13363 'BEGIN { linelen = 0 }
13364 {
13365         for (i = 1; i <= NF; i++) {
13366                 name = "SIG" $i " "
13367                 linelen = linelen + length(name)
13368                 if (linelen > 70) {
13369                         printf "\n"
13370                         linelen = length(name)
13371                 }
13372                 printf "%s", name
13373         }
13374         printf "\n"
13375 }'
13376 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13377
13378 : see what type is used for signed size_t
13379 set ssize_t ssizetype int stdio.h sys/types.h
13380 eval $typedef
13381 dflt="$ssizetype"
13382 $cat > ssize.c <<EOM
13383 #include <stdio.h>
13384 #include <sys/types.h>
13385 #define Size_t $sizetype
13386 #define SSize_t $dflt
13387 int main()
13388 {
13389         if (sizeof(Size_t) == sizeof(SSize_t))
13390                 printf("$dflt\n");
13391         else if (sizeof(Size_t) == sizeof(int))
13392                 printf("int\n");
13393         else 
13394                 printf("long\n");
13395         exit(0);
13396 }
13397 EOM
13398 echo " "
13399 set ssize
13400 if eval $compile_ok && ./ssize > /dev/null; then
13401         ssizetype=`./ssize`
13402         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13403 else
13404         $cat >&4 <<EOM
13405 Help! I can't compile and run the ssize_t test program: please enlighten me!
13406 (This is probably a misconfiguration in your system or libraries, and
13407 you really ought to fix it.  Still, I'll try anyway.)
13408
13409 I need a type that is the same size as $sizetype, but is guaranteed to
13410 be signed.  Common values are ssize_t, int and long.
13411
13412 EOM
13413         rp="What signed type is the same size as $sizetype?"
13414         . ./myread
13415         ssizetype="$ans"
13416 fi
13417 $rm -f ssize ssize.*
13418
13419 : see what type of char stdio uses.
13420 echo " "
13421 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13422         echo "Your stdio uses unsigned chars." >&4
13423         stdchar="unsigned char"
13424 else
13425         echo "Your stdio uses signed chars." >&4
13426         stdchar="char"
13427 fi
13428
13429 : see if time exists
13430 echo " "
13431 if test "X$d_time" = X -o X"$timetype" = X; then
13432     if set time val -f d_time; eval $csym; $val; then
13433                 echo 'time() found.' >&4
13434                 val="$define"
13435                 rp="What is the type returned by time() on this system?"
13436                 set time_t timetype long stdio.h sys/types.h
13437                 eval $typedef_ask
13438     else
13439                 echo 'time() not found, hope that will do.' >&4
13440                 val="$undef"
13441                 timetype='int';
13442     fi
13443     set d_time
13444     eval $setvar
13445 fi
13446
13447 : see what type uids are declared as in the kernel
13448 echo " "
13449 echo "Looking for the type for user ids returned by getuid()."
13450 set uid_t uidtype xxx stdio.h sys/types.h
13451 eval $typedef
13452 case "$uidtype" in
13453 xxx)
13454         xxx=`./findhdr sys/user.h`
13455         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13456         case $1 in
13457         unsigned) dflt="$1 $2" ;;
13458         *) dflt="$1" ;;
13459         esac
13460         ;;
13461 *) dflt="$uidtype";;
13462 esac
13463 case "$uidtype" in
13464 uid_t)  echo "uid_t found." ;;
13465 *)      rp="What is the type for user ids returned by getuid()?"
13466         . ./myread
13467         uidtype="$ans"
13468         ;;
13469 esac
13470
13471 echo " "
13472 case "$uidtype" in
13473 *_t) zzz="$uidtype"     ;;
13474 *)   zzz="uid"          ;;
13475 esac
13476 echo "Checking the size of $zzz..." >&4 
13477 cat > try.c <<EOCP
13478 #include <sys/types.h>
13479 #include <stdio.h>
13480 int main() {
13481     printf("%d\n", (int)sizeof($uidtype));
13482     exit(0);
13483 }
13484 EOCP
13485 set try
13486 if eval $compile_ok; then
13487         yyy=`./try`
13488         case "$yyy" in
13489         '')     uidsize=4
13490                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13491                 ;;
13492         *)      uidsize=$yyy
13493                 echo "Your $zzz size is $uidsize bytes."
13494                 ;;
13495         esac
13496 else
13497         uidsize=4
13498         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13499 fi
13500
13501 echo " "
13502 case "$uidtype" in
13503 *_t) zzz="$uidtype"     ;;
13504 *)   zzz="uid"          ;;
13505 esac
13506 echo "Checking the sign of $zzz..." >&4
13507 cat > try.c <<EOCP
13508 #include <sys/types.h>
13509 #include <stdio.h>
13510 int main() {
13511         $uidtype foo = -1;
13512         if (foo < 0)
13513                 printf("-1\n");
13514         else
13515                 printf("1\n");
13516 }
13517 EOCP
13518 set try
13519 if eval $compile; then
13520         yyy=`./try`
13521         case "$yyy" in
13522         '')     uidsign=1
13523                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13524                 ;;
13525         *)      uidsign=$yyy
13526                 case "$uidsign" in
13527                  1) echo "Your $zzz is unsigned." ;;
13528                 -1) echo "Your $zzz is signed."   ;;
13529                 esac
13530                 ;;
13531         esac
13532 else
13533         uidsign=1
13534         echo "(I can't compile the test program--guessing unsigned.)" >&4
13535 fi
13536
13537
13538
13539 echo " "
13540 $echo "Checking the format string to be used for uids..." >&4
13541
13542 case "$uidsign" in
13543 -1)     if $test X"$uidsize" = X"$ivsize"; then
13544                 uidformat="$ivdformat"
13545         else
13546                 if $test X"$uidsize" = X"$longsize"; then
13547                         uidformat='"ld"'
13548                 else
13549                         if $test X"$uidsize" = X"$intsize"; then
13550                                 uidformat='"d"'
13551                         else
13552                                 if $test X"$uidsize" = X"$shortsize"; then
13553                                         uidformat='"hd"'
13554                                 fi
13555                         fi
13556                 fi
13557         fi
13558         ;;
13559 *)      if $test X"$uidsize" = X"$uvsize"; then
13560                 uidformat="$uvuformat"
13561         else
13562                 if $test X"$uidsize" = X"$longsize"; then
13563                         uidformat='"lu"'
13564                 else
13565                         if $test X"$uidsize" = X"$intsize"; then
13566                                 uidformat='"u"'
13567                         else
13568                                 if $test X"$uidsize" = X"$shortsize"; then
13569                                         uidformat='"hu"'
13570                                 fi
13571                         fi
13572                 fi
13573         fi
13574         ;;
13575 esac
13576
13577 : see if dbm.h is available
13578 : see if dbmclose exists
13579 set dbmclose d_dbmclose
13580 eval $inlibc
13581
13582 case "$d_dbmclose" in
13583 $define)
13584         set dbm.h i_dbm
13585         eval $inhdr
13586         case "$i_dbm" in
13587         $define)
13588                 val="$undef"
13589                 set i_rpcsvcdbm
13590                 eval $setvar
13591                 ;;
13592         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13593                 eval $inhdr
13594                 ;;
13595         esac
13596         ;;
13597 *)      echo "We won't be including <dbm.h>"
13598         val="$undef"
13599         set i_dbm
13600         eval $setvar
13601         val="$undef"
13602         set i_rpcsvcdbm
13603         eval $setvar
13604         ;;
13605 esac
13606
13607 : see if this is a sys/file.h system
13608 val=''
13609 set sys/file.h val
13610 eval $inhdr
13611
13612 : do we need to include sys/file.h ?
13613 case "$val" in
13614 "$define")
13615         echo " "
13616         if $h_sysfile; then
13617                 val="$define"
13618                 echo "We'll be including <sys/file.h>." >&4
13619         else
13620                 val="$undef"
13621                 echo "We won't be including <sys/file.h>." >&4
13622         fi
13623         ;;
13624 *)
13625         h_sysfile=false
13626         ;;
13627 esac
13628 set i_sysfile
13629 eval $setvar
13630
13631 : see if fcntl.h is there
13632 val=''
13633 set fcntl.h val
13634 eval $inhdr
13635
13636 : see if we can include fcntl.h
13637 case "$val" in
13638 "$define")
13639         echo " "
13640         if $h_fcntl; then
13641                 val="$define"
13642                 echo "We'll be including <fcntl.h>." >&4
13643         else
13644                 val="$undef"
13645                 if $h_sysfile; then
13646         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13647                 else
13648                         echo "We won't be including <fcntl.h>." >&4
13649                 fi
13650         fi
13651         ;;
13652 *)
13653         h_fcntl=false
13654         val="$undef"
13655         ;;
13656 esac
13657 set i_fcntl
13658 eval $setvar
13659
13660 : see if this is a iconv.h system
13661 set iconv.h i_iconv
13662 eval $inhdr
13663
13664 : see if locale.h is available
13665 set locale.h i_locale
13666 eval $inhdr
13667
13668 : see if mach cthreads are available
13669 if test "X$usethreads" = "X$define"; then
13670         set mach/cthreads.h i_machcthr
13671         eval $inhdr
13672 else
13673         i_machcthr="$undef"
13674 fi
13675
13676
13677
13678 : see if this is a math.h system
13679 set math.h i_math
13680 eval $inhdr
13681
13682 : see if this is a mntent.h system
13683 set mntent.h i_mntent
13684 eval $inhdr
13685
13686 : see if ndbm.h is available
13687 set ndbm.h t_ndbm
13688 eval $inhdr
13689 case "$t_ndbm" in
13690 $define)
13691         : see if dbm_open exists
13692         set dbm_open d_dbm_open
13693         eval $inlibc
13694         case "$d_dbm_open" in
13695         $undef)
13696                 t_ndbm="$undef"
13697                 echo "We won't be including <ndbm.h>"
13698                 ;;
13699         esac
13700         ;;
13701 esac
13702 val="$t_ndbm"
13703 set i_ndbm
13704 eval $setvar
13705
13706 : see if net/errno.h is available
13707 val=''
13708 set net/errno.h val
13709 eval $inhdr
13710
13711 : Unfortunately, it causes problems on some systems.  Arrgh.
13712 case "$val" in
13713 $define)
13714         cat > try.c <<'EOM'
13715 #include <stdio.h>
13716 #include <errno.h>
13717 #include <net/errno.h>
13718 int func()
13719 {
13720         return ENOTSOCK;
13721 }
13722 EOM
13723         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13724                 echo "We'll be including <net/errno.h>." >&4
13725         else
13726                 echo "We won't be including <net/errno.h>." >&4
13727                 val="$undef"
13728         fi
13729         $rm -f try.* try
13730         ;;
13731 esac
13732 set i_neterrno
13733 eval $setvar
13734
13735 : see if netinet/tcp.h is available
13736 set netinet/tcp.h i_netinettcp
13737 eval $inhdr
13738
13739 : see if this is a poll.h system
13740 set poll.h i_poll
13741 eval $inhdr
13742
13743 echo " "
13744 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13745 $cat <<'EOSH' > Cppsym.know
13746 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13747 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13748 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13749 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13750 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13751 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13752 bull c cadmus clipper CMU COFF COMPILER_VERSION
13753 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13754 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13755 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13756 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13757 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13758 H3050R H3050RX hbullx20 hcx host_mips
13759 hp200 hp300 hp700 HP700 hp800 hp9000
13760 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13761 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13762 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13763 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13764 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13765 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13766 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13767 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13768 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13769 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13770 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13771 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13772 MATH_HAS_NO_SIDE_EFFECTS
13773 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13774 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13775 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13776 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13777 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13778 NetBSD news1500 news1700 news1800 news1900 news3700
13779 news700 news800 news900 NeXT NLS ns16000 ns32000
13780 ns32016 ns32332 ns32k nsc32000
13781 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13782 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13783 pc532 pdp11 PGC PIC plexus PORTAR posix
13784 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13785 POSIX_C_SOURCE POSIX_SOURCE POWER
13786 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13787 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13788 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13789 sony sony_news sonyrisc sparc sparclite spectrum
13790 stardent stdc STDC_EXT stratos sun sun3 sun386
13791 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13792 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13793 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13794 sysV68 sysV88 Tek4132 Tek4300 titan
13795 tower tower32 tower32_200 tower32_600 tower32_700
13796 tower32_800 tower32_850 tss
13797 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13798 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13799 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13800 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13801 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13802 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13803 z8000
13804 EOSH
13805 # Maybe put other stuff here too.
13806 cat <<EOSH >>Cppsym.know
13807 $osname
13808 EOSH
13809 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13810 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13811 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13812 $rm -f Cppsym.a Cppsym.b
13813 cat <<EOSH > Cppsym
13814 $startsh
13815 if $test \$# -gt 0; then
13816     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13817     if $test -s Cppsym.got; then
13818         $rm -f Cppsym.got
13819         exit 0
13820     fi
13821     $rm -f Cppsym.got
13822     exit 1
13823 else
13824     $tr " " "$trnl" | ./Cppsym.try
13825     exit 0
13826 fi
13827 EOSH
13828 chmod +x Cppsym
13829 $eunicefix Cppsym
13830 cat <<EOSH > Cppsym.try
13831 $startsh
13832 cat <<'EOCP' > try.c
13833 #include <stdio.h>
13834 int main() {
13835 EOCP
13836 $awk \\
13837 EOSH
13838 cat <<'EOSH' >> Cppsym.try
13839 'length($1) > 0 {
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     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
13843     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
13844 }'       >> try.c
13845 echo '}' >> try.c
13846 EOSH
13847 cat <<EOSH >> Cppsym.try
13848 cc="$cc"
13849 optimize="$optimize"
13850 ccflags="$ccflags"
13851 ldflags="$ldflags"
13852 libs="$libs"
13853 exe_ext="$exe_ext"
13854 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
13855 EOSH
13856 chmod +x Cppsym.try
13857 $eunicefix Cppsym.try
13858 ./Cppsym < Cppsym.know > Cppsym.true
13859 : now check the C compiler for additional symbols
13860 postprocess_cc_v=''
13861 case "$osname" in
13862 aix) postprocess_cc_v="|$tr , ' '" ;;
13863 esac
13864 $cat >ccsym <<EOS
13865 $startsh
13866 $cat >tmp.c <<EOF
13867 extern int foo;
13868 EOF
13869 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13870 do
13871         case "\$i" in
13872         -D*) echo "\$i" | $sed 's/^-D//';;
13873         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13874         esac
13875 done
13876 $rm -f try.c
13877 EOS
13878 postprocess_cc_v=''
13879 chmod +x ccsym
13880 $eunicefix ccsym
13881 ./ccsym > ccsym1.raw
13882 if $test -s ccsym1.raw; then
13883        $sort ccsym1.raw | $uniq >ccsym.raw
13884 else
13885        mv ccsym1.raw ccsym.raw
13886 fi
13887
13888 $awk '/\=/ { print $0; next }
13889         { print $0"=1" }' ccsym.raw >ccsym.list
13890 $awk '/\=/ { print $0; next }
13891         { print $0"=1" }' Cppsym.true >ccsym.true
13892 $comm -13 ccsym.true ccsym.list >ccsym.own
13893 $comm -12 ccsym.true ccsym.list >ccsym.com
13894 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13895 also=''
13896 if $test -z ccsym.raw; then
13897         echo "Your C compiler doesn't seem to define any symbols!" >&4
13898         echo " "
13899         echo "However, your C preprocessor defines the following symbols:"
13900         $cat Cppsym.true
13901         ccsymbols=''
13902         cppsymbols=`$cat Cppsym.true`
13903         cppsymbols=`echo $cppsymbols`
13904         cppccsymbols="$cppsymbols"
13905 else
13906         if $test -s ccsym.com; then
13907                 echo "Your C compiler and pre-processor define these symbols:"
13908                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13909                 also='also '
13910                 symbols='ones'
13911                 cppccsymbols=`$cat ccsym.com`
13912                 cppccsymbols=`echo $cppccsymbols`
13913                 $test "$silent" || sleep 1
13914         fi
13915         if $test -s ccsym.cpp; then
13916                 $test "$also" && echo " "
13917                 echo "Your C pre-processor ${also}defines the following symbols:"
13918                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13919                 also='further '
13920                 cppsymbols=`$cat ccsym.cpp`
13921                 cppsymbols=`echo $cppsymbols`
13922                 $test "$silent" || sleep 1
13923         fi
13924         if $test -s ccsym.own; then
13925                 $test "$also" && echo " "
13926                 echo "Your C compiler ${also}defines the following cpp symbols:"
13927                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13928                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13929                 ccsymbols=`$cat ccsym.own`
13930                 ccsymbols=`echo $ccsymbols`
13931                 $test "$silent" || sleep 1
13932         fi
13933 fi
13934 $rm -f ccsym*
13935
13936 : see if this is a termio system
13937 val="$undef"
13938 val2="$undef"
13939 val3="$undef"
13940 if $test `./findhdr termios.h`; then
13941         set tcsetattr i_termios
13942         eval $inlibc
13943         val3="$i_termios"
13944 fi
13945 echo " "
13946 case "$val3" in
13947 "$define") echo "You have POSIX termios.h... good!" >&4;;
13948 *) if ./Cppsym pyr; then
13949                 case "`/bin/universe`" in
13950                 ucb) if $test `./findhdr sgtty.h`; then
13951                                 val2="$define"
13952                                 echo "<sgtty.h> found." >&4
13953                         else
13954                                 echo "System is pyramid with BSD universe."
13955                                 echo "<sgtty.h> not found--you could have problems." >&4
13956                         fi;;
13957                 *) if $test `./findhdr termio.h`; then
13958                                 val="$define"
13959                                 echo "<termio.h> found." >&4
13960                         else
13961                                 echo "System is pyramid with USG universe."
13962                                 echo "<termio.h> not found--you could have problems." >&4
13963                         fi;;
13964                 esac
13965         elif ./usg; then
13966                 if $test `./findhdr termio.h`; then
13967                         echo "<termio.h> found." >&4
13968                         val="$define"
13969                 elif $test `./findhdr sgtty.h`; then
13970                         echo "<sgtty.h> found." >&4
13971                         val2="$define"
13972                 else
13973 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13974                 fi
13975         else
13976                 if $test `./findhdr sgtty.h`; then
13977                         echo "<sgtty.h> found." >&4
13978                         val2="$define"
13979                 elif $test `./findhdr termio.h`; then
13980                         echo "<termio.h> found." >&4
13981                         val="$define"
13982                 else
13983 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13984                 fi
13985         fi;;
13986 esac
13987 set i_termio; eval $setvar
13988 val=$val2; set i_sgtty; eval $setvar
13989 val=$val3; set i_termios; eval $setvar
13990
13991 : see if this is a shadow.h system
13992 set shadow.h i_shadow
13993 eval $inhdr
13994
13995 : see if this is a socks.h system
13996 set socks.h i_socks
13997 eval $inhdr
13998
13999 : see if stdarg is available
14000 echo " "
14001 if $test `./findhdr stdarg.h`; then
14002         echo "<stdarg.h> found." >&4
14003         valstd="$define"
14004 else
14005         echo "<stdarg.h> NOT found." >&4
14006         valstd="$undef"
14007 fi
14008
14009 : see if varags is available
14010 echo " "
14011 if $test `./findhdr varargs.h`; then
14012         echo "<varargs.h> found." >&4
14013 else
14014         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14015 fi
14016
14017 : set up the varargs testing programs
14018 $cat > varargs.c <<EOP
14019 #ifdef I_STDARG
14020 #include <stdarg.h>
14021 #endif
14022 #ifdef I_VARARGS
14023 #include <varargs.h>
14024 #endif
14025
14026 #ifdef I_STDARG
14027 int f(char *p, ...)
14028 #else
14029 int f(va_alist)
14030 va_dcl
14031 #endif
14032 {
14033         va_list ap;
14034 #ifndef I_STDARG
14035         char *p;
14036 #endif
14037 #ifdef I_STDARG
14038         va_start(ap,p);
14039 #else
14040         va_start(ap);
14041         p = va_arg(ap, char *);
14042 #endif
14043         va_end(ap);
14044 }
14045 EOP
14046 $cat > varargs <<EOP
14047 $startsh
14048 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14049         echo "true"
14050 else
14051         echo "false"
14052 fi
14053 $rm -f varargs$_o
14054 EOP
14055 chmod +x varargs
14056
14057 : now check which varargs header should be included
14058 echo " "
14059 i_varhdr=''
14060 case "$valstd" in
14061 "$define")
14062         if `./varargs I_STDARG`; then
14063                 val='stdarg.h'
14064         elif `./varargs I_VARARGS`; then
14065                 val='varargs.h'
14066         fi
14067         ;;
14068 *)
14069         if `./varargs I_VARARGS`; then
14070                 val='varargs.h'
14071         fi
14072         ;;
14073 esac
14074 case "$val" in
14075 '')
14076 echo "I could not find the definition for va_dcl... You have problems..." >&4
14077         val="$undef"; set i_stdarg; eval $setvar
14078         val="$undef"; set i_varargs; eval $setvar
14079         ;;
14080 *) 
14081         set i_varhdr
14082         eval $setvar
14083         case "$i_varhdr" in
14084         stdarg.h)
14085                 val="$define"; set i_stdarg; eval $setvar
14086                 val="$undef"; set i_varargs; eval $setvar
14087                 ;;
14088         varargs.h)
14089                 val="$undef"; set i_stdarg; eval $setvar
14090                 val="$define"; set i_varargs; eval $setvar
14091                 ;;
14092         esac
14093         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14094 esac
14095 $rm -f varargs*
14096
14097 : see if stddef is available
14098 set stddef.h i_stddef
14099 eval $inhdr
14100
14101 : see if sys/access.h is available
14102 set sys/access.h i_sysaccess
14103 eval $inhdr
14104
14105 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14106 set sys/filio.h i_sysfilio
14107 eval $inhdr
14108 echo " "
14109 if $test `./findhdr sys/ioctl.h`; then
14110         val="$define"
14111         echo '<sys/ioctl.h> found.' >&4
14112 else
14113         val="$undef"
14114         if $test $i_sysfilio = "$define"; then
14115             echo '<sys/ioctl.h> NOT found.' >&4
14116         else
14117                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14118                 $test $i_termio = "$define" && xxx="termio.h"
14119                 $test $i_termios = "$define" && xxx="termios.h"
14120 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14121         fi
14122 fi
14123 set i_sysioctl
14124 eval $setvar
14125
14126 : see if sys/resource.h has to be included
14127 set sys/resource.h i_sysresrc
14128 eval $inhdr
14129
14130 : see if sys/security.h is available
14131 set sys/security.h i_syssecrt
14132 eval $inhdr
14133
14134 : see if this is a sys/statvfs.h system
14135 set sys/statvfs.h i_sysstatvfs
14136 eval $inhdr
14137
14138 : see if this is a sys/uio.h system
14139 set sys/uio.h i_sysuio
14140 eval $inhdr
14141
14142 : see if this is a sys/un.h system
14143 set sys/un.h i_sysun
14144 eval $inhdr
14145
14146 : see if this is a syswait system
14147 set sys/wait.h i_syswait
14148 eval $inhdr
14149
14150 : see if this is a ustat.h system
14151 set ustat.h i_ustat
14152 eval $inhdr
14153
14154 : see if this is an utime system
14155 set utime.h i_utime
14156 eval $inhdr
14157
14158 : see if this is a values.h system
14159 set values.h i_values
14160 eval $inhdr
14161
14162 : see if this is a vfork system
14163 case "$d_vfork" in
14164 "$define")
14165         set vfork.h i_vfork
14166         eval $inhdr
14167         ;;
14168 *)
14169         i_vfork="$undef"
14170         ;;
14171 esac
14172
14173 : see if gdbm.h is available
14174 set gdbm.h t_gdbm
14175 eval $inhdr
14176 case "$t_gdbm" in
14177 $define)
14178         : see if gdbm_open exists
14179         set gdbm_open d_gdbm_open
14180         eval $inlibc
14181         case "$d_gdbm_open" in
14182         $undef)
14183                 t_gdbm="$undef"
14184                 echo "We won't be including <gdbm.h>"
14185                 ;;
14186         esac
14187         ;;
14188 esac
14189 val="$t_gdbm"
14190 set i_gdbm
14191 eval $setvar
14192
14193 echo " "
14194 echo "Looking for extensions..." >&4
14195 : If we are using the old config.sh, known_extensions may contain
14196 : old or inaccurate or duplicate values.
14197 known_extensions=''
14198 nonxs_extensions=''
14199 : We do not use find because it might not be available.
14200 : We do not just use MANIFEST because the user may have dropped
14201 : some additional extensions into the source tree and expect them
14202 : to be built.
14203
14204 : Function to recursively find available extensions, ignoring DynaLoader
14205 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14206 find_extensions='
14207     for xxx in *; do
14208        case "$xxx" in
14209            DynaLoader|dynaload) ;;
14210            *)
14211            if $test -f $xxx/$xxx.xs; then
14212                known_extensions="$known_extensions $1$xxx";
14213            elif $test -f $xxx/Makefile.PL; then
14214                nonxs_extensions="$nonxs_extensions $1$xxx";
14215            else
14216                if $test -d $xxx -a $# -lt 10; then
14217                    set $1$xxx/ $*;
14218                    cd $xxx;
14219                    eval $find_extensions;
14220                    cd ..;
14221                    shift;
14222                fi;
14223            fi
14224            ;;
14225        esac;
14226     done'
14227 tdir=`pwd`
14228 cd $rsrc/ext
14229 set X
14230 shift
14231 eval $find_extensions
14232 set X $nonxs_extensions
14233 shift
14234 nonxs_extensions="$*"
14235 set X $known_extensions
14236 shift
14237 known_extensions="$*"
14238 cd $tdir
14239
14240 : Now see which are supported on this system.
14241 avail_ext=''
14242 for xxx in $known_extensions ; do
14243         case "$xxx" in
14244         DB_File|db_file)
14245                 case "$i_db" in
14246                 $define) avail_ext="$avail_ext $xxx" ;;
14247                 esac
14248                 ;;
14249         GDBM_File|gdbm_fil)
14250                 case "$i_gdbm" in 
14251                 $define) avail_ext="$avail_ext $xxx" ;;
14252                 esac
14253                 ;;
14254         NDBM_File|ndbm_fil)
14255                 case "$i_ndbm" in
14256                 $define) avail_ext="$avail_ext $xxx" ;;
14257                 esac
14258                 ;;
14259         ODBM_File|odbm_fil) 
14260                 case "${i_dbm}${i_rpcsvcdbm}" in
14261                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14262                 esac
14263                 ;;
14264         POSIX|posix)
14265                 case "$useposix" in
14266                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14267                 esac
14268                 ;;
14269         Opcode|opcode)
14270                 case "$useopcode" in
14271                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14272                 esac
14273                 ;;
14274         Socket|socket)
14275                 case "$d_socket" in 
14276                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14277                 esac
14278                 ;;
14279         Thread|thread)
14280                 case "$usethreads" in 
14281                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14282                 esac
14283                 ;;
14284         IPC/SysV|ipc/sysv)
14285                 : XXX Do we need a useipcsysv variable here
14286                 case "${d_msg}${d_sem}${d_shm}" in 
14287                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14288                 esac
14289                 ;;
14290         *)      avail_ext="$avail_ext $xxx"
14291                 ;;
14292         esac
14293 done
14294
14295 set X $avail_ext
14296 shift
14297 avail_ext="$*"
14298
14299 : Now see which nonxs extensions are supported on this system.
14300 : For now assume all are.
14301 nonxs_ext=''
14302 for xxx in $nonxs_extensions ; do
14303         case "$xxx" in
14304         *)      nonxs_ext="$nonxs_ext $xxx"
14305                 ;;
14306         esac
14307 done
14308
14309 set X $nonxs_ext
14310 shift
14311 nonxs_ext="$*"
14312
14313 case $usedl in
14314 $define)
14315         $cat <<EOM
14316 A number of extensions are supplied with $package.  You may choose to
14317 compile these extensions for dynamic loading (the default), compile
14318 them into the $package executable (static loading), or not include
14319 them at all.  Answer "none" to include no extensions.
14320 Note that DynaLoader is always built and need not be mentioned here.
14321
14322 EOM
14323         case "$dynamic_ext" in
14324         '') dflt="$avail_ext" ;;
14325         *)      dflt="$dynamic_ext"
14326                 # Perhaps we are reusing an old out-of-date config.sh.
14327                 case "$hint" in
14328                 previous)
14329                         if test X"$dynamic_ext" != X"$avail_ext"; then
14330                                 $cat <<EOM
14331 NOTICE:  Your previous config.sh list may be incorrect. 
14332 The extensions now available to you are 
14333         ${avail_ext}
14334 but the default list from your previous config.sh is
14335         ${dynamic_ext} 
14336
14337 EOM
14338                         fi
14339                         ;;
14340                 esac
14341                 ;;
14342         esac
14343         case "$dflt" in
14344         '')     dflt=none;;
14345         esac
14346         rp="What extensions do you wish to load dynamically?"
14347         . ./myread
14348         case "$ans" in
14349         none) dynamic_ext=' ' ;;
14350         *) dynamic_ext="$ans" ;;
14351         esac
14352
14353         case "$static_ext" in
14354         '')
14355                 : Exclude those already listed in dynamic linking
14356                 dflt=''
14357                 for xxx in $avail_ext; do
14358                         case " $dynamic_ext " in
14359                         *" $xxx "*) ;;
14360                         *) dflt="$dflt $xxx" ;;
14361                         esac
14362                 done
14363                 set X $dflt
14364                 shift
14365                 dflt="$*"
14366                 ;;
14367         *)  dflt="$static_ext" 
14368                 ;;
14369         esac
14370
14371         case "$dflt" in
14372         '')     dflt=none;;
14373         esac
14374         rp="What extensions do you wish to load statically?"
14375         . ./myread
14376         case "$ans" in
14377         none) static_ext=' ' ;;
14378         *) static_ext="$ans" ;;
14379         esac
14380         ;;
14381 *)
14382         $cat <<EOM
14383 A number of extensions are supplied with $package.  Answer "none" 
14384 to include no extensions. 
14385 Note that DynaLoader is always built and need not be mentioned here.
14386
14387 EOM
14388         case "$static_ext" in
14389         '') dflt="$avail_ext" ;;
14390         *)      dflt="$static_ext"
14391                 # Perhaps we are reusing an old out-of-date config.sh.
14392                 case "$hint" in
14393                 previous)
14394                         if test X"$static_ext" != X"$avail_ext"; then
14395                                 $cat <<EOM
14396 NOTICE:  Your previous config.sh list may be incorrect. 
14397 The extensions now available to you are 
14398         ${avail_ext}
14399 but the default list from your previous config.sh is
14400         ${static_ext} 
14401
14402 EOM
14403                         fi
14404                         ;;
14405                 esac
14406                 ;;
14407         esac
14408         : Exclude those that are not xs extensions
14409         case "$dflt" in
14410         '')     dflt=none;;
14411         esac
14412         rp="What extensions do you wish to include?"
14413         . ./myread
14414         case "$ans" in
14415         none) static_ext=' ' ;;
14416         *) static_ext="$ans" ;;
14417         esac
14418         ;;
14419 esac
14420
14421 set X $dynamic_ext $static_ext $nonxs_ext
14422 shift
14423 extensions="$*"
14424
14425 : Remove build directory name from cppstdin so it can be used from
14426 : either the present location or the final installed location.
14427 echo " "
14428 : Get out of the UU directory to get correct path name.
14429 cd ..
14430 case "$cppstdin" in
14431 `pwd`/cppstdin)
14432         echo "Stripping down cppstdin path name"
14433         cppstdin=cppstdin
14434         ;;
14435 esac
14436 cd UU
14437
14438 : end of configuration questions
14439 echo " "
14440 echo "End of configuration questions."
14441 echo " "
14442
14443 : back to where it started
14444 if test -d ../UU; then
14445         cd ..
14446 fi
14447
14448 : configuration may be patched via a 'config.over' file
14449 if $test -f config.over; then
14450         echo " "
14451         dflt=y
14452         rp='I see a config.over file.  Do you wish to load it?'
14453         . UU/myread
14454         case "$ans" in
14455         n*) echo "OK, I'll ignore it.";;
14456         *)      . ./config.over
14457                 echo "Configuration override changes have been loaded."
14458                 ;;
14459         esac
14460 fi
14461
14462 : in case they want portability, strip down executable paths
14463 case "$d_portable" in
14464 "$define")
14465         echo " "
14466         echo "Stripping down executable paths..." >&4
14467         for file in $loclist $trylist; do
14468                 eval temp=\$$file
14469                 eval $file=`basename $temp`
14470         done
14471         ;;
14472 esac
14473
14474 : create config.sh file
14475 echo " "
14476 echo "Creating config.sh..." >&4
14477 $spitshell <<EOT >config.sh
14478 $startsh
14479 #
14480 # This file was produced by running the Configure script. It holds all the
14481 # definitions figured out by Configure. Should you modify one of these values,
14482 # do not forget to propagate your changes by running "Configure -der". You may
14483 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14484 #
14485
14486 # Package name      : $package
14487 # Source directory  : $src
14488 # Configuration time: $cf_time
14489 # Configured by     : $cf_by
14490 # Target system     : $myuname
14491
14492 Author='$Author'
14493 Date='$Date'
14494 Header='$Header'
14495 Id='$Id'
14496 Locker='$Locker'
14497 Log='$Log'
14498 Mcc='$Mcc'
14499 RCSfile='$RCSfile'
14500 Revision='$Revision'
14501 Source='$Source'
14502 State='$State'
14503 _a='$_a'
14504 _exe='$_exe'
14505 _o='$_o'
14506 afs='$afs'
14507 alignbytes='$alignbytes'
14508 ansi2knr='$ansi2knr'
14509 aphostname='$aphostname'
14510 api_revision='$api_revision'
14511 api_subversion='$api_subversion'
14512 api_version='$api_version'
14513 api_versionstring='$api_versionstring'
14514 ar='$ar'
14515 archlib='$archlib'
14516 archlibexp='$archlibexp'
14517 archname64='$archname64'
14518 archname='$archname'
14519 archobjs='$archobjs'
14520 awk='$awk'
14521 baserev='$baserev'
14522 bash='$bash'
14523 bin='$bin'
14524 bincompat5005='$bincompat5005'
14525 binexp='$binexp'
14526 bison='$bison'
14527 byacc='$byacc'
14528 byteorder='$byteorder'
14529 c='$c'
14530 castflags='$castflags'
14531 cat='$cat'
14532 cc='$cc'
14533 cccdlflags='$cccdlflags'
14534 ccdlflags='$ccdlflags'
14535 ccflags='$ccflags'
14536 ccsymbols='$ccsymbols'
14537 cf_by='$cf_by'
14538 cf_email='$cf_email'
14539 cf_time='$cf_time'
14540 charsize='$charsize'
14541 chgrp='$chgrp'
14542 chmod='$chmod'
14543 chown='$chown'
14544 clocktype='$clocktype'
14545 comm='$comm'
14546 compress='$compress'
14547 contains='$contains'
14548 cp='$cp'
14549 cpio='$cpio'
14550 cpp='$cpp'
14551 cpp_stuff='$cpp_stuff'
14552 cppccsymbols='$cppccsymbols'
14553 cppflags='$cppflags'
14554 cpplast='$cpplast'
14555 cppminus='$cppminus'
14556 cpprun='$cpprun'
14557 cppstdin='$cppstdin'
14558 cppsymbols='$cppsymbols'
14559 crosscompile='$crosscompile'
14560 cryptlib='$cryptlib'
14561 csh='$csh'
14562 d_Gconvert='$d_Gconvert'
14563 d_PRIEldbl='$d_PRIEldbl'
14564 d_PRIFldbl='$d_PRIFldbl'
14565 d_PRIGldbl='$d_PRIGldbl'
14566 d_PRIX64='$d_PRIX64'
14567 d_PRId64='$d_PRId64'
14568 d_PRIeldbl='$d_PRIeldbl'
14569 d_PRIfldbl='$d_PRIfldbl'
14570 d_PRIgldbl='$d_PRIgldbl'
14571 d_PRIi64='$d_PRIi64'
14572 d_PRIo64='$d_PRIo64'
14573 d_PRIu64='$d_PRIu64'
14574 d_PRIx64='$d_PRIx64'
14575 d_access='$d_access'
14576 d_accessx='$d_accessx'
14577 d_alarm='$d_alarm'
14578 d_archlib='$d_archlib'
14579 d_atolf='$d_atolf'
14580 d_atoll='$d_atoll'
14581 d_attribut='$d_attribut'
14582 d_bcmp='$d_bcmp'
14583 d_bcopy='$d_bcopy'
14584 d_bincompat5005='$d_bincompat5005'
14585 d_bsd='$d_bsd'
14586 d_bsdgetpgrp='$d_bsdgetpgrp'
14587 d_bsdsetpgrp='$d_bsdsetpgrp'
14588 d_bzero='$d_bzero'
14589 d_casti32='$d_casti32'
14590 d_castneg='$d_castneg'
14591 d_charvspr='$d_charvspr'
14592 d_chown='$d_chown'
14593 d_chroot='$d_chroot'
14594 d_chsize='$d_chsize'
14595 d_closedir='$d_closedir'
14596 d_const='$d_const'
14597 d_crypt='$d_crypt'
14598 d_csh='$d_csh'
14599 d_cuserid='$d_cuserid'
14600 d_dbl_dig='$d_dbl_dig'
14601 d_difftime='$d_difftime'
14602 d_dirnamlen='$d_dirnamlen'
14603 d_dlerror='$d_dlerror'
14604 d_dlopen='$d_dlopen'
14605 d_dlsymun='$d_dlsymun'
14606 d_dosuid='$d_dosuid'
14607 d_drand48proto='$d_drand48proto'
14608 d_dup2='$d_dup2'
14609 d_eaccess='$d_eaccess'
14610 d_endgrent='$d_endgrent'
14611 d_endhent='$d_endhent'
14612 d_endnent='$d_endnent'
14613 d_endpent='$d_endpent'
14614 d_endpwent='$d_endpwent'
14615 d_endsent='$d_endsent'
14616 d_endspent='$d_endspent'
14617 d_eofnblk='$d_eofnblk'
14618 d_eunice='$d_eunice'
14619 d_fchmod='$d_fchmod'
14620 d_fchown='$d_fchown'
14621 d_fcntl='$d_fcntl'
14622 d_fd_macros='$d_fd_macros'
14623 d_fd_set='$d_fd_set'
14624 d_fds_bits='$d_fds_bits'
14625 d_fgetpos='$d_fgetpos'
14626 d_flexfnam='$d_flexfnam'
14627 d_flock='$d_flock'
14628 d_fork='$d_fork'
14629 d_fpathconf='$d_fpathconf'
14630 d_fpos64_t='$d_fpos64_t'
14631 d_fs_data_s='$d_fs_data_s'
14632 d_fseeko='$d_fseeko'
14633 d_fsetpos='$d_fsetpos'
14634 d_fstatfs='$d_fstatfs'
14635 d_fstatvfs='$d_fstatvfs'
14636 d_ftello='$d_ftello'
14637 d_ftime='$d_ftime'
14638 d_getcwd='$d_getcwd'
14639 d_getgrent='$d_getgrent'
14640 d_getgrps='$d_getgrps'
14641 d_gethbyaddr='$d_gethbyaddr'
14642 d_gethbyname='$d_gethbyname'
14643 d_gethent='$d_gethent'
14644 d_gethname='$d_gethname'
14645 d_gethostprotos='$d_gethostprotos'
14646 d_getlogin='$d_getlogin'
14647 d_getmnt='$d_getmnt'
14648 d_getmntent='$d_getmntent'
14649 d_getnbyaddr='$d_getnbyaddr'
14650 d_getnbyname='$d_getnbyname'
14651 d_getnent='$d_getnent'
14652 d_getnetprotos='$d_getnetprotos'
14653 d_getpbyname='$d_getpbyname'
14654 d_getpbynumber='$d_getpbynumber'
14655 d_getpent='$d_getpent'
14656 d_getpgid='$d_getpgid'
14657 d_getpgrp2='$d_getpgrp2'
14658 d_getpgrp='$d_getpgrp'
14659 d_getppid='$d_getppid'
14660 d_getprior='$d_getprior'
14661 d_getprotoprotos='$d_getprotoprotos'
14662 d_getpwent='$d_getpwent'
14663 d_getsbyname='$d_getsbyname'
14664 d_getsbyport='$d_getsbyport'
14665 d_getsent='$d_getsent'
14666 d_getservprotos='$d_getservprotos'
14667 d_getspent='$d_getspent'
14668 d_getspnam='$d_getspnam'
14669 d_gettimeod='$d_gettimeod'
14670 d_gnulibc='$d_gnulibc'
14671 d_grpasswd='$d_grpasswd'
14672 d_hasmntopt='$d_hasmntopt'
14673 d_htonl='$d_htonl'
14674 d_iconv='$d_iconv'
14675 d_index='$d_index'
14676 d_inetaton='$d_inetaton'
14677 d_int64t='$d_int64t'
14678 d_isascii='$d_isascii'
14679 d_killpg='$d_killpg'
14680 d_lchown='$d_lchown'
14681 d_ldbl_dig='$d_ldbl_dig'
14682 d_link='$d_link'
14683 d_locconv='$d_locconv'
14684 d_lockf='$d_lockf'
14685 d_longdbl='$d_longdbl'
14686 d_longlong='$d_longlong'
14687 d_lstat='$d_lstat'
14688 d_mblen='$d_mblen'
14689 d_mbstowcs='$d_mbstowcs'
14690 d_mbtowc='$d_mbtowc'
14691 d_memchr='$d_memchr'
14692 d_memcmp='$d_memcmp'
14693 d_memcpy='$d_memcpy'
14694 d_memmove='$d_memmove'
14695 d_memset='$d_memset'
14696 d_mkdir='$d_mkdir'
14697 d_mkdtemp='$d_mkdtemp'
14698 d_mkfifo='$d_mkfifo'
14699 d_mkstemp='$d_mkstemp'
14700 d_mkstemps='$d_mkstemps'
14701 d_mktime='$d_mktime'
14702 d_mmap='$d_mmap'
14703 d_mprotect='$d_mprotect'
14704 d_msg='$d_msg'
14705 d_msg_ctrunc='$d_msg_ctrunc'
14706 d_msg_dontroute='$d_msg_dontroute'
14707 d_msg_oob='$d_msg_oob'
14708 d_msg_peek='$d_msg_peek'
14709 d_msg_proxy='$d_msg_proxy'
14710 d_msgctl='$d_msgctl'
14711 d_msgget='$d_msgget'
14712 d_msgrcv='$d_msgrcv'
14713 d_msgsnd='$d_msgsnd'
14714 d_msync='$d_msync'
14715 d_munmap='$d_munmap'
14716 d_mymalloc='$d_mymalloc'
14717 d_nice='$d_nice'
14718 d_nv_preserves_uv='$d_nv_preserves_uv'
14719 d_off64_t='$d_off64_t'
14720 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14721 d_oldpthreads='$d_oldpthreads'
14722 d_oldsock='$d_oldsock'
14723 d_open3='$d_open3'
14724 d_pathconf='$d_pathconf'
14725 d_pause='$d_pause'
14726 d_phostname='$d_phostname'
14727 d_pipe='$d_pipe'
14728 d_poll='$d_poll'
14729 d_portable='$d_portable'
14730 d_pthread_yield='$d_pthread_yield'
14731 d_pwage='$d_pwage'
14732 d_pwchange='$d_pwchange'
14733 d_pwclass='$d_pwclass'
14734 d_pwcomment='$d_pwcomment'
14735 d_pwexpire='$d_pwexpire'
14736 d_pwgecos='$d_pwgecos'
14737 d_pwpasswd='$d_pwpasswd'
14738 d_pwquota='$d_pwquota'
14739 d_quad='$d_quad'
14740 d_readdir='$d_readdir'
14741 d_readlink='$d_readlink'
14742 d_rename='$d_rename'
14743 d_rewinddir='$d_rewinddir'
14744 d_rmdir='$d_rmdir'
14745 d_safebcpy='$d_safebcpy'
14746 d_safemcpy='$d_safemcpy'
14747 d_sanemcmp='$d_sanemcmp'
14748 d_sched_yield='$d_sched_yield'
14749 d_scm_rights='$d_scm_rights'
14750 d_seekdir='$d_seekdir'
14751 d_select='$d_select'
14752 d_sem='$d_sem'
14753 d_semctl='$d_semctl'
14754 d_semctl_semid_ds='$d_semctl_semid_ds'
14755 d_semctl_semun='$d_semctl_semun'
14756 d_semget='$d_semget'
14757 d_semop='$d_semop'
14758 d_setegid='$d_setegid'
14759 d_seteuid='$d_seteuid'
14760 d_setgrent='$d_setgrent'
14761 d_setgrps='$d_setgrps'
14762 d_sethent='$d_sethent'
14763 d_setlinebuf='$d_setlinebuf'
14764 d_setlocale='$d_setlocale'
14765 d_setnent='$d_setnent'
14766 d_setpent='$d_setpent'
14767 d_setpgid='$d_setpgid'
14768 d_setpgrp2='$d_setpgrp2'
14769 d_setpgrp='$d_setpgrp'
14770 d_setprior='$d_setprior'
14771 d_setpwent='$d_setpwent'
14772 d_setregid='$d_setregid'
14773 d_setresgid='$d_setresgid'
14774 d_setresuid='$d_setresuid'
14775 d_setreuid='$d_setreuid'
14776 d_setrgid='$d_setrgid'
14777 d_setruid='$d_setruid'
14778 d_setsent='$d_setsent'
14779 d_setsid='$d_setsid'
14780 d_setspent='$d_setspent'
14781 d_setvbuf='$d_setvbuf'
14782 d_sfio='$d_sfio'
14783 d_shm='$d_shm'
14784 d_shmat='$d_shmat'
14785 d_shmatprototype='$d_shmatprototype'
14786 d_shmctl='$d_shmctl'
14787 d_shmdt='$d_shmdt'
14788 d_shmget='$d_shmget'
14789 d_sigaction='$d_sigaction'
14790 d_sigsetjmp='$d_sigsetjmp'
14791 d_socket='$d_socket'
14792 d_sockpair='$d_sockpair'
14793 d_sqrtl='$d_sqrtl'
14794 d_statblks='$d_statblks'
14795 d_statfs_f_flags='$d_statfs_f_flags'
14796 d_statfs_s='$d_statfs_s'
14797 d_statvfs='$d_statvfs'
14798 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14799 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14800 d_stdio_stream_array='$d_stdio_stream_array'
14801 d_stdiobase='$d_stdiobase'
14802 d_stdstdio='$d_stdstdio'
14803 d_strchr='$d_strchr'
14804 d_strcoll='$d_strcoll'
14805 d_strctcpy='$d_strctcpy'
14806 d_strerrm='$d_strerrm'
14807 d_strerror='$d_strerror'
14808 d_strtod='$d_strtod'
14809 d_strtol='$d_strtol'
14810 d_strtold='$d_strtold'
14811 d_strtoll='$d_strtoll'
14812 d_strtoul='$d_strtoul'
14813 d_strtoull='$d_strtoull'
14814 d_strtouq='$d_strtouq'
14815 d_strxfrm='$d_strxfrm'
14816 d_suidsafe='$d_suidsafe'
14817 d_symlink='$d_symlink'
14818 d_syscall='$d_syscall'
14819 d_sysconf='$d_sysconf'
14820 d_sysernlst='$d_sysernlst'
14821 d_syserrlst='$d_syserrlst'
14822 d_system='$d_system'
14823 d_tcgetpgrp='$d_tcgetpgrp'
14824 d_tcsetpgrp='$d_tcsetpgrp'
14825 d_telldir='$d_telldir'
14826 d_telldirproto='$d_telldirproto'
14827 d_time='$d_time'
14828 d_times='$d_times'
14829 d_truncate='$d_truncate'
14830 d_tzname='$d_tzname'
14831 d_umask='$d_umask'
14832 d_uname='$d_uname'
14833 d_union_semun='$d_union_semun'
14834 d_ustat='$d_ustat'
14835 d_vendorbin='$d_vendorbin'
14836 d_vendorlib='$d_vendorlib'
14837 d_vfork='$d_vfork'
14838 d_void_closedir='$d_void_closedir'
14839 d_voidsig='$d_voidsig'
14840 d_voidtty='$d_voidtty'
14841 d_volatile='$d_volatile'
14842 d_vprintf='$d_vprintf'
14843 d_wait4='$d_wait4'
14844 d_waitpid='$d_waitpid'
14845 d_wcstombs='$d_wcstombs'
14846 d_wctomb='$d_wctomb'
14847 d_xenix='$d_xenix'
14848 date='$date'
14849 db_hashtype='$db_hashtype'
14850 db_prefixtype='$db_prefixtype'
14851 defvoidused='$defvoidused'
14852 direntrytype='$direntrytype'
14853 dlext='$dlext'
14854 dlsrc='$dlsrc'
14855 doublesize='$doublesize'
14856 drand01='$drand01'
14857 dynamic_ext='$dynamic_ext'
14858 eagain='$eagain'
14859 ebcdic='$ebcdic'
14860 echo='$echo'
14861 egrep='$egrep'
14862 emacs='$emacs'
14863 eunicefix='$eunicefix'
14864 exe_ext='$exe_ext'
14865 expr='$expr'
14866 extensions='$extensions'
14867 fflushNULL='$fflushNULL'
14868 fflushall='$fflushall'
14869 find='$find'
14870 firstmakefile='$firstmakefile'
14871 flex='$flex'
14872 fpossize='$fpossize'
14873 fpostype='$fpostype'
14874 freetype='$freetype'
14875 full_ar='$full_ar'
14876 full_csh='$full_csh'
14877 full_sed='$full_sed'
14878 gccversion='$gccversion'
14879 gidformat='$gidformat'
14880 gidsign='$gidsign'
14881 gidsize='$gidsize'
14882 gidtype='$gidtype'
14883 glibpth='$glibpth'
14884 grep='$grep'
14885 groupcat='$groupcat'
14886 groupstype='$groupstype'
14887 gzip='$gzip'
14888 h_fcntl='$h_fcntl'
14889 h_sysfile='$h_sysfile'
14890 hint='$hint'
14891 hostcat='$hostcat'
14892 huge='$huge'
14893 i16size='$i16size'
14894 i16type='$i16type'
14895 i32size='$i32size'
14896 i32type='$i32type'
14897 i64size='$i64size'
14898 i64type='$i64type'
14899 i8size='$i8size'
14900 i8type='$i8type'
14901 i_arpainet='$i_arpainet'
14902 i_bsdioctl='$i_bsdioctl'
14903 i_db='$i_db'
14904 i_dbm='$i_dbm'
14905 i_dirent='$i_dirent'
14906 i_dld='$i_dld'
14907 i_dlfcn='$i_dlfcn'
14908 i_fcntl='$i_fcntl'
14909 i_float='$i_float'
14910 i_gdbm='$i_gdbm'
14911 i_grp='$i_grp'
14912 i_iconv='$i_iconv'
14913 i_inttypes='$i_inttypes'
14914 i_limits='$i_limits'
14915 i_locale='$i_locale'
14916 i_machcthr='$i_machcthr'
14917 i_malloc='$i_malloc'
14918 i_math='$i_math'
14919 i_memory='$i_memory'
14920 i_mntent='$i_mntent'
14921 i_ndbm='$i_ndbm'
14922 i_netdb='$i_netdb'
14923 i_neterrno='$i_neterrno'
14924 i_netinettcp='$i_netinettcp'
14925 i_niin='$i_niin'
14926 i_poll='$i_poll'
14927 i_pthread='$i_pthread'
14928 i_pwd='$i_pwd'
14929 i_rpcsvcdbm='$i_rpcsvcdbm'
14930 i_sfio='$i_sfio'
14931 i_sgtty='$i_sgtty'
14932 i_shadow='$i_shadow'
14933 i_socks='$i_socks'
14934 i_stdarg='$i_stdarg'
14935 i_stddef='$i_stddef'
14936 i_stdlib='$i_stdlib'
14937 i_string='$i_string'
14938 i_sysaccess='$i_sysaccess'
14939 i_sysdir='$i_sysdir'
14940 i_sysfile='$i_sysfile'
14941 i_sysfilio='$i_sysfilio'
14942 i_sysin='$i_sysin'
14943 i_sysioctl='$i_sysioctl'
14944 i_sysmman='$i_sysmman'
14945 i_sysmount='$i_sysmount'
14946 i_sysndir='$i_sysndir'
14947 i_sysparam='$i_sysparam'
14948 i_sysresrc='$i_sysresrc'
14949 i_syssecrt='$i_syssecrt'
14950 i_sysselct='$i_sysselct'
14951 i_syssockio='$i_syssockio'
14952 i_sysstat='$i_sysstat'
14953 i_sysstatfs='$i_sysstatfs'
14954 i_sysstatvfs='$i_sysstatvfs'
14955 i_systime='$i_systime'
14956 i_systimek='$i_systimek'
14957 i_systimes='$i_systimes'
14958 i_systypes='$i_systypes'
14959 i_sysuio='$i_sysuio'
14960 i_sysun='$i_sysun'
14961 i_sysvfs='$i_sysvfs'
14962 i_syswait='$i_syswait'
14963 i_termio='$i_termio'
14964 i_termios='$i_termios'
14965 i_time='$i_time'
14966 i_unistd='$i_unistd'
14967 i_ustat='$i_ustat'
14968 i_utime='$i_utime'
14969 i_values='$i_values'
14970 i_varargs='$i_varargs'
14971 i_varhdr='$i_varhdr'
14972 i_vfork='$i_vfork'
14973 ignore_versioned_solibs='$ignore_versioned_solibs'
14974 inc_version_list='$inc_version_list'
14975 inc_version_list_init='$inc_version_list_init'
14976 incpath='$incpath'
14977 inews='$inews'
14978 installarchlib='$installarchlib'
14979 installbin='$installbin'
14980 installman1dir='$installman1dir'
14981 installman3dir='$installman3dir'
14982 installprefix='$installprefix'
14983 installprefixexp='$installprefixexp'
14984 installprivlib='$installprivlib'
14985 installscript='$installscript'
14986 installsitearch='$installsitearch'
14987 installsitebin='$installsitebin'
14988 installsitelib='$installsitelib'
14989 installstyle='$installstyle'
14990 installusrbinperl='$installusrbinperl'
14991 installvendorbin='$installvendorbin'
14992 installvendorlib='$installvendorlib'
14993 intsize='$intsize'
14994 ivdformat='$ivdformat'
14995 ivsize='$ivsize'
14996 ivtype='$ivtype'
14997 known_extensions='$known_extensions'
14998 ksh='$ksh'
14999 large='$large'
15000 ld='$ld'
15001 lddlflags='$lddlflags'
15002 ldflags='$ldflags'
15003 ldlibpthname='$ldlibpthname'
15004 less='$less'
15005 lib_ext='$lib_ext'
15006 libc='$libc'
15007 libperl='$libperl'
15008 libpth='$libpth'
15009 libs='$libs'
15010 libsdirs='$libsdirs'
15011 libsfiles='$libsfiles'
15012 libsfound='$libsfound'
15013 libswanted='$libswanted'
15014 line='$line'
15015 lint='$lint'
15016 lkflags='$lkflags'
15017 ln='$ln'
15018 lns='$lns'
15019 locincpth='$locincpth'
15020 loclibpth='$loclibpth'
15021 longdblsize='$longdblsize'
15022 longlongsize='$longlongsize'
15023 longsize='$longsize'
15024 lp='$lp'
15025 lpr='$lpr'
15026 ls='$ls'
15027 lseeksize='$lseeksize'
15028 lseektype='$lseektype'
15029 mail='$mail'
15030 mailx='$mailx'
15031 make='$make'
15032 make_set_make='$make_set_make'
15033 mallocobj='$mallocobj'
15034 mallocsrc='$mallocsrc'
15035 malloctype='$malloctype'
15036 man1dir='$man1dir'
15037 man1direxp='$man1direxp'
15038 man1ext='$man1ext'
15039 man3dir='$man3dir'
15040 man3direxp='$man3direxp'
15041 man3ext='$man3ext'
15042 medium='$medium'
15043 mips_type='$mips_type'
15044 mkdir='$mkdir'
15045 mmaptype='$mmaptype'
15046 models='$models'
15047 modetype='$modetype'
15048 more='$more'
15049 multiarch='$multiarch'
15050 mv='$mv'
15051 myarchname='$myarchname'
15052 mydomain='$mydomain'
15053 myhostname='$myhostname'
15054 myuname='$myuname'
15055 n='$n'
15056 netdb_hlen_type='$netdb_hlen_type'
15057 netdb_host_type='$netdb_host_type'
15058 netdb_name_type='$netdb_name_type'
15059 netdb_net_type='$netdb_net_type'
15060 nm='$nm'
15061 nm_opt='$nm_opt'
15062 nm_so_opt='$nm_so_opt'
15063 nonxs_ext='$nonxs_ext'
15064 nroff='$nroff'
15065 nvsize='$nvsize'
15066 nvtype='$nvtype'
15067 o_nonblock='$o_nonblock'
15068 obj_ext='$obj_ext'
15069 old_pthread_create_joinable='$old_pthread_create_joinable'
15070 optimize='$optimize'
15071 orderlib='$orderlib'
15072 osname='$osname'
15073 osvers='$osvers'
15074 package='$package'
15075 pager='$pager'
15076 passcat='$passcat'
15077 patchlevel='$patchlevel'
15078 path_sep='$path_sep'
15079 perl='$perl'
15080 perladmin='$perladmin'
15081 perlpath='$perlpath'
15082 pg='$pg'
15083 phostname='$phostname'
15084 pidtype='$pidtype'
15085 plibpth='$plibpth'
15086 pm_apiversion='$pm_apiversion'
15087 pmake='$pmake'
15088 pr='$pr'
15089 prefix='$prefix'
15090 prefixexp='$prefixexp'
15091 privlib='$privlib'
15092 privlibexp='$privlibexp'
15093 prototype='$prototype'
15094 ptrsize='$ptrsize'
15095 quadkind='$quadkind'
15096 quadtype='$quadtype'
15097 randbits='$randbits'
15098 randfunc='$randfunc'
15099 randseedtype='$randseedtype'
15100 ranlib='$ranlib'
15101 rd_nodata='$rd_nodata'
15102 rm='$rm'
15103 rmail='$rmail'
15104 runnm='$runnm'
15105 sPRIEldbl='$sPRIEldbl'
15106 sPRIFldbl='$sPRIFldbl'
15107 sPRIGldbl='$sPRIGldbl'
15108 sPRIX64='$sPRIX64'
15109 sPRId64='$sPRId64'
15110 sPRIeldbl='$sPRIeldbl'
15111 sPRIfldbl='$sPRIfldbl'
15112 sPRIgldbl='$sPRIgldbl'
15113 sPRIi64='$sPRIi64'
15114 sPRIo64='$sPRIo64'
15115 sPRIu64='$sPRIu64'
15116 sPRIx64='$sPRIx64'
15117 sched_yield='$sched_yield'
15118 scriptdir='$scriptdir'
15119 scriptdirexp='$scriptdirexp'
15120 sed='$sed'
15121 seedfunc='$seedfunc'
15122 selectminbits='$selectminbits'
15123 selecttype='$selecttype'
15124 sendmail='$sendmail'
15125 sh='$sh'
15126 shar='$shar'
15127 sharpbang='$sharpbang'
15128 shmattype='$shmattype'
15129 shortsize='$shortsize'
15130 shrpenv='$shrpenv'
15131 shsharp='$shsharp'
15132 sig_count='$sig_count'
15133 sig_name='$sig_name'
15134 sig_name_init='$sig_name_init'
15135 sig_num='$sig_num'
15136 sig_num_init='$sig_num_init'
15137 signal_t='$signal_t'
15138 sitearch='$sitearch'
15139 sitearchexp='$sitearchexp'
15140 sitebin='$sitebin'
15141 sitebinexp='$sitebinexp'
15142 sitelib='$sitelib'
15143 sitelibexp='$sitelibexp'
15144 siteprefix='$siteprefix'
15145 siteprefixexp='$siteprefixexp'
15146 sizetype='$sizetype'
15147 sleep='$sleep'
15148 smail='$smail'
15149 small='$small'
15150 so='$so'
15151 sockethdr='$sockethdr'
15152 socketlib='$socketlib'
15153 sort='$sort'
15154 spackage='$spackage'
15155 spitshell='$spitshell'
15156 split='$split'
15157 src='$src'
15158 ssizetype='$ssizetype'
15159 startperl='$startperl'
15160 startsh='$startsh'
15161 static_ext='$static_ext'
15162 stdchar='$stdchar'
15163 stdio_base='$stdio_base'
15164 stdio_bufsiz='$stdio_bufsiz'
15165 stdio_cnt='$stdio_cnt'
15166 stdio_filbuf='$stdio_filbuf'
15167 stdio_ptr='$stdio_ptr'
15168 stdio_stream_array='$stdio_stream_array'
15169 strings='$strings'
15170 submit='$submit'
15171 subversion='$subversion'
15172 sysman='$sysman'
15173 tail='$tail'
15174 tar='$tar'
15175 tbl='$tbl'
15176 tee='$tee'
15177 test='$test'
15178 timeincl='$timeincl'
15179 timetype='$timetype'
15180 touch='$touch'
15181 tr='$tr'
15182 trnl='$trnl'
15183 troff='$troff'
15184 u16size='$u16size'
15185 u16type='$u16type'
15186 u32size='$u32size'
15187 u32type='$u32type'
15188 u64size='$u64size'
15189 u64type='$u64type'
15190 u8size='$u8size'
15191 u8type='$u8type'
15192 uidformat='$uidformat'
15193 uidsign='$uidsign'
15194 uidsize='$uidsize'
15195 uidtype='$uidtype'
15196 uname='$uname'
15197 uniq='$uniq'
15198 uquadtype='$uquadtype'
15199 use5005threads='$use5005threads'
15200 use64bits='$use64bits'
15201 usedl='$usedl'
15202 useithreads='$useithreads'
15203 uselargefiles='$uselargefiles'
15204 uselongdouble='$uselongdouble'
15205 uselonglong='$uselonglong'
15206 usemorebits='$usemorebits'
15207 usemultiplicity='$usemultiplicity'
15208 usemymalloc='$usemymalloc'
15209 usenm='$usenm'
15210 useopcode='$useopcode'
15211 useperlio='$useperlio'
15212 useposix='$useposix'
15213 usesfio='$usesfio'
15214 useshrplib='$useshrplib'
15215 usesocks='$usesocks'
15216 usethreads='$usethreads'
15217 usevendorprefix='$usevendorprefix'
15218 usevfork='$usevfork'
15219 usrinc='$usrinc'
15220 uuname='$uuname'
15221 uvoformat='$uvoformat'
15222 uvsize='$uvsize'
15223 uvtype='$uvtype'
15224 uvuformat='$uvuformat'
15225 uvxformat='$uvxformat'
15226 vendorbin='$vendorbin'
15227 vendorbinexp='$vendorbinexp'
15228 vendorlib='$vendorlib'
15229 vendorlibexp='$vendorlibexp'
15230 vendorprefix='$vendorprefix'
15231 vendorprefixexp='$vendorprefixexp'
15232 version='$version'
15233 vi='$vi'
15234 voidflags='$voidflags'
15235 xlibpth='$xlibpth'
15236 xs_apiversion='$xs_apiversion'
15237 zcat='$zcat'
15238 zip='$zip'
15239 EOT
15240
15241 : Add in command line options if available
15242 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15243
15244 : add special variables
15245 $test -f $src/patchlevel.h && \
15246 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15247 echo "CONFIGDOTSH=true" >>config.sh
15248
15249 : propagate old symbols
15250 if $test -f UU/config.sh; then
15251         <UU/config.sh sort | uniq >UU/oldconfig.sh
15252         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15253         sort | uniq -u >UU/oldsyms
15254         set X `cat UU/oldsyms`
15255         shift
15256         case $# in
15257         0) ;;
15258         *)
15259                 cat <<EOM
15260 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15261 EOM
15262                 echo "# Variables propagated from previous config.sh file." >>config.sh
15263                 for sym in `cat UU/oldsyms`; do
15264                         echo "    Propagating $hint variable "'$'"$sym..."
15265                         eval 'tmp="$'"${sym}"'"'
15266                         echo "$tmp" | \
15267                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15268                 done
15269                 ;;
15270         esac
15271 fi
15272
15273 : Finish up by extracting the .SH files
15274 case "$alldone" in
15275 exit)
15276         $rm -rf UU
15277         echo "Done."
15278         exit 0
15279         ;;
15280 cont)
15281         ;;
15282 '')
15283         dflt=''
15284         nostick=true
15285         $cat <<EOM
15286
15287 If you'd like to make any changes to the config.sh file before I begin
15288 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15289
15290 EOM
15291         rp="Press return or use a shell escape to edit config.sh:"
15292         . UU/myread
15293         nostick=''
15294         case "$ans" in
15295         '') ;;
15296         *) : in case they cannot read
15297                 sh 1>&4 -c "$ans";;
15298         esac
15299         ;;
15300 esac
15301
15302 : if this fails, just run all the .SH files by hand
15303 . ./config.sh
15304
15305 echo " "
15306 exec 1>&4
15307 . ./UU/extract
15308
15309 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15310         dflt=y
15311         case "$silent" in
15312         true) ;;
15313         *)
15314                 $cat <<EOM
15315
15316 Now you need to generate make dependencies by running "$make depend".
15317 You might prefer to run it in background: "$make depend > makedepend.out &"
15318 It can take a while, so you might not want to run it right now.
15319
15320 EOM
15321                 ;;
15322         esac
15323         rp="Run $make depend now?"
15324         . UU/myread
15325         case "$ans" in
15326         y*)
15327                 $make depend && echo "Now you must run a $make."
15328                 ;;
15329         *)
15330                 echo "You must run '$make depend' then '$make'."
15331                 ;;
15332         esac
15333 elif test -f [Mm]akefile; then
15334         echo " "
15335         echo "Now you must run a $make."
15336 else
15337         echo "Done."
15338 fi
15339
15340 if $test -f Policy.sh; then
15341     $cat <<EOM
15342
15343 If you compile $package on a different machine or from a different object
15344 directory, copy the Policy.sh file from this object directory to the
15345 new one before you run Configure -- this will help you with most of
15346 the policy defaults.
15347
15348 EOM
15349 fi
15350 if $test -f config.msg; then
15351     echo "Hmm.  I also noted the following information while running:"
15352     echo " "
15353     $cat config.msg >&4
15354     $rm -f config.msg
15355 fi
15356 $rm -f kit*isdone ark*isdone
15357 $rm -rf UU
15358
15359 : End of Configure
15360