avoid exiting just because we didn't scan for libm ('libs' may still
[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 Fri Feb  4 21:57:24 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_iconv=''
403 d_inetaton=''
404 d_int64t=''
405 d_isascii=''
406 d_killpg=''
407 d_lchown=''
408 d_ldbl_dig=''
409 d_link=''
410 d_locconv=''
411 d_lockf=''
412 d_longdbl=''
413 longdblsize=''
414 d_longlong=''
415 longlongsize=''
416 d_lstat=''
417 d_mblen=''
418 d_mbstowcs=''
419 d_mbtowc=''
420 d_memchr=''
421 d_memcmp=''
422 d_memcpy=''
423 d_memmove=''
424 d_memset=''
425 d_mkdir=''
426 d_mkfifo=''
427 d_mktime=''
428 d_msg=''
429 d_msgctl=''
430 d_msgget=''
431 d_msgrcv=''
432 d_msgsnd=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_rename=''
452 d_rmdir=''
453 d_safebcpy=''
454 d_safemcpy=''
455 d_sanemcmp=''
456 d_select=''
457 d_sem=''
458 d_semctl=''
459 d_semget=''
460 d_semop=''
461 d_setegid=''
462 d_seteuid=''
463 d_setgrent=''
464 d_setgrps=''
465 d_sethent=''
466 d_setlinebuf=''
467 d_setlocale=''
468 d_setnent=''
469 d_setpent=''
470 d_setpgid=''
471 d_setpgrp2=''
472 d_bsdsetpgrp=''
473 d_setpgrp=''
474 d_setprior=''
475 d_setpwent=''
476 d_setregid=''
477 d_setresgid=''
478 d_setresuid=''
479 d_setreuid=''
480 d_setrgid=''
481 d_setruid=''
482 d_setsent=''
483 d_setsid=''
484 d_setspent=''
485 d_setvbuf=''
486 d_sfio=''
487 usesfio=''
488 d_shm=''
489 d_shmat=''
490 d_shmatprototype=''
491 shmattype=''
492 d_shmctl=''
493 d_shmdt=''
494 d_shmget=''
495 d_sigaction=''
496 d_sigsetjmp=''
497 d_msg_ctrunc=''
498 d_msg_dontroute=''
499 d_msg_oob=''
500 d_msg_peek=''
501 d_msg_proxy=''
502 d_oldsock=''
503 d_scm_rights=''
504 d_socket=''
505 d_sockpair=''
506 sockethdr=''
507 socketlib=''
508 d_sqrtl=''
509 d_statblks=''
510 d_statfs_f_flags=''
511 d_statfs_s=''
512 d_fstatvfs=''
513 d_statvfs=''
514 d_stdio_cnt_lval=''
515 d_stdio_ptr_lval=''
516 d_stdiobase=''
517 d_stdstdio=''
518 stdio_base=''
519 stdio_bufsiz=''
520 stdio_cnt=''
521 stdio_filbuf=''
522 stdio_ptr=''
523 d_index=''
524 d_strchr=''
525 d_strcoll=''
526 d_strctcpy=''
527 d_strerrm=''
528 d_strerror=''
529 d_sysernlst=''
530 d_syserrlst=''
531 d_strtod=''
532 d_strtol=''
533 d_strtold=''
534 d_strtoll=''
535 d_strtoul=''
536 d_strtoull=''
537 d_strtouq=''
538 d_strxfrm=''
539 d_symlink=''
540 d_syscall=''
541 d_sysconf=''
542 d_system=''
543 d_tcgetpgrp=''
544 d_tcsetpgrp=''
545 d_telldirproto=''
546 d_time=''
547 timetype=''
548 clocktype=''
549 d_times=''
550 d_truncate=''
551 d_tzname=''
552 d_umask=''
553 d_semctl_semid_ds=''
554 d_semctl_semun=''
555 d_union_semun=''
556 d_ustat=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 dlext=''
569 cccdlflags=''
570 ccdlflags=''
571 dlsrc=''
572 ld=''
573 lddlflags=''
574 usedl=''
575 doublesize=''
576 ebcdic=''
577 fflushNULL=''
578 fflushall=''
579 fpossize=''
580 fpostype=''
581 gidformat=''
582 gidsign=''
583 gidsize=''
584 gidtype=''
585 groupstype=''
586 h_fcntl=''
587 h_sysfile=''
588 i_arpainet=''
589 db_hashtype=''
590 db_prefixtype=''
591 i_db=''
592 i_dbm=''
593 i_rpcsvcdbm=''
594 d_dirnamlen=''
595 direntrytype=''
596 i_dirent=''
597 i_dld=''
598 i_dlfcn=''
599 i_fcntl=''
600 i_float=''
601 i_gdbm=''
602 d_grpasswd=''
603 i_grp=''
604 i_iconv=''
605 i_inttypes=''
606 i_limits=''
607 i_locale=''
608 i_machcthr=''
609 i_malloc=''
610 i_math=''
611 i_memory=''
612 i_mntent=''
613 i_ndbm=''
614 i_netdb=''
615 i_neterrno=''
616 i_netinettcp=''
617 i_niin=''
618 i_sysin=''
619 i_poll=''
620 i_pthread=''
621 d_pwage=''
622 d_pwchange=''
623 d_pwclass=''
624 d_pwcomment=''
625 d_pwexpire=''
626 d_pwgecos=''
627 d_pwpasswd=''
628 d_pwquota=''
629 i_pwd=''
630 i_sfio=''
631 i_shadow=''
632 i_socks=''
633 i_stddef=''
634 i_stdlib=''
635 i_string=''
636 strings=''
637 i_sysaccess=''
638 i_sysdir=''
639 i_sysfile=''
640 d_voidtty=''
641 i_bsdioctl=''
642 i_sysfilio=''
643 i_sysioctl=''
644 i_syssockio=''
645 i_sysmount=''
646 i_sysndir=''
647 i_sysparam=''
648 i_sysresrc=''
649 i_syssecrt=''
650 i_sysselct=''
651 i_sysstat=''
652 i_sysstatfs=''
653 i_sysstatvfs=''
654 i_systimes=''
655 i_systypes=''
656 i_sysuio=''
657 i_sysun=''
658 i_sysvfs=''
659 i_syswait=''
660 i_sgtty=''
661 i_termio=''
662 i_termios=''
663 i_systime=''
664 i_systimek=''
665 i_time=''
666 timeincl=''
667 i_unistd=''
668 i_ustat=''
669 i_utime=''
670 i_values=''
671 i_stdarg=''
672 i_varargs=''
673 i_varhdr=''
674 i_vfork=''
675 inc_version_list=''
676 inc_version_list_init=''
677 installprefix=''
678 installprefixexp=''
679 installstyle=''
680 installusrbinperl=''
681 intsize=''
682 longsize=''
683 shortsize=''
684 d_fpos64_t=''
685 d_off64_t=''
686 libc=''
687 ldlibpthname=''
688 libperl=''
689 shrpenv=''
690 useshrplib=''
691 glibpth=''
692 libpth=''
693 loclibpth=''
694 plibpth=''
695 xlibpth=''
696 ignore_versioned_solibs=''
697 libs=''
698 libsdirs=''
699 libsfiles=''
700 libsfound=''
701 lns=''
702 d_PRIEldbl=''
703 d_PRIFldbl=''
704 d_PRIGldbl=''
705 d_PRIeldbl=''
706 d_PRIfldbl=''
707 d_PRIgldbl=''
708 sPRIEldbl=''
709 sPRIFldbl=''
710 sPRIGldbl=''
711 sPRIeldbl=''
712 sPRIfldbl=''
713 sPRIgldbl=''
714 lseeksize=''
715 lseektype=''
716 make_set_make=''
717 d_mymalloc=''
718 freetype=''
719 mallocobj=''
720 mallocsrc=''
721 malloctype=''
722 usemymalloc=''
723 installman1dir=''
724 man1dir=''
725 man1direxp=''
726 man1ext=''
727 installman3dir=''
728 man3dir=''
729 man3direxp=''
730 man3ext=''
731 huge=''
732 large=''
733 medium=''
734 models=''
735 small=''
736 split=''
737 modetype=''
738 multiarch=''
739 mydomain=''
740 myhostname=''
741 phostname=''
742 c=''
743 n=''
744 d_eofnblk=''
745 eagain=''
746 o_nonblock=''
747 rd_nodata=''
748 netdb_hlen_type=''
749 netdb_host_type=''
750 netdb_name_type=''
751 netdb_net_type=''
752 groupcat=''
753 hostcat=''
754 passcat=''
755 orderlib=''
756 ranlib=''
757 package=''
758 spackage=''
759 pager=''
760 api_revision=''
761 api_subversion=''
762 api_version=''
763 api_versionstring=''
764 patchlevel=''
765 subversion=''
766 version=''
767 perladmin=''
768 perlpath=''
769 d_nv_preserves_uv=''
770 i16size=''
771 i16type=''
772 i32size=''
773 i32type=''
774 i64size=''
775 i64type=''
776 i8size=''
777 i8type=''
778 ivsize=''
779 ivtype=''
780 nvsize=''
781 nvtype=''
782 u16size=''
783 u16type=''
784 u32size=''
785 u32type=''
786 u64size=''
787 u64type=''
788 u8size=''
789 u8type=''
790 uvsize=''
791 uvtype=''
792 ivdformat=''
793 uvoformat=''
794 uvuformat=''
795 uvxformat=''
796 pidtype=''
797 prefix=''
798 prefixexp=''
799 installprivlib=''
800 privlib=''
801 privlibexp=''
802 prototype=''
803 ptrsize=''
804 d_PRIX64=''
805 d_PRId64=''
806 d_PRIi64=''
807 d_PRIo64=''
808 d_PRIu64=''
809 d_PRIx64=''
810 sPRIX64=''
811 sPRId64=''
812 sPRIi64=''
813 sPRIo64=''
814 sPRIu64=''
815 sPRIx64=''
816 d_quad=''
817 quadkind=''
818 quadtype=''
819 uquadtype=''
820 drand01=''
821 randbits=''
822 randfunc=''
823 randseedtype=''
824 seedfunc=''
825 installscript=''
826 scriptdir=''
827 scriptdirexp=''
828 selectminbits=''
829 selecttype=''
830 sh=''
831 sig_count=''
832 sig_name=''
833 sig_name_init=''
834 sig_num=''
835 sig_num_init=''
836 installsitearch=''
837 sitearch=''
838 sitearchexp=''
839 installsitebin=''
840 sitebin=''
841 sitebinexp=''
842 installsitelib=''
843 sitelib=''
844 sitelibexp=''
845 siteprefix=''
846 siteprefixexp=''
847 sizetype=''
848 so=''
849 sharpbang=''
850 shsharp=''
851 spitshell=''
852 src=''
853 ssizetype=''
854 startperl=''
855 startsh=''
856 stdchar=''
857 d_stdio_stream_array=''
858 stdio_stream_array=''
859 sysman=''
860 trnl=''
861 uidformat=''
862 uidsign=''
863 uidsize=''
864 uidtype=''
865 archname64=''
866 use64bits=''
867 uselargefiles=''
868 uselongdouble=''
869 uselonglong=''
870 usemorebits=''
871 usemultiplicity=''
872 nm_opt=''
873 nm_so_opt=''
874 runnm=''
875 usenm=''
876 useperlio=''
877 usesocks=''
878 d_oldpthreads=''
879 use5005threads=''
880 useithreads=''
881 usethreads=''
882 incpath=''
883 mips_type=''
884 usrinc=''
885 d_vendorbin=''
886 installvendorbin=''
887 vendorbin=''
888 vendorbinexp=''
889 d_vendorlib=''
890 installvendorlib=''
891 vendorlib=''
892 vendorlibexp=''
893 usevendorprefix=''
894 vendorprefix=''
895 vendorprefixexp=''
896 defvoidused=''
897 voidflags=''
898 CONFIG=''
899
900 define='define'
901 undef='undef'
902 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
903 rmlist=''
904
905 : We must find out about Eunice early
906 eunicefix=':'
907 if test -f /etc/unixtovms; then
908         eunicefix=/etc/unixtovms
909 fi
910 if test -f /etc/unixtovms.exe; then
911         eunicefix=/etc/unixtovms.exe
912 fi
913
914 i_whoami=''
915 : set useposix=false in your hint file to disable the POSIX extension.
916 useposix=true
917 : set useopcode=false in your hint file to disable the Opcode extension.
918 useopcode=true
919 : Trailing extension.  Override this in a hint file, if needed.
920 _exe=''
921 : Extra object files, if any, needed on this platform.
922 archobjs=''
923 : Possible local include directories to search.
924 : Set locincpth to "" in a hint file to defeat local include searches.
925 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
926 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
927 :
928 : no include file wanted by default
929 inclwanted=''
930
931 groupstype=''
932 : change the next line if compiling for Xenix/286 on Xenix/386
933 xlibpth='/usr/lib/386 /lib/386'
934
935 : Possible local library directories to search.
936 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
937 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
938
939 : general looking path for locating libraries
940 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
941 glibpth="$glibpth /lib /usr/lib $xlibpth"
942 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
943 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
944
945 : Private path used by Configure to find libraries.  Its value
946 : is prepended to libpth. This variable takes care of special
947 : machines, like the mips.  Usually, it should be empty.
948 plibpth=''
949
950 : default library list
951 libswanted=''
952 : some systems want to use only the non-versioned libso:s
953 ignore_versioned_solibs=''
954 : set usemultiplicity on the Configure command line to enable multiplicity.
955 : set usesocks on the Configure command line to enable socks.
956 : set usethreads on the Configure command line to enable threads.
957 : full support for void wanted by default
958 defvoidused=15
959
960 : List of libraries we want.
961 : If anyone needs -lnet, put it in a hint file.
962 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
963 libswanted="$libswanted dld ld sun m c cposix posix"
964 libswanted="$libswanted ndir dir crypt sec"
965 libswanted="$libswanted ucb bsd BSD PW x"
966 : We probably want to search /usr/shlib before most other libraries.
967 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
968 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
969 glibpth="/usr/shlib $glibpth"
970 : Do not use vfork unless overridden by a hint file.
971 usevfork=false
972
973 : Find the basic shell for Bourne shell scripts
974 case "$sh" in
975 '')
976         case "$SYSTYPE" in
977         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
978         *) xxx='/bin/sh';;
979         esac
980         if test -f "$xxx"; then
981                 sh="$xxx"
982         else
983                 : Build up a list and do a single loop so we can 'break' out.
984                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
985                 for xxx in sh bash ksh pdksh ash; do
986                         for p in $pth; do
987                                 try="$try ${p}/${xxx}"
988                         done
989                 done
990                 for xxx in $try; do
991                         if test -f "$xxx"; then
992                                 sh="$xxx";
993                                 break
994                         elif test -f "$xxx.exe"; then
995                                 sh="$xxx";
996                                 break
997                         fi
998                 done
999         fi
1000         ;;
1001 esac
1002
1003 case "$sh" in
1004 '')     cat <<EOM >&2
1005 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1006
1007 Usually it's in /bin/sh.  How did you even get this far?
1008 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1009 we'll try to straighten this all out.
1010 EOM
1011         exit 1
1012         ;;
1013 esac
1014
1015 : see if sh knows # comments
1016 if `$sh -c '#' >/dev/null 2>&1`; then
1017         shsharp=true
1018         spitshell=cat
1019         xcat=/bin/cat
1020         test -f $xcat || xcat=/usr/bin/cat
1021         echo "#!$xcat" >try
1022         $eunicefix try
1023         chmod +x try
1024         ./try > today
1025         if test -s today; then
1026                 sharpbang='#!'
1027         else
1028                 echo "#! $xcat" > try
1029                 $eunicefix try
1030                 chmod +x try
1031                 ./try > today
1032                 if test -s today; then
1033                         sharpbang='#! '
1034                 else
1035                         sharpbang=': use '
1036                 fi
1037         fi
1038 else
1039         echo " "
1040         echo "Your $sh doesn't grok # comments--I will strip them later on."
1041         shsharp=false
1042         cd ..
1043         echo "exec grep -v '^[  ]*#'" >spitshell
1044         chmod +x spitshell
1045         $eunicefix spitshell
1046         spitshell=`pwd`/spitshell
1047         cd UU
1048         echo "I presume that if # doesn't work, #! won't work either!"
1049         sharpbang=': use '
1050 fi
1051 rm -f try today
1052
1053 : figure out how to guarantee sh startup
1054 case "$startsh" in
1055 '') startsh=${sharpbang}${sh} ;;
1056 *)
1057 esac
1058 cat >try <<EOSS
1059 $startsh
1060 set abc
1061 test "$?abc" != 1
1062 EOSS
1063
1064 chmod +x try
1065 $eunicefix try
1066 if ./try; then
1067         : echo "Yup, it does."
1068 else
1069         echo "Hmm... '$startsh' does not guarantee sh startup..."
1070         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1071 fi
1072 rm -f try
1073
1074
1075 : Save command line options in file UU/cmdline.opt for later use in
1076 : generating config.sh.
1077 cat > cmdline.opt <<EOSH
1078 # Configure command line arguments.
1079 config_arg0='$0'
1080 config_args='$*'
1081 config_argc=$#
1082 EOSH
1083 argn=1
1084 for arg in "$@"; do
1085         cat >>cmdline.opt <<EOSH
1086 config_arg$argn='$arg'
1087 EOSH
1088         argn=`expr $argn + 1`
1089 done
1090
1091 : produce awk script to parse command line options
1092 cat >options.awk <<'EOF'
1093 BEGIN {
1094         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1095
1096         len = length(optstr);
1097         for (i = 1; i <= len; i++) {
1098                 c = substr(optstr, i, 1);
1099                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1100                 if (a == ":") {
1101                         arg[c] = 1;
1102                         i++;
1103                 }
1104                 opt[c] = 1;
1105         }
1106 }
1107 {
1108         expect = 0;
1109         str = $0;
1110         if (substr(str, 1, 1) != "-") {
1111                 printf("'%s'\n", str);
1112                 next;
1113         }
1114         len = length($0);
1115         for (i = 2; i <= len; i++) {
1116                 c = substr(str, i, 1);
1117                 if (!opt[c]) {
1118                         printf("-%s\n", substr(str, i));
1119                         next;
1120                 }
1121                 printf("-%s\n", c);
1122                 if (arg[c]) {
1123                         if (i < len)
1124                                 printf("'%s'\n", substr(str, i + 1));
1125                         else
1126                                 expect = 1;
1127                         next;
1128                 }
1129         }
1130 }
1131 END {
1132         if (expect)
1133                 print "?";
1134 }
1135 EOF
1136
1137 : process the command line options
1138 set X `for arg in "$@"; do echo "X$arg"; done |
1139         sed -e s/X// | awk -f options.awk`
1140 eval "set $*"
1141 shift
1142 rm -f options.awk
1143
1144 : set up default values
1145 fastread=''
1146 reuseval=false
1147 config_sh=''
1148 alldone=''
1149 error=''
1150 silent=''
1151 extractsh=''
1152 override=''
1153 knowitall=''
1154 rm -f optdef.sh posthint.sh
1155 cat >optdef.sh <<EOS
1156 $startsh
1157 EOS
1158
1159
1160 : option parsing
1161 while test $# -gt 0; do
1162         case "$1" in
1163         -d) shift; fastread=yes;;
1164         -e) shift; alldone=cont;;
1165         -f)
1166                 shift
1167                 cd ..
1168                 if test -r "$1"; then
1169                         config_sh="$1"
1170                 else
1171                         echo "$me: cannot read config file $1." >&2
1172                         error=true
1173                 fi
1174                 cd UU
1175                 shift;;
1176         -h) shift; error=true;;
1177         -r) shift; reuseval=true;;
1178         -s) shift; silent=true; realsilent=true;;
1179         -E) shift; alldone=exit;;
1180         -K) shift; knowitall=true;;
1181         -O) shift; override=true;;
1182         -S) shift; silent=true; extractsh=true;;
1183         -D)
1184                 shift
1185                 case "$1" in
1186                 *=)
1187                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1188                         echo "$me: ignoring -D $1" >&2
1189                         ;;
1190                 *=*) echo "$1" | \
1191                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1192                 *) echo "$1='define'" >> optdef.sh;;
1193                 esac
1194                 shift
1195                 ;;
1196         -U)
1197                 shift
1198                 case "$1" in
1199                 *=) echo "$1" >> optdef.sh;;
1200                 *=*)
1201                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1202                         echo "$me: ignoring -U $1" >&2
1203                         ;;
1204                 *) echo "$1='undef'" >> optdef.sh;;
1205                 esac
1206                 shift
1207                 ;;
1208         -A)
1209             shift
1210             xxx=''
1211             yyy="$1"
1212             zzz=''
1213             uuu=undef
1214             case "$yyy" in
1215             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1216                  case "$zzz" in
1217                  *:*) zzz='' ;;
1218                  *)   xxx=append
1219                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1220                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1221                  esac
1222                  ;;
1223             esac
1224             case "$xxx" in
1225             '')  case "$yyy" in
1226                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1227                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1228                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1229                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1230                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1231                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1232                  esac
1233                  ;;       
1234             esac
1235             case "$xxx" in
1236             append)
1237                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1238             clear)
1239                 echo "$yyy=''"                  >> posthint.sh ;;
1240             define)
1241                 case "$zzz" in
1242                 '') zzz=define ;;
1243                 esac
1244                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1245             eval)
1246                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1247             prepend)
1248                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1249             undef)
1250                 case "$zzz" in
1251                 '') zzz="$uuu" ;;
1252                 esac
1253                 echo "$yyy=$zzz"                >> posthint.sh ;;
1254             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1255             esac
1256             ;;
1257         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1258             exit 0;;
1259         --) break;;
1260         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1261         *) break;;
1262         esac
1263 done
1264
1265 case "$error" in
1266 true)
1267         cat >&2 <<EOM
1268 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1269                  [-U symbol] [-U symbol=] [-A command:symbol...]
1270   -d : use defaults for all answers.
1271   -e : go on without questioning past the production of config.sh.
1272   -f : specify an alternate default configuration file.
1273   -h : print this help message and exit (with an error status).
1274   -r : reuse C symbols value if possible (skips costly nm extraction).
1275   -s : silent mode, only echoes questions and essential information.
1276   -D : define symbol to have some value:
1277          -D symbol         symbol gets the value 'define'
1278          -D symbol=value   symbol gets the value 'value'
1279   -E : stop at the end of questions, after having produced config.sh.
1280   -K : do not use unless you know what you are doing.
1281   -O : let -D and -U override definitions from loaded configuration file.
1282   -S : perform variable substitutions on all .SH files (can mix with -f)
1283   -U : undefine symbol:
1284          -U symbol    symbol gets the value 'undef'
1285          -U symbol=   symbol gets completely empty
1286   -A : manipulate symbol after the platform specific hints have been applied:
1287          -A symbol=value                append " "value to symbol
1288          -A append:symbol=value         append value to symbol
1289          -A define:symbol=value         define symbol to have value
1290          -A clear:symbol                define symbol to be ''
1291          -A define:symbol               define symbol to be 'define'
1292          -A eval:symbol=value           define symbol to be eval of value
1293          -A prepend:symbol=value        prepend value to symbol
1294          -A undef:symbol                define symbol to be 'undef'
1295          -A undef:symbol=               define symbol to be ''
1296   -V : print version number and exit (with a zero status).
1297 EOM
1298         exit 1
1299         ;;
1300 esac
1301
1302 : Sanity checks
1303 case "$fastread$alldone" in
1304 yescont|yesexit) ;;
1305 *)
1306         if test ! -t 0; then
1307                 echo "Say 'sh Configure', not 'sh <Configure'"
1308                 exit 1
1309         fi
1310         ;;
1311 esac
1312
1313 exec 4>&1
1314 case "$silent" in
1315 true) exec 1>/dev/null;;
1316 esac
1317
1318 : run the defines and the undefines, if any, but leave the file out there...
1319 touch optdef.sh
1320 . ./optdef.sh
1321 : create the posthint manipulation script and leave the file out there...
1322 touch posthint.sh
1323
1324 : set package name
1325 package=perl5
1326 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1327 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1328 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1329 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1330 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1331 esac
1332
1333 : Some greps do not return status, grrr.
1334 echo "grimblepritz" >grimble
1335 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1336         contains=contains
1337 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1338         contains=grep
1339 else
1340         contains=contains
1341 fi
1342 rm -f grimble
1343 : the following should work in any shell
1344 case "$contains" in
1345 contains*)
1346         echo " "
1347         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1348         cat >contains <<'EOSS'
1349 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1350 EOSS
1351 chmod +x contains
1352 esac
1353
1354 : Find the path to the source tree
1355 case "$src" in
1356 '') case "$0" in
1357     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1358          case "$src" in
1359          /*)    ;;
1360          *)     src=`cd ../$src && pwd` ;;
1361          esac
1362          ;;
1363     *)   src='.';;
1364     esac;;
1365 esac
1366 case "$src" in
1367 '')     src=/
1368         rsrc=/
1369         ;;
1370 /*) rsrc="$src";;
1371 *) rsrc="../$src";;
1372 esac
1373 if test -f $rsrc/Configure && \
1374         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1375 then
1376    : found it, so we are ok.
1377 else
1378         rsrc=''
1379         for src in . .. ../.. ../../.. ../../../..; do
1380                 if test -f ../$src/Configure && \
1381                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1382                 then
1383                         rsrc=../$src
1384                         break
1385                 fi
1386         done
1387 fi
1388 case "$rsrc" in
1389 '')
1390         cat <<EOM >&4
1391
1392 Sorry, I can't seem to locate the source dir for $package.  Please start
1393 Configure with an explicit path -- i.e. /some/path/Configure.
1394
1395 EOM
1396         exit 1
1397         ;;
1398 ../.)   rsrc='..';;
1399 *)
1400         echo " "
1401         echo "Sources for $package found in \"$src\"." >&4
1402         ;;
1403 esac
1404
1405 : script used to extract .SH files with variable substitutions
1406 cat >extract <<'EOS'
1407 CONFIGDOTSH=true
1408 echo "Doing variable substitutions on .SH files..."
1409 if test -f $src/MANIFEST; then
1410         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1411 else
1412         echo "(Looking for .SH files under the source directory.)"
1413         set x `(cd $src; find . -name "*.SH" -print)`
1414 fi
1415 shift
1416 case $# in
1417 0) set x `(cd $src; echo *.SH)`; shift;;
1418 esac
1419 if test ! -f $src/$1; then
1420         shift
1421 fi
1422 mkdir_p='
1423 name=$1;
1424 create="";
1425 while test $name; do
1426         if test ! -d "$name"; then
1427                 create="$name $create";
1428                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1429                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1430         else
1431                 name="";
1432         fi;
1433 done;
1434 for file in $create; do
1435         mkdir $file;
1436 done
1437 '
1438 for file in $*; do
1439         case "$src" in
1440         ".")
1441                 case "$file" in
1442                 */*)
1443                         dir=`expr X$file : 'X\(.*\)/'`
1444                         file=`expr X$file : 'X.*/\(.*\)'`
1445                         (cd $dir && . ./$file)
1446                         ;;
1447                 *)
1448                         . ./$file
1449                         ;;
1450                 esac
1451                 ;;
1452         *)
1453                 case "$file" in
1454                 */*)
1455                         dir=`expr X$file : 'X\(.*\)/'`
1456                         file=`expr X$file : 'X.*/\(.*\)'`
1457                         (set x $dir; shift; eval $mkdir_p)
1458                         sh <$src/$dir/$file
1459                         ;;
1460                 *)
1461                         sh <$src/$file
1462                         ;;
1463                 esac
1464                 ;;
1465         esac
1466 done
1467 if test -f $src/config_h.SH; then
1468         if test ! -f config.h; then
1469         : oops, they left it out of MANIFEST, probably, so do it anyway.
1470         . $src/config_h.SH
1471         fi
1472 fi
1473 EOS
1474
1475 : extract files and exit if asked to do so
1476 case "$extractsh" in
1477 true)
1478         case "$realsilent" in
1479         true) ;;
1480         *) exec 1>&4;;
1481         esac
1482         case "$config_sh" in
1483         '') config_sh='config.sh';;
1484         esac
1485         echo " "
1486         echo "Fetching answers from $config_sh..."
1487         cd ..
1488         . $config_sh
1489         test "$override" && . ./optdef.sh
1490         echo " "
1491         . UU/extract
1492         rm -rf UU
1493         echo "Done."
1494         exit 0
1495         ;;
1496 esac
1497
1498 : Eunice requires " " instead of "", can you believe it
1499 echo " "
1500 : Here we go...
1501 echo "Beginning of configuration questions for $package."
1502
1503 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1504
1505 : first determine how to suppress newline on echo command
1506 echo " "
1507 echo "Checking echo to see how to suppress newlines..."
1508 (echo "hi there\c" ; echo " ") >.echotmp
1509 if $contains c .echotmp >/dev/null 2>&1 ; then
1510         echo "...using -n."
1511         n='-n'
1512         c=''
1513 else
1514         cat <<'EOM'
1515 ...using \c
1516 EOM
1517         n=''
1518         c='\c'
1519 fi
1520 echo $n "The star should be here-->$c"
1521 echo '*'
1522 rm -f .echotmp
1523
1524 : Now test for existence of everything in MANIFEST
1525 echo " "
1526 if test -f $rsrc/MANIFEST; then
1527         echo "First let's make sure your kit is complete.  Checking..." >&4
1528         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1529         rm -f missing
1530         tmppwd=`pwd`
1531         for filelist in x??; do
1532                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1533         done
1534         if test -s missing; then
1535                 cat missing >&4
1536                 cat >&4 <<'EOM'
1537
1538 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1539
1540 You have the option of continuing the configuration process, despite the
1541 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1542 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1543 and contact the author (perlbug@perl.com).
1544
1545 EOM
1546                 echo $n "Continue? [n] $c" >&4
1547                 read ans
1548                 case "$ans" in
1549                 y*)
1550                         echo "Continuing..." >&4
1551                         rm -f missing
1552                         ;;
1553                 *)
1554                         echo "ABORTING..." >&4
1555                         kill $$
1556                         ;;
1557                 esac
1558         else
1559                 echo "Looks good..."
1560         fi
1561 else
1562         echo "There is no MANIFEST file.  I hope your kit is complete !"
1563 fi
1564 rm -f missing x??
1565
1566 echo " "
1567 : Find the appropriate value for a newline for tr
1568 if test -n "$DJGPP"; then
1569        trnl='\012'
1570 fi
1571 if test X"$trnl" = X; then
1572         case "`echo foo|tr '\n' x 2>/dev/null`" in
1573         foox) trnl='\n' ;;
1574         esac
1575 fi
1576 if test X"$trnl" = X; then
1577         case "`echo foo|tr '\012' x 2>/dev/null`" in
1578         foox) trnl='\012' ;;
1579         esac
1580 fi
1581 if test X"$trnl" = X; then
1582         cat <<EOM >&2
1583
1584 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1585
1586 EOM
1587         exit 1
1588 fi
1589
1590 : compute the number of columns on the terminal for proper question formatting
1591 case "$COLUMNS" in
1592 '') COLUMNS='80';;
1593 esac
1594
1595 : set up the echo used in my read
1596 myecho="case \"\$xxxm\" in
1597 '') echo $n \"\$rp $c\" >&4;;
1598 *) case \"\$rp\" in
1599         '') echo $n \"[\$xxxm] $c\";;
1600         *)
1601                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1602                         echo \"\$rp\" >&4
1603                         echo $n \"[\$xxxm] $c\" >&4
1604                 else
1605                         echo $n \"\$rp [\$xxxm] $c\" >&4
1606                 fi
1607                 ;;
1608         esac;;
1609 esac"
1610
1611 : now set up to do reads with possible shell escape and default assignment
1612 cat <<EOSC >myread
1613 $startsh
1614 xxxm=\$dflt
1615 $myecho
1616 ans='!'
1617 case "\$fastread" in
1618 yes) case "\$dflt" in
1619         '') ;;
1620         *) ans='';
1621                 case "\$silent-\$rp" in
1622                 true-) ;;
1623                 *) echo " " >&4;;
1624                 esac;;
1625         esac;;
1626 *) case "\$silent" in
1627         true) case "\$rp" in
1628                 '') ans='';;
1629                 esac;;
1630         esac;;
1631 esac
1632 while expr "X\$ans" : "X!" >/dev/null; do
1633         read answ
1634         set x \$xxxm
1635         shift
1636         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1637         case  "\$answ" in
1638         "!")
1639                 sh 1>&4
1640                 echo " "
1641                 $myecho
1642                 ;;
1643         !*)
1644                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1645                 shift
1646                 sh 1>&4 -c "\$*"
1647                 echo " "
1648                 $myecho
1649                 ;;
1650         "\$ans")
1651                 case "\$ans" in
1652                 \\&*)
1653                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1654                         shift
1655                         case "\$1" in
1656                         -d)
1657                                 fastread=yes
1658                                 echo "(OK, I'll run with -d after this question.)" >&4
1659                                 ;;
1660                         -*)
1661                                 echo "*** Sorry, \$1 not supported yet." >&4
1662                                 ;;
1663                         esac
1664                         $myecho
1665                         ans=!
1666                         ;;
1667                 esac;;
1668         *)
1669                 case "\$aok" in
1670                 y)
1671                         echo "*** Substitution done -- please confirm."
1672                         xxxm="\$ans"
1673                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1674                         xxxm="\$ans"
1675                         ans=!
1676                         ;;
1677                 *)
1678                         echo "*** Error -- try again."
1679                         ans=!
1680                         ;;
1681                 esac
1682                 $myecho
1683                 ;;
1684         esac
1685         case "\$ans\$xxxm\$nostick" in
1686         '')
1687                 ans=!
1688                 $myecho
1689                 ;;
1690         esac
1691 done
1692 case "\$ans" in
1693 '') ans="\$xxxm";;
1694 esac
1695 EOSC
1696
1697 : create .config dir to save info across Configure sessions
1698 test -d ../.config || mkdir ../.config
1699 cat >../.config/README <<EOF
1700 This directory created by Configure to save information that should
1701 persist across sessions for $package.
1702
1703 You may safely delete it if you wish.
1704 EOF
1705
1706 : general instructions
1707 needman=true
1708 firsttime=true
1709 user=`(logname) 2>/dev/null`
1710 case "$user" in
1711 '') user=`whoami 2>&1`;;
1712 esac
1713 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1714         firsttime=false
1715         echo " "
1716         rp='Would you like to see the instructions?'
1717         dflt=n
1718         . ./myread
1719         case "$ans" in
1720         [yY]*) ;;
1721         *) needman=false;;
1722         esac
1723 fi
1724 if $needman; then
1725         cat <<EOH
1726
1727 This installation shell script will examine your system and ask you questions
1728 to determine how the perl5 package should be installed. If you get
1729 stuck on a question, you may use a ! shell escape to start a subshell or
1730 execute a command.  Many of the questions will have default answers in square
1731 brackets; typing carriage return will give you the default.
1732
1733 On some of the questions which ask for file or directory names you are allowed
1734 to use the ~name construct to specify the login directory belonging to "name",
1735 even if you don't have a shell which knows about that.  Questions where this is
1736 allowed will be marked "(~name ok)".
1737
1738 EOH
1739         rp=''
1740         dflt='Type carriage return to continue'
1741         . ./myread
1742         cat <<'EOH'
1743
1744 The prompter used in this script allows you to use shell variables and
1745 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1746 in the default answer, as if the default line was a set of arguments given to a
1747 script shell.  This means you may also use $* to repeat the whole default line,
1748 so you do not have to re-type everything to add something to the default.
1749
1750 Everytime there is a substitution, you will have to confirm.  If there is an
1751 error (e.g. an unmatched backtick), the default answer will remain unchanged
1752 and you will be prompted again.
1753
1754 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1755 the questions and use the computed defaults (or the previous answers if there
1756 was already a config.sh file). Type 'Configure -h' for a list of options.
1757 You may also start interactively and then answer '& -d' at any prompt to turn
1758 on the non-interactive behaviour for the remainder of the execution.
1759
1760 EOH
1761         . ./myread
1762         cat <<EOH
1763
1764 Much effort has been expended to ensure that this shell script will run on any
1765 Unix system.  If despite that it blows up on yours, your best bet is to edit
1766 Configure and run it again.  If you can't run Configure for some reason,
1767 you'll have to generate a config.sh file by hand.  Whatever problems you
1768 have, let me (perlbug@perl.com) know how I blew it.
1769
1770 This installation script affects things in two ways:
1771
1772 1) it may do direct variable substitutions on some of the files included
1773    in this kit.
1774 2) it builds a config.h file for inclusion in C programs.  You may edit
1775    any of these files as the need arises after running this script.
1776
1777 If you make a mistake on a question, there is no easy way to back up to it
1778 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1779 files.  Configure will offer to let you do this before it runs the SH files.
1780
1781 EOH
1782         dflt='Type carriage return to continue'
1783         . ./myread
1784         case "$firsttime" in
1785         true) echo $user >>../.config/instruct;;
1786         esac
1787 fi
1788
1789 : find out where common programs are
1790 echo " "
1791 echo "Locating common programs..." >&4
1792 cat <<EOSC >loc
1793 $startsh
1794 case \$# in
1795 0) exit 1;;
1796 esac
1797 thing=\$1
1798 shift
1799 dflt=\$1
1800 shift
1801 for dir in \$*; do
1802         case "\$thing" in
1803         .)
1804         if test -d \$dir/\$thing; then
1805                 echo \$dir
1806                 exit 0
1807         fi
1808         ;;
1809         *)
1810         for thisthing in \$dir/\$thing; do
1811                 : just loop through to pick last item
1812         done
1813         if test -f \$thisthing; then
1814                 echo \$thisthing
1815                 exit 0
1816         elif test -f \$dir/\$thing.exe; then
1817                 if test -n "$DJGPP"; then
1818                         echo \$dir/\$thing.exe
1819                 else
1820                         : on Eunice apparently
1821                         echo \$dir/\$thing
1822                 fi
1823                 exit 0
1824         fi
1825         ;;
1826         esac
1827 done
1828 echo \$dflt
1829 exit 1
1830 EOSC
1831 chmod +x loc
1832 $eunicefix loc
1833 loclist="
1834 awk
1835 cat
1836 comm
1837 cp
1838 echo
1839 expr
1840 grep
1841 ls
1842 make
1843 mkdir
1844 rm
1845 sed
1846 sort
1847 touch
1848 tr
1849 uniq
1850 "
1851 trylist="
1852 Mcc
1853 ar
1854 byacc
1855 cpp
1856 csh
1857 date
1858 egrep
1859 gzip
1860 less
1861 ln
1862 more
1863 nm
1864 nroff
1865 perl
1866 pg
1867 test
1868 uname
1869 zip
1870 "
1871 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1872 pth="$pth /lib /usr/lib"
1873 for file in $loclist; do
1874         eval xxx=\$$file
1875         case "$xxx" in
1876         /*|?:[\\/]*)
1877                 if test -f "$xxx"; then
1878                         : ok
1879                 else
1880                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1881                         xxx=`./loc $file $file $pth`
1882                 fi
1883                 ;;
1884         '') xxx=`./loc $file $file $pth`;;
1885         *) xxx=`./loc $xxx $xxx $pth`;;
1886         esac
1887         eval $file=$xxx
1888         eval _$file=$xxx
1889         case "$xxx" in
1890         /*)
1891                 echo $file is in $xxx.
1892                 ;;
1893         ?:[\\/]*)
1894                 echo $file is in $xxx.
1895                 ;;
1896         *)
1897                 echo "I don't know where '$file' is, and my life depends on it." >&4
1898                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1899                 exit 1
1900                 ;;
1901         esac
1902 done
1903 echo " "
1904 echo "Don't worry if any of the following aren't found..."
1905 say=offhand
1906 for file in $trylist; do
1907         eval xxx=\$$file
1908         case "$xxx" in
1909         /*|?:[\\/]*)
1910                 if test -f "$xxx"; then
1911                         : ok
1912                 else
1913                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1914                         xxx=`./loc $file $file $pth`
1915                 fi
1916                 ;;
1917         '') xxx=`./loc $file $file $pth`;;
1918         *) xxx=`./loc $xxx $xxx $pth`;;
1919         esac
1920         eval $file=$xxx
1921         eval _$file=$xxx
1922         case "$xxx" in
1923         /*)
1924                 echo $file is in $xxx.
1925                 ;;
1926         ?:[\\/]*)
1927                 echo $file is in $xxx.
1928                 ;;
1929         *)
1930                 echo "I don't see $file out there, $say."
1931                 say=either
1932                 ;;
1933         esac
1934 done
1935 case "$egrep" in
1936 egrep)
1937         echo "Substituting grep for egrep."
1938         egrep=$grep
1939         ;;
1940 esac
1941 case "$ln" in
1942 ln)
1943         echo "Substituting cp for ln."
1944         ln=$cp
1945         ;;
1946 esac
1947 case "$test" in
1948 test)
1949         echo "Hopefully test is built into your sh."
1950         ;;
1951 *)
1952         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1953                 echo "Using the test built into your sh."
1954                 test=test
1955                 _test=test
1956         fi
1957         ;;
1958 esac
1959 case "$echo" in
1960 echo)
1961         echo "Hopefully echo is built into your sh."
1962         ;;
1963 '') ;;
1964 *)
1965         echo " "
1966 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1967         $echo $n "hi there$c" >foo1
1968         echo $n "hi there$c" >foo2
1969         if cmp foo1 foo2 >/dev/null 2>&1; then
1970                 echo "They are compatible.  In fact, they may be identical."
1971         else
1972                 case "$n" in
1973                 '-n') n='' c='\c';;
1974                 *) n='-n' c='';;
1975                 esac
1976                 cat <<FOO
1977 They are not compatible!  You are probably running ksh on a non-USG system.
1978 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1979 have echo built in and we may have to run some Bourne shell scripts.  That
1980 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1981
1982 FOO
1983                 $echo $n "The star should be here-->$c"
1984                 $echo "*"
1985         fi
1986         $rm -f foo1 foo2
1987         ;;
1988 esac
1989
1990 : determine whether symbolic links are supported
1991 echo " "
1992 $touch blurfl
1993 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1994         echo "Symbolic links are supported." >&4
1995         lns="$ln -s"
1996 else
1997         echo "Symbolic links are NOT supported." >&4
1998         lns="$ln"
1999 fi
2000 $rm -f blurfl sym
2001
2002 : see whether [:lower:] and [:upper:] are supported character classes
2003 echo " "
2004 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2005 ABYZ)
2006         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2007         up='[:upper:]'
2008         low='[:lower:]'
2009         ;;
2010 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2011         # (0xc9 and 0xd1), therefore that is a nice testing point.
2012         if test "X$up" = X -o "X$low" = X; then
2013             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2014             ij) up='[A-Z]'
2015                 low='[a-z]'
2016                 ;;
2017             esac
2018         fi
2019         if test "X$up" = X -o "X$low" = X; then
2020             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2021             ij) up='A-Z'
2022                 low='a-z'
2023                 ;;
2024             esac
2025         fi
2026         if test "X$up" = X -o "X$low" = X; then
2027             case "`echo IJ | od -x 2>/dev/null`" in
2028             *C9D1*|*c9d1*)
2029                 echo "Hey, this might be EBCDIC." >&4
2030                 if test "X$up" = X -o "X$low" = X; then
2031                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2032                     ij) up='[A-IJ-RS-Z]'
2033                         low='[a-ij-rs-z]'
2034                         ;;
2035                     esac
2036                 fi
2037                 if test "X$up" = X -o "X$low" = X; then
2038                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2039                     ij) up='A-IJ-RS-Z'
2040                         low='a-ij-rs-z'
2041                         ;;
2042                     esac
2043                 fi
2044                 ;;
2045             esac
2046         fi
2047 esac
2048 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2049 ij)
2050     echo "Using $up and $low to convert case." >&4
2051     ;;
2052 *)
2053     echo "I don't know how to translate letters from upper to lower case." >&4
2054     echo "Your tr is not acting any way I know of." >&4
2055     exit 1
2056     ;;
2057 esac
2058 : set up the translation script tr, must be called with ./tr of course
2059 cat >tr <<EOSC
2060 $startsh
2061 case "\$1\$2" in
2062 '[A-Z][a-z]') exec $tr '$up' '$low';;
2063 '[a-z][A-Z]') exec $tr '$low' '$up';;
2064 esac
2065 exec $tr "\$@"
2066 EOSC
2067 chmod +x tr
2068 $eunicefix tr
2069
2070 : Try to determine whether config.sh was made on this system
2071 case "$config_sh" in
2072 '')
2073 myuname=`$uname -a 2>/dev/null`
2074 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2075 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2076 # because the A-Z/a-z are not consecutive.
2077 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2078         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2079 newmyuname="$myuname"
2080 dflt=n
2081 case "$knowitall" in
2082 '')
2083         if test -f ../config.sh; then
2084                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2085                         eval "`grep myuname= ../config.sh`"
2086                 fi
2087                 if test "X$myuname" = "X$newmyuname"; then
2088                         dflt=y
2089                 fi
2090         fi
2091         ;;
2092 *) dflt=y;;
2093 esac
2094
2095 : Get old answers from old config file if Configure was run on the
2096 : same system, otherwise use the hints.
2097 hint=default
2098 cd ..
2099 if test -f config.sh; then
2100         echo " "
2101         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2102         . UU/myread
2103         case "$ans" in
2104         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2105         *)  echo "Fetching default answers from your old config.sh file..." >&4
2106                 tmp_n="$n"
2107                 tmp_c="$c"
2108                 tmp_sh="$sh"
2109                 . ./config.sh
2110                 cp config.sh UU
2111                 n="$tmp_n"
2112                 c="$tmp_c"
2113                 : Older versions did not always set $sh.  Catch re-use of such
2114                 : an old config.sh.
2115                 case "$sh" in
2116                 '') sh="$tmp_sh" ;;
2117                 esac
2118                 hint=previous
2119                 ;;
2120         esac
2121 fi
2122 if test ! -f config.sh; then
2123         $cat <<EOM
2124
2125 First time through, eh?  I have some defaults handy for some systems
2126 that need some extra help getting the Configure answers right:
2127
2128 EOM
2129         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2130         dflt=''
2131         : Half the following guesses are probably wrong... If you have better
2132         : tests or hints, please send them to perlbug@perl.com
2133         : The metaconfig authors would also appreciate a copy...
2134         $test -f /irix && osname=irix
2135         $test -f /xenix && osname=sco_xenix
2136         $test -f /dynix && osname=dynix
2137         $test -f /dnix && osname=dnix
2138         $test -f /lynx.os && osname=lynxos
2139         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2140         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2141         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2142         $test -f /bin/mips && /bin/mips && osname=mips
2143         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2144                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2145         $test -d /usr/apollo/bin && osname=apollo
2146         $test -f /etc/saf/_sactab && osname=svr4
2147         $test -d /usr/include/minix && osname=minix
2148         if $test -d /MachTen -o -d /MachTen_Folder; then
2149                 osname=machten
2150                 if $test -x /sbin/version; then
2151                         osvers=`/sbin/version | $awk '{print $2}' |
2152                         $sed -e 's/[A-Za-z]$//'`
2153                 elif $test -x /usr/etc/version; then
2154                         osvers=`/usr/etc/version | $awk '{print $2}' |
2155                         $sed -e 's/[A-Za-z]$//'`
2156                 else
2157                         osvers="$2.$3"
2158                 fi
2159         fi
2160
2161         $test -f /sys/posix.dll &&
2162                 $test -f /usr/bin/what &&
2163                 set X `/usr/bin/what /sys/posix.dll` &&
2164                 $test "$3" = UWIN &&
2165                 osname=uwin &&
2166                 osvers="$5"
2167
2168         if $test -f $uname; then
2169                 set X $myuname
2170                 shift
2171
2172                 case "$5" in
2173                 fps*) osname=fps ;;
2174                 mips*)
2175                         case "$4" in
2176                         umips) osname=umips ;;
2177                         *) osname=mips ;;
2178                         esac;;
2179                 [23]100) osname=mips ;;
2180                 next*) osname=next ;;
2181                 i386*)
2182                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2183                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2184                                 osname='sco'
2185                                 osvers=$tmp
2186                         elif $test -f /etc/kconfig; then
2187                                 osname=isc
2188                                 if test "$lns" = "$ln -s"; then
2189                                         osvers=4
2190                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2191                                         osvers=3
2192                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2193                                         osvers=2
2194                                 fi
2195                         fi
2196                         tmp=''
2197                         ;;
2198                 pc*)
2199                         if test -n "$DJGPP"; then
2200                                 osname=dos
2201                                 osvers=djgpp
2202                         fi
2203                         ;;
2204                 esac
2205
2206                 case "$1" in
2207                 aix) osname=aix
2208                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2209                         case "$tmp" in
2210                         'not found') osvers="$4"."$3" ;;
2211                         '<3240'|'<>3240') osvers=3.2.0 ;;
2212                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2213                         '=3250'|'>3250') osvers=3.2.5 ;;
2214                         *) osvers=$tmp;;
2215                         esac
2216                         ;;
2217                 bsd386) osname=bsd386
2218                         osvers=`$uname -r`
2219                         ;;
2220                 cygwin*) osname=cygwin
2221                         osvers="$3"
2222                         ;;
2223                 *dc.osx) osname=dcosx
2224                         osvers="$3"
2225                         ;;
2226                 dnix) osname=dnix
2227                         osvers="$3"
2228                         ;;
2229                 domainos) osname=apollo
2230                         osvers="$3"
2231                         ;;
2232                 dgux) osname=dgux 
2233                         osvers="$3"
2234                         ;;
2235                 dynixptx*) osname=dynixptx
2236                         osvers=`echo "$4"|sed 's/^v//'`
2237                         ;;
2238                 freebsd) osname=freebsd 
2239                         osvers="$3" ;;
2240                 genix) osname=genix ;;
2241                 hp*) osname=hpux 
2242                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2243                         ;;
2244                 irix*) osname=irix
2245                         case "$3" in
2246                         4*) osvers=4 ;;
2247                         5*) osvers=5 ;;
2248                         *)      osvers="$3" ;;
2249                         esac
2250                         ;;
2251                 linux) osname=linux
2252                         case "$3" in
2253                         *)      osvers="$3" ;;
2254                         esac
2255                         ;;
2256                 MiNT) osname=mint
2257                         ;;
2258                 netbsd*) osname=netbsd
2259                         osvers="$3"
2260                         ;;
2261                 news-os) osvers="$3"
2262                         case "$3" in
2263                         4*) osname=newsos4 ;;
2264                         *) osname=newsos ;;
2265                         esac
2266                         ;;
2267                 next*) osname=next ;;
2268                 POSIX-BC | posix-bc ) osname=posix-bc
2269                         osvers="$3"
2270                         ;;
2271                 powerux | power_ux | powermax_os | powermaxos | \
2272                 powerunix | power_unix) osname=powerux
2273                         osvers="$3"
2274                         ;;
2275                 qnx) osname=qnx
2276                         osvers="$4"
2277                         ;;
2278                 solaris) osname=solaris
2279                         case "$3" in
2280                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2281                         *)      osvers="$3" ;;
2282                         esac
2283                         ;;
2284                 sunos) osname=sunos
2285                         case "$3" in
2286                         5*) osname=solaris
2287                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 titanos) osname=titanos
2292                         case "$3" in
2293                         1*) osvers=1 ;;
2294                         2*) osvers=2 ;;
2295                         3*) osvers=3 ;;
2296                         4*) osvers=4 ;;
2297                         *)      osvers="$3" ;;
2298                         esac
2299                         ;;
2300                 ultrix) osname=ultrix
2301                         osvers="$3"
2302                         ;;
2303                 osf1|mls+)      case "$5" in
2304                                 alpha)
2305                                         osname=dec_osf
2306                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2307                                         ;;
2308                         hp*)    osname=hp_osf1  ;;
2309                         mips)   osname=mips_osf1 ;;
2310                         esac
2311                         ;;
2312                 unixware) osname=svr5
2313                         osvers="$4"
2314                         ;;
2315                 uts) osname=uts
2316                         osvers="$3"
2317                         ;;
2318                 $2) case "$osname" in
2319                         *isc*) ;;
2320                         *freebsd*) ;;
2321                         svr*)
2322                                 : svr4.x or possibly later
2323                                 case "svr$3" in 
2324                                 ${osname}*)
2325                                         osname=svr$3
2326                                         osvers=$4
2327                                         ;;
2328                                 esac
2329                                 case "$osname" in
2330                                 svr4.0)
2331                                         : Check for ESIX
2332                                         if test -f /stand/boot ; then
2333                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2334                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2335                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2336                                                         if test -n "$isesix"; then
2337                                                                 osname=esix4
2338                                                         fi
2339                                                 fi
2340                                         fi
2341                                         ;;
2342                                 esac
2343                                 ;;
2344                         *)      if test -f /etc/systemid; then
2345                                         osname=sco
2346                                         set `echo $3 | $sed 's/\./ /g'` $4
2347                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2348                                                 osvers=$1.$2.$3
2349                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2350                                                 osvers=$1.$2
2351                                         elif $test -f $src/hints/sco_$1.sh; then
2352                                                 osvers=$1
2353                                         fi
2354                                 else
2355                                         case "$osname" in
2356                                         '') : Still unknown.  Probably a generic Sys V.
2357                                                 osname="sysv"
2358                                                 osvers="$3"
2359                                                 ;;
2360                                         esac
2361                                 fi
2362                                 ;;
2363                         esac
2364                         ;;
2365                 *)      case "$osname" in
2366                         '') : Still unknown.  Probably a generic BSD.
2367                                 osname="$1"
2368                                 osvers="$3"
2369                                 ;;
2370                         esac
2371                         ;;
2372                 esac
2373         else
2374                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2375                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2376                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2377                                 osname=news_os
2378                         fi
2379                         $rm -f UU/kernel.what
2380                 elif test -d c:/.; then
2381                         set X $myuname
2382                         osname=os2
2383                         osvers="$5"
2384                 fi
2385         fi
2386         
2387         : Now look for a hint file osname_osvers, unless one has been
2388         : specified already.
2389         case "$hintfile" in
2390         ''|' ')
2391                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2392                 : Also try without trailing minor version numbers.
2393                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2394                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2395                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2396                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2397                 case "$file" in
2398                 '') dflt=none ;;
2399                 *)  case "$osvers" in
2400                         '') dflt=$file
2401                                 ;;
2402                         *)  if $test -f $src/hints/$file.sh ; then
2403                                         dflt=$file
2404                                 elif $test -f $src/hints/$xfile.sh ; then
2405                                         dflt=$xfile
2406                                 elif $test -f $src/hints/$xxfile.sh ; then
2407                                         dflt=$xxfile
2408                                 elif $test -f $src/hints/$xxxfile.sh ; then
2409                                         dflt=$xxxfile
2410                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2411                                         dflt=$xxxxfile
2412                                 elif $test -f "$src/hints/${osname}.sh" ; then
2413                                         dflt="${osname}"
2414                                 else
2415                                         dflt=none
2416                                 fi
2417                                 ;;
2418                         esac
2419                         ;;
2420                 esac
2421                 if $test -f Policy.sh ; then
2422                         case "$dflt" in
2423                         *Policy*) ;;
2424                         none) dflt="Policy" ;;
2425                         *) dflt="Policy $dflt" ;;
2426                         esac
2427                 fi
2428                 ;;
2429         *)
2430                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2431                 ;;
2432         esac
2433
2434         if $test -f Policy.sh ; then
2435                 $cat <<EOM
2436
2437 There's also a Policy hint file available, which should make the
2438 site-specific (policy) questions easier to answer.
2439 EOM
2440
2441         fi
2442
2443         $cat <<EOM
2444
2445 You may give one or more space-separated answers, or "none" if appropriate.
2446 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2447 is a good thing.  DO NOT give a wrong version or a wrong OS.
2448
2449 EOM
2450
2451         rp="Which of these apply, if any?"
2452         . UU/myread
2453         tans=$ans
2454         for file in $tans; do
2455                 if $test X$file = XPolicy -a -f Policy.sh; then
2456                         . Policy.sh
2457                         $cat Policy.sh >> UU/config.sh
2458                 elif $test -f $src/hints/$file.sh; then
2459                         . $src/hints/$file.sh
2460                         $cat $src/hints/$file.sh >> UU/config.sh
2461                 elif $test X$tans = X -o X$tans = Xnone ; then
2462                         : nothing
2463                 else
2464                         : Give one chance to correct a possible typo.
2465                         echo "$file.sh does not exist"
2466                         dflt=$file
2467                         rp="hint to use instead?"
2468                         . UU/myread
2469                         for file in $ans; do
2470                                 if $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$ans = X -o X$ans = Xnone ; then
2474                                         : nothing
2475                                 else
2476                                         echo "$file.sh does not exist -- ignored."
2477                                 fi
2478                         done
2479                 fi
2480         done
2481
2482         hint=recommended
2483         : Remember our hint file for later.
2484         if $test -f "$src/hints/$file.sh" ; then
2485                 hintfile="$file"
2486         else
2487                 hintfile=''
2488         fi
2489 fi
2490 cd UU
2491 ;;
2492 *)
2493         echo " "
2494         echo "Fetching default answers from $config_sh..." >&4
2495         tmp_n="$n"
2496         tmp_c="$c"
2497         cd ..
2498         cp $config_sh config.sh 2>/dev/null
2499         chmod +w config.sh
2500         . ./config.sh
2501         cd UU
2502         cp ../config.sh .
2503         n="$tmp_n"
2504         c="$tmp_c"
2505         hint=previous
2506         ;;
2507 esac
2508 test "$override" && . ./optdef.sh
2509 myuname="$newmyuname"
2510
2511 : Restore computed paths
2512 for file in $loclist $trylist; do
2513         eval $file="\$_$file"
2514 done
2515
2516 cat << EOM
2517
2518 Configure uses the operating system name and version to set some defaults.
2519 The default value is probably right if the name rings a bell. Otherwise,
2520 since spelling matters for me, either accept the default or answer "none"
2521 to leave it blank.
2522
2523 EOM
2524 case "$osname" in
2525         ''|' ')
2526                 case "$hintfile" in
2527                 ''|' '|none) dflt=none ;;
2528                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2529                 esac
2530                 ;;
2531         *) dflt="$osname" ;;
2532 esac
2533 rp="Operating system name?"
2534 . ./myread
2535 case "$ans" in
2536 none)  osname='' ;;
2537 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2538 esac
2539 echo " "
2540 case "$osvers" in
2541         ''|' ')
2542                 case "$hintfile" in
2543                 ''|' '|none) dflt=none ;;
2544                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2545                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2546                         case "$dflt" in
2547                         ''|' ') dflt=none ;;
2548                         esac
2549                         ;;
2550                 esac
2551                 ;;
2552         *) dflt="$osvers" ;;
2553 esac
2554 rp="Operating system version?"
2555 . ./myread
2556 case "$ans" in
2557 none)  osvers='' ;;
2558 *) osvers="$ans" ;;
2559 esac
2560
2561
2562 . ./posthint.sh
2563
2564 : who configured the system
2565 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2566 cf_by=`(logname) 2>/dev/null`
2567 case "$cf_by" in
2568 "")
2569         cf_by=`(whoami) 2>/dev/null`
2570         case "$cf_by" in
2571         "") cf_by=unknown ;;
2572         esac ;;
2573 esac
2574
2575 : set up the script used to warn in case of inconsistency
2576 cat <<EOS >whoa
2577 $startsh
2578 EOS
2579 cat <<'EOSC' >>whoa
2580 dflt=y
2581 echo " "
2582 echo "*** WHOA THERE!!! ***" >&4
2583 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2584 rp="    Keep the $hint value?"
2585 . ./myread
2586 case "$ans" in
2587 y) td=$was; tu=$was;;
2588 esac
2589 EOSC
2590
2591 : function used to set $1 to $val
2592 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2593 case "$val$was" in
2594 $define$undef) . ./whoa; eval "$var=\$td";;
2595 $undef$define) . ./whoa; eval "$var=\$tu";;
2596 *) eval "$var=$val";;
2597 esac'
2598
2599 cat <<EOM
2600
2601 Perl can be built to take advantage of threads on some systems.
2602 To do so, Configure must be run with -Dusethreads.
2603
2604 Note that threading is a highly experimental feature, and
2605 some known race conditions still remain.  If you choose to try
2606 it, be very sure to not actually deploy it for production
2607 purposes.  README.threads has more details, and is required
2608 reading if you enable threads.
2609 EOM
2610 case "$usethreads" in
2611 $define|true|[yY]*)     dflt='y';;
2612 *) dflt='n';;
2613 esac
2614 rp='Build a threading Perl?'
2615 . ./myread
2616 case "$ans" in
2617 y|Y)    val="$define" ;;
2618 *)      val="$undef" ;;
2619 esac
2620 set usethreads
2621 eval $setvar
2622
2623 case "$usethreads" in
2624 $define)
2625         $cat <<EOM
2626
2627 As of 5.5.640, Perl has two different internal threading implementations,
2628 the 5.005 version (5005threads) and an interpreter-based version
2629 (ithreads) that has one interpreter per thread.  Both are very 
2630 experimental.  This arrangement exists to help developers work out
2631 which one is better.
2632
2633 If you're a casual user, you probably don't want interpreter-threads
2634 at this time.  There doesn't yet exist a way to create threads from
2635 within Perl in this model, i.e., "use Thread;" will NOT work.
2636 EOM
2637         : Default to ithreads unless overridden on command line or with
2638         : old config.sh
2639         dflt='y'
2640         case "$use5005threads" in
2641                 $define|true|[yY]*) dflt='n';;
2642         esac
2643         case "$useithreads" in
2644                 $undef|false|[nN]*) dflt='n';;
2645         esac
2646         rp='Use interpreter-based ithreads?'
2647         . ./myread
2648         case "$ans" in
2649         y|Y)    val="$define" ;;
2650         *)      val="$undef" ;;
2651         esac
2652         set useithreads
2653         eval $setvar
2654         : Now set use5005threads to the opposite value.
2655         case "$useithreads" in
2656         $define) val="$undef" ;;
2657         *) val="$define" ;;
2658         esac
2659         set use5005threads
2660         eval $setvar
2661         ;;
2662 *)
2663         useithreads="$undef"
2664         use5005threads="$undef"
2665         ;;
2666 esac
2667
2668 case "$d_oldpthreads" in
2669 '')     : Configure tests would be welcome here.  For now, assume undef.
2670         val="$undef" ;;
2671 *)      val="$d_oldpthreads" ;;
2672 esac
2673 set d_oldpthreads
2674 eval $setvar
2675
2676
2677 case "$usethreads" in
2678 "$define"|true|[yY]*)
2679 : Look for a hint-file generated 'call-back-unit'.  If the
2680 : user has specified that a threading perl is to be built,
2681 : we may need to set or change some other defaults.
2682         if $test -f usethreads.cbu; then
2683                 echo "Your platform has some specific hints for threaded builds, using them..."
2684                 . ./usethreads.cbu
2685         else
2686                 $cat <<EOM
2687 (Your platform doesn't have any specific hints for threaded builds.
2688  Assuming POSIX threads, then.)
2689 EOM
2690         fi
2691         ;;
2692 esac
2693
2694 cat <<EOM
2695
2696 Perl can be built so that multiple Perl interpreters can coexist
2697 within the same Perl executable.
2698 EOM
2699
2700 case "$useithreads" in
2701 $define)
2702         cat <<EOM
2703 This multiple interpreter support is required for interpreter-based threads.
2704 EOM
2705         val="$define"
2706         ;;
2707 *)
2708         echo 'Normally you do not need this and you should answer no.'
2709         case "$usemultiplicity" in
2710         $define|true|[yY]*)     dflt='y';;
2711         *) dflt='n';;
2712         esac
2713         rp='Build Perl for multiplicity?'
2714         . ./myread
2715         case "$ans" in
2716         y|Y)    val="$define" ;;
2717         *)      val="$undef" ;;
2718         esac
2719         ;;
2720 esac
2721 set usemultiplicity
2722 eval $setvar
2723
2724 : determine where manual pages are on this system
2725 echo " "
2726 case "$sysman" in
2727 '') 
2728         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2729         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2730         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2731         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2732         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2733         sysman=`./loc . /usr/man/man1 $syspath`
2734         ;;
2735 esac
2736 if $test -d "$sysman"; then
2737         echo "System manual is in $sysman." >&4
2738 else
2739         echo "Could not find manual pages in source form." >&4
2740 fi
2741
2742 : see what memory models we can support
2743 case "$models" in
2744 '')
2745         $cat >pdp11.c <<'EOP'
2746 int main() {
2747 #ifdef pdp11
2748         exit(0);
2749 #else
2750         exit(1);
2751 #endif
2752 }
2753 EOP
2754         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2755         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2756                 dflt='unsplit split'
2757         else
2758                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2759                 case "$tans" in
2760                 X) dflt='none';;
2761                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2762                                 dflt='small'
2763                         else
2764                                 dflt=''
2765                         fi
2766                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2767                                 dflt="$dflt medium"
2768                         fi
2769                         if $test -d /lib/large || $test -d /usr/lib/large; then
2770                                 dflt="$dflt large"
2771                         fi
2772                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2773                                 dflt="$dflt huge"
2774                         fi
2775                 esac
2776         fi;;
2777 *) dflt="$models";;
2778 esac
2779 $cat <<EOM
2780  
2781 Some systems have different model sizes.  On most systems they are called
2782 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2783 split.  If your system doesn't support different memory models, say "none".
2784 If you wish to force everything to one memory model, say "none" here and
2785 put the appropriate flags later when it asks you for other cc and ld flags.
2786 Venix systems may wish to put "none" and let the compiler figure things out.
2787 (In the following question multiple model names should be space separated.)
2788
2789 The default for most systems is "none".
2790
2791 EOM
2792 rp="Which memory models are supported?"
2793 . ./myread
2794 models="$ans"
2795
2796 case "$models" in
2797 none)
2798         small=''
2799         medium=''
2800         large=''
2801         huge=''
2802         unsplit=''
2803         split=''
2804         ;;
2805 *split)
2806         case "$split" in
2807         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2808                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2809                         dflt='-i'
2810                 else
2811                         dflt='none'
2812                 fi;;
2813         *) dflt="$split";;
2814         esac
2815         rp="What flag indicates separate I and D space?"
2816         . ./myread
2817         tans="$ans"
2818         case "$tans" in
2819         none) tans='';;
2820         esac
2821         split="$tans"
2822         unsplit='';;
2823 *large*|*small*|*medium*|*huge*)
2824         case "$models" in
2825         *large*)
2826                 case "$large" in
2827                 '') dflt='-Ml';;
2828                 *) dflt="$large";;
2829                 esac
2830         rp="What flag indicates large model?"
2831         . ./myread
2832         tans="$ans"
2833         case "$tans" in
2834         none) tans='';
2835         esac
2836         large="$tans";;
2837         *) large='';;
2838         esac
2839         case "$models" in
2840         *huge*) case "$huge" in
2841                 '') dflt='-Mh';;
2842                 *) dflt="$huge";;
2843                 esac
2844                 rp="What flag indicates huge model?"
2845                 . ./myread
2846                 tans="$ans"
2847                 case "$tans" in
2848                 none) tans='';
2849                 esac
2850                 huge="$tans";;
2851         *) huge="$large";;
2852         esac
2853         case "$models" in
2854         *medium*) case "$medium" in
2855                 '') dflt='-Mm';;
2856                 *) dflt="$medium";;
2857                 esac
2858                 rp="What flag indicates medium model?"
2859                 . ./myread
2860                 tans="$ans"
2861                 case "$tans" in
2862                 none) tans='';
2863                 esac
2864                 medium="$tans";;
2865         *) medium="$large";;
2866         esac
2867         case "$models" in
2868         *small*) case "$small" in
2869                 '') dflt='none';;
2870                 *) dflt="$small";;
2871                 esac
2872                 rp="What flag indicates small model?"
2873                 . ./myread
2874                 tans="$ans"
2875                 case "$tans" in
2876                 none) tans='';
2877                 esac
2878                 small="$tans";;
2879         *) small='';;
2880         esac
2881         ;;
2882 *)
2883         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2884         ;;
2885 esac
2886 $rm -f pdp11.* pdp11
2887
2888 : make some quick guesses about what we are up against
2889 echo " "
2890 $echo $n "Hmm...  $c"
2891 echo exit 1 >bsd
2892 echo exit 1 >usg
2893 echo exit 1 >v7
2894 echo exit 1 >osf1
2895 echo exit 1 >eunice
2896 echo exit 1 >xenix
2897 echo exit 1 >venix
2898 echo exit 1 >os2
2899 d_bsd="$undef"
2900 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2901 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2902 then
2903         echo "Looks kind of like an OSF/1 system, but we'll see..."
2904         echo exit 0 >osf1
2905 elif test `echo abc | tr a-z A-Z` = Abc ; then
2906         xxx=`./loc addbib blurfl $pth`
2907         if $test -f $xxx; then
2908         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2909                 echo exit 0 >bsd
2910                 echo exit 0 >usg
2911         else
2912                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2913                         echo "Looks kind of like an extended USG system, but we'll see..."
2914                 else
2915                         echo "Looks kind of like a USG system, but we'll see..."
2916                 fi
2917                 echo exit 0 >usg
2918         fi
2919 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2920         echo "Looks kind of like a BSD system, but we'll see..."
2921         d_bsd="$define"
2922         echo exit 0 >bsd
2923 else
2924         echo "Looks kind of like a Version 7 system, but we'll see..."
2925         echo exit 0 >v7
2926 fi
2927 case "$eunicefix" in
2928 *unixtovms*)
2929         $cat <<'EOI'
2930 There is, however, a strange, musty smell in the air that reminds me of
2931 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2932 EOI
2933         echo exit 0 >eunice
2934         d_eunice="$define"
2935 : it so happens the Eunice I know will not run shell scripts in Unix format
2936         ;;
2937 *)
2938         echo " "
2939         echo "Congratulations.  You aren't running Eunice."
2940         d_eunice="$undef"
2941         ;;
2942 esac
2943 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2944 case "$p_" in
2945 :) ;;
2946 *)
2947         $cat <<'EOI'
2948 I have the feeling something is not exactly right, however...don't tell me...
2949 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2950 EOI
2951         echo exit 0 >os2
2952         ;;
2953 esac
2954 if test -f /xenix; then
2955         echo "Actually, this looks more like a XENIX system..."
2956         echo exit 0 >xenix
2957         d_xenix="$define"
2958 else
2959         echo " "
2960         echo "It's not Xenix..."
2961         d_xenix="$undef"
2962 fi
2963 chmod +x xenix
2964 $eunicefix xenix
2965 if test -f /venix; then
2966         echo "Actually, this looks more like a VENIX system..."
2967         echo exit 0 >venix
2968 else
2969         echo " "
2970         if ./xenix; then
2971                 : null
2972         else
2973                 echo "Nor is it Venix..."
2974         fi
2975 fi
2976 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2977 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2978 $rm -f foo
2979
2980 : see if we need a special compiler
2981 echo " "
2982 if ./usg; then
2983         case "$cc" in
2984         '') case "$Mcc" in
2985                 /*) dflt='Mcc';;
2986                 *) case "$large" in
2987                         -M*) dflt='cc';;
2988                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2989                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2990                                                 dflt='cc'
2991                                         else
2992                                                 dflt='cc -M'
2993                                         fi
2994                                 else
2995                                         dflt='cc'
2996                                 fi;;
2997                         esac;;
2998                 esac;;
2999         *)  dflt="$cc";;
3000         esac
3001         case "$dflt" in
3002         *M*)    $cat <<'EOM'
3003 On some older systems the default C compiler will not resolve multiple global
3004 references that happen to have the same name.  On some such systems the "Mcc"
3005 command may be used to force these to be resolved.  On other systems a "cc -M"
3006 command is required.  (Note that the -M flag on other systems indicates a
3007 memory model to use!) If you have the Gnu C compiler, you might wish to use
3008 that instead.
3009
3010 EOM
3011         ;;
3012         esac
3013         rp="Use which C compiler?"
3014         . ./myread
3015         cc="$ans"
3016 else
3017         case "$cc" in
3018         '') dflt=cc;;
3019         *) dflt="$cc";;
3020         esac
3021         rp="Use which C compiler?"
3022         . ./myread
3023         cc="$ans"
3024 fi
3025 : Look for a hint-file generated 'call-back-unit'.  Now that the
3026 : user has specified the compiler, we may need to set or change some
3027 : other defaults.
3028 if $test -f cc.cbu; then
3029     . ./cc.cbu
3030 fi
3031 echo " "
3032 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3033 $cat >gccvers.c <<EOM
3034 #include <stdio.h>
3035 int main() {
3036 #ifdef __GNUC__
3037 #ifdef __VERSION__
3038         printf("%s\n", __VERSION__);
3039 #else
3040         printf("%s\n", "1");
3041 #endif
3042 #endif
3043         exit(0);
3044 }
3045 EOM
3046 if $cc -o gccvers gccvers.c; then
3047         gccversion=`./gccvers`
3048         case "$gccversion" in
3049         '') echo "You are not using GNU cc." ;;
3050         *)  echo "You are using GNU cc $gccversion."
3051             ;;
3052         esac
3053 else
3054         echo " "
3055         echo "*** WHOA THERE!!! ***" >&4
3056         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3057         case "$knowitall" in
3058         '')
3059         echo "    You'd better start hunting for one and let me know about it." >&4
3060                 exit 1
3061                 ;;
3062         esac
3063 fi
3064 $rm -f gccvers*
3065 case "$gccversion" in
3066 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3067 esac
3068
3069 : decide how portable to be.  Allow command line overrides.
3070 case "$d_portable" in
3071 "$undef") ;;
3072 *)      d_portable="$define" ;;
3073 esac
3074
3075 : set up shell script to do ~ expansion
3076 cat >filexp <<EOSS
3077 $startsh
3078 : expand filename
3079 case "\$1" in
3080  ~/*|~)
3081         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3082         ;;
3083  ~*)
3084         if $test -f /bin/csh; then
3085                 /bin/csh -f -c "glob \$1"
3086                 failed=\$?
3087                 echo ""
3088                 exit \$failed
3089         else
3090                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3091                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3092                 if $test ! -d "\$dir"; then
3093                         me=\`basename \$0\`
3094                         echo "\$me: can't locate home directory for: \$name" >&2
3095                         exit 1
3096                 fi
3097                 case "\$1" in
3098                 */*)
3099                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3100                         ;;
3101                 *)
3102                         echo \$dir
3103                         ;;
3104                 esac
3105         fi
3106         ;;
3107 *)
3108         echo \$1
3109         ;;
3110 esac
3111 EOSS
3112 chmod +x filexp
3113 $eunicefix filexp
3114
3115 : now set up to get a file name
3116 cat <<EOS >getfile
3117 $startsh
3118 EOS
3119 cat <<'EOSC' >>getfile
3120 tilde=''
3121 fullpath=''
3122 already=''
3123 skip=''
3124 none_ok=''
3125 exp_file=''
3126 nopath_ok=''
3127 orig_rp="$rp"
3128 orig_dflt="$dflt"
3129 case "$gfpth" in
3130 '') gfpth='.' ;;
3131 esac
3132
3133 case "$fn" in
3134 *\(*)
3135         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3136         fn=`echo $fn | sed 's/(.*)//'`
3137         ;;
3138 esac
3139
3140 case "$fn" in
3141 *:*)
3142         loc_file=`expr $fn : '.*:\(.*\)'`
3143         fn=`expr $fn : '\(.*\):.*'`
3144         ;;
3145 esac
3146
3147 case "$fn" in
3148 *~*) tilde=true;;
3149 esac
3150 case "$fn" in
3151 */*) fullpath=true;;
3152 esac
3153 case "$fn" in
3154 *+*) skip=true;;
3155 esac
3156 case "$fn" in
3157 *n*) none_ok=true;;
3158 esac
3159 case "$fn" in
3160 *e*) exp_file=true;;
3161 esac
3162 case "$fn" in
3163 *p*) nopath_ok=true;;
3164 esac
3165
3166 case "$fn" in
3167 *f*) type='File';;
3168 *d*) type='Directory';;
3169 *l*) type='Locate';;
3170 esac
3171
3172 what="$type"
3173 case "$what" in
3174 Locate) what='File';;
3175 esac
3176
3177 case "$exp_file" in
3178 '')
3179         case "$d_portable" in
3180         "$define") ;;
3181         *) exp_file=true;;
3182         esac
3183         ;;
3184 esac
3185
3186 cd ..
3187 while test "$type"; do
3188         redo=''
3189         rp="$orig_rp"
3190         dflt="$orig_dflt"
3191         case "$tilde" in
3192         true) rp="$rp (~name ok)";;
3193         esac
3194         . UU/myread
3195         if test -f UU/getfile.ok && \
3196                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3197         then
3198                 value="$ans"
3199                 ansexp="$ans"
3200                 break
3201         fi
3202         case "$ans" in
3203         none)
3204                 value=''
3205                 ansexp=''
3206                 case "$none_ok" in
3207                 true) type='';;
3208                 esac
3209                 ;;
3210         *)
3211                 case "$tilde" in
3212                 '') value="$ans"
3213                         ansexp="$ans";;
3214                 *)
3215                         value=`UU/filexp $ans`
3216                         case $? in
3217                         0)
3218                                 if test "$ans" != "$value"; then
3219                                         echo "(That expands to $value on this system.)"
3220                                 fi
3221                                 ;;
3222                         *) value="$ans";;
3223                         esac
3224                         ansexp="$value"
3225                         case "$exp_file" in
3226                         '') value="$ans";;
3227                         esac
3228                         ;;
3229                 esac
3230                 case "$fullpath" in
3231                 true)
3232                         case "$ansexp" in
3233                         /*) value="$ansexp" ;;
3234                         *)
3235                                 redo=true
3236                                 case "$already" in
3237                                 true)
3238                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3239                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3240                                         ;;
3241                                 *)
3242                                 echo "Please give a full path name, starting with slash." >&4
3243                                         case "$tilde" in
3244                                         true)
3245                                 echo "Note that using ~name is ok provided it expands well." >&4
3246                                                 already=true
3247                                                 ;;
3248                                         esac
3249                                 esac
3250                                 ;;
3251                         esac
3252                         ;;
3253                 esac
3254                 case "$redo" in
3255                 '')
3256                         case "$type" in
3257                         File)
3258                                 for fp in $gfpth; do
3259                                         if test "X$fp" = X.; then
3260                                             pf="$ansexp"
3261                                         else    
3262                                             pf="$fp/$ansexp"
3263                                         fi
3264                                         if test -f "$pf"; then
3265                                                 type=''
3266                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3267                                         then
3268                                                 echo "($value is not a plain file, but that's ok.)"
3269                                                 type=''
3270                                         fi
3271                                         if test X"$type" = X; then
3272                                             value="$pf"
3273                                             break
3274                                         fi
3275                                 done
3276                                 ;;
3277                         Directory)
3278                                 for fp in $gfpth; do
3279                                         if test "X$fp" = X.; then
3280                                             pf="$ansexp"
3281                                         else    
3282                                             pf="$fp/$ansexp"
3283                                         fi
3284                                         if test -d "$pf"; then
3285                                                 type=''
3286                                                 value="$pf"
3287                                                 break
3288                                         fi
3289                                 done
3290                                 ;;
3291                         Locate)
3292                                 if test -d "$ansexp"; then
3293                                         echo "(Looking for $loc_file in directory $value.)"
3294                                         value="$value/$loc_file"
3295                                         ansexp="$ansexp/$loc_file"
3296                                 fi
3297                                 if test -f "$ansexp"; then
3298                                         type=''
3299                                 fi
3300                                 case "$nopath_ok" in
3301                                 true)   case "$value" in
3302                                         */*) ;;
3303                                         *)      echo "Assuming $value will be in people's path."
3304                                                 type=''
3305                                                 ;;
3306                                         esac
3307                                         ;;
3308                                 esac
3309                                 ;;
3310                         esac
3311
3312                         case "$skip" in
3313                         true) type='';
3314                         esac
3315
3316                         case "$type" in
3317                         '') ;;
3318                         *)
3319                                 if test "$fastread" = yes; then
3320                                         dflt=y
3321                                 else
3322                                         dflt=n
3323                                 fi
3324                                 rp="$what $value doesn't exist.  Use that name anyway?"
3325                                 . UU/myread
3326                                 dflt=''
3327                                 case "$ans" in
3328                                 y*) type='';;
3329                                 *) echo " ";;
3330                                 esac
3331                                 ;;
3332                         esac
3333                         ;;
3334                 esac
3335                 ;;
3336         esac
3337 done
3338 cd UU
3339 ans="$value"
3340 rp="$orig_rp"
3341 dflt="$orig_dflt"
3342 rm -f getfile.ok
3343 test "X$gfpthkeep" != Xy && gfpth=""
3344 EOSC
3345
3346 : What should the include directory be ?
3347 echo " "
3348 $echo $n "Hmm...  $c"
3349 dflt='/usr/include'
3350 incpath=''
3351 mips_type=''
3352 if $test -f /bin/mips && /bin/mips; then
3353         echo "Looks like a MIPS system..."
3354         $cat >usr.c <<'EOCP'
3355 #ifdef SYSTYPE_BSD43
3356 /bsd43
3357 #endif
3358 EOCP
3359         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3360                 dflt='/bsd43/usr/include'
3361                 incpath='/bsd43'
3362                 mips_type='BSD 4.3'
3363         else
3364                 mips_type='System V'
3365         fi
3366         $rm -f usr.c usr.out
3367         echo "and you're compiling with the $mips_type compiler and libraries."
3368         xxx_prompt=y
3369         echo "exit 0" >mips
3370 else
3371         echo "Doesn't look like a MIPS system."
3372         xxx_prompt=n
3373         echo "exit 1" >mips
3374 fi
3375 chmod +x mips
3376 $eunicefix mips
3377 case "$usrinc" in
3378 '') ;;
3379 *) dflt="$usrinc";;
3380 esac
3381 case "$xxx_prompt" in
3382 y)      fn=d/
3383         echo " "
3384         rp='Where are the include files you want to use?'
3385         . ./getfile
3386         usrinc="$ans"
3387         ;;
3388 *)      usrinc="$dflt"
3389         ;;
3390 esac
3391
3392 : see how we invoke the C preprocessor
3393 echo " "
3394 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3395 cat <<'EOT' >testcpp.c
3396 #define ABC abc
3397 #define XYZ xyz
3398 ABC.XYZ
3399 EOT
3400 cd ..
3401 if test ! -f cppstdin; then
3402         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3403                 # AIX cc -E doesn't show the absolute headerfile
3404                 # locations but we'll cheat by using the -M flag.
3405                 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
3406         else
3407                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3408         fi
3409 else
3410         echo "Keeping your $hint cppstdin wrapper."
3411 fi
3412 chmod 755 cppstdin
3413 wrapper=`pwd`/cppstdin
3414 ok='false'
3415 cd UU
3416
3417 if $test "X$cppstdin" != "X" && \
3418         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3419         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3420 then
3421         echo "You used to use $cppstdin $cppminus so we'll use that again."
3422         case "$cpprun" in
3423         '') echo "But let's see if we can live without a wrapper..." ;;
3424         *)
3425                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3426                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3427                 then
3428                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3429                         ok='true'
3430                 else
3431                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3432                 fi
3433                 ;;
3434         esac
3435 else
3436         case "$cppstdin" in
3437         '') ;;
3438         *)
3439                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3440                 ;;
3441         esac
3442 fi
3443
3444 if $ok; then
3445         : nothing
3446 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3447         $cc -E <testcpp.c >testcpp.out 2>&1; \
3448         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3449         echo "Yup, it does."
3450         x_cpp="$cc -E"
3451         x_minus='';
3452 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3453         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3454         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3455         echo "Yup, it does."
3456         x_cpp="$cc -E"
3457         x_minus='-';
3458 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3459         $cc -P <testcpp.c >testcpp.out 2>&1; \
3460         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3461         echo "Yipee, that works!"
3462         x_cpp="$cc -P"
3463         x_minus='';
3464 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3465         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3466         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3467         echo "At long last!"
3468         x_cpp="$cc -P"
3469         x_minus='-';
3470 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3471         $cpp <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "It works!"
3474         x_cpp="$cpp"
3475         x_minus='';
3476 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3477         $cpp - <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Hooray, it works!  I was beginning to wonder."
3480         x_cpp="$cpp"
3481         x_minus='-';
3482 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3483         $wrapper <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         x_cpp="$wrapper"
3486         x_minus=''
3487         echo "Eureka!"
3488 else
3489         dflt=''
3490         rp="No dice.  I can't find a C preprocessor.  Name one:"
3491         . ./myread
3492         x_cpp="$ans"
3493         x_minus=''
3494         $x_cpp <testcpp.c >testcpp.out 2>&1
3495         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496                 echo "OK, that will do." >&4
3497         else
3498 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3499                 exit 1
3500         fi
3501 fi
3502
3503 case "$ok" in
3504 false)
3505         cppstdin="$x_cpp"
3506         cppminus="$x_minus"
3507         cpprun="$x_cpp"
3508         cpplast="$x_minus"
3509         set X $x_cpp
3510         shift
3511         case "$1" in
3512         "$cpp")
3513                 echo "Perhaps can we force $cc -E using a wrapper..."
3514                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3515                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3516                 then
3517                         echo "Yup, we can."
3518                         cppstdin="$wrapper"
3519                         cppminus='';
3520                 else
3521                         echo "Nope, we'll have to live without it..."
3522                 fi
3523                 ;;
3524         esac
3525         case "$cpprun" in
3526         "$wrapper")
3527                 cpprun=''
3528                 cpplast=''
3529                 ;;
3530         esac
3531         ;;
3532 esac
3533
3534 case "$cppstdin" in
3535 "$wrapper"|'cppstdin') ;;
3536 *) $rm -f $wrapper;;
3537 esac
3538 $rm -f testcpp.c testcpp.out
3539
3540 : Set private lib path
3541 case "$plibpth" in
3542 '') if ./mips; then
3543                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3544         fi;;
3545 esac
3546 case "$libpth" in
3547 ' ') dlist='';;
3548 '') dlist="$loclibpth $plibpth $glibpth";;
3549 *) dlist="$libpth";;
3550 esac
3551
3552 : Now check and see which directories actually exist, avoiding duplicates
3553 libpth=''
3554 for xxx in $dlist
3555 do
3556     if $test -d $xxx; then
3557                 case " $libpth " in
3558                 *" $xxx "*) ;;
3559                 *) libpth="$libpth $xxx";;
3560                 esac
3561     fi
3562 done
3563 $cat <<'EOM'
3564
3565 Some systems have incompatible or broken versions of libraries.  Among
3566 the directories listed in the question below, please remove any you
3567 know not to be holding relevant libraries, and add any that are needed.
3568 Say "none" for none.
3569
3570 EOM
3571 case "$libpth" in
3572 '') dflt='none';;
3573 *)
3574         set X $libpth
3575         shift
3576         dflt=${1+"$@"}
3577         ;;
3578 esac
3579 rp="Directories to use for library searches?"
3580 . ./myread
3581 case "$ans" in
3582 none) libpth=' ';;
3583 *) libpth="$ans";;
3584 esac
3585
3586 : compute shared library extension
3587 case "$so" in
3588 '')
3589         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3590                 dflt='sl'
3591         else
3592                 dflt='so'
3593         fi
3594         ;;
3595 *) dflt="$so";;
3596 esac
3597 $cat <<EOM
3598
3599 On some systems, shared libraries may be available.  Answer 'none' if
3600 you want to suppress searching of shared libraries for the remainder
3601 of this configuration.
3602
3603 EOM
3604 rp='What is the file extension used for shared libraries?'
3605 . ./myread
3606 so="$ans"
3607
3608 : Define several unixisms.
3609 : Hints files or command line option can be used to override them.
3610 : The convoluted testing is in case hints files set either the old
3611 : or the new name.
3612 case "$_exe" in
3613 '')     case "$exe_ext" in
3614     '') ;;
3615         *)      _exe="$exe_ext" ;;
3616         esac
3617         ;;
3618 esac
3619 case "$_a" in
3620 '')     case "$lib_ext" in
3621     '') _a='.a';;
3622         *)      _a="$lib_ext" ;;
3623         esac
3624         ;;
3625 esac
3626 case "$_o" in
3627 '') case "$obj_ext" in
3628         '')     _o='.o';;
3629         *)      _o="$obj_ext";;
3630         esac
3631         ;;
3632 esac
3633 case "$p_" in
3634 '') case "$path_sep" in
3635         '')     p_=':';;
3636         *)      p_="$path_sep";;
3637         esac
3638         ;;
3639 esac
3640 exe_ext=$_exe
3641 lib_ext=$_a
3642 obj_ext=$_o
3643 path_sep=$p_
3644
3645 : Which makefile gets called first.  This is used by make depend.
3646 case "$firstmakefile" in
3647 '') firstmakefile='makefile';;
3648 esac
3649
3650 cat <<EOM
3651
3652 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3653 Configure must be run with -Dusesocks.
3654
3655 Normally you do not need this and you should answer no.
3656
3657 EOM
3658 case "$usesocks" in
3659 $define|true|[yY]*)     dflt='y';;
3660 *) dflt='n';;
3661 esac
3662 rp='Build Perl for SOCKS?'
3663 . ./myread
3664 case "$ans" in
3665 y|Y)    val="$define" ;;     
3666 *)      val="$undef" ;;
3667 esac
3668 set usesocks
3669 eval $setvar
3670
3671 : Looking for optional libraries
3672 echo " "
3673 echo "Checking for optional libraries..." >&4
3674 case "$libs" in
3675 ' '|'') dflt='';;
3676 *) dflt="$libs";;
3677 esac
3678 case "$libswanted" in
3679 '') libswanted='c_s';;
3680 esac
3681 case "$usesocks" in
3682 $define)
3683         libswanted="$libswanted socks5 socks5_sh"
3684         ;;
3685 esac
3686 for thislib in $libswanted; do
3687         
3688         libname="$thislib"
3689         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3690                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3691                 libstyle=shared
3692         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3693                 libstyle=shared
3694         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3695                 libstyle=static
3696         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3697                 libstyle=static
3698         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3699                 libstyle=static
3700                 libname=${thislib}_s
3701         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3702                 libstyle="static"
3703         fi
3704         if $test -f "$xxx"; then
3705                 eval $libscheck
3706         fi
3707         if $test -f "$xxx"; then
3708                 case "$libstyle" in
3709                 shared) echo "Found -l$libname (shared)." ;;
3710                 static) echo "Found -l$libname." ;;
3711                 *)      echo "Found -l$libname ($libstyle)." ;;
3712                 esac
3713                 case " $dflt " in
3714                 *"-l$thislib "*);;
3715                 *) dflt="$dflt -l$libname"
3716                    libsfound="$libsfound $xxx"
3717                    yyy=`basename $xxx`
3718                    libsfiles="$libsfiles $yyy"
3719                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3720                    case " $libsdirs " in
3721                    *" $yyy "*) ;;
3722                    *) libsdirs="$libsdirs $yyy" ;;
3723                    esac
3724                    ;;
3725                 esac
3726         else
3727                 echo "No -l$thislib."
3728         fi
3729 done
3730 set X $dflt
3731 shift
3732 dflt="$*"
3733 case "$libs" in
3734 '') dflt="$dflt";;
3735 *) dflt="$libs";;
3736 esac
3737 case "$dflt" in
3738 ' '|'') dflt='none';;
3739 esac
3740
3741 $cat <<EOM
3742
3743 In order to compile $package on your machine, a number of libraries
3744 are usually needed.  Include any other special libraries here as well.
3745 Say "none" for none.  The default list is almost always right.
3746 EOM
3747
3748 echo " "
3749 rp="What libraries to use?"
3750 . ./myread
3751 case "$ans" in
3752 none) libs=' ';;
3753 *) libs="$ans";;
3754 esac
3755
3756 : determine optimization, if desired, or use for debug flag also
3757 case "$optimize" in
3758 ' '|$undef) dflt='none';;
3759 '') dflt='-O';;
3760 *) dflt="$optimize";;
3761 esac
3762 $cat <<EOH
3763
3764 By default, $package compiles with the -O flag to use the optimizer.
3765 Alternately, you might want to use the symbolic debugger, which uses
3766 the -g flag (on traditional Unix systems).  Either flag can be
3767 specified here.  To use neither flag, specify the word "none".
3768
3769 EOH
3770 rp="What optimizer/debugger flag should be used?"
3771 . ./myread
3772 optimize="$ans"
3773 case "$optimize" in
3774 'none') optimize=" ";;
3775 esac
3776
3777 dflt=''
3778 : We will not override a previous value, but we might want to
3779 : augment a hint file
3780 case "$hint" in
3781 default|recommended)
3782         case "$gccversion" in
3783         1*) dflt='-fpcc-struct-return' ;;
3784         esac
3785         case "$optimize" in
3786         *-g*) dflt="$dflt -DDEBUGGING";;
3787         esac
3788         case "$gccversion" in
3789         2*) if test -d /etc/conf/kconfig.d &&
3790                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3791                 then
3792                         dflt="$dflt -posix"
3793                 fi
3794                 ;;
3795         esac
3796         case "$gccversion" in
3797         1*) ;;
3798         2.[0-8]*) ;;
3799         ?*)     echo " "
3800                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3801                 echo 'int main(void) { return 0; }' > gcctest.c
3802                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3803                         echo "Yes, it does." 2>&1
3804                         case "$ccflags" in
3805                         *strict-aliasing*) 
3806                                 echo "Leaving current flags $ccflags alone." 2>&1
3807                                 ;;
3808                         *) dflt="$dflt -fno-strict-aliasing" ;;
3809                         esac
3810                 else
3811                         echo "Nope, it doesn't, but that's ok." 2>&1
3812                 fi
3813                 ;;
3814         esac
3815         ;;
3816 esac
3817
3818 case "$mips_type" in
3819 *BSD*|'') inclwanted="$locincpth $usrinc";;
3820 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3821 esac
3822 for thisincl in $inclwanted; do
3823         if $test -d $thisincl; then
3824                 if $test x$thisincl != x$usrinc; then
3825                         case "$dflt" in
3826                         *$thisincl*);;
3827                         *) dflt="$dflt -I$thisincl";;
3828                         esac
3829                 fi
3830         fi
3831 done
3832
3833 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3834         xxx=true;
3835 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3836         xxx=true;
3837 else
3838         xxx=false;
3839 fi;
3840 if $xxx; then
3841         case "$dflt" in
3842         *$2*);;
3843         *) dflt="$dflt -D$2";;
3844         esac;
3845 fi'
3846
3847 set signal.h LANGUAGE_C; eval $inctest
3848
3849 case "$usesocks" in
3850 $define)
3851         ccflags="$ccflags -DSOCKS"
3852         ;;
3853 esac
3854
3855 case "$hint" in
3856 default|recommended) dflt="$ccflags $dflt" ;;
3857 *) dflt="$ccflags";;
3858 esac
3859
3860 case "$dflt" in
3861 ''|' ') dflt=none;;
3862 esac
3863 $cat <<EOH
3864
3865 Your C compiler may want other flags.  For this question you should include
3866 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3867 but you should NOT include libraries or ld flags like -lwhatever.  If you
3868 want $package to honor its debug switch, you should include -DDEBUGGING here.
3869 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3870
3871 To use no flags, specify the word "none".
3872
3873 EOH
3874 set X $dflt
3875 shift
3876 dflt=${1+"$@"}
3877 rp="Any additional cc flags?"
3878 . ./myread
3879 case "$ans" in
3880 none) ccflags='';;
3881 *) ccflags="$ans";;
3882 esac
3883
3884 : the following weeds options from ccflags that are of no interest to cpp
3885 cppflags="$ccflags"
3886 case "$gccversion" in
3887 1*) cppflags="$cppflags -D__GNUC__"
3888 esac
3889 case "$mips_type" in
3890 '');;
3891 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3892 esac
3893 case "$cppflags" in
3894 '');;
3895 *)
3896         echo " "
3897         echo "Let me guess what the preprocessor flags are..." >&4
3898         set X $cppflags
3899         shift
3900         cppflags=''
3901         $cat >cpp.c <<'EOM'
3902 #define BLURFL foo
3903
3904 BLURFL xx LFRULB
3905 EOM
3906         previous=''
3907         for flag in $*
3908         do
3909                 case "$flag" in
3910                 -*) ftry="$flag";;
3911                 *) ftry="$previous $flag";;
3912                 esac
3913                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3914                         >cpp1.out 2>/dev/null && \
3915                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3916                         >cpp2.out 2>/dev/null && \
3917                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3918                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3919                 then
3920                         cppflags="$cppflags $ftry"
3921                         previous=''
3922                 else
3923                         previous="$flag"
3924                 fi
3925         done
3926         set X $cppflags
3927         shift
3928         cppflags=${1+"$@"}
3929         case "$cppflags" in
3930         *-*)  echo "They appear to be: $cppflags";;
3931         esac
3932         $rm -f cpp.c cpp?.out
3933         ;;
3934 esac
3935
3936 : flags used in final linking phase
3937 case "$ldflags" in
3938 '') if ./venix; then
3939                 dflt='-i -z'
3940         else
3941                 dflt=''
3942         fi
3943         case "$ccflags" in
3944         *-posix*) dflt="$dflt -posix" ;;
3945         esac
3946         ;;
3947 *) dflt="$ldflags";;
3948 esac
3949
3950 : Try to guess additional flags to pick up local libraries.
3951 for thislibdir in $libpth; do
3952         case " $loclibpth " in
3953         *" $thislibdir "*)
3954                 case "$dflt " in 
3955                 *"-L$thislibdir "*) ;;
3956                 *)  dflt="$dflt -L$thislibdir" ;;
3957                 esac
3958                 ;;
3959         esac
3960 done
3961
3962 case "$dflt" in
3963 '') dflt='none' ;;
3964 esac
3965
3966 $cat <<EOH
3967
3968 Your C linker may need flags.  For this question you should
3969 include -L/whatever and any other flags used by the C linker, but you
3970 should NOT include libraries like -lwhatever.
3971
3972 Make sure you include the appropriate -L/path flags if your C linker
3973 does not normally search all of the directories you specified above,
3974 namely
3975         $libpth
3976 To use no flags, specify the word "none".
3977
3978 EOH
3979
3980 rp="Any additional ld flags (NOT including libraries)?"
3981 . ./myread
3982 case "$ans" in
3983 none) ldflags='';;
3984 *) ldflags="$ans";;
3985 esac
3986 rmlist="$rmlist pdp11"
3987
3988 : coherency check
3989 echo " "
3990 echo "Checking your choice of C compiler and flags for coherency..." >&4
3991 $cat > try.c <<'EOF'
3992 #include <stdio.h>
3993 int main() { printf("Ok\n"); exit(0); }
3994 EOF
3995 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3996 shift
3997 $cat >try.msg <<'EOM'
3998 I've tried to compile and run the following simple program:
3999
4000 EOM
4001 $cat try.c >> try.msg
4002
4003 $cat >> try.msg <<EOM
4004
4005 I used the command:
4006
4007         $*
4008         ./try
4009
4010 and I got the following output:
4011
4012 EOM
4013 dflt=y
4014 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4015         if sh -c './try' >>try.msg 2>&1; then
4016                 xxx=`./try`
4017                 case "$xxx" in
4018                 "Ok") dflt=n ;;
4019                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4020                         case " $libs " in
4021                         *" -lsfio "*)
4022                                 cat >> try.msg <<'EOQS'
4023 If $libs contains -lsfio, and sfio is mis-configured, then it
4024 sometimes (apparently) runs and exits with a 0 status, but with no
4025 output!  It may have to do with sfio's use of _exit vs. exit.
4026
4027 EOQS
4028                                 rp="You have a big problem.  Shall I abort Configure"
4029                                 dflt=y
4030                                 ;;
4031                         esac
4032                         ;;
4033                 esac
4034         else
4035                 echo "The program compiled OK, but exited with status $?." >>try.msg
4036                 rp="You have a problem.  Shall I abort Configure"
4037                 dflt=y
4038         fi
4039 else
4040         echo "I can't compile the test program." >>try.msg
4041         rp="You have a BIG problem.  Shall I abort Configure"
4042         dflt=y
4043 fi
4044 case "$dflt" in
4045 y)
4046         $cat try.msg >&4
4047         case "$knowitall" in
4048         '')
4049                 echo "(The supplied flags or libraries might be incorrect.)"
4050                 ;;
4051         *) dflt=n;;
4052         esac
4053         echo " "
4054         . ./myread
4055         case "$ans" in
4056         n*|N*) ;;
4057         *)      echo "Ok.  Stopping Configure." >&4
4058                 exit 1
4059                 ;;
4060         esac
4061         ;;
4062 n) echo "OK, that should do.";;
4063 esac
4064 $rm -f try try.* core
4065
4066 : define an is-a-typedef? function
4067 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4068 case "$inclist" in
4069 "") inclist="sys/types.h";;
4070 esac;
4071 eval "varval=\$$var";
4072 case "$varval" in
4073 "")
4074         $rm -f temp.c;
4075         for inc in $inclist; do
4076                 echo "#include <$inc>" >>temp.c;
4077         done;
4078         echo "#ifdef $type" >> temp.c;
4079         echo "printf(\"We have $type\");" >> temp.c;
4080         echo "#endif" >> temp.c;
4081         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4082         if $contains $type temp.E >/dev/null 2>&1; then
4083                 eval "$var=\$type";
4084         else
4085                 eval "$var=\$def";
4086         fi;
4087         $rm -f temp.?;;
4088 *) eval "$var=\$varval";;
4089 esac'
4090
4091 : define an is-a-typedef? function that prompts if the type is not available.
4092 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4093 case "$inclist" in
4094 "") inclist="sys/types.h";;
4095 esac;
4096 eval "varval=\$$var";
4097 case "$varval" in
4098 "")
4099         $rm -f temp.c;
4100         for inc in $inclist; do
4101                 echo "#include <$inc>" >>temp.c;
4102         done;
4103         echo "#ifdef $type" >> temp.c;
4104         echo "printf(\"We have $type\");" >> temp.c;
4105         echo "#endif" >> temp.c;
4106         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4107         echo " " ;
4108         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4109         if $contains $type temp.E >/dev/null 2>&1; then
4110                 echo "$type found." >&4;
4111                 eval "$var=\$type";
4112         else
4113                 echo "$type NOT found." >&4;
4114                 dflt="$def";
4115                 . ./myread ;
4116                 eval "$var=\$ans";
4117         fi;
4118         $rm -f temp.?;;
4119 *) eval "$var=\$varval";;
4120 esac'
4121
4122 : define a shorthand compile call
4123 compile='
4124 mc_file=$1;
4125 shift;
4126 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4127 : define a shorthand compile call for compilations that should be ok.
4128 compile_ok='
4129 mc_file=$1;
4130 shift;
4131 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4132
4133 : check for lengths of integral types
4134 echo " "
4135 case "$intsize" in
4136 '')
4137         echo "Checking to see how big your integers are..." >&4
4138         $cat >intsize.c <<'EOCP'
4139 #include <stdio.h>
4140 int main()
4141 {
4142         printf("intsize=%d;\n", (int)sizeof(int));
4143         printf("longsize=%d;\n", (int)sizeof(long));
4144         printf("shortsize=%d;\n", (int)sizeof(short));
4145         exit(0);
4146 }
4147 EOCP
4148         set intsize
4149         if eval $compile_ok && ./intsize > /dev/null; then
4150                 eval `./intsize`
4151                 echo "Your integers are $intsize bytes long."
4152                 echo "Your long integers are $longsize bytes long."
4153                 echo "Your short integers are $shortsize bytes long."
4154         else
4155                 $cat >&4 <<EOM
4156 !
4157 Help! I can't compile and run the intsize test program: please enlighten me!
4158 (This is probably a misconfiguration in your system or libraries, and
4159 you really ought to fix it.  Still, I'll try anyway.)
4160 !
4161 EOM
4162                 dflt=4
4163                 rp="What is the size of an integer (in bytes)?"
4164                 . ./myread
4165                 intsize="$ans"
4166                 dflt=$intsize
4167                 rp="What is the size of a long integer (in bytes)?"
4168                 . ./myread
4169                 longsize="$ans"
4170                 dflt=2
4171                 rp="What is the size of a short integer (in bytes)?"
4172                 . ./myread
4173                 shortsize="$ans"
4174         fi
4175         ;;
4176 esac
4177 $rm -f intsize intsize.*
4178
4179 : see what type lseek is declared as in the kernel
4180 rp="What is the type used for lseek's offset on this system?"
4181 set off_t lseektype long stdio.h sys/types.h
4182 eval $typedef_ask
4183
4184 echo " "
4185 $echo $n "Checking to see how big your file offsets are...$c" >&4
4186 $cat >try.c <<EOCP
4187 #include <sys/types.h>
4188 #include <stdio.h>
4189 int main()
4190 {
4191     printf("%d\n", (int)sizeof($lseektype));
4192     return(0); 
4193 }
4194 EOCP
4195 set try
4196 if eval $compile_ok; then
4197         lseeksize=`./try`
4198         $echo " $lseeksize bytes." >&4
4199 else
4200         dflt=$longsize
4201         echo " "
4202         echo "(I can't seem to compile the test program.  Guessing...)"
4203         rp="What is the size of your file offsets (in bytes)?"
4204         . ./myread
4205         lseeksize="$ans"
4206 fi
4207 $rm -f try.c try
4208
4209 : see what type file positions are declared as in the library
4210 rp="What is the type for file position used by fsetpos()?"
4211 set fpos_t fpostype long stdio.h sys/types.h
4212 eval $typedef_ask
4213
4214 echo " "
4215 case "$fpostype" in
4216 *_t) zzz="$fpostype"    ;;
4217 *)   zzz="fpos_t"       ;;
4218 esac
4219 $echo $n "Checking the size of $zzz...$c" >&4 
4220 cat > try.c <<EOCP
4221 #include <sys/types.h>
4222 #include <stdio.h>
4223 int main() {
4224     printf("%d\n", (int)sizeof($fpostype));
4225     exit(0);
4226 }
4227 EOCP
4228 set try
4229 if eval $compile_ok; then
4230         yyy=`./try`
4231         case "$yyy" in
4232         '')     fpossize=4
4233                 echo " "
4234                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4235                 ;;
4236         *)      fpossize=$yyy
4237                 echo " $fpossize bytes."
4238                 ;;
4239         esac
4240 else
4241         dflt="$longsize"
4242         echo " "
4243         echo "(I can't compile the test program.  Guessing...)" >&4
4244         rp="What is the size of your file positions (in bytes)?"
4245         . ./myread
4246         fpossize="$ans"
4247 fi
4248
4249
4250
4251 case "$lseeksize:$fpossize" in
4252 8:8) cat <<EOM
4253
4254 You can have files larger than 2 gigabytes.
4255 EOM
4256    val="$define" ;;
4257 *) cat <<EOM
4258
4259 Perl can be built to understand large files (files larger than 2 gigabytes)
4260 on some systems.  To do so, Configure must be run with -Duselargefiles.
4261
4262 If this doesn't make any sense to you, just accept the default 'y'.
4263 EOM
4264    case "$uselargefiles" in
4265    "$undef"|false|[nN]*) dflt='n' ;;
4266    *)   dflt='y' ;;
4267    esac
4268    rp='Try to understand large files, if available?'
4269    . ./myread
4270    case "$ans" in
4271    y|Y)         val="$define" ;;
4272    *)           val="$undef"  ;;
4273    esac
4274    ;;
4275 esac
4276 set uselargefiles
4277 eval $setvar
4278 case "$uselargefiles" in
4279 "$define")
4280 : Look for a hint-file generated 'call-back-unit'.  If the
4281 : user has specified that a large files perl is to be built,
4282 : we may need to set or change some other defaults.
4283         if $test -f uselfs.cbu; then
4284                 echo "Your platform has some specific hints for large file builds, using them..."
4285                 . ./uselfs.cbu
4286                 echo " "
4287                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4288                 $cat >try.c <<EOCP
4289 #include <sys/types.h>
4290 #include <stdio.h>
4291 int main()
4292 {
4293     printf("%d\n", (int)sizeof($lseektype));
4294     return(0); 
4295 }
4296 EOCP
4297                 set try
4298                 if eval $compile_ok; then
4299                         lseeksize=`./try`
4300                         $echo " $lseeksize bytes." >&4
4301                 else
4302                         dflt="$lseeksize"
4303                         echo " "
4304                         echo "(I can't seem to compile the test program.  Guessing...)"
4305                         rp="What is the size of your file offsets (in bytes)?"
4306                         . ./myread
4307                         lseeksize="$ans"
4308                 fi
4309                 case "$fpostype" in
4310                 *_t) zzz="$fpostype"    ;;
4311                 *)   zzz="fpos_t"       ;;
4312                 esac
4313                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4314                 $cat > try.c <<EOCP
4315 #include <sys/types.h>
4316 #include <stdio.h>
4317 int main() {
4318     printf("%d\n", (int)sizeof($fpostype));
4319     exit(0);
4320 }
4321 EOCP
4322                 set try
4323                 if eval $compile_ok; then
4324                         yyy=`./try`
4325                         dflt="$lseeksize"
4326                         case "$yyy" in
4327                         '')     echo " "
4328                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4329                                 ;;
4330                         *)      fpossize=$yyy
4331                                 echo " $fpossize bytes."
4332                                 ;;
4333                         esac
4334                 else
4335                         dflt="$fpossize"
4336                         echo " "
4337                         echo "(I can't compile the test program.  Guessing...)" >&4
4338                         rp="What is the size of your file positions (in bytes)?"
4339                         . ./myread
4340                         fpossize="$ans"
4341                 fi
4342                 $rm -f try.c try
4343         fi
4344         ;;
4345 esac
4346
4347
4348 case "$usemorebits" in
4349 "$define"|true|[yY]*)
4350         use64bits="$define"
4351         uselongdouble="$define"
4352         usemorebits="$define"
4353         ;;
4354 *)      usemorebits="$undef"
4355         ;;
4356 esac
4357
4358
4359 case "$intsize:$longsize" in
4360 8:*|*:8) cat <<EOM
4361
4362 You have natively 64-bit integers.
4363 EOM
4364    val="$define" ;;
4365 *) cat <<EOM
4366
4367 Perl can be built to take advantage of 64-bit integer types
4368 on some systems.  To do so, Configure must be run with -Duse64bits.
4369
4370 If this doesn't make any sense to you, just accept the default.
4371 EOM
4372   case "$use64bits" in
4373   $define|true|[yY]*)   dflt='y';;
4374   *) dflt='n';;
4375   esac
4376   rp='Try to use 64-bit integers, if available?'
4377   . ./myread
4378   case "$ans" in
4379   y|Y) val="$define" ;;
4380   *)   val="$undef"  ;;
4381   esac
4382   ;;
4383 esac
4384 set use64bits
4385 eval $setvar
4386
4387 case "$archname64" in
4388 '') archname64='' ;;    # not a typo
4389 esac
4390
4391 case "$use64bits" in
4392 "$define"|true|[yY]*)
4393 : Look for a hint-file generated 'call-back-unit'.  If the
4394 : user has specified that a 64-bit perl is to be built,
4395 : we may need to set or change some other defaults.
4396         if $test -f use64bits.cbu; then
4397                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4398                 . ./use64bits.cbu
4399         else
4400                 $cat <<EOM
4401 (Your platform doesn't have any specific hints for 64-bit builds.)
4402 EOM
4403                 case "$intsize:$longsize" in
4404 8:*|*:8) cat <<EOM
4405 (This is probably okay, as your system is a natively 64-bit system.)
4406 EOM
4407                   ;;
4408                 esac
4409                 case "$gccversion" in
4410                 '')     ;;
4411                 *)      case "$ccflags" in
4412                         *-DUSE_LONG_LONG*) ;;
4413                         *) $cat <<EOM
4414 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4415 to the compilation flags.
4416 EOM
4417                            ccflags="$ccflags -DUSE_LONG_LONG"
4418                            ;;
4419                         esac
4420                         ;;
4421                 esac
4422         fi
4423         ;;
4424 esac
4425
4426 : determine the architecture name
4427 echo " "
4428 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4429         tarch=`arch`"-$osname"
4430 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4431         if uname -m > tmparch 2>&1 ; then
4432                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4433                         -e 's/$/'"-$osname/" tmparch`
4434         else
4435                 tarch="$osname"
4436         fi
4437         $rm -f tmparch
4438 else
4439         tarch="$osname"
4440 fi
4441 case "$myarchname" in
4442 ''|"$tarch") ;;
4443 *)
4444         echo "(Your architecture name used to be $myarchname.)"
4445         archname=''
4446         ;;
4447 esac
4448 myarchname="$tarch"
4449 case "$archname" in
4450 '') dflt="$tarch";;
4451 *) dflt="$archname";;
4452 esac
4453 rp='What is your architecture name'
4454 . ./myread
4455 archname="$ans"
4456 case "$usethreads" in
4457 $define)
4458         echo "Threads selected." >&4
4459         case "$archname" in
4460         *-thread*) echo "...and architecture name already has -thread." >&4
4461                 ;;
4462         *)      archname="$archname-thread"
4463                 echo "...setting architecture name to $archname." >&4
4464                 ;;
4465         esac
4466         ;;
4467 esac
4468 case "$usemultiplicity" in
4469 $define)
4470         echo "Multiplicity selected." >&4
4471         case "$archname" in
4472         *-multi*) echo "...and architecture name already has -multi." >&4
4473                 ;;
4474         *)      archname="$archname-multi"
4475                 echo "...setting architecture name to $archname." >&4
4476                 ;;
4477         esac
4478         ;;
4479 esac
4480 case "$use64bits" in
4481 $define)
4482         case "$archname64" in
4483         '')
4484                 ;;
4485         *)
4486                 case "$archname" in
4487                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4488                         ;;
4489                 *)      archname="$archname-$archname64"
4490                         echo "...setting architecture name to $archname." >&4
4491                         ;;
4492                 esac
4493                 ;;
4494         esac
4495 esac
4496
4497 : determine root of directory hierarchy where package will be installed.
4498 case "$prefix" in
4499 '')
4500         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4501         ;;
4502 *)
4503         dflt="$prefix"
4504         ;;
4505 esac
4506 $cat <<EOM
4507
4508 By default, $package will be installed in $dflt/bin, manual pages
4509 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4510 installation directories. Typically this is something like /usr/local.
4511 If you wish to have binaries under /usr/bin but other parts of the
4512 installation under /usr/local, that's ok: you will be prompted
4513 separately for each of the installation directories, the prefix being
4514 only used to set the defaults.
4515
4516 EOM
4517 fn=d~
4518 rp='Installation prefix to use?'
4519 . ./getfile
4520 oldprefix=''
4521 case "$prefix" in
4522 '') ;;
4523 *)
4524         case "$ans" in
4525         "$prefix") ;;
4526         *) oldprefix="$prefix";;
4527         esac
4528         ;;
4529 esac
4530 prefix="$ans"
4531 prefixexp="$ansexp"
4532
4533 : is AFS running?
4534 echo " "
4535 case "$afs" in
4536 $define|true)   afs=true ;;
4537 $undef|false)   afs=false ;;
4538 *)      if test -d /afs; then
4539                 afs=true
4540         else
4541                 afs=false
4542         fi
4543         ;;
4544 esac
4545 if $afs; then
4546         echo "AFS may be running... I'll be extra cautious then..." >&4
4547 else
4548         echo "AFS does not seem to be running..." >&4
4549 fi
4550
4551 : determine installation prefix for where package is to be installed.
4552 if $afs; then 
4553 $cat <<EOM
4554
4555 Since you are running AFS, I need to distinguish the directory in which
4556 files will reside from the directory in which they are installed (and from
4557 which they are presumably copied to the former directory by occult means).
4558
4559 EOM
4560         case "$installprefix" in
4561         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4562         *) dflt="$installprefix";;
4563         esac
4564 else
4565 $cat <<EOM
4566
4567 In some special cases, particularly when building $package for distribution,
4568 it is convenient to distinguish between the directory in which files should 
4569 be installed from the directory ($prefix) in which they 
4570 will eventually reside.  For most users, these two directories are the same.
4571
4572 EOM
4573         case "$installprefix" in
4574         '') dflt=$prefix ;;
4575         *) dflt=$installprefix;;
4576         esac
4577 fi
4578 fn=d~
4579 rp='What installation prefix should I use for installing files?'
4580 . ./getfile
4581 installprefix="$ans"
4582 installprefixexp="$ansexp"
4583
4584 : set the prefixit variable, to compute a suitable default value
4585 prefixit='case "$3" in
4586 ""|none)
4587         case "$oldprefix" in
4588         "") eval "$1=\"\$$2\"";;
4589         *)
4590                 case "$3" in
4591                 "") eval "$1=";;
4592                 none)
4593                         eval "tp=\"\$$2\"";
4594                         case "$tp" in
4595                         ""|" ") eval "$1=\"\$$2\"";;
4596                         *) eval "$1=";;
4597                         esac;;
4598                 esac;;
4599         esac;;
4600 *)
4601         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4602         case "$tp" in
4603         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4604         /*-$oldprefix/*|\~*-$oldprefix/*)
4605                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4606         *) eval "$1=\"\$$2\"";;
4607         esac;;
4608 esac'
4609
4610 : set the base revision
4611 baserev=5.0
4612
4613
4614 : get the patchlevel
4615 echo " "
4616 echo "Getting the current patchlevel..." >&4
4617 if $test -r $rsrc/patchlevel.h;then
4618         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4619         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4620         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4621         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4622         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4623 else
4624         patchlevel=0
4625         subversion=0
4626         api_revision=0
4627         api_version=0
4628         api_subversion=0
4629 fi
4630 $echo $n "(You have $package" $c
4631 case "$package" in
4632 "*$baserev")    ;;
4633 *)              $echo $n " $baserev" $c ;;
4634 esac
4635 $echo $n " patchlevel $patchlevel" $c
4636 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4637 echo ".)"
4638 case "$osname" in
4639 dos|vms)
4640         : XXX Should be a Configure test for double-dots in filenames.
4641         version=`echo $baserev $patchlevel $subversion | \
4642                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4643         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4644                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4645         ;;
4646 *)
4647         version=`echo $baserev $patchlevel $subversion | \
4648                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4649         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4650                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4651         ;;
4652 esac
4653 : Special case the 5.005_xx maintenance series, which used 5.005
4654 : without any subversion label as a subdirectory in $sitelib
4655 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4656         api_versionstring='5.005'
4657 fi
4658
4659 : determine installation style
4660 : For now, try to deduce it from prefix unless it is already set.
4661 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4662 case "$installstyle" in
4663 '')     case "$prefix" in
4664                 *perl*) dflt='lib';;
4665                 *) dflt='lib/perl5' ;;
4666         esac
4667         ;;
4668 *)      dflt='lib/perl5' ;;
4669 esac
4670 : Probably not worth prompting for this since we prompt for all
4671 : the directories individually, and the prompt would be too long and
4672 : confusing anyway.
4673 installstyle=$dflt
4674
4675 : determine where private library files go
4676 : Usual default is /usr/local/lib/perl5/$version.
4677 : Also allow things like /opt/perl/lib/$version, since 
4678 : /opt/perl/lib/perl5... would be redundant.
4679 : The default "style" setting is made in installstyle.U
4680 case "$installstyle" in
4681 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4682 *)       set dflt privlib lib/$version ;;
4683 esac
4684 eval $prefixit
4685 $cat <<EOM
4686
4687 There are some auxiliary files for $package that need to be put into a
4688 private library directory that is accessible by everyone.
4689
4690 EOM
4691 fn=d~+
4692 rp='Pathname where the private library files will reside?'
4693 . ./getfile
4694 privlib="$ans"
4695 privlibexp="$ansexp"
4696 : Change installation prefix, if necessary.
4697 if $test X"$prefix" != X"$installprefix"; then
4698         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4699 else
4700         installprivlib="$privlibexp"
4701 fi
4702
4703 : set the prefixup variable, to restore leading tilda escape
4704 prefixup='case "$prefixexp" in
4705 "$prefix") ;;
4706 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4707 esac'
4708
4709 : determine where public architecture dependent libraries go
4710 set archlib archlib
4711 eval $prefixit
4712 : privlib default is /usr/local/lib/$package/$version
4713 : archlib default is /usr/local/lib/$package/$version/$archname
4714 : privlib may have an optional trailing /share.
4715 tdflt=`echo $privlib | $sed 's,/share$,,'`
4716 tdflt=$tdflt/$archname
4717 case "$archlib" in
4718 '')     dflt=$tdflt
4719         ;;
4720 *)      dflt="$archlib"
4721     ;;
4722 esac
4723 $cat <<EOM
4724
4725 $spackage contains architecture-dependent library files.  If you are
4726 sharing libraries in a heterogeneous environment, you might store
4727 these files in a separate location.  Otherwise, you can just include
4728 them with the rest of the public library files.
4729
4730 EOM
4731 fn=d+~
4732 rp='Where do you want to put the public architecture-dependent libraries?'
4733 . ./getfile
4734 archlib="$ans"
4735 archlibexp="$ansexp"
4736 if $test X"$archlib" = X"$privlib"; then
4737         d_archlib="$undef"
4738 else
4739         d_archlib="$define"
4740 fi
4741 : Change installation prefix, if necessary.
4742 if $test X"$prefix" != X"$installprefix"; then
4743         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4744 else
4745         installarchlib="$archlibexp"
4746 fi
4747
4748
4749 : Binary compatibility with 5.005 is not possible for builds
4750 : with advanced features
4751 case "$usethreads$usemultiplicity" in
4752 *define*)
4753         bincompat5005="$undef"
4754         d_bincompat5005="$undef"
4755         ;;
4756 *)      $cat <<EOM
4757
4758 Perl 5.006 can be compiled for binary compatibility with 5.005.
4759 If you decide to do so, you will be able to continue using most
4760 of the extensions that were compiled for Perl 5.005.
4761
4762 EOM
4763         case "$bincompat5005$d_bincompat5005" in
4764         *"$undef"*) dflt=n ;;
4765         *) dflt=y ;;
4766         esac
4767         rp='Binary compatibility with Perl 5.005?'
4768         . ./myread
4769         case "$ans" in
4770         y*) val="$define" ;;
4771         *)  val="$undef" ;;
4772         esac
4773         set d_bincompat5005
4774         eval $setvar
4775         case "$d_bincompat5005" in
4776         "$define")
4777                 bincompat5005="$define"
4778                 ;;
4779         *)      bincompat5005="$undef"
4780                 d_bincompat5005="$undef"
4781                 ;;
4782         esac
4783         ;;
4784 esac
4785
4786
4787 : see if setuid scripts can be secure
4788 $cat <<EOM
4789
4790 Some kernels have a bug that prevents setuid #! scripts from being
4791 secure.  Some sites have disabled setuid #! scripts because of this.
4792
4793 First let's decide if your kernel supports secure setuid #! scripts.
4794 (If setuid #! scripts would be secure but have been disabled anyway,
4795 don't say that they are secure if asked.)
4796
4797 EOM
4798
4799 val="$undef"
4800 if $test -d /dev/fd; then
4801         echo "#!$ls" >reflect
4802         chmod +x,u+s reflect
4803         ./reflect >flect 2>&1
4804         if $contains "/dev/fd" flect >/dev/null; then
4805                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4806                 val="$define"
4807         else
4808                 $cat <<EOM
4809 If you are not sure if they are secure, I can check but I'll need a
4810 username and password different from the one you are using right now.
4811 If you don't have such a username or don't want me to test, simply
4812 enter 'none'.
4813
4814 EOM
4815                 rp='Other username to test security of setuid scripts with?'
4816                 dflt='none'
4817                 . ./myread
4818                 case "$ans" in
4819                 n|none)
4820                         case "$d_suidsafe" in
4821                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4822                                 dflt=n;;
4823                         "$undef")
4824                                 echo "Well, the $hint value is *not* secure." >&4
4825                                 dflt=n;;
4826                         *)      echo "Well, the $hint value *is* secure." >&4
4827                                 dflt=y;;
4828                         esac
4829                         ;;
4830                 *)
4831                         $rm -f reflect flect
4832                         echo "#!$ls" >reflect
4833                         chmod +x,u+s reflect
4834                         echo >flect
4835                         chmod a+w flect
4836                         echo '"su" will (probably) prompt you for '"$ans's password."
4837                         su $ans -c './reflect >flect'
4838                         if $contains "/dev/fd" flect >/dev/null; then
4839                                 echo "Okay, it looks like setuid scripts are secure." >&4
4840                                 dflt=y
4841                         else
4842                                 echo "I don't think setuid scripts are secure." >&4
4843                                 dflt=n
4844                         fi
4845                         ;;
4846                 esac
4847                 rp='Does your kernel have *secure* setuid scripts?'
4848                 . ./myread
4849                 case "$ans" in
4850                 [yY]*)  val="$define";;
4851                 *)      val="$undef";;
4852                 esac
4853         fi
4854 else
4855         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4856         echo "(That's for file descriptors, not floppy disks.)"
4857         val="$undef"
4858 fi
4859 set d_suidsafe
4860 eval $setvar
4861
4862 $rm -f reflect flect
4863
4864 : now see if they want to do setuid emulation
4865 echo " "
4866 val="$undef"
4867 case "$d_suidsafe" in
4868 "$define")
4869         val="$undef"
4870         echo "No need to emulate SUID scripts since they are secure here." >& 4
4871         ;;
4872 *)
4873         $cat <<EOM
4874 Some systems have disabled setuid scripts, especially systems where
4875 setuid scripts cannot be secure.  On systems where setuid scripts have
4876 been disabled, the setuid/setgid bits on scripts are currently
4877 useless.  It is possible for $package to detect those bits and emulate
4878 setuid/setgid in a secure fashion.  This emulation will only work if
4879 setuid scripts have been disabled in your kernel.
4880
4881 EOM
4882         case "$d_dosuid" in
4883         "$define") dflt=y ;;
4884         *) dflt=n ;;
4885         esac
4886         rp="Do you want to do setuid/setgid emulation?"
4887         . ./myread
4888         case "$ans" in
4889         [yY]*)  val="$define";;
4890         *)      val="$undef";;
4891         esac
4892         ;;
4893 esac
4894 set d_dosuid
4895 eval $setvar
4896
4897 : determine filename position in cpp output
4898 echo " "
4899 echo "Computing filename position in cpp output for #include directives..." >&4
4900 echo '#include <stdio.h>' > foo.c
4901 $cat >fieldn <<EOF
4902 $startsh
4903 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4904 $grep '^[       ]*#.*stdio\.h' | \
4905 while read cline; do
4906         pos=1
4907         set \$cline
4908         while $test \$# -gt 0; do
4909                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4910                         echo "\$pos"
4911                         exit 0
4912                 fi
4913                 shift
4914                 pos=\`expr \$pos + 1\`
4915         done
4916 done
4917 EOF
4918 chmod +x fieldn
4919 fieldn=`./fieldn`
4920 $rm -f foo.c fieldn
4921 case $fieldn in
4922 '') pos='???';;
4923 1) pos=first;;
4924 2) pos=second;;
4925 3) pos=third;;
4926 *) pos="${fieldn}th";;
4927 esac
4928 echo "Your cpp writes the filename in the $pos field of the line."
4929
4930 : locate header file
4931 $cat >findhdr <<EOF
4932 $startsh
4933 wanted=\$1
4934 name=''
4935 for usrincdir in $usrinc
4936 do
4937         if test -f \$usrincdir/\$wanted; then
4938                 echo "\$usrincdir/\$wanted"
4939                 exit 0
4940         fi
4941 done
4942 awkprg='{ print \$$fieldn }'
4943 echo "#include <\$wanted>" > foo\$\$.c
4944 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4945 $grep "^[       ]*#.*\$wanted" | \
4946 while read cline; do
4947         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4948         case "\$name" in
4949         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4950         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4951         *) exit 2;;
4952         esac;
4953 done;
4954 #
4955 # status = 0: grep returned 0 lines, case statement not executed
4956 # status = 1: headerfile found
4957 # status = 2: while loop executed, no headerfile found
4958 #
4959 status=\$?
4960 $rm -f foo\$\$.c;
4961 if test \$status -eq 1; then
4962         exit 0;
4963 fi
4964 exit 1
4965 EOF
4966 chmod +x findhdr
4967
4968 : define an alternate in-header-list? function
4969 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4970 cont=true; xxf="echo \"<\$1> found.\" >&4";
4971 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4972 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4973 esac;
4974 case $# in 4) instead=instead;; *) instead="at last";; esac;
4975 while $test "$cont"; do
4976         xxx=`./findhdr $1`
4977         var=$2; eval "was=\$$2";
4978         if $test "$xxx" && $test -r "$xxx";
4979         then eval $xxf;
4980         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4981                 cont="";
4982         else eval $xxnf;
4983         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4984         set $yyy; shift; shift; yyy=$@;
4985         case $# in 0) cont="";;
4986         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4987                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4988         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4989                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4990         esac;
4991 done;
4992 while $test "$yyy";
4993 do set $yyy; var=$2; eval "was=\$$2";
4994         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4995         set $yyy; shift; shift; yyy=$@;
4996 done'
4997
4998 : see if this is a malloc.h system
4999 set malloc.h i_malloc
5000 eval $inhdr
5001
5002 : see if stdlib is available
5003 set stdlib.h i_stdlib
5004 eval $inhdr
5005
5006 : determine which malloc to compile in
5007 echo " "
5008 case "$usemymalloc" in
5009 ''|[yY]*|true|$define)  dflt='y' ;;
5010 *)      dflt='n' ;;
5011 esac
5012 rp="Do you wish to attempt to use the malloc that comes with $package?"
5013 . ./myread
5014 usemymalloc="$ans"
5015 case "$ans" in
5016 y*|true)
5017         usemymalloc='y'
5018         mallocsrc='malloc.c'
5019         mallocobj="malloc$_o"
5020         d_mymalloc="$define"
5021         case "$libs" in
5022         *-lmalloc*)
5023                 : Remove malloc from list of libraries to use
5024                 echo "Removing unneeded -lmalloc from library list" >&4
5025                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5026                 shift
5027                 libs="$*"
5028                 echo "libs = $libs" >&4
5029                 ;;
5030         esac
5031         ;;
5032 *)
5033         usemymalloc='n'
5034         mallocsrc=''
5035         mallocobj=''
5036         d_mymalloc="$undef"
5037         ;;
5038 esac
5039
5040 : compute the return types of malloc and free
5041 echo " "
5042 $cat >malloc.c <<END
5043 #$i_malloc I_MALLOC
5044 #$i_stdlib I_STDLIB
5045 #include <stdio.h>
5046 #include <sys/types.h>
5047 #ifdef I_MALLOC
5048 #include <malloc.h>
5049 #endif
5050 #ifdef I_STDLIB
5051 #include <stdlib.h>
5052 #endif
5053 #ifdef TRY_MALLOC
5054 void *malloc();
5055 #endif
5056 #ifdef TRY_FREE
5057 void free();
5058 #endif
5059 END
5060 case "$malloctype" in
5061 '')
5062         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5063                 malloctype='void *'
5064         else
5065                 malloctype='char *'
5066         fi
5067         ;;
5068 esac
5069 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5070
5071 case "$freetype" in
5072 '')
5073         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5074                 freetype='void'
5075         else
5076                 freetype='int'
5077         fi
5078         ;;
5079 esac
5080 echo "Your system uses $freetype free(), it would seem." >&4
5081 $rm -f malloc.[co]
5082 $cat <<EOM
5083
5084 The installation process will also create a directory for
5085 vendor-supplied add-ons.  Vendors who supply perl with their system
5086 may find it convenient to place all vendor-supplied files in this
5087 directory rather than in the main distribution directory.  This will
5088 ease upgrades between binary-compatible maintenance versions of perl.
5089
5090 Of course you may also use these directories in whatever way you see
5091 fit.  For example, you might use them to access modules shared over a
5092 company-wide network.
5093
5094 The default answer should be fine for most people.
5095 This causes further questions about vendor add-ons to be skipped
5096 and no vendor-specific directories will be configured for perl.
5097
5098 EOM
5099 rp='Do you want to configure vendor-specific add-on directories?'
5100 case "$usevendorprefix" in
5101 define|true|[yY]*) dflt=y ;;
5102 *) dflt=n ;;
5103 esac
5104 . ./myread
5105 case "$ans" in
5106 [yY]*)  fn=d~+
5107         rp='Installation prefix to use for vendor-supplied add-ons?'
5108         case "$vendorprefix" in
5109         '') dflt='' ;;
5110         *)  dflt=$vendorprefix ;;
5111         esac
5112         . ./getfile
5113         oldvendorprefix=''
5114         case "$vendorprefix" in
5115         '') ;;
5116         *)      case "$ans" in
5117                 "$prefix") ;;
5118                 *) oldvendorprefix="$prefix";;
5119                 esac
5120                 ;;
5121         esac
5122         usevendorprefix="$define"
5123         vendorprefix="$ans"
5124         vendorprefixexp="$ansexp"
5125         ;;
5126 *)      usevendorprefix="$undef"
5127         vendorprefix=''
5128         vendorprefixexp=''
5129         ;;
5130 esac
5131
5132 case "$vendorprefix" in
5133 '')     d_vendorlib="$undef"
5134         vendorlib=''
5135         vendorlibexp=''
5136         ;;
5137 *)      d_vendorlib="$define"
5138         : determine where vendor-supplied modules go.
5139         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5140         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5141         case "$installstyle" in
5142         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5143         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5144         esac
5145         fn=d~+
5146         rp='Pathname for the vendor-supplied library files?'
5147         . ./getfile
5148         vendorlib="$ans"
5149         vendorlibexp="$ansexp"
5150         : Change installation prefix, if necessary.
5151         if $test X"$prefix" != X"$installprefix"; then
5152                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5153         else
5154                 installvendorlib="$vendorlibexp"
5155         fi
5156         ;;
5157 esac
5158
5159 : Cruising for prototypes
5160 echo " "
5161 echo "Checking out function prototypes..." >&4
5162 $cat >prototype.c <<'EOCP'
5163 int main(int argc, char *argv[]) {
5164         exit(0);}
5165 EOCP
5166 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5167         echo "Your C compiler appears to support function prototypes."
5168         val="$define"
5169 else
5170         echo "Your C compiler doesn't seem to understand function prototypes."
5171         val="$undef"
5172 fi
5173 set prototype
5174 eval $setvar
5175 $rm -f prototype*
5176
5177 case "$prototype" in
5178 "$define") ;;
5179 *)      ansi2knr='ansi2knr'
5180         echo " "
5181         cat <<EOM >&4
5182
5183 $me:  FATAL ERROR:
5184 This version of $package can only be compiled by a compiler that 
5185 understands function prototypes.  Unfortunately, your C compiler 
5186         $cc $ccflags
5187 doesn't seem to understand them.  Sorry about that.
5188
5189 If GNU cc is available for your system, perhaps you could try that instead.  
5190
5191 Eventually, we hope to support building Perl with pre-ANSI compilers.
5192 If you would like to help in that effort, please contact <perlbug@perl.org>.
5193
5194 Aborting Configure now.
5195 EOM
5196         exit 2
5197         ;;
5198 esac
5199
5200 : determine where public executables go
5201 echo " "
5202 set dflt bin bin
5203 eval $prefixit
5204 fn=d~
5205 rp='Pathname where the public executables will reside?'
5206 . ./getfile
5207 if $test "X$ansexp" != "X$binexp"; then
5208         installbin=''
5209 fi
5210 bin="$ans"
5211 binexp="$ansexp"
5212 : Change installation prefix, if necessary.
5213 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5214 if $test X"$prefix" != X"$installprefix"; then
5215         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5216 else
5217         installbin="$binexp"
5218 fi
5219
5220 $cat <<EOM
5221
5222 After $package is installed, you may wish to install various
5223 add-on modules and utilities.  Typically, these add-ons will
5224 be installed under $prefix with the rest
5225 of this package.  However, you may wish to install such add-ons
5226 elsewhere under a different prefix.
5227
5228 If you do not wish to put everything under a single prefix, that's
5229 ok.  You will be prompted for the individual locations; this siteprefix
5230 is only used to suggest the defaults.
5231
5232 The default should be fine for most people.
5233
5234 EOM
5235 fn=d~+
5236 rp='Installation prefix to use for add-on modules and utilities?'
5237 : XXX Here might be another good place for an installstyle setting.
5238 case "$siteprefix" in
5239 '') dflt=$prefix ;;
5240 *)  dflt=$siteprefix ;;
5241 esac
5242 . ./getfile
5243 oldsiteprefix=''
5244 case "$siteprefix" in
5245 '') ;;
5246 *)
5247         case "$ans" in
5248         "$prefix") ;;
5249         *) oldsiteprefix="$prefix";;
5250         esac
5251         ;;
5252 esac
5253 siteprefix="$ans"
5254 siteprefixexp="$ansexp"
5255
5256 : determine where site specific libraries go.
5257 : Usual default is /usr/local/lib/perl5/site_perl/$version
5258 : The default "style" setting is made in installstyle.U
5259 : XXX No longer works with Prefixit stuff.
5260 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5261 case "$installstyle" in
5262 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5263 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5264 esac
5265 $cat <<EOM
5266
5267 The installation process will create a directory for
5268 site-specific extensions and modules.  Most users find it convenient
5269 to place all site-specific files in this directory rather than in the
5270 main distribution directory.
5271
5272 EOM
5273 fn=d~+
5274 rp='Pathname for the site-specific library files?'
5275 . ./getfile
5276 sitelib="$ans"
5277 sitelibexp="$ansexp"
5278 : Change installation prefix, if necessary.
5279 if $test X"$prefix" != X"$installprefix"; then
5280         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5281 else
5282         installsitelib="$sitelibexp"
5283 fi
5284
5285 : Determine list of previous versions to include in @INC
5286 $cat > getverlist <<EOPL
5287 #!$perl -w
5288 use File::Basename;
5289 \$api_versionstring = "$api_versionstring";
5290 \$version = "$version";
5291 \$sitelib = "$sitelib";
5292 \$archname = "$archname";
5293 EOPL
5294         $cat >> getverlist <<'EOPL'
5295 # Can't have leading @ because metaconfig interprets it as a command!
5296 ;@inc_version_list=();
5297 $stem=dirname($sitelib);
5298 # Redo to do opendir/readdir? 
5299 if (-d $stem) {
5300     chdir($stem);
5301     ;@candidates = glob("5.*");
5302 }
5303 else {
5304     ;@candidates = ();
5305 }
5306
5307 # XXX ToDo:  These comparisons must be reworked when two-digit
5308 # subversions come along, so that 5.7.10 compares as greater than
5309 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5310 # widespread that we can use the built-in version vectors rather
5311 # than reinventing them here.  For 5.6.0, however, we must
5312 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5313 foreach $d (@candidates) {
5314     if ($d lt $version) {
5315         if ($d ge $api_versionstring) {
5316             unshift(@inc_version_list, "$d/$archname", $d);
5317         }
5318         elsif ($d ge "5.005") {
5319             unshift(@inc_version_list, $d);
5320         }
5321     }
5322     else {
5323         # Skip newer version.  I.e. don't look in
5324         # 5.7.0 if we're installing 5.6.1.
5325     }
5326 }
5327
5328 if (@inc_version_list) {
5329     print join(' ', @inc_version_list);
5330 }
5331 else {
5332     # Blank space to preserve value for next Configure run.
5333     print " ";
5334 }
5335 EOPL
5336 chmod +x getverlist
5337 case "$inc_version_list" in
5338 '')     if test -x $perl; then
5339                 dflt=`$perl getverlist`
5340         else
5341                 dflt='none'
5342         fi
5343         ;;
5344 $undef) dflt='none' ;;
5345 *)  dflt="$inc_version_list" ;;
5346 esac
5347 $cat <<'EOM'
5348
5349 In order to ease the process of upgrading, this version of perl 
5350 can be configured to use modules built and installed with earlier 
5351 versions of perl that were installed under $prefix.  Specify here
5352 the list of earlier versions that this version of perl should check.
5353 If Configure detected no earlier versions of perl installed under
5354 $prefix, then the list will be empty.  Answer 'none' to tell perl
5355 to not search earlier versions.
5356
5357 The default should almost always be sensible, so if you're not sure,
5358 just accept the default.
5359 EOM
5360
5361 rp='List of earlier versions to include in @INC?'
5362 . ./myread
5363 case "$ans" in
5364 [Nn]one) inc_version_list=' ' ;;
5365 *) inc_version_list="$ans" ;;
5366 esac
5367 case "$inc_version_list" in
5368 ''|' ') 
5369         inc_version_list_init='0';;
5370 *)      inc_version_list_init=`echo $inc_version_list |
5371                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5372         ;;
5373 esac
5374 $rm -f getverlist
5375
5376 : determine whether to install perl also as /usr/bin/perl
5377
5378 echo " "
5379 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5380         $cat <<EOM
5381 Many scripts expect to perl to be installed as /usr/bin/perl.
5382 I can install the perl you are about to compile also as /usr/bin/perl
5383 (in addition to $installbin/perl).
5384 EOM
5385         case "$installusrbinperl" in
5386         "$undef"|[nN]*) dflt='n';;
5387         *)              dflt='y';;
5388         esac
5389         rp="Do you want to install perl as /usr/bin/perl?"
5390         . ./myread
5391         case "$ans" in
5392         [yY]*)  val="$define";;
5393         *)      val="$undef" ;;
5394         esac
5395 else
5396         val="$undef"
5397 fi
5398 set installusrbinperl
5399 eval $setvar
5400
5401 echo " "
5402 echo "Checking for GNU C Library..." >&4
5403 cat >gnulibc.c <<EOM
5404 #include <stdio.h>
5405 int main()
5406 {
5407 #ifdef __GLIBC__
5408     exit(0);
5409 #else
5410     exit(1);
5411 #endif
5412 }
5413 EOM
5414 set gnulibc
5415 if eval $compile_ok && ./gnulibc; then
5416         val="$define"
5417         echo "You are using the GNU C Library"
5418 else
5419         val="$undef"
5420         echo "You are not using the GNU C Library"
5421 fi
5422 $rm -f gnulibc*
5423 set d_gnulibc
5424 eval $setvar
5425
5426 : see if nm is to be used to determine whether a symbol is defined or not
5427 case "$usenm" in
5428 '')
5429         dflt=''
5430         case "$d_gnulibc" in
5431         "$define")
5432                 echo " "
5433                 echo "nm probably won't work on the GNU C Library." >&4
5434                 dflt=n
5435                 ;;
5436         esac
5437         case "$dflt" in
5438         '') 
5439                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5440                         echo " "
5441                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5442                         echo "'nm' won't be sufficient on this sytem." >&4
5443                         dflt=n
5444                 fi
5445                 ;;
5446         esac
5447         case "$dflt" in
5448         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5449                 if $test $dflt -gt 20; then
5450                         dflt=y
5451                 else
5452                         dflt=n
5453                 fi
5454                 ;;
5455         esac
5456         ;;
5457 *)
5458         case "$usenm" in
5459         true|$define) dflt=y;;
5460         *) dflt=n;;
5461         esac
5462         ;;
5463 esac
5464 $cat <<EOM
5465
5466 I can use $nm to extract the symbols from your C libraries. This
5467 is a time consuming task which may generate huge output on the disk (up
5468 to 3 megabytes) but that should make the symbols extraction faster. The
5469 alternative is to skip the 'nm' extraction part and to compile a small
5470 test program instead to determine whether each symbol is present. If
5471 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5472 this may be the best solution.
5473
5474 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5475
5476 EOM
5477 rp="Shall I use $nm to extract C symbols from the libraries?"
5478 . ./myread
5479 case "$ans" in
5480 [Nn]*) usenm=false;;
5481 *) usenm=true;;
5482 esac
5483
5484 runnm=$usenm
5485 case "$reuseval" in
5486 true) runnm=false;;
5487 esac
5488
5489 : nm options which may be necessary
5490 case "$nm_opt" in
5491 '') if $test -f /mach_boot; then
5492                 nm_opt=''       # Mach
5493         elif $test -d /usr/ccs/lib; then
5494                 nm_opt='-p'     # Solaris (and SunOS?)
5495         elif $test -f /dgux; then
5496                 nm_opt='-p'     # DG-UX
5497         elif $test -f /lib64/rld; then
5498                 nm_opt='-p'     # 64-bit Irix
5499         else
5500                 nm_opt=''
5501         fi;;
5502 esac
5503
5504 : nm options which may be necessary for shared libraries but illegal
5505 : for archive libraries.  Thank you, Linux.
5506 case "$nm_so_opt" in
5507 '')     case "$myuname" in
5508         *linux*)
5509                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5510                         nm_so_opt='--dynamic'
5511                 fi
5512                 ;;
5513         esac
5514         ;;
5515 esac
5516
5517 case "$runnm" in
5518 true)
5519 : get list of predefined functions in a handy place
5520 echo " "
5521 case "$libc" in
5522 '') libc=unknown
5523         case "$libs" in
5524         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5525         esac
5526         ;;
5527 esac
5528 libnames='';
5529 case "$libs" in
5530 '') ;;
5531 *)  for thislib in $libs; do
5532         case "$thislib" in
5533         -lc|-lc_s)
5534                 : Handle C library specially below.
5535                 ;;
5536         -l*)
5537                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5538                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5539                         :
5540                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5541                         :
5542                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5543                         :
5544                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5545                         :
5546                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5547                         :
5548                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5549                         :
5550                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5551                         :
5552                 else
5553                         try=''
5554                 fi
5555                 libnames="$libnames $try"
5556                 ;;
5557         *) libnames="$libnames $thislib" ;;
5558         esac
5559         done
5560         ;;
5561 esac
5562 xxx=normal
5563 case "$libc" in
5564 unknown)
5565         set /lib/libc.$so
5566         for xxx in $libpth; do
5567                 $test -r $1 || set $xxx/libc.$so
5568                 : The messy sed command sorts on library version numbers.
5569                 $test -r $1 || \
5570                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5571                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5572                                 h
5573                                 s/[0-9][0-9]*/0000&/g
5574                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5575                                 G
5576                                 s/\n/ /' | \
5577                          sort | $sed -e 's/^.* //'`
5578                 eval set \$$#
5579         done
5580         $test -r $1 || set /usr/ccs/lib/libc.$so
5581         $test -r $1 || set /lib/libsys_s$_a
5582         ;;
5583 *)
5584         set blurfl
5585         ;;
5586 esac
5587 if $test -r "$1"; then
5588         echo "Your (shared) C library seems to be in $1."
5589         libc="$1"
5590 elif $test -r /lib/libc && $test -r /lib/clib; then
5591         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5592         xxx=apollo
5593         libc='/lib/clib /lib/libc'
5594         if $test -r /lib/syslib; then
5595                 echo "(Your math library is in /lib/syslib.)"
5596                 libc="$libc /lib/syslib"
5597         fi
5598 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5599         echo "Your C library seems to be in $libc, as you said before."
5600 elif $test -r $incpath/usr/lib/libc$_a; then
5601         libc=$incpath/usr/lib/libc$_a;
5602         echo "Your C library seems to be in $libc.  That's fine."
5603 elif $test -r /lib/libc$_a; then
5604         libc=/lib/libc$_a;
5605         echo "Your C library seems to be in $libc.  You're normal."
5606 else
5607         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5608                 :
5609         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5610                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5611         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5612                 :
5613         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5614                 :
5615         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5616                 :
5617         else
5618                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5619         fi
5620         if $test -r "$tans"; then
5621                 echo "Your C library seems to be in $tans, of all places."
5622                 libc=$tans
5623         else
5624                 libc='blurfl'
5625         fi
5626 fi
5627 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5628         dflt="$libc"
5629         cat <<EOM
5630
5631 If the guess above is wrong (which it might be if you're using a strange
5632 compiler, or your machine supports multiple models), you can override it here.
5633
5634 EOM
5635 else
5636         dflt=''
5637         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5638         cat >&4 <<EOM
5639 I can't seem to find your C library.  I've looked in the following places:
5640
5641 EOM
5642         $sed 's/^/      /' libpath
5643         cat <<EOM
5644
5645 None of these seems to contain your C library. I need to get its name...
5646
5647 EOM
5648 fi
5649 fn=f
5650 rp='Where is your C library?'
5651 . ./getfile
5652 libc="$ans"
5653
5654 echo " "
5655 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5656 set X `cat libnames`
5657 shift
5658 xxx=files
5659 case $# in 1) xxx=file; esac
5660 echo "Extracting names from the following $xxx for later perusal:" >&4
5661 echo " "
5662 $sed 's/^/      /' libnames >&4
5663 echo " "
5664 $echo $n "This may take a while...$c" >&4
5665
5666 for file in $*; do
5667         case $file in
5668         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5669         *) $nm $nm_opt $file 2>/dev/null;;
5670         esac
5671 done >libc.tmp
5672
5673 $echo $n ".$c"
5674 $grep fprintf libc.tmp > libc.ptf
5675 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5676 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5677 xxx='[ADTSIW]'
5678 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5679         eval $xscan;\
5680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5681                 eval $xrun
5682 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5683         eval $xscan;\
5684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5685                 eval $xrun
5686 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5687         eval $xscan;\
5688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5689                 eval $xrun
5690 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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.*text.*/\1/p'";\
5695         eval $xscan;\
5696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5697                 eval $xrun
5698 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5699         eval $xscan;\
5700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5701                 eval $xrun
5702 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5703                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 else
5736         $nm -p $* 2>/dev/null >libc.tmp
5737         $grep fprintf libc.tmp > libc.ptf
5738         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5739                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5740         then
5741                 nm_opt='-p'
5742                 eval $xrun
5743         else
5744                 echo " "
5745                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5746                 com=''
5747                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5748                         for thisname in $libnames $libc; do
5749                                 $ar t $thisname >>libc.tmp
5750                         done
5751                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5752                         echo "Ok." >&4
5753                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5754                         # Repeat libc to extract forwarders to DLL entries too
5755                         for thisname in $libnames $libc; do
5756                                 $ar tv $thisname >>libc.tmp
5757                                 # Revision 50 of EMX has bug in $ar.
5758                                 # it will not extract forwarders to DLL entries
5759                                 # Use emximp which will extract exactly them.
5760                                 emximp -o tmp.imp $thisname \
5761                                     2>/dev/null && \
5762                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5763                                     < tmp.imp >>libc.tmp
5764                                 $rm tmp.imp
5765                         done
5766                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5767                         echo "Ok." >&4
5768                 else
5769                         echo "$ar didn't seem to work right." >&4
5770                         echo "Maybe this is a Cray...trying bld instead..." >&4
5771                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5772                         then
5773                                 for thisname in $libnames; do
5774                                         bld t $libnames | \
5775                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5776                                         $ar t $thisname >>libc.tmp
5777                                 done
5778                                 echo "Ok." >&4
5779                         else
5780                                 echo "That didn't work either.  Giving up." >&4
5781                                 exit 1
5782                         fi
5783                 fi
5784         fi
5785 fi
5786 nm_extract="$com"
5787 if $test -f /lib/syscalls.exp; then
5788         echo " "
5789         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5790         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5791 fi
5792 ;;
5793 esac
5794 $rm -f libnames libpath
5795
5796 : see if dld is available
5797 set dld.h i_dld
5798 eval $inhdr
5799
5800 : is a C symbol defined?
5801 csym='tlook=$1;
5802 case "$3" in
5803 -v) tf=libc.tmp; tc=""; tdc="";;
5804 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5805 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5806 esac;
5807 tx=yes;
5808 case "$reuseval-$4" in
5809 true-) ;;
5810 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5811 esac;
5812 case "$tx" in
5813 yes)
5814         case "$runnm" in
5815         true)
5816                 if $contains $tlook $tf >/dev/null 2>&1;
5817                 then tval=true;
5818                 else tval=false;
5819                 fi;;
5820         *)
5821                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5822                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5823                 then tval=true;
5824                 else tval=false;
5825                 fi;
5826                 $rm -f t t.c;;
5827         esac;;
5828 *)
5829         case "$tval" in
5830         $define) tval=true;;
5831         *) tval=false;;
5832         esac;;
5833 esac;
5834 eval "$2=$tval"'
5835
5836 : define an is-in-libc? function
5837 inlibc='echo " "; td=$define; tu=$undef;
5838 sym=$1; var=$2; eval "was=\$$2";
5839 tx=yes;
5840 case "$reuseval$was" in
5841 true) ;;
5842 true*) tx=no;;
5843 esac;
5844 case "$tx" in
5845 yes)
5846         set $sym tres -f;
5847         eval $csym;
5848         case "$tres" in
5849         true)
5850                 echo "$sym() found." >&4;
5851                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5852         *)
5853                 echo "$sym() NOT found." >&4;
5854                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5855         esac;;
5856 *)
5857         case "$was" in
5858         $define) echo "$sym() found." >&4;;
5859         *) echo "$sym() NOT found." >&4;;
5860         esac;;
5861 esac'
5862
5863 : see if dlopen exists
5864 xxx_runnm="$runnm"
5865 runnm=false
5866 set dlopen d_dlopen
5867 eval $inlibc
5868 runnm="$xxx_runnm"
5869
5870 : determine which dynamic loading, if any, to compile in
5871 echo " "
5872 dldir="ext/DynaLoader"
5873 case "$usedl" in
5874 $define|y|true)
5875         dflt='y'
5876         usedl="$define"
5877         ;;
5878 $undef|n|false)
5879         dflt='n'
5880         usedl="$undef"
5881         ;;
5882 *) 
5883         dflt='n'
5884         case "$d_dlopen" in
5885             $define) dflt='y' ;;
5886         esac
5887         case "$i_dld" in
5888             $define) dflt='y' ;;
5889         esac
5890         : Does a dl_xxx.xs file exist for this operating system
5891         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5892         ;;
5893 esac
5894 rp="Do you wish to use dynamic loading?"
5895 . ./myread
5896 usedl="$ans"
5897 case "$ans" in
5898 y*) usedl="$define"
5899         case "$dlsrc" in
5900         '')
5901                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5902                         dflt="$dldir/dl_${osname}.xs"
5903                 elif $test "$d_dlopen" = "$define" ; then
5904                         dflt="$dldir/dl_dlopen.xs"
5905                 elif $test "$i_dld" = "$define" ; then
5906                         dflt="$dldir/dl_dld.xs"
5907                 else
5908                         dflt=''
5909                 fi
5910                 ;;
5911         *)      dflt="$dldir/$dlsrc"
5912                 ;;
5913         esac
5914     echo "The following dynamic loading files are available:"
5915         : Can not go over to $dldir because getfile has path hard-coded in.
5916         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5917         rp="Source file to use for dynamic loading"
5918         fn="fne"
5919         gfpth="$src"
5920         . ./getfile
5921         usedl="$define"
5922         : emulate basename
5923         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5924
5925         $cat << EOM
5926
5927 Some systems may require passing special flags to $cc -c to
5928 compile modules that will be used to create a shared library.
5929 To use no flags, say "none".
5930
5931 EOM
5932     case "$cccdlflags" in
5933     '') case "$gccversion" in
5934                 '') case "$osname" in
5935                         hpux)   dflt='+z' ;;
5936                         next)   dflt='none' ;;
5937                         irix*)  dflt='-KPIC' ;;
5938                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5939                         sunos)  dflt='-pic' ;;
5940                         *)      dflt='none' ;;
5941                     esac
5942                         ;;
5943                 *)  case "$osname" in
5944                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5945                         *)      dflt='-fpic' ;;
5946                     esac ;;
5947             esac ;;
5948         ' ') dflt='none' ;;
5949     *)  dflt="$cccdlflags" ;;
5950     esac
5951     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5952     . ./myread
5953     case "$ans" in
5954     none) cccdlflags=' ' ;;
5955     *) cccdlflags="$ans" ;;
5956     esac
5957
5958     cat << EOM
5959
5960 Some systems use ld to create libraries that can be dynamically loaded,
5961 while other systems (such as those using ELF) use $cc.
5962
5963 EOM
5964         case "$ld" in
5965         '')     $cat >try.c <<'EOM'
5966 /* Test for whether ELF binaries are produced */
5967 #include <fcntl.h>
5968 #include <stdlib.h>
5969 int main() {
5970         char b[4];
5971         int i = open("a.out",O_RDONLY);
5972         if(i == -1) 
5973                 exit(1); /* fail */
5974         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5975                 exit(0); /* succeed (yes, it's ELF) */
5976         else
5977                 exit(1); /* fail */
5978 }
5979 EOM
5980                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5981                         cat <<EOM
5982 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5983 EOM
5984                         dflt="$cc"
5985                 else
5986                         echo "I'll use ld to build dynamic libraries."
5987                         dflt='ld'
5988                 fi
5989                 rm -f try.c a.out
5990                 ;;
5991         *)      dflt="$ld"
5992                 ;;
5993         esac
5994
5995     rp="What command should be used to create dynamic libraries?"
5996     . ./myread
5997         ld="$ans"
5998
5999     cat << EOM
6000
6001 Some systems may require passing special flags to $ld to create a
6002 library that can be dynamically loaded.  If your ld flags include
6003 -L/other/path options to locate libraries outside your loader's normal
6004 search path, you may need to specify those -L options here as well.  To
6005 use no flags, say "none".
6006
6007 EOM
6008     case "$lddlflags" in
6009     '') case "$osname" in
6010                         beos) dflt='-nostart' ;;
6011                         hpux)  dflt='-b' ;;
6012                         linux|irix*)    dflt='-shared' ;;
6013                         next)  dflt='none' ;;
6014                         solaris) dflt='-G' ;;
6015                         sunos) dflt='-assert nodefinitions' ;;
6016                         svr4*|esix*) dflt="-G $ldflags" ;;
6017                 *)     dflt='none' ;;
6018                         esac
6019                         ;;
6020     *) dflt="$lddlflags" ;;
6021     esac
6022
6023         : Try to guess additional flags to pick up local libraries.
6024         : Be careful not to append to a plain 'none'
6025         case "$dflt" in
6026         none) dflt='' ;;
6027         esac
6028         for thisflag in $ldflags; do
6029                 case "$thisflag" in
6030                 -L*)
6031                         case " $dflt " in
6032                         *" $thisflag "*) ;;
6033                         *) dflt="$dflt $thisflag" ;;
6034                         esac
6035                         ;;
6036                 esac
6037         done
6038
6039         case "$dflt" in
6040         ''|' ') dflt='none' ;;
6041         esac
6042
6043     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6044     . ./myread
6045     case "$ans" in
6046     none) lddlflags=' ' ;;
6047     *) lddlflags="$ans" ;;
6048     esac
6049
6050         cat <<EOM
6051
6052 Some systems may require passing special flags to $cc to indicate that
6053 the resulting executable will use dynamic linking.  To use no flags,
6054 say "none".
6055
6056 EOM
6057     case "$ccdlflags" in
6058     '') case "$osname" in
6059                 hpux)   dflt='-Wl,-E' ;;
6060                 linux)  dflt='-rdynamic' ;;
6061                 next)   dflt='none' ;;
6062                 sunos)  dflt='none' ;;
6063                 *)      dflt='none' ;;
6064             esac ;;
6065     ' ')  dflt='none' ;;
6066     *)  dflt="$ccdlflags" ;;
6067     esac
6068     rp="Any special flags to pass to $cc to use dynamic linking?"
6069     . ./myread
6070     case "$ans" in
6071     none) ccdlflags=' ' ;;
6072     *) ccdlflags="$ans" ;;
6073     esac
6074     ;;
6075 *)  usedl="$undef"
6076         ld='ld'
6077     dlsrc='dl_none.xs'
6078     lddlflags=''
6079     ccdlflags=''
6080     ;;
6081 esac
6082
6083 also=''
6084 case "$usedl" in
6085 $undef)
6086         # No dynamic loading being used, so don't bother even to prompt.
6087         useshrplib='false'
6088         ;;
6089 *)      case "$useshrplib" in
6090         '')     case "$osname" in
6091                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6092                         dflt=y
6093                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6094                         ;;
6095                 next*)
6096                         case "$osvers" in
6097                         4*)     dflt=y
6098                                 also='Building a shared libperl is needed for MAB support.'
6099                                 ;;
6100                         *)      dflt=n
6101                                 ;;
6102                         esac
6103                         ;;
6104                 *)      dflt=n
6105                         ;;
6106                 esac
6107                 ;;
6108         $define|true|[Yy]*)
6109                 dflt=y
6110                 ;;
6111         *)      dflt=n
6112                 ;;
6113         esac
6114         $cat << EOM
6115
6116 The perl executable is normally obtained by linking perlmain.c with
6117 libperl${_a}, any static extensions (usually just DynaLoader), and
6118 any other libraries needed on this system (such as -lm, etc.).  Since
6119 your system supports dynamic loading, it is probably possible to build
6120 a shared libperl.$so.  If you will have more than one executable linked
6121 to libperl.$so, this will significantly reduce the size of each
6122 executable, but it may have a noticeable affect on performance.  The
6123 default is probably sensible for your system.
6124 $also
6125
6126 EOM
6127         rp="Build a shared libperl.$so (y/n)"
6128         . ./myread
6129         case "$ans" in
6130         true|$define|[Yy]*)
6131                 useshrplib='true'  ;;
6132         *)      useshrplib='false' ;;
6133         esac
6134         ;;
6135 esac
6136
6137 case "$useshrplib" in
6138 true)
6139         case "$libperl" in
6140         '')
6141                 # Figure out a good name for libperl.so.  Since it gets stored in
6142                 # a version-specific architecture-dependent library, the version
6143                 # number isn't really that important, except for making cc/ld happy.
6144                 #
6145                 # A name such as libperl.so.3.1
6146                 majmin="libperl.$so.$patchlevel.$subversion"
6147                 # A name such as libperl.so.301
6148                 majonly=`echo $patchlevel $subversion |
6149                         $awk '{printf "%d%02d", $1, $2}'`
6150                 majonly=libperl.$so.$majonly
6151                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6152                 # rely on figuring it out from the naming of libc.
6153                 case "${osname}${osvers}" in
6154                 next4*)
6155                         dflt=libperl.5.$so
6156                         # XXX How handle the --version stuff for MAB?
6157                         ;;
6158                 linux*)  # ld won't link with a bare -lperl otherwise.
6159                         dflt=libperl.$so
6160                         ;;
6161                 cygwin*) # include version
6162                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6163                         ;;
6164                 *)      # Try to guess based on whether libc has major.minor.
6165                         case "$libc" in
6166                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6167                         *libc.$so.[0-9]*) dflt=$majonly ;;
6168                         *)      dflt=libperl.$so ;;
6169                         esac
6170                         ;;
6171                 esac
6172                 ;;
6173         *)      dflt=$libperl
6174                 ;;
6175         esac
6176         cat << EOM
6177
6178 I need to select a good name for the shared libperl.  If your system uses
6179 library names with major and minor numbers, then you might want something
6180 like $majmin.  Alternatively, if your system uses a single version
6181 number for shared libraries, then you might want to use $majonly.
6182 Or, your system might be quite happy with a simple libperl.$so.
6183
6184 Since the shared libperl will get installed into a version-specific
6185 architecture-dependent directory, the version number of the shared perl
6186 library probably isn't important, so the default should be o.k.
6187
6188 EOM
6189         rp='What name do you want to give to the shared libperl?'
6190         . ./myread
6191         libperl=$ans
6192         echo "Ok, I'll use $libperl"
6193         ;;
6194 *)
6195         libperl="libperl${_a}"
6196         ;;
6197 esac
6198
6199 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6200 case "$shrpdir" in
6201 '') ;;
6202 *)      $cat >&4 <<EOM
6203 WARNING:  Use of the shrpdir variable for the installation location of
6204 the shared $libperl is not supported.  It was never documented and
6205 will not work in this version.  Let me (perlbug@perl.com)
6206 know of any problems this may cause.
6207
6208 EOM
6209         case "$shrpdir" in
6210         "$archlibexp/CORE")
6211                 $cat >&4 <<EOM
6212 But your current setting of $shrpdir is
6213 the default anyway, so it's harmless.
6214 EOM
6215                 ;;
6216         *)
6217                 $cat >&4 <<EOM
6218 Further, your current attempted setting of $shrpdir
6219 conflicts with the value of $archlibexp/CORE
6220 that installperl will use.
6221 EOM
6222                 ;;
6223         esac
6224         ;;
6225 esac
6226
6227 # How will the perl executable find the installed shared $libperl?
6228 # Add $xxx to ccdlflags.
6229 # If we can't figure out a command-line option, use $shrpenv to
6230 # set env LD_RUN_PATH.  The main perl makefile uses this.
6231 shrpdir=$archlibexp/CORE
6232 xxx=''
6233 tmp_shrpenv=''
6234 if "$useshrplib"; then
6235     case "$osname" in 
6236         aix)
6237                 # We'll set it in Makefile.SH...
6238                 ;;
6239         solaris|netbsd)
6240                 xxx="-R $shrpdir"
6241                 ;;
6242         freebsd)
6243                 xxx="-Wl,-R$shrpdir"
6244                 ;;
6245         linux|irix*|dec_osf)
6246                 xxx="-Wl,-rpath,$shrpdir"
6247                 ;;
6248         next)
6249                 # next doesn't like the default...
6250                 ;;
6251         beos)
6252                 # beos doesn't like the default, either.
6253                 ;;
6254         hpux*)
6255                 # hpux doesn't like the default, either.
6256                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6257                 ;;
6258         *)
6259                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6260                 ;;
6261         esac
6262         case "$xxx" in
6263         '') ;;
6264         *)      
6265                 # Only add $xxx if it isn't already in ccdlflags.
6266                 case " $ccdlflags " in
6267                 *" $xxx "*)     ;;
6268                 *)      ccdlflags="$ccdlflags $xxx"
6269                         cat <<EOM >&4
6270
6271 Adding $xxx to the flags
6272 passed to $ld so that the perl executable will find the 
6273 installed shared $libperl.
6274
6275 EOM
6276                         ;;
6277                 esac
6278                 ;;
6279         esac
6280 fi
6281 # Fix ccdlflags in AIX for building external extensions.
6282 # (For building Perl itself bare -bE:perl.exp is needed,
6283 #  Makefile.SH takes care of this.)
6284 case "$osname" in
6285 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6286 esac
6287 # Respect a hint or command-line value.
6288 case "$shrpenv" in
6289 '') shrpenv="$tmp_shrpenv" ;;
6290 esac
6291 case "$ldlibpthname" in
6292 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6293 none)   ldlibpthname='' ;;
6294 esac
6295
6296 : determine where manual pages go
6297 set man1dir man1dir none
6298 eval $prefixit
6299 $cat <<EOM
6300
6301 $spackage has manual pages available in source form.
6302 EOM
6303 case "$nroff" in
6304 nroff)
6305         echo "However, you don't have nroff, so they're probably useless to you."
6306         case "$man1dir" in
6307         '') man1dir="none";;
6308         esac;;
6309 esac
6310 echo "If you don't want the manual sources installed, answer 'none'."
6311 case "$man1dir" in
6312 ' ') dflt=none
6313         ;;
6314 '')
6315         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6316         lookpath="$lookpath $prefixexp/man/p_man/man1"
6317         lookpath="$lookpath $prefixexp/man/u_man/man1"
6318         lookpath="$lookpath $prefixexp/man/man.1"
6319         case "$sysman" in
6320         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6321         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6322         esac
6323         set dflt
6324         eval $prefixup
6325         ;;
6326 *)  dflt="$man1dir"
6327         ;;
6328 esac
6329 echo " "
6330 fn=dn+~
6331 rp="Where do the main $spackage manual pages (source) go?"
6332 . ./getfile
6333 if $test "X$man1direxp" != "X$ansexp"; then
6334         installman1dir=''
6335 fi
6336 man1dir="$ans"
6337 man1direxp="$ansexp"
6338 case "$man1dir" in
6339 '')     man1dir=' '
6340         installman1dir='';;
6341 esac
6342
6343 : Change installation prefix, if necessary.
6344 if $test X"$prefix" != X"$installprefix"; then
6345         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6346 else
6347         installman1dir="$man1direxp"
6348 fi
6349
6350 : What suffix to use on installed man pages
6351
6352 case "$man1dir" in
6353 ' ')
6354         man1ext='0'
6355         ;;
6356 *)
6357         rp="What suffix should be used for the main $spackage man pages?"
6358         case "$man1ext" in
6359         '')     case "$man1dir" in
6360                 *1)  dflt=1 ;;
6361                 *1p) dflt=1p ;;
6362                 *1pm) dflt=1pm ;;
6363                 *l) dflt=l;;
6364                 *n) dflt=n;;
6365                 *o) dflt=o;;
6366                 *p) dflt=p;;
6367                 *C) dflt=C;;
6368                 *L) dflt=L;;
6369                 *L1) dflt=L1;;
6370                 *) dflt=1;;
6371                 esac
6372                 ;;
6373         *)      dflt="$man1ext";;
6374         esac
6375         . ./myread
6376         man1ext="$ans"
6377         ;;
6378 esac
6379
6380 : see if we can have long filenames
6381 echo " "
6382 rmlist="$rmlist /tmp/cf$$"
6383 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6384 first=123456789abcdef
6385 second=/tmp/cf$$/$first
6386 $rm -f $first $second
6387 if (echo hi >$first) 2>/dev/null; then
6388         if $test -f 123456789abcde; then
6389                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6390                 val="$undef"
6391         else
6392                 if (echo hi >$second) 2>/dev/null; then
6393                         if $test -f /tmp/cf$$/123456789abcde; then
6394                                 $cat <<'EOM'
6395 That's peculiar... You can have filenames longer than 14 characters, but only
6396 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6397 I shall consider your system cannot support long filenames at all.
6398 EOM
6399                                 val="$undef"
6400                         else
6401                                 echo 'You can have filenames longer than 14 characters.' >&4
6402                                 val="$define"
6403                         fi
6404                 else
6405                         $cat <<'EOM'
6406 How confusing! Some of your filesystems are sane enough to allow filenames
6407 longer than 14 characters but some others like /tmp can't even think about them.
6408 So, for now on, I shall assume your kernel does not allow them at all.
6409 EOM
6410                         val="$undef"
6411                 fi
6412         fi
6413 else
6414         $cat <<'EOM'
6415 You can't have filenames longer than 14 chars.  You can't even think about them!
6416 EOM
6417         val="$undef"
6418 fi 
6419 set d_flexfnam
6420 eval $setvar
6421 $rm -rf /tmp/cf$$ 123456789abcde*
6422
6423 : determine where library module manual pages go
6424 set man3dir man3dir none
6425 eval $prefixit
6426 $cat <<EOM
6427
6428 $spackage has manual pages for many of the library modules.
6429 EOM
6430
6431 case "$nroff" in
6432 nroff)
6433         $cat <<'EOM'
6434 However, you don't have nroff, so they're probably useless to you.
6435 EOM
6436         case "$man3dir" in
6437         '') man3dir="none";;
6438         esac;;
6439 esac
6440
6441 case "$d_flexfnam" in
6442 undef)
6443         $cat <<'EOM'
6444 However, your system can't handle the long file names like File::Basename.3. 
6445 EOM
6446         case "$man3dir" in
6447         '') man3dir="none";;
6448         esac;;
6449 esac
6450
6451 echo "If you don't want the manual sources installed, answer 'none'."
6452 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6453 case "$man3dir" in
6454 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6455         if $test -d "$privlib/man/man3"; then
6456                 cat <<EOM >&4
6457
6458 WARNING:  Previous versions of perl installed man3 pages into
6459 $privlib/man/man3.  This version will suggest a 
6460 new default of $dflt.  
6461 EOM
6462                 tdflt=$dflt
6463                 dflt='n'
6464                 rp='Do you wish to preserve the old behavior?(y/n)'
6465                 . ./myread
6466                 case "$ans" in
6467                 y*) dflt="$privlib/man/man3" ;;
6468                 *)  dflt=$tdflt ;;
6469                 esac
6470     fi
6471         ;;
6472 ' ') dflt=none;;
6473 *)      dflt="$man3dir" ;;
6474 esac
6475 echo " "
6476 fn=dn+~
6477 rp="Where do the $package library man pages (source) go?"
6478 . ./getfile
6479 man3dir="$ans"
6480 man3direxp="$ansexp"
6481 case "$man1dir" in
6482 '')     man3dir=' '
6483         installman3dir='';;
6484 esac
6485
6486 : Change installation prefix, if necessary.
6487 if $test X"$prefix" != X"$installprefix"; then
6488         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6489 else
6490         installman3dir="$man3direxp"
6491 fi
6492
6493 : What suffix to use on installed man pages
6494 case "$man3dir" in
6495 ' ')
6496         man3ext='0'
6497         ;;
6498 *)
6499         rp="What suffix should be used for the $package library man pages?"
6500         case "$man3ext" in
6501         '')     case "$man3dir" in
6502                 *3)  dflt=3 ;;
6503                 *3p) dflt=3p ;;
6504                 *3pm) dflt=3pm ;;
6505                 *l) dflt=l;;
6506                 *n) dflt=n;;
6507                 *o) dflt=o;;
6508                 *p) dflt=p;;
6509                 *C) dflt=C;;
6510                 *L) dflt=L;;
6511                 *L3) dflt=L3;;
6512                 *) dflt=3;;
6513                 esac
6514                 ;;
6515         *)      dflt="$man3ext";;
6516         esac
6517         . ./myread
6518         man3ext="$ans"
6519         ;;
6520 esac
6521
6522 : see if we have to deal with yellow pages, now NIS.
6523 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6524         if $test -f /usr/etc/nibindd; then
6525                 echo " "
6526                 echo "I'm fairly confident you're on a NeXT."
6527                 echo " "
6528                 rp='Do you get the hosts file via NetInfo?'
6529                 dflt=y
6530                 case "$hostcat" in
6531                 nidump*) ;;
6532                 '') ;;
6533                 *) dflt=n;;
6534                 esac
6535                 . ./myread
6536                 case "$ans" in
6537                 y*) hostcat='nidump hosts .';;
6538                 *)      case "$hostcat" in
6539                         nidump*) hostcat='';;
6540                         esac
6541                         ;;
6542                 esac
6543         fi
6544         case "$hostcat" in
6545         nidump*) ;;
6546         *)
6547                 case "$hostcat" in
6548                 *ypcat*) dflt=y;;
6549                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6550                                 dflt=y
6551                         else
6552                                 dflt=n
6553                         fi;;
6554                 *) dflt=n;;
6555                 esac
6556                 echo " "
6557                 rp='Are you getting the hosts file via yellow pages?'
6558                 . ./myread
6559                 case "$ans" in
6560                 y*) hostcat='ypcat hosts';;
6561                 *) hostcat='cat /etc/hosts';;
6562                 esac
6563                 ;;
6564         esac
6565 fi
6566 case "$hostcat" in
6567 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6568 esac
6569 case "$groupcat" in
6570 '') test -f /etc/group && groupcat='cat /etc/group';;
6571 esac
6572 case "$passcat" in
6573 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6574 esac
6575
6576 : now get the host name
6577 echo " "
6578 echo "Figuring out host name..." >&4
6579 case "$myhostname" in
6580 '') cont=true
6581         echo 'Maybe "hostname" will work...'
6582         if tans=`sh -c hostname 2>&1` ; then
6583                 myhostname=$tans
6584                 phostname=hostname
6585                 cont=''
6586         fi
6587         ;;
6588 *) cont='';;
6589 esac
6590 if $test "$cont"; then
6591         if ./xenix; then
6592                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6593                 if tans=`cat /etc/systemid 2>&1` ; then
6594                         myhostname=$tans
6595                         phostname='cat /etc/systemid'
6596                         echo "Whadyaknow.  Xenix always was a bit strange..."
6597                         cont=''
6598                 fi
6599         elif $test -r /etc/systemid; then
6600                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6601         fi
6602 fi
6603 if $test "$cont"; then
6604         echo 'No, maybe "uuname -l" will work...'
6605         if tans=`sh -c 'uuname -l' 2>&1` ; then
6606                 myhostname=$tans
6607                 phostname='uuname -l'
6608         else
6609                 echo 'Strange.  Maybe "uname -n" will work...'
6610                 if tans=`sh -c 'uname -n' 2>&1` ; then
6611                         myhostname=$tans
6612                         phostname='uname -n'
6613                 else
6614                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6615                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6616                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6617                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6618                         else
6619                                 case "$myhostname" in
6620                                 '') echo "Does this machine have an identity crisis or something?"
6621                                         phostname='';;
6622                                 *)
6623                                         echo "Well, you said $myhostname before..."
6624                                         phostname='echo $myhostname';;
6625                                 esac
6626                         fi
6627                 fi
6628         fi
6629 fi
6630 : you do not want to know about this
6631 set $myhostname
6632 myhostname=$1
6633
6634 : verify guess
6635 if $test "$myhostname" ; then
6636         dflt=y
6637         rp='Your host name appears to be "'$myhostname'".'" Right?"
6638         . ./myread
6639         case "$ans" in
6640         y*) ;;
6641         *) myhostname='';;
6642         esac
6643 fi
6644
6645 : bad guess or no guess
6646 while $test "X$myhostname" = X ; do
6647         dflt=''
6648         rp="Please type the (one word) name of your host:"
6649         . ./myread
6650         myhostname="$ans"
6651 done
6652
6653 : translate upper to lower if necessary
6654 case "$myhostname" in
6655 *[A-Z]*)
6656         echo "(Normalizing case in your host name)"
6657         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6658         ;;
6659 esac
6660
6661 case "$myhostname" in
6662 *.*)
6663         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6664         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6665         echo "(Trimming domain name from host name--host name is now $myhostname)"
6666         ;;
6667 *) case "$mydomain" in
6668         '')
6669                 {
6670                         test "X$hostcat" = "Xypcat hosts" &&
6671                         ypmatch "$myhostname" hosts 2>/dev/null |\
6672                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6673                         $test -s hosts
6674                 } || {
6675                         test "X$hostcat" != "X" &&
6676                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6677                                         /[       ]$myhostname[  . ]/p" > hosts
6678                 }
6679                 tmp_re="[       . ]"
6680                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6681                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6682                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6683                         hosts | $sort | $uniq | \
6684                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6685                 case `$echo X$dflt` in
6686                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6687                         dflt=.
6688                         ;;
6689                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6690                         ;;
6691                 esac
6692                 case "$dflt" in
6693                 .)
6694                         tans=`./loc resolv.conf X /etc /usr/etc`
6695                         if $test -f "$tans"; then
6696                                 echo "(Attempting domain name extraction from $tans)"
6697                                 dflt=.`$sed -n -e 's/   / /g' \
6698                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6699                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6700                                 case "$dflt" in
6701                                 .) dflt=.`$sed -n -e 's/        / /g' \
6702                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6703                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6704                                         ;;
6705                                 esac
6706                         fi
6707                         ;;
6708                 esac
6709                 case "$dflt" in
6710                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6711                         dflt=.`sh -c domainname 2>/dev/null`
6712                         case "$dflt" in
6713                         '') dflt='.';;
6714                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6715                         esac
6716                         ;;
6717                 esac
6718                 case "$dflt" in
6719                 .) echo "(Lost all hope -- silly guess then)"
6720                         dflt='.uucp'
6721                         ;;
6722                 esac
6723                 $rm -f hosts
6724                 ;;
6725         *) dflt="$mydomain";;
6726         esac;;
6727 esac
6728 echo " "
6729 rp="What is your domain name?"
6730 . ./myread
6731 tans="$ans"
6732 case "$ans" in
6733 '') ;;
6734 .*) ;;
6735 *) tans=".$tans";;
6736 esac
6737 mydomain="$tans"
6738
6739 : translate upper to lower if necessary
6740 case "$mydomain" in
6741 *[A-Z]*)
6742         echo "(Normalizing case in your domain name)"
6743         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6744         ;;
6745 esac
6746
6747 : a little sanity check here
6748 case "$phostname" in
6749 '') ;;
6750 *)
6751         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6752         $myhostname$mydomain|$myhostname) ;;
6753         *)
6754                 case "$phostname" in
6755                 sed*)
6756                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6757                         ;;
6758                 *)
6759                         echo "(That doesn't agree with your $phostname command, by the way.)"
6760                         ;;
6761                 esac
6762         ;;
6763         esac
6764         ;;
6765 esac
6766
6767 $cat <<EOM
6768
6769 I need to get your e-mail address in Internet format if possible, i.e.
6770 something like user@host.domain. Please answer accurately since I have
6771 no easy means to double check it. The default value provided below
6772 is most probably close to reality but may not be valid from outside
6773 your organization...
6774
6775 EOM
6776 cont=x
6777 while test "$cont"; do
6778         case "$cf_email" in
6779         '') dflt="$cf_by@$myhostname$mydomain";;
6780         *) dflt="$cf_email";;
6781         esac
6782         rp='What is your e-mail address?'
6783         . ./myread
6784         cf_email="$ans"
6785         case "$cf_email" in
6786         *@*.*) cont='' ;;
6787         *)
6788                 rp='Address does not look like an Internet one.  Use it anyway?'
6789                 case "$fastread" in
6790                 yes) dflt=y ;;
6791                 *) dflt=n ;;
6792                 esac
6793                 . ./myread
6794                 case "$ans" in
6795                 y*) cont='' ;;
6796                 *) echo " " ;;
6797                 esac
6798                 ;;
6799         esac
6800 done
6801
6802 $cat <<EOM
6803
6804 If you or somebody else will be maintaining perl at your site, please
6805 fill in the correct e-mail address here so that they may be contacted
6806 if necessary. Currently, the "perlbug" program included with perl
6807 will send mail to this address in addition to perlbug@perl.com. You may
6808 enter "none" for no administrator.
6809
6810 EOM
6811 case "$perladmin" in
6812 '') dflt="$cf_email";;
6813 *) dflt="$perladmin";;
6814 esac
6815 rp='Perl administrator e-mail address'
6816 . ./myread
6817 perladmin="$ans"
6818
6819 : figure out how to guarantee perl startup
6820 case "$startperl" in
6821 '')
6822         case "$sharpbang" in
6823         *!)
6824                 $cat <<EOH
6825
6826 I can use the #! construct to start perl on your system. This will
6827 make startup of perl scripts faster, but may cause problems if you
6828 want to share those scripts and perl is not in a standard place
6829 ($binexp/perl) on all your platforms. The alternative is to force
6830 a shell by starting the script with a single ':' character.
6831
6832 EOH
6833                 dflt="$binexp/perl"
6834                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6835                 . ./myread
6836                 case "$ans" in
6837                 none)   startperl=": # use perl";;
6838                 *)      startperl="#!$ans"
6839                         if $test 30 -lt `echo "$ans" | wc -c`; then
6840                                 $cat >&4 <<EOM
6841
6842 WARNING:  Some systems limit the #! command to 32 characters.
6843 If you experience difficulty running Perl scripts with #!, try
6844 installing Perl in a directory with a shorter pathname.
6845
6846 EOM
6847                         fi ;;
6848                 esac
6849                 ;;
6850         *) startperl=": # use perl"
6851                 ;;
6852         esac
6853         ;;
6854 esac
6855 echo "I'll use $startperl to start perl scripts."
6856
6857 : figure best path for perl in scripts
6858 case "$perlpath" in
6859 '')
6860         perlpath="$binexp/perl"
6861         case "$startperl" in
6862         *!*) ;;
6863         *)
6864                 $cat <<EOH
6865
6866 I will use the "eval 'exec'" idiom to start Perl on your system.
6867 I can use the full path of your Perl binary for this purpose, but
6868 doing so may cause problems if you want to share those scripts and
6869 Perl is not always in a standard place ($binexp/perl).
6870
6871 EOH
6872                 dflt="$binexp/perl"
6873                 rp="What path shall I use in \"eval 'exec'\"?"
6874                 . ./myread
6875                 perlpath="$ans"
6876                 ;;
6877         esac
6878         ;;
6879 esac
6880 case "$startperl" in
6881 *!*)    ;;
6882 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6883 esac
6884
6885 : determine where public executable scripts go
6886 set scriptdir scriptdir
6887 eval $prefixit
6888 case "$scriptdir" in
6889 '')
6890         dflt="$bin"
6891         : guess some guesses
6892         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6893         $test -d /usr/share/bin     && dflt=/usr/share/bin
6894         $test -d /usr/local/script  && dflt=/usr/local/script
6895         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6896         $test -d $prefixexp/script  && dflt=$prefixexp/script
6897         set dflt
6898         eval $prefixup
6899         ;;
6900 *)  dflt="$scriptdir"
6901         ;;
6902 esac
6903 $cat <<EOM
6904  
6905 Some installations have a separate directory just for executable scripts so
6906 that they can mount it across multiple architectures but keep the scripts in
6907 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6908 Or you might just lump your scripts in with all your other executables.
6909  
6910 EOM
6911 fn=d~
6912 rp='Where do you keep publicly executable scripts?'
6913 . ./getfile
6914 if $test "X$ansexp" != "X$scriptdirexp"; then
6915         installscript=''
6916 fi
6917 scriptdir="$ans"
6918 scriptdirexp="$ansexp"
6919 : Change installation prefix, if necessary.
6920 if $test X"$prefix" != X"$installprefix"; then
6921         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6922 else
6923         installscript="$scriptdirexp"
6924 fi
6925
6926 : determine where site specific architecture-dependent libraries go.
6927 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6928 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6929 : sitelib may have an optional trailing /share.
6930 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6931 tdflt="$tdflt/$archname"
6932 set sitearch sitearch none
6933 eval $prefixit
6934 case "$sitearch" in
6935 '')     dflt="$tdflt" ;;
6936 *)      dflt="$sitearch" ;;
6937 esac
6938 $cat <<EOM
6939
6940 The installation process will also create a directory for
6941 architecture-dependent site-specific extensions and modules.
6942
6943 EOM
6944 fn=nd~+
6945 rp='Pathname for the site-specific architecture-dependent library files?'
6946 . ./getfile
6947 sitearch="$ans"
6948 sitearchexp="$ansexp"
6949 : Change installation prefix, if necessary.
6950 if $test X"$prefix" != X"$installprefix"; then
6951         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6952 else
6953         installsitearch="$sitearchexp"
6954 fi
6955
6956 : determine where add-on public executables go
6957 case "$sitebin" in
6958 '')     dflt=$siteprefix/bin ;;
6959 *)      dflt=$sitebin ;;
6960 esac
6961 fn=d~
6962 rp='Pathname where the add-on public executables should be installed?'
6963 . ./getfile
6964 sitebin="$ans"
6965 sitebinexp="$ansexp"
6966 : Change installation prefix, if necessary.
6967 if $test X"$prefix" != X"$installprefix"; then
6968         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6969 else
6970         installsitebin="$sitebinexp"
6971 fi
6972
6973 : see if sqrtl exists
6974 set sqrtl d_sqrtl
6975 eval $inlibc
6976
6977 cat <<EOM
6978
6979 Perl can be built to take advantage of long doubles which
6980 (if available) may give more accuracy and range for floating point numbers.
6981
6982 If this doesn't make any sense to you, just accept the default 'n'.
6983 EOM
6984
6985 case "$ccflags" in
6986 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6987 esac
6988
6989 case "$uselongdouble" in
6990 $define|true|[yY]*)     dflt='y';;
6991 *) dflt='n';;
6992 esac
6993 rp='Try to use long doubles if available?'
6994 . ./myread
6995 case "$ans" in
6996 y|Y)    val="$define"   ;;
6997 *)      val="$undef"    ;;
6998 esac
6999 set uselongdouble
7000 eval $setvar
7001
7002 case "$uselongdouble" in
7003 true|[yY]*) uselongdouble="$define" ;;
7004 esac
7005
7006 case "$uselongdouble" in
7007 $define)
7008 : Look for a hint-file generated 'call-back-unit'.  If the
7009 : user has specified that long doubles should be used,
7010 : we may need to set or change some other defaults.
7011         if $test -f uselongdouble.cbu; then
7012                 echo "Your platform has some specific hints for long doubles, using them..."
7013                 . ./uselongdouble.cbu
7014         else
7015                 $cat <<EOM
7016 (Your platform doesn't have any specific hints for long doubles.)
7017 EOM
7018         fi
7019         ;;
7020 esac
7021
7022 case "$uselongdouble:$d_sqrtl" in
7023 $define:$undef)
7024                 $cat <<EOM >&4
7025
7026 You requested the use of long doubles but you do not seem to have
7027 the mathematic functions for long doubles.  I'm disabling the use
7028 of long doubles.
7029 EOM
7030         uselongdouble=$undef
7031         ;;
7032 esac
7033
7034 cat <<EOM
7035
7036 Perl can be built to take advantage of long longs which
7037 (if available) may give more range for integer numbers.
7038
7039 If this doesn't make any sense to you, just accept the default 'n'.
7040 EOM
7041
7042 case "$ccflags" in
7043 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7044 esac
7045
7046 case "$uselonglong" in
7047 '')     dflt='y';;
7048 esac
7049 rp='Try to use long longs if available?'
7050 . ./myread
7051 case "$ans" in
7052 y|Y)    val="$define"   ;;
7053 *)      val="$undef"    ;;
7054 esac
7055 set uselonglong
7056 eval $setvar
7057
7058 case "$uselonglong" in
7059 true|[yY]*) uselonglong="$define" ;;
7060 esac
7061
7062 case "$uselonglong" in
7063 $define)
7064 : Look for a hint-file generated 'call-back-unit'.  If the
7065 : user has specified that long longs should be used,
7066 : we may need to set or change some other defaults.
7067         if $test -f uselonglong.cbu; then
7068                 echo "Your platform has some specific hints for long longs, using them..."
7069                 . ./uselonglong.cbu
7070         else
7071                 $cat <<EOM
7072 (Your platform doesn't have any specific hints for long longs.)
7073 EOM
7074         fi
7075         ;;
7076 esac
7077
7078 cat <<EOM
7079
7080 Previous version of $package used the standard IO mechanisms as defined
7081 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7082 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7083 the default.  This abstraction layer can use AT&T's sfio (if you already
7084 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7085 problems with some extension modules.  Using PerlIO with stdio is safe,
7086 but it is slower than plain stdio and therefore is not the default.
7087
7088 If this doesn't make any sense to you, just accept the default 'n'.
7089 EOM
7090 case "$useperlio" in
7091 $define|true|[yY]*)     dflt='y';;
7092 *) dflt='n';;
7093 esac
7094 rp='Use the experimental PerlIO abstraction layer?'
7095 . ./myread
7096 case "$ans" in
7097 y|Y) 
7098         val="$define"
7099         ;;     
7100 *)      
7101         echo "Ok, doing things the stdio way"
7102         val="$undef"
7103         ;;
7104 esac
7105 set useperlio
7106 eval $setvar 
7107
7108 case "$vendorprefix" in
7109 '')     d_vendorbin="$undef"
7110         vendorbin=''
7111         vendorbinexp=''
7112         ;;
7113 *)      d_vendorbin="$define"
7114         : determine where vendor-supplied executables go.
7115         dflt=$vendorprefix/bin
7116         fn=d~+
7117         rp='Pathname for the vendor-supplied executables directory?'
7118         . ./getfile
7119         vendorbin="$ans"
7120         vendorbinexp="$ansexp"
7121         : Change installation prefix, if necessary.
7122         if $test X"$prefix" != X"$installprefix"; then
7123                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7124         else
7125                 installvendorbin="$vendorbinexp"
7126         fi
7127         ;;
7128 esac
7129
7130 : check for length of double
7131 echo " "
7132 case "$doublesize" in
7133 '')
7134         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7135         $cat >try.c <<'EOCP'
7136 #include <stdio.h>
7137 int main()
7138 {
7139     printf("%d\n", (int)sizeof(double));
7140     exit(0);
7141 }
7142 EOCP
7143         set try
7144         if eval $compile_ok; then
7145                 doublesize=`./try`
7146                 $echo " $doublesize bytes." >&4
7147         else
7148                 dflt='8'
7149                 echo "(I can't seem to compile the test program.  Guessing...)"
7150                 rp="What is the size of a double precision number (in bytes)?"
7151                 . ./myread
7152                 doublesize="$ans"
7153         fi
7154         ;;
7155 esac
7156 $rm -f try.c try
7157
7158 : check for long doubles
7159 echo " "
7160 $echo $n "Checking to see if your system supports long double..." $c >&4
7161 echo 'int main() { long double x = 7.0; }' > try.c
7162 set try
7163 if eval $compile; then
7164         val="$define"
7165         echo " Yes, it does." >&4
7166 else
7167         val="$undef"
7168         echo " No, it doesn't." >&4
7169 fi
7170 $rm try.*
7171 set d_longdbl
7172 eval $setvar
7173
7174 : check for length of long double
7175 case "${d_longdbl}${longdblsize}" in
7176 $define)
7177         echo " "
7178         $echo $n "Checking to see how big your long doubles are..." $c >&4
7179         $cat >try.c <<'EOCP'
7180 #include <stdio.h>
7181 int main()
7182 {
7183         printf("%d\n", sizeof(long double));
7184 }
7185 EOCP
7186         set try
7187         set try
7188         if eval $compile; then
7189                 longdblsize=`./try$exe_ext`
7190                 $echo " $longdblsize bytes." >&4
7191         else
7192                 dflt='8'
7193                 echo " "
7194                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7195                 rp="What is the size of a long double (in bytes)?"
7196                 . ./myread
7197                 longdblsize="$ans"
7198         fi
7199         if $test "X$doublesize" = "X$longdblsize"; then
7200                 echo "(That isn't any different from an ordinary double.)"
7201         fi      
7202         ;;
7203 esac
7204 $rm -f try.* try
7205
7206 : Check how to convert floats to strings.
7207 if test "X$d_Gconvert" = X; then
7208         echo " "
7209         echo "Checking for an efficient way to convert floats to strings."
7210         $cat >try.c <<EOP
7211 #ifdef TRY_gconvert
7212 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7213 char *myname = "gconvert";
7214 #endif
7215 #ifdef TRY_gcvt
7216 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7217 char *myname = "gcvt";
7218 #endif
7219 #ifdef TRY_qgcvt
7220 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7221 char *myname = "qgcvt";
7222 #define DOUBLETYPE long double
7223 #endif
7224 #ifdef TRY_sprintf
7225 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7226 char *myname = "sprintf";
7227 #endif
7228
7229 #ifndef DOUBLETYPE
7230 #define DOUBLETYPE double
7231 #endif
7232
7233 #include <stdio.h>
7234
7235 #define I_STDLIB $i_stdlib
7236 #ifdef I_STDLIB
7237 #include <stdlib.h>
7238 #endif
7239
7240 int
7241 checkit(expect, got)
7242 char *expect;
7243 char *got;
7244 {
7245     if (strcmp(expect, got)) {
7246                 printf("%s oddity:  Expected %s, got %s\n",
7247                         myname, expect, got);
7248                 exit(1);
7249         }
7250 }
7251
7252 int main()
7253
7254         char buf[64]; 
7255         buf[63] = '\0';
7256
7257         /* This must be 1st test on (which?) platform */
7258         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7259         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7260         checkit("0.1", buf);
7261
7262         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7263         checkit("1", buf);
7264
7265         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7266         checkit("0", buf);
7267
7268         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7269         checkit("-1", buf);
7270
7271         /* Some Linux gcvt's give 1.e+5 here. */
7272         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7273         checkit("100000", buf);
7274         
7275         /* Some Linux gcvt's give -1.e+5 here. */
7276         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7277         checkit("-100000", buf);
7278
7279         exit(0);
7280 }
7281 EOP
7282         case "$d_Gconvert" in
7283         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7284         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7285         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7286         *) xxx_list='gconvert gcvt sprintf' ;;
7287         esac
7288
7289         case "$d_longdbl$uselongdouble" in
7290         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7291         esac
7292
7293         for xxx_convert in $xxx_list; do
7294                 echo "Trying $xxx_convert..."
7295                 $rm -f try try$_o
7296                 set try -DTRY_$xxx_convert
7297                 if eval $compile; then
7298                         echo "$xxx_convert() found." >&4
7299                         if ./try; then
7300                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7301                                 break;
7302                         else
7303                                 echo "...But $xxx_convert didn't work as I expected."
7304                         fi
7305                 else
7306                         echo "$xxx_convert NOT found." >&4
7307                 fi
7308         done
7309                 
7310         case "$xxx_convert" in
7311         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7312         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7313         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7314         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7315         esac
7316 fi
7317
7318 echo " "
7319
7320 if $test X"$d_longdbl" = X"$define"; then
7321
7322 echo "Checking how to print long doubles..." >&4
7323
7324 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7325         $cat >try.c <<'EOCP'
7326 #include <sys/types.h>
7327 #include <stdio.h>
7328 int main() {
7329   double d = 123.456;
7330   printf("%.3f\n", d);
7331 }
7332 EOCP
7333         set try
7334         if eval $compile; then
7335                 yyy=`./try$exe_ext`
7336                 case "$yyy" in
7337                 123.456)
7338                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7339                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7340                         echo "We will use %f."
7341                         ;;
7342                 esac
7343         fi
7344 fi
7345
7346 if $test X"$sPRIfldbl" = X; then
7347         $cat >try.c <<'EOCP'
7348 #include <sys/types.h>
7349 #include <stdio.h>
7350 int main() {
7351   long double d = 123.456;
7352   printf("%.3llf\n", d);
7353 }
7354 EOCP
7355         set try
7356         if eval $compile; then
7357                 yyy=`./try$exe_ext`
7358                 case "$yyy" in
7359                 123.456)
7360                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7361                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7362                         echo "We will use %llf."
7363                         ;;
7364                 esac
7365         fi
7366 fi
7367
7368 if $test X"$sPRIfldbl" = X; then
7369         $cat >try.c <<'EOCP'
7370 #include <sys/types.h>
7371 #include <stdio.h>
7372 int main() {
7373   long double d = 123.456;
7374   printf("%.3Lf\n", d);
7375 }
7376 EOCP
7377         set try
7378         if eval $compile; then
7379                 yyy=`./try$exe_ext`
7380                 case "$yyy" in
7381                 123.456)
7382                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7383                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7384                         echo "We will use %Lf."
7385                         ;;
7386                 esac
7387         fi
7388 fi
7389
7390 if $test X"$sPRIfldbl" = X; then
7391         $cat >try.c <<'EOCP'
7392 #include <sys/types.h>
7393 #include <stdio.h>
7394 int main() {
7395   long double d = 123.456;
7396   printf("%.3lf\n", d);
7397 }
7398 EOCP
7399         set try
7400         if eval $compile; then
7401                 yyy=`./try$exe_ext`
7402                 case "$yyy" in
7403                 123.456)
7404                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7405                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7406                         echo "We will use %lf."
7407                         ;;
7408                 esac
7409         fi
7410 fi
7411
7412 if $test X"$sPRIfldbl" = X; then
7413         echo "Cannot figure out how to print long doubles." >&4
7414 fi
7415
7416 $rm -f try try.*
7417
7418 fi # d_longdbl
7419
7420 case "$sPRIfldbl" in
7421 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7422         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7423         ;;
7424 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7425         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7426         ;;
7427 esac
7428
7429 : Initialize h_fcntl
7430 h_fcntl=false
7431
7432 : Initialize h_sysfile
7433 h_sysfile=false
7434
7435 : access call always available on UNIX
7436 set access d_access
7437 eval $inlibc
7438
7439 : locate the flags for 'access()'
7440 case "$d_access" in
7441 "$define")
7442         echo " "
7443         $cat >access.c <<'EOCP'
7444 #include <sys/types.h>
7445 #ifdef I_FCNTL
7446 #include <fcntl.h>
7447 #endif
7448 #ifdef I_SYS_FILE
7449 #include <sys/file.h>
7450 #endif
7451 #ifdef I_UNISTD
7452 #include <unistd.h>
7453 #endif
7454 int main() {
7455         exit(R_OK);
7456 }
7457 EOCP
7458         : check sys/file.h first, no particular reason here
7459         if $test `./findhdr sys/file.h` && \
7460                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7461                 h_sysfile=true;
7462                 echo "<sys/file.h> defines the *_OK access constants." >&4
7463         elif $test `./findhdr fcntl.h` && \
7464                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7465                 h_fcntl=true;
7466                 echo "<fcntl.h> defines the *_OK access constants." >&4
7467         elif $test `./findhdr unistd.h` && \
7468                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7469                 echo "<unistd.h> defines the *_OK access constants." >&4
7470         else
7471                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7472         fi
7473         ;;
7474 esac
7475 $rm -f access*
7476
7477 : see if accessx exists
7478 set accessx d_accessx
7479 eval $inlibc
7480
7481 : see if alarm exists
7482 set alarm d_alarm
7483 eval $inlibc
7484
7485 : see if atolf exists
7486 set atolf d_atolf
7487 eval $inlibc
7488
7489 : see if atoll exists
7490 set atoll d_atoll
7491 eval $inlibc
7492
7493 : Look for GNU-cc style attribute checking
7494 echo " "
7495 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7496 $cat >attrib.c <<'EOCP'
7497 #include <stdio.h>
7498 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7499 EOCP
7500 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7501         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7502                 echo "Your C compiler doesn't fully support __attribute__."
7503                 val="$undef"
7504         else
7505                 echo "Your C compiler supports __attribute__."
7506                 val="$define"
7507         fi
7508 else
7509         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7510         val="$undef"
7511 fi
7512 set d_attribut
7513 eval $setvar
7514 $rm -f attrib*
7515
7516 : see if bcmp exists
7517 set bcmp d_bcmp
7518 eval $inlibc
7519
7520 : see if bcopy exists
7521 set bcopy d_bcopy
7522 eval $inlibc
7523
7524 : see if this is a unistd.h system
7525 set unistd.h i_unistd
7526 eval $inhdr
7527
7528 : see if getpgrp exists
7529 set getpgrp d_getpgrp
7530 eval $inlibc
7531
7532 case "$d_getpgrp" in
7533 "$define")
7534         echo " "
7535         echo "Checking to see which flavor of getpgrp is in use..."
7536         $cat >set.c <<EOP
7537 #$i_unistd I_UNISTD
7538 #include <sys/types.h>
7539 #ifdef I_UNISTD
7540 #  include <unistd.h>
7541 #endif
7542 int main()
7543 {
7544         if (getuid() == 0) {
7545                 printf("(I see you are running Configure as super-user...)\n");
7546                 setuid(1);
7547         }
7548 #ifdef TRY_BSD_PGRP
7549         if (getpgrp(1) == 0)
7550                 exit(0);
7551 #else
7552         if (getpgrp() > 0)
7553                 exit(0);
7554 #endif
7555         exit(1);
7556 }
7557 EOP
7558         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7559                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7560                 val="$define"
7561         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7562                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7563                 val="$undef"
7564         else
7565                 echo "I can't seem to compile and run the test program."
7566                 if ./usg; then
7567                         xxx="a USG one, i.e. you use getpgrp()."
7568                 else
7569                         # SVR4 systems can appear rather BSD-ish.
7570                         case "$i_unistd" in
7571                         $undef)
7572                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7573                                 val="$define"
7574                                 ;;
7575                         $define)
7576                                 xxx="probably a USG one, i.e. you use getpgrp()."
7577                                 val="$undef"
7578                                 ;;
7579                         esac
7580                 fi
7581                 echo "Assuming your getpgrp is $xxx" >&4
7582         fi
7583         ;;
7584 *) val="$undef";;
7585 esac
7586 set d_bsdgetpgrp
7587 eval $setvar
7588 $rm -f set set.c
7589
7590 : see if setpgrp exists
7591 set setpgrp d_setpgrp
7592 eval $inlibc
7593
7594 case "$d_setpgrp" in
7595 "$define")
7596         echo " "
7597         echo "Checking to see which flavor of setpgrp is in use..."
7598         $cat >set.c <<EOP
7599 #$i_unistd I_UNISTD
7600 #include <sys/types.h>
7601 #ifdef I_UNISTD
7602 #  include <unistd.h>
7603 #endif
7604 int main()
7605 {
7606         if (getuid() == 0) {
7607                 printf("(I see you are running Configure as super-user...)\n");
7608                 setuid(1);
7609         }
7610 #ifdef TRY_BSD_PGRP
7611         if (-1 == setpgrp(1, 1))
7612                 exit(0);
7613 #else
7614         if (setpgrp() != -1)
7615                 exit(0);
7616 #endif
7617         exit(1);
7618 }
7619 EOP
7620         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7621                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7622                 val="$define"
7623         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7624                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7625                 val="$undef"
7626         else
7627                 echo "(I can't seem to compile and run the test program.)"
7628                 if ./usg; then
7629                         xxx="a USG one, i.e. you use setpgrp()."
7630                 else
7631                         # SVR4 systems can appear rather BSD-ish.
7632                         case "$i_unistd" in
7633                         $undef)
7634                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7635                                 val="$define"
7636                                 ;;
7637                         $define)
7638                                 xxx="probably a USG one, i.e. you use setpgrp()."
7639                                 val="$undef"
7640                                 ;;
7641                         esac
7642                 fi
7643                 echo "Assuming your setpgrp is $xxx" >&4
7644         fi
7645         ;;
7646 *) val="$undef";;
7647 esac
7648 set d_bsdsetpgrp
7649 eval $setvar
7650 $rm -f set set.c
7651 : see if bzero exists
7652 set bzero d_bzero
7653 eval $inlibc
7654
7655 : see if signal is declared as pointer to function returning int or void
7656 echo " "
7657 xxx=`./findhdr signal.h`
7658 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7659 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7660         echo "You have int (*signal())() instead of void." >&4
7661         val="$undef"
7662 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7663         echo "You have void (*signal())()." >&4
7664         val="$define"
7665 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7666         echo "You have int (*signal())() instead of void." >&4
7667         val="$undef"
7668 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7669         echo "You have void (*signal())()." >&4
7670         val="$define"
7671 else
7672         case "$d_voidsig" in
7673         '')
7674         echo "I can't determine whether signal handler returns void or int..." >&4
7675                 dflt=void
7676                 rp="What type does your signal handler return?"
7677                 . ./myread
7678                 case "$ans" in
7679                 v*) val="$define";;
7680                 *) val="$undef";;
7681                 esac;;
7682         "$define")
7683                 echo "As you already told me, signal handler returns void." >&4
7684                 val="$define"
7685                 ;;
7686         *)      echo "As you already told me, signal handler returns int." >&4
7687                 val="$undef"
7688                 ;;
7689         esac
7690 fi
7691 set d_voidsig
7692 eval $setvar
7693 case "$d_voidsig" in
7694 "$define") signal_t="void";;
7695 *) signal_t="int";;
7696 esac
7697 $rm -f $$.tmp
7698
7699 : check for ability to cast large floats to 32-bit ints.
7700 echo " "
7701 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7702 if $test "$intsize" -ge 4; then
7703         xxx=int
7704 else
7705         xxx=long
7706 fi
7707 $cat >try.c <<EOCP
7708 #include <stdio.h>
7709 #include <sys/types.h>
7710 #include <signal.h>
7711 $signal_t blech(s) int s; { exit(3); }
7712 int main()
7713 {
7714         $xxx i32;
7715         double f, g;
7716         int result = 0;
7717         char str[16];
7718         signal(SIGFPE, blech);
7719
7720         /* Don't let compiler optimize the test away.  Store the number 
7721            in a writable string for gcc to pass to sscanf under HP/UX.
7722         */
7723         sprintf(str, "2147483647");
7724         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7725         g = 10 * f;
7726         i32  = ($xxx) g;
7727
7728         /* x86 processors will probably give 0x8000 0000, which is a
7729        sign change.  We don't want that.  We want to mimic SPARC
7730            behavior here, which is to preserve the sign and give
7731            back 0x7fff ffff.
7732         */
7733         if (i32 != ($xxx) f)
7734                 result |= 1;
7735         exit(result);
7736 }
7737 EOCP
7738 set try
7739 if eval $compile_ok; then
7740         ./try
7741         yyy=$?
7742 else
7743         echo "(I can't seem to compile the test program--assuming it can't)"
7744         yyy=1
7745 fi
7746 case "$yyy" in
7747 0)      val="$define"
7748         echo "Yup, it can."
7749         ;;
7750 *)      val="$undef"
7751         echo "Nope, it can't."
7752         ;;
7753 esac
7754 set d_casti32
7755 eval $setvar
7756 $rm -f try try.*
7757
7758 : check for ability to cast negative floats to unsigned
7759 echo " "
7760 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7761 $cat >try.c <<EOCP
7762 #include <stdio.h>
7763 #include <sys/types.h>
7764 #include <signal.h>
7765 $signal_t blech(s) int s; { exit(7); }
7766 $signal_t blech_in_list(s) int s; { exit(4); }
7767 unsigned long dummy_long(p) unsigned long p; { return p; }
7768 unsigned int dummy_int(p) unsigned int p; { return p; }
7769 unsigned short dummy_short(p) unsigned short p; { return p; }
7770 int main()
7771 {
7772         double f;
7773         unsigned long along;
7774         unsigned int aint;
7775         unsigned short ashort;
7776         int result = 0;
7777         char str[16];
7778         
7779         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7780            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7781            optimized the whole file away
7782         */
7783         /* Store the number in a writable string for gcc to pass to 
7784            sscanf under HP/UX.
7785         */
7786         sprintf(str, "-123");
7787         sscanf(str, "%lf", &f);  /* f = -123.; */
7788
7789         signal(SIGFPE, blech);
7790         along = (unsigned long)f;
7791         aint = (unsigned int)f;
7792         ashort = (unsigned short)f;
7793         if (along != (unsigned long)-123)
7794                 result |= 1;
7795         if (aint != (unsigned int)-123)
7796                 result |= 1;
7797         if (ashort != (unsigned short)-123)
7798                 result |= 1;
7799         sprintf(str, "1073741824.");
7800         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7801         f = f + f;
7802         along = 0;
7803         along = (unsigned long)f;
7804         if (along != 0x80000000)
7805                 result |= 2;
7806         f -= 1.;
7807         along = 0;
7808         along = (unsigned long)f;
7809         if (along != 0x7fffffff)
7810                 result |= 1;
7811         f += 2.;
7812         along = 0;
7813         along = (unsigned long)f;
7814         if (along != 0x80000001)
7815                 result |= 2;
7816         if (result)
7817                 exit(result);
7818         signal(SIGFPE, blech_in_list);
7819         sprintf(str, "123.");
7820         sscanf(str, "%lf", &f);  /* f = 123.; */
7821         along = dummy_long((unsigned long)f);
7822         aint = dummy_int((unsigned int)f);
7823         ashort = dummy_short((unsigned short)f);
7824         if (along != (unsigned long)123)
7825                 result |= 4;
7826         if (aint != (unsigned int)123)
7827                 result |= 4;
7828         if (ashort != (unsigned short)123)
7829                 result |= 4;
7830         exit(result);
7831
7832 }
7833 EOCP
7834 set try
7835 if eval $compile_ok; then
7836         ./try
7837         castflags=$?
7838 else
7839         echo "(I can't seem to compile the test program--assuming it can't)"
7840         castflags=7
7841 fi
7842 case "$castflags" in
7843 0)      val="$define"
7844         echo "Yup, it can."
7845         ;;
7846 *)      val="$undef"
7847         echo "Nope, it can't."
7848         ;;
7849 esac
7850 set d_castneg
7851 eval $setvar
7852 $rm -f try.*
7853
7854 : see if vprintf exists
7855 echo " "
7856 if set vprintf val -f d_vprintf; eval $csym; $val; then
7857         echo 'vprintf() found.' >&4
7858         val="$define"
7859         $cat >vprintf.c <<'EOF'
7860 #include <varargs.h>
7861
7862 int main() { xxx("foo"); }
7863
7864 xxx(va_alist)
7865 va_dcl
7866 {
7867         va_list args;
7868         char buf[10];
7869
7870         va_start(args);
7871         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7872 }
7873 EOF
7874         set vprintf
7875         if eval $compile && ./vprintf; then
7876                 echo "Your vsprintf() returns (int)." >&4
7877                 val2="$undef"
7878         else
7879                 echo "Your vsprintf() returns (char*)." >&4
7880                 val2="$define"
7881         fi
7882 else
7883         echo 'vprintf() NOT found.' >&4
7884                 val="$undef"
7885                 val2="$undef"
7886 fi
7887 set d_vprintf
7888 eval $setvar
7889 val=$val2
7890 set d_charvspr
7891 eval $setvar
7892
7893 : see if chown exists
7894 set chown d_chown
7895 eval $inlibc
7896
7897 : see if chroot exists
7898 set chroot d_chroot
7899 eval $inlibc
7900
7901 : see if chsize exists
7902 set chsize d_chsize
7903 eval $inlibc
7904
7905 : check for const keyword
7906 echo " "
7907 echo 'Checking to see if your C compiler knows about "const"...' >&4
7908 $cat >const.c <<'EOCP'
7909 typedef struct spug { int drokk; } spug;
7910 int main()
7911 {
7912         const char *foo;
7913         const spug y;
7914 }
7915 EOCP
7916 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7917         val="$define"
7918         echo "Yup, it does."
7919 else
7920         val="$undef"
7921         echo "Nope, it doesn't."
7922 fi
7923 set d_const
7924 eval $setvar
7925
7926 : see if crypt exists
7927 echo " "
7928 if set crypt val -f d_crypt; eval $csym; $val; then
7929         echo 'crypt() found.' >&4
7930         val="$define"
7931         cryptlib=''
7932 else
7933         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7934         if $test -z "$cryptlib"; then
7935                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7936         else
7937                 cryptlib=-lcrypt
7938         fi
7939         if $test -z "$cryptlib"; then
7940                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7941         else
7942                 cryptlib=-lcrypt
7943         fi
7944         if $test -z "$cryptlib"; then
7945                 cryptlib=`./loc libcrypt$_a "" $libpth`
7946         else
7947                 cryptlib=-lcrypt
7948         fi
7949         if $test -z "$cryptlib"; then
7950                 echo 'crypt() NOT found.' >&4
7951                 val="$undef"
7952         else
7953                 val="$define"
7954         fi
7955 fi
7956 set d_crypt
7957 eval $setvar
7958
7959 : get csh whereabouts
7960 case "$csh" in
7961 'csh') val="$undef" ;;
7962 *) val="$define" ;;
7963 esac
7964 set d_csh
7965 eval $setvar
7966 : Respect a hint or command line value for full_csh.
7967 case "$full_csh" in
7968 '') full_csh=$csh ;;
7969 esac
7970
7971 : see if cuserid exists
7972 set cuserid d_cuserid
7973 eval $inlibc
7974
7975 : see if this is a limits.h system
7976 set limits.h i_limits
7977 eval $inhdr
7978
7979 : see if this is a float.h system
7980 set float.h i_float
7981 eval $inhdr
7982
7983 : See if number of significant digits in a double precision number is known
7984 echo " "
7985 $cat >dbl_dig.c <<EOM
7986 #$i_limits I_LIMITS
7987 #$i_float I_FLOAT
7988 #ifdef I_LIMITS
7989 #include <limits.h>
7990 #endif
7991 #ifdef I_FLOAT
7992 #include <float.h>
7993 #endif
7994 #ifdef DBL_DIG
7995 printf("Contains DBL_DIG");
7996 #endif
7997 EOM
7998 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7999 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8000         echo "DBL_DIG found." >&4
8001         val="$define"
8002 else
8003         echo "DBL_DIG NOT found." >&4
8004         val="$undef"
8005 fi
8006 $rm -f dbl_dig.?
8007 set d_dbl_dig
8008 eval $setvar
8009
8010 : see if difftime exists
8011 set difftime d_difftime
8012 eval $inlibc
8013
8014 : see if this is a dirent system
8015 echo " "
8016 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8017         val="$define"
8018         echo "<dirent.h> found." >&4
8019 else
8020         val="$undef"
8021         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8022                 echo "<sys/dir.h> found." >&4
8023                 echo " "
8024         else
8025                 xinc=`./findhdr sys/ndir.h`
8026         fi
8027         echo "<dirent.h> NOT found." >&4
8028 fi
8029 set i_dirent
8030 eval $setvar
8031
8032 : Look for type of directory structure.
8033 echo " "
8034 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8035
8036 case "$direntrytype" in
8037 ''|' ')
8038         case "$i_dirent" in
8039         $define) guess1='struct dirent' ;;
8040         *) guess1='struct direct'  ;;
8041         esac
8042         ;;
8043 *)      guess1="$direntrytype"
8044         ;;
8045 esac
8046
8047 case "$guess1" in
8048 'struct dirent') guess2='struct direct' ;;
8049 *) guess2='struct dirent' ;;
8050 esac
8051                 
8052 if $contains "$guess1" try.c >/dev/null 2>&1; then
8053         direntrytype="$guess1"
8054         echo "Your directory entries are $direntrytype." >&4
8055 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8056         direntrytype="$guess2"
8057         echo "Your directory entries seem to be $direntrytype." >&4
8058 else
8059         echo "I don't recognize your system's directory entries." >&4
8060         rp="What type is used for directory entries on this system?"
8061         dflt="$guess1"
8062         . ./myread
8063         direntrytype="$ans"
8064 fi
8065 $rm -f try.c
8066
8067
8068 : see if the directory entry stores field length
8069 echo " "
8070 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8071 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8072         echo "Good, your directory entry keeps length information in d_namlen." >&4
8073         val="$define"
8074 else
8075         echo "Your directory entry does not know about the d_namlen field." >&4
8076         val="$undef"
8077 fi
8078 set d_dirnamlen
8079 eval $setvar
8080 $rm -f try.c
8081
8082 : see if dlerror exists
8083 xxx_runnm="$runnm"
8084 runnm=false
8085 set dlerror d_dlerror
8086 eval $inlibc
8087 runnm="$xxx_runnm"
8088
8089 : see if dlfcn is available
8090 set dlfcn.h i_dlfcn
8091 eval $inhdr
8092
8093 case "$usedl" in
8094 $define|y|true)
8095         $cat << EOM
8096
8097 On a few systems, the dynamically loaded modules that perl generates and uses
8098 will need a different extension than shared libs. The default will probably
8099 be appropriate.
8100
8101 EOM
8102         case "$dlext" in
8103         '')     dflt="$so" ;;
8104         *)      dflt="$dlext" ;;
8105         esac
8106         rp='What is the extension of dynamically loaded modules'
8107         . ./myread
8108         dlext="$ans"
8109         ;;
8110 *)
8111         dlext="none"
8112         ;;
8113 esac
8114
8115 : Check if dlsym need a leading underscore
8116 echo " "
8117 val="$undef"
8118
8119 case "$dlsrc" in
8120 dl_dlopen.xs)
8121         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8122         $cat >dyna.c <<'EOM'
8123 fred () { }
8124 EOM
8125
8126 $cat >fred.c<<EOM
8127
8128 #include <stdio.h>
8129 #$i_dlfcn I_DLFCN
8130 #ifdef I_DLFCN
8131 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8132 #else
8133 #include <sys/types.h>
8134 #include <nlist.h>
8135 #include <link.h>
8136 #endif
8137
8138 extern int fred() ;
8139
8140 int main()
8141 {
8142     void * handle ;
8143     void * symbol ;
8144 #ifndef RTLD_LAZY
8145     int mode = 1 ;
8146 #else
8147     int mode = RTLD_LAZY ;
8148 #endif
8149     handle = dlopen("./dyna.$dlext", mode) ;
8150     if (handle == NULL) {
8151         printf ("1\n") ;
8152         fflush (stdout) ;
8153         exit(0);
8154     }
8155     symbol = dlsym(handle, "fred") ;
8156     if (symbol == NULL) {
8157         /* try putting a leading underscore */
8158         symbol = dlsym(handle, "_fred") ;
8159         if (symbol == NULL) {
8160             printf ("2\n") ;
8161             fflush (stdout) ;
8162             exit(0);
8163         }
8164         printf ("3\n") ;
8165     }
8166     else
8167         printf ("4\n") ;
8168     fflush (stdout) ;
8169     exit(0);
8170 }
8171 EOM
8172         : Call the object file tmp-dyna.o in case dlext=o.
8173         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8174                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8175                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8176                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8177                 xxx=`./fred`
8178                 case $xxx in
8179                 1)      echo "Test program failed using dlopen." >&4
8180                         echo "Perhaps you should not use dynamic loading." >&4;;
8181                 2)      echo "Test program failed using dlsym." >&4
8182                         echo "Perhaps you should not use dynamic loading." >&4;;
8183                 3)      echo "dlsym needs a leading underscore" >&4
8184                         val="$define" ;;
8185                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8186                 esac
8187         else
8188                 echo "I can't compile and run the test program." >&4
8189                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8190         fi
8191         ;;
8192 esac
8193                 
8194 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8195
8196 set d_dlsymun
8197 eval $setvar
8198
8199 hasproto='varname=$1; func=$2; shift; shift;
8200 while $test $# -ge 2; do
8201         case "$1" in
8202         $define) echo "#include <$2>";;
8203         esac ;
8204     shift 2;
8205 done > try.c;
8206 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8207 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8208         echo "$func() prototype found.";
8209         val="$define";
8210 else
8211         echo "$func() prototype NOT found.";
8212         val="$undef";
8213 fi;
8214 set $varname;
8215 eval $setvar;
8216 $rm -f try.c tryout.c'
8217
8218 : see if prototype for drand48 is available
8219 echo " "
8220 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8221 eval $hasproto
8222
8223 : see if dup2 exists
8224 set dup2 d_dup2
8225 eval $inlibc
8226
8227 : see if eaccess exists
8228 set eaccess d_eaccess
8229 eval $inlibc
8230
8231 : see if endgrent exists
8232 set endgrent d_endgrent
8233 eval $inlibc
8234
8235 : see if endhostent exists
8236 set endhostent d_endhent
8237 eval $inlibc
8238
8239 : see if endnetent exists
8240 set endnetent d_endnent
8241 eval $inlibc
8242
8243 : see if endprotoent exists
8244 set endprotoent d_endpent
8245 eval $inlibc
8246
8247 : see if endpwent exists
8248 set endpwent d_endpwent
8249 eval $inlibc
8250
8251 : see if endservent exists
8252 set endservent d_endsent
8253 eval $inlibc
8254
8255 : see if endspent exists
8256 set endspent d_endspent
8257 eval $inlibc
8258
8259 : Locate the flags for 'open()'
8260 echo " "
8261 $cat >open3.c <<'EOCP'
8262 #include <sys/types.h>
8263 #ifdef I_FCNTL
8264 #include <fcntl.h>
8265 #endif
8266 #ifdef I_SYS_FILE
8267 #include <sys/file.h>
8268 #endif
8269 int main() {
8270         if(O_RDONLY);
8271 #ifdef O_TRUNC
8272         exit(0);
8273 #else
8274         exit(1);
8275 #endif
8276 }
8277 EOCP
8278 : check sys/file.h first to get FREAD on Sun
8279 if $test `./findhdr sys/file.h` && \
8280                 set open3 -DI_SYS_FILE && eval $compile; then
8281         h_sysfile=true;
8282         echo "<sys/file.h> defines the O_* constants..." >&4
8283         if ./open3; then
8284                 echo "and you have the 3 argument form of open()." >&4
8285                 val="$define"
8286         else
8287                 echo "but not the 3 argument form of open().  Oh, well." >&4
8288                 val="$undef"
8289         fi
8290 elif $test `./findhdr fcntl.h` && \
8291                 set open3 -DI_FCNTL && eval $compile; then
8292         h_fcntl=true;
8293         echo "<fcntl.h> defines the O_* constants..." >&4
8294         if ./open3; then
8295                 echo "and you have the 3 argument form of open()." >&4
8296                 val="$define"
8297         else
8298                 echo "but not the 3 argument form of open().  Oh, well." >&4
8299                 val="$undef"
8300         fi
8301 else
8302         val="$undef"
8303         echo "I can't find the O_* constant definitions!  You got problems." >&4
8304 fi
8305 set d_open3
8306 eval $setvar
8307 $rm -f open3*
8308
8309 : see which of string.h or strings.h is needed
8310 echo " "
8311 strings=`./findhdr string.h`
8312 if $test "$strings" && $test -r "$strings"; then
8313         echo "Using <string.h> instead of <strings.h>." >&4
8314         val="$define"
8315 else
8316         val="$undef"
8317         strings=`./findhdr strings.h`
8318         if $test "$strings" && $test -r "$strings"; then
8319                 echo "Using <strings.h> instead of <string.h>." >&4
8320         else
8321                 echo "No string header found -- You'll surely have problems." >&4
8322         fi
8323 fi
8324 set i_string
8325 eval $setvar
8326 case "$i_string" in
8327 "$undef") strings=`./findhdr strings.h`;;
8328 *)        strings=`./findhdr string.h`;;
8329 esac
8330
8331 : check for non-blocking I/O stuff
8332 case "$h_sysfile" in
8333 true) echo "#include <sys/file.h>" > head.c;;
8334 *)
8335         case "$h_fcntl" in
8336         true) echo "#include <fcntl.h>" > head.c;;
8337         *) echo "#include <sys/fcntl.h>" > head.c;;
8338         esac
8339         ;;
8340 esac
8341 echo " "
8342 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8343 case "$o_nonblock" in
8344 '')
8345         $cat head.c > try.c
8346         $cat >>try.c <<'EOCP'
8347 #include <stdio.h>
8348 int main() {
8349 #ifdef O_NONBLOCK
8350         printf("O_NONBLOCK\n");
8351         exit(0);
8352 #endif
8353 #ifdef O_NDELAY
8354         printf("O_NDELAY\n");
8355         exit(0);
8356 #endif
8357 #ifdef FNDELAY
8358         printf("FNDELAY\n");
8359         exit(0);
8360 #endif
8361         exit(0);
8362 }
8363 EOCP
8364         set try
8365         if eval $compile_ok; then
8366                 o_nonblock=`./try`
8367                 case "$o_nonblock" in
8368                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8369                 *) echo "Seems like we can use $o_nonblock.";;
8370                 esac
8371         else
8372                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8373         fi
8374         ;;
8375 *) echo "Using $hint value $o_nonblock.";;
8376 esac
8377 $rm -f try try.* .out core
8378
8379 echo " "
8380 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8381 case "$eagain" in
8382 '')
8383         $cat head.c > try.c
8384         $cat >>try.c <<EOCP
8385 #include <errno.h>
8386 #include <sys/types.h>
8387 #include <signal.h>
8388 #include <stdio.h> 
8389 #define MY_O_NONBLOCK $o_nonblock
8390 #ifndef errno  /* XXX need better Configure test */
8391 extern int errno;
8392 #endif
8393 #$i_unistd I_UNISTD
8394 #ifdef I_UNISTD
8395 #include <unistd.h>
8396 #endif
8397 #ifdef $i_string
8398 #include <string.h>
8399 #else
8400 #include <strings.h>
8401 #endif
8402 $signal_t blech(x) int x; { exit(3); }
8403 EOCP
8404         $cat >> try.c <<'EOCP'
8405 int main()
8406 {
8407         int pd[2];
8408         int pu[2];
8409         char buf[1];
8410         char string[100];
8411
8412         pipe(pd);       /* Down: child -> parent */
8413         pipe(pu);       /* Up: parent -> child */
8414         if (0 != fork()) {
8415                 int ret;
8416                 close(pd[1]);   /* Parent reads from pd[0] */
8417                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8418                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8419                         exit(1);
8420                 signal(SIGALRM, blech);
8421                 alarm(5);
8422                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8423                         exit(2);
8424                 sprintf(string, "%d\n", ret);
8425                 write(2, string, strlen(string));
8426                 alarm(0);
8427 #ifdef EAGAIN
8428                 if (errno == EAGAIN) {
8429                         printf("EAGAIN\n");
8430                         goto ok;
8431                 }
8432 #endif
8433 #ifdef EWOULDBLOCK
8434                 if (errno == EWOULDBLOCK)
8435                         printf("EWOULDBLOCK\n");
8436 #endif
8437         ok:
8438                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8439                 sleep(2);                               /* Give it time to close our pipe */
8440                 alarm(5);
8441                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8442                 alarm(0);
8443                 sprintf(string, "%d\n", ret);
8444                 write(3, string, strlen(string));
8445                 exit(0);
8446         }
8447
8448         close(pd[0]);                   /* We write to pd[1] */
8449         close(pu[1]);                   /* We read from pu[0] */
8450         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8451         close(pd[1]);                   /* Pipe pd is now fully closed! */
8452         exit(0);                                /* Bye bye, thank you for playing! */
8453 }
8454 EOCP
8455         set try
8456         if eval $compile_ok; then
8457                 echo "$startsh" >mtry
8458                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8459                 chmod +x mtry
8460                 ./mtry >/dev/null 2>&1
8461                 case $? in
8462                 0) eagain=`$cat try.out`;;
8463                 1) echo "Could not perform non-blocking setting!";;
8464                 2) echo "I did a successful read() for something that was not there!";;
8465                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8466                 *) echo "Something terribly wrong happened during testing.";;
8467                 esac
8468                 rd_nodata=`$cat try.ret`
8469                 echo "A read() system call with no data present returns $rd_nodata."
8470                 case "$rd_nodata" in
8471                 0|-1) ;;
8472                 *)
8473                         echo "(That's peculiar, fixing that to be -1.)"
8474                         rd_nodata=-1
8475                         ;;
8476                 esac
8477                 case "$eagain" in
8478                 '')
8479                         echo "Forcing errno EAGAIN on read() with no data available."
8480                         eagain=EAGAIN
8481                         ;;
8482                 *)
8483                         echo "Your read() sets errno to $eagain when no data is available."
8484                         ;;
8485                 esac
8486                 status=`$cat try.err`
8487                 case "$status" in
8488                 0) echo "And it correctly returns 0 to signal EOF.";;
8489                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8490                 *) echo "However, your read() returns '$status' on EOF??";;
8491                 esac
8492                 val="$define"
8493                 if test "$status" = "$rd_nodata"; then
8494                         echo "WARNING: you can't distinguish between EOF and no data!"
8495                         val="$undef"
8496                 fi
8497         else
8498                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8499                 eagain=EAGAIN
8500         fi
8501         set d_eofnblk
8502         eval $setvar
8503         ;;
8504 *)
8505         echo "Using $hint value $eagain."
8506         echo "Your read() returns $rd_nodata when no data is present."
8507         case "$d_eofnblk" in
8508         "$define") echo "And you can see EOF because read() returns 0.";;
8509         "$undef") echo "But you can't see EOF status from read() returned value.";;
8510         *)
8511                 echo "(Assuming you can't see EOF status from read anyway.)"
8512                 d_eofnblk=$undef
8513                 ;;
8514         esac
8515         ;;
8516 esac
8517 $rm -f try try.* .out core head.c mtry
8518
8519 : see if fchmod exists
8520 set fchmod d_fchmod
8521 eval $inlibc
8522
8523 : see if fchown exists
8524 set fchown d_fchown
8525 eval $inlibc
8526
8527 : see if this is an fcntl system
8528 set fcntl d_fcntl
8529 eval $inlibc
8530
8531 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8532 while $test $# -ge 2; do
8533         case "$1" in
8534         $define) echo "#include <$2>";;
8535         esac ;
8536     shift 2;
8537 done > try.c;
8538 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8539 set try;
8540 if eval $compile; then
8541         val="$define";
8542 else
8543         val="$undef";
8544 fi;
8545 set $varname;
8546 eval $setvar;
8547 $rm -f try.c try.o'
8548
8549 socketlib=''
8550 sockethdr=''
8551 : see whether socket exists
8552 echo " "
8553 $echo $n "Hmm... $c" >&4
8554 if set socket val -f d_socket; eval $csym; $val; then
8555         echo "Looks like you have Berkeley networking support." >&4
8556         d_socket="$define"
8557         if set setsockopt val -f; eval $csym; $val; then
8558                 d_oldsock="$undef"
8559         else
8560                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8561                 d_oldsock="$define"
8562         fi
8563 else
8564         if $contains socklib libc.list >/dev/null 2>&1; then
8565                 echo "Looks like you have Berkeley networking support." >&4
8566                 d_socket="$define"
8567                 : we will have to assume that it supports the 4.2 BSD interface
8568                 d_oldsock="$undef"
8569         else
8570                 echo "You don't have Berkeley networking in libc$_a..." >&4
8571                 if test "X$d_socket" = "X$define"; then
8572                    echo "...but you seem to believe that you have sockets." >&4
8573                 else
8574                         for net in net socket
8575                         do
8576                                 if test -f /usr/lib/lib$net$_a; then
8577                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8578                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8579                                         if $contains socket libc.list >/dev/null 2>&1; then
8580                                                 d_socket="$define"
8581                                                 socketlib="-l$net"
8582                                                 case "$net" in
8583                                                 net)
8584                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8585                                                         sockethdr="-I/usr/netinclude"
8586                                                         ;;
8587                                                 esac
8588                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8589                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8590                                                         d_oldsock="$undef"
8591                                                 else
8592                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8593                                                         d_oldsock="$define"
8594                                                 fi
8595                                                 break
8596                                         fi
8597                                 fi
8598                         done
8599                         if test "X$d_socket" != "X$define"; then
8600                            echo "or anywhere else I see." >&4
8601                            d_socket="$undef"
8602                            d_oldsock="$undef"
8603                         fi
8604                 fi
8605         fi
8606 fi
8607
8608 : see if socketpair exists
8609 set socketpair d_sockpair
8610 eval $inlibc
8611
8612
8613 echo " "
8614 echo "Checking the availability of certain socket constants..." >& 4
8615 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8616         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8617         $cat >try.c <<EOF
8618 #include <sys/types.h>
8619 #include <sys/socket.h>
8620 int main() {
8621     int i = $ENUM;
8622 }
8623 EOF
8624         val="$undef"
8625         set try; if eval $compile; then
8626                 val="$define"
8627         fi
8628         set d_${enum}; eval $setvar
8629         $rm -f try.c try
8630 done
8631
8632 : see if sys/select.h has to be included
8633 set sys/select.h i_sysselct
8634 eval $inhdr
8635
8636 : see if we should include time.h, sys/time.h, or both
8637 echo " "
8638 if test "X$timeincl" = X; then
8639         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8640         $echo $n "I'm now running the test program...$c"
8641         $cat >try.c <<'EOCP'
8642 #include <sys/types.h>
8643 #ifdef I_TIME
8644 #include <time.h>
8645 #endif
8646 #ifdef I_SYSTIME
8647 #ifdef SYSTIMEKERNEL
8648 #define KERNEL
8649 #endif
8650 #include <sys/time.h>
8651 #endif
8652 #ifdef I_SYSSELECT
8653 #include <sys/select.h>
8654 #endif
8655 int main()
8656 {
8657         struct tm foo;
8658 #ifdef S_TIMEVAL
8659         struct timeval bar;
8660 #endif
8661 #ifdef S_TIMEZONE
8662         struct timezone tzp;
8663 #endif
8664         if (foo.tm_sec == foo.tm_sec)
8665                 exit(0);
8666 #ifdef S_TIMEVAL
8667         if (bar.tv_sec == bar.tv_sec)
8668                 exit(0);
8669 #endif
8670         exit(1);
8671 }
8672 EOCP
8673         flags=''
8674         for s_timezone in '-DS_TIMEZONE' ''; do
8675         sysselect=''
8676         for s_timeval in '-DS_TIMEVAL' ''; do
8677         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8678         for i_time in '' '-DI_TIME'; do
8679         for i_systime in '-DI_SYSTIME' ''; do
8680                 case "$flags" in
8681                 '') $echo $n ".$c"
8682                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8683                         if eval $compile; then
8684                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8685                                 shift
8686                                 flags="$*"
8687                                 echo " "
8688                                 $echo $n "Succeeded with $flags$c"
8689                         fi
8690                         ;;
8691                 esac
8692         done
8693         done
8694         done
8695         done
8696         done
8697         timeincl=''
8698         echo " "
8699         case "$flags" in
8700         *SYSTIMEKERNEL*) i_systimek="$define"
8701                 timeincl=`./findhdr sys/time.h`
8702                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8703         *) i_systimek="$undef";;
8704         esac
8705         case "$flags" in
8706         *I_TIME*) i_time="$define"
8707                 timeincl=`./findhdr time.h`" $timeincl"
8708                 echo "We'll include <time.h>." >&4;;
8709         *) i_time="$undef";;
8710         esac
8711         case "$flags" in
8712         *I_SYSTIME*) i_systime="$define"
8713                 timeincl=`./findhdr sys/time.h`" $timeincl"
8714                 echo "We'll include <sys/time.h>." >&4;;
8715         *) i_systime="$undef";;
8716         esac
8717         $rm -f try.c try
8718 fi
8719
8720 : check for fd_set items
8721 $cat <<EOM
8722
8723 Checking to see how well your C compiler handles fd_set and friends ...
8724 EOM
8725 $cat >fd_set.c <<EOCP
8726 #$i_systime I_SYS_TIME
8727 #$i_sysselct I_SYS_SELECT
8728 #$d_socket HAS_SOCKET
8729 #include <sys/types.h>
8730 #ifdef HAS_SOCKET
8731 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8732 #endif
8733 #ifdef I_SYS_TIME
8734 #include <sys/time.h>
8735 #endif
8736 #ifdef I_SYS_SELECT
8737 #include <sys/select.h>
8738 #endif
8739 int main() {
8740         fd_set fds;
8741
8742 #ifdef TRYBITS
8743         if(fds.fds_bits);
8744 #endif
8745
8746 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8747         exit(0);
8748 #else
8749         exit(1);
8750 #endif
8751 }
8752 EOCP
8753 set fd_set -DTRYBITS
8754 if eval $compile; then
8755         d_fds_bits="$define"
8756         d_fd_set="$define"
8757         echo "Well, your system knows about the normal fd_set typedef..." >&4
8758         if ./fd_set; then
8759                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8760                 d_fd_macros="$define"
8761         else
8762                 $cat >&4 <<'EOM'
8763 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8764 EOM
8765                 d_fd_macros="$undef"
8766         fi
8767 else
8768         $cat <<'EOM'
8769 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8770 EOM
8771         set fd_set
8772         if eval $compile; then
8773                 d_fds_bits="$undef"
8774                 d_fd_set="$define"
8775                 echo "Well, your system has some sort of fd_set available..." >&4
8776                 if ./fd_set; then
8777                         echo "and you have the normal fd_set macros." >&4
8778                         d_fd_macros="$define"
8779                 else
8780                         $cat <<'EOM'
8781 but not the normal fd_set macros!  Gross!  More work for me...
8782 EOM
8783                         d_fd_macros="$undef"
8784                 fi
8785         else
8786         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8787                 d_fd_set="$undef"
8788                 d_fds_bits="$undef"
8789                 d_fd_macros="$undef"
8790         fi
8791 fi
8792 $rm -f fd_set*
8793
8794 : see if fgetpos exists
8795 set fgetpos d_fgetpos
8796 eval $inlibc
8797
8798 : see if flock exists
8799 set flock d_flock
8800 eval $inlibc
8801
8802 : see if fork exists
8803 set fork d_fork
8804 eval $inlibc
8805
8806 : see if pathconf exists
8807 set pathconf d_pathconf
8808 eval $inlibc
8809
8810 : see if fpathconf exists
8811 set fpathconf d_fpathconf
8812 eval $inlibc
8813
8814
8815 : check for off64_t
8816 echo " "
8817 echo "Checking to see if your system supports off64_t..." >&4
8818 $cat >try.c <<EOCP
8819 #include <sys/types.h>
8820 #include <unistd.h>
8821 int main() { off64_t x = 7; }'
8822 EOCP
8823 set try
8824 if eval $compile; then
8825         val="$define"
8826         echo "Yes, it does."
8827 else
8828         val="$undef"
8829         echo "No, it doesn't."
8830         case "$lseeksize" in
8831         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8832         esac
8833 fi
8834 $rm -f try.* try
8835 set d_off64_t
8836 eval $setvar
8837
8838 : check for fpos64_t
8839 echo " "
8840 echo "Checking to see if your system supports fpos64_t..." >&4
8841 $cat >try.c <<EOCP
8842 #include <sys/stdio.h>
8843 int main() { fpos64_t x x = 7; }'
8844 EOCP
8845 set try
8846 if eval $compile; then
8847         val="$define"
8848         echo "Yes, it does."
8849 else
8850         val="$undef"
8851         echo "No, it doesn't."
8852         case "$fpossize" in
8853         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8854         esac
8855 fi
8856 $rm -f try.* try
8857 set d_fpos64_t
8858 eval $setvar
8859
8860 hasstruct='varname=$1; struct=$2; shift; shift;
8861 while $test $# -ge 2; do
8862         case "$1" in
8863         $define) echo "#include <$2>";;
8864         esac ;
8865     shift 2;
8866 done > try.c;
8867 echo "int main () { struct $struct foo; }" >> try.c;
8868 set try;
8869 if eval $compile; then
8870         val="$define";
8871 else
8872         val="$undef";
8873 fi;
8874 set $varname;
8875 eval $setvar;
8876 $rm -f try.c try.o'
8877
8878 : see if this is a sys/param system
8879 set sys/param.h i_sysparam
8880 eval $inhdr
8881
8882 : see if this is a sys/mount.h system
8883 set sys/mount.h i_sysmount
8884 eval $inhdr
8885
8886 : see if sys/types.h has to be included
8887 set sys/types.h i_systypes
8888 eval $inhdr
8889
8890
8891 echo " "
8892 echo "Checking to see if your system supports struct fs_data..." >&4
8893 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8894 eval $hasstruct
8895 case "$d_fs_data_s" in
8896 "$define")      echo "Yes, it does."   ;;
8897 *)              echo "No, it doesn't." ;;
8898 esac
8899
8900 : see if fseeko exists
8901 set fseeko d_fseeko
8902 eval $inlibc
8903 case "$longsize" in
8904 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8905 esac
8906
8907 : see if fsetpos exists
8908 set fsetpos d_fsetpos
8909 eval $inlibc
8910
8911
8912 : see if fstatfs exists
8913 set fstatfs d_fstatfs
8914 eval $inlibc
8915
8916
8917 : see if statvfs exists
8918 set statvfs d_statvfs
8919 eval $inlibc
8920
8921 : see if fstatvfs exists
8922 set fstatvfs d_fstatvfs
8923 eval $inlibc
8924
8925
8926 : see if ftello exists
8927 set ftello d_ftello
8928 eval $inlibc
8929 case "$longsize" in
8930 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8931 esac
8932
8933 : see if getgrent exists
8934 set getgrent d_getgrent
8935 eval $inlibc
8936
8937 : see if gethostbyaddr exists
8938 set gethostbyaddr d_gethbyaddr
8939 eval $inlibc
8940
8941 : see if gethostbyname exists
8942 set gethostbyname d_gethbyname
8943 eval $inlibc
8944
8945 : see if gethostent exists
8946 set gethostent d_gethent
8947 eval $inlibc
8948
8949 : see how we will look up host name
8950 echo " "
8951 call=''
8952 if set gethostname val -f d_gethname; eval $csym; $val; then
8953         echo 'gethostname() found.' >&4
8954         d_gethname="$define"
8955         call=gethostname
8956 fi
8957 if set uname val -f d_uname; eval $csym; $val; then
8958         if ./xenix; then
8959                 $cat <<'EOM'
8960 uname() was found, but you're running xenix, and older versions of xenix
8961 have a broken uname(). If you don't really know whether your xenix is old
8962 enough to have a broken system call, use the default answer.
8963
8964 EOM
8965                 dflt=y
8966                 case "$d_uname" in
8967                 "$define") dflt=n;;
8968                 esac
8969                 rp='Is your uname() broken?'
8970                 . ./myread
8971                 case "$ans" in
8972                 n*) d_uname="$define"; call=uname;;
8973                 esac
8974         else
8975                 echo 'uname() found.' >&4
8976                 d_uname="$define"
8977                 case "$call" in
8978                 '') call=uname ;;
8979                 esac
8980         fi
8981 fi
8982 case "$d_gethname" in
8983 '') d_gethname="$undef";;
8984 esac
8985 case "$d_uname" in
8986 '') d_uname="$undef";;
8987 esac
8988 case "$d_uname$d_gethname" in
8989 *define*)
8990         dflt=n
8991         cat <<EOM
8992  
8993 Every now and then someone has a $call() that lies about the hostname
8994 but can't be fixed for political or economic reasons.  If you wish, I can
8995 pretend $call() isn't there and maybe compute hostname at run-time
8996 thanks to the '$phostname' command.
8997
8998 EOM
8999         rp="Shall I ignore $call() from now on?"
9000         . ./myread
9001         case "$ans" in
9002         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9003         esac;;
9004 esac
9005 case "$phostname" in
9006 '') aphostname='';;
9007 *) case "$aphostname" in
9008         /*) ;;
9009         *) set X $phostname
9010                 shift
9011                 file=$1
9012                 shift
9013                 file=`./loc $file $file $pth`
9014                 aphostname=`echo $file $*`
9015                 ;;
9016         esac
9017         ;;
9018 esac
9019 case "$d_uname$d_gethname" in
9020 *define*) ;;
9021 *)
9022         case "$phostname" in
9023         '')
9024                 echo "There will be no way for $package to get your hostname." >&4;;
9025         *)
9026         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9027                 ;;
9028         esac;;
9029 esac
9030 case "$d_phostname" in
9031 '') d_phostname="$undef";;
9032 esac
9033
9034 : see if this is a netdb.h system
9035 set netdb.h i_netdb
9036 eval $inhdr
9037
9038 : see if prototypes for various gethostxxx netdb.h functions are available
9039 echo " "
9040 set d_gethostprotos gethostent $i_netdb netdb.h
9041 eval $hasproto
9042
9043 : see if getlogin exists
9044 set getlogin d_getlogin
9045 eval $inlibc
9046
9047 : see if getmnt exists
9048 set getmnt d_getmnt
9049 eval $inlibc
9050
9051 : see if getmntent exists
9052 set getmntent d_getmntent
9053 eval $inlibc
9054
9055 : see if getnetbyaddr exists
9056 set getnetbyaddr d_getnbyaddr
9057 eval $inlibc
9058
9059 : see if getnetbyname exists
9060 set getnetbyname d_getnbyname
9061 eval $inlibc
9062
9063 : see if getnetent exists
9064 set getnetent d_getnent
9065 eval $inlibc
9066
9067 : see if prototypes for various getnetxxx netdb.h functions are available
9068 echo " "
9069 set d_getnetprotos getnetent $i_netdb netdb.h
9070 eval $hasproto
9071
9072
9073 : see if getprotobyname exists
9074 set getprotobyname d_getpbyname
9075 eval $inlibc
9076
9077 : see if getprotobynumber exists
9078 set getprotobynumber d_getpbynumber
9079 eval $inlibc
9080
9081 : see if getprotoent exists
9082 set getprotoent d_getpent
9083 eval $inlibc
9084
9085 : see if getpgid exists
9086 set getpgid d_getpgid
9087 eval $inlibc
9088
9089 : see if getpgrp2 exists
9090 set getpgrp2 d_getpgrp2
9091 eval $inlibc
9092
9093 : see if getppid exists
9094 set getppid d_getppid
9095 eval $inlibc
9096
9097 : see if getpriority exists
9098 set getpriority d_getprior
9099 eval $inlibc
9100
9101 : see if prototypes for various getprotoxxx netdb.h functions are available
9102 echo " "
9103 set d_getprotoprotos getprotoent $i_netdb netdb.h
9104 eval $hasproto
9105
9106 : see if getpwent exists
9107 set getpwent d_getpwent
9108 eval $inlibc
9109
9110
9111 : see if getservbyname exists
9112 set getservbyname d_getsbyname
9113 eval $inlibc
9114
9115 : see if getservbyport exists
9116 set getservbyport d_getsbyport
9117 eval $inlibc
9118
9119 : see if getservent exists
9120 set getservent d_getsent
9121 eval $inlibc
9122
9123 : see if prototypes for various getservxxx netdb.h functions are available
9124 echo " "
9125 set d_getservprotos getservent $i_netdb netdb.h
9126 eval $hasproto
9127
9128 : see if getspent exists
9129 set getspent d_getspent
9130 eval $inlibc
9131
9132 : see if getspnam exists
9133 set getspnam d_getspnam
9134 eval $inlibc
9135
9136 : see if gettimeofday or ftime exists
9137 set gettimeofday d_gettimeod
9138 eval $inlibc
9139 case "$d_gettimeod" in
9140 "$undef")
9141         set ftime d_ftime 
9142         eval $inlibc
9143         ;;
9144 *)
9145         val="$undef"; set d_ftime; eval $setvar
9146         ;;
9147 esac
9148 case "$d_gettimeod$d_ftime" in
9149 "$undef$undef")
9150         echo " "
9151         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9152         ;;
9153 esac
9154
9155 : see if this is an grp system
9156 set grp.h i_grp
9157 eval $inhdr
9158
9159 case "$i_grp" in
9160 $define)
9161         xxx=`./findhdr grp.h`
9162         $cppstdin $cppflags $cppminus < $xxx >$$.h
9163
9164         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9165                 val="$define"
9166         else
9167                 val="$undef"
9168         fi
9169         set d_grpasswd
9170         eval $setvar
9171
9172         $rm -f $$.h
9173         ;;
9174 *)
9175         val="$undef";
9176         set d_grpasswd; eval $setvar
9177         ;;
9178 esac
9179
9180 : see if hasmntopt exists
9181 set hasmntopt d_hasmntopt
9182 eval $inlibc
9183
9184 : see if this is a netinet/in.h or sys/in.h system
9185 set netinet/in.h i_niin sys/in.h i_sysin
9186 eval $inhdr
9187
9188 : see if arpa/inet.h has to be included
9189 set arpa/inet.h i_arpainet
9190 eval $inhdr
9191
9192 : see if htonl --and friends-- exists
9193 val=''
9194 set htonl val
9195 eval $inlibc
9196
9197 : Maybe they are macros.
9198 case "$val" in
9199 $undef)
9200         $cat >htonl.c <<EOM
9201 #include <stdio.h>
9202 #include <sys/types.h>
9203 #$i_niin I_NETINET_IN
9204 #$i_sysin I_SYS_IN
9205 #$i_arpainet I_ARPA_INET
9206 #ifdef I_NETINET_IN
9207 #include <netinet/in.h>
9208 #endif
9209 #ifdef I_SYS_IN
9210 #include <sys/in.h>
9211 #endif
9212 #ifdef I_ARPA_INET
9213 #include <arpa/inet.h>
9214 #endif
9215 #ifdef htonl
9216 printf("Defined as a macro.");
9217 #endif
9218 EOM
9219         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9220         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9221                 val="$define"
9222                 echo "But it seems to be defined as a macro." >&4
9223         fi
9224         $rm -f htonl.?
9225         ;;
9226 esac
9227 set d_htonl
9228 eval $setvar
9229
9230 : see if iconv exists
9231 set iconv d_iconv
9232 eval $inlibc
9233
9234 : index or strchr
9235 echo " "
9236 if set index val -f; eval $csym; $val; then
9237         if set strchr val -f d_strchr; eval $csym; $val; then
9238                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9239                         val="$define"
9240                         vali="$undef"
9241                         echo "strchr() found." >&4
9242                 else
9243                         val="$undef"
9244                         vali="$define"
9245                         echo "index() found." >&4
9246                 fi
9247         else
9248                 val="$undef"
9249                 vali="$define"
9250                 echo "index() found." >&4
9251         fi
9252 else
9253         if set strchr val -f d_strchr; eval $csym; $val; then
9254                 val="$define"
9255                 vali="$undef"
9256                 echo "strchr() found." >&4
9257         else
9258                 echo "No index() or strchr() found!" >&4
9259                 val="$undef"
9260                 vali="$undef"
9261         fi
9262 fi
9263 set d_strchr; eval $setvar
9264 val="$vali"
9265 set d_index; eval $setvar
9266
9267 : check whether inet_aton exists
9268 set inet_aton d_inetaton
9269 eval $inlibc
9270
9271 : Look for isascii
9272 echo " "
9273 $cat >isascii.c <<'EOCP'
9274 #include <stdio.h>
9275 #include <ctype.h>
9276 int main() {
9277         int c = 'A';
9278         if (isascii(c))
9279                 exit(0);
9280         else
9281                 exit(1);
9282 }
9283 EOCP
9284 set isascii
9285 if eval $compile; then
9286         echo "isascii() found." >&4
9287         val="$define"
9288 else
9289         echo "isascii() NOT found." >&4
9290         val="$undef"
9291 fi
9292 set d_isascii
9293 eval $setvar
9294 $rm -f isascii*
9295
9296 : see if killpg exists
9297 set killpg d_killpg
9298 eval $inlibc
9299
9300 : see if lchown exists
9301 echo " "
9302 $cat > try.c <<'EOCP'
9303 /* System header to define __stub macros and hopefully few prototypes,
9304     which can conflict with char lchown(); below.  */
9305 #include <assert.h>
9306 /* Override any gcc2 internal prototype to avoid an error.  */
9307 /* We use char because int might match the return type of a gcc2
9308    builtin and then its argument prototype would still apply.  */
9309 char lchown();
9310 int main() {
9311     /*  The GNU C library defines this for functions which it implements
9312         to always fail with ENOSYS.  Some functions are actually named
9313         something starting with __ and the normal name is an alias.  */
9314 #if defined (__stub_lchown) || defined (__stub___lchown)
9315 choke me
9316 #else
9317 lchown();
9318 #endif
9319 ; return 0; }
9320 EOCP
9321 set try
9322 if eval $compile; then
9323     $echo "lchown() found." >&4
9324     val="$define"
9325 else
9326     $echo "lchown() NOT found." >&4
9327     val="$undef"
9328 fi
9329 set d_lchown
9330 eval $setvar
9331
9332 : See if number of significant digits in a double precision number is known
9333 echo " "
9334 $cat >ldbl_dig.c <<EOM
9335 #$i_limits I_LIMITS
9336 #$i_float I_FLOAT
9337 #ifdef I_LIMITS
9338 #include <limits.h>
9339 #endif
9340 #ifdef I_FLOAT
9341 #include <float.h>
9342 #endif
9343 #ifdef LDBL_DIG
9344 printf("Contains LDBL_DIG");
9345 #endif
9346 EOM
9347 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9348 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9349         echo "LDBL_DIG found." >&4
9350         val="$define"
9351 else
9352         echo "LDBL_DIG NOT found." >&4
9353         val="$undef"
9354 fi
9355 $rm -f ldbl_dig.?
9356 set d_ldbl_dig
9357 eval $setvar
9358
9359 : see if link exists
9360 set link d_link
9361 eval $inlibc
9362
9363 : see if localeconv exists
9364 set localeconv d_locconv
9365 eval $inlibc
9366
9367 : see if lockf exists
9368 set lockf d_lockf
9369 eval $inlibc
9370
9371 : check for long long
9372 echo " "
9373 $echo $n "Checking to see if your system supports long long..." $c >&4
9374 echo 'int main() { long long x = 7; return 0; }' > try.c
9375 set try
9376 if eval $compile; then
9377         val="$define"
9378         echo " Yes, it does." >&4
9379 else
9380         val="$undef"
9381         echo " No, it doesn't." >&4
9382 fi
9383 $rm try.*
9384 set d_longlong
9385 eval $setvar
9386
9387 : check for length of long long
9388 case "${d_longlong}${longlongsize}" in
9389 $define)
9390         echo " "
9391         $echo $n "Checking to see how big your long longs are..." $c >&4
9392         $cat >try.c <<'EOCP'
9393 #include <stdio.h>
9394 int main()
9395 {
9396     printf("%d\n", (int)sizeof(long long));
9397     return(0);
9398 }
9399 EOCP
9400         set try
9401         if eval $compile_ok; then
9402                 longlongsize=`./try$exe_ext`
9403                 $echo " $longlongsize bytes." >&4
9404         else
9405                 dflt='8'
9406                 echo " "
9407                 echo "(I can't seem to compile the test program.  Guessing...)"
9408                 rp="What is the size of a long long (in bytes)?"
9409                 . ./myread
9410                 longlongsize="$ans"
9411         fi
9412         if $test "X$longsize" = "X$longlongsize"; then
9413                 echo "(That isn't any different from an ordinary long.)"
9414         fi      
9415         ;;
9416 esac
9417 $rm -f try.* try
9418
9419 : see if lstat exists
9420 set lstat d_lstat
9421 eval $inlibc
9422
9423 : see if mblen exists
9424 set mblen d_mblen
9425 eval $inlibc
9426
9427 : see if mbstowcs exists
9428 set mbstowcs d_mbstowcs
9429 eval $inlibc
9430
9431 : see if mbtowc exists
9432 set mbtowc d_mbtowc
9433 eval $inlibc
9434
9435 : see if memchr exists
9436 set memchr d_memchr
9437 eval $inlibc
9438
9439 : see if memcmp exists
9440 set memcmp d_memcmp
9441 eval $inlibc
9442
9443 : see if memcpy exists
9444 set memcpy d_memcpy
9445 eval $inlibc
9446
9447 : see if memmove exists
9448 set memmove d_memmove
9449 eval $inlibc
9450
9451 : see if memset exists
9452 set memset d_memset
9453 eval $inlibc
9454
9455 : see if mkdir exists
9456 set mkdir d_mkdir
9457 eval $inlibc
9458
9459 : see if mkfifo exists
9460 set mkfifo d_mkfifo
9461 eval $inlibc
9462
9463 : see if mktime exists
9464 set mktime d_mktime
9465 eval $inlibc
9466
9467 : see if msgctl exists
9468 set msgctl d_msgctl
9469 eval $inlibc
9470
9471 : see if msgget exists
9472 set msgget d_msgget
9473 eval $inlibc
9474
9475 : see if msgsnd exists
9476 set msgsnd d_msgsnd
9477 eval $inlibc
9478
9479 : see if msgrcv exists
9480 set msgrcv d_msgrcv
9481 eval $inlibc
9482
9483 : see how much of the 'msg*(2)' library is present.
9484 h_msg=true
9485 echo " "
9486 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9487 *"$undef"*) h_msg=false;;
9488 esac
9489 case "$osname" in
9490 freebsd)
9491     case "`ipcs 2>&1`" in
9492     "SVID messages"*"not configured"*)
9493         echo "Your $osname does not have the msg*(2) configured." >&4
9494         h_msg=false
9495         val="$undef"
9496         set msgctl d_msgctl
9497         eval $setvar
9498         set msgget d_msgget
9499         eval $setvar
9500         set msgsnd d_msgsnd
9501         eval $setvar
9502         set msgrcv d_msgrcv
9503         eval $setvar
9504         ;;
9505     esac
9506     ;;
9507 esac
9508 : we could also check for sys/ipc.h ...
9509 if $h_msg && $test `./findhdr sys/msg.h`; then
9510         echo "You have the full msg*(2) library." >&4
9511         val="$define"
9512 else
9513         echo "You don't have the full msg*(2) library." >&4
9514         val="$undef"
9515 fi
9516 set d_msg
9517 eval $setvar
9518
9519 : see if nice exists
9520 set nice d_nice
9521 eval $inlibc
9522
9523 : see if inttypes.h is available
9524 : we want a real compile instead of Inhdr because some systems
9525 : have an inttypes.h which includes non-existent headers
9526 echo " "
9527 $cat >try.c <<EOCP
9528 #include <inttypes.h>
9529 int main() {
9530         static int32_t foo32 = 0x12345678;
9531 }
9532 EOCP
9533 set try
9534 if eval $compile; then
9535         echo "<inttypes.h> found." >&4
9536         val="$define"
9537 else
9538         echo "<inttypes.h> NOT found." >&4
9539         val="$undef"
9540 fi
9541 $rm -f try.c try
9542 set i_inttypes
9543 eval $setvar
9544
9545 : check for int64_t
9546 echo " "
9547 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9548 $cat >try.c <<EOCP
9549 #include <sys/types.h>
9550 #$i_inttypes I_INTTYPES
9551 #ifdef I_INTTYPES
9552 #include <inttypes.h>
9553 #endif
9554 int main() { int64_t x = 7; }
9555 EOCP
9556 set try
9557 if eval $compile; then
9558         val="$define"
9559         echo " Yes, it does." >&4
9560 else
9561         val="$undef"
9562         echo " No, it doesn't." >&4
9563 fi
9564 $rm -f try try.*
9565 set d_int64t
9566 eval $setvar
9567
9568
9569 echo " "
9570 echo "Checking which 64-bit integer type we could use..." >&4
9571
9572 case "$intsize" in
9573 8) val=int
9574    set quadtype
9575    eval $setvar
9576    val='"unsigned int"'
9577    set uquadtype
9578    eval $setvar
9579    quadkind=1
9580    ;;
9581 *) case "$longsize" in
9582    8) val=long
9583       set quadtype
9584       eval $setvar
9585       val='"unsigned long"'
9586       set uquadtype
9587       eval $setvar
9588       quadkind=2
9589       ;;
9590    *) case "$d_longlong:$longlongsize" in
9591       define:8)
9592         val='"long long"'
9593         set quadtype
9594         eval $setvar
9595         val='"unsigned long long"'
9596         set uquadtype
9597         eval $setvar
9598         quadkind=3
9599         ;;
9600       *) case "$d_int64t" in
9601          define)
9602            val=int64_t
9603            set quadtype
9604            eval $setvar
9605            val=uint64_t
9606            set uquadtype
9607            eval $setvar
9608            quadkind=4
9609            ;;
9610          esac
9611          ;;
9612       esac
9613       ;;
9614    esac
9615    ;;
9616 esac
9617
9618 case "$quadtype" in
9619 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9620         undef:define:8)
9621            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9622         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9623         esac
9624         d_quad="$undef"
9625         ;;
9626 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9627             verb="will"
9628         else
9629             verb="could"
9630         fi
9631         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9632         d_quad="$define"
9633         ;;
9634 esac
9635
9636 : check for length of character
9637 echo " "
9638 case "$charsize" in
9639 '')
9640         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9641         $cat >try.c <<'EOCP'
9642 #include <stdio.h>
9643 int main()
9644 {
9645     printf("%d\n", (int)sizeof(char));
9646     exit(0);
9647 }
9648 EOCP
9649         set try
9650         if eval $compile_ok; then
9651                 dflt=`./try`
9652         else
9653                 dflt='1'
9654                 echo "(I can't seem to compile the test program.  Guessing...)"
9655         fi
9656         ;;
9657 *)
9658         dflt="$charsize"
9659         ;;
9660 esac
9661 rp="What is the size of a character (in bytes)?"
9662 . ./myread
9663 charsize="$ans"
9664 $rm -f try.c try
9665
9666
9667 echo " "
9668 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9669
9670 case "$use64bits:$d_quad:$quadtype" in
9671 define:define:?*)
9672         ivtype="$quadtype"
9673         uvtype="$uquadtype"
9674         ivsize=8
9675         uvsize=8
9676         ;;
9677 *)      ivtype="long"
9678         uvtype="unsigned long"
9679         ivsize=$longsize
9680         uvsize=$longsize
9681         ;;
9682 esac
9683
9684 case "$uselongdouble:$d_longdbl" in
9685 define:define)
9686         nvtype="long double"
9687         nvsize=$longdblsize
9688         ;;
9689 *)      nvtype=double
9690         nvsize=$doublesize
9691         ;;
9692 esac
9693
9694 $echo "(IV will be "$ivtype", $ivsize bytes)"
9695 $echo "(UV will be "$uvtype", $uvsize bytes)"
9696 $echo "(NV will be "$nvtype", $nvsize bytes)"
9697
9698 $cat >try.c <<EOCP
9699 #$i_inttypes I_INTTYPES
9700 #ifdef I_INTTYPES
9701 #include <inttypes.h>
9702 #endif
9703 #include <stdio.h>
9704 int main() {
9705 #ifdef INT8
9706    int8_t i =  INT8_MAX;
9707   uint8_t u = UINT8_MAX;
9708   printf("int8_t\n");
9709 #endif
9710 #ifdef INT16
9711    int16_t i =  INT16_MAX;
9712   uint16_t i = UINT16_MAX;
9713   printf("int16_t\n");
9714 #endif
9715 #ifdef INT32
9716    int32_t i =  INT32_MAX;
9717   uint32_t u = UINT32_MAX;
9718   printf("int32_t\n");
9719 #endif
9720 }
9721 EOCP
9722
9723 case "$i8type" in
9724 '')     case "$charsize" in
9725         1)      i8type=char
9726                 u8type="unsigned char"
9727                 i8size=$charsize
9728                 u8size=$charsize
9729                 ;;
9730         esac
9731         ;;
9732 esac
9733 case "$i8type" in
9734 '')     set try -DINT8
9735         if eval $compile; then
9736                 case "`./try$exe_ext`" in
9737                 int8_t) i8type=int8_t
9738                         u8type=uint8_t
9739                         i8size=1
9740                         u8size=1
9741                         ;;
9742                 esac
9743         fi
9744         ;;
9745 esac
9746 case "$i8type" in
9747 '')     if $test $charsize -ge 1; then
9748                 i8type=char
9749                 u8type="unsigned char"
9750                 i8size=$charsize
9751                 u8size=$charsize
9752         fi
9753         ;;
9754 esac
9755
9756 case "$i16type" in
9757 '')     case "$shortsize" in
9758         2)      i16type=short
9759                 u16type="unsigned short"
9760                 i16size=$shortsize
9761                 u16size=$shortsize
9762                 ;;
9763         esac
9764         ;;
9765 esac
9766 case "$i16type" in
9767 '')     set try -DINT16
9768         if eval $compile; then
9769                 case "`./try$exe_ext`" in
9770                 int16_t)
9771                         i16type=int16_t
9772                         u16type=uint16_t
9773                         i16size=2
9774                         u16size=2
9775                         ;;
9776                 esac
9777         fi
9778         ;;
9779 esac
9780 case "$i16type" in
9781 '')     if $test $shortsize -ge 2; then
9782                 i16type=short
9783                 u16type="unsigned short"
9784                 i16size=$shortsize
9785                 u16size=$shortsize
9786         fi
9787         ;;
9788 esac
9789
9790 case "$i32type" in
9791 '')     case "$longsize" in
9792         4)      i32type=long
9793                 u32type="unsigned long"
9794                 i32size=$longsize
9795                 u32size=$longsize
9796                 ;;
9797         *)      case "$intsize" in
9798                 4)      i32type=int
9799                         u32type="unsigned int"
9800                         i32size=$intsize
9801                         u32size=$intsize
9802                         ;;
9803                 esac
9804                 ;;
9805         esac
9806         ;;
9807 esac
9808 case "$i32type" in
9809 '')     set try -DINT32
9810         if eval $compile; then
9811                 case "`./try$exe_ext`" in
9812                 int32_t)
9813                         i32type=int32_t
9814                         u32type=uint32_t
9815                         i32size=4
9816                         u32size=4
9817                         ;;
9818                 esac
9819         fi
9820         ;;
9821 esac
9822 case "$i32type" in
9823 '')     if $test $intsize -ge 4; then
9824                 i32type=int
9825                 u32type="unsigned int"
9826                 i32size=$intsize
9827                 u32size=$intsize
9828         fi
9829         ;;
9830 esac
9831
9832 case "$i64type" in
9833 '')     case "$d_quad:$quadtype" in
9834         define:?*)
9835                 i64type="$quadtype"
9836                 u64type="$uquadtype"
9837                 i64size=8
9838                 u64size=8
9839                 ;;
9840         esac
9841         ;;
9842 esac
9843
9844 $echo "Checking whether your NVs can preserve your UVs..." >&4
9845 $cat <<EOP >try.c
9846 #include <stdio.h>
9847 int main() {
9848     $uvtype k = ($uvtype)~0, l;
9849     $nvtype d;
9850     l = k;
9851     d = ($nvtype)l;
9852     l = ($uvtype)d;
9853     if (l == k)
9854        printf("preserve\n");
9855     exit(0);
9856 }
9857 EOP
9858 set try
9859 if eval $compile; then
9860         case "`./try$exe_ext`" in
9861         preserve) d_nv_preserves_uv="$define" ;;
9862         esac
9863 fi      
9864 case "$d_nv_preserves_uv" in
9865 $define) $echo "Yes, they can."  2>&1 ;;
9866 *)       $echo "No, they can't." 2>&1
9867          d_nv_preserves_uv="$undef"
9868          ;;
9869 esac
9870
9871 $rm -f try.* try
9872
9873 : see if POSIX threads are available
9874 set pthread.h i_pthread
9875 eval $inhdr
9876
9877
9878
9879
9880 : how to create joinable pthreads
9881 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9882         echo " "
9883         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9884         $cat >try.c <<'EOCP'
9885 #include <pthread.h>
9886 int main() {
9887     int detachstate = JOINABLE;
9888 }
9889 EOCP
9890         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9891         if eval $compile; then
9892                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9893                 val="$undef" # Yes, undef.
9894                 set d_old_pthread_create_joinable
9895                 eval $setvar
9896                 val=""
9897                 set old_pthread_create_joinable
9898                 eval $setvar
9899         else
9900                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9901                 if eval $compile; then
9902                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9903                         val="$define"
9904                         set d_old_pthread_create_joinable
9905                         eval $setvar
9906                         val=PTHREAD_CREATE_UNDETACHED
9907                         set old_pthread_create_joinable
9908                         eval $setvar
9909                 else            
9910                         set try -DJOINABLE=__UNDETACHED
9911                         if eval $compile; then
9912                                 echo "You seem to use __UNDETACHED." >&4
9913                                 val="$define"
9914                                 set d_old_pthread_create_joinable
9915                                 eval $setvar
9916                                 val=__UNDETACHED
9917                                 set old_pthread_create_joinable
9918                                 eval $setvar
9919                         else
9920                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9921                                 val="$define"
9922                                 set d_old_pthread_create_joinable
9923                                 eval $setvar
9924                                 val=0
9925                                 set old_pthread_create_joinable
9926                                 eval $setvar
9927                         fi
9928                 fi
9929         fi
9930         $rm -f try try.*
9931 else
9932     d_old_pthread_create_joinable="$undef"
9933     old_pthread_create_joinable=""
9934 fi
9935
9936 : see if pause exists
9937 set pause d_pause
9938 eval $inlibc
9939
9940 : see if pipe exists
9941 set pipe d_pipe
9942 eval $inlibc
9943
9944 : see if poll exists
9945 set poll d_poll
9946 eval $inlibc
9947
9948
9949 : see whether the various POSIXish _yields exist
9950 $cat >try.c <<EOP
9951 #include <pthread.h>
9952 #include <stdio.h>
9953 int main() {
9954 #ifdef SCHED_YIELD
9955         sched_yield();
9956 #else
9957 #ifdef PTHREAD_YIELD
9958         pthread_yield();
9959 #else
9960 #ifdef PTHREAD_YIELD_NULL
9961         pthread_yield(NULL);
9962 #endif
9963 #endif
9964 #endif
9965 }
9966 EOP
9967 : see if sched_yield exists
9968 set try -DSCHED_YIELD
9969 if eval $compile; then
9970     val="$define"
9971     sched_yield='sched_yield()'
9972 else
9973     val="$undef"
9974 fi
9975 case "$usethreads" in
9976 $define)
9977         case "$val" in
9978         $define) echo 'sched_yield() found.' >&4        ;;
9979         *)       echo 'sched_yield() NOT found.' >&4    ;;
9980         esac
9981 esac
9982 set d_sched_yield
9983 eval $setvar
9984
9985 : see if pthread_yield exists
9986 set try -DPTHREAD_YIELD
9987 if eval $compile; then
9988     val="$define"
9989     case "$sched_yield" in
9990     '') sched_yield='pthread_yield()' ;;
9991     esac
9992 else
9993     set try -DPTHREAD_YIELD_NULL
9994     if eval $compile; then
9995         val="$define"
9996         case "$sched_yield" in
9997         '') sched_yield='pthread_yield(NULL)' ;;
9998         esac
9999     else
10000         val="$undef"
10001     fi
10002 fi
10003 case "$usethreads" in
10004 $define)
10005         case "$val" in
10006         $define) echo 'pthread_yield() found.' >&4      ;;
10007         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10008         esac
10009         ;;
10010 esac
10011 set d_pthread_yield
10012 eval $setvar
10013
10014 case "$sched_yield" in
10015 '') sched_yield=undef ;;
10016 esac
10017
10018 $rm -f try try.*
10019
10020 : see if this is a pwd.h system
10021 set pwd.h i_pwd
10022 eval $inhdr
10023
10024 case "$i_pwd" in
10025 $define)
10026         xxx=`./findhdr pwd.h`
10027         $cppstdin $cppflags $cppminus < $xxx >$$.h
10028
10029         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10030                 val="$define"
10031         else
10032                 val="$undef"
10033         fi
10034         set d_pwquota
10035         eval $setvar
10036
10037         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10038                 val="$define"
10039         else
10040                 val="$undef"
10041         fi
10042         set d_pwage
10043         eval $setvar
10044
10045         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10046                 val="$define"
10047         else
10048                 val="$undef"
10049         fi
10050         set d_pwchange
10051         eval $setvar
10052
10053         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10054                 val="$define"
10055         else
10056                 val="$undef"
10057         fi
10058         set d_pwclass
10059         eval $setvar
10060
10061         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10062                 val="$define"
10063         else
10064                 val="$undef"
10065         fi
10066         set d_pwexpire
10067         eval $setvar
10068
10069         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10070                 val="$define"
10071         else
10072                 val="$undef"
10073         fi
10074         set d_pwcomment
10075         eval $setvar
10076
10077         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10078                 val="$define"
10079         else
10080                 val="$undef"
10081         fi
10082         set d_pwgecos
10083         eval $setvar
10084
10085         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10086                 val="$define"
10087         else
10088                 val="$undef"
10089         fi
10090         set d_pwpasswd
10091         eval $setvar
10092
10093         $rm -f $$.h
10094         ;;
10095 *)
10096         val="$undef"; 
10097         set d_pwquota; eval $setvar
10098         set d_pwage; eval $setvar
10099         set d_pwchange; eval $setvar
10100         set d_pwclass; eval $setvar
10101         set d_pwexpire; eval $setvar
10102         set d_pwcomment; eval $setvar
10103         set d_pwgecos; eval $setvar
10104         set d_pwpasswd; eval $setvar
10105         ;;
10106 esac
10107
10108 : see if readdir and friends exist
10109 set readdir d_readdir
10110 eval $inlibc
10111 set seekdir d_seekdir
10112 eval $inlibc
10113 set telldir d_telldir
10114 eval $inlibc
10115 set rewinddir d_rewinddir
10116 eval $inlibc
10117
10118 : see if readlink exists
10119 set readlink d_readlink
10120 eval $inlibc
10121
10122 : see if rename exists
10123 set rename d_rename
10124 eval $inlibc
10125
10126 : see if rmdir exists
10127 set rmdir d_rmdir
10128 eval $inlibc
10129
10130 : see if memory.h is available.
10131 val=''
10132 set memory.h val
10133 eval $inhdr
10134
10135 : See if it conflicts with string.h
10136 case "$val" in
10137 $define)
10138         case "$strings" in
10139         '') ;;
10140         *)
10141                 $cppstdin $cppflags $cppminus < $strings > mem.h
10142                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10143                         echo " "
10144                         echo "We won't be including <memory.h>."
10145                         val="$undef"
10146                 fi
10147                 $rm -f mem.h
10148                 ;;
10149         esac
10150 esac
10151 set i_memory
10152 eval $setvar
10153
10154 : can bcopy handle overlapping blocks?
10155 val="$undef"
10156 case "$d_bcopy" in
10157 "$define")
10158         echo " "
10159         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10160         $cat >try.c <<EOCP
10161 #$i_memory I_MEMORY
10162 #$i_stdlib I_STDLIB
10163 #$i_string I_STRING
10164 #$i_unistd I_UNISTD
10165 EOCP
10166         $cat >>try.c <<'EOCP'
10167 #include <stdio.h>
10168 #ifdef I_MEMORY
10169 #  include <memory.h>
10170 #endif
10171 #ifdef I_STDLIB
10172 #  include <stdlib.h>
10173 #endif
10174 #ifdef I_STRING
10175 #  include <string.h>
10176 #else
10177 #  include <strings.h>
10178 #endif
10179 #ifdef I_UNISTD
10180 #  include <unistd.h>  /* Needed for NetBSD */
10181 #endif
10182 int main()
10183 {
10184 char buf[128], abc[128];
10185 char *b;
10186 int len;
10187 int off;
10188 int align;
10189
10190 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10191
10192 for (align = 7; align >= 0; align--) {
10193         for (len = 36; len; len--) {
10194                 b = buf+align;
10195                 bcopy(abc, b, len);
10196                 for (off = 1; off <= len; off++) {
10197                         bcopy(b, b+off, len);
10198                         bcopy(b+off, b, len);
10199                         if (bcmp(b, abc, len))
10200                                 exit(1);
10201                 }
10202         }
10203 }
10204 exit(0);
10205 }
10206 EOCP
10207         set try
10208         if eval $compile_ok; then
10209                 if ./try 2>/dev/null; then
10210                         echo "Yes, it can."
10211                         val="$define"
10212                 else
10213                         echo "It can't, sorry."
10214                         case "$d_memmove" in
10215                         "$define") echo "But that's Ok since you have memmove()." ;;
10216                         esac
10217                 fi
10218         else
10219                 echo "(I can't compile the test program, so we'll assume not...)"
10220                 case "$d_memmove" in
10221                 "$define") echo "But that's Ok since you have memmove()." ;;
10222                 esac
10223         fi
10224         ;;
10225 esac
10226 $rm -f try.* try core
10227 set d_safebcpy
10228 eval $setvar
10229
10230 : can memcpy handle overlapping blocks?
10231 val="$undef"
10232 case "$d_memcpy" in
10233 "$define")
10234         echo " "
10235         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10236         $cat >try.c <<EOCP
10237 #$i_memory I_MEMORY
10238 #$i_stdlib I_STDLIB
10239 #$i_string I_STRING
10240 #$i_unistd I_UNISTD
10241 EOCP
10242         $cat >>try.c <<'EOCP'
10243 #include <stdio.h>
10244 #ifdef I_MEMORY
10245 #  include <memory.h>
10246 #endif
10247 #ifdef I_STDLIB
10248 #  include <stdlib.h>
10249 #endif
10250 #ifdef I_STRING
10251 #  include <string.h>
10252 #else
10253 #  include <strings.h>
10254 #endif
10255 #ifdef I_UNISTD
10256 #  include <unistd.h>  /* Needed for NetBSD */
10257 #endif
10258 int main()
10259 {
10260 char buf[128], abc[128];
10261 char *b;
10262 int len;
10263 int off;
10264 int align;
10265
10266 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10267    try to store the string in read-only memory. */
10268 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10269
10270 for (align = 7; align >= 0; align--) {
10271         for (len = 36; len; len--) {
10272                 b = buf+align;
10273                 memcpy(b, abc, len);
10274                 for (off = 1; off <= len; off++) {
10275                         memcpy(b+off, b, len);
10276                         memcpy(b, b+off, len);
10277                         if (memcmp(b, abc, len))
10278                                 exit(1);
10279                 }
10280         }
10281 }
10282 exit(0);
10283 }
10284 EOCP
10285         set try
10286         if eval $compile_ok; then
10287                 if ./try 2>/dev/null; then
10288                         echo "Yes, it can."
10289                         val="$define"
10290                 else
10291                         echo "It can't, sorry."
10292                         case "$d_memmove" in
10293                         "$define") echo "But that's Ok since you have memmove()." ;;
10294                         esac
10295                 fi
10296         else
10297                 echo "(I can't compile the test program, so we'll assume not...)"
10298                 case "$d_memmove" in
10299                 "$define") echo "But that's Ok since you have memmove()." ;;
10300                 esac
10301         fi
10302         ;;
10303 esac
10304 $rm -f try.* try core
10305 set d_safemcpy
10306 eval $setvar
10307
10308 : can memcmp be trusted to compare relative magnitude?
10309 val="$undef"
10310 case "$d_memcmp" in
10311 "$define")
10312         echo " "
10313         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10314         $cat >try.c <<EOCP
10315 #$i_memory I_MEMORY
10316 #$i_stdlib I_STDLIB
10317 #$i_string I_STRING
10318 #$i_unistd I_UNISTD
10319 EOCP
10320         $cat >>try.c <<'EOCP'
10321 #include <stdio.h>
10322 #ifdef I_MEMORY
10323 #  include <memory.h>
10324 #endif
10325 #ifdef I_STDLIB
10326 #  include <stdlib.h>
10327 #endif
10328 #ifdef I_STRING
10329 #  include <string.h>
10330 #else
10331 #  include <strings.h>
10332 #endif
10333 #ifdef I_UNISTD
10334 #  include <unistd.h>  /* Needed for NetBSD */
10335 #endif
10336 int main()
10337 {
10338 char a = -1;
10339 char b = 0;
10340 if ((a < b) && memcmp(&a, &b, 1) < 0)
10341         exit(1);
10342 exit(0);
10343 }
10344 EOCP
10345         set try
10346         if eval $compile_ok; then
10347                 if ./try 2>/dev/null; then
10348                         echo "Yes, it can."
10349                         val="$define"
10350                 else
10351                         echo "No, it can't (it uses signed chars)."
10352                 fi
10353         else
10354                 echo "(I can't compile the test program, so we'll assume not...)"
10355         fi
10356         ;;
10357 esac
10358 $rm -f try.* try core
10359 set d_sanemcmp
10360 eval $setvar
10361
10362 : see if select exists
10363 set select d_select
10364 eval $inlibc
10365
10366 : see if semctl exists
10367 set semctl d_semctl
10368 eval $inlibc
10369
10370 : see if semget exists
10371 set semget d_semget
10372 eval $inlibc
10373
10374 : see if semop exists
10375 set semop d_semop
10376 eval $inlibc
10377
10378 : see how much of the 'sem*(2)' library is present.
10379 h_sem=true
10380 echo " "
10381 case "$d_semctl$d_semget$d_semop" in
10382 *"$undef"*) h_sem=false;;
10383 esac
10384 case "$osname" in
10385 freebsd)
10386     case "`ipcs 2>&1`" in
10387     "SVID messages"*"not configured"*)
10388         echo "Your $osname does not have the sem*(2) configured." >&4
10389         h_sem=false
10390         val="$undef"
10391         set semctl d_semctl
10392         eval $setvar
10393         set semget d_semget
10394         eval $setvar
10395         set semop d_semop
10396         eval $setvar
10397         ;;
10398     esac
10399     ;;
10400 esac
10401 : we could also check for sys/ipc.h ...
10402 if $h_sem && $test `./findhdr sys/sem.h`; then
10403         echo "You have the full sem*(2) library." >&4
10404         val="$define"
10405 else
10406         echo "You don't have the full sem*(2) library." >&4
10407         val="$undef"
10408 fi
10409 set d_sem
10410 eval $setvar
10411
10412 : see whether sys/sem.h defines union semun
10413 echo " "
10414 $cat > try.c <<'END'
10415 #include <sys/types.h>
10416 #include <sys/ipc.h>
10417 #include <sys/sem.h>
10418 int main () { union semun semun; semun.buf = 0; }
10419 END
10420 set try
10421 if eval $compile; then
10422     echo "You have union semun in <sys/sem.h>." >&4
10423     val="$define"
10424 else
10425     echo "You do not have union semun in <sys/sem.h>." >&4
10426     val="$undef"
10427 fi
10428 $rm -f try try.c try.h
10429 set d_union_semun
10430 eval $setvar
10431
10432 : see how to do semctl IPC_STAT
10433 case "$d_sem" in
10434 $define)
10435     : see whether semctl IPC_STAT can use union semun
10436     echo " "
10437     $cat > try.h <<END
10438 #ifndef S_IRUSR
10439 #   ifdef S_IREAD
10440 #       define S_IRUSR S_IREAD
10441 #       define S_IWUSR S_IWRITE
10442 #       define S_IXUSR S_IEXEC
10443 #   else
10444 #       define S_IRUSR 0400
10445 #       define S_IWUSR 0200
10446 #       define S_IXUSR 0100
10447 #   endif
10448 #   define S_IRGRP (S_IRUSR>>3)
10449 #   define S_IWGRP (S_IWUSR>>3)
10450 #   define S_IXGRP (S_IXUSR>>3)
10451 #   define S_IROTH (S_IRUSR>>6)
10452 #   define S_IWOTH (S_IWUSR>>6)
10453 #   define S_IXOTH (S_IXUSR>>6)
10454 #endif
10455 #ifndef S_IRWXU
10456 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10457 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10458 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10459 #endif
10460 END
10461
10462     $cat > try.c <<END
10463 #include <sys/types.h>
10464 #include <sys/ipc.h>
10465 #include <sys/sem.h>
10466 #include <sys/stat.h>
10467 #include <stdio.h>
10468 #include <errno.h>
10469 #include "try.h"
10470 #ifndef errno
10471 extern int errno;
10472 #endif
10473 #$d_union_semun HAS_UNION_SEMUN
10474 int main() {
10475     union semun
10476 #ifndef HAS_UNION_SEMUN
10477     {
10478         int val;
10479         struct semid_ds *buf;
10480         unsigned short *array;
10481     }
10482 #endif
10483     arg;
10484     int sem, st;
10485
10486 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10487     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10488     if (sem > -1) {
10489         struct semid_ds argbuf;
10490         arg.buf = &argbuf;
10491 #       ifdef IPC_STAT
10492         st = semctl(sem, 0, IPC_STAT, arg);
10493         if (st == 0)
10494             printf("semun\n");
10495         else
10496 #       endif /* IPC_STAT */
10497             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10498 #       ifdef IPC_RMID
10499         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10500 #       endif /* IPC_RMID */
10501             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10502     } else
10503 #endif /* IPC_PRIVATE && ... */
10504         printf("semget failed: errno = %d\n", errno);
10505   return 0;
10506 }
10507 END
10508     val="$undef"
10509     set try
10510     if eval $compile; then
10511         xxx=`./try`
10512         case "$xxx" in
10513         semun) val="$define" ;;
10514         esac
10515     fi
10516     $rm -f try try.c
10517     set d_semctl_semun
10518     eval $setvar
10519     case "$d_semctl_semun" in
10520     $define)
10521         echo "You can use union semun for semctl IPC_STAT." >&4
10522         also='also'
10523         ;;
10524     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10525         also=''
10526         ;;
10527     esac
10528
10529     : see whether semctl IPC_STAT can use struct semid_ds pointer
10530     $cat > try.c <<'END'
10531 #include <sys/types.h>
10532 #include <sys/ipc.h>
10533 #include <sys/sem.h>
10534 #include <sys/stat.h>
10535 #include "try.h"
10536 #include <stdio.h>
10537 #include <errno.h>
10538 #ifndef errno
10539 extern int errno;
10540 #endif
10541 int main() {
10542     struct semid_ds arg;
10543     int sem, st;
10544
10545 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10546     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10547     if (sem > -1) {
10548 #       ifdef IPC_STAT
10549         st = semctl(sem, 0, IPC_STAT, &arg);
10550         if (st == 0)
10551             printf("semid_ds\n");
10552         else
10553 #       endif /* IPC_STAT */
10554             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10555 #       ifdef IPC_RMID
10556         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10557 #       endif /* IPC_RMID */
10558             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10559     } else
10560 #endif /* IPC_PRIVATE && ... */
10561         printf("semget failed: errno = %d\n", errno);
10562
10563     return 0;
10564 }
10565 END
10566     val="$undef"
10567     set try
10568     if eval $compile; then
10569         xxx=`./try`
10570         case "$xxx" in
10571         semid_ds) val="$define" ;;
10572         esac
10573     fi
10574     $rm -f try try.c
10575     set d_semctl_semid_ds
10576     eval $setvar
10577     case "$d_semctl_semid_ds" in
10578     $define)
10579         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10580         ;;
10581     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10582         ;;
10583     esac
10584     $rm -f try.h
10585     ;;
10586 *)  val="$undef"
10587
10588     # We do not have the full sem*(2) library, so assume we can not
10589     # use either.
10590
10591     set d_semctl_semun
10592     eval $setvar
10593
10594     set d_semctl_semid_ds
10595     eval $setvar
10596     ;;
10597 esac
10598
10599 : see if setegid exists
10600 set setegid d_setegid
10601 eval $inlibc
10602
10603 : see if seteuid exists
10604 set seteuid d_seteuid
10605 eval $inlibc
10606
10607 : see if setgrent exists
10608 set setgrent d_setgrent
10609 eval $inlibc
10610
10611 : see if sethostent exists
10612 set sethostent d_sethent
10613 eval $inlibc
10614
10615 : see if setlinebuf exists
10616 set setlinebuf d_setlinebuf
10617 eval $inlibc
10618
10619 : see if setlocale exists
10620 set setlocale d_setlocale
10621 eval $inlibc
10622
10623 : see if setnetent exists
10624 set setnetent d_setnent
10625 eval $inlibc
10626
10627 : see if setprotoent exists
10628 set setprotoent d_setpent
10629 eval $inlibc
10630
10631 : see if setpgid exists
10632 set setpgid d_setpgid
10633 eval $inlibc
10634
10635 : see if setpgrp2 exists
10636 set setpgrp2 d_setpgrp2
10637 eval $inlibc
10638
10639 : see if setpriority exists
10640 set setpriority d_setprior
10641 eval $inlibc
10642
10643 : see if setpwent exists
10644 set setpwent d_setpwent
10645 eval $inlibc
10646
10647 : see if setregid exists
10648 set setregid d_setregid
10649 eval $inlibc
10650 set setresgid d_setresgid
10651 eval $inlibc
10652
10653 : see if setreuid exists
10654 set setreuid d_setreuid
10655 eval $inlibc
10656 set setresuid d_setresuid
10657 eval $inlibc
10658
10659 : see if setrgid exists
10660 set setrgid d_setrgid
10661 eval $inlibc
10662
10663 : see if setruid exists
10664 set setruid d_setruid
10665 eval $inlibc
10666
10667 : see if setservent exists
10668 set setservent d_setsent
10669 eval $inlibc
10670
10671 : see if setsid exists
10672 set setsid d_setsid
10673 eval $inlibc
10674
10675 : see if setspent exists
10676 set setspent d_setspent
10677 eval $inlibc
10678
10679 : see if setvbuf exists
10680 set setvbuf d_setvbuf
10681 eval $inlibc
10682
10683 : see if sfio.h is available
10684 set sfio.h i_sfio
10685 eval $inhdr
10686
10687
10688 : see if sfio library is available
10689 case "$i_sfio" in
10690 $define)
10691         val=''
10692         set sfreserve val
10693         eval $inlibc
10694         ;;
10695 *)
10696         val="$undef"
10697         ;;
10698 esac
10699 : Ok, but do we want to use it.
10700 case "$val" in
10701 $define)
10702         case "$usesfio" in
10703         true|$define|[yY]*) dflt='y';;
10704         *) dflt='n';;
10705         esac
10706         echo "$package can use the sfio library, but it is experimental."
10707         rp="You seem to have sfio available, do you want to try using it?"
10708         . ./myread
10709         case "$ans" in
10710         y|Y) ;;
10711         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10712                 val="$undef"
10713                 : Remove sfio from list of libraries to use
10714                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10715                 shift
10716                 libs="$*"
10717                 echo "libs = $libs" >&4
10718                 ;;
10719         esac
10720         ;;
10721 *)      case "$usesfio" in
10722         true|$define|[yY]*)
10723                 echo "Sorry, cannot find sfio on this machine" >&4
10724                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10725                 ;;
10726         esac
10727         ;;
10728 esac
10729 set d_sfio
10730 eval $setvar
10731 case "$d_sfio" in
10732 $define) usesfio='true';;
10733 *) usesfio='false';;
10734 esac
10735
10736 : see if shmctl exists
10737 set shmctl d_shmctl
10738 eval $inlibc
10739
10740 : see if shmget exists
10741 set shmget d_shmget
10742 eval $inlibc
10743
10744 : see if shmat exists
10745 set shmat d_shmat
10746 eval $inlibc
10747 : see what shmat returns
10748 case "$d_shmat" in
10749 "$define")
10750         $cat >shmat.c <<'END'
10751 #include <sys/shm.h>
10752 void *shmat();
10753 END
10754         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10755                 shmattype='void *'
10756         else
10757                 shmattype='char *'
10758         fi
10759         echo "and it returns ($shmattype)." >&4
10760         : see if a prototype for shmat is available
10761         xxx=`./findhdr sys/shm.h`
10762         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10763         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10764                 val="$define"
10765         else
10766                 val="$undef"
10767         fi
10768         $rm -f shmat.[co]
10769         ;;
10770 *)
10771         val="$undef"
10772         ;;
10773 esac
10774 set d_shmatprototype
10775 eval $setvar
10776
10777 : see if shmdt exists
10778 set shmdt d_shmdt
10779 eval $inlibc
10780
10781 : see how much of the 'shm*(2)' library is present.
10782 h_shm=true
10783 echo " "
10784 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10785 *"$undef"*) h_shm=false;;
10786 esac
10787 case "$osname" in
10788 freebsd)
10789     case "`ipcs 2>&1`" in
10790     "SVID shared memory"*"not configured"*)
10791         echo "Your $osname does not have the shm*(2) configured." >&4
10792         h_shm=false
10793         val="$undef"
10794         set shmctl d_shmctl
10795         evat $setvar
10796         set shmget d_shmget
10797         evat $setvar
10798         set shmat d_shmat
10799         evat $setvar
10800         set shmdt d_shmdt
10801         evat $setvar
10802         ;;
10803     esac
10804     ;;
10805 esac
10806 : we could also check for sys/ipc.h ...
10807 if $h_shm && $test `./findhdr sys/shm.h`; then
10808         echo "You have the full shm*(2) library." >&4
10809         val="$define"
10810 else
10811         echo "You don't have the full shm*(2) library." >&4
10812         val="$undef"
10813 fi
10814 set d_shm
10815 eval $setvar
10816
10817 echo " "
10818 : see if we have sigaction
10819 if set sigaction val -f d_sigaction; eval $csym; $val; then
10820         echo 'sigaction() found.' >&4
10821         $cat > try.c <<'EOP'
10822 #include <stdio.h>
10823 #include <sys/types.h>
10824 #include <signal.h>
10825 int main()
10826 {
10827     struct sigaction act, oact;
10828     act.sa_flags = 0;
10829     oact.sa_handler = 0;
10830     /* so that act and oact are used */
10831     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10832 }
10833 EOP
10834         set try
10835         if eval $compile_ok; then
10836                 val="$define"
10837         else
10838                 echo "But you don't seem to have a useable struct sigaction." >&4
10839                 val="$undef"
10840         fi
10841 else
10842         echo 'sigaction NOT found.' >&4
10843         val="$undef"
10844 fi
10845 set d_sigaction; eval $setvar
10846 $rm -f try try$_o try.c
10847
10848 : see if sigsetjmp exists
10849 echo " "
10850 case "$d_sigsetjmp" in
10851 '')
10852         $cat >try.c <<'EOP'
10853 #include <setjmp.h>
10854 sigjmp_buf env;
10855 int set = 1;
10856 int main()
10857 {
10858         if (sigsetjmp(env,1))
10859                 exit(set);
10860         set = 0;
10861         siglongjmp(env, 1);
10862         exit(1);
10863 }
10864 EOP
10865         set try
10866         if eval $compile; then
10867                 if ./try >/dev/null 2>&1; then
10868                         echo "POSIX sigsetjmp found." >&4
10869                         val="$define"
10870                 else
10871                         $cat >&4 <<EOM
10872 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10873 I'll ignore them.
10874 EOM
10875                         val="$undef"
10876                 fi
10877         else
10878                 echo "sigsetjmp not found." >&4
10879                 val="$undef"
10880         fi
10881         ;;
10882 *) val="$d_sigsetjmp"
10883         case "$d_sigsetjmp" in
10884         $define) echo "POSIX sigsetjmp found." >&4;;
10885         $undef) echo "sigsetjmp not found." >&4;;
10886         esac
10887         ;;
10888 esac
10889 set d_sigsetjmp
10890 eval $setvar
10891 $rm -f try.c try
10892
10893 : see if sys/stat.h is available
10894 set sys/stat.h i_sysstat
10895 eval $inhdr
10896
10897
10898 : see if stat knows about block sizes
10899 echo " "
10900 echo "Checking to see if your struct stat has st_blocks field..." >&4
10901 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10902 eval $hasfield
10903
10904
10905 : see if this is a sys/vfs.h system
10906 set sys/vfs.h i_sysvfs
10907 eval $inhdr
10908
10909
10910 : see if this is a sys/statfs.h system
10911 set sys/statfs.h i_sysstatfs
10912 eval $inhdr
10913
10914
10915 echo " "
10916 echo "Checking to see if your system supports struct statfs..." >&4
10917 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
10918 eval $hasstruct
10919 case "$d_statfs_s" in
10920 "$define")      echo "Yes, it does."   ;;
10921 *)              echo "No, it doesn't." ;;
10922 esac
10923
10924
10925
10926 : see if struct statfs knows about f_flags
10927 case "$d_statfs_s" in
10928 define) 
10929         echo " "
10930         echo "Checking to see if your struct statfs has f_flags field..." >&4
10931         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
10932         eval $hasfield
10933         ;;
10934 *)      val="$undef"
10935         set d_statfs_f_flags
10936         eval $setvar
10937         ;;
10938 esac
10939 case "$d_statfs_f_flags" in
10940 "$define")      echo "Yes, it does."   ;;
10941 *)              echo "No, it doesn't." ;;
10942 esac
10943
10944 : see if _ptr and _cnt from stdio act std
10945 echo " "
10946 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10947         echo "(Looks like you have stdio.h from Linux.)"
10948         case "$stdio_ptr" in
10949         '') stdio_ptr='((fp)->_IO_read_ptr)'
10950                 ptr_lval=$define
10951                 ;;
10952         *)      ptr_lval=$d_stdio_ptr_lval;;
10953         esac
10954         case "$stdio_cnt" in
10955         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10956                 cnt_lval=$undef
10957                 ;;
10958         *)      cnt_lval=$d_stdio_cnt_lval;;
10959         esac
10960         case "$stdio_base" in
10961         '') stdio_base='((fp)->_IO_read_base)';;
10962         esac
10963         case "$stdio_bufsiz" in
10964         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10965         esac
10966 else
10967         case "$stdio_ptr" in
10968         '') stdio_ptr='((fp)->_ptr)'
10969                 ptr_lval=$define
10970                 ;;
10971         *)      ptr_lval=$d_stdio_ptr_lval;;
10972         esac
10973         case "$stdio_cnt" in
10974         '') stdio_cnt='((fp)->_cnt)'
10975                 cnt_lval=$define
10976                 ;;
10977         *)      cnt_lval=$d_stdio_cnt_lval;;
10978         esac
10979         case "$stdio_base" in
10980         '') stdio_base='((fp)->_base)';;
10981         esac
10982         case "$stdio_bufsiz" in
10983         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10984         esac
10985 fi
10986 : test whether _ptr and _cnt really work
10987 echo "Checking how std your stdio is..." >&4
10988 $cat >try.c <<EOP
10989 #include <stdio.h>
10990 #define FILE_ptr(fp)    $stdio_ptr
10991 #define FILE_cnt(fp)    $stdio_cnt
10992 int main() {
10993         FILE *fp = fopen("try.c", "r");
10994         char c = getc(fp);
10995         if (
10996                 18 <= FILE_cnt(fp) &&
10997                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10998         )
10999                 exit(0);
11000         exit(1);
11001 }
11002 EOP
11003 val="$undef"
11004 set try
11005 if eval $compile; then
11006         if ./try; then
11007                 echo "Your stdio acts pretty std."
11008                 val="$define"
11009         else
11010                 echo "Your stdio isn't very std."
11011         fi
11012 else
11013         echo "Your stdio doesn't appear very std."
11014 fi
11015 $rm -f try.c try
11016 set d_stdstdio
11017 eval $setvar
11018
11019 : Can _ptr be used as an lvalue?
11020 case "$d_stdstdio$ptr_lval" in
11021 $define$define) val=$define ;;
11022 *) val=$undef ;;
11023 esac
11024 set d_stdio_ptr_lval
11025 eval $setvar
11026
11027 : Can _cnt be used as an lvalue?
11028 case "$d_stdstdio$cnt_lval" in
11029 $define$define) val=$define ;;
11030 *) val=$undef ;;
11031 esac
11032 set d_stdio_cnt_lval
11033 eval $setvar
11034
11035 : see if _base is also standard
11036 val="$undef"
11037 case "$d_stdstdio" in
11038 $define)
11039         $cat >try.c <<EOP
11040 #include <stdio.h>
11041 #define FILE_base(fp)   $stdio_base
11042 #define FILE_bufsiz(fp) $stdio_bufsiz
11043 int main() {
11044         FILE *fp = fopen("try.c", "r");
11045         char c = getc(fp);
11046         if (
11047                 19 <= FILE_bufsiz(fp) &&
11048                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11049         )
11050                 exit(0);
11051         exit(1);
11052 }
11053 EOP
11054         set try
11055         if eval $compile; then
11056                 if ./try; then
11057                         echo "And its _base field acts std."
11058                         val="$define"
11059                 else
11060                         echo "But its _base field isn't std."
11061                 fi
11062         else
11063                 echo "However, it seems to be lacking the _base field."
11064         fi
11065         $rm -f try.c try
11066         ;;
11067 esac
11068 set d_stdiobase
11069 eval $setvar
11070
11071 $cat >&4 <<EOM
11072 Checking how to access stdio streams by file descriptor number...
11073 EOM
11074 case "$stdio_stream_array" in
11075 '')     $cat >try.c <<EOCP
11076 #include <stdio.h>
11077 int main() {
11078   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11079     printf("yes\n");
11080 }
11081 EOCP
11082         for s in _iob __iob __sF
11083         do
11084                 set try -DSTDIO_STREAM_ARRAY=$s
11085                 if eval $compile; then
11086                         case "`./try$exe_ext`" in
11087                         yes)    stdio_stream_array=$s; break ;;
11088                         esac
11089                 fi
11090         done
11091         $rm -f try.* try$exe_ext
11092 esac
11093 case "$stdio_stream_array" in
11094 '')     $cat >&4 <<EOM
11095 I can't figure out how to access stdio streams by file descriptor number.
11096 EOM
11097         d_stdio_stream_array="$undef"
11098         ;;
11099 *)      $cat >&4 <<EOM
11100 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11101 EOM
11102         d_stdio_stream_array="$define"
11103         ;;
11104 esac
11105
11106 : see if strcoll exists
11107 set strcoll d_strcoll
11108 eval $inlibc
11109
11110 : check for structure copying
11111 echo " "
11112 echo "Checking to see if your C compiler can copy structs..." >&4
11113 $cat >try.c <<'EOCP'
11114 int main()
11115 {
11116         struct blurfl {
11117                 int dyick;
11118         } foo, bar;
11119
11120         foo = bar;
11121 }
11122 EOCP
11123 if $cc -c try.c >/dev/null 2>&1 ; then
11124         val="$define"
11125         echo "Yup, it can."
11126 else
11127         val="$undef"
11128         echo "Nope, it can't."
11129 fi
11130 set d_strctcpy
11131 eval $setvar
11132 $rm -f try.*
11133
11134 : see if strerror and/or sys_errlist[] exist
11135 echo " "
11136 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11137     if set strerror val -f d_strerror; eval $csym; $val; then
11138                 echo 'strerror() found.' >&4
11139                 d_strerror="$define"
11140                 d_strerrm='strerror(e)'
11141                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11142                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11143                         d_syserrlst="$define"
11144                 else
11145                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11146                         d_syserrlst="$undef"
11147                 fi
11148     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11149                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11150                 echo 'strerror() found in string header.' >&4
11151                 d_strerror="$define"
11152                 d_strerrm='strerror(e)'
11153                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11154                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11155                                 d_syserrlst="$define"
11156                 else
11157                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11158                         d_syserrlst="$undef"
11159                 fi
11160     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11161                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11162                 d_strerror="$undef"
11163                 d_syserrlst="$define"
11164                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11165     else
11166                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11167                 d_strerror="$undef"
11168                 d_syserrlst="$undef"
11169                 d_strerrm='"unknown"'
11170     fi
11171 fi
11172
11173 : see if strtod exists
11174 set strtod d_strtod
11175 eval $inlibc
11176
11177 : see if strtol exists
11178 set strtol d_strtol
11179 eval $inlibc
11180
11181 : see if strtold exists
11182 set strtold d_strtold
11183 eval $inlibc
11184
11185 : see if strtoll exists
11186 set strtoll d_strtoll
11187 eval $inlibc
11188
11189 : see if strtoul exists
11190 set strtoul d_strtoul
11191 eval $inlibc
11192
11193 : see if strtoull exists
11194 set strtoull d_strtoull
11195 eval $inlibc
11196
11197 : see if strtouq exists
11198 set strtouq d_strtouq
11199 eval $inlibc
11200
11201 : see if strxfrm exists
11202 set strxfrm d_strxfrm
11203 eval $inlibc
11204
11205 : see if symlink exists
11206 set symlink d_symlink
11207 eval $inlibc
11208
11209 : see if syscall exists
11210 set syscall d_syscall
11211 eval $inlibc
11212
11213 : see if sysconf exists
11214 set sysconf d_sysconf
11215 eval $inlibc
11216
11217 : see if system exists
11218 set system d_system
11219 eval $inlibc
11220
11221 : see if tcgetpgrp exists
11222 set tcgetpgrp d_tcgetpgrp
11223 eval $inlibc
11224
11225 : see if tcsetpgrp exists
11226 set tcsetpgrp d_tcsetpgrp
11227 eval $inlibc
11228
11229 : see if prototype for telldir is available
11230 echo " "
11231 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11232 eval $hasproto
11233
11234 : see if this is a sys/times.h system
11235 set sys/times.h i_systimes
11236 eval $inhdr
11237
11238 : see if times exists
11239 echo " "
11240 if set times val -f d_times; eval $csym; $val; then
11241         echo 'times() found.' >&4
11242         d_times="$define"
11243         inc=''
11244         case "$i_systimes" in
11245         "$define") inc='sys/times.h';;
11246         esac
11247         rp="What is the type returned by times() on this system?"
11248         set clock_t clocktype long stdio.h sys/types.h $inc
11249         eval $typedef_ask
11250 else
11251         echo 'times() NOT found, hope that will do.' >&4
11252         d_times="$undef"
11253         clocktype='int'
11254 fi
11255
11256 : see if truncate exists
11257 set truncate d_truncate
11258 eval $inlibc
11259
11260 : see if tzname[] exists
11261 echo " "
11262 if set tzname val -a d_tzname; eval $csym; $val; then
11263         val="$define"
11264         echo 'tzname[] found.' >&4
11265 else
11266         val="$undef"
11267         echo 'tzname[] NOT found.' >&4
11268 fi
11269 set d_tzname
11270 eval $setvar
11271
11272 : see if umask exists
11273 set umask d_umask
11274 eval $inlibc
11275
11276 : see if ustat exists
11277 set ustat d_ustat
11278 eval $inlibc
11279
11280 : backward compatibility for d_hvfork
11281 if test X$d_hvfork != X; then
11282         d_vfork="$d_hvfork"
11283         d_hvfork=''
11284 fi
11285 : see if there is a vfork
11286 val=''
11287 set vfork val
11288 eval $inlibc
11289
11290 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11291 : perl on Solaris 2.x, and probably elsewhere.
11292 case "$val" in
11293 $define)
11294         echo " "
11295         case "$usevfork" in
11296         false) dflt='n';;
11297         *) dflt='y';;
11298         esac
11299         cat <<'EOM'
11300  
11301 Perl can only use a vfork() that doesn't suffer from strict
11302 restrictions on calling functions or modifying global data in
11303 the child.  For example, glibc-2.1 contains such a vfork()
11304 that is unsuitable.  If your system provides a proper fork()
11305 call, chances are that you do NOT want perl to use vfork().
11306
11307 EOM
11308         rp="Do you still want to use vfork()?"
11309         . ./myread
11310         case "$ans" in
11311         y|Y) ;;
11312         *)
11313                 echo "Ok, we won't use vfork()."
11314                 val="$undef"
11315                 ;;
11316         esac
11317         ;;
11318 esac
11319 set d_vfork
11320 eval $setvar
11321 case "$d_vfork" in
11322 $define) usevfork='true';;
11323 *) usevfork='false';;
11324 esac
11325
11326 : see if this is an sysdir system
11327 set sys/dir.h i_sysdir
11328 eval $inhdr
11329
11330 : see if this is an sysndir system
11331 set sys/ndir.h i_sysndir
11332 eval $inhdr
11333
11334 : see if closedir exists
11335 set closedir d_closedir
11336 eval $inlibc
11337
11338 case "$d_closedir" in
11339 "$define")
11340         echo " "
11341         echo "Checking whether closedir() returns a status..." >&4
11342         cat > closedir.c <<EOM
11343 #$i_dirent I_DIRENT             /**/
11344 #$i_sysdir I_SYS_DIR            /**/
11345 #$i_sysndir I_SYS_NDIR          /**/
11346 #$i_systypes I_SYS_TYPES        /**/
11347
11348 #if defined(I_SYS_TYPES)
11349 #include <sys/types.h>
11350 #endif
11351 #if defined(I_DIRENT)
11352 #include <dirent.h>
11353 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11354 #include <sys/dir.h>
11355 #endif
11356 #else
11357 #ifdef I_SYS_NDIR
11358 #include <sys/ndir.h>
11359 #else
11360 #ifdef I_SYS_DIR
11361 #ifdef hp9000s500
11362 #include <ndir.h>       /* may be wrong in the future */
11363 #else
11364 #include <sys/dir.h>
11365 #endif
11366 #endif
11367 #endif
11368 #endif 
11369 int main() { return closedir(opendir(".")); }
11370 EOM
11371         set closedir
11372         if eval $compile_ok; then
11373                 if ./closedir > /dev/null 2>&1 ; then
11374                         echo "Yes, it does."
11375                         val="$undef"
11376                 else
11377                         echo "No, it doesn't."
11378                         val="$define"
11379                 fi
11380         else
11381                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11382                 val="$define"
11383         fi
11384         ;;
11385 *)
11386         val="$undef";
11387         ;;
11388 esac
11389 set d_void_closedir
11390 eval $setvar
11391 $rm -f closedir*
11392 : check for volatile keyword
11393 echo " "
11394 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11395 $cat >try.c <<'EOCP'
11396 int main()
11397 {
11398         typedef struct _goo_struct goo_struct;
11399         goo_struct * volatile goo = ((goo_struct *)0);
11400         struct _goo_struct {
11401                 long long_int;
11402                 int reg_int;
11403                 char char_var;
11404         };
11405         typedef unsigned short foo_t;
11406         char *volatile foo;
11407         volatile int bar;
11408         volatile foo_t blech;
11409         foo = foo;
11410 }
11411 EOCP
11412 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11413         val="$define"
11414         echo "Yup, it does."
11415 else
11416         val="$undef"
11417         echo "Nope, it doesn't."
11418 fi
11419 set d_volatile
11420 eval $setvar
11421 $rm -f try.*
11422
11423 : see if there is a wait4
11424 set wait4 d_wait4
11425 eval $inlibc
11426
11427 : see if waitpid exists
11428 set waitpid d_waitpid
11429 eval $inlibc
11430
11431 : see if wcstombs exists
11432 set wcstombs d_wcstombs
11433 eval $inlibc
11434
11435 : see if wctomb exists
11436 set wctomb d_wctomb
11437 eval $inlibc
11438
11439 : preserve RCS keywords in files with variable substitution, grrr
11440 Date='$Date'
11441 Id='$Id'
11442 Log='$Log'
11443 RCSfile='$RCSfile'
11444 Revision='$Revision'
11445
11446 case "$crosscompile" in
11447 ''|[nN]*) crosscompile="$undef" ;;
11448 esac
11449
11450 case "$osname" in
11451 next|rhapsody) multiarch="$define" ;;
11452 esac
11453 case "$multiarch" in
11454 ''|[nN]*) multiarch="$undef" ;;
11455 esac
11456
11457 : check for alignment requirements
11458 echo " "
11459 case "$crosscompile$multiarch" in
11460 *$define*)
11461         $cat <<EOM
11462 You seem to be either cross-compiling or doing a multiarchitecture build,
11463 skipping the memory alignment check.
11464
11465 EOM
11466         case "$alignbytes" in
11467         '') alignbytes=8 ;;
11468         esac
11469         ;;
11470 *)
11471         case "$alignbytes" in
11472         '') echo "Checking alignment constraints..." >&4
11473                 $cat >try.c <<'EOCP'
11474 #include <stdio.h>
11475 struct foobar {
11476         char foo;
11477         double bar;
11478 } try_algn;
11479 int main()
11480 {
11481     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11482     return(0);
11483 }
11484 EOCP
11485                 set try
11486                 if eval $compile_ok; then
11487                         dflt=`./try`
11488                 else
11489                         dflt='8'
11490                         echo "(I can't seem to compile the test program...)"
11491                 fi
11492                 ;;
11493         *) dflt="$alignbytes"
11494                 ;;
11495         esac
11496         rp="Doubles must be aligned on a how-many-byte boundary?"
11497         . ./myread
11498         alignbytes="$ans"
11499         $rm -f try.c try
11500         ;;
11501 esac
11502
11503
11504 : check for ordering of bytes in a long
11505 echo " "
11506 case "$crosscompile$multiarch" in
11507 *$define*)
11508         $cat <<EOM
11509 You seem to be either cross-compiling or doing a multiarchitecture build,
11510 skipping the byteorder check.
11511
11512 EOM
11513         byteorder='0xffff'
11514         ;;
11515 *)
11516         case "$byteorder" in
11517         '')
11518                 $cat <<'EOM'
11519 In the following, larger digits indicate more significance.  A big-endian
11520 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11521 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11522 machines may have weird orders like 3412.  A Cray will report 87654321,
11523 an Alpha will report 12345678. If the test program works the default is
11524 probably right.
11525 I'm now running the test program...
11526 EOM
11527                 $cat >try.c <<'EOCP'
11528 #include <stdio.h>
11529 int main()
11530 {
11531         int i;
11532         union {
11533                 unsigned long l;
11534                 char c[sizeof(long)];
11535         } u;
11536
11537         if (sizeof(long) > 4)
11538                 u.l = (0x08070605L << 32) | 0x04030201L;
11539         else
11540                 u.l = 0x04030201L;
11541         for (i = 0; i < sizeof(long); i++)
11542                 printf("%c", u.c[i]+'0');
11543         printf("\n");
11544         exit(0);
11545 }
11546 EOCP
11547                 xxx_prompt=y
11548                 set try
11549                 if eval $compile && ./try > /dev/null; then
11550                         dflt=`./try`
11551                         case "$dflt" in
11552                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11553                                 echo "(The test program ran ok.)"
11554                                 echo "byteorder=$dflt"
11555                                 xxx_prompt=n
11556                         ;;
11557                         ????|????????) echo "(The test program ran ok.)" ;;
11558                         *) echo "(The test program didn't run right for some reason.)" ;;
11559                         esac
11560                 else
11561                         dflt='4321'
11562                         cat <<'EOM'
11563 (I can't seem to compile the test program.  Guessing big-endian...)
11564 EOM
11565                 fi
11566                 case "$xxx_prompt" in
11567                 y)
11568                         rp="What is the order of bytes in a long?"
11569                         . ./myread
11570                         byteorder="$ans"
11571                         ;;
11572                 *)      byteorder=$dflt
11573                         ;;
11574                 esac
11575                 ;;
11576         esac
11577         $rm -f try.c try
11578         ;;
11579 esac
11580
11581
11582 : how do we catenate cpp tokens here?
11583 echo " "
11584 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11585 $cat >cpp_stuff.c <<'EOCP'
11586 #define RCAT(a,b)a/**/b
11587 #define ACAT(a,b)a ## b
11588 RCAT(Rei,ser)
11589 ACAT(Cir,cus)
11590 EOCP
11591 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11592 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11593         echo "Oh!  Smells like ANSI's been here." >&4
11594         echo "We can catify or stringify, separately or together!"
11595         cpp_stuff=42
11596 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11597         echo "Ah, yes!  The good old days!" >&4
11598         echo "However, in the good old days we don't know how to stringify and"
11599         echo "catify at the same time."
11600         cpp_stuff=1
11601 else
11602         $cat >&4 <<EOM
11603 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11604 to have to edit the values of CAT[2-5] in config.h...
11605 EOM
11606         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11607 fi
11608 $rm -f cpp_stuff.*
11609
11610 : see if this is a db.h system
11611 set db.h i_db
11612 eval $inhdr
11613
11614 case "$i_db" in
11615 $define)
11616         : Check db version.
11617         echo " "
11618         echo "Checking Berkeley DB version ..." >&4
11619         $cat >try.c <<EOCP
11620 #$d_const HASCONST
11621 #ifndef HASCONST
11622 #define const
11623 #endif
11624 #include <sys/types.h>
11625 #include <stdio.h>
11626 #include <db.h>
11627 int main()
11628 {
11629 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11630     int Major, Minor, Patch ;
11631     unsigned long Version ;
11632     (void)db_version(&Major, &Minor, &Patch) ;
11633     printf("You have Berkeley DB Version 2 or greater\n");
11634
11635     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11636                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11637     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11638                 Major, Minor, Patch) ;
11639
11640     /* check that db.h & libdb are compatible */
11641     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11642         printf("db.h and libdb are incompatible\n") ;
11643         exit(3);        
11644     }
11645
11646     printf("db.h and libdb are compatible\n") ;
11647
11648     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11649                 + DB_VERSION_PATCH ;
11650
11651     /* needs to be >= 2.3.4 */
11652     if (Version < 2003004) {
11653     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11654         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11655         exit(2);        
11656     }
11657
11658     exit(0);
11659 #else
11660 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11661     printf("You have Berkeley DB Version 1\n");
11662     exit(0);    /* DB version < 2: the coast is clear. */
11663 #else
11664     exit(1);    /* <db.h> not Berkeley DB? */
11665 #endif
11666 #endif
11667 }
11668 EOCP
11669         set try
11670         if eval $compile_ok && ./try; then
11671                 echo 'Looks OK.' >&4
11672         else
11673                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11674                 i_db=$undef
11675                 case " $libs " in
11676                 *"-ldb "*)
11677                         : Remove db from list of libraries to use
11678                         echo "Removing unusable -ldb from library list" >&4
11679                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11680                         shift
11681                         libs="$*"
11682                         echo "libs = $libs" >&4
11683                         ;;
11684                 esac
11685         fi
11686         $rm -f try.*
11687         ;;
11688 esac
11689
11690 case "$i_db" in
11691 define)
11692         : Check the return type needed for hash 
11693         echo " "
11694         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11695         $cat >try.c <<EOCP
11696 #$d_const HASCONST
11697 #ifndef HASCONST
11698 #define const
11699 #endif
11700 #include <sys/types.h>
11701 #include <db.h>
11702
11703 #ifndef DB_VERSION_MAJOR
11704 u_int32_t hash_cb (ptr, size)
11705 const void *ptr;
11706 size_t size;
11707 {
11708 }
11709 HASHINFO info;
11710 int main()
11711 {
11712         info.hash = hash_cb;
11713 }
11714 #endif
11715 EOCP
11716         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11717                 if $contains warning try.out >>/dev/null 2>&1 ; then
11718                         db_hashtype='int'
11719                 else
11720                         db_hashtype='u_int32_t'
11721                 fi
11722         else
11723                 : XXX Maybe we should just give up here.
11724                 db_hashtype=u_int32_t
11725                 $cat try.out >&4
11726                 echo "Help:  I can't seem to compile the db test program." >&4
11727                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11728         fi
11729         $rm -f try.*
11730         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11731         ;;
11732 *)      db_hashtype=u_int32_t
11733         ;;
11734 esac
11735 case "$i_db" in
11736 define)
11737         : Check the return type needed for prefix 
11738         echo " "
11739         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11740         cat >try.c <<EOCP
11741 #$d_const HASCONST
11742 #ifndef HASCONST
11743 #define const
11744 #endif
11745 #include <sys/types.h>
11746 #include <db.h>
11747
11748 #ifndef DB_VERSION_MAJOR
11749 size_t prefix_cb (key1, key2)
11750 const DBT *key1;
11751 const DBT *key2;
11752 {
11753 }
11754 BTREEINFO info;
11755 int main()
11756 {
11757         info.prefix = prefix_cb;
11758 }
11759 #endif
11760 EOCP
11761         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11762                 if $contains warning try.out >>/dev/null 2>&1 ; then
11763                         db_prefixtype='int'
11764                 else
11765                         db_prefixtype='size_t'
11766                 fi
11767         else
11768                 db_prefixtype='size_t'
11769                 : XXX Maybe we should just give up here.
11770                 $cat try.out >&4
11771                 echo "Help:  I can't seem to compile the db test program." >&4
11772                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11773         fi
11774         $rm -f try.*
11775         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11776         ;;
11777 *)      db_prefixtype='size_t'
11778         ;;
11779 esac
11780
11781 : check for void type
11782 echo " "
11783 echo "Checking to see how well your C compiler groks the void type..." >&4
11784 case "$voidflags" in
11785 '')
11786         $cat >try.c <<'EOCP'
11787 #if TRY & 1
11788 void sub() {
11789 #else
11790 sub() {
11791 #endif
11792         extern void moo();      /* function returning void */
11793         void (*goo)();          /* ptr to func returning void */
11794 #if TRY & 8
11795         void *hue;              /* generic ptr */
11796 #endif
11797 #if TRY & 2
11798         void (*foo[10])();
11799 #endif
11800
11801 #if TRY & 4
11802         if(goo == moo) {
11803                 exit(0);
11804         }
11805 #endif
11806         exit(0);
11807 }
11808 int main() { sub(); }
11809 EOCP
11810         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11811                 voidflags=$defvoidused
11812         echo "Good.  It appears to support void to the level $package wants.">&4
11813                 if $contains warning .out >/dev/null 2>&1; then
11814                         echo "However, you might get some warnings that look like this:"
11815                         $cat .out
11816                 fi
11817         else
11818 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11819                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11820                         echo "It supports 1..."
11821                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11822                                 echo "It also supports 2..."
11823                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11824                                         voidflags=7
11825                                         echo "And it supports 4 but not 8 definitely."
11826                                 else
11827                                         echo "It doesn't support 4..."
11828                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11829                                                 voidflags=11
11830                                                 echo "But it supports 8."
11831                                         else
11832                                                 voidflags=3
11833                                                 echo "Neither does it support 8."
11834                                         fi
11835                                 fi
11836                         else
11837                                 echo "It does not support 2..."
11838                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11839                                         voidflags=13
11840                                         echo "But it supports 4 and 8."
11841                                 else
11842                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11843                                                 voidflags=5
11844                                                 echo "And it supports 4 but has not heard about 8."
11845                                         else
11846                                                 echo "However it supports 8 but not 4."
11847                                         fi
11848                                 fi
11849                         fi
11850                 else
11851                         echo "There is no support at all for void."
11852                         voidflags=0
11853                 fi
11854         fi
11855 esac
11856 case "$voidflags" in
11857 "$defvoidused") ;;
11858 *)      $cat >&4 <<'EOM'
11859   Support flag bits are:
11860     1: basic void declarations.
11861     2: arrays of pointers to functions returning void.
11862     4: operations between pointers to and addresses of void functions.
11863     8: generic void pointers.
11864 EOM
11865         dflt="$voidflags";
11866         rp="Your void support flags add up to what?"
11867         . ./myread
11868         voidflags="$ans"
11869         ;;
11870 esac
11871 $rm -f try.* .out
11872
11873
11874 : How can we generate normalized random numbers ?
11875 echo " "
11876 echo "Looking for a random number function..." >&4
11877 case "$randfunc" in
11878 '')
11879         if set drand48 val -f; eval $csym; $val; then
11880                 dflt="drand48"
11881                 echo "Good, found drand48()." >&4
11882         elif set random val -f; eval $csym; $val; then
11883                 dflt="random"
11884                 echo "OK, found random()." >&4
11885         else
11886                 dflt="rand"
11887                 echo "Yick, looks like I have to use rand()." >&4
11888         fi
11889         echo " "
11890         ;;
11891 *)
11892         dflt="$randfunc"
11893         ;;
11894 esac
11895 cont=true
11896
11897 case "$ccflags" in
11898 *-Dmy_rand=*|*-Dmy_srand=*)
11899         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11900         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11901         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11902         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11903         ;;
11904 esac
11905
11906 while $test "$cont"; do
11907         rp="Use which function to generate random numbers?"
11908         . ./myread
11909         if $test "$ans" = "$dflt"; then
11910                 : null
11911         else
11912                 randbits=''
11913         fi
11914         randfunc="$ans"
11915         if set $ans val -f; eval $csym; $val; then
11916                 cont=''
11917         else
11918                 dflt=y
11919                 rp="I cannot find function $ans. Use that name anyway?"
11920                 . ./myread
11921                 dflt=rand
11922                 case "$ans" in
11923                         [yY]*) cont='';;
11924                 esac
11925         fi
11926         case "$cont" in
11927         '')
11928                 case "$randfunc" in
11929                 drand48)
11930                         drand01="drand48()"
11931                         seedfunc="srand48"
11932                         randbits=48
11933                         randseedtype=long
11934                         ;;
11935                 rand|random)
11936                         case "$randbits" in
11937                         '')
11938 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11939                                 $cat >try.c <<EOCP
11940 #$i_unistd I_UNISTD
11941 #$i_stdlib I_STDLIB
11942 #include <stdio.h>
11943 #ifdef I_UNISTD
11944 #  include <unistd.h>
11945 #endif
11946 #ifdef I_STDLIB
11947 #  include <stdlib.h>
11948 #endif
11949 int main()
11950 {
11951         register int i;
11952         register unsigned long tmp;
11953         register unsigned long max = 0L;
11954
11955         for (i = 1000; i; i--) {
11956                 tmp = (unsigned long) $randfunc();
11957                 if (tmp > max) max = tmp;
11958         }
11959         for (i = 0; max; i++)
11960                 max /= 2;
11961         printf("%d\n",i);
11962 }
11963 EOCP
11964                                 set try
11965                                 if eval $compile_ok; then
11966                                         dflt=`try`
11967                                 else
11968                                         dflt='?'
11969                                         echo "(I can't seem to compile the test program...)"
11970                                 fi
11971                                 ;;
11972                         *)
11973                                 dflt="$randbits"
11974                                 ;;
11975                         esac
11976                         rp="How many bits does your $randfunc() function produce?"
11977                         . ./myread
11978                         randbits="$ans"
11979                         $rm -f try.c try
11980                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11981                         seedfunc="s$randfunc"
11982                         randseedtype=unsigned
11983                         ;;
11984                 *)
11985                         dflt="31"
11986                         rp="How many bits does your $randfunc() function produce?"
11987                         . ./myread
11988                         randbits="$ans"
11989                         seedfunc="s$randfunc"
11990                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11991                         if set $seedfunc val -f; eval $csym; $val; then
11992                                 echo "(Using $seedfunc() to seed random generator)"
11993                         else
11994                                 echo "(Warning: no $seedfunc() to seed random generator)"
11995                                 seedfunc=rand
11996                         fi
11997                         randseedtype=unsigned
11998                         ;;
11999                 esac
12000                 ;;
12001         esac
12002 done
12003
12004 echo " "
12005 echo "Determining whether or not we are on an EBCDIC system..." >&4
12006 $cat >tebcdic.c <<'EOM'
12007 int main()
12008 {
12009   if ('M'==0xd4) return 0;
12010   return 1;
12011 }
12012 EOM
12013
12014 val=$undef
12015 set tebcdic
12016 if eval $compile_ok; then
12017         if ./tebcdic; then
12018                 echo "You have EBCDIC." >&4
12019                 val="$define"
12020         else
12021                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12022         fi
12023 else
12024         echo "I'm unable to compile the test program." >&4
12025         echo "I'll assume ASCII or some ISO Latin." >&4
12026 fi
12027 $rm -f tebcdic.c tebcdic
12028 set ebcdic
12029 eval $setvar
12030
12031 echo " "
12032 $cat >&4 <<EOM
12033 Checking how to flush all pending stdio output...
12034 EOM
12035 # I only know how to find the first 32 possibly open files on SunOS.
12036 # See also hints/sunos_4_1.sh and util.c  --AD
12037 case "$osname" in
12038 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12039 esac
12040 $cat >>try.c <<EOCP
12041 #include <stdio.h>
12042 #$i_unistd I_UNISTD
12043 #ifdef I_UNISTD
12044 # include <unistd.h>
12045 #endif
12046 #$d_sysconf HAS_SYSCONF
12047 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12048 #ifdef HAS_STDIO_STREAM_ARRAY
12049 # define STDIO_STREAM_ARRAY $stdio_stream_array
12050 #endif
12051 int main() {
12052   FILE* p = fopen("try.out", "w");
12053 #ifdef TRY_FPUTC
12054   fputc('x', p);
12055 #else
12056 # ifdef TRY_FPRINTF
12057   fprintf(p, "x");
12058 # endif
12059 #endif
12060 #ifdef TRY_FFLUSH_NULL
12061   fflush(NULL);
12062 #endif
12063 #ifdef TRY_FFLUSH_ALL
12064   {
12065     long open_max = -1;
12066 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12067     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12068 # else
12069 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12070     open_max = sysconf(_SC_OPEN_MAX);
12071 #  else
12072 #   ifdef FOPEN_MAX
12073     open_max = FOPEN_MAX;
12074 #   else
12075 #    ifdef OPEN_MAX
12076     open_max = OPEN_MAX;
12077 #    else
12078 #     ifdef _NFILE
12079     open_max = _NFILE;
12080 #     endif
12081 #    endif
12082 #   endif
12083 #  endif
12084 # endif 
12085 # ifdef HAS_STDIO_STREAM_ARRAY
12086     if (open_max > 0) {
12087       long i;
12088       for (i = 0; i < open_max; i++)
12089             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12090                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12091                 STDIO_STREAM_ARRAY[i]._flag)
12092                 fflush(&STDIO_STREAM_ARRAY[i]);
12093     }   
12094   }
12095 # endif
12096 #endif
12097   _exit(42);
12098 }
12099 EOCP
12100 : first we have to find out how _not_ to flush
12101 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12102     output=''
12103     set try -DTRY_FPUTC
12104     if eval $compile; then
12105             $rm -f try.out
12106             ./try$exe_ext 2>/dev/null
12107             if $test ! -s try.out -a "X$?" = X42; then
12108                 output=-DTRY_FPUTC
12109             fi
12110     fi
12111     case "$output" in
12112     '')
12113             set try -DTRY_FPRINTF
12114             $rm -f try.out
12115             if eval $compile; then
12116                     $rm -f try.out
12117                     ./try$exe_ext 2>/dev/null
12118                     if $test ! -s try.out -a "X$?" = X42; then
12119                         output=-DTRY_FPRINTF
12120                     fi
12121             fi
12122         ;;
12123     esac
12124 fi
12125 : check for fflush NULL behaviour
12126 case "$fflushNULL" in
12127 '')     set try -DTRY_FFLUSH_NULL $output
12128         if eval $compile; then
12129                 $rm -f try.out
12130                 ./try$exe_ext 2>/dev/null
12131                 code="$?"
12132                 if $test -s try.out -a "X$code" = X42; then
12133                         fflushNULL="`$cat try.out`"
12134                 else
12135                         if $test "X$code" != X42; then
12136                                 $cat >&4 <<EOM
12137 (If this test failed, don't worry, we'll try another method shortly.)
12138 EOM
12139                         fi
12140                 fi
12141         fi
12142         $rm -f core try.core core.try.*
12143         case "$fflushNULL" in
12144         x)      $cat >&4 <<EOM
12145 Your fflush(NULL) works okay.
12146 EOM
12147                 fflushNULL="$define"
12148                 ;;
12149         '')     $cat >&4 <<EOM
12150 Your fflush(NULL) isn't working (contrary to ANSI C).
12151 EOM
12152                 fflushNULL="$undef"
12153                 ;;
12154         *)      $cat >&4 <<EOM
12155 Cannot figure out whether your fflush(NULL) works or not.
12156 I'm assuming it doesn't (contrary to ANSI C).
12157 EOM
12158                 fflushNULL="$undef"
12159                 ;;
12160         esac
12161         ;;
12162 $define|true|[yY]*)
12163         fflushNULL="$define"
12164         ;;
12165 *)
12166         fflushNULL="$undef"
12167         ;;
12168 esac
12169 : check explicit looping only if NULL did not work
12170 case "$fflushNULL" in
12171 "$undef")
12172         : check for fflush all behaviour
12173         case "$fflushall" in
12174         '')     set try -DTRY_FFLUSH_ALL $output
12175                 if eval $compile; then
12176                         $cat >&4 <<EOM
12177 (Now testing the other method--but note that also this may fail.)
12178 EOM
12179                         $rm -f try.out
12180                         ./try$exe_ext 2>/dev/null
12181                         if $test -s try.out -a "X$?" = X42; then
12182                                 fflushall="`$cat try.out`"
12183                         fi
12184                 fi
12185                 $rm -f core try.core core.try.*
12186                 case "$fflushall" in
12187                 x)      $cat >&4 <<EOM
12188 Whew. Flushing explicitly all the stdio streams works.
12189 EOM
12190                         fflushall="$define"
12191                         ;;
12192                 '')     $cat >&4 <<EOM
12193 Sigh. Flushing explicitly all the stdio streams doesn't work.
12194 EOM
12195                         fflushall="$undef"
12196                         ;;
12197                 *)      $cat >&4 <<EOM
12198 Cannot figure out whether flushing stdio streams explicitly works or not.
12199 I'm assuming it doesn't.
12200 EOM
12201                         fflushall="$undef"
12202                         ;;
12203                 esac
12204                 ;;
12205         "$define"|true|[yY]*)
12206                 fflushall="$define"
12207                 ;;
12208         *)
12209                 fflushall="$undef"
12210                 ;;
12211         esac
12212         ;;
12213 *)      fflushall="$undef"      
12214         ;;
12215 esac
12216 case "$fflushNULL$fflushall" in
12217 undefundef)
12218         $cat <<EOM
12219 I cannot figure out how to flush pending stdio output.
12220 EOM
12221         ;;
12222 esac
12223 $rm -f try.* try$exe_ext
12224
12225 : Store the full pathname to the ar program for use in the C program
12226 : Respect a hint or command line value for full_ar.
12227 case "$full_ar" in
12228 '') full_ar=$ar ;;
12229 esac
12230
12231 : Store the full pathname to the sed program for use in the C program
12232 full_sed=$sed
12233
12234 : see what type gids are declared as in the kernel
12235 echo " "
12236 echo "Looking for the type for group ids returned by getgid()."
12237 set gid_t gidtype xxx stdio.h sys/types.h
12238 eval $typedef
12239 case "$gidtype" in
12240 xxx)
12241         xxx=`./findhdr sys/user.h`
12242         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12243         case $1 in
12244         unsigned) dflt="$1 $2" ;;
12245         *) dflt="$1" ;;
12246         esac
12247         ;;
12248 *) dflt="$gidtype";;
12249 esac
12250 case "$gidtype" in
12251 gid_t) echo "gid_t found." ;;
12252 *)      rp="What is the type for group ids returned by getgid()?"
12253         . ./myread
12254         gidtype="$ans"
12255         ;;
12256 esac
12257
12258 echo " "
12259 case "$gidtype" in
12260 *_t) zzz="$gidtype"     ;;
12261 *)   zzz="gid"          ;;
12262 esac
12263 echo "Checking the size of $zzz..." >&4 
12264 cat > try.c <<EOCP
12265 #include <sys/types.h>
12266 #include <stdio.h>
12267 int main() {
12268     printf("%d\n", (int)sizeof($gidtype));
12269     exit(0);
12270 }
12271 EOCP
12272 set try
12273 if eval $compile_ok; then
12274         yyy=`./try`
12275         case "$yyy" in
12276         '')     gidsize=4
12277                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12278                 ;;
12279         *)      gidsize=$yyy
12280                 echo "Your $zzz size is $gidsize bytes."
12281                 ;;
12282         esac
12283 else
12284         gidsize=4
12285         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12286 fi
12287
12288
12289 echo " "
12290 case "$gidtype" in
12291 *_t) zzz="$gidtype"     ;;
12292 *)   zzz="gid"          ;;
12293 esac
12294 echo "Checking the sign of $zzz..." >&4 
12295 cat > try.c <<EOCP
12296 #include <sys/types.h>
12297 #include <stdio.h>
12298 int main() {
12299         $gidtype foo = -1;
12300         if (foo < 0)
12301                 printf("-1\n");
12302         else
12303                 printf("1\n");
12304 }
12305 EOCP
12306 set try
12307 if eval $compile; then
12308         yyy=`./try`
12309         case "$yyy" in
12310         '')     gidsign=1
12311                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12312                 ;;
12313         *)      gidsign=$yyy
12314                 case "$gidsign" in
12315                  1) echo "Your $zzz is unsigned." ;;
12316                 -1) echo "Your $zzz is signed."   ;;
12317                 esac
12318                 ;;
12319         esac
12320 else
12321         gidsign=1
12322         echo "(I can't compile the test program--guessing unsigned.)" >&4
12323 fi
12324
12325
12326 echo " "
12327
12328 if $test X"$quadtype" != X; then
12329
12330 echo "Checking how to print 64-bit integers..." >&4
12331
12332 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12333         $cat >try.c <<'EOCP'
12334 #include <sys/types.h>
12335 #include <stdio.h>
12336 int main() {
12337   int q = 12345678901;
12338   printf("%ld\n", q);
12339 }
12340 EOCP
12341         set try
12342         if eval $compile; then
12343                 yyy=`./try$exe_ext`
12344                 case "$yyy" in
12345                 12345678901)
12346                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12347                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12348                         echo "We will use %d."
12349                         ;;
12350                 esac
12351         fi
12352 fi
12353
12354 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12355         $cat >try.c <<'EOCP'
12356 #include <sys/types.h>
12357 #include <stdio.h>
12358 int main() {
12359   long q = 12345678901;
12360   printf("%ld\n", q);
12361 }
12362 EOCP
12363         set try
12364         if eval $compile; then
12365                 yyy=`./try$exe_ext`
12366                 case "$yyy" in
12367                 12345678901)
12368                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12369                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12370                         echo "We will use %ld."
12371                         ;;
12372                 esac
12373         fi
12374 fi
12375
12376 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12377         $cat >try.c <<'EOCP'
12378 #include <sys/types.h>
12379 #include <inttypes.h>
12380 #include <stdio.h>
12381 int main() {
12382   int64_t q = 12345678901;
12383   printf("%" PRId64 "\n", q);
12384 }
12385 EOCP
12386         set try
12387         if eval $compile; then
12388                 yyy=`./try$exe_ext`
12389                 case "$yyy" in
12390                 12345678901)
12391                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12392                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12393                         echo "We will use the C9X style."
12394                         ;;
12395                 esac
12396         fi
12397 fi
12398
12399 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12400         $cat >try.c <<'EOCP'
12401 #include <sys/types.h>
12402 #include <stdio.h>
12403 int main() {
12404   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12405   printf("%lld\n", q);
12406 }
12407 EOCP
12408         set try
12409         if eval $compile; then
12410                 yyy=`./try$exe_ext`
12411                 case "$yyy" in
12412                 12345678901)
12413                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12414                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12415                         echo "We will use the %lld style."
12416                         ;;
12417                 esac
12418         fi
12419 fi
12420
12421 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12422         $cat >try.c <<EOCP
12423 #include <sys/types.h>
12424 #include <stdio.h>
12425 int main() {
12426   $quadtype q = 12345678901;
12427   printf("%Ld\n", q);
12428 }
12429 EOCP
12430         set try
12431         if eval $compile; then
12432                 yyy=`./try$exe_ext`
12433                 case "$yyy" in
12434                 12345678901)
12435                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12436                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12437                         echo "We will use %Ld."
12438                         ;;
12439                 esac
12440         fi
12441 fi
12442
12443 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12444         $cat >try.c <<EOCP
12445 #include <sys/types.h>
12446 #include <stdio.h>
12447 int main() {
12448   $quadtype q = 12345678901;
12449   printf("%qd\n", q);
12450 }
12451 EOCP
12452         set try
12453         if eval $compile; then
12454                 yyy=`./try$exe_ext`
12455                 case "$yyy" in
12456                 12345678901)
12457                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12458                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12459                         echo "We will use %qd."
12460                         ;;
12461                 esac
12462         fi
12463 fi
12464
12465 if $test X"$sPRId64" = X; then
12466         echo "Cannot figure out how to print 64-bit integers." >&4
12467 fi
12468
12469 $rm -f try try.*
12470
12471 fi
12472
12473 case "$sPRId64" in
12474 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12475         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12476         ;;
12477 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12478         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12479         ;;
12480 esac
12481
12482
12483 echo " "
12484 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12485
12486 if $test X"$ivsize" = X8; then
12487         ivdformat="$sPRId64"
12488         uvuformat="$sPRIu64"
12489         uvoformat="$sPRIo64"
12490         uvxformat="$sPRIx64"
12491 else
12492         if $test X"$ivsize" = X"$longsize"; then
12493                 ivdformat='"ld"'
12494                 uvuformat='"lu"'
12495                 uvoformat='"lo"'
12496                 uvxformat='"lx"'
12497         else
12498                 if $test X"$ivsize" = X"$intsize"; then
12499                         ivdformat='"d"'
12500                         uvuformat='"u"'
12501                         uvoformat='"o"'
12502                         uvxformat='"x"'
12503                 else
12504                         : far out
12505                         if $test X"$ivsize" = X"$shortsize"; then
12506                                 ivdformat='"hd"'
12507                                 uvuformat='"hu"'
12508                                 uvoformat='"ho"'
12509                                 uvxformat='"hx"'
12510                         fi
12511                 fi
12512         fi
12513 fi
12514
12515 case "$ivdformat" in
12516 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12517     exit 1
12518     ;;
12519 esac
12520
12521
12522 echo " "
12523 $echo "Checking the format string to be used for gids..." >&4
12524
12525 case "$gidsign" in
12526 -1)     if $test X"$gidsize" = X"$ivsize"; then
12527                 gidformat="$ivdformat"
12528         else
12529                 if $test X"$gidsize" = X"$longsize"; then
12530                         gidformat='"ld"'
12531                 else
12532                         if $test X"$gidsize" = X"$intsize"; then
12533                                 gidformat='"d"'
12534                         else
12535                                 if $test X"$gidsize" = X"$shortsize"; then
12536                                         gidformat='"hd"'
12537                                 fi
12538                         fi
12539                 fi
12540         fi
12541         ;;
12542 *)      if $test X"$gidsize" = X"$uvsize"; then
12543                 gidformat="$uvuformat"
12544         else
12545                 if $test X"$gidsize" = X"$longsize"; then
12546                         gidformat='"lu"'
12547                 else
12548                         if $test X"$gidsize" = X"$intsize"; then
12549                                 gidformat='"u"'
12550                         else
12551                                 if $test X"$gidsize" = X"$shortsize"; then
12552                                         gidformat='"hu"'
12553                                 fi
12554                         fi
12555                 fi
12556         fi
12557         ;;
12558 esac
12559
12560 : see if getgroups exists
12561 set getgroups d_getgrps
12562 eval $inlibc
12563
12564 : see if setgroups exists
12565 set setgroups d_setgrps
12566 eval $inlibc
12567
12568
12569 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12570 echo " "
12571 case "$d_getgrps$d_setgrps" in
12572 *define*)
12573         case "$groupstype" in
12574         '') dflt="$gidtype" ;;
12575         *)  dflt="$groupstype" ;;
12576         esac
12577         $cat <<EOM
12578 What type of pointer is the second argument to getgroups() and setgroups()?
12579 Usually this is the same as group ids, $gidtype, but not always.
12580
12581 EOM
12582         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12583         . ./myread
12584         groupstype="$ans"
12585         ;;
12586 *)  groupstype="$gidtype";;
12587 esac
12588
12589 echo " "
12590 echo "Checking if your $make program sets \$(MAKE)..." >&4
12591 case "$make_set_make" in
12592 '')
12593         $sed 's/^X //' > testmake.mak << 'EOF'
12594 Xall:
12595 X       @echo 'maketemp="$(MAKE)"'
12596 EOF
12597         case "`$make -f testmake.mak 2>/dev/null`" in
12598         *maketemp=*) make_set_make='#' ;;
12599         *)      make_set_make="MAKE=$make" ;;
12600         esac
12601         $rm -f testmake.mak
12602         ;;
12603 esac
12604 case "$make_set_make" in
12605 '#') echo "Yup, it does.";;
12606 *) echo "Nope, it doesn't.";;
12607 esac
12608
12609 : see what type is used for mode_t
12610 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12611 set mode_t modetype int stdio.h sys/types.h
12612 eval $typedef_ask
12613
12614 : define a fucntion to check prototypes
12615 $cat > protochk <<EOSH
12616 $startsh
12617 cc="$cc"
12618 optimize="$optimize"
12619 ccflags="$ccflags"
12620 prototype="$prototype"
12621 define="$define"
12622 rm=$rm
12623 EOSH
12624
12625 $cat >> protochk <<'EOSH'
12626
12627 $rm -f try.c
12628 foo="$1"
12629 shift
12630 while test $# -ge 2; do
12631         case "$1" in
12632                 $define) echo "#include <$2>" >> try.c ;;
12633                 literal) echo "$2" >> try.c ;;
12634         esac
12635     shift 2
12636 done
12637 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12638 cat >> try.c <<'EOCP'
12639 #ifdef CAN_PROTOTYPE
12640 #define _(args) args
12641 #else
12642 #define _(args) ()
12643 #endif
12644 EOCP
12645 echo "$foo" >> try.c
12646 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12647 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12648 status=$?
12649 $rm -f try.[co]
12650 exit $status
12651 EOSH
12652 chmod +x protochk
12653 $eunicefix protochk
12654
12655 : see what type is used for size_t
12656 rp="What is the type used for the length parameter for string functions?"
12657 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12658 eval $typedef_ask
12659
12660 : check for type of arguments to gethostbyaddr. 
12661 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12662         case "$d_gethbyaddr" in
12663         $define)
12664                 $cat <<EOM
12665
12666 Checking to see what type of arguments are accepted by gethostbyaddr().
12667 EOM
12668                 hdrs="$define sys/types.h
12669                         $d_socket sys/socket.h 
12670                         $i_niin netinet/in.h 
12671                         $i_netdb netdb.h
12672                         $i_unistd unistd.h"
12673                 : The first arg can 'char *' or 'void *'
12674                 : The second arg is some of integral type
12675                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12676                         for yyy in size_t long int; do
12677                                 case "$netdb_host_type" in
12678                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12679                                         if ./protochk "$try" $hdrs; then
12680                                                 echo "Your system accepts $xxx for the first arg."
12681                                                 echo "...and $yyy for the second arg."
12682                                                 netdb_host_type="$xxx"
12683                                                 netdb_hlen_type="$yyy"
12684                                         fi
12685                                         ;;
12686                                 esac
12687                         done
12688                 done
12689                 : In case none of those worked, prompt the user.
12690                 case "$netdb_host_type" in
12691                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12692                         dflt='char *'
12693                         . ./myread
12694                         netdb_host_type=$ans
12695                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12696                         dflt="$sizetype"
12697                         . ./myread
12698                         netdb_hlen_type=$ans
12699                         ;;
12700                 esac
12701                 ;;
12702         *)      : no gethostbyaddr, so pick harmless defaults
12703                 netdb_host_type='char *'
12704                 netdb_hlen_type="$sizetype"
12705                 ;;
12706         esac
12707         # Remove the "const" if needed. -- but then we'll have a 
12708         # prototype clash!
12709         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12710 fi
12711
12712 : check for type of argument to gethostbyname. 
12713 if test "X$netdb_name_type" = X ; then
12714         case "$d_gethbyname" in
12715         $define)
12716                 $cat <<EOM
12717
12718 Checking to see what type of argument is accepted by gethostbyname().
12719 EOM
12720                 hdrs="$define sys/types.h
12721                         $d_socket sys/socket.h 
12722                         $i_niin netinet/in.h 
12723                         $i_netdb netdb.h
12724                         $i_unistd unistd.h"
12725                 for xxx in "const char *" "char *"; do
12726                         case "$netdb_name_type" in
12727                         '')     try="extern struct hostent *gethostbyname($xxx);"
12728                                 if ./protochk "$try" $hdrs; then
12729                                         echo "Your system accepts $xxx."
12730                                         netdb_name_type="$xxx"
12731                                 fi
12732                                 ;;
12733                         esac
12734                 done
12735                 : In case none of those worked, prompt the user.
12736                 case "$netdb_name_type" in
12737                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12738                         dflt='char *'
12739                         . ./myread
12740                         netdb_name_type=$ans
12741                         ;;
12742                 esac
12743                 ;;
12744         *)      : no gethostbyname, so pick harmless default
12745                 netdb_name_type='char *'
12746                 ;;
12747         esac
12748 fi
12749
12750 : check for type of 1st argument to getnetbyaddr. 
12751 if test "X$netdb_net_type" = X ; then
12752         case "$d_getnbyaddr" in
12753         $define)
12754                 $cat <<EOM
12755
12756 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12757 EOM
12758                 hdrs="$define sys/types.h
12759                         $d_socket sys/socket.h 
12760                         $i_niin netinet/in.h 
12761                         $i_netdb netdb.h
12762                         $i_unistd unistd.h"
12763                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12764                         case "$netdb_net_type" in
12765                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12766                                 if ./protochk "$try" $hdrs; then
12767                                         echo "Your system accepts $xxx."
12768                                         netdb_net_type="$xxx"
12769                                 fi
12770                                 ;;
12771                         esac
12772                 done
12773                 : In case none of those worked, prompt the user.
12774                 case "$netdb_net_type" in
12775                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12776                         dflt='long'
12777                         . ./myread
12778                         netdb_net_type=$ans
12779                         ;;
12780                 esac
12781                 ;;
12782         *)      : no getnetbyaddr, so pick harmless default
12783                 netdb_net_type='long'
12784                 ;;
12785         esac
12786 fi
12787 : locate the preferred pager for this system
12788 case "$pager" in
12789 '')
12790         dflt=''
12791         case "$pg" in
12792         /*) dflt=$pg;;
12793         esac
12794         case "$more" in
12795         /*) dflt=$more;;
12796         esac
12797         case "$less" in
12798         /*) dflt=$less;;
12799         esac
12800         case "$dflt" in
12801         '') dflt=/usr/ucb/more;;
12802         esac
12803         ;;
12804 *) dflt="$pager";;
12805 esac
12806 echo " "
12807 fn=f/
12808 rp='What pager is used on your system?'
12809 . ./getfile
12810 pager="$ans"
12811
12812 : see what type pids are declared as in the kernel
12813 rp="What is the type of process ids on this system?"
12814 set pid_t pidtype int stdio.h sys/types.h
12815 eval $typedef_ask
12816
12817 : check for length of pointer
12818 echo " "
12819 case "$ptrsize" in
12820 '')
12821         $echo $n "Checking to see how big your pointers are...$c" >&4
12822         if test "$voidflags" -gt 7; then
12823                 echo '#define VOID_PTR char *' > try.c
12824         else
12825                 echo '#define VOID_PTR void *' > try.c
12826         fi
12827         $cat >>try.c <<'EOCP'
12828 #include <stdio.h>
12829 int main()
12830 {
12831     printf("%d\n", (int)sizeof(VOID_PTR));
12832     exit(0);
12833 }
12834 EOCP
12835         set try
12836         if eval $compile_ok; then
12837                 ptrsize=`./try`
12838                 $echo " $ptrsize bytes." >&4
12839         else
12840                 dflt='4'
12841                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12842                 rp="What is the size of a pointer (in bytes)?"
12843                 . ./myread
12844                 ptrsize="$ans"
12845         fi
12846         ;;
12847 esac
12848 $rm -f try.c try
12849
12850 : see if ar generates random libraries by itself
12851 echo " "
12852 echo "Checking how to generate random libraries on your machine..." >&4
12853 echo 'int bar1() { return bar2(); }' > bar1.c
12854 echo 'int bar2() { return 2; }' > bar2.c
12855 $cat > foo.c <<'EOP'
12856 int main() { printf("%d\n", bar1()); exit(0); }
12857 EOP
12858 $cc $ccflags -c bar1.c >/dev/null 2>&1
12859 $cc $ccflags -c bar2.c >/dev/null 2>&1
12860 $cc $ccflags -c foo.c >/dev/null 2>&1
12861 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12862 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12863         ./foobar >/dev/null 2>&1; then
12864         echo "$ar appears to generate random libraries itself."
12865         orderlib=false
12866         ranlib=":"
12867 elif $ar ts bar$_a >/dev/null 2>&1 &&
12868         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12869         ./foobar >/dev/null 2>&1; then
12870                 echo "a table of contents needs to be added with '$ar ts'."
12871                 orderlib=false
12872                 ranlib="$ar ts"
12873 else
12874         case "$ranlib" in
12875         :) ranlib='';;
12876         '')
12877                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12878                 $test -f $ranlib || ranlib=''
12879                 ;;
12880         esac
12881         if $test -n "$ranlib"; then
12882                 echo "your system has '$ranlib'; we'll use that."
12883                 orderlib=false
12884         else
12885                 echo "your system doesn't seem to support random libraries"
12886                 echo "so we'll use lorder and tsort to order the libraries."
12887                 orderlib=true
12888                 ranlib=":"
12889         fi
12890 fi
12891 $rm -f foo* bar* 
12892
12893 : check for type of arguments to select. 
12894 case "$selecttype" in
12895 '') case "$d_select" in
12896         $define)
12897                 echo " "
12898                 $cat <<EOM
12899 Checking to see what type of arguments are accepted by select().
12900 EOM
12901                 hdrs="$define sys/types.h
12902                         $i_systime sys/time.h 
12903                         $i_sysselct sys/select.h
12904                         $d_socket sys/socket.h"
12905                 : The first arg can be int, unsigned, or size_t
12906                 : The last arg may or may not be 'const'
12907                 val=''
12908                 : void pointer has been seen but using that
12909                 : breaks the selectminbits test
12910                 for xxx in 'fd_set *' 'int *'; do
12911                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12912                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12913                                         case "$val" in
12914                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12915                                                 if ./protochk "$try" $hdrs; then
12916                                                         echo "Your system accepts $xxx."
12917                                                         val="$xxx"
12918                                                 fi
12919                                                 ;;
12920                                         esac
12921                                 done
12922                         done
12923                 done
12924                 case "$val" in
12925                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12926                         case "$d_fd_set" in
12927                                 $define) dflt="fd_set *" ;;
12928                                 *)              dflt="int *" ;;
12929                         esac
12930                         . ./myread
12931                         val=$ans
12932                         ;;
12933                 esac
12934                 selecttype="$val"
12935                 ;;
12936         *)      : no select, so pick a harmless default
12937                 selecttype='int *'
12938                 ;;
12939         esac
12940         ;;
12941 esac
12942
12943 : check for the select 'width'
12944 case "$selectminbits" in
12945 '') case "$d_select" in
12946         $define)
12947                 $cat <<EOM
12948
12949 Checking to see on how many bits at a time your select() operates...
12950 EOM
12951                 $cat >try.c <<EOCP
12952 #include <sys/types.h>
12953 #$i_time I_TIME
12954 #$i_systime I_SYS_TIME
12955 #$i_systimek I_SYS_TIME_KERNEL
12956 #ifdef I_TIME
12957 #   include <time.h>
12958 #endif
12959 #ifdef I_SYS_TIME
12960 #   ifdef I_SYS_TIME_KERNEL
12961 #       define KERNEL
12962 #   endif
12963 #   include <sys/time.h>
12964 #   ifdef I_SYS_TIME_KERNEL
12965 #       undef KERNEL
12966 #   endif
12967 #endif
12968 #$i_sysselct I_SYS_SELECT
12969 #ifdef I_SYS_SELECT
12970 #include <sys/select.h>
12971 #endif
12972 #$d_socket HAS_SOCKET
12973 #ifdef HAS_SOCKET
12974 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12975 #endif
12976 #include <stdio.h>
12977 $selecttype b;
12978 #define S sizeof(*(b))
12979 #define MINBITS 64
12980 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12981 #define NBITS  (NBYTES * 8)
12982 int main() {
12983     char s[NBYTES];
12984     struct timeval t;
12985     int i;
12986     FILE* fp;
12987     int fd;
12988
12989     fclose(stdin);
12990     fp = fopen("try.c", "r");
12991     if (fp == 0)
12992       exit(1);
12993     fd = fileno(fp);
12994     if (fd < 0)
12995       exit(2);
12996     b = ($selecttype)s;
12997     for (i = 0; i < NBITS; i++)
12998         FD_SET(i, b);
12999     t.tv_sec  = 0;
13000     t.tv_usec = 0;
13001     select(fd + 1, b, 0, 0, &t);
13002     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13003     printf("%d\n", i + 1);
13004     return 0;
13005 }
13006 EOCP
13007                 set try
13008                 if eval $compile_ok; then
13009                         selectminbits=`./try`
13010                         case "$selectminbits" in
13011                         '')     cat >&4 <<EOM
13012 Cannot figure out on how many bits at a time your select() operates.
13013 I'll play safe and guess it is 32 bits.
13014 EOM
13015                                 selectminbits=32
13016                                 bits="32 bits"
13017                                 ;;
13018                         1)      bits="1 bit" ;;
13019                         *)      bits="$selectminbits bits" ;;
13020                         esac
13021                         echo "Your select() operates on $bits at a time." >&4
13022                 else
13023                         rp='What is the minimum number of bits your select() operates on?'
13024                         case "$byteorder" in
13025                         1234|12345678)  dflt=32 ;;
13026                         *)              dflt=1  ;;
13027                         esac
13028                         . ./myread
13029                         val=$ans
13030                         selectminbits="$val"
13031                 fi
13032                 $rm -f try.* try
13033                 ;;
13034         *)      : no select, so pick a harmless default
13035                 selectminbits='32'
13036                 ;;
13037         esac
13038         ;;
13039 esac
13040
13041 : Trace out the files included by signal.h, then look for SIGxxx names.
13042 : Remove SIGARRAYSIZE used by HPUX.
13043 : Remove SIGSTKSIZE used by Linux.
13044 : Remove SIGSTKSZ used by Posix.
13045 : Remove SIGTYP void lines used by OS2.
13046 : Some cpps, like os390, dont give the file name anywhere
13047 if [ "X$fieldn" = X ]; then
13048         : Just make some guesses.  We check them later.
13049         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13050 else
13051         xxx=`echo '#include <signal.h>' |
13052         $cppstdin $cppminus $cppflags 2>/dev/null |
13053         $grep '^[       ]*#.*include' | 
13054         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13055 fi
13056 : Check this list of files to be sure we have parsed the cpp output ok.
13057 : This will also avoid potentially non-existent files, such 
13058 : as ../foo/bar.h
13059 xxxfiles=''
13060 for xx in $xxx /dev/null ; do
13061         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13062 done
13063 : If we have found no files, at least try signal.h
13064 case "$xxxfiles" in
13065 '')     xxxfiles=`./findhdr signal.h` ;;
13066 esac
13067 xxx=`awk '
13068 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13069         print substr($2, 4, 20)
13070 }
13071 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13072         print substr($3, 4, 20)
13073 }' $xxxfiles`
13074 : Append some common names just in case the awk scan failed.
13075 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13076 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13077 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13078 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13079 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13080
13081 : generate a few handy files for later
13082 $cat > signal.c <<'EOCP'
13083 #include <sys/types.h>
13084 #include <signal.h>
13085 #include <stdio.h>
13086 int main() {
13087
13088 /* Strange style to avoid deeply-nested #if/#else/#endif */
13089 #ifndef NSIG
13090 #  ifdef _NSIG
13091 #    define NSIG (_NSIG)
13092 #  endif
13093 #endif
13094
13095 #ifndef NSIG
13096 #  ifdef SIGMAX
13097 #    define NSIG (SIGMAX+1)
13098 #  endif
13099 #endif
13100
13101 #ifndef NSIG
13102 #  ifdef SIG_MAX
13103 #    define NSIG (SIG_MAX+1)
13104 #  endif
13105 #endif
13106
13107 #ifndef NSIG
13108 #  ifdef MAXSIG
13109 #    define NSIG (MAXSIG+1)
13110 #  endif
13111 #endif
13112
13113 #ifndef NSIG
13114 #  ifdef MAX_SIG
13115 #    define NSIG (MAX_SIG+1)
13116 #  endif
13117 #endif
13118
13119 #ifndef NSIG
13120 #  ifdef SIGARRAYSIZE
13121 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13122 #  endif
13123 #endif
13124
13125 #ifndef NSIG
13126 #  ifdef _sys_nsig
13127 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13128 #  endif
13129 #endif
13130
13131 /* Default to some arbitrary number that's big enough to get most
13132    of the common signals.
13133 */
13134 #ifndef NSIG
13135 #    define NSIG 50
13136 #endif
13137
13138 printf("NSIG %d\n", NSIG);
13139
13140 #ifndef JUST_NSIG
13141
13142 EOCP
13143
13144 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13145 {
13146         printf "#ifdef SIG"; printf $1; printf "\n"
13147         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13148         printf $1; printf ");\n"
13149         printf "#endif\n"
13150 }
13151 END {
13152         printf "#endif /* JUST_NSIG */\n";
13153         printf "exit(0);\n}\n";
13154 }
13155 ' >>signal.c
13156 $cat >signal.awk <<'EOP'
13157 BEGIN { ndups = 0 }
13158 $1 ~ /^NSIG$/ { nsig = $2 }
13159 ($1 !~ /^NSIG$/) && (NF == 2) {
13160     if ($2 > maxsig) { maxsig = $2 }
13161     if (sig_name[$2]) {
13162         dup_name[ndups] = $1
13163         dup_num[ndups] = $2
13164         ndups++ 
13165     }
13166     else {
13167         sig_name[$2] = $1
13168         sig_num[$2] = $2
13169     }
13170 }
13171 END { 
13172     if (nsig == 0) {
13173         nsig = maxsig + 1
13174     }
13175     printf("NSIG %d\n", nsig);
13176     for (n = 1; n < nsig; n++) {
13177         if (sig_name[n]) {
13178             printf("%s %d\n", sig_name[n], sig_num[n])
13179         }
13180         else {
13181             printf("NUM%d %d\n", n, n) 
13182         }
13183     }
13184     for (n = 0; n < ndups; n++) {
13185         printf("%s %d\n", dup_name[n], dup_num[n])
13186     }
13187 }
13188 EOP
13189 $cat >signal_cmd <<EOS
13190 $startsh
13191 if $test -s signal.lst; then
13192     echo "Using your existing signal.lst file"
13193         exit 0
13194 fi
13195 xxx="$xxx"
13196 EOS
13197 $cat >>signal_cmd <<'EOS'
13198
13199 set signal
13200 if eval $compile_ok; then
13201         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13202 else
13203         echo "(I can't seem be able to compile the whole test program)" >&4
13204         echo "(I'll try it in little pieces.)" >&4
13205         set signal -DJUST_NSIG
13206         if eval $compile_ok; then
13207                 ./signal$_exe > signal.nsg
13208                 $cat signal.nsg
13209         else
13210                 echo "I can't seem to figure out how many signals you have." >&4
13211                 echo "Guessing 50." >&4
13212                 echo 'NSIG 50' > signal.nsg
13213         fi
13214         : Now look at all the signal names, one at a time.
13215         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13216                 $cat > signal.c <<EOCP
13217 #include <sys/types.h>
13218 #include <signal.h>
13219 #include <stdio.h>
13220 int main() {
13221 printf("$xx %d\n", SIG${xx});
13222 return 0;
13223 }
13224 EOCP
13225                 set signal
13226                 if eval $compile; then
13227                         echo "SIG${xx} found."
13228                         ./signal$_exe  >> signal.ls1
13229                 else
13230                         echo "SIG${xx} NOT found."
13231                 fi
13232         done
13233         if $test -s signal.ls1; then
13234                 $cat signal.nsg signal.ls1 |
13235                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13236         fi
13237
13238 fi
13239 if $test -s signal.lst; then
13240         :
13241 else
13242         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13243         echo 'kill -l' >signal
13244         set X `csh -f <signal`
13245         $rm -f signal
13246         shift
13247         case $# in
13248         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13249         esac
13250         echo $@ | $tr ' ' $trnl | \
13251             $awk '{ printf "%s %d\n", $1, ++s; }
13252                   END { printf "NSIG %d\n", ++s }' >signal.lst
13253 fi
13254 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13255 EOS
13256 chmod a+x signal_cmd
13257 $eunicefix signal_cmd
13258
13259 : generate list of signal names
13260 echo " "
13261 case "$sig_name_init" in
13262 '') doinit=yes ;;
13263 *)  case "$sig_num_init" in
13264     ''|*,*) doinit=yes ;;
13265     esac ;;
13266 esac
13267 case "$doinit" in
13268 yes)
13269         echo "Generating a list of signal names and numbers..." >&4
13270         . ./signal_cmd
13271         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13272         sig_name=`$awk 'BEGIN { printf "ZERO " }
13273                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13274         sig_num=`$awk  'BEGIN { printf "0 " }
13275                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13276         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13277                              !/^NSIG/   { printf "\"%s\", ", $1 }
13278                              END        { printf "0\n" }' signal.lst`
13279         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13280                              !/^NSIG/   { printf "%d, ", $2}
13281                              END        { printf "0\n"}' signal.lst`
13282         ;;
13283 esac
13284 echo "The following $sig_count signals are available:"
13285 echo " "
13286 echo $sig_name | $awk \
13287 'BEGIN { linelen = 0 }
13288 {
13289         for (i = 1; i <= NF; i++) {
13290                 name = "SIG" $i " "
13291                 linelen = linelen + length(name)
13292                 if (linelen > 70) {
13293                         printf "\n"
13294                         linelen = length(name)
13295                 }
13296                 printf "%s", name
13297         }
13298         printf "\n"
13299 }'
13300 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13301
13302 : see what type is used for signed size_t
13303 set ssize_t ssizetype int stdio.h sys/types.h
13304 eval $typedef
13305 dflt="$ssizetype"
13306 $cat > ssize.c <<EOM
13307 #include <stdio.h>
13308 #include <sys/types.h>
13309 #define Size_t $sizetype
13310 #define SSize_t $dflt
13311 int main()
13312 {
13313         if (sizeof(Size_t) == sizeof(SSize_t))
13314                 printf("$dflt\n");
13315         else if (sizeof(Size_t) == sizeof(int))
13316                 printf("int\n");
13317         else 
13318                 printf("long\n");
13319         exit(0);
13320 }
13321 EOM
13322 echo " "
13323 set ssize
13324 if eval $compile_ok && ./ssize > /dev/null; then
13325         ssizetype=`./ssize`
13326         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13327 else
13328         $cat >&4 <<EOM
13329 Help! I can't compile and run the ssize_t test program: please enlighten me!
13330 (This is probably a misconfiguration in your system or libraries, and
13331 you really ought to fix it.  Still, I'll try anyway.)
13332
13333 I need a type that is the same size as $sizetype, but is guaranteed to
13334 be signed.  Common values are ssize_t, int and long.
13335
13336 EOM
13337         rp="What signed type is the same size as $sizetype?"
13338         . ./myread
13339         ssizetype="$ans"
13340 fi
13341 $rm -f ssize ssize.*
13342
13343 : see what type of char stdio uses.
13344 echo " "
13345 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13346         echo "Your stdio uses unsigned chars." >&4
13347         stdchar="unsigned char"
13348 else
13349         echo "Your stdio uses signed chars." >&4
13350         stdchar="char"
13351 fi
13352
13353 : see if time exists
13354 echo " "
13355 if test "X$d_time" = X -o X"$timetype" = X; then
13356     if set time val -f d_time; eval $csym; $val; then
13357                 echo 'time() found.' >&4
13358                 val="$define"
13359                 rp="What is the type returned by time() on this system?"
13360                 set time_t timetype long stdio.h sys/types.h
13361                 eval $typedef_ask
13362     else
13363                 echo 'time() not found, hope that will do.' >&4
13364                 val="$undef"
13365                 timetype='int';
13366     fi
13367     set d_time
13368     eval $setvar
13369 fi
13370
13371 : see what type uids are declared as in the kernel
13372 echo " "
13373 echo "Looking for the type for user ids returned by getuid()."
13374 set uid_t uidtype xxx stdio.h sys/types.h
13375 eval $typedef
13376 case "$uidtype" in
13377 xxx)
13378         xxx=`./findhdr sys/user.h`
13379         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13380         case $1 in
13381         unsigned) dflt="$1 $2" ;;
13382         *) dflt="$1" ;;
13383         esac
13384         ;;
13385 *) dflt="$uidtype";;
13386 esac
13387 case "$uidtype" in
13388 uid_t)  echo "uid_t found." ;;
13389 *)      rp="What is the type for user ids returned by getuid()?"
13390         . ./myread
13391         uidtype="$ans"
13392         ;;
13393 esac
13394
13395 echo " "
13396 case "$uidtype" in
13397 *_t) zzz="$uidtype"     ;;
13398 *)   zzz="uid"          ;;
13399 esac
13400 echo "Checking the size of $zzz..." >&4 
13401 cat > try.c <<EOCP
13402 #include <sys/types.h>
13403 #include <stdio.h>
13404 int main() {
13405     printf("%d\n", (int)sizeof($uidtype));
13406     exit(0);
13407 }
13408 EOCP
13409 set try
13410 if eval $compile_ok; then
13411         yyy=`./try`
13412         case "$yyy" in
13413         '')     uidsize=4
13414                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13415                 ;;
13416         *)      uidsize=$yyy
13417                 echo "Your $zzz size is $uidsize bytes."
13418                 ;;
13419         esac
13420 else
13421         uidsize=4
13422         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13423 fi
13424
13425 echo " "
13426 case "$uidtype" in
13427 *_t) zzz="$uidtype"     ;;
13428 *)   zzz="uid"          ;;
13429 esac
13430 echo "Checking the sign of $zzz..." >&4
13431 cat > try.c <<EOCP
13432 #include <sys/types.h>
13433 #include <stdio.h>
13434 int main() {
13435         $uidtype foo = -1;
13436         if (foo < 0)
13437                 printf("-1\n");
13438         else
13439                 printf("1\n");
13440 }
13441 EOCP
13442 set try
13443 if eval $compile; then
13444         yyy=`./try`
13445         case "$yyy" in
13446         '')     uidsign=1
13447                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13448                 ;;
13449         *)      uidsign=$yyy
13450                 case "$uidsign" in
13451                  1) echo "Your $zzz is unsigned." ;;
13452                 -1) echo "Your $zzz is signed."   ;;
13453                 esac
13454                 ;;
13455         esac
13456 else
13457         uidsign=1
13458         echo "(I can't compile the test program--guessing unsigned.)" >&4
13459 fi
13460
13461
13462
13463 echo " "
13464 $echo "Checking the format string to be used for uids..." >&4
13465
13466 case "$uidsign" in
13467 -1)     if $test X"$uidsize" = X"$ivsize"; then
13468                 uidformat="$ivdformat"
13469         else
13470                 if $test X"$uidsize" = X"$longsize"; then
13471                         uidformat='"ld"'
13472                 else
13473                         if $test X"$uidsize" = X"$intsize"; then
13474                                 uidformat='"d"'
13475                         else
13476                                 if $test X"$uidsize" = X"$shortsize"; then
13477                                         uidformat='"hd"'
13478                                 fi
13479                         fi
13480                 fi
13481         fi
13482         ;;
13483 *)      if $test X"$uidsize" = X"$uvsize"; then
13484                 uidformat="$uvuformat"
13485         else
13486                 if $test X"$uidsize" = X"$longsize"; then
13487                         uidformat='"lu"'
13488                 else
13489                         if $test X"$uidsize" = X"$intsize"; then
13490                                 uidformat='"u"'
13491                         else
13492                                 if $test X"$uidsize" = X"$shortsize"; then
13493                                         uidformat='"hu"'
13494                                 fi
13495                         fi
13496                 fi
13497         fi
13498         ;;
13499 esac
13500
13501 : see if dbm.h is available
13502 : see if dbmclose exists
13503 set dbmclose d_dbmclose
13504 eval $inlibc
13505
13506 case "$d_dbmclose" in
13507 $define)
13508         set dbm.h i_dbm
13509         eval $inhdr
13510         case "$i_dbm" in
13511         $define)
13512                 val="$undef"
13513                 set i_rpcsvcdbm
13514                 eval $setvar
13515                 ;;
13516         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13517                 eval $inhdr
13518                 ;;
13519         esac
13520         ;;
13521 *)      echo "We won't be including <dbm.h>"
13522         val="$undef"
13523         set i_dbm
13524         eval $setvar
13525         val="$undef"
13526         set i_rpcsvcdbm
13527         eval $setvar
13528         ;;
13529 esac
13530
13531 : see if this is a sys/file.h system
13532 val=''
13533 set sys/file.h val
13534 eval $inhdr
13535
13536 : do we need to include sys/file.h ?
13537 case "$val" in
13538 "$define")
13539         echo " "
13540         if $h_sysfile; then
13541                 val="$define"
13542                 echo "We'll be including <sys/file.h>." >&4
13543         else
13544                 val="$undef"
13545                 echo "We won't be including <sys/file.h>." >&4
13546         fi
13547         ;;
13548 *)
13549         h_sysfile=false
13550         ;;
13551 esac
13552 set i_sysfile
13553 eval $setvar
13554
13555 : see if fcntl.h is there
13556 val=''
13557 set fcntl.h val
13558 eval $inhdr
13559
13560 : see if we can include fcntl.h
13561 case "$val" in
13562 "$define")
13563         echo " "
13564         if $h_fcntl; then
13565                 val="$define"
13566                 echo "We'll be including <fcntl.h>." >&4
13567         else
13568                 val="$undef"
13569                 if $h_sysfile; then
13570         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13571                 else
13572                         echo "We won't be including <fcntl.h>." >&4
13573                 fi
13574         fi
13575         ;;
13576 *)
13577         h_fcntl=false
13578         val="$undef"
13579         ;;
13580 esac
13581 set i_fcntl
13582 eval $setvar
13583
13584 : see if this is a iconv.h system
13585 set iconv.h i_iconv
13586 eval $inhdr
13587
13588 : see if locale.h is available
13589 set locale.h i_locale
13590 eval $inhdr
13591
13592 : see if mach cthreads are available
13593 if test "X$usethreads" = "X$define"; then
13594         set mach/cthreads.h i_machcthr
13595         eval $inhdr
13596 else
13597         i_machcthr="$undef"
13598 fi
13599
13600
13601
13602 : see if this is a math.h system
13603 set math.h i_math
13604 eval $inhdr
13605
13606 : see if this is a mntent.h system
13607 set mntent.h i_mntent
13608 eval $inhdr
13609
13610 : see if ndbm.h is available
13611 set ndbm.h t_ndbm
13612 eval $inhdr
13613 case "$t_ndbm" in
13614 $define)
13615         : see if dbm_open exists
13616         set dbm_open d_dbm_open
13617         eval $inlibc
13618         case "$d_dbm_open" in
13619         $undef)
13620                 t_ndbm="$undef"
13621                 echo "We won't be including <ndbm.h>"
13622                 ;;
13623         esac
13624         ;;
13625 esac
13626 val="$t_ndbm"
13627 set i_ndbm
13628 eval $setvar
13629
13630 : see if net/errno.h is available
13631 val=''
13632 set net/errno.h val
13633 eval $inhdr
13634
13635 : Unfortunately, it causes problems on some systems.  Arrgh.
13636 case "$val" in
13637 $define)
13638         cat > try.c <<'EOM'
13639 #include <stdio.h>
13640 #include <errno.h>
13641 #include <net/errno.h>
13642 int func()
13643 {
13644         return ENOTSOCK;
13645 }
13646 EOM
13647         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13648                 echo "We'll be including <net/errno.h>." >&4
13649         else
13650                 echo "We won't be including <net/errno.h>." >&4
13651                 val="$undef"
13652         fi
13653         $rm -f try.* try
13654         ;;
13655 esac
13656 set i_neterrno
13657 eval $setvar
13658
13659 : see if netinet/tcp.h is available
13660 set netinet/tcp.h i_netinettcp
13661 eval $inhdr
13662
13663 : see if this is a poll.h system
13664 set poll.h i_poll
13665 eval $inhdr
13666
13667 echo " "
13668 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13669 $cat <<'EOSH' > Cppsym.know
13670 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13671 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13672 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13673 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13674 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13675 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13676 bull c cadmus clipper CMU COFF COMPILER_VERSION
13677 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13678 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13679 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13680 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13681 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13682 H3050R H3050RX hbullx20 hcx host_mips
13683 hp200 hp300 hp700 HP700 hp800 hp9000
13684 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13685 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13686 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13687 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13688 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13689 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13690 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13691 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13692 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13693 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13694 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13695 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13696 MATH_HAS_NO_SIDE_EFFECTS
13697 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13698 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13699 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13700 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13701 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13702 NetBSD news1500 news1700 news1800 news1900 news3700
13703 news700 news800 news900 NeXT NLS ns16000 ns32000
13704 ns32016 ns32332 ns32k nsc32000
13705 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13706 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13707 pc532 pdp11 PGC PIC plexus PORTAR posix
13708 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13709 POSIX_C_SOURCE POSIX_SOURCE POWER
13710 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13711 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13712 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13713 sony sony_news sonyrisc sparc sparclite spectrum
13714 stardent stdc STDC_EXT stratos sun sun3 sun386
13715 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13716 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13717 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13718 sysV68 sysV88 Tek4132 Tek4300 titan
13719 tower tower32 tower32_200 tower32_600 tower32_700
13720 tower32_800 tower32_850 tss
13721 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13722 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13723 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13724 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13725 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13726 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13727 z8000
13728 EOSH
13729 # Maybe put other stuff here too.
13730 cat <<EOSH >>Cppsym.know
13731 $osname
13732 EOSH
13733 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13734 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13735 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13736 $rm -f Cppsym.a Cppsym.b
13737 cat <<EOSH > Cppsym
13738 $startsh
13739 if $test \$# -gt 0; then
13740     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13741     if $test -s Cppsym.got; then
13742         $rm -f Cppsym.got
13743         exit 0
13744     fi
13745     $rm -f Cppsym.got
13746     exit 1
13747 else
13748     $tr " " "$trnl" | ./Cppsym.try
13749     exit 0
13750 fi
13751 EOSH
13752 chmod +x Cppsym
13753 $eunicefix Cppsym
13754 cat <<EOSH > Cppsym.try
13755 $startsh
13756 cat <<'EOCP' > try.c
13757 #include <stdio.h>
13758 int main() {
13759 EOCP
13760 $awk \\
13761 EOSH
13762 cat <<'EOSH' >> Cppsym.try
13763 'length($1) > 0 {
13764     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
13765     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
13766     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
13767     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
13768 }'       >> try.c
13769 echo '}' >> try.c
13770 EOSH
13771 cat <<EOSH >> Cppsym.try
13772 cc="$cc"
13773 optimize="$optimize"
13774 ccflags="$ccflags"
13775 ldflags="$ldflags"
13776 libs="$libs"
13777 exe_ext="$exe_ext"
13778 $cc $optimize $ccflags $ldflags -o try$exe_ext try.c $libs && ./try$exe_ext
13779 EOSH
13780 chmod +x Cppsym.try
13781 $eunicefix Cppsym.try
13782 ./Cppsym < Cppsym.know > Cppsym.true
13783 : now check the C compiler for additional symbols
13784 postprocess_cc_v=''
13785 case "$osname" in
13786 aix) postprocess_cc_v="|$tr , ' '" ;;
13787 esac
13788 $cat >ccsym <<EOS
13789 $startsh
13790 $cat >tmp.c <<EOF
13791 extern int foo;
13792 EOF
13793 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13794 do
13795         case "\$i" in
13796         -D*) echo "\$i" | $sed 's/^-D//';;
13797         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13798         esac
13799 done
13800 $rm -f try.c
13801 EOS
13802 postprocess_cc_v=''
13803 chmod +x ccsym
13804 $eunicefix ccsym
13805 ./ccsym > ccsym1.raw
13806 if $test -s ccsym1.raw; then
13807        $sort ccsym1.raw | $uniq >ccsym.raw
13808 else
13809        mv ccsym1.raw ccsym.raw
13810 fi
13811
13812 $awk '/\=/ { print $0; next }
13813         { print $0"=1" }' ccsym.raw >ccsym.list
13814 $awk '/\=/ { print $0; next }
13815         { print $0"=1" }' Cppsym.true >ccsym.true
13816 $comm -13 ccsym.true ccsym.list >ccsym.own
13817 $comm -12 ccsym.true ccsym.list >ccsym.com
13818 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13819 also=''
13820 if $test -z ccsym.raw; then
13821         echo "Your C compiler doesn't seem to define any symbols!" >&4
13822         echo " "
13823         echo "However, your C preprocessor defines the following symbols:"
13824         $cat Cppsym.true
13825         ccsymbols=''
13826         cppsymbols=`$cat Cppsym.true`
13827         cppsymbols=`echo $cppsymbols`
13828         cppccsymbols="$cppsymbols"
13829 else
13830         if $test -s ccsym.com; then
13831                 echo "Your C compiler and pre-processor define these symbols:"
13832                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13833                 also='also '
13834                 symbols='ones'
13835                 cppccsymbols=`$cat ccsym.com`
13836                 cppccsymbols=`echo $cppccsymbols`
13837                 $test "$silent" || sleep 1
13838         fi
13839         if $test -s ccsym.cpp; then
13840                 $test "$also" && echo " "
13841                 echo "Your C pre-processor ${also}defines the following symbols:"
13842                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13843                 also='further '
13844                 cppsymbols=`$cat ccsym.cpp`
13845                 cppsymbols=`echo $cppsymbols`
13846                 $test "$silent" || sleep 1
13847         fi
13848         if $test -s ccsym.own; then
13849                 $test "$also" && echo " "
13850                 echo "Your C compiler ${also}defines the following cpp symbols:"
13851                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13852                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13853                 ccsymbols=`$cat ccsym.own`
13854                 ccsymbols=`echo $ccsymbols`
13855                 $test "$silent" || sleep 1
13856         fi
13857 fi
13858 $rm -f ccsym*
13859
13860 : see if this is a termio system
13861 val="$undef"
13862 val2="$undef"
13863 val3="$undef"
13864 if $test `./findhdr termios.h`; then
13865         set tcsetattr i_termios
13866         eval $inlibc
13867         val3="$i_termios"
13868 fi
13869 echo " "
13870 case "$val3" in
13871 "$define") echo "You have POSIX termios.h... good!" >&4;;
13872 *) if ./Cppsym pyr; then
13873                 case "`/bin/universe`" in
13874                 ucb) if $test `./findhdr sgtty.h`; then
13875                                 val2="$define"
13876                                 echo "<sgtty.h> found." >&4
13877                         else
13878                                 echo "System is pyramid with BSD universe."
13879                                 echo "<sgtty.h> not found--you could have problems." >&4
13880                         fi;;
13881                 *) if $test `./findhdr termio.h`; then
13882                                 val="$define"
13883                                 echo "<termio.h> found." >&4
13884                         else
13885                                 echo "System is pyramid with USG universe."
13886                                 echo "<termio.h> not found--you could have problems." >&4
13887                         fi;;
13888                 esac
13889         elif ./usg; then
13890                 if $test `./findhdr termio.h`; then
13891                         echo "<termio.h> found." >&4
13892                         val="$define"
13893                 elif $test `./findhdr sgtty.h`; then
13894                         echo "<sgtty.h> found." >&4
13895                         val2="$define"
13896                 else
13897 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13898                 fi
13899         else
13900                 if $test `./findhdr sgtty.h`; then
13901                         echo "<sgtty.h> found." >&4
13902                         val2="$define"
13903                 elif $test `./findhdr termio.h`; then
13904                         echo "<termio.h> found." >&4
13905                         val="$define"
13906                 else
13907 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13908                 fi
13909         fi;;
13910 esac
13911 set i_termio; eval $setvar
13912 val=$val2; set i_sgtty; eval $setvar
13913 val=$val3; set i_termios; eval $setvar
13914
13915 : see if this is a shadow.h system
13916 set shadow.h i_shadow
13917 eval $inhdr
13918
13919 : see if this is a socks.h system
13920 set socks.h i_socks
13921 eval $inhdr
13922
13923 : see if stdarg is available
13924 echo " "
13925 if $test `./findhdr stdarg.h`; then
13926         echo "<stdarg.h> found." >&4
13927         valstd="$define"
13928 else
13929         echo "<stdarg.h> NOT found." >&4
13930         valstd="$undef"
13931 fi
13932
13933 : see if varags is available
13934 echo " "
13935 if $test `./findhdr varargs.h`; then
13936         echo "<varargs.h> found." >&4
13937 else
13938         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13939 fi
13940
13941 : set up the varargs testing programs
13942 $cat > varargs.c <<EOP
13943 #ifdef I_STDARG
13944 #include <stdarg.h>
13945 #endif
13946 #ifdef I_VARARGS
13947 #include <varargs.h>
13948 #endif
13949
13950 #ifdef I_STDARG
13951 int f(char *p, ...)
13952 #else
13953 int f(va_alist)
13954 va_dcl
13955 #endif
13956 {
13957         va_list ap;
13958 #ifndef I_STDARG
13959         char *p;
13960 #endif
13961 #ifdef I_STDARG
13962         va_start(ap,p);
13963 #else
13964         va_start(ap);
13965         p = va_arg(ap, char *);
13966 #endif
13967         va_end(ap);
13968 }
13969 EOP
13970 $cat > varargs <<EOP
13971 $startsh
13972 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13973         echo "true"
13974 else
13975         echo "false"
13976 fi
13977 $rm -f varargs$_o
13978 EOP
13979 chmod +x varargs
13980
13981 : now check which varargs header should be included
13982 echo " "
13983 i_varhdr=''
13984 case "$valstd" in
13985 "$define")
13986         if `./varargs I_STDARG`; then
13987                 val='stdarg.h'
13988         elif `./varargs I_VARARGS`; then
13989                 val='varargs.h'
13990         fi
13991         ;;
13992 *)
13993         if `./varargs I_VARARGS`; then
13994                 val='varargs.h'
13995         fi
13996         ;;
13997 esac
13998 case "$val" in
13999 '')
14000 echo "I could not find the definition for va_dcl... You have problems..." >&4
14001         val="$undef"; set i_stdarg; eval $setvar
14002         val="$undef"; set i_varargs; eval $setvar
14003         ;;
14004 *) 
14005         set i_varhdr
14006         eval $setvar
14007         case "$i_varhdr" in
14008         stdarg.h)
14009                 val="$define"; set i_stdarg; eval $setvar
14010                 val="$undef"; set i_varargs; eval $setvar
14011                 ;;
14012         varargs.h)
14013                 val="$undef"; set i_stdarg; eval $setvar
14014                 val="$define"; set i_varargs; eval $setvar
14015                 ;;
14016         esac
14017         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14018 esac
14019 $rm -f varargs*
14020
14021 : see if stddef is available
14022 set stddef.h i_stddef
14023 eval $inhdr
14024
14025 : see if sys/access.h is available
14026 set sys/access.h i_sysaccess
14027 eval $inhdr
14028
14029 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14030 set sys/filio.h i_sysfilio
14031 eval $inhdr
14032 echo " "
14033 if $test `./findhdr sys/ioctl.h`; then
14034         val="$define"
14035         echo '<sys/ioctl.h> found.' >&4
14036 else
14037         val="$undef"
14038         if $test $i_sysfilio = "$define"; then
14039             echo '<sys/ioctl.h> NOT found.' >&4
14040         else
14041                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14042                 $test $i_termio = "$define" && xxx="termio.h"
14043                 $test $i_termios = "$define" && xxx="termios.h"
14044 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14045         fi
14046 fi
14047 set i_sysioctl
14048 eval $setvar
14049
14050 : see if sys/resource.h has to be included
14051 set sys/resource.h i_sysresrc
14052 eval $inhdr
14053
14054 : see if sys/security.h is available
14055 set sys/security.h i_syssecrt
14056 eval $inhdr
14057
14058 : see if this is a sys/statvfs.h system
14059 set sys/statvfs.h i_sysstatvfs
14060 eval $inhdr
14061
14062 : see if this is a sys/uio.h system
14063 set sys/uio.h i_sysuio
14064 eval $inhdr
14065
14066 : see if this is a sys/un.h system
14067 set sys/un.h i_sysun
14068 eval $inhdr
14069
14070 : see if this is a syswait system
14071 set sys/wait.h i_syswait
14072 eval $inhdr
14073
14074 : see if this is a ustat.h system
14075 set ustat.h i_ustat
14076 eval $inhdr
14077
14078 : see if this is an utime system
14079 set utime.h i_utime
14080 eval $inhdr
14081
14082 : see if this is a values.h system
14083 set values.h i_values
14084 eval $inhdr
14085
14086 : see if this is a vfork system
14087 case "$d_vfork" in
14088 "$define")
14089         set vfork.h i_vfork
14090         eval $inhdr
14091         ;;
14092 *)
14093         i_vfork="$undef"
14094         ;;
14095 esac
14096
14097 : see if gdbm.h is available
14098 set gdbm.h t_gdbm
14099 eval $inhdr
14100 case "$t_gdbm" in
14101 $define)
14102         : see if gdbm_open exists
14103         set gdbm_open d_gdbm_open
14104         eval $inlibc
14105         case "$d_gdbm_open" in
14106         $undef)
14107                 t_gdbm="$undef"
14108                 echo "We won't be including <gdbm.h>"
14109                 ;;
14110         esac
14111         ;;
14112 esac
14113 val="$t_gdbm"
14114 set i_gdbm
14115 eval $setvar
14116
14117 echo " "
14118 echo "Looking for extensions..." >&4
14119 : If we are using the old config.sh, known_extensions may contain
14120 : old or inaccurate or duplicate values.
14121 known_extensions=''
14122 nonxs_extensions=''
14123 : We do not use find because it might not be available.
14124 : We do not just use MANIFEST because the user may have dropped
14125 : some additional extensions into the source tree and expect them
14126 : to be built.
14127
14128 : Function to recursively find available extensions, ignoring DynaLoader
14129 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14130 find_extensions='
14131     for xxx in *; do
14132        case "$xxx" in
14133            DynaLoader|dynaload) ;;
14134            *)
14135            if $test -f $xxx/$xxx.xs; then
14136                known_extensions="$known_extensions $1$xxx";
14137            elif $test -f $xxx/Makefile.PL; then
14138                nonxs_extensions="$nonxs_extensions $1$xxx";
14139            else
14140                if $test -d $xxx -a $# -lt 10; then
14141                    set $1$xxx/ $*;
14142                    cd $xxx;
14143                    eval $find_extensions;
14144                    cd ..;
14145                    shift;
14146                fi;
14147            fi
14148            ;;
14149        esac;
14150     done'
14151 tdir=`pwd`
14152 cd $rsrc/ext
14153 set X
14154 shift
14155 eval $find_extensions
14156 set X $nonxs_extensions
14157 shift
14158 nonxs_extensions="$*"
14159 set X $known_extensions
14160 shift
14161 known_extensions="$*"
14162 cd $tdir
14163
14164 : Now see which are supported on this system.
14165 avail_ext=''
14166 for xxx in $known_extensions ; do
14167         case "$xxx" in
14168         DB_File|db_file)
14169                 case "$i_db" in
14170                 $define) avail_ext="$avail_ext $xxx" ;;
14171                 esac
14172                 ;;
14173         GDBM_File|gdbm_fil)
14174                 case "$i_gdbm" in 
14175                 $define) avail_ext="$avail_ext $xxx" ;;
14176                 esac
14177                 ;;
14178         NDBM_File|ndbm_fil)
14179                 case "$i_ndbm" in
14180                 $define) avail_ext="$avail_ext $xxx" ;;
14181                 esac
14182                 ;;
14183         ODBM_File|odbm_fil) 
14184                 case "${i_dbm}${i_rpcsvcdbm}" in
14185                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14186                 esac
14187                 ;;
14188         POSIX|posix)
14189                 case "$useposix" in
14190                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14191                 esac
14192                 ;;
14193         Opcode|opcode)
14194                 case "$useopcode" in
14195                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14196                 esac
14197                 ;;
14198         Socket|socket)
14199                 case "$d_socket" in 
14200                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14201                 esac
14202                 ;;
14203         Thread|thread)
14204                 case "$usethreads" in 
14205                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14206                 esac
14207                 ;;
14208         IPC/SysV|ipc/sysv)
14209                 : XXX Do we need a useipcsysv variable here
14210                 case "${d_msg}${d_sem}${d_shm}" in 
14211                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14212                 esac
14213                 ;;
14214         *)      avail_ext="$avail_ext $xxx"
14215                 ;;
14216         esac
14217 done
14218
14219 set X $avail_ext
14220 shift
14221 avail_ext="$*"
14222
14223 : Now see which nonxs extensions are supported on this system.
14224 : For now assume all are.
14225 nonxs_ext=''
14226 for xxx in $nonxs_extensions ; do
14227         case "$xxx" in
14228         *)      nonxs_ext="$nonxs_ext $xxx"
14229                 ;;
14230         esac
14231 done
14232
14233 set X $nonxs_ext
14234 shift
14235 nonxs_ext="$*"
14236
14237 case $usedl in
14238 $define)
14239         $cat <<EOM
14240 A number of extensions are supplied with $package.  You may choose to
14241 compile these extensions for dynamic loading (the default), compile
14242 them into the $package executable (static loading), or not include
14243 them at all.  Answer "none" to include no extensions.
14244 Note that DynaLoader is always built and need not be mentioned here.
14245
14246 EOM
14247         case "$dynamic_ext" in
14248         '') dflt="$avail_ext" ;;
14249         *)      dflt="$dynamic_ext"
14250                 # Perhaps we are reusing an old out-of-date config.sh.
14251                 case "$hint" in
14252                 previous)
14253                         if test X"$dynamic_ext" != X"$avail_ext"; then
14254                                 $cat <<EOM
14255 NOTICE:  Your previous config.sh list may be incorrect. 
14256 The extensions now available to you are 
14257         ${avail_ext}
14258 but the default list from your previous config.sh is
14259         ${dynamic_ext} 
14260
14261 EOM
14262                         fi
14263                         ;;
14264                 esac
14265                 ;;
14266         esac
14267         case "$dflt" in
14268         '')     dflt=none;;
14269         esac
14270         rp="What extensions do you wish to load dynamically?"
14271         . ./myread
14272         case "$ans" in
14273         none) dynamic_ext=' ' ;;
14274         *) dynamic_ext="$ans" ;;
14275         esac
14276
14277         case "$static_ext" in
14278         '')
14279                 : Exclude those already listed in dynamic linking
14280                 dflt=''
14281                 for xxx in $avail_ext; do
14282                         case " $dynamic_ext " in
14283                         *" $xxx "*) ;;
14284                         *) dflt="$dflt $xxx" ;;
14285                         esac
14286                 done
14287                 set X $dflt
14288                 shift
14289                 dflt="$*"
14290                 ;;
14291         *)  dflt="$static_ext" 
14292                 ;;
14293         esac
14294
14295         case "$dflt" in
14296         '')     dflt=none;;
14297         esac
14298         rp="What extensions do you wish to load statically?"
14299         . ./myread
14300         case "$ans" in
14301         none) static_ext=' ' ;;
14302         *) static_ext="$ans" ;;
14303         esac
14304         ;;
14305 *)
14306         $cat <<EOM
14307 A number of extensions are supplied with $package.  Answer "none" 
14308 to include no extensions. 
14309 Note that DynaLoader is always built and need not be mentioned here.
14310
14311 EOM
14312         case "$static_ext" in
14313         '') dflt="$avail_ext" ;;
14314         *)      dflt="$static_ext"
14315                 # Perhaps we are reusing an old out-of-date config.sh.
14316                 case "$hint" in
14317                 previous)
14318                         if test X"$static_ext" != X"$avail_ext"; then
14319                                 $cat <<EOM
14320 NOTICE:  Your previous config.sh list may be incorrect. 
14321 The extensions now available to you are 
14322         ${avail_ext}
14323 but the default list from your previous config.sh is
14324         ${static_ext} 
14325
14326 EOM
14327                         fi
14328                         ;;
14329                 esac
14330                 ;;
14331         esac
14332         : Exclude those that are not xs extensions
14333         case "$dflt" in
14334         '')     dflt=none;;
14335         esac
14336         rp="What extensions do you wish to include?"
14337         . ./myread
14338         case "$ans" in
14339         none) static_ext=' ' ;;
14340         *) static_ext="$ans" ;;
14341         esac
14342         ;;
14343 esac
14344
14345 set X $dynamic_ext $static_ext $nonxs_ext
14346 shift
14347 extensions="$*"
14348
14349 : Remove build directory name from cppstdin so it can be used from
14350 : either the present location or the final installed location.
14351 echo " "
14352 : Get out of the UU directory to get correct path name.
14353 cd ..
14354 case "$cppstdin" in
14355 `pwd`/cppstdin)
14356         echo "Stripping down cppstdin path name"
14357         cppstdin=cppstdin
14358         ;;
14359 esac
14360 cd UU
14361
14362 : end of configuration questions
14363 echo " "
14364 echo "End of configuration questions."
14365 echo " "
14366
14367 : back to where it started
14368 if test -d ../UU; then
14369         cd ..
14370 fi
14371
14372 : configuration may be patched via a 'config.over' file
14373 if $test -f config.over; then
14374         echo " "
14375         dflt=y
14376         rp='I see a config.over file.  Do you wish to load it?'
14377         . UU/myread
14378         case "$ans" in
14379         n*) echo "OK, I'll ignore it.";;
14380         *)      . ./config.over
14381                 echo "Configuration override changes have been loaded."
14382                 ;;
14383         esac
14384 fi
14385
14386 : in case they want portability, strip down executable paths
14387 case "$d_portable" in
14388 "$define")
14389         echo " "
14390         echo "Stripping down executable paths..." >&4
14391         for file in $loclist $trylist; do
14392                 eval temp=\$$file
14393                 eval $file=`basename $temp`
14394         done
14395         ;;
14396 esac
14397
14398 : create config.sh file
14399 echo " "
14400 echo "Creating config.sh..." >&4
14401 $spitshell <<EOT >config.sh
14402 $startsh
14403 #
14404 # This file was produced by running the Configure script. It holds all the
14405 # definitions figured out by Configure. Should you modify one of these values,
14406 # do not forget to propagate your changes by running "Configure -der". You may
14407 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14408 #
14409
14410 # Package name      : $package
14411 # Source directory  : $src
14412 # Configuration time: $cf_time
14413 # Configured by     : $cf_by
14414 # Target system     : $myuname
14415
14416 Author='$Author'
14417 Date='$Date'
14418 Header='$Header'
14419 Id='$Id'
14420 Locker='$Locker'
14421 Log='$Log'
14422 Mcc='$Mcc'
14423 RCSfile='$RCSfile'
14424 Revision='$Revision'
14425 Source='$Source'
14426 State='$State'
14427 _a='$_a'
14428 _exe='$_exe'
14429 _o='$_o'
14430 afs='$afs'
14431 alignbytes='$alignbytes'
14432 ansi2knr='$ansi2knr'
14433 aphostname='$aphostname'
14434 api_revision='$api_revision'
14435 api_subversion='$api_subversion'
14436 api_version='$api_version'
14437 api_versionstring='$api_versionstring'
14438 ar='$ar'
14439 archlib='$archlib'
14440 archlibexp='$archlibexp'
14441 archname64='$archname64'
14442 archname='$archname'
14443 archobjs='$archobjs'
14444 awk='$awk'
14445 baserev='$baserev'
14446 bash='$bash'
14447 bin='$bin'
14448 bincompat5005='$bincompat5005'
14449 binexp='$binexp'
14450 bison='$bison'
14451 byacc='$byacc'
14452 byteorder='$byteorder'
14453 c='$c'
14454 castflags='$castflags'
14455 cat='$cat'
14456 cc='$cc'
14457 cccdlflags='$cccdlflags'
14458 ccdlflags='$ccdlflags'
14459 ccflags='$ccflags'
14460 ccsymbols='$ccsymbols'
14461 cf_by='$cf_by'
14462 cf_email='$cf_email'
14463 cf_time='$cf_time'
14464 charsize='$charsize'
14465 chgrp='$chgrp'
14466 chmod='$chmod'
14467 chown='$chown'
14468 clocktype='$clocktype'
14469 comm='$comm'
14470 compress='$compress'
14471 contains='$contains'
14472 cp='$cp'
14473 cpio='$cpio'
14474 cpp='$cpp'
14475 cpp_stuff='$cpp_stuff'
14476 cppccsymbols='$cppccsymbols'
14477 cppflags='$cppflags'
14478 cpplast='$cpplast'
14479 cppminus='$cppminus'
14480 cpprun='$cpprun'
14481 cppstdin='$cppstdin'
14482 cppsymbols='$cppsymbols'
14483 crosscompile='$crosscompile'
14484 cryptlib='$cryptlib'
14485 csh='$csh'
14486 d_Gconvert='$d_Gconvert'
14487 d_PRIEldbl='$d_PRIEldbl'
14488 d_PRIFldbl='$d_PRIFldbl'
14489 d_PRIGldbl='$d_PRIGldbl'
14490 d_PRIX64='$d_PRIX64'
14491 d_PRId64='$d_PRId64'
14492 d_PRIeldbl='$d_PRIeldbl'
14493 d_PRIfldbl='$d_PRIfldbl'
14494 d_PRIgldbl='$d_PRIgldbl'
14495 d_PRIi64='$d_PRIi64'
14496 d_PRIo64='$d_PRIo64'
14497 d_PRIu64='$d_PRIu64'
14498 d_PRIx64='$d_PRIx64'
14499 d_access='$d_access'
14500 d_accessx='$d_accessx'
14501 d_alarm='$d_alarm'
14502 d_archlib='$d_archlib'
14503 d_atolf='$d_atolf'
14504 d_atoll='$d_atoll'
14505 d_attribut='$d_attribut'
14506 d_bcmp='$d_bcmp'
14507 d_bcopy='$d_bcopy'
14508 d_bincompat5005='$d_bincompat5005'
14509 d_bsd='$d_bsd'
14510 d_bsdgetpgrp='$d_bsdgetpgrp'
14511 d_bsdsetpgrp='$d_bsdsetpgrp'
14512 d_bzero='$d_bzero'
14513 d_casti32='$d_casti32'
14514 d_castneg='$d_castneg'
14515 d_charvspr='$d_charvspr'
14516 d_chown='$d_chown'
14517 d_chroot='$d_chroot'
14518 d_chsize='$d_chsize'
14519 d_closedir='$d_closedir'
14520 d_const='$d_const'
14521 d_crypt='$d_crypt'
14522 d_csh='$d_csh'
14523 d_cuserid='$d_cuserid'
14524 d_dbl_dig='$d_dbl_dig'
14525 d_difftime='$d_difftime'
14526 d_dirnamlen='$d_dirnamlen'
14527 d_dlerror='$d_dlerror'
14528 d_dlopen='$d_dlopen'
14529 d_dlsymun='$d_dlsymun'
14530 d_dosuid='$d_dosuid'
14531 d_drand48proto='$d_drand48proto'
14532 d_dup2='$d_dup2'
14533 d_eaccess='$d_eaccess'
14534 d_endgrent='$d_endgrent'
14535 d_endhent='$d_endhent'
14536 d_endnent='$d_endnent'
14537 d_endpent='$d_endpent'
14538 d_endpwent='$d_endpwent'
14539 d_endsent='$d_endsent'
14540 d_endspent='$d_endspent'
14541 d_eofnblk='$d_eofnblk'
14542 d_eunice='$d_eunice'
14543 d_fchmod='$d_fchmod'
14544 d_fchown='$d_fchown'
14545 d_fcntl='$d_fcntl'
14546 d_fd_macros='$d_fd_macros'
14547 d_fd_set='$d_fd_set'
14548 d_fds_bits='$d_fds_bits'
14549 d_fgetpos='$d_fgetpos'
14550 d_flexfnam='$d_flexfnam'
14551 d_flock='$d_flock'
14552 d_fork='$d_fork'
14553 d_fpathconf='$d_fpathconf'
14554 d_fpos64_t='$d_fpos64_t'
14555 d_fs_data_s='$d_fs_data_s'
14556 d_fseeko='$d_fseeko'
14557 d_fsetpos='$d_fsetpos'
14558 d_fstatfs='$d_fstatfs'
14559 d_fstatvfs='$d_fstatvfs'
14560 d_ftello='$d_ftello'
14561 d_ftime='$d_ftime'
14562 d_getgrent='$d_getgrent'
14563 d_getgrps='$d_getgrps'
14564 d_gethbyaddr='$d_gethbyaddr'
14565 d_gethbyname='$d_gethbyname'
14566 d_gethent='$d_gethent'
14567 d_gethname='$d_gethname'
14568 d_gethostprotos='$d_gethostprotos'
14569 d_getlogin='$d_getlogin'
14570 d_getmnt='$d_getmnt'
14571 d_getmntent='$d_getmntent'
14572 d_getnbyaddr='$d_getnbyaddr'
14573 d_getnbyname='$d_getnbyname'
14574 d_getnent='$d_getnent'
14575 d_getnetprotos='$d_getnetprotos'
14576 d_getpbyname='$d_getpbyname'
14577 d_getpbynumber='$d_getpbynumber'
14578 d_getpent='$d_getpent'
14579 d_getpgid='$d_getpgid'
14580 d_getpgrp2='$d_getpgrp2'
14581 d_getpgrp='$d_getpgrp'
14582 d_getppid='$d_getppid'
14583 d_getprior='$d_getprior'
14584 d_getprotoprotos='$d_getprotoprotos'
14585 d_getpwent='$d_getpwent'
14586 d_getsbyname='$d_getsbyname'
14587 d_getsbyport='$d_getsbyport'
14588 d_getsent='$d_getsent'
14589 d_getservprotos='$d_getservprotos'
14590 d_getspent='$d_getspent'
14591 d_getspnam='$d_getspnam'
14592 d_gettimeod='$d_gettimeod'
14593 d_gnulibc='$d_gnulibc'
14594 d_grpasswd='$d_grpasswd'
14595 d_hasmntopt='$d_hasmntopt'
14596 d_htonl='$d_htonl'
14597 d_iconv='$d_iconv'
14598 d_index='$d_index'
14599 d_inetaton='$d_inetaton'
14600 d_int64t='$d_int64t'
14601 d_isascii='$d_isascii'
14602 d_killpg='$d_killpg'
14603 d_lchown='$d_lchown'
14604 d_ldbl_dig='$d_ldbl_dig'
14605 d_link='$d_link'
14606 d_locconv='$d_locconv'
14607 d_lockf='$d_lockf'
14608 d_longdbl='$d_longdbl'
14609 d_longlong='$d_longlong'
14610 d_lstat='$d_lstat'
14611 d_mblen='$d_mblen'
14612 d_mbstowcs='$d_mbstowcs'
14613 d_mbtowc='$d_mbtowc'
14614 d_memchr='$d_memchr'
14615 d_memcmp='$d_memcmp'
14616 d_memcpy='$d_memcpy'
14617 d_memmove='$d_memmove'
14618 d_memset='$d_memset'
14619 d_mkdir='$d_mkdir'
14620 d_mkfifo='$d_mkfifo'
14621 d_mktime='$d_mktime'
14622 d_msg='$d_msg'
14623 d_msg_ctrunc='$d_msg_ctrunc'
14624 d_msg_dontroute='$d_msg_dontroute'
14625 d_msg_oob='$d_msg_oob'
14626 d_msg_peek='$d_msg_peek'
14627 d_msg_proxy='$d_msg_proxy'
14628 d_msgctl='$d_msgctl'
14629 d_msgget='$d_msgget'
14630 d_msgrcv='$d_msgrcv'
14631 d_msgsnd='$d_msgsnd'
14632 d_mymalloc='$d_mymalloc'
14633 d_nice='$d_nice'
14634 d_nv_preserves_uv='$d_nv_preserves_uv'
14635 d_off64_t='$d_off64_t'
14636 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14637 d_oldpthreads='$d_oldpthreads'
14638 d_oldsock='$d_oldsock'
14639 d_open3='$d_open3'
14640 d_pathconf='$d_pathconf'
14641 d_pause='$d_pause'
14642 d_phostname='$d_phostname'
14643 d_pipe='$d_pipe'
14644 d_poll='$d_poll'
14645 d_portable='$d_portable'
14646 d_pthread_yield='$d_pthread_yield'
14647 d_pwage='$d_pwage'
14648 d_pwchange='$d_pwchange'
14649 d_pwclass='$d_pwclass'
14650 d_pwcomment='$d_pwcomment'
14651 d_pwexpire='$d_pwexpire'
14652 d_pwgecos='$d_pwgecos'
14653 d_pwpasswd='$d_pwpasswd'
14654 d_pwquota='$d_pwquota'
14655 d_quad='$d_quad'
14656 d_readdir='$d_readdir'
14657 d_readlink='$d_readlink'
14658 d_rename='$d_rename'
14659 d_rewinddir='$d_rewinddir'
14660 d_rmdir='$d_rmdir'
14661 d_safebcpy='$d_safebcpy'
14662 d_safemcpy='$d_safemcpy'
14663 d_sanemcmp='$d_sanemcmp'
14664 d_sched_yield='$d_sched_yield'
14665 d_scm_rights='$d_scm_rights'
14666 d_seekdir='$d_seekdir'
14667 d_select='$d_select'
14668 d_sem='$d_sem'
14669 d_semctl='$d_semctl'
14670 d_semctl_semid_ds='$d_semctl_semid_ds'
14671 d_semctl_semun='$d_semctl_semun'
14672 d_semget='$d_semget'
14673 d_semop='$d_semop'
14674 d_setegid='$d_setegid'
14675 d_seteuid='$d_seteuid'
14676 d_setgrent='$d_setgrent'
14677 d_setgrps='$d_setgrps'
14678 d_sethent='$d_sethent'
14679 d_setlinebuf='$d_setlinebuf'
14680 d_setlocale='$d_setlocale'
14681 d_setnent='$d_setnent'
14682 d_setpent='$d_setpent'
14683 d_setpgid='$d_setpgid'
14684 d_setpgrp2='$d_setpgrp2'
14685 d_setpgrp='$d_setpgrp'
14686 d_setprior='$d_setprior'
14687 d_setpwent='$d_setpwent'
14688 d_setregid='$d_setregid'
14689 d_setresgid='$d_setresgid'
14690 d_setresuid='$d_setresuid'
14691 d_setreuid='$d_setreuid'
14692 d_setrgid='$d_setrgid'
14693 d_setruid='$d_setruid'
14694 d_setsent='$d_setsent'
14695 d_setsid='$d_setsid'
14696 d_setspent='$d_setspent'
14697 d_setvbuf='$d_setvbuf'
14698 d_sfio='$d_sfio'
14699 d_shm='$d_shm'
14700 d_shmat='$d_shmat'
14701 d_shmatprototype='$d_shmatprototype'
14702 d_shmctl='$d_shmctl'
14703 d_shmdt='$d_shmdt'
14704 d_shmget='$d_shmget'
14705 d_sigaction='$d_sigaction'
14706 d_sigsetjmp='$d_sigsetjmp'
14707 d_socket='$d_socket'
14708 d_sockpair='$d_sockpair'
14709 d_sqrtl='$d_sqrtl'
14710 d_statblks='$d_statblks'
14711 d_statfs_f_flags='$d_statfs_f_flags'
14712 d_statfs_s='$d_statfs_s'
14713 d_statvfs='$d_statvfs'
14714 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14715 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14716 d_stdio_stream_array='$d_stdio_stream_array'
14717 d_stdiobase='$d_stdiobase'
14718 d_stdstdio='$d_stdstdio'
14719 d_strchr='$d_strchr'
14720 d_strcoll='$d_strcoll'
14721 d_strctcpy='$d_strctcpy'
14722 d_strerrm='$d_strerrm'
14723 d_strerror='$d_strerror'
14724 d_strtod='$d_strtod'
14725 d_strtol='$d_strtol'
14726 d_strtold='$d_strtold'
14727 d_strtoll='$d_strtoll'
14728 d_strtoul='$d_strtoul'
14729 d_strtoull='$d_strtoull'
14730 d_strtouq='$d_strtouq'
14731 d_strxfrm='$d_strxfrm'
14732 d_suidsafe='$d_suidsafe'
14733 d_symlink='$d_symlink'
14734 d_syscall='$d_syscall'
14735 d_sysconf='$d_sysconf'
14736 d_sysernlst='$d_sysernlst'
14737 d_syserrlst='$d_syserrlst'
14738 d_system='$d_system'
14739 d_tcgetpgrp='$d_tcgetpgrp'
14740 d_tcsetpgrp='$d_tcsetpgrp'
14741 d_telldir='$d_telldir'
14742 d_telldirproto='$d_telldirproto'
14743 d_time='$d_time'
14744 d_times='$d_times'
14745 d_truncate='$d_truncate'
14746 d_tzname='$d_tzname'
14747 d_umask='$d_umask'
14748 d_uname='$d_uname'
14749 d_union_semun='$d_union_semun'
14750 d_ustat='$d_ustat'
14751 d_vendorbin='$d_vendorbin'
14752 d_vendorlib='$d_vendorlib'
14753 d_vfork='$d_vfork'
14754 d_void_closedir='$d_void_closedir'
14755 d_voidsig='$d_voidsig'
14756 d_voidtty='$d_voidtty'
14757 d_volatile='$d_volatile'
14758 d_vprintf='$d_vprintf'
14759 d_wait4='$d_wait4'
14760 d_waitpid='$d_waitpid'
14761 d_wcstombs='$d_wcstombs'
14762 d_wctomb='$d_wctomb'
14763 d_xenix='$d_xenix'
14764 date='$date'
14765 db_hashtype='$db_hashtype'
14766 db_prefixtype='$db_prefixtype'
14767 defvoidused='$defvoidused'
14768 direntrytype='$direntrytype'
14769 dlext='$dlext'
14770 dlsrc='$dlsrc'
14771 doublesize='$doublesize'
14772 drand01='$drand01'
14773 dynamic_ext='$dynamic_ext'
14774 eagain='$eagain'
14775 ebcdic='$ebcdic'
14776 echo='$echo'
14777 egrep='$egrep'
14778 emacs='$emacs'
14779 eunicefix='$eunicefix'
14780 exe_ext='$exe_ext'
14781 expr='$expr'
14782 extensions='$extensions'
14783 fflushNULL='$fflushNULL'
14784 fflushall='$fflushall'
14785 find='$find'
14786 firstmakefile='$firstmakefile'
14787 flex='$flex'
14788 fpossize='$fpossize'
14789 fpostype='$fpostype'
14790 freetype='$freetype'
14791 full_ar='$full_ar'
14792 full_csh='$full_csh'
14793 full_sed='$full_sed'
14794 gccversion='$gccversion'
14795 gidformat='$gidformat'
14796 gidsign='$gidsign'
14797 gidsize='$gidsize'
14798 gidtype='$gidtype'
14799 glibpth='$glibpth'
14800 grep='$grep'
14801 groupcat='$groupcat'
14802 groupstype='$groupstype'
14803 gzip='$gzip'
14804 h_fcntl='$h_fcntl'
14805 h_sysfile='$h_sysfile'
14806 hint='$hint'
14807 hostcat='$hostcat'
14808 huge='$huge'
14809 i16size='$i16size'
14810 i16type='$i16type'
14811 i32size='$i32size'
14812 i32type='$i32type'
14813 i64size='$i64size'
14814 i64type='$i64type'
14815 i8size='$i8size'
14816 i8type='$i8type'
14817 i_arpainet='$i_arpainet'
14818 i_bsdioctl='$i_bsdioctl'
14819 i_db='$i_db'
14820 i_dbm='$i_dbm'
14821 i_dirent='$i_dirent'
14822 i_dld='$i_dld'
14823 i_dlfcn='$i_dlfcn'
14824 i_fcntl='$i_fcntl'
14825 i_float='$i_float'
14826 i_gdbm='$i_gdbm'
14827 i_grp='$i_grp'
14828 i_iconv='$i_iconv'
14829 i_inttypes='$i_inttypes'
14830 i_limits='$i_limits'
14831 i_locale='$i_locale'
14832 i_machcthr='$i_machcthr'
14833 i_malloc='$i_malloc'
14834 i_math='$i_math'
14835 i_memory='$i_memory'
14836 i_mntent='$i_mntent'
14837 i_ndbm='$i_ndbm'
14838 i_netdb='$i_netdb'
14839 i_neterrno='$i_neterrno'
14840 i_netinettcp='$i_netinettcp'
14841 i_niin='$i_niin'
14842 i_poll='$i_poll'
14843 i_pthread='$i_pthread'
14844 i_pwd='$i_pwd'
14845 i_rpcsvcdbm='$i_rpcsvcdbm'
14846 i_sfio='$i_sfio'
14847 i_sgtty='$i_sgtty'
14848 i_shadow='$i_shadow'
14849 i_socks='$i_socks'
14850 i_stdarg='$i_stdarg'
14851 i_stddef='$i_stddef'
14852 i_stdlib='$i_stdlib'
14853 i_string='$i_string'
14854 i_sysaccess='$i_sysaccess'
14855 i_sysdir='$i_sysdir'
14856 i_sysfile='$i_sysfile'
14857 i_sysfilio='$i_sysfilio'
14858 i_sysin='$i_sysin'
14859 i_sysioctl='$i_sysioctl'
14860 i_sysmount='$i_sysmount'
14861 i_sysndir='$i_sysndir'
14862 i_sysparam='$i_sysparam'
14863 i_sysresrc='$i_sysresrc'
14864 i_syssecrt='$i_syssecrt'
14865 i_sysselct='$i_sysselct'
14866 i_syssockio='$i_syssockio'
14867 i_sysstat='$i_sysstat'
14868 i_sysstatfs='$i_sysstatfs'
14869 i_sysstatvfs='$i_sysstatvfs'
14870 i_systime='$i_systime'
14871 i_systimek='$i_systimek'
14872 i_systimes='$i_systimes'
14873 i_systypes='$i_systypes'
14874 i_sysuio='$i_sysuio'
14875 i_sysun='$i_sysun'
14876 i_sysvfs='$i_sysvfs'
14877 i_syswait='$i_syswait'
14878 i_termio='$i_termio'
14879 i_termios='$i_termios'
14880 i_time='$i_time'
14881 i_unistd='$i_unistd'
14882 i_ustat='$i_ustat'
14883 i_utime='$i_utime'
14884 i_values='$i_values'
14885 i_varargs='$i_varargs'
14886 i_varhdr='$i_varhdr'
14887 i_vfork='$i_vfork'
14888 ignore_versioned_solibs='$ignore_versioned_solibs'
14889 inc_version_list='$inc_version_list'
14890 inc_version_list_init='$inc_version_list_init'
14891 incpath='$incpath'
14892 inews='$inews'
14893 installarchlib='$installarchlib'
14894 installbin='$installbin'
14895 installman1dir='$installman1dir'
14896 installman3dir='$installman3dir'
14897 installprefix='$installprefix'
14898 installprefixexp='$installprefixexp'
14899 installprivlib='$installprivlib'
14900 installscript='$installscript'
14901 installsitearch='$installsitearch'
14902 installsitebin='$installsitebin'
14903 installsitelib='$installsitelib'
14904 installstyle='$installstyle'
14905 installusrbinperl='$installusrbinperl'
14906 installvendorbin='$installvendorbin'
14907 installvendorlib='$installvendorlib'
14908 intsize='$intsize'
14909 ivdformat='$ivdformat'
14910 ivsize='$ivsize'
14911 ivtype='$ivtype'
14912 known_extensions='$known_extensions'
14913 ksh='$ksh'
14914 large='$large'
14915 ld='$ld'
14916 lddlflags='$lddlflags'
14917 ldflags='$ldflags'
14918 ldlibpthname='$ldlibpthname'
14919 less='$less'
14920 lib_ext='$lib_ext'
14921 libc='$libc'
14922 libperl='$libperl'
14923 libpth='$libpth'
14924 libs='$libs'
14925 libsdirs='$libsdirs'
14926 libsfiles='$libsfiles'
14927 libsfound='$libsfound'
14928 libswanted='$libswanted'
14929 line='$line'
14930 lint='$lint'
14931 lkflags='$lkflags'
14932 ln='$ln'
14933 lns='$lns'
14934 locincpth='$locincpth'
14935 loclibpth='$loclibpth'
14936 longdblsize='$longdblsize'
14937 longlongsize='$longlongsize'
14938 longsize='$longsize'
14939 lp='$lp'
14940 lpr='$lpr'
14941 ls='$ls'
14942 lseeksize='$lseeksize'
14943 lseektype='$lseektype'
14944 mail='$mail'
14945 mailx='$mailx'
14946 make='$make'
14947 make_set_make='$make_set_make'
14948 mallocobj='$mallocobj'
14949 mallocsrc='$mallocsrc'
14950 malloctype='$malloctype'
14951 man1dir='$man1dir'
14952 man1direxp='$man1direxp'
14953 man1ext='$man1ext'
14954 man3dir='$man3dir'
14955 man3direxp='$man3direxp'
14956 man3ext='$man3ext'
14957 medium='$medium'
14958 mips_type='$mips_type'
14959 mkdir='$mkdir'
14960 models='$models'
14961 modetype='$modetype'
14962 more='$more'
14963 multiarch='$multiarch'
14964 mv='$mv'
14965 myarchname='$myarchname'
14966 mydomain='$mydomain'
14967 myhostname='$myhostname'
14968 myuname='$myuname'
14969 n='$n'
14970 netdb_hlen_type='$netdb_hlen_type'
14971 netdb_host_type='$netdb_host_type'
14972 netdb_name_type='$netdb_name_type'
14973 netdb_net_type='$netdb_net_type'
14974 nm='$nm'
14975 nm_opt='$nm_opt'
14976 nm_so_opt='$nm_so_opt'
14977 nonxs_ext='$nonxs_ext'
14978 nroff='$nroff'
14979 nvsize='$nvsize'
14980 nvtype='$nvtype'
14981 o_nonblock='$o_nonblock'
14982 obj_ext='$obj_ext'
14983 old_pthread_create_joinable='$old_pthread_create_joinable'
14984 optimize='$optimize'
14985 orderlib='$orderlib'
14986 osname='$osname'
14987 osvers='$osvers'
14988 package='$package'
14989 pager='$pager'
14990 passcat='$passcat'
14991 patchlevel='$patchlevel'
14992 path_sep='$path_sep'
14993 perl='$perl'
14994 perladmin='$perladmin'
14995 perlpath='$perlpath'
14996 pg='$pg'
14997 phostname='$phostname'
14998 pidtype='$pidtype'
14999 plibpth='$plibpth'
15000 pmake='$pmake'
15001 pr='$pr'
15002 prefix='$prefix'
15003 prefixexp='$prefixexp'
15004 privlib='$privlib'
15005 privlibexp='$privlibexp'
15006 prototype='$prototype'
15007 ptrsize='$ptrsize'
15008 quadkind='$quadkind'
15009 quadtype='$quadtype'
15010 randbits='$randbits'
15011 randfunc='$randfunc'
15012 randseedtype='$randseedtype'
15013 ranlib='$ranlib'
15014 rd_nodata='$rd_nodata'
15015 rm='$rm'
15016 rmail='$rmail'
15017 runnm='$runnm'
15018 sPRIEldbl='$sPRIEldbl'
15019 sPRIFldbl='$sPRIFldbl'
15020 sPRIGldbl='$sPRIGldbl'
15021 sPRIX64='$sPRIX64'
15022 sPRId64='$sPRId64'
15023 sPRIeldbl='$sPRIeldbl'
15024 sPRIfldbl='$sPRIfldbl'
15025 sPRIgldbl='$sPRIgldbl'
15026 sPRIi64='$sPRIi64'
15027 sPRIo64='$sPRIo64'
15028 sPRIu64='$sPRIu64'
15029 sPRIx64='$sPRIx64'
15030 sched_yield='$sched_yield'
15031 scriptdir='$scriptdir'
15032 scriptdirexp='$scriptdirexp'
15033 sed='$sed'
15034 seedfunc='$seedfunc'
15035 selectminbits='$selectminbits'
15036 selecttype='$selecttype'
15037 sendmail='$sendmail'
15038 sh='$sh'
15039 shar='$shar'
15040 sharpbang='$sharpbang'
15041 shmattype='$shmattype'
15042 shortsize='$shortsize'
15043 shrpenv='$shrpenv'
15044 shsharp='$shsharp'
15045 sig_count='$sig_count'
15046 sig_name='$sig_name'
15047 sig_name_init='$sig_name_init'
15048 sig_num='$sig_num'
15049 sig_num_init='$sig_num_init'
15050 signal_t='$signal_t'
15051 sitearch='$sitearch'
15052 sitearchexp='$sitearchexp'
15053 sitebin='$sitebin'
15054 sitebinexp='$sitebinexp'
15055 sitelib='$sitelib'
15056 sitelibexp='$sitelibexp'
15057 siteprefix='$siteprefix'
15058 siteprefixexp='$siteprefixexp'
15059 sizetype='$sizetype'
15060 sleep='$sleep'
15061 smail='$smail'
15062 small='$small'
15063 so='$so'
15064 sockethdr='$sockethdr'
15065 socketlib='$socketlib'
15066 sort='$sort'
15067 spackage='$spackage'
15068 spitshell='$spitshell'
15069 split='$split'
15070 src='$src'
15071 ssizetype='$ssizetype'
15072 startperl='$startperl'
15073 startsh='$startsh'
15074 static_ext='$static_ext'
15075 stdchar='$stdchar'
15076 stdio_base='$stdio_base'
15077 stdio_bufsiz='$stdio_bufsiz'
15078 stdio_cnt='$stdio_cnt'
15079 stdio_filbuf='$stdio_filbuf'
15080 stdio_ptr='$stdio_ptr'
15081 stdio_stream_array='$stdio_stream_array'
15082 strings='$strings'
15083 submit='$submit'
15084 subversion='$subversion'
15085 sysman='$sysman'
15086 tail='$tail'
15087 tar='$tar'
15088 tbl='$tbl'
15089 tee='$tee'
15090 test='$test'
15091 timeincl='$timeincl'
15092 timetype='$timetype'
15093 touch='$touch'
15094 tr='$tr'
15095 trnl='$trnl'
15096 troff='$troff'
15097 u16size='$u16size'
15098 u16type='$u16type'
15099 u32size='$u32size'
15100 u32type='$u32type'
15101 u64size='$u64size'
15102 u64type='$u64type'
15103 u8size='$u8size'
15104 u8type='$u8type'
15105 uidformat='$uidformat'
15106 uidsign='$uidsign'
15107 uidsize='$uidsize'
15108 uidtype='$uidtype'
15109 uname='$uname'
15110 uniq='$uniq'
15111 uquadtype='$uquadtype'
15112 use5005threads='$use5005threads'
15113 use64bits='$use64bits'
15114 usedl='$usedl'
15115 useithreads='$useithreads'
15116 uselargefiles='$uselargefiles'
15117 uselongdouble='$uselongdouble'
15118 uselonglong='$uselonglong'
15119 usemorebits='$usemorebits'
15120 usemultiplicity='$usemultiplicity'
15121 usemymalloc='$usemymalloc'
15122 usenm='$usenm'
15123 useopcode='$useopcode'
15124 useperlio='$useperlio'
15125 useposix='$useposix'
15126 usesfio='$usesfio'
15127 useshrplib='$useshrplib'
15128 usesocks='$usesocks'
15129 usethreads='$usethreads'
15130 usevendorprefix='$usevendorprefix'
15131 usevfork='$usevfork'
15132 usrinc='$usrinc'
15133 uuname='$uuname'
15134 uvoformat='$uvoformat'
15135 uvsize='$uvsize'
15136 uvtype='$uvtype'
15137 uvuformat='$uvuformat'
15138 uvxformat='$uvxformat'
15139 vendorbin='$vendorbin'
15140 vendorbinexp='$vendorbinexp'
15141 vendorlib='$vendorlib'
15142 vendorlibexp='$vendorlibexp'
15143 vendorprefix='$vendorprefix'
15144 vendorprefixexp='$vendorprefixexp'
15145 version='$version'
15146 vi='$vi'
15147 voidflags='$voidflags'
15148 xlibpth='$xlibpth'
15149 zcat='$zcat'
15150 zip='$zip'
15151 EOT
15152
15153 : Add in command line options if available
15154 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15155
15156 : add special variables
15157 $test -f $src/patchlevel.h && \
15158 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15159 echo "CONFIGDOTSH=true" >>config.sh
15160
15161 : propagate old symbols
15162 if $test -f UU/config.sh; then
15163         <UU/config.sh sort | uniq >UU/oldconfig.sh
15164         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15165         sort | uniq -u >UU/oldsyms
15166         set X `cat UU/oldsyms`
15167         shift
15168         case $# in
15169         0) ;;
15170         *)
15171                 cat <<EOM
15172 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15173 EOM
15174                 echo "# Variables propagated from previous config.sh file." >>config.sh
15175                 for sym in `cat UU/oldsyms`; do
15176                         echo "    Propagating $hint variable "'$'"$sym..."
15177                         eval 'tmp="$'"${sym}"'"'
15178                         echo "$tmp" | \
15179                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15180                 done
15181                 ;;
15182         esac
15183 fi
15184
15185 : Finish up by extracting the .SH files
15186 case "$alldone" in
15187 exit)
15188         $rm -rf UU
15189         echo "Done."
15190         exit 0
15191         ;;
15192 cont)
15193         ;;
15194 '')
15195         dflt=''
15196         nostick=true
15197         $cat <<EOM
15198
15199 If you'd like to make any changes to the config.sh file before I begin
15200 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15201
15202 EOM
15203         rp="Press return or use a shell escape to edit config.sh:"
15204         . UU/myread
15205         nostick=''
15206         case "$ans" in
15207         '') ;;
15208         *) : in case they cannot read
15209                 sh 1>&4 -c "$ans";;
15210         esac
15211         ;;
15212 esac
15213
15214 : if this fails, just run all the .SH files by hand
15215 . ./config.sh
15216
15217 echo " "
15218 exec 1>&4
15219 . ./UU/extract
15220
15221 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15222         dflt=y
15223         case "$silent" in
15224         true) ;;
15225         *)
15226                 $cat <<EOM
15227
15228 Now you need to generate make dependencies by running "$make depend".
15229 You might prefer to run it in background: "$make depend > makedepend.out &"
15230 It can take a while, so you might not want to run it right now.
15231
15232 EOM
15233                 ;;
15234         esac
15235         rp="Run $make depend now?"
15236         . UU/myread
15237         case "$ans" in
15238         y*)
15239                 $make depend && echo "Now you must run a $make."
15240                 ;;
15241         *)
15242                 echo "You must run '$make depend' then '$make'."
15243                 ;;
15244         esac
15245 elif test -f [Mm]akefile; then
15246         echo " "
15247         echo "Now you must run a $make."
15248 else
15249         echo "Done."
15250 fi
15251
15252 if $test -f Policy.sh; then
15253     $cat <<EOM
15254
15255 If you compile $package on a different machine or from a different object
15256 directory, copy the Policy.sh file from this object directory to the
15257 new one before you run Configure -- this will help you with most of
15258 the policy defaults.
15259
15260 EOM
15261 fi
15262 if $test -f config.msg; then
15263     echo "Hmm.  I also noted the following information while running:"
15264     echo " "
15265     $cat config.msg >&4
15266     $rm -f config.msg
15267 fi
15268 $rm -f kit*isdone ark*isdone
15269 $rm -rf UU
15270
15271 : End of Configure
15272