I don't think it's sensible or portable to test the strtou*
[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 Dec 15 19:53:39 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >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 >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 c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ 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 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigsetjmp=''
523 d_msg_ctrunc=''
524 d_msg_dontroute=''
525 d_msg_oob=''
526 d_msg_peek=''
527 d_msg_proxy=''
528 d_oldsock=''
529 d_scm_rights=''
530 d_socket=''
531 d_sockpair=''
532 sockethdr=''
533 socketlib=''
534 d_socklen_t=''
535 d_socks5_init=''
536 d_sqrtl=''
537 d_statblks=''
538 d_statfs_f_flags=''
539 d_statfs_s=''
540 d_fstatvfs=''
541 d_statvfs=''
542 d_stdio_cnt_lval=''
543 d_stdio_ptr_lval=''
544 d_stdio_ptr_lval_nochange_cnt=''
545 d_stdio_ptr_lval_sets_cnt=''
546 d_stdiobase=''
547 d_stdstdio=''
548 stdio_base=''
549 stdio_bufsiz=''
550 stdio_cnt=''
551 stdio_filbuf=''
552 stdio_ptr=''
553 d_index=''
554 d_strchr=''
555 d_strcoll=''
556 d_strctcpy=''
557 d_strerrm=''
558 d_strerror=''
559 d_sysernlst=''
560 d_syserrlst=''
561 d_strtod=''
562 d_strtol=''
563 d_strtold=''
564 d_strtoll=''
565 d_strtoul=''
566 d_strtoull=''
567 d_strtouq=''
568 d_strxfrm=''
569 d_symlink=''
570 d_syscall=''
571 d_sysconf=''
572 d_system=''
573 d_tcgetpgrp=''
574 d_tcsetpgrp=''
575 d_telldirproto=''
576 d_time=''
577 timetype=''
578 clocktype=''
579 d_times=''
580 d_truncate=''
581 d_tzname=''
582 d_umask=''
583 d_semctl_semid_ds=''
584 d_semctl_semun=''
585 d_union_semun=''
586 d_ustat=''
587 d_vfork=''
588 usevfork=''
589 d_voidsig=''
590 signal_t=''
591 d_volatile=''
592 d_charvspr=''
593 d_vprintf=''
594 d_wait4=''
595 d_waitpid=''
596 d_wcstombs=''
597 d_wctomb=''
598 dlext=''
599 cccdlflags=''
600 ccdlflags=''
601 dlsrc=''
602 ld=''
603 lddlflags=''
604 usedl=''
605 doublesize=''
606 ebcdic=''
607 fflushNULL=''
608 fflushall=''
609 fpossize=''
610 fpostype=''
611 gccosandvers=''
612 gccversion=''
613 gidformat=''
614 gidsign=''
615 gidsize=''
616 gidtype=''
617 groupstype=''
618 h_fcntl=''
619 h_sysfile=''
620 i_arpainet=''
621 db_hashtype=''
622 db_prefixtype=''
623 i_db=''
624 i_dbm=''
625 i_rpcsvcdbm=''
626 d_dirnamlen=''
627 direntrytype=''
628 i_dirent=''
629 i_dld=''
630 i_dlfcn=''
631 i_fcntl=''
632 i_float=''
633 i_gdbm=''
634 d_grpasswd=''
635 i_grp=''
636 i_iconv=''
637 i_ieeefp=''
638 i_inttypes=''
639 i_libutil=''
640 i_limits=''
641 i_locale=''
642 i_machcthr=''
643 i_malloc=''
644 i_math=''
645 i_memory=''
646 i_mntent=''
647 i_ndbm=''
648 i_netdb=''
649 i_neterrno=''
650 i_netinettcp=''
651 i_niin=''
652 i_sysin=''
653 i_poll=''
654 i_prot=''
655 i_pthread=''
656 d_pwage=''
657 d_pwchange=''
658 d_pwclass=''
659 d_pwcomment=''
660 d_pwexpire=''
661 d_pwgecos=''
662 d_pwpasswd=''
663 d_pwquota=''
664 i_pwd=''
665 i_sfio=''
666 i_shadow=''
667 i_socks=''
668 i_stddef=''
669 i_stdlib=''
670 i_string=''
671 strings=''
672 i_sunmath=''
673 i_sysaccess=''
674 i_sysdir=''
675 i_sysfile=''
676 d_voidtty=''
677 i_bsdioctl=''
678 i_sysfilio=''
679 i_sysioctl=''
680 i_syssockio=''
681 i_syslog=''
682 i_sysmman=''
683 i_sysmode=''
684 i_sysmount=''
685 i_sysndir=''
686 i_sysparam=''
687 i_sysresrc=''
688 i_syssecrt=''
689 i_sysselct=''
690 i_sysstat=''
691 i_sysstatfs=''
692 i_sysstatvfs=''
693 i_systimes=''
694 i_systypes=''
695 i_sysuio=''
696 i_sysun=''
697 i_sysutsname=''
698 i_sysvfs=''
699 i_syswait=''
700 i_sgtty=''
701 i_termio=''
702 i_termios=''
703 i_systime=''
704 i_systimek=''
705 i_time=''
706 timeincl=''
707 i_unistd=''
708 i_ustat=''
709 i_utime=''
710 i_values=''
711 i_stdarg=''
712 i_varargs=''
713 i_varhdr=''
714 i_vfork=''
715 inc_version_list=''
716 inc_version_list_init=''
717 installprefix=''
718 installprefixexp=''
719 installstyle=''
720 installusrbinperl=''
721 intsize=''
722 longsize=''
723 shortsize=''
724 libc=''
725 ldlibpthname=''
726 libperl=''
727 shrpenv=''
728 useshrplib=''
729 glibpth=''
730 libpth=''
731 loclibpth=''
732 plibpth=''
733 xlibpth=''
734 ignore_versioned_solibs=''
735 libs=''
736 libsdirs=''
737 libsfiles=''
738 libsfound=''
739 libspath=''
740 lns=''
741 d_PRIEUldbl=''
742 d_PRIFUldbl=''
743 d_PRIGUldbl=''
744 d_PRIeldbl=''
745 d_PRIfldbl=''
746 d_PRIgldbl=''
747 d_SCNfldbl=''
748 sPRIEUldbl=''
749 sPRIFUldbl=''
750 sPRIGUldbl=''
751 sPRIeldbl=''
752 sPRIfldbl=''
753 sPRIgldbl=''
754 sSCNfldbl=''
755 lseeksize=''
756 lseektype=''
757 make_set_make=''
758 d_mymalloc=''
759 freetype=''
760 mallocobj=''
761 mallocsrc=''
762 malloctype=''
763 usemymalloc=''
764 installman1dir=''
765 man1dir=''
766 man1direxp=''
767 man1ext=''
768 installman3dir=''
769 man3dir=''
770 man3direxp=''
771 man3ext=''
772 modetype=''
773 multiarch=''
774 mydomain=''
775 myhostname=''
776 phostname=''
777 c=''
778 n=''
779 d_eofnblk=''
780 eagain=''
781 o_nonblock=''
782 rd_nodata=''
783 need_va_copy=''
784 netdb_hlen_type=''
785 netdb_host_type=''
786 netdb_name_type=''
787 netdb_net_type=''
788 groupcat=''
789 hostcat=''
790 passcat=''
791 orderlib=''
792 ranlib=''
793 d_perl_otherlibdirs=''
794 otherlibdirs=''
795 package=''
796 spackage=''
797 pager=''
798 api_revision=''
799 api_subversion=''
800 api_version=''
801 api_versionstring=''
802 patchlevel=''
803 revision=''
804 subversion=''
805 version=''
806 perl5=''
807 perladmin=''
808 perlpath=''
809 d_nv_preserves_uv=''
810 d_nv_preserves_uv_bits=''
811 i16size=''
812 i16type=''
813 i32size=''
814 i32type=''
815 i64size=''
816 i64type=''
817 i8size=''
818 i8type=''
819 ivsize=''
820 ivtype=''
821 nvsize=''
822 nvtype=''
823 u16size=''
824 u16type=''
825 u32size=''
826 u32type=''
827 u64size=''
828 u64type=''
829 u8size=''
830 u8type=''
831 uvsize=''
832 uvtype=''
833 ivdformat=''
834 nvEUformat=''
835 nvFUformat=''
836 nvGUformat=''
837 nveformat=''
838 nvfformat=''
839 nvgformat=''
840 uvXUformat=''
841 uvoformat=''
842 uvuformat=''
843 uvxformat=''
844 pidtype=''
845 prefix=''
846 prefixexp=''
847 installprivlib=''
848 privlib=''
849 privlibexp=''
850 prototype=''
851 ptrsize=''
852 d_PRIXU64=''
853 d_PRId64=''
854 d_PRIi64=''
855 d_PRIo64=''
856 d_PRIu64=''
857 d_PRIx64=''
858 sPRIXU64=''
859 sPRId64=''
860 sPRIi64=''
861 sPRIo64=''
862 sPRIu64=''
863 sPRIx64=''
864 d_quad=''
865 quadkind=''
866 quadtype=''
867 uquadtype=''
868 drand01=''
869 randbits=''
870 randfunc=''
871 randseedtype=''
872 seedfunc=''
873 installscript=''
874 scriptdir=''
875 scriptdirexp=''
876 selectminbits=''
877 selecttype=''
878 sh=''
879 sig_count=''
880 sig_name=''
881 sig_name_init=''
882 sig_num=''
883 sig_num_init=''
884 installsitearch=''
885 sitearch=''
886 sitearchexp=''
887 installsitebin=''
888 sitebin=''
889 sitebinexp=''
890 installsitelib=''
891 sitelib=''
892 sitelib_stem=''
893 sitelibexp=''
894 siteprefix=''
895 siteprefixexp=''
896 sizesize=''
897 sizetype=''
898 so=''
899 socksizetype=''
900 sharpbang=''
901 shsharp=''
902 spitshell=''
903 src=''
904 ssizetype=''
905 startperl=''
906 startsh=''
907 stdchar=''
908 d_stdio_stream_array=''
909 stdio_stream_array=''
910 sysman=''
911 trnl=''
912 uidformat=''
913 uidsign=''
914 uidsize=''
915 uidtype=''
916 archname64=''
917 use64bitall=''
918 use64bitint=''
919 ccflags_uselargefiles=''
920 ldflags_uselargefiles=''
921 libswanted_uselargefiles=''
922 uselargefiles=''
923 uselongdouble=''
924 usemorebits=''
925 usemultiplicity=''
926 nm_opt=''
927 nm_so_opt=''
928 runnm=''
929 usenm=''
930 useperlio=''
931 usesocks=''
932 d_oldpthreads=''
933 use5005threads=''
934 useithreads=''
935 usethreads=''
936 incpath=''
937 mips_type=''
938 usrinc=''
939 d_vendorarch=''
940 installvendorarch=''
941 vendorarch=''
942 vendorarchexp=''
943 d_vendorbin=''
944 installvendorbin=''
945 vendorbin=''
946 vendorbinexp=''
947 d_vendorlib=''
948 installvendorlib=''
949 vendorlib=''
950 vendorlib_stem=''
951 vendorlibexp=''
952 usevendorprefix=''
953 vendorprefix=''
954 vendorprefixexp=''
955 versiononly=''
956 defvoidused=''
957 voidflags=''
958 pm_apiversion=''
959 xs_apiversion=''
960 CONFIG=''
961
962 define='define'
963 undef='undef'
964 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
965 rmlist=''
966
967 : We must find out about Eunice early
968 eunicefix=':'
969 if test -f /etc/unixtovms; then
970         eunicefix=/etc/unixtovms
971 fi
972 if test -f /etc/unixtovms.exe; then
973         eunicefix=/etc/unixtovms.exe
974 fi
975
976 i_whoami=''
977 ccname=''
978 ccversion=''
979 perllibs=''
980 : set useposix=false in your hint file to disable the POSIX extension.
981 useposix=true
982 : set useopcode=false in your hint file to disable the Opcode extension.
983 useopcode=true
984 : Trailing extension.  Override this in a hint file, if needed.
985 _exe=''
986 : Extra object files, if any, needed on this platform.
987 archobjs=''
988 archname=''
989 : Possible local include directories to search.
990 : Set locincpth to "" in a hint file to defeat local include searches.
991 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
992 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
993 :
994 : no include file wanted by default
995 inclwanted=''
996
997 groupstype=''
998 : change the next line if compiling for Xenix/286 on Xenix/386
999 xlibpth='/usr/lib/386 /lib/386'
1000 : Possible local library directories to search.
1001 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1002 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1003
1004 : general looking path for locating libraries
1005 glibpth="/lib /usr/lib $xlibpth"
1006 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1007 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1008 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1009
1010 : Private path used by Configure to find libraries.  Its value
1011 : is prepended to libpth. This variable takes care of special
1012 : machines, like the mips.  Usually, it should be empty.
1013 plibpth=''
1014
1015 : default library list
1016 libswanted=''
1017 : some systems want to use only the non-versioned libso:s
1018 ignore_versioned_solibs=''
1019 archname64=''
1020 ccflags_uselargefiles=''
1021 ldflags_uselargefiles=''
1022 libswanted_uselargefiles=''
1023 : set usemultiplicity on the Configure command line to enable multiplicity.
1024 : set usesocks on the Configure command line to enable socks.
1025 : set usethreads on the Configure command line to enable threads.
1026 : full support for void wanted by default
1027 defvoidused=15
1028
1029 : List of libraries we want.
1030 : If anyone needs -lnet, put it in a hint file.
1031 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1032 libswanted="$libswanted dld ld sun m c cposix posix"
1033 libswanted="$libswanted ndir dir crypt sec"
1034 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1035 : We probably want to search /usr/shlib before most other libraries.
1036 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1037 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1038 glibpth="/usr/shlib $glibpth"
1039 : Do not use vfork unless overridden by a hint file.
1040 usevfork=false
1041
1042 : Find the basic shell for Bourne shell scripts
1043 case "$sh" in
1044 '')
1045         case "$SYSTYPE" in
1046         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1047         *) xxx='/bin/sh';;
1048         esac
1049         if test -f "$xxx"; then
1050                 sh="$xxx"
1051         else
1052                 : Build up a list and do a single loop so we can 'break' out.
1053                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1054                 for xxx in sh bash ksh pdksh ash; do
1055                         for p in $pth; do
1056                                 try="$try ${p}/${xxx}"
1057                         done
1058                 done
1059                 for xxx in $try; do
1060                         if test -f "$xxx"; then
1061                                 sh="$xxx";
1062                                 break
1063                         elif test -f "$xxx.exe"; then
1064                                 sh="$xxx";
1065                                 break
1066                         fi
1067                 done
1068         fi
1069         ;;
1070 esac
1071
1072 case "$sh" in
1073 '')     cat <<EOM >&2
1074 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1075
1076 Usually it's in /bin/sh.  How did you even get this far?
1077 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1078 we'll try to straighten this all out.
1079 EOM
1080         exit 1
1081         ;;
1082 esac
1083
1084 : see if sh knows # comments
1085 if `$sh -c '#' >/dev/null 2>&1`; then
1086         shsharp=true
1087         spitshell=cat
1088         xcat=/bin/cat
1089         test -f $xcat || xcat=/usr/bin/cat
1090         echo "#!$xcat" >try
1091         $eunicefix try
1092         chmod +x try
1093         ./try > today
1094         if test -s today; then
1095                 sharpbang='#!'
1096         else
1097                 echo "#! $xcat" > try
1098                 $eunicefix try
1099                 chmod +x try
1100                 ./try > today
1101                 if test -s today; then
1102                         sharpbang='#! '
1103                 else
1104                         sharpbang=': use '
1105                 fi
1106         fi
1107 else
1108         echo " "
1109         echo "Your $sh doesn't grok # comments--I will strip them later on."
1110         shsharp=false
1111         cd ..
1112         echo "exec grep -v '^[  ]*#'" >spitshell
1113         chmod +x spitshell
1114         $eunicefix spitshell
1115         spitshell=`pwd`/spitshell
1116         cd UU
1117         echo "I presume that if # doesn't work, #! won't work either!"
1118         sharpbang=': use '
1119 fi
1120 rm -f try today
1121
1122 : figure out how to guarantee sh startup
1123 case "$startsh" in
1124 '') startsh=${sharpbang}${sh} ;;
1125 *)
1126 esac
1127 cat >try <<EOSS
1128 $startsh
1129 set abc
1130 test "$?abc" != 1
1131 EOSS
1132
1133 chmod +x try
1134 $eunicefix try
1135 if ./try; then
1136         : echo "Yup, it does."
1137 else
1138         echo "Hmm... '$startsh' does not guarantee sh startup..."
1139         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1140 fi
1141 rm -f try
1142
1143
1144 : Save command line options in file UU/cmdline.opt for later use in
1145 : generating config.sh.
1146 cat > cmdline.opt <<EOSH
1147 # Configure command line arguments.
1148 config_arg0='$0'
1149 config_args='$*'
1150 config_argc=$#
1151 EOSH
1152 argn=1
1153 for arg in "$@"; do
1154         cat >>cmdline.opt <<EOSH
1155 config_arg$argn='$arg'
1156 EOSH
1157         argn=`expr $argn + 1`
1158 done
1159
1160 : produce awk script to parse command line options
1161 cat >options.awk <<'EOF'
1162 BEGIN {
1163         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1164
1165         len = length(optstr);
1166         for (i = 1; i <= len; i++) {
1167                 c = substr(optstr, i, 1);
1168                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1169                 if (a == ":") {
1170                         arg[c] = 1;
1171                         i++;
1172                 }
1173                 opt[c] = 1;
1174         }
1175 }
1176 {
1177         expect = 0;
1178         str = $0;
1179         if (substr(str, 1, 1) != "-") {
1180                 printf("'%s'\n", str);
1181                 next;
1182         }
1183         len = length($0);
1184         for (i = 2; i <= len; i++) {
1185                 c = substr(str, i, 1);
1186                 if (!opt[c]) {
1187                         printf("-%s\n", substr(str, i));
1188                         next;
1189                 }
1190                 printf("-%s\n", c);
1191                 if (arg[c]) {
1192                         if (i < len)
1193                                 printf("'%s'\n", substr(str, i + 1));
1194                         else
1195                                 expect = 1;
1196                         next;
1197                 }
1198         }
1199 }
1200 END {
1201         if (expect)
1202                 print "?";
1203 }
1204 EOF
1205
1206 : process the command line options
1207 set X `for arg in "$@"; do echo "X$arg"; done |
1208         sed -e s/X// | awk -f options.awk`
1209 eval "set $*"
1210 shift
1211 rm -f options.awk
1212
1213 : set up default values
1214 fastread=''
1215 reuseval=false
1216 config_sh=''
1217 alldone=''
1218 error=''
1219 silent=''
1220 extractsh=''
1221 override=''
1222 knowitall=''
1223 rm -f optdef.sh posthint.sh
1224 cat >optdef.sh <<EOS
1225 $startsh
1226 EOS
1227
1228
1229 : option parsing
1230 while test $# -gt 0; do
1231         case "$1" in
1232         -d) shift; fastread=yes;;
1233         -e) shift; alldone=cont;;
1234         -f)
1235                 shift
1236                 cd ..
1237                 if test -r "$1"; then
1238                         config_sh="$1"
1239                 else
1240                         echo "$me: cannot read config file $1." >&2
1241                         error=true
1242                 fi
1243                 cd UU
1244                 shift;;
1245         -h) shift; error=true;;
1246         -r) shift; reuseval=true;;
1247         -s) shift; silent=true; realsilent=true;;
1248         -E) shift; alldone=exit;;
1249         -K) shift; knowitall=true;;
1250         -O) shift; override=true;;
1251         -S) shift; silent=true; extractsh=true;;
1252         -D)
1253                 shift
1254                 case "$1" in
1255                 *=)
1256                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1257                         echo "$me: ignoring -D $1" >&2
1258                         ;;
1259                 *=*) echo "$1" | \
1260                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1261                 *) echo "$1='define'" >> optdef.sh;;
1262                 esac
1263                 shift
1264                 ;;
1265         -U)
1266                 shift
1267                 case "$1" in
1268                 *=) echo "$1" >> optdef.sh;;
1269                 *=*)
1270                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1271                         echo "$me: ignoring -U $1" >&2
1272                         ;;
1273                 *) echo "$1='undef'" >> optdef.sh;;
1274                 esac
1275                 shift
1276                 ;;
1277         -A)
1278             shift
1279             xxx=''
1280             yyy="$1"
1281             zzz=''
1282             uuu=undef
1283             case "$yyy" in
1284             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1285                  case "$zzz" in
1286                  *:*) zzz='' ;;
1287                  *)   xxx=append
1288                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1289                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1290                  esac
1291                  ;;
1292             esac
1293             case "$xxx" in
1294             '')  case "$yyy" in
1295                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1296                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1297                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1298                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1299                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1300                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1301                  esac
1302                  ;;       
1303             esac
1304             case "$xxx" in
1305             append)
1306                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1307             clear)
1308                 echo "$yyy=''"                  >> posthint.sh ;;
1309             define)
1310                 case "$zzz" in
1311                 '') zzz=define ;;
1312                 esac
1313                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1314             eval)
1315                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1316             prepend)
1317                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1318             undef)
1319                 case "$zzz" in
1320                 '') zzz="$uuu" ;;
1321                 esac
1322                 echo "$yyy=$zzz"                >> posthint.sh ;;
1323             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1324             esac
1325             shift
1326             ;;
1327         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1328             exit 0;;
1329         --) break;;
1330         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1331         *) break;;
1332         esac
1333 done
1334
1335 case "$error" in
1336 true)
1337         cat >&2 <<EOM
1338 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1339                  [-U symbol] [-U symbol=] [-A command:symbol...]
1340   -d : use defaults for all answers.
1341   -e : go on without questioning past the production of config.sh.
1342   -f : specify an alternate default configuration file.
1343   -h : print this help message and exit (with an error status).
1344   -r : reuse C symbols value if possible (skips costly nm extraction).
1345   -s : silent mode, only echoes questions and essential information.
1346   -D : define symbol to have some value:
1347          -D symbol         symbol gets the value 'define'
1348          -D symbol=value   symbol gets the value 'value'
1349   -E : stop at the end of questions, after having produced config.sh.
1350   -K : do not use unless you know what you are doing.
1351   -O : let -D and -U override definitions from loaded configuration file.
1352   -S : perform variable substitutions on all .SH files (can mix with -f)
1353   -U : undefine symbol:
1354          -U symbol    symbol gets the value 'undef'
1355          -U symbol=   symbol gets completely empty
1356   -A : manipulate symbol after the platform specific hints have been applied:
1357          -A symbol=value                append " "value to symbol
1358          -A append:symbol=value         append value to symbol
1359          -A define:symbol=value         define symbol to have value
1360          -A clear:symbol                define symbol to be ''
1361          -A define:symbol               define symbol to be 'define'
1362          -A eval:symbol=value           define symbol to be eval of value
1363          -A prepend:symbol=value        prepend value to symbol
1364          -A undef:symbol                define symbol to be 'undef'
1365          -A undef:symbol=               define symbol to be ''
1366   -V : print version number and exit (with a zero status).
1367 EOM
1368         exit 1
1369         ;;
1370 esac
1371
1372 : Sanity checks
1373 case "$fastread$alldone" in
1374 yescont|yesexit) ;;
1375 *)
1376         case "$extractsh" in
1377         true) ;;
1378         *)
1379                 if test ! -t 0; then
1380                         echo "Say 'sh Configure', not 'sh <Configure'"
1381                         exit 1
1382                 fi
1383                 ;;
1384         esac
1385         ;;
1386 esac
1387
1388 exec 4>&1
1389 case "$silent" in
1390 true) exec 1>/dev/null;;
1391 esac
1392
1393 : run the defines and the undefines, if any, but leave the file out there...
1394 touch optdef.sh
1395 . ./optdef.sh
1396 : create the posthint manipulation script and leave the file out there...
1397 touch posthint.sh
1398
1399 : set package name
1400 package=perl5
1401 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1402 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1403 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1404 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1405 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1406 esac
1407
1408 : Some greps do not return status, grrr.
1409 echo "grimblepritz" >grimble
1410 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1411         contains=contains
1412 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1413         contains=grep
1414 else
1415         contains=contains
1416 fi
1417 rm -f grimble
1418 : the following should work in any shell
1419 case "$contains" in
1420 contains*)
1421         echo " "
1422         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1423         cat >contains <<'EOSS'
1424 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1425 EOSS
1426 chmod +x contains
1427 esac
1428
1429 : Find the path to the source tree
1430 case "$src" in
1431 '') case "$0" in
1432     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1433          case "$src" in
1434          /*)    ;;
1435          *)     src=`cd ../$src && pwd` ;;
1436          esac
1437          ;;
1438     *)   src='.';;
1439     esac;;
1440 esac
1441 case "$src" in
1442 '')     src=/
1443         rsrc=/
1444         ;;
1445 /*) rsrc="$src";;
1446 *) rsrc="../$src";;
1447 esac
1448 if test -f $rsrc/Configure && \
1449         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1450 then
1451    : found it, so we are ok.
1452 else
1453         rsrc=''
1454         for src in . .. ../.. ../../.. ../../../..; do
1455                 if test -f ../$src/Configure && \
1456                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1457                 then
1458                         rsrc=../$src
1459                         break
1460                 fi
1461         done
1462 fi
1463 case "$rsrc" in
1464 '')
1465         cat <<EOM >&4
1466
1467 Sorry, I can't seem to locate the source dir for $package.  Please start
1468 Configure with an explicit path -- i.e. /some/path/Configure.
1469
1470 EOM
1471         exit 1
1472         ;;
1473 ../.)   rsrc='..';;
1474 *)
1475         echo " "
1476         echo "Sources for $package found in \"$src\"." >&4
1477         ;;
1478 esac
1479
1480 : script used to extract .SH files with variable substitutions
1481 cat >extract <<'EOS'
1482 CONFIGDOTSH=true
1483 echo "Doing variable substitutions on .SH files..."
1484 if test -f $src/MANIFEST; then
1485         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1486 else
1487         echo "(Looking for .SH files under the source directory.)"
1488         set x `(cd $src; find . -name "*.SH" -print)`
1489 fi
1490 shift
1491 case $# in
1492 0) set x `(cd $src; echo *.SH)`; shift;;
1493 esac
1494 if test ! -f $src/$1; then
1495         shift
1496 fi
1497 mkdir_p='
1498 name=$1;
1499 create="";
1500 while test $name; do
1501         if test ! -d "$name"; then
1502                 create="$name $create";
1503                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1504                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1505         else
1506                 name="";
1507         fi;
1508 done;
1509 for file in $create; do
1510         mkdir $file;
1511 done
1512 '
1513 for file in $*; do
1514         case "$src" in
1515         ".")
1516                 case "$file" in
1517                 */*)
1518                         dir=`expr X$file : 'X\(.*\)/'`
1519                         file=`expr X$file : 'X.*/\(.*\)'`
1520                         (cd $dir && . ./$file)
1521                         ;;
1522                 *)
1523                         . ./$file
1524                         ;;
1525                 esac
1526                 ;;
1527         *)
1528                 case "$file" in
1529                 */*)
1530                         dir=`expr X$file : 'X\(.*\)/'`
1531                         file=`expr X$file : 'X.*/\(.*\)'`
1532                         (set x $dir; shift; eval $mkdir_p)
1533                         sh <$src/$dir/$file
1534                         ;;
1535                 *)
1536                         sh <$src/$file
1537                         ;;
1538                 esac
1539                 ;;
1540         esac
1541 done
1542 if test -f $src/config_h.SH; then
1543         if test ! -f config.h; then
1544         : oops, they left it out of MANIFEST, probably, so do it anyway.
1545         . $src/config_h.SH
1546         fi
1547 fi
1548 EOS
1549
1550 : extract files and exit if asked to do so
1551 case "$extractsh" in
1552 true)
1553         case "$realsilent" in
1554         true) ;;
1555         *) exec 1>&4;;
1556         esac
1557         case "$config_sh" in
1558         '') config_sh='config.sh';;
1559         esac
1560         echo " "
1561         echo "Fetching answers from $config_sh..."
1562         cd ..
1563         . $config_sh
1564         test "$override" && . ./optdef.sh
1565         echo " "
1566         . UU/extract
1567         rm -rf UU
1568         echo "Done."
1569         exit 0
1570         ;;
1571 esac
1572
1573 : Eunice requires " " instead of "", can you believe it
1574 echo " "
1575 : Here we go...
1576 echo "Beginning of configuration questions for $package."
1577
1578 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1579
1580 : first determine how to suppress newline on echo command
1581 echo " "
1582 echo "Checking echo to see how to suppress newlines..."
1583 (echo "hi there\c" ; echo " ") >.echotmp
1584 if $contains c .echotmp >/dev/null 2>&1 ; then
1585         echo "...using -n."
1586         n='-n'
1587         c=''
1588 else
1589         cat <<'EOM'
1590 ...using \c
1591 EOM
1592         n=''
1593         c='\c'
1594 fi
1595 echo $n "The star should be here-->$c"
1596 echo '*'
1597 rm -f .echotmp
1598
1599 : Now test for existence of everything in MANIFEST
1600 echo " "
1601 if test -f $rsrc/MANIFEST; then
1602         echo "First let's make sure your kit is complete.  Checking..." >&4
1603         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1604         rm -f missing
1605         tmppwd=`pwd`
1606         for filelist in x??; do
1607                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1608         done
1609         if test -s missing; then
1610                 cat missing >&4
1611                 cat >&4 <<'EOM'
1612
1613 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1614
1615 You have the option of continuing the configuration process, despite the
1616 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1617 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1618 and contact the author (perlbug@perl.org).
1619
1620 EOM
1621                 echo $n "Continue? [n] $c" >&4
1622                 read ans
1623                 case "$ans" in
1624                 y*)
1625                         echo "Continuing..." >&4
1626                         rm -f missing
1627                         ;;
1628                 *)
1629                         echo "ABORTING..." >&4
1630                         kill $$
1631                         ;;
1632                 esac
1633         else
1634                 echo "Looks good..."
1635         fi
1636 else
1637         echo "There is no MANIFEST file.  I hope your kit is complete !"
1638 fi
1639 rm -f missing x??
1640
1641 echo " "
1642 : Find the appropriate value for a newline for tr
1643 if test -n "$DJGPP"; then
1644        trnl='\012'
1645 fi
1646 if test X"$trnl" = X; then
1647         case "`echo foo|tr '\n' x 2>/dev/null`" in
1648         foox) trnl='\n' ;;
1649         esac
1650 fi
1651 if test X"$trnl" = X; then
1652         case "`echo foo|tr '\012' x 2>/dev/null`" in
1653         foox) trnl='\012' ;;
1654         esac
1655 fi
1656 if test X"$trnl" = X; then
1657         cat <<EOM >&2
1658
1659 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1660
1661 EOM
1662         exit 1
1663 fi
1664
1665 : compute the number of columns on the terminal for proper question formatting
1666 case "$COLUMNS" in
1667 '') COLUMNS='80';;
1668 esac
1669
1670 : set up the echo used in my read
1671 myecho="case \"\$xxxm\" in
1672 '') echo $n \"\$rp $c\" >&4;;
1673 *) case \"\$rp\" in
1674         '') echo $n \"[\$xxxm] $c\";;
1675         *)
1676                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1677                         echo \"\$rp\" >&4
1678                         echo $n \"[\$xxxm] $c\" >&4
1679                 else
1680                         echo $n \"\$rp [\$xxxm] $c\" >&4
1681                 fi
1682                 ;;
1683         esac;;
1684 esac"
1685
1686 : now set up to do reads with possible shell escape and default assignment
1687 cat <<EOSC >myread
1688 $startsh
1689 xxxm=\$dflt
1690 $myecho
1691 ans='!'
1692 case "\$fastread" in
1693 yes) case "\$dflt" in
1694         '') ;;
1695         *) ans='';
1696                 case "\$silent-\$rp" in
1697                 true-) ;;
1698                 *) echo " " >&4;;
1699                 esac;;
1700         esac;;
1701 *) case "\$silent" in
1702         true) case "\$rp" in
1703                 '') ans='';;
1704                 esac;;
1705         esac;;
1706 esac
1707 while expr "X\$ans" : "X!" >/dev/null; do
1708         read answ
1709         set x \$xxxm
1710         shift
1711         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1712         case  "\$answ" in
1713         "!")
1714                 sh 1>&4
1715                 echo " "
1716                 $myecho
1717                 ;;
1718         !*)
1719                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1720                 shift
1721                 sh 1>&4 -c "\$*"
1722                 echo " "
1723                 $myecho
1724                 ;;
1725         "\$ans")
1726                 case "\$ans" in
1727                 \\&*)
1728                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1729                         shift
1730                         case "\$1" in
1731                         -d)
1732                                 fastread=yes
1733                                 echo "(OK, I'll run with -d after this question.)" >&4
1734                                 ;;
1735                         -*)
1736                                 echo "*** Sorry, \$1 not supported yet." >&4
1737                                 ;;
1738                         esac
1739                         $myecho
1740                         ans=!
1741                         ;;
1742                 esac;;
1743         *)
1744                 case "\$aok" in
1745                 y)
1746                         echo "*** Substitution done -- please confirm."
1747                         xxxm="\$ans"
1748                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1749                         xxxm="\$ans"
1750                         ans=!
1751                         ;;
1752                 *)
1753                         echo "*** Error -- try again."
1754                         ans=!
1755                         ;;
1756                 esac
1757                 $myecho
1758                 ;;
1759         esac
1760         case "\$ans\$xxxm\$nostick" in
1761         '')
1762                 ans=!
1763                 $myecho
1764                 ;;
1765         esac
1766 done
1767 case "\$ans" in
1768 '') ans="\$xxxm";;
1769 esac
1770 EOSC
1771
1772 : create .config dir to save info across Configure sessions
1773 test -d ../.config || mkdir ../.config
1774 cat >../.config/README <<EOF
1775 This directory created by Configure to save information that should
1776 persist across sessions for $package.
1777
1778 You may safely delete it if you wish.
1779 EOF
1780
1781 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1782 case "$usedevel" in
1783 $define|true|[yY]*) ;;
1784 *) case "$xversion" in
1785    *[13579])
1786         cat >&4 <<EOH
1787 *** WHOA THERE!!! ***
1788
1789     This is an UNSTABLE DEVELOPMENT release.
1790     The version of this $package distribution is $xversion, that is, odd,
1791     (as opposed to even) and that signifies a development release.
1792     If you want a maintenance release, you want an even-numbered version.
1793
1794     Do ***NOT*** install this into production use.
1795     Data corruption and crashes are possible.
1796
1797     It is most seriously suggested that you do not continue any further
1798     unless you want to help in developing and debugging Perl.
1799
1800 EOH
1801         rp='Do you really want to continue?'
1802         dflt='n'
1803         . ./myread
1804         case "$ans" in
1805         [yY]) echo >&4 "Okay, continuing." ;;
1806         *) echo >&4 "Okay, bye."
1807            exit 1
1808            ;;
1809         esac
1810         ;;
1811     esac
1812     ;;
1813 esac
1814
1815 : general instructions
1816 needman=true
1817 firsttime=true
1818 user=`(logname) 2>/dev/null`
1819 case "$user" in
1820 '') user=`whoami 2>&1`;;
1821 esac
1822 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1823         firsttime=false
1824         echo " "
1825         rp='Would you like to see the instructions?'
1826         dflt=n
1827         . ./myread
1828         case "$ans" in
1829         [yY]*) ;;
1830         *) needman=false;;
1831         esac
1832 fi
1833 if $needman; then
1834         cat <<EOH
1835
1836 This installation shell script will examine your system and ask you questions
1837 to determine how the perl5 package should be installed. If you get
1838 stuck on a question, you may use a ! shell escape to start a subshell or
1839 execute a command.  Many of the questions will have default answers in square
1840 brackets; typing carriage return will give you the default.
1841
1842 On some of the questions which ask for file or directory names you are allowed
1843 to use the ~name construct to specify the login directory belonging to "name",
1844 even if you don't have a shell which knows about that.  Questions where this is
1845 allowed will be marked "(~name ok)".
1846
1847 EOH
1848         rp=''
1849         dflt='Type carriage return to continue'
1850         . ./myread
1851         cat <<'EOH'
1852
1853 The prompter used in this script allows you to use shell variables and
1854 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1855 in the default answer, as if the default line was a set of arguments given to a
1856 script shell.  This means you may also use $* to repeat the whole default line,
1857 so you do not have to re-type everything to add something to the default.
1858
1859 Everytime there is a substitution, you will have to confirm.  If there is an
1860 error (e.g. an unmatched backtick), the default answer will remain unchanged
1861 and you will be prompted again.
1862
1863 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1864 the questions and use the computed defaults (or the previous answers if there
1865 was already a config.sh file). Type 'Configure -h' for a list of options.
1866 You may also start interactively and then answer '& -d' at any prompt to turn
1867 on the non-interactive behaviour for the remainder of the execution.
1868
1869 EOH
1870         . ./myread
1871         cat <<EOH
1872
1873 Much effort has been expended to ensure that this shell script will run on any
1874 Unix system.  If despite that it blows up on yours, your best bet is to edit
1875 Configure and run it again.  If you can't run Configure for some reason,
1876 you'll have to generate a config.sh file by hand.  Whatever problems you
1877 have, let me (perlbug@perl.org) know how I blew it.
1878
1879 This installation script affects things in two ways:
1880
1881 1) it may do direct variable substitutions on some of the files included
1882    in this kit.
1883 2) it builds a config.h file for inclusion in C programs.  You may edit
1884    any of these files as the need arises after running this script.
1885
1886 If you make a mistake on a question, there is no easy way to back up to it
1887 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1888 files.  Configure will offer to let you do this before it runs the SH files.
1889
1890 EOH
1891         dflt='Type carriage return to continue'
1892         . ./myread
1893         case "$firsttime" in
1894         true) echo $user >>../.config/instruct;;
1895         esac
1896 fi
1897
1898 : find out where common programs are
1899 echo " "
1900 echo "Locating common programs..." >&4
1901 cat <<EOSC >loc
1902 $startsh
1903 case \$# in
1904 0) exit 1;;
1905 esac
1906 thing=\$1
1907 shift
1908 dflt=\$1
1909 shift
1910 for dir in \$*; do
1911         case "\$thing" in
1912         .)
1913         if test -d \$dir/\$thing; then
1914                 echo \$dir
1915                 exit 0
1916         fi
1917         ;;
1918         *)
1919         for thisthing in \$dir/\$thing; do
1920                 : just loop through to pick last item
1921         done
1922         if test -f \$thisthing; then
1923                 echo \$thisthing
1924                 exit 0
1925         elif test -f \$dir/\$thing.exe; then
1926                 if test -n "$DJGPP"; then
1927                         echo \$dir/\$thing.exe
1928                 else
1929                         : on Eunice apparently
1930                         echo \$dir/\$thing
1931                 fi
1932                 exit 0
1933         fi
1934         ;;
1935         esac
1936 done
1937 echo \$dflt
1938 exit 1
1939 EOSC
1940 chmod +x loc
1941 $eunicefix loc
1942 loclist="
1943 awk
1944 cat
1945 comm
1946 cp
1947 echo
1948 expr
1949 grep
1950 ls
1951 make
1952 mkdir
1953 rm
1954 sed
1955 sort
1956 touch
1957 tr
1958 uniq
1959 "
1960 trylist="
1961 Mcc
1962 ar
1963 byacc
1964 cpp
1965 csh
1966 date
1967 egrep
1968 gzip
1969 less
1970 ln
1971 more
1972 nm
1973 nroff
1974 pg
1975 test
1976 uname
1977 zip
1978 "
1979 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1980 pth="$pth /lib /usr/lib"
1981 for file in $loclist; do
1982         eval xxx=\$$file
1983         case "$xxx" in
1984         /*|?:[\\/]*)
1985                 if test -f "$xxx"; then
1986                         : ok
1987                 else
1988                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1989                         xxx=`./loc $file $file $pth`
1990                 fi
1991                 ;;
1992         '') xxx=`./loc $file $file $pth`;;
1993         *) xxx=`./loc $xxx $xxx $pth`;;
1994         esac
1995         eval $file=$xxx
1996         eval _$file=$xxx
1997         case "$xxx" in
1998         /*)
1999                 echo $file is in $xxx.
2000                 ;;
2001         ?:[\\/]*)
2002                 echo $file is in $xxx.
2003                 ;;
2004         *)
2005                 echo "I don't know where '$file' is, and my life depends on it." >&4
2006                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2007                 exit 1
2008                 ;;
2009         esac
2010 done
2011 echo " "
2012 echo "Don't worry if any of the following aren't found..."
2013 say=offhand
2014 for file in $trylist; do
2015         eval xxx=\$$file
2016         case "$xxx" in
2017         /*|?:[\\/]*)
2018                 if test -f "$xxx"; then
2019                         : ok
2020                 else
2021                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2022                         xxx=`./loc $file $file $pth`
2023                 fi
2024                 ;;
2025         '') xxx=`./loc $file $file $pth`;;
2026         *) xxx=`./loc $xxx $xxx $pth`;;
2027         esac
2028         eval $file=$xxx
2029         eval _$file=$xxx
2030         case "$xxx" in
2031         /*)
2032                 echo $file is in $xxx.
2033                 ;;
2034         ?:[\\/]*)
2035                 echo $file is in $xxx.
2036                 ;;
2037         *)
2038                 echo "I don't see $file out there, $say."
2039                 say=either
2040                 ;;
2041         esac
2042 done
2043 case "$egrep" in
2044 egrep)
2045         echo "Substituting grep for egrep."
2046         egrep=$grep
2047         ;;
2048 esac
2049 case "$ln" in
2050 ln)
2051         echo "Substituting cp for ln."
2052         ln=$cp
2053         ;;
2054 esac
2055 case "$test" in
2056 test)
2057         echo "Hopefully test is built into your sh."
2058         ;;
2059 *)
2060         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2061                 echo "Using the test built into your sh."
2062                 test=test
2063                 _test=test
2064         fi
2065         ;;
2066 esac
2067 case "$echo" in
2068 echo)
2069         echo "Hopefully echo is built into your sh."
2070         ;;
2071 '') ;;
2072 *)
2073         echo " "
2074 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2075         $echo $n "hi there$c" >foo1
2076         echo $n "hi there$c" >foo2
2077         if cmp foo1 foo2 >/dev/null 2>&1; then
2078                 echo "They are compatible.  In fact, they may be identical."
2079         else
2080                 case "$n" in
2081                 '-n') n='' c='\c';;
2082                 *) n='-n' c='';;
2083                 esac
2084                 cat <<FOO
2085 They are not compatible!  You are probably running ksh on a non-USG system.
2086 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2087 have echo built in and we may have to run some Bourne shell scripts.  That
2088 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2089
2090 FOO
2091                 $echo $n "The star should be here-->$c"
2092                 $echo "*"
2093         fi
2094         $rm -f foo1 foo2
2095         ;;
2096 esac
2097
2098 cat <<EOS >checkcc
2099 $startsh
2100 EOS
2101 cat <<'EOSC' >>checkcc
2102 case "$cc" in
2103 '') ;;
2104 *)  $rm -f try try.*
2105     $cat >try.c <<EOM
2106 int main(int argc, char *argv[]) {
2107   return 0;
2108 }
2109 EOM
2110     if $cc -o try $ccflags try.c; then
2111        :
2112     else
2113         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2114         despair=yes
2115         trygcc=yes
2116         case "$cc" in
2117         *gcc*) trygcc=no ;;
2118         esac
2119         case "`$cc -v -c try.c 2>&1`" in
2120         *gcc*) trygcc=no ;;
2121         esac
2122         if $test X"$trygcc" = Xyes; then
2123             if gcc -o try -c try.c; then
2124                 echo " "
2125                 echo "You seem to have a working gcc, though." >&4
2126                 rp="Would you like to use it?"
2127                 dflt=y
2128                 if $test -f myread; then
2129                     . ./myread
2130                 else
2131                     if $test -f UU/myread; then
2132                         . ./UU/myread
2133                     else
2134                         echo "Cannot find myread, sorry.  Aborting." >&2
2135                         exit 1
2136                     fi
2137                 fi  
2138                 case "$ans" in
2139                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2140                 esac
2141             fi
2142         fi
2143         if $test X"$despair" = Xyes; then
2144             $cat >&4 <<EOM
2145 You need to find a working C compiler.
2146 Either (purchase and) install the C compiler supplied by your OS vendor,
2147 or for a free C compiler try http://gcc.gnu.org/
2148 I cannot continue any further, aborting.
2149 EOM
2150             exit 1
2151         fi
2152     fi
2153     $rm -f try try.*
2154     ;;
2155 esac
2156 EOSC
2157
2158 : determine whether symbolic links are supported
2159 echo " "
2160 $touch blurfl
2161 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2162         echo "Symbolic links are supported." >&4
2163         lns="$ln -s"
2164 else
2165         echo "Symbolic links are NOT supported." >&4
2166         lns="$ln"
2167 fi
2168 $rm -f blurfl sym
2169
2170 : see whether [:lower:] and [:upper:] are supported character classes
2171 echo " "
2172 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2173 ABYZ)
2174         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2175         up='[:upper:]'
2176         low='[:lower:]'
2177         ;;
2178 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2179         # (0xc9 and 0xd1), therefore that is a nice testing point.
2180         if test "X$up" = X -o "X$low" = X; then
2181             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2182             ij) up='[A-Z]'
2183                 low='[a-z]'
2184                 ;;
2185             esac
2186         fi
2187         if test "X$up" = X -o "X$low" = X; then
2188             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2189             ij) up='A-Z'
2190                 low='a-z'
2191                 ;;
2192             esac
2193         fi
2194         if test "X$up" = X -o "X$low" = X; then
2195             case "`echo IJ | od -x 2>/dev/null`" in
2196             *C9D1*|*c9d1*)
2197                 echo "Hey, this might be EBCDIC." >&4
2198                 if test "X$up" = X -o "X$low" = X; then
2199                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2200                     ij) up='[A-IJ-RS-Z]'
2201                         low='[a-ij-rs-z]'
2202                         ;;
2203                     esac
2204                 fi
2205                 if test "X$up" = X -o "X$low" = X; then
2206                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2207                     ij) up='A-IJ-RS-Z'
2208                         low='a-ij-rs-z'
2209                         ;;
2210                     esac
2211                 fi
2212                 ;;
2213             esac
2214         fi
2215 esac
2216 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2217 ij)
2218     echo "Using $up and $low to convert case." >&4
2219     ;;
2220 *)
2221     echo "I don't know how to translate letters from upper to lower case." >&4
2222     echo "Your tr is not acting any way I know of." >&4
2223     exit 1
2224     ;;
2225 esac
2226 : set up the translation script tr, must be called with ./tr of course
2227 cat >tr <<EOSC
2228 $startsh
2229 case "\$1\$2" in
2230 '[A-Z][a-z]') exec $tr '$up' '$low';;
2231 '[a-z][A-Z]') exec $tr '$low' '$up';;
2232 esac
2233 exec $tr "\$@"
2234 EOSC
2235 chmod +x tr
2236 $eunicefix tr
2237
2238 : Try to determine whether config.sh was made on this system
2239 case "$config_sh" in
2240 '')
2241 myuname=`$uname -a 2>/dev/null`
2242 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2243 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2244 # because the A-Z/a-z are not consecutive.
2245 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2246         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2247 newmyuname="$myuname"
2248 dflt=n
2249 case "$knowitall" in
2250 '')
2251         if test -f ../config.sh; then
2252                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2253                         eval "`grep myuname= ../config.sh`"
2254                 fi
2255                 if test "X$myuname" = "X$newmyuname"; then
2256                         dflt=y
2257                 fi
2258         fi
2259         ;;
2260 *) dflt=y;;
2261 esac
2262
2263 : Get old answers from old config file if Configure was run on the
2264 : same system, otherwise use the hints.
2265 hint=default
2266 cd ..
2267 if test -f config.sh; then
2268         echo " "
2269         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2270         . UU/myread
2271         case "$ans" in
2272         n*|N*) echo "OK, I'll ignore it."
2273                 mv config.sh config.sh.old
2274                 myuname="$newmyuname"
2275                 ;;
2276         *)  echo "Fetching default answers from your old config.sh file..." >&4
2277                 tmp_n="$n"
2278                 tmp_c="$c"
2279                 tmp_sh="$sh"
2280                 . ./config.sh
2281                 cp config.sh UU
2282                 n="$tmp_n"
2283                 c="$tmp_c"
2284                 : Older versions did not always set $sh.  Catch re-use of such
2285                 : an old config.sh.
2286                 case "$sh" in
2287                 '') sh="$tmp_sh" ;;
2288                 esac
2289                 hint=previous
2290                 ;;
2291         esac
2292 fi
2293 . ./UU/checkcc
2294 if test ! -f config.sh; then
2295         $cat <<EOM
2296
2297 First time through, eh?  I have some defaults handy for some systems
2298 that need some extra help getting the Configure answers right:
2299
2300 EOM
2301         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2302         dflt=''
2303         : Half the following guesses are probably wrong... If you have better
2304         : tests or hints, please send them to perlbug@perl.org
2305         : The metaconfig authors would also appreciate a copy...
2306         $test -f /irix && osname=irix
2307         $test -f /xenix && osname=sco_xenix
2308         $test -f /dynix && osname=dynix
2309         $test -f /dnix && osname=dnix
2310         $test -f /lynx.os && osname=lynxos
2311         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2312         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2313         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2314         $test -f /bin/mips && /bin/mips && osname=mips
2315         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2316                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2317         $test -d /usr/apollo/bin && osname=apollo
2318         $test -f /etc/saf/_sactab && osname=svr4
2319         $test -d /usr/include/minix && osname=minix
2320         if $test -d /MachTen -o -d /MachTen_Folder; then
2321                 osname=machten
2322                 if $test -x /sbin/version; then
2323                         osvers=`/sbin/version | $awk '{print $2}' |
2324                         $sed -e 's/[A-Za-z]$//'`
2325                 elif $test -x /usr/etc/version; then
2326                         osvers=`/usr/etc/version | $awk '{print $2}' |
2327                         $sed -e 's/[A-Za-z]$//'`
2328                 else
2329                         osvers="$2.$3"
2330                 fi
2331         fi
2332
2333         $test -f /sys/posix.dll &&
2334                 $test -f /usr/bin/what &&
2335                 set X `/usr/bin/what /sys/posix.dll` &&
2336                 $test "$3" = UWIN &&
2337                 osname=uwin &&
2338                 osvers="$5"
2339
2340         if $test -f $uname; then
2341                 set X $myuname
2342                 shift
2343
2344                 case "$5" in
2345                 fps*) osname=fps ;;
2346                 mips*)
2347                         case "$4" in
2348                         umips) osname=umips ;;
2349                         *) osname=mips ;;
2350                         esac;;
2351                 [23]100) osname=mips ;;
2352                 next*) osname=next ;;
2353                 i386*)
2354                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2355                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2356                                 osname='sco'
2357                                 osvers=$tmp
2358                         elif $test -f /etc/kconfig; then
2359                                 osname=isc
2360                                 if test "$lns" = "$ln -s"; then
2361                                         osvers=4
2362                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2363                                         osvers=3
2364                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2365                                         osvers=2
2366                                 fi
2367                         fi
2368                         tmp=''
2369                         ;;
2370                 pc*)
2371                         if test -n "$DJGPP"; then
2372                                 osname=dos
2373                                 osvers=djgpp
2374                         fi
2375                         ;;
2376                 esac
2377
2378                 case "$1" in
2379                 aix) osname=aix
2380                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2381                         case "$tmp" in
2382                         'not found') osvers="$4"."$3" ;;
2383                         '<3240'|'<>3240') osvers=3.2.0 ;;
2384                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2385                         '=3250'|'>3250') osvers=3.2.5 ;;
2386                         *) osvers=$tmp;;
2387                         esac
2388                         ;;
2389                 bsd386) osname=bsd386
2390                         osvers=`$uname -r`
2391                         ;;
2392                 cygwin*) osname=cygwin
2393                         osvers="$3"
2394                         ;;
2395                 *dc.osx) osname=dcosx
2396                         osvers="$3"
2397                         ;;
2398                 dnix) osname=dnix
2399                         osvers="$3"
2400                         ;;
2401                 domainos) osname=apollo
2402                         osvers="$3"
2403                         ;;
2404                 dgux) osname=dgux 
2405                         osvers="$3"
2406                         ;;
2407                 dynixptx*) osname=dynixptx
2408                         osvers=`echo "$4"|sed 's/^v//'`
2409                         ;;
2410                 freebsd) osname=freebsd 
2411                         osvers="$3" ;;
2412                 genix) osname=genix ;;
2413                 hp*) osname=hpux 
2414                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2415                         ;;
2416                 irix*) osname=irix
2417                         case "$3" in
2418                         4*) osvers=4 ;;
2419                         5*) osvers=5 ;;
2420                         *)      osvers="$3" ;;
2421                         esac
2422                         ;;
2423                 linux) osname=linux
2424                         case "$3" in
2425                         *)      osvers="$3" ;;
2426                         esac
2427                         ;;
2428                 MiNT) osname=mint
2429                         ;;
2430                 netbsd*) osname=netbsd
2431                         osvers="$3"
2432                         ;;
2433                 news-os) osvers="$3"
2434                         case "$3" in
2435                         4*) osname=newsos4 ;;
2436                         *) osname=newsos ;;
2437                         esac
2438                         ;;
2439                 next*) osname=next ;;
2440                 nonstop-ux) osname=nonstopux ;;
2441                 POSIX-BC | posix-bc ) osname=posix-bc
2442                         osvers="$3"
2443                         ;;
2444                 powerux | power_ux | powermax_os | powermaxos | \
2445                 powerunix | power_unix) osname=powerux
2446                         osvers="$3"
2447                         ;;
2448                 qnx) osname=qnx
2449                         osvers="$4"
2450                         ;;
2451                 solaris) osname=solaris
2452                         case "$3" in
2453                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2454                         *)      osvers="$3" ;;
2455                         esac
2456                         ;;
2457                 sunos) osname=sunos
2458                         case "$3" in
2459                         5*) osname=solaris
2460                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2461                         *)      osvers="$3" ;;
2462                         esac
2463                         ;;
2464                 titanos) osname=titanos
2465                         case "$3" in
2466                         1*) osvers=1 ;;
2467                         2*) osvers=2 ;;
2468                         3*) osvers=3 ;;
2469                         4*) osvers=4 ;;
2470                         *)      osvers="$3" ;;
2471                         esac
2472                         ;;
2473                 ultrix) osname=ultrix
2474                         osvers="$3"
2475                         ;;
2476                 osf1|mls+)      case "$5" in
2477                                 alpha)
2478                                         osname=dec_osf
2479                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2480                                         case "$osvers" in
2481                                         [1-9].[0-9]*) ;;
2482                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2483                                         esac
2484                                         ;;
2485                         hp*)    osname=hp_osf1  ;;
2486                         mips)   osname=mips_osf1 ;;
2487                         esac
2488                         ;;
2489                 unixware) osname=svr5
2490                         osvers="$4"
2491                         ;;
2492                 uts) osname=uts
2493                         osvers="$3"
2494                         ;;
2495                 $2) case "$osname" in
2496                         *isc*) ;;
2497                         *freebsd*) ;;
2498                         svr*)
2499                                 : svr4.x or possibly later
2500                                 case "svr$3" in 
2501                                 ${osname}*)
2502                                         osname=svr$3
2503                                         osvers=$4
2504                                         ;;
2505                                 esac
2506                                 case "$osname" in
2507                                 svr4.0)
2508                                         : Check for ESIX
2509                                         if test -f /stand/boot ; then
2510                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2511                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2512                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2513                                                         if test -n "$isesix"; then
2514                                                                 osname=esix4
2515                                                         fi
2516                                                 fi
2517                                         fi
2518                                         ;;
2519                                 esac
2520                                 ;;
2521                         *)      if test -f /etc/systemid; then
2522                                         osname=sco
2523                                         set `echo $3 | $sed 's/\./ /g'` $4
2524                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2525                                                 osvers=$1.$2.$3
2526                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2527                                                 osvers=$1.$2
2528                                         elif $test -f $src/hints/sco_$1.sh; then
2529                                                 osvers=$1
2530                                         fi
2531                                 else
2532                                         case "$osname" in
2533                                         '') : Still unknown.  Probably a generic Sys V.
2534                                                 osname="sysv"
2535                                                 osvers="$3"
2536                                                 ;;
2537                                         esac
2538                                 fi
2539                                 ;;
2540                         esac
2541                         ;;
2542                 *)      case "$osname" in
2543                         '') : Still unknown.  Probably a generic BSD.
2544                                 osname="$1"
2545                                 osvers="$3"
2546                                 ;;
2547                         esac
2548                         ;;
2549                 esac
2550         else
2551                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2552                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2553                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2554                                 osname=news_os
2555                         fi
2556                         $rm -f UU/kernel.what
2557                 elif test -d c:/.; then
2558                         set X $myuname
2559                         osname=os2
2560                         osvers="$5"
2561                 fi
2562         fi
2563         
2564         : Now look for a hint file osname_osvers, unless one has been
2565         : specified already.
2566         case "$hintfile" in
2567         ''|' ')
2568                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2569                 : Also try without trailing minor version numbers.
2570                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2571                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2572                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2573                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2574                 case "$file" in
2575                 '') dflt=none ;;
2576                 *)  case "$osvers" in
2577                         '') dflt=$file
2578                                 ;;
2579                         *)  if $test -f $src/hints/$file.sh ; then
2580                                         dflt=$file
2581                                 elif $test -f $src/hints/$xfile.sh ; then
2582                                         dflt=$xfile
2583                                 elif $test -f $src/hints/$xxfile.sh ; then
2584                                         dflt=$xxfile
2585                                 elif $test -f $src/hints/$xxxfile.sh ; then
2586                                         dflt=$xxxfile
2587                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2588                                         dflt=$xxxxfile
2589                                 elif $test -f "$src/hints/${osname}.sh" ; then
2590                                         dflt="${osname}"
2591                                 else
2592                                         dflt=none
2593                                 fi
2594                                 ;;
2595                         esac
2596                         ;;
2597                 esac
2598                 if $test -f Policy.sh ; then
2599                         case "$dflt" in
2600                         *Policy*) ;;
2601                         none) dflt="Policy" ;;
2602                         *) dflt="Policy $dflt" ;;
2603                         esac
2604                 fi
2605                 ;;
2606         *)
2607                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2608                 ;;
2609         esac
2610
2611         if $test -f Policy.sh ; then
2612                 $cat <<EOM
2613
2614 There's also a Policy hint file available, which should make the
2615 site-specific (policy) questions easier to answer.
2616 EOM
2617
2618         fi
2619
2620         $cat <<EOM
2621
2622 You may give one or more space-separated answers, or "none" if appropriate.
2623 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2624 is a good thing.  DO NOT give a wrong version or a wrong OS.
2625
2626 EOM
2627
2628         rp="Which of these apply, if any?"
2629         . UU/myread
2630         tans=$ans
2631         for file in $tans; do
2632                 if $test X$file = XPolicy -a -f Policy.sh; then
2633                         . Policy.sh
2634                         $cat Policy.sh >> UU/config.sh
2635                 elif $test -f $src/hints/$file.sh; then
2636                         . $src/hints/$file.sh
2637                         $cat $src/hints/$file.sh >> UU/config.sh
2638                 elif $test X$tans = X -o X$tans = Xnone ; then
2639                         : nothing
2640                 else
2641                         : Give one chance to correct a possible typo.
2642                         echo "$file.sh does not exist"
2643                         dflt=$file
2644                         rp="hint to use instead?"
2645                         . UU/myread
2646                         for file in $ans; do
2647                                 if $test -f "$src/hints/$file.sh"; then
2648                                         . $src/hints/$file.sh
2649                                         $cat $src/hints/$file.sh >> UU/config.sh
2650                                 elif $test X$ans = X -o X$ans = Xnone ; then
2651                                         : nothing
2652                                 else
2653                                         echo "$file.sh does not exist -- ignored."
2654                                 fi
2655                         done
2656                 fi
2657         done
2658
2659         hint=recommended
2660         : Remember our hint file for later.
2661         if $test -f "$src/hints/$file.sh" ; then
2662                 hintfile="$file"
2663         else
2664                 hintfile=''
2665         fi
2666 fi
2667 cd UU
2668 ;;
2669 *)
2670         echo " "
2671         echo "Fetching default answers from $config_sh..." >&4
2672         tmp_n="$n"
2673         tmp_c="$c"
2674         cd ..
2675         cp $config_sh config.sh 2>/dev/null
2676         chmod +w config.sh
2677         . ./config.sh
2678         cd UU
2679         cp ../config.sh .
2680         n="$tmp_n"
2681         c="$tmp_c"
2682         hint=previous
2683         ;;
2684 esac
2685 test "$override" && . ./optdef.sh
2686
2687 : Restore computed paths
2688 for file in $loclist $trylist; do
2689         eval $file="\$_$file"
2690 done
2691
2692 cat << EOM
2693
2694 Configure uses the operating system name and version to set some defaults.
2695 The default value is probably right if the name rings a bell. Otherwise,
2696 since spelling matters for me, either accept the default or answer "none"
2697 to leave it blank.
2698
2699 EOM
2700 case "$osname" in
2701         ''|' ')
2702                 case "$hintfile" in
2703                 ''|' '|none) dflt=none ;;
2704                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2705                 esac
2706                 ;;
2707         *) dflt="$osname" ;;
2708 esac
2709 rp="Operating system name?"
2710 . ./myread
2711 case "$ans" in
2712 none)  osname='' ;;
2713 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2714 esac
2715 echo " "
2716 case "$osvers" in
2717         ''|' ')
2718                 case "$hintfile" in
2719                 ''|' '|none) dflt=none ;;
2720                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2721                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2722                         case "$dflt" in
2723                         ''|' ') dflt=none ;;
2724                         esac
2725                         ;;
2726                 esac
2727                 ;;
2728         *) dflt="$osvers" ;;
2729 esac
2730 rp="Operating system version?"
2731 . ./myread
2732 case "$ans" in
2733 none)  osvers='' ;;
2734 *) osvers="$ans" ;;
2735 esac
2736
2737
2738 . ./posthint.sh
2739
2740 : who configured the system
2741 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2742 cf_by=`(logname) 2>/dev/null`
2743 case "$cf_by" in
2744 "")
2745         cf_by=`(whoami) 2>/dev/null`
2746         case "$cf_by" in
2747         "") cf_by=unknown ;;
2748         esac ;;
2749 esac
2750
2751 : set up the script used to warn in case of inconsistency
2752 cat <<EOS >whoa
2753 $startsh
2754 EOS
2755 cat <<'EOSC' >>whoa
2756 dflt=y
2757 echo " "
2758 echo "*** WHOA THERE!!! ***" >&4
2759 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2760 rp="    Keep the $hint value?"
2761 . ./myread
2762 case "$ans" in
2763 y) td=$was; tu=$was;;
2764 esac
2765 EOSC
2766
2767 : function used to set $1 to $val
2768 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2769 case "$val$was" in
2770 $define$undef) . ./whoa; eval "$var=\$td";;
2771 $undef$define) . ./whoa; eval "$var=\$tu";;
2772 *) eval "$var=$val";;
2773 esac'
2774
2775 case "$usethreads" in
2776 $define|true|[yY]*)     dflt='y';;
2777 *) dflt='n';;
2778 esac
2779 cat <<EOM
2780
2781 Perl can be built to take advantage of threads on some systems.
2782 To do so, Configure can be run with -Dusethreads.
2783
2784 Note that threading is a highly experimental feature, and
2785 some known race conditions still remain.  If you choose to try
2786 it, be very sure to not actually deploy it for production
2787 purposes.  README.threads has more details, and is required
2788 reading if you enable threads.
2789
2790 If this doesn't make any sense to you, just accept the default '$dflt'.
2791 EOM
2792 rp='Build a threading Perl?'
2793 . ./myread
2794 case "$ans" in
2795 y|Y)    val="$define" ;;
2796 *)      val="$undef" ;;
2797 esac
2798 set usethreads
2799 eval $setvar
2800
2801 case "$usethreads" in
2802 $define)
2803         $cat <<EOM
2804
2805 As of 5.5.640, Perl has two different internal threading implementations,
2806 the 5.005 version (5005threads) and an interpreter-based version
2807 (ithreads) that has one interpreter per thread.  Both are very 
2808 experimental.  This arrangement exists to help developers work out
2809 which one is better.
2810
2811 If you're a casual user, you probably don't want interpreter-threads
2812 at this time.  There doesn't yet exist a way to create threads from
2813 within Perl in this model, i.e., "use Thread;" will NOT work.
2814 EOM
2815         : Default to ithreads unless overridden on command line or with
2816         : old config.sh
2817         dflt='y'
2818         case "$use5005threads" in
2819                 $define|true|[yY]*) dflt='n';;
2820         esac
2821         case "$useithreads" in
2822                 $undef|false|[nN]*) dflt='n';;
2823         esac
2824         rp='Use interpreter-based ithreads?'
2825         . ./myread
2826         case "$ans" in
2827         y|Y)    val="$define" ;;
2828         *)      val="$undef" ;;
2829         esac
2830         set useithreads
2831         eval $setvar
2832         : Now set use5005threads to the opposite value.
2833         case "$useithreads" in
2834         $define) val="$undef" ;;
2835         *) val="$define" ;;
2836         esac
2837         set use5005threads
2838         eval $setvar
2839         ;;
2840 *)
2841         useithreads="$undef"
2842         use5005threads="$undef"
2843         ;;
2844 esac
2845
2846 case "$d_oldpthreads" in
2847 '')     : Configure tests would be welcome here.  For now, assume undef.
2848         val="$undef" ;;
2849 *)      val="$d_oldpthreads" ;;
2850 esac
2851 set d_oldpthreads
2852 eval $setvar
2853
2854
2855 case "$usethreads" in
2856 "$define"|true|[yY]*)
2857 : Look for a hint-file generated 'call-back-unit'.  If the
2858 : user has specified that a threading perl is to be built,
2859 : we may need to set or change some other defaults.
2860         if $test -f usethreads.cbu; then
2861                 echo "Your platform has some specific hints for threaded builds, using them..."
2862                 . ./usethreads.cbu
2863         else
2864                 $cat <<EOM
2865 (Your platform doesn't have any specific hints for threaded builds.
2866  Assuming POSIX threads, then.)
2867 EOM
2868         fi
2869         ;;
2870 esac
2871
2872 cat <<EOM
2873
2874 Perl can be built so that multiple Perl interpreters can coexist
2875 within the same Perl executable.
2876 EOM
2877
2878 case "$useithreads" in
2879 $define)
2880         cat <<EOM
2881 This multiple interpreter support is required for interpreter-based threads.
2882 EOM
2883         val="$define"
2884         ;;
2885 *)      case "$usemultiplicity" in
2886         $define|true|[yY]*)     dflt='y';;
2887         *) dflt='n';;
2888         esac
2889         echo " "
2890         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2891         rp='Build Perl for multiplicity?'
2892         . ./myread
2893         case "$ans" in
2894         y|Y)    val="$define" ;;
2895         *)      val="$undef" ;;
2896         esac
2897         ;;
2898 esac
2899 set usemultiplicity
2900 eval $setvar
2901
2902 : make some quick guesses about what we are up against
2903 echo " "
2904 $echo $n "Hmm...  $c"
2905 echo exit 1 >bsd
2906 echo exit 1 >usg
2907 echo exit 1 >v7
2908 echo exit 1 >osf1
2909 echo exit 1 >eunice
2910 echo exit 1 >xenix
2911 echo exit 1 >venix
2912 echo exit 1 >os2
2913 d_bsd="$undef"
2914 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2915 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2916 then
2917         echo "Looks kind of like an OSF/1 system, but we'll see..."
2918         echo exit 0 >osf1
2919 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2920         xxx=`./loc addbib blurfl $pth`
2921         if $test -f $xxx; then
2922         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2923                 echo exit 0 >bsd
2924                 echo exit 0 >usg
2925         else
2926                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2927                         echo "Looks kind of like an extended USG system, but we'll see..."
2928                 else
2929                         echo "Looks kind of like a USG system, but we'll see..."
2930                 fi
2931                 echo exit 0 >usg
2932         fi
2933 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2934         echo "Looks kind of like a BSD system, but we'll see..."
2935         d_bsd="$define"
2936         echo exit 0 >bsd
2937 else
2938         echo "Looks kind of like a Version 7 system, but we'll see..."
2939         echo exit 0 >v7
2940 fi
2941 case "$eunicefix" in
2942 *unixtovms*)
2943         $cat <<'EOI'
2944 There is, however, a strange, musty smell in the air that reminds me of
2945 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2946 EOI
2947         echo exit 0 >eunice
2948         d_eunice="$define"
2949 : it so happens the Eunice I know will not run shell scripts in Unix format
2950         ;;
2951 *)
2952         echo " "
2953         echo "Congratulations.  You aren't running Eunice."
2954         d_eunice="$undef"
2955         ;;
2956 esac
2957 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2958 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2959 : semicolon as a patch separator
2960 case "$p_" in
2961 :) ;;
2962 *)
2963         $cat <<'EOI'
2964 I have the feeling something is not exactly right, however...don't tell me...
2965 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2966 (Or you may be running DOS with DJGPP.)
2967 EOI
2968         echo exit 0 >os2
2969         ;;
2970 esac
2971 if test -f /xenix; then
2972         echo "Actually, this looks more like a XENIX system..."
2973         echo exit 0 >xenix
2974         d_xenix="$define"
2975 else
2976         echo " "
2977         echo "It's not Xenix..."
2978         d_xenix="$undef"
2979 fi
2980 chmod +x xenix
2981 $eunicefix xenix
2982 if test -f /venix; then
2983         echo "Actually, this looks more like a VENIX system..."
2984         echo exit 0 >venix
2985 else
2986         echo " "
2987         if ./xenix; then
2988                 : null
2989         else
2990                 echo "Nor is it Venix..."
2991         fi
2992 fi
2993 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2994 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2995 $rm -f foo
2996
2997 case "$cc" in
2998 '') dflt=cc;;
2999 *) dflt="$cc";;
3000 esac
3001 rp="Use which C compiler?"
3002 . ./myread
3003 cc="$ans"
3004 : Look for a hint-file generated 'call-back-unit'.  Now that the
3005 : user has specified the compiler, we may need to set or change some
3006 : other defaults.
3007 if $test -f cc.cbu; then
3008     . ./cc.cbu
3009 fi
3010 . ./checkcc
3011
3012 echo " "
3013 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3014 $cat >gccvers.c <<EOM
3015 #include <stdio.h>
3016 int main() {
3017 #ifdef __GNUC__
3018 #ifdef __VERSION__
3019         printf("%s\n", __VERSION__);
3020 #else
3021         printf("%s\n", "1");
3022 #endif
3023 #endif
3024         exit(0);
3025 }
3026 EOM
3027 if $cc -o gccvers $ldflags gccvers.c; then
3028         gccversion=`./gccvers`
3029         case "$gccversion" in
3030         '') echo "You are not using GNU cc." ;;
3031         *)  echo "You are using GNU cc $gccversion."
3032             ccname=gcc  
3033             ;;
3034         esac
3035 else
3036         echo " "
3037         echo "*** WHOA THERE!!! ***" >&4
3038         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3039         case "$knowitall" in
3040         '')
3041         echo "    You'd better start hunting for one and let me know about it." >&4
3042                 exit 1
3043                 ;;
3044         esac
3045 fi
3046 $rm -f gccvers*
3047 case "$gccversion" in
3048 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3049 esac
3050 case "$gccversion" in
3051 '') gccosandvers='' ;;
3052 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3053    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3054    gccshortvers=''
3055    case "$gccosandvers" in
3056    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3057    $osname$osvers) ;; # looking good
3058    $osname*) cat <<EOM >&4
3059
3060 *** WHOA THERE!!! ***
3061
3062     Your gcc has not been compiled for the exact release of
3063     your operating system ($gccosandvers versus $osname$osvers).
3064
3065     In general it is a good idea to keep gcc synchronized with
3066     the operating system because otherwise serious problems
3067     may ensue when trying to compile software, like Perl.
3068
3069     I'm trying to be optimistic here, though, and will continue.
3070     If later during the configuration and build icky compilation
3071     problems appear (headerfile conflicts being the most common
3072     manifestation), I suggest reinstalling the gcc to match
3073     your operating system release.
3074
3075 EOM
3076       ;;
3077    *) gccosandvers='' ;; # failed to parse, better be silent
3078    esac
3079    ;;
3080 esac
3081 case "$ccname" in
3082 '') ccname="$cc" ;;
3083 esac
3084
3085 : see how we invoke the C preprocessor
3086 echo " "
3087 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3088 cat <<'EOT' >testcpp.c
3089 #define ABC abc
3090 #define XYZ xyz
3091 ABC.XYZ
3092 EOT
3093 cd ..
3094 if test ! -f cppstdin; then
3095         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3096                 # AIX cc -E doesn't show the absolute headerfile
3097                 # locations but we'll cheat by using the -M flag.
3098                 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
3099         else
3100                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3101         fi
3102 else
3103         echo "Keeping your $hint cppstdin wrapper."
3104 fi
3105 chmod 755 cppstdin
3106 wrapper=`pwd`/cppstdin
3107 ok='false'
3108 cd UU
3109
3110 if $test "X$cppstdin" != "X" && \
3111         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3112         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3113 then
3114         echo "You used to use $cppstdin $cppminus so we'll use that again."
3115         case "$cpprun" in
3116         '') echo "But let's see if we can live without a wrapper..." ;;
3117         *)
3118                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3119                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3120                 then
3121                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3122                         ok='true'
3123                 else
3124                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3125                 fi
3126                 ;;
3127         esac
3128 else
3129         case "$cppstdin" in
3130         '') ;;
3131         *)
3132                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3133                 ;;
3134         esac
3135 fi
3136
3137 if $ok; then
3138         : nothing
3139 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3140         $cc -E <testcpp.c >testcpp.out 2>&1; \
3141         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3142         echo "Yup, it does."
3143         x_cpp="$cc -E"
3144         x_minus='';
3145 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3146         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3148         echo "Yup, it does."
3149         x_cpp="$cc -E"
3150         x_minus='-';
3151 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3152         $cc -P <testcpp.c >testcpp.out 2>&1; \
3153         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3154         echo "Yipee, that works!"
3155         x_cpp="$cc -P"
3156         x_minus='';
3157 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3158         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3159         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3160         echo "At long last!"
3161         x_cpp="$cc -P"
3162         x_minus='-';
3163 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3164         $cpp <testcpp.c >testcpp.out 2>&1; \
3165         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3166         echo "It works!"
3167         x_cpp="$cpp"
3168         x_minus='';
3169 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3170         $cpp - <testcpp.c >testcpp.out 2>&1; \
3171         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3172         echo "Hooray, it works!  I was beginning to wonder."
3173         x_cpp="$cpp"
3174         x_minus='-';
3175 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3176         $wrapper <testcpp.c >testcpp.out 2>&1; \
3177         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3178         x_cpp="$wrapper"
3179         x_minus=''
3180         echo "Eureka!"
3181 else
3182         dflt=''
3183         rp="No dice.  I can't find a C preprocessor.  Name one:"
3184         . ./myread
3185         x_cpp="$ans"
3186         x_minus=''
3187         $x_cpp <testcpp.c >testcpp.out 2>&1
3188         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3189                 echo "OK, that will do." >&4
3190         else
3191 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3192                 exit 1
3193         fi
3194 fi
3195
3196 case "$ok" in
3197 false)
3198         cppstdin="$x_cpp"
3199         cppminus="$x_minus"
3200         cpprun="$x_cpp"
3201         cpplast="$x_minus"
3202         set X $x_cpp
3203         shift
3204         case "$1" in
3205         "$cpp")
3206                 echo "Perhaps can we force $cc -E using a wrapper..."
3207                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3208                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3209                 then
3210                         echo "Yup, we can."
3211                         cppstdin="$wrapper"
3212                         cppminus='';
3213                 else
3214                         echo "Nope, we'll have to live without it..."
3215                 fi
3216                 ;;
3217         esac
3218         case "$cpprun" in
3219         "$wrapper")
3220                 cpprun=''
3221                 cpplast=''
3222                 ;;
3223         esac
3224         ;;
3225 esac
3226
3227 case "$cppstdin" in
3228 "$wrapper"|'cppstdin') ;;
3229 *) $rm -f $wrapper;;
3230 esac
3231 $rm -f testcpp.c testcpp.out
3232
3233 : decide how portable to be.  Allow command line overrides.
3234 case "$d_portable" in
3235 "$undef") ;;
3236 *)      d_portable="$define" ;;
3237 esac
3238
3239 : set up shell script to do ~ expansion
3240 cat >filexp <<EOSS
3241 $startsh
3242 : expand filename
3243 case "\$1" in
3244  ~/*|~)
3245         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3246         ;;
3247  ~*)
3248         if $test -f /bin/csh; then
3249                 /bin/csh -f -c "glob \$1"
3250                 failed=\$?
3251                 echo ""
3252                 exit \$failed
3253         else
3254                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3255                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3256                 if $test ! -d "\$dir"; then
3257                         me=\`basename \$0\`
3258                         echo "\$me: can't locate home directory for: \$name" >&2
3259                         exit 1
3260                 fi
3261                 case "\$1" in
3262                 */*)
3263                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3264                         ;;
3265                 *)
3266                         echo \$dir
3267                         ;;
3268                 esac
3269         fi
3270         ;;
3271 *)
3272         echo \$1
3273         ;;
3274 esac
3275 EOSS
3276 chmod +x filexp
3277 $eunicefix filexp
3278
3279 : now set up to get a file name
3280 cat <<EOS >getfile
3281 $startsh
3282 EOS
3283 cat <<'EOSC' >>getfile
3284 tilde=''
3285 fullpath=''
3286 already=''
3287 skip=''
3288 none_ok=''
3289 exp_file=''
3290 nopath_ok=''
3291 orig_rp="$rp"
3292 orig_dflt="$dflt"
3293 case "$gfpth" in
3294 '') gfpth='.' ;;
3295 esac
3296
3297 case "$fn" in
3298 *\(*)
3299         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3300         fn=`echo $fn | sed 's/(.*)//'`
3301         ;;
3302 esac
3303
3304 case "$fn" in
3305 *:*)
3306         loc_file=`expr $fn : '.*:\(.*\)'`
3307         fn=`expr $fn : '\(.*\):.*'`
3308         ;;
3309 esac
3310
3311 case "$fn" in
3312 *~*) tilde=true;;
3313 esac
3314 case "$fn" in
3315 */*) fullpath=true;;
3316 esac
3317 case "$fn" in
3318 *+*) skip=true;;
3319 esac
3320 case "$fn" in
3321 *n*) none_ok=true;;
3322 esac
3323 case "$fn" in
3324 *e*) exp_file=true;;
3325 esac
3326 case "$fn" in
3327 *p*) nopath_ok=true;;
3328 esac
3329
3330 case "$fn" in
3331 *f*) type='File';;
3332 *d*) type='Directory';;
3333 *l*) type='Locate';;
3334 esac
3335
3336 what="$type"
3337 case "$what" in
3338 Locate) what='File';;
3339 esac
3340
3341 case "$exp_file" in
3342 '')
3343         case "$d_portable" in
3344         "$define") ;;
3345         *) exp_file=true;;
3346         esac
3347         ;;
3348 esac
3349
3350 cd ..
3351 while test "$type"; do
3352         redo=''
3353         rp="$orig_rp"
3354         dflt="$orig_dflt"
3355         case "$tilde" in
3356         true) rp="$rp (~name ok)";;
3357         esac
3358         . UU/myread
3359         if test -f UU/getfile.ok && \
3360                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3361         then
3362                 value="$ans"
3363                 ansexp="$ans"
3364                 break
3365         fi
3366         case "$ans" in
3367         none)
3368                 value=''
3369                 ansexp=''
3370                 case "$none_ok" in
3371                 true) type='';;
3372                 esac
3373                 ;;
3374         *)
3375                 case "$tilde" in
3376                 '') value="$ans"
3377                         ansexp="$ans";;
3378                 *)
3379                         value=`UU/filexp $ans`
3380                         case $? in
3381                         0)
3382                                 if test "$ans" != "$value"; then
3383                                         echo "(That expands to $value on this system.)"
3384                                 fi
3385                                 ;;
3386                         *) value="$ans";;
3387                         esac
3388                         ansexp="$value"
3389                         case "$exp_file" in
3390                         '') value="$ans";;
3391                         esac
3392                         ;;
3393                 esac
3394                 case "$fullpath" in
3395                 true)
3396                         case "$ansexp" in
3397                         /*) value="$ansexp" ;;
3398                         [a-zA-Z]:/*) value="$ansexp" ;;
3399                         *)
3400                                 redo=true
3401                                 case "$already" in
3402                                 true)
3403                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3404                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3405                                         ;;
3406                                 *)
3407                                 echo "Please give a full path name, starting with slash." >&4
3408                                         case "$tilde" in
3409                                         true)
3410                                 echo "Note that using ~name is ok provided it expands well." >&4
3411                                                 already=true
3412                                                 ;;
3413                                         esac
3414                                 esac
3415                                 ;;
3416                         esac
3417                         ;;
3418                 esac
3419                 case "$redo" in
3420                 '')
3421                         case "$type" in
3422                         File)
3423                                 for fp in $gfpth; do
3424                                         if test "X$fp" = X.; then
3425                                             pf="$ansexp"
3426                                         else    
3427                                             pf="$fp/$ansexp"
3428                                         fi
3429                                         if test -f "$pf"; then
3430                                                 type=''
3431                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3432                                         then
3433                                                 echo "($value is not a plain file, but that's ok.)"
3434                                                 type=''
3435                                         fi
3436                                         if test X"$type" = X; then
3437                                             value="$pf"
3438                                             break
3439                                         fi
3440                                 done
3441                                 ;;
3442                         Directory)
3443                                 for fp in $gfpth; do
3444                                         if test "X$fp" = X.; then
3445                                             dir="$ans"
3446                                             direxp="$ansexp"
3447                                         else    
3448                                             dir="$fp/$ansexp"
3449                                             direxp="$fp/$ansexp"
3450                                         fi
3451                                         if test -d "$direxp"; then
3452                                                 type=''
3453                                                 value="$dir"
3454                                                 break
3455                                         fi
3456                                 done
3457                                 ;;
3458                         Locate)
3459                                 if test -d "$ansexp"; then
3460                                         echo "(Looking for $loc_file in directory $value.)"
3461                                         value="$value/$loc_file"
3462                                         ansexp="$ansexp/$loc_file"
3463                                 fi
3464                                 if test -f "$ansexp"; then
3465                                         type=''
3466                                 fi
3467                                 case "$nopath_ok" in
3468                                 true)   case "$value" in
3469                                         */*) ;;
3470                                         *)      echo "Assuming $value will be in people's path."
3471                                                 type=''
3472                                                 ;;
3473                                         esac
3474                                         ;;
3475                                 esac
3476                                 ;;
3477                         esac
3478
3479                         case "$skip" in
3480                         true) type='';
3481                         esac
3482
3483                         case "$type" in
3484                         '') ;;
3485                         *)
3486                                 if test "$fastread" = yes; then
3487                                         dflt=y
3488                                 else
3489                                         dflt=n
3490                                 fi
3491                                 rp="$what $value doesn't exist.  Use that name anyway?"
3492                                 . UU/myread
3493                                 dflt=''
3494                                 case "$ans" in
3495                                 y*) type='';;
3496                                 *) echo " ";;
3497                                 esac
3498                                 ;;
3499                         esac
3500                         ;;
3501                 esac
3502                 ;;
3503         esac
3504 done
3505 cd UU
3506 ans="$value"
3507 rp="$orig_rp"
3508 dflt="$orig_dflt"
3509 rm -f getfile.ok
3510 test "X$gfpthkeep" != Xy && gfpth=""
3511 EOSC
3512
3513 : What should the include directory be ?
3514 echo " "
3515 $echo $n "Hmm...  $c"
3516 dflt='/usr/include'
3517 incpath=''
3518 mips_type=''
3519 if $test -f /bin/mips && /bin/mips; then
3520         echo "Looks like a MIPS system..."
3521         $cat >usr.c <<'EOCP'
3522 #ifdef SYSTYPE_BSD43
3523 /bsd43
3524 #endif
3525 EOCP
3526         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3527                 dflt='/bsd43/usr/include'
3528                 incpath='/bsd43'
3529                 mips_type='BSD 4.3'
3530         else
3531                 mips_type='System V'
3532         fi
3533         $rm -f usr.c usr.out
3534         echo "and you're compiling with the $mips_type compiler and libraries."
3535         xxx_prompt=y
3536         echo "exit 0" >mips
3537 else
3538         echo "Doesn't look like a MIPS system."
3539         xxx_prompt=n
3540         echo "exit 1" >mips
3541 fi
3542 chmod +x mips
3543 $eunicefix mips
3544 case "$usrinc" in
3545 '') ;;
3546 *) dflt="$usrinc";;
3547 esac
3548 case "$xxx_prompt" in
3549 y)      fn=d/
3550         echo " "
3551         rp='Where are the include files you want to use?'
3552         . ./getfile
3553         usrinc="$ans"
3554         ;;
3555 *)      usrinc="$dflt"
3556         ;;
3557 esac
3558
3559 : Set private lib path
3560 case "$plibpth" in
3561 '') if ./mips; then
3562                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3563         fi;;
3564 esac
3565 case "$libpth" in
3566 ' ') dlist='';;
3567 '') dlist="$loclibpth $plibpth $glibpth";;
3568 *) dlist="$libpth";;
3569 esac
3570
3571 : Now check and see which directories actually exist, avoiding duplicates
3572 libpth=''
3573 for xxx in $dlist
3574 do
3575     if $test -d $xxx; then
3576                 case " $libpth " in
3577                 *" $xxx "*) ;;
3578                 *) libpth="$libpth $xxx";;
3579                 esac
3580     fi
3581 done
3582 $cat <<'EOM'
3583
3584 Some systems have incompatible or broken versions of libraries.  Among
3585 the directories listed in the question below, please remove any you
3586 know not to be holding relevant libraries, and add any that are needed.
3587 Say "none" for none.
3588
3589 EOM
3590 case "$libpth" in
3591 '') dflt='none';;
3592 *)
3593         set X $libpth
3594         shift
3595         dflt=${1+"$@"}
3596         ;;
3597 esac
3598 rp="Directories to use for library searches?"
3599 . ./myread
3600 case "$ans" in
3601 none) libpth=' ';;
3602 *) libpth="$ans";;
3603 esac
3604
3605 : compute shared library extension
3606 case "$so" in
3607 '')
3608         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3609                 dflt='sl'
3610         else
3611                 dflt='so'
3612         fi
3613         ;;
3614 *) dflt="$so";;
3615 esac
3616 $cat <<EOM
3617
3618 On some systems, shared libraries may be available.  Answer 'none' if
3619 you want to suppress searching of shared libraries for the remainder
3620 of this configuration.
3621
3622 EOM
3623 rp='What is the file extension used for shared libraries?'
3624 . ./myread
3625 so="$ans"
3626
3627 : Define several unixisms.
3628 : Hints files or command line option can be used to override them.
3629 : The convoluted testing is in case hints files set either the old
3630 : or the new name.
3631 case "$_exe" in
3632 '')     case "$exe_ext" in
3633     '') ;;
3634         *)      _exe="$exe_ext" ;;
3635         esac
3636         ;;
3637 esac
3638 case "$_a" in
3639 '')     case "$lib_ext" in
3640     '') _a='.a';;
3641         *)      _a="$lib_ext" ;;
3642         esac
3643         ;;
3644 esac
3645 case "$_o" in
3646 '') case "$obj_ext" in
3647         '')     _o='.o';;
3648         *)      _o="$obj_ext";;
3649         esac
3650         ;;
3651 esac
3652 case "$p_" in
3653 '') case "$path_sep" in
3654         '')     p_=':';;
3655         *)      p_="$path_sep";;
3656         esac
3657         ;;
3658 esac
3659 exe_ext=$_exe
3660 lib_ext=$_a
3661 obj_ext=$_o
3662 path_sep=$p_
3663
3664 : Which makefile gets called first.  This is used by make depend.
3665 case "$firstmakefile" in
3666 '') firstmakefile='makefile';;
3667 esac
3668
3669 case "$usesocks" in
3670 $define|true|[yY]*)     dflt='y';;
3671 *) dflt='n';;
3672 esac
3673 cat <<EOM
3674
3675 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3676 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3677 to use the PerlIO abstraction layer, this will be implicitly selected.
3678
3679 If this doesn't make any sense to you, just accept the default '$dflt'.
3680 EOM
3681 rp='Build Perl for SOCKS?'
3682 . ./myread
3683 case "$ans" in
3684 y|Y)    val="$define" ;;     
3685 *)      val="$undef" ;;
3686 esac
3687 set usesocks
3688 eval $setvar
3689
3690 case "$usesocks" in
3691 $define|true|[yY]*) useperlio="$define";;
3692 esac
3693
3694 : Looking for optional libraries
3695 echo " "
3696 echo "Checking for optional libraries..." >&4
3697 case "$libs" in
3698 ' '|'') dflt='';;
3699 *) dflt="$libs";;
3700 esac
3701 case "$libswanted" in
3702 '') libswanted='c_s';;
3703 esac
3704 case "$usesocks" in
3705 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3706 esac
3707 libsfound=''
3708 libsfiles=''
3709 libsdirs=''
3710 libspath=''
3711 for thisdir in $libpth $xlibpth; do
3712   test -d $thisdir && libspath="$libspath $thisdir"
3713 done
3714 for thislib in $libswanted; do
3715         for thisdir in $libspath; do
3716             xxx=''
3717             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3718                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3719                 $test -f "$xxx" && eval $libscheck
3720                 $test -f "$xxx" && libstyle=shared
3721             fi
3722             if test ! -f "$xxx"; then
3723                 xxx=$thisdir/lib$thislib.$so
3724                 $test -f "$xxx" && eval $libscheck
3725                 $test -f "$xxx" && libstyle=shared
3726             fi  
3727             if test ! -f "$xxx"; then
3728                 xxx=$thisdir/lib$thislib$_a
3729                 $test -f "$xxx" && eval $libscheck
3730                 $test -f "$xxx" && libstyle=static
3731             fi
3732             if test ! -f "$xxx"; then
3733                 xxx=$thisdir/$thislib$_a
3734                 $test -f "$xxx" && eval $libscheck
3735                 $test -f "$xxx" && libstyle=static
3736             fi
3737             if test ! -f "$xxx"; then
3738                 xxx=$thisdir/lib${thislib}_s$_a
3739                 $test -f "$xxx" && eval $libscheck
3740                 $test -f "$xxx" && libstyle=static
3741                 $test -f "$xxx" && thislib=${thislib}_s
3742             fi
3743             if test ! -f "$xxx"; then
3744                 xxx=$thisdir/Slib$thislib$_a
3745                 $test -f "$xxx" && eval $libscheck
3746                 $test -f "$xxx" && libstyle=static
3747             fi
3748             if $test -f "$xxx"; then
3749                 case "$libstyle" in
3750                 shared) echo "Found -l$thislib (shared)." ;;
3751                 static) echo "Found -l$thislib." ;;
3752                 *)      echo "Found -l$thislib ($libstyle)." ;;
3753                 esac
3754                 case " $dflt " in
3755                 *"-l$thislib "*);;
3756                 *) dflt="$dflt -l$thislib"
3757                    libsfound="$libsfound $xxx"
3758                    yyy=`basename $xxx`
3759                    libsfiles="$libsfiles $yyy"
3760                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3761                    case " $libsdirs " in
3762                    *" $yyy "*) ;;
3763                    *) libsdirs="$libsdirs $yyy" ;;
3764                    esac
3765                    ;;
3766                 esac
3767                 break
3768             fi  
3769         done
3770         if $test ! -f "$xxx"; then
3771             echo "No -l$thislib."
3772         fi
3773 done
3774 set X $dflt
3775 shift
3776 dflt="$*"
3777 case "$libs" in
3778 '') dflt="$dflt";;
3779 *) dflt="$libs";;
3780 esac
3781 case "$dflt" in
3782 ' '|'') dflt='none';;
3783 esac
3784
3785 $cat <<EOM
3786
3787 In order to compile $package on your machine, a number of libraries
3788 are usually needed.  Include any other special libraries here as well.
3789 Say "none" for none.  The default list is almost always right.
3790 EOM
3791
3792 echo " "
3793 rp="What libraries to use?"
3794 . ./myread
3795 case "$ans" in
3796 none) libs=' ';;
3797 *) libs="$ans";;
3798 esac
3799
3800 : determine optimization, if desired, or use for debug flag also
3801 case "$optimize" in
3802 ' '|$undef) dflt='none';;
3803 '') dflt='-O';;
3804 *) dflt="$optimize";;
3805 esac
3806 $cat <<EOH
3807
3808 By default, $package compiles with the -O flag to use the optimizer.
3809 Alternately, you might want to use the symbolic debugger, which uses
3810 the -g flag (on traditional Unix systems).  Either flag can be
3811 specified here.  To use neither flag, specify the word "none".
3812
3813 EOH
3814 rp="What optimizer/debugger flag should be used?"
3815 . ./myread
3816 optimize="$ans"
3817 case "$optimize" in
3818 'none') optimize=" ";;
3819 esac
3820
3821 dflt=''
3822 : We will not override a previous value, but we might want to
3823 : augment a hint file
3824 case "$hint" in
3825 default|recommended)
3826         case "$gccversion" in
3827         1*) dflt='-fpcc-struct-return' ;;
3828         esac
3829         case "$optimize" in
3830         *-g*) dflt="$dflt -DDEBUGGING";;
3831         esac
3832         case "$gccversion" in
3833         2*) if test -d /etc/conf/kconfig.d &&
3834                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3835                 then
3836                         dflt="$dflt -posix"
3837                 fi
3838                 ;;
3839         esac
3840         case "$gccversion" in
3841         1*) ;;
3842         2.[0-8]*) ;;
3843         ?*)     echo " "
3844                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3845                 echo 'int main(void) { return 0; }' > gcctest.c
3846                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3847                         echo "Yes, it does." 2>&1
3848                         case "$ccflags" in
3849                         *strict-aliasing*) 
3850                                 echo "Leaving current flags $ccflags alone." 2>&1
3851                                 ;;
3852                         *) dflt="$dflt -fno-strict-aliasing" ;;
3853                         esac
3854                 else
3855                         echo "Nope, it doesn't, but that's ok." 2>&1
3856                 fi
3857                 ;;
3858         esac
3859         ;;
3860 esac
3861
3862 case "$mips_type" in
3863 *BSD*|'') inclwanted="$locincpth $usrinc";;
3864 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3865 esac
3866 for thisincl in $inclwanted; do
3867         if $test -d $thisincl; then
3868                 if $test x$thisincl != x$usrinc; then
3869                         case "$dflt" in
3870                         *" -I$thisincl "*);;
3871                         *) dflt="$dflt -I$thisincl ";;
3872                         esac
3873                 fi
3874         fi
3875 done
3876
3877 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3878         xxx=true;
3879 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3880         xxx=true;
3881 else
3882         xxx=false;
3883 fi;
3884 if $xxx; then
3885         case "$dflt" in
3886         *$2*);;
3887         *) dflt="$dflt -D$2";;
3888         esac;
3889 fi'
3890
3891 set signal.h LANGUAGE_C; eval $inctest
3892
3893 case "$usesocks" in
3894 $define)
3895         ccflags="$ccflags -DSOCKS"
3896         ;;
3897 esac
3898
3899 case "$hint" in
3900 default|recommended) dflt="$ccflags $dflt" ;;
3901 *) dflt="$ccflags";;
3902 esac
3903
3904 case "$dflt" in
3905 ''|' ') dflt=none;;
3906 esac
3907
3908 $cat <<EOH
3909
3910 Your C compiler may want other flags.  For this question you should include
3911 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3912 but you should NOT include libraries or ld flags like -lwhatever.  If you
3913 want $package to honor its debug switch, you should include -DDEBUGGING here.
3914 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3915
3916 To use no flags, specify the word "none".
3917
3918 EOH
3919 set X $dflt
3920 shift
3921 dflt=${1+"$@"}
3922 rp="Any additional cc flags?"
3923 . ./myread
3924 case "$ans" in
3925 none) ccflags='';;
3926 *) ccflags="$ans";;
3927 esac
3928
3929 : the following weeds options from ccflags that are of no interest to cpp
3930 cppflags="$ccflags"
3931 case "$gccversion" in
3932 1*) cppflags="$cppflags -D__GNUC__"
3933 esac
3934 case "$mips_type" in
3935 '');;
3936 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3937 esac
3938 case "$cppflags" in
3939 '');;
3940 *)
3941         echo " "
3942         echo "Let me guess what the preprocessor flags are..." >&4
3943         set X $cppflags
3944         shift
3945         cppflags=''
3946         $cat >cpp.c <<'EOM'
3947 #define BLURFL foo
3948
3949 BLURFL xx LFRULB
3950 EOM
3951         previous=''
3952         for flag in $*
3953         do
3954                 case "$flag" in
3955                 -*) ftry="$flag";;
3956                 *) ftry="$previous $flag";;
3957                 esac
3958                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3959                         >cpp1.out 2>/dev/null && \
3960                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3961                         >cpp2.out 2>/dev/null && \
3962                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3963                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3964                 then
3965                         cppflags="$cppflags $ftry"
3966                         previous=''
3967                 else
3968                         previous="$flag"
3969                 fi
3970         done
3971         set X $cppflags
3972         shift
3973         cppflags=${1+"$@"}
3974         case "$cppflags" in
3975         *-*)  echo "They appear to be: $cppflags";;
3976         esac
3977         $rm -f cpp.c cpp?.out
3978         ;;
3979 esac
3980
3981 : flags used in final linking phase
3982 case "$ldflags" in
3983 '') if ./venix; then
3984                 dflt='-i -z'
3985         else
3986                 dflt=''
3987         fi
3988         case "$ccflags" in
3989         *-posix*) dflt="$dflt -posix" ;;
3990         esac
3991         ;;
3992 *) dflt="$ldflags";;
3993 esac
3994
3995 : Try to guess additional flags to pick up local libraries.
3996 for thislibdir in $libpth; do
3997         case " $loclibpth " in
3998         *" $thislibdir "*)
3999                 case "$dflt " in 
4000                 *"-L$thislibdir "*) ;;
4001                 *)  dflt="$dflt -L$thislibdir" ;;
4002                 esac
4003                 ;;
4004         esac
4005 done
4006
4007 case "$dflt" in
4008 '') dflt='none' ;;
4009 esac
4010
4011 $cat <<EOH
4012
4013 Your C linker may need flags.  For this question you should
4014 include -L/whatever and any other flags used by the C linker, but you
4015 should NOT include libraries like -lwhatever.
4016
4017 Make sure you include the appropriate -L/path flags if your C linker
4018 does not normally search all of the directories you specified above,
4019 namely
4020         $libpth
4021 To use no flags, specify the word "none".
4022
4023 EOH
4024
4025 rp="Any additional ld flags (NOT including libraries)?"
4026 . ./myread
4027 case "$ans" in
4028 none) ldflags='';;
4029 *) ldflags="$ans";;
4030 esac
4031 rmlist="$rmlist pdp11"
4032
4033 : coherency check
4034 echo " "
4035 echo "Checking your choice of C compiler and flags for coherency..." >&4
4036 $cat > try.c <<'EOF'
4037 #include <stdio.h>
4038 int main() { printf("Ok\n"); exit(0); }
4039 EOF
4040 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4041 shift
4042 $cat >try.msg <<'EOM'
4043 I've tried to compile and run the following simple program:
4044
4045 EOM
4046 $cat try.c >> try.msg
4047
4048 $cat >> try.msg <<EOM
4049
4050 I used the command:
4051
4052         $*
4053         ./try
4054
4055 and I got the following output:
4056
4057 EOM
4058 dflt=y
4059 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4060         if sh -c './try' >>try.msg 2>&1; then
4061                 xxx=`./try`
4062                 case "$xxx" in
4063                 "Ok") dflt=n ;;
4064                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4065                         case " $libs " in
4066                         *" -lsfio "*)
4067                                 cat >> try.msg <<'EOQS'
4068 If $libs contains -lsfio, and sfio is mis-configured, then it
4069 sometimes (apparently) runs and exits with a 0 status, but with no
4070 output!  It may have to do with sfio's use of _exit vs. exit.
4071
4072 EOQS
4073                                 rp="You have a big problem.  Shall I abort Configure"
4074                                 dflt=y
4075                                 ;;
4076                         esac
4077                         ;;
4078                 esac
4079         else
4080                 echo "The program compiled OK, but exited with status $?." >>try.msg
4081                 rp="You have a problem.  Shall I abort Configure"
4082                 dflt=y
4083         fi
4084 else
4085         echo "I can't compile the test program." >>try.msg
4086         rp="You have a BIG problem.  Shall I abort Configure"
4087         dflt=y
4088 fi
4089 case "$dflt" in
4090 y)
4091         $cat try.msg >&4
4092         case "$knowitall" in
4093         '')
4094                 echo "(The supplied flags or libraries might be incorrect.)"
4095                 ;;
4096         *) dflt=n;;
4097         esac
4098         echo " "
4099         . ./myread
4100         case "$ans" in
4101         n*|N*) ;;
4102         *)      echo "Ok.  Stopping Configure." >&4
4103                 exit 1
4104                 ;;
4105         esac
4106         ;;
4107 n) echo "OK, that should do.";;
4108 esac
4109 $rm -f try try.* core
4110
4111 : define an is-a-typedef? function
4112 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4113 case "$inclist" in
4114 "") inclist="sys/types.h";;
4115 esac;
4116 eval "varval=\$$var";
4117 case "$varval" in
4118 "")
4119         $rm -f temp.c;
4120         for inc in $inclist; do
4121                 echo "#include <$inc>" >>temp.c;
4122         done;
4123         echo "#ifdef $type" >> temp.c;
4124         echo "printf(\"We have $type\");" >> temp.c;
4125         echo "#endif" >> temp.c;
4126         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4127         if $contains $type temp.E >/dev/null 2>&1; then
4128                 eval "$var=\$type";
4129         else
4130                 eval "$var=\$def";
4131         fi;
4132         $rm -f temp.?;;
4133 *) eval "$var=\$varval";;
4134 esac'
4135
4136 : define an is-a-typedef? function that prompts if the type is not available.
4137 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138 case "$inclist" in
4139 "") inclist="sys/types.h";;
4140 esac;
4141 eval "varval=\$$var";
4142 case "$varval" in
4143 "")
4144         $rm -f temp.c;
4145         for inc in $inclist; do
4146                 echo "#include <$inc>" >>temp.c;
4147         done;
4148         echo "#ifdef $type" >> temp.c;
4149         echo "printf(\"We have $type\");" >> temp.c;
4150         echo "#endif" >> temp.c;
4151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152         echo " " ;
4153         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4154         if $contains $type temp.E >/dev/null 2>&1; then
4155                 echo "$type found." >&4;
4156                 eval "$var=\$type";
4157         else
4158                 echo "$type NOT found." >&4;
4159                 dflt="$def";
4160                 . ./myread ;
4161                 eval "$var=\$ans";
4162         fi;
4163         $rm -f temp.?;;
4164 *) eval "$var=\$varval";;
4165 esac'
4166
4167 : define a shorthand compile call
4168 compile='
4169 mc_file=$1;
4170 shift;
4171 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4172 : define a shorthand compile call for compilations that should be ok.
4173 compile_ok='
4174 mc_file=$1;
4175 shift;
4176 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4177
4178 : check for lengths of integral types
4179 echo " "
4180 case "$intsize" in
4181 '')
4182         echo "Checking to see how big your integers are..." >&4
4183         $cat >intsize.c <<'EOCP'
4184 #include <stdio.h>
4185 int main()
4186 {
4187         printf("intsize=%d;\n", (int)sizeof(int));
4188         printf("longsize=%d;\n", (int)sizeof(long));
4189         printf("shortsize=%d;\n", (int)sizeof(short));
4190         exit(0);
4191 }
4192 EOCP
4193         set intsize
4194         if eval $compile_ok && ./intsize > /dev/null; then
4195                 eval `./intsize`
4196                 echo "Your integers are $intsize bytes long."
4197                 echo "Your long integers are $longsize bytes long."
4198                 echo "Your short integers are $shortsize bytes long."
4199         else
4200                 $cat >&4 <<EOM
4201 !
4202 Help! I can't compile and run the intsize test program: please enlighten me!
4203 (This is probably a misconfiguration in your system or libraries, and
4204 you really ought to fix it.  Still, I'll try anyway.)
4205 !
4206 EOM
4207                 dflt=4
4208                 rp="What is the size of an integer (in bytes)?"
4209                 . ./myread
4210                 intsize="$ans"
4211                 dflt=$intsize
4212                 rp="What is the size of a long integer (in bytes)?"
4213                 . ./myread
4214                 longsize="$ans"
4215                 dflt=2
4216                 rp="What is the size of a short integer (in bytes)?"
4217                 . ./myread
4218                 shortsize="$ans"
4219         fi
4220         ;;
4221 esac
4222 $rm -f intsize intsize.*
4223
4224 : see what type lseek is declared as in the kernel
4225 rp="What is the type used for lseek's offset on this system?"
4226 set off_t lseektype long stdio.h sys/types.h
4227 eval $typedef_ask
4228
4229 echo " "
4230 echo "Checking to see how big your file offsets are..." >&4
4231 $cat >try.c <<EOCP
4232 #include <sys/types.h>
4233 #include <stdio.h>
4234 int main()
4235 {
4236     printf("%d\n", (int)sizeof($lseektype));
4237     return(0); 
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         lseeksize=`./try`
4243         echo "Your file offsets are $lseeksize bytes long."
4244 else
4245         dflt=$longsize
4246         echo " "
4247         echo "(I can't seem to compile the test program.  Guessing...)"
4248         rp="What is the size of your file offsets (in bytes)?"
4249         . ./myread
4250         lseeksize="$ans"
4251 fi
4252 $rm -f try.c try
4253
4254 : see what type file positions are declared as in the library
4255 rp="What is the type for file position used by fsetpos()?"
4256 set fpos_t fpostype long stdio.h sys/types.h
4257 eval $typedef_ask
4258
4259 echo " "
4260 case "$fpostype" in
4261 *_t) zzz="$fpostype"    ;;
4262 *)   zzz="fpos_t"       ;;
4263 esac
4264 echo "Checking the size of $zzz..." >&4 
4265 cat > try.c <<EOCP
4266 #include <sys/types.h>
4267 #include <stdio.h>
4268 int main() {
4269     printf("%d\n", (int)sizeof($fpostype));
4270     exit(0);
4271 }
4272 EOCP
4273 set try
4274 if eval $compile_ok; then
4275         yyy=`./try`
4276         case "$yyy" in
4277         '')     fpossize=4
4278                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4279                 ;;
4280         *)      fpossize=$yyy
4281                 echo "Your $zzz is $fpossize bytes long."
4282                 ;;
4283         esac
4284 else
4285         dflt="$longsize"
4286         echo " " >&4
4287         echo "(I can't compile the test program.  Guessing...)" >&4
4288         rp="What is the size of your file positions (in bytes)?"
4289         . ./myread
4290         fpossize="$ans"
4291 fi
4292
4293
4294
4295 # Backward compatibility (uselfs is deprecated).
4296 case "$uselfs" in
4297 "$define"|true|[yY]*)
4298         cat <<EOM >&4
4299
4300 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4301 EOM
4302         uselargefiles="$define"
4303         ;;
4304 esac                          
4305
4306 case "$lseeksize:$fpossize" in
4307 8:8) cat <<EOM
4308
4309 You can have files larger than 2 gigabytes.
4310 EOM
4311    val="$define" ;;
4312 *)    case "$uselargefiles" in
4313    "$undef"|false|[nN]*) dflt='n' ;;
4314    *)   dflt='y' ;;
4315    esac
4316    cat <<EOM
4317
4318 Perl can be built to understand large files (files larger than 2 gigabytes)
4319 on some systems.  To do so, Configure can be run with -Duselargefiles.
4320
4321 If this doesn't make any sense to you, just accept the default '$dflt'.
4322 EOM
4323    rp='Try to understand large files, if available?'
4324    . ./myread
4325    case "$ans" in
4326    y|Y)         val="$define" ;;
4327    *)           val="$undef"  ;;
4328    esac
4329    ;;
4330 esac
4331 set uselargefiles
4332 eval $setvar
4333 case "$uselargefiles" in
4334 "$define")
4335 : Look for a hint-file generated 'call-back-unit'.  If the
4336 : user has specified that a large files perl is to be built,
4337 : we may need to set or change some other defaults.
4338         if $test -f uselargefiles.cbu; then
4339                 echo "Your platform has some specific hints for large file builds, using them..."
4340                 . ./uselargefiles.cbu
4341                 echo " "
4342                 echo "Rechecking to see how big your file offsets are..." >&4
4343                 $cat >try.c <<EOCP
4344 #include <sys/types.h>
4345 #include <stdio.h>
4346 int main()
4347 {
4348     printf("%d\n", (int)sizeof($lseektype));
4349     return(0); 
4350 }
4351 EOCP
4352                 set try
4353                 if eval $compile_ok; then
4354                         lseeksize=`./try`
4355                         $echo "Your file offsets are now $lseeksize bytes long."
4356                 else
4357                         dflt="$lseeksize"
4358                         echo " "
4359                         echo "(I can't seem to compile the test program.  Guessing...)"
4360                         rp="What is the size of your file offsets (in bytes)?"
4361                         . ./myread
4362                         lseeksize="$ans"
4363                 fi
4364                 case "$fpostype" in
4365                 *_t) zzz="$fpostype"    ;;
4366                 *)   zzz="fpos_t"       ;;
4367                 esac
4368                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4369                 $cat > try.c <<EOCP
4370 #include <sys/types.h>
4371 #include <stdio.h>
4372 int main() {
4373     printf("%d\n", (int)sizeof($fpostype));
4374     exit(0);
4375 }
4376 EOCP
4377                 set try
4378                 if eval $compile_ok; then
4379                         yyy=`./try`
4380                         dflt="$lseeksize"
4381                         case "$yyy" in
4382                         '')     echo " "
4383                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4384                                 ;;
4385                         *)      fpossize=$yyy
4386                                 echo " $fpossize bytes." >&4
4387                                 ;;
4388                         esac
4389                 else
4390                         dflt="$fpossize"
4391                         echo " "
4392                         echo "(I can't compile the test program.  Guessing...)" >&4
4393                         rp="What is the size of your file positions (in bytes)?"
4394                         . ./myread
4395                         fpossize="$ans"
4396                 fi
4397                 $rm -f try.c try
4398         fi
4399         ;;
4400 esac
4401
4402
4403 case "$usemorebits" in
4404 "$define"|true|[yY]*)
4405         use64bitint="$define"
4406         uselongdouble="$define"
4407         usemorebits="$define"
4408         ;;
4409 *)      usemorebits="$undef"
4410         ;;
4411 esac
4412
4413
4414 case "$uselonglong" in
4415 "$define"|true|[yY]*)
4416         cat <<EOM >&4
4417
4418 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4419 EOM
4420         use64bitint="$define"
4421         ;;
4422 esac                          
4423 case "$use64bits" in
4424 "$define"|true|[yY]*)
4425         cat <<EOM >&4
4426
4427 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4428 EOM
4429         use64bitint="$define"
4430         ;;
4431 esac                          
4432 case "$use64bitints" in
4433 "$define"|true|[yY]*)
4434         cat <<EOM >&4
4435
4436 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4437 EOM
4438         use64bitint="$define"
4439         ;;
4440 esac                          
4441 case "$use64bitsint" in
4442 "$define"|true|[yY]*)
4443         cat <<EOM >&4
4444
4445 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4446 EOM
4447         use64bitint="$define"
4448         ;;
4449 esac                          
4450 case "$uselonglongs" in
4451 "$define"|true|[yY]*)
4452         cat <<EOM >&4
4453
4454 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4455 EOM
4456         use64bitint="$define"
4457         ;;
4458 esac                          
4459 case "$use64bitsall" in
4460 "$define"|true|[yY]*)
4461         cat <<EOM >&4
4462
4463 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4464 EOM
4465         use64bitall="$define"
4466         ;;
4467 esac                          
4468
4469 case "$ccflags" in
4470 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4471 esac
4472 case "$use64bitall" in
4473 "$define"|true|[yY]*) use64bitint="$define" ;;
4474 esac
4475
4476 case "$longsize" in
4477 8) cat <<EOM
4478
4479 You have natively 64-bit long integers.
4480 EOM
4481    val="$define"
4482    ;;
4483 *) case "$use64bitint" in
4484    "$define"|true|[yY]*) dflt='y';;
4485    *) dflt='n';;
4486    esac
4487    cat <<EOM
4488
4489 Perl can be built to take advantage of 64-bit integer types
4490 on some systems.  To do so, Configure can be run with -Duse64bitint.
4491 Choosing this option will most probably introduce binary incompatibilities.
4492
4493 If this doesn't make any sense to you, just accept the default '$dflt'.
4494 EOM
4495    rp='Try to use 64-bit integers, if available?'
4496    . ./myread
4497    case "$ans" in
4498    [yY]*) val="$define" ;;
4499    *)     val="$undef"  ;;
4500    esac
4501    ;;
4502 esac
4503 set use64bitint
4504 eval $setvar
4505
4506 case "$use64bitall" in
4507 "$define"|true|[yY]*) dflt='y' ;;
4508 *) case "$longsize" in
4509    8) dflt='y' ;;
4510    *) dflt='n' ;;
4511    esac
4512    ;;
4513 esac    
4514 cat <<EOM
4515
4516 You may also choose to try maximal 64-bitness.  It means using as much
4517 64-bitness as possible on the platform.  This in turn means even more
4518 binary incompatibilities.  On the other hand, your platform may not
4519 have any more 64-bitness available than what you already have chosen.
4520
4521 If this doesn't make any sense to you, just accept the default '$dflt'.
4522 EOM
4523 rp='Try to use maximal 64-bit support, if available?'
4524 . ./myread
4525 case "$ans" in
4526 [yY]*) val="$define" ;;
4527 *)     val="$undef"  ;;
4528 esac
4529 set use64bitall
4530 eval $setvar
4531 case "$use64bitall" in
4532 "$define")
4533         case "$use64bitint" in
4534         "$undef")
4535                 cat <<EOM
4536
4537 Since you have chosen a maximally 64-bit build, I'm also turning on
4538 the use of 64-bit integers.
4539 EOM
4540                 use64bitint="$define" ;;
4541         esac
4542         ;;
4543 esac
4544
4545 case "$use64bitint" in
4546 "$define"|true|[yY]*)
4547 : Look for a hint-file generated 'call-back-unit'.  If the
4548 : user has specified that a 64-bit perl is to be built,
4549 : we may need to set or change some other defaults.
4550         if $test -f use64bitint.cbu; then
4551                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4552                 . ./use64bitint.cbu
4553         fi
4554         case "$longsize" in
4555         4) case "$archname64" in
4556            '') archname64=64int ;;
4557            esac
4558            ;;
4559         esac
4560         ;;
4561 esac
4562
4563 case "$use64bitall" in
4564 "$define"|true|[yY]*)
4565 : Look for a hint-file generated 'call-back-unit'.  If the
4566 : user has specified that a maximally 64-bit perl is to be built,
4567 : we may need to set or change some other defaults.
4568         if $test -f use64bitall.cbu; then
4569                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4570                 . ./use64bitall.cbu
4571         fi
4572         case "$longsize" in
4573         4) case "$archname64" in
4574            ''|64int) archname64=64all ;;
4575            esac
4576            ;;
4577         esac
4578         ;;
4579 esac
4580
4581 echo " "
4582 echo "Checking for GNU C Library..." >&4
4583 cat >gnulibc.c <<EOM
4584 #include <stdio.h>
4585 int main()
4586 {
4587 #ifdef __GLIBC__
4588     exit(0);
4589 #else
4590     exit(1);
4591 #endif
4592 }
4593 EOM
4594 set gnulibc
4595 if eval $compile_ok && ./gnulibc; then
4596         val="$define"
4597         echo "You are using the GNU C Library"
4598 else
4599         val="$undef"
4600         echo "You are not using the GNU C Library"
4601 fi
4602 $rm -f gnulibc*
4603 set d_gnulibc
4604 eval $setvar
4605
4606 : see if nm is to be used to determine whether a symbol is defined or not
4607 case "$usenm" in
4608 '')
4609         dflt=''
4610         case "$d_gnulibc" in
4611         "$define")
4612                 echo " "
4613                 echo "nm probably won't work on the GNU C Library." >&4
4614                 dflt=n
4615                 ;;
4616         esac
4617         case "$dflt" in
4618         '') 
4619                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4620                         echo " "
4621                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4622                         echo "'nm' won't be sufficient on this sytem." >&4
4623                         dflt=n
4624                 fi
4625                 ;;
4626         esac
4627         case "$dflt" in
4628         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4629                 if $test $dflt -gt 20; then
4630                         dflt=y
4631                 else
4632                         dflt=n
4633                 fi
4634                 ;;
4635         esac
4636         ;;
4637 *)
4638         case "$usenm" in
4639         true|$define) dflt=y;;
4640         *) dflt=n;;
4641         esac
4642         ;;
4643 esac
4644 $cat <<EOM
4645
4646 I can use $nm to extract the symbols from your C libraries. This
4647 is a time consuming task which may generate huge output on the disk (up
4648 to 3 megabytes) but that should make the symbols extraction faster. The
4649 alternative is to skip the 'nm' extraction part and to compile a small
4650 test program instead to determine whether each symbol is present. If
4651 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4652 this may be the best solution.
4653
4654 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4655
4656 EOM
4657 rp="Shall I use $nm to extract C symbols from the libraries?"
4658 . ./myread
4659 case "$ans" in
4660 [Nn]*) usenm=false;;
4661 *) usenm=true;;
4662 esac
4663
4664 runnm=$usenm
4665 case "$reuseval" in
4666 true) runnm=false;;
4667 esac
4668
4669 : nm options which may be necessary
4670 case "$nm_opt" in
4671 '') if $test -f /mach_boot; then
4672                 nm_opt=''       # Mach
4673         elif $test -d /usr/ccs/lib; then
4674                 nm_opt='-p'     # Solaris (and SunOS?)
4675         elif $test -f /dgux; then
4676                 nm_opt='-p'     # DG-UX
4677         elif $test -f /lib64/rld; then
4678                 nm_opt='-p'     # 64-bit Irix
4679         else
4680                 nm_opt=''
4681         fi;;
4682 esac
4683
4684 : nm options which may be necessary for shared libraries but illegal
4685 : for archive libraries.  Thank you, Linux.
4686 case "$nm_so_opt" in
4687 '')     case "$myuname" in
4688         *linux*)
4689                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4690                         nm_so_opt='--dynamic'
4691                 fi
4692                 ;;
4693         esac
4694         ;;
4695 esac
4696
4697 case "$runnm" in
4698 true)
4699 : get list of predefined functions in a handy place
4700 echo " "
4701 case "$libc" in
4702 '') libc=unknown
4703         case "$libs" in
4704         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4705         esac
4706         ;;
4707 esac
4708 libnames='';
4709 case "$libs" in
4710 '') ;;
4711 *)  for thislib in $libs; do
4712         case "$thislib" in
4713         -lc|-lc_s)
4714                 : Handle C library specially below.
4715                 ;;
4716         -l*)
4717                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4718                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4719                         :
4720                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4721                         :
4722                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4723                         :
4724                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4725                         :
4726                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4727                         :
4728                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4729                         :
4730                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4731                         :
4732                 else
4733                         try=''
4734                 fi
4735                 libnames="$libnames $try"
4736                 ;;
4737         *) libnames="$libnames $thislib" ;;
4738         esac
4739         done
4740         ;;
4741 esac
4742 xxx=normal
4743 case "$libc" in
4744 unknown)
4745         set /lib/libc.$so
4746         for xxx in $libpth; do
4747                 $test -r $1 || set $xxx/libc.$so
4748                 : The messy sed command sorts on library version numbers.
4749                 $test -r $1 || \
4750                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4751                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4752                                 h
4753                                 s/[0-9][0-9]*/0000&/g
4754                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4755                                 G
4756                                 s/\n/ /' | \
4757                          $sort | $sed -e 's/^.* //'`
4758                 eval set \$$#
4759         done
4760         $test -r $1 || set /usr/ccs/lib/libc.$so
4761         $test -r $1 || set /lib/libsys_s$_a
4762         ;;
4763 *)
4764         set blurfl
4765         ;;
4766 esac
4767 if $test -r "$1"; then
4768         echo "Your (shared) C library seems to be in $1."
4769         libc="$1"
4770 elif $test -r /lib/libc && $test -r /lib/clib; then
4771         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4772         xxx=apollo
4773         libc='/lib/clib /lib/libc'
4774         if $test -r /lib/syslib; then
4775                 echo "(Your math library is in /lib/syslib.)"
4776                 libc="$libc /lib/syslib"
4777         fi
4778 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4779         echo "Your C library seems to be in $libc, as you said before."
4780 elif $test -r $incpath/usr/lib/libc$_a; then
4781         libc=$incpath/usr/lib/libc$_a;
4782         echo "Your C library seems to be in $libc.  That's fine."
4783 elif $test -r /lib/libc$_a; then
4784         libc=/lib/libc$_a;
4785         echo "Your C library seems to be in $libc.  You're normal."
4786 else
4787         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4788                 :
4789         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4790                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4791         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4792                 :
4793         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4794                 :
4795         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4796                 :
4797         else
4798                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4799         fi
4800         if $test -r "$tans"; then
4801                 echo "Your C library seems to be in $tans, of all places."
4802                 libc=$tans
4803         else
4804                 libc='blurfl'
4805         fi
4806 fi
4807 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4808         dflt="$libc"
4809         cat <<EOM
4810
4811 If the guess above is wrong (which it might be if you're using a strange
4812 compiler, or your machine supports multiple models), you can override it here.
4813
4814 EOM
4815 else
4816         dflt=''
4817         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4818         cat >&4 <<EOM
4819 I can't seem to find your C library.  I've looked in the following places:
4820
4821 EOM
4822         $sed 's/^/      /' libpath
4823         cat <<EOM
4824
4825 None of these seems to contain your C library. I need to get its name...
4826
4827 EOM
4828 fi
4829 fn=f
4830 rp='Where is your C library?'
4831 . ./getfile
4832 libc="$ans"
4833
4834 echo " "
4835 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4836 set X `cat libnames`
4837 shift
4838 xxx=files
4839 case $# in 1) xxx=file; esac
4840 echo "Extracting names from the following $xxx for later perusal:" >&4
4841 echo " "
4842 $sed 's/^/      /' libnames >&4
4843 echo " "
4844 $echo $n "This may take a while...$c" >&4
4845
4846 for file in $*; do
4847         case $file in
4848         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4849         *) $nm $nm_opt $file 2>/dev/null;;
4850         esac
4851 done >libc.tmp
4852
4853 $echo $n ".$c"
4854 $grep fprintf libc.tmp > libc.ptf
4855 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4856 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4857 xxx='[ADTSIW]'
4858 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4859         eval $xscan;\
4860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861                 eval $xrun
4862 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4863         eval $xscan;\
4864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865                 eval $xrun
4866 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4867         eval $xscan;\
4868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869                 eval $xrun
4870 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4871         eval $xscan;\
4872         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4873                 eval $xrun
4874 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4875         eval $xscan;\
4876         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4877                 eval $xrun
4878 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4879         eval $xscan;\
4880         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4881                 eval $xrun
4882 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4883                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4884         eval $xscan;\
4885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886                 eval $xrun
4887 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4888         eval $xscan;\
4889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890                 eval $xrun
4891 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4892         eval $xscan;\
4893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894                 eval $xrun
4895 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4896         eval $xscan;\
4897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898                 eval $xrun
4899 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4900         eval $xscan;\
4901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902                 eval $xrun
4903 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4904         eval $xscan;\
4905         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4906                 eval $xrun
4907 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4908         eval $xscan;\
4909         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4910                 eval $xrun
4911 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4912         eval $xscan;\
4913         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4914                 eval $xrun
4915 else
4916         $nm -p $* 2>/dev/null >libc.tmp
4917         $grep fprintf libc.tmp > libc.ptf
4918         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4919                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4920         then
4921                 nm_opt='-p'
4922                 eval $xrun
4923         else
4924                 echo " "
4925                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4926                 com=''
4927                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4928                         for thisname in $libnames $libc; do
4929                                 $ar t $thisname >>libc.tmp
4930                         done
4931                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4932                         echo "Ok." >&4
4933                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4934                         # Repeat libc to extract forwarders to DLL entries too
4935                         for thisname in $libnames $libc; do
4936                                 $ar tv $thisname >>libc.tmp
4937                                 # Revision 50 of EMX has bug in $ar.
4938                                 # it will not extract forwarders to DLL entries
4939                                 # Use emximp which will extract exactly them.
4940                                 emximp -o tmp.imp $thisname \
4941                                     2>/dev/null && \
4942                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4943                                     < tmp.imp >>libc.tmp
4944                                 $rm tmp.imp
4945                         done
4946                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4947                         echo "Ok." >&4
4948                 else
4949                         echo "$ar didn't seem to work right." >&4
4950                         echo "Maybe this is a Cray...trying bld instead..." >&4
4951                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4952                         then
4953                                 for thisname in $libnames; do
4954                                         bld t $libnames | \
4955                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4956                                         $ar t $thisname >>libc.tmp
4957                                 done
4958                                 echo "Ok." >&4
4959                         else
4960                                 echo "That didn't work either.  Giving up." >&4
4961                                 exit 1
4962                         fi
4963                 fi
4964         fi
4965 fi
4966 nm_extract="$com"
4967 if $test -f /lib/syscalls.exp; then
4968         echo " "
4969         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4970         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4971 fi
4972 ;;
4973 esac
4974 $rm -f libnames libpath
4975
4976 : is a C symbol defined?
4977 csym='tlook=$1;
4978 case "$3" in
4979 -v) tf=libc.tmp; tc=""; tdc="";;
4980 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4981 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4982 esac;
4983 tx=yes;
4984 case "$reuseval-$4" in
4985 true-) ;;
4986 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4987 esac;
4988 case "$tx" in
4989 yes)
4990         case "$runnm" in
4991         true)
4992                 if $contains $tlook $tf >/dev/null 2>&1;
4993                 then tval=true;
4994                 else tval=false;
4995                 fi;;
4996         *)
4997                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4998                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4999                 then tval=true;
5000                 else tval=false;
5001                 fi;
5002                 $rm -f t t.c;;
5003         esac;;
5004 *)
5005         case "$tval" in
5006         $define) tval=true;;
5007         *) tval=false;;
5008         esac;;
5009 esac;
5010 eval "$2=$tval"'
5011
5012 : define an is-in-libc? function
5013 inlibc='echo " "; td=$define; tu=$undef;
5014 sym=$1; var=$2; eval "was=\$$2";
5015 tx=yes;
5016 case "$reuseval$was" in
5017 true) ;;
5018 true*) tx=no;;
5019 esac;
5020 case "$tx" in
5021 yes)
5022         set $sym tres -f;
5023         eval $csym;
5024         case "$tres" in
5025         true)
5026                 echo "$sym() found." >&4;
5027                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5028         *)
5029                 echo "$sym() NOT found." >&4;
5030                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5031         esac;;
5032 *)
5033         case "$was" in
5034         $define) echo "$sym() found." >&4;;
5035         *) echo "$sym() NOT found." >&4;;
5036         esac;;
5037 esac'
5038
5039 : see if sqrtl exists
5040 set sqrtl d_sqrtl
5041 eval $inlibc
5042
5043 case "$ccflags" in
5044 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5045 esac
5046
5047 case "$uselongdouble" in
5048 $define|true|[yY]*)     dflt='y';;
5049 *) dflt='n';;
5050 esac
5051 cat <<EOM
5052
5053 Perl can be built to take advantage of long doubles which
5054 (if available) may give more accuracy and range for floating point numbers.
5055
5056 If this doesn't make any sense to you, just accept the default '$dflt'.
5057 EOM
5058 rp='Try to use long doubles if available?'
5059 . ./myread
5060 case "$ans" in
5061 y|Y)    val="$define"   ;;
5062 *)      val="$undef"    ;;
5063 esac
5064 set uselongdouble
5065 eval $setvar
5066
5067 case "$uselongdouble" in
5068 true|[yY]*) uselongdouble="$define" ;;
5069 esac
5070
5071 case "$uselongdouble" in
5072 $define)
5073 : Look for a hint-file generated 'call-back-unit'.  If the
5074 : user has specified that long doubles should be used,
5075 : we may need to set or change some other defaults.
5076         if $test -f uselongdouble.cbu; then
5077                 echo "Your platform has some specific hints for long doubles, using them..."
5078                 . ./uselongdouble.cbu
5079         else
5080                 $cat <<EOM
5081 (Your platform doesn't have any specific hints for long doubles.)
5082 EOM
5083         fi
5084         ;;
5085 esac
5086
5087 case "$uselongdouble:$d_sqrtl" in
5088 $define:$undef)
5089                 $cat <<EOM >&4
5090
5091 *** You requested the use of long doubles but you do not seem to have
5092 *** the mathematic functions for long doubles.  I'm disabling the use
5093 *** of long doubles.
5094
5095 EOM
5096         uselongdouble=$undef
5097         ;;
5098 esac
5099
5100 : check for length of double
5101 echo " "
5102 case "$doublesize" in
5103 '')
5104         echo "Checking to see how big your double precision numbers are..." >&4
5105         $cat >try.c <<'EOCP'
5106 #include <stdio.h>
5107 int main()
5108 {
5109     printf("%d\n", (int)sizeof(double));
5110     exit(0);
5111 }
5112 EOCP
5113         set try
5114         if eval $compile_ok; then
5115                 doublesize=`./try`
5116                 echo "Your double is $doublesize bytes long."
5117         else
5118                 dflt='8'
5119                 echo "(I can't seem to compile the test program.  Guessing...)"
5120                 rp="What is the size of a double precision number (in bytes)?"
5121                 . ./myread
5122                 doublesize="$ans"
5123         fi
5124         ;;
5125 esac
5126 $rm -f try.c try
5127
5128 : check for long doubles
5129 echo " "
5130 echo "Checking to see if you have long double..." >&4
5131 echo 'int main() { long double x = 7.0; }' > try.c
5132 set try
5133 if eval $compile; then
5134         val="$define"
5135         echo "You have long double."
5136 else
5137         val="$undef"
5138         echo "You do not have long double."
5139 fi
5140 $rm try.*
5141 set d_longdbl
5142 eval $setvar
5143
5144 : check for length of long double
5145 case "${d_longdbl}${longdblsize}" in
5146 $define)
5147         echo " "
5148         echo "Checking to see how big your long doubles are..." >&4
5149         $cat >try.c <<'EOCP'
5150 #include <stdio.h>
5151 int main()
5152 {
5153         printf("%d\n", sizeof(long double));
5154 }
5155 EOCP
5156         set try
5157         set try
5158         if eval $compile; then
5159                 longdblsize=`./try$exe_ext`
5160                 echo "Your long doubles are $longdblsize bytes long."
5161         else
5162                 dflt='8'
5163                 echo " "
5164                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5165                 rp="What is the size of a long double (in bytes)?"
5166                 . ./myread
5167                 longdblsize="$ans"
5168         fi
5169         if $test "X$doublesize" = "X$longdblsize"; then
5170                 echo "(That isn't any different from an ordinary double.)"
5171         fi      
5172         ;;
5173 esac
5174 $rm -f try.* try
5175
5176 : determine the architecture name
5177 echo " "
5178 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5179         tarch=`arch`"-$osname"
5180 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5181         if uname -m > tmparch 2>&1 ; then
5182                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5183                         -e 's/$/'"-$osname/" tmparch`
5184         else
5185                 tarch="$osname"
5186         fi
5187         $rm -f tmparch
5188 else
5189         tarch="$osname"
5190 fi
5191 case "$myarchname" in
5192 ''|"$tarch") ;;
5193 *)
5194         echo "(Your architecture name used to be $myarchname.)"
5195         archname=''
5196         ;;
5197 esac
5198 myarchname="$tarch"
5199 case "$archname" in
5200 '') dflt="$tarch";;
5201 *) dflt="$archname";;
5202 esac
5203 rp='What is your architecture name'
5204 . ./myread
5205 archname="$ans"
5206 case "$usethreads" in
5207 $define)
5208         echo "Threads selected." >&4
5209         case "$archname" in
5210         *-thread*) echo "...and architecture name already has -thread." >&4
5211                 ;;
5212         *)      archname="$archname-thread"
5213                 echo "...setting architecture name to $archname." >&4
5214                 ;;
5215         esac
5216         ;;
5217 esac
5218 case "$usemultiplicity" in
5219 $define)
5220         echo "Multiplicity selected." >&4
5221         case "$archname" in
5222         *-multi*) echo "...and architecture name already has -multi." >&4
5223                 ;;
5224         *)      archname="$archname-multi"
5225                 echo "...setting architecture name to $archname." >&4
5226                 ;;
5227         esac
5228         ;;
5229 esac
5230 case "$use64bitint$use64bitall" in
5231 *"$define"*)
5232         case "$archname64" in
5233         '')
5234                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5235                 ;;
5236         *)
5237                 case "$use64bitint" in
5238                 "$define") echo "64 bit integers selected." >&4 ;;
5239                 esac
5240                 case "$use64bitall" in
5241                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5242                 esac
5243                 case "$archname" in
5244                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5245                         ;;
5246                 *)      archname="$archname-$archname64"
5247                         echo "...setting architecture name to $archname." >&4
5248                         ;;
5249                 esac
5250                 ;;
5251         esac
5252 esac
5253 case "$uselongdouble" in
5254 $define)
5255         echo "Long doubles selected." >&4
5256         case "$longdblsize" in
5257         $doublesize)
5258                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5259                 ;;
5260         *)
5261                 case "$archname" in
5262                 *-ld*) echo "...and architecture name already has -ld." >&4
5263                         ;;
5264                 *)      archname="$archname-ld"
5265                         echo "...setting architecture name to $archname." >&4
5266                         ;;
5267                 esac
5268                 ;;
5269         esac
5270         ;;
5271 esac
5272
5273 : determine root of directory hierarchy where package will be installed.
5274 case "$prefix" in
5275 '')
5276         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5277         ;;
5278 *)
5279         dflt="$prefix"
5280         ;;
5281 esac
5282 $cat <<EOM
5283
5284 By default, $package will be installed in $dflt/bin, manual pages
5285 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5286 installation directories. Typically this is something like /usr/local.
5287 If you wish to have binaries under /usr/bin but other parts of the
5288 installation under /usr/local, that's ok: you will be prompted
5289 separately for each of the installation directories, the prefix being
5290 only used to set the defaults.
5291
5292 EOM
5293 fn=d~
5294 rp='Installation prefix to use?'
5295 . ./getfile
5296 oldprefix=''
5297 case "$prefix" in
5298 '') ;;
5299 *)
5300         case "$ans" in
5301         "$prefix") ;;
5302         *) oldprefix="$prefix";;
5303         esac
5304         ;;
5305 esac
5306 prefix="$ans"
5307 prefixexp="$ansexp"
5308
5309 : is AFS running?
5310 echo " "
5311 case "$afs" in
5312 $define|true)   afs=true ;;
5313 $undef|false)   afs=false ;;
5314 *)      if test -d /afs; then
5315                 afs=true
5316         else
5317                 afs=false
5318         fi
5319         ;;
5320 esac
5321 if $afs; then
5322         echo "AFS may be running... I'll be extra cautious then..." >&4
5323 else
5324         echo "AFS does not seem to be running..." >&4
5325 fi
5326
5327 : determine installation prefix for where package is to be installed.
5328 if $afs; then 
5329 $cat <<EOM
5330
5331 Since you are running AFS, I need to distinguish the directory in which
5332 files will reside from the directory in which they are installed (and from
5333 which they are presumably copied to the former directory by occult means).
5334
5335 EOM
5336         case "$installprefix" in
5337         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5338         *) dflt="$installprefix";;
5339         esac
5340 else
5341 $cat <<EOM
5342
5343 In some special cases, particularly when building $package for distribution,
5344 it is convenient to distinguish between the directory in which files should 
5345 be installed from the directory ($prefix) in which they 
5346 will eventually reside.  For most users, these two directories are the same.
5347
5348 EOM
5349         case "$installprefix" in
5350         '') dflt=$prefix ;;
5351         *) dflt=$installprefix;;
5352         esac
5353 fi
5354 fn=d~
5355 rp='What installation prefix should I use for installing files?'
5356 . ./getfile
5357 installprefix="$ans"
5358 installprefixexp="$ansexp"
5359
5360 : set the prefixit variable, to compute a suitable default value
5361 prefixit='case "$3" in
5362 ""|none)
5363         case "$oldprefix" in
5364         "") eval "$1=\"\$$2\"";;
5365         *)
5366                 case "$3" in
5367                 "") eval "$1=";;
5368                 none)
5369                         eval "tp=\"\$$2\"";
5370                         case "$tp" in
5371                         ""|" ") eval "$1=\"\$$2\"";;
5372                         *) eval "$1=";;
5373                         esac;;
5374                 esac;;
5375         esac;;
5376 *)
5377         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5378         case "$tp" in
5379         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5380         /*-$oldprefix/*|\~*-$oldprefix/*)
5381                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5382         *) eval "$1=\"\$$2\"";;
5383         esac;;
5384 esac'
5385
5386
5387 : get the patchlevel
5388 echo " "
5389 echo "Getting the current patchlevel..." >&4
5390 if $test -r $rsrc/patchlevel.h;then
5391         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5392         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5393         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5394         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5395         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5396         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5397 else
5398         revision=0
5399         patchlevel=0
5400         subversion=0
5401         api_revision=0
5402         api_version=0
5403         api_subversion=0
5404 fi
5405 $echo "(You have $package version $patchlevel subversion $subversion.)"
5406 case "$osname" in
5407 dos|vms)
5408         : XXX Should be a Configure test for double-dots in filenames.
5409         version=`echo $revision $patchlevel $subversion | \
5410                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5411         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5412                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5413         ;;
5414 *)
5415         version=`echo $revision $patchlevel $subversion | \
5416                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5417         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5418                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5419         ;;
5420 esac
5421 : Special case the 5.005_xx maintenance series, which used 5.005
5422 : without any subversion label as a subdirectory in $sitelib
5423 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5424         api_versionstring='5.005'
5425 fi
5426
5427 : determine installation style
5428 : For now, try to deduce it from prefix unless it is already set.
5429 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5430 case "$installstyle" in
5431 '')     case "$prefix" in
5432                 *perl*) dflt='lib';;
5433                 *) dflt='lib/perl5' ;;
5434         esac
5435         ;;
5436 *)      dflt="$installstyle" ;;
5437 esac
5438 : Probably not worth prompting for this since we prompt for all
5439 : the directories individually, and the prompt would be too long and
5440 : confusing anyway.
5441 installstyle=$dflt
5442
5443 : determine where private library files go
5444 : Usual default is /usr/local/lib/perl5/$version.
5445 : Also allow things like /opt/perl/lib/$version, since 
5446 : /opt/perl/lib/perl5... would be redundant.
5447 : The default "style" setting is made in installstyle.U
5448 case "$installstyle" in
5449 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5450 *)       set dflt privlib lib/$version ;;
5451 esac
5452 eval $prefixit
5453 $cat <<EOM
5454
5455 There are some auxiliary files for $package that need to be put into a
5456 private library directory that is accessible by everyone.
5457
5458 EOM
5459 fn=d~+
5460 rp='Pathname where the private library files will reside?'
5461 . ./getfile
5462 privlib="$ans"
5463 privlibexp="$ansexp"
5464 : Change installation prefix, if necessary.
5465 if $test X"$prefix" != X"$installprefix"; then
5466         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5467 else
5468         installprivlib="$privlibexp"
5469 fi
5470
5471 : set the prefixup variable, to restore leading tilda escape
5472 prefixup='case "$prefixexp" in
5473 "$prefix") ;;
5474 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5475 esac'
5476
5477 : determine where public architecture dependent libraries go
5478 set archlib archlib
5479 eval $prefixit
5480 : privlib default is /usr/local/lib/$package/$version
5481 : archlib default is /usr/local/lib/$package/$version/$archname
5482 : privlib may have an optional trailing /share.
5483 tdflt=`echo $privlib | $sed 's,/share$,,'`
5484 tdflt=$tdflt/$archname
5485 case "$archlib" in
5486 '')     dflt=$tdflt
5487         ;;
5488 *)      dflt="$archlib"
5489     ;;
5490 esac
5491 $cat <<EOM
5492
5493 $spackage contains architecture-dependent library files.  If you are
5494 sharing libraries in a heterogeneous environment, you might store
5495 these files in a separate location.  Otherwise, you can just include
5496 them with the rest of the public library files.
5497
5498 EOM
5499 fn=d+~
5500 rp='Where do you want to put the public architecture-dependent libraries?'
5501 . ./getfile
5502 archlib="$ans"
5503 archlibexp="$ansexp"
5504 if $test X"$archlib" = X"$privlib"; then
5505         d_archlib="$undef"
5506 else
5507         d_archlib="$define"
5508 fi
5509 : Change installation prefix, if necessary.
5510 if $test X"$prefix" != X"$installprefix"; then
5511         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5512 else
5513         installarchlib="$archlibexp"
5514 fi
5515
5516
5517 : Binary compatibility with 5.005 is not possible for builds
5518 : with advanced features
5519 case "$usethreads$usemultiplicity" in
5520 *define*)
5521         bincompat5005="$undef"
5522         d_bincompat5005="$undef"
5523         ;;
5524 *)      $cat <<EOM
5525
5526 This version of Perl can be compiled for binary compatibility with 5.005.
5527 If you decide to do so, you will be able to continue using most of the
5528 extensions that were compiled for Perl 5.005.
5529
5530 EOM
5531         case "$bincompat5005$d_bincompat5005" in
5532         *"$undef"*) dflt=n ;;
5533         *) dflt=y ;;
5534         esac
5535         rp='Binary compatibility with Perl 5.005?'
5536         . ./myread
5537         case "$ans" in
5538         y*) val="$define" ;;
5539         *)  val="$undef" ;;
5540         esac
5541         set d_bincompat5005
5542         eval $setvar
5543         case "$d_bincompat5005" in
5544         "$define")
5545                 bincompat5005="$define"
5546                 ;;
5547         *)      bincompat5005="$undef"
5548                 d_bincompat5005="$undef"
5549                 ;;
5550         esac
5551         ;;
5552 esac
5553
5554
5555 : see if setuid scripts can be secure
5556 $cat <<EOM
5557
5558 Some kernels have a bug that prevents setuid #! scripts from being
5559 secure.  Some sites have disabled setuid #! scripts because of this.
5560
5561 First let's decide if your kernel supports secure setuid #! scripts.
5562 (If setuid #! scripts would be secure but have been disabled anyway,
5563 don't say that they are secure if asked.)
5564
5565 EOM
5566
5567 val="$undef"
5568 if $test -d /dev/fd; then
5569         echo "#!$ls" >reflect
5570         chmod +x,u+s reflect
5571         ./reflect >flect 2>&1
5572         if $contains "/dev/fd" flect >/dev/null; then
5573                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5574                 val="$define"
5575         else
5576                 $cat <<EOM
5577 If you are not sure if they are secure, I can check but I'll need a
5578 username and password different from the one you are using right now.
5579 If you don't have such a username or don't want me to test, simply
5580 enter 'none'.
5581
5582 EOM
5583                 rp='Other username to test security of setuid scripts with?'
5584                 dflt='none'
5585                 . ./myread
5586                 case "$ans" in
5587                 n|none)
5588                         case "$d_suidsafe" in
5589                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5590                                 dflt=n;;
5591                         "$undef")
5592                                 echo "Well, the $hint value is *not* secure." >&4
5593                                 dflt=n;;
5594                         *)      echo "Well, the $hint value *is* secure." >&4
5595                                 dflt=y;;
5596                         esac
5597                         ;;
5598                 *)
5599                         $rm -f reflect flect
5600                         echo "#!$ls" >reflect
5601                         chmod +x,u+s reflect
5602                         echo >flect
5603                         chmod a+w flect
5604                         echo '"su" will (probably) prompt you for '"$ans's password."
5605                         su $ans -c './reflect >flect'
5606                         if $contains "/dev/fd" flect >/dev/null; then
5607                                 echo "Okay, it looks like setuid scripts are secure." >&4
5608                                 dflt=y
5609                         else
5610                                 echo "I don't think setuid scripts are secure." >&4
5611                                 dflt=n
5612                         fi
5613                         ;;
5614                 esac
5615                 rp='Does your kernel have *secure* setuid scripts?'
5616                 . ./myread
5617                 case "$ans" in
5618                 [yY]*)  val="$define";;
5619                 *)      val="$undef";;
5620                 esac
5621         fi
5622 else
5623         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5624         echo "(That's for file descriptors, not floppy disks.)"
5625         val="$undef"
5626 fi
5627 set d_suidsafe
5628 eval $setvar
5629
5630 $rm -f reflect flect
5631
5632 : now see if they want to do setuid emulation
5633 echo " "
5634 val="$undef"
5635 case "$d_suidsafe" in
5636 "$define")
5637         val="$undef"
5638         echo "No need to emulate SUID scripts since they are secure here." >& 4
5639         ;;
5640 *)
5641         $cat <<EOM
5642 Some systems have disabled setuid scripts, especially systems where
5643 setuid scripts cannot be secure.  On systems where setuid scripts have
5644 been disabled, the setuid/setgid bits on scripts are currently
5645 useless.  It is possible for $package to detect those bits and emulate
5646 setuid/setgid in a secure fashion.  This emulation will only work if
5647 setuid scripts have been disabled in your kernel.
5648
5649 EOM
5650         case "$d_dosuid" in
5651         "$define") dflt=y ;;
5652         *) dflt=n ;;
5653         esac
5654         rp="Do you want to do setuid/setgid emulation?"
5655         . ./myread
5656         case "$ans" in
5657         [yY]*)  val="$define";;
5658         *)      val="$undef";;
5659         esac
5660         ;;
5661 esac
5662 set d_dosuid
5663 eval $setvar
5664
5665 : determine filename position in cpp output
5666 echo " "
5667 echo "Computing filename position in cpp output for #include directives..." >&4
5668 echo '#include <stdio.h>' > foo.c
5669 $cat >fieldn <<EOF
5670 $startsh
5671 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5672 $grep '^[       ]*#.*stdio\.h' | \
5673 while read cline; do
5674         pos=1
5675         set \$cline
5676         while $test \$# -gt 0; do
5677                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5678                         echo "\$pos"
5679                         exit 0
5680                 fi
5681                 shift
5682                 pos=\`expr \$pos + 1\`
5683         done
5684 done
5685 EOF
5686 chmod +x fieldn
5687 fieldn=`./fieldn`
5688 $rm -f foo.c fieldn
5689 case $fieldn in
5690 '') pos='???';;
5691 1) pos=first;;
5692 2) pos=second;;
5693 3) pos=third;;
5694 *) pos="${fieldn}th";;
5695 esac
5696 echo "Your cpp writes the filename in the $pos field of the line."
5697
5698 : locate header file
5699 $cat >findhdr <<EOF
5700 $startsh
5701 wanted=\$1
5702 name=''
5703 for usrincdir in $usrinc
5704 do
5705         if test -f \$usrincdir/\$wanted; then
5706                 echo "\$usrincdir/\$wanted"
5707                 exit 0
5708         fi
5709 done
5710 awkprg='{ print \$$fieldn }'
5711 echo "#include <\$wanted>" > foo\$\$.c
5712 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5713 $grep "^[       ]*#.*\$wanted" | \
5714 while read cline; do
5715         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5716         case "\$name" in
5717         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5718         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5719         *) exit 2;;
5720         esac;
5721 done;
5722 #
5723 # status = 0: grep returned 0 lines, case statement not executed
5724 # status = 1: headerfile found
5725 # status = 2: while loop executed, no headerfile found
5726 #
5727 status=\$?
5728 $rm -f foo\$\$.c;
5729 if test \$status -eq 1; then
5730         exit 0;
5731 fi
5732 exit 1
5733 EOF
5734 chmod +x findhdr
5735
5736 : define an alternate in-header-list? function
5737 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5738 cont=true; xxf="echo \"<\$1> found.\" >&4";
5739 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5740 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5741 esac;
5742 case $# in 4) instead=instead;; *) instead="at last";; esac;
5743 while $test "$cont"; do
5744         xxx=`./findhdr $1`
5745         var=$2; eval "was=\$$2";
5746         if $test "$xxx" && $test -r "$xxx";
5747         then eval $xxf;
5748         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5749                 cont="";
5750         else eval $xxnf;
5751         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5752         set $yyy; shift; shift; yyy=$@;
5753         case $# in 0) cont="";;
5754         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5755                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5756         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5757                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5758         esac;
5759 done;
5760 while $test "$yyy";
5761 do set $yyy; var=$2; eval "was=\$$2";
5762         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5763         set $yyy; shift; shift; yyy=$@;
5764 done'
5765
5766 : see if this is a malloc.h system
5767 set malloc.h i_malloc
5768 eval $inhdr
5769
5770 : see if stdlib is available
5771 set stdlib.h i_stdlib
5772 eval $inhdr
5773
5774 : determine which malloc to compile in
5775 echo " "
5776 case "$usemymalloc" in
5777 ''|[yY]*|true|$define)  dflt='y' ;;
5778 *)      dflt='n' ;;
5779 esac
5780 rp="Do you wish to attempt to use the malloc that comes with $package?"
5781 . ./myread
5782 usemymalloc="$ans"
5783 case "$ans" in
5784 y*|true)
5785         usemymalloc='y'
5786         mallocsrc='malloc.c'
5787         mallocobj="malloc$_o"
5788         d_mymalloc="$define"
5789         case "$libs" in
5790         *-lmalloc*)
5791                 : Remove malloc from list of libraries to use
5792                 echo "Removing unneeded -lmalloc from library list" >&4
5793                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5794                 shift
5795                 libs="$*"
5796                 echo "libs = $libs" >&4
5797                 ;;
5798         esac
5799         ;;
5800 *)
5801         usemymalloc='n'
5802         mallocsrc=''
5803         mallocobj=''
5804         d_mymalloc="$undef"
5805         ;;
5806 esac
5807
5808 : compute the return types of malloc and free
5809 echo " "
5810 $cat >malloc.c <<END
5811 #$i_malloc I_MALLOC
5812 #$i_stdlib I_STDLIB
5813 #include <stdio.h>
5814 #include <sys/types.h>
5815 #ifdef I_MALLOC
5816 #include <malloc.h>
5817 #endif
5818 #ifdef I_STDLIB
5819 #include <stdlib.h>
5820 #endif
5821 #ifdef TRY_MALLOC
5822 void *malloc();
5823 #endif
5824 #ifdef TRY_FREE
5825 void free();
5826 #endif
5827 END
5828 case "$malloctype" in
5829 '')
5830         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5831                 malloctype='void *'
5832         else
5833                 malloctype='char *'
5834         fi
5835         ;;
5836 esac
5837 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5838
5839 case "$freetype" in
5840 '')
5841         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5842                 freetype='void'
5843         else
5844                 freetype='int'
5845         fi
5846         ;;
5847 esac
5848 echo "Your system uses $freetype free(), it would seem." >&4
5849 $rm -f malloc.[co]
5850 $cat <<EOM
5851
5852 After $package is installed, you may wish to install various
5853 add-on modules and utilities.  Typically, these add-ons will
5854 be installed under $prefix with the rest
5855 of this package.  However, you may wish to install such add-ons
5856 elsewhere under a different prefix.
5857
5858 If you do not wish to put everything under a single prefix, that's
5859 ok.  You will be prompted for the individual locations; this siteprefix
5860 is only used to suggest the defaults.
5861
5862 The default should be fine for most people.
5863
5864 EOM
5865 fn=d~+
5866 rp='Installation prefix to use for add-on modules and utilities?'
5867 : XXX Here might be another good place for an installstyle setting.
5868 case "$siteprefix" in
5869 '') dflt=$prefix ;;
5870 *)  dflt=$siteprefix ;;
5871 esac
5872 . ./getfile
5873 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5874 oldsiteprefix=''
5875 case "$siteprefix" in
5876 '') ;;
5877 *)      case "$ans" in
5878         "$prefix") ;;
5879         *) oldsiteprefix="$prefix";;
5880         esac
5881         ;;
5882 esac
5883 siteprefix="$ans"
5884 siteprefixexp="$ansexp"
5885
5886 : determine where site specific libraries go.
5887 : Usual default is /usr/local/lib/perl5/site_perl/$version
5888 : The default "style" setting is made in installstyle.U
5889 : XXX No longer works with Prefixit stuff.
5890 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5891 case "$sitelib" in
5892 '') case "$installstyle" in
5893         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5894         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5895         esac
5896         ;;
5897 *)      dflt="$sitelib"
5898         ;;
5899 esac
5900 $cat <<EOM
5901
5902 The installation process will create a directory for
5903 site-specific extensions and modules.  Most users find it convenient
5904 to place all site-specific files in this directory rather than in the
5905 main distribution directory.
5906
5907 EOM
5908 fn=d~+
5909 rp='Pathname for the site-specific library files?'
5910 . ./getfile
5911 sitelib="$ans"
5912 sitelibexp="$ansexp"
5913 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5914 : Change installation prefix, if necessary.
5915 if $test X"$prefix" != X"$installprefix"; then
5916         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5917 else
5918         installsitelib="$sitelibexp"
5919 fi
5920
5921 : determine where site specific architecture-dependent libraries go.
5922 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5923 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5924 : sitelib may have an optional trailing /share.
5925 case "$sitearch" in
5926 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5927         dflt="$dflt/$archname"
5928         ;;
5929 *)      dflt="$sitearch"
5930         ;;
5931 esac
5932 set sitearch sitearch none
5933 eval $prefixit
5934 $cat <<EOM
5935
5936 The installation process will also create a directory for
5937 architecture-dependent site-specific extensions and modules.
5938
5939 EOM
5940 fn=d~+
5941 rp='Pathname for the site-specific architecture-dependent library files?'
5942 . ./getfile
5943 sitearch="$ans"
5944 sitearchexp="$ansexp"
5945 : Change installation prefix, if necessary.
5946 if $test X"$prefix" != X"$installprefix"; then
5947         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5948 else
5949         installsitearch="$sitearchexp"
5950 fi
5951
5952 $cat <<EOM
5953
5954 The installation process will also create a directory for
5955 vendor-supplied add-ons.  Vendors who supply perl with their system
5956 may find it convenient to place all vendor-supplied files in this
5957 directory rather than in the main distribution directory.  This will
5958 ease upgrades between binary-compatible maintenance versions of perl.
5959
5960 Of course you may also use these directories in whatever way you see
5961 fit.  For example, you might use them to access modules shared over a
5962 company-wide network.
5963
5964 The default answer should be fine for most people.
5965 This causes further questions about vendor add-ons to be skipped
5966 and no vendor-specific directories will be configured for perl.
5967
5968 EOM
5969 rp='Do you want to configure vendor-specific add-on directories?'
5970 case "$usevendorprefix" in
5971 define|true|[yY]*) dflt=y ;;
5972 *)      : User may have set vendorprefix directly on Configure command line.
5973         case "$vendorprefix" in
5974         ''|' ') dflt=n ;;
5975         *)      dflt=y ;;
5976         esac
5977         ;;
5978 esac
5979 . ./myread
5980 case "$ans" in
5981 [yY]*)  fn=d~+
5982         rp='Installation prefix to use for vendor-supplied add-ons?'
5983         case "$vendorprefix" in
5984         '') dflt='' ;;
5985         *)  dflt=$vendorprefix ;;
5986         esac
5987         . ./getfile
5988         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5989         oldvendorprefix=''
5990         case "$vendorprefix" in
5991         '') ;;
5992         *)      case "$ans" in
5993                 "$prefix") ;;
5994                 *) oldvendorprefix="$prefix";;
5995                 esac
5996                 ;;
5997         esac
5998         usevendorprefix="$define"
5999         vendorprefix="$ans"
6000         vendorprefixexp="$ansexp"
6001         ;;
6002 *)      usevendorprefix="$undef"
6003         vendorprefix=''
6004         vendorprefixexp=''
6005         ;;
6006 esac
6007
6008 case "$vendorprefix" in
6009 '')     d_vendorlib="$undef"
6010         vendorlib=''
6011         vendorlibexp=''
6012         ;;
6013 *)      d_vendorlib="$define"
6014         : determine where vendor-supplied modules go.
6015         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6016         case "$vendorlib" in
6017         '')
6018                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6019                 case "$installstyle" in
6020                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6021                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6022                 esac
6023                 ;;
6024         *)      dflt="$vendorlib"
6025                 ;;
6026         esac
6027         fn=d~+
6028         rp='Pathname for the vendor-supplied library files?'
6029         . ./getfile
6030         vendorlib="$ans"
6031         vendorlibexp="$ansexp"
6032         ;;
6033 esac
6034 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6035 : Change installation prefix, if necessary.
6036 if $test X"$prefix" != X"$installprefix"; then
6037         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6038 else
6039         installvendorlib="$vendorlibexp"
6040 fi
6041
6042 case "$vendorprefix" in
6043 '')     d_vendorarch="$undef"
6044         vendorarch=''
6045         vendorarchexp=''
6046         ;;
6047 *)      d_vendorarch="$define"
6048         : determine where vendor-supplied architecture-dependent libraries go.
6049         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6050         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6051         : vendorlib may have an optional trailing /share.
6052         case "$vendorarch" in
6053         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6054                 dflt="$dflt/$archname"
6055                 ;;
6056         *)      dflt="$vendorarch" ;;
6057         esac
6058         fn=d~+
6059         rp='Pathname for vendor-supplied architecture-dependent files?'
6060         . ./getfile
6061         vendorarch="$ans"
6062         vendorarchexp="$ansexp"
6063         ;;
6064 esac
6065 : Change installation prefix, if necessary.
6066 if $test X"$prefix" != X"$installprefix"; then
6067         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6068 else
6069         installvendorarch="$vendorarchexp"
6070 fi
6071
6072 : Final catch-all directories to search
6073 $cat <<EOM
6074
6075 Lastly, you can have perl look in other directories for extensions and
6076 modules in addition to those already specified.
6077 These directories will be searched after 
6078         $sitearch 
6079         $sitelib 
6080 EOM
6081 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6082 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6083 echo ' '
6084 case "$otherlibdirs" in
6085 ''|' ') dflt='none' ;;
6086 *)      dflt="$otherlibdirs" ;;
6087 esac
6088 $cat <<EOM
6089 Enter a colon-separated set of extra paths to include in perl's @INC
6090 search path, or enter 'none' for no extra paths.
6091
6092 EOM
6093
6094 rp='Colon-separated list of additional directories for perl to search?'
6095 . ./myread
6096 case "$ans" in
6097 ' '|''|none)    otherlibdirs=' ' ;;     
6098 *)      otherlibdirs="$ans" ;;
6099 esac
6100 case "$otherlibdirs" in
6101 ' ') val=$undef ;;
6102 *)      val=$define ;;
6103 esac
6104 set d_perl_otherlibdirs
6105 eval $setvar
6106
6107 : Cruising for prototypes
6108 echo " "
6109 echo "Checking out function prototypes..." >&4
6110 $cat >prototype.c <<'EOCP'
6111 int main(int argc, char *argv[]) {
6112         exit(0);}
6113 EOCP
6114 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6115         echo "Your C compiler appears to support function prototypes."
6116         val="$define"
6117 else
6118         echo "Your C compiler doesn't seem to understand function prototypes."
6119         val="$undef"
6120 fi
6121 set prototype
6122 eval $setvar
6123 $rm -f prototype*
6124
6125 case "$prototype" in
6126 "$define") ;;
6127 *)      ansi2knr='ansi2knr'
6128         echo " "
6129         cat <<EOM >&4
6130
6131 $me:  FATAL ERROR:
6132 This version of $package can only be compiled by a compiler that 
6133 understands function prototypes.  Unfortunately, your C compiler 
6134         $cc $ccflags
6135 doesn't seem to understand them.  Sorry about that.
6136
6137 If GNU cc is available for your system, perhaps you could try that instead.  
6138
6139 Eventually, we hope to support building Perl with pre-ANSI compilers.
6140 If you would like to help in that effort, please contact <perlbug@perl.org>.
6141
6142 Aborting Configure now.
6143 EOM
6144         exit 2
6145         ;;
6146 esac
6147
6148 : determine where public executables go
6149 echo " "
6150 set dflt bin bin
6151 eval $prefixit
6152 fn=d~
6153 rp='Pathname where the public executables will reside?'
6154 . ./getfile
6155 if $test "X$ansexp" != "X$binexp"; then
6156         installbin=''
6157 fi
6158 bin="$ans"
6159 binexp="$ansexp"
6160 : Change installation prefix, if necessary.
6161 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6162 if $test X"$prefix" != X"$installprefix"; then
6163         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6164 else
6165         installbin="$binexp"
6166 fi
6167
6168 : Find perl5.005 or later.
6169 echo "Looking for a previously installed perl5.005 or later... "
6170 case "$perl5" in
6171 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6172                 : Check if this perl is recent and can load a simple module
6173                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6174                         perl5=$tdir/perl
6175                         break;
6176                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6177                         perl5=$tdir/perl
6178                         break;
6179                 fi
6180         done
6181         ;;
6182 *)      perl5="$perl5"
6183         ;;
6184 esac
6185 case "$perl5" in
6186 '')     echo "None found.  That's ok.";;
6187 *)      echo "Using $perl5." ;;
6188 esac
6189
6190 : Determine list of previous versions to include in @INC
6191 $cat > getverlist <<EOPL
6192 #!$perl5 -w
6193 use File::Basename;
6194 \$api_versionstring = "$api_versionstring";
6195 \$version = "$version";
6196 \$stem = "$sitelib_stem";
6197 \$archname = "$archname";
6198 EOPL
6199         $cat >> getverlist <<'EOPL'
6200 # Can't have leading @ because metaconfig interprets it as a command!
6201 ;@inc_version_list=();
6202 # XXX Redo to do opendir/readdir? 
6203 if (-d $stem) {
6204     chdir($stem);
6205     ;@candidates = glob("5.*");
6206 }
6207 else {
6208     ;@candidates = ();
6209 }
6210
6211 # XXX ToDo:  These comparisons must be reworked when two-digit
6212 # subversions come along, so that 5.7.10 compares as greater than
6213 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6214 # widespread that we can use the built-in version vectors rather
6215 # than reinventing them here.  For 5.6.0, however, we must
6216 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6217 foreach $d (@candidates) {
6218     if ($d lt $version) {
6219         if ($d ge $api_versionstring) {
6220             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6221         }
6222         elsif ($d ge "5.005") {
6223             unshift(@inc_version_list, grep { -d } $d);
6224         }
6225     }
6226     else {
6227         # Skip newer version.  I.e. don't look in
6228         # 5.7.0 if we're installing 5.6.1.
6229     }
6230 }
6231
6232 if (@inc_version_list) {
6233     print join(' ', @inc_version_list);
6234 }
6235 else {
6236     # Blank space to preserve value for next Configure run.
6237     print " ";
6238 }
6239 EOPL
6240 chmod +x getverlist
6241 case "$inc_version_list" in
6242 '')     if test -x "$perl5"; then
6243                 dflt=`$perl5 getverlist`
6244         else
6245                 dflt='none'
6246         fi
6247         ;;
6248 $undef) dflt='none' ;;
6249 *)  dflt="$inc_version_list" ;;
6250 esac
6251 case "$dflt" in
6252 ''|' ') dflt=none ;;
6253 esac
6254 case "$dflt" in
6255 5.005) case "$bincompat5005" in
6256        $define|true|[yY]*) ;;
6257        *) dflt=none ;;
6258        esac
6259        ;;
6260 esac
6261 $cat <<'EOM'
6262
6263 In order to ease the process of upgrading, this version of perl 
6264 can be configured to use modules built and installed with earlier 
6265 versions of perl that were installed under $prefix.  Specify here
6266 the list of earlier versions that this version of perl should check.
6267 If Configure detected no earlier versions of perl installed under
6268 $prefix, then the list will be empty.  Answer 'none' to tell perl
6269 to not search earlier versions.
6270
6271 The default should almost always be sensible, so if you're not sure,
6272 just accept the default.
6273 EOM
6274
6275 rp='List of earlier versions to include in @INC?'
6276 . ./myread
6277 case "$ans" in
6278 [Nn]one|''|' ') inc_version_list=' ' ;;
6279 *) inc_version_list="$ans" ;;
6280 esac
6281 case "$inc_version_list" in
6282 ''|' ') 
6283         inc_version_list_init='0';;
6284 *)      inc_version_list_init=`echo $inc_version_list |
6285                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6286         ;;
6287 esac
6288 $rm -f getverlist
6289
6290 : determine whether to install perl also as /usr/bin/perl
6291
6292 echo " "
6293 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6294         $cat <<EOM
6295 Many scripts expect perl to be installed as /usr/bin/perl.
6296 I can install the perl you are about to compile also as /usr/bin/perl
6297 (in addition to $installbin/perl).
6298 EOM
6299         case "$installusrbinperl" in
6300         "$undef"|[nN]*) dflt='n';;
6301         *)              dflt='y';;
6302         esac
6303         rp="Do you want to install perl as /usr/bin/perl?"
6304         . ./myread
6305         case "$ans" in
6306         [yY]*)  val="$define";;
6307         *)      val="$undef" ;;
6308         esac
6309 else
6310         val="$undef"
6311 fi
6312 set installusrbinperl
6313 eval $setvar
6314
6315 : see if dld is available
6316 set dld.h i_dld
6317 eval $inhdr
6318
6319 : see if dlopen exists
6320 xxx_runnm="$runnm"
6321 runnm=false
6322 set dlopen d_dlopen
6323 eval $inlibc
6324 runnm="$xxx_runnm"
6325
6326 : determine which dynamic loading, if any, to compile in
6327 echo " "
6328 dldir="ext/DynaLoader"
6329 case "$usedl" in
6330 $define|y|true)
6331         dflt='y'
6332         usedl="$define"
6333         ;;
6334 $undef|n|false)
6335         dflt='n'
6336         usedl="$undef"
6337         ;;
6338 *) 
6339         dflt='n'
6340         case "$d_dlopen" in
6341             $define) dflt='y' ;;
6342         esac
6343         case "$i_dld" in
6344             $define) dflt='y' ;;
6345         esac
6346         : Does a dl_xxx.xs file exist for this operating system
6347         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6348         ;;
6349 esac
6350 rp="Do you wish to use dynamic loading?"
6351 . ./myread
6352 usedl="$ans"
6353 case "$ans" in
6354 y*) usedl="$define"
6355         case "$dlsrc" in
6356         '')
6357                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6358                         dflt="$dldir/dl_${osname}.xs"
6359                 elif $test "$d_dlopen" = "$define" ; then
6360                         dflt="$dldir/dl_dlopen.xs"
6361                 elif $test "$i_dld" = "$define" ; then
6362                         dflt="$dldir/dl_dld.xs"
6363                 else
6364                         dflt=''
6365                 fi
6366                 ;;
6367         *)      dflt="$dldir/$dlsrc"
6368                 ;;
6369         esac
6370     echo "The following dynamic loading files are available:"
6371         : Can not go over to $dldir because getfile has path hard-coded in.
6372         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6373         rp="Source file to use for dynamic loading"
6374         fn="fne"
6375         gfpth="$src"
6376         . ./getfile
6377         usedl="$define"
6378         : emulate basename
6379         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6380
6381         $cat << EOM
6382
6383 Some systems may require passing special flags to $cc -c to
6384 compile modules that will be used to create a shared library.
6385 To use no flags, say "none".
6386
6387 EOM
6388     case "$cccdlflags" in
6389     '') case "$gccversion" in
6390                 '') case "$osname" in
6391                         hpux)   dflt='+z' ;;
6392                         next)   dflt='none' ;;
6393                         irix*)  dflt='-KPIC' ;;
6394                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6395                         sunos)  dflt='-pic' ;;
6396                         *)      dflt='none' ;;
6397                     esac
6398                         ;;
6399                 *)  case "$osname" in
6400                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6401                         *)      dflt='-fpic' ;;
6402                     esac ;;
6403             esac ;;
6404         ' ') dflt='none' ;;
6405     *)  dflt="$cccdlflags" ;;
6406     esac
6407     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6408     . ./myread
6409     case "$ans" in
6410     none) cccdlflags=' ' ;;
6411     *) cccdlflags="$ans" ;;
6412     esac
6413
6414     cat << EOM
6415
6416 Some systems use ld to create libraries that can be dynamically loaded,
6417 while other systems (such as those using ELF) use $cc.
6418
6419 EOM
6420         case "$ld" in
6421         '')     $cat >try.c <<'EOM'
6422 /* Test for whether ELF binaries are produced */
6423 #include <fcntl.h>
6424 #include <stdlib.h>
6425 int main() {
6426         char b[4];
6427         int i = open("a.out",O_RDONLY);
6428         if(i == -1) 
6429                 exit(1); /* fail */
6430         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6431                 exit(0); /* succeed (yes, it's ELF) */
6432         else
6433                 exit(1); /* fail */
6434 }
6435 EOM
6436                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6437                         cat <<EOM
6438 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6439 EOM
6440                         dflt="$cc"
6441                 else
6442                         echo "I'll use ld to build dynamic libraries."
6443                         dflt='ld'
6444                 fi
6445                 rm -f try.c a.out
6446                 ;;
6447         *)      dflt="$ld"
6448                 ;;
6449         esac
6450
6451     rp="What command should be used to create dynamic libraries?"
6452     . ./myread
6453         ld="$ans"
6454
6455     cat << EOM
6456
6457 Some systems may require passing special flags to $ld to create a
6458 library that can be dynamically loaded.  If your ld flags include
6459 -L/other/path options to locate libraries outside your loader's normal
6460 search path, you may need to specify those -L options here as well.  To
6461 use no flags, say "none".
6462
6463 EOM
6464     case "$lddlflags" in
6465     '') case "$osname" in
6466                         beos) dflt='-nostart' ;;
6467                         hpux) dflt='-b';
6468                               case "$gccversion" in
6469                               '') dflt="$dflt +vnocompatwarnings" ;;
6470                               esac
6471                               ;;        
6472                         linux|irix*)    dflt='-shared' ;;
6473                         next)  dflt='none' ;;
6474                         solaris) dflt='-G' ;;
6475                         sunos) dflt='-assert nodefinitions' ;;
6476                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6477                 *)     dflt='none' ;;
6478                         esac
6479                         ;;
6480     *) dflt="$lddlflags" ;;
6481     esac
6482
6483         : Try to guess additional flags to pick up local libraries.
6484         : Be careful not to append to a plain 'none'
6485         case "$dflt" in
6486         none) dflt='' ;;
6487         esac
6488         for thisflag in $ldflags; do
6489                 case "$thisflag" in
6490                 -L*|-R*)
6491                         case " $dflt " in
6492                         *" $thisflag "*) ;;
6493                         *) dflt="$dflt $thisflag" ;;
6494                         esac
6495                         ;;
6496                 esac
6497         done
6498
6499         case "$dflt" in
6500         ''|' ') dflt='none' ;;
6501         esac
6502
6503     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6504     . ./myread
6505     case "$ans" in
6506     none) lddlflags=' ' ;;
6507     *) lddlflags="$ans" ;;
6508     esac
6509
6510         cat <<EOM
6511
6512 Some systems may require passing special flags to $cc to indicate that
6513 the resulting executable will use dynamic linking.  To use no flags,
6514 say "none".
6515
6516 EOM
6517     case "$ccdlflags" in
6518     '') case "$osname" in
6519                 hpux)   dflt='-Wl,-E' ;;
6520                 linux)  dflt='-rdynamic' ;;
6521                 next)   dflt='none' ;;
6522                 sunos)  dflt='none' ;;
6523                 *)      dflt='none' ;;
6524             esac ;;
6525     ' ')  dflt='none' ;;
6526     *)  dflt="$ccdlflags" ;;
6527     esac
6528     rp="Any special flags to pass to $cc to use dynamic linking?"
6529     . ./myread
6530     case "$ans" in
6531     none) ccdlflags=' ' ;;
6532     *) ccdlflags="$ans" ;;
6533     esac
6534     ;;
6535 *)  usedl="$undef"
6536         ld='ld'
6537     dlsrc='dl_none.xs'
6538     lddlflags=''
6539     ccdlflags=''
6540     ;;
6541 esac
6542
6543 also=''
6544 case "$usedl" in
6545 $undef)
6546         # No dynamic loading being used, so don't bother even to prompt.
6547         useshrplib='false'
6548         ;;
6549 *)      case "$useshrplib" in
6550         '')     case "$osname" in
6551                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6552                         dflt=y
6553                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6554                         ;;
6555                 next*)
6556                         case "$osvers" in
6557                         4*)     dflt=y
6558                                 also='Building a shared libperl is needed for MAB support.'
6559                                 ;;
6560                         *)      dflt=n
6561                                 ;;
6562                         esac
6563                         ;;
6564                 *)      dflt=n
6565                         ;;
6566                 esac
6567                 ;;
6568         $define|true|[Yy]*)
6569                 dflt=y
6570                 ;;
6571         *)      dflt=n
6572                 ;;
6573         esac
6574         $cat << EOM
6575
6576 The perl executable is normally obtained by linking perlmain.c with
6577 libperl${_a}, any static extensions (usually just DynaLoader), and
6578 any other libraries needed on this system (such as -lm, etc.).  Since
6579 your system supports dynamic loading, it is probably possible to build
6580 a shared libperl.$so.  If you will have more than one executable linked
6581 to libperl.$so, this will significantly reduce the size of each
6582 executable, but it may have a noticeable affect on performance.  The
6583 default is probably sensible for your system.
6584 $also
6585
6586 EOM
6587         rp="Build a shared libperl.$so (y/n)"
6588         . ./myread
6589         case "$ans" in
6590         true|$define|[Yy]*)
6591                 useshrplib='true'  ;;
6592         *)      useshrplib='false' ;;
6593         esac
6594         ;;
6595 esac
6596
6597 case "$useshrplib" in
6598 true)
6599         case "$libperl" in
6600         '')
6601                 # Figure out a good name for libperl.so.  Since it gets stored in
6602                 # a version-specific architecture-dependent library, the version
6603                 # number isn't really that important, except for making cc/ld happy.
6604                 #
6605                 # A name such as libperl.so.3.1
6606                 majmin="libperl.$so.$patchlevel.$subversion"
6607                 # A name such as libperl.so.301
6608                 majonly=`echo $patchlevel $subversion |
6609                         $awk '{printf "%d%02d", $1, $2}'`
6610                 majonly=libperl.$so.$majonly
6611                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6612                 # rely on figuring it out from the naming of libc.
6613                 case "${osname}${osvers}" in
6614                 next4*)
6615                         dflt=libperl.5.$so
6616                         # XXX How handle the --version stuff for MAB?
6617                         ;;
6618                 linux*)  # ld won't link with a bare -lperl otherwise.
6619                         dflt=libperl.$so
6620                         ;;
6621                 cygwin*) # include version
6622                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6623                         ;;
6624                 *)      # Try to guess based on whether libc has major.minor.
6625                         case "$libc" in
6626                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6627                         *libc.$so.[0-9]*) dflt=$majonly ;;
6628                         *)      dflt=libperl.$so ;;
6629                         esac
6630                         ;;
6631                 esac
6632                 ;;
6633         *)      dflt=$libperl
6634                 ;;
6635         esac
6636         cat << EOM
6637
6638 I need to select a good name for the shared libperl.  If your system uses
6639 library names with major and minor numbers, then you might want something
6640 like $majmin.  Alternatively, if your system uses a single version
6641 number for shared libraries, then you might want to use $majonly.
6642 Or, your system might be quite happy with a simple libperl.$so.
6643
6644 Since the shared libperl will get installed into a version-specific
6645 architecture-dependent directory, the version number of the shared perl
6646 library probably isn't important, so the default should be o.k.
6647
6648 EOM
6649         rp='What name do you want to give to the shared libperl?'
6650         . ./myread
6651         libperl=$ans
6652         echo "Ok, I'll use $libperl"
6653         ;;
6654 *)
6655         libperl="libperl${_a}"
6656         ;;
6657 esac
6658
6659 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6660 case "$shrpdir" in
6661 '') ;;
6662 *)      $cat >&4 <<EOM
6663 WARNING:  Use of the shrpdir variable for the installation location of
6664 the shared $libperl is not supported.  It was never documented and
6665 will not work in this version.  Let me (perlbug@perl.org)
6666 know of any problems this may cause.
6667
6668 EOM
6669         case "$shrpdir" in
6670         "$archlibexp/CORE")
6671                 $cat >&4 <<EOM
6672 But your current setting of $shrpdir is
6673 the default anyway, so it's harmless.
6674 EOM
6675                 ;;
6676         *)
6677                 $cat >&4 <<EOM
6678 Further, your current attempted setting of $shrpdir
6679 conflicts with the value of $archlibexp/CORE
6680 that installperl will use.
6681 EOM
6682                 ;;
6683         esac
6684         ;;
6685 esac
6686
6687 # How will the perl executable find the installed shared $libperl?
6688 # Add $xxx to ccdlflags.
6689 # If we can't figure out a command-line option, use $shrpenv to
6690 # set env LD_RUN_PATH.  The main perl makefile uses this.
6691 shrpdir=$archlibexp/CORE
6692 xxx=''
6693 tmp_shrpenv=''
6694 if "$useshrplib"; then
6695     case "$osname" in 
6696         aix)
6697                 # We'll set it in Makefile.SH...
6698                 ;;
6699         solaris|netbsd)
6700                 xxx="-R $shrpdir"
6701                 ;;
6702         freebsd)
6703                 xxx="-Wl,-R$shrpdir"
6704                 ;;
6705         linux|irix*|dec_osf)
6706                 xxx="-Wl,-rpath,$shrpdir"
6707                 ;;
6708         next)
6709                 # next doesn't like the default...
6710                 ;;
6711         beos)
6712                 # beos doesn't like the default, either.
6713                 ;;
6714         hpux*)
6715                 # hpux doesn't like the default, either.
6716                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6717                 ;;
6718         *)
6719                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6720                 ;;
6721         esac
6722         case "$xxx" in
6723         '') ;;
6724         *)      
6725                 # Only add $xxx if it isn't already in ccdlflags.
6726                 case " $ccdlflags " in
6727                 *" $xxx "*)     ;;
6728                 *)      ccdlflags="$ccdlflags $xxx"
6729                         cat <<EOM >&4
6730
6731 Adding $xxx to the flags
6732 passed to $ld so that the perl executable will find the 
6733 installed shared $libperl.
6734
6735 EOM
6736                         ;;
6737                 esac
6738                 ;;
6739         esac
6740 fi
6741 # Fix ccdlflags in AIX for building external extensions.
6742 # (For building Perl itself bare -bE:perl.exp is needed,
6743 #  Makefile.SH takes care of this.)
6744 case "$osname" in
6745 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6746 esac
6747 # Respect a hint or command-line value.
6748 case "$shrpenv" in
6749 '') shrpenv="$tmp_shrpenv" ;;
6750 esac
6751 case "$ldlibpthname" in
6752 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6753 none)   ldlibpthname='' ;;
6754 esac
6755
6756 : determine where manual pages are on this system
6757 echo " "
6758 case "$sysman" in
6759 '') 
6760         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6761         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6762         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6763         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6764         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6765         sysman=`./loc . /usr/man/man1 $syspath`
6766         ;;
6767 esac
6768 if $test -d "$sysman"; then
6769         echo "System manual is in $sysman." >&4
6770 else
6771         echo "Could not find manual pages in source form." >&4
6772 fi
6773
6774 : determine where manual pages go
6775 set man1dir man1dir none
6776 eval $prefixit
6777 $cat <<EOM
6778
6779 $spackage has manual pages available in source form.
6780 EOM
6781 case "$nroff" in
6782 nroff)
6783         echo "However, you don't have nroff, so they're probably useless to you."
6784         case "$man1dir" in
6785         '') man1dir="none";;
6786         esac;;
6787 esac
6788 echo "If you don't want the manual sources installed, answer 'none'."
6789 case "$man1dir" in
6790 ' ') dflt=none
6791         ;;
6792 '')
6793         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6794         lookpath="$lookpath $prefixexp/man/p_man/man1"
6795         lookpath="$lookpath $prefixexp/man/u_man/man1"
6796         lookpath="$lookpath $prefixexp/man/man.1"
6797         case "$sysman" in
6798         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6799         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6800         esac
6801         set dflt
6802         eval $prefixup
6803         ;;
6804 *)  dflt="$man1dir"
6805         ;;
6806 esac
6807 echo " "
6808 fn=dn+~
6809 rp="Where do the main $spackage manual pages (source) go?"
6810 . ./getfile
6811 if $test "X$man1direxp" != "X$ansexp"; then
6812         installman1dir=''
6813 fi
6814 man1dir="$ans"
6815 man1direxp="$ansexp"
6816 case "$man1dir" in
6817 '')     man1dir=' '
6818         installman1dir='';;
6819 esac
6820
6821 : Change installation prefix, if necessary.
6822 if $test X"$prefix" != X"$installprefix"; then
6823         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6824 else
6825         installman1dir="$man1direxp"
6826 fi
6827
6828 : What suffix to use on installed man pages
6829
6830 case "$man1dir" in
6831 ' ')
6832         man1ext='0'
6833         ;;
6834 *)
6835         rp="What suffix should be used for the main $spackage man pages?"
6836         case "$man1ext" in
6837         '')     case "$man1dir" in
6838                 *1)  dflt=1 ;;
6839                 *1p) dflt=1p ;;
6840                 *1pm) dflt=1pm ;;
6841                 *l) dflt=l;;
6842                 *n) dflt=n;;
6843                 *o) dflt=o;;
6844                 *p) dflt=p;;
6845                 *C) dflt=C;;
6846                 *L) dflt=L;;
6847                 *L1) dflt=L1;;
6848                 *) dflt=1;;
6849                 esac
6850                 ;;
6851         *)      dflt="$man1ext";;
6852         esac
6853         . ./myread
6854         man1ext="$ans"
6855         ;;
6856 esac
6857
6858 : see if we can have long filenames
6859 echo " "
6860 first=123456789abcdef
6861 $rm -f $first
6862 if (echo hi >$first) 2>/dev/null; then
6863         if $test -f 123456789abcde; then
6864                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6865                 val="$undef"
6866         else
6867                 echo 'You can have filenames longer than 14 characters.'>&4
6868                 val="$define"
6869         fi
6870 else
6871         $cat <<'EOM'
6872 You can't have filenames longer than 14 chars.
6873 You can't even think about them!
6874 EOM
6875         val="$undef"
6876 fi 
6877 set d_flexfnam
6878 eval $setvar
6879 $rm -rf 123456789abcde*
6880
6881 : determine where library module manual pages go
6882 set man3dir man3dir none
6883 eval $prefixit
6884 $cat <<EOM
6885
6886 $spackage has manual pages for many of the library modules.
6887 EOM
6888
6889 case "$nroff" in
6890 nroff)
6891         $cat <<'EOM'
6892 However, you don't have nroff, so they're probably useless to you.
6893 EOM
6894         case "$man3dir" in
6895         '') man3dir="none";;
6896         esac;;
6897 esac
6898
6899 case "$d_flexfnam" in
6900 undef)
6901         $cat <<'EOM'
6902 However, your system can't handle the long file names like File::Basename.3. 
6903 EOM
6904         case "$man3dir" in
6905         '') man3dir="none";;
6906         esac;;
6907 esac
6908
6909 echo "If you don't want the manual sources installed, answer 'none'."
6910 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6911 case "$man3dir" in
6912 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6913         if $test -d "$privlib/man/man3"; then
6914                 cat <<EOM >&4
6915
6916 WARNING:  Previous versions of perl installed man3 pages into
6917 $privlib/man/man3.  This version will suggest a 
6918 new default of $dflt.  
6919 EOM
6920                 tdflt=$dflt
6921                 dflt='n'
6922                 rp='Do you wish to preserve the old behavior?(y/n)'
6923                 . ./myread
6924                 case "$ans" in
6925                 y*) dflt="$privlib/man/man3" ;;
6926                 *)  dflt=$tdflt ;;
6927                 esac
6928     fi
6929         ;;
6930 *)      dflt="$man3dir" ;;
6931 esac
6932 case "$dflt" in
6933 ' ') dflt=none ;;
6934 esac
6935 echo " "
6936 fn=dn+~
6937 rp="Where do the $package library man pages (source) go?"
6938 . ./getfile
6939 man3dir="$ans"
6940 man3direxp="$ansexp"
6941 case "$man3dir" in
6942 '')     man3dir=' '
6943         installman3dir='';;
6944 esac
6945
6946 : Change installation prefix, if necessary.
6947 if $test X"$prefix" != X"$installprefix"; then
6948         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6949 else
6950         installman3dir="$man3direxp"
6951 fi
6952
6953 : What suffix to use on installed man pages
6954 case "$man3dir" in
6955 ' ')
6956         man3ext='0'
6957         ;;
6958 *)
6959         rp="What suffix should be used for the $package library man pages?"
6960         case "$man3ext" in
6961         '')     case "$man3dir" in
6962                 *3)  dflt=3 ;;
6963                 *3p) dflt=3p ;;
6964                 *3pm) dflt=3pm ;;
6965                 *l) dflt=l;;
6966                 *n) dflt=n;;
6967                 *o) dflt=o;;
6968                 *p) dflt=p;;
6969                 *C) dflt=C;;
6970                 *L) dflt=L;;
6971                 *L3) dflt=L3;;
6972                 *) dflt=3;;
6973                 esac
6974                 ;;
6975         *)      dflt="$man3ext";;
6976         esac
6977         . ./myread
6978         man3ext="$ans"
6979         ;;
6980 esac
6981
6982 : see if we have to deal with yellow pages, now NIS.
6983 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6984         if $test -f /usr/etc/nibindd; then
6985                 echo " "
6986                 echo "I'm fairly confident you're on a NeXT."
6987                 echo " "
6988                 rp='Do you get the hosts file via NetInfo?'
6989                 dflt=y
6990                 case "$hostcat" in
6991                 nidump*) ;;
6992                 '') ;;
6993                 *) dflt=n;;
6994                 esac
6995                 . ./myread
6996                 case "$ans" in
6997                 y*) hostcat='nidump hosts .';;
6998                 *)      case "$hostcat" in
6999                         nidump*) hostcat='';;
7000                         esac
7001                         ;;
7002                 esac
7003         fi
7004         case "$hostcat" in
7005         nidump*) ;;
7006         *)
7007                 case "$hostcat" in
7008                 *ypcat*) dflt=y;;
7009                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7010                                 dflt=y
7011                         else
7012                                 dflt=n
7013                         fi;;
7014                 *) dflt=n;;
7015                 esac
7016                 echo " "
7017                 rp='Are you getting the hosts file via yellow pages?'
7018                 . ./myread
7019                 case "$ans" in
7020                 y*) hostcat='ypcat hosts';;
7021                 *) hostcat='cat /etc/hosts';;
7022                 esac
7023                 ;;
7024         esac
7025 fi
7026 case "$hostcat" in
7027 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7028 esac
7029 case "$groupcat" in
7030 '') test -f /etc/group && groupcat='cat /etc/group';;
7031 esac
7032 case "$passcat" in
7033 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7034 esac
7035
7036 : now get the host name
7037 echo " "
7038 echo "Figuring out host name..." >&4
7039 case "$myhostname" in
7040 '') cont=true
7041         echo 'Maybe "hostname" will work...'
7042         if tans=`sh -c hostname 2>&1` ; then
7043                 myhostname=$tans
7044                 phostname=hostname
7045                 cont=''
7046         fi
7047         ;;
7048 *) cont='';;
7049 esac
7050 if $test "$cont"; then
7051         if ./xenix; then
7052                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7053                 if tans=`cat /etc/systemid 2>&1` ; then
7054                         myhostname=$tans
7055                         phostname='cat /etc/systemid'
7056                         echo "Whadyaknow.  Xenix always was a bit strange..."
7057                         cont=''
7058                 fi
7059         elif $test -r /etc/systemid; then
7060                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7061         fi
7062 fi
7063 if $test "$cont"; then
7064         echo 'No, maybe "uuname -l" will work...'
7065         if tans=`sh -c 'uuname -l' 2>&1` ; then
7066                 myhostname=$tans
7067                 phostname='uuname -l'
7068         else
7069                 echo 'Strange.  Maybe "uname -n" will work...'
7070                 if tans=`sh -c 'uname -n' 2>&1` ; then
7071                         myhostname=$tans
7072                         phostname='uname -n'
7073                 else
7074                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7075                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7076                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7077                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7078                         else
7079                                 case "$myhostname" in
7080                                 '') echo "Does this machine have an identity crisis or something?"
7081                                         phostname='';;
7082                                 *)
7083                                         echo "Well, you said $myhostname before..."
7084                                         phostname='echo $myhostname';;
7085                                 esac
7086                         fi
7087                 fi
7088         fi
7089 fi
7090 : you do not want to know about this
7091 set $myhostname
7092 myhostname=$1
7093
7094 : verify guess
7095 if $test "$myhostname" ; then
7096         dflt=y
7097         rp='Your host name appears to be "'$myhostname'".'" Right?"
7098         . ./myread
7099         case "$ans" in
7100         y*) ;;
7101         *) myhostname='';;
7102         esac
7103 fi
7104
7105 : bad guess or no guess
7106 while $test "X$myhostname" = X ; do
7107         dflt=''
7108         rp="Please type the (one word) name of your host:"
7109         . ./myread
7110         myhostname="$ans"
7111 done
7112
7113 : translate upper to lower if necessary
7114 case "$myhostname" in
7115 *[A-Z]*)
7116         echo "(Normalizing case in your host name)"
7117         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7118         ;;
7119 esac
7120
7121 case "$myhostname" in
7122 *.*)
7123         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7124         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7125         echo "(Trimming domain name from host name--host name is now $myhostname)"
7126         ;;
7127 *) case "$mydomain" in
7128         '')
7129                 {
7130                         test "X$hostcat" = "Xypcat hosts" &&
7131                         ypmatch "$myhostname" hosts 2>/dev/null |\
7132                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7133                         $test -s hosts
7134                 } || {
7135                         test "X$hostcat" != "X" &&
7136                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7137                                         /[       ]$myhostname[  . ]/p" > hosts
7138                 }
7139                 tmp_re="[       . ]"
7140                 if $test -f hosts; then
7141                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7142                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7143                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7144                                 hosts | $sort | $uniq | \
7145                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7146                         case `$echo X$dflt` in
7147                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7148                                 dflt=.
7149                                 ;;
7150                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7151                                 ;;
7152                         esac
7153                 else
7154                         echo "(I cannot locate a hosts database anywhere)"
7155                         dflt=.
7156                 fi
7157                 case "$dflt" in
7158                 .)
7159                         tans=`./loc resolv.conf X /etc /usr/etc`
7160                         if $test -f "$tans"; then
7161                                 echo "(Attempting domain name extraction from $tans)"
7162                                 dflt=.`$sed -n -e 's/   / /g' \
7163                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7164                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7165                                 case "$dflt" in
7166                                 .) dflt=.`$sed -n -e 's/        / /g' \
7167                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7168                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7169                                         ;;
7170                                 esac
7171                         fi
7172                         ;;
7173                 esac
7174                 case "$dflt" in
7175                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7176                         dflt=.`sh -c domainname 2>/dev/null`
7177                         case "$dflt" in
7178                         '') dflt='.';;
7179                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7180                         esac
7181                         ;;
7182                 esac
7183                 case "$dflt" in
7184                 .) echo "(Lost all hope -- silly guess then)"
7185                         dflt='.uucp'
7186                         ;;
7187                 esac
7188                 $rm -f hosts
7189                 ;;
7190         *) dflt="$mydomain";;
7191         esac;;
7192 esac
7193 echo " "
7194 rp="What is your domain name?"
7195 . ./myread
7196 tans="$ans"
7197 case "$ans" in
7198 '') ;;
7199 .*) ;;
7200 *) tans=".$tans";;
7201 esac
7202 mydomain="$tans"
7203
7204 : translate upper to lower if necessary
7205 case "$mydomain" in
7206 *[A-Z]*)
7207         echo "(Normalizing case in your domain name)"
7208         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7209         ;;
7210 esac
7211
7212 : a little sanity check here
7213 case "$phostname" in
7214 '') ;;
7215 *)
7216         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7217         $myhostname$mydomain|$myhostname) ;;
7218         *)
7219                 case "$phostname" in
7220                 sed*)
7221                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7222                         ;;
7223                 *)
7224                         echo "(That doesn't agree with your $phostname command, by the way.)"
7225                         ;;
7226                 esac
7227         ;;
7228         esac
7229         ;;
7230 esac
7231
7232 $cat <<EOM
7233
7234 I need to get your e-mail address in Internet format if possible, i.e.
7235 something like user@host.domain. Please answer accurately since I have
7236 no easy means to double check it. The default value provided below
7237 is most probably close to reality but may not be valid from outside
7238 your organization...
7239
7240 EOM
7241 cont=x
7242 while test "$cont"; do
7243         case "$cf_email" in
7244         '') dflt="$cf_by@$myhostname$mydomain";;
7245         *) dflt="$cf_email";;
7246         esac
7247         rp='What is your e-mail address?'
7248         . ./myread
7249         cf_email="$ans"
7250         case "$cf_email" in
7251         *@*.*) cont='' ;;
7252         *)
7253                 rp='Address does not look like an Internet one.  Use it anyway?'
7254                 case "$fastread" in
7255                 yes) dflt=y ;;
7256                 *) dflt=n ;;
7257                 esac
7258                 . ./myread
7259                 case "$ans" in
7260                 y*) cont='' ;;
7261                 *) echo " " ;;
7262                 esac
7263                 ;;
7264         esac
7265 done
7266
7267 $cat <<EOM
7268
7269 If you or somebody else will be maintaining perl at your site, please
7270 fill in the correct e-mail address here so that they may be contacted
7271 if necessary. Currently, the "perlbug" program included with perl
7272 will send mail to this address in addition to perlbug@perl.org. You may
7273 enter "none" for no administrator.
7274
7275 EOM
7276 case "$perladmin" in
7277 '') dflt="$cf_email";;
7278 *) dflt="$perladmin";;
7279 esac
7280 rp='Perl administrator e-mail address'
7281 . ./myread
7282 perladmin="$ans"
7283
7284 : determine whether to only install version-specific parts.
7285 echo " "
7286 $cat <<EOM
7287 Do you want to install only the version-specific parts of the perl
7288 distribution?  Usually you do *not* want to do this.
7289 EOM
7290 case "$versiononly" in
7291 "$define"|[Yy]*|true) dflt='y' ;;
7292 *) dflt='n';
7293 esac
7294 rp="Do you want to install only the version-specific parts of perl?"
7295 . ./myread
7296 case "$ans" in
7297 [yY]*)  val="$define";;
7298 *)      val="$undef" ;;
7299 esac
7300 set versiononly
7301 eval $setvar
7302
7303 : figure out how to guarantee perl startup
7304 case "$startperl" in
7305 '')
7306         case "$sharpbang" in
7307         *!)
7308                 $cat <<EOH
7309
7310 I can use the #! construct to start perl on your system. This will
7311 make startup of perl scripts faster, but may cause problems if you
7312 want to share those scripts and perl is not in a standard place
7313 ($binexp/perl) on all your platforms. The alternative is to force
7314 a shell by starting the script with a single ':' character.
7315
7316 EOH
7317                 case "$versiononly" in
7318                 "$define")      dflt="$binexp/perl$version";;  
7319                 *)              dflt="$binexp/perl";;
7320                 esac
7321                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7322                 . ./myread
7323                 case "$ans" in
7324                 none)   startperl=": # use perl";;
7325                 *)      startperl="#!$ans"
7326                         if $test 30 -lt `echo "$ans" | wc -c`; then
7327                                 $cat >&4 <<EOM
7328
7329 WARNING:  Some systems limit the #! command to 32 characters.
7330 If you experience difficulty running Perl scripts with #!, try
7331 installing Perl in a directory with a shorter pathname.
7332
7333 EOM
7334                         fi ;;
7335                 esac
7336                 ;;
7337         *) startperl=": # use perl"
7338                 ;;
7339         esac
7340         ;;
7341 esac
7342 echo "I'll use $startperl to start perl scripts."
7343
7344 : figure best path for perl in scripts
7345 case "$perlpath" in
7346 '')
7347         perlpath="$binexp/perl"
7348         case "$startperl" in
7349         *!*) ;;
7350         *)
7351                 $cat <<EOH
7352
7353 I will use the "eval 'exec'" idiom to start Perl on your system.
7354 I can use the full path of your Perl binary for this purpose, but
7355 doing so may cause problems if you want to share those scripts and
7356 Perl is not always in a standard place ($binexp/perl).
7357
7358 EOH
7359                 dflt="$binexp/perl"
7360                 rp="What path shall I use in \"eval 'exec'\"?"
7361                 . ./myread
7362                 perlpath="$ans"
7363                 ;;
7364         esac
7365         ;;
7366 esac
7367 case "$startperl" in
7368 *!*)    ;;
7369 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7370 esac
7371
7372 : determine where public executable scripts go
7373 set scriptdir scriptdir
7374 eval $prefixit
7375 case "$scriptdir" in
7376 '')
7377         dflt="$bin"
7378         : guess some guesses
7379         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7380         $test -d /usr/share/bin     && dflt=/usr/share/bin
7381         $test -d /usr/local/script  && dflt=/usr/local/script
7382         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7383         $test -d $prefixexp/script  && dflt=$prefixexp/script
7384         set dflt
7385         eval $prefixup
7386         ;;
7387 *)  dflt="$scriptdir"
7388         ;;
7389 esac
7390 $cat <<EOM
7391  
7392 Some installations have a separate directory just for executable scripts so
7393 that they can mount it across multiple architectures but keep the scripts in
7394 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7395 Or you might just lump your scripts in with all your other executables.
7396  
7397 EOM
7398 fn=d~
7399 rp='Where do you keep publicly executable scripts?'
7400 . ./getfile
7401 if $test "X$ansexp" != "X$scriptdirexp"; then
7402         installscript=''
7403 fi
7404 scriptdir="$ans"
7405 scriptdirexp="$ansexp"
7406 : Change installation prefix, if necessary.
7407 if $test X"$prefix" != X"$installprefix"; then
7408         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7409 else
7410         installscript="$scriptdirexp"
7411 fi
7412
7413 : determine where add-on public executables go
7414 case "$sitebin" in
7415 '')     dflt=$siteprefix/bin ;;
7416 *)      dflt=$sitebin ;;
7417 esac
7418 fn=d~
7419 rp='Pathname where the add-on public executables should be installed?'
7420 . ./getfile
7421 sitebin="$ans"
7422 sitebinexp="$ansexp"
7423 : Change installation prefix, if necessary.
7424 if $test X"$prefix" != X"$installprefix"; then
7425         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7426 else
7427         installsitebin="$sitebinexp"
7428 fi
7429
7430 case "$useperlio" in
7431 $define|true|[yY]*)     dflt='y';;
7432 *) dflt='n';;
7433 esac
7434 cat <<EOM
7435
7436 Previous version of $package used the standard IO mechanisms as
7437 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7438 alternate IO mechanisms via the PerlIO abstraction layer, but the
7439 stdio mechanism is still the default.  This abstraction layer can
7440 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7441 Using PerlIO with sfio may cause problems with some extension modules.
7442
7443 If this doesn't make any sense to you, just accept the default '$dflt'.
7444 EOM
7445 rp='Use the experimental PerlIO abstraction layer?'
7446 . ./myread
7447 case "$ans" in
7448 y|Y) 
7449         val="$define"
7450         ;;     
7451 *)      
7452         echo "Ok, doing things the stdio way."
7453         val="$undef"
7454         ;;
7455 esac
7456 set useperlio
7457 eval $setvar 
7458
7459 case "$usesocks" in
7460 $define|true|[yY]*)
7461         case "$useperlio" in
7462         $define|true|[yY]*) ;;
7463         *)      cat >&4 <<EOM
7464
7465 You are using the SOCKS proxy protocol library which means that you
7466 should also use the PerlIO layer.  You may be headed for trouble.
7467
7468 EOM
7469                 ;;
7470         esac
7471         ;;
7472 esac
7473
7474         
7475 case "$vendorprefix" in
7476 '')     d_vendorbin="$undef"
7477         vendorbin=''
7478         vendorbinexp=''
7479         ;;
7480 *)      d_vendorbin="$define"
7481         : determine where vendor-supplied executables go.
7482         case "$vendorbin" in
7483         '') dflt=$vendorprefix/bin ;;
7484         *)      dflt="$vendorbin" ;;
7485         esac
7486         fn=d~+
7487         rp='Pathname for the vendor-supplied executables directory?'
7488         . ./getfile
7489         vendorbin="$ans"
7490         vendorbinexp="$ansexp"
7491         ;;
7492 esac
7493 : Change installation prefix, if necessary.
7494 if $test X"$prefix" != X"$installprefix"; then
7495         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7496 else
7497         installvendorbin="$vendorbinexp"
7498 fi
7499
7500 : see if qgcvt exists
7501 set qgcvt d_qgcvt
7502 eval $inlibc
7503
7504 echo " "
7505
7506 if $test X"$d_longdbl" = X"$define"; then
7507
7508 echo "Checking how to print long doubles..." >&4
7509
7510 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7511         $cat >try.c <<'EOCP'
7512 #include <sys/types.h>
7513 #include <stdio.h>
7514 int main() {
7515   double d = 123.456;
7516   printf("%.3f\n", d);
7517 }
7518 EOCP
7519         set try
7520         if eval $compile; then
7521                 yyy=`./try$exe_ext`
7522                 case "$yyy" in
7523                 123.456)
7524                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7525                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7526                         echo "We will use %f."
7527                         ;;
7528                 esac
7529         fi
7530 fi
7531
7532 if $test X"$sPRIfldbl" = X; then
7533         $cat >try.c <<'EOCP'
7534 #include <sys/types.h>
7535 #include <stdio.h>
7536 int main() {
7537   long double d = 123.456;
7538   printf("%.3llf\n", d);
7539 }
7540 EOCP
7541         set try
7542         if eval $compile; then
7543                 yyy=`./try$exe_ext`
7544                 case "$yyy" in
7545                 123.456)
7546                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7547                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7548                         echo "We will use %llf."
7549                         ;;
7550                 esac
7551         fi
7552 fi
7553
7554 if $test X"$sPRIfldbl" = X; then
7555         $cat >try.c <<'EOCP'
7556 #include <sys/types.h>
7557 #include <stdio.h>
7558 int main() {
7559   long double d = 123.456;
7560   printf("%.3Lf\n", d);
7561 }
7562 EOCP
7563         set try
7564         if eval $compile; then
7565                 yyy=`./try$exe_ext`
7566                 case "$yyy" in
7567                 123.456)
7568                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7569                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7570                         echo "We will use %Lf."
7571                         ;;
7572                 esac
7573         fi
7574 fi
7575
7576 if $test X"$sPRIfldbl" = X; then
7577         $cat >try.c <<'EOCP'
7578 #include <sys/types.h>
7579 #include <stdio.h>
7580 int main() {
7581   long double d = 123.456;
7582   printf("%.3lf\n", d);
7583 }
7584 EOCP
7585         set try
7586         if eval $compile; then
7587                 yyy=`./try$exe_ext`
7588                 case "$yyy" in
7589                 123.456)
7590                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7591                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7592                         echo "We will use %lf."
7593                         ;;
7594                 esac
7595         fi
7596 fi
7597
7598 if $test X"$sPRIfldbl" = X; then
7599         echo "Cannot figure out how to print long doubles." >&4
7600 else
7601         sSCNfldbl=$sPRIfldbl    # expect consistency
7602 fi
7603
7604 $rm -f try try.*
7605
7606 fi # d_longdbl
7607
7608 case "$sPRIfldbl" in
7609 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7610         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7611         d_SCNfldbl="$undef";
7612         ;;
7613 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7614         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7615         d_SCNfldbl="$define";
7616         ;;
7617 esac
7618
7619 : Check how to convert floats to strings.
7620 echo " "
7621 echo "Checking for an efficient way to convert floats to strings."
7622 echo " " > try.c
7623 case "$uselongdouble" in
7624 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7625 esac
7626 case "$d_longdbl" in
7627 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7628 esac
7629 case "$d_PRIgldbl" in
7630 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7631 esac
7632 $cat >>try.c <<EOP
7633 #ifdef TRY_gconvert
7634 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7635 char *myname = "gconvert";
7636 #endif
7637 #ifdef TRY_gcvt
7638 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7639 char *myname = "gcvt";
7640 #endif
7641 #ifdef TRY_qgcvt
7642 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7643 char *myname = "qgcvt";
7644 #define DOUBLETYPE long double
7645 #endif
7646 #ifdef TRY_sprintf
7647 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7648 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7649 #else
7650 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7651 #endif
7652 char *myname = "sprintf";
7653 #endif
7654
7655 #ifndef DOUBLETYPE
7656 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7657 #define DOUBLETYPE long double
7658 #else
7659 #define DOUBLETYPE double
7660 #endif
7661 #endif
7662
7663 #include <stdio.h>
7664
7665 #define I_STDLIB $i_stdlib
7666 #ifdef I_STDLIB
7667 #include <stdlib.h>
7668 #endif
7669
7670 int
7671 checkit(expect, got)
7672 char *expect;
7673 char *got;
7674 {
7675     if (strcmp(expect, got)) {
7676                 printf("%s oddity:  Expected %s, got %s\n",
7677                         myname, expect, got);
7678                 exit(1);
7679         }
7680 }
7681
7682 int main()
7683
7684         char buf[64]; 
7685         buf[63] = '\0';
7686
7687         /* This must be 1st test on (which?) platform */
7688         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7689         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7690         checkit("0.1", buf);
7691
7692         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7693         checkit("1", buf);
7694
7695         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7696         checkit("1.1", buf);
7697
7698         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7699         checkit("1.01", buf);
7700
7701         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7702         checkit("1.001", buf);
7703
7704         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7705         checkit("1.0001", buf);
7706
7707         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7708         checkit("1.00001", buf);
7709
7710         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7711         checkit("1.000001", buf);
7712
7713         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7714         checkit("0", buf);
7715
7716         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7717         checkit("-1", buf);
7718
7719         /* Some Linux gcvt's give 1.e+5 here. */
7720         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7721         checkit("100000", buf);
7722         
7723         /* Some Linux gcvt's give -1.e+5 here. */
7724         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7725         checkit("-100000", buf);
7726
7727         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7728         checkit("123.456", buf);
7729
7730         exit(0);
7731 }
7732 EOP
7733 case "$d_Gconvert" in
7734 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7735 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7736 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7737 *) xxx_list='gconvert gcvt sprintf' ;;
7738 esac
7739
7740 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7741 "$define$define$define")
7742     # for long doubles prefer first qgcvt, then sprintf
7743     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7744     xxx_list="sprintf $xxx_list"
7745     case "$d_qgcvt" in
7746     "$define") xxx_list="qgcvt $xxx_list" ;;
7747     esac
7748     ;;
7749 esac
7750
7751 for xxx_convert in $xxx_list; do
7752         echo "Trying $xxx_convert..."
7753         $rm -f try try$_o
7754         set try -DTRY_$xxx_convert
7755         if eval $compile; then
7756                 echo "$xxx_convert() found." >&4
7757                 if ./try; then
7758                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7759                         break;
7760                 else
7761                         echo "...But $xxx_convert didn't work as I expected."
7762                 fi
7763         else
7764                 echo "$xxx_convert NOT found." >&4
7765         fi
7766 done
7767         
7768 case "$xxx_convert" in
7769 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7770 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7771 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7772 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7773    "$define$define$define")
7774       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7775    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7776    esac
7777    ;;  
7778 esac
7779
7780 : see if _fwalk exists
7781 set fwalk d__fwalk
7782 eval $inlibc
7783
7784 : Initialize h_fcntl
7785 h_fcntl=false
7786
7787 : Initialize h_sysfile
7788 h_sysfile=false
7789
7790 : access call always available on UNIX
7791 set access d_access
7792 eval $inlibc
7793
7794 : locate the flags for 'access()'
7795 case "$d_access" in
7796 "$define")
7797         echo " "
7798         $cat >access.c <<'EOCP'
7799 #include <sys/types.h>
7800 #ifdef I_FCNTL
7801 #include <fcntl.h>
7802 #endif
7803 #ifdef I_SYS_FILE
7804 #include <sys/file.h>
7805 #endif
7806 #ifdef I_UNISTD
7807 #include <unistd.h>
7808 #endif
7809 int main() {
7810         exit(R_OK);
7811 }
7812 EOCP
7813         : check sys/file.h first, no particular reason here
7814         if $test `./findhdr sys/file.h` && \
7815                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7816                 h_sysfile=true;
7817                 echo "<sys/file.h> defines the *_OK access constants." >&4
7818         elif $test `./findhdr fcntl.h` && \
7819                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7820                 h_fcntl=true;
7821                 echo "<fcntl.h> defines the *_OK access constants." >&4
7822         elif $test `./findhdr unistd.h` && \
7823                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7824                 echo "<unistd.h> defines the *_OK access constants." >&4
7825         else
7826                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7827         fi
7828         ;;
7829 esac
7830 $rm -f access*
7831
7832 : see if accessx exists
7833 set accessx d_accessx
7834 eval $inlibc
7835
7836 : see if alarm exists
7837 set alarm d_alarm
7838 eval $inlibc
7839
7840 : see if atolf exists
7841 set atolf d_atolf
7842 eval $inlibc
7843
7844 : see if atoll exists
7845 set atoll d_atoll
7846 eval $inlibc
7847
7848 : Look for GNU-cc style attribute checking
7849 echo " "
7850 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7851 $cat >attrib.c <<'EOCP'
7852 #include <stdio.h>
7853 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7854 EOCP
7855 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7856         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7857                 echo "Your C compiler doesn't fully support __attribute__."
7858                 val="$undef"
7859         else
7860                 echo "Your C compiler supports __attribute__."
7861                 val="$define"
7862         fi
7863 else
7864         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7865         val="$undef"
7866 fi
7867 set d_attribut
7868 eval $setvar
7869 $rm -f attrib*
7870
7871 : see if bcmp exists
7872 set bcmp d_bcmp
7873 eval $inlibc
7874
7875 : see if bcopy exists
7876 set bcopy d_bcopy
7877 eval $inlibc
7878
7879 : see if this is a unistd.h system
7880 set unistd.h i_unistd
7881 eval $inhdr
7882
7883 : see if getpgrp exists
7884 set getpgrp d_getpgrp
7885 eval $inlibc
7886
7887 case "$d_getpgrp" in
7888 "$define")
7889         echo " "
7890         echo "Checking to see which flavor of getpgrp is in use..."
7891         $cat >set.c <<EOP
7892 #$i_unistd I_UNISTD
7893 #include <sys/types.h>
7894 #ifdef I_UNISTD
7895 #  include <unistd.h>
7896 #endif
7897 int main()
7898 {
7899         if (getuid() == 0) {
7900                 printf("(I see you are running Configure as super-user...)\n");
7901                 setuid(1);
7902         }
7903 #ifdef TRY_BSD_PGRP
7904         if (getpgrp(1) == 0)
7905                 exit(0);
7906 #else
7907         if (getpgrp() > 0)
7908                 exit(0);
7909 #endif
7910         exit(1);
7911 }
7912 EOP
7913         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7914                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7915                 val="$define"
7916         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7917                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7918                 val="$undef"
7919         else
7920                 echo "I can't seem to compile and run the test program."
7921                 if ./usg; then
7922                         xxx="a USG one, i.e. you use getpgrp()."
7923                 else
7924                         # SVR4 systems can appear rather BSD-ish.
7925                         case "$i_unistd" in
7926                         $undef)
7927                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7928                                 val="$define"
7929                                 ;;
7930                         $define)
7931                                 xxx="probably a USG one, i.e. you use getpgrp()."
7932                                 val="$undef"
7933                                 ;;
7934                         esac
7935                 fi
7936                 echo "Assuming your getpgrp is $xxx" >&4
7937         fi
7938         ;;
7939 *) val="$undef";;
7940 esac
7941 set d_bsdgetpgrp
7942 eval $setvar
7943 $rm -f set set.c
7944
7945 : see if setpgrp exists
7946 set setpgrp d_setpgrp
7947 eval $inlibc
7948
7949 case "$d_setpgrp" in
7950 "$define")
7951         echo " "
7952         echo "Checking to see which flavor of setpgrp is in use..."
7953         $cat >set.c <<EOP
7954 #$i_unistd I_UNISTD
7955 #include <sys/types.h>
7956 #ifdef I_UNISTD
7957 #  include <unistd.h>
7958 #endif
7959 int main()
7960 {
7961         if (getuid() == 0) {
7962                 printf("(I see you are running Configure as super-user...)\n");
7963                 setuid(1);
7964         }
7965 #ifdef TRY_BSD_PGRP
7966         if (-1 == setpgrp(1, 1))
7967                 exit(0);
7968 #else
7969         if (setpgrp() != -1)
7970                 exit(0);
7971 #endif
7972         exit(1);
7973 }
7974 EOP
7975         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7976                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7977                 val="$define"
7978         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7979                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7980                 val="$undef"
7981         else
7982                 echo "(I can't seem to compile and run the test program.)"
7983                 if ./usg; then
7984                         xxx="a USG one, i.e. you use setpgrp()."
7985                 else
7986                         # SVR4 systems can appear rather BSD-ish.
7987                         case "$i_unistd" in
7988                         $undef)
7989                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7990                                 val="$define"
7991                                 ;;
7992                         $define)
7993                                 xxx="probably a USG one, i.e. you use setpgrp()."
7994                                 val="$undef"
7995                                 ;;
7996                         esac
7997                 fi
7998                 echo "Assuming your setpgrp is $xxx" >&4
7999         fi
8000         ;;
8001 *) val="$undef";;
8002 esac
8003 set d_bsdsetpgrp
8004 eval $setvar
8005 $rm -f set set.c
8006 : see if bzero exists
8007 set bzero d_bzero
8008 eval $inlibc
8009
8010 : see if signal is declared as pointer to function returning int or void
8011 echo " "
8012 xxx=`./findhdr signal.h`
8013 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8014 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8015         echo "You have int (*signal())() instead of void." >&4
8016         val="$undef"
8017 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8018         echo "You have void (*signal())()." >&4
8019         val="$define"
8020 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8021         echo "You have int (*signal())() instead of void." >&4
8022         val="$undef"
8023 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8024         echo "You have void (*signal())()." >&4
8025         val="$define"
8026 else
8027         case "$d_voidsig" in
8028         '')
8029         echo "I can't determine whether signal handler returns void or int..." >&4
8030                 dflt=void
8031                 rp="What type does your signal handler return?"
8032                 . ./myread
8033                 case "$ans" in
8034                 v*) val="$define";;
8035                 *) val="$undef";;
8036                 esac;;
8037         "$define")
8038                 echo "As you already told me, signal handler returns void." >&4
8039                 val="$define"
8040                 ;;
8041         *)      echo "As you already told me, signal handler returns int." >&4
8042                 val="$undef"
8043                 ;;
8044         esac
8045 fi
8046 set d_voidsig
8047 eval $setvar
8048 case "$d_voidsig" in
8049 "$define") signal_t="void";;
8050 *) signal_t="int";;
8051 esac
8052 $rm -f $$.tmp
8053
8054 : check for ability to cast large floats to 32-bit ints.
8055 echo " "
8056 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8057 if $test "$intsize" -ge 4; then
8058         xxx=int
8059 else
8060         xxx=long
8061 fi
8062 $cat >try.c <<EOCP
8063 #include <stdio.h>
8064 #include <sys/types.h>
8065 #include <signal.h>
8066 $signal_t blech(s) int s; { exit(3); }
8067 int main()
8068 {
8069         $xxx i32;
8070         double f, g;
8071         int result = 0;
8072         char str[16];
8073         signal(SIGFPE, blech);
8074
8075         /* Don't let compiler optimize the test away.  Store the number 
8076            in a writable string for gcc to pass to sscanf under HP/UX.
8077         */
8078         sprintf(str, "2147483647");
8079         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8080         g = 10 * f;
8081         i32  = ($xxx) g;
8082
8083         /* x86 processors will probably give 0x8000 0000, which is a
8084        sign change.  We don't want that.  We want to mimic SPARC
8085            behavior here, which is to preserve the sign and give
8086            back 0x7fff ffff.
8087         */
8088         if (i32 != ($xxx) f)
8089                 result |= 1;
8090         exit(result);
8091 }
8092 EOCP
8093 set try
8094 if eval $compile_ok; then
8095         ./try
8096         yyy=$?
8097 else
8098         echo "(I can't seem to compile the test program--assuming it can't)"
8099         yyy=1
8100 fi
8101 case "$yyy" in
8102 0)      val="$define"
8103         echo "Yup, it can."
8104         ;;
8105 *)      val="$undef"
8106         echo "Nope, it can't."
8107         ;;
8108 esac
8109 set d_casti32
8110 eval $setvar
8111 $rm -f try try.*
8112
8113 : check for ability to cast negative floats to unsigned
8114 echo " "
8115 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8116 $cat >try.c <<EOCP
8117 #include <stdio.h>
8118 #include <sys/types.h>
8119 #include <signal.h>
8120 $signal_t blech(s) int s; { exit(7); }
8121 $signal_t blech_in_list(s) int s; { exit(4); }
8122 unsigned long dummy_long(p) unsigned long p; { return p; }
8123 unsigned int dummy_int(p) unsigned int p; { return p; }
8124 unsigned short dummy_short(p) unsigned short p; { return p; }
8125 int main()
8126 {
8127         double f;
8128         unsigned long along;
8129         unsigned int aint;
8130         unsigned short ashort;
8131         int result = 0;
8132         char str[16];
8133         
8134         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8135            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8136            optimized the whole file away
8137         */
8138         /* Store the number in a writable string for gcc to pass to 
8139            sscanf under HP/UX.
8140         */
8141         sprintf(str, "-123");
8142         sscanf(str, "%lf", &f);  /* f = -123.; */
8143
8144         signal(SIGFPE, blech);
8145         along = (unsigned long)f;
8146         aint = (unsigned int)f;
8147         ashort = (unsigned short)f;
8148         if (along != (unsigned long)-123)
8149                 result |= 1;
8150         if (aint != (unsigned int)-123)
8151                 result |= 1;
8152         if (ashort != (unsigned short)-123)
8153                 result |= 1;
8154         sprintf(str, "1073741824.");
8155         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8156         f = f + f;
8157         along = 0;
8158         along = (unsigned long)f;
8159         if (along != 0x80000000)
8160                 result |= 2;
8161         f -= 1.;
8162         along = 0;
8163         along = (unsigned long)f;
8164         if (along != 0x7fffffff)
8165                 result |= 1;
8166         f += 2.;
8167         along = 0;
8168         along = (unsigned long)f;
8169         if (along != 0x80000001)
8170                 result |= 2;
8171         if (result)
8172                 exit(result);
8173         signal(SIGFPE, blech_in_list);
8174         sprintf(str, "123.");
8175         sscanf(str, "%lf", &f);  /* f = 123.; */
8176         along = dummy_long((unsigned long)f);
8177         aint = dummy_int((unsigned int)f);
8178         ashort = dummy_short((unsigned short)f);
8179         if (along != (unsigned long)123)
8180                 result |= 4;
8181         if (aint != (unsigned int)123)
8182                 result |= 4;
8183         if (ashort != (unsigned short)123)
8184                 result |= 4;
8185         exit(result);
8186
8187 }
8188 EOCP
8189 set try
8190 if eval $compile_ok; then
8191         ./try
8192         castflags=$?
8193 else
8194         echo "(I can't seem to compile the test program--assuming it can't)"
8195         castflags=7
8196 fi
8197 case "$castflags" in
8198 0)      val="$define"
8199         echo "Yup, it can."
8200         ;;
8201 *)      val="$undef"
8202         echo "Nope, it can't."
8203         ;;
8204 esac
8205 set d_castneg
8206 eval $setvar
8207 $rm -f try.*
8208
8209 : see if vprintf exists
8210 echo " "
8211 if set vprintf val -f d_vprintf; eval $csym; $val; then
8212         echo 'vprintf() found.' >&4
8213         val="$define"
8214         $cat >vprintf.c <<'EOF'
8215 #include <varargs.h>
8216
8217 int main() { xxx("foo"); }
8218
8219 xxx(va_alist)
8220 va_dcl
8221 {
8222         va_list args;
8223         char buf[10];
8224
8225         va_start(args);
8226         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8227 }
8228 EOF
8229         set vprintf
8230         if eval $compile && ./vprintf; then
8231                 echo "Your vsprintf() returns (int)." >&4
8232                 val2="$undef"
8233         else
8234                 echo "Your vsprintf() returns (char*)." >&4
8235                 val2="$define"
8236         fi
8237 else
8238         echo 'vprintf() NOT found.' >&4
8239                 val="$undef"
8240                 val2="$undef"
8241 fi
8242 set d_vprintf
8243 eval $setvar
8244 val=$val2
8245 set d_charvspr
8246 eval $setvar
8247
8248 : see if chown exists
8249 set chown d_chown
8250 eval $inlibc
8251
8252 : see if chroot exists
8253 set chroot d_chroot
8254 eval $inlibc
8255
8256 : see if chsize exists
8257 set chsize d_chsize
8258 eval $inlibc
8259
8260 : check for const keyword
8261 echo " "
8262 echo 'Checking to see if your C compiler knows about "const"...' >&4
8263 $cat >const.c <<'EOCP'
8264 typedef struct spug { int drokk; } spug;
8265 int main()
8266 {
8267         const char *foo;
8268         const spug y;
8269 }
8270 EOCP
8271 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8272         val="$define"
8273         echo "Yup, it does."
8274 else
8275         val="$undef"
8276         echo "Nope, it doesn't."
8277 fi
8278 set d_const
8279 eval $setvar
8280
8281 : see if crypt exists
8282 echo " "
8283 if set crypt val -f d_crypt; eval $csym; $val; then
8284         echo 'crypt() found.' >&4
8285         val="$define"
8286         cryptlib=''
8287 else
8288         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8289         if $test -z "$cryptlib"; then
8290                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8291         else
8292                 cryptlib=-lcrypt
8293         fi
8294         if $test -z "$cryptlib"; then
8295                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8296         else
8297                 cryptlib=-lcrypt
8298         fi
8299         if $test -z "$cryptlib"; then
8300                 cryptlib=`./loc libcrypt$_a "" $libpth`
8301         else
8302                 cryptlib=-lcrypt
8303         fi
8304         if $test -z "$cryptlib"; then
8305                 echo 'crypt() NOT found.' >&4
8306                 val="$undef"
8307         else
8308                 val="$define"
8309         fi
8310 fi
8311 set d_crypt
8312 eval $setvar
8313
8314 : get csh whereabouts
8315 case "$csh" in
8316 'csh') val="$undef" ;;
8317 *) val="$define" ;;
8318 esac
8319 set d_csh
8320 eval $setvar
8321 : Respect a hint or command line value for full_csh.
8322 case "$full_csh" in
8323 '') full_csh=$csh ;;
8324 esac
8325
8326 : see if cuserid exists
8327 set cuserid d_cuserid
8328 eval $inlibc
8329
8330 : see if this is a limits.h system
8331 set limits.h i_limits
8332 eval $inhdr
8333
8334 : see if this is a float.h system
8335 set float.h i_float
8336 eval $inhdr
8337
8338 : See if number of significant digits in a double precision number is known
8339 echo " "
8340 $cat >dbl_dig.c <<EOM
8341 #$i_limits I_LIMITS
8342 #$i_float I_FLOAT
8343 #ifdef I_LIMITS
8344 #include <limits.h>
8345 #endif
8346 #ifdef I_FLOAT
8347 #include <float.h>
8348 #endif
8349 #ifdef DBL_DIG
8350 printf("Contains DBL_DIG");
8351 #endif
8352 EOM
8353 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8354 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8355         echo "DBL_DIG found." >&4
8356         val="$define"
8357 else
8358         echo "DBL_DIG NOT found." >&4
8359         val="$undef"
8360 fi
8361 $rm -f dbl_dig.?
8362 set d_dbl_dig
8363 eval $setvar
8364
8365 : see if difftime exists
8366 set difftime d_difftime
8367 eval $inlibc
8368
8369 : see if this is a dirent system
8370 echo " "
8371 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8372         val="$define"
8373         echo "<dirent.h> found." >&4
8374 else
8375         val="$undef"
8376         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8377                 echo "<sys/dir.h> found." >&4
8378                 echo " "
8379         else
8380                 xinc=`./findhdr sys/ndir.h`
8381         fi
8382         echo "<dirent.h> NOT found." >&4
8383 fi
8384 set i_dirent
8385 eval $setvar
8386
8387 : Look for type of directory structure.
8388 echo " "
8389 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8390
8391 case "$direntrytype" in
8392 ''|' ')
8393         case "$i_dirent" in
8394         $define) guess1='struct dirent' ;;
8395         *) guess1='struct direct'  ;;
8396         esac
8397         ;;
8398 *)      guess1="$direntrytype"
8399         ;;
8400 esac
8401
8402 case "$guess1" in
8403 'struct dirent') guess2='struct direct' ;;
8404 *) guess2='struct dirent' ;;
8405 esac
8406                 
8407 if $contains "$guess1" try.c >/dev/null 2>&1; then
8408         direntrytype="$guess1"
8409         echo "Your directory entries are $direntrytype." >&4
8410 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8411         direntrytype="$guess2"
8412         echo "Your directory entries seem to be $direntrytype." >&4
8413 else
8414         echo "I don't recognize your system's directory entries." >&4
8415         rp="What type is used for directory entries on this system?"
8416         dflt="$guess1"
8417         . ./myread
8418         direntrytype="$ans"
8419 fi
8420 $rm -f try.c
8421
8422
8423 : see if the directory entry stores field length
8424 echo " "
8425 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8426 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8427         echo "Good, your directory entry keeps length information in d_namlen." >&4
8428         val="$define"
8429 else
8430         echo "Your directory entry does not know about the d_namlen field." >&4
8431         val="$undef"
8432 fi
8433 set d_dirnamlen
8434 eval $setvar
8435 $rm -f try.c
8436
8437 : see if dlerror exists
8438 xxx_runnm="$runnm"
8439 runnm=false
8440 set dlerror d_dlerror
8441 eval $inlibc
8442 runnm="$xxx_runnm"
8443
8444 : see if dlfcn is available
8445 set dlfcn.h i_dlfcn
8446 eval $inhdr
8447
8448 case "$usedl" in
8449 $define|y|true)
8450         $cat << EOM
8451
8452 On a few systems, the dynamically loaded modules that perl generates and uses
8453 will need a different extension than shared libs. The default will probably
8454 be appropriate.
8455
8456 EOM
8457         case "$dlext" in
8458         '')     dflt="$so" ;;
8459         *)      dflt="$dlext" ;;
8460         esac
8461         rp='What is the extension of dynamically loaded modules'
8462         . ./myread
8463         dlext="$ans"
8464         ;;
8465 *)
8466         dlext="none"
8467         ;;
8468 esac
8469
8470 : Check if dlsym need a leading underscore
8471 echo " "
8472 val="$undef"
8473
8474 case "$dlsrc" in
8475 dl_dlopen.xs)
8476         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8477         $cat >dyna.c <<'EOM'
8478 fred () { }
8479 EOM
8480
8481 $cat >fred.c<<EOM
8482
8483 #include <stdio.h>
8484 #$i_dlfcn I_DLFCN
8485 #ifdef I_DLFCN
8486 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8487 #else
8488 #include <sys/types.h>
8489 #include <nlist.h>
8490 #include <link.h>
8491 #endif
8492
8493 extern int fred() ;
8494
8495 int main()
8496 {
8497     void * handle ;
8498     void * symbol ;
8499 #ifndef RTLD_LAZY
8500     int mode = 1 ;
8501 #else
8502     int mode = RTLD_LAZY ;
8503 #endif
8504     handle = dlopen("./dyna.$dlext", mode) ;
8505     if (handle == NULL) {
8506         printf ("1\n") ;
8507         fflush (stdout) ;
8508         exit(0);
8509     }
8510     symbol = dlsym(handle, "fred") ;
8511     if (symbol == NULL) {
8512         /* try putting a leading underscore */
8513         symbol = dlsym(handle, "_fred") ;
8514         if (symbol == NULL) {
8515             printf ("2\n") ;
8516             fflush (stdout) ;
8517             exit(0);
8518         }
8519         printf ("3\n") ;
8520     }
8521     else
8522         printf ("4\n") ;
8523     fflush (stdout) ;
8524     exit(0);
8525 }
8526 EOM
8527         : Call the object file tmp-dyna.o in case dlext=o.
8528         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8529                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8530                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8531                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8532                 xxx=`./fred`
8533                 case $xxx in
8534                 1)      echo "Test program failed using dlopen." >&4
8535                         echo "Perhaps you should not use dynamic loading." >&4;;
8536                 2)      echo "Test program failed using dlsym." >&4
8537                         echo "Perhaps you should not use dynamic loading." >&4;;
8538                 3)      echo "dlsym needs a leading underscore" >&4
8539                         val="$define" ;;
8540                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8541                 esac
8542         else
8543                 echo "I can't compile and run the test program." >&4
8544                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8545         fi
8546         ;;
8547 esac
8548                 
8549 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8550
8551 set d_dlsymun
8552 eval $setvar
8553
8554 hasproto='varname=$1; func=$2; shift; shift;
8555 while $test $# -ge 2; do
8556         case "$1" in
8557         $define) echo "#include <$2>";;
8558         esac ;
8559     shift 2;
8560 done > try.c;
8561 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8562 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8563         echo "$func() prototype found.";
8564         val="$define";
8565 else
8566         echo "$func() prototype NOT found.";
8567         val="$undef";
8568 fi;
8569 set $varname;
8570 eval $setvar;
8571 $rm -f try.c tryout.c'
8572
8573 : see if prototype for drand48 is available
8574 echo " "
8575 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8576 eval $hasproto
8577
8578 : see if dup2 exists
8579 set dup2 d_dup2
8580 eval $inlibc
8581
8582 : see if eaccess exists
8583 set eaccess d_eaccess
8584 eval $inlibc
8585
8586 : see if endgrent exists
8587 set endgrent d_endgrent
8588 eval $inlibc
8589
8590 : see if endhostent exists
8591 set endhostent d_endhent
8592 eval $inlibc
8593
8594 : see if endnetent exists
8595 set endnetent d_endnent
8596 eval $inlibc
8597
8598 : see if endprotoent exists
8599 set endprotoent d_endpent
8600 eval $inlibc
8601
8602 : see if endpwent exists
8603 set endpwent d_endpwent
8604 eval $inlibc
8605
8606 : see if endservent exists
8607 set endservent d_endsent
8608 eval $inlibc
8609
8610 : Locate the flags for 'open()'
8611 echo " "
8612 $cat >open3.c <<'EOCP'
8613 #include <sys/types.h>
8614 #ifdef I_FCNTL
8615 #include <fcntl.h>
8616 #endif
8617 #ifdef I_SYS_FILE
8618 #include <sys/file.h>
8619 #endif
8620 int main() {
8621         if(O_RDONLY);
8622 #ifdef O_TRUNC
8623         exit(0);
8624 #else
8625         exit(1);
8626 #endif
8627 }
8628 EOCP
8629 : check sys/file.h first to get FREAD on Sun
8630 if $test `./findhdr sys/file.h` && \
8631                 set open3 -DI_SYS_FILE && eval $compile; then
8632         h_sysfile=true;
8633         echo "<sys/file.h> defines the O_* constants..." >&4
8634         if ./open3; then
8635                 echo "and you have the 3 argument form of open()." >&4
8636                 val="$define"
8637         else
8638                 echo "but not the 3 argument form of open().  Oh, well." >&4
8639                 val="$undef"
8640         fi
8641 elif $test `./findhdr fcntl.h` && \
8642                 set open3 -DI_FCNTL && eval $compile; then
8643         h_fcntl=true;
8644         echo "<fcntl.h> defines the O_* constants..." >&4
8645         if ./open3; then
8646                 echo "and you have the 3 argument form of open()." >&4
8647                 val="$define"
8648         else
8649                 echo "but not the 3 argument form of open().  Oh, well." >&4
8650                 val="$undef"
8651         fi
8652 else
8653         val="$undef"
8654         echo "I can't find the O_* constant definitions!  You got problems." >&4
8655 fi
8656 set d_open3
8657 eval $setvar
8658 $rm -f open3*
8659
8660 : see which of string.h or strings.h is needed
8661 echo " "
8662 strings=`./findhdr string.h`
8663 if $test "$strings" && $test -r "$strings"; then
8664         echo "Using <string.h> instead of <strings.h>." >&4
8665         val="$define"
8666 else
8667         val="$undef"
8668         strings=`./findhdr strings.h`
8669         if $test "$strings" && $test -r "$strings"; then
8670                 echo "Using <strings.h> instead of <string.h>." >&4
8671         else
8672                 echo "No string header found -- You'll surely have problems." >&4
8673         fi
8674 fi
8675 set i_string
8676 eval $setvar
8677 case "$i_string" in
8678 "$undef") strings=`./findhdr strings.h`;;
8679 *)        strings=`./findhdr string.h`;;
8680 esac
8681
8682 : check for non-blocking I/O stuff
8683 case "$h_sysfile" in
8684 true) echo "#include <sys/file.h>" > head.c;;
8685 *)
8686         case "$h_fcntl" in
8687         true) echo "#include <fcntl.h>" > head.c;;
8688         *) echo "#include <sys/fcntl.h>" > head.c;;
8689         esac
8690         ;;
8691 esac
8692 echo " "
8693 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8694 case "$o_nonblock" in
8695 '')
8696         $cat head.c > try.c
8697         $cat >>try.c <<'EOCP'
8698 #include <stdio.h>
8699 int main() {
8700 #ifdef O_NONBLOCK
8701         printf("O_NONBLOCK\n");
8702         exit(0);
8703 #endif
8704 #ifdef O_NDELAY
8705         printf("O_NDELAY\n");
8706         exit(0);
8707 #endif
8708 #ifdef FNDELAY
8709         printf("FNDELAY\n");
8710         exit(0);
8711 #endif
8712         exit(0);
8713 }
8714 EOCP
8715         set try
8716         if eval $compile_ok; then
8717                 o_nonblock=`./try`
8718                 case "$o_nonblock" in
8719                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8720                 *) echo "Seems like we can use $o_nonblock.";;
8721                 esac
8722         else
8723                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8724         fi
8725         ;;
8726 *) echo "Using $hint value $o_nonblock.";;
8727 esac
8728 $rm -f try try.* .out core
8729
8730 echo " "
8731 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8732 case "$eagain" in
8733 '')
8734         $cat head.c > try.c
8735         $cat >>try.c <<EOCP
8736 #include <errno.h>
8737 #include <sys/types.h>
8738 #include <signal.h>
8739 #include <stdio.h> 
8740 #define MY_O_NONBLOCK $o_nonblock
8741 #ifndef errno  /* XXX need better Configure test */
8742 extern int errno;
8743 #endif
8744 #$i_unistd I_UNISTD
8745 #ifdef I_UNISTD
8746 #include <unistd.h>
8747 #endif
8748 #$i_string I_STRING
8749 #ifdef I_STRING
8750 #include <string.h>
8751 #else
8752 #include <strings.h>
8753 #endif
8754 $signal_t blech(x) int x; { exit(3); }
8755 EOCP
8756         $cat >> try.c <<'EOCP'
8757 int main()
8758 {
8759         int pd[2];
8760         int pu[2];
8761         char buf[1];
8762         char string[100];
8763
8764         pipe(pd);       /* Down: child -> parent */
8765         pipe(pu);       /* Up: parent -> child */
8766         if (0 != fork()) {
8767                 int ret;
8768                 close(pd[1]);   /* Parent reads from pd[0] */
8769                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8770                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8771                         exit(1);
8772                 signal(SIGALRM, blech);
8773                 alarm(5);
8774                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8775                         exit(2);
8776                 sprintf(string, "%d\n", ret);
8777                 write(2, string, strlen(string));
8778                 alarm(0);
8779 #ifdef EAGAIN
8780                 if (errno == EAGAIN) {
8781                         printf("EAGAIN\n");
8782                         goto ok;
8783                 }
8784 #endif
8785 #ifdef EWOULDBLOCK
8786                 if (errno == EWOULDBLOCK)
8787                         printf("EWOULDBLOCK\n");
8788 #endif
8789         ok:
8790                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8791                 sleep(2);                               /* Give it time to close our pipe */
8792                 alarm(5);
8793                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8794                 alarm(0);
8795                 sprintf(string, "%d\n", ret);
8796                 write(3, string, strlen(string));
8797                 exit(0);
8798         }
8799
8800         close(pd[0]);                   /* We write to pd[1] */
8801         close(pu[1]);                   /* We read from pu[0] */
8802         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8803         close(pd[1]);                   /* Pipe pd is now fully closed! */
8804         exit(0);                                /* Bye bye, thank you for playing! */
8805 }
8806 EOCP
8807         set try
8808         if eval $compile_ok; then
8809                 echo "$startsh" >mtry
8810                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8811                 chmod +x mtry
8812                 ./mtry >/dev/null 2>&1
8813                 case $? in
8814                 0) eagain=`$cat try.out`;;
8815                 1) echo "Could not perform non-blocking setting!";;
8816                 2) echo "I did a successful read() for something that was not there!";;
8817                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8818                 *) echo "Something terribly wrong happened during testing.";;
8819                 esac
8820                 rd_nodata=`$cat try.ret`
8821                 echo "A read() system call with no data present returns $rd_nodata."
8822                 case "$rd_nodata" in
8823                 0|-1) ;;
8824                 *)
8825                         echo "(That's peculiar, fixing that to be -1.)"
8826                         rd_nodata=-1
8827                         ;;
8828                 esac
8829                 case "$eagain" in
8830                 '')
8831                         echo "Forcing errno EAGAIN on read() with no data available."
8832                         eagain=EAGAIN
8833                         ;;
8834                 *)
8835                         echo "Your read() sets errno to $eagain when no data is available."
8836                         ;;
8837                 esac
8838                 status=`$cat try.err`
8839                 case "$status" in
8840                 0) echo "And it correctly returns 0 to signal EOF.";;
8841                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8842                 *) echo "However, your read() returns '$status' on EOF??";;
8843                 esac
8844                 val="$define"
8845                 if test "$status" = "$rd_nodata"; then
8846                         echo "WARNING: you can't distinguish between EOF and no data!"
8847                         val="$undef"
8848                 fi
8849         else
8850                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8851                 eagain=EAGAIN
8852         fi
8853         set d_eofnblk
8854         eval $setvar
8855         ;;
8856 *)
8857         echo "Using $hint value $eagain."
8858         echo "Your read() returns $rd_nodata when no data is present."
8859         case "$d_eofnblk" in
8860         "$define") echo "And you can see EOF because read() returns 0.";;
8861         "$undef") echo "But you can't see EOF status from read() returned value.";;
8862         *)
8863                 echo "(Assuming you can't see EOF status from read anyway.)"
8864                 d_eofnblk=$undef
8865                 ;;
8866         esac
8867         ;;
8868 esac
8869 $rm -f try try.* .out core head.c mtry
8870
8871 : see if fchmod exists
8872 set fchmod d_fchmod
8873 eval $inlibc
8874
8875 : see if fchown exists
8876 set fchown d_fchown
8877 eval $inlibc
8878
8879 : see if this is an fcntl system
8880 set fcntl d_fcntl
8881 eval $inlibc
8882
8883 echo " "
8884 : See if fcntl-based locking works.
8885 $cat >try.c <<'EOCP'
8886 #include <stdlib.h>
8887 #include <unistd.h>
8888 #include <fcntl.h>
8889 int main() {
8890 #if defined(F_SETLK) && defined(F_SETLKW)
8891      struct flock flock;
8892      int retval, fd;
8893      fd = open("try.c", O_RDONLY);
8894      flock.l_type = F_RDLCK;
8895      flock.l_whence = SEEK_SET;
8896      flock.l_start = flock.l_len = 0;
8897      retval = fcntl(fd, F_SETLK, &flock);
8898      close(fd);
8899      (retval < 0 ? exit(2) : exit(0));
8900 #else
8901      exit(2);
8902 #endif
8903 }
8904 EOCP
8905 echo "Checking if fcntl-based file locking works... "
8906 case "$d_fcntl" in
8907 "$define")
8908         set try
8909         if eval $compile_ok; then
8910                 if ./try; then
8911                         echo "Yes, it seems to work."
8912                         val="$define"
8913                 else
8914                         echo "Nope, it didn't work."
8915                         val="$undef"
8916                 fi
8917         else
8918                 echo "I'm unable to compile the test program, so I'll assume not."
8919                 val="$undef"
8920         fi
8921         ;;
8922 *) val="$undef";
8923         echo "Nope, since you don't even have fcntl()."
8924         ;;
8925 esac
8926 set d_fcntl_can_lock
8927 eval $setvar
8928 $rm -f try*
8929
8930
8931 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8932 while $test $# -ge 2; do
8933         case "$1" in
8934         $define) echo "#include <$2>";;
8935         esac ;
8936     shift 2;
8937 done > try.c;
8938 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8939 set try;
8940 if eval $compile; then
8941         val="$define";
8942 else
8943         val="$undef";
8944 fi;
8945 set $varname;
8946 eval $setvar;
8947 $rm -f try.c try.o'
8948
8949 socketlib=''
8950 sockethdr=''
8951 : see whether socket exists
8952 echo " "
8953 $echo $n "Hmm... $c" >&4
8954 if set socket val -f d_socket; eval $csym; $val; then
8955         echo "Looks like you have Berkeley networking support." >&4
8956         d_socket="$define"
8957         if set setsockopt val -f; eval $csym; $val; then
8958                 d_oldsock="$undef"
8959         else
8960                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8961                 d_oldsock="$define"
8962         fi
8963 else
8964         if $contains socklib libc.list >/dev/null 2>&1; then
8965                 echo "Looks like you have Berkeley networking support." >&4
8966                 d_socket="$define"
8967                 : we will have to assume that it supports the 4.2 BSD interface
8968                 d_oldsock="$undef"
8969         else
8970                 echo "You don't have Berkeley networking in libc$_a..." >&4
8971                 if test "X$d_socket" = "X$define"; then
8972                    echo "...but you seem to believe that you have sockets." >&4
8973                 else
8974                         for net in net socket
8975                         do
8976                                 if test -f /usr/lib/lib$net$_a; then
8977                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8978                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8979                                         if $contains socket libc.list >/dev/null 2>&1; then
8980                                                 d_socket="$define"
8981                                                 socketlib="-l$net"
8982                                                 case "$net" in
8983                                                 net)
8984                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8985                                                         sockethdr="-I/usr/netinclude"
8986                                                         ;;
8987                                                 esac
8988                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8989                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8990                                                         d_oldsock="$undef"
8991                                                 else
8992                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8993                                                         d_oldsock="$define"
8994                                                 fi
8995                                                 break
8996                                         fi
8997                                 fi
8998                         done
8999                         if test "X$d_socket" != "X$define"; then
9000                            echo "or anywhere else I see." >&4
9001                            d_socket="$undef"
9002                            d_oldsock="$undef"
9003                         fi
9004                 fi
9005         fi
9006 fi
9007
9008 : see if socketpair exists
9009 set socketpair d_sockpair
9010 eval $inlibc
9011
9012
9013 echo " "
9014 echo "Checking the availability of certain socket constants..." >& 4
9015 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9016         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9017         $cat >try.c <<EOF
9018 #include <sys/types.h>
9019 #include <sys/socket.h>
9020 int main() {
9021     int i = $ENUM;
9022 }
9023 EOF
9024         val="$undef"
9025         set try; if eval $compile; then
9026                 val="$define"
9027         fi
9028         set d_${enum}; eval $setvar
9029         $rm -f try.c try
9030 done
9031
9032 : see if sys/select.h has to be included
9033 set sys/select.h i_sysselct
9034 eval $inhdr
9035
9036 : see if we should include time.h, sys/time.h, or both
9037 echo " "
9038 if test "X$timeincl" = X; then
9039         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9040         $echo $n "I'm now running the test program...$c"
9041         $cat >try.c <<'EOCP'
9042 #include <sys/types.h>
9043 #ifdef I_TIME
9044 #include <time.h>
9045 #endif
9046 #ifdef I_SYSTIME
9047 #ifdef SYSTIMEKERNEL
9048 #define KERNEL
9049 #endif
9050 #include <sys/time.h>
9051 #endif
9052 #ifdef I_SYSSELECT
9053 #include <sys/select.h>
9054 #endif
9055 int main()
9056 {
9057         struct tm foo;
9058 #ifdef S_TIMEVAL
9059         struct timeval bar;
9060 #endif
9061 #ifdef S_TIMEZONE
9062         struct timezone tzp;
9063 #endif
9064         if (foo.tm_sec == foo.tm_sec)
9065                 exit(0);
9066 #ifdef S_TIMEVAL
9067         if (bar.tv_sec == bar.tv_sec)
9068                 exit(0);
9069 #endif
9070         exit(1);
9071 }
9072 EOCP
9073         flags=''
9074         for s_timezone in '-DS_TIMEZONE' ''; do
9075         sysselect=''
9076         for s_timeval in '-DS_TIMEVAL' ''; do
9077         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9078         for i_time in '' '-DI_TIME'; do
9079         for i_systime in '-DI_SYSTIME' ''; do
9080                 case "$flags" in
9081                 '') $echo $n ".$c"
9082                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9083                         if eval $compile; then
9084                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9085                                 shift
9086                                 flags="$*"
9087                                 echo " "
9088                                 $echo $n "Succeeded with $flags$c"
9089                         fi
9090                         ;;
9091                 esac
9092         done
9093         done
9094         done
9095         done
9096         done
9097         timeincl=''
9098         echo " "
9099         case "$flags" in
9100         *SYSTIMEKERNEL*) i_systimek="$define"
9101                 timeincl=`./findhdr sys/time.h`
9102                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9103         *) i_systimek="$undef";;
9104         esac
9105         case "$flags" in
9106         *I_TIME*) i_time="$define"
9107                 timeincl=`./findhdr time.h`" $timeincl"
9108                 echo "We'll include <time.h>." >&4;;
9109         *) i_time="$undef";;
9110         esac
9111         case "$flags" in
9112         *I_SYSTIME*) i_systime="$define"
9113                 timeincl=`./findhdr sys/time.h`" $timeincl"
9114                 echo "We'll include <sys/time.h>." >&4;;
9115         *) i_systime="$undef";;
9116         esac
9117         $rm -f try.c try
9118 fi
9119
9120 : check for fd_set items
9121 $cat <<EOM
9122
9123 Checking to see how well your C compiler handles fd_set and friends ...
9124 EOM
9125 $cat >fd_set.c <<EOCP
9126 #$i_systime I_SYS_TIME
9127 #$i_sysselct I_SYS_SELECT
9128 #$d_socket HAS_SOCKET
9129 #include <sys/types.h>
9130 #ifdef HAS_SOCKET
9131 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9132 #endif
9133 #ifdef I_SYS_TIME
9134 #include <sys/time.h>
9135 #endif
9136 #ifdef I_SYS_SELECT
9137 #include <sys/select.h>
9138 #endif
9139 int main() {
9140         fd_set fds;
9141
9142 #ifdef TRYBITS
9143         if(fds.fds_bits);
9144 #endif
9145
9146 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9147         exit(0);
9148 #else
9149         exit(1);
9150 #endif
9151 }
9152 EOCP
9153 set fd_set -DTRYBITS
9154 if eval $compile; then
9155         d_fds_bits="$define"
9156         d_fd_set="$define"
9157         echo "Well, your system knows about the normal fd_set typedef..." >&4
9158         if ./fd_set; then
9159                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9160                 d_fd_macros="$define"
9161         else
9162                 $cat >&4 <<'EOM'
9163 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9164 EOM
9165                 d_fd_macros="$undef"
9166         fi
9167 else
9168         $cat <<'EOM'
9169 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9170 EOM
9171         set fd_set
9172         if eval $compile; then
9173                 d_fds_bits="$undef"
9174                 d_fd_set="$define"
9175                 echo "Well, your system has some sort of fd_set available..." >&4
9176                 if ./fd_set; then
9177                         echo "and you have the normal fd_set macros." >&4
9178                         d_fd_macros="$define"
9179                 else
9180                         $cat <<'EOM'
9181 but not the normal fd_set macros!  Gross!  More work for me...
9182 EOM
9183                         d_fd_macros="$undef"
9184                 fi
9185         else
9186         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9187                 d_fd_set="$undef"
9188                 d_fds_bits="$undef"
9189                 d_fd_macros="$undef"
9190         fi
9191 fi
9192 $rm -f fd_set*
9193
9194 : see if fgetpos exists
9195 set fgetpos d_fgetpos
9196 eval $inlibc
9197
9198 : see if flock exists
9199 set flock d_flock
9200 eval $inlibc
9201
9202 : see if fork exists
9203 set fork d_fork
9204 eval $inlibc
9205
9206 : see if pathconf exists
9207 set pathconf d_pathconf
9208 eval $inlibc
9209
9210 : see if fpathconf exists
9211 set fpathconf d_fpathconf
9212 eval $inlibc
9213
9214
9215 : check for fpos64_t
9216 echo " "
9217 echo "Checking to see if you have fpos64_t..." >&4
9218 $cat >try.c <<EOCP
9219 #include <stdio.h>
9220 int main() { fpos64_t x = 7; }
9221 EOCP
9222 set try
9223 if eval $compile; then
9224         val="$define"
9225         echo "You have fpos64_t."
9226 else
9227         val="$undef"
9228         echo "You do not have fpos64_t."
9229         case "$fpossize" in
9230         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9231         esac
9232 fi
9233 $rm -f try.* try
9234 set d_fpos64_t
9235 eval $setvar
9236
9237 : see if frexpl exists
9238 set frexpl d_frexpl
9239 eval $inlibc
9240
9241 hasstruct='varname=$1; struct=$2; shift; shift;
9242 while $test $# -ge 2; do
9243         case "$1" in
9244         $define) echo "#include <$2>";;
9245         esac ;
9246     shift 2;
9247 done > try.c;
9248 echo "int main () { struct $struct foo; }" >> try.c;
9249 set try;
9250 if eval $compile; then
9251         val="$define";
9252 else
9253         val="$undef";
9254 fi;
9255 set $varname;
9256 eval $setvar;
9257 $rm -f try.c try.o'
9258
9259 : see if this is a sys/param system
9260 set sys/param.h i_sysparam
9261 eval $inhdr
9262
9263 : see if this is a sys/mount.h system
9264 set sys/mount.h i_sysmount
9265 eval $inhdr
9266
9267 : see if sys/types.h has to be included
9268 set sys/types.h i_systypes
9269 eval $inhdr
9270
9271
9272 echo " "
9273 echo "Checking to see if your system supports struct fs_data..." >&4
9274 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9275 eval $hasstruct
9276 case "$d_fs_data_s" in
9277 "$define")      echo "Yes, it does."   ;;
9278 *)              echo "No, it doesn't." ;;
9279 esac
9280
9281 : see if fseeko exists
9282 set fseeko d_fseeko
9283 eval $inlibc
9284 case "$longsize" in
9285 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9286 esac
9287
9288 : see if fsetpos exists
9289 set fsetpos d_fsetpos
9290 eval $inlibc
9291
9292
9293 : see if fstatfs exists
9294 set fstatfs d_fstatfs
9295 eval $inlibc
9296
9297
9298 : see if statvfs exists
9299 set statvfs d_statvfs
9300 eval $inlibc
9301
9302 : see if fstatvfs exists
9303 set fstatvfs d_fstatvfs
9304 eval $inlibc
9305
9306
9307 : see if fsync exists
9308 set fsync d_fsync
9309 eval $inlibc
9310
9311 : see if ftello exists
9312 set ftello d_ftello
9313 eval $inlibc
9314 case "$longsize" in
9315 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9316 esac
9317
9318 : see if getcwd exists
9319 set getcwd d_getcwd
9320 eval $inlibc
9321
9322 : see if getespwnam exists
9323 set getespwnam d_getespwnam
9324 eval $inlibc
9325
9326
9327 : see if getfsstat exists
9328 set getfsstat d_getfsstat
9329 eval $inlibc
9330
9331 : see if getgrent exists
9332 set getgrent d_getgrent
9333 eval $inlibc
9334
9335 : see if gethostbyaddr exists
9336 set gethostbyaddr d_gethbyaddr
9337 eval $inlibc
9338
9339 : see if gethostbyname exists
9340 set gethostbyname d_gethbyname
9341 eval $inlibc
9342
9343 : see if gethostent exists
9344 set gethostent d_gethent
9345 eval $inlibc
9346
9347 : see how we will look up host name
9348 echo " "
9349 call=''
9350 if set gethostname val -f d_gethname; eval $csym; $val; then
9351         echo 'gethostname() found.' >&4
9352         d_gethname="$define"
9353         call=gethostname
9354 fi
9355 if set uname val -f d_uname; eval $csym; $val; then
9356         if ./xenix; then
9357                 $cat <<'EOM'
9358 uname() was found, but you're running xenix, and older versions of xenix
9359 have a broken uname(). If you don't really know whether your xenix is old
9360 enough to have a broken system call, use the default answer.
9361
9362 EOM
9363                 dflt=y
9364                 case "$d_uname" in
9365                 "$define") dflt=n;;
9366                 esac
9367                 rp='Is your uname() broken?'
9368                 . ./myread
9369                 case "$ans" in
9370                 n*) d_uname="$define"; call=uname;;
9371                 esac
9372         else
9373                 echo 'uname() found.' >&4
9374                 d_uname="$define"
9375                 case "$call" in
9376                 '') call=uname ;;
9377                 esac
9378         fi
9379 fi
9380 case "$d_gethname" in
9381 '') d_gethname="$undef";;
9382 esac
9383 case "$d_uname" in
9384 '') d_uname="$undef";;
9385 esac
9386 case "$d_uname$d_gethname" in
9387 *define*)
9388         dflt=n
9389         cat <<EOM
9390  
9391 Every now and then someone has a $call() that lies about the hostname
9392 but can't be fixed for political or economic reasons.  If you wish, I can
9393 pretend $call() isn't there and maybe compute hostname at run-time
9394 thanks to the '$phostname' command.
9395
9396 EOM
9397         rp="Shall I ignore $call() from now on?"
9398         . ./myread
9399         case "$ans" in
9400         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9401         esac;;
9402 esac
9403 case "$phostname" in
9404 '') aphostname='';;
9405 *) case "$aphostname" in
9406         /*) ;;
9407         *) set X $phostname
9408                 shift
9409                 file=$1
9410                 shift
9411                 file=`./loc $file $file $pth`
9412                 aphostname=`echo $file $*`
9413                 ;;
9414         esac
9415         ;;
9416 esac
9417 case "$d_uname$d_gethname" in
9418 *define*) ;;
9419 *)
9420         case "$phostname" in
9421         '')
9422                 echo "There will be no way for $package to get your hostname." >&4;;
9423         *)
9424         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9425                 ;;
9426         esac;;
9427 esac
9428 case "$d_phostname" in
9429 '') d_phostname="$undef";;
9430 esac
9431
9432 : see if this is a netdb.h system
9433 set netdb.h i_netdb
9434 eval $inhdr
9435
9436 : see if prototypes for various gethostxxx netdb.h functions are available
9437 echo " "
9438 set d_gethostprotos gethostent $i_netdb netdb.h
9439 eval $hasproto
9440
9441 : see if getlogin exists
9442 set getlogin d_getlogin
9443 eval $inlibc
9444
9445 : see if getmnt exists
9446 set getmnt d_getmnt
9447 eval $inlibc
9448
9449 : see if getmntent exists
9450 set getmntent d_getmntent
9451 eval $inlibc
9452
9453 : see if getnetbyaddr exists
9454 set getnetbyaddr d_getnbyaddr
9455 eval $inlibc
9456
9457 : see if getnetbyname exists
9458 set getnetbyname d_getnbyname
9459 eval $inlibc
9460
9461 : see if getnetent exists
9462 set getnetent d_getnent
9463 eval $inlibc
9464
9465 : see if prototypes for various getnetxxx netdb.h functions are available
9466 echo " "
9467 set d_getnetprotos getnetent $i_netdb netdb.h
9468 eval $hasproto
9469
9470 : see if getpagesize exists
9471 set getpagesize d_getpagsz
9472 eval $inlibc
9473
9474
9475 : see if getprotobyname exists
9476 set getprotobyname d_getpbyname
9477 eval $inlibc
9478
9479 : see if getprotobynumber exists
9480 set getprotobynumber d_getpbynumber
9481 eval $inlibc
9482
9483 : see if getprotoent exists
9484 set getprotoent d_getpent
9485 eval $inlibc
9486
9487 : see if getpgid exists
9488 set getpgid d_getpgid
9489 eval $inlibc
9490
9491 : see if getpgrp2 exists
9492 set getpgrp2 d_getpgrp2
9493 eval $inlibc
9494
9495 : see if getppid exists
9496 set getppid d_getppid
9497 eval $inlibc
9498
9499 : see if getpriority exists
9500 set getpriority d_getprior
9501 eval $inlibc
9502
9503 : see if prototypes for various getprotoxxx netdb.h functions are available
9504 echo " "
9505 set d_getprotoprotos getprotoent $i_netdb netdb.h
9506 eval $hasproto
9507
9508 : see if getprpwnam exists
9509 set getprpwnam d_getprpwnam
9510 eval $inlibc
9511
9512 : see if getpwent exists
9513 set getpwent d_getpwent
9514 eval $inlibc
9515
9516
9517 : see if getservbyname exists
9518 set getservbyname d_getsbyname
9519 eval $inlibc
9520
9521 : see if getservbyport exists
9522 set getservbyport d_getsbyport
9523 eval $inlibc
9524
9525 : see if getservent exists
9526 set getservent d_getsent
9527 eval $inlibc
9528
9529 : see if prototypes for various getservxxx netdb.h functions are available
9530 echo " "
9531 set d_getservprotos getservent $i_netdb netdb.h
9532 eval $hasproto
9533
9534 : see if getspnam exists
9535 set getspnam d_getspnam
9536 eval $inlibc
9537
9538 : see if gettimeofday or ftime exists
9539 set gettimeofday d_gettimeod
9540 eval $inlibc
9541 case "$d_gettimeod" in
9542 "$undef")
9543         set ftime d_ftime 
9544         eval $inlibc
9545         ;;
9546 *)
9547         val="$undef"; set d_ftime; eval $setvar
9548         ;;
9549 esac
9550 case "$d_gettimeod$d_ftime" in
9551 "$undef$undef")
9552         echo " "
9553         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9554         ;;
9555 esac
9556
9557 : see if this is an grp system
9558 set grp.h i_grp
9559 eval $inhdr
9560
9561 case "$i_grp" in
9562 $define)
9563         xxx=`./findhdr grp.h`
9564         $cppstdin $cppflags $cppminus < $xxx >$$.h
9565
9566         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9567                 val="$define"
9568         else
9569                 val="$undef"
9570         fi
9571         set d_grpasswd
9572         eval $setvar
9573
9574         $rm -f $$.h
9575         ;;
9576 *)
9577         val="$undef";
9578         set d_grpasswd; eval $setvar
9579         ;;
9580 esac
9581
9582 : see if hasmntopt exists
9583 set hasmntopt d_hasmntopt
9584 eval $inlibc
9585
9586 : see if this is a netinet/in.h or sys/in.h system
9587 set netinet/in.h i_niin sys/in.h i_sysin
9588 eval $inhdr
9589
9590 : see if arpa/inet.h has to be included
9591 set arpa/inet.h i_arpainet
9592 eval $inhdr
9593
9594 : see if htonl --and friends-- exists
9595 val=''
9596 set htonl val
9597 eval $inlibc
9598
9599 : Maybe they are macros.
9600 case "$val" in
9601 $undef)
9602         $cat >htonl.c <<EOM
9603 #include <stdio.h>
9604 #include <sys/types.h>
9605 #$i_niin I_NETINET_IN
9606 #$i_sysin I_SYS_IN
9607 #$i_arpainet I_ARPA_INET
9608 #ifdef I_NETINET_IN
9609 #include <netinet/in.h>
9610 #endif
9611 #ifdef I_SYS_IN
9612 #include <sys/in.h>
9613 #endif
9614 #ifdef I_ARPA_INET
9615 #include <arpa/inet.h>
9616 #endif
9617 #ifdef htonl
9618 printf("Defined as a macro.");
9619 #endif
9620 EOM
9621         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9622         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9623                 val="$define"
9624                 echo "But it seems to be defined as a macro." >&4
9625         fi
9626         $rm -f htonl.?
9627         ;;
9628 esac
9629 set d_htonl
9630 eval $setvar
9631
9632 : see if iconv exists
9633 set iconv d_iconv
9634 eval $inlibc
9635
9636 : index or strchr
9637 echo " "
9638 if set index val -f; eval $csym; $val; then
9639         if set strchr val -f d_strchr; eval $csym; $val; then
9640                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9641                         val="$define"
9642                         vali="$undef"
9643                         echo "strchr() found." >&4
9644                 else
9645                         val="$undef"
9646                         vali="$define"
9647                         echo "index() found." >&4
9648                 fi
9649         else
9650                 val="$undef"
9651                 vali="$define"
9652                 echo "index() found." >&4
9653         fi
9654 else
9655         if set strchr val -f d_strchr; eval $csym; $val; then
9656                 val="$define"
9657                 vali="$undef"
9658                 echo "strchr() found." >&4
9659         else
9660                 echo "No index() or strchr() found!" >&4
9661                 val="$undef"
9662                 vali="$undef"
9663         fi
9664 fi
9665 set d_strchr; eval $setvar
9666 val="$vali"
9667 set d_index; eval $setvar
9668
9669 : check whether inet_aton exists
9670 set inet_aton d_inetaton
9671 eval $inlibc
9672
9673 : see if inttypes.h is available
9674 : we want a real compile instead of Inhdr because some systems
9675 : have an inttypes.h which includes non-existent headers
9676 echo " "
9677 $cat >try.c <<EOCP
9678 #include <inttypes.h>
9679 int main() {
9680         static int32_t foo32 = 0x12345678;
9681 }
9682 EOCP
9683 set try
9684 if eval $compile; then
9685         echo "<inttypes.h> found." >&4
9686         val="$define"
9687 else
9688         echo "<inttypes.h> NOT found." >&4
9689         val="$undef"
9690 fi
9691 $rm -f try.c try
9692 set i_inttypes
9693 eval $setvar
9694
9695 : check for int64_t
9696 echo " "
9697 echo "Checking to see if you have int64_t..." >&4
9698 $cat >try.c <<EOCP
9699 #include <sys/types.h>
9700 #$i_inttypes I_INTTYPES
9701 #ifdef I_INTTYPES
9702 #include <inttypes.h>
9703 #endif
9704 int main() { int64_t x = 7; }
9705 EOCP
9706 set try
9707 if eval $compile; then
9708         val="$define"
9709         echo "You have int64_t."
9710 else
9711         val="$undef"
9712         echo "You do not have int64_t."
9713 fi
9714 $rm -f try try.*
9715 set d_int64_t
9716 eval $setvar
9717
9718 : Look for isascii
9719 echo " "
9720 $cat >isascii.c <<'EOCP'
9721 #include <stdio.h>
9722 #include <ctype.h>
9723 int main() {
9724         int c = 'A';
9725         if (isascii(c))
9726                 exit(0);
9727         else
9728                 exit(1);
9729 }
9730 EOCP
9731 set isascii
9732 if eval $compile; then
9733         echo "isascii() found." >&4
9734         val="$define"
9735 else
9736         echo "isascii() NOT found." >&4
9737         val="$undef"
9738 fi
9739 set d_isascii
9740 eval $setvar
9741 $rm -f isascii*
9742
9743 : see if isnan exists
9744 set isnan d_isnan
9745 eval $inlibc
9746
9747 : see if isnanl exists
9748 set isnanl d_isnanl
9749 eval $inlibc
9750
9751 : see if killpg exists
9752 set killpg d_killpg
9753 eval $inlibc
9754
9755 : see if lchown exists
9756 echo " "
9757 $cat > try.c <<'EOCP'
9758 /* System header to define __stub macros and hopefully few prototypes,
9759     which can conflict with char lchown(); below.  */
9760 #include <assert.h>
9761 /* Override any gcc2 internal prototype to avoid an error.  */
9762 /* We use char because int might match the return type of a gcc2
9763    builtin and then its argument prototype would still apply.  */
9764 char lchown();
9765 int main() {
9766     /*  The GNU C library defines this for functions which it implements
9767         to always fail with ENOSYS.  Some functions are actually named
9768         something starting with __ and the normal name is an alias.  */
9769 #if defined (__stub_lchown) || defined (__stub___lchown)
9770 choke me
9771 #else
9772 lchown();
9773 #endif
9774 ; return 0; }
9775 EOCP
9776 set try
9777 if eval $compile; then
9778     $echo "lchown() found." >&4
9779     val="$define"
9780 else
9781     $echo "lchown() NOT found." >&4
9782     val="$undef"
9783 fi
9784 set d_lchown
9785 eval $setvar
9786
9787 : See if number of significant digits in a double precision number is known
9788 echo " "
9789 $cat >ldbl_dig.c <<EOM
9790 #$i_limits I_LIMITS
9791 #$i_float I_FLOAT
9792 #ifdef I_LIMITS
9793 #include <limits.h>
9794 #endif
9795 #ifdef I_FLOAT
9796 #include <float.h>
9797 #endif
9798 #ifdef LDBL_DIG
9799 printf("Contains LDBL_DIG");
9800 #endif
9801 EOM
9802 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9803 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9804         echo "LDBL_DIG found." >&4
9805         val="$define"
9806 else
9807         echo "LDBL_DIG NOT found." >&4
9808         val="$undef"
9809 fi
9810 $rm -f ldbl_dig.?
9811 set d_ldbl_dig
9812 eval $setvar
9813
9814 : see if link exists
9815 set link d_link
9816 eval $inlibc
9817
9818 : see if localeconv exists
9819 set localeconv d_locconv
9820 eval $inlibc
9821
9822 : see if lockf exists
9823 set lockf d_lockf
9824 eval $inlibc
9825
9826 : check for long long
9827 echo " "
9828 echo "Checking to see if you have long long..." >&4
9829 echo 'int main() { long long x = 7; return 0; }' > try.c
9830 set try
9831 if eval $compile; then
9832         val="$define"
9833         echo "You have long long."
9834 else
9835         val="$undef"
9836         echo "You do not have long long."
9837 fi
9838 $rm try.*
9839 set d_longlong
9840 eval $setvar
9841
9842 : check for length of long long
9843 case "${d_longlong}${longlongsize}" in
9844 $define)
9845         echo " "
9846         echo "Checking to see how big your long longs are..." >&4
9847         $cat >try.c <<'EOCP'
9848 #include <stdio.h>
9849 int main()
9850 {
9851     printf("%d\n", (int)sizeof(long long));
9852     return(0);
9853 }
9854 EOCP
9855         set try
9856         if eval $compile_ok; then
9857                 longlongsize=`./try$exe_ext`
9858                 echo "Your long longs are $longlongsize bytes long."
9859         else
9860                 dflt='8'
9861                 echo " "
9862                 echo "(I can't seem to compile the test program.  Guessing...)"
9863                 rp="What is the size of a long long (in bytes)?"
9864                 . ./myread
9865                 longlongsize="$ans"
9866         fi
9867         if $test "X$longsize" = "X$longlongsize"; then
9868                 echo "(That isn't any different from an ordinary long.)"
9869         fi      
9870         ;;
9871 esac
9872 $rm -f try.* try
9873
9874 : see if prototype for lseek is available
9875 echo " "
9876 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9877 eval $hasproto
9878
9879 : see if lstat exists
9880 set lstat d_lstat
9881 eval $inlibc
9882
9883 : see if madvise exists
9884 set madvise d_madvise
9885 eval $inlibc
9886
9887 : see if mblen exists
9888 set mblen d_mblen
9889 eval $inlibc
9890
9891 : see if mbstowcs exists
9892 set mbstowcs d_mbstowcs
9893 eval $inlibc
9894
9895 : see if mbtowc exists
9896 set mbtowc d_mbtowc
9897 eval $inlibc
9898
9899 : see if memchr exists
9900 set memchr d_memchr
9901 eval $inlibc
9902
9903 : see if memcmp exists
9904 set memcmp d_memcmp
9905 eval $inlibc
9906
9907 : see if memcpy exists
9908 set memcpy d_memcpy
9909 eval $inlibc
9910
9911 : see if memmove exists
9912 set memmove d_memmove
9913 eval $inlibc
9914
9915 : see if memset exists
9916 set memset d_memset
9917 eval $inlibc
9918
9919 : see if mkdir exists
9920 set mkdir d_mkdir
9921 eval $inlibc
9922
9923 : see if mkdtemp exists
9924 set mkdtemp d_mkdtemp
9925 eval $inlibc
9926
9927 : see if mkfifo exists
9928 set mkfifo d_mkfifo
9929 eval $inlibc
9930
9931 : see if mkstemp exists
9932 set mkstemp d_mkstemp
9933 eval $inlibc
9934
9935 : see if mkstemps exists
9936 set mkstemps d_mkstemps
9937 eval $inlibc
9938
9939 : see if mktime exists
9940 set mktime d_mktime
9941 eval $inlibc
9942
9943 : see if this is a sys/mman.h system
9944 set sys/mman.h i_sysmman
9945 eval $inhdr
9946
9947 : see if mmap exists
9948 set mmap d_mmap
9949 eval $inlibc
9950 : see what shmat returns
9951 : default to something harmless
9952 mmaptype='void *'
9953 case "$i_sysmman$d_mmap" in
9954 "$define$define")
9955         $cat >mmap.c <<'END'
9956 #include <sys/mman.h>
9957 void *mmap();
9958 END
9959         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9960                 mmaptype='void *'
9961         else
9962                 mmaptype='caddr_t'
9963         fi
9964         echo "and it returns ($mmaptype)." >&4
9965         ;;
9966 esac
9967
9968
9969
9970 : see if modfl exists
9971 set modfl d_modfl
9972 eval $inlibc
9973
9974 : see if mprotect exists
9975 set mprotect d_mprotect
9976 eval $inlibc
9977
9978 : see if msgctl exists
9979 set msgctl d_msgctl
9980 eval $inlibc
9981
9982 : see if msgget exists
9983 set msgget d_msgget
9984 eval $inlibc
9985
9986 : see if msgsnd exists
9987 set msgsnd d_msgsnd
9988 eval $inlibc
9989
9990 : see if msgrcv exists
9991 set msgrcv d_msgrcv
9992 eval $inlibc
9993
9994 : see how much of the 'msg*(2)' library is present.
9995 h_msg=true
9996 echo " "
9997 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9998 *"$undef"*) h_msg=false;;
9999 esac
10000 case "$osname" in
10001 freebsd)
10002     case "`ipcs 2>&1`" in
10003     "SVID messages"*"not configured"*)
10004         echo "Your $osname does not have the msg*(2) configured." >&4
10005         h_msg=false
10006         val="$undef"
10007         set msgctl d_msgctl
10008         eval $setvar
10009         set msgget d_msgget
10010         eval $setvar
10011         set msgsnd d_msgsnd
10012         eval $setvar
10013         set msgrcv d_msgrcv
10014         eval $setvar
10015         ;;
10016     esac
10017     ;;
10018 esac
10019 : we could also check for sys/ipc.h ...
10020 if $h_msg && $test `./findhdr sys/msg.h`; then
10021         echo "You have the full msg*(2) library." >&4
10022         val="$define"
10023 else
10024         echo "You don't have the full msg*(2) library." >&4
10025         val="$undef"
10026 fi
10027 set d_msg
10028 eval $setvar
10029
10030 : see if msync exists
10031 set msync d_msync
10032 eval $inlibc
10033
10034 : see if munmap exists
10035 set munmap d_munmap
10036 eval $inlibc
10037
10038 : see if nice exists
10039 set nice d_nice
10040 eval $inlibc
10041
10042
10043 echo " "
10044 echo "Checking which 64-bit integer type we could use..." >&4
10045
10046 case "$intsize" in
10047 8) val=int
10048    set quadtype
10049    eval $setvar
10050    val='"unsigned int"'
10051    set uquadtype
10052    eval $setvar
10053    quadkind=1
10054    ;;
10055 *) case "$longsize" in
10056    8) val=long
10057       set quadtype
10058       eval $setvar
10059       val='"unsigned long"'
10060       set uquadtype
10061       eval $setvar
10062       quadkind=2
10063       ;;
10064    *) case "$d_longlong:$longlongsize" in
10065       define:8)
10066         val='"long long"'
10067         set quadtype
10068         eval $setvar
10069         val='"unsigned long long"'
10070         set uquadtype
10071         eval $setvar
10072         quadkind=3
10073         ;;
10074       *) case "$d_int64_t" in
10075          define)
10076            val=int64_t
10077            set quadtype
10078            eval $setvar
10079            val=uint64_t
10080            set uquadtype
10081            eval $setvar
10082            quadkind=4
10083            ;;
10084          esac
10085          ;;
10086       esac
10087       ;;
10088    esac
10089    ;;
10090 esac
10091
10092 case "$quadtype" in
10093 '')     echo "Alas, no 64-bit integer types in sight." >&4
10094         d_quad="$undef"
10095         ;;
10096 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10097             verb="will"
10098         else
10099             verb="could"
10100         fi
10101         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10102         d_quad="$define"
10103         ;;
10104 esac
10105
10106 : check for length of character
10107 echo " "
10108 case "$charsize" in
10109 '')
10110         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10111         $cat >try.c <<'EOCP'
10112 #include <stdio.h>
10113 int main()
10114 {
10115     printf("%d\n", (int)sizeof(char));
10116     exit(0);
10117 }
10118 EOCP
10119         set try
10120         if eval $compile_ok; then
10121                 dflt=`./try`
10122         else
10123                 dflt='1'
10124                 echo "(I can't seem to compile the test program.  Guessing...)"
10125         fi
10126         ;;
10127 *)
10128         dflt="$charsize"
10129         ;;
10130 esac
10131 rp="What is the size of a character (in bytes)?"
10132 . ./myread
10133 charsize="$ans"
10134 $rm -f try.c try
10135
10136 : check for volatile keyword
10137 echo " "
10138 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10139 $cat >try.c <<'EOCP'
10140 int main()
10141 {
10142         typedef struct _goo_struct goo_struct;
10143         goo_struct * volatile goo = ((goo_struct *)0);
10144         struct _goo_struct {
10145                 long long_int;
10146                 int reg_int;
10147                 char char_var;
10148         };
10149         typedef unsigned short foo_t;
10150         char *volatile foo;
10151         volatile int bar;
10152         volatile foo_t blech;
10153         foo = foo;
10154 }
10155 EOCP
10156 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10157         val="$define"
10158         echo "Yup, it does."
10159 else
10160         val="$undef"
10161         echo "Nope, it doesn't."
10162 fi
10163 set d_volatile
10164 eval $setvar
10165 $rm -f try.*
10166
10167
10168 echo " "
10169 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10170
10171 case "$use64bitint:$d_quad:$quadtype" in
10172 define:define:?*)
10173         ivtype="$quadtype"
10174         uvtype="$uquadtype"
10175         ivsize=8
10176         uvsize=8
10177         ;;
10178 *)      ivtype="long"
10179         uvtype="unsigned long"
10180         ivsize=$longsize
10181         uvsize=$longsize
10182         ;;
10183 esac
10184
10185 case "$uselongdouble:$d_longdbl" in
10186 define:define)
10187         nvtype="long double"
10188         nvsize=$longdblsize
10189         ;;
10190 *)      nvtype=double
10191         nvsize=$doublesize
10192         ;;
10193 esac
10194
10195 $echo "(IV will be "$ivtype", $ivsize bytes)"
10196 $echo "(UV will be "$uvtype", $uvsize bytes)"
10197 $echo "(NV will be "$nvtype", $nvsize bytes)"
10198
10199 $cat >try.c <<EOCP
10200 #$i_inttypes I_INTTYPES
10201 #ifdef I_INTTYPES
10202 #include <inttypes.h>
10203 #endif
10204 #include <stdio.h>
10205 int main() {
10206 #ifdef INT8
10207    int8_t i =  INT8_MAX;
10208   uint8_t u = UINT8_MAX;
10209   printf("int8_t\n");
10210 #endif
10211 #ifdef INT16
10212    int16_t i =  INT16_MAX;
10213   uint16_t i = UINT16_MAX;
10214   printf("int16_t\n");
10215 #endif
10216 #ifdef INT32
10217    int32_t i =  INT32_MAX;
10218   uint32_t u = UINT32_MAX;
10219   printf("int32_t\n");
10220 #endif
10221 }
10222 EOCP
10223
10224 case "$i8type" in
10225 '')     case "$charsize" in
10226         1)      i8type=char
10227                 u8type="unsigned char"
10228                 i8size=$charsize
10229                 u8size=$charsize
10230                 ;;
10231         esac
10232         ;;
10233 esac
10234 case "$i8type" in
10235 '')     set try -DINT8
10236         if eval $compile; then
10237                 case "`./try$exe_ext`" in
10238                 int8_t) i8type=int8_t
10239                         u8type=uint8_t
10240                         i8size=1
10241                         u8size=1
10242                         ;;
10243                 esac
10244         fi
10245         ;;
10246 esac
10247 case "$i8type" in
10248 '')     if $test $charsize -ge 1; then
10249                 i8type=char
10250                 u8type="unsigned char"
10251                 i8size=$charsize
10252                 u8size=$charsize
10253         fi
10254         ;;
10255 esac
10256
10257 case "$i16type" in
10258 '')     case "$shortsize" in
10259         2)      i16type=short
10260                 u16type="unsigned short"
10261                 i16size=$shortsize
10262                 u16size=$shortsize
10263                 ;;
10264         esac
10265         ;;
10266 esac
10267 case "$i16type" in
10268 '')     set try -DINT16
10269         if eval $compile; then
10270                 case "`./try$exe_ext`" in
10271                 int16_t)
10272                         i16type=int16_t
10273                         u16type=uint16_t
10274                         i16size=2
10275                         u16size=2
10276                         ;;
10277                 esac
10278         fi
10279         ;;
10280 esac
10281 case "$i16type" in
10282 '')     if $test $shortsize -ge 2; then
10283                 i16type=short
10284                 u16type="unsigned short"
10285                 i16size=$shortsize
10286                 u16size=$shortsize
10287         fi
10288         ;;
10289 esac
10290
10291 case "$i32type" in
10292 '')     case "$longsize" in
10293         4)      i32type=long
10294                 u32type="unsigned long"
10295                 i32size=$longsize
10296                 u32size=$longsize
10297                 ;;
10298         *)      case "$intsize" in
10299                 4)      i32type=int
10300                         u32type="unsigned int"
10301                         i32size=$intsize
10302                         u32size=$intsize
10303                         ;;
10304                 esac
10305                 ;;
10306         esac
10307         ;;
10308 esac
10309 case "$i32type" in
10310 '')     set try -DINT32
10311         if eval $compile; then
10312                 case "`./try$exe_ext`" in
10313                 int32_t)
10314                         i32type=int32_t
10315                         u32type=uint32_t
10316                         i32size=4
10317                         u32size=4
10318                         ;;
10319                 esac
10320         fi
10321         ;;
10322 esac
10323 case "$i32type" in
10324 '')     if $test $intsize -ge 4; then
10325                 i32type=int
10326                 u32type="unsigned int"
10327                 i32size=$intsize
10328                 u32size=$intsize
10329         fi
10330         ;;
10331 esac
10332
10333 case "$i64type" in
10334 '')     case "$d_quad:$quadtype" in
10335         define:?*)
10336                 i64type="$quadtype"
10337                 u64type="$uquadtype"
10338                 i64size=8
10339                 u64size=8
10340                 ;;
10341         esac
10342         ;;
10343 esac
10344
10345 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10346 : volatile so that the compiler has to store it out to memory.
10347 if test X"$d_volatile" = X"$define"; then
10348         volatile=volatile
10349 fi
10350 $cat <<EOP >try.c
10351 #include <stdio.h>
10352 #include <sys/types.h>
10353 #include <signal.h>
10354 #ifdef SIGFPE
10355 $volatile int bletched = 0;
10356 $signal_t blech(s) int s; { bletched = 1; }
10357 #endif
10358 int main() {
10359     $uvtype u = 0;
10360     $nvtype d;
10361     int     n = 8 * $uvsize;
10362     int     i;
10363 #ifdef SIGFPE
10364     signal(SIGFPE, blech);
10365 #endif
10366
10367     for (i = 0; i < n; i++) {
10368       u = u << 1 | ($uvtype)1;
10369       d = ($nvtype)u;
10370       if (($uvtype)d != u)
10371         break;
10372       if (d <= 0)
10373         break;
10374       d = ($nvtype)(u - 1);
10375       if (($uvtype)d != (u - 1))
10376         break;
10377 #ifdef SIGFPE
10378       if (bletched) {
10379         break;
10380 #endif
10381       } 
10382     }
10383     printf("%d\n", ((i == n) ? -n : i));
10384     exit(0);
10385 }
10386 EOP
10387 set try
10388
10389 d_nv_preserves_uv="$undef"
10390 if eval $compile; then
10391         d_nv_preserves_uv_bits="`./try$exe_ext`"
10392 fi
10393 case "$d_nv_preserves_uv_bits" in
10394 \-[1-9]*)       
10395         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10396         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10397         d_nv_preserves_uv="$define"
10398         ;;
10399 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10400         d_nv_preserves_uv="$undef" ;;
10401 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10402         d_nv_preserves_uv_bits="$undef" ;;
10403 esac
10404
10405 $rm -f try.* try
10406
10407
10408 : check for off64_t
10409 echo " "
10410 echo "Checking to see if you have off64_t..." >&4
10411 $cat >try.c <<EOCP
10412 #include <sys/types.h>
10413 #include <unistd.h>
10414 int main() { off64_t x = 7; }
10415 EOCP
10416 set try
10417 if eval $compile; then
10418         val="$define"
10419         echo "You have off64_t."
10420 else
10421         val="$undef"
10422         echo "You do not have off64_t."
10423         case "$lseeksize" in
10424         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10425         esac
10426 fi
10427 $rm -f try.* try
10428 set d_off64_t
10429 eval $setvar
10430
10431 : see if POSIX threads are available
10432 set pthread.h i_pthread
10433 eval $inhdr
10434
10435
10436
10437
10438 : how to create joinable pthreads
10439 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10440         echo " "
10441         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10442         $cat >try.c <<'EOCP'
10443 #include <pthread.h>
10444 int main() {
10445     int detachstate = JOINABLE;
10446 }
10447 EOCP
10448         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10449         if eval $compile; then
10450                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10451                 val="$undef" # Yes, undef.
10452                 set d_old_pthread_create_joinable
10453                 eval $setvar
10454                 val=""
10455                 set old_pthread_create_joinable
10456                 eval $setvar
10457         else
10458                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10459                 if eval $compile; then
10460                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10461                         val="$define"
10462                         set d_old_pthread_create_joinable
10463                         eval $setvar
10464                         val=PTHREAD_CREATE_UNDETACHED
10465                         set old_pthread_create_joinable
10466                         eval $setvar
10467                 else            
10468                         set try -DJOINABLE=__UNDETACHED
10469                         if eval $compile; then
10470                                 echo "You seem to use __UNDETACHED." >&4
10471                                 val="$define"
10472                                 set d_old_pthread_create_joinable
10473                                 eval $setvar
10474                                 val=__UNDETACHED
10475                                 set old_pthread_create_joinable
10476                                 eval $setvar
10477                         else
10478                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10479                                 val="$define"
10480                                 set d_old_pthread_create_joinable
10481                                 eval $setvar
10482                                 val=0
10483                                 set old_pthread_create_joinable
10484                                 eval $setvar
10485                         fi
10486                 fi
10487         fi
10488         $rm -f try try.*
10489 else
10490     d_old_pthread_create_joinable="$undef"
10491     old_pthread_create_joinable=""
10492 fi
10493
10494 : see if pause exists
10495 set pause d_pause
10496 eval $inlibc
10497
10498 : see if pipe exists
10499 set pipe d_pipe
10500 eval $inlibc
10501
10502 : see if poll exists
10503 set poll d_poll
10504 eval $inlibc
10505
10506
10507 : see whether the various POSIXish _yields exist
10508 $cat >try.c <<EOP
10509 #include <pthread.h>
10510 #include <stdio.h>
10511 int main() {
10512 #ifdef SCHED_YIELD
10513         sched_yield();
10514 #else
10515 #ifdef PTHREAD_YIELD
10516         pthread_yield();
10517 #else
10518 #ifdef PTHREAD_YIELD_NULL
10519         pthread_yield(NULL);
10520 #endif
10521 #endif
10522 #endif
10523 }
10524 EOP
10525 : see if sched_yield exists
10526 set try -DSCHED_YIELD
10527 if eval $compile; then
10528     val="$define"
10529     sched_yield='sched_yield()'
10530 else
10531     val="$undef"
10532 fi
10533 case "$usethreads" in
10534 $define)
10535         case "$val" in
10536         $define) echo 'sched_yield() found.' >&4        ;;
10537         *)       echo 'sched_yield() NOT found.' >&4    ;;
10538         esac
10539 esac
10540 set d_sched_yield
10541 eval $setvar
10542
10543 : see if pthread_yield exists
10544 set try -DPTHREAD_YIELD
10545 if eval $compile; then
10546     val="$define"
10547     case "$sched_yield" in
10548     '') sched_yield='pthread_yield()' ;;
10549     esac
10550 else
10551     set try -DPTHREAD_YIELD_NULL
10552     if eval $compile; then
10553         val="$define"
10554         case "$sched_yield" in
10555         '') sched_yield='pthread_yield(NULL)' ;;
10556         esac
10557     else
10558         val="$undef"
10559     fi
10560 fi
10561 case "$usethreads" in
10562 $define)
10563         case "$val" in
10564         $define) echo 'pthread_yield() found.' >&4      ;;
10565         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10566         esac
10567         ;;
10568 esac
10569 set d_pthread_yield
10570 eval $setvar
10571
10572 case "$sched_yield" in
10573 '') sched_yield=undef ;;
10574 esac
10575
10576 $rm -f try try.*
10577
10578 : see if this is a pwd.h system
10579 set pwd.h i_pwd
10580 eval $inhdr
10581
10582 case "$i_pwd" in
10583 $define)
10584         xxx=`./findhdr pwd.h`
10585         $cppstdin $cppflags $cppminus < $xxx >$$.h
10586
10587         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10588                 val="$define"
10589         else
10590                 val="$undef"
10591         fi
10592         set d_pwquota
10593         eval $setvar
10594
10595         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10596                 val="$define"
10597         else
10598                 val="$undef"
10599         fi
10600         set d_pwage
10601         eval $setvar
10602
10603         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10604                 val="$define"
10605         else
10606                 val="$undef"
10607         fi
10608         set d_pwchange
10609         eval $setvar
10610
10611         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10612                 val="$define"
10613         else
10614                 val="$undef"
10615         fi
10616         set d_pwclass
10617         eval $setvar
10618
10619         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10620                 val="$define"
10621         else
10622                 val="$undef"
10623         fi
10624         set d_pwexpire
10625         eval $setvar
10626
10627         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10628                 val="$define"
10629         else
10630                 val="$undef"
10631         fi
10632         set d_pwcomment
10633         eval $setvar
10634
10635         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10636                 val="$define"
10637         else
10638                 val="$undef"
10639         fi
10640         set d_pwgecos
10641         eval $setvar
10642
10643         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10644                 val="$define"
10645         else
10646                 val="$undef"
10647         fi
10648         set d_pwpasswd
10649         eval $setvar
10650
10651         $rm -f $$.h
10652         ;;
10653 *)
10654         val="$undef"; 
10655         set d_pwquota; eval $setvar
10656         set d_pwage; eval $setvar
10657         set d_pwchange; eval $setvar
10658         set d_pwclass; eval $setvar
10659         set d_pwexpire; eval $setvar
10660         set d_pwcomment; eval $setvar
10661         set d_pwgecos; eval $setvar
10662         set d_pwpasswd; eval $setvar
10663         ;;
10664 esac
10665
10666 : see if readdir and friends exist
10667 set readdir d_readdir
10668 eval $inlibc
10669 set seekdir d_seekdir
10670 eval $inlibc
10671 set telldir d_telldir
10672 eval $inlibc
10673 set rewinddir d_rewinddir
10674 eval $inlibc
10675
10676 : see if readlink exists
10677 set readlink d_readlink
10678 eval $inlibc
10679
10680 : see if rename exists
10681 set rename d_rename
10682 eval $inlibc
10683
10684 : see if rmdir exists
10685 set rmdir d_rmdir
10686 eval $inlibc
10687
10688 : see if memory.h is available.
10689 val=''
10690 set memory.h val
10691 eval $inhdr
10692
10693 : See if it conflicts with string.h
10694 case "$val" in
10695 $define)
10696         case "$strings" in
10697         '') ;;
10698         *)
10699                 $cppstdin $cppflags $cppminus < $strings > mem.h
10700                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10701                         echo " "
10702                         echo "We won't be including <memory.h>."
10703                         val="$undef"
10704                 fi
10705                 $rm -f mem.h
10706                 ;;
10707         esac
10708 esac
10709 set i_memory
10710 eval $setvar
10711
10712 : can bcopy handle overlapping blocks?
10713 val="$undef"
10714 case "$d_bcopy" in
10715 "$define")
10716         echo " "
10717         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10718         $cat >try.c <<EOCP
10719 #$i_memory I_MEMORY
10720 #$i_stdlib I_STDLIB
10721 #$i_string I_STRING
10722 #$i_unistd I_UNISTD
10723 EOCP
10724         $cat >>try.c <<'EOCP'
10725 #include <stdio.h>
10726 #ifdef I_MEMORY
10727 #  include <memory.h>
10728 #endif
10729 #ifdef I_STDLIB
10730 #  include <stdlib.h>
10731 #endif
10732 #ifdef I_STRING
10733 #  include <string.h>
10734 #else
10735 #  include <strings.h>
10736 #endif
10737 #ifdef I_UNISTD
10738 #  include <unistd.h>  /* Needed for NetBSD */
10739 #endif
10740 int main()
10741 {
10742 char buf[128], abc[128];
10743 char *b;
10744 int len;
10745 int off;
10746 int align;
10747
10748 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10749
10750 for (align = 7; align >= 0; align--) {
10751         for (len = 36; len; len--) {
10752                 b = buf+align;
10753                 bcopy(abc, b, len);
10754                 for (off = 1; off <= len; off++) {
10755                         bcopy(b, b+off, len);
10756                         bcopy(b+off, b, len);
10757                         if (bcmp(b, abc, len))
10758                                 exit(1);
10759                 }
10760         }
10761 }
10762 exit(0);
10763 }
10764 EOCP
10765         set try
10766         if eval $compile_ok; then
10767                 if ./try 2>/dev/null; then
10768                         echo "Yes, it can."
10769                         val="$define"
10770                 else
10771                         echo "It can't, sorry."
10772                         case "$d_memmove" in
10773                         "$define") echo "But that's Ok since you have memmove()." ;;
10774                         esac
10775                 fi
10776         else
10777                 echo "(I can't compile the test program, so we'll assume not...)"
10778                 case "$d_memmove" in
10779                 "$define") echo "But that's Ok since you have memmove()." ;;
10780                 esac
10781         fi
10782         ;;
10783 esac
10784 $rm -f try.* try core
10785 set d_safebcpy
10786 eval $setvar
10787
10788 : can memcpy handle overlapping blocks?
10789 val="$undef"
10790 case "$d_memcpy" in
10791 "$define")
10792         echo " "
10793         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10794         $cat >try.c <<EOCP
10795 #$i_memory I_MEMORY
10796 #$i_stdlib I_STDLIB
10797 #$i_string I_STRING
10798 #$i_unistd I_UNISTD
10799 EOCP
10800         $cat >>try.c <<'EOCP'
10801 #include <stdio.h>
10802 #ifdef I_MEMORY
10803 #  include <memory.h>
10804 #endif
10805 #ifdef I_STDLIB
10806 #  include <stdlib.h>
10807 #endif
10808 #ifdef I_STRING
10809 #  include <string.h>
10810 #else
10811 #  include <strings.h>
10812 #endif
10813 #ifdef I_UNISTD
10814 #  include <unistd.h>  /* Needed for NetBSD */
10815 #endif
10816 int main()
10817 {
10818 char buf[128], abc[128];
10819 char *b;
10820 int len;
10821 int off;
10822 int align;
10823
10824 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10825    try to store the string in read-only memory. */
10826 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10827
10828 for (align = 7; align >= 0; align--) {
10829         for (len = 36; len; len--) {
10830                 b = buf+align;
10831                 memcpy(b, abc, len);
10832                 for (off = 1; off <= len; off++) {
10833                         memcpy(b+off, b, len);
10834                         memcpy(b, b+off, len);
10835                         if (memcmp(b, abc, len))
10836                                 exit(1);
10837                 }
10838         }
10839 }
10840 exit(0);
10841 }
10842 EOCP
10843         set try
10844         if eval $compile_ok; then
10845                 if ./try 2>/dev/null; then
10846                         echo "Yes, it can."
10847                         val="$define"
10848                 else
10849                         echo "It can't, sorry."
10850                         case "$d_memmove" in
10851                         "$define") echo "But that's Ok since you have memmove()." ;;
10852                         esac
10853                 fi
10854         else
10855                 echo "(I can't compile the test program, so we'll assume not...)"
10856                 case "$d_memmove" in
10857                 "$define") echo "But that's Ok since you have memmove()." ;;
10858                 esac
10859         fi
10860         ;;
10861 esac
10862 $rm -f try.* try core
10863 set d_safemcpy
10864 eval $setvar
10865
10866 : can memcmp be trusted to compare relative magnitude?
10867 val="$undef"
10868 case "$d_memcmp" in
10869 "$define")
10870         echo " "
10871         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10872         $cat >try.c <<EOCP
10873 #$i_memory I_MEMORY
10874 #$i_stdlib I_STDLIB
10875 #$i_string I_STRING
10876 #$i_unistd I_UNISTD
10877 EOCP
10878         $cat >>try.c <<'EOCP'
10879 #include <stdio.h>
10880 #ifdef I_MEMORY
10881 #  include <memory.h>
10882 #endif
10883 #ifdef I_STDLIB
10884 #  include <stdlib.h>
10885 #endif
10886 #ifdef I_STRING
10887 #  include <string.h>
10888 #else
10889 #  include <strings.h>
10890 #endif
10891 #ifdef I_UNISTD
10892 #  include <unistd.h>  /* Needed for NetBSD */
10893 #endif
10894 int main()
10895 {
10896 char a = -1;
10897 char b = 0;
10898 if ((a < b) && memcmp(&a, &b, 1) < 0)
10899         exit(1);
10900 exit(0);
10901 }
10902 EOCP
10903         set try
10904         if eval $compile_ok; then
10905                 if ./try 2>/dev/null; then
10906                         echo "Yes, it can."
10907                         val="$define"
10908                 else
10909                         echo "No, it can't (it uses signed chars)."
10910                 fi
10911         else
10912                 echo "(I can't compile the test program, so we'll assume not...)"
10913         fi
10914         ;;
10915 esac
10916 $rm -f try.* try core
10917 set d_sanemcmp
10918 eval $setvar
10919
10920 : see if prototype for sbrk is available
10921 echo " "
10922 set d_sbrkproto sbrk $i_unistd unistd.h
10923 eval $hasproto
10924
10925 : see if select exists
10926 set select d_select
10927 eval $inlibc
10928
10929 : see if semctl exists
10930 set semctl d_semctl
10931 eval $inlibc
10932
10933 : see if semget exists
10934 set semget d_semget
10935 eval $inlibc
10936
10937 : see if semop exists
10938 set semop d_semop
10939 eval $inlibc
10940
10941 : see how much of the 'sem*(2)' library is present.
10942 h_sem=true
10943 echo " "
10944 case "$d_semctl$d_semget$d_semop" in
10945 *"$undef"*) h_sem=false;;
10946 esac
10947 case "$osname" in
10948 freebsd)
10949     case "`ipcs 2>&1`" in
10950     "SVID messages"*"not configured"*)
10951         echo "Your $osname does not have the sem*(2) configured." >&4
10952         h_sem=false
10953         val="$undef"
10954         set semctl d_semctl
10955         eval $setvar
10956         set semget d_semget
10957         eval $setvar
10958         set semop d_semop
10959         eval $setvar
10960         ;;
10961     esac
10962     ;;
10963 esac
10964 : we could also check for sys/ipc.h ...
10965 if $h_sem && $test `./findhdr sys/sem.h`; then
10966         echo "You have the full sem*(2) library." >&4
10967         val="$define"
10968 else
10969         echo "You don't have the full sem*(2) library." >&4
10970         val="$undef"
10971 fi
10972 set d_sem
10973 eval $setvar
10974
10975 : see whether sys/sem.h defines union semun
10976 echo " "
10977 $cat > try.c <<'END'
10978 #include <sys/types.h>
10979 #include <sys/ipc.h>
10980 #include <sys/sem.h>
10981 int main () { union semun semun; semun.buf = 0; }
10982 END
10983 set try
10984 if eval $compile; then
10985     echo "You have union semun in <sys/sem.h>." >&4
10986     val="$define"
10987 else
10988     echo "You do not have union semun in <sys/sem.h>." >&4
10989     val="$undef"
10990 fi
10991 $rm -f try try.c try.h
10992 set d_union_semun
10993 eval $setvar
10994
10995 : see how to do semctl IPC_STAT
10996 case "$d_sem" in
10997 $define)
10998     : see whether semctl IPC_STAT can use union semun
10999     echo " "
11000     $cat > try.h <<END
11001 #ifndef S_IRUSR
11002 #   ifdef S_IREAD
11003 #       define S_IRUSR S_IREAD
11004 #       define S_IWUSR S_IWRITE
11005 #       define S_IXUSR S_IEXEC
11006 #   else
11007 #       define S_IRUSR 0400
11008 #       define S_IWUSR 0200
11009 #       define S_IXUSR 0100
11010 #   endif
11011 #   define S_IRGRP (S_IRUSR>>3)
11012 #   define S_IWGRP (S_IWUSR>>3)
11013 #   define S_IXGRP (S_IXUSR>>3)
11014 #   define S_IROTH (S_IRUSR>>6)
11015 #   define S_IWOTH (S_IWUSR>>6)
11016 #   define S_IXOTH (S_IXUSR>>6)
11017 #endif
11018 #ifndef S_IRWXU
11019 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11020 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11021 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11022 #endif
11023 END
11024
11025     $cat > try.c <<END
11026 #include <sys/types.h>
11027 #include <sys/ipc.h>
11028 #include <sys/sem.h>
11029 #include <sys/stat.h>
11030 #include <stdio.h>
11031 #include <errno.h>
11032 #include "try.h"
11033 #ifndef errno
11034 extern int errno;
11035 #endif
11036 #$d_union_semun HAS_UNION_SEMUN
11037 int main() {
11038     union semun
11039 #ifndef HAS_UNION_SEMUN
11040     {
11041         int val;
11042         struct semid_ds *buf;
11043         unsigned short *array;
11044     }
11045 #endif
11046     arg;
11047     int sem, st;
11048
11049 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11050     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11051     if (sem > -1) {
11052         struct semid_ds argbuf;
11053         arg.buf = &argbuf;
11054 #       ifdef IPC_STAT
11055         st = semctl(sem, 0, IPC_STAT, arg);
11056         if (st == 0)
11057             printf("semun\n");
11058         else
11059 #       endif /* IPC_STAT */
11060             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11061 #       ifdef IPC_RMID
11062         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11063 #       endif /* IPC_RMID */
11064             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11065     } else
11066 #endif /* IPC_PRIVATE && ... */
11067         printf("semget failed: errno = %d\n", errno);
11068   return 0;
11069 }
11070 END
11071     val="$undef"
11072     set try
11073     if eval $compile; then
11074         xxx=`./try`
11075         case "$xxx" in
11076         semun) val="$define" ;;
11077         esac
11078     fi
11079     $rm -f try try.c
11080     set d_semctl_semun
11081     eval $setvar
11082     case "$d_semctl_semun" in
11083     $define)
11084         echo "You can use union semun for semctl IPC_STAT." >&4
11085         also='also'
11086         ;;
11087     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11088         also=''
11089         ;;
11090     esac
11091
11092     : see whether semctl IPC_STAT can use struct semid_ds pointer
11093     $cat > try.c <<'END'
11094 #include <sys/types.h>
11095 #include <sys/ipc.h>
11096 #include <sys/sem.h>
11097 #include <sys/stat.h>
11098 #include "try.h"
11099 #include <stdio.h>
11100 #include <errno.h>
11101 #ifndef errno
11102 extern int errno;
11103 #endif
11104 int main() {
11105     struct semid_ds arg;
11106     int sem, st;
11107
11108 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11109     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11110     if (sem > -1) {
11111 #       ifdef IPC_STAT
11112         st = semctl(sem, 0, IPC_STAT, &arg);
11113         if (st == 0)
11114             printf("semid_ds\n");
11115         else
11116 #       endif /* IPC_STAT */
11117             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11118 #       ifdef IPC_RMID
11119         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11120 #       endif /* IPC_RMID */
11121             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11122     } else
11123 #endif /* IPC_PRIVATE && ... */
11124         printf("semget failed: errno = %d\n", errno);
11125
11126     return 0;
11127 }
11128 END
11129     val="$undef"
11130     set try
11131     if eval $compile; then
11132         xxx=`./try`
11133         case "$xxx" in
11134         semid_ds) val="$define" ;;
11135         esac
11136     fi
11137     $rm -f try try.c
11138     set d_semctl_semid_ds
11139     eval $setvar
11140     case "$d_semctl_semid_ds" in
11141     $define)
11142         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11143         ;;
11144     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11145         ;;
11146     esac
11147     $rm -f try.h
11148     ;;
11149 *)  val="$undef"
11150
11151     # We do not have the full sem*(2) library, so assume we can not
11152     # use either.
11153
11154     set d_semctl_semun
11155     eval $setvar
11156
11157     set d_semctl_semid_ds
11158     eval $setvar
11159     ;;
11160 esac
11161
11162 : see if setegid exists
11163 set setegid d_setegid
11164 eval $inlibc
11165
11166 : see if seteuid exists
11167 set seteuid d_seteuid
11168 eval $inlibc
11169
11170 : see if setgrent exists
11171 set setgrent d_setgrent
11172 eval $inlibc
11173
11174 : see if sethostent exists
11175 set sethostent d_sethent
11176 eval $inlibc
11177
11178 : see if setlinebuf exists
11179 set setlinebuf d_setlinebuf
11180 eval $inlibc
11181
11182 : see if setlocale exists
11183 set setlocale d_setlocale
11184 eval $inlibc
11185
11186 : see if setnetent exists
11187 set setnetent d_setnent
11188 eval $inlibc
11189
11190 : see if setprotoent exists
11191 set setprotoent d_setpent
11192 eval $inlibc
11193
11194 : see if setpgid exists
11195 set setpgid d_setpgid
11196 eval $inlibc
11197
11198 : see if setpgrp2 exists
11199 set setpgrp2 d_setpgrp2
11200 eval $inlibc
11201
11202 : see if setpriority exists
11203 set setpriority d_setprior
11204 eval $inlibc
11205
11206 : see if setproctitle exists
11207 set setproctitle d_setproctitle
11208 eval $inlibc
11209
11210 : see if setpwent exists
11211 set setpwent d_setpwent
11212 eval $inlibc
11213
11214 : see if setregid exists
11215 set setregid d_setregid
11216 eval $inlibc
11217 set setresgid d_setresgid
11218 eval $inlibc
11219
11220 : see if setreuid exists
11221 set setreuid d_setreuid
11222 eval $inlibc
11223 set setresuid d_setresuid
11224 eval $inlibc
11225
11226 : see if setrgid exists
11227 set setrgid d_setrgid
11228 eval $inlibc
11229
11230 : see if setruid exists
11231 set setruid d_setruid
11232 eval $inlibc
11233
11234 : see if setservent exists
11235 set setservent d_setsent
11236 eval $inlibc
11237
11238 : see if setsid exists
11239 set setsid d_setsid
11240 eval $inlibc
11241
11242 : see if setvbuf exists
11243 set setvbuf d_setvbuf
11244 eval $inlibc
11245
11246 : see if sfio.h is available
11247 set sfio.h i_sfio
11248 eval $inhdr
11249
11250
11251 : see if sfio library is available
11252 case "$i_sfio" in
11253 $define)
11254         val=''
11255         set sfreserve val
11256         eval $inlibc
11257         ;;
11258 *)
11259         val="$undef"
11260         ;;
11261 esac
11262 : Ok, but do we want to use it.
11263 case "$val" in
11264 $define)
11265         case "$usesfio" in
11266         true|$define|[yY]*) dflt='y';;
11267         *) dflt='n';;
11268         esac
11269         echo "$package can use the sfio library, but it is experimental."
11270         case "$useperlio" in
11271         "$undef")
11272             echo "For sfio also the PerlIO abstraction layer is needed."
11273             echo "Earlier you said you wouldn't want that."
11274             ;;
11275         esac
11276         rp="You seem to have sfio available, do you want to try using it?"
11277         . ./myread
11278         case "$ans" in
11279         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11280                 useperlio="$define"
11281                 val="$define"
11282                 ;;
11283         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11284                 val="$undef"
11285                 : Remove sfio from list of libraries to use
11286                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11287                 shift
11288                 libs="$*"
11289                 echo "libs = $libs" >&4
11290                 ;;
11291         esac
11292         ;;
11293 *)      case "$usesfio" in
11294         true|$define|[yY]*)
11295                 echo "Sorry, cannot find sfio on this machine." >&4
11296                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11297                 val="$undef"
11298                 ;;
11299         esac
11300         ;;
11301 esac
11302 set d_sfio
11303 eval $setvar
11304 case "$d_sfio" in
11305 $define) usesfio='true';;
11306 *) usesfio='false';;
11307 esac
11308
11309 : see if shmctl exists
11310 set shmctl d_shmctl
11311 eval $inlibc
11312
11313 : see if shmget exists
11314 set shmget d_shmget
11315 eval $inlibc
11316
11317 : see if shmat exists
11318 set shmat d_shmat
11319 eval $inlibc
11320 : see what shmat returns
11321 case "$d_shmat" in
11322 "$define")
11323         $cat >shmat.c <<'END'
11324 #include <sys/shm.h>
11325 void *shmat();
11326 END
11327         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11328                 shmattype='void *'
11329         else
11330                 shmattype='char *'
11331         fi
11332         echo "and it returns ($shmattype)." >&4
11333         : see if a prototype for shmat is available
11334         xxx=`./findhdr sys/shm.h`
11335         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11336         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11337                 val="$define"
11338         else
11339                 val="$undef"
11340         fi
11341         $rm -f shmat.[co]
11342         ;;
11343 *)
11344         val="$undef"
11345         ;;
11346 esac
11347 set d_shmatprototype
11348 eval $setvar
11349
11350 : see if shmdt exists
11351 set shmdt d_shmdt
11352 eval $inlibc
11353
11354 : see how much of the 'shm*(2)' library is present.
11355 h_shm=true
11356 echo " "
11357 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11358 *"$undef"*) h_shm=false;;
11359 esac
11360 case "$osname" in
11361 freebsd)
11362     case "`ipcs 2>&1`" in
11363     "SVID shared memory"*"not configured"*)
11364         echo "Your $osname does not have the shm*(2) configured." >&4
11365         h_shm=false
11366         val="$undef"
11367         set shmctl d_shmctl
11368         evat $setvar
11369         set shmget d_shmget
11370         evat $setvar
11371         set shmat d_shmat
11372         evat $setvar
11373         set shmdt d_shmdt
11374         evat $setvar
11375         ;;
11376     esac
11377     ;;
11378 esac
11379 : we could also check for sys/ipc.h ...
11380 if $h_shm && $test `./findhdr sys/shm.h`; then
11381         echo "You have the full shm*(2) library." >&4
11382         val="$define"
11383 else
11384         echo "You don't have the full shm*(2) library." >&4
11385         val="$undef"
11386 fi
11387 set d_shm
11388 eval $setvar
11389
11390 echo " "
11391 : see if we have sigaction
11392 if set sigaction val -f d_sigaction; eval $csym; $val; then
11393         echo 'sigaction() found.' >&4
11394         $cat > try.c <<'EOP'
11395 #include <stdio.h>
11396 #include <sys/types.h>
11397 #include <signal.h>
11398 int main()
11399 {
11400     struct sigaction act, oact;
11401     act.sa_flags = 0;
11402     oact.sa_handler = 0;
11403     /* so that act and oact are used */
11404     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11405 }
11406 EOP
11407         set try
11408         if eval $compile_ok; then
11409                 val="$define"
11410         else
11411                 echo "But you don't seem to have a useable struct sigaction." >&4
11412                 val="$undef"
11413         fi
11414 else
11415         echo 'sigaction NOT found.' >&4
11416         val="$undef"
11417 fi
11418 set d_sigaction; eval $setvar
11419 $rm -f try try$_o try.c
11420
11421 : see if sigsetjmp exists
11422 echo " "
11423 case "$d_sigsetjmp" in
11424 '')
11425         $cat >try.c <<'EOP'
11426 #include <setjmp.h>
11427 sigjmp_buf env;
11428 int set = 1;
11429 int main()
11430 {
11431         if (sigsetjmp(env,1))
11432                 exit(set);
11433         set = 0;
11434         siglongjmp(env, 1);
11435         exit(1);
11436 }
11437 EOP
11438         set try
11439         if eval $compile; then
11440                 if ./try >/dev/null 2>&1; then
11441                         echo "POSIX sigsetjmp found." >&4
11442                         val="$define"
11443                 else
11444                         $cat >&4 <<EOM
11445 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11446 I'll ignore them.
11447 EOM
11448                         val="$undef"
11449                 fi
11450         else
11451                 echo "sigsetjmp not found." >&4
11452                 val="$undef"
11453         fi
11454         ;;
11455 *) val="$d_sigsetjmp"
11456         case "$d_sigsetjmp" in
11457         $define) echo "POSIX sigsetjmp found." >&4;;
11458         $undef) echo "sigsetjmp not found." >&4;;
11459         esac
11460         ;;
11461 esac
11462 set d_sigsetjmp
11463 eval $setvar
11464 $rm -f try.c try
11465
11466 : see if socks5_init exists
11467 set socks5_init d_socks5_init
11468 eval $inlibc
11469
11470 : see if sys/stat.h is available
11471 set sys/stat.h i_sysstat
11472 eval $inhdr
11473
11474
11475 : see if stat knows about block sizes
11476 echo " "
11477 echo "Checking to see if your struct stat has st_blocks field..." >&4
11478 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11479 eval $hasfield
11480
11481
11482 : see if this is a sys/vfs.h system
11483 set sys/vfs.h i_sysvfs
11484 eval $inhdr
11485
11486
11487 : see if this is a sys/statfs.h system
11488 set sys/statfs.h i_sysstatfs
11489 eval $inhdr
11490
11491
11492 echo " "
11493 echo "Checking to see if your system supports struct statfs..." >&4
11494 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
11495 eval $hasstruct
11496 case "$d_statfs_s" in
11497 "$define")      echo "Yes, it does."   ;;
11498 *)              echo "No, it doesn't." ;;
11499 esac
11500
11501
11502
11503 : see if struct statfs knows about f_flags
11504 case "$d_statfs_s" in
11505 define) 
11506         echo " "
11507         echo "Checking to see if your struct statfs has f_flags field..." >&4
11508         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
11509         eval $hasfield
11510         ;;
11511 *)      val="$undef"
11512         set d_statfs_f_flags
11513         eval $setvar
11514         ;;
11515 esac
11516 case "$d_statfs_f_flags" in
11517 "$define")      echo "Yes, it does."   ;;
11518 *)              echo "No, it doesn't." ;;
11519 esac
11520
11521 : see if _ptr and _cnt from stdio act std
11522 echo " "
11523
11524 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11525         echo "(Looks like you have stdio.h from BSD.)"
11526         case "$stdio_ptr" in
11527         '') stdio_ptr='((fp)->_p)'
11528                 ptr_lval=$define
11529                 ;;
11530         *)      ptr_lval=$d_stdio_ptr_lval;;
11531         esac
11532         case "$stdio_cnt" in
11533         '') stdio_cnt='((fp)->_r)'
11534                 cnt_lval=$define
11535                 ;;
11536         *)      cnt_lval=$d_stdio_cnt_lval;;
11537         esac
11538         case "$stdio_base" in
11539         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11540         esac
11541         case "$stdio_bufsiz" in
11542         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11543         esac
11544 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11545         echo "(Looks like you have stdio.h from Linux.)"
11546         case "$stdio_ptr" in
11547         '') stdio_ptr='((fp)->_IO_read_ptr)'
11548                 ptr_lval=$define
11549                 ;;
11550         *)      ptr_lval=$d_stdio_ptr_lval;;
11551         esac
11552         case "$stdio_cnt" in
11553         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11554                 cnt_lval=$undef
11555                 ;;
11556         *)      cnt_lval=$d_stdio_cnt_lval;;
11557         esac
11558         case "$stdio_base" in
11559         '') stdio_base='((fp)->_IO_read_base)';;
11560         esac
11561         case "$stdio_bufsiz" in
11562         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11563         esac
11564 else
11565         case "$stdio_ptr" in
11566         '') stdio_ptr='((fp)->_ptr)'
11567                 ptr_lval=$define
11568                 ;;
11569         *)      ptr_lval=$d_stdio_ptr_lval;;
11570         esac
11571         case "$stdio_cnt" in
11572         '') stdio_cnt='((fp)->_cnt)'
11573                 cnt_lval=$define
11574                 ;;
11575         *)      cnt_lval=$d_stdio_cnt_lval;;
11576         esac
11577         case "$stdio_base" in
11578         '') stdio_base='((fp)->_base)';;
11579         esac
11580         case "$stdio_bufsiz" in
11581         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11582         esac
11583 fi
11584
11585 : test whether _ptr and _cnt really work
11586 echo "Checking how std your stdio is..." >&4
11587 $cat >try.c <<EOP
11588 #include <stdio.h>
11589 #define FILE_ptr(fp)    $stdio_ptr
11590 #define FILE_cnt(fp)    $stdio_cnt
11591 int main() {
11592         FILE *fp = fopen("try.c", "r");
11593         char c = getc(fp);
11594         if (
11595                 18 <= FILE_cnt(fp) &&
11596                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11597         )
11598                 exit(0);
11599         exit(1);
11600 }
11601 EOP
11602 val="$undef"
11603 set try
11604 if eval $compile; then
11605         if ./try; then
11606                 echo "Your stdio acts pretty std."
11607                 val="$define"
11608         else
11609                 echo "Your stdio isn't very std."
11610         fi
11611 else
11612         echo "Your stdio doesn't appear very std."
11613 fi
11614 $rm -f try.c try
11615 set d_stdstdio
11616 eval $setvar
11617
11618 : Can _ptr be used as an lvalue?
11619 case "$d_stdstdio$ptr_lval" in
11620 $define$define) val=$define ;;
11621 *) val=$undef ;;
11622 esac
11623 set d_stdio_ptr_lval
11624 eval $setvar
11625
11626 : Can _cnt be used as an lvalue?
11627 case "$d_stdstdio$cnt_lval" in
11628 $define$define) val=$define ;;
11629 *) val=$undef ;;
11630 esac
11631 set d_stdio_cnt_lval
11632 eval $setvar
11633
11634
11635 : test whether setting _ptr sets _cnt as a side effect
11636 d_stdio_ptr_lval_sets_cnt="$undef"
11637 d_stdio_ptr_lval_nochange_cnt="$undef"
11638 case "$d_stdio_ptr_lval$d_stdstdio" in
11639 $define$define)
11640         echo "Checking to see what happens if we set the stdio ptr..." >&4
11641 $cat >try.c <<EOP
11642 #include <stdio.h>
11643 /* Can we scream? */
11644 /* Eat dust sed :-) */
11645 /* In the buffer space, no one can hear you scream. */
11646 #define FILE_ptr(fp)    $stdio_ptr
11647 #define FILE_cnt(fp)    $stdio_cnt
11648 #include <sys/types.h>
11649 int main() {
11650         FILE *fp = fopen("try.c", "r");
11651         int c;
11652         char *ptr;
11653         size_t cnt;
11654         if (!fp) {
11655             puts("Fail even to read");
11656             exit(1);
11657         }
11658         c = getc(fp); /* Read away the first # */
11659         if (c == EOF) {
11660             puts("Fail even to read");
11661             exit(1);
11662         }
11663         if (!(
11664                 18 <= FILE_cnt(fp) &&
11665                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11666         )) {
11667                 puts("Fail even to read");
11668                 exit (1);
11669         }
11670         ptr = (char*) FILE_ptr(fp);
11671         cnt = (size_t)FILE_cnt(fp);
11672
11673         FILE_ptr(fp) += 42;
11674
11675         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11676                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11677                 exit (1);
11678         }
11679         if (FILE_cnt(fp) <= 20) {
11680                 printf ("Fail (<20 chars to test)");
11681                 exit (1);
11682         }
11683         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11684                 puts("Fail compare");
11685                 exit (1);
11686         }
11687         if (cnt == FILE_cnt(fp)) {
11688                 puts("Pass_unchanged");
11689                 exit (0);
11690         }       
11691         if (FILE_cnt(fp) == (cnt - 42)) {
11692                 puts("Pass_changed");
11693                 exit (0);
11694         }
11695         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11696         return 1;
11697
11698 }
11699 EOP
11700         set try
11701         if eval $compile; then
11702                 case `./try$exe_ext` in
11703                 Pass_changed)
11704                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11705                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11706                 Pass_unchanged)
11707                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11708                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11709                 Fail*)
11710                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11711                 *)
11712                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11713         esac
11714         else
11715                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11716         fi
11717         $rm -f try.c try
11718         ;;
11719 esac
11720
11721 : see if _base is also standard
11722 val="$undef"
11723 case "$d_stdstdio" in
11724 $define)
11725         $cat >try.c <<EOP
11726 #include <stdio.h>
11727 #define FILE_base(fp)   $stdio_base
11728 #define FILE_bufsiz(fp) $stdio_bufsiz
11729 int main() {
11730         FILE *fp = fopen("try.c", "r");
11731         char c = getc(fp);
11732         if (
11733                 19 <= FILE_bufsiz(fp) &&
11734                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11735         )
11736                 exit(0);
11737         exit(1);
11738 }
11739 EOP
11740         set try
11741         if eval $compile; then
11742                 if ./try; then
11743                         echo "And its _base field acts std."
11744                         val="$define"
11745                 else
11746                         echo "But its _base field isn't std."
11747                 fi
11748         else
11749                 echo "However, it seems to be lacking the _base field."
11750         fi
11751         $rm -f try.c try
11752         ;;
11753 esac
11754 set d_stdiobase
11755 eval $setvar
11756
11757 $cat >&4 <<EOM
11758 Checking how to access stdio streams by file descriptor number...
11759 EOM
11760 case "$stdio_stream_array" in
11761 '')     $cat >try.c <<EOCP
11762 #include <stdio.h>
11763 int main() {
11764   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11765     printf("yes\n");
11766 }
11767 EOCP
11768         for s in _iob __iob __sF
11769         do
11770                 set try -DSTDIO_STREAM_ARRAY=$s
11771                 if eval $compile; then
11772                         case "`./try$exe_ext`" in
11773                         yes)    stdio_stream_array=$s; break ;;
11774                         esac
11775                 fi
11776         done
11777         $rm -f try.* try$exe_ext
11778 esac
11779 case "$stdio_stream_array" in
11780 '')     $cat >&4 <<EOM
11781 I can't figure out how to access stdio streams by file descriptor number.
11782 EOM
11783         d_stdio_stream_array="$undef"
11784         ;;
11785 *)      $cat >&4 <<EOM
11786 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11787 EOM
11788         d_stdio_stream_array="$define"
11789         ;;
11790 esac
11791
11792 : see if strcoll exists
11793 set strcoll d_strcoll
11794 eval $inlibc
11795
11796 : check for structure copying
11797 echo " "
11798 echo "Checking to see if your C compiler can copy structs..." >&4
11799 $cat >try.c <<'EOCP'
11800 int main()
11801 {
11802         struct blurfl {
11803                 int dyick;
11804         } foo, bar;
11805
11806         foo = bar;
11807 }
11808 EOCP
11809 if $cc -c try.c >/dev/null 2>&1 ; then
11810         val="$define"
11811         echo "Yup, it can."
11812 else
11813         val="$undef"
11814         echo "Nope, it can't."
11815 fi
11816 set d_strctcpy
11817 eval $setvar
11818 $rm -f try.*
11819
11820 : see if strerror and/or sys_errlist[] exist
11821 echo " "
11822 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11823     if set strerror val -f d_strerror; eval $csym; $val; then
11824                 echo 'strerror() found.' >&4
11825                 d_strerror="$define"
11826                 d_strerrm='strerror(e)'
11827                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11828                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11829                         d_syserrlst="$define"
11830                 else
11831                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11832                         d_syserrlst="$undef"
11833                 fi
11834     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11835                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11836                 echo 'strerror() found in string header.' >&4
11837                 d_strerror="$define"
11838                 d_strerrm='strerror(e)'
11839                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11840                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11841                                 d_syserrlst="$define"
11842                 else
11843                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11844                         d_syserrlst="$undef"
11845                 fi
11846     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11847                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11848                 d_strerror="$undef"
11849                 d_syserrlst="$define"
11850                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11851     else
11852                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11853                 d_strerror="$undef"
11854                 d_syserrlst="$undef"
11855                 d_strerrm='"unknown"'
11856     fi
11857 fi
11858
11859 : see if strtod exists
11860 set strtod d_strtod
11861 eval $inlibc
11862
11863 : see if strtol exists
11864 set strtol d_strtol
11865 eval $inlibc
11866
11867 : see if strtold exists
11868 set strtold d_strtold
11869 eval $inlibc
11870
11871 : see if strtoll exists
11872 set strtoll d_strtoll
11873 eval $inlibc
11874
11875 case "$d_longlong-$d_strtoll" in
11876 "$define-$define")
11877         $cat <<EOM
11878 Checking whether your strtoll() works okay...
11879 EOM
11880         $cat >try.c <<'EOCP'
11881 #include <errno.h>
11882 #ifdef __hpux
11883 #define strtoll __strtoll
11884 #endif
11885 #ifdef __EMX__
11886 #define strtoll _strtoll
11887 #endif
11888 #include <stdio.h>
11889 extern long long int strtoll(char *s, char **, int); 
11890 static int bad = 0;
11891 int check(char *s, long long ell, int een) {
11892         long long gll;
11893         errno = 0;
11894         gll = strtoll(s, 0, 10);
11895         if (!((gll == ell) && (errno == een)))
11896                 bad++;
11897 }
11898 int main() {
11899         check(" 1",                                      1LL, 0);
11900         check(" 0",                                      0LL, 0);
11901         check("-1",                                     -1LL, 0);
11902         check("-9223372036854775808", -9223372036854775808LL, 0);
11903         check("-9223372036854775808", -9223372036854775808LL, 0);
11904         check(" 9223372036854775807",  9223372036854775807LL, 0);
11905         check("-9223372036854775808", -9223372036854775808LL, 0);
11906         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11907         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11908         if (!bad)
11909                 printf("ok\n");
11910 }
11911 EOCP
11912         set try
11913         if eval $compile; then
11914                 yyy=`./try`
11915                 case "$yyy" in
11916                 ok) echo "Your strtoll() seems to be working okay." ;;
11917                 *) cat <<EOM >&4
11918 Your strtoll() doesn't seem to be working okay.
11919 EOM
11920                    d_strtoll="$undef"
11921                    ;;
11922                 esac
11923         else
11924                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11925                 d_strtoll="$undef"
11926         fi
11927         ;;
11928 esac
11929
11930 : see if strtoul exists
11931 set strtoul d_strtoul
11932 eval $inlibc
11933
11934 case "$d_strtoul" in
11935 "$define")
11936         $cat <<EOM
11937 Checking whether your strtoul() works okay...
11938 EOM
11939         $cat >try.c <<'EOCP'
11940 #include <errno.h>
11941 #include <stdio.h>
11942 extern unsigned long int strtoul(char *s, char **, int); 
11943 static int bad = 0;
11944 void check(char *s, unsigned long eul, int een) {
11945         unsigned long gul;
11946         errno = 0;
11947         gul = strtoul(s, 0, 10);
11948         if (!((gul == eul) && (errno == een)))
11949                 bad++;
11950 }
11951 int main() {
11952         check(" 1", 1L, 0);
11953         check(" 0", 0L, 0);
11954 EOCP
11955         case "$longsize" in
11956         8)
11957             $cat >>try.c <<'EOCP'
11958         check("18446744073709551615", 18446744073709551615UL, 0);
11959         check("18446744073709551616", 18446744073709551615UL, ERANGE);
11960 #if 0 /* strtoul() for /^-/ strings is undefined. */
11961         check("-1", 18446744073709551615UL, 0);
11962         check("-18446744073709551614", 2, 0);
11963         check("-18446744073709551615", 1, 0);
11964         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
11965         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
11966 #endif
11967 EOCP
11968                 ;;
11969         4)
11970                     $cat >>try.c <<'EOCP'
11971         check("4294967295", 4294967295UL, 0);
11972         check("4294967296", 4294967295UL, ERANGE);
11973 #if 0 /* strtoul() for /^-/ strings is undefined. */
11974         check("-1", 4294967295UL, 0);
11975         check("-4294967294", 2, 0);
11976         check("-4294967295", 1, 0);
11977         check("-4294967296", 4294967295UL, ERANGE);
11978         check("-4294967297", 4294967295UL, ERANGE);
11979 #endif
11980 EOCP
11981                 ;;
11982         *)
11983 : Should we write these tests to be more portable by sprintf-ing
11984 : ~0 and then manipulating that char string as input for strtol?
11985                 ;;
11986         esac
11987         $cat >>try.c <<'EOCP'
11988         if (!bad)
11989                 printf("ok\n");
11990         return 0;
11991 }
11992 EOCP
11993         set try
11994         if eval $compile; then
11995                 case "`./try`" in
11996                 ok) echo "Your strtoul() seems to be working okay." ;;
11997                 *) cat <<EOM >&4
11998 Your strtoul() doesn't seem to be working okay.
11999 EOM
12000                    d_strtoul="$undef"
12001                    ;;
12002                 esac
12003         fi
12004         ;;
12005 esac
12006
12007 : see if strtoull exists
12008 set strtoull d_strtoull
12009 eval $inlibc
12010
12011 case "$d_longlong-$d_strtoull" in
12012 "$define-$define")
12013         $cat <<EOM
12014 Checking whether your strtoull() works okay...
12015 EOM
12016         $cat >try.c <<'EOCP'
12017 #include <errno.h>
12018 #ifdef __hpux
12019 #define strtoull __strtoull
12020 #endif
12021 #include <stdio.h>
12022 extern unsigned long long int strtoull(char *s, char **, int); 
12023 static int bad = 0;
12024 int check(char *s, long long eull, int een) {
12025         long long gull;
12026         errno = 0;
12027         gull = strtoull(s, 0, 10);
12028         if (!((gull == eull) && (errno == een)))
12029                 bad++;
12030 }
12031 int main() {
12032         check(" 1",                                        1LL, 0);
12033         check(" 0",                                        0LL, 0);
12034         check("18446744073709551615",  18446744073709551615ULL, 0);
12035         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12036 #if 0 /* strtoull() for /^-/ strings is undefined. */
12037         check("-1",                    18446744073709551615ULL, 0);
12038         check("-18446744073709551614",                     2LL, 0);
12039         check("-18446744073709551615",                     1LL, 0);
12040         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12041         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12042 #endif
12043         if (!bad)
12044                 printf("ok\n");
12045 }
12046 EOCP
12047         set try
12048         if eval $compile; then
12049                 case "`./try`" in
12050                 ok) echo "Your strtoull() seems to be working okay." ;;
12051                 *) cat <<EOM >&4
12052 Your strtoull() doesn't seem to be working okay.
12053 EOM
12054                    d_strtoull="$undef"
12055                    ;;
12056                 esac
12057         fi
12058         ;;
12059 esac
12060
12061 : see if strtouq exists
12062 set strtouq d_strtouq
12063 eval $inlibc
12064
12065 case "$d_strtouq" in
12066 "$define")
12067         $cat <<EOM
12068 Checking whether your strtouq() works okay...
12069 EOM
12070         $cat >try.c <<'EOCP'
12071 #include <errno.h>
12072 #include <stdio.h>
12073 extern unsigned long long int strtouq(char *s, char **, int); 
12074 static int bad = 0;
12075 void check(char *s, unsigned long long eull, int een) {
12076         unsigned long long gull;
12077         errno = 0;
12078         gull = strtouq(s, 0, 10);
12079         if (!((gull == eull) && (errno == een)))
12080                 bad++;
12081 }
12082 int main() {
12083         check(" 1",                                        1LL, 0);
12084         check(" 0",                                        0LL, 0);
12085         check("18446744073709551615",  18446744073709551615ULL, 0);
12086         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12087 #if 0 /* strtouq() for /^-/ strings is undefined. */
12088         check("-1",                    18446744073709551615ULL, 0);
12089         check("-18446744073709551614",                     2LL, 0);
12090         check("-18446744073709551615",                     1LL, 0);
12091         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12092         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12093 #endif
12094         if (!bad)
12095                 printf("ok\n");
12096         return 0;
12097 }
12098 EOCP
12099         set try
12100         if eval $compile; then
12101                 case "`./try`" in
12102                 ok) echo "Your strtouq() seems to be working okay." ;;
12103                 *) cat <<EOM >&4
12104 Your strtouq() doesn't seem to be working okay.
12105 EOM
12106                    d_strtouq="$undef"
12107                    ;;
12108                 esac
12109         fi
12110         ;;
12111 esac
12112
12113 : see if strxfrm exists
12114 set strxfrm d_strxfrm
12115 eval $inlibc
12116
12117 : see if symlink exists
12118 set symlink d_symlink
12119 eval $inlibc
12120
12121 : see if syscall exists
12122 set syscall d_syscall
12123 eval $inlibc
12124
12125 : see if sysconf exists
12126 set sysconf d_sysconf
12127 eval $inlibc
12128
12129 : see if system exists
12130 set system d_system
12131 eval $inlibc
12132
12133 : see if tcgetpgrp exists
12134 set tcgetpgrp d_tcgetpgrp
12135 eval $inlibc
12136
12137 : see if tcsetpgrp exists
12138 set tcsetpgrp d_tcsetpgrp
12139 eval $inlibc
12140
12141 : see if prototype for telldir is available
12142 echo " "
12143 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12144 eval $hasproto
12145
12146 : see if this is a sys/times.h system
12147 set sys/times.h i_systimes
12148 eval $inhdr
12149
12150 : see if times exists
12151 echo " "
12152 if set times val -f d_times; eval $csym; $val; then
12153         echo 'times() found.' >&4
12154         d_times="$define"
12155         inc=''
12156         case "$i_systimes" in
12157         "$define") inc='sys/times.h';;
12158         esac
12159         rp="What is the type returned by times() on this system?"
12160         set clock_t clocktype long stdio.h sys/types.h $inc
12161         eval $typedef_ask
12162 else
12163         echo 'times() NOT found, hope that will do.' >&4
12164         d_times="$undef"
12165         clocktype='int'
12166 fi
12167
12168 : see if truncate exists
12169 set truncate d_truncate
12170 eval $inlibc
12171
12172 : see if tzname[] exists
12173 echo " "
12174 if set tzname val -a d_tzname; eval $csym; $val; then
12175         val="$define"
12176         echo 'tzname[] found.' >&4
12177 else
12178         val="$undef"
12179         echo 'tzname[] NOT found.' >&4
12180 fi
12181 set d_tzname
12182 eval $setvar
12183
12184 : see if umask exists
12185 set umask d_umask
12186 eval $inlibc
12187
12188 : see if ustat exists
12189 set ustat d_ustat
12190 eval $inlibc
12191
12192 : backward compatibility for d_hvfork
12193 if test X$d_hvfork != X; then
12194         d_vfork="$d_hvfork"
12195         d_hvfork=''
12196 fi
12197 : see if there is a vfork
12198 val=''
12199 set vfork val
12200 eval $inlibc
12201
12202 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12203 : perl on Solaris 2.x, and probably elsewhere.
12204 case "$val" in
12205 $define)
12206         echo " "
12207         case "$usevfork" in
12208         false) dflt='n';;
12209         *) dflt='y';;
12210         esac
12211         cat <<'EOM'
12212  
12213 Perl can only use a vfork() that doesn't suffer from strict
12214 restrictions on calling functions or modifying global data in
12215 the child.  For example, glibc-2.1 contains such a vfork()
12216 that is unsuitable.  If your system provides a proper fork()
12217 call, chances are that you do NOT want perl to use vfork().
12218
12219 EOM
12220         rp="Do you still want to use vfork()?"
12221         . ./myread
12222         case "$ans" in
12223         y|Y) ;;
12224         *)
12225                 echo "Ok, we won't use vfork()."
12226                 val="$undef"
12227                 ;;
12228         esac
12229         ;;
12230 esac
12231 set d_vfork
12232 eval $setvar
12233 case "$d_vfork" in
12234 $define) usevfork='true';;
12235 *) usevfork='false';;
12236 esac
12237
12238 : see if this is an sysdir system
12239 set sys/dir.h i_sysdir
12240 eval $inhdr
12241
12242 : see if this is an sysndir system
12243 set sys/ndir.h i_sysndir
12244 eval $inhdr
12245
12246 : see if closedir exists
12247 set closedir d_closedir
12248 eval $inlibc
12249
12250 case "$d_closedir" in
12251 "$define")
12252         echo " "
12253         echo "Checking whether closedir() returns a status..." >&4
12254         cat > closedir.c <<EOM
12255 #$i_dirent I_DIRENT             /**/
12256 #$i_sysdir I_SYS_DIR            /**/
12257 #$i_sysndir I_SYS_NDIR          /**/
12258 #$i_systypes I_SYS_TYPES        /**/
12259
12260 #if defined(I_SYS_TYPES)
12261 #include <sys/types.h>
12262 #endif
12263 #if defined(I_DIRENT)
12264 #include <dirent.h>
12265 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12266 #include <sys/dir.h>
12267 #endif
12268 #else
12269 #ifdef I_SYS_NDIR
12270 #include <sys/ndir.h>
12271 #else
12272 #ifdef I_SYS_DIR
12273 #ifdef hp9000s500
12274 #include <ndir.h>       /* may be wrong in the future */
12275 #else
12276 #include <sys/dir.h>
12277 #endif
12278 #endif
12279 #endif
12280 #endif 
12281 int main() { return closedir(opendir(".")); }
12282 EOM
12283         set closedir
12284         if eval $compile_ok; then
12285                 if ./closedir > /dev/null 2>&1 ; then
12286                         echo "Yes, it does."
12287                         val="$undef"
12288                 else
12289                         echo "No, it doesn't."
12290                         val="$define"
12291                 fi
12292         else
12293                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12294                 val="$define"
12295         fi
12296         ;;
12297 *)
12298         val="$undef";
12299         ;;
12300 esac
12301 set d_void_closedir
12302 eval $setvar
12303 $rm -f closedir*
12304 : see if there is a wait4
12305 set wait4 d_wait4
12306 eval $inlibc
12307
12308 : see if waitpid exists
12309 set waitpid d_waitpid
12310 eval $inlibc
12311
12312 : see if wcstombs exists
12313 set wcstombs d_wcstombs
12314 eval $inlibc
12315
12316 : see if wctomb exists
12317 set wctomb d_wctomb
12318 eval $inlibc
12319
12320 : preserve RCS keywords in files with variable substitution, grrr
12321 Date='$Date'
12322 Id='$Id'
12323 Log='$Log'
12324 RCSfile='$RCSfile'
12325 Revision='$Revision'
12326
12327 case "$crosscompile" in
12328 ''|[nN]*) crosscompile="$undef" ;;
12329 esac
12330
12331 case "$osname" in
12332 next|rhapsody|darwin) multiarch="$define" ;;
12333 esac
12334 case "$multiarch" in
12335 ''|[nN]*) multiarch="$undef" ;;
12336 esac
12337
12338 : check for alignment requirements
12339 echo " "
12340 case "$crosscompile$multiarch" in
12341 *$define*)
12342         $cat <<EOM
12343 You seem to be either cross-compiling or doing a multiarchitecture build,
12344 skipping the memory alignment check.
12345
12346 EOM
12347         case "$alignbytes" in
12348         '') alignbytes=8 ;;
12349         esac
12350         ;;
12351 *)
12352         case "$alignbytes" in
12353         '') echo "Checking alignment constraints..." >&4
12354                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12355                         $cat >try.c <<'EOCP'
12356 typedef long double NV;
12357 EOCP
12358                 else
12359                         $cat >try.c <<'EOCP'
12360 typedef double NV;
12361 EOCP
12362                 fi
12363                 $cat >>try.c <<'EOCP'
12364 #include <stdio.h>
12365 struct foobar {
12366         char foo;
12367         NV bar;
12368 } try_algn;
12369 int main()
12370 {
12371     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12372     return(0);
12373 }
12374 EOCP
12375                 set try
12376                 if eval $compile_ok; then
12377                         dflt=`./try`
12378                 else
12379                         dflt='8'
12380                         echo "(I can't seem to compile the test program...)"
12381                 fi
12382                 ;;
12383         *) dflt="$alignbytes"
12384                 ;;
12385         esac
12386         rp="Doubles must be aligned on a how-many-byte boundary?"
12387         . ./myread
12388         alignbytes="$ans"
12389         $rm -f try.c try
12390         ;;
12391 esac
12392
12393
12394 : set the base revision
12395 baserev=5.0
12396
12397 : check for ordering of bytes in a long
12398 echo " "
12399 case "$crosscompile$multiarch" in
12400 *$define*)
12401         $cat <<EOM
12402 You seem to be either cross-compiling or doing a multiarchitecture build,
12403 skipping the byteorder check.
12404
12405 EOM
12406         byteorder='0xffff'
12407         ;;
12408 *)
12409         case "$byteorder" in
12410         '')
12411                 $cat <<'EOM'
12412 In the following, larger digits indicate more significance.  A big-endian
12413 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12414 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12415 machines may have weird orders like 3412.  A Cray will report 87654321,
12416 an Alpha will report 12345678. If the test program works the default is
12417 probably right.
12418 I'm now running the test program...
12419 EOM
12420                 $cat >try.c <<'EOCP'
12421 #include <stdio.h>
12422 int main()
12423 {
12424         int i;
12425         union {
12426                 unsigned long l;
12427                 char c[sizeof(long)];
12428         } u;
12429
12430         if (sizeof(long) > 4)
12431                 u.l = (0x08070605L << 32) | 0x04030201L;
12432         else
12433                 u.l = 0x04030201L;
12434         for (i = 0; i < sizeof(long); i++)
12435                 printf("%c", u.c[i]+'0');
12436         printf("\n");
12437         exit(0);
12438 }
12439 EOCP
12440                 xxx_prompt=y
12441                 set try
12442                 if eval $compile && ./try > /dev/null; then
12443                         dflt=`./try`
12444                         case "$dflt" in
12445                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12446                                 echo "(The test program ran ok.)"
12447                                 echo "byteorder=$dflt"
12448                                 xxx_prompt=n
12449                         ;;
12450                         ????|????????) echo "(The test program ran ok.)" ;;
12451                         *) echo "(The test program didn't run right for some reason.)" ;;
12452                         esac
12453                 else
12454                         dflt='4321'
12455                         cat <<'EOM'
12456 (I can't seem to compile the test program.  Guessing big-endian...)
12457 EOM
12458                 fi
12459                 case "$xxx_prompt" in
12460                 y)
12461                         rp="What is the order of bytes in a long?"
12462                         . ./myread
12463                         byteorder="$ans"
12464                         ;;
12465                 *)      byteorder=$dflt
12466                         ;;
12467                 esac
12468                 ;;
12469         esac
12470         $rm -f try.c try
12471         ;;
12472 esac
12473
12474
12475 : how do we catenate cpp tokens here?
12476 echo " "
12477 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12478 $cat >cpp_stuff.c <<'EOCP'
12479 #define RCAT(a,b)a/**/b
12480 #define ACAT(a,b)a ## b
12481 RCAT(Rei,ser)
12482 ACAT(Cir,cus)
12483 EOCP
12484 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12485 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12486         echo "Oh!  Smells like ANSI's been here." >&4
12487         echo "We can catify or stringify, separately or together!"
12488         cpp_stuff=42
12489 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12490         echo "Ah, yes!  The good old days!" >&4
12491         echo "However, in the good old days we don't know how to stringify and"
12492         echo "catify at the same time."
12493         cpp_stuff=1
12494 else
12495         $cat >&4 <<EOM
12496 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12497 to have to edit the values of CAT[2-5] in config.h...
12498 EOM
12499         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12500 fi
12501 $rm -f cpp_stuff.*
12502
12503 : see if this is a db.h system
12504 set db.h i_db
12505 eval $inhdr
12506
12507 case "$i_db" in
12508 $define)
12509         : Check db version.
12510         echo " "
12511         echo "Checking Berkeley DB version ..." >&4
12512         $cat >try.c <<EOCP
12513 #$d_const HASCONST
12514 #ifndef HASCONST
12515 #define const
12516 #endif
12517 #include <sys/types.h>
12518 #include <stdio.h>
12519 #include <db.h>
12520 int main()
12521 {
12522 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12523     int Major, Minor, Patch ;
12524     unsigned long Version ;
12525     (void)db_version(&Major, &Minor, &Patch) ;
12526     printf("You have Berkeley DB Version 2 or greater\n");
12527
12528     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12529                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12530     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12531                 Major, Minor, Patch) ;
12532
12533     /* check that db.h & libdb are compatible */
12534     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12535         printf("db.h and libdb are incompatible\n") ;
12536         exit(3);        
12537     }
12538
12539     printf("db.h and libdb are compatible\n") ;
12540
12541     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12542                 + DB_VERSION_PATCH ;
12543
12544     /* needs to be >= 2.3.4 */
12545     if (Version < 2003004) {
12546     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12547         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12548         exit(2);        
12549     }
12550
12551     exit(0);
12552 #else
12553 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12554     printf("You have Berkeley DB Version 1\n");
12555     exit(0);    /* DB version < 2: the coast is clear. */
12556 #else
12557     exit(1);    /* <db.h> not Berkeley DB? */
12558 #endif
12559 #endif
12560 }
12561 EOCP
12562         set try
12563         if eval $compile_ok && ./try; then
12564                 echo 'Looks OK.' >&4
12565         else
12566                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12567                 i_db=$undef
12568                 case " $libs " in
12569                 *"-ldb "*)
12570                         : Remove db from list of libraries to use
12571                         echo "Removing unusable -ldb from library list" >&4
12572                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12573                         shift
12574                         libs="$*"
12575                         echo "libs = $libs" >&4
12576                         ;;
12577                 esac
12578         fi
12579         $rm -f try.*
12580         ;;
12581 esac
12582
12583 case "$i_db" in
12584 define)
12585         : Check the return type needed for hash 
12586         echo " "
12587         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12588         $cat >try.c <<EOCP
12589 #$d_const HASCONST
12590 #ifndef HASCONST
12591 #define const
12592 #endif
12593 #include <sys/types.h>
12594 #include <db.h>
12595
12596 #ifndef DB_VERSION_MAJOR
12597 u_int32_t hash_cb (ptr, size)
12598 const void *ptr;
12599 size_t size;
12600 {
12601 }
12602 HASHINFO info;
12603 int main()
12604 {
12605         info.hash = hash_cb;
12606 }
12607 #endif
12608 EOCP
12609         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12610                 if $contains warning try.out >>/dev/null 2>&1 ; then
12611                         db_hashtype='int'
12612                 else
12613                         db_hashtype='u_int32_t'
12614                 fi
12615         else
12616                 : XXX Maybe we should just give up here.
12617                 db_hashtype=u_int32_t
12618                 $cat try.out >&4
12619                 echo "Help:  I can't seem to compile the db test program." >&4
12620                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12621         fi
12622         $rm -f try.*
12623         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12624         ;;
12625 *)      db_hashtype=u_int32_t
12626         ;;
12627 esac
12628 case "$i_db" in
12629 define)
12630         : Check the return type needed for prefix 
12631         echo " "
12632         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12633         cat >try.c <<EOCP
12634 #$d_const HASCONST
12635 #ifndef HASCONST
12636 #define const
12637 #endif
12638 #include <sys/types.h>
12639 #include <db.h>
12640
12641 #ifndef DB_VERSION_MAJOR
12642 size_t prefix_cb (key1, key2)
12643 const DBT *key1;
12644 const DBT *key2;
12645 {
12646 }
12647 BTREEINFO info;
12648 int main()
12649 {
12650         info.prefix = prefix_cb;
12651 }
12652 #endif
12653 EOCP
12654         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12655                 if $contains warning try.out >>/dev/null 2>&1 ; then
12656                         db_prefixtype='int'
12657                 else
12658                         db_prefixtype='size_t'
12659                 fi
12660         else
12661                 db_prefixtype='size_t'
12662                 : XXX Maybe we should just give up here.
12663                 $cat try.out >&4
12664                 echo "Help:  I can't seem to compile the db test program." >&4
12665                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12666         fi
12667         $rm -f try.*
12668         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12669         ;;
12670 *)      db_prefixtype='size_t'
12671         ;;
12672 esac
12673
12674 : check for void type
12675 echo " "
12676 echo "Checking to see how well your C compiler groks the void type..." >&4
12677 case "$voidflags" in
12678 '')
12679         $cat >try.c <<'EOCP'
12680 #if TRY & 1
12681 void sub() {
12682 #else
12683 sub() {
12684 #endif
12685         extern void moo();      /* function returning void */
12686         void (*goo)();          /* ptr to func returning void */
12687 #if TRY & 8
12688         void *hue;              /* generic ptr */
12689 #endif
12690 #if TRY & 2
12691         void (*foo[10])();
12692 #endif
12693
12694 #if TRY & 4
12695         if(goo == moo) {
12696                 exit(0);
12697         }
12698 #endif
12699         exit(0);
12700 }
12701 int main() { sub(); }
12702 EOCP
12703         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12704                 voidflags=$defvoidused
12705         echo "Good.  It appears to support void to the level $package wants.">&4
12706                 if $contains warning .out >/dev/null 2>&1; then
12707                         echo "However, you might get some warnings that look like this:"
12708                         $cat .out
12709                 fi
12710         else
12711 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12712                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12713                         echo "It supports 1..."
12714                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12715                                 echo "It also supports 2..."
12716                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12717                                         voidflags=7
12718                                         echo "And it supports 4 but not 8 definitely."
12719                                 else
12720                                         echo "It doesn't support 4..."
12721                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12722                                                 voidflags=11
12723                                                 echo "But it supports 8."
12724                                         else
12725                                                 voidflags=3
12726                                                 echo "Neither does it support 8."
12727                                         fi
12728                                 fi
12729                         else
12730                                 echo "It does not support 2..."
12731                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12732                                         voidflags=13
12733                                         echo "But it supports 4 and 8."
12734                                 else
12735                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12736                                                 voidflags=5
12737                                                 echo "And it supports 4 but has not heard about 8."
12738                                         else
12739                                                 echo "However it supports 8 but not 4."
12740                                         fi
12741                                 fi
12742                         fi
12743                 else
12744                         echo "There is no support at all for void."
12745                         voidflags=0
12746                 fi
12747         fi
12748 esac
12749 case "$voidflags" in
12750 "$defvoidused") ;;
12751 *)      $cat >&4 <<'EOM'
12752   Support flag bits are:
12753     1: basic void declarations.
12754     2: arrays of pointers to functions returning void.
12755     4: operations between pointers to and addresses of void functions.
12756     8: generic void pointers.
12757 EOM
12758         dflt="$voidflags";
12759         rp="Your void support flags add up to what?"
12760         . ./myread
12761         voidflags="$ans"
12762         ;;
12763 esac
12764 $rm -f try.* .out
12765
12766
12767 : How can we generate normalized random numbers ?
12768 echo " "
12769 echo "Looking for a random number function..." >&4
12770 case "$randfunc" in
12771 '')
12772         if set drand48 val -f; eval $csym; $val; then
12773                 dflt="drand48"
12774                 echo "Good, found drand48()." >&4
12775         elif set random val -f; eval $csym; $val; then
12776                 dflt="random"
12777                 echo "OK, found random()." >&4
12778         else
12779                 dflt="rand"
12780                 echo "Yick, looks like I have to use rand()." >&4
12781         fi
12782         echo " "
12783         ;;
12784 *)
12785         dflt="$randfunc"
12786         ;;
12787 esac
12788 cont=true
12789
12790 case "$ccflags" in
12791 *-Dmy_rand=*|*-Dmy_srand=*)
12792         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12793         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12794         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12795         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12796         ;;
12797 esac
12798
12799 while $test "$cont"; do
12800         rp="Use which function to generate random numbers?"
12801         . ./myread
12802         if $test "$ans" = "$dflt"; then
12803                 : null
12804         else
12805                 randbits=''
12806         fi
12807         randfunc="$ans"
12808         if set $ans val -f; eval $csym; $val; then
12809                 cont=''
12810         else
12811                 dflt=y
12812                 rp="I cannot find function $ans. Use that name anyway?"
12813                 . ./myread
12814                 dflt=rand
12815                 case "$ans" in
12816                         [yY]*) cont='';;
12817                 esac
12818         fi
12819         case "$cont" in
12820         '')
12821                 case "$randfunc" in
12822                 drand48)
12823                         drand01="drand48()"
12824                         seedfunc="srand48"
12825                         randbits=48
12826                         randseedtype=long
12827                         ;;
12828                 rand|random)
12829                         case "$randbits" in
12830                         '')
12831 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12832                                 $cat >try.c <<EOCP
12833 #$i_unistd I_UNISTD
12834 #$i_stdlib I_STDLIB
12835 #include <stdio.h>
12836 #ifdef I_UNISTD
12837 #  include <unistd.h>
12838 #endif
12839 #ifdef I_STDLIB
12840 #  include <stdlib.h>
12841 #endif
12842 int main()
12843 {
12844         register int i;
12845         register unsigned long tmp;
12846         register unsigned long max = 0L;
12847
12848         for (i = 1000; i; i--) {
12849                 tmp = (unsigned long) $randfunc();
12850                 if (tmp > max) max = tmp;
12851         }
12852         for (i = 0; max; i++)
12853                 max /= 2;
12854         printf("%d\n",i);
12855 }
12856 EOCP
12857                                 set try
12858                                 if eval $compile_ok; then
12859                                         dflt=`try`
12860                                 else
12861                                         dflt='?'
12862                                         echo "(I can't seem to compile the test program...)"
12863                                 fi
12864                                 ;;
12865                         *)
12866                                 dflt="$randbits"
12867                                 ;;
12868                         esac
12869                         rp="How many bits does your $randfunc() function produce?"
12870                         . ./myread
12871                         randbits="$ans"
12872                         $rm -f try.c try
12873                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12874                         seedfunc="s$randfunc"
12875                         randseedtype=unsigned
12876                         ;;
12877                 *)
12878                         dflt="31"
12879                         rp="How many bits does your $randfunc() function produce?"
12880                         . ./myread
12881                         randbits="$ans"
12882                         seedfunc="s$randfunc"
12883                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12884                         if set $seedfunc val -f; eval $csym; $val; then
12885                                 echo "(Using $seedfunc() to seed random generator)"
12886                         else
12887                                 echo "(Warning: no $seedfunc() to seed random generator)"
12888                                 seedfunc=rand
12889                         fi
12890                         randseedtype=unsigned
12891                         ;;
12892                 esac
12893                 ;;
12894         esac
12895 done
12896
12897 echo " "
12898 echo "Determining whether or not we are on an EBCDIC system..." >&4
12899 $cat >tebcdic.c <<'EOM'
12900 int main()
12901 {
12902   if ('M'==0xd4) return 0;
12903   return 1;
12904 }
12905 EOM
12906
12907 val=$undef
12908 set tebcdic
12909 if eval $compile_ok; then
12910         if ./tebcdic; then
12911                 echo "You seem to speak EBCDIC." >&4
12912                 val="$define"
12913         else
12914                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12915         fi
12916 else
12917         echo "I'm unable to compile the test program." >&4
12918         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12919 fi
12920 $rm -f tebcdic.c tebcdic
12921 set ebcdic
12922 eval $setvar
12923
12924 echo " "
12925 $cat >&4 <<EOM
12926 Checking how to flush all pending stdio output...
12927 EOM
12928 # I only know how to find the first 32 possibly open files on SunOS.
12929 # See also hints/sunos_4_1.sh and util.c  --AD
12930 case "$osname" in
12931 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12932 esac
12933 $cat >>try.c <<EOCP
12934 #include <stdio.h>
12935 #$i_unistd I_UNISTD
12936 #ifdef I_UNISTD
12937 # include <unistd.h>
12938 #endif
12939 #$d_sysconf HAS_SYSCONF
12940 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12941 #ifdef HAS_STDIO_STREAM_ARRAY
12942 # define STDIO_STREAM_ARRAY $stdio_stream_array
12943 #endif
12944 int main() {
12945   FILE* p = fopen("try.out", "w");
12946 #ifdef TRY_FPUTC
12947   fputc('x', p);
12948 #else
12949 # ifdef TRY_FPRINTF
12950   fprintf(p, "x");
12951 # endif
12952 #endif
12953 #ifdef TRY_FFLUSH_NULL
12954   fflush(NULL);
12955 #endif
12956 #ifdef TRY_FFLUSH_ALL
12957   {
12958     long open_max = -1;
12959 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12960     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12961 # else
12962 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12963     open_max = sysconf(_SC_OPEN_MAX);
12964 #  else
12965 #   ifdef FOPEN_MAX
12966     open_max = FOPEN_MAX;
12967 #   else
12968 #    ifdef OPEN_MAX
12969     open_max = OPEN_MAX;
12970 #    else
12971 #     ifdef _NFILE
12972     open_max = _NFILE;
12973 #     endif
12974 #    endif
12975 #   endif
12976 #  endif
12977 # endif 
12978 # ifdef HAS_STDIO_STREAM_ARRAY
12979     if (open_max > 0) {
12980       long i;
12981       for (i = 0; i < open_max; i++)
12982             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12983                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12984                 STDIO_STREAM_ARRAY[i]._flag)
12985                 fflush(&STDIO_STREAM_ARRAY[i]);
12986     }   
12987   }
12988 # endif
12989 #endif
12990   _exit(42);
12991 }
12992 EOCP
12993 : first we have to find out how _not_ to flush
12994 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12995     output=''
12996     set try -DTRY_FPUTC
12997     if eval $compile; then
12998             $rm -f try.out
12999             ./try$exe_ext 2>/dev/null
13000             if $test ! -s try.out -a "X$?" = X42; then
13001                 output=-DTRY_FPUTC
13002             fi
13003     fi
13004     case "$output" in
13005     '')
13006             set try -DTRY_FPRINTF
13007             $rm -f try.out
13008             if eval $compile; then
13009                     $rm -f try.out
13010                     ./try$exe_ext 2>/dev/null
13011                     if $test ! -s try.out -a "X$?" = X42; then
13012                         output=-DTRY_FPRINTF
13013                     fi
13014             fi
13015         ;;
13016     esac
13017 fi
13018 : check for fflush NULL behaviour
13019 case "$fflushNULL" in
13020 '')     set try -DTRY_FFLUSH_NULL $output
13021         if eval $compile; then
13022                 $rm -f try.out
13023                 ./try$exe_ext 2>/dev/null
13024                 code="$?"
13025                 if $test -s try.out -a "X$code" = X42; then
13026                         fflushNULL="`$cat try.out`"
13027                 else
13028                         if $test "X$code" != X42; then
13029                                 $cat >&4 <<EOM
13030 (If this test failed, don't worry, we'll try another method shortly.)
13031 EOM
13032                         fi
13033                 fi
13034         fi
13035         $rm -f core try.core core.try.*
13036         case "$fflushNULL" in
13037         x)      $cat >&4 <<EOM
13038 Your fflush(NULL) works okay for output streams.
13039 Let's see if it clobbers input pipes...
13040 EOM
13041 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13042 # bug that improperly flushes the input end of pipes.  So we avoid the
13043 # autoflush on fork/system/exec support for now. :-(
13044 $cat >tryp.c <<EOCP
13045 #include <stdio.h>
13046 int
13047 main(int argc, char **argv)
13048 {
13049     char buf[1024];
13050     int i;
13051     char *bp = buf;
13052     while (1) {
13053         while ((i = getc(stdin)) != -1
13054                && (*bp++ = i) != '\n'
13055                && bp < &buf[1024])
13056         /* DO NOTHING */ ;
13057         *bp = '\0';
13058         fprintf(stdout, "%s", buf);
13059         fflush(NULL);
13060         if (i == -1)
13061             return 0;
13062         bp = buf;
13063     }
13064 }
13065 EOCP
13066                 fflushNULL="$define"
13067                 set tryp
13068                 if eval $compile; then
13069                     $rm -f tryp.out
13070                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13071                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13072                        $cat >&4 <<EOM
13073 fflush(NULL) seems to behave okay with input streams.
13074 EOM
13075                         fflushNULL="$define"
13076                     else
13077                         $cat >&4 <<EOM
13078 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13079 EOM
13080                         fflushNULL="$undef"
13081                     fi
13082                 fi
13083                 $rm -f core tryp.c tryp.core core.tryp.*
13084                 ;;
13085         '')     $cat >&4 <<EOM
13086 Your fflush(NULL) isn't working (contrary to ANSI C).
13087 EOM
13088                 fflushNULL="$undef"
13089                 ;;
13090         *)      $cat >&4 <<EOM
13091 Cannot figure out whether your fflush(NULL) works or not.
13092 I'm assuming it doesn't (contrary to ANSI C).
13093 EOM
13094                 fflushNULL="$undef"
13095                 ;;
13096         esac
13097         ;;
13098 $define|true|[yY]*)
13099         fflushNULL="$define"
13100         ;;
13101 *)
13102         fflushNULL="$undef"
13103         ;;
13104 esac
13105 : check explicit looping only if NULL did not work, and if the pipe
13106 : bug does not show up on an explicit flush too
13107 case "$fflushNULL" in
13108 "$undef")
13109         $cat >tryp.c <<EOCP
13110 #include <stdio.h>
13111 int
13112 main(int argc, char **argv)
13113 {
13114     char buf[1024];
13115     int i;
13116     char *bp = buf;
13117     while (1) {
13118         while ((i = getc(stdin)) != -1
13119                && (*bp++ = i) != '\n'
13120                && bp < &buf[1024])
13121         /* DO NOTHING */ ;
13122         *bp = '\0';
13123         fprintf(stdout, "%s", buf);
13124         fflush(stdin);
13125         if (i == -1)
13126             return 0;
13127         bp = buf;
13128     }
13129 }
13130 EOCP
13131         set tryp
13132         if eval $compile; then
13133             $rm -f tryp.out
13134             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13135             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13136                $cat >&4 <<EOM
13137 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13138 EOM
13139                 : now check for fflushall behaviour
13140                 case "$fflushall" in
13141                 '')     set try -DTRY_FFLUSH_ALL $output
13142                         if eval $compile; then
13143                                 $cat >&4 <<EOM
13144 (Now testing the other method--but note that this also may fail.)
13145 EOM
13146                                 $rm -f try.out
13147                                 ./try$exe_ext 2>/dev/null
13148                                 if $test -s try.out -a "X$?" = X42; then
13149                                         fflushall="`$cat try.out`"
13150                                 fi
13151                         fi
13152                         $rm -f core try.core core.try.*
13153                         case "$fflushall" in
13154                         x)      $cat >&4 <<EOM
13155 Whew. Flushing explicitly all the stdio streams works.
13156 EOM
13157                                 fflushall="$define"
13158                                 ;;
13159                         '')     $cat >&4 <<EOM
13160 Sigh. Flushing explicitly all the stdio streams doesn't work.
13161 EOM
13162                                 fflushall="$undef"
13163                                 ;;
13164                         *)      $cat >&4 <<EOM
13165 Cannot figure out whether flushing stdio streams explicitly works or not.
13166 I'm assuming it doesn't.
13167 EOM
13168                                 fflushall="$undef"
13169                                 ;;
13170                         esac
13171                         ;;
13172                 "$define"|true|[yY]*)
13173                         fflushall="$define"
13174                         ;;
13175                 *)
13176                         fflushall="$undef"
13177                         ;;
13178                 esac
13179             else
13180                 $cat >&4 <<EOM
13181 All is futile.  Even fflush(stdin) clobbers input pipes!
13182 EOM
13183                 fflushall="$undef"
13184             fi
13185         else
13186             fflushall="$undef"
13187         fi
13188         $rm -f core tryp.c tryp.core core.tryp.*
13189         ;;
13190 *)      fflushall="$undef"
13191         ;;
13192 esac
13193
13194 case "$fflushNULL$fflushall" in
13195 undefundef)
13196         $cat <<EOM
13197 OK, I give up.  I cannot figure out how to flush pending stdio output.
13198 We won't be flushing handles at all before fork/exec/popen.
13199 EOM
13200         ;;
13201 esac
13202 $rm -f try.* try$exe_ext
13203
13204 : Store the full pathname to the ar program for use in the C program
13205 : Respect a hint or command line value for full_ar.
13206 case "$full_ar" in
13207 '') full_ar=$ar ;;
13208 esac
13209
13210 : Store the full pathname to the sed program for use in the C program
13211 full_sed=$sed
13212
13213 : see what type gids are declared as in the kernel
13214 echo " "
13215 echo "Looking for the type for group ids returned by getgid()."
13216 set gid_t gidtype xxx stdio.h sys/types.h
13217 eval $typedef
13218 case "$gidtype" in
13219 xxx)
13220         xxx=`./findhdr sys/user.h`
13221         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13222         case $1 in
13223         unsigned) dflt="$1 $2" ;;
13224         *) dflt="$1" ;;
13225         esac
13226         ;;
13227 *) dflt="$gidtype";;
13228 esac
13229 case "$gidtype" in
13230 gid_t) echo "gid_t found." ;;
13231 *)      rp="What is the type for group ids returned by getgid()?"
13232         . ./myread
13233         gidtype="$ans"
13234         ;;
13235 esac
13236
13237 echo " "
13238 case "$gidtype" in
13239 *_t) zzz="$gidtype"     ;;
13240 *)   zzz="gid"          ;;
13241 esac
13242 echo "Checking the size of $zzz..." >&4 
13243 cat > try.c <<EOCP
13244 #include <sys/types.h>
13245 #include <stdio.h>
13246 int main() {
13247     printf("%d\n", (int)sizeof($gidtype));
13248     exit(0);
13249 }
13250 EOCP
13251 set try
13252 if eval $compile_ok; then
13253         yyy=`./try`
13254         case "$yyy" in
13255         '')     gidsize=4
13256                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13257                 ;;
13258         *)      gidsize=$yyy
13259                 echo "Your $zzz is $gidsize bytes long."
13260                 ;;
13261         esac
13262 else
13263         gidsize=4
13264         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13265 fi
13266
13267
13268 echo " "
13269 case "$gidtype" in
13270 *_t) zzz="$gidtype"     ;;
13271 *)   zzz="gid"          ;;
13272 esac
13273 echo "Checking the sign of $zzz..." >&4 
13274 cat > try.c <<EOCP
13275 #include <sys/types.h>
13276 #include <stdio.h>
13277 int main() {
13278         $gidtype foo = -1;
13279         if (foo < 0)
13280                 printf("-1\n");
13281         else
13282                 printf("1\n");
13283 }
13284 EOCP
13285 set try
13286 if eval $compile; then
13287         yyy=`./try`
13288         case "$yyy" in
13289         '')     gidsign=1
13290                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13291                 ;;
13292         *)      gidsign=$yyy
13293                 case "$gidsign" in
13294                  1) echo "Your $zzz is unsigned." ;;
13295                 -1) echo "Your $zzz is signed."   ;;
13296                 esac
13297                 ;;
13298         esac
13299 else
13300         gidsign=1
13301         echo "(I can't compile the test program--guessing unsigned.)" >&4
13302 fi
13303
13304
13305 echo " "
13306
13307 if $test X"$quadtype" != X; then
13308
13309 echo "Checking how to print 64-bit integers..." >&4
13310
13311 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13312         $cat >try.c <<'EOCP'
13313 #include <sys/types.h>
13314 #include <stdio.h>
13315 int main() {
13316   int q = 12345678901;
13317   printf("%ld\n", q);
13318 }
13319 EOCP
13320         set try
13321         if eval $compile; then
13322                 yyy=`./try$exe_ext`
13323                 case "$yyy" in
13324                 12345678901)
13325                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13326                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13327                         echo "We will use %d."
13328                         ;;
13329                 esac
13330         fi
13331 fi
13332
13333 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13334         $cat >try.c <<'EOCP'
13335 #include <sys/types.h>
13336 #include <stdio.h>
13337 int main() {
13338   long q = 12345678901;
13339   printf("%ld\n", q);
13340 }
13341 EOCP
13342         set try
13343         if eval $compile; then
13344                 yyy=`./try$exe_ext`
13345                 case "$yyy" in
13346                 12345678901)
13347                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13348                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13349                         echo "We will use %ld."
13350                         ;;
13351                 esac
13352         fi
13353 fi
13354
13355 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13356         $cat >try.c <<'EOCP'
13357 #include <sys/types.h>
13358 #include <inttypes.h>
13359 #include <stdio.h>
13360 int main() {
13361   int64_t q = 12345678901;
13362   printf("%" PRId64 "\n", q);
13363 }
13364 EOCP
13365         set try
13366         if eval $compile; then
13367                 yyy=`./try$exe_ext`
13368                 case "$yyy" in
13369                 12345678901)
13370                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13371                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13372                         echo "We will use the C9X style."
13373                         ;;
13374                 esac
13375         fi
13376 fi
13377
13378 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13379         $cat >try.c <<'EOCP'
13380 #include <sys/types.h>
13381 #include <stdio.h>
13382 int main() {
13383   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13384   printf("%lld\n", q);
13385 }
13386 EOCP
13387         set try
13388         if eval $compile; then
13389                 yyy=`./try$exe_ext`
13390                 case "$yyy" in
13391                 12345678901)
13392                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13393                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13394                         echo "We will use the %lld style."
13395                         ;;
13396                 esac
13397         fi
13398 fi
13399
13400 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13401         $cat >try.c <<EOCP
13402 #include <sys/types.h>
13403 #include <stdio.h>
13404 int main() {
13405   $quadtype q = 12345678901;
13406   printf("%Ld\n", q);
13407 }
13408 EOCP
13409         set try
13410         if eval $compile; then
13411                 yyy=`./try$exe_ext`
13412                 case "$yyy" in
13413                 12345678901)
13414                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13415                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13416                         echo "We will use %Ld."
13417                         ;;
13418                 esac
13419         fi
13420 fi
13421
13422 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13423         $cat >try.c <<EOCP
13424 #include <sys/types.h>
13425 #include <stdio.h>
13426 int main() {
13427   $quadtype q = 12345678901;
13428   printf("%qd\n", q);
13429 }
13430 EOCP
13431         set try
13432         if eval $compile; then
13433                 yyy=`./try$exe_ext`
13434                 case "$yyy" in
13435                 12345678901)
13436                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13437                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13438                         echo "We will use %qd."
13439                         ;;
13440                 esac
13441         fi
13442 fi
13443
13444 if $test X"$sPRId64" = X; then
13445         echo "Cannot figure out how to print 64-bit integers." >&4
13446 fi
13447
13448 $rm -f try try.*
13449
13450 fi
13451
13452 case "$sPRId64" in
13453 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13454         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13455         ;;
13456 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13457         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13458         ;;
13459 esac
13460
13461
13462 echo " "
13463 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13464
13465 if $test X"$ivsize" = X8; then
13466         ivdformat="$sPRId64"
13467         uvuformat="$sPRIu64"
13468         uvoformat="$sPRIo64"
13469         uvxformat="$sPRIx64"
13470         uvXUformat="$sPRIXU64"
13471 else
13472         if $test X"$ivsize" = X"$longsize"; then
13473                 ivdformat='"ld"'
13474                 uvuformat='"lu"'
13475                 uvoformat='"lo"'
13476                 uvxformat='"lx"'
13477                 uvXUformat='"lX"'
13478         else
13479                 if $test X"$ivsize" = X"$intsize"; then
13480                         ivdformat='"d"'
13481                         uvuformat='"u"'
13482                         uvoformat='"o"'
13483                         uvxformat='"x"'
13484                         uvXUformat='"X"'
13485                 else
13486                         : far out
13487                         if $test X"$ivsize" = X"$shortsize"; then
13488                                 ivdformat='"hd"'
13489                                 uvuformat='"hu"'
13490                                 uvoformat='"ho"'
13491                                 uvxformat='"hx"'
13492                                 uvXUformat='"hX"'
13493                         fi
13494                 fi
13495         fi
13496 fi
13497
13498 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13499         nveformat="$sPRIeldbl"
13500         nvfformat="$sPRIfldbl"
13501         nvgformat="$sPRIgldbl"
13502         nvEUformat="$sPRIEUldbl"
13503         nvFUformat="$sPRIFUldbl"
13504         nvGUformat="$sPRIGUldbl"
13505 else
13506         nveformat='"e"'
13507         nvfformat='"f"'
13508         nvgformat='"g"'
13509         nvEUformat='"E"'
13510         nvFUformat='"F"'
13511         nvGUformat='"G"'
13512 fi
13513
13514 case "$ivdformat" in
13515 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13516     exit 1
13517     ;;
13518 esac
13519
13520
13521 echo " "
13522 $echo "Checking the format string to be used for gids..." >&4
13523
13524 case "$gidsign" in
13525 -1)     if $test X"$gidsize" = X"$ivsize"; then
13526                 gidformat="$ivdformat"
13527         else
13528                 if $test X"$gidsize" = X"$longsize"; then
13529                         gidformat='"ld"'
13530                 else
13531                         if $test X"$gidsize" = X"$intsize"; then
13532                                 gidformat='"d"'
13533                         else
13534                                 if $test X"$gidsize" = X"$shortsize"; then
13535                                         gidformat='"hd"'
13536                                 fi
13537                         fi
13538                 fi
13539         fi
13540         ;;
13541 *)      if $test X"$gidsize" = X"$uvsize"; then
13542                 gidformat="$uvuformat"
13543         else
13544                 if $test X"$gidsize" = X"$longsize"; then
13545                         gidformat='"lu"'
13546                 else
13547                         if $test X"$gidsize" = X"$intsize"; then
13548                                 gidformat='"u"'
13549                         else
13550                                 if $test X"$gidsize" = X"$shortsize"; then
13551                                         gidformat='"hu"'
13552                                 fi
13553                         fi
13554                 fi
13555         fi
13556         ;;
13557 esac
13558
13559 : see if getgroups exists
13560 set getgroups d_getgrps
13561 eval $inlibc
13562
13563 : see if setgroups exists
13564 set setgroups d_setgrps
13565 eval $inlibc
13566
13567
13568 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13569 echo " "
13570 case "$d_getgrps$d_setgrps" in
13571 *define*)
13572         case "$groupstype" in
13573         '') dflt="$gidtype" ;;
13574         *)  dflt="$groupstype" ;;
13575         esac
13576         $cat <<EOM
13577 What type of pointer is the second argument to getgroups() and setgroups()?
13578 Usually this is the same as group ids, $gidtype, but not always.
13579
13580 EOM
13581         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13582         . ./myread
13583         groupstype="$ans"
13584         ;;
13585 *)  groupstype="$gidtype";;
13586 esac
13587
13588 echo " "
13589 echo "Checking if your $make program sets \$(MAKE)..." >&4
13590 case "$make_set_make" in
13591 '')
13592         $sed 's/^X //' > testmake.mak << 'EOF'
13593 Xall:
13594 X       @echo 'maketemp="$(MAKE)"'
13595 EOF
13596         case "`$make -f testmake.mak 2>/dev/null`" in
13597         *maketemp=*) make_set_make='#' ;;
13598         *)      make_set_make="MAKE=$make" ;;
13599         esac
13600         $rm -f testmake.mak
13601         ;;
13602 esac
13603 case "$make_set_make" in
13604 '#') echo "Yup, it does.";;
13605 *) echo "Nope, it doesn't.";;
13606 esac
13607
13608 : see what type is used for mode_t
13609 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13610 set mode_t modetype int stdio.h sys/types.h
13611 eval $typedef_ask
13612
13613 : see if stdarg is available
13614 echo " "
13615 if $test `./findhdr stdarg.h`; then
13616         echo "<stdarg.h> found." >&4
13617         valstd="$define"
13618 else
13619         echo "<stdarg.h> NOT found." >&4
13620         valstd="$undef"
13621 fi
13622
13623 : see if varags is available
13624 echo " "
13625 if $test `./findhdr varargs.h`; then
13626         echo "<varargs.h> found." >&4
13627 else
13628         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13629 fi
13630
13631 : set up the varargs testing programs
13632 $cat > varargs.c <<EOP
13633 #ifdef I_STDARG
13634 #include <stdarg.h>
13635 #endif
13636 #ifdef I_VARARGS
13637 #include <varargs.h>
13638 #endif
13639
13640 #ifdef I_STDARG
13641 int f(char *p, ...)
13642 #else
13643 int f(va_alist)
13644 va_dcl
13645 #endif
13646 {
13647         va_list ap;
13648 #ifndef I_STDARG
13649         char *p;
13650 #endif
13651 #ifdef I_STDARG
13652         va_start(ap,p);
13653 #else
13654         va_start(ap);
13655         p = va_arg(ap, char *);
13656 #endif
13657         va_end(ap);
13658 }
13659 EOP
13660 $cat > varargs <<EOP
13661 $startsh
13662 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13663         echo "true"
13664 else
13665         echo "false"
13666 fi
13667 $rm -f varargs$_o
13668 EOP
13669 chmod +x varargs
13670
13671 : now check which varargs header should be included
13672 echo " "
13673 i_varhdr=''
13674 case "$valstd" in
13675 "$define")
13676         if `./varargs I_STDARG`; then
13677                 val='stdarg.h'
13678         elif `./varargs I_VARARGS`; then
13679                 val='varargs.h'
13680         fi
13681         ;;
13682 *)
13683         if `./varargs I_VARARGS`; then
13684                 val='varargs.h'
13685         fi
13686         ;;
13687 esac
13688 case "$val" in
13689 '')
13690 echo "I could not find the definition for va_dcl... You have problems..." >&4
13691         val="$undef"; set i_stdarg; eval $setvar
13692         val="$undef"; set i_varargs; eval $setvar
13693         ;;
13694 *) 
13695         set i_varhdr
13696         eval $setvar
13697         case "$i_varhdr" in
13698         stdarg.h)
13699                 val="$define"; set i_stdarg; eval $setvar
13700                 val="$undef"; set i_varargs; eval $setvar
13701                 ;;
13702         varargs.h)
13703                 val="$undef"; set i_stdarg; eval $setvar
13704                 val="$define"; set i_varargs; eval $setvar
13705                 ;;
13706         esac
13707         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13708 esac
13709 $rm -f varargs*
13710
13711 : see if we need va_copy
13712 echo " "
13713 case "$i_stdarg" in
13714 "$define")
13715         $cat >try.c <<EOCP
13716 #include <stdarg.h>
13717 #include <stdio.h>
13718 #$i_stdlib I_STDLIB
13719 #ifdef I_STDLIB
13720 #include <stdlib.h>
13721 #endif
13722 #include <signal.h>
13723
13724 int
13725 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13726 {
13727   return vfprintf(f, fmt, *valp);
13728 }
13729  
13730 int    
13731 myvfprintf(FILE *f, const  char *fmt, va_list val)
13732 {
13733   return ivfprintf(f, fmt, &val);
13734 }
13735       
13736 int
13737 myprintf(char *fmt, ...) 
13738 {
13739   va_list val;
13740   va_start(val, fmt);
13741   return myvfprintf(stdout, fmt, val); 
13742 }         
13743
13744 int
13745 main(int ac, char **av)
13746 {
13747   signal(SIGSEGV, exit);
13748
13749   myprintf("%s%cs all right, then\n", "that", '\'');                            
13750   exit(0);      
13751 }
13752 EOCP
13753         set try
13754         if eval $compile && ./try 2>&1 >/dev/null; then
13755                 case "`./try`" in
13756                 "that's all right, then")
13757                         okay=yes
13758                         ;;
13759                 esac
13760         fi
13761         case "$okay" in
13762         yes)    echo "It seems that you don't need va_copy()." >&4
13763                 need_va_copy="$undef"
13764                 ;;
13765         *)      echo "It seems that va_copy() or similar will be needed." >&4
13766                 need_va_copy="$define"
13767                 ;;
13768         esac
13769         $rm -f try.* core core.* *.core *.core.*
13770         ;;
13771 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13772         ;;
13773 esac
13774
13775 : define a fucntion to check prototypes
13776 $cat > protochk <<EOSH
13777 $startsh
13778 cc="$cc"
13779 optimize="$optimize"
13780 ccflags="$ccflags"
13781 prototype="$prototype"
13782 define="$define"
13783 rm=$rm
13784 EOSH
13785
13786 $cat >> protochk <<'EOSH'
13787
13788 $rm -f try.c
13789 foo="$1"
13790 shift
13791 while test $# -ge 2; do
13792         case "$1" in
13793                 $define) echo "#include <$2>" >> try.c ;;
13794                 literal) echo "$2" >> try.c ;;
13795         esac
13796     shift 2
13797 done
13798 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13799 cat >> try.c <<'EOCP'
13800 #ifdef CAN_PROTOTYPE
13801 #define _(args) args
13802 #else
13803 #define _(args) ()
13804 #endif
13805 EOCP
13806 echo "$foo" >> try.c
13807 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13808 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13809 status=$?
13810 $rm -f try.[co]
13811 exit $status
13812 EOSH
13813 chmod +x protochk
13814 $eunicefix protochk
13815
13816 : see what type is used for size_t
13817 rp="What is the type used for the length parameter for string functions?"
13818 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13819 eval $typedef_ask
13820
13821 : check for type of arguments to gethostbyaddr. 
13822 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13823         case "$d_gethbyaddr" in
13824         $define)
13825                 $cat <<EOM
13826
13827 Checking to see what type of arguments are accepted by gethostbyaddr().
13828 EOM
13829                 hdrs="$define sys/types.h
13830                         $d_socket sys/socket.h 
13831                         $i_niin netinet/in.h 
13832                         $i_netdb netdb.h
13833                         $i_unistd unistd.h"
13834                 : The first arg can 'char *' or 'void *'
13835                 : The second arg is some of integral type
13836                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13837                         for yyy in size_t long int; do
13838                                 case "$netdb_host_type" in
13839                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13840                                         if ./protochk "$try" $hdrs; then
13841                                                 echo "Your system accepts $xxx for the first arg."
13842                                                 echo "...and $yyy for the second arg."
13843                                                 netdb_host_type="$xxx"
13844                                                 netdb_hlen_type="$yyy"
13845                                         fi
13846                                         ;;
13847                                 esac
13848                         done
13849                 done
13850                 : In case none of those worked, prompt the user.
13851                 case "$netdb_host_type" in
13852                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13853                         dflt='char *'
13854                         . ./myread
13855                         netdb_host_type=$ans
13856                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13857                         dflt="$sizetype"
13858                         . ./myread
13859                         netdb_hlen_type=$ans
13860                         ;;
13861                 esac
13862                 ;;
13863         *)      : no gethostbyaddr, so pick harmless defaults
13864                 netdb_host_type='char *'
13865                 netdb_hlen_type="$sizetype"
13866                 ;;
13867         esac
13868         # Remove the "const" if needed. -- but then we'll have a 
13869         # prototype clash!
13870         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13871 fi
13872
13873 : check for type of argument to gethostbyname. 
13874 if test "X$netdb_name_type" = X ; then
13875         case "$d_gethbyname" in
13876         $define)
13877                 $cat <<EOM
13878
13879 Checking to see what type of argument is accepted by gethostbyname().
13880 EOM
13881                 hdrs="$define sys/types.h
13882                         $d_socket sys/socket.h 
13883                         $i_niin netinet/in.h 
13884                         $i_netdb netdb.h
13885                         $i_unistd unistd.h"
13886                 for xxx in "const char *" "char *"; do
13887                         case "$netdb_name_type" in
13888                         '')     try="extern struct hostent *gethostbyname($xxx);"
13889                                 if ./protochk "$try" $hdrs; then
13890                                         echo "Your system accepts $xxx."
13891                                         netdb_name_type="$xxx"
13892                                 fi
13893                                 ;;
13894                         esac
13895                 done
13896                 : In case none of those worked, prompt the user.
13897                 case "$netdb_name_type" in
13898                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13899                         dflt='char *'
13900                         . ./myread
13901                         netdb_name_type=$ans
13902                         ;;
13903                 esac
13904                 ;;
13905         *)      : no gethostbyname, so pick harmless default
13906                 netdb_name_type='char *'
13907                 ;;
13908         esac
13909 fi
13910
13911 : check for type of 1st argument to getnetbyaddr. 
13912 if test "X$netdb_net_type" = X ; then
13913         case "$d_getnbyaddr" in
13914         $define)
13915                 $cat <<EOM
13916
13917 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13918 EOM
13919                 hdrs="$define sys/types.h
13920                         $d_socket sys/socket.h 
13921                         $i_niin netinet/in.h 
13922                         $i_netdb netdb.h
13923                         $i_unistd unistd.h"
13924                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13925                         case "$netdb_net_type" in
13926                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13927                                 if ./protochk "$try" $hdrs; then
13928                                         echo "Your system accepts $xxx."
13929                                         netdb_net_type="$xxx"
13930                                 fi
13931                                 ;;
13932                         esac
13933                 done
13934                 : In case none of those worked, prompt the user.
13935                 case "$netdb_net_type" in
13936                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13937                         dflt='long'
13938                         . ./myread
13939                         netdb_net_type=$ans
13940                         ;;
13941                 esac
13942                 ;;
13943         *)      : no getnetbyaddr, so pick harmless default
13944                 netdb_net_type='long'
13945                 ;;
13946         esac
13947 fi
13948 : locate the preferred pager for this system
13949 case "$pager" in
13950 '')
13951         dflt=''
13952         case "$pg" in
13953         /*) dflt=$pg;;
13954         [a-zA-Z]:/*) dflt=$pg;;
13955         esac
13956         case "$more" in
13957         /*) dflt=$more;;
13958         [a-zA-Z]:/*) dflt=$more;;
13959         esac
13960         case "$less" in
13961         /*) dflt=$less;;
13962         [a-zA-Z]:/*) dflt=$less;;
13963         esac
13964         case "$dflt" in
13965         '') dflt=/usr/ucb/more;;
13966         esac
13967         ;;
13968 *) dflt="$pager";;
13969 esac
13970 echo " "
13971 fn=f/
13972 rp='What pager is used on your system?'
13973 . ./getfile
13974 pager="$ans"
13975
13976 : see what type pids are declared as in the kernel
13977 rp="What is the type of process ids on this system?"
13978 set pid_t pidtype int stdio.h sys/types.h
13979 eval $typedef_ask
13980
13981 : Find earliest binary compatible site_perl subdirectory perl can use.
13982 case "$bincompat5005" in
13983 "$define") xs_apiversion='5.005' ;;
13984 *) xs_apiversion=$version ;;   # The current site_perl version.
13985 esac
13986 : Find earliest pure perl site_perl subdirectory perl can use.
13987 : The versioned directories started at 5.005.
13988 pm_apiversion='5.005'
13989
13990 : check for length of pointer
13991 echo " "
13992 case "$ptrsize" in
13993 '')
13994         echo "Checking to see how big your pointers are..." >&4
13995         if test "$voidflags" -gt 7; then
13996                 echo '#define VOID_PTR char *' > try.c
13997         else
13998                 echo '#define VOID_PTR void *' > try.c
13999         fi
14000         $cat >>try.c <<'EOCP'
14001 #include <stdio.h>
14002 int main()
14003 {
14004     printf("%d\n", (int)sizeof(VOID_PTR));
14005     exit(0);
14006 }
14007 EOCP
14008         set try
14009         if eval $compile_ok; then
14010                 ptrsize=`./try`
14011                 echo "Your pointers are $ptrsize bytes long."
14012         else
14013                 dflt='4'
14014                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14015                 rp="What is the size of a pointer (in bytes)?"
14016                 . ./myread
14017                 ptrsize="$ans"
14018         fi
14019         ;;
14020 esac
14021 $rm -f try.c try
14022
14023 : see if ar generates random libraries by itself
14024 echo " "
14025 echo "Checking how to generate random libraries on your machine..." >&4
14026 echo 'int bar1() { return bar2(); }' > bar1.c
14027 echo 'int bar2() { return 2; }' > bar2.c
14028 $cat > foo.c <<'EOP'
14029 int main() { printf("%d\n", bar1()); exit(0); }
14030 EOP
14031 $cc $ccflags -c bar1.c >/dev/null 2>&1
14032 $cc $ccflags -c bar2.c >/dev/null 2>&1
14033 $cc $ccflags -c foo.c >/dev/null 2>&1
14034 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14035 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14036         ./foobar >/dev/null 2>&1; then
14037         echo "$ar appears to generate random libraries itself."
14038         orderlib=false
14039         ranlib=":"
14040 elif $ar ts bar$_a >/dev/null 2>&1 &&
14041         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14042         ./foobar >/dev/null 2>&1; then
14043                 echo "a table of contents needs to be added with '$ar ts'."
14044                 orderlib=false
14045                 ranlib="$ar ts"
14046 else
14047         case "$ranlib" in
14048         :) ranlib='';;
14049         '')
14050                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14051                 $test -f $ranlib || ranlib=''
14052                 ;;
14053         esac
14054         if $test -n "$ranlib"; then
14055                 echo "your system has '$ranlib'; we'll use that."
14056                 orderlib=false
14057         else
14058                 echo "your system doesn't seem to support random libraries"
14059                 echo "so we'll use lorder and tsort to order the libraries."
14060                 orderlib=true
14061                 ranlib=":"
14062         fi
14063 fi
14064 $rm -f foo* bar* 
14065
14066 : check for type of arguments to select. 
14067 case "$selecttype" in
14068 '') case "$d_select" in
14069         $define)
14070                 echo " "
14071                 $cat <<EOM
14072 Checking to see what type of arguments are accepted by select().
14073 EOM
14074                 hdrs="$define sys/types.h
14075                         $i_systime sys/time.h 
14076                         $i_sysselct sys/select.h
14077                         $d_socket sys/socket.h"
14078                 : The first arg can be int, unsigned, or size_t
14079                 : The last arg may or may not be 'const'
14080                 val=''
14081                 : void pointer has been seen but using that
14082                 : breaks the selectminbits test
14083                 for xxx in 'fd_set *' 'int *'; do
14084                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14085                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14086                                         case "$val" in
14087                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14088                                                 if ./protochk "$try" $hdrs; then
14089                                                         echo "Your system accepts $xxx."
14090                                                         val="$xxx"
14091                                                 fi
14092                                                 ;;
14093                                         esac
14094                                 done
14095                         done
14096                 done
14097                 case "$val" in
14098                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14099                         case "$d_fd_set" in
14100                                 $define) dflt="fd_set *" ;;
14101                                 *)              dflt="int *" ;;
14102                         esac
14103                         . ./myread
14104                         val=$ans
14105                         ;;
14106                 esac
14107                 selecttype="$val"
14108                 ;;
14109         *)      : no select, so pick a harmless default
14110                 selecttype='int *'
14111                 ;;
14112         esac
14113         ;;
14114 esac
14115
14116 : check for the select 'width'
14117 case "$selectminbits" in
14118 '') case "$d_select" in
14119         $define)
14120                 $cat <<EOM
14121
14122 Checking to see on how many bits at a time your select() operates...
14123 EOM
14124                 $cat >try.c <<EOCP
14125 #include <sys/types.h>
14126 #$i_time I_TIME
14127 #$i_systime I_SYS_TIME
14128 #$i_systimek I_SYS_TIME_KERNEL
14129 #ifdef I_TIME
14130 #   include <time.h>
14131 #endif
14132 #ifdef I_SYS_TIME
14133 #   ifdef I_SYS_TIME_KERNEL
14134 #       define KERNEL
14135 #   endif
14136 #   include <sys/time.h>
14137 #   ifdef I_SYS_TIME_KERNEL
14138 #       undef KERNEL
14139 #   endif
14140 #endif
14141 #$i_sysselct I_SYS_SELECT
14142 #ifdef I_SYS_SELECT
14143 #include <sys/select.h>
14144 #endif
14145 #$d_socket HAS_SOCKET
14146 #ifdef HAS_SOCKET
14147 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14148 #endif
14149 #include <stdio.h>
14150 $selecttype b;
14151 #define S sizeof(*(b))
14152 #define MINBITS 64
14153 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14154 #define NBITS  (NBYTES * 8)
14155 int main() {
14156     char s[NBYTES];
14157     struct timeval t;
14158     int i;
14159     FILE* fp;
14160     int fd;
14161
14162     fclose(stdin);
14163     fp = fopen("try.c", "r");
14164     if (fp == 0)
14165       exit(1);
14166     fd = fileno(fp);
14167     if (fd < 0)
14168       exit(2);
14169     b = ($selecttype)s;
14170     for (i = 0; i < NBITS; i++)
14171         FD_SET(i, b);
14172     t.tv_sec  = 0;
14173     t.tv_usec = 0;
14174     select(fd + 1, b, 0, 0, &t);
14175     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14176     printf("%d\n", i + 1);
14177     return 0;
14178 }
14179 EOCP
14180                 set try
14181                 if eval $compile_ok; then
14182                         selectminbits=`./try`
14183                         case "$selectminbits" in
14184                         '')     cat >&4 <<EOM
14185 Cannot figure out on how many bits at a time your select() operates.
14186 I'll play safe and guess it is 32 bits.
14187 EOM
14188                                 selectminbits=32
14189                                 bits="32 bits"
14190                                 ;;
14191                         1)      bits="1 bit" ;;
14192                         *)      bits="$selectminbits bits" ;;
14193                         esac
14194                         echo "Your select() operates on $bits at a time." >&4
14195                 else
14196                         rp='What is the minimum number of bits your select() operates on?'
14197                         case "$byteorder" in
14198                         1234|12345678)  dflt=32 ;;
14199                         *)              dflt=1  ;;
14200                         esac
14201                         . ./myread
14202                         val=$ans
14203                         selectminbits="$val"
14204                 fi
14205                 $rm -f try.* try
14206                 ;;
14207         *)      : no select, so pick a harmless default
14208                 selectminbits='32'
14209                 ;;
14210         esac
14211         ;;
14212 esac
14213
14214 : Trace out the files included by signal.h, then look for SIGxxx names.
14215 : Remove SIGARRAYSIZE used by HPUX.
14216 : Remove SIGSTKSIZE used by Linux.
14217 : Remove SIGSTKSZ used by Posix.
14218 : Remove SIGTYP void lines used by OS2.
14219 : Some cpps, like os390, dont give the file name anywhere
14220 if [ "X$fieldn" = X ]; then
14221         : Just make some guesses.  We check them later.
14222         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14223 else
14224         xxx=`echo '#include <signal.h>' |
14225         $cppstdin $cppminus $cppflags 2>/dev/null |
14226         $grep '^[       ]*#.*include' | 
14227         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14228 fi
14229 : Check this list of files to be sure we have parsed the cpp output ok.
14230 : This will also avoid potentially non-existent files, such 
14231 : as ../foo/bar.h
14232 xxxfiles=''
14233 for xx in $xxx /dev/null ; do
14234         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14235 done
14236 : If we have found no files, at least try signal.h
14237 case "$xxxfiles" in
14238 '')     xxxfiles=`./findhdr signal.h` ;;
14239 esac
14240 xxx=`awk '
14241 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14242         print substr($2, 4, 20)
14243 }
14244 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14245         print substr($3, 4, 20)
14246 }' $xxxfiles`
14247 : Append some common names just in case the awk scan failed.
14248 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14249 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14250 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14251 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14252 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14253
14254 : generate a few handy files for later
14255 $cat > signal.c <<'EOCP'
14256 #include <sys/types.h>
14257 #include <signal.h>
14258 #include <stdio.h>
14259 int main() {
14260
14261 /* Strange style to avoid deeply-nested #if/#else/#endif */
14262 #ifndef NSIG
14263 #  ifdef _NSIG
14264 #    define NSIG (_NSIG)
14265 #  endif
14266 #endif
14267
14268 #ifndef NSIG
14269 #  ifdef SIGMAX
14270 #    define NSIG (SIGMAX+1)
14271 #  endif
14272 #endif
14273
14274 #ifndef NSIG
14275 #  ifdef SIG_MAX
14276 #    define NSIG (SIG_MAX+1)
14277 #  endif
14278 #endif
14279
14280 #ifndef NSIG
14281 #  ifdef MAXSIG
14282 #    define NSIG (MAXSIG+1)
14283 #  endif
14284 #endif
14285
14286 #ifndef NSIG
14287 #  ifdef MAX_SIG
14288 #    define NSIG (MAX_SIG+1)
14289 #  endif
14290 #endif
14291
14292 #ifndef NSIG
14293 #  ifdef SIGARRAYSIZE
14294 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14295 #  endif
14296 #endif
14297
14298 #ifndef NSIG
14299 #  ifdef _sys_nsig
14300 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14301 #  endif
14302 #endif
14303
14304 /* Default to some arbitrary number that's big enough to get most
14305    of the common signals.
14306 */
14307 #ifndef NSIG
14308 #    define NSIG 50
14309 #endif
14310
14311 printf("NSIG %d\n", NSIG);
14312
14313 #ifndef JUST_NSIG
14314
14315 EOCP
14316
14317 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14318 {
14319         printf "#ifdef SIG"; printf $1; printf "\n"
14320         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14321         printf $1; printf ");\n"
14322         printf "#endif\n"
14323 }
14324 END {
14325         printf "#endif /* JUST_NSIG */\n";
14326         printf "exit(0);\n}\n";
14327 }
14328 ' >>signal.c
14329 $cat >signal.awk <<'EOP'
14330 BEGIN { ndups = 0 }
14331 $1 ~ /^NSIG$/ { nsig = $2 }
14332 ($1 !~ /^NSIG$/) && (NF == 2) {
14333     if ($2 > maxsig) { maxsig = $2 }
14334     if (sig_name[$2]) {
14335         dup_name[ndups] = $1
14336         dup_num[ndups] = $2
14337         ndups++ 
14338     }
14339     else {
14340         sig_name[$2] = $1
14341         sig_num[$2] = $2
14342     }
14343 }
14344 END { 
14345     if (nsig == 0) {
14346         nsig = maxsig + 1
14347     }
14348     printf("NSIG %d\n", nsig);
14349     for (n = 1; n < nsig; n++) {
14350         if (sig_name[n]) {
14351             printf("%s %d\n", sig_name[n], sig_num[n])
14352         }
14353         else {
14354             printf("NUM%d %d\n", n, n) 
14355         }
14356     }
14357     for (n = 0; n < ndups; n++) {
14358         printf("%s %d\n", dup_name[n], dup_num[n])
14359     }
14360 }
14361 EOP
14362 $cat >signal_cmd <<EOS
14363 $startsh
14364 if $test -s signal.lst; then
14365     echo "Using your existing signal.lst file"
14366         exit 0
14367 fi
14368 xxx="$xxx"
14369 EOS
14370 $cat >>signal_cmd <<'EOS'
14371
14372 set signal
14373 if eval $compile_ok; then
14374         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14375 else
14376         echo "(I can't seem be able to compile the whole test program)" >&4
14377         echo "(I'll try it in little pieces.)" >&4
14378         set signal -DJUST_NSIG
14379         if eval $compile_ok; then
14380                 ./signal$_exe > signal.nsg
14381                 $cat signal.nsg
14382         else
14383                 echo "I can't seem to figure out how many signals you have." >&4
14384                 echo "Guessing 50." >&4
14385                 echo 'NSIG 50' > signal.nsg
14386         fi
14387         : Now look at all the signal names, one at a time.
14388         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14389                 $cat > signal.c <<EOCP
14390 #include <sys/types.h>
14391 #include <signal.h>
14392 #include <stdio.h>
14393 int main() {
14394 printf("$xx %d\n", SIG${xx});
14395 return 0;
14396 }
14397 EOCP
14398                 set signal
14399                 if eval $compile; then
14400                         echo "SIG${xx} found."
14401                         ./signal$_exe  >> signal.ls1
14402                 else
14403                         echo "SIG${xx} NOT found."
14404                 fi
14405         done
14406         if $test -s signal.ls1; then
14407                 $cat signal.nsg signal.ls1 |
14408                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14409         fi
14410
14411 fi
14412 if $test -s signal.lst; then
14413         :
14414 else
14415         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14416         echo 'kill -l' >signal
14417         set X `csh -f <signal`
14418         $rm -f signal
14419         shift
14420         case $# in
14421         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14422         esac
14423         echo $@ | $tr ' ' $trnl | \
14424             $awk '{ printf "%s %d\n", $1, ++s; }
14425                   END { printf "NSIG %d\n", ++s }' >signal.lst
14426 fi
14427 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14428 EOS
14429 chmod a+x signal_cmd
14430 $eunicefix signal_cmd
14431
14432 : generate list of signal names
14433 echo " "
14434 case "$sig_name_init" in
14435 '') doinit=yes ;;
14436 *)  case "$sig_num_init" in
14437     ''|*,*) doinit=yes ;;
14438     esac ;;
14439 esac
14440 case "$doinit" in
14441 yes)
14442         echo "Generating a list of signal names and numbers..." >&4
14443         . ./signal_cmd
14444         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14445         sig_name=`$awk 'BEGIN { printf "ZERO " }
14446                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14447         sig_num=`$awk  'BEGIN { printf "0 " }
14448                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14449         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14450                              !/^NSIG/   { printf "\"%s\", ", $1 }
14451                              END        { printf "0\n" }' signal.lst`
14452         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14453                              !/^NSIG/   { printf "%d, ", $2}
14454                              END        { printf "0\n"}' signal.lst`
14455         ;;
14456 esac
14457 echo "The following $sig_count signals are available:"
14458 echo " "
14459 echo $sig_name | $awk \
14460 'BEGIN { linelen = 0 }
14461 {
14462         for (i = 1; i <= NF; i++) {
14463                 name = "SIG" $i " "
14464                 linelen = linelen + length(name)
14465                 if (linelen > 70) {
14466                         printf "\n"
14467                         linelen = length(name)
14468                 }
14469                 printf "%s", name
14470         }
14471         printf "\n"
14472 }'
14473 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14474
14475 echo " "
14476 case "$sizetype" in
14477 *_t) zzz="$sizetype"    ;;
14478 *)   zzz="filesize"     ;;
14479 esac
14480 echo "Checking the size of $zzz..." >&4 
14481 cat > try.c <<EOCP
14482 #include <sys/types.h>
14483 #include <stdio.h>
14484 int main() {
14485     printf("%d\n", (int)sizeof($sizetype));
14486     exit(0);
14487 }
14488 EOCP
14489 set try
14490 if eval $compile_ok; then
14491         yyy=`./try`
14492         case "$yyy" in
14493         '')     sizesize=4
14494                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14495                 ;;
14496         *)      sizesize=$yyy
14497                 echo "Your $zzz size is $sizesize bytes."
14498                 ;;
14499         esac
14500 else
14501         sizesize=4
14502         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14503 fi
14504
14505
14506 : check for socklen_t
14507 echo " "
14508 echo "Checking to see if you have socklen_t..." >&4
14509 $cat >try.c <<EOCP
14510 #include <sys/types.h>
14511 #$d_socket HAS_SOCKET
14512 #ifdef HAS_SOCKET
14513 #include <sys/socket.h>
14514 #endif
14515 int main() { socklen_t x = 16; }
14516 EOCP
14517 set try
14518 if eval $compile; then
14519         val="$define"
14520         echo "You have socklen_t."
14521 else
14522         val="$undef"
14523         echo "You do not have socklen_t."
14524         case "$sizetype" in
14525         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14526         esac
14527 fi
14528 $rm -f try try.*
14529 set d_socklen_t
14530 eval $setvar
14531
14532 : see if this is a socks.h system
14533 set socks.h i_socks
14534 eval $inhdr
14535
14536 : check for type of the size argument to socket calls
14537 case "$d_socket" in
14538 "$define")
14539         $cat <<EOM
14540
14541 Checking to see what type is the last argument of accept().
14542 EOM
14543         yyy=''
14544         case "$d_socklen_t" in
14545         "$define") yyy="$yyy socklen_t"
14546         esac
14547         yyy="$yyy $sizetype int long unsigned"
14548         for xxx in $yyy; do
14549                 case "$socksizetype" in
14550                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14551                         case "$usesocks" in
14552                         "$define")
14553                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14554                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14555                                         socksizetype="$xxx"
14556                                 fi
14557                                 ;;
14558                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14559                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14560                                         socksizetype="$xxx"
14561                                 fi
14562                                 ;;
14563                         esac
14564                         ;;
14565                 esac
14566         done
14567 : In case none of those worked, prompt the user.
14568         case "$socksizetype" in
14569         '')     rp='What is the type for socket address structure sizes?'
14570                 dflt='int'
14571                 . ./myread
14572                 socksizetype=$ans
14573                 ;;
14574         esac
14575         ;;
14576 *)      : no sockets, so pick relatively harmless default
14577         socksizetype='int'
14578         ;;
14579 esac
14580
14581 : see what type is used for signed size_t
14582 set ssize_t ssizetype int stdio.h sys/types.h
14583 eval $typedef
14584 dflt="$ssizetype"
14585 $cat > ssize.c <<EOM
14586 #include <stdio.h>
14587 #include <sys/types.h>
14588 #define Size_t $sizetype
14589 #define SSize_t $dflt
14590 int main()
14591 {
14592         if (sizeof(Size_t) == sizeof(SSize_t))
14593                 printf("$dflt\n");
14594         else if (sizeof(Size_t) == sizeof(int))
14595                 printf("int\n");
14596         else 
14597                 printf("long\n");
14598         exit(0);
14599 }
14600 EOM
14601 echo " "
14602 set ssize
14603 if eval $compile_ok && ./ssize > /dev/null; then
14604         ssizetype=`./ssize`
14605         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14606 else
14607         $cat >&4 <<EOM
14608 Help! I can't compile and run the ssize_t test program: please enlighten me!
14609 (This is probably a misconfiguration in your system or libraries, and
14610 you really ought to fix it.  Still, I'll try anyway.)
14611
14612 I need a type that is the same size as $sizetype, but is guaranteed to
14613 be signed.  Common values are ssize_t, int and long.
14614
14615 EOM
14616         rp="What signed type is the same size as $sizetype?"
14617         . ./myread
14618         ssizetype="$ans"
14619 fi
14620 $rm -f ssize ssize.*
14621
14622 : see what type of char stdio uses.
14623 echo " "
14624 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14625 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14626         echo "Your stdio uses unsigned chars." >&4
14627         stdchar="unsigned char"
14628 else
14629         echo "Your stdio uses signed chars." >&4
14630         stdchar="char"
14631 fi
14632 $rm -f stdioh
14633
14634
14635
14636 : see if time exists
14637 echo " "
14638 if test "X$d_time" = X -o X"$timetype" = X; then
14639     if set time val -f d_time; eval $csym; $val; then
14640                 echo 'time() found.' >&4
14641                 val="$define"
14642                 rp="What is the type returned by time() on this system?"
14643                 set time_t timetype long stdio.h sys/types.h
14644                 eval $typedef_ask
14645     else
14646                 echo 'time() not found, hope that will do.' >&4
14647                 val="$undef"
14648                 timetype='int';
14649     fi
14650     set d_time
14651     eval $setvar
14652 fi
14653
14654 : see what type uids are declared as in the kernel
14655 echo " "
14656 echo "Looking for the type for user ids returned by getuid()."
14657 set uid_t uidtype xxx stdio.h sys/types.h
14658 eval $typedef
14659 case "$uidtype" in
14660 xxx)
14661         xxx=`./findhdr sys/user.h`
14662         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14663         case $1 in
14664         unsigned) dflt="$1 $2" ;;
14665         *) dflt="$1" ;;
14666         esac
14667         ;;
14668 *) dflt="$uidtype";;
14669 esac
14670 case "$uidtype" in
14671 uid_t)  echo "uid_t found." ;;
14672 *)      rp="What is the type for user ids returned by getuid()?"
14673         . ./myread
14674         uidtype="$ans"
14675         ;;
14676 esac
14677
14678 echo " "
14679 case "$uidtype" in
14680 *_t) zzz="$uidtype"     ;;
14681 *)   zzz="uid"          ;;
14682 esac
14683 echo "Checking the size of $zzz..." >&4 
14684 cat > try.c <<EOCP
14685 #include <sys/types.h>
14686 #include <stdio.h>
14687 int main() {
14688     printf("%d\n", (int)sizeof($uidtype));
14689     exit(0);
14690 }
14691 EOCP
14692 set try
14693 if eval $compile_ok; then
14694         yyy=`./try`
14695         case "$yyy" in
14696         '')     uidsize=4
14697                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14698                 ;;
14699         *)      uidsize=$yyy
14700                 echo "Your $zzz is $uidsize bytes long."
14701                 ;;
14702         esac
14703 else
14704         uidsize=4
14705         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14706 fi
14707
14708 echo " "
14709 case "$uidtype" in
14710 *_t) zzz="$uidtype"     ;;
14711 *)   zzz="uid"          ;;
14712 esac
14713 echo "Checking the sign of $zzz..." >&4
14714 cat > try.c <<EOCP
14715 #include <sys/types.h>
14716 #include <stdio.h>
14717 int main() {
14718         $uidtype foo = -1;
14719         if (foo < 0)
14720                 printf("-1\n");
14721         else
14722                 printf("1\n");
14723 }
14724 EOCP
14725 set try
14726 if eval $compile; then
14727         yyy=`./try`
14728         case "$yyy" in
14729         '')     uidsign=1
14730                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14731                 ;;
14732         *)      uidsign=$yyy
14733                 case "$uidsign" in
14734                  1) echo "Your $zzz is unsigned." ;;
14735                 -1) echo "Your $zzz is signed."   ;;
14736                 esac
14737                 ;;
14738         esac
14739 else
14740         uidsign=1
14741         echo "(I can't compile the test program--guessing unsigned.)" >&4
14742 fi
14743
14744
14745
14746 echo " "
14747 $echo "Checking the format string to be used for uids..." >&4
14748
14749 case "$uidsign" in
14750 -1)     if $test X"$uidsize" = X"$ivsize"; then
14751                 uidformat="$ivdformat"
14752         else
14753                 if $test X"$uidsize" = X"$longsize"; then
14754                         uidformat='"ld"'
14755                 else
14756                         if $test X"$uidsize" = X"$intsize"; then
14757                                 uidformat='"d"'
14758                         else
14759                                 if $test X"$uidsize" = X"$shortsize"; then
14760                                         uidformat='"hd"'
14761                                 fi
14762                         fi
14763                 fi
14764         fi
14765         ;;
14766 *)      if $test X"$uidsize" = X"$uvsize"; then
14767                 uidformat="$uvuformat"
14768         else
14769                 if $test X"$uidsize" = X"$longsize"; then
14770                         uidformat='"lu"'
14771                 else
14772                         if $test X"$uidsize" = X"$intsize"; then
14773                                 uidformat='"u"'
14774                         else
14775                                 if $test X"$uidsize" = X"$shortsize"; then
14776                                         uidformat='"hu"'
14777                                 fi
14778                         fi
14779                 fi
14780         fi
14781         ;;
14782 esac
14783
14784 : see if dbm.h is available
14785 : see if dbmclose exists
14786 set dbmclose d_dbmclose
14787 eval $inlibc
14788
14789 case "$d_dbmclose" in
14790 $define)
14791         set dbm.h i_dbm
14792         eval $inhdr
14793         case "$i_dbm" in
14794         $define)
14795                 val="$undef"
14796                 set i_rpcsvcdbm
14797                 eval $setvar
14798                 ;;
14799         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14800                 eval $inhdr
14801                 ;;
14802         esac
14803         ;;
14804 *)      echo "We won't be including <dbm.h>"
14805         val="$undef"
14806         set i_dbm
14807         eval $setvar
14808         val="$undef"
14809         set i_rpcsvcdbm
14810         eval $setvar
14811         ;;
14812 esac
14813
14814 : see if this is a sys/file.h system
14815 val=''
14816 set sys/file.h val
14817 eval $inhdr
14818
14819 : do we need to include sys/file.h ?
14820 case "$val" in
14821 "$define")
14822         echo " "
14823         if $h_sysfile; then
14824                 val="$define"
14825                 echo "We'll be including <sys/file.h>." >&4
14826         else
14827                 val="$undef"
14828                 echo "We won't be including <sys/file.h>." >&4
14829         fi
14830         ;;
14831 *)
14832         h_sysfile=false
14833         ;;
14834 esac
14835 set i_sysfile
14836 eval $setvar
14837
14838 : see if fcntl.h is there
14839 val=''
14840 set fcntl.h val
14841 eval $inhdr
14842
14843 : see if we can include fcntl.h
14844 case "$val" in
14845 "$define")
14846         echo " "
14847         if $h_fcntl; then
14848                 val="$define"
14849                 echo "We'll be including <fcntl.h>." >&4
14850         else
14851                 val="$undef"
14852                 if $h_sysfile; then
14853         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14854                 else
14855                         echo "We won't be including <fcntl.h>." >&4
14856                 fi
14857         fi
14858         ;;
14859 *)
14860         h_fcntl=false
14861         val="$undef"
14862         ;;
14863 esac
14864 set i_fcntl
14865 eval $setvar
14866
14867 : see if this is a iconv.h system
14868 set iconv.h i_iconv
14869 eval $inhdr
14870
14871 : see if this is a ieeefp.h system
14872 set ieeefp.h i_ieeefp
14873 eval $inhdr
14874
14875 : see if this is a libutil.h system
14876 set libutil.h i_libutil
14877 eval $inhdr
14878
14879 : see if locale.h is available
14880 set locale.h i_locale
14881 eval $inhdr
14882
14883 : see if mach cthreads are available
14884 if test "X$usethreads" = "X$define"; then
14885         set mach/cthreads.h i_machcthr
14886         eval $inhdr
14887 else
14888         i_machcthr="$undef"
14889 fi
14890
14891
14892
14893 : see if this is a math.h system
14894 set math.h i_math
14895 eval $inhdr
14896
14897 : see if this is a mntent.h system
14898 set mntent.h i_mntent
14899 eval $inhdr
14900
14901 : see if ndbm.h is available
14902 set ndbm.h t_ndbm
14903 eval $inhdr
14904 case "$t_ndbm" in
14905 $define)
14906         : see if dbm_open exists
14907         set dbm_open d_dbm_open
14908         eval $inlibc
14909         case "$d_dbm_open" in
14910         $undef)
14911                 t_ndbm="$undef"
14912                 echo "We won't be including <ndbm.h>"
14913                 ;;
14914         esac
14915         ;;
14916 esac
14917 val="$t_ndbm"
14918 set i_ndbm
14919 eval $setvar
14920
14921 : see if net/errno.h is available
14922 val=''
14923 set net/errno.h val
14924 eval $inhdr
14925
14926 : Unfortunately, it causes problems on some systems.  Arrgh.
14927 case "$val" in
14928 $define)
14929         cat > try.c <<'EOM'
14930 #include <stdio.h>
14931 #include <errno.h>
14932 #include <net/errno.h>
14933 int func()
14934 {
14935         return ENOTSOCK;
14936 }
14937 EOM
14938         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14939                 echo "We'll be including <net/errno.h>." >&4
14940         else
14941                 echo "We won't be including <net/errno.h>." >&4
14942                 val="$undef"
14943         fi
14944         $rm -f try.* try
14945         ;;
14946 esac
14947 set i_neterrno
14948 eval $setvar
14949
14950 : see if netinet/tcp.h is available
14951 set netinet/tcp.h i_netinettcp
14952 eval $inhdr
14953
14954 : see if this is a poll.h system
14955 set poll.h i_poll
14956 eval $inhdr
14957
14958 : see if this is a prot.h system
14959 set prot.h i_prot
14960 eval $inhdr
14961
14962 echo " "
14963 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14964 $cat <<'EOSH' > Cppsym.know
14965 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14966 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14967 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14968 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14969 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14970 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14971 bull c cadmus clipper CMU COFF COMPILER_VERSION
14972 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14973 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14974 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14975 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14976 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14977 H3050R H3050RX hbullx20 hcx host_mips
14978 hp200 hp300 hp700 HP700 hp800 hp9000
14979 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14980 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14981 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14982 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14983 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14984 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14985 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14986 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14987 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14988 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14989 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14990 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14991 MATH_HAS_NO_SIDE_EFFECTS
14992 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14993 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14994 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14995 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14996 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14997 NetBSD news1500 news1700 news1800 news1900 news3700
14998 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14999 ns32016 ns32332 ns32k nsc32000
15000 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15001 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15002 pc532 pdp11 PGC PIC plexus PORTAR posix
15003 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15004 POSIX_C_SOURCE POSIX_SOURCE POWER
15005 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15006 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15007 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15008 sony sony_news sonyrisc sparc sparclite spectrum
15009 stardent stdc STDC_EXT stratos sun sun3 sun386
15010 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15011 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15012 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15013 sysV68 sysV88 Tek4132 Tek4300 titan
15014 tower tower32 tower32_200 tower32_600 tower32_700
15015 tower32_800 tower32_850 tss
15016 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15017 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15018 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15019 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15020 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15021 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15022 z8000
15023 EOSH
15024 # Maybe put other stuff here too.
15025 cat <<EOSH >>Cppsym.know
15026 $osname
15027 EOSH
15028 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15029 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15030 $cat Cppsym.know > Cppsym.c
15031 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15032 $rm -f Cppsym.a Cppsym.b Cppsym.c
15033 cat <<EOSH > Cppsym
15034 $startsh
15035 if $test \$# -gt 0; then
15036     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15037     if $test -s Cppsym.got; then
15038         $rm -f Cppsym.got
15039         exit 0
15040     fi
15041     $rm -f Cppsym.got
15042     exit 1
15043 else
15044     $tr " " "$trnl" | ./Cppsym.try
15045     exit 0
15046 fi
15047 EOSH
15048 chmod +x Cppsym
15049 $eunicefix Cppsym
15050 cat <<EOSH > Cppsym.try
15051 $startsh
15052 cat <<'EOCP' > try.c
15053 #include <stdio.h>
15054 int main() {
15055 EOCP
15056 $awk \\
15057 EOSH
15058 cat <<'EOSH' >> Cppsym.try
15059 'length($1) > 0 {
15060     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
15061     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
15062     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
15063     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
15064 }'       >> try.c
15065 echo '}' >> try.c
15066 EOSH
15067 cat <<EOSH >> Cppsym.try
15068 ccflags="$ccflags"
15069 case "$osname-$gccversion" in
15070 irix-) ccflags="\$ccflags -woff 1178" ;;
15071 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15072 esac
15073 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15074 EOSH
15075 chmod +x Cppsym.try
15076 $eunicefix Cppsym.try
15077 ./Cppsym < Cppsym.know > Cppsym.true
15078 : now check the C compiler for additional symbols
15079 postprocess_cc_v=''
15080 case "$osname" in
15081 aix) postprocess_cc_v="|$tr , ' '" ;;
15082 esac
15083 $cat >ccsym <<EOS
15084 $startsh
15085 $cat >tmp.c <<EOF
15086 extern int foo;
15087 EOF
15088 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15089 do
15090         case "\$i" in
15091         -D*) echo "\$i" | $sed 's/^-D//';;
15092         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15093         esac
15094 done
15095 $rm -f try.c
15096 EOS
15097 postprocess_cc_v=''
15098 chmod +x ccsym
15099 $eunicefix ccsym
15100 ./ccsym > ccsym1.raw
15101 if $test -s ccsym1.raw; then
15102        $sort ccsym1.raw | $uniq >ccsym.raw
15103 else
15104        mv ccsym1.raw ccsym.raw
15105 fi
15106
15107 $awk '/\=/ { print $0; next }
15108         { print $0"=1" }' ccsym.raw >ccsym.list
15109 $awk '/\=/ { print $0; next }
15110         { print $0"=1" }' Cppsym.true >ccsym.true
15111 $comm -13 ccsym.true ccsym.list >ccsym.own
15112 $comm -12 ccsym.true ccsym.list >ccsym.com
15113 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15114 also=''
15115 if $test -z ccsym.raw; then
15116         echo "Your C compiler doesn't seem to define any symbols!" >&4
15117         echo " "
15118         echo "However, your C preprocessor defines the following symbols:"
15119         $cat Cppsym.true
15120         ccsymbols=''
15121         cppsymbols=`$cat Cppsym.true`
15122         cppsymbols=`echo $cppsymbols`
15123         cppccsymbols="$cppsymbols"
15124 else
15125         if $test -s ccsym.com; then
15126                 echo "Your C compiler and pre-processor define these symbols:"
15127                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15128                 also='also '
15129                 symbols='ones'
15130                 cppccsymbols=`$cat ccsym.com`
15131                 cppccsymbols=`echo $cppccsymbols`
15132                 $test "$silent" || sleep 1
15133         fi
15134         if $test -s ccsym.cpp; then
15135                 $test "$also" && echo " "
15136                 echo "Your C pre-processor ${also}defines the following symbols:"
15137                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15138                 also='further '
15139                 cppsymbols=`$cat ccsym.cpp`
15140                 cppsymbols=`echo $cppsymbols`
15141                 $test "$silent" || sleep 1
15142         fi
15143         if $test -s ccsym.own; then
15144                 $test "$also" && echo " "
15145                 echo "Your C compiler ${also}defines the following cpp symbols:"
15146                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15147                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15148                 ccsymbols=`$cat ccsym.own`
15149                 ccsymbols=`echo $ccsymbols`
15150                 $test "$silent" || sleep 1
15151         fi
15152 fi
15153 $rm -f ccsym* Cppsym.*
15154
15155 : see if this is a termio system
15156 val="$undef"
15157 val2="$undef"
15158 val3="$undef"
15159 if $test `./findhdr termios.h`; then
15160         set tcsetattr i_termios
15161         eval $inlibc
15162         val3="$i_termios"
15163 fi
15164 echo " "
15165 case "$val3" in
15166 "$define") echo "You have POSIX termios.h... good!" >&4;;
15167 *) if ./Cppsym pyr; then
15168                 case "`/bin/universe`" in
15169                 ucb) if $test `./findhdr sgtty.h`; then
15170                                 val2="$define"
15171                                 echo "<sgtty.h> found." >&4
15172                         else
15173                                 echo "System is pyramid with BSD universe."
15174                                 echo "<sgtty.h> not found--you could have problems." >&4
15175                         fi;;
15176                 *) if $test `./findhdr termio.h`; then
15177                                 val="$define"
15178                                 echo "<termio.h> found." >&4
15179                         else
15180                                 echo "System is pyramid with USG universe."
15181                                 echo "<termio.h> not found--you could have problems." >&4
15182                         fi;;
15183                 esac
15184         elif ./usg; then
15185                 if $test `./findhdr termio.h`; then
15186                         echo "<termio.h> found." >&4
15187                         val="$define"
15188                 elif $test `./findhdr sgtty.h`; then
15189                         echo "<sgtty.h> found." >&4
15190                         val2="$define"
15191                 else
15192 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15193                 fi
15194         else
15195                 if $test `./findhdr sgtty.h`; then
15196                         echo "<sgtty.h> found." >&4
15197                         val2="$define"
15198                 elif $test `./findhdr termio.h`; then
15199                         echo "<termio.h> found." >&4
15200                         val="$define"
15201                 else
15202 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15203                 fi
15204         fi;;
15205 esac
15206 set i_termio; eval $setvar
15207 val=$val2; set i_sgtty; eval $setvar
15208 val=$val3; set i_termios; eval $setvar
15209
15210 : see if this is a shadow.h system
15211 set shadow.h i_shadow
15212 eval $inhdr
15213
15214 : see if stddef is available
15215 set stddef.h i_stddef
15216 eval $inhdr
15217
15218 : see if this is a sunmath.h system
15219 set sunmath.h i_sunmath
15220 eval $inhdr
15221
15222 : see if sys/access.h is available
15223 set sys/access.h i_sysaccess
15224 eval $inhdr
15225
15226 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15227 set sys/filio.h i_sysfilio
15228 eval $inhdr
15229 echo " "
15230 if $test `./findhdr sys/ioctl.h`; then
15231         val="$define"
15232         echo '<sys/ioctl.h> found.' >&4
15233 else
15234         val="$undef"
15235         if $test $i_sysfilio = "$define"; then
15236             echo '<sys/ioctl.h> NOT found.' >&4
15237         else
15238                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15239                 $test $i_termio = "$define" && xxx="termio.h"
15240                 $test $i_termios = "$define" && xxx="termios.h"
15241 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15242         fi
15243 fi
15244 set i_sysioctl
15245 eval $setvar
15246
15247
15248 : see if this is a syslog.h system
15249 set syslog.h i_syslog
15250 eval $inhdr
15251
15252
15253 : see if this is a sys/mode.h system
15254 set sys/mode.h i_sysmode
15255 eval $inhdr
15256
15257 : see if sys/resource.h has to be included
15258 set sys/resource.h i_sysresrc
15259 eval $inhdr
15260
15261 : see if sys/security.h is available
15262 set sys/security.h i_syssecrt
15263 eval $inhdr
15264
15265 : see if this is a sys/statvfs.h system
15266 set sys/statvfs.h i_sysstatvfs
15267 eval $inhdr
15268
15269 : see if this is a sys/uio.h system
15270 set sys/uio.h i_sysuio
15271 eval $inhdr
15272
15273 : see if this is a sys/un.h system
15274 set sys/un.h i_sysun
15275 eval $inhdr
15276
15277
15278 : see if this is a sys/utsname.h system
15279 set sys/utsname.h i_sysutsname
15280 eval $inhdr
15281
15282 : see if this is a syswait system
15283 set sys/wait.h i_syswait
15284 eval $inhdr
15285
15286 : see if this is a ustat.h system
15287 set ustat.h i_ustat
15288 eval $inhdr
15289
15290 : see if this is an utime system
15291 set utime.h i_utime
15292 eval $inhdr
15293
15294 : see if this is a values.h system
15295 set values.h i_values
15296 eval $inhdr
15297
15298 : see if this is a vfork system
15299 case "$d_vfork" in
15300 "$define")
15301         set vfork.h i_vfork
15302         eval $inhdr
15303         ;;
15304 *)
15305         i_vfork="$undef"
15306         ;;
15307 esac
15308
15309 : see if gdbm.h is available
15310 set gdbm.h t_gdbm
15311 eval $inhdr
15312 case "$t_gdbm" in
15313 $define)
15314         : see if gdbm_open exists
15315         set gdbm_open d_gdbm_open
15316         eval $inlibc
15317         case "$d_gdbm_open" in
15318         $undef)
15319                 t_gdbm="$undef"
15320                 echo "We won't be including <gdbm.h>"
15321                 ;;
15322         esac
15323         ;;
15324 esac
15325 val="$t_gdbm"
15326 set i_gdbm
15327 eval $setvar
15328
15329 echo " "
15330 echo "Looking for extensions..." >&4
15331 : If we are using the old config.sh, known_extensions may contain
15332 : old or inaccurate or duplicate values.
15333 known_extensions=''
15334 nonxs_extensions=''
15335 : We do not use find because it might not be available.
15336 : We do not just use MANIFEST because the user may have dropped
15337 : some additional extensions into the source tree and expect them
15338 : to be built.
15339
15340 : Function to recursively find available extensions, ignoring DynaLoader
15341 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15342 find_extensions='
15343     for xxx in *; do
15344        case "$xxx" in
15345            DynaLoader|dynaload) ;;
15346            *)
15347            if $test -f $xxx/$xxx.xs; then
15348                known_extensions="$known_extensions $1$xxx";
15349            elif $test -f $xxx/Makefile.PL; then
15350                nonxs_extensions="$nonxs_extensions $1$xxx";
15351            else
15352                if $test -d $xxx -a $# -lt 10; then
15353                    set $1$xxx/ $*;
15354                    cd $xxx;
15355                    eval $find_extensions;
15356                    cd ..;
15357                    shift;
15358                fi;
15359            fi
15360            ;;
15361        esac;
15362     done'
15363 tdir=`pwd`
15364 cd $rsrc/ext
15365 set X
15366 shift
15367 eval $find_extensions
15368 set X $nonxs_extensions
15369 shift
15370 nonxs_extensions="$*"
15371 set X $known_extensions
15372 shift
15373 known_extensions="$*"
15374 cd $tdir
15375
15376 : Now see which are supported on this system.
15377 avail_ext=''
15378 for xxx in $known_extensions ; do
15379         case "$xxx" in
15380         DB_File|db_file)
15381                 case "$i_db" in
15382                 $define) avail_ext="$avail_ext $xxx" ;;
15383                 esac
15384                 ;;
15385         GDBM_File|gdbm_fil)
15386                 case "$i_gdbm" in 
15387                 $define) avail_ext="$avail_ext $xxx" ;;
15388                 esac
15389                 ;;
15390         NDBM_File|ndbm_fil)
15391                 case "$i_ndbm" in
15392                 $define)
15393                     case "$osname-$use64bitint" in
15394                     hpux-define)
15395                         case "$libs" in
15396                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15397                         esac
15398                         ;;
15399                     *) avail_ext="$avail_ext $xxx" ;;
15400                     esac
15401                     ;;
15402                 esac
15403                 ;;
15404         ODBM_File|odbm_fil) 
15405                 case "${i_dbm}${i_rpcsvcdbm}" in
15406                 *"${define}"*)
15407                     case "$osname-$use64bitint" in
15408                     hpux-define)
15409                         case "$libs" in
15410                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15411                         esac
15412                         ;;
15413                     *) avail_ext="$avail_ext $xxx" ;;
15414                     esac
15415                     ;;
15416                 esac
15417                 ;;
15418         POSIX|posix)
15419                 case "$useposix" in
15420                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15421                 esac
15422                 ;;
15423         Opcode|opcode)
15424                 case "$useopcode" in
15425                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15426                 esac
15427                 ;;
15428         Socket|socket)
15429                 case "$d_socket" in 
15430                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15431                 esac
15432                 ;;
15433         Sys/Syslog|sys/syslog)
15434                 : XXX syslog requires socket
15435                 case "$d_socket" in 
15436                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15437                 esac
15438                 ;;
15439         Thread|thread)
15440                 case "$usethreads" in 
15441                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15442                 esac
15443                 ;;
15444         IPC/SysV|ipc/sysv)
15445                 : XXX Do we need a useipcsysv variable here
15446                 case "${d_msg}${d_sem}${d_shm}" in 
15447                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15448                 esac
15449                 ;;
15450         *)      avail_ext="$avail_ext $xxx"
15451                 ;;
15452         esac
15453 done
15454
15455 set X $avail_ext
15456 shift
15457 avail_ext="$*"
15458
15459 : Now see which nonxs extensions are supported on this system.
15460 : For now assume all are.
15461 nonxs_ext=''
15462 for xxx in $nonxs_extensions ; do
15463         case "$xxx" in
15464         *)      nonxs_ext="$nonxs_ext $xxx"
15465                 ;;
15466         esac
15467 done
15468
15469 set X $nonxs_ext
15470 shift
15471 nonxs_ext="$*"
15472
15473 case $usedl in
15474 $define)
15475         $cat <<EOM
15476 A number of extensions are supplied with $package.  You may choose to
15477 compile these extensions for dynamic loading (the default), compile
15478 them into the $package executable (static loading), or not include
15479 them at all.  Answer "none" to include no extensions.
15480 Note that DynaLoader is always built and need not be mentioned here.
15481
15482 EOM
15483         case "$dynamic_ext" in
15484         '') dflt="$avail_ext" ;;
15485         *)      dflt="$dynamic_ext"
15486                 # Perhaps we are reusing an old out-of-date config.sh.
15487                 case "$hint" in
15488                 previous)
15489                         if test X"$dynamic_ext" != X"$avail_ext"; then
15490                                 $cat <<EOM
15491 NOTICE:  Your previous config.sh list may be incorrect. 
15492 The extensions now available to you are 
15493         ${avail_ext}
15494 but the default list from your previous config.sh is
15495         ${dynamic_ext} 
15496
15497 EOM
15498                         fi
15499                         ;;
15500                 esac
15501                 ;;
15502         esac
15503         case "$dflt" in
15504         '')     dflt=none;;
15505         esac
15506         rp="What extensions do you wish to load dynamically?"
15507         . ./myread
15508         case "$ans" in
15509         none) dynamic_ext=' ' ;;
15510         *) dynamic_ext="$ans" ;;
15511         esac
15512
15513         case "$static_ext" in
15514         '')
15515                 : Exclude those already listed in dynamic linking
15516                 dflt=''
15517                 for xxx in $avail_ext; do
15518                         case " $dynamic_ext " in
15519                         *" $xxx "*) ;;
15520                         *) dflt="$dflt $xxx" ;;
15521                         esac
15522                 done
15523                 set X $dflt
15524                 shift
15525                 dflt="$*"
15526                 ;;
15527         *)  dflt="$static_ext" 
15528                 ;;
15529         esac
15530
15531         case "$dflt" in
15532         '')     dflt=none;;
15533         esac
15534         rp="What extensions do you wish to load statically?"
15535         . ./myread
15536         case "$ans" in
15537         none) static_ext=' ' ;;
15538         *) static_ext="$ans" ;;
15539         esac
15540         ;;
15541 *)
15542         $cat <<EOM
15543 A number of extensions are supplied with $package.  Answer "none" 
15544 to include no extensions. 
15545 Note that DynaLoader is always built and need not be mentioned here.
15546
15547 EOM
15548         case "$static_ext" in
15549         '') dflt="$avail_ext" ;;
15550         *)      dflt="$static_ext"
15551                 # Perhaps we are reusing an old out-of-date config.sh.
15552                 case "$hint" in
15553                 previous)
15554                         if test X"$static_ext" != X"$avail_ext"; then
15555                                 $cat <<EOM
15556 NOTICE:  Your previous config.sh list may be incorrect. 
15557 The extensions now available to you are 
15558         ${avail_ext}
15559 but the default list from your previous config.sh is
15560         ${static_ext} 
15561
15562 EOM
15563                         fi
15564                         ;;
15565                 esac
15566                 ;;
15567         esac
15568         : Exclude those that are not xs extensions
15569         case "$dflt" in
15570         '')     dflt=none;;
15571         esac
15572         rp="What extensions do you wish to include?"
15573         . ./myread
15574         case "$ans" in
15575         none) static_ext=' ' ;;
15576         *) static_ext="$ans" ;;
15577         esac
15578         ;;
15579 esac
15580
15581 set X $dynamic_ext $static_ext $nonxs_ext
15582 shift
15583 extensions="$*"
15584
15585 : Remove libraries needed only for extensions
15586 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15587 : The exception is SunOS 4.x, which needs them.
15588 case "${osname}X${osvers}" in
15589 sunos*X4*)
15590     perllibs="$libs"
15591     ;;
15592 *) case "$usedl" in
15593     $define|true|[yY]*)
15594             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15595             shift
15596             perllibs="$*"
15597             ;;
15598     *)  perllibs="$libs"
15599             ;;
15600     esac
15601     ;;
15602 esac
15603
15604 : Remove build directory name from cppstdin so it can be used from
15605 : either the present location or the final installed location.
15606 echo " "
15607 : Get out of the UU directory to get correct path name.
15608 cd ..
15609 case "$cppstdin" in
15610 `pwd`/cppstdin)
15611         echo "Stripping down cppstdin path name"
15612         cppstdin=cppstdin
15613         ;;
15614 esac
15615 cd UU
15616
15617 : end of configuration questions
15618 echo " "
15619 echo "End of configuration questions."
15620 echo " "
15621
15622 : back to where it started
15623 if test -d ../UU; then
15624         cd ..
15625 fi
15626
15627 : configuration may be patched via a 'config.over' file
15628 if $test -f config.over; then
15629         echo " "
15630         dflt=y
15631         rp='I see a config.over file.  Do you wish to load it?'
15632         . UU/myread
15633         case "$ans" in
15634         n*) echo "OK, I'll ignore it.";;
15635         *)      . ./config.over
15636                 echo "Configuration override changes have been loaded."
15637                 ;;
15638         esac
15639 fi
15640
15641 : in case they want portability, strip down executable paths
15642 case "$d_portable" in
15643 "$define")
15644         echo " "
15645         echo "Stripping down executable paths..." >&4
15646         for file in $loclist $trylist; do
15647                 eval temp=\$$file
15648                 eval $file=`basename $temp`
15649         done
15650         ;;
15651 esac
15652
15653 : create config.sh file
15654 echo " "
15655 echo "Creating config.sh..." >&4
15656 $spitshell <<EOT >config.sh
15657 $startsh
15658 #
15659 # This file was produced by running the Configure script. It holds all the
15660 # definitions figured out by Configure. Should you modify one of these values,
15661 # do not forget to propagate your changes by running "Configure -der". You may
15662 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15663 #
15664
15665 # Package name      : $package
15666 # Source directory  : $src
15667 # Configuration time: $cf_time
15668 # Configured by     : $cf_by
15669 # Target system     : $myuname
15670
15671 Author='$Author'
15672 Date='$Date'
15673 Header='$Header'
15674 Id='$Id'
15675 Locker='$Locker'
15676 Log='$Log'
15677 Mcc='$Mcc'
15678 RCSfile='$RCSfile'
15679 Revision='$Revision'
15680 Source='$Source'
15681 State='$State'
15682 _a='$_a'
15683 _exe='$_exe'
15684 _o='$_o'
15685 afs='$afs'
15686 alignbytes='$alignbytes'
15687 ansi2knr='$ansi2knr'
15688 aphostname='$aphostname'
15689 api_revision='$api_revision'
15690 api_subversion='$api_subversion'
15691 api_version='$api_version'
15692 api_versionstring='$api_versionstring'
15693 ar='$ar'
15694 archlib='$archlib'
15695 archlibexp='$archlibexp'
15696 archname64='$archname64'
15697 archname='$archname'
15698 archobjs='$archobjs'
15699 awk='$awk'
15700 baserev='$baserev'
15701 bash='$bash'
15702 bin='$bin'
15703 bincompat5005='$bincompat5005'
15704 binexp='$binexp'
15705 bison='$bison'
15706 byacc='$byacc'
15707 byteorder='$byteorder'
15708 c='$c'
15709 castflags='$castflags'
15710 cat='$cat'
15711 cc='$cc'
15712 cccdlflags='$cccdlflags'
15713 ccdlflags='$ccdlflags'
15714 ccflags='$ccflags'
15715 ccflags_uselargefiles='$ccflags_uselargefiles'
15716 ccname='$ccname'
15717 ccsymbols='$ccsymbols'
15718 ccversion='$ccversion'
15719 cf_by='$cf_by'
15720 cf_email='$cf_email'
15721 cf_time='$cf_time'
15722 charsize='$charsize'
15723 chgrp='$chgrp'
15724 chmod='$chmod'
15725 chown='$chown'
15726 clocktype='$clocktype'
15727 comm='$comm'
15728 compress='$compress'
15729 contains='$contains'
15730 cp='$cp'
15731 cpio='$cpio'
15732 cpp='$cpp'
15733 cpp_stuff='$cpp_stuff'
15734 cppccsymbols='$cppccsymbols'
15735 cppflags='$cppflags'
15736 cpplast='$cpplast'
15737 cppminus='$cppminus'
15738 cpprun='$cpprun'
15739 cppstdin='$cppstdin'
15740 cppsymbols='$cppsymbols'
15741 crosscompile='$crosscompile'
15742 cryptlib='$cryptlib'
15743 csh='$csh'
15744 d_Gconvert='$d_Gconvert'
15745 d_PRIEUldbl='$d_PRIEUldbl'
15746 d_PRIFUldbl='$d_PRIFUldbl'
15747 d_PRIGUldbl='$d_PRIGUldbl'
15748 d_PRIXU64='$d_PRIXU64'
15749 d_PRId64='$d_PRId64'
15750 d_PRIeldbl='$d_PRIeldbl'
15751 d_PRIfldbl='$d_PRIfldbl'
15752 d_PRIgldbl='$d_PRIgldbl'
15753 d_PRIi64='$d_PRIi64'
15754 d_PRIo64='$d_PRIo64'
15755 d_PRIu64='$d_PRIu64'
15756 d_PRIx64='$d_PRIx64'
15757 d_SCNfldbl='$d_SCNfldbl'
15758 d__fwalk='$d__fwalk'
15759 d_access='$d_access'
15760 d_accessx='$d_accessx'
15761 d_alarm='$d_alarm'
15762 d_archlib='$d_archlib'
15763 d_atolf='$d_atolf'
15764 d_atoll='$d_atoll'
15765 d_attribut='$d_attribut'
15766 d_bcmp='$d_bcmp'
15767 d_bcopy='$d_bcopy'
15768 d_bincompat5005='$d_bincompat5005'
15769 d_bsd='$d_bsd'
15770 d_bsdgetpgrp='$d_bsdgetpgrp'
15771 d_bsdsetpgrp='$d_bsdsetpgrp'
15772 d_bzero='$d_bzero'
15773 d_casti32='$d_casti32'
15774 d_castneg='$d_castneg'
15775 d_charvspr='$d_charvspr'
15776 d_chown='$d_chown'
15777 d_chroot='$d_chroot'
15778 d_chsize='$d_chsize'
15779 d_closedir='$d_closedir'
15780 d_const='$d_const'
15781 d_crypt='$d_crypt'
15782 d_csh='$d_csh'
15783 d_cuserid='$d_cuserid'
15784 d_dbl_dig='$d_dbl_dig'
15785 d_difftime='$d_difftime'
15786 d_dirnamlen='$d_dirnamlen'
15787 d_dlerror='$d_dlerror'
15788 d_dlopen='$d_dlopen'
15789 d_dlsymun='$d_dlsymun'
15790 d_dosuid='$d_dosuid'
15791 d_drand48proto='$d_drand48proto'
15792 d_dup2='$d_dup2'
15793 d_eaccess='$d_eaccess'
15794 d_endgrent='$d_endgrent'
15795 d_endhent='$d_endhent'
15796 d_endnent='$d_endnent'
15797 d_endpent='$d_endpent'
15798 d_endpwent='$d_endpwent'
15799 d_endsent='$d_endsent'
15800 d_eofnblk='$d_eofnblk'
15801 d_eunice='$d_eunice'
15802 d_fchmod='$d_fchmod'
15803 d_fchown='$d_fchown'
15804 d_fcntl='$d_fcntl'
15805 d_fcntl_can_lock='$d_fcntl_can_lock'
15806 d_fd_macros='$d_fd_macros'
15807 d_fd_set='$d_fd_set'
15808 d_fds_bits='$d_fds_bits'
15809 d_fgetpos='$d_fgetpos'
15810 d_flexfnam='$d_flexfnam'
15811 d_flock='$d_flock'
15812 d_fork='$d_fork'
15813 d_fpathconf='$d_fpathconf'
15814 d_fpos64_t='$d_fpos64_t'
15815 d_frexpl='$d_frexpl'
15816 d_fs_data_s='$d_fs_data_s'
15817 d_fseeko='$d_fseeko'
15818 d_fsetpos='$d_fsetpos'
15819 d_fstatfs='$d_fstatfs'
15820 d_fstatvfs='$d_fstatvfs'
15821 d_fsync='$d_fsync'
15822 d_ftello='$d_ftello'
15823 d_ftime='$d_ftime'
15824 d_getcwd='$d_getcwd'
15825 d_getespwnam='$d_getespwnam'
15826 d_getfsstat='$d_getfsstat'
15827 d_getgrent='$d_getgrent'
15828 d_getgrps='$d_getgrps'
15829 d_gethbyaddr='$d_gethbyaddr'
15830 d_gethbyname='$d_gethbyname'
15831 d_gethent='$d_gethent'
15832 d_gethname='$d_gethname'
15833 d_gethostprotos='$d_gethostprotos'
15834 d_getlogin='$d_getlogin'
15835 d_getmnt='$d_getmnt'
15836 d_getmntent='$d_getmntent'
15837 d_getnbyaddr='$d_getnbyaddr'
15838 d_getnbyname='$d_getnbyname'
15839 d_getnent='$d_getnent'
15840 d_getnetprotos='$d_getnetprotos'
15841 d_getpagsz='$d_getpagsz'
15842 d_getpbyname='$d_getpbyname'
15843 d_getpbynumber='$d_getpbynumber'
15844 d_getpent='$d_getpent'
15845 d_getpgid='$d_getpgid'
15846 d_getpgrp2='$d_getpgrp2'
15847 d_getpgrp='$d_getpgrp'
15848 d_getppid='$d_getppid'
15849 d_getprior='$d_getprior'
15850 d_getprotoprotos='$d_getprotoprotos'
15851 d_getprpwnam='$d_getprpwnam'
15852 d_getpwent='$d_getpwent'
15853 d_getsbyname='$d_getsbyname'
15854 d_getsbyport='$d_getsbyport'
15855 d_getsent='$d_getsent'
15856 d_getservprotos='$d_getservprotos'
15857 d_getspnam='$d_getspnam'
15858 d_gettimeod='$d_gettimeod'
15859 d_gnulibc='$d_gnulibc'
15860 d_grpasswd='$d_grpasswd'
15861 d_hasmntopt='$d_hasmntopt'
15862 d_htonl='$d_htonl'
15863 d_iconv='$d_iconv'
15864 d_index='$d_index'
15865 d_inetaton='$d_inetaton'
15866 d_int64_t='$d_int64_t'
15867 d_isascii='$d_isascii'
15868 d_isnan='$d_isnan'
15869 d_isnanl='$d_isnanl'
15870 d_killpg='$d_killpg'
15871 d_lchown='$d_lchown'
15872 d_ldbl_dig='$d_ldbl_dig'
15873 d_link='$d_link'
15874 d_locconv='$d_locconv'
15875 d_lockf='$d_lockf'
15876 d_longdbl='$d_longdbl'
15877 d_longlong='$d_longlong'
15878 d_lseekproto='$d_lseekproto'
15879 d_lstat='$d_lstat'
15880 d_madvise='$d_madvise'
15881 d_mblen='$d_mblen'
15882 d_mbstowcs='$d_mbstowcs'
15883 d_mbtowc='$d_mbtowc'
15884 d_memchr='$d_memchr'
15885 d_memcmp='$d_memcmp'
15886 d_memcpy='$d_memcpy'
15887 d_memmove='$d_memmove'
15888 d_memset='$d_memset'
15889 d_mkdir='$d_mkdir'
15890 d_mkdtemp='$d_mkdtemp'
15891 d_mkfifo='$d_mkfifo'
15892 d_mkstemp='$d_mkstemp'
15893 d_mkstemps='$d_mkstemps'
15894 d_mktime='$d_mktime'
15895 d_mmap='$d_mmap'
15896 d_modfl='$d_modfl'
15897 d_mprotect='$d_mprotect'
15898 d_msg='$d_msg'
15899 d_msg_ctrunc='$d_msg_ctrunc'
15900 d_msg_dontroute='$d_msg_dontroute'
15901 d_msg_oob='$d_msg_oob'
15902 d_msg_peek='$d_msg_peek'
15903 d_msg_proxy='$d_msg_proxy'
15904 d_msgctl='$d_msgctl'
15905 d_msgget='$d_msgget'
15906 d_msgrcv='$d_msgrcv'
15907 d_msgsnd='$d_msgsnd'
15908 d_msync='$d_msync'
15909 d_munmap='$d_munmap'
15910 d_mymalloc='$d_mymalloc'
15911 d_nice='$d_nice'
15912 d_nv_preserves_uv='$d_nv_preserves_uv'
15913 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15914 d_off64_t='$d_off64_t'
15915 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15916 d_oldpthreads='$d_oldpthreads'
15917 d_oldsock='$d_oldsock'
15918 d_open3='$d_open3'
15919 d_pathconf='$d_pathconf'
15920 d_pause='$d_pause'
15921 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15922 d_phostname='$d_phostname'
15923 d_pipe='$d_pipe'
15924 d_poll='$d_poll'
15925 d_portable='$d_portable'
15926 d_pthread_yield='$d_pthread_yield'
15927 d_pwage='$d_pwage'
15928 d_pwchange='$d_pwchange'
15929 d_pwclass='$d_pwclass'
15930 d_pwcomment='$d_pwcomment'
15931 d_pwexpire='$d_pwexpire'
15932 d_pwgecos='$d_pwgecos'
15933 d_pwpasswd='$d_pwpasswd'
15934 d_pwquota='$d_pwquota'
15935 d_qgcvt='$d_qgcvt'
15936 d_quad='$d_quad'
15937 d_readdir='$d_readdir'
15938 d_readlink='$d_readlink'
15939 d_rename='$d_rename'
15940 d_rewinddir='$d_rewinddir'
15941 d_rmdir='$d_rmdir'
15942 d_safebcpy='$d_safebcpy'
15943 d_safemcpy='$d_safemcpy'
15944 d_sanemcmp='$d_sanemcmp'
15945 d_sbrkproto='$d_sbrkproto'
15946 d_sched_yield='$d_sched_yield'
15947 d_scm_rights='$d_scm_rights'
15948 d_seekdir='$d_seekdir'
15949 d_select='$d_select'
15950 d_sem='$d_sem'
15951 d_semctl='$d_semctl'
15952 d_semctl_semid_ds='$d_semctl_semid_ds'
15953 d_semctl_semun='$d_semctl_semun'
15954 d_semget='$d_semget'
15955 d_semop='$d_semop'
15956 d_setegid='$d_setegid'
15957 d_seteuid='$d_seteuid'
15958 d_setgrent='$d_setgrent'
15959 d_setgrps='$d_setgrps'
15960 d_sethent='$d_sethent'
15961 d_setlinebuf='$d_setlinebuf'
15962 d_setlocale='$d_setlocale'
15963 d_setnent='$d_setnent'
15964 d_setpent='$d_setpent'
15965 d_setpgid='$d_setpgid'
15966 d_setpgrp2='$d_setpgrp2'
15967 d_setpgrp='$d_setpgrp'
15968 d_setprior='$d_setprior'
15969 d_setproctitle='$d_setproctitle'
15970 d_setpwent='$d_setpwent'
15971 d_setregid='$d_setregid'
15972 d_setresgid='$d_setresgid'
15973 d_setresuid='$d_setresuid'
15974 d_setreuid='$d_setreuid'
15975 d_setrgid='$d_setrgid'
15976 d_setruid='$d_setruid'
15977 d_setsent='$d_setsent'
15978 d_setsid='$d_setsid'
15979 d_setvbuf='$d_setvbuf'
15980 d_sfio='$d_sfio'
15981 d_shm='$d_shm'
15982 d_shmat='$d_shmat'
15983 d_shmatprototype='$d_shmatprototype'
15984 d_shmctl='$d_shmctl'
15985 d_shmdt='$d_shmdt'
15986 d_shmget='$d_shmget'
15987 d_sigaction='$d_sigaction'
15988 d_sigsetjmp='$d_sigsetjmp'
15989 d_socket='$d_socket'
15990 d_socklen_t='$d_socklen_t'
15991 d_sockpair='$d_sockpair'
15992 d_socks5_init='$d_socks5_init'
15993 d_sqrtl='$d_sqrtl'
15994 d_statblks='$d_statblks'
15995 d_statfs_f_flags='$d_statfs_f_flags'
15996 d_statfs_s='$d_statfs_s'
15997 d_statvfs='$d_statvfs'
15998 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15999 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16000 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16001 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16002 d_stdio_stream_array='$d_stdio_stream_array'
16003 d_stdiobase='$d_stdiobase'
16004 d_stdstdio='$d_stdstdio'
16005 d_strchr='$d_strchr'
16006 d_strcoll='$d_strcoll'
16007 d_strctcpy='$d_strctcpy'
16008 d_strerrm='$d_strerrm'
16009 d_strerror='$d_strerror'
16010 d_strtod='$d_strtod'
16011 d_strtol='$d_strtol'
16012 d_strtold='$d_strtold'
16013 d_strtoll='$d_strtoll'
16014 d_strtoul='$d_strtoul'
16015 d_strtoull='$d_strtoull'
16016 d_strtouq='$d_strtouq'
16017 d_strxfrm='$d_strxfrm'
16018 d_suidsafe='$d_suidsafe'
16019 d_symlink='$d_symlink'
16020 d_syscall='$d_syscall'
16021 d_sysconf='$d_sysconf'
16022 d_sysernlst='$d_sysernlst'
16023 d_syserrlst='$d_syserrlst'
16024 d_system='$d_system'
16025 d_tcgetpgrp='$d_tcgetpgrp'
16026 d_tcsetpgrp='$d_tcsetpgrp'
16027 d_telldir='$d_telldir'
16028 d_telldirproto='$d_telldirproto'
16029 d_time='$d_time'
16030 d_times='$d_times'
16031 d_truncate='$d_truncate'
16032 d_tzname='$d_tzname'
16033 d_umask='$d_umask'
16034 d_uname='$d_uname'
16035 d_union_semun='$d_union_semun'
16036 d_ustat='$d_ustat'
16037 d_vendorarch='$d_vendorarch'
16038 d_vendorbin='$d_vendorbin'
16039 d_vendorlib='$d_vendorlib'
16040 d_vfork='$d_vfork'
16041 d_void_closedir='$d_void_closedir'
16042 d_voidsig='$d_voidsig'
16043 d_voidtty='$d_voidtty'
16044 d_volatile='$d_volatile'
16045 d_vprintf='$d_vprintf'
16046 d_wait4='$d_wait4'
16047 d_waitpid='$d_waitpid'
16048 d_wcstombs='$d_wcstombs'
16049 d_wctomb='$d_wctomb'
16050 d_xenix='$d_xenix'
16051 date='$date'
16052 db_hashtype='$db_hashtype'
16053 db_prefixtype='$db_prefixtype'
16054 defvoidused='$defvoidused'
16055 direntrytype='$direntrytype'
16056 dlext='$dlext'
16057 dlsrc='$dlsrc'
16058 doublesize='$doublesize'
16059 drand01='$drand01'
16060 dynamic_ext='$dynamic_ext'
16061 eagain='$eagain'
16062 ebcdic='$ebcdic'
16063 echo='$echo'
16064 egrep='$egrep'
16065 emacs='$emacs'
16066 eunicefix='$eunicefix'
16067 exe_ext='$exe_ext'
16068 expr='$expr'
16069 extensions='$extensions'
16070 fflushNULL='$fflushNULL'
16071 fflushall='$fflushall'
16072 find='$find'
16073 firstmakefile='$firstmakefile'
16074 flex='$flex'
16075 fpossize='$fpossize'
16076 fpostype='$fpostype'
16077 freetype='$freetype'
16078 full_ar='$full_ar'
16079 full_csh='$full_csh'
16080 full_sed='$full_sed'
16081 gccosandvers='$gccosandvers'
16082 gccversion='$gccversion'
16083 gidformat='$gidformat'
16084 gidsign='$gidsign'
16085 gidsize='$gidsize'
16086 gidtype='$gidtype'
16087 glibpth='$glibpth'
16088 grep='$grep'
16089 groupcat='$groupcat'
16090 groupstype='$groupstype'
16091 gzip='$gzip'
16092 h_fcntl='$h_fcntl'
16093 h_sysfile='$h_sysfile'
16094 hint='$hint'
16095 hostcat='$hostcat'
16096 i16size='$i16size'
16097 i16type='$i16type'
16098 i32size='$i32size'
16099 i32type='$i32type'
16100 i64size='$i64size'
16101 i64type='$i64type'
16102 i8size='$i8size'
16103 i8type='$i8type'
16104 i_arpainet='$i_arpainet'
16105 i_bsdioctl='$i_bsdioctl'
16106 i_db='$i_db'
16107 i_dbm='$i_dbm'
16108 i_dirent='$i_dirent'
16109 i_dld='$i_dld'
16110 i_dlfcn='$i_dlfcn'
16111 i_fcntl='$i_fcntl'
16112 i_float='$i_float'
16113 i_gdbm='$i_gdbm'
16114 i_grp='$i_grp'
16115 i_iconv='$i_iconv'
16116 i_ieeefp='$i_ieeefp'
16117 i_inttypes='$i_inttypes'
16118 i_libutil='$i_libutil'
16119 i_limits='$i_limits'
16120 i_locale='$i_locale'
16121 i_machcthr='$i_machcthr'
16122 i_malloc='$i_malloc'
16123 i_math='$i_math'
16124 i_memory='$i_memory'
16125 i_mntent='$i_mntent'
16126 i_ndbm='$i_ndbm'
16127 i_netdb='$i_netdb'
16128 i_neterrno='$i_neterrno'
16129 i_netinettcp='$i_netinettcp'
16130 i_niin='$i_niin'
16131 i_poll='$i_poll'
16132 i_prot='$i_prot'
16133 i_pthread='$i_pthread'
16134 i_pwd='$i_pwd'
16135 i_rpcsvcdbm='$i_rpcsvcdbm'
16136 i_sfio='$i_sfio'
16137 i_sgtty='$i_sgtty'
16138 i_shadow='$i_shadow'
16139 i_socks='$i_socks'
16140 i_stdarg='$i_stdarg'
16141 i_stddef='$i_stddef'
16142 i_stdlib='$i_stdlib'
16143 i_string='$i_string'
16144 i_sunmath='$i_sunmath'
16145 i_sysaccess='$i_sysaccess'
16146 i_sysdir='$i_sysdir'
16147 i_sysfile='$i_sysfile'
16148 i_sysfilio='$i_sysfilio'
16149 i_sysin='$i_sysin'
16150 i_sysioctl='$i_sysioctl'
16151 i_syslog='$i_syslog'
16152 i_sysmman='$i_sysmman'
16153 i_sysmode='$i_sysmode'
16154 i_sysmount='$i_sysmount'
16155 i_sysndir='$i_sysndir'
16156 i_sysparam='$i_sysparam'
16157 i_sysresrc='$i_sysresrc'
16158 i_syssecrt='$i_syssecrt'
16159 i_sysselct='$i_sysselct'
16160 i_syssockio='$i_syssockio'
16161 i_sysstat='$i_sysstat'
16162 i_sysstatfs='$i_sysstatfs'
16163 i_sysstatvfs='$i_sysstatvfs'
16164 i_systime='$i_systime'
16165 i_systimek='$i_systimek'
16166 i_systimes='$i_systimes'
16167 i_systypes='$i_systypes'
16168 i_sysuio='$i_sysuio'
16169 i_sysun='$i_sysun'
16170 i_sysutsname='$i_sysutsname'
16171 i_sysvfs='$i_sysvfs'
16172 i_syswait='$i_syswait'
16173 i_termio='$i_termio'
16174 i_termios='$i_termios'
16175 i_time='$i_time'
16176 i_unistd='$i_unistd'
16177 i_ustat='$i_ustat'
16178 i_utime='$i_utime'
16179 i_values='$i_values'
16180 i_varargs='$i_varargs'
16181 i_varhdr='$i_varhdr'
16182 i_vfork='$i_vfork'
16183 ignore_versioned_solibs='$ignore_versioned_solibs'
16184 inc_version_list='$inc_version_list'
16185 inc_version_list_init='$inc_version_list_init'
16186 incpath='$incpath'
16187 inews='$inews'
16188 installarchlib='$installarchlib'
16189 installbin='$installbin'
16190 installman1dir='$installman1dir'
16191 installman3dir='$installman3dir'
16192 installprefix='$installprefix'
16193 installprefixexp='$installprefixexp'
16194 installprivlib='$installprivlib'
16195 installscript='$installscript'
16196 installsitearch='$installsitearch'
16197 installsitebin='$installsitebin'
16198 installsitelib='$installsitelib'
16199 installstyle='$installstyle'
16200 installusrbinperl='$installusrbinperl'
16201 installvendorarch='$installvendorarch'
16202 installvendorbin='$installvendorbin'
16203 installvendorlib='$installvendorlib'
16204 intsize='$intsize'
16205 ivdformat='$ivdformat'
16206 ivsize='$ivsize'
16207 ivtype='$ivtype'
16208 known_extensions='$known_extensions'
16209 ksh='$ksh'
16210 ld='$ld'
16211 lddlflags='$lddlflags'
16212 ldflags='$ldflags'
16213 ldflags_uselargefiles='$ldflags_uselargefiles'
16214 ldlibpthname='$ldlibpthname'
16215 less='$less'
16216 lib_ext='$lib_ext'
16217 libc='$libc'
16218 libperl='$libperl'
16219 libpth='$libpth'
16220 libs='$libs'
16221 libsdirs='$libsdirs'
16222 libsfiles='$libsfiles'
16223 libsfound='$libsfound'
16224 libspath='$libspath'
16225 libswanted='$libswanted'
16226 libswanted_uselargefiles='$libswanted_uselargefiles'
16227 line='$line'
16228 lint='$lint'
16229 lkflags='$lkflags'
16230 ln='$ln'
16231 lns='$lns'
16232 locincpth='$locincpth'
16233 loclibpth='$loclibpth'
16234 longdblsize='$longdblsize'
16235 longlongsize='$longlongsize'
16236 longsize='$longsize'
16237 lp='$lp'
16238 lpr='$lpr'
16239 ls='$ls'
16240 lseeksize='$lseeksize'
16241 lseektype='$lseektype'
16242 mail='$mail'
16243 mailx='$mailx'
16244 make='$make'
16245 make_set_make='$make_set_make'
16246 mallocobj='$mallocobj'
16247 mallocsrc='$mallocsrc'
16248 malloctype='$malloctype'
16249 man1dir='$man1dir'
16250 man1direxp='$man1direxp'
16251 man1ext='$man1ext'
16252 man3dir='$man3dir'
16253 man3direxp='$man3direxp'
16254 man3ext='$man3ext'
16255 mips_type='$mips_type'
16256 mkdir='$mkdir'
16257 mmaptype='$mmaptype'
16258 modetype='$modetype'
16259 more='$more'
16260 multiarch='$multiarch'
16261 mv='$mv'
16262 myarchname='$myarchname'
16263 mydomain='$mydomain'
16264 myhostname='$myhostname'
16265 myuname='$myuname'
16266 n='$n'
16267 need_va_copy='$need_va_copy'
16268 netdb_hlen_type='$netdb_hlen_type'
16269 netdb_host_type='$netdb_host_type'
16270 netdb_name_type='$netdb_name_type'
16271 netdb_net_type='$netdb_net_type'
16272 nm='$nm'
16273 nm_opt='$nm_opt'
16274 nm_so_opt='$nm_so_opt'
16275 nonxs_ext='$nonxs_ext'
16276 nroff='$nroff'
16277 nvEUformat='$nvEUformat'
16278 nvFUformat='$nvFUformat'
16279 nvGUformat='$nvGUformat'
16280 nveformat='$nveformat'
16281 nvfformat='$nvfformat'
16282 nvgformat='$nvgformat'
16283 nvsize='$nvsize'
16284 nvtype='$nvtype'
16285 o_nonblock='$o_nonblock'
16286 obj_ext='$obj_ext'
16287 old_pthread_create_joinable='$old_pthread_create_joinable'
16288 optimize='$optimize'
16289 orderlib='$orderlib'
16290 osname='$osname'
16291 osvers='$osvers'
16292 otherlibdirs='$otherlibdirs'
16293 package='$package'
16294 pager='$pager'
16295 passcat='$passcat'
16296 patchlevel='$patchlevel'
16297 path_sep='$path_sep'
16298 perl5='$perl5'
16299 perl='$perl'
16300 perladmin='$perladmin'
16301 perllibs='$perllibs'
16302 perlpath='$perlpath'
16303 pg='$pg'
16304 phostname='$phostname'
16305 pidtype='$pidtype'
16306 plibpth='$plibpth'
16307 pm_apiversion='$pm_apiversion'
16308 pmake='$pmake'
16309 pr='$pr'
16310 prefix='$prefix'
16311 prefixexp='$prefixexp'
16312 privlib='$privlib'
16313 privlibexp='$privlibexp'
16314 prototype='$prototype'
16315 ptrsize='$ptrsize'
16316 quadkind='$quadkind'
16317 quadtype='$quadtype'
16318 randbits='$randbits'
16319 randfunc='$randfunc'
16320 randseedtype='$randseedtype'
16321 ranlib='$ranlib'
16322 rd_nodata='$rd_nodata'
16323 revision='$revision'
16324 rm='$rm'
16325 rmail='$rmail'
16326 runnm='$runnm'
16327 sPRIEUldbl='$sPRIEUldbl'
16328 sPRIFUldbl='$sPRIFUldbl'
16329 sPRIGUldbl='$sPRIGUldbl'
16330 sPRIXU64='$sPRIXU64'
16331 sPRId64='$sPRId64'
16332 sPRIeldbl='$sPRIeldbl'
16333 sPRIfldbl='$sPRIfldbl'
16334 sPRIgldbl='$sPRIgldbl'
16335 sPRIi64='$sPRIi64'
16336 sPRIo64='$sPRIo64'
16337 sPRIu64='$sPRIu64'
16338 sPRIx64='$sPRIx64'
16339 sSCNfldbl='$sSCNfldbl'
16340 sched_yield='$sched_yield'
16341 scriptdir='$scriptdir'
16342 scriptdirexp='$scriptdirexp'
16343 sed='$sed'
16344 seedfunc='$seedfunc'
16345 selectminbits='$selectminbits'
16346 selecttype='$selecttype'
16347 sendmail='$sendmail'
16348 sh='$sh'
16349 shar='$shar'
16350 sharpbang='$sharpbang'
16351 shmattype='$shmattype'
16352 shortsize='$shortsize'
16353 shrpenv='$shrpenv'
16354 shsharp='$shsharp'
16355 sig_count='$sig_count'
16356 sig_name='$sig_name'
16357 sig_name_init='$sig_name_init'
16358 sig_num='$sig_num'
16359 sig_num_init='$sig_num_init'
16360 signal_t='$signal_t'
16361 sitearch='$sitearch'
16362 sitearchexp='$sitearchexp'
16363 sitebin='$sitebin'
16364 sitebinexp='$sitebinexp'
16365 sitelib='$sitelib'
16366 sitelib_stem='$sitelib_stem'
16367 sitelibexp='$sitelibexp'
16368 siteprefix='$siteprefix'
16369 siteprefixexp='$siteprefixexp'
16370 sizesize='$sizesize'
16371 sizetype='$sizetype'
16372 sleep='$sleep'
16373 smail='$smail'
16374 so='$so'
16375 sockethdr='$sockethdr'
16376 socketlib='$socketlib'
16377 socksizetype='$socksizetype'
16378 sort='$sort'
16379 spackage='$spackage'
16380 spitshell='$spitshell'
16381 src='$src'
16382 ssizetype='$ssizetype'
16383 startperl='$startperl'
16384 startsh='$startsh'
16385 static_ext='$static_ext'
16386 stdchar='$stdchar'
16387 stdio_base='$stdio_base'
16388 stdio_bufsiz='$stdio_bufsiz'
16389 stdio_cnt='$stdio_cnt'
16390 stdio_filbuf='$stdio_filbuf'
16391 stdio_ptr='$stdio_ptr'
16392 stdio_stream_array='$stdio_stream_array'
16393 strings='$strings'
16394 submit='$submit'
16395 subversion='$subversion'
16396 sysman='$sysman'
16397 tail='$tail'
16398 tar='$tar'
16399 tbl='$tbl'
16400 tee='$tee'
16401 test='$test'
16402 timeincl='$timeincl'
16403 timetype='$timetype'
16404 touch='$touch'
16405 tr='$tr'
16406 trnl='$trnl'
16407 troff='$troff'
16408 u16size='$u16size'
16409 u16type='$u16type'
16410 u32size='$u32size'
16411 u32type='$u32type'
16412 u64size='$u64size'
16413 u64type='$u64type'
16414 u8size='$u8size'
16415 u8type='$u8type'
16416 uidformat='$uidformat'
16417 uidsign='$uidsign'
16418 uidsize='$uidsize'
16419 uidtype='$uidtype'
16420 uname='$uname'
16421 uniq='$uniq'
16422 uquadtype='$uquadtype'
16423 use5005threads='$use5005threads'
16424 use64bitall='$use64bitall'
16425 use64bitint='$use64bitint'
16426 usedl='$usedl'
16427 useithreads='$useithreads'
16428 uselargefiles='$uselargefiles'
16429 uselongdouble='$uselongdouble'
16430 usemorebits='$usemorebits'
16431 usemultiplicity='$usemultiplicity'
16432 usemymalloc='$usemymalloc'
16433 usenm='$usenm'
16434 useopcode='$useopcode'
16435 useperlio='$useperlio'
16436 useposix='$useposix'
16437 usesfio='$usesfio'
16438 useshrplib='$useshrplib'
16439 usesocks='$usesocks'
16440 usethreads='$usethreads'
16441 usevendorprefix='$usevendorprefix'
16442 usevfork='$usevfork'
16443 usrinc='$usrinc'
16444 uuname='$uuname'
16445 uvXUformat='$uvXUformat'
16446 uvoformat='$uvoformat'
16447 uvsize='$uvsize'
16448 uvtype='$uvtype'
16449 uvuformat='$uvuformat'
16450 uvxformat='$uvxformat'
16451 vendorarch='$vendorarch'
16452 vendorarchexp='$vendorarchexp'
16453 vendorbin='$vendorbin'
16454 vendorbinexp='$vendorbinexp'
16455 vendorlib='$vendorlib'
16456 vendorlib_stem='$vendorlib_stem'
16457 vendorlibexp='$vendorlibexp'
16458 vendorprefix='$vendorprefix'
16459 vendorprefixexp='$vendorprefixexp'
16460 version='$version'
16461 versiononly='$versiononly'
16462 vi='$vi'
16463 voidflags='$voidflags'
16464 xlibpth='$xlibpth'
16465 xs_apiversion='$xs_apiversion'
16466 zcat='$zcat'
16467 zip='$zip'
16468 EOT
16469
16470 : Add in command line options if available
16471 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16472
16473 : add special variables
16474 $test -f $src/patchlevel.h && \
16475 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16476 echo "CONFIGDOTSH=true" >>config.sh
16477
16478 : propagate old symbols
16479 if $test -f UU/config.sh; then
16480         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16481         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16482         $sort | $uniq -u >UU/oldsyms
16483         set X `cat UU/oldsyms`
16484         shift
16485         case $# in
16486         0) ;;
16487         *)
16488                 cat <<EOM
16489 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16490 EOM
16491                 echo "# Variables propagated from previous config.sh file." >>config.sh
16492                 for sym in `cat UU/oldsyms`; do
16493                         echo "    Propagating $hint variable "'$'"$sym..."
16494                         eval 'tmp="$'"${sym}"'"'
16495                         echo "$tmp" | \
16496                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16497                 done
16498                 ;;
16499         esac
16500 fi
16501
16502 : Finish up by extracting the .SH files
16503 case "$alldone" in
16504 exit)
16505         $rm -rf UU
16506         echo "Done."
16507         exit 0
16508         ;;
16509 cont)
16510         ;;
16511 '')
16512         dflt=''
16513         nostick=true
16514         $cat <<EOM
16515
16516 If you'd like to make any changes to the config.sh file before I begin
16517 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16518
16519 EOM
16520         rp="Press return or use a shell escape to edit config.sh:"
16521         . UU/myread
16522         nostick=''
16523         case "$ans" in
16524         '') ;;
16525         *) : in case they cannot read
16526                 sh 1>&4 -c "$ans";;
16527         esac
16528         ;;
16529 esac
16530
16531 : if this fails, just run all the .SH files by hand
16532 . ./config.sh
16533
16534 echo " "
16535 exec 1>&4
16536 . ./UU/extract
16537
16538 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16539         dflt=y
16540         case "$silent" in
16541         true) ;;
16542         *)
16543                 $cat <<EOM
16544
16545 Now you need to generate make dependencies by running "$make depend".
16546 You might prefer to run it in background: "$make depend > makedepend.out &"
16547 It can take a while, so you might not want to run it right now.
16548
16549 EOM
16550                 ;;
16551         esac
16552         rp="Run $make depend now?"
16553         . UU/myread
16554         case "$ans" in
16555         y*)
16556                 $make depend && echo "Now you must run '$make'."
16557                 ;;
16558         *)
16559                 echo "You must run '$make depend' then '$make'."
16560                 ;;
16561         esac
16562 elif test -f [Mm]akefile; then
16563         echo " "
16564         echo "Now you must run a $make."
16565 else
16566         echo "Done."
16567 fi
16568
16569 if $test -f Policy.sh; then
16570     $cat <<EOM
16571
16572 If you compile $package on a different machine or from a different object
16573 directory, copy the Policy.sh file from this object directory to the
16574 new one before you run Configure -- this will help you with most of
16575 the policy defaults.
16576
16577 EOM
16578 fi
16579 if $test -f config.msg; then
16580     echo "Hmm.  I also noted the following information while running:"
16581     echo " "
16582     $cat config.msg >&4
16583     $rm -f config.msg
16584 fi
16585 $rm -f kit*isdone ark*isdone
16586 $rm -rf UU
16587
16588 : End of Configure
16589