f8bdce86b00a598b6e018332bc8a140128fa1065
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Feb 29 19:47:23 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getpwent=''
396 d_getsent=''
397 d_getservprotos=''
398 d_getspent=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_killpg=''
410 d_lchown=''
411 d_ldbl_dig=''
412 d_link=''
413 d_locconv=''
414 d_lockf=''
415 d_longdbl=''
416 longdblsize=''
417 d_longlong=''
418 longlongsize=''
419 d_lseekproto=''
420 d_lstat=''
421 d_madvise=''
422 d_mblen=''
423 d_mbstowcs=''
424 d_mbtowc=''
425 d_memchr=''
426 d_memcmp=''
427 d_memcpy=''
428 d_memmove=''
429 d_memset=''
430 d_mkdir=''
431 d_mkdtemp=''
432 d_mkfifo=''
433 d_mkstemp=''
434 d_mkstemps=''
435 d_mktime=''
436 d_mmap=''
437 mmaptype=''
438 d_mprotect=''
439 d_msg=''
440 d_msgctl=''
441 d_msgget=''
442 d_msgrcv=''
443 d_msgsnd=''
444 d_msync=''
445 d_munmap=''
446 d_nice=''
447 d_off64_t=''
448 d_open3=''
449 d_fpathconf=''
450 d_pathconf=''
451 d_pause=''
452 d_pipe=''
453 d_poll=''
454 d_portable=''
455 d_old_pthread_create_joinable=''
456 old_pthread_create_joinable=''
457 d_pthread_yield=''
458 d_sched_yield=''
459 sched_yield=''
460 d_qgcvt=''
461 d_readdir=''
462 d_rewinddir=''
463 d_seekdir=''
464 d_telldir=''
465 d_readlink=''
466 d_rename=''
467 d_rmdir=''
468 d_safebcpy=''
469 d_safemcpy=''
470 d_sanemcmp=''
471 d_select=''
472 d_sem=''
473 d_semctl=''
474 d_semget=''
475 d_semop=''
476 d_setegid=''
477 d_seteuid=''
478 d_setgrent=''
479 d_setgrps=''
480 d_sethent=''
481 d_setlinebuf=''
482 d_setlocale=''
483 d_setnent=''
484 d_setpent=''
485 d_setpgid=''
486 d_setpgrp2=''
487 d_bsdsetpgrp=''
488 d_setpgrp=''
489 d_setprior=''
490 d_setpwent=''
491 d_setregid=''
492 d_setresgid=''
493 d_setresuid=''
494 d_setreuid=''
495 d_setrgid=''
496 d_setruid=''
497 d_setsent=''
498 d_setsid=''
499 d_setspent=''
500 d_setvbuf=''
501 d_sfio=''
502 usesfio=''
503 d_shm=''
504 d_shmat=''
505 d_shmatprototype=''
506 shmattype=''
507 d_shmctl=''
508 d_shmdt=''
509 d_shmget=''
510 d_sigaction=''
511 d_sigsetjmp=''
512 d_msg_ctrunc=''
513 d_msg_dontroute=''
514 d_msg_oob=''
515 d_msg_peek=''
516 d_msg_proxy=''
517 d_oldsock=''
518 d_scm_rights=''
519 d_socket=''
520 d_sockpair=''
521 sockethdr=''
522 socketlib=''
523 d_socklen_t=''
524 d_sqrtl=''
525 d_statblks=''
526 d_statfs_f_flags=''
527 d_statfs_s=''
528 d_fstatvfs=''
529 d_statvfs=''
530 d_stdio_cnt_lval=''
531 d_stdio_ptr_lval=''
532 d_stdiobase=''
533 d_stdstdio=''
534 stdio_base=''
535 stdio_bufsiz=''
536 stdio_cnt=''
537 stdio_filbuf=''
538 stdio_ptr=''
539 d_index=''
540 d_strchr=''
541 d_strcoll=''
542 d_strctcpy=''
543 d_strerrm=''
544 d_strerror=''
545 d_sysernlst=''
546 d_syserrlst=''
547 d_strtod=''
548 d_strtol=''
549 d_strtold=''
550 d_strtoll=''
551 d_strtoul=''
552 d_strtoull=''
553 d_strtouq=''
554 d_strxfrm=''
555 d_symlink=''
556 d_syscall=''
557 d_sysconf=''
558 d_system=''
559 d_tcgetpgrp=''
560 d_tcsetpgrp=''
561 d_telldirproto=''
562 d_time=''
563 timetype=''
564 clocktype=''
565 d_times=''
566 d_truncate=''
567 d_tzname=''
568 d_umask=''
569 d_semctl_semid_ds=''
570 d_semctl_semun=''
571 d_union_semun=''
572 d_ustat=''
573 d_vfork=''
574 usevfork=''
575 d_voidsig=''
576 signal_t=''
577 d_volatile=''
578 d_charvspr=''
579 d_vprintf=''
580 d_wait4=''
581 d_waitpid=''
582 d_wcstombs=''
583 d_wctomb=''
584 dlext=''
585 cccdlflags=''
586 ccdlflags=''
587 dlsrc=''
588 ld=''
589 lddlflags=''
590 usedl=''
591 doublesize=''
592 ebcdic=''
593 fflushNULL=''
594 fflushall=''
595 fpossize=''
596 fpostype=''
597 gidformat=''
598 gidsign=''
599 gidsize=''
600 gidtype=''
601 groupstype=''
602 h_fcntl=''
603 h_sysfile=''
604 i_arpainet=''
605 db_hashtype=''
606 db_prefixtype=''
607 i_db=''
608 i_dbm=''
609 i_rpcsvcdbm=''
610 d_dirnamlen=''
611 direntrytype=''
612 i_dirent=''
613 i_dld=''
614 i_dlfcn=''
615 i_fcntl=''
616 i_float=''
617 i_gdbm=''
618 d_grpasswd=''
619 i_grp=''
620 i_iconv=''
621 i_inttypes=''
622 i_limits=''
623 i_locale=''
624 i_machcthr=''
625 i_malloc=''
626 i_math=''
627 i_memory=''
628 i_mntent=''
629 i_ndbm=''
630 i_netdb=''
631 i_neterrno=''
632 i_netinettcp=''
633 i_niin=''
634 i_sysin=''
635 i_poll=''
636 i_pthread=''
637 d_pwage=''
638 d_pwchange=''
639 d_pwclass=''
640 d_pwcomment=''
641 d_pwexpire=''
642 d_pwgecos=''
643 d_pwpasswd=''
644 d_pwquota=''
645 i_pwd=''
646 i_sfio=''
647 i_shadow=''
648 i_socks=''
649 i_stddef=''
650 i_stdlib=''
651 i_string=''
652 strings=''
653 i_sysaccess=''
654 i_sysdir=''
655 i_sysfile=''
656 d_voidtty=''
657 i_bsdioctl=''
658 i_sysfilio=''
659 i_sysioctl=''
660 i_syssockio=''
661 i_syslog=''
662 i_sysmman=''
663 i_sysmode=''
664 i_sysmount=''
665 i_sysndir=''
666 i_sysparam=''
667 i_sysresrc=''
668 i_syssecrt=''
669 i_sysselct=''
670 i_sysstat=''
671 i_sysstatfs=''
672 i_sysstatvfs=''
673 i_systimes=''
674 i_systypes=''
675 i_sysuio=''
676 i_sysun=''
677 i_sysutsname=''
678 i_sysvfs=''
679 i_syswait=''
680 i_sgtty=''
681 i_termio=''
682 i_termios=''
683 i_systime=''
684 i_systimek=''
685 i_time=''
686 timeincl=''
687 i_unistd=''
688 i_ustat=''
689 i_utime=''
690 i_values=''
691 i_stdarg=''
692 i_varargs=''
693 i_varhdr=''
694 i_vfork=''
695 inc_version_list=''
696 inc_version_list_init=''
697 installprefix=''
698 installprefixexp=''
699 installstyle=''
700 installusrbinperl=''
701 intsize=''
702 longsize=''
703 shortsize=''
704 libc=''
705 ldlibpthname=''
706 libperl=''
707 shrpenv=''
708 useshrplib=''
709 glibpth=''
710 libpth=''
711 loclibpth=''
712 plibpth=''
713 xlibpth=''
714 ignore_versioned_solibs=''
715 libs=''
716 libsdirs=''
717 libsfiles=''
718 libsfound=''
719 libspath=''
720 lns=''
721 d_PRIEldbl=''
722 d_PRIFldbl=''
723 d_PRIGldbl=''
724 d_PRIeldbl=''
725 d_PRIfldbl=''
726 d_PRIgldbl=''
727 sPRIEldbl=''
728 sPRIFldbl=''
729 sPRIGldbl=''
730 sPRIeldbl=''
731 sPRIfldbl=''
732 sPRIgldbl=''
733 lseeksize=''
734 lseektype=''
735 make_set_make=''
736 d_mymalloc=''
737 freetype=''
738 mallocobj=''
739 mallocsrc=''
740 malloctype=''
741 usemymalloc=''
742 installman1dir=''
743 man1dir=''
744 man1direxp=''
745 man1ext=''
746 installman3dir=''
747 man3dir=''
748 man3direxp=''
749 man3ext=''
750 huge=''
751 large=''
752 medium=''
753 models=''
754 small=''
755 split=''
756 modetype=''
757 multiarch=''
758 mydomain=''
759 myhostname=''
760 phostname=''
761 c=''
762 n=''
763 d_eofnblk=''
764 eagain=''
765 o_nonblock=''
766 rd_nodata=''
767 netdb_hlen_type=''
768 netdb_host_type=''
769 netdb_name_type=''
770 netdb_net_type=''
771 groupcat=''
772 hostcat=''
773 passcat=''
774 orderlib=''
775 ranlib=''
776 package=''
777 spackage=''
778 pager=''
779 api_revision=''
780 api_subversion=''
781 api_version=''
782 api_versionstring=''
783 patchlevel=''
784 revision=''
785 subversion=''
786 version=''
787 perl5=''
788 perladmin=''
789 perlpath=''
790 d_nv_preserves_uv=''
791 i16size=''
792 i16type=''
793 i32size=''
794 i32type=''
795 i64size=''
796 i64type=''
797 i8size=''
798 i8type=''
799 ivsize=''
800 ivtype=''
801 nvsize=''
802 nvtype=''
803 u16size=''
804 u16type=''
805 u32size=''
806 u32type=''
807 u64size=''
808 u64type=''
809 u8size=''
810 u8type=''
811 uvsize=''
812 uvtype=''
813 ivdformat=''
814 uvoformat=''
815 uvuformat=''
816 uvxformat=''
817 pidtype=''
818 prefix=''
819 prefixexp=''
820 installprivlib=''
821 privlib=''
822 privlibexp=''
823 prototype=''
824 ptrsize=''
825 d_PRIX64=''
826 d_PRId64=''
827 d_PRIi64=''
828 d_PRIo64=''
829 d_PRIu64=''
830 d_PRIx64=''
831 sPRIX64=''
832 sPRId64=''
833 sPRIi64=''
834 sPRIo64=''
835 sPRIu64=''
836 sPRIx64=''
837 d_quad=''
838 quadkind=''
839 quadtype=''
840 uquadtype=''
841 drand01=''
842 randbits=''
843 randfunc=''
844 randseedtype=''
845 seedfunc=''
846 installscript=''
847 scriptdir=''
848 scriptdirexp=''
849 selectminbits=''
850 selecttype=''
851 sh=''
852 sig_count=''
853 sig_name=''
854 sig_name_init=''
855 sig_num=''
856 sig_num_init=''
857 installsitearch=''
858 sitearch=''
859 sitearchexp=''
860 installsitebin=''
861 sitebin=''
862 sitebinexp=''
863 installsitelib=''
864 sitelib=''
865 sitelibexp=''
866 siteprefix=''
867 siteprefixexp=''
868 sizetype=''
869 so=''
870 socksizetype=''
871 sharpbang=''
872 shsharp=''
873 spitshell=''
874 src=''
875 ssizetype=''
876 startperl=''
877 startsh=''
878 stdchar=''
879 d_stdio_stream_array=''
880 stdio_stream_array=''
881 sysman=''
882 trnl=''
883 uidformat=''
884 uidsign=''
885 uidsize=''
886 uidtype=''
887 archname64=''
888 use64bitall=''
889 use64bitint=''
890 uselargefiles=''
891 uselongdouble=''
892 usemorebits=''
893 usemultiplicity=''
894 nm_opt=''
895 nm_so_opt=''
896 runnm=''
897 usenm=''
898 useperlio=''
899 usesocks=''
900 d_oldpthreads=''
901 use5005threads=''
902 useithreads=''
903 usethreads=''
904 incpath=''
905 mips_type=''
906 usrinc=''
907 d_vendorbin=''
908 installvendorbin=''
909 vendorbin=''
910 vendorbinexp=''
911 d_vendorlib=''
912 installvendorlib=''
913 vendorlib=''
914 vendorlibexp=''
915 usevendorprefix=''
916 vendorprefix=''
917 vendorprefixexp=''
918 defvoidused=''
919 voidflags=''
920 pm_apiversion=''
921 xs_apiversion=''
922 CONFIG=''
923
924 define='define'
925 undef='undef'
926 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
927 rmlist=''
928
929 : We must find out about Eunice early
930 eunicefix=':'
931 if test -f /etc/unixtovms; then
932         eunicefix=/etc/unixtovms
933 fi
934 if test -f /etc/unixtovms.exe; then
935         eunicefix=/etc/unixtovms.exe
936 fi
937
938 i_whoami=''
939 : set useposix=false in your hint file to disable the POSIX extension.
940 useposix=true
941 : set useopcode=false in your hint file to disable the Opcode extension.
942 useopcode=true
943 : Trailing extension.  Override this in a hint file, if needed.
944 _exe=''
945 : Extra object files, if any, needed on this platform.
946 archobjs=''
947 : Possible local include directories to search.
948 : Set locincpth to "" in a hint file to defeat local include searches.
949 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
950 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
951 :
952 : no include file wanted by default
953 inclwanted=''
954
955 groupstype=''
956 : change the next line if compiling for Xenix/286 on Xenix/386
957 xlibpth='/usr/lib/386 /lib/386'
958 : Possible local library directories to search.
959 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
960 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
961
962 : general looking path for locating libraries
963 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
964 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
965 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
966 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
967 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
968
969 : Private path used by Configure to find libraries.  Its value
970 : is prepended to libpth. This variable takes care of special
971 : machines, like the mips.  Usually, it should be empty.
972 plibpth=''
973
974 : default library list
975 libswanted=''
976 : some systems want to use only the non-versioned libso:s
977 ignore_versioned_solibs=''
978 : set usemultiplicity on the Configure command line to enable multiplicity.
979 : set usesocks on the Configure command line to enable socks.
980 : set usethreads on the Configure command line to enable threads.
981 : full support for void wanted by default
982 defvoidused=15
983
984 : List of libraries we want.
985 : If anyone needs -lnet, put it in a hint file.
986 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
987 libswanted="$libswanted dld ld sun m c cposix posix"
988 libswanted="$libswanted ndir dir crypt sec"
989 libswanted="$libswanted ucb bsd BSD PW x iconv"
990 : We probably want to search /usr/shlib before most other libraries.
991 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
992 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
993 glibpth="/usr/shlib $glibpth"
994 : Do not use vfork unless overridden by a hint file.
995 usevfork=false
996
997 : Find the basic shell for Bourne shell scripts
998 case "$sh" in
999 '')
1000         case "$SYSTYPE" in
1001         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1002         *) xxx='/bin/sh';;
1003         esac
1004         if test -f "$xxx"; then
1005                 sh="$xxx"
1006         else
1007                 : Build up a list and do a single loop so we can 'break' out.
1008                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1009                 for xxx in sh bash ksh pdksh ash; do
1010                         for p in $pth; do
1011                                 try="$try ${p}/${xxx}"
1012                         done
1013                 done
1014                 for xxx in $try; do
1015                         if test -f "$xxx"; then
1016                                 sh="$xxx";
1017                                 break
1018                         elif test -f "$xxx.exe"; then
1019                                 sh="$xxx";
1020                                 break
1021                         fi
1022                 done
1023         fi
1024         ;;
1025 esac
1026
1027 case "$sh" in
1028 '')     cat <<EOM >&2
1029 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1030
1031 Usually it's in /bin/sh.  How did you even get this far?
1032 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1033 we'll try to straighten this all out.
1034 EOM
1035         exit 1
1036         ;;
1037 esac
1038
1039 : see if sh knows # comments
1040 if `$sh -c '#' >/dev/null 2>&1`; then
1041         shsharp=true
1042         spitshell=cat
1043         xcat=/bin/cat
1044         test -f $xcat || xcat=/usr/bin/cat
1045         echo "#!$xcat" >try
1046         $eunicefix try
1047         chmod +x try
1048         ./try > today
1049         if test -s today; then
1050                 sharpbang='#!'
1051         else
1052                 echo "#! $xcat" > try
1053                 $eunicefix try
1054                 chmod +x try
1055                 ./try > today
1056                 if test -s today; then
1057                         sharpbang='#! '
1058                 else
1059                         sharpbang=': use '
1060                 fi
1061         fi
1062 else
1063         echo " "
1064         echo "Your $sh doesn't grok # comments--I will strip them later on."
1065         shsharp=false
1066         cd ..
1067         echo "exec grep -v '^[  ]*#'" >spitshell
1068         chmod +x spitshell
1069         $eunicefix spitshell
1070         spitshell=`pwd`/spitshell
1071         cd UU
1072         echo "I presume that if # doesn't work, #! won't work either!"
1073         sharpbang=': use '
1074 fi
1075 rm -f try today
1076
1077 : figure out how to guarantee sh startup
1078 case "$startsh" in
1079 '') startsh=${sharpbang}${sh} ;;
1080 *)
1081 esac
1082 cat >try <<EOSS
1083 $startsh
1084 set abc
1085 test "$?abc" != 1
1086 EOSS
1087
1088 chmod +x try
1089 $eunicefix try
1090 if ./try; then
1091         : echo "Yup, it does."
1092 else
1093         echo "Hmm... '$startsh' does not guarantee sh startup..."
1094         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1095 fi
1096 rm -f try
1097
1098
1099 : Save command line options in file UU/cmdline.opt for later use in
1100 : generating config.sh.
1101 cat > cmdline.opt <<EOSH
1102 # Configure command line arguments.
1103 config_arg0='$0'
1104 config_args='$*'
1105 config_argc=$#
1106 EOSH
1107 argn=1
1108 for arg in "$@"; do
1109         cat >>cmdline.opt <<EOSH
1110 config_arg$argn='$arg'
1111 EOSH
1112         argn=`expr $argn + 1`
1113 done
1114
1115 : produce awk script to parse command line options
1116 cat >options.awk <<'EOF'
1117 BEGIN {
1118         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1119
1120         len = length(optstr);
1121         for (i = 1; i <= len; i++) {
1122                 c = substr(optstr, i, 1);
1123                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1124                 if (a == ":") {
1125                         arg[c] = 1;
1126                         i++;
1127                 }
1128                 opt[c] = 1;
1129         }
1130 }
1131 {
1132         expect = 0;
1133         str = $0;
1134         if (substr(str, 1, 1) != "-") {
1135                 printf("'%s'\n", str);
1136                 next;
1137         }
1138         len = length($0);
1139         for (i = 2; i <= len; i++) {
1140                 c = substr(str, i, 1);
1141                 if (!opt[c]) {
1142                         printf("-%s\n", substr(str, i));
1143                         next;
1144                 }
1145                 printf("-%s\n", c);
1146                 if (arg[c]) {
1147                         if (i < len)
1148                                 printf("'%s'\n", substr(str, i + 1));
1149                         else
1150                                 expect = 1;
1151                         next;
1152                 }
1153         }
1154 }
1155 END {
1156         if (expect)
1157                 print "?";
1158 }
1159 EOF
1160
1161 : process the command line options
1162 set X `for arg in "$@"; do echo "X$arg"; done |
1163         sed -e s/X// | awk -f options.awk`
1164 eval "set $*"
1165 shift
1166 rm -f options.awk
1167
1168 : set up default values
1169 fastread=''
1170 reuseval=false
1171 config_sh=''
1172 alldone=''
1173 error=''
1174 silent=''
1175 extractsh=''
1176 override=''
1177 knowitall=''
1178 rm -f optdef.sh posthint.sh
1179 cat >optdef.sh <<EOS
1180 $startsh
1181 EOS
1182
1183
1184 : option parsing
1185 while test $# -gt 0; do
1186         case "$1" in
1187         -d) shift; fastread=yes;;
1188         -e) shift; alldone=cont;;
1189         -f)
1190                 shift
1191                 cd ..
1192                 if test -r "$1"; then
1193                         config_sh="$1"
1194                 else
1195                         echo "$me: cannot read config file $1." >&2
1196                         error=true
1197                 fi
1198                 cd UU
1199                 shift;;
1200         -h) shift; error=true;;
1201         -r) shift; reuseval=true;;
1202         -s) shift; silent=true; realsilent=true;;
1203         -E) shift; alldone=exit;;
1204         -K) shift; knowitall=true;;
1205         -O) shift; override=true;;
1206         -S) shift; silent=true; extractsh=true;;
1207         -D)
1208                 shift
1209                 case "$1" in
1210                 *=)
1211                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1212                         echo "$me: ignoring -D $1" >&2
1213                         ;;
1214                 *=*) echo "$1" | \
1215                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1216                 *) echo "$1='define'" >> optdef.sh;;
1217                 esac
1218                 shift
1219                 ;;
1220         -U)
1221                 shift
1222                 case "$1" in
1223                 *=) echo "$1" >> optdef.sh;;
1224                 *=*)
1225                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1226                         echo "$me: ignoring -U $1" >&2
1227                         ;;
1228                 *) echo "$1='undef'" >> optdef.sh;;
1229                 esac
1230                 shift
1231                 ;;
1232         -A)
1233             shift
1234             xxx=''
1235             yyy="$1"
1236             zzz=''
1237             uuu=undef
1238             case "$yyy" in
1239             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1240                  case "$zzz" in
1241                  *:*) zzz='' ;;
1242                  *)   xxx=append
1243                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1244                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1245                  esac
1246                  ;;
1247             esac
1248             case "$xxx" in
1249             '')  case "$yyy" in
1250                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1251                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1252                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1253                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1254                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1255                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1256                  esac
1257                  ;;       
1258             esac
1259             case "$xxx" in
1260             append)
1261                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1262             clear)
1263                 echo "$yyy=''"                  >> posthint.sh ;;
1264             define)
1265                 case "$zzz" in
1266                 '') zzz=define ;;
1267                 esac
1268                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1269             eval)
1270                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1271             prepend)
1272                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1273             undef)
1274                 case "$zzz" in
1275                 '') zzz="$uuu" ;;
1276                 esac
1277                 echo "$yyy=$zzz"                >> posthint.sh ;;
1278             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1279             esac
1280             shift
1281             ;;
1282         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1283             exit 0;;
1284         --) break;;
1285         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1286         *) break;;
1287         esac
1288 done
1289
1290 case "$error" in
1291 true)
1292         cat >&2 <<EOM
1293 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1294                  [-U symbol] [-U symbol=] [-A command:symbol...]
1295   -d : use defaults for all answers.
1296   -e : go on without questioning past the production of config.sh.
1297   -f : specify an alternate default configuration file.
1298   -h : print this help message and exit (with an error status).
1299   -r : reuse C symbols value if possible (skips costly nm extraction).
1300   -s : silent mode, only echoes questions and essential information.
1301   -D : define symbol to have some value:
1302          -D symbol         symbol gets the value 'define'
1303          -D symbol=value   symbol gets the value 'value'
1304   -E : stop at the end of questions, after having produced config.sh.
1305   -K : do not use unless you know what you are doing.
1306   -O : let -D and -U override definitions from loaded configuration file.
1307   -S : perform variable substitutions on all .SH files (can mix with -f)
1308   -U : undefine symbol:
1309          -U symbol    symbol gets the value 'undef'
1310          -U symbol=   symbol gets completely empty
1311   -A : manipulate symbol after the platform specific hints have been applied:
1312          -A symbol=value                append " "value to symbol
1313          -A append:symbol=value         append value to symbol
1314          -A define:symbol=value         define symbol to have value
1315          -A clear:symbol                define symbol to be ''
1316          -A define:symbol               define symbol to be 'define'
1317          -A eval:symbol=value           define symbol to be eval of value
1318          -A prepend:symbol=value        prepend value to symbol
1319          -A undef:symbol                define symbol to be 'undef'
1320          -A undef:symbol=               define symbol to be ''
1321   -V : print version number and exit (with a zero status).
1322 EOM
1323         exit 1
1324         ;;
1325 esac
1326
1327 : Sanity checks
1328 case "$fastread$alldone" in
1329 yescont|yesexit) ;;
1330 *)
1331         if test ! -t 0; then
1332                 echo "Say 'sh Configure', not 'sh <Configure'"
1333                 exit 1
1334         fi
1335         ;;
1336 esac
1337
1338 exec 4>&1
1339 case "$silent" in
1340 true) exec 1>/dev/null;;
1341 esac
1342
1343 : run the defines and the undefines, if any, but leave the file out there...
1344 touch optdef.sh
1345 . ./optdef.sh
1346 : create the posthint manipulation script and leave the file out there...
1347 touch posthint.sh
1348
1349 : set package name
1350 package=perl5
1351 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1352 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1353 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1354 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1355 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1356 esac
1357
1358 : Some greps do not return status, grrr.
1359 echo "grimblepritz" >grimble
1360 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1361         contains=contains
1362 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1363         contains=grep
1364 else
1365         contains=contains
1366 fi
1367 rm -f grimble
1368 : the following should work in any shell
1369 case "$contains" in
1370 contains*)
1371         echo " "
1372         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1373         cat >contains <<'EOSS'
1374 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1375 EOSS
1376 chmod +x contains
1377 esac
1378
1379 : Find the path to the source tree
1380 case "$src" in
1381 '') case "$0" in
1382     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1383          case "$src" in
1384          /*)    ;;
1385          *)     src=`cd ../$src && pwd` ;;
1386          esac
1387          ;;
1388     *)   src='.';;
1389     esac;;
1390 esac
1391 case "$src" in
1392 '')     src=/
1393         rsrc=/
1394         ;;
1395 /*) rsrc="$src";;
1396 *) rsrc="../$src";;
1397 esac
1398 if test -f $rsrc/Configure && \
1399         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1400 then
1401    : found it, so we are ok.
1402 else
1403         rsrc=''
1404         for src in . .. ../.. ../../.. ../../../..; do
1405                 if test -f ../$src/Configure && \
1406                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1407                 then
1408                         rsrc=../$src
1409                         break
1410                 fi
1411         done
1412 fi
1413 case "$rsrc" in
1414 '')
1415         cat <<EOM >&4
1416
1417 Sorry, I can't seem to locate the source dir for $package.  Please start
1418 Configure with an explicit path -- i.e. /some/path/Configure.
1419
1420 EOM
1421         exit 1
1422         ;;
1423 ../.)   rsrc='..';;
1424 *)
1425         echo " "
1426         echo "Sources for $package found in \"$src\"." >&4
1427         ;;
1428 esac
1429
1430 : script used to extract .SH files with variable substitutions
1431 cat >extract <<'EOS'
1432 CONFIGDOTSH=true
1433 echo "Doing variable substitutions on .SH files..."
1434 if test -f $src/MANIFEST; then
1435         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1436 else
1437         echo "(Looking for .SH files under the source directory.)"
1438         set x `(cd $src; find . -name "*.SH" -print)`
1439 fi
1440 shift
1441 case $# in
1442 0) set x `(cd $src; echo *.SH)`; shift;;
1443 esac
1444 if test ! -f $src/$1; then
1445         shift
1446 fi
1447 mkdir_p='
1448 name=$1;
1449 create="";
1450 while test $name; do
1451         if test ! -d "$name"; then
1452                 create="$name $create";
1453                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1454                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1455         else
1456                 name="";
1457         fi;
1458 done;
1459 for file in $create; do
1460         mkdir $file;
1461 done
1462 '
1463 for file in $*; do
1464         case "$src" in
1465         ".")
1466                 case "$file" in
1467                 */*)
1468                         dir=`expr X$file : 'X\(.*\)/'`
1469                         file=`expr X$file : 'X.*/\(.*\)'`
1470                         (cd $dir && . ./$file)
1471                         ;;
1472                 *)
1473                         . ./$file
1474                         ;;
1475                 esac
1476                 ;;
1477         *)
1478                 case "$file" in
1479                 */*)
1480                         dir=`expr X$file : 'X\(.*\)/'`
1481                         file=`expr X$file : 'X.*/\(.*\)'`
1482                         (set x $dir; shift; eval $mkdir_p)
1483                         sh <$src/$dir/$file
1484                         ;;
1485                 *)
1486                         sh <$src/$file
1487                         ;;
1488                 esac
1489                 ;;
1490         esac
1491 done
1492 if test -f $src/config_h.SH; then
1493         if test ! -f config.h; then
1494         : oops, they left it out of MANIFEST, probably, so do it anyway.
1495         . $src/config_h.SH
1496         fi
1497 fi
1498 EOS
1499
1500 : extract files and exit if asked to do so
1501 case "$extractsh" in
1502 true)
1503         case "$realsilent" in
1504         true) ;;
1505         *) exec 1>&4;;
1506         esac
1507         case "$config_sh" in
1508         '') config_sh='config.sh';;
1509         esac
1510         echo " "
1511         echo "Fetching answers from $config_sh..."
1512         cd ..
1513         . $config_sh
1514         test "$override" && . ./optdef.sh
1515         echo " "
1516         . UU/extract
1517         rm -rf UU
1518         echo "Done."
1519         exit 0
1520         ;;
1521 esac
1522
1523 : Eunice requires " " instead of "", can you believe it
1524 echo " "
1525 : Here we go...
1526 echo "Beginning of configuration questions for $package."
1527
1528 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1529
1530 : first determine how to suppress newline on echo command
1531 echo " "
1532 echo "Checking echo to see how to suppress newlines..."
1533 (echo "hi there\c" ; echo " ") >.echotmp
1534 if $contains c .echotmp >/dev/null 2>&1 ; then
1535         echo "...using -n."
1536         n='-n'
1537         c=''
1538 else
1539         cat <<'EOM'
1540 ...using \c
1541 EOM
1542         n=''
1543         c='\c'
1544 fi
1545 echo $n "The star should be here-->$c"
1546 echo '*'
1547 rm -f .echotmp
1548
1549 : Now test for existence of everything in MANIFEST
1550 echo " "
1551 if test -f $rsrc/MANIFEST; then
1552         echo "First let's make sure your kit is complete.  Checking..." >&4
1553         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1554         rm -f missing
1555         tmppwd=`pwd`
1556         for filelist in x??; do
1557                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1558         done
1559         if test -s missing; then
1560                 cat missing >&4
1561                 cat >&4 <<'EOM'
1562
1563 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1564
1565 You have the option of continuing the configuration process, despite the
1566 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1567 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1568 and contact the author (perlbug@perl.com).
1569
1570 EOM
1571                 echo $n "Continue? [n] $c" >&4
1572                 read ans
1573                 case "$ans" in
1574                 y*)
1575                         echo "Continuing..." >&4
1576                         rm -f missing
1577                         ;;
1578                 *)
1579                         echo "ABORTING..." >&4
1580                         kill $$
1581                         ;;
1582                 esac
1583         else
1584                 echo "Looks good..."
1585         fi
1586 else
1587         echo "There is no MANIFEST file.  I hope your kit is complete !"
1588 fi
1589 rm -f missing x??
1590
1591 echo " "
1592 : Find the appropriate value for a newline for tr
1593 if test -n "$DJGPP"; then
1594        trnl='\012'
1595 fi
1596 if test X"$trnl" = X; then
1597         case "`echo foo|tr '\n' x 2>/dev/null`" in
1598         foox) trnl='\n' ;;
1599         esac
1600 fi
1601 if test X"$trnl" = X; then
1602         case "`echo foo|tr '\012' x 2>/dev/null`" in
1603         foox) trnl='\012' ;;
1604         esac
1605 fi
1606 if test X"$trnl" = X; then
1607         cat <<EOM >&2
1608
1609 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1610
1611 EOM
1612         exit 1
1613 fi
1614
1615 : compute the number of columns on the terminal for proper question formatting
1616 case "$COLUMNS" in
1617 '') COLUMNS='80';;
1618 esac
1619
1620 : set up the echo used in my read
1621 myecho="case \"\$xxxm\" in
1622 '') echo $n \"\$rp $c\" >&4;;
1623 *) case \"\$rp\" in
1624         '') echo $n \"[\$xxxm] $c\";;
1625         *)
1626                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1627                         echo \"\$rp\" >&4
1628                         echo $n \"[\$xxxm] $c\" >&4
1629                 else
1630                         echo $n \"\$rp [\$xxxm] $c\" >&4
1631                 fi
1632                 ;;
1633         esac;;
1634 esac"
1635
1636 : now set up to do reads with possible shell escape and default assignment
1637 cat <<EOSC >myread
1638 $startsh
1639 xxxm=\$dflt
1640 $myecho
1641 ans='!'
1642 case "\$fastread" in
1643 yes) case "\$dflt" in
1644         '') ;;
1645         *) ans='';
1646                 case "\$silent-\$rp" in
1647                 true-) ;;
1648                 *) echo " " >&4;;
1649                 esac;;
1650         esac;;
1651 *) case "\$silent" in
1652         true) case "\$rp" in
1653                 '') ans='';;
1654                 esac;;
1655         esac;;
1656 esac
1657 while expr "X\$ans" : "X!" >/dev/null; do
1658         read answ
1659         set x \$xxxm
1660         shift
1661         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1662         case  "\$answ" in
1663         "!")
1664                 sh 1>&4
1665                 echo " "
1666                 $myecho
1667                 ;;
1668         !*)
1669                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1670                 shift
1671                 sh 1>&4 -c "\$*"
1672                 echo " "
1673                 $myecho
1674                 ;;
1675         "\$ans")
1676                 case "\$ans" in
1677                 \\&*)
1678                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1679                         shift
1680                         case "\$1" in
1681                         -d)
1682                                 fastread=yes
1683                                 echo "(OK, I'll run with -d after this question.)" >&4
1684                                 ;;
1685                         -*)
1686                                 echo "*** Sorry, \$1 not supported yet." >&4
1687                                 ;;
1688                         esac
1689                         $myecho
1690                         ans=!
1691                         ;;
1692                 esac;;
1693         *)
1694                 case "\$aok" in
1695                 y)
1696                         echo "*** Substitution done -- please confirm."
1697                         xxxm="\$ans"
1698                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1699                         xxxm="\$ans"
1700                         ans=!
1701                         ;;
1702                 *)
1703                         echo "*** Error -- try again."
1704                         ans=!
1705                         ;;
1706                 esac
1707                 $myecho
1708                 ;;
1709         esac
1710         case "\$ans\$xxxm\$nostick" in
1711         '')
1712                 ans=!
1713                 $myecho
1714                 ;;
1715         esac
1716 done
1717 case "\$ans" in
1718 '') ans="\$xxxm";;
1719 esac
1720 EOSC
1721
1722 : create .config dir to save info across Configure sessions
1723 test -d ../.config || mkdir ../.config
1724 cat >../.config/README <<EOF
1725 This directory created by Configure to save information that should
1726 persist across sessions for $package.
1727
1728 You may safely delete it if you wish.
1729 EOF
1730
1731 : general instructions
1732 needman=true
1733 firsttime=true
1734 user=`(logname) 2>/dev/null`
1735 case "$user" in
1736 '') user=`whoami 2>&1`;;
1737 esac
1738 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1739         firsttime=false
1740         echo " "
1741         rp='Would you like to see the instructions?'
1742         dflt=n
1743         . ./myread
1744         case "$ans" in
1745         [yY]*) ;;
1746         *) needman=false;;
1747         esac
1748 fi
1749 if $needman; then
1750         cat <<EOH
1751
1752 This installation shell script will examine your system and ask you questions
1753 to determine how the perl5 package should be installed. If you get
1754 stuck on a question, you may use a ! shell escape to start a subshell or
1755 execute a command.  Many of the questions will have default answers in square
1756 brackets; typing carriage return will give you the default.
1757
1758 On some of the questions which ask for file or directory names you are allowed
1759 to use the ~name construct to specify the login directory belonging to "name",
1760 even if you don't have a shell which knows about that.  Questions where this is
1761 allowed will be marked "(~name ok)".
1762
1763 EOH
1764         rp=''
1765         dflt='Type carriage return to continue'
1766         . ./myread
1767         cat <<'EOH'
1768
1769 The prompter used in this script allows you to use shell variables and
1770 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1771 in the default answer, as if the default line was a set of arguments given to a
1772 script shell.  This means you may also use $* to repeat the whole default line,
1773 so you do not have to re-type everything to add something to the default.
1774
1775 Everytime there is a substitution, you will have to confirm.  If there is an
1776 error (e.g. an unmatched backtick), the default answer will remain unchanged
1777 and you will be prompted again.
1778
1779 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1780 the questions and use the computed defaults (or the previous answers if there
1781 was already a config.sh file). Type 'Configure -h' for a list of options.
1782 You may also start interactively and then answer '& -d' at any prompt to turn
1783 on the non-interactive behaviour for the remainder of the execution.
1784
1785 EOH
1786         . ./myread
1787         cat <<EOH
1788
1789 Much effort has been expended to ensure that this shell script will run on any
1790 Unix system.  If despite that it blows up on yours, your best bet is to edit
1791 Configure and run it again.  If you can't run Configure for some reason,
1792 you'll have to generate a config.sh file by hand.  Whatever problems you
1793 have, let me (perlbug@perl.com) know how I blew it.
1794
1795 This installation script affects things in two ways:
1796
1797 1) it may do direct variable substitutions on some of the files included
1798    in this kit.
1799 2) it builds a config.h file for inclusion in C programs.  You may edit
1800    any of these files as the need arises after running this script.
1801
1802 If you make a mistake on a question, there is no easy way to back up to it
1803 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1804 files.  Configure will offer to let you do this before it runs the SH files.
1805
1806 EOH
1807         dflt='Type carriage return to continue'
1808         . ./myread
1809         case "$firsttime" in
1810         true) echo $user >>../.config/instruct;;
1811         esac
1812 fi
1813
1814 : find out where common programs are
1815 echo " "
1816 echo "Locating common programs..." >&4
1817 cat <<EOSC >loc
1818 $startsh
1819 case \$# in
1820 0) exit 1;;
1821 esac
1822 thing=\$1
1823 shift
1824 dflt=\$1
1825 shift
1826 for dir in \$*; do
1827         case "\$thing" in
1828         .)
1829         if test -d \$dir/\$thing; then
1830                 echo \$dir
1831                 exit 0
1832         fi
1833         ;;
1834         *)
1835         for thisthing in \$dir/\$thing; do
1836                 : just loop through to pick last item
1837         done
1838         if test -f \$thisthing; then
1839                 echo \$thisthing
1840                 exit 0
1841         elif test -f \$dir/\$thing.exe; then
1842                 if test -n "$DJGPP"; then
1843                         echo \$dir/\$thing.exe
1844                 else
1845                         : on Eunice apparently
1846                         echo \$dir/\$thing
1847                 fi
1848                 exit 0
1849         fi
1850         ;;
1851         esac
1852 done
1853 echo \$dflt
1854 exit 1
1855 EOSC
1856 chmod +x loc
1857 $eunicefix loc
1858 loclist="
1859 awk
1860 cat
1861 comm
1862 cp
1863 echo
1864 expr
1865 grep
1866 ls
1867 make
1868 mkdir
1869 rm
1870 sed
1871 sort
1872 touch
1873 tr
1874 uniq
1875 "
1876 trylist="
1877 Mcc
1878 ar
1879 byacc
1880 cpp
1881 csh
1882 date
1883 egrep
1884 gzip
1885 less
1886 ln
1887 more
1888 nm
1889 nroff
1890 pg
1891 test
1892 uname
1893 zip
1894 "
1895 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1896 pth="$pth /lib /usr/lib"
1897 for file in $loclist; do
1898         eval xxx=\$$file
1899         case "$xxx" in
1900         /*|?:[\\/]*)
1901                 if test -f "$xxx"; then
1902                         : ok
1903                 else
1904                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1905                         xxx=`./loc $file $file $pth`
1906                 fi
1907                 ;;
1908         '') xxx=`./loc $file $file $pth`;;
1909         *) xxx=`./loc $xxx $xxx $pth`;;
1910         esac
1911         eval $file=$xxx
1912         eval _$file=$xxx
1913         case "$xxx" in
1914         /*)
1915                 echo $file is in $xxx.
1916                 ;;
1917         ?:[\\/]*)
1918                 echo $file is in $xxx.
1919                 ;;
1920         *)
1921                 echo "I don't know where '$file' is, and my life depends on it." >&4
1922                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1923                 exit 1
1924                 ;;
1925         esac
1926 done
1927 echo " "
1928 echo "Don't worry if any of the following aren't found..."
1929 say=offhand
1930 for file in $trylist; do
1931         eval xxx=\$$file
1932         case "$xxx" in
1933         /*|?:[\\/]*)
1934                 if test -f "$xxx"; then
1935                         : ok
1936                 else
1937                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1938                         xxx=`./loc $file $file $pth`
1939                 fi
1940                 ;;
1941         '') xxx=`./loc $file $file $pth`;;
1942         *) xxx=`./loc $xxx $xxx $pth`;;
1943         esac
1944         eval $file=$xxx
1945         eval _$file=$xxx
1946         case "$xxx" in
1947         /*)
1948                 echo $file is in $xxx.
1949                 ;;
1950         ?:[\\/]*)
1951                 echo $file is in $xxx.
1952                 ;;
1953         *)
1954                 echo "I don't see $file out there, $say."
1955                 say=either
1956                 ;;
1957         esac
1958 done
1959 case "$egrep" in
1960 egrep)
1961         echo "Substituting grep for egrep."
1962         egrep=$grep
1963         ;;
1964 esac
1965 case "$ln" in
1966 ln)
1967         echo "Substituting cp for ln."
1968         ln=$cp
1969         ;;
1970 esac
1971 case "$test" in
1972 test)
1973         echo "Hopefully test is built into your sh."
1974         ;;
1975 *)
1976         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1977                 echo "Using the test built into your sh."
1978                 test=test
1979                 _test=test
1980         fi
1981         ;;
1982 esac
1983 case "$echo" in
1984 echo)
1985         echo "Hopefully echo is built into your sh."
1986         ;;
1987 '') ;;
1988 *)
1989         echo " "
1990 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1991         $echo $n "hi there$c" >foo1
1992         echo $n "hi there$c" >foo2
1993         if cmp foo1 foo2 >/dev/null 2>&1; then
1994                 echo "They are compatible.  In fact, they may be identical."
1995         else
1996                 case "$n" in
1997                 '-n') n='' c='\c';;
1998                 *) n='-n' c='';;
1999                 esac
2000                 cat <<FOO
2001 They are not compatible!  You are probably running ksh on a non-USG system.
2002 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2003 have echo built in and we may have to run some Bourne shell scripts.  That
2004 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2005
2006 FOO
2007                 $echo $n "The star should be here-->$c"
2008                 $echo "*"
2009         fi
2010         $rm -f foo1 foo2
2011         ;;
2012 esac
2013
2014 : determine whether symbolic links are supported
2015 echo " "
2016 $touch blurfl
2017 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2018         echo "Symbolic links are supported." >&4
2019         lns="$ln -s"
2020 else
2021         echo "Symbolic links are NOT supported." >&4
2022         lns="$ln"
2023 fi
2024 $rm -f blurfl sym
2025
2026 : see whether [:lower:] and [:upper:] are supported character classes
2027 echo " "
2028 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2029 ABYZ)
2030         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2031         up='[:upper:]'
2032         low='[:lower:]'
2033         ;;
2034 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2035         # (0xc9 and 0xd1), therefore that is a nice testing point.
2036         if test "X$up" = X -o "X$low" = X; then
2037             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2038             ij) up='[A-Z]'
2039                 low='[a-z]'
2040                 ;;
2041             esac
2042         fi
2043         if test "X$up" = X -o "X$low" = X; then
2044             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2045             ij) up='A-Z'
2046                 low='a-z'
2047                 ;;
2048             esac
2049         fi
2050         if test "X$up" = X -o "X$low" = X; then
2051             case "`echo IJ | od -x 2>/dev/null`" in
2052             *C9D1*|*c9d1*)
2053                 echo "Hey, this might be EBCDIC." >&4
2054                 if test "X$up" = X -o "X$low" = X; then
2055                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2056                     ij) up='[A-IJ-RS-Z]'
2057                         low='[a-ij-rs-z]'
2058                         ;;
2059                     esac
2060                 fi
2061                 if test "X$up" = X -o "X$low" = X; then
2062                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2063                     ij) up='A-IJ-RS-Z'
2064                         low='a-ij-rs-z'
2065                         ;;
2066                     esac
2067                 fi
2068                 ;;
2069             esac
2070         fi
2071 esac
2072 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2073 ij)
2074     echo "Using $up and $low to convert case." >&4
2075     ;;
2076 *)
2077     echo "I don't know how to translate letters from upper to lower case." >&4
2078     echo "Your tr is not acting any way I know of." >&4
2079     exit 1
2080     ;;
2081 esac
2082 : set up the translation script tr, must be called with ./tr of course
2083 cat >tr <<EOSC
2084 $startsh
2085 case "\$1\$2" in
2086 '[A-Z][a-z]') exec $tr '$up' '$low';;
2087 '[a-z][A-Z]') exec $tr '$low' '$up';;
2088 esac
2089 exec $tr "\$@"
2090 EOSC
2091 chmod +x tr
2092 $eunicefix tr
2093
2094 : Try to determine whether config.sh was made on this system
2095 case "$config_sh" in
2096 '')
2097 myuname=`$uname -a 2>/dev/null`
2098 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2099 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2100 # because the A-Z/a-z are not consecutive.
2101 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2102         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2103 newmyuname="$myuname"
2104 dflt=n
2105 case "$knowitall" in
2106 '')
2107         if test -f ../config.sh; then
2108                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2109                         eval "`grep myuname= ../config.sh`"
2110                 fi
2111                 if test "X$myuname" = "X$newmyuname"; then
2112                         dflt=y
2113                 fi
2114         fi
2115         ;;
2116 *) dflt=y;;
2117 esac
2118
2119 : Get old answers from old config file if Configure was run on the
2120 : same system, otherwise use the hints.
2121 hint=default
2122 cd ..
2123 if test -f config.sh; then
2124         echo " "
2125         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2126         . UU/myread
2127         case "$ans" in
2128         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2129         *)  echo "Fetching default answers from your old config.sh file..." >&4
2130                 tmp_n="$n"
2131                 tmp_c="$c"
2132                 tmp_sh="$sh"
2133                 . ./config.sh
2134                 cp config.sh UU
2135                 n="$tmp_n"
2136                 c="$tmp_c"
2137                 : Older versions did not always set $sh.  Catch re-use of such
2138                 : an old config.sh.
2139                 case "$sh" in
2140                 '') sh="$tmp_sh" ;;
2141                 esac
2142                 hint=previous
2143                 ;;
2144         esac
2145 fi
2146 if test ! -f config.sh; then
2147         $cat <<EOM
2148
2149 First time through, eh?  I have some defaults handy for some systems
2150 that need some extra help getting the Configure answers right:
2151
2152 EOM
2153         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2154         dflt=''
2155         : Half the following guesses are probably wrong... If you have better
2156         : tests or hints, please send them to perlbug@perl.com
2157         : The metaconfig authors would also appreciate a copy...
2158         $test -f /irix && osname=irix
2159         $test -f /xenix && osname=sco_xenix
2160         $test -f /dynix && osname=dynix
2161         $test -f /dnix && osname=dnix
2162         $test -f /lynx.os && osname=lynxos
2163         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2164         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2165         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2166         $test -f /bin/mips && /bin/mips && osname=mips
2167         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2168                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2169         $test -d /usr/apollo/bin && osname=apollo
2170         $test -f /etc/saf/_sactab && osname=svr4
2171         $test -d /usr/include/minix && osname=minix
2172         if $test -d /MachTen -o -d /MachTen_Folder; then
2173                 osname=machten
2174                 if $test -x /sbin/version; then
2175                         osvers=`/sbin/version | $awk '{print $2}' |
2176                         $sed -e 's/[A-Za-z]$//'`
2177                 elif $test -x /usr/etc/version; then
2178                         osvers=`/usr/etc/version | $awk '{print $2}' |
2179                         $sed -e 's/[A-Za-z]$//'`
2180                 else
2181                         osvers="$2.$3"
2182                 fi
2183         fi
2184
2185         $test -f /sys/posix.dll &&
2186                 $test -f /usr/bin/what &&
2187                 set X `/usr/bin/what /sys/posix.dll` &&
2188                 $test "$3" = UWIN &&
2189                 osname=uwin &&
2190                 osvers="$5"
2191
2192         if $test -f $uname; then
2193                 set X $myuname
2194                 shift
2195
2196                 case "$5" in
2197                 fps*) osname=fps ;;
2198                 mips*)
2199                         case "$4" in
2200                         umips) osname=umips ;;
2201                         *) osname=mips ;;
2202                         esac;;
2203                 [23]100) osname=mips ;;
2204                 next*) osname=next ;;
2205                 i386*)
2206                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2207                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2208                                 osname='sco'
2209                                 osvers=$tmp
2210                         elif $test -f /etc/kconfig; then
2211                                 osname=isc
2212                                 if test "$lns" = "$ln -s"; then
2213                                         osvers=4
2214                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2215                                         osvers=3
2216                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2217                                         osvers=2
2218                                 fi
2219                         fi
2220                         tmp=''
2221                         ;;
2222                 pc*)
2223                         if test -n "$DJGPP"; then
2224                                 osname=dos
2225                                 osvers=djgpp
2226                         fi
2227                         ;;
2228                 esac
2229
2230                 case "$1" in
2231                 aix) osname=aix
2232                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2233                         case "$tmp" in
2234                         'not found') osvers="$4"."$3" ;;
2235                         '<3240'|'<>3240') osvers=3.2.0 ;;
2236                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2237                         '=3250'|'>3250') osvers=3.2.5 ;;
2238                         *) osvers=$tmp;;
2239                         esac
2240                         ;;
2241                 bsd386) osname=bsd386
2242                         osvers=`$uname -r`
2243                         ;;
2244                 cygwin*) osname=cygwin
2245                         osvers="$3"
2246                         ;;
2247                 *dc.osx) osname=dcosx
2248                         osvers="$3"
2249                         ;;
2250                 dnix) osname=dnix
2251                         osvers="$3"
2252                         ;;
2253                 domainos) osname=apollo
2254                         osvers="$3"
2255                         ;;
2256                 dgux) osname=dgux 
2257                         osvers="$3"
2258                         ;;
2259                 dynixptx*) osname=dynixptx
2260                         osvers=`echo "$4"|sed 's/^v//'`
2261                         ;;
2262                 freebsd) osname=freebsd 
2263                         osvers="$3" ;;
2264                 genix) osname=genix ;;
2265                 hp*) osname=hpux 
2266                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2267                         ;;
2268                 irix*) osname=irix
2269                         case "$3" in
2270                         4*) osvers=4 ;;
2271                         5*) osvers=5 ;;
2272                         *)      osvers="$3" ;;
2273                         esac
2274                         ;;
2275                 linux) osname=linux
2276                         case "$3" in
2277                         *)      osvers="$3" ;;
2278                         esac
2279                         ;;
2280                 MiNT) osname=mint
2281                         ;;
2282                 netbsd*) osname=netbsd
2283                         osvers="$3"
2284                         ;;
2285                 news-os) osvers="$3"
2286                         case "$3" in
2287                         4*) osname=newsos4 ;;
2288                         *) osname=newsos ;;
2289                         esac
2290                         ;;
2291                 next*) osname=next ;;
2292                 POSIX-BC | posix-bc ) osname=posix-bc
2293                         osvers="$3"
2294                         ;;
2295                 powerux | power_ux | powermax_os | powermaxos | \
2296                 powerunix | power_unix) osname=powerux
2297                         osvers="$3"
2298                         ;;
2299                 qnx) osname=qnx
2300                         osvers="$4"
2301                         ;;
2302                 solaris) osname=solaris
2303                         case "$3" in
2304                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2305                         *)      osvers="$3" ;;
2306                         esac
2307                         ;;
2308                 sunos) osname=sunos
2309                         case "$3" in
2310                         5*) osname=solaris
2311                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2312                         *)      osvers="$3" ;;
2313                         esac
2314                         ;;
2315                 titanos) osname=titanos
2316                         case "$3" in
2317                         1*) osvers=1 ;;
2318                         2*) osvers=2 ;;
2319                         3*) osvers=3 ;;
2320                         4*) osvers=4 ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 ultrix) osname=ultrix
2325                         osvers="$3"
2326                         ;;
2327                 osf1|mls+)      case "$5" in
2328                                 alpha)
2329                                         osname=dec_osf
2330                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2331                                         ;;
2332                         hp*)    osname=hp_osf1  ;;
2333                         mips)   osname=mips_osf1 ;;
2334                         esac
2335                         ;;
2336                 unixware) osname=svr5
2337                         osvers="$4"
2338                         ;;
2339                 uts) osname=uts
2340                         osvers="$3"
2341                         ;;
2342                 $2) case "$osname" in
2343                         *isc*) ;;
2344                         *freebsd*) ;;
2345                         svr*)
2346                                 : svr4.x or possibly later
2347                                 case "svr$3" in 
2348                                 ${osname}*)
2349                                         osname=svr$3
2350                                         osvers=$4
2351                                         ;;
2352                                 esac
2353                                 case "$osname" in
2354                                 svr4.0)
2355                                         : Check for ESIX
2356                                         if test -f /stand/boot ; then
2357                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2358                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2359                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2360                                                         if test -n "$isesix"; then
2361                                                                 osname=esix4
2362                                                         fi
2363                                                 fi
2364                                         fi
2365                                         ;;
2366                                 esac
2367                                 ;;
2368                         *)      if test -f /etc/systemid; then
2369                                         osname=sco
2370                                         set `echo $3 | $sed 's/\./ /g'` $4
2371                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2372                                                 osvers=$1.$2.$3
2373                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2374                                                 osvers=$1.$2
2375                                         elif $test -f $src/hints/sco_$1.sh; then
2376                                                 osvers=$1
2377                                         fi
2378                                 else
2379                                         case "$osname" in
2380                                         '') : Still unknown.  Probably a generic Sys V.
2381                                                 osname="sysv"
2382                                                 osvers="$3"
2383                                                 ;;
2384                                         esac
2385                                 fi
2386                                 ;;
2387                         esac
2388                         ;;
2389                 *)      case "$osname" in
2390                         '') : Still unknown.  Probably a generic BSD.
2391                                 osname="$1"
2392                                 osvers="$3"
2393                                 ;;
2394                         esac
2395                         ;;
2396                 esac
2397         else
2398                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2399                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2400                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2401                                 osname=news_os
2402                         fi
2403                         $rm -f UU/kernel.what
2404                 elif test -d c:/.; then
2405                         set X $myuname
2406                         osname=os2
2407                         osvers="$5"
2408                 fi
2409         fi
2410         
2411         : Now look for a hint file osname_osvers, unless one has been
2412         : specified already.
2413         case "$hintfile" in
2414         ''|' ')
2415                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2416                 : Also try without trailing minor version numbers.
2417                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2418                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2419                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2420                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2421                 case "$file" in
2422                 '') dflt=none ;;
2423                 *)  case "$osvers" in
2424                         '') dflt=$file
2425                                 ;;
2426                         *)  if $test -f $src/hints/$file.sh ; then
2427                                         dflt=$file
2428                                 elif $test -f $src/hints/$xfile.sh ; then
2429                                         dflt=$xfile
2430                                 elif $test -f $src/hints/$xxfile.sh ; then
2431                                         dflt=$xxfile
2432                                 elif $test -f $src/hints/$xxxfile.sh ; then
2433                                         dflt=$xxxfile
2434                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2435                                         dflt=$xxxxfile
2436                                 elif $test -f "$src/hints/${osname}.sh" ; then
2437                                         dflt="${osname}"
2438                                 else
2439                                         dflt=none
2440                                 fi
2441                                 ;;
2442                         esac
2443                         ;;
2444                 esac
2445                 if $test -f Policy.sh ; then
2446                         case "$dflt" in
2447                         *Policy*) ;;
2448                         none) dflt="Policy" ;;
2449                         *) dflt="Policy $dflt" ;;
2450                         esac
2451                 fi
2452                 ;;
2453         *)
2454                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2455                 ;;
2456         esac
2457
2458         if $test -f Policy.sh ; then
2459                 $cat <<EOM
2460
2461 There's also a Policy hint file available, which should make the
2462 site-specific (policy) questions easier to answer.
2463 EOM
2464
2465         fi
2466
2467         $cat <<EOM
2468
2469 You may give one or more space-separated answers, or "none" if appropriate.
2470 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2471 is a good thing.  DO NOT give a wrong version or a wrong OS.
2472
2473 EOM
2474
2475         rp="Which of these apply, if any?"
2476         . UU/myread
2477         tans=$ans
2478         for file in $tans; do
2479                 if $test X$file = XPolicy -a -f Policy.sh; then
2480                         . Policy.sh
2481                         $cat Policy.sh >> UU/config.sh
2482                 elif $test -f $src/hints/$file.sh; then
2483                         . $src/hints/$file.sh
2484                         $cat $src/hints/$file.sh >> UU/config.sh
2485                 elif $test X$tans = X -o X$tans = Xnone ; then
2486                         : nothing
2487                 else
2488                         : Give one chance to correct a possible typo.
2489                         echo "$file.sh does not exist"
2490                         dflt=$file
2491                         rp="hint to use instead?"
2492                         . UU/myread
2493                         for file in $ans; do
2494                                 if $test -f "$src/hints/$file.sh"; then
2495                                         . $src/hints/$file.sh
2496                                         $cat $src/hints/$file.sh >> UU/config.sh
2497                                 elif $test X$ans = X -o X$ans = Xnone ; then
2498                                         : nothing
2499                                 else
2500                                         echo "$file.sh does not exist -- ignored."
2501                                 fi
2502                         done
2503                 fi
2504         done
2505
2506         hint=recommended
2507         : Remember our hint file for later.
2508         if $test -f "$src/hints/$file.sh" ; then
2509                 hintfile="$file"
2510         else
2511                 hintfile=''
2512         fi
2513 fi
2514 cd UU
2515 ;;
2516 *)
2517         echo " "
2518         echo "Fetching default answers from $config_sh..." >&4
2519         tmp_n="$n"
2520         tmp_c="$c"
2521         cd ..
2522         cp $config_sh config.sh 2>/dev/null
2523         chmod +w config.sh
2524         . ./config.sh
2525         cd UU
2526         cp ../config.sh .
2527         n="$tmp_n"
2528         c="$tmp_c"
2529         hint=previous
2530         ;;
2531 esac
2532 test "$override" && . ./optdef.sh
2533 myuname="$newmyuname"
2534
2535 : Restore computed paths
2536 for file in $loclist $trylist; do
2537         eval $file="\$_$file"
2538 done
2539
2540 cat << EOM
2541
2542 Configure uses the operating system name and version to set some defaults.
2543 The default value is probably right if the name rings a bell. Otherwise,
2544 since spelling matters for me, either accept the default or answer "none"
2545 to leave it blank.
2546
2547 EOM
2548 case "$osname" in
2549         ''|' ')
2550                 case "$hintfile" in
2551                 ''|' '|none) dflt=none ;;
2552                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2553                 esac
2554                 ;;
2555         *) dflt="$osname" ;;
2556 esac
2557 rp="Operating system name?"
2558 . ./myread
2559 case "$ans" in
2560 none)  osname='' ;;
2561 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2562 esac
2563 echo " "
2564 case "$osvers" in
2565         ''|' ')
2566                 case "$hintfile" in
2567                 ''|' '|none) dflt=none ;;
2568                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2569                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2570                         case "$dflt" in
2571                         ''|' ') dflt=none ;;
2572                         esac
2573                         ;;
2574                 esac
2575                 ;;
2576         *) dflt="$osvers" ;;
2577 esac
2578 rp="Operating system version?"
2579 . ./myread
2580 case "$ans" in
2581 none)  osvers='' ;;
2582 *) osvers="$ans" ;;
2583 esac
2584
2585
2586 . ./posthint.sh
2587
2588 : who configured the system
2589 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2590 cf_by=`(logname) 2>/dev/null`
2591 case "$cf_by" in
2592 "")
2593         cf_by=`(whoami) 2>/dev/null`
2594         case "$cf_by" in
2595         "") cf_by=unknown ;;
2596         esac ;;
2597 esac
2598
2599 : set up the script used to warn in case of inconsistency
2600 cat <<EOS >whoa
2601 $startsh
2602 EOS
2603 cat <<'EOSC' >>whoa
2604 dflt=y
2605 echo " "
2606 echo "*** WHOA THERE!!! ***" >&4
2607 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2608 rp="    Keep the $hint value?"
2609 . ./myread
2610 case "$ans" in
2611 y) td=$was; tu=$was;;
2612 esac
2613 EOSC
2614
2615 : function used to set $1 to $val
2616 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2617 case "$val$was" in
2618 $define$undef) . ./whoa; eval "$var=\$td";;
2619 $undef$define) . ./whoa; eval "$var=\$tu";;
2620 *) eval "$var=$val";;
2621 esac'
2622
2623 case "$usethreads" in
2624 $define|true|[yY]*)     dflt='y';;
2625 *) dflt='n';;
2626 esac
2627 cat <<EOM
2628
2629 Perl can be built to take advantage of threads on some systems.
2630 To do so, Configure can be run with -Dusethreads.
2631
2632 Note that threading is a highly experimental feature, and
2633 some known race conditions still remain.  If you choose to try
2634 it, be very sure to not actually deploy it for production
2635 purposes.  README.threads has more details, and is required
2636 reading if you enable threads.
2637
2638 If this doesn't make any sense to you, just accept the default '$dflt'.
2639 EOM
2640 rp='Build a threading Perl?'
2641 . ./myread
2642 case "$ans" in
2643 y|Y)    val="$define" ;;
2644 *)      val="$undef" ;;
2645 esac
2646 set usethreads
2647 eval $setvar
2648
2649 case "$usethreads" in
2650 $define)
2651         $cat <<EOM
2652
2653 As of 5.5.640, Perl has two different internal threading implementations,
2654 the 5.005 version (5005threads) and an interpreter-based version
2655 (ithreads) that has one interpreter per thread.  Both are very 
2656 experimental.  This arrangement exists to help developers work out
2657 which one is better.
2658
2659 If you're a casual user, you probably don't want interpreter-threads
2660 at this time.  There doesn't yet exist a way to create threads from
2661 within Perl in this model, i.e., "use Thread;" will NOT work.
2662 EOM
2663         : Default to ithreads unless overridden on command line or with
2664         : old config.sh
2665         dflt='y'
2666         case "$use5005threads" in
2667                 $define|true|[yY]*) dflt='n';;
2668         esac
2669         case "$useithreads" in
2670                 $undef|false|[nN]*) dflt='n';;
2671         esac
2672         rp='Use interpreter-based ithreads?'
2673         . ./myread
2674         case "$ans" in
2675         y|Y)    val="$define" ;;
2676         *)      val="$undef" ;;
2677         esac
2678         set useithreads
2679         eval $setvar
2680         : Now set use5005threads to the opposite value.
2681         case "$useithreads" in
2682         $define) val="$undef" ;;
2683         *) val="$define" ;;
2684         esac
2685         set use5005threads
2686         eval $setvar
2687         ;;
2688 *)
2689         useithreads="$undef"
2690         use5005threads="$undef"
2691         ;;
2692 esac
2693
2694 case "$d_oldpthreads" in
2695 '')     : Configure tests would be welcome here.  For now, assume undef.
2696         val="$undef" ;;
2697 *)      val="$d_oldpthreads" ;;
2698 esac
2699 set d_oldpthreads
2700 eval $setvar
2701
2702
2703 case "$usethreads" in
2704 "$define"|true|[yY]*)
2705 : Look for a hint-file generated 'call-back-unit'.  If the
2706 : user has specified that a threading perl is to be built,
2707 : we may need to set or change some other defaults.
2708         if $test -f usethreads.cbu; then
2709                 echo "Your platform has some specific hints for threaded builds, using them..."
2710                 . ./usethreads.cbu
2711         else
2712                 $cat <<EOM
2713 (Your platform doesn't have any specific hints for threaded builds.
2714  Assuming POSIX threads, then.)
2715 EOM
2716         fi
2717         ;;
2718 esac
2719
2720 cat <<EOM
2721
2722 Perl can be built so that multiple Perl interpreters can coexist
2723 within the same Perl executable.
2724 EOM
2725
2726 case "$useithreads" in
2727 $define)
2728         cat <<EOM
2729 This multiple interpreter support is required for interpreter-based threads.
2730 EOM
2731         val="$define"
2732         ;;
2733 *)      case "$usemultiplicity" in
2734         $define|true|[yY]*)     dflt='y';;
2735         *) dflt='n';;
2736         esac
2737         echo " "
2738         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2739         rp='Build Perl for multiplicity?'
2740         . ./myread
2741         case "$ans" in
2742         y|Y)    val="$define" ;;
2743         *)      val="$undef" ;;
2744         esac
2745         ;;
2746 esac
2747 set usemultiplicity
2748 eval $setvar
2749
2750 : determine where manual pages are on this system
2751 echo " "
2752 case "$sysman" in
2753 '') 
2754         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2755         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2756         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2757         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2758         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2759         sysman=`./loc . /usr/man/man1 $syspath`
2760         ;;
2761 esac
2762 if $test -d "$sysman"; then
2763         echo "System manual is in $sysman." >&4
2764 else
2765         echo "Could not find manual pages in source form." >&4
2766 fi
2767
2768 : see what memory models we can support
2769 case "$models" in
2770 '')
2771         $cat >pdp11.c <<'EOP'
2772 int main() {
2773 #ifdef pdp11
2774         exit(0);
2775 #else
2776         exit(1);
2777 #endif
2778 }
2779 EOP
2780         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2781         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2782                 dflt='unsplit split'
2783         else
2784                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2785                 case "$tans" in
2786                 X) dflt='none';;
2787                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2788                                 dflt='small'
2789                         else
2790                                 dflt=''
2791                         fi
2792                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2793                                 dflt="$dflt medium"
2794                         fi
2795                         if $test -d /lib/large || $test -d /usr/lib/large; then
2796                                 dflt="$dflt large"
2797                         fi
2798                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2799                                 dflt="$dflt huge"
2800                         fi
2801                 esac
2802         fi;;
2803 *) dflt="$models";;
2804 esac
2805 $cat <<EOM
2806  
2807 Some systems have different model sizes.  On most systems they are called
2808 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2809 split.  If your system doesn't support different memory models, say "none".
2810 If you wish to force everything to one memory model, say "none" here and
2811 put the appropriate flags later when it asks you for other cc and ld flags.
2812 Venix systems may wish to put "none" and let the compiler figure things out.
2813 (In the following question multiple model names should be space separated.)
2814
2815 The default for most systems is "none".
2816
2817 EOM
2818 rp="Which memory models are supported?"
2819 . ./myread
2820 models="$ans"
2821
2822 case "$models" in
2823 none)
2824         small=''
2825         medium=''
2826         large=''
2827         huge=''
2828         unsplit=''
2829         split=''
2830         ;;
2831 *split)
2832         case "$split" in
2833         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2834                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2835                         dflt='-i'
2836                 else
2837                         dflt='none'
2838                 fi;;
2839         *) dflt="$split";;
2840         esac
2841         rp="What flag indicates separate I and D space?"
2842         . ./myread
2843         tans="$ans"
2844         case "$tans" in
2845         none) tans='';;
2846         esac
2847         split="$tans"
2848         unsplit='';;
2849 *large*|*small*|*medium*|*huge*)
2850         case "$models" in
2851         *large*)
2852                 case "$large" in
2853                 '') dflt='-Ml';;
2854                 *) dflt="$large";;
2855                 esac
2856         rp="What flag indicates large model?"
2857         . ./myread
2858         tans="$ans"
2859         case "$tans" in
2860         none) tans='';
2861         esac
2862         large="$tans";;
2863         *) large='';;
2864         esac
2865         case "$models" in
2866         *huge*) case "$huge" in
2867                 '') dflt='-Mh';;
2868                 *) dflt="$huge";;
2869                 esac
2870                 rp="What flag indicates huge model?"
2871                 . ./myread
2872                 tans="$ans"
2873                 case "$tans" in
2874                 none) tans='';
2875                 esac
2876                 huge="$tans";;
2877         *) huge="$large";;
2878         esac
2879         case "$models" in
2880         *medium*) case "$medium" in
2881                 '') dflt='-Mm';;
2882                 *) dflt="$medium";;
2883                 esac
2884                 rp="What flag indicates medium model?"
2885                 . ./myread
2886                 tans="$ans"
2887                 case "$tans" in
2888                 none) tans='';
2889                 esac
2890                 medium="$tans";;
2891         *) medium="$large";;
2892         esac
2893         case "$models" in
2894         *small*) case "$small" in
2895                 '') dflt='none';;
2896                 *) dflt="$small";;
2897                 esac
2898                 rp="What flag indicates small model?"
2899                 . ./myread
2900                 tans="$ans"
2901                 case "$tans" in
2902                 none) tans='';
2903                 esac
2904                 small="$tans";;
2905         *) small='';;
2906         esac
2907         ;;
2908 *)
2909         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2910         ;;
2911 esac
2912 $rm -f pdp11.* pdp11
2913
2914 : make some quick guesses about what we are up against
2915 echo " "
2916 $echo $n "Hmm...  $c"
2917 echo exit 1 >bsd
2918 echo exit 1 >usg
2919 echo exit 1 >v7
2920 echo exit 1 >osf1
2921 echo exit 1 >eunice
2922 echo exit 1 >xenix
2923 echo exit 1 >venix
2924 echo exit 1 >os2
2925 d_bsd="$undef"
2926 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2927 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2928 then
2929         echo "Looks kind of like an OSF/1 system, but we'll see..."
2930         echo exit 0 >osf1
2931 elif test `echo abc | tr a-z A-Z` = Abc ; then
2932         xxx=`./loc addbib blurfl $pth`
2933         if $test -f $xxx; then
2934         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2935                 echo exit 0 >bsd
2936                 echo exit 0 >usg
2937         else
2938                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2939                         echo "Looks kind of like an extended USG system, but we'll see..."
2940                 else
2941                         echo "Looks kind of like a USG system, but we'll see..."
2942                 fi
2943                 echo exit 0 >usg
2944         fi
2945 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2946         echo "Looks kind of like a BSD system, but we'll see..."
2947         d_bsd="$define"
2948         echo exit 0 >bsd
2949 else
2950         echo "Looks kind of like a Version 7 system, but we'll see..."
2951         echo exit 0 >v7
2952 fi
2953 case "$eunicefix" in
2954 *unixtovms*)
2955         $cat <<'EOI'
2956 There is, however, a strange, musty smell in the air that reminds me of
2957 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2958 EOI
2959         echo exit 0 >eunice
2960         d_eunice="$define"
2961 : it so happens the Eunice I know will not run shell scripts in Unix format
2962         ;;
2963 *)
2964         echo " "
2965         echo "Congratulations.  You aren't running Eunice."
2966         d_eunice="$undef"
2967         ;;
2968 esac
2969 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2970 case "$p_" in
2971 :) ;;
2972 *)
2973         $cat <<'EOI'
2974 I have the feeling something is not exactly right, however...don't tell me...
2975 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2976 EOI
2977         echo exit 0 >os2
2978         ;;
2979 esac
2980 if test -f /xenix; then
2981         echo "Actually, this looks more like a XENIX system..."
2982         echo exit 0 >xenix
2983         d_xenix="$define"
2984 else
2985         echo " "
2986         echo "It's not Xenix..."
2987         d_xenix="$undef"
2988 fi
2989 chmod +x xenix
2990 $eunicefix xenix
2991 if test -f /venix; then
2992         echo "Actually, this looks more like a VENIX system..."
2993         echo exit 0 >venix
2994 else
2995         echo " "
2996         if ./xenix; then
2997                 : null
2998         else
2999                 echo "Nor is it Venix..."
3000         fi
3001 fi
3002 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3003 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3004 $rm -f foo
3005
3006 : see if we need a special compiler
3007 echo " "
3008 if ./usg; then
3009         case "$cc" in
3010         '') case "$Mcc" in
3011                 /*) dflt='Mcc';;
3012                 *) case "$large" in
3013                         -M*) dflt='cc';;
3014                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3015                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3016                                                 dflt='cc'
3017                                         else
3018                                                 dflt='cc -M'
3019                                         fi
3020                                 else
3021                                         dflt='cc'
3022                                 fi;;
3023                         esac;;
3024                 esac;;
3025         *)  dflt="$cc";;
3026         esac
3027         case "$dflt" in
3028         *M*)    $cat <<'EOM'
3029 On some older systems the default C compiler will not resolve multiple global
3030 references that happen to have the same name.  On some such systems the "Mcc"
3031 command may be used to force these to be resolved.  On other systems a "cc -M"
3032 command is required.  (Note that the -M flag on other systems indicates a
3033 memory model to use!) If you have the Gnu C compiler, you might wish to use
3034 that instead.
3035
3036 EOM
3037         ;;
3038         esac
3039         rp="Use which C compiler?"
3040         . ./myread
3041         cc="$ans"
3042 else
3043         case "$cc" in
3044         '') dflt=cc;;
3045         *) dflt="$cc";;
3046         esac
3047         rp="Use which C compiler?"
3048         . ./myread
3049         cc="$ans"
3050 fi
3051 : Look for a hint-file generated 'call-back-unit'.  Now that the
3052 : user has specified the compiler, we may need to set or change some
3053 : other defaults.
3054 if $test -f cc.cbu; then
3055     . ./cc.cbu
3056 fi
3057 echo " "
3058 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3059 $cat >gccvers.c <<EOM
3060 #include <stdio.h>
3061 int main() {
3062 #ifdef __GNUC__
3063 #ifdef __VERSION__
3064         printf("%s\n", __VERSION__);
3065 #else
3066         printf("%s\n", "1");
3067 #endif
3068 #endif
3069         exit(0);
3070 }
3071 EOM
3072 if $cc $ldflags -o gccvers gccvers.c; then
3073         gccversion=`./gccvers`
3074         case "$gccversion" in
3075         '') echo "You are not using GNU cc." ;;
3076         *)  echo "You are using GNU cc $gccversion."
3077             ;;
3078         esac
3079 else
3080         echo " "
3081         echo "*** WHOA THERE!!! ***" >&4
3082         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3083         case "$knowitall" in
3084         '')
3085         echo "    You'd better start hunting for one and let me know about it." >&4
3086                 exit 1
3087                 ;;
3088         esac
3089 fi
3090 $rm -f gccvers*
3091 case "$gccversion" in
3092 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3093 esac
3094
3095 : decide how portable to be.  Allow command line overrides.
3096 case "$d_portable" in
3097 "$undef") ;;
3098 *)      d_portable="$define" ;;
3099 esac
3100
3101 : set up shell script to do ~ expansion
3102 cat >filexp <<EOSS
3103 $startsh
3104 : expand filename
3105 case "\$1" in
3106  ~/*|~)
3107         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3108         ;;
3109  ~*)
3110         if $test -f /bin/csh; then
3111                 /bin/csh -f -c "glob \$1"
3112                 failed=\$?
3113                 echo ""
3114                 exit \$failed
3115         else
3116                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3117                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3118                 if $test ! -d "\$dir"; then
3119                         me=\`basename \$0\`
3120                         echo "\$me: can't locate home directory for: \$name" >&2
3121                         exit 1
3122                 fi
3123                 case "\$1" in
3124                 */*)
3125                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3126                         ;;
3127                 *)
3128                         echo \$dir
3129                         ;;
3130                 esac
3131         fi
3132         ;;
3133 *)
3134         echo \$1
3135         ;;
3136 esac
3137 EOSS
3138 chmod +x filexp
3139 $eunicefix filexp
3140
3141 : now set up to get a file name
3142 cat <<EOS >getfile
3143 $startsh
3144 EOS
3145 cat <<'EOSC' >>getfile
3146 tilde=''
3147 fullpath=''
3148 already=''
3149 skip=''
3150 none_ok=''
3151 exp_file=''
3152 nopath_ok=''
3153 orig_rp="$rp"
3154 orig_dflt="$dflt"
3155 case "$gfpth" in
3156 '') gfpth='.' ;;
3157 esac
3158
3159 case "$fn" in
3160 *\(*)
3161         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3162         fn=`echo $fn | sed 's/(.*)//'`
3163         ;;
3164 esac
3165
3166 case "$fn" in
3167 *:*)
3168         loc_file=`expr $fn : '.*:\(.*\)'`
3169         fn=`expr $fn : '\(.*\):.*'`
3170         ;;
3171 esac
3172
3173 case "$fn" in
3174 *~*) tilde=true;;
3175 esac
3176 case "$fn" in
3177 */*) fullpath=true;;
3178 esac
3179 case "$fn" in
3180 *+*) skip=true;;
3181 esac
3182 case "$fn" in
3183 *n*) none_ok=true;;
3184 esac
3185 case "$fn" in
3186 *e*) exp_file=true;;
3187 esac
3188 case "$fn" in
3189 *p*) nopath_ok=true;;
3190 esac
3191
3192 case "$fn" in
3193 *f*) type='File';;
3194 *d*) type='Directory';;
3195 *l*) type='Locate';;
3196 esac
3197
3198 what="$type"
3199 case "$what" in
3200 Locate) what='File';;
3201 esac
3202
3203 case "$exp_file" in
3204 '')
3205         case "$d_portable" in
3206         "$define") ;;
3207         *) exp_file=true;;
3208         esac
3209         ;;
3210 esac
3211
3212 cd ..
3213 while test "$type"; do
3214         redo=''
3215         rp="$orig_rp"
3216         dflt="$orig_dflt"
3217         case "$tilde" in
3218         true) rp="$rp (~name ok)";;
3219         esac
3220         . UU/myread
3221         if test -f UU/getfile.ok && \
3222                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3223         then
3224                 value="$ans"
3225                 ansexp="$ans"
3226                 break
3227         fi
3228         case "$ans" in
3229         none)
3230                 value=''
3231                 ansexp=''
3232                 case "$none_ok" in
3233                 true) type='';;
3234                 esac
3235                 ;;
3236         *)
3237                 case "$tilde" in
3238                 '') value="$ans"
3239                         ansexp="$ans";;
3240                 *)
3241                         value=`UU/filexp $ans`
3242                         case $? in
3243                         0)
3244                                 if test "$ans" != "$value"; then
3245                                         echo "(That expands to $value on this system.)"
3246                                 fi
3247                                 ;;
3248                         *) value="$ans";;
3249                         esac
3250                         ansexp="$value"
3251                         case "$exp_file" in
3252                         '') value="$ans";;
3253                         esac
3254                         ;;
3255                 esac
3256                 case "$fullpath" in
3257                 true)
3258                         case "$ansexp" in
3259                         /*) value="$ansexp" ;;
3260                         *)
3261                                 redo=true
3262                                 case "$already" in
3263                                 true)
3264                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3265                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3266                                         ;;
3267                                 *)
3268                                 echo "Please give a full path name, starting with slash." >&4
3269                                         case "$tilde" in
3270                                         true)
3271                                 echo "Note that using ~name is ok provided it expands well." >&4
3272                                                 already=true
3273                                                 ;;
3274                                         esac
3275                                 esac
3276                                 ;;
3277                         esac
3278                         ;;
3279                 esac
3280                 case "$redo" in
3281                 '')
3282                         case "$type" in
3283                         File)
3284                                 for fp in $gfpth; do
3285                                         if test "X$fp" = X.; then
3286                                             pf="$ansexp"
3287                                         else    
3288                                             pf="$fp/$ansexp"
3289                                         fi
3290                                         if test -f "$pf"; then
3291                                                 type=''
3292                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3293                                         then
3294                                                 echo "($value is not a plain file, but that's ok.)"
3295                                                 type=''
3296                                         fi
3297                                         if test X"$type" = X; then
3298                                             value="$pf"
3299                                             break
3300                                         fi
3301                                 done
3302                                 ;;
3303                         Directory)
3304                                 for fp in $gfpth; do
3305                                         if test "X$fp" = X.; then
3306                                             pf="$ansexp"
3307                                         else    
3308                                             pf="$fp/$ansexp"
3309                                         fi
3310                                         if test -d "$pf"; then
3311                                                 type=''
3312                                                 value="$pf"
3313                                                 break
3314                                         fi
3315                                 done
3316                                 ;;
3317                         Locate)
3318                                 if test -d "$ansexp"; then
3319                                         echo "(Looking for $loc_file in directory $value.)"
3320                                         value="$value/$loc_file"
3321                                         ansexp="$ansexp/$loc_file"
3322                                 fi
3323                                 if test -f "$ansexp"; then
3324                                         type=''
3325                                 fi
3326                                 case "$nopath_ok" in
3327                                 true)   case "$value" in
3328                                         */*) ;;
3329                                         *)      echo "Assuming $value will be in people's path."
3330                                                 type=''
3331                                                 ;;
3332                                         esac
3333                                         ;;
3334                                 esac
3335                                 ;;
3336                         esac
3337
3338                         case "$skip" in
3339                         true) type='';
3340                         esac
3341
3342                         case "$type" in
3343                         '') ;;
3344                         *)
3345                                 if test "$fastread" = yes; then
3346                                         dflt=y
3347                                 else
3348                                         dflt=n
3349                                 fi
3350                                 rp="$what $value doesn't exist.  Use that name anyway?"
3351                                 . UU/myread
3352                                 dflt=''
3353                                 case "$ans" in
3354                                 y*) type='';;
3355                                 *) echo " ";;
3356                                 esac
3357                                 ;;
3358                         esac
3359                         ;;
3360                 esac
3361                 ;;
3362         esac
3363 done
3364 cd UU
3365 ans="$value"
3366 rp="$orig_rp"
3367 dflt="$orig_dflt"
3368 rm -f getfile.ok
3369 test "X$gfpthkeep" != Xy && gfpth=""
3370 EOSC
3371
3372 : What should the include directory be ?
3373 echo " "
3374 $echo $n "Hmm...  $c"
3375 dflt='/usr/include'
3376 incpath=''
3377 mips_type=''
3378 if $test -f /bin/mips && /bin/mips; then
3379         echo "Looks like a MIPS system..."
3380         $cat >usr.c <<'EOCP'
3381 #ifdef SYSTYPE_BSD43
3382 /bsd43
3383 #endif
3384 EOCP
3385         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3386                 dflt='/bsd43/usr/include'
3387                 incpath='/bsd43'
3388                 mips_type='BSD 4.3'
3389         else
3390                 mips_type='System V'
3391         fi
3392         $rm -f usr.c usr.out
3393         echo "and you're compiling with the $mips_type compiler and libraries."
3394         xxx_prompt=y
3395         echo "exit 0" >mips
3396 else
3397         echo "Doesn't look like a MIPS system."
3398         xxx_prompt=n
3399         echo "exit 1" >mips
3400 fi
3401 chmod +x mips
3402 $eunicefix mips
3403 case "$usrinc" in
3404 '') ;;
3405 *) dflt="$usrinc";;
3406 esac
3407 case "$xxx_prompt" in
3408 y)      fn=d/
3409         echo " "
3410         rp='Where are the include files you want to use?'
3411         . ./getfile
3412         usrinc="$ans"
3413         ;;
3414 *)      usrinc="$dflt"
3415         ;;
3416 esac
3417
3418 : see how we invoke the C preprocessor
3419 echo " "
3420 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3421 cat <<'EOT' >testcpp.c
3422 #define ABC abc
3423 #define XYZ xyz
3424 ABC.XYZ
3425 EOT
3426 cd ..
3427 if test ! -f cppstdin; then
3428         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3429                 # AIX cc -E doesn't show the absolute headerfile
3430                 # locations but we'll cheat by using the -M flag.
3431                 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
3432         else
3433                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3434         fi
3435 else
3436         echo "Keeping your $hint cppstdin wrapper."
3437 fi
3438 chmod 755 cppstdin
3439 wrapper=`pwd`/cppstdin
3440 ok='false'
3441 cd UU
3442
3443 if $test "X$cppstdin" != "X" && \
3444         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3445         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3446 then
3447         echo "You used to use $cppstdin $cppminus so we'll use that again."
3448         case "$cpprun" in
3449         '') echo "But let's see if we can live without a wrapper..." ;;
3450         *)
3451                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3452                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3453                 then
3454                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3455                         ok='true'
3456                 else
3457                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3458                 fi
3459                 ;;
3460         esac
3461 else
3462         case "$cppstdin" in
3463         '') ;;
3464         *)
3465                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3466                 ;;
3467         esac
3468 fi
3469
3470 if $ok; then
3471         : nothing
3472 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3473         $cc -E <testcpp.c >testcpp.out 2>&1; \
3474         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3475         echo "Yup, it does."
3476         x_cpp="$cc -E"
3477         x_minus='';
3478 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3479         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3480         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3481         echo "Yup, it does."
3482         x_cpp="$cc -E"
3483         x_minus='-';
3484 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3485         $cc -P <testcpp.c >testcpp.out 2>&1; \
3486         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3487         echo "Yipee, that works!"
3488         x_cpp="$cc -P"
3489         x_minus='';
3490 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3491         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3492         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3493         echo "At long last!"
3494         x_cpp="$cc -P"
3495         x_minus='-';
3496 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3497         $cpp <testcpp.c >testcpp.out 2>&1; \
3498         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3499         echo "It works!"
3500         x_cpp="$cpp"
3501         x_minus='';
3502 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3503         $cpp - <testcpp.c >testcpp.out 2>&1; \
3504         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3505         echo "Hooray, it works!  I was beginning to wonder."
3506         x_cpp="$cpp"
3507         x_minus='-';
3508 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3509         $wrapper <testcpp.c >testcpp.out 2>&1; \
3510         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3511         x_cpp="$wrapper"
3512         x_minus=''
3513         echo "Eureka!"
3514 else
3515         dflt=''
3516         rp="No dice.  I can't find a C preprocessor.  Name one:"
3517         . ./myread
3518         x_cpp="$ans"
3519         x_minus=''
3520         $x_cpp <testcpp.c >testcpp.out 2>&1
3521         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3522                 echo "OK, that will do." >&4
3523         else
3524 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3525                 exit 1
3526         fi
3527 fi
3528
3529 case "$ok" in
3530 false)
3531         cppstdin="$x_cpp"
3532         cppminus="$x_minus"
3533         cpprun="$x_cpp"
3534         cpplast="$x_minus"
3535         set X $x_cpp
3536         shift
3537         case "$1" in
3538         "$cpp")
3539                 echo "Perhaps can we force $cc -E using a wrapper..."
3540                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3541                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3542                 then
3543                         echo "Yup, we can."
3544                         cppstdin="$wrapper"
3545                         cppminus='';
3546                 else
3547                         echo "Nope, we'll have to live without it..."
3548                 fi
3549                 ;;
3550         esac
3551         case "$cpprun" in
3552         "$wrapper")
3553                 cpprun=''
3554                 cpplast=''
3555                 ;;
3556         esac
3557         ;;
3558 esac
3559
3560 case "$cppstdin" in
3561 "$wrapper"|'cppstdin') ;;
3562 *) $rm -f $wrapper;;
3563 esac
3564 $rm -f testcpp.c testcpp.out
3565
3566 : Set private lib path
3567 case "$plibpth" in
3568 '') if ./mips; then
3569                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3570         fi;;
3571 esac
3572 case "$libpth" in
3573 ' ') dlist='';;
3574 '') dlist="$loclibpth $plibpth $glibpth";;
3575 *) dlist="$libpth";;
3576 esac
3577
3578 : Now check and see which directories actually exist, avoiding duplicates
3579 libpth=''
3580 for xxx in $dlist
3581 do
3582     if $test -d $xxx; then
3583                 case " $libpth " in
3584                 *" $xxx "*) ;;
3585                 *) libpth="$libpth $xxx";;
3586                 esac
3587     fi
3588 done
3589 $cat <<'EOM'
3590
3591 Some systems have incompatible or broken versions of libraries.  Among
3592 the directories listed in the question below, please remove any you
3593 know not to be holding relevant libraries, and add any that are needed.
3594 Say "none" for none.
3595
3596 EOM
3597 case "$libpth" in
3598 '') dflt='none';;
3599 *)
3600         set X $libpth
3601         shift
3602         dflt=${1+"$@"}
3603         ;;
3604 esac
3605 rp="Directories to use for library searches?"
3606 . ./myread
3607 case "$ans" in
3608 none) libpth=' ';;
3609 *) libpth="$ans";;
3610 esac
3611
3612 : compute shared library extension
3613 case "$so" in
3614 '')
3615         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3616                 dflt='sl'
3617         else
3618                 dflt='so'
3619         fi
3620         ;;
3621 *) dflt="$so";;
3622 esac
3623 $cat <<EOM
3624
3625 On some systems, shared libraries may be available.  Answer 'none' if
3626 you want to suppress searching of shared libraries for the remainder
3627 of this configuration.
3628
3629 EOM
3630 rp='What is the file extension used for shared libraries?'
3631 . ./myread
3632 so="$ans"
3633
3634 : Define several unixisms.
3635 : Hints files or command line option can be used to override them.
3636 : The convoluted testing is in case hints files set either the old
3637 : or the new name.
3638 case "$_exe" in
3639 '')     case "$exe_ext" in
3640     '') ;;
3641         *)      _exe="$exe_ext" ;;
3642         esac
3643         ;;
3644 esac
3645 case "$_a" in
3646 '')     case "$lib_ext" in
3647     '') _a='.a';;
3648         *)      _a="$lib_ext" ;;
3649         esac
3650         ;;
3651 esac
3652 case "$_o" in
3653 '') case "$obj_ext" in
3654         '')     _o='.o';;
3655         *)      _o="$obj_ext";;
3656         esac
3657         ;;
3658 esac
3659 case "$p_" in
3660 '') case "$path_sep" in
3661         '')     p_=':';;
3662         *)      p_="$path_sep";;
3663         esac
3664         ;;
3665 esac
3666 exe_ext=$_exe
3667 lib_ext=$_a
3668 obj_ext=$_o
3669 path_sep=$p_
3670
3671 : Which makefile gets called first.  This is used by make depend.
3672 case "$firstmakefile" in
3673 '') firstmakefile='makefile';;
3674 esac
3675
3676 case "$usesocks" in
3677 $define|true|[yY]*)     dflt='y';;
3678 *) dflt='n';;
3679 esac
3680 cat <<EOM
3681
3682 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3683 Configure must be run with -Dusesocks.
3684
3685 If this doesn't make any sense to you, just accept the default '$dflt'.
3686 EOM
3687 rp='Build Perl for SOCKS?'
3688 . ./myread
3689 case "$ans" in
3690 y|Y)    val="$define" ;;     
3691 *)      val="$undef" ;;
3692 esac
3693 set usesocks
3694 eval $setvar
3695
3696 : Looking for optional libraries
3697 echo " "
3698 echo "Checking for optional libraries..." >&4
3699 case "$libs" in
3700 ' '|'') dflt='';;
3701 *) dflt="$libs";;
3702 esac
3703 case "$libswanted" in
3704 '') libswanted='c_s';;
3705 esac
3706 case "$usesocks" in
3707 $define)
3708         libswanted="$libswanted socks5 socks5_sh"
3709         ;;
3710 esac
3711 libsfound=''
3712 libsfiles=''
3713 libsdirs=''
3714 libspath=''
3715 for thisdir in $libpth $xlibpth; do
3716   test -d $thisdir && libspath="$libspath $thisdir"
3717 done
3718 for thislib in $libswanted; do
3719         for thisdir in $libspath; do
3720             xxx=''
3721             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3722                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3723                 $test -f "$xxx" && eval $libscheck
3724                 $test -f "$xxx" && libstyle=shared
3725             fi
3726             if test ! -f "$xxx"; then
3727                 xxx=$thisdir/lib$thislib.$so
3728                 $test -f "$xxx" && eval $libscheck
3729                 $test -f "$xxx" && libstyle=shared
3730             fi  
3731             if test ! -f "$xxx"; then
3732                 xxx=$thisdir/lib$thislib$_a
3733                 $test -f "$xxx" && eval $libscheck
3734                 $test -f "$xxx" && libstyle=static
3735             fi
3736             if test ! -f "$xxx"; then
3737                 xxx=$thisdir/$thislib$_a
3738                 $test -f "$xxx" && eval $libscheck
3739                 $test -f "$xxx" && libstyle=static
3740             fi
3741             if test ! -f "$xxx"; then
3742                 xxx=$thisdir/lib${thislib}_s$_a
3743                 $test -f "$xxx" && eval $libscheck
3744                 $test -f "$xxx" && libstyle=static
3745                 $test -f "$xxx" && thislib=${thislib}_s
3746             fi
3747             if test ! -f "$xxx"; then
3748                 xxx=$thisdir/Slib$thislib$_a
3749                 $test -f "$xxx" && eval $libscheck
3750                 $test -f "$xxx" && libstyle=static
3751             fi
3752             if $test -f "$xxx"; then
3753                 case "$libstyle" in
3754                 shared) echo "Found -l$thislib (shared)." ;;
3755                 static) echo "Found -l$thislib." ;;
3756                 *)      echo "Found -l$thislib ($libstyle)." ;;
3757                 esac
3758                 case " $dflt " in
3759                 *"-l$thislib "*);;
3760                 *) dflt="$dflt -l$thislib"
3761                    libsfound="$libsfound $xxx"
3762                    yyy=`basename $xxx`
3763                    libsfiles="$libsfiles $yyy"
3764                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3765                    case " $libsdirs " in
3766                    *" $yyy "*) ;;
3767                    *) libsdirs="$libsdirs $yyy" ;;
3768                    esac
3769                    ;;
3770                 esac
3771                 break
3772             fi  
3773         done
3774         if $test ! -f "$xxx"; then
3775             echo "No -l$thislib."
3776         fi
3777 done
3778 set X $dflt
3779 shift
3780 dflt="$*"
3781 case "$libs" in
3782 '') dflt="$dflt";;
3783 *) dflt="$libs";;
3784 esac
3785 case "$dflt" in
3786 ' '|'') dflt='none';;
3787 esac
3788
3789 $cat <<EOM
3790
3791 In order to compile $package on your machine, a number of libraries
3792 are usually needed.  Include any other special libraries here as well.
3793 Say "none" for none.  The default list is almost always right.
3794 EOM
3795
3796 echo " "
3797 rp="What libraries to use?"
3798 . ./myread
3799 case "$ans" in
3800 none) libs=' ';;
3801 *) libs="$ans";;
3802 esac
3803
3804 : determine optimization, if desired, or use for debug flag also
3805 case "$optimize" in
3806 ' '|$undef) dflt='none';;
3807 '') dflt='-O';;
3808 *) dflt="$optimize";;
3809 esac
3810 $cat <<EOH
3811
3812 By default, $package compiles with the -O flag to use the optimizer.
3813 Alternately, you might want to use the symbolic debugger, which uses
3814 the -g flag (on traditional Unix systems).  Either flag can be
3815 specified here.  To use neither flag, specify the word "none".
3816
3817 EOH
3818 rp="What optimizer/debugger flag should be used?"
3819 . ./myread
3820 optimize="$ans"
3821 case "$optimize" in
3822 'none') optimize=" ";;
3823 esac
3824
3825 dflt=''
3826 : We will not override a previous value, but we might want to
3827 : augment a hint file
3828 case "$hint" in
3829 default|recommended)
3830         case "$gccversion" in
3831         1*) dflt='-fpcc-struct-return' ;;
3832         esac
3833         case "$optimize" in
3834         *-g*) dflt="$dflt -DDEBUGGING";;
3835         esac
3836         case "$gccversion" in
3837         2*) if test -d /etc/conf/kconfig.d &&
3838                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3839                 then
3840                         dflt="$dflt -posix"
3841                 fi
3842                 ;;
3843         esac
3844         case "$gccversion" in
3845         1*) ;;
3846         2.[0-8]*) ;;
3847         ?*)     echo " "
3848                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3849                 echo 'int main(void) { return 0; }' > gcctest.c
3850                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3851                         echo "Yes, it does." 2>&1
3852                         case "$ccflags" in
3853                         *strict-aliasing*) 
3854                                 echo "Leaving current flags $ccflags alone." 2>&1
3855                                 ;;
3856                         *) dflt="$dflt -fno-strict-aliasing" ;;
3857                         esac
3858                 else
3859                         echo "Nope, it doesn't, but that's ok." 2>&1
3860                 fi
3861                 ;;
3862         esac
3863         ;;
3864 esac
3865
3866 case "$mips_type" in
3867 *BSD*|'') inclwanted="$locincpth $usrinc";;
3868 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3869 esac
3870 for thisincl in $inclwanted; do
3871         if $test -d $thisincl; then
3872                 if $test x$thisincl != x$usrinc; then
3873                         case "$dflt" in
3874                         *$thisincl*);;
3875                         *) dflt="$dflt -I$thisincl";;
3876                         esac
3877                 fi
3878         fi
3879 done
3880
3881 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3882         xxx=true;
3883 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3884         xxx=true;
3885 else
3886         xxx=false;
3887 fi;
3888 if $xxx; then
3889         case "$dflt" in
3890         *$2*);;
3891         *) dflt="$dflt -D$2";;
3892         esac;
3893 fi'
3894
3895 set signal.h LANGUAGE_C; eval $inctest
3896
3897 case "$usesocks" in
3898 $define)
3899         ccflags="$ccflags -DSOCKS"
3900         ;;
3901 esac
3902
3903 case "$hint" in
3904 default|recommended) dflt="$ccflags $dflt" ;;
3905 *) dflt="$ccflags";;
3906 esac
3907
3908 case "$dflt" in
3909 ''|' ') dflt=none;;
3910 esac
3911 $cat <<EOH
3912
3913 Your C compiler may want other flags.  For this question you should include
3914 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3915 but you should NOT include libraries or ld flags like -lwhatever.  If you
3916 want $package to honor its debug switch, you should include -DDEBUGGING here.
3917 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3918
3919 To use no flags, specify the word "none".
3920
3921 EOH
3922 set X $dflt
3923 shift
3924 dflt=${1+"$@"}
3925 rp="Any additional cc flags?"
3926 . ./myread
3927 case "$ans" in
3928 none) ccflags='';;
3929 *) ccflags="$ans";;
3930 esac
3931
3932 : the following weeds options from ccflags that are of no interest to cpp
3933 cppflags="$ccflags"
3934 case "$gccversion" in
3935 1*) cppflags="$cppflags -D__GNUC__"
3936 esac
3937 case "$mips_type" in
3938 '');;
3939 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3940 esac
3941 case "$cppflags" in
3942 '');;
3943 *)
3944         echo " "
3945         echo "Let me guess what the preprocessor flags are..." >&4
3946         set X $cppflags
3947         shift
3948         cppflags=''
3949         $cat >cpp.c <<'EOM'
3950 #define BLURFL foo
3951
3952 BLURFL xx LFRULB
3953 EOM
3954         previous=''
3955         for flag in $*
3956         do
3957                 case "$flag" in
3958                 -*) ftry="$flag";;
3959                 *) ftry="$previous $flag";;
3960                 esac
3961                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3962                         >cpp1.out 2>/dev/null && \
3963                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3964                         >cpp2.out 2>/dev/null && \
3965                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3966                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3967                 then
3968                         cppflags="$cppflags $ftry"
3969                         previous=''
3970                 else
3971                         previous="$flag"
3972                 fi
3973         done
3974         set X $cppflags
3975         shift
3976         cppflags=${1+"$@"}
3977         case "$cppflags" in
3978         *-*)  echo "They appear to be: $cppflags";;
3979         esac
3980         $rm -f cpp.c cpp?.out
3981         ;;
3982 esac
3983
3984 : flags used in final linking phase
3985 case "$ldflags" in
3986 '') if ./venix; then
3987                 dflt='-i -z'
3988         else
3989                 dflt=''
3990         fi
3991         case "$ccflags" in
3992         *-posix*) dflt="$dflt -posix" ;;
3993         esac
3994         ;;
3995 *) dflt="$ldflags";;
3996 esac
3997
3998 : Try to guess additional flags to pick up local libraries.
3999 for thislibdir in $libpth; do
4000         case " $loclibpth " in
4001         *" $thislibdir "*)
4002                 case "$dflt " in 
4003                 *"-L$thislibdir "*) ;;
4004                 *)  dflt="$dflt -L$thislibdir" ;;
4005                 esac
4006                 ;;
4007         esac
4008 done
4009
4010 case "$dflt" in
4011 '') dflt='none' ;;
4012 esac
4013
4014 $cat <<EOH
4015
4016 Your C linker may need flags.  For this question you should
4017 include -L/whatever and any other flags used by the C linker, but you
4018 should NOT include libraries like -lwhatever.
4019
4020 Make sure you include the appropriate -L/path flags if your C linker
4021 does not normally search all of the directories you specified above,
4022 namely
4023         $libpth
4024 To use no flags, specify the word "none".
4025
4026 EOH
4027
4028 rp="Any additional ld flags (NOT including libraries)?"
4029 . ./myread
4030 case "$ans" in
4031 none) ldflags='';;
4032 *) ldflags="$ans";;
4033 esac
4034 rmlist="$rmlist pdp11"
4035
4036 : coherency check
4037 echo " "
4038 echo "Checking your choice of C compiler and flags for coherency..." >&4
4039 $cat > try.c <<'EOF'
4040 #include <stdio.h>
4041 int main() { printf("Ok\n"); exit(0); }
4042 EOF
4043 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4044 shift
4045 $cat >try.msg <<'EOM'
4046 I've tried to compile and run the following simple program:
4047
4048 EOM
4049 $cat try.c >> try.msg
4050
4051 $cat >> try.msg <<EOM
4052
4053 I used the command:
4054
4055         $*
4056         ./try
4057
4058 and I got the following output:
4059
4060 EOM
4061 dflt=y
4062 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4063         if sh -c './try' >>try.msg 2>&1; then
4064                 xxx=`./try`
4065                 case "$xxx" in
4066                 "Ok") dflt=n ;;
4067                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4068                         case " $libs " in
4069                         *" -lsfio "*)
4070                                 cat >> try.msg <<'EOQS'
4071 If $libs contains -lsfio, and sfio is mis-configured, then it
4072 sometimes (apparently) runs and exits with a 0 status, but with no
4073 output!  It may have to do with sfio's use of _exit vs. exit.
4074
4075 EOQS
4076                                 rp="You have a big problem.  Shall I abort Configure"
4077                                 dflt=y
4078                                 ;;
4079                         esac
4080                         ;;
4081                 esac
4082         else
4083                 echo "The program compiled OK, but exited with status $?." >>try.msg
4084                 rp="You have a problem.  Shall I abort Configure"
4085                 dflt=y
4086         fi
4087 else
4088         echo "I can't compile the test program." >>try.msg
4089         rp="You have a BIG problem.  Shall I abort Configure"
4090         dflt=y
4091 fi
4092 case "$dflt" in
4093 y)
4094         $cat try.msg >&4
4095         case "$knowitall" in
4096         '')
4097                 echo "(The supplied flags or libraries might be incorrect.)"
4098                 ;;
4099         *) dflt=n;;
4100         esac
4101         echo " "
4102         . ./myread
4103         case "$ans" in
4104         n*|N*) ;;
4105         *)      echo "Ok.  Stopping Configure." >&4
4106                 exit 1
4107                 ;;
4108         esac
4109         ;;
4110 n) echo "OK, that should do.";;
4111 esac
4112 $rm -f try try.* core
4113
4114 : define an is-a-typedef? function
4115 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4116 case "$inclist" in
4117 "") inclist="sys/types.h";;
4118 esac;
4119 eval "varval=\$$var";
4120 case "$varval" in
4121 "")
4122         $rm -f temp.c;
4123         for inc in $inclist; do
4124                 echo "#include <$inc>" >>temp.c;
4125         done;
4126         echo "#ifdef $type" >> temp.c;
4127         echo "printf(\"We have $type\");" >> temp.c;
4128         echo "#endif" >> temp.c;
4129         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4130         if $contains $type temp.E >/dev/null 2>&1; then
4131                 eval "$var=\$type";
4132         else
4133                 eval "$var=\$def";
4134         fi;
4135         $rm -f temp.?;;
4136 *) eval "$var=\$varval";;
4137 esac'
4138
4139 : define an is-a-typedef? function that prompts if the type is not available.
4140 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4141 case "$inclist" in
4142 "") inclist="sys/types.h";;
4143 esac;
4144 eval "varval=\$$var";
4145 case "$varval" in
4146 "")
4147         $rm -f temp.c;
4148         for inc in $inclist; do
4149                 echo "#include <$inc>" >>temp.c;
4150         done;
4151         echo "#ifdef $type" >> temp.c;
4152         echo "printf(\"We have $type\");" >> temp.c;
4153         echo "#endif" >> temp.c;
4154         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4155         echo " " ;
4156         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4157         if $contains $type temp.E >/dev/null 2>&1; then
4158                 echo "$type found." >&4;
4159                 eval "$var=\$type";
4160         else
4161                 echo "$type NOT found." >&4;
4162                 dflt="$def";
4163                 . ./myread ;
4164                 eval "$var=\$ans";
4165         fi;
4166         $rm -f temp.?;;
4167 *) eval "$var=\$varval";;
4168 esac'
4169
4170 : define a shorthand compile call
4171 compile='
4172 mc_file=$1;
4173 shift;
4174 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4175 : define a shorthand compile call for compilations that should be ok.
4176 compile_ok='
4177 mc_file=$1;
4178 shift;
4179 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4180
4181 : check for lengths of integral types
4182 echo " "
4183 case "$intsize" in
4184 '')
4185         echo "Checking to see how big your integers are..." >&4
4186         $cat >intsize.c <<'EOCP'
4187 #include <stdio.h>
4188 int main()
4189 {
4190         printf("intsize=%d;\n", (int)sizeof(int));
4191         printf("longsize=%d;\n", (int)sizeof(long));
4192         printf("shortsize=%d;\n", (int)sizeof(short));
4193         exit(0);
4194 }
4195 EOCP
4196         set intsize
4197         if eval $compile_ok && ./intsize > /dev/null; then
4198                 eval `./intsize`
4199                 echo "Your integers are $intsize bytes long."
4200                 echo "Your long integers are $longsize bytes long."
4201                 echo "Your short integers are $shortsize bytes long."
4202         else
4203                 $cat >&4 <<EOM
4204 !
4205 Help! I can't compile and run the intsize test program: please enlighten me!
4206 (This is probably a misconfiguration in your system or libraries, and
4207 you really ought to fix it.  Still, I'll try anyway.)
4208 !
4209 EOM
4210                 dflt=4
4211                 rp="What is the size of an integer (in bytes)?"
4212                 . ./myread
4213                 intsize="$ans"
4214                 dflt=$intsize
4215                 rp="What is the size of a long integer (in bytes)?"
4216                 . ./myread
4217                 longsize="$ans"
4218                 dflt=2
4219                 rp="What is the size of a short integer (in bytes)?"
4220                 . ./myread
4221                 shortsize="$ans"
4222         fi
4223         ;;
4224 esac
4225 $rm -f intsize intsize.*
4226
4227 : see what type lseek is declared as in the kernel
4228 rp="What is the type used for lseek's offset on this system?"
4229 set off_t lseektype long stdio.h sys/types.h
4230 eval $typedef_ask
4231
4232 echo " "
4233 echo "Checking to see how big your file offsets are..." >&4
4234 $cat >try.c <<EOCP
4235 #include <sys/types.h>
4236 #include <stdio.h>
4237 int main()
4238 {
4239     printf("%d\n", (int)sizeof($lseektype));
4240     return(0); 
4241 }
4242 EOCP
4243 set try
4244 if eval $compile_ok; then
4245         lseeksize=`./try`
4246         echo "Your file offsets are $lseeksize bytes long."
4247 else
4248         dflt=$longsize
4249         echo " "
4250         echo "(I can't seem to compile the test program.  Guessing...)"
4251         rp="What is the size of your file offsets (in bytes)?"
4252         . ./myread
4253         lseeksize="$ans"
4254 fi
4255 $rm -f try.c try
4256
4257 : see what type file positions are declared as in the library
4258 rp="What is the type for file position used by fsetpos()?"
4259 set fpos_t fpostype long stdio.h sys/types.h
4260 eval $typedef_ask
4261
4262 echo " "
4263 case "$fpostype" in
4264 *_t) zzz="$fpostype"    ;;
4265 *)   zzz="fpos_t"       ;;
4266 esac
4267 echo "Checking the size of $zzz..." >&4 
4268 cat > try.c <<EOCP
4269 #include <sys/types.h>
4270 #include <stdio.h>
4271 int main() {
4272     printf("%d\n", (int)sizeof($fpostype));
4273     exit(0);
4274 }
4275 EOCP
4276 set try
4277 if eval $compile_ok; then
4278         yyy=`./try`
4279         case "$yyy" in
4280         '')     fpossize=4
4281                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4282                 ;;
4283         *)      fpossize=$yyy
4284                 echo "Your $zzz is $fpossize bytes long."
4285                 ;;
4286         esac
4287 else
4288         dflt="$longsize"
4289         echo " " >&4
4290         echo "(I can't compile the test program.  Guessing...)" >&4
4291         rp="What is the size of your file positions (in bytes)?"
4292         . ./myread
4293         fpossize="$ans"
4294 fi
4295
4296
4297
4298 # Backward compatibility (uselfs is deprecated).
4299 case "$uselfs" in
4300 "$define"|true|[yY]*)
4301         cat <<EOM >&4
4302
4303 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4304 EOM
4305         uselargefiles="$define"
4306         ;;
4307 esac                          
4308
4309 case "$lseeksize:$fpossize" in
4310 8:8) cat <<EOM
4311
4312 You can have files larger than 2 gigabytes.
4313 EOM
4314    val="$define" ;;
4315 *)    case "$uselargefiles" in
4316    "$undef"|false|[nN]*) dflt='n' ;;
4317    *)   dflt='y' ;;
4318    esac
4319    cat <<EOM
4320
4321 Perl can be built to understand large files (files larger than 2 gigabytes)
4322 on some systems.  To do so, Configure can be run with -Duselargefiles.
4323
4324 If this doesn't make any sense to you, just accept the default '$dflt'.
4325 EOM
4326    rp='Try to understand large files, if available?'
4327    . ./myread
4328    case "$ans" in
4329    y|Y)         val="$define" ;;
4330    *)           val="$undef"  ;;
4331    esac
4332    ;;
4333 esac
4334 set uselargefiles
4335 eval $setvar
4336 case "$uselargefiles" in
4337 "$define")
4338 : Look for a hint-file generated 'call-back-unit'.  If the
4339 : user has specified that a large files perl is to be built,
4340 : we may need to set or change some other defaults.
4341         if $test -f uselfs.cbu; then
4342                 echo "Your platform has some specific hints for large file builds, using them..."
4343                 . ./uselfs.cbu
4344                 echo " "
4345                 echo "Rechecking to see how big your file offsets are..." >&4
4346                 $cat >try.c <<EOCP
4347 #include <sys/types.h>
4348 #include <stdio.h>
4349 int main()
4350 {
4351     printf("%d\n", (int)sizeof($lseektype));
4352     return(0); 
4353 }
4354 EOCP
4355                 set try
4356                 if eval $compile_ok; then
4357                         lseeksize=`./try`
4358                         $echo "Your file offsets are now $lseeksize bytes long."
4359                 else
4360                         dflt="$lseeksize"
4361                         echo " "
4362                         echo "(I can't seem to compile the test program.  Guessing...)"
4363                         rp="What is the size of your file offsets (in bytes)?"
4364                         . ./myread
4365                         lseeksize="$ans"
4366                 fi
4367                 case "$fpostype" in
4368                 *_t) zzz="$fpostype"    ;;
4369                 *)   zzz="fpos_t"       ;;
4370                 esac
4371                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4372                 $cat > try.c <<EOCP
4373 #include <sys/types.h>
4374 #include <stdio.h>
4375 int main() {
4376     printf("%d\n", (int)sizeof($fpostype));
4377     exit(0);
4378 }
4379 EOCP
4380                 set try
4381                 if eval $compile_ok; then
4382                         yyy=`./try`
4383                         dflt="$lseeksize"
4384                         case "$yyy" in
4385                         '')     echo " "
4386                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4387                                 ;;
4388                         *)      fpossize=$yyy
4389                                 echo " $fpossize bytes." >&4
4390                                 ;;
4391                         esac
4392                 else
4393                         dflt="$fpossize"
4394                         echo " "
4395                         echo "(I can't compile the test program.  Guessing...)" >&4
4396                         rp="What is the size of your file positions (in bytes)?"
4397                         . ./myread
4398                         fpossize="$ans"
4399                 fi
4400                 $rm -f try.c try
4401         fi
4402         ;;
4403 esac
4404
4405
4406 case "$usemorebits" in
4407 "$define"|true|[yY]*)
4408         use64bitint="$define"
4409         uselongdouble="$define"
4410         usemorebits="$define"
4411         ;;
4412 *)      usemorebits="$undef"
4413         ;;
4414 esac
4415
4416
4417 # Backward compatibility (uselonglong is deprecated).
4418 case "$uselonglong" in
4419 "$define"|true|[yY]*)
4420         cat <<EOM >&4
4421
4422 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4423 EOM
4424         use64bitint="$define"
4425         ;;
4426 esac                          
4427 # Backward compatibility (use64bits is deprecated).
4428 case "$use64bits" in
4429 "$define"|true|[yY]*)
4430         cat <<EOM >&4
4431
4432 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4433 EOM
4434         use64bitint="$define"
4435         ;;
4436 esac                          
4437 # Thinko compatibilities.
4438 case "$use64bitints" in
4439 "$define"|true|[yY]*)
4440         cat <<EOM >&4
4441
4442 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4443 EOM
4444         use64bitint="$define"
4445         ;;
4446 esac                          
4447 case "$use64bitsall" in
4448 "$define"|true|[yY]*)
4449         cat <<EOM >&4
4450
4451 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4452 EOM
4453         use64bitall="$define"
4454         ;;
4455 esac                          
4456
4457 case "$ccflags" in
4458 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4459 esac
4460 case "$use64bitall" in
4461 "$define"|true|[yY]*) use64bitint="$define" ;;
4462 esac
4463
4464 case "$longsize" in
4465 8) cat <<EOM
4466
4467 You have natively 64-bit long integers.
4468 EOM
4469    val="$define"
4470    ;;
4471 *) case "$use64bitint" in
4472    "$define"|true|[yY]*) dflt='y';;
4473    *) dflt='n';;
4474    esac
4475    cat <<EOM
4476
4477 Perl can be built to take advantage of 64-bit integer types
4478 on some systems.  To do so, Configure can be run with -Duse64bitint.
4479 Choosing this option will most probably introduce binary incompatibilities.
4480
4481 If this doesn't make any sense to you, just accept the default '$dflt'.
4482 EOM
4483    rp='Try to use 64-bit integers, if available?'
4484    . ./myread
4485    case "$ans" in
4486    [yY]*) val="$define" ;;
4487    *)     val="$undef"  ;;
4488    esac
4489    ;;
4490 esac
4491 set use64bitint
4492 eval $setvar
4493
4494 cat <<EOM
4495
4496 You may also choose to try maximal 64-bitness.  It means using as much
4497 64-bitness as possible on the platform.  This in turn means even more
4498 binary incompatibilities.  On the other hand, your platform may not
4499 have any more 64-bitness available than what you already have chosen.
4500
4501 If this doesn't make any sense to you, just accept the default '$dflt'.
4502 EOM
4503 rp='Try to use maximal 64-bit support, if available?'
4504 case "$use64bitall" in
4505 "$define"|true|[yY]*) dflt='y' ;;
4506 *) case "$longsize" in
4507    8) dflt='y' ;;
4508    *) dflt='n' ;;
4509    esac
4510    ;;
4511 esac    
4512 . ./myread
4513 case "$ans" in
4514 [yY]*) val="$define" ;;
4515 *)     val="$undef"  ;;
4516 esac
4517 set use64bitall
4518 eval $setvar
4519 case "$use64bitall" in
4520 "$define")
4521         case "$use64bitint" in
4522         "$undef")
4523                 cat <<EOM
4524
4525 Since you have chosen a maximally 64-bit build, I'm also turning on
4526 the use of 64-bit integers.
4527 EOM
4528                 use64bitint="$define" ;;
4529         esac
4530         ;;
4531 esac
4532
4533 case "$use64bitint" in
4534 "$define"|true|[yY]*)
4535 : Look for a hint-file generated 'call-back-unit'.  If the
4536 : user has specified that a 64-bit perl is to be built,
4537 : we may need to set or change some other defaults.
4538         if $test -f use64bitint.cbu; then
4539                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4540                 . ./use64bitint.cbu
4541         fi
4542         case "$longsize" in
4543         4) case "$archname64" in
4544            '') archname64=64int ;;
4545            esac
4546            ;;
4547         esac
4548         ;;
4549 esac
4550
4551 case "$use64bitall" in
4552 "$define"|true|[yY]*)
4553 : Look for a hint-file generated 'call-back-unit'.  If the
4554 : user has specified that a maximally 64-bit perl is to be built,
4555 : we may need to set or change some other defaults.
4556         if $test -f use64bitall.cbu; then
4557                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4558                 . ./use64bitall.cbu
4559         fi
4560         case "$longsize" in
4561         4) case "$archname64" in
4562            ''|64int) archname64=64all ;;
4563            esac
4564            ;;
4565         esac
4566         ;;
4567 esac
4568
4569 : determine the architecture name
4570 echo " "
4571 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4572         tarch=`arch`"-$osname"
4573 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4574         if uname -m > tmparch 2>&1 ; then
4575                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4576                         -e 's/$/'"-$osname/" tmparch`
4577         else
4578                 tarch="$osname"
4579         fi
4580         $rm -f tmparch
4581 else
4582         tarch="$osname"
4583 fi
4584 case "$myarchname" in
4585 ''|"$tarch") ;;
4586 *)
4587         echo "(Your architecture name used to be $myarchname.)"
4588         archname=''
4589         ;;
4590 esac
4591 myarchname="$tarch"
4592 case "$archname" in
4593 '') dflt="$tarch";;
4594 *) dflt="$archname";;
4595 esac
4596 rp='What is your architecture name'
4597 . ./myread
4598 archname="$ans"
4599 case "$usethreads" in
4600 $define)
4601         echo "Threads selected." >&4
4602         case "$archname" in
4603         *-thread*) echo "...and architecture name already has -thread." >&4
4604                 ;;
4605         *)      archname="$archname-thread"
4606                 echo "...setting architecture name to $archname." >&4
4607                 ;;
4608         esac
4609         ;;
4610 esac
4611 case "$usemultiplicity" in
4612 $define)
4613         echo "Multiplicity selected." >&4
4614         case "$archname" in
4615         *-multi*) echo "...and architecture name already has -multi." >&4
4616                 ;;
4617         *)      archname="$archname-multi"
4618                 echo "...setting architecture name to $archname." >&4
4619                 ;;
4620         esac
4621         ;;
4622 esac
4623 case "$use64bitint" in
4624 $define)
4625         case "$archname64" in
4626         '')
4627                 ;;
4628         *)
4629                 case "$archname" in
4630                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4631                         ;;
4632                 *)      archname="$archname-$archname64"
4633                         echo "...setting architecture name to $archname." >&4
4634                         ;;
4635                 esac
4636                 ;;
4637         esac
4638 esac
4639
4640 : determine root of directory hierarchy where package will be installed.
4641 case "$prefix" in
4642 '')
4643         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4644         ;;
4645 *)
4646         dflt="$prefix"
4647         ;;
4648 esac
4649 $cat <<EOM
4650
4651 By default, $package will be installed in $dflt/bin, manual pages
4652 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4653 installation directories. Typically this is something like /usr/local.
4654 If you wish to have binaries under /usr/bin but other parts of the
4655 installation under /usr/local, that's ok: you will be prompted
4656 separately for each of the installation directories, the prefix being
4657 only used to set the defaults.
4658
4659 EOM
4660 fn=d~
4661 rp='Installation prefix to use?'
4662 . ./getfile
4663 oldprefix=''
4664 case "$prefix" in
4665 '') ;;
4666 *)
4667         case "$ans" in
4668         "$prefix") ;;
4669         *) oldprefix="$prefix";;
4670         esac
4671         ;;
4672 esac
4673 prefix="$ans"
4674 prefixexp="$ansexp"
4675
4676 : is AFS running?
4677 echo " "
4678 case "$afs" in
4679 $define|true)   afs=true ;;
4680 $undef|false)   afs=false ;;
4681 *)      if test -d /afs; then
4682                 afs=true
4683         else
4684                 afs=false
4685         fi
4686         ;;
4687 esac
4688 if $afs; then
4689         echo "AFS may be running... I'll be extra cautious then..." >&4
4690 else
4691         echo "AFS does not seem to be running..." >&4
4692 fi
4693
4694 : determine installation prefix for where package is to be installed.
4695 if $afs; then 
4696 $cat <<EOM
4697
4698 Since you are running AFS, I need to distinguish the directory in which
4699 files will reside from the directory in which they are installed (and from
4700 which they are presumably copied to the former directory by occult means).
4701
4702 EOM
4703         case "$installprefix" in
4704         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4705         *) dflt="$installprefix";;
4706         esac
4707 else
4708 $cat <<EOM
4709
4710 In some special cases, particularly when building $package for distribution,
4711 it is convenient to distinguish between the directory in which files should 
4712 be installed from the directory ($prefix) in which they 
4713 will eventually reside.  For most users, these two directories are the same.
4714
4715 EOM
4716         case "$installprefix" in
4717         '') dflt=$prefix ;;
4718         *) dflt=$installprefix;;
4719         esac
4720 fi
4721 fn=d~
4722 rp='What installation prefix should I use for installing files?'
4723 . ./getfile
4724 installprefix="$ans"
4725 installprefixexp="$ansexp"
4726
4727 : set the prefixit variable, to compute a suitable default value
4728 prefixit='case "$3" in
4729 ""|none)
4730         case "$oldprefix" in
4731         "") eval "$1=\"\$$2\"";;
4732         *)
4733                 case "$3" in
4734                 "") eval "$1=";;
4735                 none)
4736                         eval "tp=\"\$$2\"";
4737                         case "$tp" in
4738                         ""|" ") eval "$1=\"\$$2\"";;
4739                         *) eval "$1=";;
4740                         esac;;
4741                 esac;;
4742         esac;;
4743 *)
4744         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4745         case "$tp" in
4746         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4747         /*-$oldprefix/*|\~*-$oldprefix/*)
4748                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4749         *) eval "$1=\"\$$2\"";;
4750         esac;;
4751 esac'
4752
4753
4754 : get the patchlevel
4755 echo " "
4756 echo "Getting the current patchlevel..." >&4
4757 if $test -r $rsrc/patchlevel.h;then
4758         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4759         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4760         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4761         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4762         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4763         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4764 else
4765         revision=0
4766         patchlevel=0
4767         subversion=0
4768         api_revision=0
4769         api_version=0
4770         api_subversion=0
4771 fi
4772 $echo $n "(You have $package revision $revision" $c
4773 $echo $n " patchlevel $patchlevel" $c
4774 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4775 echo ".)"
4776 case "$osname" in
4777 dos|vms)
4778         : XXX Should be a Configure test for double-dots in filenames.
4779         version=`echo $revision $patchlevel $subversion | \
4780                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4781         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4782                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4783         ;;
4784 *)
4785         version=`echo $revision $patchlevel $subversion | \
4786                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4787         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4788                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4789         ;;
4790 esac
4791 : Special case the 5.005_xx maintenance series, which used 5.005
4792 : without any subversion label as a subdirectory in $sitelib
4793 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4794         api_versionstring='5.005'
4795 fi
4796
4797 : determine installation style
4798 : For now, try to deduce it from prefix unless it is already set.
4799 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4800 case "$installstyle" in
4801 '')     case "$prefix" in
4802                 *perl*) dflt='lib';;
4803                 *) dflt='lib/perl5' ;;
4804         esac
4805         ;;
4806 *)      dflt='lib/perl5' ;;
4807 esac
4808 : Probably not worth prompting for this since we prompt for all
4809 : the directories individually, and the prompt would be too long and
4810 : confusing anyway.
4811 installstyle=$dflt
4812
4813 : determine where private library files go
4814 : Usual default is /usr/local/lib/perl5/$version.
4815 : Also allow things like /opt/perl/lib/$version, since 
4816 : /opt/perl/lib/perl5... would be redundant.
4817 : The default "style" setting is made in installstyle.U
4818 case "$installstyle" in
4819 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4820 *)       set dflt privlib lib/$version ;;
4821 esac
4822 eval $prefixit
4823 $cat <<EOM
4824
4825 There are some auxiliary files for $package that need to be put into a
4826 private library directory that is accessible by everyone.
4827
4828 EOM
4829 fn=d~+
4830 rp='Pathname where the private library files will reside?'
4831 . ./getfile
4832 privlib="$ans"
4833 privlibexp="$ansexp"
4834 : Change installation prefix, if necessary.
4835 if $test X"$prefix" != X"$installprefix"; then
4836         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4837 else
4838         installprivlib="$privlibexp"
4839 fi
4840
4841 : set the prefixup variable, to restore leading tilda escape
4842 prefixup='case "$prefixexp" in
4843 "$prefix") ;;
4844 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4845 esac'
4846
4847 : determine where public architecture dependent libraries go
4848 set archlib archlib
4849 eval $prefixit
4850 : privlib default is /usr/local/lib/$package/$version
4851 : archlib default is /usr/local/lib/$package/$version/$archname
4852 : privlib may have an optional trailing /share.
4853 tdflt=`echo $privlib | $sed 's,/share$,,'`
4854 tdflt=$tdflt/$archname
4855 case "$archlib" in
4856 '')     dflt=$tdflt
4857         ;;
4858 *)      dflt="$archlib"
4859     ;;
4860 esac
4861 $cat <<EOM
4862
4863 $spackage contains architecture-dependent library files.  If you are
4864 sharing libraries in a heterogeneous environment, you might store
4865 these files in a separate location.  Otherwise, you can just include
4866 them with the rest of the public library files.
4867
4868 EOM
4869 fn=d+~
4870 rp='Where do you want to put the public architecture-dependent libraries?'
4871 . ./getfile
4872 archlib="$ans"
4873 archlibexp="$ansexp"
4874 if $test X"$archlib" = X"$privlib"; then
4875         d_archlib="$undef"
4876 else
4877         d_archlib="$define"
4878 fi
4879 : Change installation prefix, if necessary.
4880 if $test X"$prefix" != X"$installprefix"; then
4881         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4882 else
4883         installarchlib="$archlibexp"
4884 fi
4885
4886
4887 : Binary compatibility with 5.005 is not possible for builds
4888 : with advanced features
4889 case "$usethreads$usemultiplicity" in
4890 *define*)
4891         bincompat5005="$undef"
4892         d_bincompat5005="$undef"
4893         ;;
4894 *)      $cat <<EOM
4895
4896 Perl 5.006 can be compiled for binary compatibility with 5.005.
4897 If you decide to do so, you will be able to continue using most
4898 of the extensions that were compiled for Perl 5.005.
4899
4900 EOM
4901         case "$bincompat5005$d_bincompat5005" in
4902         *"$undef"*) dflt=n ;;
4903         *) dflt=y ;;
4904         esac
4905         rp='Binary compatibility with Perl 5.005?'
4906         . ./myread
4907         case "$ans" in
4908         y*) val="$define" ;;
4909         *)  val="$undef" ;;
4910         esac
4911         set d_bincompat5005
4912         eval $setvar
4913         case "$d_bincompat5005" in
4914         "$define")
4915                 bincompat5005="$define"
4916                 ;;
4917         *)      bincompat5005="$undef"
4918                 d_bincompat5005="$undef"
4919                 ;;
4920         esac
4921         ;;
4922 esac
4923
4924
4925 : see if setuid scripts can be secure
4926 $cat <<EOM
4927
4928 Some kernels have a bug that prevents setuid #! scripts from being
4929 secure.  Some sites have disabled setuid #! scripts because of this.
4930
4931 First let's decide if your kernel supports secure setuid #! scripts.
4932 (If setuid #! scripts would be secure but have been disabled anyway,
4933 don't say that they are secure if asked.)
4934
4935 EOM
4936
4937 val="$undef"
4938 if $test -d /dev/fd; then
4939         echo "#!$ls" >reflect
4940         chmod +x,u+s reflect
4941         ./reflect >flect 2>&1
4942         if $contains "/dev/fd" flect >/dev/null; then
4943                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4944                 val="$define"
4945         else
4946                 $cat <<EOM
4947 If you are not sure if they are secure, I can check but I'll need a
4948 username and password different from the one you are using right now.
4949 If you don't have such a username or don't want me to test, simply
4950 enter 'none'.
4951
4952 EOM
4953                 rp='Other username to test security of setuid scripts with?'
4954                 dflt='none'
4955                 . ./myread
4956                 case "$ans" in
4957                 n|none)
4958                         case "$d_suidsafe" in
4959                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4960                                 dflt=n;;
4961                         "$undef")
4962                                 echo "Well, the $hint value is *not* secure." >&4
4963                                 dflt=n;;
4964                         *)      echo "Well, the $hint value *is* secure." >&4
4965                                 dflt=y;;
4966                         esac
4967                         ;;
4968                 *)
4969                         $rm -f reflect flect
4970                         echo "#!$ls" >reflect
4971                         chmod +x,u+s reflect
4972                         echo >flect
4973                         chmod a+w flect
4974                         echo '"su" will (probably) prompt you for '"$ans's password."
4975                         su $ans -c './reflect >flect'
4976                         if $contains "/dev/fd" flect >/dev/null; then
4977                                 echo "Okay, it looks like setuid scripts are secure." >&4
4978                                 dflt=y
4979                         else
4980                                 echo "I don't think setuid scripts are secure." >&4
4981                                 dflt=n
4982                         fi
4983                         ;;
4984                 esac
4985                 rp='Does your kernel have *secure* setuid scripts?'
4986                 . ./myread
4987                 case "$ans" in
4988                 [yY]*)  val="$define";;
4989                 *)      val="$undef";;
4990                 esac
4991         fi
4992 else
4993         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4994         echo "(That's for file descriptors, not floppy disks.)"
4995         val="$undef"
4996 fi
4997 set d_suidsafe
4998 eval $setvar
4999
5000 $rm -f reflect flect
5001
5002 : now see if they want to do setuid emulation
5003 echo " "
5004 val="$undef"
5005 case "$d_suidsafe" in
5006 "$define")
5007         val="$undef"
5008         echo "No need to emulate SUID scripts since they are secure here." >& 4
5009         ;;
5010 *)
5011         $cat <<EOM
5012 Some systems have disabled setuid scripts, especially systems where
5013 setuid scripts cannot be secure.  On systems where setuid scripts have
5014 been disabled, the setuid/setgid bits on scripts are currently
5015 useless.  It is possible for $package to detect those bits and emulate
5016 setuid/setgid in a secure fashion.  This emulation will only work if
5017 setuid scripts have been disabled in your kernel.
5018
5019 EOM
5020         case "$d_dosuid" in
5021         "$define") dflt=y ;;
5022         *) dflt=n ;;
5023         esac
5024         rp="Do you want to do setuid/setgid emulation?"
5025         . ./myread
5026         case "$ans" in
5027         [yY]*)  val="$define";;
5028         *)      val="$undef";;
5029         esac
5030         ;;
5031 esac
5032 set d_dosuid
5033 eval $setvar
5034
5035 : determine filename position in cpp output
5036 echo " "
5037 echo "Computing filename position in cpp output for #include directives..." >&4
5038 echo '#include <stdio.h>' > foo.c
5039 $cat >fieldn <<EOF
5040 $startsh
5041 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5042 $grep '^[       ]*#.*stdio\.h' | \
5043 while read cline; do
5044         pos=1
5045         set \$cline
5046         while $test \$# -gt 0; do
5047                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5048                         echo "\$pos"
5049                         exit 0
5050                 fi
5051                 shift
5052                 pos=\`expr \$pos + 1\`
5053         done
5054 done
5055 EOF
5056 chmod +x fieldn
5057 fieldn=`./fieldn`
5058 $rm -f foo.c fieldn
5059 case $fieldn in
5060 '') pos='???';;
5061 1) pos=first;;
5062 2) pos=second;;
5063 3) pos=third;;
5064 *) pos="${fieldn}th";;
5065 esac
5066 echo "Your cpp writes the filename in the $pos field of the line."
5067
5068 : locate header file
5069 $cat >findhdr <<EOF
5070 $startsh
5071 wanted=\$1
5072 name=''
5073 for usrincdir in $usrinc
5074 do
5075         if test -f \$usrincdir/\$wanted; then
5076                 echo "\$usrincdir/\$wanted"
5077                 exit 0
5078         fi
5079 done
5080 awkprg='{ print \$$fieldn }'
5081 echo "#include <\$wanted>" > foo\$\$.c
5082 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5083 $grep "^[       ]*#.*\$wanted" | \
5084 while read cline; do
5085         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5086         case "\$name" in
5087         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5088         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5089         *) exit 2;;
5090         esac;
5091 done;
5092 #
5093 # status = 0: grep returned 0 lines, case statement not executed
5094 # status = 1: headerfile found
5095 # status = 2: while loop executed, no headerfile found
5096 #
5097 status=\$?
5098 $rm -f foo\$\$.c;
5099 if test \$status -eq 1; then
5100         exit 0;
5101 fi
5102 exit 1
5103 EOF
5104 chmod +x findhdr
5105
5106 : define an alternate in-header-list? function
5107 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5108 cont=true; xxf="echo \"<\$1> found.\" >&4";
5109 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5110 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5111 esac;
5112 case $# in 4) instead=instead;; *) instead="at last";; esac;
5113 while $test "$cont"; do
5114         xxx=`./findhdr $1`
5115         var=$2; eval "was=\$$2";
5116         if $test "$xxx" && $test -r "$xxx";
5117         then eval $xxf;
5118         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5119                 cont="";
5120         else eval $xxnf;
5121         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5122         set $yyy; shift; shift; yyy=$@;
5123         case $# in 0) cont="";;
5124         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5125                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5126         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5127                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5128         esac;
5129 done;
5130 while $test "$yyy";
5131 do set $yyy; var=$2; eval "was=\$$2";
5132         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5133         set $yyy; shift; shift; yyy=$@;
5134 done'
5135
5136 : see if this is a malloc.h system
5137 set malloc.h i_malloc
5138 eval $inhdr
5139
5140 : see if stdlib is available
5141 set stdlib.h i_stdlib
5142 eval $inhdr
5143
5144 : determine which malloc to compile in
5145 echo " "
5146 case "$usemymalloc" in
5147 ''|[yY]*|true|$define)  dflt='y' ;;
5148 *)      dflt='n' ;;
5149 esac
5150 rp="Do you wish to attempt to use the malloc that comes with $package?"
5151 . ./myread
5152 usemymalloc="$ans"
5153 case "$ans" in
5154 y*|true)
5155         usemymalloc='y'
5156         mallocsrc='malloc.c'
5157         mallocobj="malloc$_o"
5158         d_mymalloc="$define"
5159         case "$libs" in
5160         *-lmalloc*)
5161                 : Remove malloc from list of libraries to use
5162                 echo "Removing unneeded -lmalloc from library list" >&4
5163                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5164                 shift
5165                 libs="$*"
5166                 echo "libs = $libs" >&4
5167                 ;;
5168         esac
5169         ;;
5170 *)
5171         usemymalloc='n'
5172         mallocsrc=''
5173         mallocobj=''
5174         d_mymalloc="$undef"
5175         ;;
5176 esac
5177
5178 : compute the return types of malloc and free
5179 echo " "
5180 $cat >malloc.c <<END
5181 #$i_malloc I_MALLOC
5182 #$i_stdlib I_STDLIB
5183 #include <stdio.h>
5184 #include <sys/types.h>
5185 #ifdef I_MALLOC
5186 #include <malloc.h>
5187 #endif
5188 #ifdef I_STDLIB
5189 #include <stdlib.h>
5190 #endif
5191 #ifdef TRY_MALLOC
5192 void *malloc();
5193 #endif
5194 #ifdef TRY_FREE
5195 void free();
5196 #endif
5197 END
5198 case "$malloctype" in
5199 '')
5200         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5201                 malloctype='void *'
5202         else
5203                 malloctype='char *'
5204         fi
5205         ;;
5206 esac
5207 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5208
5209 case "$freetype" in
5210 '')
5211         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5212                 freetype='void'
5213         else
5214                 freetype='int'
5215         fi
5216         ;;
5217 esac
5218 echo "Your system uses $freetype free(), it would seem." >&4
5219 $rm -f malloc.[co]
5220 $cat <<EOM
5221
5222 The installation process will also create a directory for
5223 vendor-supplied add-ons.  Vendors who supply perl with their system
5224 may find it convenient to place all vendor-supplied files in this
5225 directory rather than in the main distribution directory.  This will
5226 ease upgrades between binary-compatible maintenance versions of perl.
5227
5228 Of course you may also use these directories in whatever way you see
5229 fit.  For example, you might use them to access modules shared over a
5230 company-wide network.
5231
5232 The default answer should be fine for most people.
5233 This causes further questions about vendor add-ons to be skipped
5234 and no vendor-specific directories will be configured for perl.
5235
5236 EOM
5237 rp='Do you want to configure vendor-specific add-on directories?'
5238 case "$usevendorprefix" in
5239 define|true|[yY]*) dflt=y ;;
5240 *)      : User may have set vendorprefix directly on Configure command line.
5241         case "$vendorprefix" in
5242         ''|' ') dflt=n ;;
5243         *)      dflt=y ;;
5244         esac
5245         ;;
5246 esac
5247 . ./myread
5248 case "$ans" in
5249 [yY]*)  fn=d~+
5250         rp='Installation prefix to use for vendor-supplied add-ons?'
5251         case "$vendorprefix" in
5252         '') dflt='' ;;
5253         *)  dflt=$vendorprefix ;;
5254         esac
5255         . ./getfile
5256         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5257         oldvendorprefix=''
5258         case "$vendorprefix" in
5259         '') ;;
5260         *)      case "$ans" in
5261                 "$prefix") ;;
5262                 *) oldvendorprefix="$prefix";;
5263                 esac
5264                 ;;
5265         esac
5266         usevendorprefix="$define"
5267         vendorprefix="$ans"
5268         vendorprefixexp="$ansexp"
5269         ;;
5270 *)      usevendorprefix="$undef"
5271         vendorprefix=''
5272         vendorprefixexp=''
5273         ;;
5274 esac
5275
5276 case "$vendorprefix" in
5277 '')     d_vendorlib="$undef"
5278         vendorlib=''
5279         vendorlibexp=''
5280         ;;
5281 *)      d_vendorlib="$define"
5282         : determine where vendor-supplied modules go.
5283         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5284         case "$vendorlib" in
5285         '')
5286                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5287                 case "$installstyle" in
5288                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5289                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5290                 esac
5291                 ;;
5292         *)      dflt="$vendorlib"
5293                 ;;
5294         esac
5295         fn=d~+
5296         rp='Pathname for the vendor-supplied library files?'
5297         . ./getfile
5298         vendorlib="$ans"
5299         vendorlibexp="$ansexp"
5300         ;;
5301 esac
5302 : Change installation prefix, if necessary.
5303 if $test X"$prefix" != X"$installprefix"; then
5304         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5305 else
5306         installvendorlib="$vendorlibexp"
5307 fi
5308
5309 : Cruising for prototypes
5310 echo " "
5311 echo "Checking out function prototypes..." >&4
5312 $cat >prototype.c <<'EOCP'
5313 int main(int argc, char *argv[]) {
5314         exit(0);}
5315 EOCP
5316 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5317         echo "Your C compiler appears to support function prototypes."
5318         val="$define"
5319 else
5320         echo "Your C compiler doesn't seem to understand function prototypes."
5321         val="$undef"
5322 fi
5323 set prototype
5324 eval $setvar
5325 $rm -f prototype*
5326
5327 case "$prototype" in
5328 "$define") ;;
5329 *)      ansi2knr='ansi2knr'
5330         echo " "
5331         cat <<EOM >&4
5332
5333 $me:  FATAL ERROR:
5334 This version of $package can only be compiled by a compiler that 
5335 understands function prototypes.  Unfortunately, your C compiler 
5336         $cc $ccflags
5337 doesn't seem to understand them.  Sorry about that.
5338
5339 If GNU cc is available for your system, perhaps you could try that instead.  
5340
5341 Eventually, we hope to support building Perl with pre-ANSI compilers.
5342 If you would like to help in that effort, please contact <perlbug@perl.org>.
5343
5344 Aborting Configure now.
5345 EOM
5346         exit 2
5347         ;;
5348 esac
5349
5350 : determine where public executables go
5351 echo " "
5352 set dflt bin bin
5353 eval $prefixit
5354 fn=d~
5355 rp='Pathname where the public executables will reside?'
5356 . ./getfile
5357 if $test "X$ansexp" != "X$binexp"; then
5358         installbin=''
5359 fi
5360 bin="$ans"
5361 binexp="$ansexp"
5362 : Change installation prefix, if necessary.
5363 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5364 if $test X"$prefix" != X"$installprefix"; then
5365         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5366 else
5367         installbin="$binexp"
5368 fi
5369
5370 : Find perl5.005 or later.
5371 echo "Looking for a previously installed perl5.005 or later... "
5372 case "$perl5" in
5373 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5374                 : Check if this perl is recent and can load a simple module
5375                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5376                         perl5=$tdir/perl
5377                         break;
5378                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5379                         perl5=$tdir/perl
5380                         break;
5381                 fi
5382         done
5383         ;;
5384 *)      perl5="$perl5"
5385         ;;
5386 esac
5387 case "$perl5" in
5388 '')     echo "None found.  That's ok.";;
5389 *)      echo "Using $perl5." ;;
5390 esac
5391
5392 $cat <<EOM
5393
5394 After $package is installed, you may wish to install various
5395 add-on modules and utilities.  Typically, these add-ons will
5396 be installed under $prefix with the rest
5397 of this package.  However, you may wish to install such add-ons
5398 elsewhere under a different prefix.
5399
5400 If you do not wish to put everything under a single prefix, that's
5401 ok.  You will be prompted for the individual locations; this siteprefix
5402 is only used to suggest the defaults.
5403
5404 The default should be fine for most people.
5405
5406 EOM
5407 fn=d~+
5408 rp='Installation prefix to use for add-on modules and utilities?'
5409 : XXX Here might be another good place for an installstyle setting.
5410 case "$siteprefix" in
5411 '') dflt=$prefix ;;
5412 *)  dflt=$siteprefix ;;
5413 esac
5414 . ./getfile
5415 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5416 oldsiteprefix=''
5417 case "$siteprefix" in
5418 '') ;;
5419 *)      case "$ans" in
5420         "$prefix") ;;
5421         *) oldsiteprefix="$prefix";;
5422         esac
5423         ;;
5424 esac
5425 siteprefix="$ans"
5426 siteprefixexp="$ansexp"
5427
5428 : determine where site specific libraries go.
5429 : Usual default is /usr/local/lib/perl5/site_perl/$version
5430 : The default "style" setting is made in installstyle.U
5431 : XXX No longer works with Prefixit stuff.
5432 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5433 case "$sitelib" in
5434 '') case "$installstyle" in
5435         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5436         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5437         esac
5438         ;;
5439 *)      dflt="$sitelib"
5440         ;;
5441 esac
5442 $cat <<EOM
5443
5444 The installation process will create a directory for
5445 site-specific extensions and modules.  Most users find it convenient
5446 to place all site-specific files in this directory rather than in the
5447 main distribution directory.
5448
5449 EOM
5450 fn=d~+
5451 rp='Pathname for the site-specific library files?'
5452 . ./getfile
5453 sitelib="$ans"
5454 sitelibexp="$ansexp"
5455 : Change installation prefix, if necessary.
5456 if $test X"$prefix" != X"$installprefix"; then
5457         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5458 else
5459         installsitelib="$sitelibexp"
5460 fi
5461
5462 : Determine list of previous versions to include in @INC
5463 $cat > getverlist <<EOPL
5464 #!$perl5 -w
5465 use File::Basename;
5466 \$api_versionstring = "$api_versionstring";
5467 \$version = "$version";
5468 \$sitelib = "$sitelib";
5469 \$archname = "$archname";
5470 EOPL
5471         $cat >> getverlist <<'EOPL'
5472 # Can't have leading @ because metaconfig interprets it as a command!
5473 ;@inc_version_list=();
5474 $stem=dirname($sitelib);
5475 # XXX Redo to do opendir/readdir? 
5476 if (-d $stem) {
5477     chdir($stem);
5478     ;@candidates = glob("5.*");
5479 }
5480 else {
5481     ;@candidates = ();
5482 }
5483
5484 # XXX ToDo:  These comparisons must be reworked when two-digit
5485 # subversions come along, so that 5.7.10 compares as greater than
5486 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5487 # widespread that we can use the built-in version vectors rather
5488 # than reinventing them here.  For 5.6.0, however, we must
5489 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5490 foreach $d (@candidates) {
5491     if ($d lt $version) {
5492         if ($d ge $api_versionstring) {
5493             unshift(@inc_version_list, "$d/$archname", $d);
5494         }
5495         elsif ($d ge "5.005") {
5496             unshift(@inc_version_list, $d);
5497         }
5498     }
5499     else {
5500         # Skip newer version.  I.e. don't look in
5501         # 5.7.0 if we're installing 5.6.1.
5502     }
5503 }
5504
5505 if (@inc_version_list) {
5506     print join(' ', @inc_version_list);
5507 }
5508 else {
5509     # Blank space to preserve value for next Configure run.
5510     print " ";
5511 }
5512 EOPL
5513 chmod +x getverlist
5514 case "$inc_version_list" in
5515 '')     if test -x "$perl5"; then
5516                 dflt=`$perl5 getverlist`
5517         else
5518                 dflt='none'
5519         fi
5520         ;;
5521 $undef) dflt='none' ;;
5522 *)  dflt="$inc_version_list" ;;
5523 esac
5524 case "$dflt" in
5525 ''|' ') dflt=none ;;
5526 esac
5527 $cat <<'EOM'
5528
5529 In order to ease the process of upgrading, this version of perl 
5530 can be configured to use modules built and installed with earlier 
5531 versions of perl that were installed under $prefix.  Specify here
5532 the list of earlier versions that this version of perl should check.
5533 If Configure detected no earlier versions of perl installed under
5534 $prefix, then the list will be empty.  Answer 'none' to tell perl
5535 to not search earlier versions.
5536
5537 The default should almost always be sensible, so if you're not sure,
5538 just accept the default.
5539 EOM
5540
5541 rp='List of earlier versions to include in @INC?'
5542 . ./myread
5543 case "$ans" in
5544 [Nn]one|''|' ') inc_version_list=' ' ;;
5545 *) inc_version_list="$ans" ;;
5546 esac
5547 case "$inc_version_list" in
5548 ''|' ') 
5549         inc_version_list_init='0';;
5550 *)      inc_version_list_init=`echo $inc_version_list |
5551                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5552         ;;
5553 esac
5554 $rm -f getverlist
5555
5556 : determine whether to install perl also as /usr/bin/perl
5557
5558 echo " "
5559 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5560         $cat <<EOM
5561 Many scripts expect to perl to be installed as /usr/bin/perl.
5562 I can install the perl you are about to compile also as /usr/bin/perl
5563 (in addition to $installbin/perl).
5564 EOM
5565         case "$installusrbinperl" in
5566         "$undef"|[nN]*) dflt='n';;
5567         *)              dflt='y';;
5568         esac
5569         rp="Do you want to install perl as /usr/bin/perl?"
5570         . ./myread
5571         case "$ans" in
5572         [yY]*)  val="$define";;
5573         *)      val="$undef" ;;
5574         esac
5575 else
5576         val="$undef"
5577 fi
5578 set installusrbinperl
5579 eval $setvar
5580
5581 echo " "
5582 echo "Checking for GNU C Library..." >&4
5583 cat >gnulibc.c <<EOM
5584 #include <stdio.h>
5585 int main()
5586 {
5587 #ifdef __GLIBC__
5588     exit(0);
5589 #else
5590     exit(1);
5591 #endif
5592 }
5593 EOM
5594 set gnulibc
5595 if eval $compile_ok && ./gnulibc; then
5596         val="$define"
5597         echo "You are using the GNU C Library"
5598 else
5599         val="$undef"
5600         echo "You are not using the GNU C Library"
5601 fi
5602 $rm -f gnulibc*
5603 set d_gnulibc
5604 eval $setvar
5605
5606 : see if nm is to be used to determine whether a symbol is defined or not
5607 case "$usenm" in
5608 '')
5609         dflt=''
5610         case "$d_gnulibc" in
5611         "$define")
5612                 echo " "
5613                 echo "nm probably won't work on the GNU C Library." >&4
5614                 dflt=n
5615                 ;;
5616         esac
5617         case "$dflt" in
5618         '') 
5619                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5620                         echo " "
5621                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5622                         echo "'nm' won't be sufficient on this sytem." >&4
5623                         dflt=n
5624                 fi
5625                 ;;
5626         esac
5627         case "$dflt" in
5628         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5629                 if $test $dflt -gt 20; then
5630                         dflt=y
5631                 else
5632                         dflt=n
5633                 fi
5634                 ;;
5635         esac
5636         ;;
5637 *)
5638         case "$usenm" in
5639         true|$define) dflt=y;;
5640         *) dflt=n;;
5641         esac
5642         ;;
5643 esac
5644 $cat <<EOM
5645
5646 I can use $nm to extract the symbols from your C libraries. This
5647 is a time consuming task which may generate huge output on the disk (up
5648 to 3 megabytes) but that should make the symbols extraction faster. The
5649 alternative is to skip the 'nm' extraction part and to compile a small
5650 test program instead to determine whether each symbol is present. If
5651 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5652 this may be the best solution.
5653
5654 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5655
5656 EOM
5657 rp="Shall I use $nm to extract C symbols from the libraries?"
5658 . ./myread
5659 case "$ans" in
5660 [Nn]*) usenm=false;;
5661 *) usenm=true;;
5662 esac
5663
5664 runnm=$usenm
5665 case "$reuseval" in
5666 true) runnm=false;;
5667 esac
5668
5669 : nm options which may be necessary
5670 case "$nm_opt" in
5671 '') if $test -f /mach_boot; then
5672                 nm_opt=''       # Mach
5673         elif $test -d /usr/ccs/lib; then
5674                 nm_opt='-p'     # Solaris (and SunOS?)
5675         elif $test -f /dgux; then
5676                 nm_opt='-p'     # DG-UX
5677         elif $test -f /lib64/rld; then
5678                 nm_opt='-p'     # 64-bit Irix
5679         else
5680                 nm_opt=''
5681         fi;;
5682 esac
5683
5684 : nm options which may be necessary for shared libraries but illegal
5685 : for archive libraries.  Thank you, Linux.
5686 case "$nm_so_opt" in
5687 '')     case "$myuname" in
5688         *linux*)
5689                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5690                         nm_so_opt='--dynamic'
5691                 fi
5692                 ;;
5693         esac
5694         ;;
5695 esac
5696
5697 case "$runnm" in
5698 true)
5699 : get list of predefined functions in a handy place
5700 echo " "
5701 case "$libc" in
5702 '') libc=unknown
5703         case "$libs" in
5704         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5705         esac
5706         ;;
5707 esac
5708 libnames='';
5709 case "$libs" in
5710 '') ;;
5711 *)  for thislib in $libs; do
5712         case "$thislib" in
5713         -lc|-lc_s)
5714                 : Handle C library specially below.
5715                 ;;
5716         -l*)
5717                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5718                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5719                         :
5720                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5721                         :
5722                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5723                         :
5724                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5725                         :
5726                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5727                         :
5728                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5729                         :
5730                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5731                         :
5732                 else
5733                         try=''
5734                 fi
5735                 libnames="$libnames $try"
5736                 ;;
5737         *) libnames="$libnames $thislib" ;;
5738         esac
5739         done
5740         ;;
5741 esac
5742 xxx=normal
5743 case "$libc" in
5744 unknown)
5745         set /lib/libc.$so
5746         for xxx in $libpth; do
5747                 $test -r $1 || set $xxx/libc.$so
5748                 : The messy sed command sorts on library version numbers.
5749                 $test -r $1 || \
5750                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5751                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5752                                 h
5753                                 s/[0-9][0-9]*/0000&/g
5754                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5755                                 G
5756                                 s/\n/ /' | \
5757                          sort | $sed -e 's/^.* //'`
5758                 eval set \$$#
5759         done
5760         $test -r $1 || set /usr/ccs/lib/libc.$so
5761         $test -r $1 || set /lib/libsys_s$_a
5762         ;;
5763 *)
5764         set blurfl
5765         ;;
5766 esac
5767 if $test -r "$1"; then
5768         echo "Your (shared) C library seems to be in $1."
5769         libc="$1"
5770 elif $test -r /lib/libc && $test -r /lib/clib; then
5771         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5772         xxx=apollo
5773         libc='/lib/clib /lib/libc'
5774         if $test -r /lib/syslib; then
5775                 echo "(Your math library is in /lib/syslib.)"
5776                 libc="$libc /lib/syslib"
5777         fi
5778 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5779         echo "Your C library seems to be in $libc, as you said before."
5780 elif $test -r $incpath/usr/lib/libc$_a; then
5781         libc=$incpath/usr/lib/libc$_a;
5782         echo "Your C library seems to be in $libc.  That's fine."
5783 elif $test -r /lib/libc$_a; then
5784         libc=/lib/libc$_a;
5785         echo "Your C library seems to be in $libc.  You're normal."
5786 else
5787         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5788                 :
5789         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5790                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5791         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5792                 :
5793         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5794                 :
5795         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5796                 :
5797         else
5798                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5799         fi
5800         if $test -r "$tans"; then
5801                 echo "Your C library seems to be in $tans, of all places."
5802                 libc=$tans
5803         else
5804                 libc='blurfl'
5805         fi
5806 fi
5807 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5808         dflt="$libc"
5809         cat <<EOM
5810
5811 If the guess above is wrong (which it might be if you're using a strange
5812 compiler, or your machine supports multiple models), you can override it here.
5813
5814 EOM
5815 else
5816         dflt=''
5817         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5818         cat >&4 <<EOM
5819 I can't seem to find your C library.  I've looked in the following places:
5820
5821 EOM
5822         $sed 's/^/      /' libpath
5823         cat <<EOM
5824
5825 None of these seems to contain your C library. I need to get its name...
5826
5827 EOM
5828 fi
5829 fn=f
5830 rp='Where is your C library?'
5831 . ./getfile
5832 libc="$ans"
5833
5834 echo " "
5835 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5836 set X `cat libnames`
5837 shift
5838 xxx=files
5839 case $# in 1) xxx=file; esac
5840 echo "Extracting names from the following $xxx for later perusal:" >&4
5841 echo " "
5842 $sed 's/^/      /' libnames >&4
5843 echo " "
5844 $echo $n "This may take a while...$c" >&4
5845
5846 for file in $*; do
5847         case $file in
5848         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5849         *) $nm $nm_opt $file 2>/dev/null;;
5850         esac
5851 done >libc.tmp
5852
5853 $echo $n ".$c"
5854 $grep fprintf libc.tmp > libc.ptf
5855 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5856 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5857 xxx='[ADTSIW]'
5858 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5859         eval $xscan;\
5860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5861                 eval $xrun
5862 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5863         eval $xscan;\
5864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5865                 eval $xrun
5866 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5867         eval $xscan;\
5868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5869                 eval $xrun
5870 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5871         eval $xscan;\
5872         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5873                 eval $xrun
5874 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5875         eval $xscan;\
5876         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5877                 eval $xrun
5878 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5879         eval $xscan;\
5880         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5881                 eval $xrun
5882 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5883                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5884         eval $xscan;\
5885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5886                 eval $xrun
5887 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5888         eval $xscan;\
5889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5890                 eval $xrun
5891 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5892         eval $xscan;\
5893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5894                 eval $xrun
5895 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5896         eval $xscan;\
5897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5898                 eval $xrun
5899 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5900         eval $xscan;\
5901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5902                 eval $xrun
5903 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5904         eval $xscan;\
5905         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5906                 eval $xrun
5907 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5908         eval $xscan;\
5909         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5910                 eval $xrun
5911 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5912         eval $xscan;\
5913         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5914                 eval $xrun
5915 else
5916         $nm -p $* 2>/dev/null >libc.tmp
5917         $grep fprintf libc.tmp > libc.ptf
5918         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5919                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5920         then
5921                 nm_opt='-p'
5922                 eval $xrun
5923         else
5924                 echo " "
5925                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5926                 com=''
5927                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5928                         for thisname in $libnames $libc; do
5929                                 $ar t $thisname >>libc.tmp
5930                         done
5931                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5932                         echo "Ok." >&4
5933                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5934                         # Repeat libc to extract forwarders to DLL entries too
5935                         for thisname in $libnames $libc; do
5936                                 $ar tv $thisname >>libc.tmp
5937                                 # Revision 50 of EMX has bug in $ar.
5938                                 # it will not extract forwarders to DLL entries
5939                                 # Use emximp which will extract exactly them.
5940                                 emximp -o tmp.imp $thisname \
5941                                     2>/dev/null && \
5942                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5943                                     < tmp.imp >>libc.tmp
5944                                 $rm tmp.imp
5945                         done
5946                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5947                         echo "Ok." >&4
5948                 else
5949                         echo "$ar didn't seem to work right." >&4
5950                         echo "Maybe this is a Cray...trying bld instead..." >&4
5951                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5952                         then
5953                                 for thisname in $libnames; do
5954                                         bld t $libnames | \
5955                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5956                                         $ar t $thisname >>libc.tmp
5957                                 done
5958                                 echo "Ok." >&4
5959                         else
5960                                 echo "That didn't work either.  Giving up." >&4
5961                                 exit 1
5962                         fi
5963                 fi
5964         fi
5965 fi
5966 nm_extract="$com"
5967 if $test -f /lib/syscalls.exp; then
5968         echo " "
5969         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5970         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5971 fi
5972 ;;
5973 esac
5974 $rm -f libnames libpath
5975
5976 : see if dld is available
5977 set dld.h i_dld
5978 eval $inhdr
5979
5980 : is a C symbol defined?
5981 csym='tlook=$1;
5982 case "$3" in
5983 -v) tf=libc.tmp; tc=""; tdc="";;
5984 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5985 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5986 esac;
5987 tx=yes;
5988 case "$reuseval-$4" in
5989 true-) ;;
5990 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5991 esac;
5992 case "$tx" in
5993 yes)
5994         case "$runnm" in
5995         true)
5996                 if $contains $tlook $tf >/dev/null 2>&1;
5997                 then tval=true;
5998                 else tval=false;
5999                 fi;;
6000         *)
6001                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6002                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6003                 then tval=true;
6004                 else tval=false;
6005                 fi;
6006                 $rm -f t t.c;;
6007         esac;;
6008 *)
6009         case "$tval" in
6010         $define) tval=true;;
6011         *) tval=false;;
6012         esac;;
6013 esac;
6014 eval "$2=$tval"'
6015
6016 : define an is-in-libc? function
6017 inlibc='echo " "; td=$define; tu=$undef;
6018 sym=$1; var=$2; eval "was=\$$2";
6019 tx=yes;
6020 case "$reuseval$was" in
6021 true) ;;
6022 true*) tx=no;;
6023 esac;
6024 case "$tx" in
6025 yes)
6026         set $sym tres -f;
6027         eval $csym;
6028         case "$tres" in
6029         true)
6030                 echo "$sym() found." >&4;
6031                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6032         *)
6033                 echo "$sym() NOT found." >&4;
6034                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6035         esac;;
6036 *)
6037         case "$was" in
6038         $define) echo "$sym() found." >&4;;
6039         *) echo "$sym() NOT found." >&4;;
6040         esac;;
6041 esac'
6042
6043 : see if dlopen exists
6044 xxx_runnm="$runnm"
6045 runnm=false
6046 set dlopen d_dlopen
6047 eval $inlibc
6048 runnm="$xxx_runnm"
6049
6050 : determine which dynamic loading, if any, to compile in
6051 echo " "
6052 dldir="ext/DynaLoader"
6053 case "$usedl" in
6054 $define|y|true)
6055         dflt='y'
6056         usedl="$define"
6057         ;;
6058 $undef|n|false)
6059         dflt='n'
6060         usedl="$undef"
6061         ;;
6062 *) 
6063         dflt='n'
6064         case "$d_dlopen" in
6065             $define) dflt='y' ;;
6066         esac
6067         case "$i_dld" in
6068             $define) dflt='y' ;;
6069         esac
6070         : Does a dl_xxx.xs file exist for this operating system
6071         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6072         ;;
6073 esac
6074 rp="Do you wish to use dynamic loading?"
6075 . ./myread
6076 usedl="$ans"
6077 case "$ans" in
6078 y*) usedl="$define"
6079         case "$dlsrc" in
6080         '')
6081                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6082                         dflt="$dldir/dl_${osname}.xs"
6083                 elif $test "$d_dlopen" = "$define" ; then
6084                         dflt="$dldir/dl_dlopen.xs"
6085                 elif $test "$i_dld" = "$define" ; then
6086                         dflt="$dldir/dl_dld.xs"
6087                 else
6088                         dflt=''
6089                 fi
6090                 ;;
6091         *)      dflt="$dldir/$dlsrc"
6092                 ;;
6093         esac
6094     echo "The following dynamic loading files are available:"
6095         : Can not go over to $dldir because getfile has path hard-coded in.
6096         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6097         rp="Source file to use for dynamic loading"
6098         fn="fne"
6099         gfpth="$src"
6100         . ./getfile
6101         usedl="$define"
6102         : emulate basename
6103         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6104
6105         $cat << EOM
6106
6107 Some systems may require passing special flags to $cc -c to
6108 compile modules that will be used to create a shared library.
6109 To use no flags, say "none".
6110
6111 EOM
6112     case "$cccdlflags" in
6113     '') case "$gccversion" in
6114                 '') case "$osname" in
6115                         hpux)   dflt='+z' ;;
6116                         next)   dflt='none' ;;
6117                         irix*)  dflt='-KPIC' ;;
6118                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6119                         sunos)  dflt='-pic' ;;
6120                         *)      dflt='none' ;;
6121                     esac
6122                         ;;
6123                 *)  case "$osname" in
6124                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6125                         *)      dflt='-fpic' ;;
6126                     esac ;;
6127             esac ;;
6128         ' ') dflt='none' ;;
6129     *)  dflt="$cccdlflags" ;;
6130     esac
6131     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6132     . ./myread
6133     case "$ans" in
6134     none) cccdlflags=' ' ;;
6135     *) cccdlflags="$ans" ;;
6136     esac
6137
6138     cat << EOM
6139
6140 Some systems use ld to create libraries that can be dynamically loaded,
6141 while other systems (such as those using ELF) use $cc.
6142
6143 EOM
6144         case "$ld" in
6145         '')     $cat >try.c <<'EOM'
6146 /* Test for whether ELF binaries are produced */
6147 #include <fcntl.h>
6148 #include <stdlib.h>
6149 int main() {
6150         char b[4];
6151         int i = open("a.out",O_RDONLY);
6152         if(i == -1) 
6153                 exit(1); /* fail */
6154         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6155                 exit(0); /* succeed (yes, it's ELF) */
6156         else
6157                 exit(1); /* fail */
6158 }
6159 EOM
6160                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6161                         cat <<EOM
6162 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6163 EOM
6164                         dflt="$cc"
6165                 else
6166                         echo "I'll use ld to build dynamic libraries."
6167                         dflt='ld'
6168                 fi
6169                 rm -f try.c a.out
6170                 ;;
6171         *)      dflt="$ld"
6172                 ;;
6173         esac
6174
6175     rp="What command should be used to create dynamic libraries?"
6176     . ./myread
6177         ld="$ans"
6178
6179     cat << EOM
6180
6181 Some systems may require passing special flags to $ld to create a
6182 library that can be dynamically loaded.  If your ld flags include
6183 -L/other/path options to locate libraries outside your loader's normal
6184 search path, you may need to specify those -L options here as well.  To
6185 use no flags, say "none".
6186
6187 EOM
6188     case "$lddlflags" in
6189     '') case "$osname" in
6190                         beos) dflt='-nostart' ;;
6191                         hpux) dflt='-b';
6192                               case "$gccversion" in
6193                               '') dflt="$dflt +vnocompatwarnings" ;;
6194                               esac
6195                               ;;        
6196                         linux|irix*)    dflt='-shared' ;;
6197                         next)  dflt='none' ;;
6198                         solaris) dflt='-G' ;;
6199                         sunos) dflt='-assert nodefinitions' ;;
6200                         svr4*|esix*) dflt="-G $ldflags" ;;
6201                 *)     dflt='none' ;;
6202                         esac
6203                         ;;
6204     *) dflt="$lddlflags" ;;
6205     esac
6206
6207         : Try to guess additional flags to pick up local libraries.
6208         : Be careful not to append to a plain 'none'
6209         case "$dflt" in
6210         none) dflt='' ;;
6211         esac
6212         for thisflag in $ldflags; do
6213                 case "$thisflag" in
6214                 -L*)
6215                         case " $dflt " in
6216                         *" $thisflag "*) ;;
6217                         *) dflt="$dflt $thisflag" ;;
6218                         esac
6219                         ;;
6220                 esac
6221         done
6222
6223         case "$dflt" in
6224         ''|' ') dflt='none' ;;
6225         esac
6226
6227     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6228     . ./myread
6229     case "$ans" in
6230     none) lddlflags=' ' ;;
6231     *) lddlflags="$ans" ;;
6232     esac
6233
6234         cat <<EOM
6235
6236 Some systems may require passing special flags to $cc to indicate that
6237 the resulting executable will use dynamic linking.  To use no flags,
6238 say "none".
6239
6240 EOM
6241     case "$ccdlflags" in
6242     '') case "$osname" in
6243                 hpux)   dflt='-Wl,-E' ;;
6244                 linux)  dflt='-rdynamic' ;;
6245                 next)   dflt='none' ;;
6246                 sunos)  dflt='none' ;;
6247                 *)      dflt='none' ;;
6248             esac ;;
6249     ' ')  dflt='none' ;;
6250     *)  dflt="$ccdlflags" ;;
6251     esac
6252     rp="Any special flags to pass to $cc to use dynamic linking?"
6253     . ./myread
6254     case "$ans" in
6255     none) ccdlflags=' ' ;;
6256     *) ccdlflags="$ans" ;;
6257     esac
6258     ;;
6259 *)  usedl="$undef"
6260         ld='ld'
6261     dlsrc='dl_none.xs'
6262     lddlflags=''
6263     ccdlflags=''
6264     ;;
6265 esac
6266
6267 also=''
6268 case "$usedl" in
6269 $undef)
6270         # No dynamic loading being used, so don't bother even to prompt.
6271         useshrplib='false'
6272         ;;
6273 *)      case "$useshrplib" in
6274         '')     case "$osname" in
6275                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6276                         dflt=y
6277                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6278                         ;;
6279                 next*)
6280                         case "$osvers" in
6281                         4*)     dflt=y
6282                                 also='Building a shared libperl is needed for MAB support.'
6283                                 ;;
6284                         *)      dflt=n
6285                                 ;;
6286                         esac
6287                         ;;
6288                 *)      dflt=n
6289                         ;;
6290                 esac
6291                 ;;
6292         $define|true|[Yy]*)
6293                 dflt=y
6294                 ;;
6295         *)      dflt=n
6296                 ;;
6297         esac
6298         $cat << EOM
6299
6300 The perl executable is normally obtained by linking perlmain.c with
6301 libperl${_a}, any static extensions (usually just DynaLoader), and
6302 any other libraries needed on this system (such as -lm, etc.).  Since
6303 your system supports dynamic loading, it is probably possible to build
6304 a shared libperl.$so.  If you will have more than one executable linked
6305 to libperl.$so, this will significantly reduce the size of each
6306 executable, but it may have a noticeable affect on performance.  The
6307 default is probably sensible for your system.
6308 $also
6309
6310 EOM
6311         rp="Build a shared libperl.$so (y/n)"
6312         . ./myread
6313         case "$ans" in
6314         true|$define|[Yy]*)
6315                 useshrplib='true'  ;;
6316         *)      useshrplib='false' ;;
6317         esac
6318         ;;
6319 esac
6320
6321 case "$useshrplib" in
6322 true)
6323         case "$libperl" in
6324         '')
6325                 # Figure out a good name for libperl.so.  Since it gets stored in
6326                 # a version-specific architecture-dependent library, the version
6327                 # number isn't really that important, except for making cc/ld happy.
6328                 #
6329                 # A name such as libperl.so.3.1
6330                 majmin="libperl.$so.$patchlevel.$subversion"
6331                 # A name such as libperl.so.301
6332                 majonly=`echo $patchlevel $subversion |
6333                         $awk '{printf "%d%02d", $1, $2}'`
6334                 majonly=libperl.$so.$majonly
6335                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6336                 # rely on figuring it out from the naming of libc.
6337                 case "${osname}${osvers}" in
6338                 next4*)
6339                         dflt=libperl.5.$so
6340                         # XXX How handle the --version stuff for MAB?
6341                         ;;
6342                 linux*)  # ld won't link with a bare -lperl otherwise.
6343                         dflt=libperl.$so
6344                         ;;
6345                 cygwin*) # include version
6346                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6347                         ;;
6348                 *)      # Try to guess based on whether libc has major.minor.
6349                         case "$libc" in
6350                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6351                         *libc.$so.[0-9]*) dflt=$majonly ;;
6352                         *)      dflt=libperl.$so ;;
6353                         esac
6354                         ;;
6355                 esac
6356                 ;;
6357         *)      dflt=$libperl
6358                 ;;
6359         esac
6360         cat << EOM
6361
6362 I need to select a good name for the shared libperl.  If your system uses
6363 library names with major and minor numbers, then you might want something
6364 like $majmin.  Alternatively, if your system uses a single version
6365 number for shared libraries, then you might want to use $majonly.
6366 Or, your system might be quite happy with a simple libperl.$so.
6367
6368 Since the shared libperl will get installed into a version-specific
6369 architecture-dependent directory, the version number of the shared perl
6370 library probably isn't important, so the default should be o.k.
6371
6372 EOM
6373         rp='What name do you want to give to the shared libperl?'
6374         . ./myread
6375         libperl=$ans
6376         echo "Ok, I'll use $libperl"
6377         ;;
6378 *)
6379         libperl="libperl${_a}"
6380         ;;
6381 esac
6382
6383 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6384 case "$shrpdir" in
6385 '') ;;
6386 *)      $cat >&4 <<EOM
6387 WARNING:  Use of the shrpdir variable for the installation location of
6388 the shared $libperl is not supported.  It was never documented and
6389 will not work in this version.  Let me (perlbug@perl.com)
6390 know of any problems this may cause.
6391
6392 EOM
6393         case "$shrpdir" in
6394         "$archlibexp/CORE")
6395                 $cat >&4 <<EOM
6396 But your current setting of $shrpdir is
6397 the default anyway, so it's harmless.
6398 EOM
6399                 ;;
6400         *)
6401                 $cat >&4 <<EOM
6402 Further, your current attempted setting of $shrpdir
6403 conflicts with the value of $archlibexp/CORE
6404 that installperl will use.
6405 EOM
6406                 ;;
6407         esac
6408         ;;
6409 esac
6410
6411 # How will the perl executable find the installed shared $libperl?
6412 # Add $xxx to ccdlflags.
6413 # If we can't figure out a command-line option, use $shrpenv to
6414 # set env LD_RUN_PATH.  The main perl makefile uses this.
6415 shrpdir=$archlibexp/CORE
6416 xxx=''
6417 tmp_shrpenv=''
6418 if "$useshrplib"; then
6419     case "$osname" in 
6420         aix)
6421                 # We'll set it in Makefile.SH...
6422                 ;;
6423         solaris|netbsd)
6424                 xxx="-R $shrpdir"
6425                 ;;
6426         freebsd)
6427                 xxx="-Wl,-R$shrpdir"
6428                 ;;
6429         linux|irix*|dec_osf)
6430                 xxx="-Wl,-rpath,$shrpdir"
6431                 ;;
6432         next)
6433                 # next doesn't like the default...
6434                 ;;
6435         beos)
6436                 # beos doesn't like the default, either.
6437                 ;;
6438         hpux*)
6439                 # hpux doesn't like the default, either.
6440                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6441                 ;;
6442         *)
6443                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6444                 ;;
6445         esac
6446         case "$xxx" in
6447         '') ;;
6448         *)      
6449                 # Only add $xxx if it isn't already in ccdlflags.
6450                 case " $ccdlflags " in
6451                 *" $xxx "*)     ;;
6452                 *)      ccdlflags="$ccdlflags $xxx"
6453                         cat <<EOM >&4
6454
6455 Adding $xxx to the flags
6456 passed to $ld so that the perl executable will find the 
6457 installed shared $libperl.
6458
6459 EOM
6460                         ;;
6461                 esac
6462                 ;;
6463         esac
6464 fi
6465 # Fix ccdlflags in AIX for building external extensions.
6466 # (For building Perl itself bare -bE:perl.exp is needed,
6467 #  Makefile.SH takes care of this.)
6468 case "$osname" in
6469 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6470 esac
6471 # Respect a hint or command-line value.
6472 case "$shrpenv" in
6473 '') shrpenv="$tmp_shrpenv" ;;
6474 esac
6475 case "$ldlibpthname" in
6476 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6477 none)   ldlibpthname='' ;;
6478 esac
6479
6480 : determine where manual pages go
6481 set man1dir man1dir none
6482 eval $prefixit
6483 $cat <<EOM
6484
6485 $spackage has manual pages available in source form.
6486 EOM
6487 case "$nroff" in
6488 nroff)
6489         echo "However, you don't have nroff, so they're probably useless to you."
6490         case "$man1dir" in
6491         '') man1dir="none";;
6492         esac;;
6493 esac
6494 echo "If you don't want the manual sources installed, answer 'none'."
6495 case "$man1dir" in
6496 ' ') dflt=none
6497         ;;
6498 '')
6499         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6500         lookpath="$lookpath $prefixexp/man/p_man/man1"
6501         lookpath="$lookpath $prefixexp/man/u_man/man1"
6502         lookpath="$lookpath $prefixexp/man/man.1"
6503         case "$sysman" in
6504         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6505         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6506         esac
6507         set dflt
6508         eval $prefixup
6509         ;;
6510 *)  dflt="$man1dir"
6511         ;;
6512 esac
6513 echo " "
6514 fn=dn+~
6515 rp="Where do the main $spackage manual pages (source) go?"
6516 . ./getfile
6517 if $test "X$man1direxp" != "X$ansexp"; then
6518         installman1dir=''
6519 fi
6520 man1dir="$ans"
6521 man1direxp="$ansexp"
6522 case "$man1dir" in
6523 '')     man1dir=' '
6524         installman1dir='';;
6525 esac
6526
6527 : Change installation prefix, if necessary.
6528 if $test X"$prefix" != X"$installprefix"; then
6529         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6530 else
6531         installman1dir="$man1direxp"
6532 fi
6533
6534 : What suffix to use on installed man pages
6535
6536 case "$man1dir" in
6537 ' ')
6538         man1ext='0'
6539         ;;
6540 *)
6541         rp="What suffix should be used for the main $spackage man pages?"
6542         case "$man1ext" in
6543         '')     case "$man1dir" in
6544                 *1)  dflt=1 ;;
6545                 *1p) dflt=1p ;;
6546                 *1pm) dflt=1pm ;;
6547                 *l) dflt=l;;
6548                 *n) dflt=n;;
6549                 *o) dflt=o;;
6550                 *p) dflt=p;;
6551                 *C) dflt=C;;
6552                 *L) dflt=L;;
6553                 *L1) dflt=L1;;
6554                 *) dflt=1;;
6555                 esac
6556                 ;;
6557         *)      dflt="$man1ext";;
6558         esac
6559         . ./myread
6560         man1ext="$ans"
6561         ;;
6562 esac
6563
6564 : see if we can have long filenames
6565 echo " "
6566 rmlist="$rmlist /tmp/cf$$"
6567 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6568 first=123456789abcdef
6569 second=/tmp/cf$$/$first
6570 $rm -f $first $second
6571 if (echo hi >$first) 2>/dev/null; then
6572         if $test -f 123456789abcde; then
6573                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6574                 val="$undef"
6575         else
6576                 if (echo hi >$second) 2>/dev/null; then
6577                         if $test -f /tmp/cf$$/123456789abcde; then
6578                                 $cat <<'EOM'
6579 That's peculiar... You can have filenames longer than 14 characters, but only
6580 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6581 I shall consider your system cannot support long filenames at all.
6582 EOM
6583                                 val="$undef"
6584                         else
6585                                 echo 'You can have filenames longer than 14 characters.' >&4
6586                                 val="$define"
6587                         fi
6588                 else
6589                         $cat <<'EOM'
6590 How confusing! Some of your filesystems are sane enough to allow filenames
6591 longer than 14 characters but some others like /tmp can't even think about them.
6592 So, for now on, I shall assume your kernel does not allow them at all.
6593 EOM
6594                         val="$undef"
6595                 fi
6596         fi
6597 else
6598         $cat <<'EOM'
6599 You can't have filenames longer than 14 chars.  You can't even think about them!
6600 EOM
6601         val="$undef"
6602 fi 
6603 set d_flexfnam
6604 eval $setvar
6605 $rm -rf /tmp/cf$$ 123456789abcde*
6606
6607 : determine where library module manual pages go
6608 set man3dir man3dir none
6609 eval $prefixit
6610 $cat <<EOM
6611
6612 $spackage has manual pages for many of the library modules.
6613 EOM
6614
6615 case "$nroff" in
6616 nroff)
6617         $cat <<'EOM'
6618 However, you don't have nroff, so they're probably useless to you.
6619 EOM
6620         case "$man3dir" in
6621         '') man3dir="none";;
6622         esac;;
6623 esac
6624
6625 case "$d_flexfnam" in
6626 undef)
6627         $cat <<'EOM'
6628 However, your system can't handle the long file names like File::Basename.3. 
6629 EOM
6630         case "$man3dir" in
6631         '') man3dir="none";;
6632         esac;;
6633 esac
6634
6635 echo "If you don't want the manual sources installed, answer 'none'."
6636 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6637 case "$man3dir" in
6638 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6639         if $test -d "$privlib/man/man3"; then
6640                 cat <<EOM >&4
6641
6642 WARNING:  Previous versions of perl installed man3 pages into
6643 $privlib/man/man3.  This version will suggest a 
6644 new default of $dflt.  
6645 EOM
6646                 tdflt=$dflt
6647                 dflt='n'
6648                 rp='Do you wish to preserve the old behavior?(y/n)'
6649                 . ./myread
6650                 case "$ans" in
6651                 y*) dflt="$privlib/man/man3" ;;
6652                 *)  dflt=$tdflt ;;
6653                 esac
6654     fi
6655         ;;
6656 ' ') dflt=none;;
6657 *)      dflt="$man3dir" ;;
6658 esac
6659 echo " "
6660 fn=dn+~
6661 rp="Where do the $package library man pages (source) go?"
6662 . ./getfile
6663 man3dir="$ans"
6664 man3direxp="$ansexp"
6665 case "$man1dir" in
6666 '')     man3dir=' '
6667         installman3dir='';;
6668 esac
6669
6670 : Change installation prefix, if necessary.
6671 if $test X"$prefix" != X"$installprefix"; then
6672         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6673 else
6674         installman3dir="$man3direxp"
6675 fi
6676
6677 : What suffix to use on installed man pages
6678 case "$man3dir" in
6679 ' ')
6680         man3ext='0'
6681         ;;
6682 *)
6683         rp="What suffix should be used for the $package library man pages?"
6684         case "$man3ext" in
6685         '')     case "$man3dir" in
6686                 *3)  dflt=3 ;;
6687                 *3p) dflt=3p ;;
6688                 *3pm) dflt=3pm ;;
6689                 *l) dflt=l;;
6690                 *n) dflt=n;;
6691                 *o) dflt=o;;
6692                 *p) dflt=p;;
6693                 *C) dflt=C;;
6694                 *L) dflt=L;;
6695                 *L3) dflt=L3;;
6696                 *) dflt=3;;
6697                 esac
6698                 ;;
6699         *)      dflt="$man3ext";;
6700         esac
6701         . ./myread
6702         man3ext="$ans"
6703         ;;
6704 esac
6705
6706 : see if we have to deal with yellow pages, now NIS.
6707 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6708         if $test -f /usr/etc/nibindd; then
6709                 echo " "
6710                 echo "I'm fairly confident you're on a NeXT."
6711                 echo " "
6712                 rp='Do you get the hosts file via NetInfo?'
6713                 dflt=y
6714                 case "$hostcat" in
6715                 nidump*) ;;
6716                 '') ;;
6717                 *) dflt=n;;
6718                 esac
6719                 . ./myread
6720                 case "$ans" in
6721                 y*) hostcat='nidump hosts .';;
6722                 *)      case "$hostcat" in
6723                         nidump*) hostcat='';;
6724                         esac
6725                         ;;
6726                 esac
6727         fi
6728         case "$hostcat" in
6729         nidump*) ;;
6730         *)
6731                 case "$hostcat" in
6732                 *ypcat*) dflt=y;;
6733                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6734                                 dflt=y
6735                         else
6736                                 dflt=n
6737                         fi;;
6738                 *) dflt=n;;
6739                 esac
6740                 echo " "
6741                 rp='Are you getting the hosts file via yellow pages?'
6742                 . ./myread
6743                 case "$ans" in
6744                 y*) hostcat='ypcat hosts';;
6745                 *) hostcat='cat /etc/hosts';;
6746                 esac
6747                 ;;
6748         esac
6749 fi
6750 case "$hostcat" in
6751 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6752 esac
6753 case "$groupcat" in
6754 '') test -f /etc/group && groupcat='cat /etc/group';;
6755 esac
6756 case "$passcat" in
6757 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6758 esac
6759
6760 : now get the host name
6761 echo " "
6762 echo "Figuring out host name..." >&4
6763 case "$myhostname" in
6764 '') cont=true
6765         echo 'Maybe "hostname" will work...'
6766         if tans=`sh -c hostname 2>&1` ; then
6767                 myhostname=$tans
6768                 phostname=hostname
6769                 cont=''
6770         fi
6771         ;;
6772 *) cont='';;
6773 esac
6774 if $test "$cont"; then
6775         if ./xenix; then
6776                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6777                 if tans=`cat /etc/systemid 2>&1` ; then
6778                         myhostname=$tans
6779                         phostname='cat /etc/systemid'
6780                         echo "Whadyaknow.  Xenix always was a bit strange..."
6781                         cont=''
6782                 fi
6783         elif $test -r /etc/systemid; then
6784                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6785         fi
6786 fi
6787 if $test "$cont"; then
6788         echo 'No, maybe "uuname -l" will work...'
6789         if tans=`sh -c 'uuname -l' 2>&1` ; then
6790                 myhostname=$tans
6791                 phostname='uuname -l'
6792         else
6793                 echo 'Strange.  Maybe "uname -n" will work...'
6794                 if tans=`sh -c 'uname -n' 2>&1` ; then
6795                         myhostname=$tans
6796                         phostname='uname -n'
6797                 else
6798                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6799                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6800                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6801                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6802                         else
6803                                 case "$myhostname" in
6804                                 '') echo "Does this machine have an identity crisis or something?"
6805                                         phostname='';;
6806                                 *)
6807                                         echo "Well, you said $myhostname before..."
6808                                         phostname='echo $myhostname';;
6809                                 esac
6810                         fi
6811                 fi
6812         fi
6813 fi
6814 : you do not want to know about this
6815 set $myhostname
6816 myhostname=$1
6817
6818 : verify guess
6819 if $test "$myhostname" ; then
6820         dflt=y
6821         rp='Your host name appears to be "'$myhostname'".'" Right?"
6822         . ./myread
6823         case "$ans" in
6824         y*) ;;
6825         *) myhostname='';;
6826         esac
6827 fi
6828
6829 : bad guess or no guess
6830 while $test "X$myhostname" = X ; do
6831         dflt=''
6832         rp="Please type the (one word) name of your host:"
6833         . ./myread
6834         myhostname="$ans"
6835 done
6836
6837 : translate upper to lower if necessary
6838 case "$myhostname" in
6839 *[A-Z]*)
6840         echo "(Normalizing case in your host name)"
6841         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6842         ;;
6843 esac
6844
6845 case "$myhostname" in
6846 *.*)
6847         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6848         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6849         echo "(Trimming domain name from host name--host name is now $myhostname)"
6850         ;;
6851 *) case "$mydomain" in
6852         '')
6853                 {
6854                         test "X$hostcat" = "Xypcat hosts" &&
6855                         ypmatch "$myhostname" hosts 2>/dev/null |\
6856                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6857                         $test -s hosts
6858                 } || {
6859                         test "X$hostcat" != "X" &&
6860                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6861                                         /[       ]$myhostname[  . ]/p" > hosts
6862                 }
6863                 tmp_re="[       . ]"
6864                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6865                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6866                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6867                         hosts | $sort | $uniq | \
6868                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6869                 case `$echo X$dflt` in
6870                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6871                         dflt=.
6872                         ;;
6873                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6874                         ;;
6875                 esac
6876                 case "$dflt" in
6877                 .)
6878                         tans=`./loc resolv.conf X /etc /usr/etc`
6879                         if $test -f "$tans"; then
6880                                 echo "(Attempting domain name extraction from $tans)"
6881                                 dflt=.`$sed -n -e 's/   / /g' \
6882                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6883                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6884                                 case "$dflt" in
6885                                 .) dflt=.`$sed -n -e 's/        / /g' \
6886                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6887                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6888                                         ;;
6889                                 esac
6890                         fi
6891                         ;;
6892                 esac
6893                 case "$dflt" in
6894                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6895                         dflt=.`sh -c domainname 2>/dev/null`
6896                         case "$dflt" in
6897                         '') dflt='.';;
6898                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6899                         esac
6900                         ;;
6901                 esac
6902                 case "$dflt" in
6903                 .) echo "(Lost all hope -- silly guess then)"
6904                         dflt='.uucp'
6905                         ;;
6906                 esac
6907                 $rm -f hosts
6908                 ;;
6909         *) dflt="$mydomain";;
6910         esac;;
6911 esac
6912 echo " "
6913 rp="What is your domain name?"
6914 . ./myread
6915 tans="$ans"
6916 case "$ans" in
6917 '') ;;
6918 .*) ;;
6919 *) tans=".$tans";;
6920 esac
6921 mydomain="$tans"
6922
6923 : translate upper to lower if necessary
6924 case "$mydomain" in
6925 *[A-Z]*)
6926         echo "(Normalizing case in your domain name)"
6927         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6928         ;;
6929 esac
6930
6931 : a little sanity check here
6932 case "$phostname" in
6933 '') ;;
6934 *)
6935         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6936         $myhostname$mydomain|$myhostname) ;;
6937         *)
6938                 case "$phostname" in
6939                 sed*)
6940                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6941                         ;;
6942                 *)
6943                         echo "(That doesn't agree with your $phostname command, by the way.)"
6944                         ;;
6945                 esac
6946         ;;
6947         esac
6948         ;;
6949 esac
6950
6951 $cat <<EOM
6952
6953 I need to get your e-mail address in Internet format if possible, i.e.
6954 something like user@host.domain. Please answer accurately since I have
6955 no easy means to double check it. The default value provided below
6956 is most probably close to reality but may not be valid from outside
6957 your organization...
6958
6959 EOM
6960 cont=x
6961 while test "$cont"; do
6962         case "$cf_email" in
6963         '') dflt="$cf_by@$myhostname$mydomain";;
6964         *) dflt="$cf_email";;
6965         esac
6966         rp='What is your e-mail address?'
6967         . ./myread
6968         cf_email="$ans"
6969         case "$cf_email" in
6970         *@*.*) cont='' ;;
6971         *)
6972                 rp='Address does not look like an Internet one.  Use it anyway?'
6973                 case "$fastread" in
6974                 yes) dflt=y ;;
6975                 *) dflt=n ;;
6976                 esac
6977                 . ./myread
6978                 case "$ans" in
6979                 y*) cont='' ;;
6980                 *) echo " " ;;
6981                 esac
6982                 ;;
6983         esac
6984 done
6985
6986 $cat <<EOM
6987
6988 If you or somebody else will be maintaining perl at your site, please
6989 fill in the correct e-mail address here so that they may be contacted
6990 if necessary. Currently, the "perlbug" program included with perl
6991 will send mail to this address in addition to perlbug@perl.com. You may
6992 enter "none" for no administrator.
6993
6994 EOM
6995 case "$perladmin" in
6996 '') dflt="$cf_email";;
6997 *) dflt="$perladmin";;
6998 esac
6999 rp='Perl administrator e-mail address'
7000 . ./myread
7001 perladmin="$ans"
7002
7003 : figure out how to guarantee perl startup
7004 case "$startperl" in
7005 '')
7006         case "$sharpbang" in
7007         *!)
7008                 $cat <<EOH
7009
7010 I can use the #! construct to start perl on your system. This will
7011 make startup of perl scripts faster, but may cause problems if you
7012 want to share those scripts and perl is not in a standard place
7013 ($binexp/perl) on all your platforms. The alternative is to force
7014 a shell by starting the script with a single ':' character.
7015
7016 EOH
7017                 dflt="$binexp/perl"
7018                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7019                 . ./myread
7020                 case "$ans" in
7021                 none)   startperl=": # use perl";;
7022                 *)      startperl="#!$ans"
7023                         if $test 30 -lt `echo "$ans" | wc -c`; then
7024                                 $cat >&4 <<EOM
7025
7026 WARNING:  Some systems limit the #! command to 32 characters.
7027 If you experience difficulty running Perl scripts with #!, try
7028 installing Perl in a directory with a shorter pathname.
7029
7030 EOM
7031                         fi ;;
7032                 esac
7033                 ;;
7034         *) startperl=": # use perl"
7035                 ;;
7036         esac
7037         ;;
7038 esac
7039 echo "I'll use $startperl to start perl scripts."
7040
7041 : figure best path for perl in scripts
7042 case "$perlpath" in
7043 '')
7044         perlpath="$binexp/perl"
7045         case "$startperl" in
7046         *!*) ;;
7047         *)
7048                 $cat <<EOH
7049
7050 I will use the "eval 'exec'" idiom to start Perl on your system.
7051 I can use the full path of your Perl binary for this purpose, but
7052 doing so may cause problems if you want to share those scripts and
7053 Perl is not always in a standard place ($binexp/perl).
7054
7055 EOH
7056                 dflt="$binexp/perl"
7057                 rp="What path shall I use in \"eval 'exec'\"?"
7058                 . ./myread
7059                 perlpath="$ans"
7060                 ;;
7061         esac
7062         ;;
7063 esac
7064 case "$startperl" in
7065 *!*)    ;;
7066 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7067 esac
7068
7069 : determine where public executable scripts go
7070 set scriptdir scriptdir
7071 eval $prefixit
7072 case "$scriptdir" in
7073 '')
7074         dflt="$bin"
7075         : guess some guesses
7076         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7077         $test -d /usr/share/bin     && dflt=/usr/share/bin
7078         $test -d /usr/local/script  && dflt=/usr/local/script
7079         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7080         $test -d $prefixexp/script  && dflt=$prefixexp/script
7081         set dflt
7082         eval $prefixup
7083         ;;
7084 *)  dflt="$scriptdir"
7085         ;;
7086 esac
7087 $cat <<EOM
7088  
7089 Some installations have a separate directory just for executable scripts so
7090 that they can mount it across multiple architectures but keep the scripts in
7091 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7092 Or you might just lump your scripts in with all your other executables.
7093  
7094 EOM
7095 fn=d~
7096 rp='Where do you keep publicly executable scripts?'
7097 . ./getfile
7098 if $test "X$ansexp" != "X$scriptdirexp"; then
7099         installscript=''
7100 fi
7101 scriptdir="$ans"
7102 scriptdirexp="$ansexp"
7103 : Change installation prefix, if necessary.
7104 if $test X"$prefix" != X"$installprefix"; then
7105         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7106 else
7107         installscript="$scriptdirexp"
7108 fi
7109
7110 : determine where site specific architecture-dependent libraries go.
7111 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7112 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7113 : sitelib may have an optional trailing /share.
7114 case "$sitearch" in
7115 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7116         dflt="$dflt/$archname"
7117         ;;
7118 *)      dflt="$sitearch"
7119         ;;
7120 esac
7121 set sitearch sitearch none
7122 eval $prefixit
7123 $cat <<EOM
7124
7125 The installation process will also create a directory for
7126 architecture-dependent site-specific extensions and modules.
7127
7128 EOM
7129 fn=d~+
7130 rp='Pathname for the site-specific architecture-dependent library files?'
7131 . ./getfile
7132 sitearch="$ans"
7133 sitearchexp="$ansexp"
7134 : Change installation prefix, if necessary.
7135 if $test X"$prefix" != X"$installprefix"; then
7136         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7137 else
7138         installsitearch="$sitearchexp"
7139 fi
7140
7141 : determine where add-on public executables go
7142 case "$sitebin" in
7143 '')     dflt=$siteprefix/bin ;;
7144 *)      dflt=$sitebin ;;
7145 esac
7146 fn=d~
7147 rp='Pathname where the add-on public executables should be installed?'
7148 . ./getfile
7149 sitebin="$ans"
7150 sitebinexp="$ansexp"
7151 : Change installation prefix, if necessary.
7152 if $test X"$prefix" != X"$installprefix"; then
7153         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7154 else
7155         installsitebin="$sitebinexp"
7156 fi
7157
7158 : see if sqrtl exists
7159 set sqrtl d_sqrtl
7160 eval $inlibc
7161
7162 case "$ccflags" in
7163 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7164 esac
7165
7166 case "$uselongdouble" in
7167 $define|true|[yY]*)     dflt='y';;
7168 *) dflt='n';;
7169 esac
7170 cat <<EOM
7171
7172 Perl can be built to take advantage of long doubles which
7173 (if available) may give more accuracy and range for floating point numbers.
7174
7175 If this doesn't make any sense to you, just accept the default '$dflt'.
7176 EOM
7177 rp='Try to use long doubles if available?'
7178 . ./myread
7179 case "$ans" in
7180 y|Y)    val="$define"   ;;
7181 *)      val="$undef"    ;;
7182 esac
7183 set uselongdouble
7184 eval $setvar
7185
7186 case "$uselongdouble" in
7187 true|[yY]*) uselongdouble="$define" ;;
7188 esac
7189
7190 case "$uselongdouble" in
7191 $define)
7192 : Look for a hint-file generated 'call-back-unit'.  If the
7193 : user has specified that long doubles should be used,
7194 : we may need to set or change some other defaults.
7195         if $test -f uselongdouble.cbu; then
7196                 echo "Your platform has some specific hints for long doubles, using them..."
7197                 . ./uselongdouble.cbu
7198         else
7199                 $cat <<EOM
7200 (Your platform doesn't have any specific hints for long doubles.)
7201 EOM
7202         fi
7203         ;;
7204 esac
7205
7206 case "$uselongdouble:$d_sqrtl" in
7207 $define:$undef)
7208                 $cat <<EOM >&4
7209
7210 *** You requested the use of long doubles but you do not seem to have
7211 *** the mathematic functions for long doubles.  I'm disabling the use
7212 *** of long doubles.
7213
7214 EOM
7215         uselongdouble=$undef
7216         ;;
7217 esac
7218
7219 case "$useperlio" in
7220 $define|true|[yY]*)     dflt='y';;
7221 *) dflt='n';;
7222 esac
7223 cat <<EOM
7224
7225 Previous version of $package used the standard IO mechanisms as defined
7226 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7227 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7228 the default.  This abstraction layer can use AT&T's sfio (if you already
7229 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7230 problems with some extension modules.  Using PerlIO with stdio is safe,
7231 but it is slower than plain stdio and therefore is not the default.
7232
7233 If this doesn't make any sense to you, just accept the default '$dflt'.
7234 EOM
7235 rp='Use the experimental PerlIO abstraction layer?'
7236 . ./myread
7237 case "$ans" in
7238 y|Y) 
7239         val="$define"
7240         ;;     
7241 *)      
7242         echo "Ok, doing things the stdio way"
7243         val="$undef"
7244         ;;
7245 esac
7246 set useperlio
7247 eval $setvar 
7248
7249 case "$vendorprefix" in
7250 '')     d_vendorbin="$undef"
7251         vendorbin=''
7252         vendorbinexp=''
7253         ;;
7254 *)      d_vendorbin="$define"
7255         : determine where vendor-supplied executables go.
7256         case "$vendorbin" in
7257         '') dflt=$vendorprefix/bin ;;
7258         *)      dflt="$vendorbin" ;;
7259         esac
7260         fn=d~+
7261         rp='Pathname for the vendor-supplied executables directory?'
7262         . ./getfile
7263         vendorbin="$ans"
7264         vendorbinexp="$ansexp"
7265         ;;
7266 esac
7267 : Change installation prefix, if necessary.
7268 if $test X"$prefix" != X"$installprefix"; then
7269         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7270 else
7271         installvendorbin="$vendorbinexp"
7272 fi
7273
7274 : see if qgcvt exists
7275 set qgcvt d_qgcvt
7276 eval $inlibc
7277
7278 : check for length of double
7279 echo " "
7280 case "$doublesize" in
7281 '')
7282         echo "Checking to see how big your double precision numbers are..." >&4
7283         $cat >try.c <<'EOCP'
7284 #include <stdio.h>
7285 int main()
7286 {
7287     printf("%d\n", (int)sizeof(double));
7288     exit(0);
7289 }
7290 EOCP
7291         set try
7292         if eval $compile_ok; then
7293                 doublesize=`./try`
7294                 echo "Your double is $doublesize bytes long."
7295         else
7296                 dflt='8'
7297                 echo "(I can't seem to compile the test program.  Guessing...)"
7298                 rp="What is the size of a double precision number (in bytes)?"
7299                 . ./myread
7300                 doublesize="$ans"
7301         fi
7302         ;;
7303 esac
7304 $rm -f try.c try
7305
7306 : check for long doubles
7307 echo " "
7308 echo "Checking to see if you have long double..." >&4
7309 echo 'int main() { long double x = 7.0; }' > try.c
7310 set try
7311 if eval $compile; then
7312         val="$define"
7313         echo "You have long double."
7314 else
7315         val="$undef"
7316         echo "You do not have long double."
7317 fi
7318 $rm try.*
7319 set d_longdbl
7320 eval $setvar
7321
7322 : check for length of long double
7323 case "${d_longdbl}${longdblsize}" in
7324 $define)
7325         echo " "
7326         echo "Checking to see how big your long doubles are..." >&4
7327         $cat >try.c <<'EOCP'
7328 #include <stdio.h>
7329 int main()
7330 {
7331         printf("%d\n", sizeof(long double));
7332 }
7333 EOCP
7334         set try
7335         set try
7336         if eval $compile; then
7337                 longdblsize=`./try$exe_ext`
7338                 echo "Your long doubles are $longdblsize bytes long."
7339         else
7340                 dflt='8'
7341                 echo " "
7342                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7343                 rp="What is the size of a long double (in bytes)?"
7344                 . ./myread
7345                 longdblsize="$ans"
7346         fi
7347         if $test "X$doublesize" = "X$longdblsize"; then
7348                 echo "(That isn't any different from an ordinary double.)"
7349         fi      
7350         ;;
7351 esac
7352 $rm -f try.* try
7353
7354 echo " "
7355
7356 if $test X"$d_longdbl" = X"$define"; then
7357
7358 echo "Checking how to print long doubles..." >&4
7359
7360 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7361         $cat >try.c <<'EOCP'
7362 #include <sys/types.h>
7363 #include <stdio.h>
7364 int main() {
7365   double d = 123.456;
7366   printf("%.3f\n", d);
7367 }
7368 EOCP
7369         set try
7370         if eval $compile; then
7371                 yyy=`./try$exe_ext`
7372                 case "$yyy" in
7373                 123.456)
7374                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7375                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7376                         echo "We will use %f."
7377                         ;;
7378                 esac
7379         fi
7380 fi
7381
7382 if $test X"$sPRIfldbl" = X; then
7383         $cat >try.c <<'EOCP'
7384 #include <sys/types.h>
7385 #include <stdio.h>
7386 int main() {
7387   long double d = 123.456;
7388   printf("%.3llf\n", d);
7389 }
7390 EOCP
7391         set try
7392         if eval $compile; then
7393                 yyy=`./try$exe_ext`
7394                 case "$yyy" in
7395                 123.456)
7396                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7397                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7398                         echo "We will use %llf."
7399                         ;;
7400                 esac
7401         fi
7402 fi
7403
7404 if $test X"$sPRIfldbl" = X; then
7405         $cat >try.c <<'EOCP'
7406 #include <sys/types.h>
7407 #include <stdio.h>
7408 int main() {
7409   long double d = 123.456;
7410   printf("%.3Lf\n", d);
7411 }
7412 EOCP
7413         set try
7414         if eval $compile; then
7415                 yyy=`./try$exe_ext`
7416                 case "$yyy" in
7417                 123.456)
7418                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7419                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7420                         echo "We will use %Lf."
7421                         ;;
7422                 esac
7423         fi
7424 fi
7425
7426 if $test X"$sPRIfldbl" = X; then
7427         $cat >try.c <<'EOCP'
7428 #include <sys/types.h>
7429 #include <stdio.h>
7430 int main() {
7431   long double d = 123.456;
7432   printf("%.3lf\n", d);
7433 }
7434 EOCP
7435         set try
7436         if eval $compile; then
7437                 yyy=`./try$exe_ext`
7438                 case "$yyy" in
7439                 123.456)
7440                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7441                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7442                         echo "We will use %lf."
7443                         ;;
7444                 esac
7445         fi
7446 fi
7447
7448 if $test X"$sPRIfldbl" = X; then
7449         echo "Cannot figure out how to print long doubles." >&4
7450 fi
7451
7452 $rm -f try try.*
7453
7454 fi # d_longdbl
7455
7456 case "$sPRIfldbl" in
7457 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7458         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7459         ;;
7460 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7461         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7462         ;;
7463 esac
7464
7465 : Check how to convert floats to strings.
7466 if test "X$d_Gconvert" = X; then
7467         echo " "
7468         echo "Checking for an efficient way to convert floats to strings."
7469         echo " " > try.c
7470         case "$uselongdouble" in
7471         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7472         esac
7473         case "$d_longdbl" in
7474         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7475         esac
7476         case "$d_PRIgldbl" in
7477         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7478         esac
7479         $cat >>try.c <<EOP
7480 #ifdef TRY_gconvert
7481 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7482 char *myname = "gconvert";
7483 #endif
7484 #ifdef TRY_gcvt
7485 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7486 char *myname = "gcvt";
7487 #endif
7488 #ifdef TRY_qgcvt
7489 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7490 char *myname = "qgcvt";
7491 #define DOUBLETYPE long double
7492 #endif
7493 #ifdef TRY_sprintf
7494 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7495 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7496 #else
7497 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7498 #endif
7499 char *myname = "sprintf";
7500 #endif
7501
7502 #ifndef DOUBLETYPE
7503 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7504 #define DOUBLETYPE long double
7505 #else
7506 #define DOUBLETYPE double
7507 #endif
7508 #endif
7509
7510 #include <stdio.h>
7511
7512 #define I_STDLIB $i_stdlib
7513 #ifdef I_STDLIB
7514 #include <stdlib.h>
7515 #endif
7516
7517 int
7518 checkit(expect, got)
7519 char *expect;
7520 char *got;
7521 {
7522     if (strcmp(expect, got)) {
7523                 printf("%s oddity:  Expected %s, got %s\n",
7524                         myname, expect, got);
7525                 exit(1);
7526         }
7527 }
7528
7529 int main()
7530
7531         char buf[64]; 
7532         buf[63] = '\0';
7533
7534         /* This must be 1st test on (which?) platform */
7535         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7536         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7537         checkit("0.1", buf);
7538
7539         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7540         checkit("1", buf);
7541
7542         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7543         checkit("1.1", buf);
7544
7545         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7546         checkit("1.01", buf);
7547
7548         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7549         checkit("1.001", buf);
7550
7551         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7552         checkit("1.0001", buf);
7553
7554         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7555         checkit("1.00001", buf);
7556
7557         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7558         checkit("1.000001", buf);
7559
7560         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7561         checkit("0", buf);
7562
7563         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7564         checkit("-1", buf);
7565
7566         /* Some Linux gcvt's give 1.e+5 here. */
7567         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7568         checkit("100000", buf);
7569         
7570         /* Some Linux gcvt's give -1.e+5 here. */
7571         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7572         checkit("-100000", buf);
7573
7574         exit(0);
7575 }
7576 EOP
7577         case "$d_Gconvert" in
7578         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7579         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7580         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7581         *) xxx_list='gconvert gcvt sprintf' ;;
7582         esac
7583
7584         case "$d_longdbl$uselongdouble$d_qgcvt" in
7585         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7586         esac
7587
7588         for xxx_convert in $xxx_list; do
7589                 echo "Trying $xxx_convert..."
7590                 $rm -f try try$_o
7591                 set try -DTRY_$xxx_convert
7592                 if eval $compile; then
7593                         echo "$xxx_convert() found." >&4
7594                         if ./try; then
7595                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7596                                 break;
7597                         else
7598                                 echo "...But $xxx_convert didn't work as I expected."
7599                         fi
7600                 else
7601                         echo "$xxx_convert NOT found." >&4
7602                 fi
7603         done
7604                 
7605         case "$xxx_convert" in
7606         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7607         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7608         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7609         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7610            "$define$define$define")
7611               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7612            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7613            esac
7614            ;;  
7615         esac
7616 fi
7617
7618 : Initialize h_fcntl
7619 h_fcntl=false
7620
7621 : Initialize h_sysfile
7622 h_sysfile=false
7623
7624 : access call always available on UNIX
7625 set access d_access
7626 eval $inlibc
7627
7628 : locate the flags for 'access()'
7629 case "$d_access" in
7630 "$define")
7631         echo " "
7632         $cat >access.c <<'EOCP'
7633 #include <sys/types.h>
7634 #ifdef I_FCNTL
7635 #include <fcntl.h>
7636 #endif
7637 #ifdef I_SYS_FILE
7638 #include <sys/file.h>
7639 #endif
7640 #ifdef I_UNISTD
7641 #include <unistd.h>
7642 #endif
7643 int main() {
7644         exit(R_OK);
7645 }
7646 EOCP
7647         : check sys/file.h first, no particular reason here
7648         if $test `./findhdr sys/file.h` && \
7649                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7650                 h_sysfile=true;
7651                 echo "<sys/file.h> defines the *_OK access constants." >&4
7652         elif $test `./findhdr fcntl.h` && \
7653                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7654                 h_fcntl=true;
7655                 echo "<fcntl.h> defines the *_OK access constants." >&4
7656         elif $test `./findhdr unistd.h` && \
7657                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7658                 echo "<unistd.h> defines the *_OK access constants." >&4
7659         else
7660                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7661         fi
7662         ;;
7663 esac
7664 $rm -f access*
7665
7666 : see if accessx exists
7667 set accessx d_accessx
7668 eval $inlibc
7669
7670 : see if alarm exists
7671 set alarm d_alarm
7672 eval $inlibc
7673
7674 : see if atolf exists
7675 set atolf d_atolf
7676 eval $inlibc
7677
7678 : see if atoll exists
7679 set atoll d_atoll
7680 eval $inlibc
7681
7682 : Look for GNU-cc style attribute checking
7683 echo " "
7684 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7685 $cat >attrib.c <<'EOCP'
7686 #include <stdio.h>
7687 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7688 EOCP
7689 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7690         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7691                 echo "Your C compiler doesn't fully support __attribute__."
7692                 val="$undef"
7693         else
7694                 echo "Your C compiler supports __attribute__."
7695                 val="$define"
7696         fi
7697 else
7698         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7699         val="$undef"
7700 fi
7701 set d_attribut
7702 eval $setvar
7703 $rm -f attrib*
7704
7705 : see if bcmp exists
7706 set bcmp d_bcmp
7707 eval $inlibc
7708
7709 : see if bcopy exists
7710 set bcopy d_bcopy
7711 eval $inlibc
7712
7713 : see if this is a unistd.h system
7714 set unistd.h i_unistd
7715 eval $inhdr
7716
7717 : see if getpgrp exists
7718 set getpgrp d_getpgrp
7719 eval $inlibc
7720
7721 case "$d_getpgrp" in
7722 "$define")
7723         echo " "
7724         echo "Checking to see which flavor of getpgrp is in use..."
7725         $cat >set.c <<EOP
7726 #$i_unistd I_UNISTD
7727 #include <sys/types.h>
7728 #ifdef I_UNISTD
7729 #  include <unistd.h>
7730 #endif
7731 int main()
7732 {
7733         if (getuid() == 0) {
7734                 printf("(I see you are running Configure as super-user...)\n");
7735                 setuid(1);
7736         }
7737 #ifdef TRY_BSD_PGRP
7738         if (getpgrp(1) == 0)
7739                 exit(0);
7740 #else
7741         if (getpgrp() > 0)
7742                 exit(0);
7743 #endif
7744         exit(1);
7745 }
7746 EOP
7747         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7748                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7749                 val="$define"
7750         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7751                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7752                 val="$undef"
7753         else
7754                 echo "I can't seem to compile and run the test program."
7755                 if ./usg; then
7756                         xxx="a USG one, i.e. you use getpgrp()."
7757                 else
7758                         # SVR4 systems can appear rather BSD-ish.
7759                         case "$i_unistd" in
7760                         $undef)
7761                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7762                                 val="$define"
7763                                 ;;
7764                         $define)
7765                                 xxx="probably a USG one, i.e. you use getpgrp()."
7766                                 val="$undef"
7767                                 ;;
7768                         esac
7769                 fi
7770                 echo "Assuming your getpgrp is $xxx" >&4
7771         fi
7772         ;;
7773 *) val="$undef";;
7774 esac
7775 set d_bsdgetpgrp
7776 eval $setvar
7777 $rm -f set set.c
7778
7779 : see if setpgrp exists
7780 set setpgrp d_setpgrp
7781 eval $inlibc
7782
7783 case "$d_setpgrp" in
7784 "$define")
7785         echo " "
7786         echo "Checking to see which flavor of setpgrp is in use..."
7787         $cat >set.c <<EOP
7788 #$i_unistd I_UNISTD
7789 #include <sys/types.h>
7790 #ifdef I_UNISTD
7791 #  include <unistd.h>
7792 #endif
7793 int main()
7794 {
7795         if (getuid() == 0) {
7796                 printf("(I see you are running Configure as super-user...)\n");
7797                 setuid(1);
7798         }
7799 #ifdef TRY_BSD_PGRP
7800         if (-1 == setpgrp(1, 1))
7801                 exit(0);
7802 #else
7803         if (setpgrp() != -1)
7804                 exit(0);
7805 #endif
7806         exit(1);
7807 }
7808 EOP
7809         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7810                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7811                 val="$define"
7812         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7813                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7814                 val="$undef"
7815         else
7816                 echo "(I can't seem to compile and run the test program.)"
7817                 if ./usg; then
7818                         xxx="a USG one, i.e. you use setpgrp()."
7819                 else
7820                         # SVR4 systems can appear rather BSD-ish.
7821                         case "$i_unistd" in
7822                         $undef)
7823                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7824                                 val="$define"
7825                                 ;;
7826                         $define)
7827                                 xxx="probably a USG one, i.e. you use setpgrp()."
7828                                 val="$undef"
7829                                 ;;
7830                         esac
7831                 fi
7832                 echo "Assuming your setpgrp is $xxx" >&4
7833         fi
7834         ;;
7835 *) val="$undef";;
7836 esac
7837 set d_bsdsetpgrp
7838 eval $setvar
7839 $rm -f set set.c
7840 : see if bzero exists
7841 set bzero d_bzero
7842 eval $inlibc
7843
7844 : see if signal is declared as pointer to function returning int or void
7845 echo " "
7846 xxx=`./findhdr signal.h`
7847 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7848 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7849         echo "You have int (*signal())() instead of void." >&4
7850         val="$undef"
7851 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7852         echo "You have void (*signal())()." >&4
7853         val="$define"
7854 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7855         echo "You have int (*signal())() instead of void." >&4
7856         val="$undef"
7857 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7858         echo "You have void (*signal())()." >&4
7859         val="$define"
7860 else
7861         case "$d_voidsig" in
7862         '')
7863         echo "I can't determine whether signal handler returns void or int..." >&4
7864                 dflt=void
7865                 rp="What type does your signal handler return?"
7866                 . ./myread
7867                 case "$ans" in
7868                 v*) val="$define";;
7869                 *) val="$undef";;
7870                 esac;;
7871         "$define")
7872                 echo "As you already told me, signal handler returns void." >&4
7873                 val="$define"
7874                 ;;
7875         *)      echo "As you already told me, signal handler returns int." >&4
7876                 val="$undef"
7877                 ;;
7878         esac
7879 fi
7880 set d_voidsig
7881 eval $setvar
7882 case "$d_voidsig" in
7883 "$define") signal_t="void";;
7884 *) signal_t="int";;
7885 esac
7886 $rm -f $$.tmp
7887
7888 : check for ability to cast large floats to 32-bit ints.
7889 echo " "
7890 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7891 if $test "$intsize" -ge 4; then
7892         xxx=int
7893 else
7894         xxx=long
7895 fi
7896 $cat >try.c <<EOCP
7897 #include <stdio.h>
7898 #include <sys/types.h>
7899 #include <signal.h>
7900 $signal_t blech(s) int s; { exit(3); }
7901 int main()
7902 {
7903         $xxx i32;
7904         double f, g;
7905         int result = 0;
7906         char str[16];
7907         signal(SIGFPE, blech);
7908
7909         /* Don't let compiler optimize the test away.  Store the number 
7910            in a writable string for gcc to pass to sscanf under HP/UX.
7911         */
7912         sprintf(str, "2147483647");
7913         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7914         g = 10 * f;
7915         i32  = ($xxx) g;
7916
7917         /* x86 processors will probably give 0x8000 0000, which is a
7918        sign change.  We don't want that.  We want to mimic SPARC
7919            behavior here, which is to preserve the sign and give
7920            back 0x7fff ffff.
7921         */
7922         if (i32 != ($xxx) f)
7923                 result |= 1;
7924         exit(result);
7925 }
7926 EOCP
7927 set try
7928 if eval $compile_ok; then
7929         ./try
7930         yyy=$?
7931 else
7932         echo "(I can't seem to compile the test program--assuming it can't)"
7933         yyy=1
7934 fi
7935 case "$yyy" in
7936 0)      val="$define"
7937         echo "Yup, it can."
7938         ;;
7939 *)      val="$undef"
7940         echo "Nope, it can't."
7941         ;;
7942 esac
7943 set d_casti32
7944 eval $setvar
7945 $rm -f try try.*
7946
7947 : check for ability to cast negative floats to unsigned
7948 echo " "
7949 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7950 $cat >try.c <<EOCP
7951 #include <stdio.h>
7952 #include <sys/types.h>
7953 #include <signal.h>
7954 $signal_t blech(s) int s; { exit(7); }
7955 $signal_t blech_in_list(s) int s; { exit(4); }
7956 unsigned long dummy_long(p) unsigned long p; { return p; }
7957 unsigned int dummy_int(p) unsigned int p; { return p; }
7958 unsigned short dummy_short(p) unsigned short p; { return p; }
7959 int main()
7960 {
7961         double f;
7962         unsigned long along;
7963         unsigned int aint;
7964         unsigned short ashort;
7965         int result = 0;
7966         char str[16];
7967         
7968         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7969            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7970            optimized the whole file away
7971         */
7972         /* Store the number in a writable string for gcc to pass to 
7973            sscanf under HP/UX.
7974         */
7975         sprintf(str, "-123");
7976         sscanf(str, "%lf", &f);  /* f = -123.; */
7977
7978         signal(SIGFPE, blech);
7979         along = (unsigned long)f;
7980         aint = (unsigned int)f;
7981         ashort = (unsigned short)f;
7982         if (along != (unsigned long)-123)
7983                 result |= 1;
7984         if (aint != (unsigned int)-123)
7985                 result |= 1;
7986         if (ashort != (unsigned short)-123)
7987                 result |= 1;
7988         sprintf(str, "1073741824.");
7989         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7990         f = f + f;
7991         along = 0;
7992         along = (unsigned long)f;
7993         if (along != 0x80000000)
7994                 result |= 2;
7995         f -= 1.;
7996         along = 0;
7997         along = (unsigned long)f;
7998         if (along != 0x7fffffff)
7999                 result |= 1;
8000         f += 2.;
8001         along = 0;
8002         along = (unsigned long)f;
8003         if (along != 0x80000001)
8004                 result |= 2;
8005         if (result)
8006                 exit(result);
8007         signal(SIGFPE, blech_in_list);
8008         sprintf(str, "123.");
8009         sscanf(str, "%lf", &f);  /* f = 123.; */
8010         along = dummy_long((unsigned long)f);
8011         aint = dummy_int((unsigned int)f);
8012         ashort = dummy_short((unsigned short)f);
8013         if (along != (unsigned long)123)
8014                 result |= 4;
8015         if (aint != (unsigned int)123)
8016                 result |= 4;
8017         if (ashort != (unsigned short)123)
8018                 result |= 4;
8019         exit(result);
8020
8021 }
8022 EOCP
8023 set try
8024 if eval $compile_ok; then
8025         ./try
8026         castflags=$?
8027 else
8028         echo "(I can't seem to compile the test program--assuming it can't)"
8029         castflags=7
8030 fi
8031 case "$castflags" in
8032 0)      val="$define"
8033         echo "Yup, it can."
8034         ;;
8035 *)      val="$undef"
8036         echo "Nope, it can't."
8037         ;;
8038 esac
8039 set d_castneg
8040 eval $setvar
8041 $rm -f try.*
8042
8043 : see if vprintf exists
8044 echo " "
8045 if set vprintf val -f d_vprintf; eval $csym; $val; then
8046         echo 'vprintf() found.' >&4
8047         val="$define"
8048         $cat >vprintf.c <<'EOF'
8049 #include <varargs.h>
8050
8051 int main() { xxx("foo"); }
8052
8053 xxx(va_alist)
8054 va_dcl
8055 {
8056         va_list args;
8057         char buf[10];
8058
8059         va_start(args);
8060         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8061 }
8062 EOF
8063         set vprintf
8064         if eval $compile && ./vprintf; then
8065                 echo "Your vsprintf() returns (int)." >&4
8066                 val2="$undef"
8067         else
8068                 echo "Your vsprintf() returns (char*)." >&4
8069                 val2="$define"
8070         fi
8071 else
8072         echo 'vprintf() NOT found.' >&4
8073                 val="$undef"
8074                 val2="$undef"
8075 fi
8076 set d_vprintf
8077 eval $setvar
8078 val=$val2
8079 set d_charvspr
8080 eval $setvar
8081
8082 : see if chown exists
8083 set chown d_chown
8084 eval $inlibc
8085
8086 : see if chroot exists
8087 set chroot d_chroot
8088 eval $inlibc
8089
8090 : see if chsize exists
8091 set chsize d_chsize
8092 eval $inlibc
8093
8094 : check for const keyword
8095 echo " "
8096 echo 'Checking to see if your C compiler knows about "const"...' >&4
8097 $cat >const.c <<'EOCP'
8098 typedef struct spug { int drokk; } spug;
8099 int main()
8100 {
8101         const char *foo;
8102         const spug y;
8103 }
8104 EOCP
8105 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8106         val="$define"
8107         echo "Yup, it does."
8108 else
8109         val="$undef"
8110         echo "Nope, it doesn't."
8111 fi
8112 set d_const
8113 eval $setvar
8114
8115 : see if crypt exists
8116 echo " "
8117 if set crypt val -f d_crypt; eval $csym; $val; then
8118         echo 'crypt() found.' >&4
8119         val="$define"
8120         cryptlib=''
8121 else
8122         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8123         if $test -z "$cryptlib"; then
8124                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8125         else
8126                 cryptlib=-lcrypt
8127         fi
8128         if $test -z "$cryptlib"; then
8129                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8130         else
8131                 cryptlib=-lcrypt
8132         fi
8133         if $test -z "$cryptlib"; then
8134                 cryptlib=`./loc libcrypt$_a "" $libpth`
8135         else
8136                 cryptlib=-lcrypt
8137         fi
8138         if $test -z "$cryptlib"; then
8139                 echo 'crypt() NOT found.' >&4
8140                 val="$undef"
8141         else
8142                 val="$define"
8143         fi
8144 fi
8145 set d_crypt
8146 eval $setvar
8147
8148 : get csh whereabouts
8149 case "$csh" in
8150 'csh') val="$undef" ;;
8151 *) val="$define" ;;
8152 esac
8153 set d_csh
8154 eval $setvar
8155 : Respect a hint or command line value for full_csh.
8156 case "$full_csh" in
8157 '') full_csh=$csh ;;
8158 esac
8159
8160 : see if cuserid exists
8161 set cuserid d_cuserid
8162 eval $inlibc
8163
8164 : see if this is a limits.h system
8165 set limits.h i_limits
8166 eval $inhdr
8167
8168 : see if this is a float.h system
8169 set float.h i_float
8170 eval $inhdr
8171
8172 : See if number of significant digits in a double precision number is known
8173 echo " "
8174 $cat >dbl_dig.c <<EOM
8175 #$i_limits I_LIMITS
8176 #$i_float I_FLOAT
8177 #ifdef I_LIMITS
8178 #include <limits.h>
8179 #endif
8180 #ifdef I_FLOAT
8181 #include <float.h>
8182 #endif
8183 #ifdef DBL_DIG
8184 printf("Contains DBL_DIG");
8185 #endif
8186 EOM
8187 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8188 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8189         echo "DBL_DIG found." >&4
8190         val="$define"
8191 else
8192         echo "DBL_DIG NOT found." >&4
8193         val="$undef"
8194 fi
8195 $rm -f dbl_dig.?
8196 set d_dbl_dig
8197 eval $setvar
8198
8199 : see if difftime exists
8200 set difftime d_difftime
8201 eval $inlibc
8202
8203 : see if this is a dirent system
8204 echo " "
8205 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8206         val="$define"
8207         echo "<dirent.h> found." >&4
8208 else
8209         val="$undef"
8210         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8211                 echo "<sys/dir.h> found." >&4
8212                 echo " "
8213         else
8214                 xinc=`./findhdr sys/ndir.h`
8215         fi
8216         echo "<dirent.h> NOT found." >&4
8217 fi
8218 set i_dirent
8219 eval $setvar
8220
8221 : Look for type of directory structure.
8222 echo " "
8223 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8224
8225 case "$direntrytype" in
8226 ''|' ')
8227         case "$i_dirent" in
8228         $define) guess1='struct dirent' ;;
8229         *) guess1='struct direct'  ;;
8230         esac
8231         ;;
8232 *)      guess1="$direntrytype"
8233         ;;
8234 esac
8235
8236 case "$guess1" in
8237 'struct dirent') guess2='struct direct' ;;
8238 *) guess2='struct dirent' ;;
8239 esac
8240                 
8241 if $contains "$guess1" try.c >/dev/null 2>&1; then
8242         direntrytype="$guess1"
8243         echo "Your directory entries are $direntrytype." >&4
8244 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8245         direntrytype="$guess2"
8246         echo "Your directory entries seem to be $direntrytype." >&4
8247 else
8248         echo "I don't recognize your system's directory entries." >&4
8249         rp="What type is used for directory entries on this system?"
8250         dflt="$guess1"
8251         . ./myread
8252         direntrytype="$ans"
8253 fi
8254 $rm -f try.c
8255
8256
8257 : see if the directory entry stores field length
8258 echo " "
8259 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8260 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8261         echo "Good, your directory entry keeps length information in d_namlen." >&4
8262         val="$define"
8263 else
8264         echo "Your directory entry does not know about the d_namlen field." >&4
8265         val="$undef"
8266 fi
8267 set d_dirnamlen
8268 eval $setvar
8269 $rm -f try.c
8270
8271 : see if dlerror exists
8272 xxx_runnm="$runnm"
8273 runnm=false
8274 set dlerror d_dlerror
8275 eval $inlibc
8276 runnm="$xxx_runnm"
8277
8278 : see if dlfcn is available
8279 set dlfcn.h i_dlfcn
8280 eval $inhdr
8281
8282 case "$usedl" in
8283 $define|y|true)
8284         $cat << EOM
8285
8286 On a few systems, the dynamically loaded modules that perl generates and uses
8287 will need a different extension than shared libs. The default will probably
8288 be appropriate.
8289
8290 EOM
8291         case "$dlext" in
8292         '')     dflt="$so" ;;
8293         *)      dflt="$dlext" ;;
8294         esac
8295         rp='What is the extension of dynamically loaded modules'
8296         . ./myread
8297         dlext="$ans"
8298         ;;
8299 *)
8300         dlext="none"
8301         ;;
8302 esac
8303
8304 : Check if dlsym need a leading underscore
8305 echo " "
8306 val="$undef"
8307
8308 case "$dlsrc" in
8309 dl_dlopen.xs)
8310         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8311         $cat >dyna.c <<'EOM'
8312 fred () { }
8313 EOM
8314
8315 $cat >fred.c<<EOM
8316
8317 #include <stdio.h>
8318 #$i_dlfcn I_DLFCN
8319 #ifdef I_DLFCN
8320 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8321 #else
8322 #include <sys/types.h>
8323 #include <nlist.h>
8324 #include <link.h>
8325 #endif
8326
8327 extern int fred() ;
8328
8329 int main()
8330 {
8331     void * handle ;
8332     void * symbol ;
8333 #ifndef RTLD_LAZY
8334     int mode = 1 ;
8335 #else
8336     int mode = RTLD_LAZY ;
8337 #endif
8338     handle = dlopen("./dyna.$dlext", mode) ;
8339     if (handle == NULL) {
8340         printf ("1\n") ;
8341         fflush (stdout) ;
8342         exit(0);
8343     }
8344     symbol = dlsym(handle, "fred") ;
8345     if (symbol == NULL) {
8346         /* try putting a leading underscore */
8347         symbol = dlsym(handle, "_fred") ;
8348         if (symbol == NULL) {
8349             printf ("2\n") ;
8350             fflush (stdout) ;
8351             exit(0);
8352         }
8353         printf ("3\n") ;
8354     }
8355     else
8356         printf ("4\n") ;
8357     fflush (stdout) ;
8358     exit(0);
8359 }
8360 EOM
8361         : Call the object file tmp-dyna.o in case dlext=o.
8362         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8363                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8364                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8365                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8366                 xxx=`./fred`
8367                 case $xxx in
8368                 1)      echo "Test program failed using dlopen." >&4
8369                         echo "Perhaps you should not use dynamic loading." >&4;;
8370                 2)      echo "Test program failed using dlsym." >&4
8371                         echo "Perhaps you should not use dynamic loading." >&4;;
8372                 3)      echo "dlsym needs a leading underscore" >&4
8373                         val="$define" ;;
8374                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8375                 esac
8376         else
8377                 echo "I can't compile and run the test program." >&4
8378                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8379         fi
8380         ;;
8381 esac
8382                 
8383 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8384
8385 set d_dlsymun
8386 eval $setvar
8387
8388 hasproto='varname=$1; func=$2; shift; shift;
8389 while $test $# -ge 2; do
8390         case "$1" in
8391         $define) echo "#include <$2>";;
8392         esac ;
8393     shift 2;
8394 done > try.c;
8395 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8396 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8397         echo "$func() prototype found.";
8398         val="$define";
8399 else
8400         echo "$func() prototype NOT found.";
8401         val="$undef";
8402 fi;
8403 set $varname;
8404 eval $setvar;
8405 $rm -f try.c tryout.c'
8406
8407 : see if prototype for drand48 is available
8408 echo " "
8409 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8410 eval $hasproto
8411
8412 : see if dup2 exists
8413 set dup2 d_dup2
8414 eval $inlibc
8415
8416 : see if eaccess exists
8417 set eaccess d_eaccess
8418 eval $inlibc
8419
8420 : see if endgrent exists
8421 set endgrent d_endgrent
8422 eval $inlibc
8423
8424 : see if endhostent exists
8425 set endhostent d_endhent
8426 eval $inlibc
8427
8428 : see if endnetent exists
8429 set endnetent d_endnent
8430 eval $inlibc
8431
8432 : see if endprotoent exists
8433 set endprotoent d_endpent
8434 eval $inlibc
8435
8436 : see if endpwent exists
8437 set endpwent d_endpwent
8438 eval $inlibc
8439
8440 : see if endservent exists
8441 set endservent d_endsent
8442 eval $inlibc
8443
8444 : see if endspent exists
8445 set endspent d_endspent
8446 eval $inlibc
8447
8448 : Locate the flags for 'open()'
8449 echo " "
8450 $cat >open3.c <<'EOCP'
8451 #include <sys/types.h>
8452 #ifdef I_FCNTL
8453 #include <fcntl.h>
8454 #endif
8455 #ifdef I_SYS_FILE
8456 #include <sys/file.h>
8457 #endif
8458 int main() {
8459         if(O_RDONLY);
8460 #ifdef O_TRUNC
8461         exit(0);
8462 #else
8463         exit(1);
8464 #endif
8465 }
8466 EOCP
8467 : check sys/file.h first to get FREAD on Sun
8468 if $test `./findhdr sys/file.h` && \
8469                 set open3 -DI_SYS_FILE && eval $compile; then
8470         h_sysfile=true;
8471         echo "<sys/file.h> defines the O_* constants..." >&4
8472         if ./open3; then
8473                 echo "and you have the 3 argument form of open()." >&4
8474                 val="$define"
8475         else
8476                 echo "but not the 3 argument form of open().  Oh, well." >&4
8477                 val="$undef"
8478         fi
8479 elif $test `./findhdr fcntl.h` && \
8480                 set open3 -DI_FCNTL && eval $compile; then
8481         h_fcntl=true;
8482         echo "<fcntl.h> defines the O_* constants..." >&4
8483         if ./open3; then
8484                 echo "and you have the 3 argument form of open()." >&4
8485                 val="$define"
8486         else
8487                 echo "but not the 3 argument form of open().  Oh, well." >&4
8488                 val="$undef"
8489         fi
8490 else
8491         val="$undef"
8492         echo "I can't find the O_* constant definitions!  You got problems." >&4
8493 fi
8494 set d_open3
8495 eval $setvar
8496 $rm -f open3*
8497
8498 : see which of string.h or strings.h is needed
8499 echo " "
8500 strings=`./findhdr string.h`
8501 if $test "$strings" && $test -r "$strings"; then
8502         echo "Using <string.h> instead of <strings.h>." >&4
8503         val="$define"
8504 else
8505         val="$undef"
8506         strings=`./findhdr strings.h`
8507         if $test "$strings" && $test -r "$strings"; then
8508                 echo "Using <strings.h> instead of <string.h>." >&4
8509         else
8510                 echo "No string header found -- You'll surely have problems." >&4
8511         fi
8512 fi
8513 set i_string
8514 eval $setvar
8515 case "$i_string" in
8516 "$undef") strings=`./findhdr strings.h`;;
8517 *)        strings=`./findhdr string.h`;;
8518 esac
8519
8520 : check for non-blocking I/O stuff
8521 case "$h_sysfile" in
8522 true) echo "#include <sys/file.h>" > head.c;;
8523 *)
8524         case "$h_fcntl" in
8525         true) echo "#include <fcntl.h>" > head.c;;
8526         *) echo "#include <sys/fcntl.h>" > head.c;;
8527         esac
8528         ;;
8529 esac
8530 echo " "
8531 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8532 case "$o_nonblock" in
8533 '')
8534         $cat head.c > try.c
8535         $cat >>try.c <<'EOCP'
8536 #include <stdio.h>
8537 int main() {
8538 #ifdef O_NONBLOCK
8539         printf("O_NONBLOCK\n");
8540         exit(0);
8541 #endif
8542 #ifdef O_NDELAY
8543         printf("O_NDELAY\n");
8544         exit(0);
8545 #endif
8546 #ifdef FNDELAY
8547         printf("FNDELAY\n");
8548         exit(0);
8549 #endif
8550         exit(0);
8551 }
8552 EOCP
8553         set try
8554         if eval $compile_ok; then
8555                 o_nonblock=`./try`
8556                 case "$o_nonblock" in
8557                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8558                 *) echo "Seems like we can use $o_nonblock.";;
8559                 esac
8560         else
8561                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8562         fi
8563         ;;
8564 *) echo "Using $hint value $o_nonblock.";;
8565 esac
8566 $rm -f try try.* .out core
8567
8568 echo " "
8569 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8570 case "$eagain" in
8571 '')
8572         $cat head.c > try.c
8573         $cat >>try.c <<EOCP
8574 #include <errno.h>
8575 #include <sys/types.h>
8576 #include <signal.h>
8577 #include <stdio.h> 
8578 #define MY_O_NONBLOCK $o_nonblock
8579 #ifndef errno  /* XXX need better Configure test */
8580 extern int errno;
8581 #endif
8582 #$i_unistd I_UNISTD
8583 #ifdef I_UNISTD
8584 #include <unistd.h>
8585 #endif
8586 #ifdef $i_string
8587 #include <string.h>
8588 #else
8589 #include <strings.h>
8590 #endif
8591 $signal_t blech(x) int x; { exit(3); }
8592 EOCP
8593         $cat >> try.c <<'EOCP'
8594 int main()
8595 {
8596         int pd[2];
8597         int pu[2];
8598         char buf[1];
8599         char string[100];
8600
8601         pipe(pd);       /* Down: child -> parent */
8602         pipe(pu);       /* Up: parent -> child */
8603         if (0 != fork()) {
8604                 int ret;
8605                 close(pd[1]);   /* Parent reads from pd[0] */
8606                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8607                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8608                         exit(1);
8609                 signal(SIGALRM, blech);
8610                 alarm(5);
8611                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8612                         exit(2);
8613                 sprintf(string, "%d\n", ret);
8614                 write(2, string, strlen(string));
8615                 alarm(0);
8616 #ifdef EAGAIN
8617                 if (errno == EAGAIN) {
8618                         printf("EAGAIN\n");
8619                         goto ok;
8620                 }
8621 #endif
8622 #ifdef EWOULDBLOCK
8623                 if (errno == EWOULDBLOCK)
8624                         printf("EWOULDBLOCK\n");
8625 #endif
8626         ok:
8627                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8628                 sleep(2);                               /* Give it time to close our pipe */
8629                 alarm(5);
8630                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8631                 alarm(0);
8632                 sprintf(string, "%d\n", ret);
8633                 write(3, string, strlen(string));
8634                 exit(0);
8635         }
8636
8637         close(pd[0]);                   /* We write to pd[1] */
8638         close(pu[1]);                   /* We read from pu[0] */
8639         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8640         close(pd[1]);                   /* Pipe pd is now fully closed! */
8641         exit(0);                                /* Bye bye, thank you for playing! */
8642 }
8643 EOCP
8644         set try
8645         if eval $compile_ok; then
8646                 echo "$startsh" >mtry
8647                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8648                 chmod +x mtry
8649                 ./mtry >/dev/null 2>&1
8650                 case $? in
8651                 0) eagain=`$cat try.out`;;
8652                 1) echo "Could not perform non-blocking setting!";;
8653                 2) echo "I did a successful read() for something that was not there!";;
8654                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8655                 *) echo "Something terribly wrong happened during testing.";;
8656                 esac
8657                 rd_nodata=`$cat try.ret`
8658                 echo "A read() system call with no data present returns $rd_nodata."
8659                 case "$rd_nodata" in
8660                 0|-1) ;;
8661                 *)
8662                         echo "(That's peculiar, fixing that to be -1.)"
8663                         rd_nodata=-1
8664                         ;;
8665                 esac
8666                 case "$eagain" in
8667                 '')
8668                         echo "Forcing errno EAGAIN on read() with no data available."
8669                         eagain=EAGAIN
8670                         ;;
8671                 *)
8672                         echo "Your read() sets errno to $eagain when no data is available."
8673                         ;;
8674                 esac
8675                 status=`$cat try.err`
8676                 case "$status" in
8677                 0) echo "And it correctly returns 0 to signal EOF.";;
8678                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8679                 *) echo "However, your read() returns '$status' on EOF??";;
8680                 esac
8681                 val="$define"
8682                 if test "$status" = "$rd_nodata"; then
8683                         echo "WARNING: you can't distinguish between EOF and no data!"
8684                         val="$undef"
8685                 fi
8686         else
8687                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8688                 eagain=EAGAIN
8689         fi
8690         set d_eofnblk
8691         eval $setvar
8692         ;;
8693 *)
8694         echo "Using $hint value $eagain."
8695         echo "Your read() returns $rd_nodata when no data is present."
8696         case "$d_eofnblk" in
8697         "$define") echo "And you can see EOF because read() returns 0.";;
8698         "$undef") echo "But you can't see EOF status from read() returned value.";;
8699         *)
8700                 echo "(Assuming you can't see EOF status from read anyway.)"
8701                 d_eofnblk=$undef
8702                 ;;
8703         esac
8704         ;;
8705 esac
8706 $rm -f try try.* .out core head.c mtry
8707
8708 : see if fchmod exists
8709 set fchmod d_fchmod
8710 eval $inlibc
8711
8712 : see if fchown exists
8713 set fchown d_fchown
8714 eval $inlibc
8715
8716 : see if this is an fcntl system
8717 set fcntl d_fcntl
8718 eval $inlibc
8719
8720 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8721 while $test $# -ge 2; do
8722         case "$1" in
8723         $define) echo "#include <$2>";;
8724         esac ;
8725     shift 2;
8726 done > try.c;
8727 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8728 set try;
8729 if eval $compile; then
8730         val="$define";
8731 else
8732         val="$undef";
8733 fi;
8734 set $varname;
8735 eval $setvar;
8736 $rm -f try.c try.o'
8737
8738 socketlib=''
8739 sockethdr=''
8740 : see whether socket exists
8741 echo " "
8742 $echo $n "Hmm... $c" >&4
8743 if set socket val -f d_socket; eval $csym; $val; then
8744         echo "Looks like you have Berkeley networking support." >&4
8745         d_socket="$define"
8746         if set setsockopt val -f; eval $csym; $val; then
8747                 d_oldsock="$undef"
8748         else
8749                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8750                 d_oldsock="$define"
8751         fi
8752 else
8753         if $contains socklib libc.list >/dev/null 2>&1; then
8754                 echo "Looks like you have Berkeley networking support." >&4
8755                 d_socket="$define"
8756                 : we will have to assume that it supports the 4.2 BSD interface
8757                 d_oldsock="$undef"
8758         else
8759                 echo "You don't have Berkeley networking in libc$_a..." >&4
8760                 if test "X$d_socket" = "X$define"; then
8761                    echo "...but you seem to believe that you have sockets." >&4
8762                 else
8763                         for net in net socket
8764                         do
8765                                 if test -f /usr/lib/lib$net$_a; then
8766                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8767                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8768                                         if $contains socket libc.list >/dev/null 2>&1; then
8769                                                 d_socket="$define"
8770                                                 socketlib="-l$net"
8771                                                 case "$net" in
8772                                                 net)
8773                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8774                                                         sockethdr="-I/usr/netinclude"
8775                                                         ;;
8776                                                 esac
8777                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8778                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8779                                                         d_oldsock="$undef"
8780                                                 else
8781                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8782                                                         d_oldsock="$define"
8783                                                 fi
8784                                                 break
8785                                         fi
8786                                 fi
8787                         done
8788                         if test "X$d_socket" != "X$define"; then
8789                            echo "or anywhere else I see." >&4
8790                            d_socket="$undef"
8791                            d_oldsock="$undef"
8792                         fi
8793                 fi
8794         fi
8795 fi
8796
8797 : see if socketpair exists
8798 set socketpair d_sockpair
8799 eval $inlibc
8800
8801
8802 echo " "
8803 echo "Checking the availability of certain socket constants..." >& 4
8804 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8805         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8806         $cat >try.c <<EOF
8807 #include <sys/types.h>
8808 #include <sys/socket.h>
8809 int main() {
8810     int i = $ENUM;
8811 }
8812 EOF
8813         val="$undef"
8814         set try; if eval $compile; then
8815                 val="$define"
8816         fi
8817         set d_${enum}; eval $setvar
8818         $rm -f try.c try
8819 done
8820
8821 : see if sys/select.h has to be included
8822 set sys/select.h i_sysselct
8823 eval $inhdr
8824
8825 : see if we should include time.h, sys/time.h, or both
8826 echo " "
8827 if test "X$timeincl" = X; then
8828         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8829         $echo $n "I'm now running the test program...$c"
8830         $cat >try.c <<'EOCP'
8831 #include <sys/types.h>
8832 #ifdef I_TIME
8833 #include <time.h>
8834 #endif
8835 #ifdef I_SYSTIME
8836 #ifdef SYSTIMEKERNEL
8837 #define KERNEL
8838 #endif
8839 #include <sys/time.h>
8840 #endif
8841 #ifdef I_SYSSELECT
8842 #include <sys/select.h>
8843 #endif
8844 int main()
8845 {
8846         struct tm foo;
8847 #ifdef S_TIMEVAL
8848         struct timeval bar;
8849 #endif
8850 #ifdef S_TIMEZONE
8851         struct timezone tzp;
8852 #endif
8853         if (foo.tm_sec == foo.tm_sec)
8854                 exit(0);
8855 #ifdef S_TIMEVAL
8856         if (bar.tv_sec == bar.tv_sec)
8857                 exit(0);
8858 #endif
8859         exit(1);
8860 }
8861 EOCP
8862         flags=''
8863         for s_timezone in '-DS_TIMEZONE' ''; do
8864         sysselect=''
8865         for s_timeval in '-DS_TIMEVAL' ''; do
8866         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8867         for i_time in '' '-DI_TIME'; do
8868         for i_systime in '-DI_SYSTIME' ''; do
8869                 case "$flags" in
8870                 '') $echo $n ".$c"
8871                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8872                         if eval $compile; then
8873                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8874                                 shift
8875                                 flags="$*"
8876                                 echo " "
8877                                 $echo $n "Succeeded with $flags$c"
8878                         fi
8879                         ;;
8880                 esac
8881         done
8882         done
8883         done
8884         done
8885         done
8886         timeincl=''
8887         echo " "
8888         case "$flags" in
8889         *SYSTIMEKERNEL*) i_systimek="$define"
8890                 timeincl=`./findhdr sys/time.h`
8891                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8892         *) i_systimek="$undef";;
8893         esac
8894         case "$flags" in
8895         *I_TIME*) i_time="$define"
8896                 timeincl=`./findhdr time.h`" $timeincl"
8897                 echo "We'll include <time.h>." >&4;;
8898         *) i_time="$undef";;
8899         esac
8900         case "$flags" in
8901         *I_SYSTIME*) i_systime="$define"
8902                 timeincl=`./findhdr sys/time.h`" $timeincl"
8903                 echo "We'll include <sys/time.h>." >&4;;
8904         *) i_systime="$undef";;
8905         esac
8906         $rm -f try.c try
8907 fi
8908
8909 : check for fd_set items
8910 $cat <<EOM
8911
8912 Checking to see how well your C compiler handles fd_set and friends ...
8913 EOM
8914 $cat >fd_set.c <<EOCP
8915 #$i_systime I_SYS_TIME
8916 #$i_sysselct I_SYS_SELECT
8917 #$d_socket HAS_SOCKET
8918 #include <sys/types.h>
8919 #ifdef HAS_SOCKET
8920 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8921 #endif
8922 #ifdef I_SYS_TIME
8923 #include <sys/time.h>
8924 #endif
8925 #ifdef I_SYS_SELECT
8926 #include <sys/select.h>
8927 #endif
8928 int main() {
8929         fd_set fds;
8930
8931 #ifdef TRYBITS
8932         if(fds.fds_bits);
8933 #endif
8934
8935 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8936         exit(0);
8937 #else
8938         exit(1);
8939 #endif
8940 }
8941 EOCP
8942 set fd_set -DTRYBITS
8943 if eval $compile; then
8944         d_fds_bits="$define"
8945         d_fd_set="$define"
8946         echo "Well, your system knows about the normal fd_set typedef..." >&4
8947         if ./fd_set; then
8948                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8949                 d_fd_macros="$define"
8950         else
8951                 $cat >&4 <<'EOM'
8952 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8953 EOM
8954                 d_fd_macros="$undef"
8955         fi
8956 else
8957         $cat <<'EOM'
8958 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8959 EOM
8960         set fd_set
8961         if eval $compile; then
8962                 d_fds_bits="$undef"
8963                 d_fd_set="$define"
8964                 echo "Well, your system has some sort of fd_set available..." >&4
8965                 if ./fd_set; then
8966                         echo "and you have the normal fd_set macros." >&4
8967                         d_fd_macros="$define"
8968                 else
8969                         $cat <<'EOM'
8970 but not the normal fd_set macros!  Gross!  More work for me...
8971 EOM
8972                         d_fd_macros="$undef"
8973                 fi
8974         else
8975         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8976                 d_fd_set="$undef"
8977                 d_fds_bits="$undef"
8978                 d_fd_macros="$undef"
8979         fi
8980 fi
8981 $rm -f fd_set*
8982
8983 : see if fgetpos exists
8984 set fgetpos d_fgetpos
8985 eval $inlibc
8986
8987 : see if flock exists
8988 set flock d_flock
8989 eval $inlibc
8990
8991 : see if fork exists
8992 set fork d_fork
8993 eval $inlibc
8994
8995 : see if pathconf exists
8996 set pathconf d_pathconf
8997 eval $inlibc
8998
8999 : see if fpathconf exists
9000 set fpathconf d_fpathconf
9001 eval $inlibc
9002
9003
9004 : check for fpos64_t
9005 echo " "
9006 echo "Checking to see if you have fpos64_t..." >&4
9007 $cat >try.c <<EOCP
9008 #include <stdio.h>
9009 int main() { fpos64_t x = 7; }
9010 EOCP
9011 set try
9012 if eval $compile; then
9013         val="$define"
9014         echo "You have fpos64_t."
9015 else
9016         val="$undef"
9017         echo "You do not have fpos64_t."
9018         case "$fpossize" in
9019         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9020         esac
9021 fi
9022 $rm -f try.* try
9023 set d_fpos64_t
9024 eval $setvar
9025
9026 hasstruct='varname=$1; struct=$2; shift; shift;
9027 while $test $# -ge 2; do
9028         case "$1" in
9029         $define) echo "#include <$2>";;
9030         esac ;
9031     shift 2;
9032 done > try.c;
9033 echo "int main () { struct $struct foo; }" >> try.c;
9034 set try;
9035 if eval $compile; then
9036         val="$define";
9037 else
9038         val="$undef";
9039 fi;
9040 set $varname;
9041 eval $setvar;
9042 $rm -f try.c try.o'
9043
9044 : see if this is a sys/param system
9045 set sys/param.h i_sysparam
9046 eval $inhdr
9047
9048 : see if this is a sys/mount.h system
9049 set sys/mount.h i_sysmount
9050 eval $inhdr
9051
9052 : see if sys/types.h has to be included
9053 set sys/types.h i_systypes
9054 eval $inhdr
9055
9056
9057 echo " "
9058 echo "Checking to see if your system supports struct fs_data..." >&4
9059 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9060 eval $hasstruct
9061 case "$d_fs_data_s" in
9062 "$define")      echo "Yes, it does."   ;;
9063 *)              echo "No, it doesn't." ;;
9064 esac
9065
9066 : see if fseeko exists
9067 set fseeko d_fseeko
9068 eval $inlibc
9069 case "$longsize" in
9070 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9071 esac
9072
9073 : see if fsetpos exists
9074 set fsetpos d_fsetpos
9075 eval $inlibc
9076
9077
9078 : see if fstatfs exists
9079 set fstatfs d_fstatfs
9080 eval $inlibc
9081
9082
9083 : see if statvfs exists
9084 set statvfs d_statvfs
9085 eval $inlibc
9086
9087 : see if fstatvfs exists
9088 set fstatvfs d_fstatvfs
9089 eval $inlibc
9090
9091
9092 : see if ftello exists
9093 set ftello d_ftello
9094 eval $inlibc
9095 case "$longsize" in
9096 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9097 esac
9098
9099 : see if getcwd exists
9100 set getcwd d_getcwd
9101 eval $inlibc
9102
9103
9104 : see if getfsstat exists
9105 set getfsstat d_getfsstat
9106 eval $inlibc
9107
9108 : see if getgrent exists
9109 set getgrent d_getgrent
9110 eval $inlibc
9111
9112 : see if gethostbyaddr exists
9113 set gethostbyaddr d_gethbyaddr
9114 eval $inlibc
9115
9116 : see if gethostbyname exists
9117 set gethostbyname d_gethbyname
9118 eval $inlibc
9119
9120 : see if gethostent exists
9121 set gethostent d_gethent
9122 eval $inlibc
9123
9124 : see how we will look up host name
9125 echo " "
9126 call=''
9127 if set gethostname val -f d_gethname; eval $csym; $val; then
9128         echo 'gethostname() found.' >&4
9129         d_gethname="$define"
9130         call=gethostname
9131 fi
9132 if set uname val -f d_uname; eval $csym; $val; then
9133         if ./xenix; then
9134                 $cat <<'EOM'
9135 uname() was found, but you're running xenix, and older versions of xenix
9136 have a broken uname(). If you don't really know whether your xenix is old
9137 enough to have a broken system call, use the default answer.
9138
9139 EOM
9140                 dflt=y
9141                 case "$d_uname" in
9142                 "$define") dflt=n;;
9143                 esac
9144                 rp='Is your uname() broken?'
9145                 . ./myread
9146                 case "$ans" in
9147                 n*) d_uname="$define"; call=uname;;
9148                 esac
9149         else
9150                 echo 'uname() found.' >&4
9151                 d_uname="$define"
9152                 case "$call" in
9153                 '') call=uname ;;
9154                 esac
9155         fi
9156 fi
9157 case "$d_gethname" in
9158 '') d_gethname="$undef";;
9159 esac
9160 case "$d_uname" in
9161 '') d_uname="$undef";;
9162 esac
9163 case "$d_uname$d_gethname" in
9164 *define*)
9165         dflt=n
9166         cat <<EOM
9167  
9168 Every now and then someone has a $call() that lies about the hostname
9169 but can't be fixed for political or economic reasons.  If you wish, I can
9170 pretend $call() isn't there and maybe compute hostname at run-time
9171 thanks to the '$phostname' command.
9172
9173 EOM
9174         rp="Shall I ignore $call() from now on?"
9175         . ./myread
9176         case "$ans" in
9177         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9178         esac;;
9179 esac
9180 case "$phostname" in
9181 '') aphostname='';;
9182 *) case "$aphostname" in
9183         /*) ;;
9184         *) set X $phostname
9185                 shift
9186                 file=$1
9187                 shift
9188                 file=`./loc $file $file $pth`
9189                 aphostname=`echo $file $*`
9190                 ;;
9191         esac
9192         ;;
9193 esac
9194 case "$d_uname$d_gethname" in
9195 *define*) ;;
9196 *)
9197         case "$phostname" in
9198         '')
9199                 echo "There will be no way for $package to get your hostname." >&4;;
9200         *)
9201         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9202                 ;;
9203         esac;;
9204 esac
9205 case "$d_phostname" in
9206 '') d_phostname="$undef";;
9207 esac
9208
9209 : see if this is a netdb.h system
9210 set netdb.h i_netdb
9211 eval $inhdr
9212
9213 : see if prototypes for various gethostxxx netdb.h functions are available
9214 echo " "
9215 set d_gethostprotos gethostent $i_netdb netdb.h
9216 eval $hasproto
9217
9218 : see if getlogin exists
9219 set getlogin d_getlogin
9220 eval $inlibc
9221
9222 : see if getmnt exists
9223 set getmnt d_getmnt
9224 eval $inlibc
9225
9226 : see if getmntent exists
9227 set getmntent d_getmntent
9228 eval $inlibc
9229
9230 : see if getnetbyaddr exists
9231 set getnetbyaddr d_getnbyaddr
9232 eval $inlibc
9233
9234 : see if getnetbyname exists
9235 set getnetbyname d_getnbyname
9236 eval $inlibc
9237
9238 : see if getnetent exists
9239 set getnetent d_getnent
9240 eval $inlibc
9241
9242 : see if prototypes for various getnetxxx netdb.h functions are available
9243 echo " "
9244 set d_getnetprotos getnetent $i_netdb netdb.h
9245 eval $hasproto
9246
9247
9248 : see if getprotobyname exists
9249 set getprotobyname d_getpbyname
9250 eval $inlibc
9251
9252 : see if getprotobynumber exists
9253 set getprotobynumber d_getpbynumber
9254 eval $inlibc
9255
9256 : see if getprotoent exists
9257 set getprotoent d_getpent
9258 eval $inlibc
9259
9260 : see if getpgid exists
9261 set getpgid d_getpgid
9262 eval $inlibc
9263
9264 : see if getpgrp2 exists
9265 set getpgrp2 d_getpgrp2
9266 eval $inlibc
9267
9268 : see if getppid exists
9269 set getppid d_getppid
9270 eval $inlibc
9271
9272 : see if getpriority exists
9273 set getpriority d_getprior
9274 eval $inlibc
9275
9276 : see if prototypes for various getprotoxxx netdb.h functions are available
9277 echo " "
9278 set d_getprotoprotos getprotoent $i_netdb netdb.h
9279 eval $hasproto
9280
9281 : see if getpwent exists
9282 set getpwent d_getpwent
9283 eval $inlibc
9284
9285
9286 : see if getservbyname exists
9287 set getservbyname d_getsbyname
9288 eval $inlibc
9289
9290 : see if getservbyport exists
9291 set getservbyport d_getsbyport
9292 eval $inlibc
9293
9294 : see if getservent exists
9295 set getservent d_getsent
9296 eval $inlibc
9297
9298 : see if prototypes for various getservxxx netdb.h functions are available
9299 echo " "
9300 set d_getservprotos getservent $i_netdb netdb.h
9301 eval $hasproto
9302
9303 : see if getspent exists
9304 set getspent d_getspent
9305 eval $inlibc
9306
9307 : see if getspnam exists
9308 set getspnam d_getspnam
9309 eval $inlibc
9310
9311 : see if gettimeofday or ftime exists
9312 set gettimeofday d_gettimeod
9313 eval $inlibc
9314 case "$d_gettimeod" in
9315 "$undef")
9316         set ftime d_ftime 
9317         eval $inlibc
9318         ;;
9319 *)
9320         val="$undef"; set d_ftime; eval $setvar
9321         ;;
9322 esac
9323 case "$d_gettimeod$d_ftime" in
9324 "$undef$undef")
9325         echo " "
9326         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9327         ;;
9328 esac
9329
9330 : see if this is an grp system
9331 set grp.h i_grp
9332 eval $inhdr
9333
9334 case "$i_grp" in
9335 $define)
9336         xxx=`./findhdr grp.h`
9337         $cppstdin $cppflags $cppminus < $xxx >$$.h
9338
9339         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9340                 val="$define"
9341         else
9342                 val="$undef"
9343         fi
9344         set d_grpasswd
9345         eval $setvar
9346
9347         $rm -f $$.h
9348         ;;
9349 *)
9350         val="$undef";
9351         set d_grpasswd; eval $setvar
9352         ;;
9353 esac
9354
9355 : see if hasmntopt exists
9356 set hasmntopt d_hasmntopt
9357 eval $inlibc
9358
9359 : see if this is a netinet/in.h or sys/in.h system
9360 set netinet/in.h i_niin sys/in.h i_sysin
9361 eval $inhdr
9362
9363 : see if arpa/inet.h has to be included
9364 set arpa/inet.h i_arpainet
9365 eval $inhdr
9366
9367 : see if htonl --and friends-- exists
9368 val=''
9369 set htonl val
9370 eval $inlibc
9371
9372 : Maybe they are macros.
9373 case "$val" in
9374 $undef)
9375         $cat >htonl.c <<EOM
9376 #include <stdio.h>
9377 #include <sys/types.h>
9378 #$i_niin I_NETINET_IN
9379 #$i_sysin I_SYS_IN
9380 #$i_arpainet I_ARPA_INET
9381 #ifdef I_NETINET_IN
9382 #include <netinet/in.h>
9383 #endif
9384 #ifdef I_SYS_IN
9385 #include <sys/in.h>
9386 #endif
9387 #ifdef I_ARPA_INET
9388 #include <arpa/inet.h>
9389 #endif
9390 #ifdef htonl
9391 printf("Defined as a macro.");
9392 #endif
9393 EOM
9394         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9395         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9396                 val="$define"
9397                 echo "But it seems to be defined as a macro." >&4
9398         fi
9399         $rm -f htonl.?
9400         ;;
9401 esac
9402 set d_htonl
9403 eval $setvar
9404
9405 : see if iconv exists
9406 set iconv d_iconv
9407 eval $inlibc
9408
9409 : index or strchr
9410 echo " "
9411 if set index val -f; eval $csym; $val; then
9412         if set strchr val -f d_strchr; eval $csym; $val; then
9413                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9414                         val="$define"
9415                         vali="$undef"
9416                         echo "strchr() found." >&4
9417                 else
9418                         val="$undef"
9419                         vali="$define"
9420                         echo "index() found." >&4
9421                 fi
9422         else
9423                 val="$undef"
9424                 vali="$define"
9425                 echo "index() found." >&4
9426         fi
9427 else
9428         if set strchr val -f d_strchr; eval $csym; $val; then
9429                 val="$define"
9430                 vali="$undef"
9431                 echo "strchr() found." >&4
9432         else
9433                 echo "No index() or strchr() found!" >&4
9434                 val="$undef"
9435                 vali="$undef"
9436         fi
9437 fi
9438 set d_strchr; eval $setvar
9439 val="$vali"
9440 set d_index; eval $setvar
9441
9442 : check whether inet_aton exists
9443 set inet_aton d_inetaton
9444 eval $inlibc
9445
9446 : see if inttypes.h is available
9447 : we want a real compile instead of Inhdr because some systems
9448 : have an inttypes.h which includes non-existent headers
9449 echo " "
9450 $cat >try.c <<EOCP
9451 #include <inttypes.h>
9452 int main() {
9453         static int32_t foo32 = 0x12345678;
9454 }
9455 EOCP
9456 set try
9457 if eval $compile; then
9458         echo "<inttypes.h> found." >&4
9459         val="$define"
9460 else
9461         echo "<inttypes.h> NOT found." >&4
9462         val="$undef"
9463 fi
9464 $rm -f try.c try
9465 set i_inttypes
9466 eval $setvar
9467
9468 : check for int64_t
9469 echo " "
9470 echo "Checking to see if you have int64_t..." >&4
9471 $cat >try.c <<EOCP
9472 #include <sys/types.h>
9473 #$i_inttypes I_INTTYPES
9474 #ifdef I_INTTYPES
9475 #include <inttypes.h>
9476 #endif
9477 int main() { int64_t x = 7; }
9478 EOCP
9479 set try
9480 if eval $compile; then
9481         val="$define"
9482         echo "You have int64_t."
9483 else
9484         val="$undef"
9485         echo "You do not have int64_t."
9486 fi
9487 $rm -f try try.*
9488 set d_int64_t
9489 eval $setvar
9490
9491 : Look for isascii
9492 echo " "
9493 $cat >isascii.c <<'EOCP'
9494 #include <stdio.h>
9495 #include <ctype.h>
9496 int main() {
9497         int c = 'A';
9498         if (isascii(c))
9499                 exit(0);
9500         else
9501                 exit(1);
9502 }
9503 EOCP
9504 set isascii
9505 if eval $compile; then
9506         echo "isascii() found." >&4
9507         val="$define"
9508 else
9509         echo "isascii() NOT found." >&4
9510         val="$undef"
9511 fi
9512 set d_isascii
9513 eval $setvar
9514 $rm -f isascii*
9515
9516 : see if killpg exists
9517 set killpg d_killpg
9518 eval $inlibc
9519
9520 : see if lchown exists
9521 echo " "
9522 $cat > try.c <<'EOCP'
9523 /* System header to define __stub macros and hopefully few prototypes,
9524     which can conflict with char lchown(); below.  */
9525 #include <assert.h>
9526 /* Override any gcc2 internal prototype to avoid an error.  */
9527 /* We use char because int might match the return type of a gcc2
9528    builtin and then its argument prototype would still apply.  */
9529 char lchown();
9530 int main() {
9531     /*  The GNU C library defines this for functions which it implements
9532         to always fail with ENOSYS.  Some functions are actually named
9533         something starting with __ and the normal name is an alias.  */
9534 #if defined (__stub_lchown) || defined (__stub___lchown)
9535 choke me
9536 #else
9537 lchown();
9538 #endif
9539 ; return 0; }
9540 EOCP
9541 set try
9542 if eval $compile; then
9543     $echo "lchown() found." >&4
9544     val="$define"
9545 else
9546     $echo "lchown() NOT found." >&4
9547     val="$undef"
9548 fi
9549 set d_lchown
9550 eval $setvar
9551
9552 : See if number of significant digits in a double precision number is known
9553 echo " "
9554 $cat >ldbl_dig.c <<EOM
9555 #$i_limits I_LIMITS
9556 #$i_float I_FLOAT
9557 #ifdef I_LIMITS
9558 #include <limits.h>
9559 #endif
9560 #ifdef I_FLOAT
9561 #include <float.h>
9562 #endif
9563 #ifdef LDBL_DIG
9564 printf("Contains LDBL_DIG");
9565 #endif
9566 EOM
9567 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9568 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9569         echo "LDBL_DIG found." >&4
9570         val="$define"
9571 else
9572         echo "LDBL_DIG NOT found." >&4
9573         val="$undef"
9574 fi
9575 $rm -f ldbl_dig.?
9576 set d_ldbl_dig
9577 eval $setvar
9578
9579 : see if link exists
9580 set link d_link
9581 eval $inlibc
9582
9583 : see if localeconv exists
9584 set localeconv d_locconv
9585 eval $inlibc
9586
9587 : see if lockf exists
9588 set lockf d_lockf
9589 eval $inlibc
9590
9591 : check for long long
9592 echo " "
9593 echo "Checking to see if you have long long..." >&4
9594 echo 'int main() { long long x = 7; return 0; }' > try.c
9595 set try
9596 if eval $compile; then
9597         val="$define"
9598         echo "You have have long long."
9599 else
9600         val="$undef"
9601         echo "You do not have long long."
9602 fi
9603 $rm try.*
9604 set d_longlong
9605 eval $setvar
9606
9607 : check for length of long long
9608 case "${d_longlong}${longlongsize}" in
9609 $define)
9610         echo " "
9611         echo "Checking to see how big your long longs are..." >&4
9612         $cat >try.c <<'EOCP'
9613 #include <stdio.h>
9614 int main()
9615 {
9616     printf("%d\n", (int)sizeof(long long));
9617     return(0);
9618 }
9619 EOCP
9620         set try
9621         if eval $compile_ok; then
9622                 longlongsize=`./try$exe_ext`
9623                 echo "Your long longs are $longlongsize bytes long."
9624         else
9625                 dflt='8'
9626                 echo " "
9627                 echo "(I can't seem to compile the test program.  Guessing...)"
9628                 rp="What is the size of a long long (in bytes)?"
9629                 . ./myread
9630                 longlongsize="$ans"
9631         fi
9632         if $test "X$longsize" = "X$longlongsize"; then
9633                 echo "(That isn't any different from an ordinary long.)"
9634         fi      
9635         ;;
9636 esac
9637 $rm -f try.* try
9638
9639 : see if prototype for lseek is available
9640 echo " "
9641 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9642 eval $hasproto
9643
9644 : see if lstat exists
9645 set lstat d_lstat
9646 eval $inlibc
9647
9648 : see if madvise exists
9649 set madvise d_madvise
9650 eval $inlibc
9651
9652 : see if mblen exists
9653 set mblen d_mblen
9654 eval $inlibc
9655
9656 : see if mbstowcs exists
9657 set mbstowcs d_mbstowcs
9658 eval $inlibc
9659
9660 : see if mbtowc exists
9661 set mbtowc d_mbtowc
9662 eval $inlibc
9663
9664 : see if memchr exists
9665 set memchr d_memchr
9666 eval $inlibc
9667
9668 : see if memcmp exists
9669 set memcmp d_memcmp
9670 eval $inlibc
9671
9672 : see if memcpy exists
9673 set memcpy d_memcpy
9674 eval $inlibc
9675
9676 : see if memmove exists
9677 set memmove d_memmove
9678 eval $inlibc
9679
9680 : see if memset exists
9681 set memset d_memset
9682 eval $inlibc
9683
9684 : see if mkdir exists
9685 set mkdir d_mkdir
9686 eval $inlibc
9687
9688 : see if mkdtemp exists
9689 set mkdtemp d_mkdtemp
9690 eval $inlibc
9691
9692 : see if mkfifo exists
9693 set mkfifo d_mkfifo
9694 eval $inlibc
9695
9696 : see if mkstemp exists
9697 set mkstemp d_mkstemp
9698 eval $inlibc
9699
9700 : see if mkstemps exists
9701 set mkstemps d_mkstemps
9702 eval $inlibc
9703
9704 : see if mktime exists
9705 set mktime d_mktime
9706 eval $inlibc
9707
9708 : see if this is a sys/mman.h system
9709 set sys/mman.h i_sysmman
9710 eval $inhdr
9711
9712 : see if mmap exists
9713 set mmap d_mmap
9714 eval $inlibc
9715 : see what shmat returns
9716 : default to something harmless
9717 mmaptype='void *'
9718 case "$i_sysmman$d_mmap" in
9719 "$define$define")
9720         $cat >mmap.c <<'END'
9721 #include <sys/mman.h>
9722 void *mmap();
9723 END
9724         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9725                 mmaptype='void *'
9726         else
9727                 mmaptype='caddr_t'
9728         fi
9729         echo "and it returns ($mmaptype)." >&4
9730         ;;
9731 esac
9732
9733
9734
9735 : see if mprotect exists
9736 set mprotect d_mprotect
9737 eval $inlibc
9738
9739 : see if msgctl exists
9740 set msgctl d_msgctl
9741 eval $inlibc
9742
9743 : see if msgget exists
9744 set msgget d_msgget
9745 eval $inlibc
9746
9747 : see if msgsnd exists
9748 set msgsnd d_msgsnd
9749 eval $inlibc
9750
9751 : see if msgrcv exists
9752 set msgrcv d_msgrcv
9753 eval $inlibc
9754
9755 : see how much of the 'msg*(2)' library is present.
9756 h_msg=true
9757 echo " "
9758 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9759 *"$undef"*) h_msg=false;;
9760 esac
9761 case "$osname" in
9762 freebsd)
9763     case "`ipcs 2>&1`" in
9764     "SVID messages"*"not configured"*)
9765         echo "Your $osname does not have the msg*(2) configured." >&4
9766         h_msg=false
9767         val="$undef"
9768         set msgctl d_msgctl
9769         eval $setvar
9770         set msgget d_msgget
9771         eval $setvar
9772         set msgsnd d_msgsnd
9773         eval $setvar
9774         set msgrcv d_msgrcv
9775         eval $setvar
9776         ;;
9777     esac
9778     ;;
9779 esac
9780 : we could also check for sys/ipc.h ...
9781 if $h_msg && $test `./findhdr sys/msg.h`; then
9782         echo "You have the full msg*(2) library." >&4
9783         val="$define"
9784 else
9785         echo "You don't have the full msg*(2) library." >&4
9786         val="$undef"
9787 fi
9788 set d_msg
9789 eval $setvar
9790
9791 : see if msync exists
9792 set msync d_msync
9793 eval $inlibc
9794
9795 : see if munmap exists
9796 set munmap d_munmap
9797 eval $inlibc
9798
9799 : see if nice exists
9800 set nice d_nice
9801 eval $inlibc
9802
9803
9804 echo " "
9805 echo "Checking which 64-bit integer type we could use..." >&4
9806
9807 case "$intsize" in
9808 8) val=int
9809    set quadtype
9810    eval $setvar
9811    val='"unsigned int"'
9812    set uquadtype
9813    eval $setvar
9814    quadkind=1
9815    ;;
9816 *) case "$longsize" in
9817    8) val=long
9818       set quadtype
9819       eval $setvar
9820       val='"unsigned long"'
9821       set uquadtype
9822       eval $setvar
9823       quadkind=2
9824       ;;
9825    *) case "$d_longlong:$longlongsize" in
9826       define:8)
9827         val='"long long"'
9828         set quadtype
9829         eval $setvar
9830         val='"unsigned long long"'
9831         set uquadtype
9832         eval $setvar
9833         quadkind=3
9834         ;;
9835       *) case "$d_int64_t" in
9836          define)
9837            val=int64_t
9838            set quadtype
9839            eval $setvar
9840            val=uint64_t
9841            set uquadtype
9842            eval $setvar
9843            quadkind=4
9844            ;;
9845          esac
9846          ;;
9847       esac
9848       ;;
9849    esac
9850    ;;
9851 esac
9852
9853 case "$quadtype" in
9854 '')     echo "Alas, no 64-bit integer types in sight." >&4
9855         d_quad="$undef"
9856         ;;
9857 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9858             verb="will"
9859         else
9860             verb="could"
9861         fi
9862         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9863         d_quad="$define"
9864         ;;
9865 esac
9866
9867 : check for length of character
9868 echo " "
9869 case "$charsize" in
9870 '')
9871         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9872         $cat >try.c <<'EOCP'
9873 #include <stdio.h>
9874 int main()
9875 {
9876     printf("%d\n", (int)sizeof(char));
9877     exit(0);
9878 }
9879 EOCP
9880         set try
9881         if eval $compile_ok; then
9882                 dflt=`./try`
9883         else
9884                 dflt='1'
9885                 echo "(I can't seem to compile the test program.  Guessing...)"
9886         fi
9887         ;;
9888 *)
9889         dflt="$charsize"
9890         ;;
9891 esac
9892 rp="What is the size of a character (in bytes)?"
9893 . ./myread
9894 charsize="$ans"
9895 $rm -f try.c try
9896
9897
9898 echo " "
9899 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9900
9901 case "$use64bitint:$d_quad:$quadtype" in
9902 define:define:?*)
9903         ivtype="$quadtype"
9904         uvtype="$uquadtype"
9905         ivsize=8
9906         uvsize=8
9907         ;;
9908 *)      ivtype="long"
9909         uvtype="unsigned long"
9910         ivsize=$longsize
9911         uvsize=$longsize
9912         ;;
9913 esac
9914
9915 case "$uselongdouble:$d_longdbl" in
9916 define:define)
9917         nvtype="long double"
9918         nvsize=$longdblsize
9919         ;;
9920 *)      nvtype=double
9921         nvsize=$doublesize
9922         ;;
9923 esac
9924
9925 $echo "(IV will be "$ivtype", $ivsize bytes)"
9926 $echo "(UV will be "$uvtype", $uvsize bytes)"
9927 $echo "(NV will be "$nvtype", $nvsize bytes)"
9928
9929 $cat >try.c <<EOCP
9930 #$i_inttypes I_INTTYPES
9931 #ifdef I_INTTYPES
9932 #include <inttypes.h>
9933 #endif
9934 #include <stdio.h>
9935 int main() {
9936 #ifdef INT8
9937    int8_t i =  INT8_MAX;
9938   uint8_t u = UINT8_MAX;
9939   printf("int8_t\n");
9940 #endif
9941 #ifdef INT16
9942    int16_t i =  INT16_MAX;
9943   uint16_t i = UINT16_MAX;
9944   printf("int16_t\n");
9945 #endif
9946 #ifdef INT32
9947    int32_t i =  INT32_MAX;
9948   uint32_t u = UINT32_MAX;
9949   printf("int32_t\n");
9950 #endif
9951 }
9952 EOCP
9953
9954 case "$i8type" in
9955 '')     case "$charsize" in
9956         1)      i8type=char
9957                 u8type="unsigned char"
9958                 i8size=$charsize
9959                 u8size=$charsize
9960                 ;;
9961         esac
9962         ;;
9963 esac
9964 case "$i8type" in
9965 '')     set try -DINT8
9966         if eval $compile; then
9967                 case "`./try$exe_ext`" in
9968                 int8_t) i8type=int8_t
9969                         u8type=uint8_t
9970                         i8size=1
9971                         u8size=1
9972                         ;;
9973                 esac
9974         fi
9975         ;;
9976 esac
9977 case "$i8type" in
9978 '')     if $test $charsize -ge 1; then
9979                 i8type=char
9980                 u8type="unsigned char"
9981                 i8size=$charsize
9982                 u8size=$charsize
9983         fi
9984         ;;
9985 esac
9986
9987 case "$i16type" in
9988 '')     case "$shortsize" in
9989         2)      i16type=short
9990                 u16type="unsigned short"
9991                 i16size=$shortsize
9992                 u16size=$shortsize
9993                 ;;
9994         esac
9995         ;;
9996 esac
9997 case "$i16type" in
9998 '')     set try -DINT16
9999         if eval $compile; then
10000                 case "`./try$exe_ext`" in
10001                 int16_t)
10002                         i16type=int16_t
10003                         u16type=uint16_t
10004                         i16size=2
10005                         u16size=2
10006                         ;;
10007                 esac
10008         fi
10009         ;;
10010 esac
10011 case "$i16type" in
10012 '')     if $test $shortsize -ge 2; then
10013                 i16type=short
10014                 u16type="unsigned short"
10015                 i16size=$shortsize
10016                 u16size=$shortsize
10017         fi
10018         ;;
10019 esac
10020
10021 case "$i32type" in
10022 '')     case "$longsize" in
10023         4)      i32type=long
10024                 u32type="unsigned long"
10025                 i32size=$longsize
10026                 u32size=$longsize
10027                 ;;
10028         *)      case "$intsize" in
10029                 4)      i32type=int
10030                         u32type="unsigned int"
10031                         i32size=$intsize
10032                         u32size=$intsize
10033                         ;;
10034                 esac
10035                 ;;
10036         esac
10037         ;;
10038 esac
10039 case "$i32type" in
10040 '')     set try -DINT32
10041         if eval $compile; then
10042                 case "`./try$exe_ext`" in
10043                 int32_t)
10044                         i32type=int32_t
10045                         u32type=uint32_t
10046                         i32size=4
10047                         u32size=4
10048                         ;;
10049                 esac
10050         fi
10051         ;;
10052 esac
10053 case "$i32type" in
10054 '')     if $test $intsize -ge 4; then
10055                 i32type=int
10056                 u32type="unsigned int"
10057                 i32size=$intsize
10058                 u32size=$intsize
10059         fi
10060         ;;
10061 esac
10062
10063 case "$i64type" in
10064 '')     case "$d_quad:$quadtype" in
10065         define:?*)
10066                 i64type="$quadtype"
10067                 u64type="$uquadtype"
10068                 i64size=8
10069                 u64size=8
10070                 ;;
10071         esac
10072         ;;
10073 esac
10074
10075 $echo "Checking whether your NVs can preserve your UVs..." >&4
10076 $cat <<EOP >try.c
10077 #include <stdio.h>
10078 int main() {
10079     $uvtype k = ($uvtype)~0, l;
10080     $nvtype d;
10081     l = k;
10082     d = ($nvtype)l;
10083     l = ($uvtype)d;
10084     if (l == k)
10085        printf("preserve\n");
10086     exit(0);
10087 }
10088 EOP
10089 set try
10090 if eval $compile; then
10091         case "`./try$exe_ext`" in
10092         preserve) d_nv_preserves_uv="$define" ;;
10093         esac
10094 fi      
10095 case "$d_nv_preserves_uv" in
10096 $define) $echo "Yes, they can."  2>&1 ;;
10097 *)       $echo "No, they can't." 2>&1
10098          d_nv_preserves_uv="$undef"
10099          ;;
10100 esac
10101
10102 $rm -f try.* try
10103
10104
10105 : check for off64_t
10106 echo " "
10107 echo "Checking to see if you have off64_t..." >&4
10108 $cat >try.c <<EOCP
10109 #include <sys/types.h>
10110 #include <unistd.h>
10111 int main() { off64_t x = 7; }
10112 EOCP
10113 set try
10114 if eval $compile; then
10115         val="$define"
10116         echo "You have off64_t."
10117 else
10118         val="$undef"
10119         echo "You do not have off64_t."
10120         case "$lseeksize" in
10121         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10122         esac
10123 fi
10124 $rm -f try.* try
10125 set d_off64_t
10126 eval $setvar
10127
10128 : see if POSIX threads are available
10129 set pthread.h i_pthread
10130 eval $inhdr
10131
10132
10133
10134
10135 : how to create joinable pthreads
10136 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10137         echo " "
10138         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10139         $cat >try.c <<'EOCP'
10140 #include <pthread.h>
10141 int main() {
10142     int detachstate = JOINABLE;
10143 }
10144 EOCP
10145         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10146         if eval $compile; then
10147                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10148                 val="$undef" # Yes, undef.
10149                 set d_old_pthread_create_joinable
10150                 eval $setvar
10151                 val=""
10152                 set old_pthread_create_joinable
10153                 eval $setvar
10154         else
10155                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10156                 if eval $compile; then
10157                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10158                         val="$define"
10159                         set d_old_pthread_create_joinable
10160                         eval $setvar
10161                         val=PTHREAD_CREATE_UNDETACHED
10162                         set old_pthread_create_joinable
10163                         eval $setvar
10164                 else            
10165                         set try -DJOINABLE=__UNDETACHED
10166                         if eval $compile; then
10167                                 echo "You seem to use __UNDETACHED." >&4
10168                                 val="$define"
10169                                 set d_old_pthread_create_joinable
10170                                 eval $setvar
10171                                 val=__UNDETACHED
10172                                 set old_pthread_create_joinable
10173                                 eval $setvar
10174                         else
10175                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10176                                 val="$define"
10177                                 set d_old_pthread_create_joinable
10178                                 eval $setvar
10179                                 val=0
10180                                 set old_pthread_create_joinable
10181                                 eval $setvar
10182                         fi
10183                 fi
10184         fi
10185         $rm -f try try.*
10186 else
10187     d_old_pthread_create_joinable="$undef"
10188     old_pthread_create_joinable=""
10189 fi
10190
10191 : see if pause exists
10192 set pause d_pause
10193 eval $inlibc
10194
10195 : see if pipe exists
10196 set pipe d_pipe
10197 eval $inlibc
10198
10199 : see if poll exists
10200 set poll d_poll
10201 eval $inlibc
10202
10203
10204 : see whether the various POSIXish _yields exist
10205 $cat >try.c <<EOP
10206 #include <pthread.h>
10207 #include <stdio.h>
10208 int main() {
10209 #ifdef SCHED_YIELD
10210         sched_yield();
10211 #else
10212 #ifdef PTHREAD_YIELD
10213         pthread_yield();
10214 #else
10215 #ifdef PTHREAD_YIELD_NULL
10216         pthread_yield(NULL);
10217 #endif
10218 #endif
10219 #endif
10220 }
10221 EOP
10222 : see if sched_yield exists
10223 set try -DSCHED_YIELD
10224 if eval $compile; then
10225     val="$define"
10226     sched_yield='sched_yield()'
10227 else
10228     val="$undef"
10229 fi
10230 case "$usethreads" in
10231 $define)
10232         case "$val" in
10233         $define) echo 'sched_yield() found.' >&4        ;;
10234         *)       echo 'sched_yield() NOT found.' >&4    ;;
10235         esac
10236 esac
10237 set d_sched_yield
10238 eval $setvar
10239
10240 : see if pthread_yield exists
10241 set try -DPTHREAD_YIELD
10242 if eval $compile; then
10243     val="$define"
10244     case "$sched_yield" in
10245     '') sched_yield='pthread_yield()' ;;
10246     esac
10247 else
10248     set try -DPTHREAD_YIELD_NULL
10249     if eval $compile; then
10250         val="$define"
10251         case "$sched_yield" in
10252         '') sched_yield='pthread_yield(NULL)' ;;
10253         esac
10254     else
10255         val="$undef"
10256     fi
10257 fi
10258 case "$usethreads" in
10259 $define)
10260         case "$val" in
10261         $define) echo 'pthread_yield() found.' >&4      ;;
10262         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10263         esac
10264         ;;
10265 esac
10266 set d_pthread_yield
10267 eval $setvar
10268
10269 case "$sched_yield" in
10270 '') sched_yield=undef ;;
10271 esac
10272
10273 $rm -f try try.*
10274
10275 : see if this is a pwd.h system
10276 set pwd.h i_pwd
10277 eval $inhdr
10278
10279 case "$i_pwd" in
10280 $define)
10281         xxx=`./findhdr pwd.h`
10282         $cppstdin $cppflags $cppminus < $xxx >$$.h
10283
10284         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10285                 val="$define"
10286         else
10287                 val="$undef"
10288         fi
10289         set d_pwquota
10290         eval $setvar
10291
10292         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10293                 val="$define"
10294         else
10295                 val="$undef"
10296         fi
10297         set d_pwage
10298         eval $setvar
10299
10300         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10301                 val="$define"
10302         else
10303                 val="$undef"
10304         fi
10305         set d_pwchange
10306         eval $setvar
10307
10308         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10309                 val="$define"
10310         else
10311                 val="$undef"
10312         fi
10313         set d_pwclass
10314         eval $setvar
10315
10316         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10317                 val="$define"
10318         else
10319                 val="$undef"
10320         fi
10321         set d_pwexpire
10322         eval $setvar
10323
10324         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10325                 val="$define"
10326         else
10327                 val="$undef"
10328         fi
10329         set d_pwcomment
10330         eval $setvar
10331
10332         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10333                 val="$define"
10334         else
10335                 val="$undef"
10336         fi
10337         set d_pwgecos
10338         eval $setvar
10339
10340         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10341                 val="$define"
10342         else
10343                 val="$undef"
10344         fi
10345         set d_pwpasswd
10346         eval $setvar
10347
10348         $rm -f $$.h
10349         ;;
10350 *)
10351         val="$undef"; 
10352         set d_pwquota; eval $setvar
10353         set d_pwage; eval $setvar
10354         set d_pwchange; eval $setvar
10355         set d_pwclass; eval $setvar
10356         set d_pwexpire; eval $setvar
10357         set d_pwcomment; eval $setvar
10358         set d_pwgecos; eval $setvar
10359         set d_pwpasswd; eval $setvar
10360         ;;
10361 esac
10362
10363 : see if readdir and friends exist
10364 set readdir d_readdir
10365 eval $inlibc
10366 set seekdir d_seekdir
10367 eval $inlibc
10368 set telldir d_telldir
10369 eval $inlibc
10370 set rewinddir d_rewinddir
10371 eval $inlibc
10372
10373 : see if readlink exists
10374 set readlink d_readlink
10375 eval $inlibc
10376
10377 : see if rename exists
10378 set rename d_rename
10379 eval $inlibc
10380
10381 : see if rmdir exists
10382 set rmdir d_rmdir
10383 eval $inlibc
10384
10385 : see if memory.h is available.
10386 val=''
10387 set memory.h val
10388 eval $inhdr
10389
10390 : See if it conflicts with string.h
10391 case "$val" in
10392 $define)
10393         case "$strings" in
10394         '') ;;
10395         *)
10396                 $cppstdin $cppflags $cppminus < $strings > mem.h
10397                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10398                         echo " "
10399                         echo "We won't be including <memory.h>."
10400                         val="$undef"
10401                 fi
10402                 $rm -f mem.h
10403                 ;;
10404         esac
10405 esac
10406 set i_memory
10407 eval $setvar
10408
10409 : can bcopy handle overlapping blocks?
10410 val="$undef"
10411 case "$d_bcopy" in
10412 "$define")
10413         echo " "
10414         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10415         $cat >try.c <<EOCP
10416 #$i_memory I_MEMORY
10417 #$i_stdlib I_STDLIB
10418 #$i_string I_STRING
10419 #$i_unistd I_UNISTD
10420 EOCP
10421         $cat >>try.c <<'EOCP'
10422 #include <stdio.h>
10423 #ifdef I_MEMORY
10424 #  include <memory.h>
10425 #endif
10426 #ifdef I_STDLIB
10427 #  include <stdlib.h>
10428 #endif
10429 #ifdef I_STRING
10430 #  include <string.h>
10431 #else
10432 #  include <strings.h>
10433 #endif
10434 #ifdef I_UNISTD
10435 #  include <unistd.h>  /* Needed for NetBSD */
10436 #endif
10437 int main()
10438 {
10439 char buf[128], abc[128];
10440 char *b;
10441 int len;
10442 int off;
10443 int align;
10444
10445 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10446
10447 for (align = 7; align >= 0; align--) {
10448         for (len = 36; len; len--) {
10449                 b = buf+align;
10450                 bcopy(abc, b, len);
10451                 for (off = 1; off <= len; off++) {
10452                         bcopy(b, b+off, len);
10453                         bcopy(b+off, b, len);
10454                         if (bcmp(b, abc, len))
10455                                 exit(1);
10456                 }
10457         }
10458 }
10459 exit(0);
10460 }
10461 EOCP
10462         set try
10463         if eval $compile_ok; then
10464                 if ./try 2>/dev/null; then
10465                         echo "Yes, it can."
10466                         val="$define"
10467                 else
10468                         echo "It can't, sorry."
10469                         case "$d_memmove" in
10470                         "$define") echo "But that's Ok since you have memmove()." ;;
10471                         esac
10472                 fi
10473         else
10474                 echo "(I can't compile the test program, so we'll assume not...)"
10475                 case "$d_memmove" in
10476                 "$define") echo "But that's Ok since you have memmove()." ;;
10477                 esac
10478         fi
10479         ;;
10480 esac
10481 $rm -f try.* try core
10482 set d_safebcpy
10483 eval $setvar
10484
10485 : can memcpy handle overlapping blocks?
10486 val="$undef"
10487 case "$d_memcpy" in
10488 "$define")
10489         echo " "
10490         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10491         $cat >try.c <<EOCP
10492 #$i_memory I_MEMORY
10493 #$i_stdlib I_STDLIB
10494 #$i_string I_STRING
10495 #$i_unistd I_UNISTD
10496 EOCP
10497         $cat >>try.c <<'EOCP'
10498 #include <stdio.h>
10499 #ifdef I_MEMORY
10500 #  include <memory.h>
10501 #endif
10502 #ifdef I_STDLIB
10503 #  include <stdlib.h>
10504 #endif
10505 #ifdef I_STRING
10506 #  include <string.h>
10507 #else
10508 #  include <strings.h>
10509 #endif
10510 #ifdef I_UNISTD
10511 #  include <unistd.h>  /* Needed for NetBSD */
10512 #endif
10513 int main()
10514 {
10515 char buf[128], abc[128];
10516 char *b;
10517 int len;
10518 int off;
10519 int align;
10520
10521 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10522    try to store the string in read-only memory. */
10523 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10524
10525 for (align = 7; align >= 0; align--) {
10526         for (len = 36; len; len--) {
10527                 b = buf+align;
10528                 memcpy(b, abc, len);
10529                 for (off = 1; off <= len; off++) {
10530                         memcpy(b+off, b, len);
10531                         memcpy(b, b+off, len);
10532                         if (memcmp(b, abc, len))
10533                                 exit(1);
10534                 }
10535         }
10536 }
10537 exit(0);
10538 }
10539 EOCP
10540         set try
10541         if eval $compile_ok; then
10542                 if ./try 2>/dev/null; then
10543                         echo "Yes, it can."
10544                         val="$define"
10545                 else
10546                         echo "It can't, sorry."
10547                         case "$d_memmove" in
10548                         "$define") echo "But that's Ok since you have memmove()." ;;
10549                         esac
10550                 fi
10551         else
10552                 echo "(I can't compile the test program, so we'll assume not...)"
10553                 case "$d_memmove" in
10554                 "$define") echo "But that's Ok since you have memmove()." ;;
10555                 esac
10556         fi
10557         ;;
10558 esac
10559 $rm -f try.* try core
10560 set d_safemcpy
10561 eval $setvar
10562
10563 : can memcmp be trusted to compare relative magnitude?
10564 val="$undef"
10565 case "$d_memcmp" in
10566 "$define")
10567         echo " "
10568         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10569         $cat >try.c <<EOCP
10570 #$i_memory I_MEMORY
10571 #$i_stdlib I_STDLIB
10572 #$i_string I_STRING
10573 #$i_unistd I_UNISTD
10574 EOCP
10575         $cat >>try.c <<'EOCP'
10576 #include <stdio.h>
10577 #ifdef I_MEMORY
10578 #  include <memory.h>
10579 #endif
10580 #ifdef I_STDLIB
10581 #  include <stdlib.h>
10582 #endif
10583 #ifdef I_STRING
10584 #  include <string.h>
10585 #else
10586 #  include <strings.h>
10587 #endif
10588 #ifdef I_UNISTD
10589 #  include <unistd.h>  /* Needed for NetBSD */
10590 #endif
10591 int main()
10592 {
10593 char a = -1;
10594 char b = 0;
10595 if ((a < b) && memcmp(&a, &b, 1) < 0)
10596         exit(1);
10597 exit(0);
10598 }
10599 EOCP
10600         set try
10601         if eval $compile_ok; then
10602                 if ./try 2>/dev/null; then
10603                         echo "Yes, it can."
10604                         val="$define"
10605                 else
10606                         echo "No, it can't (it uses signed chars)."
10607                 fi
10608         else
10609                 echo "(I can't compile the test program, so we'll assume not...)"
10610         fi
10611         ;;
10612 esac
10613 $rm -f try.* try core
10614 set d_sanemcmp
10615 eval $setvar
10616
10617 : see if select exists
10618 set select d_select
10619 eval $inlibc
10620
10621 : see if semctl exists
10622 set semctl d_semctl
10623 eval $inlibc
10624
10625 : see if semget exists
10626 set semget d_semget
10627 eval $inlibc
10628
10629 : see if semop exists
10630 set semop d_semop
10631 eval $inlibc
10632
10633 : see how much of the 'sem*(2)' library is present.
10634 h_sem=true
10635 echo " "
10636 case "$d_semctl$d_semget$d_semop" in
10637 *"$undef"*) h_sem=false;;
10638 esac
10639 case "$osname" in
10640 freebsd)
10641     case "`ipcs 2>&1`" in
10642     "SVID messages"*"not configured"*)
10643         echo "Your $osname does not have the sem*(2) configured." >&4
10644         h_sem=false
10645         val="$undef"
10646         set semctl d_semctl
10647         eval $setvar
10648         set semget d_semget
10649         eval $setvar
10650         set semop d_semop
10651         eval $setvar
10652         ;;
10653     esac
10654     ;;
10655 esac
10656 : we could also check for sys/ipc.h ...
10657 if $h_sem && $test `./findhdr sys/sem.h`; then
10658         echo "You have the full sem*(2) library." >&4
10659         val="$define"
10660 else
10661         echo "You don't have the full sem*(2) library." >&4
10662         val="$undef"
10663 fi
10664 set d_sem
10665 eval $setvar
10666
10667 : see whether sys/sem.h defines union semun
10668 echo " "
10669 $cat > try.c <<'END'
10670 #include <sys/types.h>
10671 #include <sys/ipc.h>
10672 #include <sys/sem.h>
10673 int main () { union semun semun; semun.buf = 0; }
10674 END
10675 set try
10676 if eval $compile; then
10677     echo "You have union semun in <sys/sem.h>." >&4
10678     val="$define"
10679 else
10680     echo "You do not have union semun in <sys/sem.h>." >&4
10681     val="$undef"
10682 fi
10683 $rm -f try try.c try.h
10684 set d_union_semun
10685 eval $setvar
10686
10687 : see how to do semctl IPC_STAT
10688 case "$d_sem" in
10689 $define)
10690     : see whether semctl IPC_STAT can use union semun
10691     echo " "
10692     $cat > try.h <<END
10693 #ifndef S_IRUSR
10694 #   ifdef S_IREAD
10695 #       define S_IRUSR S_IREAD
10696 #       define S_IWUSR S_IWRITE
10697 #       define S_IXUSR S_IEXEC
10698 #   else
10699 #       define S_IRUSR 0400
10700 #       define S_IWUSR 0200
10701 #       define S_IXUSR 0100
10702 #   endif
10703 #   define S_IRGRP (S_IRUSR>>3)
10704 #   define S_IWGRP (S_IWUSR>>3)
10705 #   define S_IXGRP (S_IXUSR>>3)
10706 #   define S_IROTH (S_IRUSR>>6)
10707 #   define S_IWOTH (S_IWUSR>>6)
10708 #   define S_IXOTH (S_IXUSR>>6)
10709 #endif
10710 #ifndef S_IRWXU
10711 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10712 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10713 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10714 #endif
10715 END
10716
10717     $cat > try.c <<END
10718 #include <sys/types.h>
10719 #include <sys/ipc.h>
10720 #include <sys/sem.h>
10721 #include <sys/stat.h>
10722 #include <stdio.h>
10723 #include <errno.h>
10724 #include "try.h"
10725 #ifndef errno
10726 extern int errno;
10727 #endif
10728 #$d_union_semun HAS_UNION_SEMUN
10729 int main() {
10730     union semun
10731 #ifndef HAS_UNION_SEMUN
10732     {
10733         int val;
10734         struct semid_ds *buf;
10735         unsigned short *array;
10736     }
10737 #endif
10738     arg;
10739     int sem, st;
10740
10741 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10742     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10743     if (sem > -1) {
10744         struct semid_ds argbuf;
10745         arg.buf = &argbuf;
10746 #       ifdef IPC_STAT
10747         st = semctl(sem, 0, IPC_STAT, arg);
10748         if (st == 0)
10749             printf("semun\n");
10750         else
10751 #       endif /* IPC_STAT */
10752             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10753 #       ifdef IPC_RMID
10754         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10755 #       endif /* IPC_RMID */
10756             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10757     } else
10758 #endif /* IPC_PRIVATE && ... */
10759         printf("semget failed: errno = %d\n", errno);
10760   return 0;
10761 }
10762 END
10763     val="$undef"
10764     set try
10765     if eval $compile; then
10766         xxx=`./try`
10767         case "$xxx" in
10768         semun) val="$define" ;;
10769         esac
10770     fi
10771     $rm -f try try.c
10772     set d_semctl_semun
10773     eval $setvar
10774     case "$d_semctl_semun" in
10775     $define)
10776         echo "You can use union semun for semctl IPC_STAT." >&4
10777         also='also'
10778         ;;
10779     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10780         also=''
10781         ;;
10782     esac
10783
10784     : see whether semctl IPC_STAT can use struct semid_ds pointer
10785     $cat > try.c <<'END'
10786 #include <sys/types.h>
10787 #include <sys/ipc.h>
10788 #include <sys/sem.h>
10789 #include <sys/stat.h>
10790 #include "try.h"
10791 #include <stdio.h>
10792 #include <errno.h>
10793 #ifndef errno
10794 extern int errno;
10795 #endif
10796 int main() {
10797     struct semid_ds arg;
10798     int sem, st;
10799
10800 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10801     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10802     if (sem > -1) {
10803 #       ifdef IPC_STAT
10804         st = semctl(sem, 0, IPC_STAT, &arg);
10805         if (st == 0)
10806             printf("semid_ds\n");
10807         else
10808 #       endif /* IPC_STAT */
10809             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10810 #       ifdef IPC_RMID
10811         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10812 #       endif /* IPC_RMID */
10813             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10814     } else
10815 #endif /* IPC_PRIVATE && ... */
10816         printf("semget failed: errno = %d\n", errno);
10817
10818     return 0;
10819 }
10820 END
10821     val="$undef"
10822     set try
10823     if eval $compile; then
10824         xxx=`./try`
10825         case "$xxx" in
10826         semid_ds) val="$define" ;;
10827         esac
10828     fi
10829     $rm -f try try.c
10830     set d_semctl_semid_ds
10831     eval $setvar
10832     case "$d_semctl_semid_ds" in
10833     $define)
10834         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10835         ;;
10836     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10837         ;;
10838     esac
10839     $rm -f try.h
10840     ;;
10841 *)  val="$undef"
10842
10843     # We do not have the full sem*(2) library, so assume we can not
10844     # use either.
10845
10846     set d_semctl_semun
10847     eval $setvar
10848
10849     set d_semctl_semid_ds
10850     eval $setvar
10851     ;;
10852 esac
10853
10854 : see if setegid exists
10855 set setegid d_setegid
10856 eval $inlibc
10857
10858 : see if seteuid exists
10859 set seteuid d_seteuid
10860 eval $inlibc
10861
10862 : see if setgrent exists
10863 set setgrent d_setgrent
10864 eval $inlibc
10865
10866 : see if sethostent exists
10867 set sethostent d_sethent
10868 eval $inlibc
10869
10870 : see if setlinebuf exists
10871 set setlinebuf d_setlinebuf
10872 eval $inlibc
10873
10874 : see if setlocale exists
10875 set setlocale d_setlocale
10876 eval $inlibc
10877
10878 : see if setnetent exists
10879 set setnetent d_setnent
10880 eval $inlibc
10881
10882 : see if setprotoent exists
10883 set setprotoent d_setpent
10884 eval $inlibc
10885
10886 : see if setpgid exists
10887 set setpgid d_setpgid
10888 eval $inlibc
10889
10890 : see if setpgrp2 exists
10891 set setpgrp2 d_setpgrp2
10892 eval $inlibc
10893
10894 : see if setpriority exists
10895 set setpriority d_setprior
10896 eval $inlibc
10897
10898 : see if setpwent exists
10899 set setpwent d_setpwent
10900 eval $inlibc
10901
10902 : see if setregid exists
10903 set setregid d_setregid
10904 eval $inlibc
10905 set setresgid d_setresgid
10906 eval $inlibc
10907
10908 : see if setreuid exists
10909 set setreuid d_setreuid
10910 eval $inlibc
10911 set setresuid d_setresuid
10912 eval $inlibc
10913
10914 : see if setrgid exists
10915 set setrgid d_setrgid
10916 eval $inlibc
10917
10918 : see if setruid exists
10919 set setruid d_setruid
10920 eval $inlibc
10921
10922 : see if setservent exists
10923 set setservent d_setsent
10924 eval $inlibc
10925
10926 : see if setsid exists
10927 set setsid d_setsid
10928 eval $inlibc
10929
10930 : see if setspent exists
10931 set setspent d_setspent
10932 eval $inlibc
10933
10934 : see if setvbuf exists
10935 set setvbuf d_setvbuf
10936 eval $inlibc
10937
10938 : see if sfio.h is available
10939 set sfio.h i_sfio
10940 eval $inhdr
10941
10942
10943 : see if sfio library is available
10944 case "$i_sfio" in
10945 $define)
10946         val=''
10947         set sfreserve val
10948         eval $inlibc
10949         ;;
10950 *)
10951         val="$undef"
10952         ;;
10953 esac
10954 : Ok, but do we want to use it.
10955 case "$val" in
10956 $define)
10957         case "$usesfio" in
10958         true|$define|[yY]*) dflt='y';;
10959         *) dflt='n';;
10960         esac
10961         echo "$package can use the sfio library, but it is experimental."
10962         rp="You seem to have sfio available, do you want to try using it?"
10963         . ./myread
10964         case "$ans" in
10965         y|Y) ;;
10966         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10967                 val="$undef"
10968                 : Remove sfio from list of libraries to use
10969                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10970                 shift
10971                 libs="$*"
10972                 echo "libs = $libs" >&4
10973                 ;;
10974         esac
10975         ;;
10976 *)      case "$usesfio" in
10977         true|$define|[yY]*)
10978                 echo "Sorry, cannot find sfio on this machine" >&4
10979                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10980                 ;;
10981         esac
10982         ;;
10983 esac
10984 set d_sfio
10985 eval $setvar
10986 case "$d_sfio" in
10987 $define) usesfio='true';;
10988 *) usesfio='false';;
10989 esac
10990
10991 : see if shmctl exists
10992 set shmctl d_shmctl
10993 eval $inlibc
10994
10995 : see if shmget exists
10996 set shmget d_shmget
10997 eval $inlibc
10998
10999 : see if shmat exists
11000 set shmat d_shmat
11001 eval $inlibc
11002 : see what shmat returns
11003 case "$d_shmat" in
11004 "$define")
11005         $cat >shmat.c <<'END'
11006 #include <sys/shm.h>
11007 void *shmat();
11008 END
11009         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11010                 shmattype='void *'
11011         else
11012                 shmattype='char *'
11013         fi
11014         echo "and it returns ($shmattype)." >&4
11015         : see if a prototype for shmat is available
11016         xxx=`./findhdr sys/shm.h`
11017         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11018         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11019                 val="$define"
11020         else
11021                 val="$undef"
11022         fi
11023         $rm -f shmat.[co]
11024         ;;
11025 *)
11026         val="$undef"
11027         ;;
11028 esac
11029 set d_shmatprototype
11030 eval $setvar
11031
11032 : see if shmdt exists
11033 set shmdt d_shmdt
11034 eval $inlibc
11035
11036 : see how much of the 'shm*(2)' library is present.
11037 h_shm=true
11038 echo " "
11039 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11040 *"$undef"*) h_shm=false;;
11041 esac
11042 case "$osname" in
11043 freebsd)
11044     case "`ipcs 2>&1`" in
11045     "SVID shared memory"*"not configured"*)
11046         echo "Your $osname does not have the shm*(2) configured." >&4
11047         h_shm=false
11048         val="$undef"
11049         set shmctl d_shmctl
11050         evat $setvar
11051         set shmget d_shmget
11052         evat $setvar
11053         set shmat d_shmat
11054         evat $setvar
11055         set shmdt d_shmdt
11056         evat $setvar
11057         ;;
11058     esac
11059     ;;
11060 esac
11061 : we could also check for sys/ipc.h ...
11062 if $h_shm && $test `./findhdr sys/shm.h`; then
11063         echo "You have the full shm*(2) library." >&4
11064         val="$define"
11065 else
11066         echo "You don't have the full shm*(2) library." >&4
11067         val="$undef"
11068 fi
11069 set d_shm
11070 eval $setvar
11071
11072 echo " "
11073 : see if we have sigaction
11074 if set sigaction val -f d_sigaction; eval $csym; $val; then
11075         echo 'sigaction() found.' >&4
11076         $cat > try.c <<'EOP'
11077 #include <stdio.h>
11078 #include <sys/types.h>
11079 #include <signal.h>
11080 int main()
11081 {
11082     struct sigaction act, oact;
11083     act.sa_flags = 0;
11084     oact.sa_handler = 0;
11085     /* so that act and oact are used */
11086     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11087 }
11088 EOP
11089         set try
11090         if eval $compile_ok; then
11091                 val="$define"
11092         else
11093                 echo "But you don't seem to have a useable struct sigaction." >&4
11094                 val="$undef"
11095         fi
11096 else
11097         echo 'sigaction NOT found.' >&4
11098         val="$undef"
11099 fi
11100 set d_sigaction; eval $setvar
11101 $rm -f try try$_o try.c
11102
11103 : see if sigsetjmp exists
11104 echo " "
11105 case "$d_sigsetjmp" in
11106 '')
11107         $cat >try.c <<'EOP'
11108 #include <setjmp.h>
11109 sigjmp_buf env;
11110 int set = 1;
11111 int main()
11112 {
11113         if (sigsetjmp(env,1))
11114                 exit(set);
11115         set = 0;
11116         siglongjmp(env, 1);
11117         exit(1);
11118 }
11119 EOP
11120         set try
11121         if eval $compile; then
11122                 if ./try >/dev/null 2>&1; then
11123                         echo "POSIX sigsetjmp found." >&4
11124                         val="$define"
11125                 else
11126                         $cat >&4 <<EOM
11127 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11128 I'll ignore them.
11129 EOM
11130                         val="$undef"
11131                 fi
11132         else
11133                 echo "sigsetjmp not found." >&4
11134                 val="$undef"
11135         fi
11136         ;;
11137 *) val="$d_sigsetjmp"
11138         case "$d_sigsetjmp" in
11139         $define) echo "POSIX sigsetjmp found." >&4;;
11140         $undef) echo "sigsetjmp not found." >&4;;
11141         esac
11142         ;;
11143 esac
11144 set d_sigsetjmp
11145 eval $setvar
11146 $rm -f try.c try
11147
11148 : see if sys/stat.h is available
11149 set sys/stat.h i_sysstat
11150 eval $inhdr
11151
11152
11153 : see if stat knows about block sizes
11154 echo " "
11155 echo "Checking to see if your struct stat has st_blocks field..." >&4
11156 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11157 eval $hasfield
11158
11159
11160 : see if this is a sys/vfs.h system
11161 set sys/vfs.h i_sysvfs
11162 eval $inhdr
11163
11164
11165 : see if this is a sys/statfs.h system
11166 set sys/statfs.h i_sysstatfs
11167 eval $inhdr
11168
11169
11170 echo " "
11171 echo "Checking to see if your system supports struct statfs..." >&4
11172 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
11173 eval $hasstruct
11174 case "$d_statfs_s" in
11175 "$define")      echo "Yes, it does."   ;;
11176 *)              echo "No, it doesn't." ;;
11177 esac
11178
11179
11180
11181 : see if struct statfs knows about f_flags
11182 case "$d_statfs_s" in
11183 define) 
11184         echo " "
11185         echo "Checking to see if your struct statfs has f_flags field..." >&4
11186         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
11187         eval $hasfield
11188         ;;
11189 *)      val="$undef"
11190         set d_statfs_f_flags
11191         eval $setvar
11192         ;;
11193 esac
11194 case "$d_statfs_f_flags" in
11195 "$define")      echo "Yes, it does."   ;;
11196 *)              echo "No, it doesn't." ;;
11197 esac
11198
11199 : see if _ptr and _cnt from stdio act std
11200 echo " "
11201 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11202         echo "(Looks like you have stdio.h from Linux.)"
11203         case "$stdio_ptr" in
11204         '') stdio_ptr='((fp)->_IO_read_ptr)'
11205                 ptr_lval=$define
11206                 ;;
11207         *)      ptr_lval=$d_stdio_ptr_lval;;
11208         esac
11209         case "$stdio_cnt" in
11210         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11211                 cnt_lval=$undef
11212                 ;;
11213         *)      cnt_lval=$d_stdio_cnt_lval;;
11214         esac
11215         case "$stdio_base" in
11216         '') stdio_base='((fp)->_IO_read_base)';;
11217         esac
11218         case "$stdio_bufsiz" in
11219         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11220         esac
11221 else
11222         case "$stdio_ptr" in
11223         '') stdio_ptr='((fp)->_ptr)'
11224                 ptr_lval=$define
11225                 ;;
11226         *)      ptr_lval=$d_stdio_ptr_lval;;
11227         esac
11228         case "$stdio_cnt" in
11229         '') stdio_cnt='((fp)->_cnt)'
11230                 cnt_lval=$define
11231                 ;;
11232         *)      cnt_lval=$d_stdio_cnt_lval;;
11233         esac
11234         case "$stdio_base" in
11235         '') stdio_base='((fp)->_base)';;
11236         esac
11237         case "$stdio_bufsiz" in
11238         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11239         esac
11240 fi
11241 : test whether _ptr and _cnt really work
11242 echo "Checking how std your stdio is..." >&4
11243 $cat >try.c <<EOP
11244 #include <stdio.h>
11245 #define FILE_ptr(fp)    $stdio_ptr
11246 #define FILE_cnt(fp)    $stdio_cnt
11247 int main() {
11248         FILE *fp = fopen("try.c", "r");
11249         char c = getc(fp);
11250         if (
11251                 18 <= FILE_cnt(fp) &&
11252                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11253         )
11254                 exit(0);
11255         exit(1);
11256 }
11257 EOP
11258 val="$undef"
11259 set try
11260 if eval $compile; then
11261         if ./try; then
11262                 echo "Your stdio acts pretty std."
11263                 val="$define"
11264         else
11265                 echo "Your stdio isn't very std."
11266         fi
11267 else
11268         echo "Your stdio doesn't appear very std."
11269 fi
11270 $rm -f try.c try
11271 set d_stdstdio
11272 eval $setvar
11273
11274 : Can _ptr be used as an lvalue?
11275 case "$d_stdstdio$ptr_lval" in
11276 $define$define) val=$define ;;
11277 *) val=$undef ;;
11278 esac
11279 set d_stdio_ptr_lval
11280 eval $setvar
11281
11282 : Can _cnt be used as an lvalue?
11283 case "$d_stdstdio$cnt_lval" in
11284 $define$define) val=$define ;;
11285 *) val=$undef ;;
11286 esac
11287 set d_stdio_cnt_lval
11288 eval $setvar
11289
11290 : see if _base is also standard
11291 val="$undef"
11292 case "$d_stdstdio" in
11293 $define)
11294         $cat >try.c <<EOP
11295 #include <stdio.h>
11296 #define FILE_base(fp)   $stdio_base
11297 #define FILE_bufsiz(fp) $stdio_bufsiz
11298 int main() {
11299         FILE *fp = fopen("try.c", "r");
11300         char c = getc(fp);
11301         if (
11302                 19 <= FILE_bufsiz(fp) &&
11303                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11304         )
11305                 exit(0);
11306         exit(1);
11307 }
11308 EOP
11309         set try
11310         if eval $compile; then
11311                 if ./try; then
11312                         echo "And its _base field acts std."
11313                         val="$define"
11314                 else
11315                         echo "But its _base field isn't std."
11316                 fi
11317         else
11318                 echo "However, it seems to be lacking the _base field."
11319         fi
11320         $rm -f try.c try
11321         ;;
11322 esac
11323 set d_stdiobase
11324 eval $setvar
11325
11326 $cat >&4 <<EOM
11327 Checking how to access stdio streams by file descriptor number...
11328 EOM
11329 case "$stdio_stream_array" in
11330 '')     $cat >try.c <<EOCP
11331 #include <stdio.h>
11332 int main() {
11333   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11334     printf("yes\n");
11335 }
11336 EOCP
11337         for s in _iob __iob __sF
11338         do
11339                 set try -DSTDIO_STREAM_ARRAY=$s
11340                 if eval $compile; then
11341                         case "`./try$exe_ext`" in
11342                         yes)    stdio_stream_array=$s; break ;;
11343                         esac
11344                 fi
11345         done
11346         $rm -f try.* try$exe_ext
11347 esac
11348 case "$stdio_stream_array" in
11349 '')     $cat >&4 <<EOM
11350 I can't figure out how to access stdio streams by file descriptor number.
11351 EOM
11352         d_stdio_stream_array="$undef"
11353         ;;
11354 *)      $cat >&4 <<EOM
11355 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11356 EOM
11357         d_stdio_stream_array="$define"
11358         ;;
11359 esac
11360
11361 : see if strcoll exists
11362 set strcoll d_strcoll
11363 eval $inlibc
11364
11365 : check for structure copying
11366 echo " "
11367 echo "Checking to see if your C compiler can copy structs..." >&4
11368 $cat >try.c <<'EOCP'
11369 int main()
11370 {
11371         struct blurfl {
11372                 int dyick;
11373         } foo, bar;
11374
11375         foo = bar;
11376 }
11377 EOCP
11378 if $cc -c try.c >/dev/null 2>&1 ; then
11379         val="$define"
11380         echo "Yup, it can."
11381 else
11382         val="$undef"
11383         echo "Nope, it can't."
11384 fi
11385 set d_strctcpy
11386 eval $setvar
11387 $rm -f try.*
11388
11389 : see if strerror and/or sys_errlist[] exist
11390 echo " "
11391 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11392     if set strerror val -f d_strerror; eval $csym; $val; then
11393                 echo 'strerror() found.' >&4
11394                 d_strerror="$define"
11395                 d_strerrm='strerror(e)'
11396                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11397                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11398                         d_syserrlst="$define"
11399                 else
11400                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11401                         d_syserrlst="$undef"
11402                 fi
11403     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11404                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11405                 echo 'strerror() found in string header.' >&4
11406                 d_strerror="$define"
11407                 d_strerrm='strerror(e)'
11408                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11409                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11410                                 d_syserrlst="$define"
11411                 else
11412                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11413                         d_syserrlst="$undef"
11414                 fi
11415     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11416                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11417                 d_strerror="$undef"
11418                 d_syserrlst="$define"
11419                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11420     else
11421                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11422                 d_strerror="$undef"
11423                 d_syserrlst="$undef"
11424                 d_strerrm='"unknown"'
11425     fi
11426 fi
11427
11428 : see if strtod exists
11429 set strtod d_strtod
11430 eval $inlibc
11431
11432 : see if strtol exists
11433 set strtol d_strtol
11434 eval $inlibc
11435
11436 : see if strtold exists
11437 set strtold d_strtold
11438 eval $inlibc
11439
11440 : see if strtoll exists
11441 set strtoll d_strtoll
11442 eval $inlibc
11443
11444 : see if strtoul exists
11445 set strtoul d_strtoul
11446 eval $inlibc
11447
11448 : see if strtoull exists
11449 set strtoull d_strtoull
11450 eval $inlibc
11451
11452 : see if strtouq exists
11453 set strtouq d_strtouq
11454 eval $inlibc
11455
11456 : see if strxfrm exists
11457 set strxfrm d_strxfrm
11458 eval $inlibc
11459
11460 : see if symlink exists
11461 set symlink d_symlink
11462 eval $inlibc
11463
11464 : see if syscall exists
11465 set syscall d_syscall
11466 eval $inlibc
11467
11468 : see if sysconf exists
11469 set sysconf d_sysconf
11470 eval $inlibc
11471
11472 : see if system exists
11473 set system d_system
11474 eval $inlibc
11475
11476 : see if tcgetpgrp exists
11477 set tcgetpgrp d_tcgetpgrp
11478 eval $inlibc
11479
11480 : see if tcsetpgrp exists
11481 set tcsetpgrp d_tcsetpgrp
11482 eval $inlibc
11483
11484 : see if prototype for telldir is available
11485 echo " "
11486 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11487 eval $hasproto
11488
11489 : see if this is a sys/times.h system
11490 set sys/times.h i_systimes
11491 eval $inhdr
11492
11493 : see if times exists
11494 echo " "
11495 if set times val -f d_times; eval $csym; $val; then
11496         echo 'times() found.' >&4
11497         d_times="$define"
11498         inc=''
11499         case "$i_systimes" in
11500         "$define") inc='sys/times.h';;
11501         esac
11502         rp="What is the type returned by times() on this system?"
11503         set clock_t clocktype long stdio.h sys/types.h $inc
11504         eval $typedef_ask
11505 else
11506         echo 'times() NOT found, hope that will do.' >&4
11507         d_times="$undef"
11508         clocktype='int'
11509 fi
11510
11511 : see if truncate exists
11512 set truncate d_truncate
11513 eval $inlibc
11514
11515 : see if tzname[] exists
11516 echo " "
11517 if set tzname val -a d_tzname; eval $csym; $val; then
11518         val="$define"
11519         echo 'tzname[] found.' >&4
11520 else
11521         val="$undef"
11522         echo 'tzname[] NOT found.' >&4
11523 fi
11524 set d_tzname
11525 eval $setvar
11526
11527 : see if umask exists
11528 set umask d_umask
11529 eval $inlibc
11530
11531 : see if ustat exists
11532 set ustat d_ustat
11533 eval $inlibc
11534
11535 : backward compatibility for d_hvfork
11536 if test X$d_hvfork != X; then
11537         d_vfork="$d_hvfork"
11538         d_hvfork=''
11539 fi
11540 : see if there is a vfork
11541 val=''
11542 set vfork val
11543 eval $inlibc
11544
11545 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11546 : perl on Solaris 2.x, and probably elsewhere.
11547 case "$val" in
11548 $define)
11549         echo " "
11550         case "$usevfork" in
11551         false) dflt='n';;
11552         *) dflt='y';;
11553         esac
11554         cat <<'EOM'
11555  
11556 Perl can only use a vfork() that doesn't suffer from strict
11557 restrictions on calling functions or modifying global data in
11558 the child.  For example, glibc-2.1 contains such a vfork()
11559 that is unsuitable.  If your system provides a proper fork()
11560 call, chances are that you do NOT want perl to use vfork().
11561
11562 EOM
11563         rp="Do you still want to use vfork()?"
11564         . ./myread
11565         case "$ans" in
11566         y|Y) ;;
11567         *)
11568                 echo "Ok, we won't use vfork()."
11569                 val="$undef"
11570                 ;;
11571         esac
11572         ;;
11573 esac
11574 set d_vfork
11575 eval $setvar
11576 case "$d_vfork" in
11577 $define) usevfork='true';;
11578 *) usevfork='false';;
11579 esac
11580
11581 : see if this is an sysdir system
11582 set sys/dir.h i_sysdir
11583 eval $inhdr
11584
11585 : see if this is an sysndir system
11586 set sys/ndir.h i_sysndir
11587 eval $inhdr
11588
11589 : see if closedir exists
11590 set closedir d_closedir
11591 eval $inlibc
11592
11593 case "$d_closedir" in
11594 "$define")
11595         echo " "
11596         echo "Checking whether closedir() returns a status..." >&4
11597         cat > closedir.c <<EOM
11598 #$i_dirent I_DIRENT             /**/
11599 #$i_sysdir I_SYS_DIR            /**/
11600 #$i_sysndir I_SYS_NDIR          /**/
11601 #$i_systypes I_SYS_TYPES        /**/
11602
11603 #if defined(I_SYS_TYPES)
11604 #include <sys/types.h>
11605 #endif
11606 #if defined(I_DIRENT)
11607 #include <dirent.h>
11608 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11609 #include <sys/dir.h>
11610 #endif
11611 #else
11612 #ifdef I_SYS_NDIR
11613 #include <sys/ndir.h>
11614 #else
11615 #ifdef I_SYS_DIR
11616 #ifdef hp9000s500
11617 #include <ndir.h>       /* may be wrong in the future */
11618 #else
11619 #include <sys/dir.h>
11620 #endif
11621 #endif
11622 #endif
11623 #endif 
11624 int main() { return closedir(opendir(".")); }
11625 EOM
11626         set closedir
11627         if eval $compile_ok; then
11628                 if ./closedir > /dev/null 2>&1 ; then
11629                         echo "Yes, it does."
11630                         val="$undef"
11631                 else
11632                         echo "No, it doesn't."
11633                         val="$define"
11634                 fi
11635         else
11636                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11637                 val="$define"
11638         fi
11639         ;;
11640 *)
11641         val="$undef";
11642         ;;
11643 esac
11644 set d_void_closedir
11645 eval $setvar
11646 $rm -f closedir*
11647 : check for volatile keyword
11648 echo " "
11649 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11650 $cat >try.c <<'EOCP'
11651 int main()
11652 {
11653         typedef struct _goo_struct goo_struct;
11654         goo_struct * volatile goo = ((goo_struct *)0);
11655         struct _goo_struct {
11656                 long long_int;
11657                 int reg_int;
11658                 char char_var;
11659         };
11660         typedef unsigned short foo_t;
11661         char *volatile foo;
11662         volatile int bar;
11663         volatile foo_t blech;
11664         foo = foo;
11665 }
11666 EOCP
11667 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11668         val="$define"
11669         echo "Yup, it does."
11670 else
11671         val="$undef"
11672         echo "Nope, it doesn't."
11673 fi
11674 set d_volatile
11675 eval $setvar
11676 $rm -f try.*
11677
11678 : see if there is a wait4
11679 set wait4 d_wait4
11680 eval $inlibc
11681
11682 : see if waitpid exists
11683 set waitpid d_waitpid
11684 eval $inlibc
11685
11686 : see if wcstombs exists
11687 set wcstombs d_wcstombs
11688 eval $inlibc
11689
11690 : see if wctomb exists
11691 set wctomb d_wctomb
11692 eval $inlibc
11693
11694 : preserve RCS keywords in files with variable substitution, grrr
11695 Date='$Date'
11696 Id='$Id'
11697 Log='$Log'
11698 RCSfile='$RCSfile'
11699 Revision='$Revision'
11700
11701 case "$crosscompile" in
11702 ''|[nN]*) crosscompile="$undef" ;;
11703 esac
11704
11705 case "$osname" in
11706 next|rhapsody|darwin) multiarch="$define" ;;
11707 esac
11708 case "$multiarch" in
11709 ''|[nN]*) multiarch="$undef" ;;
11710 esac
11711
11712 : check for alignment requirements
11713 echo " "
11714 case "$crosscompile$multiarch" in
11715 *$define*)
11716         $cat <<EOM
11717 You seem to be either cross-compiling or doing a multiarchitecture build,
11718 skipping the memory alignment check.
11719
11720 EOM
11721         case "$alignbytes" in
11722         '') alignbytes=8 ;;
11723         esac
11724         ;;
11725 *)
11726         case "$alignbytes" in
11727         '') echo "Checking alignment constraints..." >&4
11728                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11729                         $cat >try.c <<'EOCP'
11730 typedef long double NV;
11731 EOCP
11732                 else
11733                         $cat >try.c <<'EOCP'
11734 typedef double NV;
11735 EOCP
11736                 fi
11737                 $cat >>try.c <<'EOCP'
11738 #include <stdio.h>
11739 struct foobar {
11740         char foo;
11741         NV bar;
11742 } try_algn;
11743 int main()
11744 {
11745     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11746     return(0);
11747 }
11748 EOCP
11749                 set try
11750                 if eval $compile_ok; then
11751                         dflt=`./try`
11752                 else
11753                         dflt='8'
11754                         echo "(I can't seem to compile the test program...)"
11755                 fi
11756                 ;;
11757         *) dflt="$alignbytes"
11758                 ;;
11759         esac
11760         rp="Doubles must be aligned on a how-many-byte boundary?"
11761         . ./myread
11762         alignbytes="$ans"
11763         $rm -f try.c try
11764         ;;
11765 esac
11766
11767
11768 : set the base revision
11769 baserev=5.0
11770
11771 : check for ordering of bytes in a long
11772 echo " "
11773 case "$crosscompile$multiarch" in
11774 *$define*)
11775         $cat <<EOM
11776 You seem to be either cross-compiling or doing a multiarchitecture build,
11777 skipping the byteorder check.
11778
11779 EOM
11780         byteorder='0xffff'
11781         ;;
11782 *)
11783         case "$byteorder" in
11784         '')
11785                 $cat <<'EOM'
11786 In the following, larger digits indicate more significance.  A big-endian
11787 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11788 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11789 machines may have weird orders like 3412.  A Cray will report 87654321,
11790 an Alpha will report 12345678. If the test program works the default is
11791 probably right.
11792 I'm now running the test program...
11793 EOM
11794                 $cat >try.c <<'EOCP'
11795 #include <stdio.h>
11796 int main()
11797 {
11798         int i;
11799         union {
11800                 unsigned long l;
11801                 char c[sizeof(long)];
11802         } u;
11803
11804         if (sizeof(long) > 4)
11805                 u.l = (0x08070605L << 32) | 0x04030201L;
11806         else
11807                 u.l = 0x04030201L;
11808         for (i = 0; i < sizeof(long); i++)
11809                 printf("%c", u.c[i]+'0');
11810         printf("\n");
11811         exit(0);
11812 }
11813 EOCP
11814                 xxx_prompt=y
11815                 set try
11816                 if eval $compile && ./try > /dev/null; then
11817                         dflt=`./try`
11818                         case "$dflt" in
11819                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11820                                 echo "(The test program ran ok.)"
11821                                 echo "byteorder=$dflt"
11822                                 xxx_prompt=n
11823                         ;;
11824                         ????|????????) echo "(The test program ran ok.)" ;;
11825                         *) echo "(The test program didn't run right for some reason.)" ;;
11826                         esac
11827                 else
11828                         dflt='4321'
11829                         cat <<'EOM'
11830 (I can't seem to compile the test program.  Guessing big-endian...)
11831 EOM
11832                 fi
11833                 case "$xxx_prompt" in
11834                 y)
11835                         rp="What is the order of bytes in a long?"
11836                         . ./myread
11837                         byteorder="$ans"
11838                         ;;
11839                 *)      byteorder=$dflt
11840                         ;;
11841                 esac
11842                 ;;
11843         esac
11844         $rm -f try.c try
11845         ;;
11846 esac
11847
11848
11849 : how do we catenate cpp tokens here?
11850 echo " "
11851 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11852 $cat >cpp_stuff.c <<'EOCP'
11853 #define RCAT(a,b)a/**/b
11854 #define ACAT(a,b)a ## b
11855 RCAT(Rei,ser)
11856 ACAT(Cir,cus)
11857 EOCP
11858 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11859 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11860         echo "Oh!  Smells like ANSI's been here." >&4
11861         echo "We can catify or stringify, separately or together!"
11862         cpp_stuff=42
11863 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11864         echo "Ah, yes!  The good old days!" >&4
11865         echo "However, in the good old days we don't know how to stringify and"
11866         echo "catify at the same time."
11867         cpp_stuff=1
11868 else
11869         $cat >&4 <<EOM
11870 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11871 to have to edit the values of CAT[2-5] in config.h...
11872 EOM
11873         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11874 fi
11875 $rm -f cpp_stuff.*
11876
11877 : see if this is a db.h system
11878 set db.h i_db
11879 eval $inhdr
11880
11881 case "$i_db" in
11882 $define)
11883         : Check db version.
11884         echo " "
11885         echo "Checking Berkeley DB version ..." >&4
11886         $cat >try.c <<EOCP
11887 #$d_const HASCONST
11888 #ifndef HASCONST
11889 #define const
11890 #endif
11891 #include <sys/types.h>
11892 #include <stdio.h>
11893 #include <db.h>
11894 int main()
11895 {
11896 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11897     int Major, Minor, Patch ;
11898     unsigned long Version ;
11899     (void)db_version(&Major, &Minor, &Patch) ;
11900     printf("You have Berkeley DB Version 2 or greater\n");
11901
11902     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11903                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11904     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11905                 Major, Minor, Patch) ;
11906
11907     /* check that db.h & libdb are compatible */
11908     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11909         printf("db.h and libdb are incompatible\n") ;
11910         exit(3);        
11911     }
11912
11913     printf("db.h and libdb are compatible\n") ;
11914
11915     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11916                 + DB_VERSION_PATCH ;
11917
11918     /* needs to be >= 2.3.4 */
11919     if (Version < 2003004) {
11920     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11921         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11922         exit(2);        
11923     }
11924
11925     exit(0);
11926 #else
11927 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11928     printf("You have Berkeley DB Version 1\n");
11929     exit(0);    /* DB version < 2: the coast is clear. */
11930 #else
11931     exit(1);    /* <db.h> not Berkeley DB? */
11932 #endif
11933 #endif
11934 }
11935 EOCP
11936         set try
11937         if eval $compile_ok && ./try; then
11938                 echo 'Looks OK.' >&4
11939         else
11940                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11941                 i_db=$undef
11942                 case " $libs " in
11943                 *"-ldb "*)
11944                         : Remove db from list of libraries to use
11945                         echo "Removing unusable -ldb from library list" >&4
11946                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11947                         shift
11948                         libs="$*"
11949                         echo "libs = $libs" >&4
11950                         ;;
11951                 esac
11952         fi
11953         $rm -f try.*
11954         ;;
11955 esac
11956
11957 case "$i_db" in
11958 define)
11959         : Check the return type needed for hash 
11960         echo " "
11961         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11962         $cat >try.c <<EOCP
11963 #$d_const HASCONST
11964 #ifndef HASCONST
11965 #define const
11966 #endif
11967 #include <sys/types.h>
11968 #include <db.h>
11969
11970 #ifndef DB_VERSION_MAJOR
11971 u_int32_t hash_cb (ptr, size)
11972 const void *ptr;
11973 size_t size;
11974 {
11975 }
11976 HASHINFO info;
11977 int main()
11978 {
11979         info.hash = hash_cb;
11980 }
11981 #endif
11982 EOCP
11983         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11984                 if $contains warning try.out >>/dev/null 2>&1 ; then
11985                         db_hashtype='int'
11986                 else
11987                         db_hashtype='u_int32_t'
11988                 fi
11989         else
11990                 : XXX Maybe we should just give up here.
11991                 db_hashtype=u_int32_t
11992                 $cat try.out >&4
11993                 echo "Help:  I can't seem to compile the db test program." >&4
11994                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11995         fi
11996         $rm -f try.*
11997         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11998         ;;
11999 *)      db_hashtype=u_int32_t
12000         ;;
12001 esac
12002 case "$i_db" in
12003 define)
12004         : Check the return type needed for prefix 
12005         echo " "
12006         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12007         cat >try.c <<EOCP
12008 #$d_const HASCONST
12009 #ifndef HASCONST
12010 #define const
12011 #endif
12012 #include <sys/types.h>
12013 #include <db.h>
12014
12015 #ifndef DB_VERSION_MAJOR
12016 size_t prefix_cb (key1, key2)
12017 const DBT *key1;
12018 const DBT *key2;
12019 {
12020 }
12021 BTREEINFO info;
12022 int main()
12023 {
12024         info.prefix = prefix_cb;
12025 }
12026 #endif
12027 EOCP
12028         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12029                 if $contains warning try.out >>/dev/null 2>&1 ; then
12030                         db_prefixtype='int'
12031                 else
12032                         db_prefixtype='size_t'
12033                 fi
12034         else
12035                 db_prefixtype='size_t'
12036                 : XXX Maybe we should just give up here.
12037                 $cat try.out >&4
12038                 echo "Help:  I can't seem to compile the db test program." >&4
12039                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12040         fi
12041         $rm -f try.*
12042         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12043         ;;
12044 *)      db_prefixtype='size_t'
12045         ;;
12046 esac
12047
12048 : check for void type
12049 echo " "
12050 echo "Checking to see how well your C compiler groks the void type..." >&4
12051 case "$voidflags" in
12052 '')
12053         $cat >try.c <<'EOCP'
12054 #if TRY & 1
12055 void sub() {
12056 #else
12057 sub() {
12058 #endif
12059         extern void moo();      /* function returning void */
12060         void (*goo)();          /* ptr to func returning void */
12061 #if TRY & 8
12062         void *hue;              /* generic ptr */
12063 #endif
12064 #if TRY & 2
12065         void (*foo[10])();
12066 #endif
12067
12068 #if TRY & 4
12069         if(goo == moo) {
12070                 exit(0);
12071         }
12072 #endif
12073         exit(0);
12074 }
12075 int main() { sub(); }
12076 EOCP
12077         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12078                 voidflags=$defvoidused
12079         echo "Good.  It appears to support void to the level $package wants.">&4
12080                 if $contains warning .out >/dev/null 2>&1; then
12081                         echo "However, you might get some warnings that look like this:"
12082                         $cat .out
12083                 fi
12084         else
12085 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12086                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12087                         echo "It supports 1..."
12088                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12089                                 echo "It also supports 2..."
12090                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12091                                         voidflags=7
12092                                         echo "And it supports 4 but not 8 definitely."
12093                                 else
12094                                         echo "It doesn't support 4..."
12095                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12096                                                 voidflags=11
12097                                                 echo "But it supports 8."
12098                                         else
12099                                                 voidflags=3
12100                                                 echo "Neither does it support 8."
12101                                         fi
12102                                 fi
12103                         else
12104                                 echo "It does not support 2..."
12105                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12106                                         voidflags=13
12107                                         echo "But it supports 4 and 8."
12108                                 else
12109                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12110                                                 voidflags=5
12111                                                 echo "And it supports 4 but has not heard about 8."
12112                                         else
12113                                                 echo "However it supports 8 but not 4."
12114                                         fi
12115                                 fi
12116                         fi
12117                 else
12118                         echo "There is no support at all for void."
12119                         voidflags=0
12120                 fi
12121         fi
12122 esac
12123 case "$voidflags" in
12124 "$defvoidused") ;;
12125 *)      $cat >&4 <<'EOM'
12126   Support flag bits are:
12127     1: basic void declarations.
12128     2: arrays of pointers to functions returning void.
12129     4: operations between pointers to and addresses of void functions.
12130     8: generic void pointers.
12131 EOM
12132         dflt="$voidflags";
12133         rp="Your void support flags add up to what?"
12134         . ./myread
12135         voidflags="$ans"
12136         ;;
12137 esac
12138 $rm -f try.* .out
12139
12140
12141 : How can we generate normalized random numbers ?
12142 echo " "
12143 echo "Looking for a random number function..." >&4
12144 case "$randfunc" in
12145 '')
12146         if set drand48 val -f; eval $csym; $val; then
12147                 dflt="drand48"
12148                 echo "Good, found drand48()." >&4
12149         elif set random val -f; eval $csym; $val; then
12150                 dflt="random"
12151                 echo "OK, found random()." >&4
12152         else
12153                 dflt="rand"
12154                 echo "Yick, looks like I have to use rand()." >&4
12155         fi
12156         echo " "
12157         ;;
12158 *)
12159         dflt="$randfunc"
12160         ;;
12161 esac
12162 cont=true
12163
12164 case "$ccflags" in
12165 *-Dmy_rand=*|*-Dmy_srand=*)
12166         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12167         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12168         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12169         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12170         ;;
12171 esac
12172
12173 while $test "$cont"; do
12174         rp="Use which function to generate random numbers?"
12175         . ./myread
12176         if $test "$ans" = "$dflt"; then
12177                 : null
12178         else
12179                 randbits=''
12180         fi
12181         randfunc="$ans"
12182         if set $ans val -f; eval $csym; $val; then
12183                 cont=''
12184         else
12185                 dflt=y
12186                 rp="I cannot find function $ans. Use that name anyway?"
12187                 . ./myread
12188                 dflt=rand
12189                 case "$ans" in
12190                         [yY]*) cont='';;
12191                 esac
12192         fi
12193         case "$cont" in
12194         '')
12195                 case "$randfunc" in
12196                 drand48)
12197                         drand01="drand48()"
12198                         seedfunc="srand48"
12199                         randbits=48
12200                         randseedtype=long
12201                         ;;
12202                 rand|random)
12203                         case "$randbits" in
12204                         '')
12205 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12206                                 $cat >try.c <<EOCP
12207 #$i_unistd I_UNISTD
12208 #$i_stdlib I_STDLIB
12209 #include <stdio.h>
12210 #ifdef I_UNISTD
12211 #  include <unistd.h>
12212 #endif
12213 #ifdef I_STDLIB
12214 #  include <stdlib.h>
12215 #endif
12216 int main()
12217 {
12218         register int i;
12219         register unsigned long tmp;
12220         register unsigned long max = 0L;
12221
12222         for (i = 1000; i; i--) {
12223                 tmp = (unsigned long) $randfunc();
12224                 if (tmp > max) max = tmp;
12225         }
12226         for (i = 0; max; i++)
12227                 max /= 2;
12228         printf("%d\n",i);
12229 }
12230 EOCP
12231                                 set try
12232                                 if eval $compile_ok; then
12233                                         dflt=`try`
12234                                 else
12235                                         dflt='?'
12236                                         echo "(I can't seem to compile the test program...)"
12237                                 fi
12238                                 ;;
12239                         *)
12240                                 dflt="$randbits"
12241                                 ;;
12242                         esac
12243                         rp="How many bits does your $randfunc() function produce?"
12244                         . ./myread
12245                         randbits="$ans"
12246                         $rm -f try.c try
12247                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12248                         seedfunc="s$randfunc"
12249                         randseedtype=unsigned
12250                         ;;
12251                 *)
12252                         dflt="31"
12253                         rp="How many bits does your $randfunc() function produce?"
12254                         . ./myread
12255                         randbits="$ans"
12256                         seedfunc="s$randfunc"
12257                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12258                         if set $seedfunc val -f; eval $csym; $val; then
12259                                 echo "(Using $seedfunc() to seed random generator)"
12260                         else
12261                                 echo "(Warning: no $seedfunc() to seed random generator)"
12262                                 seedfunc=rand
12263                         fi
12264                         randseedtype=unsigned
12265                         ;;
12266                 esac
12267                 ;;
12268         esac
12269 done
12270
12271 echo " "
12272 echo "Determining whether or not we are on an EBCDIC system..." >&4
12273 $cat >tebcdic.c <<'EOM'
12274 int main()
12275 {
12276   if ('M'==0xd4) return 0;
12277   return 1;
12278 }
12279 EOM
12280
12281 val=$undef
12282 set tebcdic
12283 if eval $compile_ok; then
12284         if ./tebcdic; then
12285                 echo "You have EBCDIC." >&4
12286                 val="$define"
12287         else
12288                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12289         fi
12290 else
12291         echo "I'm unable to compile the test program." >&4
12292         echo "I'll assume ASCII or some ISO Latin." >&4
12293 fi
12294 $rm -f tebcdic.c tebcdic
12295 set ebcdic
12296 eval $setvar
12297
12298 echo " "
12299 $cat >&4 <<EOM
12300 Checking how to flush all pending stdio output...
12301 EOM
12302 # I only know how to find the first 32 possibly open files on SunOS.
12303 # See also hints/sunos_4_1.sh and util.c  --AD
12304 case "$osname" in
12305 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12306 esac
12307 $cat >>try.c <<EOCP
12308 #include <stdio.h>
12309 #$i_unistd I_UNISTD
12310 #ifdef I_UNISTD
12311 # include <unistd.h>
12312 #endif
12313 #$d_sysconf HAS_SYSCONF
12314 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12315 #ifdef HAS_STDIO_STREAM_ARRAY
12316 # define STDIO_STREAM_ARRAY $stdio_stream_array
12317 #endif
12318 int main() {
12319   FILE* p = fopen("try.out", "w");
12320 #ifdef TRY_FPUTC
12321   fputc('x', p);
12322 #else
12323 # ifdef TRY_FPRINTF
12324   fprintf(p, "x");
12325 # endif
12326 #endif
12327 #ifdef TRY_FFLUSH_NULL
12328   fflush(NULL);
12329 #endif
12330 #ifdef TRY_FFLUSH_ALL
12331   {
12332     long open_max = -1;
12333 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12334     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12335 # else
12336 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12337     open_max = sysconf(_SC_OPEN_MAX);
12338 #  else
12339 #   ifdef FOPEN_MAX
12340     open_max = FOPEN_MAX;
12341 #   else
12342 #    ifdef OPEN_MAX
12343     open_max = OPEN_MAX;
12344 #    else
12345 #     ifdef _NFILE
12346     open_max = _NFILE;
12347 #     endif
12348 #    endif
12349 #   endif
12350 #  endif
12351 # endif 
12352 # ifdef HAS_STDIO_STREAM_ARRAY
12353     if (open_max > 0) {
12354       long i;
12355       for (i = 0; i < open_max; i++)
12356             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12357                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12358                 STDIO_STREAM_ARRAY[i]._flag)
12359                 fflush(&STDIO_STREAM_ARRAY[i]);
12360     }   
12361   }
12362 # endif
12363 #endif
12364   _exit(42);
12365 }
12366 EOCP
12367 : first we have to find out how _not_ to flush
12368 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12369     output=''
12370     set try -DTRY_FPUTC
12371     if eval $compile; then
12372             $rm -f try.out
12373             ./try$exe_ext 2>/dev/null
12374             if $test ! -s try.out -a "X$?" = X42; then
12375                 output=-DTRY_FPUTC
12376             fi
12377     fi
12378     case "$output" in
12379     '')
12380             set try -DTRY_FPRINTF
12381             $rm -f try.out
12382             if eval $compile; then
12383                     $rm -f try.out
12384                     ./try$exe_ext 2>/dev/null
12385                     if $test ! -s try.out -a "X$?" = X42; then
12386                         output=-DTRY_FPRINTF
12387                     fi
12388             fi
12389         ;;
12390     esac
12391 fi
12392 : check for fflush NULL behaviour
12393 case "$fflushNULL" in
12394 '')     set try -DTRY_FFLUSH_NULL $output
12395         if eval $compile; then
12396                 $rm -f try.out
12397                 ./try$exe_ext 2>/dev/null
12398                 code="$?"
12399                 if $test -s try.out -a "X$code" = X42; then
12400                         fflushNULL="`$cat try.out`"
12401                 else
12402                         if $test "X$code" != X42; then
12403                                 $cat >&4 <<EOM
12404 (If this test failed, don't worry, we'll try another method shortly.)
12405 EOM
12406                         fi
12407                 fi
12408         fi
12409         $rm -f core try.core core.try.*
12410         case "$fflushNULL" in
12411         x)      $cat >&4 <<EOM
12412 Your fflush(NULL) works okay.
12413 EOM
12414                 fflushNULL="$define"
12415                 ;;
12416         '')     $cat >&4 <<EOM
12417 Your fflush(NULL) isn't working (contrary to ANSI C).
12418 EOM
12419                 fflushNULL="$undef"
12420                 ;;
12421         *)      $cat >&4 <<EOM
12422 Cannot figure out whether your fflush(NULL) works or not.
12423 I'm assuming it doesn't (contrary to ANSI C).
12424 EOM
12425                 fflushNULL="$undef"
12426                 ;;
12427         esac
12428         ;;
12429 $define|true|[yY]*)
12430         fflushNULL="$define"
12431         ;;
12432 *)
12433         fflushNULL="$undef"
12434         ;;
12435 esac
12436 : check explicit looping only if NULL did not work
12437 case "$fflushNULL" in
12438 "$undef")
12439         : check for fflush all behaviour
12440         case "$fflushall" in
12441         '')     set try -DTRY_FFLUSH_ALL $output
12442                 if eval $compile; then
12443                         $cat >&4 <<EOM
12444 (Now testing the other method--but note that also this may fail.)
12445 EOM
12446                         $rm -f try.out
12447                         ./try$exe_ext 2>/dev/null
12448                         if $test -s try.out -a "X$?" = X42; then
12449                                 fflushall="`$cat try.out`"
12450                         fi
12451                 fi
12452                 $rm -f core try.core core.try.*
12453                 case "$fflushall" in
12454                 x)      $cat >&4 <<EOM
12455 Whew. Flushing explicitly all the stdio streams works.
12456 EOM
12457                         fflushall="$define"
12458                         ;;
12459                 '')     $cat >&4 <<EOM
12460 Sigh. Flushing explicitly all the stdio streams doesn't work.
12461 EOM
12462                         fflushall="$undef"
12463                         ;;
12464                 *)      $cat >&4 <<EOM
12465 Cannot figure out whether flushing stdio streams explicitly works or not.
12466 I'm assuming it doesn't.
12467 EOM
12468                         fflushall="$undef"
12469                         ;;
12470                 esac
12471                 ;;
12472         "$define"|true|[yY]*)
12473                 fflushall="$define"
12474                 ;;
12475         *)
12476                 fflushall="$undef"
12477                 ;;
12478         esac
12479         ;;
12480 *)      fflushall="$undef"      
12481         ;;
12482 esac
12483 case "$fflushNULL$fflushall" in
12484 undefundef)
12485         $cat <<EOM
12486 I cannot figure out how to flush pending stdio output.
12487 EOM
12488         ;;
12489 esac
12490 $rm -f try.* try$exe_ext
12491
12492 : Store the full pathname to the ar program for use in the C program
12493 : Respect a hint or command line value for full_ar.
12494 case "$full_ar" in
12495 '') full_ar=$ar ;;
12496 esac
12497
12498 : Store the full pathname to the sed program for use in the C program
12499 full_sed=$sed
12500
12501 : see what type gids are declared as in the kernel
12502 echo " "
12503 echo "Looking for the type for group ids returned by getgid()."
12504 set gid_t gidtype xxx stdio.h sys/types.h
12505 eval $typedef
12506 case "$gidtype" in
12507 xxx)
12508         xxx=`./findhdr sys/user.h`
12509         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12510         case $1 in
12511         unsigned) dflt="$1 $2" ;;
12512         *) dflt="$1" ;;
12513         esac
12514         ;;
12515 *) dflt="$gidtype";;
12516 esac
12517 case "$gidtype" in
12518 gid_t) echo "gid_t found." ;;
12519 *)      rp="What is the type for group ids returned by getgid()?"
12520         . ./myread
12521         gidtype="$ans"
12522         ;;
12523 esac
12524
12525 echo " "
12526 case "$gidtype" in
12527 *_t) zzz="$gidtype"     ;;
12528 *)   zzz="gid"          ;;
12529 esac
12530 echo "Checking the size of $zzz..." >&4 
12531 cat > try.c <<EOCP
12532 #include <sys/types.h>
12533 #include <stdio.h>
12534 int main() {
12535     printf("%d\n", (int)sizeof($gidtype));
12536     exit(0);
12537 }
12538 EOCP
12539 set try
12540 if eval $compile_ok; then
12541         yyy=`./try`
12542         case "$yyy" in
12543         '')     gidsize=4
12544                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12545                 ;;
12546         *)      gidsize=$yyy
12547                 echo "Your $zzz is $gidsize bytes long."
12548                 ;;
12549         esac
12550 else
12551         gidsize=4
12552         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12553 fi
12554
12555
12556 echo " "
12557 case "$gidtype" in
12558 *_t) zzz="$gidtype"     ;;
12559 *)   zzz="gid"          ;;
12560 esac
12561 echo "Checking the sign of $zzz..." >&4 
12562 cat > try.c <<EOCP
12563 #include <sys/types.h>
12564 #include <stdio.h>
12565 int main() {
12566         $gidtype foo = -1;
12567         if (foo < 0)
12568                 printf("-1\n");
12569         else
12570                 printf("1\n");
12571 }
12572 EOCP
12573 set try
12574 if eval $compile; then
12575         yyy=`./try`
12576         case "$yyy" in
12577         '')     gidsign=1
12578                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12579                 ;;
12580         *)      gidsign=$yyy
12581                 case "$gidsign" in
12582                  1) echo "Your $zzz is unsigned." ;;
12583                 -1) echo "Your $zzz is signed."   ;;
12584                 esac
12585                 ;;
12586         esac
12587 else
12588         gidsign=1
12589         echo "(I can't compile the test program--guessing unsigned.)" >&4
12590 fi
12591
12592
12593 echo " "
12594
12595 if $test X"$quadtype" != X; then
12596
12597 echo "Checking how to print 64-bit integers..." >&4
12598
12599 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12600         $cat >try.c <<'EOCP'
12601 #include <sys/types.h>
12602 #include <stdio.h>
12603 int main() {
12604   int q = 12345678901;
12605   printf("%ld\n", q);
12606 }
12607 EOCP
12608         set try
12609         if eval $compile; then
12610                 yyy=`./try$exe_ext`
12611                 case "$yyy" in
12612                 12345678901)
12613                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12614                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12615                         echo "We will use %d."
12616                         ;;
12617                 esac
12618         fi
12619 fi
12620
12621 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12622         $cat >try.c <<'EOCP'
12623 #include <sys/types.h>
12624 #include <stdio.h>
12625 int main() {
12626   long q = 12345678901;
12627   printf("%ld\n", q);
12628 }
12629 EOCP
12630         set try
12631         if eval $compile; then
12632                 yyy=`./try$exe_ext`
12633                 case "$yyy" in
12634                 12345678901)
12635                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12636                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12637                         echo "We will use %ld."
12638                         ;;
12639                 esac
12640         fi
12641 fi
12642
12643 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12644         $cat >try.c <<'EOCP'
12645 #include <sys/types.h>
12646 #include <inttypes.h>
12647 #include <stdio.h>
12648 int main() {
12649   int64_t q = 12345678901;
12650   printf("%" PRId64 "\n", q);
12651 }
12652 EOCP
12653         set try
12654         if eval $compile; then
12655                 yyy=`./try$exe_ext`
12656                 case "$yyy" in
12657                 12345678901)
12658                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12659                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12660                         echo "We will use the C9X style."
12661                         ;;
12662                 esac
12663         fi
12664 fi
12665
12666 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12667         $cat >try.c <<'EOCP'
12668 #include <sys/types.h>
12669 #include <stdio.h>
12670 int main() {
12671   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12672   printf("%lld\n", q);
12673 }
12674 EOCP
12675         set try
12676         if eval $compile; then
12677                 yyy=`./try$exe_ext`
12678                 case "$yyy" in
12679                 12345678901)
12680                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12681                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12682                         echo "We will use the %lld style."
12683                         ;;
12684                 esac
12685         fi
12686 fi
12687
12688 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12689         $cat >try.c <<EOCP
12690 #include <sys/types.h>
12691 #include <stdio.h>
12692 int main() {
12693   $quadtype q = 12345678901;
12694   printf("%Ld\n", q);
12695 }
12696 EOCP
12697         set try
12698         if eval $compile; then
12699                 yyy=`./try$exe_ext`
12700                 case "$yyy" in
12701                 12345678901)
12702                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12703                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12704                         echo "We will use %Ld."
12705                         ;;
12706                 esac
12707         fi
12708 fi
12709
12710 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12711         $cat >try.c <<EOCP
12712 #include <sys/types.h>
12713 #include <stdio.h>
12714 int main() {
12715   $quadtype q = 12345678901;
12716   printf("%qd\n", q);
12717 }
12718 EOCP
12719         set try
12720         if eval $compile; then
12721                 yyy=`./try$exe_ext`
12722                 case "$yyy" in
12723                 12345678901)
12724                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12725                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12726                         echo "We will use %qd."
12727                         ;;
12728                 esac
12729         fi
12730 fi
12731
12732 if $test X"$sPRId64" = X; then
12733         echo "Cannot figure out how to print 64-bit integers." >&4
12734 fi
12735
12736 $rm -f try try.*
12737
12738 fi
12739
12740 case "$sPRId64" in
12741 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12742         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12743         ;;
12744 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12745         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12746         ;;
12747 esac
12748
12749
12750 echo " "
12751 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12752
12753 if $test X"$ivsize" = X8; then
12754         ivdformat="$sPRId64"
12755         uvuformat="$sPRIu64"
12756         uvoformat="$sPRIo64"
12757         uvxformat="$sPRIx64"
12758 else
12759         if $test X"$ivsize" = X"$longsize"; then
12760                 ivdformat='"ld"'
12761                 uvuformat='"lu"'
12762                 uvoformat='"lo"'
12763                 uvxformat='"lx"'
12764         else
12765                 if $test X"$ivsize" = X"$intsize"; then
12766                         ivdformat='"d"'
12767                         uvuformat='"u"'
12768                         uvoformat='"o"'
12769                         uvxformat='"x"'
12770                 else
12771                         : far out
12772                         if $test X"$ivsize" = X"$shortsize"; then
12773                                 ivdformat='"hd"'
12774                                 uvuformat='"hu"'
12775                                 uvoformat='"ho"'
12776                                 uvxformat='"hx"'
12777                         fi
12778                 fi
12779         fi
12780 fi
12781
12782 case "$ivdformat" in
12783 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12784     exit 1
12785     ;;
12786 esac
12787
12788
12789 echo " "
12790 $echo "Checking the format string to be used for gids..." >&4
12791
12792 case "$gidsign" in
12793 -1)     if $test X"$gidsize" = X"$ivsize"; then
12794                 gidformat="$ivdformat"
12795         else
12796                 if $test X"$gidsize" = X"$longsize"; then
12797                         gidformat='"ld"'
12798                 else
12799                         if $test X"$gidsize" = X"$intsize"; then
12800                                 gidformat='"d"'
12801                         else
12802                                 if $test X"$gidsize" = X"$shortsize"; then
12803                                         gidformat='"hd"'
12804                                 fi
12805                         fi
12806                 fi
12807         fi
12808         ;;
12809 *)      if $test X"$gidsize" = X"$uvsize"; then
12810                 gidformat="$uvuformat"
12811         else
12812                 if $test X"$gidsize" = X"$longsize"; then
12813                         gidformat='"lu"'
12814                 else
12815                         if $test X"$gidsize" = X"$intsize"; then
12816                                 gidformat='"u"'
12817                         else
12818                                 if $test X"$gidsize" = X"$shortsize"; then
12819                                         gidformat='"hu"'
12820                                 fi
12821                         fi
12822                 fi
12823         fi
12824         ;;
12825 esac
12826
12827 : see if getgroups exists
12828 set getgroups d_getgrps
12829 eval $inlibc
12830
12831 : see if setgroups exists
12832 set setgroups d_setgrps
12833 eval $inlibc
12834
12835
12836 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12837 echo " "
12838 case "$d_getgrps$d_setgrps" in
12839 *define*)
12840         case "$groupstype" in
12841         '') dflt="$gidtype" ;;
12842         *)  dflt="$groupstype" ;;
12843         esac
12844         $cat <<EOM
12845 What type of pointer is the second argument to getgroups() and setgroups()?
12846 Usually this is the same as group ids, $gidtype, but not always.
12847
12848 EOM
12849         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12850         . ./myread
12851         groupstype="$ans"
12852         ;;
12853 *)  groupstype="$gidtype";;
12854 esac
12855
12856 echo " "
12857 echo "Checking if your $make program sets \$(MAKE)..." >&4
12858 case "$make_set_make" in
12859 '')
12860         $sed 's/^X //' > testmake.mak << 'EOF'
12861 Xall:
12862 X       @echo 'maketemp="$(MAKE)"'
12863 EOF
12864         case "`$make -f testmake.mak 2>/dev/null`" in
12865         *maketemp=*) make_set_make='#' ;;
12866         *)      make_set_make="MAKE=$make" ;;
12867         esac
12868         $rm -f testmake.mak
12869         ;;
12870 esac
12871 case "$make_set_make" in
12872 '#') echo "Yup, it does.";;
12873 *) echo "Nope, it doesn't.";;
12874 esac
12875
12876 : see what type is used for mode_t
12877 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12878 set mode_t modetype int stdio.h sys/types.h
12879 eval $typedef_ask
12880
12881 : define a fucntion to check prototypes
12882 $cat > protochk <<EOSH
12883 $startsh
12884 cc="$cc"
12885 optimize="$optimize"
12886 ccflags="$ccflags"
12887 prototype="$prototype"
12888 define="$define"
12889 rm=$rm
12890 EOSH
12891
12892 $cat >> protochk <<'EOSH'
12893
12894 $rm -f try.c
12895 foo="$1"
12896 shift
12897 while test $# -ge 2; do
12898         case "$1" in
12899                 $define) echo "#include <$2>" >> try.c ;;
12900                 literal) echo "$2" >> try.c ;;
12901         esac
12902     shift 2
12903 done
12904 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12905 cat >> try.c <<'EOCP'
12906 #ifdef CAN_PROTOTYPE
12907 #define _(args) args
12908 #else
12909 #define _(args) ()
12910 #endif
12911 EOCP
12912 echo "$foo" >> try.c
12913 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12914 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12915 status=$?
12916 $rm -f try.[co]
12917 exit $status
12918 EOSH
12919 chmod +x protochk
12920 $eunicefix protochk
12921
12922 : see what type is used for size_t
12923 rp="What is the type used for the length parameter for string functions?"
12924 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12925 eval $typedef_ask
12926
12927 : check for type of arguments to gethostbyaddr. 
12928 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12929         case "$d_gethbyaddr" in
12930         $define)
12931                 $cat <<EOM
12932
12933 Checking to see what type of arguments are accepted by gethostbyaddr().
12934 EOM
12935                 hdrs="$define sys/types.h
12936                         $d_socket sys/socket.h 
12937                         $i_niin netinet/in.h 
12938                         $i_netdb netdb.h
12939                         $i_unistd unistd.h"
12940                 : The first arg can 'char *' or 'void *'
12941                 : The second arg is some of integral type
12942                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12943                         for yyy in size_t long int; do
12944                                 case "$netdb_host_type" in
12945                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12946                                         if ./protochk "$try" $hdrs; then
12947                                                 echo "Your system accepts $xxx for the first arg."
12948                                                 echo "...and $yyy for the second arg."
12949                                                 netdb_host_type="$xxx"
12950                                                 netdb_hlen_type="$yyy"
12951                                         fi
12952                                         ;;
12953                                 esac
12954                         done
12955                 done
12956                 : In case none of those worked, prompt the user.
12957                 case "$netdb_host_type" in
12958                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12959                         dflt='char *'
12960                         . ./myread
12961                         netdb_host_type=$ans
12962                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12963                         dflt="$sizetype"
12964                         . ./myread
12965                         netdb_hlen_type=$ans
12966                         ;;
12967                 esac
12968                 ;;
12969         *)      : no gethostbyaddr, so pick harmless defaults
12970                 netdb_host_type='char *'
12971                 netdb_hlen_type="$sizetype"
12972                 ;;
12973         esac
12974         # Remove the "const" if needed. -- but then we'll have a 
12975         # prototype clash!
12976         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12977 fi
12978
12979 : check for type of argument to gethostbyname. 
12980 if test "X$netdb_name_type" = X ; then
12981         case "$d_gethbyname" in
12982         $define)
12983                 $cat <<EOM
12984
12985 Checking to see what type of argument is accepted by gethostbyname().
12986 EOM
12987                 hdrs="$define sys/types.h
12988                         $d_socket sys/socket.h 
12989                         $i_niin netinet/in.h 
12990                         $i_netdb netdb.h
12991                         $i_unistd unistd.h"
12992                 for xxx in "const char *" "char *"; do
12993                         case "$netdb_name_type" in
12994                         '')     try="extern struct hostent *gethostbyname($xxx);"
12995                                 if ./protochk "$try" $hdrs; then
12996                                         echo "Your system accepts $xxx."
12997                                         netdb_name_type="$xxx"
12998                                 fi
12999                                 ;;
13000                         esac
13001                 done
13002                 : In case none of those worked, prompt the user.
13003                 case "$netdb_name_type" in
13004                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13005                         dflt='char *'
13006                         . ./myread
13007                         netdb_name_type=$ans
13008                         ;;
13009                 esac
13010                 ;;
13011         *)      : no gethostbyname, so pick harmless default
13012                 netdb_name_type='char *'
13013                 ;;
13014         esac
13015 fi
13016
13017 : check for type of 1st argument to getnetbyaddr. 
13018 if test "X$netdb_net_type" = X ; then
13019         case "$d_getnbyaddr" in
13020         $define)
13021                 $cat <<EOM
13022
13023 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13024 EOM
13025                 hdrs="$define sys/types.h
13026                         $d_socket sys/socket.h 
13027                         $i_niin netinet/in.h 
13028                         $i_netdb netdb.h
13029                         $i_unistd unistd.h"
13030                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13031                         case "$netdb_net_type" in
13032                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13033                                 if ./protochk "$try" $hdrs; then
13034                                         echo "Your system accepts $xxx."
13035                                         netdb_net_type="$xxx"
13036                                 fi
13037                                 ;;
13038                         esac
13039                 done
13040                 : In case none of those worked, prompt the user.
13041                 case "$netdb_net_type" in
13042                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13043                         dflt='long'
13044                         . ./myread
13045                         netdb_net_type=$ans
13046                         ;;
13047                 esac
13048                 ;;
13049         *)      : no getnetbyaddr, so pick harmless default
13050                 netdb_net_type='long'
13051                 ;;
13052         esac
13053 fi
13054 : locate the preferred pager for this system
13055 case "$pager" in
13056 '')
13057         dflt=''
13058         case "$pg" in
13059         /*) dflt=$pg;;
13060         esac
13061         case "$more" in
13062         /*) dflt=$more;;
13063         esac
13064         case "$less" in
13065         /*) dflt=$less;;
13066         esac
13067         case "$dflt" in
13068         '') dflt=/usr/ucb/more;;
13069         esac
13070         ;;
13071 *) dflt="$pager";;
13072 esac
13073 echo " "
13074 fn=f/
13075 rp='What pager is used on your system?'
13076 . ./getfile
13077 pager="$ans"
13078
13079 : see what type pids are declared as in the kernel
13080 rp="What is the type of process ids on this system?"
13081 set pid_t pidtype int stdio.h sys/types.h
13082 eval $typedef_ask
13083
13084 : Find earliest binary compatible site_perl subdirectory perl can use.
13085 case "$bincompat5005" in
13086 "$define") xs_apiversion='5.005' ;;
13087 *) xs_apiversion=$version ;;   # The current site_perl version.
13088 esac
13089 : Find earliest pure perl site_perl subdirectory perl can use.
13090 : The versioned directories started at 5.005.
13091 pm_apiversion='5.005'
13092
13093 : check for length of pointer
13094 echo " "
13095 case "$ptrsize" in
13096 '')
13097         echo "Checking to see how big your pointers are..." >&4
13098         if test "$voidflags" -gt 7; then
13099                 echo '#define VOID_PTR char *' > try.c
13100         else
13101                 echo '#define VOID_PTR void *' > try.c
13102         fi
13103         $cat >>try.c <<'EOCP'
13104 #include <stdio.h>
13105 int main()
13106 {
13107     printf("%d\n", (int)sizeof(VOID_PTR));
13108     exit(0);
13109 }
13110 EOCP
13111         set try
13112         if eval $compile_ok; then
13113                 ptrsize=`./try`
13114                 echo "Your pointers are $ptrsize bytes long."
13115         else
13116                 dflt='4'
13117                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13118                 rp="What is the size of a pointer (in bytes)?"
13119                 . ./myread
13120                 ptrsize="$ans"
13121         fi
13122         ;;
13123 esac
13124 $rm -f try.c try
13125
13126 : see if ar generates random libraries by itself
13127 echo " "
13128 echo "Checking how to generate random libraries on your machine..." >&4
13129 echo 'int bar1() { return bar2(); }' > bar1.c
13130 echo 'int bar2() { return 2; }' > bar2.c
13131 $cat > foo.c <<'EOP'
13132 int main() { printf("%d\n", bar1()); exit(0); }
13133 EOP
13134 $cc $ccflags -c bar1.c >/dev/null 2>&1
13135 $cc $ccflags -c bar2.c >/dev/null 2>&1
13136 $cc $ccflags -c foo.c >/dev/null 2>&1
13137 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13138 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13139         ./foobar >/dev/null 2>&1; then
13140         echo "$ar appears to generate random libraries itself."
13141         orderlib=false
13142         ranlib=":"
13143 elif $ar ts bar$_a >/dev/null 2>&1 &&
13144         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13145         ./foobar >/dev/null 2>&1; then
13146                 echo "a table of contents needs to be added with '$ar ts'."
13147                 orderlib=false
13148                 ranlib="$ar ts"
13149 else
13150         case "$ranlib" in
13151         :) ranlib='';;
13152         '')
13153                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13154                 $test -f $ranlib || ranlib=''
13155                 ;;
13156         esac
13157         if $test -n "$ranlib"; then
13158                 echo "your system has '$ranlib'; we'll use that."
13159                 orderlib=false
13160         else
13161                 echo "your system doesn't seem to support random libraries"
13162                 echo "so we'll use lorder and tsort to order the libraries."
13163                 orderlib=true
13164                 ranlib=":"
13165         fi
13166 fi
13167 $rm -f foo* bar* 
13168
13169 : check for type of arguments to select. 
13170 case "$selecttype" in
13171 '') case "$d_select" in
13172         $define)
13173                 echo " "
13174                 $cat <<EOM
13175 Checking to see what type of arguments are accepted by select().
13176 EOM
13177                 hdrs="$define sys/types.h
13178                         $i_systime sys/time.h 
13179                         $i_sysselct sys/select.h
13180                         $d_socket sys/socket.h"
13181                 : The first arg can be int, unsigned, or size_t
13182                 : The last arg may or may not be 'const'
13183                 val=''
13184                 : void pointer has been seen but using that
13185                 : breaks the selectminbits test
13186                 for xxx in 'fd_set *' 'int *'; do
13187                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13188                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13189                                         case "$val" in
13190                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13191                                                 if ./protochk "$try" $hdrs; then
13192                                                         echo "Your system accepts $xxx."
13193                                                         val="$xxx"
13194                                                 fi
13195                                                 ;;
13196                                         esac
13197                                 done
13198                         done
13199                 done
13200                 case "$val" in
13201                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13202                         case "$d_fd_set" in
13203                                 $define) dflt="fd_set *" ;;
13204                                 *)              dflt="int *" ;;
13205                         esac
13206                         . ./myread
13207                         val=$ans
13208                         ;;
13209                 esac
13210                 selecttype="$val"
13211                 ;;
13212         *)      : no select, so pick a harmless default
13213                 selecttype='int *'
13214                 ;;
13215         esac
13216         ;;
13217 esac
13218
13219 : check for the select 'width'
13220 case "$selectminbits" in
13221 '') case "$d_select" in
13222         $define)
13223                 $cat <<EOM
13224
13225 Checking to see on how many bits at a time your select() operates...
13226 EOM
13227                 $cat >try.c <<EOCP
13228 #include <sys/types.h>
13229 #$i_time I_TIME
13230 #$i_systime I_SYS_TIME
13231 #$i_systimek I_SYS_TIME_KERNEL
13232 #ifdef I_TIME
13233 #   include <time.h>
13234 #endif
13235 #ifdef I_SYS_TIME
13236 #   ifdef I_SYS_TIME_KERNEL
13237 #       define KERNEL
13238 #   endif
13239 #   include <sys/time.h>
13240 #   ifdef I_SYS_TIME_KERNEL
13241 #       undef KERNEL
13242 #   endif
13243 #endif
13244 #$i_sysselct I_SYS_SELECT
13245 #ifdef I_SYS_SELECT
13246 #include <sys/select.h>
13247 #endif
13248 #$d_socket HAS_SOCKET
13249 #ifdef HAS_SOCKET
13250 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13251 #endif
13252 #include <stdio.h>
13253 $selecttype b;
13254 #define S sizeof(*(b))
13255 #define MINBITS 64
13256 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13257 #define NBITS  (NBYTES * 8)
13258 int main() {
13259     char s[NBYTES];
13260     struct timeval t;
13261     int i;
13262     FILE* fp;
13263     int fd;
13264
13265     fclose(stdin);
13266     fp = fopen("try.c", "r");
13267     if (fp == 0)
13268       exit(1);
13269     fd = fileno(fp);
13270     if (fd < 0)
13271       exit(2);
13272     b = ($selecttype)s;
13273     for (i = 0; i < NBITS; i++)
13274         FD_SET(i, b);
13275     t.tv_sec  = 0;
13276     t.tv_usec = 0;
13277     select(fd + 1, b, 0, 0, &t);
13278     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13279     printf("%d\n", i + 1);
13280     return 0;
13281 }
13282 EOCP
13283                 set try
13284                 if eval $compile_ok; then
13285                         selectminbits=`./try`
13286                         case "$selectminbits" in
13287                         '')     cat >&4 <<EOM
13288 Cannot figure out on how many bits at a time your select() operates.
13289 I'll play safe and guess it is 32 bits.
13290 EOM
13291                                 selectminbits=32
13292                                 bits="32 bits"
13293                                 ;;
13294                         1)      bits="1 bit" ;;
13295                         *)      bits="$selectminbits bits" ;;
13296                         esac
13297                         echo "Your select() operates on $bits at a time." >&4
13298                 else
13299                         rp='What is the minimum number of bits your select() operates on?'
13300                         case "$byteorder" in
13301                         1234|12345678)  dflt=32 ;;
13302                         *)              dflt=1  ;;
13303                         esac
13304                         . ./myread
13305                         val=$ans
13306                         selectminbits="$val"
13307                 fi
13308                 $rm -f try.* try
13309                 ;;
13310         *)      : no select, so pick a harmless default
13311                 selectminbits='32'
13312                 ;;
13313         esac
13314         ;;
13315 esac
13316
13317 : Trace out the files included by signal.h, then look for SIGxxx names.
13318 : Remove SIGARRAYSIZE used by HPUX.
13319 : Remove SIGSTKSIZE used by Linux.
13320 : Remove SIGSTKSZ used by Posix.
13321 : Remove SIGTYP void lines used by OS2.
13322 : Some cpps, like os390, dont give the file name anywhere
13323 if [ "X$fieldn" = X ]; then
13324         : Just make some guesses.  We check them later.
13325         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13326 else
13327         xxx=`echo '#include <signal.h>' |
13328         $cppstdin $cppminus $cppflags 2>/dev/null |
13329         $grep '^[       ]*#.*include' | 
13330         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13331 fi
13332 : Check this list of files to be sure we have parsed the cpp output ok.
13333 : This will also avoid potentially non-existent files, such 
13334 : as ../foo/bar.h
13335 xxxfiles=''
13336 for xx in $xxx /dev/null ; do
13337         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13338 done
13339 : If we have found no files, at least try signal.h
13340 case "$xxxfiles" in
13341 '')     xxxfiles=`./findhdr signal.h` ;;
13342 esac
13343 xxx=`awk '
13344 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13345         print substr($2, 4, 20)
13346 }
13347 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13348         print substr($3, 4, 20)
13349 }' $xxxfiles`
13350 : Append some common names just in case the awk scan failed.
13351 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13352 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13353 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13354 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13355 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13356
13357 : generate a few handy files for later
13358 $cat > signal.c <<'EOCP'
13359 #include <sys/types.h>
13360 #include <signal.h>
13361 #include <stdio.h>
13362 int main() {
13363
13364 /* Strange style to avoid deeply-nested #if/#else/#endif */
13365 #ifndef NSIG
13366 #  ifdef _NSIG
13367 #    define NSIG (_NSIG)
13368 #  endif
13369 #endif
13370
13371 #ifndef NSIG
13372 #  ifdef SIGMAX
13373 #    define NSIG (SIGMAX+1)
13374 #  endif
13375 #endif
13376
13377 #ifndef NSIG
13378 #  ifdef SIG_MAX
13379 #    define NSIG (SIG_MAX+1)
13380 #  endif
13381 #endif
13382
13383 #ifndef NSIG
13384 #  ifdef MAXSIG
13385 #    define NSIG (MAXSIG+1)
13386 #  endif
13387 #endif
13388
13389 #ifndef NSIG
13390 #  ifdef MAX_SIG
13391 #    define NSIG (MAX_SIG+1)
13392 #  endif
13393 #endif
13394
13395 #ifndef NSIG
13396 #  ifdef SIGARRAYSIZE
13397 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13398 #  endif
13399 #endif
13400
13401 #ifndef NSIG
13402 #  ifdef _sys_nsig
13403 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13404 #  endif
13405 #endif
13406
13407 /* Default to some arbitrary number that's big enough to get most
13408    of the common signals.
13409 */
13410 #ifndef NSIG
13411 #    define NSIG 50
13412 #endif
13413
13414 printf("NSIG %d\n", NSIG);
13415
13416 #ifndef JUST_NSIG
13417
13418 EOCP
13419
13420 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13421 {
13422         printf "#ifdef SIG"; printf $1; printf "\n"
13423         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13424         printf $1; printf ");\n"
13425         printf "#endif\n"
13426 }
13427 END {
13428         printf "#endif /* JUST_NSIG */\n";
13429         printf "exit(0);\n}\n";
13430 }
13431 ' >>signal.c
13432 $cat >signal.awk <<'EOP'
13433 BEGIN { ndups = 0 }
13434 $1 ~ /^NSIG$/ { nsig = $2 }
13435 ($1 !~ /^NSIG$/) && (NF == 2) {
13436     if ($2 > maxsig) { maxsig = $2 }
13437     if (sig_name[$2]) {
13438         dup_name[ndups] = $1
13439         dup_num[ndups] = $2
13440         ndups++ 
13441     }
13442     else {
13443         sig_name[$2] = $1
13444         sig_num[$2] = $2
13445     }
13446 }
13447 END { 
13448     if (nsig == 0) {
13449         nsig = maxsig + 1
13450     }
13451     printf("NSIG %d\n", nsig);
13452     for (n = 1; n < nsig; n++) {
13453         if (sig_name[n]) {
13454             printf("%s %d\n", sig_name[n], sig_num[n])
13455         }
13456         else {
13457             printf("NUM%d %d\n", n, n) 
13458         }
13459     }
13460     for (n = 0; n < ndups; n++) {
13461         printf("%s %d\n", dup_name[n], dup_num[n])
13462     }
13463 }
13464 EOP
13465 $cat >signal_cmd <<EOS
13466 $startsh
13467 if $test -s signal.lst; then
13468     echo "Using your existing signal.lst file"
13469         exit 0
13470 fi
13471 xxx="$xxx"
13472 EOS
13473 $cat >>signal_cmd <<'EOS'
13474
13475 set signal
13476 if eval $compile_ok; then
13477         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13478 else
13479         echo "(I can't seem be able to compile the whole test program)" >&4
13480         echo "(I'll try it in little pieces.)" >&4
13481         set signal -DJUST_NSIG
13482         if eval $compile_ok; then
13483                 ./signal$_exe > signal.nsg
13484                 $cat signal.nsg
13485         else
13486                 echo "I can't seem to figure out how many signals you have." >&4
13487                 echo "Guessing 50." >&4
13488                 echo 'NSIG 50' > signal.nsg
13489         fi
13490         : Now look at all the signal names, one at a time.
13491         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13492                 $cat > signal.c <<EOCP
13493 #include <sys/types.h>
13494 #include <signal.h>
13495 #include <stdio.h>
13496 int main() {
13497 printf("$xx %d\n", SIG${xx});
13498 return 0;
13499 }
13500 EOCP
13501                 set signal
13502                 if eval $compile; then
13503                         echo "SIG${xx} found."
13504                         ./signal$_exe  >> signal.ls1
13505                 else
13506                         echo "SIG${xx} NOT found."
13507                 fi
13508         done
13509         if $test -s signal.ls1; then
13510                 $cat signal.nsg signal.ls1 |
13511                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13512         fi
13513
13514 fi
13515 if $test -s signal.lst; then
13516         :
13517 else
13518         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13519         echo 'kill -l' >signal
13520         set X `csh -f <signal`
13521         $rm -f signal
13522         shift
13523         case $# in
13524         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13525         esac
13526         echo $@ | $tr ' ' $trnl | \
13527             $awk '{ printf "%s %d\n", $1, ++s; }
13528                   END { printf "NSIG %d\n", ++s }' >signal.lst
13529 fi
13530 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13531 EOS
13532 chmod a+x signal_cmd
13533 $eunicefix signal_cmd
13534
13535 : generate list of signal names
13536 echo " "
13537 case "$sig_name_init" in
13538 '') doinit=yes ;;
13539 *)  case "$sig_num_init" in
13540     ''|*,*) doinit=yes ;;
13541     esac ;;
13542 esac
13543 case "$doinit" in
13544 yes)
13545         echo "Generating a list of signal names and numbers..." >&4
13546         . ./signal_cmd
13547         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13548         sig_name=`$awk 'BEGIN { printf "ZERO " }
13549                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13550         sig_num=`$awk  'BEGIN { printf "0 " }
13551                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13552         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13553                              !/^NSIG/   { printf "\"%s\", ", $1 }
13554                              END        { printf "0\n" }' signal.lst`
13555         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13556                              !/^NSIG/   { printf "%d, ", $2}
13557                              END        { printf "0\n"}' signal.lst`
13558         ;;
13559 esac
13560 echo "The following $sig_count signals are available:"
13561 echo " "
13562 echo $sig_name | $awk \
13563 'BEGIN { linelen = 0 }
13564 {
13565         for (i = 1; i <= NF; i++) {
13566                 name = "SIG" $i " "
13567                 linelen = linelen + length(name)
13568                 if (linelen > 70) {
13569                         printf "\n"
13570                         linelen = length(name)
13571                 }
13572                 printf "%s", name
13573         }
13574         printf "\n"
13575 }'
13576 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13577
13578 : check for socklen_t
13579 echo " "
13580 echo "Checking to see if you have socklen_t..." >&4
13581 $cat >try.c <<EOCP
13582 #include <sys/types.h>
13583 #$d_socket HAS_SOCKET
13584 #ifdef HAS_SOCKET
13585 #include <sys/socket.h>
13586 #endif
13587 int main() { socklen_t x = 16; }
13588 EOCP
13589 set try
13590 if eval $compile; then
13591         val="$define"
13592         echo "You have socklen_t."
13593 else
13594         val="$undef"
13595         echo "You do not have socklen_t."
13596         case "$sizetype" in
13597         size_t) echo "(You do have size_t, that might work.)" ;;
13598         esac
13599 fi
13600 $rm -f try try.*
13601 set d_socklen_t
13602 eval $setvar
13603
13604 : check for type of the size argument to socket calls
13605 case "$d_socket" in
13606 "$define")
13607         $cat <<EOM
13608
13609 Checking to see what type is the last argument of accept().
13610 EOM
13611         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13612         yyy=''
13613         case "$d_socklen_t" in
13614         "$define") yyy="$yyy socklen_t"
13615         esac
13616         yyy="$yyy $sizetype int long"
13617         for xxx in $yyy; do
13618                 case "$socksizetype" in
13619                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13620                         if ./protochk "$try" $hdrs; then
13621                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13622                                 socksizetype="$xxx"
13623                         fi
13624                         ;;
13625                 esac
13626         done
13627 : In case none of those worked, prompt the user.
13628         case "$socksizetype" in
13629         '')     rp='What is the type for socket address structure sizes?'
13630                 dflt='int'
13631                 . ./myread
13632                 socksizetype=$ans
13633                 ;;
13634         esac
13635         ;;
13636 *)      : no sockets, so pick relatively harmless defaults
13637         socksizetype='char *'
13638         ;;
13639 esac
13640
13641 : see what type is used for signed size_t
13642 set ssize_t ssizetype int stdio.h sys/types.h
13643 eval $typedef
13644 dflt="$ssizetype"
13645 $cat > ssize.c <<EOM
13646 #include <stdio.h>
13647 #include <sys/types.h>
13648 #define Size_t $sizetype
13649 #define SSize_t $dflt
13650 int main()
13651 {
13652         if (sizeof(Size_t) == sizeof(SSize_t))
13653                 printf("$dflt\n");
13654         else if (sizeof(Size_t) == sizeof(int))
13655                 printf("int\n");
13656         else 
13657                 printf("long\n");
13658         exit(0);
13659 }
13660 EOM
13661 echo " "
13662 set ssize
13663 if eval $compile_ok && ./ssize > /dev/null; then
13664         ssizetype=`./ssize`
13665         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13666 else
13667         $cat >&4 <<EOM
13668 Help! I can't compile and run the ssize_t test program: please enlighten me!
13669 (This is probably a misconfiguration in your system or libraries, and
13670 you really ought to fix it.  Still, I'll try anyway.)
13671
13672 I need a type that is the same size as $sizetype, but is guaranteed to
13673 be signed.  Common values are ssize_t, int and long.
13674
13675 EOM
13676         rp="What signed type is the same size as $sizetype?"
13677         . ./myread
13678         ssizetype="$ans"
13679 fi
13680 $rm -f ssize ssize.*
13681
13682 : see what type of char stdio uses.
13683 echo " "
13684 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13685         echo "Your stdio uses unsigned chars." >&4
13686         stdchar="unsigned char"
13687 else
13688         echo "Your stdio uses signed chars." >&4
13689         stdchar="char"
13690 fi
13691
13692 : see if time exists
13693 echo " "
13694 if test "X$d_time" = X -o X"$timetype" = X; then
13695     if set time val -f d_time; eval $csym; $val; then
13696                 echo 'time() found.' >&4
13697                 val="$define"
13698                 rp="What is the type returned by time() on this system?"
13699                 set time_t timetype long stdio.h sys/types.h
13700                 eval $typedef_ask
13701     else
13702                 echo 'time() not found, hope that will do.' >&4
13703                 val="$undef"
13704                 timetype='int';
13705     fi
13706     set d_time
13707     eval $setvar
13708 fi
13709
13710 : see what type uids are declared as in the kernel
13711 echo " "
13712 echo "Looking for the type for user ids returned by getuid()."
13713 set uid_t uidtype xxx stdio.h sys/types.h
13714 eval $typedef
13715 case "$uidtype" in
13716 xxx)
13717         xxx=`./findhdr sys/user.h`
13718         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13719         case $1 in
13720         unsigned) dflt="$1 $2" ;;
13721         *) dflt="$1" ;;
13722         esac
13723         ;;
13724 *) dflt="$uidtype";;
13725 esac
13726 case "$uidtype" in
13727 uid_t)  echo "uid_t found." ;;
13728 *)      rp="What is the type for user ids returned by getuid()?"
13729         . ./myread
13730         uidtype="$ans"
13731         ;;
13732 esac
13733
13734 echo " "
13735 case "$uidtype" in
13736 *_t) zzz="$uidtype"     ;;
13737 *)   zzz="uid"          ;;
13738 esac
13739 echo "Checking the size of $zzz..." >&4 
13740 cat > try.c <<EOCP
13741 #include <sys/types.h>
13742 #include <stdio.h>
13743 int main() {
13744     printf("%d\n", (int)sizeof($uidtype));
13745     exit(0);
13746 }
13747 EOCP
13748 set try
13749 if eval $compile_ok; then
13750         yyy=`./try`
13751         case "$yyy" in
13752         '')     uidsize=4
13753                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13754                 ;;
13755         *)      uidsize=$yyy
13756                 echo "Your $zzz is $uidsize bytes long."
13757                 ;;
13758         esac
13759 else
13760         uidsize=4
13761         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13762 fi
13763
13764 echo " "
13765 case "$uidtype" in
13766 *_t) zzz="$uidtype"     ;;
13767 *)   zzz="uid"          ;;
13768 esac
13769 echo "Checking the sign of $zzz..." >&4
13770 cat > try.c <<EOCP
13771 #include <sys/types.h>
13772 #include <stdio.h>
13773 int main() {
13774         $uidtype foo = -1;
13775         if (foo < 0)
13776                 printf("-1\n");
13777         else
13778                 printf("1\n");
13779 }
13780 EOCP
13781 set try
13782 if eval $compile; then
13783         yyy=`./try`
13784         case "$yyy" in
13785         '')     uidsign=1
13786                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13787                 ;;
13788         *)      uidsign=$yyy
13789                 case "$uidsign" in
13790                  1) echo "Your $zzz is unsigned." ;;
13791                 -1) echo "Your $zzz is signed."   ;;
13792                 esac
13793                 ;;
13794         esac
13795 else
13796         uidsign=1
13797         echo "(I can't compile the test program--guessing unsigned.)" >&4
13798 fi
13799
13800
13801
13802 echo " "
13803 $echo "Checking the format string to be used for uids..." >&4
13804
13805 case "$uidsign" in
13806 -1)     if $test X"$uidsize" = X"$ivsize"; then
13807                 uidformat="$ivdformat"
13808         else
13809                 if $test X"$uidsize" = X"$longsize"; then
13810                         uidformat='"ld"'
13811                 else
13812                         if $test X"$uidsize" = X"$intsize"; then
13813                                 uidformat='"d"'
13814                         else
13815                                 if $test X"$uidsize" = X"$shortsize"; then
13816                                         uidformat='"hd"'
13817                                 fi
13818                         fi
13819                 fi
13820         fi
13821         ;;
13822 *)      if $test X"$uidsize" = X"$uvsize"; then
13823                 uidformat="$uvuformat"
13824         else
13825                 if $test X"$uidsize" = X"$longsize"; then
13826                         uidformat='"lu"'
13827                 else
13828                         if $test X"$uidsize" = X"$intsize"; then
13829                                 uidformat='"u"'
13830                         else
13831                                 if $test X"$uidsize" = X"$shortsize"; then
13832                                         uidformat='"hu"'
13833                                 fi
13834                         fi
13835                 fi
13836         fi
13837         ;;
13838 esac
13839
13840 : see if dbm.h is available
13841 : see if dbmclose exists
13842 set dbmclose d_dbmclose
13843 eval $inlibc
13844
13845 case "$d_dbmclose" in
13846 $define)
13847         set dbm.h i_dbm
13848         eval $inhdr
13849         case "$i_dbm" in
13850         $define)
13851                 val="$undef"
13852                 set i_rpcsvcdbm
13853                 eval $setvar
13854                 ;;
13855         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13856                 eval $inhdr
13857                 ;;
13858         esac
13859         ;;
13860 *)      echo "We won't be including <dbm.h>"
13861         val="$undef"
13862         set i_dbm
13863         eval $setvar
13864         val="$undef"
13865         set i_rpcsvcdbm
13866         eval $setvar
13867         ;;
13868 esac
13869
13870 : see if this is a sys/file.h system
13871 val=''
13872 set sys/file.h val
13873 eval $inhdr
13874
13875 : do we need to include sys/file.h ?
13876 case "$val" in
13877 "$define")
13878         echo " "
13879         if $h_sysfile; then
13880                 val="$define"
13881                 echo "We'll be including <sys/file.h>." >&4
13882         else
13883                 val="$undef"
13884                 echo "We won't be including <sys/file.h>." >&4
13885         fi
13886         ;;
13887 *)
13888         h_sysfile=false
13889         ;;
13890 esac
13891 set i_sysfile
13892 eval $setvar
13893
13894 : see if fcntl.h is there
13895 val=''
13896 set fcntl.h val
13897 eval $inhdr
13898
13899 : see if we can include fcntl.h
13900 case "$val" in
13901 "$define")
13902         echo " "
13903         if $h_fcntl; then
13904                 val="$define"
13905                 echo "We'll be including <fcntl.h>." >&4
13906         else
13907                 val="$undef"
13908                 if $h_sysfile; then
13909         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13910                 else
13911                         echo "We won't be including <fcntl.h>." >&4
13912                 fi
13913         fi
13914         ;;
13915 *)
13916         h_fcntl=false
13917         val="$undef"
13918         ;;
13919 esac
13920 set i_fcntl
13921 eval $setvar
13922
13923 : see if this is a iconv.h system
13924 set iconv.h i_iconv
13925 eval $inhdr
13926
13927 : see if locale.h is available
13928 set locale.h i_locale
13929 eval $inhdr
13930
13931 : see if mach cthreads are available
13932 if test "X$usethreads" = "X$define"; then
13933         set mach/cthreads.h i_machcthr
13934         eval $inhdr
13935 else
13936         i_machcthr="$undef"
13937 fi
13938
13939
13940
13941 : see if this is a math.h system
13942 set math.h i_math
13943 eval $inhdr
13944
13945 : see if this is a mntent.h system
13946 set mntent.h i_mntent
13947 eval $inhdr
13948
13949 : see if ndbm.h is available
13950 set ndbm.h t_ndbm
13951 eval $inhdr
13952 case "$t_ndbm" in
13953 $define)
13954         : see if dbm_open exists
13955         set dbm_open d_dbm_open
13956         eval $inlibc
13957         case "$d_dbm_open" in
13958         $undef)
13959                 t_ndbm="$undef"
13960                 echo "We won't be including <ndbm.h>"
13961                 ;;
13962         esac
13963         ;;
13964 esac
13965 val="$t_ndbm"
13966 set i_ndbm
13967 eval $setvar
13968
13969 : see if net/errno.h is available
13970 val=''
13971 set net/errno.h val
13972 eval $inhdr
13973
13974 : Unfortunately, it causes problems on some systems.  Arrgh.
13975 case "$val" in
13976 $define)
13977         cat > try.c <<'EOM'
13978 #include <stdio.h>
13979 #include <errno.h>
13980 #include <net/errno.h>
13981 int func()
13982 {
13983         return ENOTSOCK;
13984 }
13985 EOM
13986         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13987                 echo "We'll be including <net/errno.h>." >&4
13988         else
13989                 echo "We won't be including <net/errno.h>." >&4
13990                 val="$undef"
13991         fi
13992         $rm -f try.* try
13993         ;;
13994 esac
13995 set i_neterrno
13996 eval $setvar
13997
13998 : see if netinet/tcp.h is available
13999 set netinet/tcp.h i_netinettcp
14000 eval $inhdr
14001
14002 : see if this is a poll.h system
14003 set poll.h i_poll
14004 eval $inhdr
14005
14006 echo " "
14007 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14008 $cat <<'EOSH' > Cppsym.know
14009 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14010 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14011 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14012 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14013 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14014 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14015 bull c cadmus clipper CMU COFF COMPILER_VERSION
14016 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14017 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14018 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14019 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14020 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14021 H3050R H3050RX hbullx20 hcx host_mips
14022 hp200 hp300 hp700 HP700 hp800 hp9000
14023 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14024 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14025 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14026 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14027 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14028 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14029 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14030 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14031 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14032 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14033 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14034 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14035 MATH_HAS_NO_SIDE_EFFECTS
14036 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14037 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14038 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14039 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14040 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14041 NetBSD news1500 news1700 news1800 news1900 news3700
14042 news700 news800 news900 NeXT NLS ns16000 ns32000
14043 ns32016 ns32332 ns32k nsc32000
14044 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14045 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14046 pc532 pdp11 PGC PIC plexus PORTAR posix
14047 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14048 POSIX_C_SOURCE POSIX_SOURCE POWER
14049 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14050 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14051 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14052 sony sony_news sonyrisc sparc sparclite spectrum
14053 stardent stdc STDC_EXT stratos sun sun3 sun386
14054 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14055 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14056 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14057 sysV68 sysV88 Tek4132 Tek4300 titan
14058 tower tower32 tower32_200 tower32_600 tower32_700
14059 tower32_800 tower32_850 tss
14060 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14061 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14062 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14063 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14064 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14065 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14066 z8000
14067 EOSH
14068 # Maybe put other stuff here too.
14069 cat <<EOSH >>Cppsym.know
14070 $osname
14071 EOSH
14072 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14073 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14074 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14075 $rm -f Cppsym.a Cppsym.b
14076 cat <<EOSH > Cppsym
14077 $startsh
14078 if $test \$# -gt 0; then
14079     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14080     if $test -s Cppsym.got; then
14081         $rm -f Cppsym.got
14082         exit 0
14083     fi
14084     $rm -f Cppsym.got
14085     exit 1
14086 else
14087     $tr " " "$trnl" | ./Cppsym.try
14088     exit 0
14089 fi
14090 EOSH
14091 chmod +x Cppsym
14092 $eunicefix Cppsym
14093 cat <<EOSH > Cppsym.try
14094 $startsh
14095 cat <<'EOCP' > try.c
14096 #include <stdio.h>
14097 int main() {
14098 EOCP
14099 $awk \\
14100 EOSH
14101 cat <<'EOSH' >> Cppsym.try
14102 'length($1) > 0 {
14103     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
14104     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
14105     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
14106     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
14107 }'       >> try.c
14108 echo '}' >> try.c
14109 EOSH
14110 cat <<EOSH >> Cppsym.try
14111 ccflags="$ccflags"
14112 case "$osname-$gccversion" in
14113 irix-) ccflags="\$ccflags -woff 1178" ;;
14114 esac
14115 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14116 EOSH
14117 chmod +x Cppsym.try
14118 $eunicefix Cppsym.try
14119 ./Cppsym < Cppsym.know > Cppsym.true
14120 : now check the C compiler for additional symbols
14121 postprocess_cc_v=''
14122 case "$osname" in
14123 aix) postprocess_cc_v="|$tr , ' '" ;;
14124 esac
14125 $cat >ccsym <<EOS
14126 $startsh
14127 $cat >tmp.c <<EOF
14128 extern int foo;
14129 EOF
14130 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14131 do
14132         case "\$i" in
14133         -D*) echo "\$i" | $sed 's/^-D//';;
14134         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14135         esac
14136 done
14137 $rm -f try.c
14138 EOS
14139 postprocess_cc_v=''
14140 chmod +x ccsym
14141 $eunicefix ccsym
14142 ./ccsym > ccsym1.raw
14143 if $test -s ccsym1.raw; then
14144        $sort ccsym1.raw | $uniq >ccsym.raw
14145 else
14146        mv ccsym1.raw ccsym.raw
14147 fi
14148
14149 $awk '/\=/ { print $0; next }
14150         { print $0"=1" }' ccsym.raw >ccsym.list
14151 $awk '/\=/ { print $0; next }
14152         { print $0"=1" }' Cppsym.true >ccsym.true
14153 $comm -13 ccsym.true ccsym.list >ccsym.own
14154 $comm -12 ccsym.true ccsym.list >ccsym.com
14155 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14156 also=''
14157 if $test -z ccsym.raw; then
14158         echo "Your C compiler doesn't seem to define any symbols!" >&4
14159         echo " "
14160         echo "However, your C preprocessor defines the following symbols:"
14161         $cat Cppsym.true
14162         ccsymbols=''
14163         cppsymbols=`$cat Cppsym.true`
14164         cppsymbols=`echo $cppsymbols`
14165         cppccsymbols="$cppsymbols"
14166 else
14167         if $test -s ccsym.com; then
14168                 echo "Your C compiler and pre-processor define these symbols:"
14169                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14170                 also='also '
14171                 symbols='ones'
14172                 cppccsymbols=`$cat ccsym.com`
14173                 cppccsymbols=`echo $cppccsymbols`
14174                 $test "$silent" || sleep 1
14175         fi
14176         if $test -s ccsym.cpp; then
14177                 $test "$also" && echo " "
14178                 echo "Your C pre-processor ${also}defines the following symbols:"
14179                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14180                 also='further '
14181                 cppsymbols=`$cat ccsym.cpp`
14182                 cppsymbols=`echo $cppsymbols`
14183                 $test "$silent" || sleep 1
14184         fi
14185         if $test -s ccsym.own; then
14186                 $test "$also" && echo " "
14187                 echo "Your C compiler ${also}defines the following cpp symbols:"
14188                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14189                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14190                 ccsymbols=`$cat ccsym.own`
14191                 ccsymbols=`echo $ccsymbols`
14192                 $test "$silent" || sleep 1
14193         fi
14194 fi
14195 $rm -f ccsym*
14196
14197 : see if this is a termio system
14198 val="$undef"
14199 val2="$undef"
14200 val3="$undef"
14201 if $test `./findhdr termios.h`; then
14202         set tcsetattr i_termios
14203         eval $inlibc
14204         val3="$i_termios"
14205 fi
14206 echo " "
14207 case "$val3" in
14208 "$define") echo "You have POSIX termios.h... good!" >&4;;
14209 *) if ./Cppsym pyr; then
14210                 case "`/bin/universe`" in
14211                 ucb) if $test `./findhdr sgtty.h`; then
14212                                 val2="$define"
14213                                 echo "<sgtty.h> found." >&4
14214                         else
14215                                 echo "System is pyramid with BSD universe."
14216                                 echo "<sgtty.h> not found--you could have problems." >&4
14217                         fi;;
14218                 *) if $test `./findhdr termio.h`; then
14219                                 val="$define"
14220                                 echo "<termio.h> found." >&4
14221                         else
14222                                 echo "System is pyramid with USG universe."
14223                                 echo "<termio.h> not found--you could have problems." >&4
14224                         fi;;
14225                 esac
14226         elif ./usg; then
14227                 if $test `./findhdr termio.h`; then
14228                         echo "<termio.h> found." >&4
14229                         val="$define"
14230                 elif $test `./findhdr sgtty.h`; then
14231                         echo "<sgtty.h> found." >&4
14232                         val2="$define"
14233                 else
14234 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14235                 fi
14236         else
14237                 if $test `./findhdr sgtty.h`; then
14238                         echo "<sgtty.h> found." >&4
14239                         val2="$define"
14240                 elif $test `./findhdr termio.h`; then
14241                         echo "<termio.h> found." >&4
14242                         val="$define"
14243                 else
14244 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14245                 fi
14246         fi;;
14247 esac
14248 set i_termio; eval $setvar
14249 val=$val2; set i_sgtty; eval $setvar
14250 val=$val3; set i_termios; eval $setvar
14251
14252 : see if this is a shadow.h system
14253 set shadow.h i_shadow
14254 eval $inhdr
14255
14256 : see if this is a socks.h system
14257 set socks.h i_socks
14258 eval $inhdr
14259
14260 : see if stdarg is available
14261 echo " "
14262 if $test `./findhdr stdarg.h`; then
14263         echo "<stdarg.h> found." >&4
14264         valstd="$define"
14265 else
14266         echo "<stdarg.h> NOT found." >&4
14267         valstd="$undef"
14268 fi
14269
14270 : see if varags is available
14271 echo " "
14272 if $test `./findhdr varargs.h`; then
14273         echo "<varargs.h> found." >&4
14274 else
14275         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14276 fi
14277
14278 : set up the varargs testing programs
14279 $cat > varargs.c <<EOP
14280 #ifdef I_STDARG
14281 #include <stdarg.h>
14282 #endif
14283 #ifdef I_VARARGS
14284 #include <varargs.h>
14285 #endif
14286
14287 #ifdef I_STDARG
14288 int f(char *p, ...)
14289 #else
14290 int f(va_alist)
14291 va_dcl
14292 #endif
14293 {
14294         va_list ap;
14295 #ifndef I_STDARG
14296         char *p;
14297 #endif
14298 #ifdef I_STDARG
14299         va_start(ap,p);
14300 #else
14301         va_start(ap);
14302         p = va_arg(ap, char *);
14303 #endif
14304         va_end(ap);
14305 }
14306 EOP
14307 $cat > varargs <<EOP
14308 $startsh
14309 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14310         echo "true"
14311 else
14312         echo "false"
14313 fi
14314 $rm -f varargs$_o
14315 EOP
14316 chmod +x varargs
14317
14318 : now check which varargs header should be included
14319 echo " "
14320 i_varhdr=''
14321 case "$valstd" in
14322 "$define")
14323         if `./varargs I_STDARG`; then
14324                 val='stdarg.h'
14325         elif `./varargs I_VARARGS`; then
14326                 val='varargs.h'
14327         fi
14328         ;;
14329 *)
14330         if `./varargs I_VARARGS`; then
14331                 val='varargs.h'
14332         fi
14333         ;;
14334 esac
14335 case "$val" in
14336 '')
14337 echo "I could not find the definition for va_dcl... You have problems..." >&4
14338         val="$undef"; set i_stdarg; eval $setvar
14339         val="$undef"; set i_varargs; eval $setvar
14340         ;;
14341 *) 
14342         set i_varhdr
14343         eval $setvar
14344         case "$i_varhdr" in
14345         stdarg.h)
14346                 val="$define"; set i_stdarg; eval $setvar
14347                 val="$undef"; set i_varargs; eval $setvar
14348                 ;;
14349         varargs.h)
14350                 val="$undef"; set i_stdarg; eval $setvar
14351                 val="$define"; set i_varargs; eval $setvar
14352                 ;;
14353         esac
14354         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14355 esac
14356 $rm -f varargs*
14357
14358 : see if stddef is available
14359 set stddef.h i_stddef
14360 eval $inhdr
14361
14362 : see if sys/access.h is available
14363 set sys/access.h i_sysaccess
14364 eval $inhdr
14365
14366 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14367 set sys/filio.h i_sysfilio
14368 eval $inhdr
14369 echo " "
14370 if $test `./findhdr sys/ioctl.h`; then
14371         val="$define"
14372         echo '<sys/ioctl.h> found.' >&4
14373 else
14374         val="$undef"
14375         if $test $i_sysfilio = "$define"; then
14376             echo '<sys/ioctl.h> NOT found.' >&4
14377         else
14378                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14379                 $test $i_termio = "$define" && xxx="termio.h"
14380                 $test $i_termios = "$define" && xxx="termios.h"
14381 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14382         fi
14383 fi
14384 set i_sysioctl
14385 eval $setvar
14386
14387
14388 : see if this is a syslog.h system
14389 set syslog.h i_syslog
14390 eval $inhdr
14391
14392
14393 : see if this is a sys/mode.h system
14394 set sys/mode.h i_sysmode
14395 eval $inhdr
14396
14397 : see if sys/resource.h has to be included
14398 set sys/resource.h i_sysresrc
14399 eval $inhdr
14400
14401 : see if sys/security.h is available
14402 set sys/security.h i_syssecrt
14403 eval $inhdr
14404
14405 : see if this is a sys/statvfs.h system
14406 set sys/statvfs.h i_sysstatvfs
14407 eval $inhdr
14408
14409 : see if this is a sys/uio.h system
14410 set sys/uio.h i_sysuio
14411 eval $inhdr
14412
14413 : see if this is a sys/un.h system
14414 set sys/un.h i_sysun
14415 eval $inhdr
14416
14417
14418 : see if this is a sys/utsname.h system
14419 set sys/utsname.h i_sysutsname
14420 eval $inhdr
14421
14422 : see if this is a syswait system
14423 set sys/wait.h i_syswait
14424 eval $inhdr
14425
14426 : see if this is a ustat.h system
14427 set ustat.h i_ustat
14428 eval $inhdr
14429
14430 : see if this is an utime system
14431 set utime.h i_utime
14432 eval $inhdr
14433
14434 : see if this is a values.h system
14435 set values.h i_values
14436 eval $inhdr
14437
14438 : see if this is a vfork system
14439 case "$d_vfork" in
14440 "$define")
14441         set vfork.h i_vfork
14442         eval $inhdr
14443         ;;
14444 *)
14445         i_vfork="$undef"
14446         ;;
14447 esac
14448
14449 : see if gdbm.h is available
14450 set gdbm.h t_gdbm
14451 eval $inhdr
14452 case "$t_gdbm" in
14453 $define)
14454         : see if gdbm_open exists
14455         set gdbm_open d_gdbm_open
14456         eval $inlibc
14457         case "$d_gdbm_open" in
14458         $undef)
14459                 t_gdbm="$undef"
14460                 echo "We won't be including <gdbm.h>"
14461                 ;;
14462         esac
14463         ;;
14464 esac
14465 val="$t_gdbm"
14466 set i_gdbm
14467 eval $setvar
14468
14469 echo " "
14470 echo "Looking for extensions..." >&4
14471 : If we are using the old config.sh, known_extensions may contain
14472 : old or inaccurate or duplicate values.
14473 known_extensions=''
14474 nonxs_extensions=''
14475 : We do not use find because it might not be available.
14476 : We do not just use MANIFEST because the user may have dropped
14477 : some additional extensions into the source tree and expect them
14478 : to be built.
14479
14480 : Function to recursively find available extensions, ignoring DynaLoader
14481 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14482 find_extensions='
14483     for xxx in *; do
14484        case "$xxx" in
14485            DynaLoader|dynaload) ;;
14486            *)
14487            if $test -f $xxx/$xxx.xs; then
14488                known_extensions="$known_extensions $1$xxx";
14489            elif $test -f $xxx/Makefile.PL; then
14490                nonxs_extensions="$nonxs_extensions $1$xxx";
14491            else
14492                if $test -d $xxx -a $# -lt 10; then
14493                    set $1$xxx/ $*;
14494                    cd $xxx;
14495                    eval $find_extensions;
14496                    cd ..;
14497                    shift;
14498                fi;
14499            fi
14500            ;;
14501        esac;
14502     done'
14503 tdir=`pwd`
14504 cd $rsrc/ext
14505 set X
14506 shift
14507 eval $find_extensions
14508 set X $nonxs_extensions
14509 shift
14510 nonxs_extensions="$*"
14511 set X $known_extensions
14512 shift
14513 known_extensions="$*"
14514 cd $tdir
14515
14516 : Now see which are supported on this system.
14517 avail_ext=''
14518 for xxx in $known_extensions ; do
14519         case "$xxx" in
14520         DB_File|db_file)
14521                 case "$i_db" in
14522                 $define) avail_ext="$avail_ext $xxx" ;;
14523                 esac
14524                 ;;
14525         GDBM_File|gdbm_fil)
14526                 case "$i_gdbm" in 
14527                 $define) avail_ext="$avail_ext $xxx" ;;
14528                 esac
14529                 ;;
14530         NDBM_File|ndbm_fil)
14531                 case "$i_ndbm" in
14532                 $define)
14533                     case "$osname-$use64bitint" in
14534                     hpux-define)
14535                         case "$libs" in
14536                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14537                         esac
14538                         ;;
14539                     *) avail_ext="$avail_ext $xxx" ;;
14540                     esac
14541                     ;;
14542                 esac
14543                 ;;
14544         ODBM_File|odbm_fil) 
14545                 case "${i_dbm}${i_rpcsvcdbm}" in
14546                 *"${define}"*)
14547                     case "$osname-$use64bitint" in
14548                     hpux-define)
14549                         case "$libs" in
14550                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14551                         esac
14552                         ;;
14553                     *) avail_ext="$avail_ext $xxx" ;;
14554                     esac
14555                     ;;
14556                 esac
14557                 ;;
14558         POSIX|posix)
14559                 case "$useposix" in
14560                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14561                 esac
14562                 ;;
14563         Opcode|opcode)
14564                 case "$useopcode" in
14565                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14566                 esac
14567                 ;;
14568         Socket|socket)
14569                 case "$d_socket" in 
14570                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14571                 esac
14572                 ;;
14573         Thread|thread)
14574                 case "$usethreads" in 
14575                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14576                 esac
14577                 ;;
14578         IPC/SysV|ipc/sysv)
14579                 : XXX Do we need a useipcsysv variable here
14580                 case "${d_msg}${d_sem}${d_shm}" in 
14581                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14582                 esac
14583                 ;;
14584         *)      avail_ext="$avail_ext $xxx"
14585                 ;;
14586         esac
14587 done
14588
14589 set X $avail_ext
14590 shift
14591 avail_ext="$*"
14592
14593 : Now see which nonxs extensions are supported on this system.
14594 : For now assume all are.
14595 nonxs_ext=''
14596 for xxx in $nonxs_extensions ; do
14597         case "$xxx" in
14598         *)      nonxs_ext="$nonxs_ext $xxx"
14599                 ;;
14600         esac
14601 done
14602
14603 set X $nonxs_ext
14604 shift
14605 nonxs_ext="$*"
14606
14607 case $usedl in
14608 $define)
14609         $cat <<EOM
14610 A number of extensions are supplied with $package.  You may choose to
14611 compile these extensions for dynamic loading (the default), compile
14612 them into the $package executable (static loading), or not include
14613 them at all.  Answer "none" to include no extensions.
14614 Note that DynaLoader is always built and need not be mentioned here.
14615
14616 EOM
14617         case "$dynamic_ext" in
14618         '') dflt="$avail_ext" ;;
14619         *)      dflt="$dynamic_ext"
14620                 # Perhaps we are reusing an old out-of-date config.sh.
14621                 case "$hint" in
14622                 previous)
14623                         if test X"$dynamic_ext" != X"$avail_ext"; then
14624                                 $cat <<EOM
14625 NOTICE:  Your previous config.sh list may be incorrect. 
14626 The extensions now available to you are 
14627         ${avail_ext}
14628 but the default list from your previous config.sh is
14629         ${dynamic_ext} 
14630
14631 EOM
14632                         fi
14633                         ;;
14634                 esac
14635                 ;;
14636         esac
14637         case "$dflt" in
14638         '')     dflt=none;;
14639         esac
14640         rp="What extensions do you wish to load dynamically?"
14641         . ./myread
14642         case "$ans" in
14643         none) dynamic_ext=' ' ;;
14644         *) dynamic_ext="$ans" ;;
14645         esac
14646
14647         case "$static_ext" in
14648         '')
14649                 : Exclude those already listed in dynamic linking
14650                 dflt=''
14651                 for xxx in $avail_ext; do
14652                         case " $dynamic_ext " in
14653                         *" $xxx "*) ;;
14654                         *) dflt="$dflt $xxx" ;;
14655                         esac
14656                 done
14657                 set X $dflt
14658                 shift
14659                 dflt="$*"
14660                 ;;
14661         *)  dflt="$static_ext" 
14662                 ;;
14663         esac
14664
14665         case "$dflt" in
14666         '')     dflt=none;;
14667         esac
14668         rp="What extensions do you wish to load statically?"
14669         . ./myread
14670         case "$ans" in
14671         none) static_ext=' ' ;;
14672         *) static_ext="$ans" ;;
14673         esac
14674         ;;
14675 *)
14676         $cat <<EOM
14677 A number of extensions are supplied with $package.  Answer "none" 
14678 to include no extensions. 
14679 Note that DynaLoader is always built and need not be mentioned here.
14680
14681 EOM
14682         case "$static_ext" in
14683         '') dflt="$avail_ext" ;;
14684         *)      dflt="$static_ext"
14685                 # Perhaps we are reusing an old out-of-date config.sh.
14686                 case "$hint" in
14687                 previous)
14688                         if test X"$static_ext" != X"$avail_ext"; then
14689                                 $cat <<EOM
14690 NOTICE:  Your previous config.sh list may be incorrect. 
14691 The extensions now available to you are 
14692         ${avail_ext}
14693 but the default list from your previous config.sh is
14694         ${static_ext} 
14695
14696 EOM
14697                         fi
14698                         ;;
14699                 esac
14700                 ;;
14701         esac
14702         : Exclude those that are not xs extensions
14703         case "$dflt" in
14704         '')     dflt=none;;
14705         esac
14706         rp="What extensions do you wish to include?"
14707         . ./myread
14708         case "$ans" in
14709         none) static_ext=' ' ;;
14710         *) static_ext="$ans" ;;
14711         esac
14712         ;;
14713 esac
14714
14715 set X $dynamic_ext $static_ext $nonxs_ext
14716 shift
14717 extensions="$*"
14718
14719 : Remove build directory name from cppstdin so it can be used from
14720 : either the present location or the final installed location.
14721 echo " "
14722 : Get out of the UU directory to get correct path name.
14723 cd ..
14724 case "$cppstdin" in
14725 `pwd`/cppstdin)
14726         echo "Stripping down cppstdin path name"
14727         cppstdin=cppstdin
14728         ;;
14729 esac
14730 cd UU
14731
14732 : end of configuration questions
14733 echo " "
14734 echo "End of configuration questions."
14735 echo " "
14736
14737 : back to where it started
14738 if test -d ../UU; then
14739         cd ..
14740 fi
14741
14742 : configuration may be patched via a 'config.over' file
14743 if $test -f config.over; then
14744         echo " "
14745         dflt=y
14746         rp='I see a config.over file.  Do you wish to load it?'
14747         . UU/myread
14748         case "$ans" in
14749         n*) echo "OK, I'll ignore it.";;
14750         *)      . ./config.over
14751                 echo "Configuration override changes have been loaded."
14752                 ;;
14753         esac
14754 fi
14755
14756 : in case they want portability, strip down executable paths
14757 case "$d_portable" in
14758 "$define")
14759         echo " "
14760         echo "Stripping down executable paths..." >&4
14761         for file in $loclist $trylist; do
14762                 eval temp=\$$file
14763                 eval $file=`basename $temp`
14764         done
14765         ;;
14766 esac
14767
14768 : create config.sh file
14769 echo " "
14770 echo "Creating config.sh..." >&4
14771 $spitshell <<EOT >config.sh
14772 $startsh
14773 #
14774 # This file was produced by running the Configure script. It holds all the
14775 # definitions figured out by Configure. Should you modify one of these values,
14776 # do not forget to propagate your changes by running "Configure -der". You may
14777 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14778 #
14779
14780 # Package name      : $package
14781 # Source directory  : $src
14782 # Configuration time: $cf_time
14783 # Configured by     : $cf_by
14784 # Target system     : $myuname
14785
14786 Author='$Author'
14787 Date='$Date'
14788 Header='$Header'
14789 Id='$Id'
14790 Locker='$Locker'
14791 Log='$Log'
14792 Mcc='$Mcc'
14793 RCSfile='$RCSfile'
14794 Revision='$Revision'
14795 Source='$Source'
14796 State='$State'
14797 _a='$_a'
14798 _exe='$_exe'
14799 _o='$_o'
14800 afs='$afs'
14801 alignbytes='$alignbytes'
14802 ansi2knr='$ansi2knr'
14803 aphostname='$aphostname'
14804 api_revision='$api_revision'
14805 api_subversion='$api_subversion'
14806 api_version='$api_version'
14807 api_versionstring='$api_versionstring'
14808 ar='$ar'
14809 archlib='$archlib'
14810 archlibexp='$archlibexp'
14811 archname64='$archname64'
14812 archname='$archname'
14813 archobjs='$archobjs'
14814 awk='$awk'
14815 baserev='$baserev'
14816 bash='$bash'
14817 bin='$bin'
14818 bincompat5005='$bincompat5005'
14819 binexp='$binexp'
14820 bison='$bison'
14821 byacc='$byacc'
14822 byteorder='$byteorder'
14823 c='$c'
14824 castflags='$castflags'
14825 cat='$cat'
14826 cc='$cc'
14827 cccdlflags='$cccdlflags'
14828 ccdlflags='$ccdlflags'
14829 ccflags='$ccflags'
14830 ccsymbols='$ccsymbols'
14831 cf_by='$cf_by'
14832 cf_email='$cf_email'
14833 cf_time='$cf_time'
14834 charsize='$charsize'
14835 chgrp='$chgrp'
14836 chmod='$chmod'
14837 chown='$chown'
14838 clocktype='$clocktype'
14839 comm='$comm'
14840 compress='$compress'
14841 contains='$contains'
14842 cp='$cp'
14843 cpio='$cpio'
14844 cpp='$cpp'
14845 cpp_stuff='$cpp_stuff'
14846 cppccsymbols='$cppccsymbols'
14847 cppflags='$cppflags'
14848 cpplast='$cpplast'
14849 cppminus='$cppminus'
14850 cpprun='$cpprun'
14851 cppstdin='$cppstdin'
14852 cppsymbols='$cppsymbols'
14853 crosscompile='$crosscompile'
14854 cryptlib='$cryptlib'
14855 csh='$csh'
14856 d_Gconvert='$d_Gconvert'
14857 d_PRIEldbl='$d_PRIEldbl'
14858 d_PRIFldbl='$d_PRIFldbl'
14859 d_PRIGldbl='$d_PRIGldbl'
14860 d_PRIX64='$d_PRIX64'
14861 d_PRId64='$d_PRId64'
14862 d_PRIeldbl='$d_PRIeldbl'
14863 d_PRIfldbl='$d_PRIfldbl'
14864 d_PRIgldbl='$d_PRIgldbl'
14865 d_PRIi64='$d_PRIi64'
14866 d_PRIo64='$d_PRIo64'
14867 d_PRIu64='$d_PRIu64'
14868 d_PRIx64='$d_PRIx64'
14869 d_access='$d_access'
14870 d_accessx='$d_accessx'
14871 d_alarm='$d_alarm'
14872 d_archlib='$d_archlib'
14873 d_atolf='$d_atolf'
14874 d_atoll='$d_atoll'
14875 d_attribut='$d_attribut'
14876 d_bcmp='$d_bcmp'
14877 d_bcopy='$d_bcopy'
14878 d_bincompat5005='$d_bincompat5005'
14879 d_bsd='$d_bsd'
14880 d_bsdgetpgrp='$d_bsdgetpgrp'
14881 d_bsdsetpgrp='$d_bsdsetpgrp'
14882 d_bzero='$d_bzero'
14883 d_casti32='$d_casti32'
14884 d_castneg='$d_castneg'
14885 d_charvspr='$d_charvspr'
14886 d_chown='$d_chown'
14887 d_chroot='$d_chroot'
14888 d_chsize='$d_chsize'
14889 d_closedir='$d_closedir'
14890 d_const='$d_const'
14891 d_crypt='$d_crypt'
14892 d_csh='$d_csh'
14893 d_cuserid='$d_cuserid'
14894 d_dbl_dig='$d_dbl_dig'
14895 d_difftime='$d_difftime'
14896 d_dirnamlen='$d_dirnamlen'
14897 d_dlerror='$d_dlerror'
14898 d_dlopen='$d_dlopen'
14899 d_dlsymun='$d_dlsymun'
14900 d_dosuid='$d_dosuid'
14901 d_drand48proto='$d_drand48proto'
14902 d_dup2='$d_dup2'
14903 d_eaccess='$d_eaccess'
14904 d_endgrent='$d_endgrent'
14905 d_endhent='$d_endhent'
14906 d_endnent='$d_endnent'
14907 d_endpent='$d_endpent'
14908 d_endpwent='$d_endpwent'
14909 d_endsent='$d_endsent'
14910 d_endspent='$d_endspent'
14911 d_eofnblk='$d_eofnblk'
14912 d_eunice='$d_eunice'
14913 d_fchmod='$d_fchmod'
14914 d_fchown='$d_fchown'
14915 d_fcntl='$d_fcntl'
14916 d_fd_macros='$d_fd_macros'
14917 d_fd_set='$d_fd_set'
14918 d_fds_bits='$d_fds_bits'
14919 d_fgetpos='$d_fgetpos'
14920 d_flexfnam='$d_flexfnam'
14921 d_flock='$d_flock'
14922 d_fork='$d_fork'
14923 d_fpathconf='$d_fpathconf'
14924 d_fpos64_t='$d_fpos64_t'
14925 d_fs_data_s='$d_fs_data_s'
14926 d_fseeko='$d_fseeko'
14927 d_fsetpos='$d_fsetpos'
14928 d_fstatfs='$d_fstatfs'
14929 d_fstatvfs='$d_fstatvfs'
14930 d_ftello='$d_ftello'
14931 d_ftime='$d_ftime'
14932 d_getcwd='$d_getcwd'
14933 d_getfsstat='$d_getfsstat'
14934 d_getgrent='$d_getgrent'
14935 d_getgrps='$d_getgrps'
14936 d_gethbyaddr='$d_gethbyaddr'
14937 d_gethbyname='$d_gethbyname'
14938 d_gethent='$d_gethent'
14939 d_gethname='$d_gethname'
14940 d_gethostprotos='$d_gethostprotos'
14941 d_getlogin='$d_getlogin'
14942 d_getmnt='$d_getmnt'
14943 d_getmntent='$d_getmntent'
14944 d_getnbyaddr='$d_getnbyaddr'
14945 d_getnbyname='$d_getnbyname'
14946 d_getnent='$d_getnent'
14947 d_getnetprotos='$d_getnetprotos'
14948 d_getpbyname='$d_getpbyname'
14949 d_getpbynumber='$d_getpbynumber'
14950 d_getpent='$d_getpent'
14951 d_getpgid='$d_getpgid'
14952 d_getpgrp2='$d_getpgrp2'
14953 d_getpgrp='$d_getpgrp'
14954 d_getppid='$d_getppid'
14955 d_getprior='$d_getprior'
14956 d_getprotoprotos='$d_getprotoprotos'
14957 d_getpwent='$d_getpwent'
14958 d_getsbyname='$d_getsbyname'
14959 d_getsbyport='$d_getsbyport'
14960 d_getsent='$d_getsent'
14961 d_getservprotos='$d_getservprotos'
14962 d_getspent='$d_getspent'
14963 d_getspnam='$d_getspnam'
14964 d_gettimeod='$d_gettimeod'
14965 d_gnulibc='$d_gnulibc'
14966 d_grpasswd='$d_grpasswd'
14967 d_hasmntopt='$d_hasmntopt'
14968 d_htonl='$d_htonl'
14969 d_iconv='$d_iconv'
14970 d_index='$d_index'
14971 d_inetaton='$d_inetaton'
14972 d_int64_t='$d_int64_t'
14973 d_isascii='$d_isascii'
14974 d_killpg='$d_killpg'
14975 d_lchown='$d_lchown'
14976 d_ldbl_dig='$d_ldbl_dig'
14977 d_link='$d_link'
14978 d_locconv='$d_locconv'
14979 d_lockf='$d_lockf'
14980 d_longdbl='$d_longdbl'
14981 d_longlong='$d_longlong'
14982 d_lseekproto='$d_lseekproto'
14983 d_lstat='$d_lstat'
14984 d_madvise='$d_madvise'
14985 d_mblen='$d_mblen'
14986 d_mbstowcs='$d_mbstowcs'
14987 d_mbtowc='$d_mbtowc'
14988 d_memchr='$d_memchr'
14989 d_memcmp='$d_memcmp'
14990 d_memcpy='$d_memcpy'
14991 d_memmove='$d_memmove'
14992 d_memset='$d_memset'
14993 d_mkdir='$d_mkdir'
14994 d_mkdtemp='$d_mkdtemp'
14995 d_mkfifo='$d_mkfifo'
14996 d_mkstemp='$d_mkstemp'
14997 d_mkstemps='$d_mkstemps'
14998 d_mktime='$d_mktime'
14999 d_mmap='$d_mmap'
15000 d_mprotect='$d_mprotect'
15001 d_msg='$d_msg'
15002 d_msg_ctrunc='$d_msg_ctrunc'
15003 d_msg_dontroute='$d_msg_dontroute'
15004 d_msg_oob='$d_msg_oob'
15005 d_msg_peek='$d_msg_peek'
15006 d_msg_proxy='$d_msg_proxy'
15007 d_msgctl='$d_msgctl'
15008 d_msgget='$d_msgget'
15009 d_msgrcv='$d_msgrcv'
15010 d_msgsnd='$d_msgsnd'
15011 d_msync='$d_msync'
15012 d_munmap='$d_munmap'
15013 d_mymalloc='$d_mymalloc'
15014 d_nice='$d_nice'
15015 d_nv_preserves_uv='$d_nv_preserves_uv'
15016 d_off64_t='$d_off64_t'
15017 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15018 d_oldpthreads='$d_oldpthreads'
15019 d_oldsock='$d_oldsock'
15020 d_open3='$d_open3'
15021 d_pathconf='$d_pathconf'
15022 d_pause='$d_pause'
15023 d_phostname='$d_phostname'
15024 d_pipe='$d_pipe'
15025 d_poll='$d_poll'
15026 d_portable='$d_portable'
15027 d_pthread_yield='$d_pthread_yield'
15028 d_pwage='$d_pwage'
15029 d_pwchange='$d_pwchange'
15030 d_pwclass='$d_pwclass'
15031 d_pwcomment='$d_pwcomment'
15032 d_pwexpire='$d_pwexpire'
15033 d_pwgecos='$d_pwgecos'
15034 d_pwpasswd='$d_pwpasswd'
15035 d_pwquota='$d_pwquota'
15036 d_qgcvt='$d_qgcvt'
15037 d_quad='$d_quad'
15038 d_readdir='$d_readdir'
15039 d_readlink='$d_readlink'
15040 d_rename='$d_rename'
15041 d_rewinddir='$d_rewinddir'
15042 d_rmdir='$d_rmdir'
15043 d_safebcpy='$d_safebcpy'
15044 d_safemcpy='$d_safemcpy'
15045 d_sanemcmp='$d_sanemcmp'
15046 d_sched_yield='$d_sched_yield'
15047 d_scm_rights='$d_scm_rights'
15048 d_seekdir='$d_seekdir'
15049 d_select='$d_select'
15050 d_sem='$d_sem'
15051 d_semctl='$d_semctl'
15052 d_semctl_semid_ds='$d_semctl_semid_ds'
15053 d_semctl_semun='$d_semctl_semun'
15054 d_semget='$d_semget'
15055 d_semop='$d_semop'
15056 d_setegid='$d_setegid'
15057 d_seteuid='$d_seteuid'
15058 d_setgrent='$d_setgrent'
15059 d_setgrps='$d_setgrps'
15060 d_sethent='$d_sethent'
15061 d_setlinebuf='$d_setlinebuf'
15062 d_setlocale='$d_setlocale'
15063 d_setnent='$d_setnent'
15064 d_setpent='$d_setpent'
15065 d_setpgid='$d_setpgid'
15066 d_setpgrp2='$d_setpgrp2'
15067 d_setpgrp='$d_setpgrp'
15068 d_setprior='$d_setprior'
15069 d_setpwent='$d_setpwent'
15070 d_setregid='$d_setregid'
15071 d_setresgid='$d_setresgid'
15072 d_setresuid='$d_setresuid'
15073 d_setreuid='$d_setreuid'
15074 d_setrgid='$d_setrgid'
15075 d_setruid='$d_setruid'
15076 d_setsent='$d_setsent'
15077 d_setsid='$d_setsid'
15078 d_setspent='$d_setspent'
15079 d_setvbuf='$d_setvbuf'
15080 d_sfio='$d_sfio'
15081 d_shm='$d_shm'
15082 d_shmat='$d_shmat'
15083 d_shmatprototype='$d_shmatprototype'
15084 d_shmctl='$d_shmctl'
15085 d_shmdt='$d_shmdt'
15086 d_shmget='$d_shmget'
15087 d_sigaction='$d_sigaction'
15088 d_sigsetjmp='$d_sigsetjmp'
15089 d_socket='$d_socket'
15090 d_socklen_t='$d_socklen_t'
15091 d_sockpair='$d_sockpair'
15092 d_sqrtl='$d_sqrtl'
15093 d_statblks='$d_statblks'
15094 d_statfs_f_flags='$d_statfs_f_flags'
15095 d_statfs_s='$d_statfs_s'
15096 d_statvfs='$d_statvfs'
15097 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15098 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15099 d_stdio_stream_array='$d_stdio_stream_array'
15100 d_stdiobase='$d_stdiobase'
15101 d_stdstdio='$d_stdstdio'
15102 d_strchr='$d_strchr'
15103 d_strcoll='$d_strcoll'
15104 d_strctcpy='$d_strctcpy'
15105 d_strerrm='$d_strerrm'
15106 d_strerror='$d_strerror'
15107 d_strtod='$d_strtod'
15108 d_strtol='$d_strtol'
15109 d_strtold='$d_strtold'
15110 d_strtoll='$d_strtoll'
15111 d_strtoul='$d_strtoul'
15112 d_strtoull='$d_strtoull'
15113 d_strtouq='$d_strtouq'
15114 d_strxfrm='$d_strxfrm'
15115 d_suidsafe='$d_suidsafe'
15116 d_symlink='$d_symlink'
15117 d_syscall='$d_syscall'
15118 d_sysconf='$d_sysconf'
15119 d_sysernlst='$d_sysernlst'
15120 d_syserrlst='$d_syserrlst'
15121 d_system='$d_system'
15122 d_tcgetpgrp='$d_tcgetpgrp'
15123 d_tcsetpgrp='$d_tcsetpgrp'
15124 d_telldir='$d_telldir'
15125 d_telldirproto='$d_telldirproto'
15126 d_time='$d_time'
15127 d_times='$d_times'
15128 d_truncate='$d_truncate'
15129 d_tzname='$d_tzname'
15130 d_umask='$d_umask'
15131 d_uname='$d_uname'
15132 d_union_semun='$d_union_semun'
15133 d_ustat='$d_ustat'
15134 d_vendorbin='$d_vendorbin'
15135 d_vendorlib='$d_vendorlib'
15136 d_vfork='$d_vfork'
15137 d_void_closedir='$d_void_closedir'
15138 d_voidsig='$d_voidsig'
15139 d_voidtty='$d_voidtty'
15140 d_volatile='$d_volatile'
15141 d_vprintf='$d_vprintf'
15142 d_wait4='$d_wait4'
15143 d_waitpid='$d_waitpid'
15144 d_wcstombs='$d_wcstombs'
15145 d_wctomb='$d_wctomb'
15146 d_xenix='$d_xenix'
15147 date='$date'
15148 db_hashtype='$db_hashtype'
15149 db_prefixtype='$db_prefixtype'
15150 defvoidused='$defvoidused'
15151 direntrytype='$direntrytype'
15152 dlext='$dlext'
15153 dlsrc='$dlsrc'
15154 doublesize='$doublesize'
15155 drand01='$drand01'
15156 dynamic_ext='$dynamic_ext'
15157 eagain='$eagain'
15158 ebcdic='$ebcdic'
15159 echo='$echo'
15160 egrep='$egrep'
15161 emacs='$emacs'
15162 eunicefix='$eunicefix'
15163 exe_ext='$exe_ext'
15164 expr='$expr'
15165 extensions='$extensions'
15166 fflushNULL='$fflushNULL'
15167 fflushall='$fflushall'
15168 find='$find'
15169 firstmakefile='$firstmakefile'
15170 flex='$flex'
15171 fpossize='$fpossize'
15172 fpostype='$fpostype'
15173 freetype='$freetype'
15174 full_ar='$full_ar'
15175 full_csh='$full_csh'
15176 full_sed='$full_sed'
15177 gccversion='$gccversion'
15178 gidformat='$gidformat'
15179 gidsign='$gidsign'
15180 gidsize='$gidsize'
15181 gidtype='$gidtype'
15182 glibpth='$glibpth'
15183 grep='$grep'
15184 groupcat='$groupcat'
15185 groupstype='$groupstype'
15186 gzip='$gzip'
15187 h_fcntl='$h_fcntl'
15188 h_sysfile='$h_sysfile'
15189 hint='$hint'
15190 hostcat='$hostcat'
15191 huge='$huge'
15192 i16size='$i16size'
15193 i16type='$i16type'
15194 i32size='$i32size'
15195 i32type='$i32type'
15196 i64size='$i64size'
15197 i64type='$i64type'
15198 i8size='$i8size'
15199 i8type='$i8type'
15200 i_arpainet='$i_arpainet'
15201 i_bsdioctl='$i_bsdioctl'
15202 i_db='$i_db'
15203 i_dbm='$i_dbm'
15204 i_dirent='$i_dirent'
15205 i_dld='$i_dld'
15206 i_dlfcn='$i_dlfcn'
15207 i_fcntl='$i_fcntl'
15208 i_float='$i_float'
15209 i_gdbm='$i_gdbm'
15210 i_grp='$i_grp'
15211 i_iconv='$i_iconv'
15212 i_inttypes='$i_inttypes'
15213 i_limits='$i_limits'
15214 i_locale='$i_locale'
15215 i_machcthr='$i_machcthr'
15216 i_malloc='$i_malloc'
15217 i_math='$i_math'
15218 i_memory='$i_memory'
15219 i_mntent='$i_mntent'
15220 i_ndbm='$i_ndbm'
15221 i_netdb='$i_netdb'
15222 i_neterrno='$i_neterrno'
15223 i_netinettcp='$i_netinettcp'
15224 i_niin='$i_niin'
15225 i_poll='$i_poll'
15226 i_pthread='$i_pthread'
15227 i_pwd='$i_pwd'
15228 i_rpcsvcdbm='$i_rpcsvcdbm'
15229 i_sfio='$i_sfio'
15230 i_sgtty='$i_sgtty'
15231 i_shadow='$i_shadow'
15232 i_socks='$i_socks'
15233 i_stdarg='$i_stdarg'
15234 i_stddef='$i_stddef'
15235 i_stdlib='$i_stdlib'
15236 i_string='$i_string'
15237 i_sysaccess='$i_sysaccess'
15238 i_sysdir='$i_sysdir'
15239 i_sysfile='$i_sysfile'
15240 i_sysfilio='$i_sysfilio'
15241 i_sysin='$i_sysin'
15242 i_sysioctl='$i_sysioctl'
15243 i_syslog='$i_syslog'
15244 i_sysmman='$i_sysmman'
15245 i_sysmode='$i_sysmode'
15246 i_sysmount='$i_sysmount'
15247 i_sysndir='$i_sysndir'
15248 i_sysparam='$i_sysparam'
15249 i_sysresrc='$i_sysresrc'
15250 i_syssecrt='$i_syssecrt'
15251 i_sysselct='$i_sysselct'
15252 i_syssockio='$i_syssockio'
15253 i_sysstat='$i_sysstat'
15254 i_sysstatfs='$i_sysstatfs'
15255 i_sysstatvfs='$i_sysstatvfs'
15256 i_systime='$i_systime'
15257 i_systimek='$i_systimek'
15258 i_systimes='$i_systimes'
15259 i_systypes='$i_systypes'
15260 i_sysuio='$i_sysuio'
15261 i_sysun='$i_sysun'
15262 i_sysutsname='$i_sysutsname'
15263 i_sysvfs='$i_sysvfs'
15264 i_syswait='$i_syswait'
15265 i_termio='$i_termio'
15266 i_termios='$i_termios'
15267 i_time='$i_time'
15268 i_unistd='$i_unistd'
15269 i_ustat='$i_ustat'
15270 i_utime='$i_utime'
15271 i_values='$i_values'
15272 i_varargs='$i_varargs'
15273 i_varhdr='$i_varhdr'
15274 i_vfork='$i_vfork'
15275 ignore_versioned_solibs='$ignore_versioned_solibs'
15276 inc_version_list='$inc_version_list'
15277 inc_version_list_init='$inc_version_list_init'
15278 incpath='$incpath'
15279 inews='$inews'
15280 installarchlib='$installarchlib'
15281 installbin='$installbin'
15282 installman1dir='$installman1dir'
15283 installman3dir='$installman3dir'
15284 installprefix='$installprefix'
15285 installprefixexp='$installprefixexp'
15286 installprivlib='$installprivlib'
15287 installscript='$installscript'
15288 installsitearch='$installsitearch'
15289 installsitebin='$installsitebin'
15290 installsitelib='$installsitelib'
15291 installstyle='$installstyle'
15292 installusrbinperl='$installusrbinperl'
15293 installvendorbin='$installvendorbin'
15294 installvendorlib='$installvendorlib'
15295 intsize='$intsize'
15296 ivdformat='$ivdformat'
15297 ivsize='$ivsize'
15298 ivtype='$ivtype'
15299 known_extensions='$known_extensions'
15300 ksh='$ksh'
15301 large='$large'
15302 ld='$ld'
15303 lddlflags='$lddlflags'
15304 ldflags='$ldflags'
15305 ldlibpthname='$ldlibpthname'
15306 less='$less'
15307 lib_ext='$lib_ext'
15308 libc='$libc'
15309 libperl='$libperl'
15310 libpth='$libpth'
15311 libs='$libs'
15312 libsdirs='$libsdirs'
15313 libsfiles='$libsfiles'
15314 libsfound='$libsfound'
15315 libspath='$libspath'
15316 libswanted='$libswanted'
15317 line='$line'
15318 lint='$lint'
15319 lkflags='$lkflags'
15320 ln='$ln'
15321 lns='$lns'
15322 locincpth='$locincpth'
15323 loclibpth='$loclibpth'
15324 longdblsize='$longdblsize'
15325 longlongsize='$longlongsize'
15326 longsize='$longsize'
15327 lp='$lp'
15328 lpr='$lpr'
15329 ls='$ls'
15330 lseeksize='$lseeksize'
15331 lseektype='$lseektype'
15332 mail='$mail'
15333 mailx='$mailx'
15334 make='$make'
15335 make_set_make='$make_set_make'
15336 mallocobj='$mallocobj'
15337 mallocsrc='$mallocsrc'
15338 malloctype='$malloctype'
15339 man1dir='$man1dir'
15340 man1direxp='$man1direxp'
15341 man1ext='$man1ext'
15342 man3dir='$man3dir'
15343 man3direxp='$man3direxp'
15344 man3ext='$man3ext'
15345 medium='$medium'
15346 mips_type='$mips_type'
15347 mkdir='$mkdir'
15348 mmaptype='$mmaptype'
15349 models='$models'
15350 modetype='$modetype'
15351 more='$more'
15352 multiarch='$multiarch'
15353 mv='$mv'
15354 myarchname='$myarchname'
15355 mydomain='$mydomain'
15356 myhostname='$myhostname'
15357 myuname='$myuname'
15358 n='$n'
15359 netdb_hlen_type='$netdb_hlen_type'
15360 netdb_host_type='$netdb_host_type'
15361 netdb_name_type='$netdb_name_type'
15362 netdb_net_type='$netdb_net_type'
15363 nm='$nm'
15364 nm_opt='$nm_opt'
15365 nm_so_opt='$nm_so_opt'
15366 nonxs_ext='$nonxs_ext'
15367 nroff='$nroff'
15368 nvsize='$nvsize'
15369 nvtype='$nvtype'
15370 o_nonblock='$o_nonblock'
15371 obj_ext='$obj_ext'
15372 old_pthread_create_joinable='$old_pthread_create_joinable'
15373 optimize='$optimize'
15374 orderlib='$orderlib'
15375 osname='$osname'
15376 osvers='$osvers'
15377 package='$package'
15378 pager='$pager'
15379 passcat='$passcat'
15380 patchlevel='$patchlevel'
15381 path_sep='$path_sep'
15382 perl5='$perl5'
15383 perl='$perl'
15384 perladmin='$perladmin'
15385 perlpath='$perlpath'
15386 pg='$pg'
15387 phostname='$phostname'
15388 pidtype='$pidtype'
15389 plibpth='$plibpth'
15390 pm_apiversion='$pm_apiversion'
15391 pmake='$pmake'
15392 pr='$pr'
15393 prefix='$prefix'
15394 prefixexp='$prefixexp'
15395 privlib='$privlib'
15396 privlibexp='$privlibexp'
15397 prototype='$prototype'
15398 ptrsize='$ptrsize'
15399 quadkind='$quadkind'
15400 quadtype='$quadtype'
15401 randbits='$randbits'
15402 randfunc='$randfunc'
15403 randseedtype='$randseedtype'
15404 ranlib='$ranlib'
15405 rd_nodata='$rd_nodata'
15406 revision='$revision'
15407 rm='$rm'
15408 rmail='$rmail'
15409 runnm='$runnm'
15410 sPRIEldbl='$sPRIEldbl'
15411 sPRIFldbl='$sPRIFldbl'
15412 sPRIGldbl='$sPRIGldbl'
15413 sPRIX64='$sPRIX64'
15414 sPRId64='$sPRId64'
15415 sPRIeldbl='$sPRIeldbl'
15416 sPRIfldbl='$sPRIfldbl'
15417 sPRIgldbl='$sPRIgldbl'
15418 sPRIi64='$sPRIi64'
15419 sPRIo64='$sPRIo64'
15420 sPRIu64='$sPRIu64'
15421 sPRIx64='$sPRIx64'
15422 sched_yield='$sched_yield'
15423 scriptdir='$scriptdir'
15424 scriptdirexp='$scriptdirexp'
15425 sed='$sed'
15426 seedfunc='$seedfunc'
15427 selectminbits='$selectminbits'
15428 selecttype='$selecttype'
15429 sendmail='$sendmail'
15430 sh='$sh'
15431 shar='$shar'
15432 sharpbang='$sharpbang'
15433 shmattype='$shmattype'
15434 shortsize='$shortsize'
15435 shrpenv='$shrpenv'
15436 shsharp='$shsharp'
15437 sig_count='$sig_count'
15438 sig_name='$sig_name'
15439 sig_name_init='$sig_name_init'
15440 sig_num='$sig_num'
15441 sig_num_init='$sig_num_init'
15442 signal_t='$signal_t'
15443 sitearch='$sitearch'
15444 sitearchexp='$sitearchexp'
15445 sitebin='$sitebin'
15446 sitebinexp='$sitebinexp'
15447 sitelib='$sitelib'
15448 sitelibexp='$sitelibexp'
15449 siteprefix='$siteprefix'
15450 siteprefixexp='$siteprefixexp'
15451 sizetype='$sizetype'
15452 sleep='$sleep'
15453 smail='$smail'
15454 small='$small'
15455 so='$so'
15456 sockethdr='$sockethdr'
15457 socketlib='$socketlib'
15458 socksizetype='$socksizetype'
15459 sort='$sort'
15460 spackage='$spackage'
15461 spitshell='$spitshell'
15462 split='$split'
15463 src='$src'
15464 ssizetype='$ssizetype'
15465 startperl='$startperl'
15466 startsh='$startsh'
15467 static_ext='$static_ext'
15468 stdchar='$stdchar'
15469 stdio_base='$stdio_base'
15470 stdio_bufsiz='$stdio_bufsiz'
15471 stdio_cnt='$stdio_cnt'
15472 stdio_filbuf='$stdio_filbuf'
15473 stdio_ptr='$stdio_ptr'
15474 stdio_stream_array='$stdio_stream_array'
15475 strings='$strings'
15476 submit='$submit'
15477 subversion='$subversion'
15478 sysman='$sysman'
15479 tail='$tail'
15480 tar='$tar'
15481 tbl='$tbl'
15482 tee='$tee'
15483 test='$test'
15484 timeincl='$timeincl'
15485 timetype='$timetype'
15486 touch='$touch'
15487 tr='$tr'
15488 trnl='$trnl'
15489 troff='$troff'
15490 u16size='$u16size'
15491 u16type='$u16type'
15492 u32size='$u32size'
15493 u32type='$u32type'
15494 u64size='$u64size'
15495 u64type='$u64type'
15496 u8size='$u8size'
15497 u8type='$u8type'
15498 uidformat='$uidformat'
15499 uidsign='$uidsign'
15500 uidsize='$uidsize'
15501 uidtype='$uidtype'
15502 uname='$uname'
15503 uniq='$uniq'
15504 uquadtype='$uquadtype'
15505 use5005threads='$use5005threads'
15506 use64bitall='$use64bitall'
15507 use64bitint='$use64bitint'
15508 usedl='$usedl'
15509 useithreads='$useithreads'
15510 uselargefiles='$uselargefiles'
15511 uselongdouble='$uselongdouble'
15512 usemorebits='$usemorebits'
15513 usemultiplicity='$usemultiplicity'
15514 usemymalloc='$usemymalloc'
15515 usenm='$usenm'
15516 useopcode='$useopcode'
15517 useperlio='$useperlio'
15518 useposix='$useposix'
15519 usesfio='$usesfio'
15520 useshrplib='$useshrplib'
15521 usesocks='$usesocks'
15522 usethreads='$usethreads'
15523 usevendorprefix='$usevendorprefix'
15524 usevfork='$usevfork'
15525 usrinc='$usrinc'
15526 uuname='$uuname'
15527 uvoformat='$uvoformat'
15528 uvsize='$uvsize'
15529 uvtype='$uvtype'
15530 uvuformat='$uvuformat'
15531 uvxformat='$uvxformat'
15532 vendorbin='$vendorbin'
15533 vendorbinexp='$vendorbinexp'
15534 vendorlib='$vendorlib'
15535 vendorlibexp='$vendorlibexp'
15536 vendorprefix='$vendorprefix'
15537 vendorprefixexp='$vendorprefixexp'
15538 version='$version'
15539 vi='$vi'
15540 voidflags='$voidflags'
15541 xlibpth='$xlibpth'
15542 xs_apiversion='$xs_apiversion'
15543 zcat='$zcat'
15544 zip='$zip'
15545 EOT
15546
15547 : Add in command line options if available
15548 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15549
15550 : add special variables
15551 $test -f $src/patchlevel.h && \
15552 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15553 echo "CONFIGDOTSH=true" >>config.sh
15554
15555 : propagate old symbols
15556 if $test -f UU/config.sh; then
15557         <UU/config.sh sort | uniq >UU/oldconfig.sh
15558         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15559         sort | uniq -u >UU/oldsyms
15560         set X `cat UU/oldsyms`
15561         shift
15562         case $# in
15563         0) ;;
15564         *)
15565                 cat <<EOM
15566 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15567 EOM
15568                 echo "# Variables propagated from previous config.sh file." >>config.sh
15569                 for sym in `cat UU/oldsyms`; do
15570                         echo "    Propagating $hint variable "'$'"$sym..."
15571                         eval 'tmp="$'"${sym}"'"'
15572                         echo "$tmp" | \
15573                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15574                 done
15575                 ;;
15576         esac
15577 fi
15578
15579 : Finish up by extracting the .SH files
15580 case "$alldone" in
15581 exit)
15582         $rm -rf UU
15583         echo "Done."
15584         exit 0
15585         ;;
15586 cont)
15587         ;;
15588 '')
15589         dflt=''
15590         nostick=true
15591         $cat <<EOM
15592
15593 If you'd like to make any changes to the config.sh file before I begin
15594 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15595
15596 EOM
15597         rp="Press return or use a shell escape to edit config.sh:"
15598         . UU/myread
15599         nostick=''
15600         case "$ans" in
15601         '') ;;
15602         *) : in case they cannot read
15603                 sh 1>&4 -c "$ans";;
15604         esac
15605         ;;
15606 esac
15607
15608 : if this fails, just run all the .SH files by hand
15609 . ./config.sh
15610
15611 echo " "
15612 exec 1>&4
15613 . ./UU/extract
15614
15615 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15616         dflt=y
15617         case "$silent" in
15618         true) ;;
15619         *)
15620                 $cat <<EOM
15621
15622 Now you need to generate make dependencies by running "$make depend".
15623 You might prefer to run it in background: "$make depend > makedepend.out &"
15624 It can take a while, so you might not want to run it right now.
15625
15626 EOM
15627                 ;;
15628         esac
15629         rp="Run $make depend now?"
15630         . UU/myread
15631         case "$ans" in
15632         y*)
15633                 $make depend && echo "Now you must run a $make."
15634                 ;;
15635         *)
15636                 echo "You must run '$make depend' then '$make'."
15637                 ;;
15638         esac
15639 elif test -f [Mm]akefile; then
15640         echo " "
15641         echo "Now you must run a $make."
15642 else
15643         echo "Done."
15644 fi
15645
15646 if $test -f Policy.sh; then
15647     $cat <<EOM
15648
15649 If you compile $package on a different machine or from a different object
15650 directory, copy the Policy.sh file from this object directory to the
15651 new one before you run Configure -- this will help you with most of
15652 the policy defaults.
15653
15654 EOM
15655 fi
15656 if $test -f config.msg; then
15657     echo "Hmm.  I also noted the following information while running:"
15658     echo " "
15659     $cat config.msg >&4
15660     $rm -f config.msg
15661 fi
15662 $rm -f kit*isdone ark*isdone
15663 $rm -rf UU
15664
15665 : End of Configure
15666