315ada8193d7e69b9ae1bf711895cb5da3f1ec2a
[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 Mon Feb 28 08:28:06 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_mblen=''
422 d_mbstowcs=''
423 d_mbtowc=''
424 d_memchr=''
425 d_memcmp=''
426 d_memcpy=''
427 d_memmove=''
428 d_memset=''
429 d_mkdir=''
430 d_mkdtemp=''
431 d_mkfifo=''
432 d_mkstemp=''
433 d_mkstemps=''
434 d_mktime=''
435 d_mmap=''
436 mmaptype=''
437 d_mprotect=''
438 d_msg=''
439 d_msgctl=''
440 d_msgget=''
441 d_msgrcv=''
442 d_msgsnd=''
443 d_msync=''
444 d_munmap=''
445 d_nice=''
446 d_off64_t=''
447 d_open3=''
448 d_fpathconf=''
449 d_pathconf=''
450 d_pause=''
451 d_pipe=''
452 d_poll=''
453 d_portable=''
454 d_old_pthread_create_joinable=''
455 old_pthread_create_joinable=''
456 d_pthread_yield=''
457 d_sched_yield=''
458 sched_yield=''
459 d_readdir=''
460 d_rewinddir=''
461 d_seekdir=''
462 d_telldir=''
463 d_readlink=''
464 d_rename=''
465 d_rmdir=''
466 d_safebcpy=''
467 d_safemcpy=''
468 d_sanemcmp=''
469 d_select=''
470 d_sem=''
471 d_semctl=''
472 d_semget=''
473 d_semop=''
474 d_setegid=''
475 d_seteuid=''
476 d_setgrent=''
477 d_setgrps=''
478 d_sethent=''
479 d_setlinebuf=''
480 d_setlocale=''
481 d_setnent=''
482 d_setpent=''
483 d_setpgid=''
484 d_setpgrp2=''
485 d_bsdsetpgrp=''
486 d_setpgrp=''
487 d_setprior=''
488 d_setpwent=''
489 d_setregid=''
490 d_setresgid=''
491 d_setresuid=''
492 d_setreuid=''
493 d_setrgid=''
494 d_setruid=''
495 d_setsent=''
496 d_setsid=''
497 d_setspent=''
498 d_setvbuf=''
499 d_sfio=''
500 usesfio=''
501 d_shm=''
502 d_shmat=''
503 d_shmatprototype=''
504 shmattype=''
505 d_shmctl=''
506 d_shmdt=''
507 d_shmget=''
508 d_sigaction=''
509 d_sigsetjmp=''
510 d_msg_ctrunc=''
511 d_msg_dontroute=''
512 d_msg_oob=''
513 d_msg_peek=''
514 d_msg_proxy=''
515 d_oldsock=''
516 d_scm_rights=''
517 d_socket=''
518 d_sockpair=''
519 sockethdr=''
520 socketlib=''
521 d_socklen_t=''
522 d_sqrtl=''
523 d_statblks=''
524 d_statfs_f_flags=''
525 d_statfs_s=''
526 d_fstatvfs=''
527 d_statvfs=''
528 d_stdio_cnt_lval=''
529 d_stdio_ptr_lval=''
530 d_stdiobase=''
531 d_stdstdio=''
532 stdio_base=''
533 stdio_bufsiz=''
534 stdio_cnt=''
535 stdio_filbuf=''
536 stdio_ptr=''
537 d_index=''
538 d_strchr=''
539 d_strcoll=''
540 d_strctcpy=''
541 d_strerrm=''
542 d_strerror=''
543 d_sysernlst=''
544 d_syserrlst=''
545 d_strtod=''
546 d_strtol=''
547 d_strtold=''
548 d_strtoll=''
549 d_strtoul=''
550 d_strtoull=''
551 d_strtouq=''
552 d_strxfrm=''
553 d_symlink=''
554 d_syscall=''
555 d_sysconf=''
556 d_system=''
557 d_tcgetpgrp=''
558 d_tcsetpgrp=''
559 d_telldirproto=''
560 d_time=''
561 timetype=''
562 clocktype=''
563 d_times=''
564 d_truncate=''
565 d_tzname=''
566 d_umask=''
567 d_semctl_semid_ds=''
568 d_semctl_semun=''
569 d_union_semun=''
570 d_ustat=''
571 d_vfork=''
572 usevfork=''
573 d_voidsig=''
574 signal_t=''
575 d_volatile=''
576 d_charvspr=''
577 d_vprintf=''
578 d_wait4=''
579 d_waitpid=''
580 d_wcstombs=''
581 d_wctomb=''
582 dlext=''
583 cccdlflags=''
584 ccdlflags=''
585 dlsrc=''
586 ld=''
587 lddlflags=''
588 usedl=''
589 doublesize=''
590 ebcdic=''
591 fflushNULL=''
592 fflushall=''
593 fpossize=''
594 fpostype=''
595 gidformat=''
596 gidsign=''
597 gidsize=''
598 gidtype=''
599 groupstype=''
600 h_fcntl=''
601 h_sysfile=''
602 i_arpainet=''
603 db_hashtype=''
604 db_prefixtype=''
605 i_db=''
606 i_dbm=''
607 i_rpcsvcdbm=''
608 d_dirnamlen=''
609 direntrytype=''
610 i_dirent=''
611 i_dld=''
612 i_dlfcn=''
613 i_fcntl=''
614 i_float=''
615 i_gdbm=''
616 d_grpasswd=''
617 i_grp=''
618 i_iconv=''
619 i_inttypes=''
620 i_limits=''
621 i_locale=''
622 i_machcthr=''
623 i_malloc=''
624 i_math=''
625 i_memory=''
626 i_mntent=''
627 i_ndbm=''
628 i_netdb=''
629 i_neterrno=''
630 i_netinettcp=''
631 i_niin=''
632 i_sysin=''
633 i_poll=''
634 i_pthread=''
635 d_pwage=''
636 d_pwchange=''
637 d_pwclass=''
638 d_pwcomment=''
639 d_pwexpire=''
640 d_pwgecos=''
641 d_pwpasswd=''
642 d_pwquota=''
643 i_pwd=''
644 i_sfio=''
645 i_shadow=''
646 i_socks=''
647 i_stddef=''
648 i_stdlib=''
649 i_string=''
650 strings=''
651 i_sysaccess=''
652 i_sysdir=''
653 i_sysfile=''
654 d_voidtty=''
655 i_bsdioctl=''
656 i_sysfilio=''
657 i_sysioctl=''
658 i_syssockio=''
659 i_syslog=''
660 i_sysmman=''
661 i_sysmode=''
662 i_sysmount=''
663 i_sysndir=''
664 i_sysparam=''
665 i_sysresrc=''
666 i_syssecrt=''
667 i_sysselct=''
668 i_sysstat=''
669 i_sysstatfs=''
670 i_sysstatvfs=''
671 i_systimes=''
672 i_systypes=''
673 i_sysuio=''
674 i_sysun=''
675 i_sysutsname=''
676 i_sysvfs=''
677 i_syswait=''
678 i_sgtty=''
679 i_termio=''
680 i_termios=''
681 i_systime=''
682 i_systimek=''
683 i_time=''
684 timeincl=''
685 i_unistd=''
686 i_ustat=''
687 i_utime=''
688 i_values=''
689 i_stdarg=''
690 i_varargs=''
691 i_varhdr=''
692 i_vfork=''
693 inc_version_list=''
694 inc_version_list_init=''
695 installprefix=''
696 installprefixexp=''
697 installstyle=''
698 installusrbinperl=''
699 intsize=''
700 longsize=''
701 shortsize=''
702 libc=''
703 ldlibpthname=''
704 libperl=''
705 shrpenv=''
706 useshrplib=''
707 glibpth=''
708 libpth=''
709 loclibpth=''
710 plibpth=''
711 xlibpth=''
712 ignore_versioned_solibs=''
713 libs=''
714 libsdirs=''
715 libsfiles=''
716 libsfound=''
717 libspath=''
718 lns=''
719 d_PRIEldbl=''
720 d_PRIFldbl=''
721 d_PRIGldbl=''
722 d_PRIeldbl=''
723 d_PRIfldbl=''
724 d_PRIgldbl=''
725 sPRIEldbl=''
726 sPRIFldbl=''
727 sPRIGldbl=''
728 sPRIeldbl=''
729 sPRIfldbl=''
730 sPRIgldbl=''
731 lseeksize=''
732 lseektype=''
733 make_set_make=''
734 d_mymalloc=''
735 freetype=''
736 mallocobj=''
737 mallocsrc=''
738 malloctype=''
739 usemymalloc=''
740 installman1dir=''
741 man1dir=''
742 man1direxp=''
743 man1ext=''
744 installman3dir=''
745 man3dir=''
746 man3direxp=''
747 man3ext=''
748 huge=''
749 large=''
750 medium=''
751 models=''
752 small=''
753 split=''
754 modetype=''
755 multiarch=''
756 mydomain=''
757 myhostname=''
758 phostname=''
759 c=''
760 n=''
761 d_eofnblk=''
762 eagain=''
763 o_nonblock=''
764 rd_nodata=''
765 netdb_hlen_type=''
766 netdb_host_type=''
767 netdb_name_type=''
768 netdb_net_type=''
769 groupcat=''
770 hostcat=''
771 passcat=''
772 orderlib=''
773 ranlib=''
774 package=''
775 spackage=''
776 pager=''
777 api_revision=''
778 api_subversion=''
779 api_version=''
780 api_versionstring=''
781 patchlevel=''
782 revision=''
783 subversion=''
784 version=''
785 perl5=''
786 perladmin=''
787 perlpath=''
788 d_nv_preserves_uv=''
789 i16size=''
790 i16type=''
791 i32size=''
792 i32type=''
793 i64size=''
794 i64type=''
795 i8size=''
796 i8type=''
797 ivsize=''
798 ivtype=''
799 nvsize=''
800 nvtype=''
801 u16size=''
802 u16type=''
803 u32size=''
804 u32type=''
805 u64size=''
806 u64type=''
807 u8size=''
808 u8type=''
809 uvsize=''
810 uvtype=''
811 ivdformat=''
812 uvoformat=''
813 uvuformat=''
814 uvxformat=''
815 pidtype=''
816 prefix=''
817 prefixexp=''
818 installprivlib=''
819 privlib=''
820 privlibexp=''
821 prototype=''
822 ptrsize=''
823 d_PRIX64=''
824 d_PRId64=''
825 d_PRIi64=''
826 d_PRIo64=''
827 d_PRIu64=''
828 d_PRIx64=''
829 sPRIX64=''
830 sPRId64=''
831 sPRIi64=''
832 sPRIo64=''
833 sPRIu64=''
834 sPRIx64=''
835 d_quad=''
836 quadkind=''
837 quadtype=''
838 uquadtype=''
839 drand01=''
840 randbits=''
841 randfunc=''
842 randseedtype=''
843 seedfunc=''
844 installscript=''
845 scriptdir=''
846 scriptdirexp=''
847 selectminbits=''
848 selecttype=''
849 sh=''
850 sig_count=''
851 sig_name=''
852 sig_name_init=''
853 sig_num=''
854 sig_num_init=''
855 installsitearch=''
856 sitearch=''
857 sitearchexp=''
858 installsitebin=''
859 sitebin=''
860 sitebinexp=''
861 installsitelib=''
862 sitelib=''
863 sitelibexp=''
864 siteprefix=''
865 siteprefixexp=''
866 sizetype=''
867 so=''
868 socksizetype=''
869 sharpbang=''
870 shsharp=''
871 spitshell=''
872 src=''
873 ssizetype=''
874 startperl=''
875 startsh=''
876 stdchar=''
877 d_stdio_stream_array=''
878 stdio_stream_array=''
879 sysman=''
880 trnl=''
881 uidformat=''
882 uidsign=''
883 uidsize=''
884 uidtype=''
885 archname64=''
886 use64bitall=''
887 use64bitint=''
888 uselargefiles=''
889 uselongdouble=''
890 usemorebits=''
891 usemultiplicity=''
892 nm_opt=''
893 nm_so_opt=''
894 runnm=''
895 usenm=''
896 useperlio=''
897 usesocks=''
898 d_oldpthreads=''
899 use5005threads=''
900 useithreads=''
901 usethreads=''
902 incpath=''
903 mips_type=''
904 usrinc=''
905 d_vendorbin=''
906 installvendorbin=''
907 vendorbin=''
908 vendorbinexp=''
909 d_vendorlib=''
910 installvendorlib=''
911 vendorlib=''
912 vendorlibexp=''
913 usevendorprefix=''
914 vendorprefix=''
915 vendorprefixexp=''
916 defvoidused=''
917 voidflags=''
918 pm_apiversion=''
919 xs_apiversion=''
920 CONFIG=''
921
922 define='define'
923 undef='undef'
924 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
925 rmlist=''
926
927 : We must find out about Eunice early
928 eunicefix=':'
929 if test -f /etc/unixtovms; then
930         eunicefix=/etc/unixtovms
931 fi
932 if test -f /etc/unixtovms.exe; then
933         eunicefix=/etc/unixtovms.exe
934 fi
935
936 i_whoami=''
937 : set useposix=false in your hint file to disable the POSIX extension.
938 useposix=true
939 : set useopcode=false in your hint file to disable the Opcode extension.
940 useopcode=true
941 : Trailing extension.  Override this in a hint file, if needed.
942 _exe=''
943 : Extra object files, if any, needed on this platform.
944 archobjs=''
945 : Possible local include directories to search.
946 : Set locincpth to "" in a hint file to defeat local include searches.
947 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
948 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
949 :
950 : no include file wanted by default
951 inclwanted=''
952
953 groupstype=''
954 : change the next line if compiling for Xenix/286 on Xenix/386
955 xlibpth='/usr/lib/386 /lib/386'
956 : Possible local library directories to search.
957 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
958 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
959
960 : general looking path for locating libraries
961 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
962 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
963 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
964 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
965 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
966
967 : Private path used by Configure to find libraries.  Its value
968 : is prepended to libpth. This variable takes care of special
969 : machines, like the mips.  Usually, it should be empty.
970 plibpth=''
971
972 : default library list
973 libswanted=''
974 : some systems want to use only the non-versioned libso:s
975 ignore_versioned_solibs=''
976 : set usemultiplicity on the Configure command line to enable multiplicity.
977 : set usesocks on the Configure command line to enable socks.
978 : set usethreads on the Configure command line to enable threads.
979 : full support for void wanted by default
980 defvoidused=15
981
982 : List of libraries we want.
983 : If anyone needs -lnet, put it in a hint file.
984 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
985 libswanted="$libswanted dld ld sun m c cposix posix"
986 libswanted="$libswanted ndir dir crypt sec"
987 libswanted="$libswanted ucb bsd BSD PW x"
988 : We probably want to search /usr/shlib before most other libraries.
989 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
990 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
991 glibpth="/usr/shlib $glibpth"
992 : Do not use vfork unless overridden by a hint file.
993 usevfork=false
994
995 : Find the basic shell for Bourne shell scripts
996 case "$sh" in
997 '')
998         case "$SYSTYPE" in
999         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1000         *) xxx='/bin/sh';;
1001         esac
1002         if test -f "$xxx"; then
1003                 sh="$xxx"
1004         else
1005                 : Build up a list and do a single loop so we can 'break' out.
1006                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1007                 for xxx in sh bash ksh pdksh ash; do
1008                         for p in $pth; do
1009                                 try="$try ${p}/${xxx}"
1010                         done
1011                 done
1012                 for xxx in $try; do
1013                         if test -f "$xxx"; then
1014                                 sh="$xxx";
1015                                 break
1016                         elif test -f "$xxx.exe"; then
1017                                 sh="$xxx";
1018                                 break
1019                         fi
1020                 done
1021         fi
1022         ;;
1023 esac
1024
1025 case "$sh" in
1026 '')     cat <<EOM >&2
1027 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1028
1029 Usually it's in /bin/sh.  How did you even get this far?
1030 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1031 we'll try to straighten this all out.
1032 EOM
1033         exit 1
1034         ;;
1035 esac
1036
1037 : see if sh knows # comments
1038 if `$sh -c '#' >/dev/null 2>&1`; then
1039         shsharp=true
1040         spitshell=cat
1041         xcat=/bin/cat
1042         test -f $xcat || xcat=/usr/bin/cat
1043         echo "#!$xcat" >try
1044         $eunicefix try
1045         chmod +x try
1046         ./try > today
1047         if test -s today; then
1048                 sharpbang='#!'
1049         else
1050                 echo "#! $xcat" > try
1051                 $eunicefix try
1052                 chmod +x try
1053                 ./try > today
1054                 if test -s today; then
1055                         sharpbang='#! '
1056                 else
1057                         sharpbang=': use '
1058                 fi
1059         fi
1060 else
1061         echo " "
1062         echo "Your $sh doesn't grok # comments--I will strip them later on."
1063         shsharp=false
1064         cd ..
1065         echo "exec grep -v '^[  ]*#'" >spitshell
1066         chmod +x spitshell
1067         $eunicefix spitshell
1068         spitshell=`pwd`/spitshell
1069         cd UU
1070         echo "I presume that if # doesn't work, #! won't work either!"
1071         sharpbang=': use '
1072 fi
1073 rm -f try today
1074
1075 : figure out how to guarantee sh startup
1076 case "$startsh" in
1077 '') startsh=${sharpbang}${sh} ;;
1078 *)
1079 esac
1080 cat >try <<EOSS
1081 $startsh
1082 set abc
1083 test "$?abc" != 1
1084 EOSS
1085
1086 chmod +x try
1087 $eunicefix try
1088 if ./try; then
1089         : echo "Yup, it does."
1090 else
1091         echo "Hmm... '$startsh' does not guarantee sh startup..."
1092         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1093 fi
1094 rm -f try
1095
1096
1097 : Save command line options in file UU/cmdline.opt for later use in
1098 : generating config.sh.
1099 cat > cmdline.opt <<EOSH
1100 # Configure command line arguments.
1101 config_arg0='$0'
1102 config_args='$*'
1103 config_argc=$#
1104 EOSH
1105 argn=1
1106 for arg in "$@"; do
1107         cat >>cmdline.opt <<EOSH
1108 config_arg$argn='$arg'
1109 EOSH
1110         argn=`expr $argn + 1`
1111 done
1112
1113 : produce awk script to parse command line options
1114 cat >options.awk <<'EOF'
1115 BEGIN {
1116         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1117
1118         len = length(optstr);
1119         for (i = 1; i <= len; i++) {
1120                 c = substr(optstr, i, 1);
1121                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1122                 if (a == ":") {
1123                         arg[c] = 1;
1124                         i++;
1125                 }
1126                 opt[c] = 1;
1127         }
1128 }
1129 {
1130         expect = 0;
1131         str = $0;
1132         if (substr(str, 1, 1) != "-") {
1133                 printf("'%s'\n", str);
1134                 next;
1135         }
1136         len = length($0);
1137         for (i = 2; i <= len; i++) {
1138                 c = substr(str, i, 1);
1139                 if (!opt[c]) {
1140                         printf("-%s\n", substr(str, i));
1141                         next;
1142                 }
1143                 printf("-%s\n", c);
1144                 if (arg[c]) {
1145                         if (i < len)
1146                                 printf("'%s'\n", substr(str, i + 1));
1147                         else
1148                                 expect = 1;
1149                         next;
1150                 }
1151         }
1152 }
1153 END {
1154         if (expect)
1155                 print "?";
1156 }
1157 EOF
1158
1159 : process the command line options
1160 set X `for arg in "$@"; do echo "X$arg"; done |
1161         sed -e s/X// | awk -f options.awk`
1162 eval "set $*"
1163 shift
1164 rm -f options.awk
1165
1166 : set up default values
1167 fastread=''
1168 reuseval=false
1169 config_sh=''
1170 alldone=''
1171 error=''
1172 silent=''
1173 extractsh=''
1174 override=''
1175 knowitall=''
1176 rm -f optdef.sh posthint.sh
1177 cat >optdef.sh <<EOS
1178 $startsh
1179 EOS
1180
1181
1182 : option parsing
1183 while test $# -gt 0; do
1184         case "$1" in
1185         -d) shift; fastread=yes;;
1186         -e) shift; alldone=cont;;
1187         -f)
1188                 shift
1189                 cd ..
1190                 if test -r "$1"; then
1191                         config_sh="$1"
1192                 else
1193                         echo "$me: cannot read config file $1." >&2
1194                         error=true
1195                 fi
1196                 cd UU
1197                 shift;;
1198         -h) shift; error=true;;
1199         -r) shift; reuseval=true;;
1200         -s) shift; silent=true; realsilent=true;;
1201         -E) shift; alldone=exit;;
1202         -K) shift; knowitall=true;;
1203         -O) shift; override=true;;
1204         -S) shift; silent=true; extractsh=true;;
1205         -D)
1206                 shift
1207                 case "$1" in
1208                 *=)
1209                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1210                         echo "$me: ignoring -D $1" >&2
1211                         ;;
1212                 *=*) echo "$1" | \
1213                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1214                 *) echo "$1='define'" >> optdef.sh;;
1215                 esac
1216                 shift
1217                 ;;
1218         -U)
1219                 shift
1220                 case "$1" in
1221                 *=) echo "$1" >> optdef.sh;;
1222                 *=*)
1223                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1224                         echo "$me: ignoring -U $1" >&2
1225                         ;;
1226                 *) echo "$1='undef'" >> optdef.sh;;
1227                 esac
1228                 shift
1229                 ;;
1230         -A)
1231             shift
1232             xxx=''
1233             yyy="$1"
1234             zzz=''
1235             uuu=undef
1236             case "$yyy" in
1237             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1238                  case "$zzz" in
1239                  *:*) zzz='' ;;
1240                  *)   xxx=append
1241                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1242                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1243                  esac
1244                  ;;
1245             esac
1246             case "$xxx" in
1247             '')  case "$yyy" in
1248                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1249                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1250                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1251                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1252                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1253                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1254                  esac
1255                  ;;       
1256             esac
1257             case "$xxx" in
1258             append)
1259                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1260             clear)
1261                 echo "$yyy=''"                  >> posthint.sh ;;
1262             define)
1263                 case "$zzz" in
1264                 '') zzz=define ;;
1265                 esac
1266                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1267             eval)
1268                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1269             prepend)
1270                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1271             undef)
1272                 case "$zzz" in
1273                 '') zzz="$uuu" ;;
1274                 esac
1275                 echo "$yyy=$zzz"                >> posthint.sh ;;
1276             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1277             esac
1278             shift
1279             ;;
1280         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1281             exit 0;;
1282         --) break;;
1283         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1284         *) break;;
1285         esac
1286 done
1287
1288 case "$error" in
1289 true)
1290         cat >&2 <<EOM
1291 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1292                  [-U symbol] [-U symbol=] [-A command:symbol...]
1293   -d : use defaults for all answers.
1294   -e : go on without questioning past the production of config.sh.
1295   -f : specify an alternate default configuration file.
1296   -h : print this help message and exit (with an error status).
1297   -r : reuse C symbols value if possible (skips costly nm extraction).
1298   -s : silent mode, only echoes questions and essential information.
1299   -D : define symbol to have some value:
1300          -D symbol         symbol gets the value 'define'
1301          -D symbol=value   symbol gets the value 'value'
1302   -E : stop at the end of questions, after having produced config.sh.
1303   -K : do not use unless you know what you are doing.
1304   -O : let -D and -U override definitions from loaded configuration file.
1305   -S : perform variable substitutions on all .SH files (can mix with -f)
1306   -U : undefine symbol:
1307          -U symbol    symbol gets the value 'undef'
1308          -U symbol=   symbol gets completely empty
1309   -A : manipulate symbol after the platform specific hints have been applied:
1310          -A symbol=value                append " "value to symbol
1311          -A append:symbol=value         append value to symbol
1312          -A define:symbol=value         define symbol to have value
1313          -A clear:symbol                define symbol to be ''
1314          -A define:symbol               define symbol to be 'define'
1315          -A eval:symbol=value           define symbol to be eval of value
1316          -A prepend:symbol=value        prepend value to symbol
1317          -A undef:symbol                define symbol to be 'undef'
1318          -A undef:symbol=               define symbol to be ''
1319   -V : print version number and exit (with a zero status).
1320 EOM
1321         exit 1
1322         ;;
1323 esac
1324
1325 : Sanity checks
1326 case "$fastread$alldone" in
1327 yescont|yesexit) ;;
1328 *)
1329         if test ! -t 0; then
1330                 echo "Say 'sh Configure', not 'sh <Configure'"
1331                 exit 1
1332         fi
1333         ;;
1334 esac
1335
1336 exec 4>&1
1337 case "$silent" in
1338 true) exec 1>/dev/null;;
1339 esac
1340
1341 : run the defines and the undefines, if any, but leave the file out there...
1342 touch optdef.sh
1343 . ./optdef.sh
1344 : create the posthint manipulation script and leave the file out there...
1345 touch posthint.sh
1346
1347 : set package name
1348 package=perl5
1349 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1350 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1351 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1352 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1353 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1354 esac
1355
1356 : Some greps do not return status, grrr.
1357 echo "grimblepritz" >grimble
1358 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1359         contains=contains
1360 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1361         contains=grep
1362 else
1363         contains=contains
1364 fi
1365 rm -f grimble
1366 : the following should work in any shell
1367 case "$contains" in
1368 contains*)
1369         echo " "
1370         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1371         cat >contains <<'EOSS'
1372 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1373 EOSS
1374 chmod +x contains
1375 esac
1376
1377 : Find the path to the source tree
1378 case "$src" in
1379 '') case "$0" in
1380     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1381          case "$src" in
1382          /*)    ;;
1383          *)     src=`cd ../$src && pwd` ;;
1384          esac
1385          ;;
1386     *)   src='.';;
1387     esac;;
1388 esac
1389 case "$src" in
1390 '')     src=/
1391         rsrc=/
1392         ;;
1393 /*) rsrc="$src";;
1394 *) rsrc="../$src";;
1395 esac
1396 if test -f $rsrc/Configure && \
1397         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1398 then
1399    : found it, so we are ok.
1400 else
1401         rsrc=''
1402         for src in . .. ../.. ../../.. ../../../..; do
1403                 if test -f ../$src/Configure && \
1404                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1405                 then
1406                         rsrc=../$src
1407                         break
1408                 fi
1409         done
1410 fi
1411 case "$rsrc" in
1412 '')
1413         cat <<EOM >&4
1414
1415 Sorry, I can't seem to locate the source dir for $package.  Please start
1416 Configure with an explicit path -- i.e. /some/path/Configure.
1417
1418 EOM
1419         exit 1
1420         ;;
1421 ../.)   rsrc='..';;
1422 *)
1423         echo " "
1424         echo "Sources for $package found in \"$src\"." >&4
1425         ;;
1426 esac
1427
1428 : script used to extract .SH files with variable substitutions
1429 cat >extract <<'EOS'
1430 CONFIGDOTSH=true
1431 echo "Doing variable substitutions on .SH files..."
1432 if test -f $src/MANIFEST; then
1433         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1434 else
1435         echo "(Looking for .SH files under the source directory.)"
1436         set x `(cd $src; find . -name "*.SH" -print)`
1437 fi
1438 shift
1439 case $# in
1440 0) set x `(cd $src; echo *.SH)`; shift;;
1441 esac
1442 if test ! -f $src/$1; then
1443         shift
1444 fi
1445 mkdir_p='
1446 name=$1;
1447 create="";
1448 while test $name; do
1449         if test ! -d "$name"; then
1450                 create="$name $create";
1451                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1452                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1453         else
1454                 name="";
1455         fi;
1456 done;
1457 for file in $create; do
1458         mkdir $file;
1459 done
1460 '
1461 for file in $*; do
1462         case "$src" in
1463         ".")
1464                 case "$file" in
1465                 */*)
1466                         dir=`expr X$file : 'X\(.*\)/'`
1467                         file=`expr X$file : 'X.*/\(.*\)'`
1468                         (cd $dir && . ./$file)
1469                         ;;
1470                 *)
1471                         . ./$file
1472                         ;;
1473                 esac
1474                 ;;
1475         *)
1476                 case "$file" in
1477                 */*)
1478                         dir=`expr X$file : 'X\(.*\)/'`
1479                         file=`expr X$file : 'X.*/\(.*\)'`
1480                         (set x $dir; shift; eval $mkdir_p)
1481                         sh <$src/$dir/$file
1482                         ;;
1483                 *)
1484                         sh <$src/$file
1485                         ;;
1486                 esac
1487                 ;;
1488         esac
1489 done
1490 if test -f $src/config_h.SH; then
1491         if test ! -f config.h; then
1492         : oops, they left it out of MANIFEST, probably, so do it anyway.
1493         . $src/config_h.SH
1494         fi
1495 fi
1496 EOS
1497
1498 : extract files and exit if asked to do so
1499 case "$extractsh" in
1500 true)
1501         case "$realsilent" in
1502         true) ;;
1503         *) exec 1>&4;;
1504         esac
1505         case "$config_sh" in
1506         '') config_sh='config.sh';;
1507         esac
1508         echo " "
1509         echo "Fetching answers from $config_sh..."
1510         cd ..
1511         . $config_sh
1512         test "$override" && . ./optdef.sh
1513         echo " "
1514         . UU/extract
1515         rm -rf UU
1516         echo "Done."
1517         exit 0
1518         ;;
1519 esac
1520
1521 : Eunice requires " " instead of "", can you believe it
1522 echo " "
1523 : Here we go...
1524 echo "Beginning of configuration questions for $package."
1525
1526 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1527
1528 : first determine how to suppress newline on echo command
1529 echo " "
1530 echo "Checking echo to see how to suppress newlines..."
1531 (echo "hi there\c" ; echo " ") >.echotmp
1532 if $contains c .echotmp >/dev/null 2>&1 ; then
1533         echo "...using -n."
1534         n='-n'
1535         c=''
1536 else
1537         cat <<'EOM'
1538 ...using \c
1539 EOM
1540         n=''
1541         c='\c'
1542 fi
1543 echo $n "The star should be here-->$c"
1544 echo '*'
1545 rm -f .echotmp
1546
1547 : Now test for existence of everything in MANIFEST
1548 echo " "
1549 if test -f $rsrc/MANIFEST; then
1550         echo "First let's make sure your kit is complete.  Checking..." >&4
1551         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1552         rm -f missing
1553         tmppwd=`pwd`
1554         for filelist in x??; do
1555                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1556         done
1557         if test -s missing; then
1558                 cat missing >&4
1559                 cat >&4 <<'EOM'
1560
1561 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1562
1563 You have the option of continuing the configuration process, despite the
1564 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1565 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1566 and contact the author (perlbug@perl.com).
1567
1568 EOM
1569                 echo $n "Continue? [n] $c" >&4
1570                 read ans
1571                 case "$ans" in
1572                 y*)
1573                         echo "Continuing..." >&4
1574                         rm -f missing
1575                         ;;
1576                 *)
1577                         echo "ABORTING..." >&4
1578                         kill $$
1579                         ;;
1580                 esac
1581         else
1582                 echo "Looks good..."
1583         fi
1584 else
1585         echo "There is no MANIFEST file.  I hope your kit is complete !"
1586 fi
1587 rm -f missing x??
1588
1589 echo " "
1590 : Find the appropriate value for a newline for tr
1591 if test -n "$DJGPP"; then
1592        trnl='\012'
1593 fi
1594 if test X"$trnl" = X; then
1595         case "`echo foo|tr '\n' x 2>/dev/null`" in
1596         foox) trnl='\n' ;;
1597         esac
1598 fi
1599 if test X"$trnl" = X; then
1600         case "`echo foo|tr '\012' x 2>/dev/null`" in
1601         foox) trnl='\012' ;;
1602         esac
1603 fi
1604 if test X"$trnl" = X; then
1605         cat <<EOM >&2
1606
1607 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1608
1609 EOM
1610         exit 1
1611 fi
1612
1613 : compute the number of columns on the terminal for proper question formatting
1614 case "$COLUMNS" in
1615 '') COLUMNS='80';;
1616 esac
1617
1618 : set up the echo used in my read
1619 myecho="case \"\$xxxm\" in
1620 '') echo $n \"\$rp $c\" >&4;;
1621 *) case \"\$rp\" in
1622         '') echo $n \"[\$xxxm] $c\";;
1623         *)
1624                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1625                         echo \"\$rp\" >&4
1626                         echo $n \"[\$xxxm] $c\" >&4
1627                 else
1628                         echo $n \"\$rp [\$xxxm] $c\" >&4
1629                 fi
1630                 ;;
1631         esac;;
1632 esac"
1633
1634 : now set up to do reads with possible shell escape and default assignment
1635 cat <<EOSC >myread
1636 $startsh
1637 xxxm=\$dflt
1638 $myecho
1639 ans='!'
1640 case "\$fastread" in
1641 yes) case "\$dflt" in
1642         '') ;;
1643         *) ans='';
1644                 case "\$silent-\$rp" in
1645                 true-) ;;
1646                 *) echo " " >&4;;
1647                 esac;;
1648         esac;;
1649 *) case "\$silent" in
1650         true) case "\$rp" in
1651                 '') ans='';;
1652                 esac;;
1653         esac;;
1654 esac
1655 while expr "X\$ans" : "X!" >/dev/null; do
1656         read answ
1657         set x \$xxxm
1658         shift
1659         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1660         case  "\$answ" in
1661         "!")
1662                 sh 1>&4
1663                 echo " "
1664                 $myecho
1665                 ;;
1666         !*)
1667                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1668                 shift
1669                 sh 1>&4 -c "\$*"
1670                 echo " "
1671                 $myecho
1672                 ;;
1673         "\$ans")
1674                 case "\$ans" in
1675                 \\&*)
1676                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1677                         shift
1678                         case "\$1" in
1679                         -d)
1680                                 fastread=yes
1681                                 echo "(OK, I'll run with -d after this question.)" >&4
1682                                 ;;
1683                         -*)
1684                                 echo "*** Sorry, \$1 not supported yet." >&4
1685                                 ;;
1686                         esac
1687                         $myecho
1688                         ans=!
1689                         ;;
1690                 esac;;
1691         *)
1692                 case "\$aok" in
1693                 y)
1694                         echo "*** Substitution done -- please confirm."
1695                         xxxm="\$ans"
1696                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1697                         xxxm="\$ans"
1698                         ans=!
1699                         ;;
1700                 *)
1701                         echo "*** Error -- try again."
1702                         ans=!
1703                         ;;
1704                 esac
1705                 $myecho
1706                 ;;
1707         esac
1708         case "\$ans\$xxxm\$nostick" in
1709         '')
1710                 ans=!
1711                 $myecho
1712                 ;;
1713         esac
1714 done
1715 case "\$ans" in
1716 '') ans="\$xxxm";;
1717 esac
1718 EOSC
1719
1720 : create .config dir to save info across Configure sessions
1721 test -d ../.config || mkdir ../.config
1722 cat >../.config/README <<EOF
1723 This directory created by Configure to save information that should
1724 persist across sessions for $package.
1725
1726 You may safely delete it if you wish.
1727 EOF
1728
1729 : general instructions
1730 needman=true
1731 firsttime=true
1732 user=`(logname) 2>/dev/null`
1733 case "$user" in
1734 '') user=`whoami 2>&1`;;
1735 esac
1736 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1737         firsttime=false
1738         echo " "
1739         rp='Would you like to see the instructions?'
1740         dflt=n
1741         . ./myread
1742         case "$ans" in
1743         [yY]*) ;;
1744         *) needman=false;;
1745         esac
1746 fi
1747 if $needman; then
1748         cat <<EOH
1749
1750 This installation shell script will examine your system and ask you questions
1751 to determine how the perl5 package should be installed. If you get
1752 stuck on a question, you may use a ! shell escape to start a subshell or
1753 execute a command.  Many of the questions will have default answers in square
1754 brackets; typing carriage return will give you the default.
1755
1756 On some of the questions which ask for file or directory names you are allowed
1757 to use the ~name construct to specify the login directory belonging to "name",
1758 even if you don't have a shell which knows about that.  Questions where this is
1759 allowed will be marked "(~name ok)".
1760
1761 EOH
1762         rp=''
1763         dflt='Type carriage return to continue'
1764         . ./myread
1765         cat <<'EOH'
1766
1767 The prompter used in this script allows you to use shell variables and
1768 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1769 in the default answer, as if the default line was a set of arguments given to a
1770 script shell.  This means you may also use $* to repeat the whole default line,
1771 so you do not have to re-type everything to add something to the default.
1772
1773 Everytime there is a substitution, you will have to confirm.  If there is an
1774 error (e.g. an unmatched backtick), the default answer will remain unchanged
1775 and you will be prompted again.
1776
1777 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1778 the questions and use the computed defaults (or the previous answers if there
1779 was already a config.sh file). Type 'Configure -h' for a list of options.
1780 You may also start interactively and then answer '& -d' at any prompt to turn
1781 on the non-interactive behaviour for the remainder of the execution.
1782
1783 EOH
1784         . ./myread
1785         cat <<EOH
1786
1787 Much effort has been expended to ensure that this shell script will run on any
1788 Unix system.  If despite that it blows up on yours, your best bet is to edit
1789 Configure and run it again.  If you can't run Configure for some reason,
1790 you'll have to generate a config.sh file by hand.  Whatever problems you
1791 have, let me (perlbug@perl.com) know how I blew it.
1792
1793 This installation script affects things in two ways:
1794
1795 1) it may do direct variable substitutions on some of the files included
1796    in this kit.
1797 2) it builds a config.h file for inclusion in C programs.  You may edit
1798    any of these files as the need arises after running this script.
1799
1800 If you make a mistake on a question, there is no easy way to back up to it
1801 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1802 files.  Configure will offer to let you do this before it runs the SH files.
1803
1804 EOH
1805         dflt='Type carriage return to continue'
1806         . ./myread
1807         case "$firsttime" in
1808         true) echo $user >>../.config/instruct;;
1809         esac
1810 fi
1811
1812 : find out where common programs are
1813 echo " "
1814 echo "Locating common programs..." >&4
1815 cat <<EOSC >loc
1816 $startsh
1817 case \$# in
1818 0) exit 1;;
1819 esac
1820 thing=\$1
1821 shift
1822 dflt=\$1
1823 shift
1824 for dir in \$*; do
1825         case "\$thing" in
1826         .)
1827         if test -d \$dir/\$thing; then
1828                 echo \$dir
1829                 exit 0
1830         fi
1831         ;;
1832         *)
1833         for thisthing in \$dir/\$thing; do
1834                 : just loop through to pick last item
1835         done
1836         if test -f \$thisthing; then
1837                 echo \$thisthing
1838                 exit 0
1839         elif test -f \$dir/\$thing.exe; then
1840                 if test -n "$DJGPP"; then
1841                         echo \$dir/\$thing.exe
1842                 else
1843                         : on Eunice apparently
1844                         echo \$dir/\$thing
1845                 fi
1846                 exit 0
1847         fi
1848         ;;
1849         esac
1850 done
1851 echo \$dflt
1852 exit 1
1853 EOSC
1854 chmod +x loc
1855 $eunicefix loc
1856 loclist="
1857 awk
1858 cat
1859 comm
1860 cp
1861 echo
1862 expr
1863 grep
1864 ls
1865 make
1866 mkdir
1867 rm
1868 sed
1869 sort
1870 touch
1871 tr
1872 uniq
1873 "
1874 trylist="
1875 Mcc
1876 ar
1877 byacc
1878 cpp
1879 csh
1880 date
1881 egrep
1882 gzip
1883 less
1884 ln
1885 more
1886 nm
1887 nroff
1888 pg
1889 test
1890 uname
1891 zip
1892 "
1893 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1894 pth="$pth /lib /usr/lib"
1895 for file in $loclist; do
1896         eval xxx=\$$file
1897         case "$xxx" in
1898         /*|?:[\\/]*)
1899                 if test -f "$xxx"; then
1900                         : ok
1901                 else
1902                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1903                         xxx=`./loc $file $file $pth`
1904                 fi
1905                 ;;
1906         '') xxx=`./loc $file $file $pth`;;
1907         *) xxx=`./loc $xxx $xxx $pth`;;
1908         esac
1909         eval $file=$xxx
1910         eval _$file=$xxx
1911         case "$xxx" in
1912         /*)
1913                 echo $file is in $xxx.
1914                 ;;
1915         ?:[\\/]*)
1916                 echo $file is in $xxx.
1917                 ;;
1918         *)
1919                 echo "I don't know where '$file' is, and my life depends on it." >&4
1920                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1921                 exit 1
1922                 ;;
1923         esac
1924 done
1925 echo " "
1926 echo "Don't worry if any of the following aren't found..."
1927 say=offhand
1928 for file in $trylist; do
1929         eval xxx=\$$file
1930         case "$xxx" in
1931         /*|?:[\\/]*)
1932                 if test -f "$xxx"; then
1933                         : ok
1934                 else
1935                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1936                         xxx=`./loc $file $file $pth`
1937                 fi
1938                 ;;
1939         '') xxx=`./loc $file $file $pth`;;
1940         *) xxx=`./loc $xxx $xxx $pth`;;
1941         esac
1942         eval $file=$xxx
1943         eval _$file=$xxx
1944         case "$xxx" in
1945         /*)
1946                 echo $file is in $xxx.
1947                 ;;
1948         ?:[\\/]*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         *)
1952                 echo "I don't see $file out there, $say."
1953                 say=either
1954                 ;;
1955         esac
1956 done
1957 case "$egrep" in
1958 egrep)
1959         echo "Substituting grep for egrep."
1960         egrep=$grep
1961         ;;
1962 esac
1963 case "$ln" in
1964 ln)
1965         echo "Substituting cp for ln."
1966         ln=$cp
1967         ;;
1968 esac
1969 case "$test" in
1970 test)
1971         echo "Hopefully test is built into your sh."
1972         ;;
1973 *)
1974         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1975                 echo "Using the test built into your sh."
1976                 test=test
1977                 _test=test
1978         fi
1979         ;;
1980 esac
1981 case "$echo" in
1982 echo)
1983         echo "Hopefully echo is built into your sh."
1984         ;;
1985 '') ;;
1986 *)
1987         echo " "
1988 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1989         $echo $n "hi there$c" >foo1
1990         echo $n "hi there$c" >foo2
1991         if cmp foo1 foo2 >/dev/null 2>&1; then
1992                 echo "They are compatible.  In fact, they may be identical."
1993         else
1994                 case "$n" in
1995                 '-n') n='' c='\c';;
1996                 *) n='-n' c='';;
1997                 esac
1998                 cat <<FOO
1999 They are not compatible!  You are probably running ksh on a non-USG system.
2000 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2001 have echo built in and we may have to run some Bourne shell scripts.  That
2002 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2003
2004 FOO
2005                 $echo $n "The star should be here-->$c"
2006                 $echo "*"
2007         fi
2008         $rm -f foo1 foo2
2009         ;;
2010 esac
2011
2012 : determine whether symbolic links are supported
2013 echo " "
2014 $touch blurfl
2015 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2016         echo "Symbolic links are supported." >&4
2017         lns="$ln -s"
2018 else
2019         echo "Symbolic links are NOT supported." >&4
2020         lns="$ln"
2021 fi
2022 $rm -f blurfl sym
2023
2024 : see whether [:lower:] and [:upper:] are supported character classes
2025 echo " "
2026 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2027 ABYZ)
2028         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2029         up='[:upper:]'
2030         low='[:lower:]'
2031         ;;
2032 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2033         # (0xc9 and 0xd1), therefore that is a nice testing point.
2034         if test "X$up" = X -o "X$low" = X; then
2035             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2036             ij) up='[A-Z]'
2037                 low='[a-z]'
2038                 ;;
2039             esac
2040         fi
2041         if test "X$up" = X -o "X$low" = X; then
2042             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2043             ij) up='A-Z'
2044                 low='a-z'
2045                 ;;
2046             esac
2047         fi
2048         if test "X$up" = X -o "X$low" = X; then
2049             case "`echo IJ | od -x 2>/dev/null`" in
2050             *C9D1*|*c9d1*)
2051                 echo "Hey, this might be EBCDIC." >&4
2052                 if test "X$up" = X -o "X$low" = X; then
2053                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2054                     ij) up='[A-IJ-RS-Z]'
2055                         low='[a-ij-rs-z]'
2056                         ;;
2057                     esac
2058                 fi
2059                 if test "X$up" = X -o "X$low" = X; then
2060                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2061                     ij) up='A-IJ-RS-Z'
2062                         low='a-ij-rs-z'
2063                         ;;
2064                     esac
2065                 fi
2066                 ;;
2067             esac
2068         fi
2069 esac
2070 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2071 ij)
2072     echo "Using $up and $low to convert case." >&4
2073     ;;
2074 *)
2075     echo "I don't know how to translate letters from upper to lower case." >&4
2076     echo "Your tr is not acting any way I know of." >&4
2077     exit 1
2078     ;;
2079 esac
2080 : set up the translation script tr, must be called with ./tr of course
2081 cat >tr <<EOSC
2082 $startsh
2083 case "\$1\$2" in
2084 '[A-Z][a-z]') exec $tr '$up' '$low';;
2085 '[a-z][A-Z]') exec $tr '$low' '$up';;
2086 esac
2087 exec $tr "\$@"
2088 EOSC
2089 chmod +x tr
2090 $eunicefix tr
2091
2092 : Try to determine whether config.sh was made on this system
2093 case "$config_sh" in
2094 '')
2095 myuname=`$uname -a 2>/dev/null`
2096 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2097 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2098 # because the A-Z/a-z are not consecutive.
2099 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2100         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2101 newmyuname="$myuname"
2102 dflt=n
2103 case "$knowitall" in
2104 '')
2105         if test -f ../config.sh; then
2106                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2107                         eval "`grep myuname= ../config.sh`"
2108                 fi
2109                 if test "X$myuname" = "X$newmyuname"; then
2110                         dflt=y
2111                 fi
2112         fi
2113         ;;
2114 *) dflt=y;;
2115 esac
2116
2117 : Get old answers from old config file if Configure was run on the
2118 : same system, otherwise use the hints.
2119 hint=default
2120 cd ..
2121 if test -f config.sh; then
2122         echo " "
2123         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2124         . UU/myread
2125         case "$ans" in
2126         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2127         *)  echo "Fetching default answers from your old config.sh file..." >&4
2128                 tmp_n="$n"
2129                 tmp_c="$c"
2130                 tmp_sh="$sh"
2131                 . ./config.sh
2132                 cp config.sh UU
2133                 n="$tmp_n"
2134                 c="$tmp_c"
2135                 : Older versions did not always set $sh.  Catch re-use of such
2136                 : an old config.sh.
2137                 case "$sh" in
2138                 '') sh="$tmp_sh" ;;
2139                 esac
2140                 hint=previous
2141                 ;;
2142         esac
2143 fi
2144 if test ! -f config.sh; then
2145         $cat <<EOM
2146
2147 First time through, eh?  I have some defaults handy for some systems
2148 that need some extra help getting the Configure answers right:
2149
2150 EOM
2151         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2152         dflt=''
2153         : Half the following guesses are probably wrong... If you have better
2154         : tests or hints, please send them to perlbug@perl.com
2155         : The metaconfig authors would also appreciate a copy...
2156         $test -f /irix && osname=irix
2157         $test -f /xenix && osname=sco_xenix
2158         $test -f /dynix && osname=dynix
2159         $test -f /dnix && osname=dnix
2160         $test -f /lynx.os && osname=lynxos
2161         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2162         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2163         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2164         $test -f /bin/mips && /bin/mips && osname=mips
2165         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2166                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2167         $test -d /usr/apollo/bin && osname=apollo
2168         $test -f /etc/saf/_sactab && osname=svr4
2169         $test -d /usr/include/minix && osname=minix
2170         if $test -d /MachTen -o -d /MachTen_Folder; then
2171                 osname=machten
2172                 if $test -x /sbin/version; then
2173                         osvers=`/sbin/version | $awk '{print $2}' |
2174                         $sed -e 's/[A-Za-z]$//'`
2175                 elif $test -x /usr/etc/version; then
2176                         osvers=`/usr/etc/version | $awk '{print $2}' |
2177                         $sed -e 's/[A-Za-z]$//'`
2178                 else
2179                         osvers="$2.$3"
2180                 fi
2181         fi
2182
2183         $test -f /sys/posix.dll &&
2184                 $test -f /usr/bin/what &&
2185                 set X `/usr/bin/what /sys/posix.dll` &&
2186                 $test "$3" = UWIN &&
2187                 osname=uwin &&
2188                 osvers="$5"
2189
2190         if $test -f $uname; then
2191                 set X $myuname
2192                 shift
2193
2194                 case "$5" in
2195                 fps*) osname=fps ;;
2196                 mips*)
2197                         case "$4" in
2198                         umips) osname=umips ;;
2199                         *) osname=mips ;;
2200                         esac;;
2201                 [23]100) osname=mips ;;
2202                 next*) osname=next ;;
2203                 i386*)
2204                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2205                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2206                                 osname='sco'
2207                                 osvers=$tmp
2208                         elif $test -f /etc/kconfig; then
2209                                 osname=isc
2210                                 if test "$lns" = "$ln -s"; then
2211                                         osvers=4
2212                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2213                                         osvers=3
2214                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2215                                         osvers=2
2216                                 fi
2217                         fi
2218                         tmp=''
2219                         ;;
2220                 pc*)
2221                         if test -n "$DJGPP"; then
2222                                 osname=dos
2223                                 osvers=djgpp
2224                         fi
2225                         ;;
2226                 esac
2227
2228                 case "$1" in
2229                 aix) osname=aix
2230                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2231                         case "$tmp" in
2232                         'not found') osvers="$4"."$3" ;;
2233                         '<3240'|'<>3240') osvers=3.2.0 ;;
2234                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2235                         '=3250'|'>3250') osvers=3.2.5 ;;
2236                         *) osvers=$tmp;;
2237                         esac
2238                         ;;
2239                 bsd386) osname=bsd386
2240                         osvers=`$uname -r`
2241                         ;;
2242                 cygwin*) osname=cygwin
2243                         osvers="$3"
2244                         ;;
2245                 *dc.osx) osname=dcosx
2246                         osvers="$3"
2247                         ;;
2248                 dnix) osname=dnix
2249                         osvers="$3"
2250                         ;;
2251                 domainos) osname=apollo
2252                         osvers="$3"
2253                         ;;
2254                 dgux) osname=dgux 
2255                         osvers="$3"
2256                         ;;
2257                 dynixptx*) osname=dynixptx
2258                         osvers=`echo "$4"|sed 's/^v//'`
2259                         ;;
2260                 freebsd) osname=freebsd 
2261                         osvers="$3" ;;
2262                 genix) osname=genix ;;
2263                 hp*) osname=hpux 
2264                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2265                         ;;
2266                 irix*) osname=irix
2267                         case "$3" in
2268                         4*) osvers=4 ;;
2269                         5*) osvers=5 ;;
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 linux) osname=linux
2274                         case "$3" in
2275                         *)      osvers="$3" ;;
2276                         esac
2277                         ;;
2278                 MiNT) osname=mint
2279                         ;;
2280                 netbsd*) osname=netbsd
2281                         osvers="$3"
2282                         ;;
2283                 news-os) osvers="$3"
2284                         case "$3" in
2285                         4*) osname=newsos4 ;;
2286                         *) osname=newsos ;;
2287                         esac
2288                         ;;
2289                 next*) osname=next ;;
2290                 POSIX-BC | posix-bc ) osname=posix-bc
2291                         osvers="$3"
2292                         ;;
2293                 powerux | power_ux | powermax_os | powermaxos | \
2294                 powerunix | power_unix) osname=powerux
2295                         osvers="$3"
2296                         ;;
2297                 qnx) osname=qnx
2298                         osvers="$4"
2299                         ;;
2300                 solaris) osname=solaris
2301                         case "$3" in
2302                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2303                         *)      osvers="$3" ;;
2304                         esac
2305                         ;;
2306                 sunos) osname=sunos
2307                         case "$3" in
2308                         5*) osname=solaris
2309                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2310                         *)      osvers="$3" ;;
2311                         esac
2312                         ;;
2313                 titanos) osname=titanos
2314                         case "$3" in
2315                         1*) osvers=1 ;;
2316                         2*) osvers=2 ;;
2317                         3*) osvers=3 ;;
2318                         4*) osvers=4 ;;
2319                         *)      osvers="$3" ;;
2320                         esac
2321                         ;;
2322                 ultrix) osname=ultrix
2323                         osvers="$3"
2324                         ;;
2325                 osf1|mls+)      case "$5" in
2326                                 alpha)
2327                                         osname=dec_osf
2328                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2329                                         ;;
2330                         hp*)    osname=hp_osf1  ;;
2331                         mips)   osname=mips_osf1 ;;
2332                         esac
2333                         ;;
2334                 unixware) osname=svr5
2335                         osvers="$4"
2336                         ;;
2337                 uts) osname=uts
2338                         osvers="$3"
2339                         ;;
2340                 $2) case "$osname" in
2341                         *isc*) ;;
2342                         *freebsd*) ;;
2343                         svr*)
2344                                 : svr4.x or possibly later
2345                                 case "svr$3" in 
2346                                 ${osname}*)
2347                                         osname=svr$3
2348                                         osvers=$4
2349                                         ;;
2350                                 esac
2351                                 case "$osname" in
2352                                 svr4.0)
2353                                         : Check for ESIX
2354                                         if test -f /stand/boot ; then
2355                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2356                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2357                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2358                                                         if test -n "$isesix"; then
2359                                                                 osname=esix4
2360                                                         fi
2361                                                 fi
2362                                         fi
2363                                         ;;
2364                                 esac
2365                                 ;;
2366                         *)      if test -f /etc/systemid; then
2367                                         osname=sco
2368                                         set `echo $3 | $sed 's/\./ /g'` $4
2369                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2370                                                 osvers=$1.$2.$3
2371                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2372                                                 osvers=$1.$2
2373                                         elif $test -f $src/hints/sco_$1.sh; then
2374                                                 osvers=$1
2375                                         fi
2376                                 else
2377                                         case "$osname" in
2378                                         '') : Still unknown.  Probably a generic Sys V.
2379                                                 osname="sysv"
2380                                                 osvers="$3"
2381                                                 ;;
2382                                         esac
2383                                 fi
2384                                 ;;
2385                         esac
2386                         ;;
2387                 *)      case "$osname" in
2388                         '') : Still unknown.  Probably a generic BSD.
2389                                 osname="$1"
2390                                 osvers="$3"
2391                                 ;;
2392                         esac
2393                         ;;
2394                 esac
2395         else
2396                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2397                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2398                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2399                                 osname=news_os
2400                         fi
2401                         $rm -f UU/kernel.what
2402                 elif test -d c:/.; then
2403                         set X $myuname
2404                         osname=os2
2405                         osvers="$5"
2406                 fi
2407         fi
2408         
2409         : Now look for a hint file osname_osvers, unless one has been
2410         : specified already.
2411         case "$hintfile" in
2412         ''|' ')
2413                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2414                 : Also try without trailing minor version numbers.
2415                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2416                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2417                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2418                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2419                 case "$file" in
2420                 '') dflt=none ;;
2421                 *)  case "$osvers" in
2422                         '') dflt=$file
2423                                 ;;
2424                         *)  if $test -f $src/hints/$file.sh ; then
2425                                         dflt=$file
2426                                 elif $test -f $src/hints/$xfile.sh ; then
2427                                         dflt=$xfile
2428                                 elif $test -f $src/hints/$xxfile.sh ; then
2429                                         dflt=$xxfile
2430                                 elif $test -f $src/hints/$xxxfile.sh ; then
2431                                         dflt=$xxxfile
2432                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2433                                         dflt=$xxxxfile
2434                                 elif $test -f "$src/hints/${osname}.sh" ; then
2435                                         dflt="${osname}"
2436                                 else
2437                                         dflt=none
2438                                 fi
2439                                 ;;
2440                         esac
2441                         ;;
2442                 esac
2443                 if $test -f Policy.sh ; then
2444                         case "$dflt" in
2445                         *Policy*) ;;
2446                         none) dflt="Policy" ;;
2447                         *) dflt="Policy $dflt" ;;
2448                         esac
2449                 fi
2450                 ;;
2451         *)
2452                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2453                 ;;
2454         esac
2455
2456         if $test -f Policy.sh ; then
2457                 $cat <<EOM
2458
2459 There's also a Policy hint file available, which should make the
2460 site-specific (policy) questions easier to answer.
2461 EOM
2462
2463         fi
2464
2465         $cat <<EOM
2466
2467 You may give one or more space-separated answers, or "none" if appropriate.
2468 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2469 is a good thing.  DO NOT give a wrong version or a wrong OS.
2470
2471 EOM
2472
2473         rp="Which of these apply, if any?"
2474         . UU/myread
2475         tans=$ans
2476         for file in $tans; do
2477                 if $test X$file = XPolicy -a -f Policy.sh; then
2478                         . Policy.sh
2479                         $cat Policy.sh >> UU/config.sh
2480                 elif $test -f $src/hints/$file.sh; then
2481                         . $src/hints/$file.sh
2482                         $cat $src/hints/$file.sh >> UU/config.sh
2483                 elif $test X$tans = X -o X$tans = Xnone ; then
2484                         : nothing
2485                 else
2486                         : Give one chance to correct a possible typo.
2487                         echo "$file.sh does not exist"
2488                         dflt=$file
2489                         rp="hint to use instead?"
2490                         . UU/myread
2491                         for file in $ans; do
2492                                 if $test -f "$src/hints/$file.sh"; then
2493                                         . $src/hints/$file.sh
2494                                         $cat $src/hints/$file.sh >> UU/config.sh
2495                                 elif $test X$ans = X -o X$ans = Xnone ; then
2496                                         : nothing
2497                                 else
2498                                         echo "$file.sh does not exist -- ignored."
2499                                 fi
2500                         done
2501                 fi
2502         done
2503
2504         hint=recommended
2505         : Remember our hint file for later.
2506         if $test -f "$src/hints/$file.sh" ; then
2507                 hintfile="$file"
2508         else
2509                 hintfile=''
2510         fi
2511 fi
2512 cd UU
2513 ;;
2514 *)
2515         echo " "
2516         echo "Fetching default answers from $config_sh..." >&4
2517         tmp_n="$n"
2518         tmp_c="$c"
2519         cd ..
2520         cp $config_sh config.sh 2>/dev/null
2521         chmod +w config.sh
2522         . ./config.sh
2523         cd UU
2524         cp ../config.sh .
2525         n="$tmp_n"
2526         c="$tmp_c"
2527         hint=previous
2528         ;;
2529 esac
2530 test "$override" && . ./optdef.sh
2531 myuname="$newmyuname"
2532
2533 : Restore computed paths
2534 for file in $loclist $trylist; do
2535         eval $file="\$_$file"
2536 done
2537
2538 cat << EOM
2539
2540 Configure uses the operating system name and version to set some defaults.
2541 The default value is probably right if the name rings a bell. Otherwise,
2542 since spelling matters for me, either accept the default or answer "none"
2543 to leave it blank.
2544
2545 EOM
2546 case "$osname" in
2547         ''|' ')
2548                 case "$hintfile" in
2549                 ''|' '|none) dflt=none ;;
2550                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2551                 esac
2552                 ;;
2553         *) dflt="$osname" ;;
2554 esac
2555 rp="Operating system name?"
2556 . ./myread
2557 case "$ans" in
2558 none)  osname='' ;;
2559 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2560 esac
2561 echo " "
2562 case "$osvers" in
2563         ''|' ')
2564                 case "$hintfile" in
2565                 ''|' '|none) dflt=none ;;
2566                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2567                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2568                         case "$dflt" in
2569                         ''|' ') dflt=none ;;
2570                         esac
2571                         ;;
2572                 esac
2573                 ;;
2574         *) dflt="$osvers" ;;
2575 esac
2576 rp="Operating system version?"
2577 . ./myread
2578 case "$ans" in
2579 none)  osvers='' ;;
2580 *) osvers="$ans" ;;
2581 esac
2582
2583
2584 . ./posthint.sh
2585
2586 : who configured the system
2587 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2588 cf_by=`(logname) 2>/dev/null`
2589 case "$cf_by" in
2590 "")
2591         cf_by=`(whoami) 2>/dev/null`
2592         case "$cf_by" in
2593         "") cf_by=unknown ;;
2594         esac ;;
2595 esac
2596
2597 : set up the script used to warn in case of inconsistency
2598 cat <<EOS >whoa
2599 $startsh
2600 EOS
2601 cat <<'EOSC' >>whoa
2602 dflt=y
2603 echo " "
2604 echo "*** WHOA THERE!!! ***" >&4
2605 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2606 rp="    Keep the $hint value?"
2607 . ./myread
2608 case "$ans" in
2609 y) td=$was; tu=$was;;
2610 esac
2611 EOSC
2612
2613 : function used to set $1 to $val
2614 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2615 case "$val$was" in
2616 $define$undef) . ./whoa; eval "$var=\$td";;
2617 $undef$define) . ./whoa; eval "$var=\$tu";;
2618 *) eval "$var=$val";;
2619 esac'
2620
2621 case "$usethreads" in
2622 $define|true|[yY]*)     dflt='y';;
2623 *) dflt='n';;
2624 esac
2625 cat <<EOM
2626
2627 Perl can be built to take advantage of threads on some systems.
2628 To do so, Configure can be run with -Dusethreads.
2629
2630 Note that threading is a highly experimental feature, and
2631 some known race conditions still remain.  If you choose to try
2632 it, be very sure to not actually deploy it for production
2633 purposes.  README.threads has more details, and is required
2634 reading if you enable threads.
2635
2636 If this doesn't make any sense to you, just accept the default '$dflt'.
2637 EOM
2638 rp='Build a threading Perl?'
2639 . ./myread
2640 case "$ans" in
2641 y|Y)    val="$define" ;;
2642 *)      val="$undef" ;;
2643 esac
2644 set usethreads
2645 eval $setvar
2646
2647 case "$usethreads" in
2648 $define)
2649         $cat <<EOM
2650
2651 As of 5.5.640, Perl has two different internal threading implementations,
2652 the 5.005 version (5005threads) and an interpreter-based version
2653 (ithreads) that has one interpreter per thread.  Both are very 
2654 experimental.  This arrangement exists to help developers work out
2655 which one is better.
2656
2657 If you're a casual user, you probably don't want interpreter-threads
2658 at this time.  There doesn't yet exist a way to create threads from
2659 within Perl in this model, i.e., "use Thread;" will NOT work.
2660 EOM
2661         : Default to ithreads unless overridden on command line or with
2662         : old config.sh
2663         dflt='y'
2664         case "$use5005threads" in
2665                 $define|true|[yY]*) dflt='n';;
2666         esac
2667         case "$useithreads" in
2668                 $undef|false|[nN]*) dflt='n';;
2669         esac
2670         rp='Use interpreter-based ithreads?'
2671         . ./myread
2672         case "$ans" in
2673         y|Y)    val="$define" ;;
2674         *)      val="$undef" ;;
2675         esac
2676         set useithreads
2677         eval $setvar
2678         : Now set use5005threads to the opposite value.
2679         case "$useithreads" in
2680         $define) val="$undef" ;;
2681         *) val="$define" ;;
2682         esac
2683         set use5005threads
2684         eval $setvar
2685         ;;
2686 *)
2687         useithreads="$undef"
2688         use5005threads="$undef"
2689         ;;
2690 esac
2691
2692 case "$d_oldpthreads" in
2693 '')     : Configure tests would be welcome here.  For now, assume undef.
2694         val="$undef" ;;
2695 *)      val="$d_oldpthreads" ;;
2696 esac
2697 set d_oldpthreads
2698 eval $setvar
2699
2700
2701 case "$usethreads" in
2702 "$define"|true|[yY]*)
2703 : Look for a hint-file generated 'call-back-unit'.  If the
2704 : user has specified that a threading perl is to be built,
2705 : we may need to set or change some other defaults.
2706         if $test -f usethreads.cbu; then
2707                 echo "Your platform has some specific hints for threaded builds, using them..."
2708                 . ./usethreads.cbu
2709         else
2710                 $cat <<EOM
2711 (Your platform doesn't have any specific hints for threaded builds.
2712  Assuming POSIX threads, then.)
2713 EOM
2714         fi
2715         ;;
2716 esac
2717
2718 cat <<EOM
2719
2720 Perl can be built so that multiple Perl interpreters can coexist
2721 within the same Perl executable.
2722 EOM
2723
2724 case "$useithreads" in
2725 $define)
2726         cat <<EOM
2727 This multiple interpreter support is required for interpreter-based threads.
2728 EOM
2729         val="$define"
2730         ;;
2731 *)      case "$usemultiplicity" in
2732         $define|true|[yY]*)     dflt='y';;
2733         *) dflt='n';;
2734         esac
2735         echo " "
2736         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2737         rp='Build Perl for multiplicity?'
2738         . ./myread
2739         case "$ans" in
2740         y|Y)    val="$define" ;;
2741         *)      val="$undef" ;;
2742         esac
2743         ;;
2744 esac
2745 set usemultiplicity
2746 eval $setvar
2747
2748 : determine where manual pages are on this system
2749 echo " "
2750 case "$sysman" in
2751 '') 
2752         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2753         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2754         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2755         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2756         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2757         sysman=`./loc . /usr/man/man1 $syspath`
2758         ;;
2759 esac
2760 if $test -d "$sysman"; then
2761         echo "System manual is in $sysman." >&4
2762 else
2763         echo "Could not find manual pages in source form." >&4
2764 fi
2765
2766 : see what memory models we can support
2767 case "$models" in
2768 '')
2769         $cat >pdp11.c <<'EOP'
2770 int main() {
2771 #ifdef pdp11
2772         exit(0);
2773 #else
2774         exit(1);
2775 #endif
2776 }
2777 EOP
2778         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2779         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2780                 dflt='unsplit split'
2781         else
2782                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2783                 case "$tans" in
2784                 X) dflt='none';;
2785                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2786                                 dflt='small'
2787                         else
2788                                 dflt=''
2789                         fi
2790                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2791                                 dflt="$dflt medium"
2792                         fi
2793                         if $test -d /lib/large || $test -d /usr/lib/large; then
2794                                 dflt="$dflt large"
2795                         fi
2796                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2797                                 dflt="$dflt huge"
2798                         fi
2799                 esac
2800         fi;;
2801 *) dflt="$models";;
2802 esac
2803 $cat <<EOM
2804  
2805 Some systems have different model sizes.  On most systems they are called
2806 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2807 split.  If your system doesn't support different memory models, say "none".
2808 If you wish to force everything to one memory model, say "none" here and
2809 put the appropriate flags later when it asks you for other cc and ld flags.
2810 Venix systems may wish to put "none" and let the compiler figure things out.
2811 (In the following question multiple model names should be space separated.)
2812
2813 The default for most systems is "none".
2814
2815 EOM
2816 rp="Which memory models are supported?"
2817 . ./myread
2818 models="$ans"
2819
2820 case "$models" in
2821 none)
2822         small=''
2823         medium=''
2824         large=''
2825         huge=''
2826         unsplit=''
2827         split=''
2828         ;;
2829 *split)
2830         case "$split" in
2831         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2832                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2833                         dflt='-i'
2834                 else
2835                         dflt='none'
2836                 fi;;
2837         *) dflt="$split";;
2838         esac
2839         rp="What flag indicates separate I and D space?"
2840         . ./myread
2841         tans="$ans"
2842         case "$tans" in
2843         none) tans='';;
2844         esac
2845         split="$tans"
2846         unsplit='';;
2847 *large*|*small*|*medium*|*huge*)
2848         case "$models" in
2849         *large*)
2850                 case "$large" in
2851                 '') dflt='-Ml';;
2852                 *) dflt="$large";;
2853                 esac
2854         rp="What flag indicates large model?"
2855         . ./myread
2856         tans="$ans"
2857         case "$tans" in
2858         none) tans='';
2859         esac
2860         large="$tans";;
2861         *) large='';;
2862         esac
2863         case "$models" in
2864         *huge*) case "$huge" in
2865                 '') dflt='-Mh';;
2866                 *) dflt="$huge";;
2867                 esac
2868                 rp="What flag indicates huge model?"
2869                 . ./myread
2870                 tans="$ans"
2871                 case "$tans" in
2872                 none) tans='';
2873                 esac
2874                 huge="$tans";;
2875         *) huge="$large";;
2876         esac
2877         case "$models" in
2878         *medium*) case "$medium" in
2879                 '') dflt='-Mm';;
2880                 *) dflt="$medium";;
2881                 esac
2882                 rp="What flag indicates medium model?"
2883                 . ./myread
2884                 tans="$ans"
2885                 case "$tans" in
2886                 none) tans='';
2887                 esac
2888                 medium="$tans";;
2889         *) medium="$large";;
2890         esac
2891         case "$models" in
2892         *small*) case "$small" in
2893                 '') dflt='none';;
2894                 *) dflt="$small";;
2895                 esac
2896                 rp="What flag indicates small model?"
2897                 . ./myread
2898                 tans="$ans"
2899                 case "$tans" in
2900                 none) tans='';
2901                 esac
2902                 small="$tans";;
2903         *) small='';;
2904         esac
2905         ;;
2906 *)
2907         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2908         ;;
2909 esac
2910 $rm -f pdp11.* pdp11
2911
2912 : make some quick guesses about what we are up against
2913 echo " "
2914 $echo $n "Hmm...  $c"
2915 echo exit 1 >bsd
2916 echo exit 1 >usg
2917 echo exit 1 >v7
2918 echo exit 1 >osf1
2919 echo exit 1 >eunice
2920 echo exit 1 >xenix
2921 echo exit 1 >venix
2922 echo exit 1 >os2
2923 d_bsd="$undef"
2924 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2925 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2926 then
2927         echo "Looks kind of like an OSF/1 system, but we'll see..."
2928         echo exit 0 >osf1
2929 elif test `echo abc | tr a-z A-Z` = Abc ; then
2930         xxx=`./loc addbib blurfl $pth`
2931         if $test -f $xxx; then
2932         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2933                 echo exit 0 >bsd
2934                 echo exit 0 >usg
2935         else
2936                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2937                         echo "Looks kind of like an extended USG system, but we'll see..."
2938                 else
2939                         echo "Looks kind of like a USG system, but we'll see..."
2940                 fi
2941                 echo exit 0 >usg
2942         fi
2943 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2944         echo "Looks kind of like a BSD system, but we'll see..."
2945         d_bsd="$define"
2946         echo exit 0 >bsd
2947 else
2948         echo "Looks kind of like a Version 7 system, but we'll see..."
2949         echo exit 0 >v7
2950 fi
2951 case "$eunicefix" in
2952 *unixtovms*)
2953         $cat <<'EOI'
2954 There is, however, a strange, musty smell in the air that reminds me of
2955 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2956 EOI
2957         echo exit 0 >eunice
2958         d_eunice="$define"
2959 : it so happens the Eunice I know will not run shell scripts in Unix format
2960         ;;
2961 *)
2962         echo " "
2963         echo "Congratulations.  You aren't running Eunice."
2964         d_eunice="$undef"
2965         ;;
2966 esac
2967 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2968 case "$p_" in
2969 :) ;;
2970 *)
2971         $cat <<'EOI'
2972 I have the feeling something is not exactly right, however...don't tell me...
2973 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2974 EOI
2975         echo exit 0 >os2
2976         ;;
2977 esac
2978 if test -f /xenix; then
2979         echo "Actually, this looks more like a XENIX system..."
2980         echo exit 0 >xenix
2981         d_xenix="$define"
2982 else
2983         echo " "
2984         echo "It's not Xenix..."
2985         d_xenix="$undef"
2986 fi
2987 chmod +x xenix
2988 $eunicefix xenix
2989 if test -f /venix; then
2990         echo "Actually, this looks more like a VENIX system..."
2991         echo exit 0 >venix
2992 else
2993         echo " "
2994         if ./xenix; then
2995                 : null
2996         else
2997                 echo "Nor is it Venix..."
2998         fi
2999 fi
3000 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3001 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3002 $rm -f foo
3003
3004 : see if we need a special compiler
3005 echo " "
3006 if ./usg; then
3007         case "$cc" in
3008         '') case "$Mcc" in
3009                 /*) dflt='Mcc';;
3010                 *) case "$large" in
3011                         -M*) dflt='cc';;
3012                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3013                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3014                                                 dflt='cc'
3015                                         else
3016                                                 dflt='cc -M'
3017                                         fi
3018                                 else
3019                                         dflt='cc'
3020                                 fi;;
3021                         esac;;
3022                 esac;;
3023         *)  dflt="$cc";;
3024         esac
3025         case "$dflt" in
3026         *M*)    $cat <<'EOM'
3027 On some older systems the default C compiler will not resolve multiple global
3028 references that happen to have the same name.  On some such systems the "Mcc"
3029 command may be used to force these to be resolved.  On other systems a "cc -M"
3030 command is required.  (Note that the -M flag on other systems indicates a
3031 memory model to use!) If you have the Gnu C compiler, you might wish to use
3032 that instead.
3033
3034 EOM
3035         ;;
3036         esac
3037         rp="Use which C compiler?"
3038         . ./myread
3039         cc="$ans"
3040 else
3041         case "$cc" in
3042         '') dflt=cc;;
3043         *) dflt="$cc";;
3044         esac
3045         rp="Use which C compiler?"
3046         . ./myread
3047         cc="$ans"
3048 fi
3049 : Look for a hint-file generated 'call-back-unit'.  Now that the
3050 : user has specified the compiler, we may need to set or change some
3051 : other defaults.
3052 if $test -f cc.cbu; then
3053     . ./cc.cbu
3054 fi
3055 echo " "
3056 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3057 $cat >gccvers.c <<EOM
3058 #include <stdio.h>
3059 int main() {
3060 #ifdef __GNUC__
3061 #ifdef __VERSION__
3062         printf("%s\n", __VERSION__);
3063 #else
3064         printf("%s\n", "1");
3065 #endif
3066 #endif
3067         exit(0);
3068 }
3069 EOM
3070 if $cc $ldflags -o gccvers gccvers.c; then
3071         gccversion=`./gccvers`
3072         case "$gccversion" in
3073         '') echo "You are not using GNU cc." ;;
3074         *)  echo "You are using GNU cc $gccversion."
3075             ;;
3076         esac
3077 else
3078         echo " "
3079         echo "*** WHOA THERE!!! ***" >&4
3080         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3081         case "$knowitall" in
3082         '')
3083         echo "    You'd better start hunting for one and let me know about it." >&4
3084                 exit 1
3085                 ;;
3086         esac
3087 fi
3088 $rm -f gccvers*
3089 case "$gccversion" in
3090 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3091 esac
3092
3093 : decide how portable to be.  Allow command line overrides.
3094 case "$d_portable" in
3095 "$undef") ;;
3096 *)      d_portable="$define" ;;
3097 esac
3098
3099 : set up shell script to do ~ expansion
3100 cat >filexp <<EOSS
3101 $startsh
3102 : expand filename
3103 case "\$1" in
3104  ~/*|~)
3105         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3106         ;;
3107  ~*)
3108         if $test -f /bin/csh; then
3109                 /bin/csh -f -c "glob \$1"
3110                 failed=\$?
3111                 echo ""
3112                 exit \$failed
3113         else
3114                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3115                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3116                 if $test ! -d "\$dir"; then
3117                         me=\`basename \$0\`
3118                         echo "\$me: can't locate home directory for: \$name" >&2
3119                         exit 1
3120                 fi
3121                 case "\$1" in
3122                 */*)
3123                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3124                         ;;
3125                 *)
3126                         echo \$dir
3127                         ;;
3128                 esac
3129         fi
3130         ;;
3131 *)
3132         echo \$1
3133         ;;
3134 esac
3135 EOSS
3136 chmod +x filexp
3137 $eunicefix filexp
3138
3139 : now set up to get a file name
3140 cat <<EOS >getfile
3141 $startsh
3142 EOS
3143 cat <<'EOSC' >>getfile
3144 tilde=''
3145 fullpath=''
3146 already=''
3147 skip=''
3148 none_ok=''
3149 exp_file=''
3150 nopath_ok=''
3151 orig_rp="$rp"
3152 orig_dflt="$dflt"
3153 case "$gfpth" in
3154 '') gfpth='.' ;;
3155 esac
3156
3157 case "$fn" in
3158 *\(*)
3159         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3160         fn=`echo $fn | sed 's/(.*)//'`
3161         ;;
3162 esac
3163
3164 case "$fn" in
3165 *:*)
3166         loc_file=`expr $fn : '.*:\(.*\)'`
3167         fn=`expr $fn : '\(.*\):.*'`
3168         ;;
3169 esac
3170
3171 case "$fn" in
3172 *~*) tilde=true;;
3173 esac
3174 case "$fn" in
3175 */*) fullpath=true;;
3176 esac
3177 case "$fn" in
3178 *+*) skip=true;;
3179 esac
3180 case "$fn" in
3181 *n*) none_ok=true;;
3182 esac
3183 case "$fn" in
3184 *e*) exp_file=true;;
3185 esac
3186 case "$fn" in
3187 *p*) nopath_ok=true;;
3188 esac
3189
3190 case "$fn" in
3191 *f*) type='File';;
3192 *d*) type='Directory';;
3193 *l*) type='Locate';;
3194 esac
3195
3196 what="$type"
3197 case "$what" in
3198 Locate) what='File';;
3199 esac
3200
3201 case "$exp_file" in
3202 '')
3203         case "$d_portable" in
3204         "$define") ;;
3205         *) exp_file=true;;
3206         esac
3207         ;;
3208 esac
3209
3210 cd ..
3211 while test "$type"; do
3212         redo=''
3213         rp="$orig_rp"
3214         dflt="$orig_dflt"
3215         case "$tilde" in
3216         true) rp="$rp (~name ok)";;
3217         esac
3218         . UU/myread
3219         if test -f UU/getfile.ok && \
3220                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3221         then
3222                 value="$ans"
3223                 ansexp="$ans"
3224                 break
3225         fi
3226         case "$ans" in
3227         none)
3228                 value=''
3229                 ansexp=''
3230                 case "$none_ok" in
3231                 true) type='';;
3232                 esac
3233                 ;;
3234         *)
3235                 case "$tilde" in
3236                 '') value="$ans"
3237                         ansexp="$ans";;
3238                 *)
3239                         value=`UU/filexp $ans`
3240                         case $? in
3241                         0)
3242                                 if test "$ans" != "$value"; then
3243                                         echo "(That expands to $value on this system.)"
3244                                 fi
3245                                 ;;
3246                         *) value="$ans";;
3247                         esac
3248                         ansexp="$value"
3249                         case "$exp_file" in
3250                         '') value="$ans";;
3251                         esac
3252                         ;;
3253                 esac
3254                 case "$fullpath" in
3255                 true)
3256                         case "$ansexp" in
3257                         /*) value="$ansexp" ;;
3258                         *)
3259                                 redo=true
3260                                 case "$already" in
3261                                 true)
3262                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3263                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3264                                         ;;
3265                                 *)
3266                                 echo "Please give a full path name, starting with slash." >&4
3267                                         case "$tilde" in
3268                                         true)
3269                                 echo "Note that using ~name is ok provided it expands well." >&4
3270                                                 already=true
3271                                                 ;;
3272                                         esac
3273                                 esac
3274                                 ;;
3275                         esac
3276                         ;;
3277                 esac
3278                 case "$redo" in
3279                 '')
3280                         case "$type" in
3281                         File)
3282                                 for fp in $gfpth; do
3283                                         if test "X$fp" = X.; then
3284                                             pf="$ansexp"
3285                                         else    
3286                                             pf="$fp/$ansexp"
3287                                         fi
3288                                         if test -f "$pf"; then
3289                                                 type=''
3290                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3291                                         then
3292                                                 echo "($value is not a plain file, but that's ok.)"
3293                                                 type=''
3294                                         fi
3295                                         if test X"$type" = X; then
3296                                             value="$pf"
3297                                             break
3298                                         fi
3299                                 done
3300                                 ;;
3301                         Directory)
3302                                 for fp in $gfpth; do
3303                                         if test "X$fp" = X.; then
3304                                             pf="$ansexp"
3305                                         else    
3306                                             pf="$fp/$ansexp"
3307                                         fi
3308                                         if test -d "$pf"; then
3309                                                 type=''
3310                                                 value="$pf"
3311                                                 break
3312                                         fi
3313                                 done
3314                                 ;;
3315                         Locate)
3316                                 if test -d "$ansexp"; then
3317                                         echo "(Looking for $loc_file in directory $value.)"
3318                                         value="$value/$loc_file"
3319                                         ansexp="$ansexp/$loc_file"
3320                                 fi
3321                                 if test -f "$ansexp"; then
3322                                         type=''
3323                                 fi
3324                                 case "$nopath_ok" in
3325                                 true)   case "$value" in
3326                                         */*) ;;
3327                                         *)      echo "Assuming $value will be in people's path."
3328                                                 type=''
3329                                                 ;;
3330                                         esac
3331                                         ;;
3332                                 esac
3333                                 ;;
3334                         esac
3335
3336                         case "$skip" in
3337                         true) type='';
3338                         esac
3339
3340                         case "$type" in
3341                         '') ;;
3342                         *)
3343                                 if test "$fastread" = yes; then
3344                                         dflt=y
3345                                 else
3346                                         dflt=n
3347                                 fi
3348                                 rp="$what $value doesn't exist.  Use that name anyway?"
3349                                 . UU/myread
3350                                 dflt=''
3351                                 case "$ans" in
3352                                 y*) type='';;
3353                                 *) echo " ";;
3354                                 esac
3355                                 ;;
3356                         esac
3357                         ;;
3358                 esac
3359                 ;;
3360         esac
3361 done
3362 cd UU
3363 ans="$value"
3364 rp="$orig_rp"
3365 dflt="$orig_dflt"
3366 rm -f getfile.ok
3367 test "X$gfpthkeep" != Xy && gfpth=""
3368 EOSC
3369
3370 : What should the include directory be ?
3371 echo " "
3372 $echo $n "Hmm...  $c"
3373 dflt='/usr/include'
3374 incpath=''
3375 mips_type=''
3376 if $test -f /bin/mips && /bin/mips; then
3377         echo "Looks like a MIPS system..."
3378         $cat >usr.c <<'EOCP'
3379 #ifdef SYSTYPE_BSD43
3380 /bsd43
3381 #endif
3382 EOCP
3383         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3384                 dflt='/bsd43/usr/include'
3385                 incpath='/bsd43'
3386                 mips_type='BSD 4.3'
3387         else
3388                 mips_type='System V'
3389         fi
3390         $rm -f usr.c usr.out
3391         echo "and you're compiling with the $mips_type compiler and libraries."
3392         xxx_prompt=y
3393         echo "exit 0" >mips
3394 else
3395         echo "Doesn't look like a MIPS system."
3396         xxx_prompt=n
3397         echo "exit 1" >mips
3398 fi
3399 chmod +x mips
3400 $eunicefix mips
3401 case "$usrinc" in
3402 '') ;;
3403 *) dflt="$usrinc";;
3404 esac
3405 case "$xxx_prompt" in
3406 y)      fn=d/
3407         echo " "
3408         rp='Where are the include files you want to use?'
3409         . ./getfile
3410         usrinc="$ans"
3411         ;;
3412 *)      usrinc="$dflt"
3413         ;;
3414 esac
3415
3416 : see how we invoke the C preprocessor
3417 echo " "
3418 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3419 cat <<'EOT' >testcpp.c
3420 #define ABC abc
3421 #define XYZ xyz
3422 ABC.XYZ
3423 EOT
3424 cd ..
3425 if test ! -f cppstdin; then
3426         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3427                 # AIX cc -E doesn't show the absolute headerfile
3428                 # locations but we'll cheat by using the -M flag.
3429                 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
3430         else
3431                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3432         fi
3433 else
3434         echo "Keeping your $hint cppstdin wrapper."
3435 fi
3436 chmod 755 cppstdin
3437 wrapper=`pwd`/cppstdin
3438 ok='false'
3439 cd UU
3440
3441 if $test "X$cppstdin" != "X" && \
3442         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3443         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3444 then
3445         echo "You used to use $cppstdin $cppminus so we'll use that again."
3446         case "$cpprun" in
3447         '') echo "But let's see if we can live without a wrapper..." ;;
3448         *)
3449                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3450                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3451                 then
3452                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3453                         ok='true'
3454                 else
3455                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3456                 fi
3457                 ;;
3458         esac
3459 else
3460         case "$cppstdin" in
3461         '') ;;
3462         *)
3463                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3464                 ;;
3465         esac
3466 fi
3467
3468 if $ok; then
3469         : nothing
3470 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3471         $cc -E <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "Yup, it does."
3474         x_cpp="$cc -E"
3475         x_minus='';
3476 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3477         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Yup, it does."
3480         x_cpp="$cc -E"
3481         x_minus='-';
3482 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3483         $cc -P <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         echo "Yipee, that works!"
3486         x_cpp="$cc -P"
3487         x_minus='';
3488 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3489         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "At long last!"
3492         x_cpp="$cc -P"
3493         x_minus='-';
3494 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3495         $cpp <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         echo "It works!"
3498         x_cpp="$cpp"
3499         x_minus='';
3500 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3501         $cpp - <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Hooray, it works!  I was beginning to wonder."
3504         x_cpp="$cpp"
3505         x_minus='-';
3506 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3507         $wrapper <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         x_cpp="$wrapper"
3510         x_minus=''
3511         echo "Eureka!"
3512 else
3513         dflt=''
3514         rp="No dice.  I can't find a C preprocessor.  Name one:"
3515         . ./myread
3516         x_cpp="$ans"
3517         x_minus=''
3518         $x_cpp <testcpp.c >testcpp.out 2>&1
3519         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3520                 echo "OK, that will do." >&4
3521         else
3522 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3523                 exit 1
3524         fi
3525 fi
3526
3527 case "$ok" in
3528 false)
3529         cppstdin="$x_cpp"
3530         cppminus="$x_minus"
3531         cpprun="$x_cpp"
3532         cpplast="$x_minus"
3533         set X $x_cpp
3534         shift
3535         case "$1" in
3536         "$cpp")
3537                 echo "Perhaps can we force $cc -E using a wrapper..."
3538                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3539                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3540                 then
3541                         echo "Yup, we can."
3542                         cppstdin="$wrapper"
3543                         cppminus='';
3544                 else
3545                         echo "Nope, we'll have to live without it..."
3546                 fi
3547                 ;;
3548         esac
3549         case "$cpprun" in
3550         "$wrapper")
3551                 cpprun=''
3552                 cpplast=''
3553                 ;;
3554         esac
3555         ;;
3556 esac
3557
3558 case "$cppstdin" in
3559 "$wrapper"|'cppstdin') ;;
3560 *) $rm -f $wrapper;;
3561 esac
3562 $rm -f testcpp.c testcpp.out
3563
3564 : Set private lib path
3565 case "$plibpth" in
3566 '') if ./mips; then
3567                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3568         fi;;
3569 esac
3570 case "$libpth" in
3571 ' ') dlist='';;
3572 '') dlist="$loclibpth $plibpth $glibpth";;
3573 *) dlist="$libpth";;
3574 esac
3575
3576 : Now check and see which directories actually exist, avoiding duplicates
3577 libpth=''
3578 for xxx in $dlist
3579 do
3580     if $test -d $xxx; then
3581                 case " $libpth " in
3582                 *" $xxx "*) ;;
3583                 *) libpth="$libpth $xxx";;
3584                 esac
3585     fi
3586 done
3587 $cat <<'EOM'
3588
3589 Some systems have incompatible or broken versions of libraries.  Among
3590 the directories listed in the question below, please remove any you
3591 know not to be holding relevant libraries, and add any that are needed.
3592 Say "none" for none.
3593
3594 EOM
3595 case "$libpth" in
3596 '') dflt='none';;
3597 *)
3598         set X $libpth
3599         shift
3600         dflt=${1+"$@"}
3601         ;;
3602 esac
3603 rp="Directories to use for library searches?"
3604 . ./myread
3605 case "$ans" in
3606 none) libpth=' ';;
3607 *) libpth="$ans";;
3608 esac
3609
3610 : compute shared library extension
3611 case "$so" in
3612 '')
3613         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3614                 dflt='sl'
3615         else
3616                 dflt='so'
3617         fi
3618         ;;
3619 *) dflt="$so";;
3620 esac
3621 $cat <<EOM
3622
3623 On some systems, shared libraries may be available.  Answer 'none' if
3624 you want to suppress searching of shared libraries for the remainder
3625 of this configuration.
3626
3627 EOM
3628 rp='What is the file extension used for shared libraries?'
3629 . ./myread
3630 so="$ans"
3631
3632 : Define several unixisms.
3633 : Hints files or command line option can be used to override them.
3634 : The convoluted testing is in case hints files set either the old
3635 : or the new name.
3636 case "$_exe" in
3637 '')     case "$exe_ext" in
3638     '') ;;
3639         *)      _exe="$exe_ext" ;;
3640         esac
3641         ;;
3642 esac
3643 case "$_a" in
3644 '')     case "$lib_ext" in
3645     '') _a='.a';;
3646         *)      _a="$lib_ext" ;;
3647         esac
3648         ;;
3649 esac
3650 case "$_o" in
3651 '') case "$obj_ext" in
3652         '')     _o='.o';;
3653         *)      _o="$obj_ext";;
3654         esac
3655         ;;
3656 esac
3657 case "$p_" in
3658 '') case "$path_sep" in
3659         '')     p_=':';;
3660         *)      p_="$path_sep";;
3661         esac
3662         ;;
3663 esac
3664 exe_ext=$_exe
3665 lib_ext=$_a
3666 obj_ext=$_o
3667 path_sep=$p_
3668
3669 : Which makefile gets called first.  This is used by make depend.
3670 case "$firstmakefile" in
3671 '') firstmakefile='makefile';;
3672 esac
3673
3674 case "$usesocks" in
3675 $define|true|[yY]*)     dflt='y';;
3676 *) dflt='n';;
3677 esac
3678 cat <<EOM
3679
3680 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3681 Configure must be run with -Dusesocks.
3682
3683 If this doesn't make any sense to you, just accept the default '$dflt'.
3684 EOM
3685 rp='Build Perl for SOCKS?'
3686 . ./myread
3687 case "$ans" in
3688 y|Y)    val="$define" ;;     
3689 *)      val="$undef" ;;
3690 esac
3691 set usesocks
3692 eval $setvar
3693
3694 : Looking for optional libraries
3695 echo " "
3696 echo "Checking for optional libraries..." >&4
3697 case "$libs" in
3698 ' '|'') dflt='';;
3699 *) dflt="$libs";;
3700 esac
3701 case "$libswanted" in
3702 '') libswanted='c_s';;
3703 esac
3704 case "$usesocks" in
3705 $define)
3706         libswanted="$libswanted socks5 socks5_sh"
3707         ;;
3708 esac
3709 libsfound=''
3710 libsfiles=''
3711 libsdirs=''
3712 libspath=''
3713 for thisdir in $libpth $xlibpth; do
3714   test -d $thisdir && libspath="$libspath $thisdir"
3715 done
3716 for thislib in $libswanted; do
3717         for thisdir in $libspath; do
3718             xxx=''
3719             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3720                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3721                 $test -f "$xxx" && eval $libscheck
3722                 $test -f "$xxx" && libstyle=shared
3723             fi
3724             if test ! -f "$xxx"; then
3725                 xxx=$thisdir/lib$thislib.$so
3726                 $test -f "$xxx" && eval $libscheck
3727                 $test -f "$xxx" && libstyle=shared
3728             fi  
3729             if test ! -f "$xxx"; then
3730                 xxx=$thisdir/lib$thislib$_a
3731                 $test -f "$xxx" && eval $libscheck
3732                 $test -f "$xxx" && libstyle=static
3733             fi
3734             if test ! -f "$xxx"; then
3735                 xxx=$thisdir/$thislib$_a
3736                 $test -f "$xxx" && eval $libscheck
3737                 $test -f "$xxx" && libstyle=static
3738             fi
3739             if test ! -f "$xxx"; then
3740                 xxx=$thisdir/lib${thislib}_s$_a
3741                 $test -f "$xxx" && eval $libscheck
3742                 $test -f "$xxx" && libstyle=static
3743                 $test -f "$xxx" && thislib=${thislib}_s
3744             fi
3745             if test ! -f "$xxx"; then
3746                 xxx=$thisdir/Slib$thislib$_a
3747                 $test -f "$xxx" && eval $libscheck
3748                 $test -f "$xxx" && libstyle=static
3749             fi
3750             if $test -f "$xxx"; then
3751                 case "$libstyle" in
3752                 shared) echo "Found -l$thislib (shared)." ;;
3753                 static) echo "Found -l$thislib." ;;
3754                 *)      echo "Found -l$thislib ($libstyle)." ;;
3755                 esac
3756                 case " $dflt " in
3757                 *"-l$thislib "*);;
3758                 *) dflt="$dflt -l$thislib"
3759                    libsfound="$libsfound $xxx"
3760                    yyy=`basename $xxx`
3761                    libsfiles="$libsfiles $yyy"
3762                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3763                    case " $libsdirs " in
3764                    *" $yyy "*) ;;
3765                    *) libsdirs="$libsdirs $yyy" ;;
3766                    esac
3767                    ;;
3768                 esac
3769                 break
3770             fi  
3771         done
3772         if $test ! -f "$xxx"; then
3773             echo "No -l$thislib."
3774         fi
3775 done
3776 set X $dflt
3777 shift
3778 dflt="$*"
3779 case "$libs" in
3780 '') dflt="$dflt";;
3781 *) dflt="$libs";;
3782 esac
3783 case "$dflt" in
3784 ' '|'') dflt='none';;
3785 esac
3786
3787 $cat <<EOM
3788
3789 In order to compile $package on your machine, a number of libraries
3790 are usually needed.  Include any other special libraries here as well.
3791 Say "none" for none.  The default list is almost always right.
3792 EOM
3793
3794 echo " "
3795 rp="What libraries to use?"
3796 . ./myread
3797 case "$ans" in
3798 none) libs=' ';;
3799 *) libs="$ans";;
3800 esac
3801
3802 : determine optimization, if desired, or use for debug flag also
3803 case "$optimize" in
3804 ' '|$undef) dflt='none';;
3805 '') dflt='-O';;
3806 *) dflt="$optimize";;
3807 esac
3808 $cat <<EOH
3809
3810 By default, $package compiles with the -O flag to use the optimizer.
3811 Alternately, you might want to use the symbolic debugger, which uses
3812 the -g flag (on traditional Unix systems).  Either flag can be
3813 specified here.  To use neither flag, specify the word "none".
3814
3815 EOH
3816 rp="What optimizer/debugger flag should be used?"
3817 . ./myread
3818 optimize="$ans"
3819 case "$optimize" in
3820 'none') optimize=" ";;
3821 esac
3822
3823 dflt=''
3824 : We will not override a previous value, but we might want to
3825 : augment a hint file
3826 case "$hint" in
3827 default|recommended)
3828         case "$gccversion" in
3829         1*) dflt='-fpcc-struct-return' ;;
3830         esac
3831         case "$optimize" in
3832         *-g*) dflt="$dflt -DDEBUGGING";;
3833         esac
3834         case "$gccversion" in
3835         2*) if test -d /etc/conf/kconfig.d &&
3836                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3837                 then
3838                         dflt="$dflt -posix"
3839                 fi
3840                 ;;
3841         esac
3842         case "$gccversion" in
3843         1*) ;;
3844         2.[0-8]*) ;;
3845         ?*)     echo " "
3846                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3847                 echo 'int main(void) { return 0; }' > gcctest.c
3848                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3849                         echo "Yes, it does." 2>&1
3850                         case "$ccflags" in
3851                         *strict-aliasing*) 
3852                                 echo "Leaving current flags $ccflags alone." 2>&1
3853                                 ;;
3854                         *) dflt="$dflt -fno-strict-aliasing" ;;
3855                         esac
3856                 else
3857                         echo "Nope, it doesn't, but that's ok." 2>&1
3858                 fi
3859                 ;;
3860         esac
3861         ;;
3862 esac
3863
3864 case "$mips_type" in
3865 *BSD*|'') inclwanted="$locincpth $usrinc";;
3866 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3867 esac
3868 for thisincl in $inclwanted; do
3869         if $test -d $thisincl; then
3870                 if $test x$thisincl != x$usrinc; then
3871                         case "$dflt" in
3872                         *$thisincl*);;
3873                         *) dflt="$dflt -I$thisincl";;
3874                         esac
3875                 fi
3876         fi
3877 done
3878
3879 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3880         xxx=true;
3881 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3882         xxx=true;
3883 else
3884         xxx=false;
3885 fi;
3886 if $xxx; then
3887         case "$dflt" in
3888         *$2*);;
3889         *) dflt="$dflt -D$2";;
3890         esac;
3891 fi'
3892
3893 set signal.h LANGUAGE_C; eval $inctest
3894
3895 case "$usesocks" in
3896 $define)
3897         ccflags="$ccflags -DSOCKS"
3898         ;;
3899 esac
3900
3901 case "$hint" in
3902 default|recommended) dflt="$ccflags $dflt" ;;
3903 *) dflt="$ccflags";;
3904 esac
3905
3906 case "$dflt" in
3907 ''|' ') dflt=none;;
3908 esac
3909 $cat <<EOH
3910
3911 Your C compiler may want other flags.  For this question you should include
3912 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3913 but you should NOT include libraries or ld flags like -lwhatever.  If you
3914 want $package to honor its debug switch, you should include -DDEBUGGING here.
3915 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3916
3917 To use no flags, specify the word "none".
3918
3919 EOH
3920 set X $dflt
3921 shift
3922 dflt=${1+"$@"}
3923 rp="Any additional cc flags?"
3924 . ./myread
3925 case "$ans" in
3926 none) ccflags='';;
3927 *) ccflags="$ans";;
3928 esac
3929
3930 : the following weeds options from ccflags that are of no interest to cpp
3931 cppflags="$ccflags"
3932 case "$gccversion" in
3933 1*) cppflags="$cppflags -D__GNUC__"
3934 esac
3935 case "$mips_type" in
3936 '');;
3937 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3938 esac
3939 case "$cppflags" in
3940 '');;
3941 *)
3942         echo " "
3943         echo "Let me guess what the preprocessor flags are..." >&4
3944         set X $cppflags
3945         shift
3946         cppflags=''
3947         $cat >cpp.c <<'EOM'
3948 #define BLURFL foo
3949
3950 BLURFL xx LFRULB
3951 EOM
3952         previous=''
3953         for flag in $*
3954         do
3955                 case "$flag" in
3956                 -*) ftry="$flag";;
3957                 *) ftry="$previous $flag";;
3958                 esac
3959                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3960                         >cpp1.out 2>/dev/null && \
3961                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3962                         >cpp2.out 2>/dev/null && \
3963                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3964                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3965                 then
3966                         cppflags="$cppflags $ftry"
3967                         previous=''
3968                 else
3969                         previous="$flag"
3970                 fi
3971         done
3972         set X $cppflags
3973         shift
3974         cppflags=${1+"$@"}
3975         case "$cppflags" in
3976         *-*)  echo "They appear to be: $cppflags";;
3977         esac
3978         $rm -f cpp.c cpp?.out
3979         ;;
3980 esac
3981
3982 : flags used in final linking phase
3983 case "$ldflags" in
3984 '') if ./venix; then
3985                 dflt='-i -z'
3986         else
3987                 dflt=''
3988         fi
3989         case "$ccflags" in
3990         *-posix*) dflt="$dflt -posix" ;;
3991         esac
3992         ;;
3993 *) dflt="$ldflags";;
3994 esac
3995
3996 : Try to guess additional flags to pick up local libraries.
3997 for thislibdir in $libpth; do
3998         case " $loclibpth " in
3999         *" $thislibdir "*)
4000                 case "$dflt " in 
4001                 *"-L$thislibdir "*) ;;
4002                 *)  dflt="$dflt -L$thislibdir" ;;
4003                 esac
4004                 ;;
4005         esac
4006 done
4007
4008 case "$dflt" in
4009 '') dflt='none' ;;
4010 esac
4011
4012 $cat <<EOH
4013
4014 Your C linker may need flags.  For this question you should
4015 include -L/whatever and any other flags used by the C linker, but you
4016 should NOT include libraries like -lwhatever.
4017
4018 Make sure you include the appropriate -L/path flags if your C linker
4019 does not normally search all of the directories you specified above,
4020 namely
4021         $libpth
4022 To use no flags, specify the word "none".
4023
4024 EOH
4025
4026 rp="Any additional ld flags (NOT including libraries)?"
4027 . ./myread
4028 case "$ans" in
4029 none) ldflags='';;
4030 *) ldflags="$ans";;
4031 esac
4032 rmlist="$rmlist pdp11"
4033
4034 : coherency check
4035 echo " "
4036 echo "Checking your choice of C compiler and flags for coherency..." >&4
4037 $cat > try.c <<'EOF'
4038 #include <stdio.h>
4039 int main() { printf("Ok\n"); exit(0); }
4040 EOF
4041 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4042 shift
4043 $cat >try.msg <<'EOM'
4044 I've tried to compile and run the following simple program:
4045
4046 EOM
4047 $cat try.c >> try.msg
4048
4049 $cat >> try.msg <<EOM
4050
4051 I used the command:
4052
4053         $*
4054         ./try
4055
4056 and I got the following output:
4057
4058 EOM
4059 dflt=y
4060 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4061         if sh -c './try' >>try.msg 2>&1; then
4062                 xxx=`./try`
4063                 case "$xxx" in
4064                 "Ok") dflt=n ;;
4065                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4066                         case " $libs " in
4067                         *" -lsfio "*)
4068                                 cat >> try.msg <<'EOQS'
4069 If $libs contains -lsfio, and sfio is mis-configured, then it
4070 sometimes (apparently) runs and exits with a 0 status, but with no
4071 output!  It may have to do with sfio's use of _exit vs. exit.
4072
4073 EOQS
4074                                 rp="You have a big problem.  Shall I abort Configure"
4075                                 dflt=y
4076                                 ;;
4077                         esac
4078                         ;;
4079                 esac
4080         else
4081                 echo "The program compiled OK, but exited with status $?." >>try.msg
4082                 rp="You have a problem.  Shall I abort Configure"
4083                 dflt=y
4084         fi
4085 else
4086         echo "I can't compile the test program." >>try.msg
4087         rp="You have a BIG problem.  Shall I abort Configure"
4088         dflt=y
4089 fi
4090 case "$dflt" in
4091 y)
4092         $cat try.msg >&4
4093         case "$knowitall" in
4094         '')
4095                 echo "(The supplied flags or libraries might be incorrect.)"
4096                 ;;
4097         *) dflt=n;;
4098         esac
4099         echo " "
4100         . ./myread
4101         case "$ans" in
4102         n*|N*) ;;
4103         *)      echo "Ok.  Stopping Configure." >&4
4104                 exit 1
4105                 ;;
4106         esac
4107         ;;
4108 n) echo "OK, that should do.";;
4109 esac
4110 $rm -f try try.* core
4111
4112 : define an is-a-typedef? function
4113 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4114 case "$inclist" in
4115 "") inclist="sys/types.h";;
4116 esac;
4117 eval "varval=\$$var";
4118 case "$varval" in
4119 "")
4120         $rm -f temp.c;
4121         for inc in $inclist; do
4122                 echo "#include <$inc>" >>temp.c;
4123         done;
4124         echo "#ifdef $type" >> temp.c;
4125         echo "printf(\"We have $type\");" >> temp.c;
4126         echo "#endif" >> temp.c;
4127         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4128         if $contains $type temp.E >/dev/null 2>&1; then
4129                 eval "$var=\$type";
4130         else
4131                 eval "$var=\$def";
4132         fi;
4133         $rm -f temp.?;;
4134 *) eval "$var=\$varval";;
4135 esac'
4136
4137 : define an is-a-typedef? function that prompts if the type is not available.
4138 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4139 case "$inclist" in
4140 "") inclist="sys/types.h";;
4141 esac;
4142 eval "varval=\$$var";
4143 case "$varval" in
4144 "")
4145         $rm -f temp.c;
4146         for inc in $inclist; do
4147                 echo "#include <$inc>" >>temp.c;
4148         done;
4149         echo "#ifdef $type" >> temp.c;
4150         echo "printf(\"We have $type\");" >> temp.c;
4151         echo "#endif" >> temp.c;
4152         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4153         echo " " ;
4154         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4155         if $contains $type temp.E >/dev/null 2>&1; then
4156                 echo "$type found." >&4;
4157                 eval "$var=\$type";
4158         else
4159                 echo "$type NOT found." >&4;
4160                 dflt="$def";
4161                 . ./myread ;
4162                 eval "$var=\$ans";
4163         fi;
4164         $rm -f temp.?;;
4165 *) eval "$var=\$varval";;
4166 esac'
4167
4168 : define a shorthand compile call
4169 compile='
4170 mc_file=$1;
4171 shift;
4172 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4173 : define a shorthand compile call for compilations that should be ok.
4174 compile_ok='
4175 mc_file=$1;
4176 shift;
4177 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4178
4179 : check for lengths of integral types
4180 echo " "
4181 case "$intsize" in
4182 '')
4183         echo "Checking to see how big your integers are..." >&4
4184         $cat >intsize.c <<'EOCP'
4185 #include <stdio.h>
4186 int main()
4187 {
4188         printf("intsize=%d;\n", (int)sizeof(int));
4189         printf("longsize=%d;\n", (int)sizeof(long));
4190         printf("shortsize=%d;\n", (int)sizeof(short));
4191         exit(0);
4192 }
4193 EOCP
4194         set intsize
4195         if eval $compile_ok && ./intsize > /dev/null; then
4196                 eval `./intsize`
4197                 echo "Your integers are $intsize bytes long."
4198                 echo "Your long integers are $longsize bytes long."
4199                 echo "Your short integers are $shortsize bytes long."
4200         else
4201                 $cat >&4 <<EOM
4202 !
4203 Help! I can't compile and run the intsize test program: please enlighten me!
4204 (This is probably a misconfiguration in your system or libraries, and
4205 you really ought to fix it.  Still, I'll try anyway.)
4206 !
4207 EOM
4208                 dflt=4
4209                 rp="What is the size of an integer (in bytes)?"
4210                 . ./myread
4211                 intsize="$ans"
4212                 dflt=$intsize
4213                 rp="What is the size of a long integer (in bytes)?"
4214                 . ./myread
4215                 longsize="$ans"
4216                 dflt=2
4217                 rp="What is the size of a short integer (in bytes)?"
4218                 . ./myread
4219                 shortsize="$ans"
4220         fi
4221         ;;
4222 esac
4223 $rm -f intsize intsize.*
4224
4225 : see what type lseek is declared as in the kernel
4226 rp="What is the type used for lseek's offset on this system?"
4227 set off_t lseektype long stdio.h sys/types.h
4228 eval $typedef_ask
4229
4230 echo " "
4231 echo "Checking to see how big your file offsets are..." >&4
4232 $cat >try.c <<EOCP
4233 #include <sys/types.h>
4234 #include <stdio.h>
4235 int main()
4236 {
4237     printf("%d\n", (int)sizeof($lseektype));
4238     return(0); 
4239 }
4240 EOCP
4241 set try
4242 if eval $compile_ok; then
4243         lseeksize=`./try`
4244         echo "Your file offsets are $lseeksize bytes long."
4245 else
4246         dflt=$longsize
4247         echo " "
4248         echo "(I can't seem to compile the test program.  Guessing...)"
4249         rp="What is the size of your file offsets (in bytes)?"
4250         . ./myread
4251         lseeksize="$ans"
4252 fi
4253 $rm -f try.c try
4254
4255 : see what type file positions are declared as in the library
4256 rp="What is the type for file position used by fsetpos()?"
4257 set fpos_t fpostype long stdio.h sys/types.h
4258 eval $typedef_ask
4259
4260 echo " "
4261 case "$fpostype" in
4262 *_t) zzz="$fpostype"    ;;
4263 *)   zzz="fpos_t"       ;;
4264 esac
4265 echo "Checking the size of $zzz..." >&4 
4266 cat > try.c <<EOCP
4267 #include <sys/types.h>
4268 #include <stdio.h>
4269 int main() {
4270     printf("%d\n", (int)sizeof($fpostype));
4271     exit(0);
4272 }
4273 EOCP
4274 set try
4275 if eval $compile_ok; then
4276         yyy=`./try`
4277         case "$yyy" in
4278         '')     fpossize=4
4279                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4280                 ;;
4281         *)      fpossize=$yyy
4282                 echo "Your $zzz is $fpossize bytes long."
4283                 ;;
4284         esac
4285 else
4286         dflt="$longsize"
4287         echo " " >&4
4288         echo "(I can't compile the test program.  Guessing...)" >&4
4289         rp="What is the size of your file positions (in bytes)?"
4290         . ./myread
4291         fpossize="$ans"
4292 fi
4293
4294
4295
4296 # Backward compatibility (uselfs is deprecated).
4297 case "$uselfs" in
4298 "$define"|true|[yY]*)
4299         cat <<EOM >&4
4300
4301 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4302 EOM
4303         uselargefiles="$define"
4304         ;;
4305 esac                          
4306
4307 case "$lseeksize:$fpossize" in
4308 8:8) cat <<EOM
4309
4310 You can have files larger than 2 gigabytes.
4311 EOM
4312    val="$define" ;;
4313 *)    case "$uselargefiles" in
4314    "$undef"|false|[nN]*) dflt='n' ;;
4315    *)   dflt='y' ;;
4316    esac
4317    cat <<EOM
4318
4319 Perl can be built to understand large files (files larger than 2 gigabytes)
4320 on some systems.  To do so, Configure can be run with -Duselargefiles.
4321
4322 If this doesn't make any sense to you, just accept the default '$dflt'.
4323 EOM
4324    rp='Try to understand large files, if available?'
4325    . ./myread
4326    case "$ans" in
4327    y|Y)         val="$define" ;;
4328    *)           val="$undef"  ;;
4329    esac
4330    ;;
4331 esac
4332 set uselargefiles
4333 eval $setvar
4334 case "$uselargefiles" in
4335 "$define")
4336 : Look for a hint-file generated 'call-back-unit'.  If the
4337 : user has specified that a large files perl is to be built,
4338 : we may need to set or change some other defaults.
4339         if $test -f uselfs.cbu; then
4340                 echo "Your platform has some specific hints for large file builds, using them..."
4341                 . ./uselfs.cbu
4342                 echo " "
4343                 echo "Rechecking to see how big your file offsets are..." >&4
4344                 $cat >try.c <<EOCP
4345 #include <sys/types.h>
4346 #include <stdio.h>
4347 int main()
4348 {
4349     printf("%d\n", (int)sizeof($lseektype));
4350     return(0); 
4351 }
4352 EOCP
4353                 set try
4354                 if eval $compile_ok; then
4355                         lseeksize=`./try`
4356                         $echo "Your file offsets are now $lseeksize bytes long."
4357                 else
4358                         dflt="$lseeksize"
4359                         echo " "
4360                         echo "(I can't seem to compile the test program.  Guessing...)"
4361                         rp="What is the size of your file offsets (in bytes)?"
4362                         . ./myread
4363                         lseeksize="$ans"
4364                 fi
4365                 case "$fpostype" in
4366                 *_t) zzz="$fpostype"    ;;
4367                 *)   zzz="fpos_t"       ;;
4368                 esac
4369                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4370                 $cat > try.c <<EOCP
4371 #include <sys/types.h>
4372 #include <stdio.h>
4373 int main() {
4374     printf("%d\n", (int)sizeof($fpostype));
4375     exit(0);
4376 }
4377 EOCP
4378                 set try
4379                 if eval $compile_ok; then
4380                         yyy=`./try`
4381                         dflt="$lseeksize"
4382                         case "$yyy" in
4383                         '')     echo " "
4384                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4385                                 ;;
4386                         *)      fpossize=$yyy
4387                                 echo " $fpossize bytes." >&4
4388                                 ;;
4389                         esac
4390                 else
4391                         dflt="$fpossize"
4392                         echo " "
4393                         echo "(I can't compile the test program.  Guessing...)" >&4
4394                         rp="What is the size of your file positions (in bytes)?"
4395                         . ./myread
4396                         fpossize="$ans"
4397                 fi
4398                 $rm -f try.c try
4399         fi
4400         ;;
4401 esac
4402
4403
4404 case "$usemorebits" in
4405 "$define"|true|[yY]*)
4406         use64bitint="$define"
4407         uselongdouble="$define"
4408         usemorebits="$define"
4409         ;;
4410 *)      usemorebits="$undef"
4411         ;;
4412 esac
4413
4414
4415 # Backward compatibility (uselonglong is deprecated).
4416 case "$uselonglong" in
4417 "$define"|true|[yY]*)
4418         cat <<EOM >&4
4419
4420 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4421 EOM
4422         use64bitint="$define"
4423         ;;
4424 esac                          
4425 # Backward compatibility (use64bits is deprecated).
4426 case "$use64bits" in
4427 "$define"|true|[yY]*)
4428         cat <<EOM >&4
4429
4430 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4431 EOM
4432         use64bitint="$define"
4433         ;;
4434 esac                          
4435 # Thinko compatibility
4436 case "$use64bitints" in
4437 "$define"|true|[yY]*)
4438         cat <<EOM >&4
4439
4440 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4441 EOM
4442         use64bitint="$define"
4443         ;;
4444 esac                          
4445
4446 case "$ccflags" in
4447 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4448 esac
4449 case "$use64bitall" in
4450 "$define"|true|[yY]*) use64bitint="$define" ;;
4451 esac
4452
4453 case "$longsize" in
4454 8) cat <<EOM
4455
4456 You have natively 64-bit long integers.
4457 EOM
4458    val="$define"
4459    ;;
4460 *) case "$use64bitint" in
4461    "$define"|true|[yY]*) dflt='y';;
4462    *) dflt='n';;
4463    esac
4464    cat <<EOM
4465
4466 Perl can be built to take advantage of 64-bit integer types
4467 on some systems.  To do so, Configure can be run with -Duse64bitint.
4468 Choosing this option will most probably introduce binary incompatibilities.
4469
4470 If this doesn't make any sense to you, just accept the default '$dflt'.
4471 EOM
4472    rp='Try to use 64-bit integers, if available?'
4473    . ./myread
4474    case "$ans" in
4475    [yY]*) val="$define" ;;
4476    *)     val="$undef"  ;;
4477    esac
4478    ;;
4479 esac
4480 set use64bitint
4481 eval $setvar
4482
4483 case "$use64bitint" in
4484 "$define")      case "$longsize" in
4485                 8) dflt='y' ;;
4486                 *) dflt='n' ;;
4487                 esac
4488                 ;;
4489 *)      case "$use64bitall" in
4490         "$define"|true|[yY]*) dflt='y' ;;
4491         *) dflt='n' ;;
4492         esac
4493         ;;
4494 esac 
4495 cat <<EOM
4496
4497 You may also choose to try maximal 64-bitness.  It means using as much
4498 64-bitness as possible on the platform.  This in turn means even more
4499 binary incompatibilities.  On the other hand, your platform may not
4500 have any more 64-bitness available than what you already have chosen.
4501
4502 If this doesn't make any sense to you, just accept the default '$dflt'.
4503 EOM
4504 rp='Try to use maximal 64-bit support, if available?'
4505 . ./myread
4506 case "$ans" in
4507 [yY]*) val="$define" ;;
4508 *)     val="$undef"  ;;
4509 esac
4510 set use64bitall
4511 eval $setvar
4512 case "$use64bitall" in
4513 "$define")
4514         case "$use64bitint" in
4515         "$undef")
4516                 cat <<EOM
4517
4518 Since you have chosen a maximally 64-bit build, I'm also turning on
4519 the use of 64-bit integers.
4520 EOM
4521                 use64bitint="$define" ;;
4522         esac
4523         ;;
4524 esac
4525
4526 case "$use64bitint" in
4527 "$define"|true|[yY]*)
4528 : Look for a hint-file generated 'call-back-unit'.  If the
4529 : user has specified that a 64-bit perl is to be built,
4530 : we may need to set or change some other defaults.
4531         if $test -f use64bitint.cbu; then
4532                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4533                 . ./use64bitint.cbu
4534         fi
4535         case "$longsize" in
4536         4) case "$ccflags" in
4537            *-DUSE_64_BIT_INT*) ;;
4538            *) ccflags="$ccflags -DUSE_64_BIT_INT";;
4539            esac
4540            case "$archname64" in
4541            '') archname64=64int ;;
4542            esac
4543            ;;
4544         esac
4545         ;;
4546 esac
4547
4548 case "$use64bitall" in
4549 "$define"|true|[yY]*)
4550 : Look for a hint-file generated 'call-back-unit'.  If the
4551 : user has specified that a maximally 64-bit perl is to be built,
4552 : we may need to set or change some other defaults.
4553         if $test -f use64bitall.cbu; then
4554                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4555                 . ./use64bitall.cbu
4556         fi
4557         case "$longsize" in
4558         4) case "$ccflags" in
4559            *-DUSE_64_BIT_ALL*) ;;
4560            *) ccflags="$ccflags -DUSE_64_BIT_ALL";;
4561            esac
4562            case "$archname64" in
4563            ''|64) archname64=64all ;;
4564            esac
4565            ;;
4566         esac
4567         ;;
4568 esac
4569
4570 : determine the architecture name
4571 echo " "
4572 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4573         tarch=`arch`"-$osname"
4574 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4575         if uname -m > tmparch 2>&1 ; then
4576                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4577                         -e 's/$/'"-$osname/" tmparch`
4578         else
4579                 tarch="$osname"
4580         fi
4581         $rm -f tmparch
4582 else
4583         tarch="$osname"
4584 fi
4585 case "$myarchname" in
4586 ''|"$tarch") ;;
4587 *)
4588         echo "(Your architecture name used to be $myarchname.)"
4589         archname=''
4590         ;;
4591 esac
4592 myarchname="$tarch"
4593 case "$archname" in
4594 '') dflt="$tarch";;
4595 *) dflt="$archname";;
4596 esac
4597 rp='What is your architecture name'
4598 . ./myread
4599 archname="$ans"
4600 case "$usethreads" in
4601 $define)
4602         echo "Threads selected." >&4
4603         case "$archname" in
4604         *-thread*) echo "...and architecture name already has -thread." >&4
4605                 ;;
4606         *)      archname="$archname-thread"
4607                 echo "...setting architecture name to $archname." >&4
4608                 ;;
4609         esac
4610         ;;
4611 esac
4612 case "$usemultiplicity" in
4613 $define)
4614         echo "Multiplicity selected." >&4
4615         case "$archname" in
4616         *-multi*) echo "...and architecture name already has -multi." >&4
4617                 ;;
4618         *)      archname="$archname-multi"
4619                 echo "...setting architecture name to $archname." >&4
4620                 ;;
4621         esac
4622         ;;
4623 esac
4624 case "$use64bitint" in
4625 $define)
4626         case "$archname64" in
4627         '')
4628                 ;;
4629         *)
4630                 case "$archname" in
4631                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4632                         ;;
4633                 *)      archname="$archname-$archname64"
4634                         echo "...setting architecture name to $archname." >&4
4635                         ;;
4636                 esac
4637                 ;;
4638         esac
4639 esac
4640
4641 : determine root of directory hierarchy where package will be installed.
4642 case "$prefix" in
4643 '')
4644         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4645         ;;
4646 *)
4647         dflt="$prefix"
4648         ;;
4649 esac
4650 $cat <<EOM
4651
4652 By default, $package will be installed in $dflt/bin, manual pages
4653 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4654 installation directories. Typically this is something like /usr/local.
4655 If you wish to have binaries under /usr/bin but other parts of the
4656 installation under /usr/local, that's ok: you will be prompted
4657 separately for each of the installation directories, the prefix being
4658 only used to set the defaults.
4659
4660 EOM
4661 fn=d~
4662 rp='Installation prefix to use?'
4663 . ./getfile
4664 oldprefix=''
4665 case "$prefix" in
4666 '') ;;
4667 *)
4668         case "$ans" in
4669         "$prefix") ;;
4670         *) oldprefix="$prefix";;
4671         esac
4672         ;;
4673 esac
4674 prefix="$ans"
4675 prefixexp="$ansexp"
4676
4677 : is AFS running?
4678 echo " "
4679 case "$afs" in
4680 $define|true)   afs=true ;;
4681 $undef|false)   afs=false ;;
4682 *)      if test -d /afs; then
4683                 afs=true
4684         else
4685                 afs=false
4686         fi
4687         ;;
4688 esac
4689 if $afs; then
4690         echo "AFS may be running... I'll be extra cautious then..." >&4
4691 else
4692         echo "AFS does not seem to be running..." >&4
4693 fi
4694
4695 : determine installation prefix for where package is to be installed.
4696 if $afs; then 
4697 $cat <<EOM
4698
4699 Since you are running AFS, I need to distinguish the directory in which
4700 files will reside from the directory in which they are installed (and from
4701 which they are presumably copied to the former directory by occult means).
4702
4703 EOM
4704         case "$installprefix" in
4705         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4706         *) dflt="$installprefix";;
4707         esac
4708 else
4709 $cat <<EOM
4710
4711 In some special cases, particularly when building $package for distribution,
4712 it is convenient to distinguish between the directory in which files should 
4713 be installed from the directory ($prefix) in which they 
4714 will eventually reside.  For most users, these two directories are the same.
4715
4716 EOM
4717         case "$installprefix" in
4718         '') dflt=$prefix ;;
4719         *) dflt=$installprefix;;
4720         esac
4721 fi
4722 fn=d~
4723 rp='What installation prefix should I use for installing files?'
4724 . ./getfile
4725 installprefix="$ans"
4726 installprefixexp="$ansexp"
4727
4728 : set the prefixit variable, to compute a suitable default value
4729 prefixit='case "$3" in
4730 ""|none)
4731         case "$oldprefix" in
4732         "") eval "$1=\"\$$2\"";;
4733         *)
4734                 case "$3" in
4735                 "") eval "$1=";;
4736                 none)
4737                         eval "tp=\"\$$2\"";
4738                         case "$tp" in
4739                         ""|" ") eval "$1=\"\$$2\"";;
4740                         *) eval "$1=";;
4741                         esac;;
4742                 esac;;
4743         esac;;
4744 *)
4745         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4746         case "$tp" in
4747         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4748         /*-$oldprefix/*|\~*-$oldprefix/*)
4749                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4750         *) eval "$1=\"\$$2\"";;
4751         esac;;
4752 esac'
4753
4754
4755 : get the patchlevel
4756 echo " "
4757 echo "Getting the current patchlevel..." >&4
4758 if $test -r $rsrc/patchlevel.h;then
4759         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4760         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4761         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4762         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4763         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4764         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4765 else
4766         revision=0
4767         patchlevel=0
4768         subversion=0
4769         api_revision=0
4770         api_version=0
4771         api_subversion=0
4772 fi
4773 $echo $n "(You have $package revision $revision" $c
4774 $echo $n " patchlevel $patchlevel" $c
4775 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4776 echo ".)"
4777 case "$osname" in
4778 dos|vms)
4779         : XXX Should be a Configure test for double-dots in filenames.
4780         version=`echo $revision $patchlevel $subversion | \
4781                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4782         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4783                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4784         ;;
4785 *)
4786         version=`echo $revision $patchlevel $subversion | \
4787                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4788         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4789                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4790         ;;
4791 esac
4792 : Special case the 5.005_xx maintenance series, which used 5.005
4793 : without any subversion label as a subdirectory in $sitelib
4794 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4795         api_versionstring='5.005'
4796 fi
4797
4798 : determine installation style
4799 : For now, try to deduce it from prefix unless it is already set.
4800 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4801 case "$installstyle" in
4802 '')     case "$prefix" in
4803                 *perl*) dflt='lib';;
4804                 *) dflt='lib/perl5' ;;
4805         esac
4806         ;;
4807 *)      dflt='lib/perl5' ;;
4808 esac
4809 : Probably not worth prompting for this since we prompt for all
4810 : the directories individually, and the prompt would be too long and
4811 : confusing anyway.
4812 installstyle=$dflt
4813
4814 : determine where private library files go
4815 : Usual default is /usr/local/lib/perl5/$version.
4816 : Also allow things like /opt/perl/lib/$version, since 
4817 : /opt/perl/lib/perl5... would be redundant.
4818 : The default "style" setting is made in installstyle.U
4819 case "$installstyle" in
4820 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4821 *)       set dflt privlib lib/$version ;;
4822 esac
4823 eval $prefixit
4824 $cat <<EOM
4825
4826 There are some auxiliary files for $package that need to be put into a
4827 private library directory that is accessible by everyone.
4828
4829 EOM
4830 fn=d~+
4831 rp='Pathname where the private library files will reside?'
4832 . ./getfile
4833 privlib="$ans"
4834 privlibexp="$ansexp"
4835 : Change installation prefix, if necessary.
4836 if $test X"$prefix" != X"$installprefix"; then
4837         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4838 else
4839         installprivlib="$privlibexp"
4840 fi
4841
4842 : set the prefixup variable, to restore leading tilda escape
4843 prefixup='case "$prefixexp" in
4844 "$prefix") ;;
4845 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4846 esac'
4847
4848 : determine where public architecture dependent libraries go
4849 set archlib archlib
4850 eval $prefixit
4851 : privlib default is /usr/local/lib/$package/$version
4852 : archlib default is /usr/local/lib/$package/$version/$archname
4853 : privlib may have an optional trailing /share.
4854 tdflt=`echo $privlib | $sed 's,/share$,,'`
4855 tdflt=$tdflt/$archname
4856 case "$archlib" in
4857 '')     dflt=$tdflt
4858         ;;
4859 *)      dflt="$archlib"
4860     ;;
4861 esac
4862 $cat <<EOM
4863
4864 $spackage contains architecture-dependent library files.  If you are
4865 sharing libraries in a heterogeneous environment, you might store
4866 these files in a separate location.  Otherwise, you can just include
4867 them with the rest of the public library files.
4868
4869 EOM
4870 fn=d+~
4871 rp='Where do you want to put the public architecture-dependent libraries?'
4872 . ./getfile
4873 archlib="$ans"
4874 archlibexp="$ansexp"
4875 if $test X"$archlib" = X"$privlib"; then
4876         d_archlib="$undef"
4877 else
4878         d_archlib="$define"
4879 fi
4880 : Change installation prefix, if necessary.
4881 if $test X"$prefix" != X"$installprefix"; then
4882         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4883 else
4884         installarchlib="$archlibexp"
4885 fi
4886
4887
4888 : Binary compatibility with 5.005 is not possible for builds
4889 : with advanced features
4890 case "$usethreads$usemultiplicity" in
4891 *define*)
4892         bincompat5005="$undef"
4893         d_bincompat5005="$undef"
4894         ;;
4895 *)      $cat <<EOM
4896
4897 Perl 5.006 can be compiled for binary compatibility with 5.005.
4898 If you decide to do so, you will be able to continue using most
4899 of the extensions that were compiled for Perl 5.005.
4900
4901 EOM
4902         case "$bincompat5005$d_bincompat5005" in
4903         *"$undef"*) dflt=n ;;
4904         *) dflt=y ;;
4905         esac
4906         rp='Binary compatibility with Perl 5.005?'
4907         . ./myread
4908         case "$ans" in
4909         y*) val="$define" ;;
4910         *)  val="$undef" ;;
4911         esac
4912         set d_bincompat5005
4913         eval $setvar
4914         case "$d_bincompat5005" in
4915         "$define")
4916                 bincompat5005="$define"
4917                 ;;
4918         *)      bincompat5005="$undef"
4919                 d_bincompat5005="$undef"
4920                 ;;
4921         esac
4922         ;;
4923 esac
4924
4925
4926 : see if setuid scripts can be secure
4927 $cat <<EOM
4928
4929 Some kernels have a bug that prevents setuid #! scripts from being
4930 secure.  Some sites have disabled setuid #! scripts because of this.
4931
4932 First let's decide if your kernel supports secure setuid #! scripts.
4933 (If setuid #! scripts would be secure but have been disabled anyway,
4934 don't say that they are secure if asked.)
4935
4936 EOM
4937
4938 val="$undef"
4939 if $test -d /dev/fd; then
4940         echo "#!$ls" >reflect
4941         chmod +x,u+s reflect
4942         ./reflect >flect 2>&1
4943         if $contains "/dev/fd" flect >/dev/null; then
4944                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4945                 val="$define"
4946         else
4947                 $cat <<EOM
4948 If you are not sure if they are secure, I can check but I'll need a
4949 username and password different from the one you are using right now.
4950 If you don't have such a username or don't want me to test, simply
4951 enter 'none'.
4952
4953 EOM
4954                 rp='Other username to test security of setuid scripts with?'
4955                 dflt='none'
4956                 . ./myread
4957                 case "$ans" in
4958                 n|none)
4959                         case "$d_suidsafe" in
4960                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4961                                 dflt=n;;
4962                         "$undef")
4963                                 echo "Well, the $hint value is *not* secure." >&4
4964                                 dflt=n;;
4965                         *)      echo "Well, the $hint value *is* secure." >&4
4966                                 dflt=y;;
4967                         esac
4968                         ;;
4969                 *)
4970                         $rm -f reflect flect
4971                         echo "#!$ls" >reflect
4972                         chmod +x,u+s reflect
4973                         echo >flect
4974                         chmod a+w flect
4975                         echo '"su" will (probably) prompt you for '"$ans's password."
4976                         su $ans -c './reflect >flect'
4977                         if $contains "/dev/fd" flect >/dev/null; then
4978                                 echo "Okay, it looks like setuid scripts are secure." >&4
4979                                 dflt=y
4980                         else
4981                                 echo "I don't think setuid scripts are secure." >&4
4982                                 dflt=n
4983                         fi
4984                         ;;
4985                 esac
4986                 rp='Does your kernel have *secure* setuid scripts?'
4987                 . ./myread
4988                 case "$ans" in
4989                 [yY]*)  val="$define";;
4990                 *)      val="$undef";;
4991                 esac
4992         fi
4993 else
4994         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4995         echo "(That's for file descriptors, not floppy disks.)"
4996         val="$undef"
4997 fi
4998 set d_suidsafe
4999 eval $setvar
5000
5001 $rm -f reflect flect
5002
5003 : now see if they want to do setuid emulation
5004 echo " "
5005 val="$undef"
5006 case "$d_suidsafe" in
5007 "$define")
5008         val="$undef"
5009         echo "No need to emulate SUID scripts since they are secure here." >& 4
5010         ;;
5011 *)
5012         $cat <<EOM
5013 Some systems have disabled setuid scripts, especially systems where
5014 setuid scripts cannot be secure.  On systems where setuid scripts have
5015 been disabled, the setuid/setgid bits on scripts are currently
5016 useless.  It is possible for $package to detect those bits and emulate
5017 setuid/setgid in a secure fashion.  This emulation will only work if
5018 setuid scripts have been disabled in your kernel.
5019
5020 EOM
5021         case "$d_dosuid" in
5022         "$define") dflt=y ;;
5023         *) dflt=n ;;
5024         esac
5025         rp="Do you want to do setuid/setgid emulation?"
5026         . ./myread
5027         case "$ans" in
5028         [yY]*)  val="$define";;
5029         *)      val="$undef";;
5030         esac
5031         ;;
5032 esac
5033 set d_dosuid
5034 eval $setvar
5035
5036 : determine filename position in cpp output
5037 echo " "
5038 echo "Computing filename position in cpp output for #include directives..." >&4
5039 echo '#include <stdio.h>' > foo.c
5040 $cat >fieldn <<EOF
5041 $startsh
5042 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5043 $grep '^[       ]*#.*stdio\.h' | \
5044 while read cline; do
5045         pos=1
5046         set \$cline
5047         while $test \$# -gt 0; do
5048                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5049                         echo "\$pos"
5050                         exit 0
5051                 fi
5052                 shift
5053                 pos=\`expr \$pos + 1\`
5054         done
5055 done
5056 EOF
5057 chmod +x fieldn
5058 fieldn=`./fieldn`
5059 $rm -f foo.c fieldn
5060 case $fieldn in
5061 '') pos='???';;
5062 1) pos=first;;
5063 2) pos=second;;
5064 3) pos=third;;
5065 *) pos="${fieldn}th";;
5066 esac
5067 echo "Your cpp writes the filename in the $pos field of the line."
5068
5069 : locate header file
5070 $cat >findhdr <<EOF
5071 $startsh
5072 wanted=\$1
5073 name=''
5074 for usrincdir in $usrinc
5075 do
5076         if test -f \$usrincdir/\$wanted; then
5077                 echo "\$usrincdir/\$wanted"
5078                 exit 0
5079         fi
5080 done
5081 awkprg='{ print \$$fieldn }'
5082 echo "#include <\$wanted>" > foo\$\$.c
5083 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5084 $grep "^[       ]*#.*\$wanted" | \
5085 while read cline; do
5086         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5087         case "\$name" in
5088         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5089         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5090         *) exit 2;;
5091         esac;
5092 done;
5093 #
5094 # status = 0: grep returned 0 lines, case statement not executed
5095 # status = 1: headerfile found
5096 # status = 2: while loop executed, no headerfile found
5097 #
5098 status=\$?
5099 $rm -f foo\$\$.c;
5100 if test \$status -eq 1; then
5101         exit 0;
5102 fi
5103 exit 1
5104 EOF
5105 chmod +x findhdr
5106
5107 : define an alternate in-header-list? function
5108 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5109 cont=true; xxf="echo \"<\$1> found.\" >&4";
5110 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5111 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5112 esac;
5113 case $# in 4) instead=instead;; *) instead="at last";; esac;
5114 while $test "$cont"; do
5115         xxx=`./findhdr $1`
5116         var=$2; eval "was=\$$2";
5117         if $test "$xxx" && $test -r "$xxx";
5118         then eval $xxf;
5119         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5120                 cont="";
5121         else eval $xxnf;
5122         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5123         set $yyy; shift; shift; yyy=$@;
5124         case $# in 0) cont="";;
5125         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5126                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5127         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5128                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5129         esac;
5130 done;
5131 while $test "$yyy";
5132 do set $yyy; var=$2; eval "was=\$$2";
5133         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5134         set $yyy; shift; shift; yyy=$@;
5135 done'
5136
5137 : see if this is a malloc.h system
5138 set malloc.h i_malloc
5139 eval $inhdr
5140
5141 : see if stdlib is available
5142 set stdlib.h i_stdlib
5143 eval $inhdr
5144
5145 : determine which malloc to compile in
5146 echo " "
5147 case "$usemymalloc" in
5148 ''|[yY]*|true|$define)  dflt='y' ;;
5149 *)      dflt='n' ;;
5150 esac
5151 rp="Do you wish to attempt to use the malloc that comes with $package?"
5152 . ./myread
5153 usemymalloc="$ans"
5154 case "$ans" in
5155 y*|true)
5156         usemymalloc='y'
5157         mallocsrc='malloc.c'
5158         mallocobj="malloc$_o"
5159         d_mymalloc="$define"
5160         case "$libs" in
5161         *-lmalloc*)
5162                 : Remove malloc from list of libraries to use
5163                 echo "Removing unneeded -lmalloc from library list" >&4
5164                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5165                 shift
5166                 libs="$*"
5167                 echo "libs = $libs" >&4
5168                 ;;
5169         esac
5170         ;;
5171 *)
5172         usemymalloc='n'
5173         mallocsrc=''
5174         mallocobj=''
5175         d_mymalloc="$undef"
5176         ;;
5177 esac
5178
5179 : compute the return types of malloc and free
5180 echo " "
5181 $cat >malloc.c <<END
5182 #$i_malloc I_MALLOC
5183 #$i_stdlib I_STDLIB
5184 #include <stdio.h>
5185 #include <sys/types.h>
5186 #ifdef I_MALLOC
5187 #include <malloc.h>
5188 #endif
5189 #ifdef I_STDLIB
5190 #include <stdlib.h>
5191 #endif
5192 #ifdef TRY_MALLOC
5193 void *malloc();
5194 #endif
5195 #ifdef TRY_FREE
5196 void free();
5197 #endif
5198 END
5199 case "$malloctype" in
5200 '')
5201         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5202                 malloctype='void *'
5203         else
5204                 malloctype='char *'
5205         fi
5206         ;;
5207 esac
5208 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5209
5210 case "$freetype" in
5211 '')
5212         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5213                 freetype='void'
5214         else
5215                 freetype='int'
5216         fi
5217         ;;
5218 esac
5219 echo "Your system uses $freetype free(), it would seem." >&4
5220 $rm -f malloc.[co]
5221 $cat <<EOM
5222
5223 The installation process will also create a directory for
5224 vendor-supplied add-ons.  Vendors who supply perl with their system
5225 may find it convenient to place all vendor-supplied files in this
5226 directory rather than in the main distribution directory.  This will
5227 ease upgrades between binary-compatible maintenance versions of perl.
5228
5229 Of course you may also use these directories in whatever way you see
5230 fit.  For example, you might use them to access modules shared over a
5231 company-wide network.
5232
5233 The default answer should be fine for most people.
5234 This causes further questions about vendor add-ons to be skipped
5235 and no vendor-specific directories will be configured for perl.
5236
5237 EOM
5238 rp='Do you want to configure vendor-specific add-on directories?'
5239 case "$usevendorprefix" in
5240 define|true|[yY]*) dflt=y ;;
5241 *)      : User may have set vendorprefix directly on Configure command line.
5242         case "$vendorprefix" in
5243         ''|' ') dflt=n ;;
5244         *)      dflt=y ;;
5245         esac
5246         ;;
5247 esac
5248 . ./myread
5249 case "$ans" in
5250 [yY]*)  fn=d~+
5251         rp='Installation prefix to use for vendor-supplied add-ons?'
5252         case "$vendorprefix" in
5253         '') dflt='' ;;
5254         *)  dflt=$vendorprefix ;;
5255         esac
5256         . ./getfile
5257         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5258         oldvendorprefix=''
5259         case "$vendorprefix" in
5260         '') ;;
5261         *)      case "$ans" in
5262                 "$prefix") ;;
5263                 *) oldvendorprefix="$prefix";;
5264                 esac
5265                 ;;
5266         esac
5267         usevendorprefix="$define"
5268         vendorprefix="$ans"
5269         vendorprefixexp="$ansexp"
5270         ;;
5271 *)      usevendorprefix="$undef"
5272         vendorprefix=''
5273         vendorprefixexp=''
5274         ;;
5275 esac
5276
5277 case "$vendorprefix" in
5278 '')     d_vendorlib="$undef"
5279         vendorlib=''
5280         vendorlibexp=''
5281         ;;
5282 *)      d_vendorlib="$define"
5283         : determine where vendor-supplied modules go.
5284         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5285         case "$vendorlib" in
5286         '')
5287                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5288                 case "$installstyle" in
5289                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5290                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5291                 esac
5292                 ;;
5293         *)      dflt="$vendorlib"
5294                 ;;
5295         esac
5296         fn=d~+
5297         rp='Pathname for the vendor-supplied library files?'
5298         . ./getfile
5299         vendorlib="$ans"
5300         vendorlibexp="$ansexp"
5301         ;;
5302 esac
5303 : Change installation prefix, if necessary.
5304 if $test X"$prefix" != X"$installprefix"; then
5305         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5306 else
5307         installvendorlib="$vendorlibexp"
5308 fi
5309
5310 : Cruising for prototypes
5311 echo " "
5312 echo "Checking out function prototypes..." >&4
5313 $cat >prototype.c <<'EOCP'
5314 int main(int argc, char *argv[]) {
5315         exit(0);}
5316 EOCP
5317 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5318         echo "Your C compiler appears to support function prototypes."
5319         val="$define"
5320 else
5321         echo "Your C compiler doesn't seem to understand function prototypes."
5322         val="$undef"
5323 fi
5324 set prototype
5325 eval $setvar
5326 $rm -f prototype*
5327
5328 case "$prototype" in
5329 "$define") ;;
5330 *)      ansi2knr='ansi2knr'
5331         echo " "
5332         cat <<EOM >&4
5333
5334 $me:  FATAL ERROR:
5335 This version of $package can only be compiled by a compiler that 
5336 understands function prototypes.  Unfortunately, your C compiler 
5337         $cc $ccflags
5338 doesn't seem to understand them.  Sorry about that.
5339
5340 If GNU cc is available for your system, perhaps you could try that instead.  
5341
5342 Eventually, we hope to support building Perl with pre-ANSI compilers.
5343 If you would like to help in that effort, please contact <perlbug@perl.org>.
5344
5345 Aborting Configure now.
5346 EOM
5347         exit 2
5348         ;;
5349 esac
5350
5351 : determine where public executables go
5352 echo " "
5353 set dflt bin bin
5354 eval $prefixit
5355 fn=d~
5356 rp='Pathname where the public executables will reside?'
5357 . ./getfile
5358 if $test "X$ansexp" != "X$binexp"; then
5359         installbin=''
5360 fi
5361 bin="$ans"
5362 binexp="$ansexp"
5363 : Change installation prefix, if necessary.
5364 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5365 if $test X"$prefix" != X"$installprefix"; then
5366         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5367 else
5368         installbin="$binexp"
5369 fi
5370
5371 : Find perl5.005 or later.
5372 echo "Looking for a previously installed perl5.005 or later... "
5373 case "$perl5" in
5374 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5375                 : Check if this perl is recent and can load a simple module
5376                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5377                         perl5=$tdir/perl
5378                         break;
5379                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5380                         perl5=$tdir/perl
5381                         break;
5382                 fi
5383         done
5384         ;;
5385 *)      perl5="$perl5"
5386         ;;
5387 esac
5388 case "$perl5" in
5389 '')     echo "None found.  That's ok.";;
5390 *)      echo "Using $perl5." ;;
5391 esac
5392
5393 $cat <<EOM
5394
5395 After $package is installed, you may wish to install various
5396 add-on modules and utilities.  Typically, these add-ons will
5397 be installed under $prefix with the rest
5398 of this package.  However, you may wish to install such add-ons
5399 elsewhere under a different prefix.
5400
5401 If you do not wish to put everything under a single prefix, that's
5402 ok.  You will be prompted for the individual locations; this siteprefix
5403 is only used to suggest the defaults.
5404
5405 The default should be fine for most people.
5406
5407 EOM
5408 fn=d~+
5409 rp='Installation prefix to use for add-on modules and utilities?'
5410 : XXX Here might be another good place for an installstyle setting.
5411 case "$siteprefix" in
5412 '') dflt=$prefix ;;
5413 *)  dflt=$siteprefix ;;
5414 esac
5415 . ./getfile
5416 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5417 oldsiteprefix=''
5418 case "$siteprefix" in
5419 '') ;;
5420 *)      case "$ans" in
5421         "$prefix") ;;
5422         *) oldsiteprefix="$prefix";;
5423         esac
5424         ;;
5425 esac
5426 siteprefix="$ans"
5427 siteprefixexp="$ansexp"
5428
5429 : determine where site specific libraries go.
5430 : Usual default is /usr/local/lib/perl5/site_perl/$version
5431 : The default "style" setting is made in installstyle.U
5432 : XXX No longer works with Prefixit stuff.
5433 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5434 case "$sitelib" in
5435 '') case "$installstyle" in
5436         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5437         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5438         esac
5439         ;;
5440 *)      dflt="$sitelib"
5441         ;;
5442 esac
5443 $cat <<EOM
5444
5445 The installation process will create a directory for
5446 site-specific extensions and modules.  Most users find it convenient
5447 to place all site-specific files in this directory rather than in the
5448 main distribution directory.
5449
5450 EOM
5451 fn=d~+
5452 rp='Pathname for the site-specific library files?'
5453 . ./getfile
5454 sitelib="$ans"
5455 sitelibexp="$ansexp"
5456 : Change installation prefix, if necessary.
5457 if $test X"$prefix" != X"$installprefix"; then
5458         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5459 else
5460         installsitelib="$sitelibexp"
5461 fi
5462
5463 : Determine list of previous versions to include in @INC
5464 $cat > getverlist <<EOPL
5465 #!$perl5 -w
5466 use File::Basename;
5467 \$api_versionstring = "$api_versionstring";
5468 \$version = "$version";
5469 \$sitelib = "$sitelib";
5470 \$archname = "$archname";
5471 EOPL
5472         $cat >> getverlist <<'EOPL'
5473 # Can't have leading @ because metaconfig interprets it as a command!
5474 ;@inc_version_list=();
5475 $stem=dirname($sitelib);
5476 # XXX Redo to do opendir/readdir? 
5477 if (-d $stem) {
5478     chdir($stem);
5479     ;@candidates = glob("5.*");
5480 }
5481 else {
5482     ;@candidates = ();
5483 }
5484
5485 # XXX ToDo:  These comparisons must be reworked when two-digit
5486 # subversions come along, so that 5.7.10 compares as greater than
5487 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5488 # widespread that we can use the built-in version vectors rather
5489 # than reinventing them here.  For 5.6.0, however, we must
5490 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5491 foreach $d (@candidates) {
5492     if ($d lt $version) {
5493         if ($d ge $api_versionstring) {
5494             unshift(@inc_version_list, "$d/$archname", $d);
5495         }
5496         elsif ($d ge "5.005") {
5497             unshift(@inc_version_list, $d);
5498         }
5499     }
5500     else {
5501         # Skip newer version.  I.e. don't look in
5502         # 5.7.0 if we're installing 5.6.1.
5503     }
5504 }
5505
5506 if (@inc_version_list) {
5507     print join(' ', @inc_version_list);
5508 }
5509 else {
5510     # Blank space to preserve value for next Configure run.
5511     print " ";
5512 }
5513 EOPL
5514 chmod +x getverlist
5515 case "$inc_version_list" in
5516 '')     if test -x "$perl5"; then
5517                 dflt=`$perl5 getverlist`
5518         else
5519                 dflt='none'
5520         fi
5521         ;;
5522 $undef) dflt='none' ;;
5523 *)  dflt="$inc_version_list" ;;
5524 esac
5525 case "$dflt" in
5526 ''|' ') dflt=none ;;
5527 esac
5528 $cat <<'EOM'
5529
5530 In order to ease the process of upgrading, this version of perl 
5531 can be configured to use modules built and installed with earlier 
5532 versions of perl that were installed under $prefix.  Specify here
5533 the list of earlier versions that this version of perl should check.
5534 If Configure detected no earlier versions of perl installed under
5535 $prefix, then the list will be empty.  Answer 'none' to tell perl
5536 to not search earlier versions.
5537
5538 The default should almost always be sensible, so if you're not sure,
5539 just accept the default.
5540 EOM
5541
5542 rp='List of earlier versions to include in @INC?'
5543 . ./myread
5544 case "$ans" in
5545 [Nn]one|''|' ') inc_version_list=' ' ;;
5546 *) inc_version_list="$ans" ;;
5547 esac
5548 case "$inc_version_list" in
5549 ''|' ') 
5550         inc_version_list_init='0';;
5551 *)      inc_version_list_init=`echo $inc_version_list |
5552                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5553         ;;
5554 esac
5555 $rm -f getverlist
5556
5557 : determine whether to install perl also as /usr/bin/perl
5558
5559 echo " "
5560 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5561         $cat <<EOM
5562 Many scripts expect to perl to be installed as /usr/bin/perl.
5563 I can install the perl you are about to compile also as /usr/bin/perl
5564 (in addition to $installbin/perl).
5565 EOM
5566         case "$installusrbinperl" in
5567         "$undef"|[nN]*) dflt='n';;
5568         *)              dflt='y';;
5569         esac
5570         rp="Do you want to install perl as /usr/bin/perl?"
5571         . ./myread
5572         case "$ans" in
5573         [yY]*)  val="$define";;
5574         *)      val="$undef" ;;
5575         esac
5576 else
5577         val="$undef"
5578 fi
5579 set installusrbinperl
5580 eval $setvar
5581
5582 echo " "
5583 echo "Checking for GNU C Library..." >&4
5584 cat >gnulibc.c <<EOM
5585 #include <stdio.h>
5586 int main()
5587 {
5588 #ifdef __GLIBC__
5589     exit(0);
5590 #else
5591     exit(1);
5592 #endif
5593 }
5594 EOM
5595 set gnulibc
5596 if eval $compile_ok && ./gnulibc; then
5597         val="$define"
5598         echo "You are using the GNU C Library"
5599 else
5600         val="$undef"
5601         echo "You are not using the GNU C Library"
5602 fi
5603 $rm -f gnulibc*
5604 set d_gnulibc
5605 eval $setvar
5606
5607 : see if nm is to be used to determine whether a symbol is defined or not
5608 case "$usenm" in
5609 '')
5610         dflt=''
5611         case "$d_gnulibc" in
5612         "$define")
5613                 echo " "
5614                 echo "nm probably won't work on the GNU C Library." >&4
5615                 dflt=n
5616                 ;;
5617         esac
5618         case "$dflt" in
5619         '') 
5620                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5621                         echo " "
5622                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5623                         echo "'nm' won't be sufficient on this sytem." >&4
5624                         dflt=n
5625                 fi
5626                 ;;
5627         esac
5628         case "$dflt" in
5629         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5630                 if $test $dflt -gt 20; then
5631                         dflt=y
5632                 else
5633                         dflt=n
5634                 fi
5635                 ;;
5636         esac
5637         ;;
5638 *)
5639         case "$usenm" in
5640         true|$define) dflt=y;;
5641         *) dflt=n;;
5642         esac
5643         ;;
5644 esac
5645 $cat <<EOM
5646
5647 I can use $nm to extract the symbols from your C libraries. This
5648 is a time consuming task which may generate huge output on the disk (up
5649 to 3 megabytes) but that should make the symbols extraction faster. The
5650 alternative is to skip the 'nm' extraction part and to compile a small
5651 test program instead to determine whether each symbol is present. If
5652 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5653 this may be the best solution.
5654
5655 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5656
5657 EOM
5658 rp="Shall I use $nm to extract C symbols from the libraries?"
5659 . ./myread
5660 case "$ans" in
5661 [Nn]*) usenm=false;;
5662 *) usenm=true;;
5663 esac
5664
5665 runnm=$usenm
5666 case "$reuseval" in
5667 true) runnm=false;;
5668 esac
5669
5670 : nm options which may be necessary
5671 case "$nm_opt" in
5672 '') if $test -f /mach_boot; then
5673                 nm_opt=''       # Mach
5674         elif $test -d /usr/ccs/lib; then
5675                 nm_opt='-p'     # Solaris (and SunOS?)
5676         elif $test -f /dgux; then
5677                 nm_opt='-p'     # DG-UX
5678         elif $test -f /lib64/rld; then
5679                 nm_opt='-p'     # 64-bit Irix
5680         else
5681                 nm_opt=''
5682         fi;;
5683 esac
5684
5685 : nm options which may be necessary for shared libraries but illegal
5686 : for archive libraries.  Thank you, Linux.
5687 case "$nm_so_opt" in
5688 '')     case "$myuname" in
5689         *linux*)
5690                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5691                         nm_so_opt='--dynamic'
5692                 fi
5693                 ;;
5694         esac
5695         ;;
5696 esac
5697
5698 case "$runnm" in
5699 true)
5700 : get list of predefined functions in a handy place
5701 echo " "
5702 case "$libc" in
5703 '') libc=unknown
5704         case "$libs" in
5705         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5706         esac
5707         ;;
5708 esac
5709 libnames='';
5710 case "$libs" in
5711 '') ;;
5712 *)  for thislib in $libs; do
5713         case "$thislib" in
5714         -lc|-lc_s)
5715                 : Handle C library specially below.
5716                 ;;
5717         -l*)
5718                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5719                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5720                         :
5721                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5722                         :
5723                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5724                         :
5725                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5726                         :
5727                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5728                         :
5729                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5730                         :
5731                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5732                         :
5733                 else
5734                         try=''
5735                 fi
5736                 libnames="$libnames $try"
5737                 ;;
5738         *) libnames="$libnames $thislib" ;;
5739         esac
5740         done
5741         ;;
5742 esac
5743 xxx=normal
5744 case "$libc" in
5745 unknown)
5746         set /lib/libc.$so
5747         for xxx in $libpth; do
5748                 $test -r $1 || set $xxx/libc.$so
5749                 : The messy sed command sorts on library version numbers.
5750                 $test -r $1 || \
5751                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5752                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5753                                 h
5754                                 s/[0-9][0-9]*/0000&/g
5755                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5756                                 G
5757                                 s/\n/ /' | \
5758                          sort | $sed -e 's/^.* //'`
5759                 eval set \$$#
5760         done
5761         $test -r $1 || set /usr/ccs/lib/libc.$so
5762         $test -r $1 || set /lib/libsys_s$_a
5763         ;;
5764 *)
5765         set blurfl
5766         ;;
5767 esac
5768 if $test -r "$1"; then
5769         echo "Your (shared) C library seems to be in $1."
5770         libc="$1"
5771 elif $test -r /lib/libc && $test -r /lib/clib; then
5772         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5773         xxx=apollo
5774         libc='/lib/clib /lib/libc'
5775         if $test -r /lib/syslib; then
5776                 echo "(Your math library is in /lib/syslib.)"
5777                 libc="$libc /lib/syslib"
5778         fi
5779 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5780         echo "Your C library seems to be in $libc, as you said before."
5781 elif $test -r $incpath/usr/lib/libc$_a; then
5782         libc=$incpath/usr/lib/libc$_a;
5783         echo "Your C library seems to be in $libc.  That's fine."
5784 elif $test -r /lib/libc$_a; then
5785         libc=/lib/libc$_a;
5786         echo "Your C library seems to be in $libc.  You're normal."
5787 else
5788         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5789                 :
5790         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5791                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5792         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5793                 :
5794         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5795                 :
5796         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5797                 :
5798         else
5799                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5800         fi
5801         if $test -r "$tans"; then
5802                 echo "Your C library seems to be in $tans, of all places."
5803                 libc=$tans
5804         else
5805                 libc='blurfl'
5806         fi
5807 fi
5808 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5809         dflt="$libc"
5810         cat <<EOM
5811
5812 If the guess above is wrong (which it might be if you're using a strange
5813 compiler, or your machine supports multiple models), you can override it here.
5814
5815 EOM
5816 else
5817         dflt=''
5818         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5819         cat >&4 <<EOM
5820 I can't seem to find your C library.  I've looked in the following places:
5821
5822 EOM
5823         $sed 's/^/      /' libpath
5824         cat <<EOM
5825
5826 None of these seems to contain your C library. I need to get its name...
5827
5828 EOM
5829 fi
5830 fn=f
5831 rp='Where is your C library?'
5832 . ./getfile
5833 libc="$ans"
5834
5835 echo " "
5836 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5837 set X `cat libnames`
5838 shift
5839 xxx=files
5840 case $# in 1) xxx=file; esac
5841 echo "Extracting names from the following $xxx for later perusal:" >&4
5842 echo " "
5843 $sed 's/^/      /' libnames >&4
5844 echo " "
5845 $echo $n "This may take a while...$c" >&4
5846
5847 for file in $*; do
5848         case $file in
5849         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5850         *) $nm $nm_opt $file 2>/dev/null;;
5851         esac
5852 done >libc.tmp
5853
5854 $echo $n ".$c"
5855 $grep fprintf libc.tmp > libc.ptf
5856 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5857 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5858 xxx='[ADTSIW]'
5859 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5860         eval $xscan;\
5861         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5862                 eval $xrun
5863 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5864         eval $xscan;\
5865         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5866                 eval $xrun
5867 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5868         eval $xscan;\
5869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5870                 eval $xrun
5871 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5872         eval $xscan;\
5873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5874                 eval $xrun
5875 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5876         eval $xscan;\
5877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5878                 eval $xrun
5879 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5880         eval $xscan;\
5881         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5882                 eval $xrun
5883 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5884                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5885         eval $xscan;\
5886         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5887                 eval $xrun
5888 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5889         eval $xscan;\
5890         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5891                 eval $xrun
5892 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5893         eval $xscan;\
5894         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5895                 eval $xrun
5896 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5897         eval $xscan;\
5898         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5899                 eval $xrun
5900 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5901         eval $xscan;\
5902         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5903                 eval $xrun
5904 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5905         eval $xscan;\
5906         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5907                 eval $xrun
5908 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5909         eval $xscan;\
5910         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5911                 eval $xrun
5912 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5913         eval $xscan;\
5914         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5915                 eval $xrun
5916 else
5917         $nm -p $* 2>/dev/null >libc.tmp
5918         $grep fprintf libc.tmp > libc.ptf
5919         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5920                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5921         then
5922                 nm_opt='-p'
5923                 eval $xrun
5924         else
5925                 echo " "
5926                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5927                 com=''
5928                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5929                         for thisname in $libnames $libc; do
5930                                 $ar t $thisname >>libc.tmp
5931                         done
5932                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5933                         echo "Ok." >&4
5934                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5935                         # Repeat libc to extract forwarders to DLL entries too
5936                         for thisname in $libnames $libc; do
5937                                 $ar tv $thisname >>libc.tmp
5938                                 # Revision 50 of EMX has bug in $ar.
5939                                 # it will not extract forwarders to DLL entries
5940                                 # Use emximp which will extract exactly them.
5941                                 emximp -o tmp.imp $thisname \
5942                                     2>/dev/null && \
5943                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5944                                     < tmp.imp >>libc.tmp
5945                                 $rm tmp.imp
5946                         done
5947                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5948                         echo "Ok." >&4
5949                 else
5950                         echo "$ar didn't seem to work right." >&4
5951                         echo "Maybe this is a Cray...trying bld instead..." >&4
5952                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5953                         then
5954                                 for thisname in $libnames; do
5955                                         bld t $libnames | \
5956                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5957                                         $ar t $thisname >>libc.tmp
5958                                 done
5959                                 echo "Ok." >&4
5960                         else
5961                                 echo "That didn't work either.  Giving up." >&4
5962                                 exit 1
5963                         fi
5964                 fi
5965         fi
5966 fi
5967 nm_extract="$com"
5968 if $test -f /lib/syscalls.exp; then
5969         echo " "
5970         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5971         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5972 fi
5973 ;;
5974 esac
5975 $rm -f libnames libpath
5976
5977 : see if dld is available
5978 set dld.h i_dld
5979 eval $inhdr
5980
5981 : is a C symbol defined?
5982 csym='tlook=$1;
5983 case "$3" in
5984 -v) tf=libc.tmp; tc=""; tdc="";;
5985 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5986 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5987 esac;
5988 tx=yes;
5989 case "$reuseval-$4" in
5990 true-) ;;
5991 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5992 esac;
5993 case "$tx" in
5994 yes)
5995         case "$runnm" in
5996         true)
5997                 if $contains $tlook $tf >/dev/null 2>&1;
5998                 then tval=true;
5999                 else tval=false;
6000                 fi;;
6001         *)
6002                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6003                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6004                 then tval=true;
6005                 else tval=false;
6006                 fi;
6007                 $rm -f t t.c;;
6008         esac;;
6009 *)
6010         case "$tval" in
6011         $define) tval=true;;
6012         *) tval=false;;
6013         esac;;
6014 esac;
6015 eval "$2=$tval"'
6016
6017 : define an is-in-libc? function
6018 inlibc='echo " "; td=$define; tu=$undef;
6019 sym=$1; var=$2; eval "was=\$$2";
6020 tx=yes;
6021 case "$reuseval$was" in
6022 true) ;;
6023 true*) tx=no;;
6024 esac;
6025 case "$tx" in
6026 yes)
6027         set $sym tres -f;
6028         eval $csym;
6029         case "$tres" in
6030         true)
6031                 echo "$sym() found." >&4;
6032                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6033         *)
6034                 echo "$sym() NOT found." >&4;
6035                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6036         esac;;
6037 *)
6038         case "$was" in
6039         $define) echo "$sym() found." >&4;;
6040         *) echo "$sym() NOT found." >&4;;
6041         esac;;
6042 esac'
6043
6044 : see if dlopen exists
6045 xxx_runnm="$runnm"
6046 runnm=false
6047 set dlopen d_dlopen
6048 eval $inlibc
6049 runnm="$xxx_runnm"
6050
6051 : determine which dynamic loading, if any, to compile in
6052 echo " "
6053 dldir="ext/DynaLoader"
6054 case "$usedl" in
6055 $define|y|true)
6056         dflt='y'
6057         usedl="$define"
6058         ;;
6059 $undef|n|false)
6060         dflt='n'
6061         usedl="$undef"
6062         ;;
6063 *) 
6064         dflt='n'
6065         case "$d_dlopen" in
6066             $define) dflt='y' ;;
6067         esac
6068         case "$i_dld" in
6069             $define) dflt='y' ;;
6070         esac
6071         : Does a dl_xxx.xs file exist for this operating system
6072         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6073         ;;
6074 esac
6075 rp="Do you wish to use dynamic loading?"
6076 . ./myread
6077 usedl="$ans"
6078 case "$ans" in
6079 y*) usedl="$define"
6080         case "$dlsrc" in
6081         '')
6082                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6083                         dflt="$dldir/dl_${osname}.xs"
6084                 elif $test "$d_dlopen" = "$define" ; then
6085                         dflt="$dldir/dl_dlopen.xs"
6086                 elif $test "$i_dld" = "$define" ; then
6087                         dflt="$dldir/dl_dld.xs"
6088                 else
6089                         dflt=''
6090                 fi
6091                 ;;
6092         *)      dflt="$dldir/$dlsrc"
6093                 ;;
6094         esac
6095     echo "The following dynamic loading files are available:"
6096         : Can not go over to $dldir because getfile has path hard-coded in.
6097         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6098         rp="Source file to use for dynamic loading"
6099         fn="fne"
6100         gfpth="$src"
6101         . ./getfile
6102         usedl="$define"
6103         : emulate basename
6104         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6105
6106         $cat << EOM
6107
6108 Some systems may require passing special flags to $cc -c to
6109 compile modules that will be used to create a shared library.
6110 To use no flags, say "none".
6111
6112 EOM
6113     case "$cccdlflags" in
6114     '') case "$gccversion" in
6115                 '') case "$osname" in
6116                         hpux)   dflt='+z' ;;
6117                         next)   dflt='none' ;;
6118                         irix*)  dflt='-KPIC' ;;
6119                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6120                         sunos)  dflt='-pic' ;;
6121                         *)      dflt='none' ;;
6122                     esac
6123                         ;;
6124                 *)  case "$osname" in
6125                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6126                         *)      dflt='-fpic' ;;
6127                     esac ;;
6128             esac ;;
6129         ' ') dflt='none' ;;
6130     *)  dflt="$cccdlflags" ;;
6131     esac
6132     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6133     . ./myread
6134     case "$ans" in
6135     none) cccdlflags=' ' ;;
6136     *) cccdlflags="$ans" ;;
6137     esac
6138
6139     cat << EOM
6140
6141 Some systems use ld to create libraries that can be dynamically loaded,
6142 while other systems (such as those using ELF) use $cc.
6143
6144 EOM
6145         case "$ld" in
6146         '')     $cat >try.c <<'EOM'
6147 /* Test for whether ELF binaries are produced */
6148 #include <fcntl.h>
6149 #include <stdlib.h>
6150 int main() {
6151         char b[4];
6152         int i = open("a.out",O_RDONLY);
6153         if(i == -1) 
6154                 exit(1); /* fail */
6155         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6156                 exit(0); /* succeed (yes, it's ELF) */
6157         else
6158                 exit(1); /* fail */
6159 }
6160 EOM
6161                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6162                         cat <<EOM
6163 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6164 EOM
6165                         dflt="$cc"
6166                 else
6167                         echo "I'll use ld to build dynamic libraries."
6168                         dflt='ld'
6169                 fi
6170                 rm -f try.c a.out
6171                 ;;
6172         *)      dflt="$ld"
6173                 ;;
6174         esac
6175
6176     rp="What command should be used to create dynamic libraries?"
6177     . ./myread
6178         ld="$ans"
6179
6180     cat << EOM
6181
6182 Some systems may require passing special flags to $ld to create a
6183 library that can be dynamically loaded.  If your ld flags include
6184 -L/other/path options to locate libraries outside your loader's normal
6185 search path, you may need to specify those -L options here as well.  To
6186 use no flags, say "none".
6187
6188 EOM
6189     case "$lddlflags" in
6190     '') case "$osname" in
6191                         beos) dflt='-nostart' ;;
6192                         hpux)  dflt='-b +vnocompatwarnings' ;;
6193                         linux|irix*)    dflt='-shared' ;;
6194                         next)  dflt='none' ;;
6195                         solaris) dflt='-G' ;;
6196                         sunos) dflt='-assert nodefinitions' ;;
6197                         svr4*|esix*) dflt="-G $ldflags" ;;
6198                 *)     dflt='none' ;;
6199                         esac
6200                         ;;
6201     *) dflt="$lddlflags" ;;
6202     esac
6203
6204         : Try to guess additional flags to pick up local libraries.
6205         : Be careful not to append to a plain 'none'
6206         case "$dflt" in
6207         none) dflt='' ;;
6208         esac
6209         for thisflag in $ldflags; do
6210                 case "$thisflag" in
6211                 -L*)
6212                         case " $dflt " in
6213                         *" $thisflag "*) ;;
6214                         *) dflt="$dflt $thisflag" ;;
6215                         esac
6216                         ;;
6217                 esac
6218         done
6219
6220         case "$dflt" in
6221         ''|' ') dflt='none' ;;
6222         esac
6223
6224     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6225     . ./myread
6226     case "$ans" in
6227     none) lddlflags=' ' ;;
6228     *) lddlflags="$ans" ;;
6229     esac
6230
6231         cat <<EOM
6232
6233 Some systems may require passing special flags to $cc to indicate that
6234 the resulting executable will use dynamic linking.  To use no flags,
6235 say "none".
6236
6237 EOM
6238     case "$ccdlflags" in
6239     '') case "$osname" in
6240                 hpux)   dflt='-Wl,-E' ;;
6241                 linux)  dflt='-rdynamic' ;;
6242                 next)   dflt='none' ;;
6243                 sunos)  dflt='none' ;;
6244                 *)      dflt='none' ;;
6245             esac ;;
6246     ' ')  dflt='none' ;;
6247     *)  dflt="$ccdlflags" ;;
6248     esac
6249     rp="Any special flags to pass to $cc to use dynamic linking?"
6250     . ./myread
6251     case "$ans" in
6252     none) ccdlflags=' ' ;;
6253     *) ccdlflags="$ans" ;;
6254     esac
6255     ;;
6256 *)  usedl="$undef"
6257         ld='ld'
6258     dlsrc='dl_none.xs'
6259     lddlflags=''
6260     ccdlflags=''
6261     ;;
6262 esac
6263
6264 also=''
6265 case "$usedl" in
6266 $undef)
6267         # No dynamic loading being used, so don't bother even to prompt.
6268         useshrplib='false'
6269         ;;
6270 *)      case "$useshrplib" in
6271         '')     case "$osname" in
6272                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6273                         dflt=y
6274                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6275                         ;;
6276                 next*)
6277                         case "$osvers" in
6278                         4*)     dflt=y
6279                                 also='Building a shared libperl is needed for MAB support.'
6280                                 ;;
6281                         *)      dflt=n
6282                                 ;;
6283                         esac
6284                         ;;
6285                 *)      dflt=n
6286                         ;;
6287                 esac
6288                 ;;
6289         $define|true|[Yy]*)
6290                 dflt=y
6291                 ;;
6292         *)      dflt=n
6293                 ;;
6294         esac
6295         $cat << EOM
6296
6297 The perl executable is normally obtained by linking perlmain.c with
6298 libperl${_a}, any static extensions (usually just DynaLoader), and
6299 any other libraries needed on this system (such as -lm, etc.).  Since
6300 your system supports dynamic loading, it is probably possible to build
6301 a shared libperl.$so.  If you will have more than one executable linked
6302 to libperl.$so, this will significantly reduce the size of each
6303 executable, but it may have a noticeable affect on performance.  The
6304 default is probably sensible for your system.
6305 $also
6306
6307 EOM
6308         rp="Build a shared libperl.$so (y/n)"
6309         . ./myread
6310         case "$ans" in
6311         true|$define|[Yy]*)
6312                 useshrplib='true'  ;;
6313         *)      useshrplib='false' ;;
6314         esac
6315         ;;
6316 esac
6317
6318 case "$useshrplib" in
6319 true)
6320         case "$libperl" in
6321         '')
6322                 # Figure out a good name for libperl.so.  Since it gets stored in
6323                 # a version-specific architecture-dependent library, the version
6324                 # number isn't really that important, except for making cc/ld happy.
6325                 #
6326                 # A name such as libperl.so.3.1
6327                 majmin="libperl.$so.$patchlevel.$subversion"
6328                 # A name such as libperl.so.301
6329                 majonly=`echo $patchlevel $subversion |
6330                         $awk '{printf "%d%02d", $1, $2}'`
6331                 majonly=libperl.$so.$majonly
6332                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6333                 # rely on figuring it out from the naming of libc.
6334                 case "${osname}${osvers}" in
6335                 next4*)
6336                         dflt=libperl.5.$so
6337                         # XXX How handle the --version stuff for MAB?
6338                         ;;
6339                 linux*)  # ld won't link with a bare -lperl otherwise.
6340                         dflt=libperl.$so
6341                         ;;
6342                 cygwin*) # include version
6343                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6344                         ;;
6345                 *)      # Try to guess based on whether libc has major.minor.
6346                         case "$libc" in
6347                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6348                         *libc.$so.[0-9]*) dflt=$majonly ;;
6349                         *)      dflt=libperl.$so ;;
6350                         esac
6351                         ;;
6352                 esac
6353                 ;;
6354         *)      dflt=$libperl
6355                 ;;
6356         esac
6357         cat << EOM
6358
6359 I need to select a good name for the shared libperl.  If your system uses
6360 library names with major and minor numbers, then you might want something
6361 like $majmin.  Alternatively, if your system uses a single version
6362 number for shared libraries, then you might want to use $majonly.
6363 Or, your system might be quite happy with a simple libperl.$so.
6364
6365 Since the shared libperl will get installed into a version-specific
6366 architecture-dependent directory, the version number of the shared perl
6367 library probably isn't important, so the default should be o.k.
6368
6369 EOM
6370         rp='What name do you want to give to the shared libperl?'
6371         . ./myread
6372         libperl=$ans
6373         echo "Ok, I'll use $libperl"
6374         ;;
6375 *)
6376         libperl="libperl${_a}"
6377         ;;
6378 esac
6379
6380 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6381 case "$shrpdir" in
6382 '') ;;
6383 *)      $cat >&4 <<EOM
6384 WARNING:  Use of the shrpdir variable for the installation location of
6385 the shared $libperl is not supported.  It was never documented and
6386 will not work in this version.  Let me (perlbug@perl.com)
6387 know of any problems this may cause.
6388
6389 EOM
6390         case "$shrpdir" in
6391         "$archlibexp/CORE")
6392                 $cat >&4 <<EOM
6393 But your current setting of $shrpdir is
6394 the default anyway, so it's harmless.
6395 EOM
6396                 ;;
6397         *)
6398                 $cat >&4 <<EOM
6399 Further, your current attempted setting of $shrpdir
6400 conflicts with the value of $archlibexp/CORE
6401 that installperl will use.
6402 EOM
6403                 ;;
6404         esac
6405         ;;
6406 esac
6407
6408 # How will the perl executable find the installed shared $libperl?
6409 # Add $xxx to ccdlflags.
6410 # If we can't figure out a command-line option, use $shrpenv to
6411 # set env LD_RUN_PATH.  The main perl makefile uses this.
6412 shrpdir=$archlibexp/CORE
6413 xxx=''
6414 tmp_shrpenv=''
6415 if "$useshrplib"; then
6416     case "$osname" in 
6417         aix)
6418                 # We'll set it in Makefile.SH...
6419                 ;;
6420         solaris|netbsd)
6421                 xxx="-R $shrpdir"
6422                 ;;
6423         freebsd)
6424                 xxx="-Wl,-R$shrpdir"
6425                 ;;
6426         linux|irix*|dec_osf)
6427                 xxx="-Wl,-rpath,$shrpdir"
6428                 ;;
6429         next)
6430                 # next doesn't like the default...
6431                 ;;
6432         beos)
6433                 # beos doesn't like the default, either.
6434                 ;;
6435         hpux*)
6436                 # hpux doesn't like the default, either.
6437                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6438                 ;;
6439         *)
6440                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6441                 ;;
6442         esac
6443         case "$xxx" in
6444         '') ;;
6445         *)      
6446                 # Only add $xxx if it isn't already in ccdlflags.
6447                 case " $ccdlflags " in
6448                 *" $xxx "*)     ;;
6449                 *)      ccdlflags="$ccdlflags $xxx"
6450                         cat <<EOM >&4
6451
6452 Adding $xxx to the flags
6453 passed to $ld so that the perl executable will find the 
6454 installed shared $libperl.
6455
6456 EOM
6457                         ;;
6458                 esac
6459                 ;;
6460         esac
6461 fi
6462 # Fix ccdlflags in AIX for building external extensions.
6463 # (For building Perl itself bare -bE:perl.exp is needed,
6464 #  Makefile.SH takes care of this.)
6465 case "$osname" in
6466 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6467 esac
6468 # Respect a hint or command-line value.
6469 case "$shrpenv" in
6470 '') shrpenv="$tmp_shrpenv" ;;
6471 esac
6472 case "$ldlibpthname" in
6473 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6474 none)   ldlibpthname='' ;;
6475 esac
6476
6477 : determine where manual pages go
6478 set man1dir man1dir none
6479 eval $prefixit
6480 $cat <<EOM
6481
6482 $spackage has manual pages available in source form.
6483 EOM
6484 case "$nroff" in
6485 nroff)
6486         echo "However, you don't have nroff, so they're probably useless to you."
6487         case "$man1dir" in
6488         '') man1dir="none";;
6489         esac;;
6490 esac
6491 echo "If you don't want the manual sources installed, answer 'none'."
6492 case "$man1dir" in
6493 ' ') dflt=none
6494         ;;
6495 '')
6496         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6497         lookpath="$lookpath $prefixexp/man/p_man/man1"
6498         lookpath="$lookpath $prefixexp/man/u_man/man1"
6499         lookpath="$lookpath $prefixexp/man/man.1"
6500         case "$sysman" in
6501         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6502         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6503         esac
6504         set dflt
6505         eval $prefixup
6506         ;;
6507 *)  dflt="$man1dir"
6508         ;;
6509 esac
6510 echo " "
6511 fn=dn+~
6512 rp="Where do the main $spackage manual pages (source) go?"
6513 . ./getfile
6514 if $test "X$man1direxp" != "X$ansexp"; then
6515         installman1dir=''
6516 fi
6517 man1dir="$ans"
6518 man1direxp="$ansexp"
6519 case "$man1dir" in
6520 '')     man1dir=' '
6521         installman1dir='';;
6522 esac
6523
6524 : Change installation prefix, if necessary.
6525 if $test X"$prefix" != X"$installprefix"; then
6526         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6527 else
6528         installman1dir="$man1direxp"
6529 fi
6530
6531 : What suffix to use on installed man pages
6532
6533 case "$man1dir" in
6534 ' ')
6535         man1ext='0'
6536         ;;
6537 *)
6538         rp="What suffix should be used for the main $spackage man pages?"
6539         case "$man1ext" in
6540         '')     case "$man1dir" in
6541                 *1)  dflt=1 ;;
6542                 *1p) dflt=1p ;;
6543                 *1pm) dflt=1pm ;;
6544                 *l) dflt=l;;
6545                 *n) dflt=n;;
6546                 *o) dflt=o;;
6547                 *p) dflt=p;;
6548                 *C) dflt=C;;
6549                 *L) dflt=L;;
6550                 *L1) dflt=L1;;
6551                 *) dflt=1;;
6552                 esac
6553                 ;;
6554         *)      dflt="$man1ext";;
6555         esac
6556         . ./myread
6557         man1ext="$ans"
6558         ;;
6559 esac
6560
6561 : see if we can have long filenames
6562 echo " "
6563 rmlist="$rmlist /tmp/cf$$"
6564 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6565 first=123456789abcdef
6566 second=/tmp/cf$$/$first
6567 $rm -f $first $second
6568 if (echo hi >$first) 2>/dev/null; then
6569         if $test -f 123456789abcde; then
6570                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6571                 val="$undef"
6572         else
6573                 if (echo hi >$second) 2>/dev/null; then
6574                         if $test -f /tmp/cf$$/123456789abcde; then
6575                                 $cat <<'EOM'
6576 That's peculiar... You can have filenames longer than 14 characters, but only
6577 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6578 I shall consider your system cannot support long filenames at all.
6579 EOM
6580                                 val="$undef"
6581                         else
6582                                 echo 'You can have filenames longer than 14 characters.' >&4
6583                                 val="$define"
6584                         fi
6585                 else
6586                         $cat <<'EOM'
6587 How confusing! Some of your filesystems are sane enough to allow filenames
6588 longer than 14 characters but some others like /tmp can't even think about them.
6589 So, for now on, I shall assume your kernel does not allow them at all.
6590 EOM
6591                         val="$undef"
6592                 fi
6593         fi
6594 else
6595         $cat <<'EOM'
6596 You can't have filenames longer than 14 chars.  You can't even think about them!
6597 EOM
6598         val="$undef"
6599 fi 
6600 set d_flexfnam
6601 eval $setvar
6602 $rm -rf /tmp/cf$$ 123456789abcde*
6603
6604 : determine where library module manual pages go
6605 set man3dir man3dir none
6606 eval $prefixit
6607 $cat <<EOM
6608
6609 $spackage has manual pages for many of the library modules.
6610 EOM
6611
6612 case "$nroff" in
6613 nroff)
6614         $cat <<'EOM'
6615 However, you don't have nroff, so they're probably useless to you.
6616 EOM
6617         case "$man3dir" in
6618         '') man3dir="none";;
6619         esac;;
6620 esac
6621
6622 case "$d_flexfnam" in
6623 undef)
6624         $cat <<'EOM'
6625 However, your system can't handle the long file names like File::Basename.3. 
6626 EOM
6627         case "$man3dir" in
6628         '') man3dir="none";;
6629         esac;;
6630 esac
6631
6632 echo "If you don't want the manual sources installed, answer 'none'."
6633 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6634 case "$man3dir" in
6635 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6636         if $test -d "$privlib/man/man3"; then
6637                 cat <<EOM >&4
6638
6639 WARNING:  Previous versions of perl installed man3 pages into
6640 $privlib/man/man3.  This version will suggest a 
6641 new default of $dflt.  
6642 EOM
6643                 tdflt=$dflt
6644                 dflt='n'
6645                 rp='Do you wish to preserve the old behavior?(y/n)'
6646                 . ./myread
6647                 case "$ans" in
6648                 y*) dflt="$privlib/man/man3" ;;
6649                 *)  dflt=$tdflt ;;
6650                 esac
6651     fi
6652         ;;
6653 ' ') dflt=none;;
6654 *)      dflt="$man3dir" ;;
6655 esac
6656 echo " "
6657 fn=dn+~
6658 rp="Where do the $package library man pages (source) go?"
6659 . ./getfile
6660 man3dir="$ans"
6661 man3direxp="$ansexp"
6662 case "$man1dir" in
6663 '')     man3dir=' '
6664         installman3dir='';;
6665 esac
6666
6667 : Change installation prefix, if necessary.
6668 if $test X"$prefix" != X"$installprefix"; then
6669         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6670 else
6671         installman3dir="$man3direxp"
6672 fi
6673
6674 : What suffix to use on installed man pages
6675 case "$man3dir" in
6676 ' ')
6677         man3ext='0'
6678         ;;
6679 *)
6680         rp="What suffix should be used for the $package library man pages?"
6681         case "$man3ext" in
6682         '')     case "$man3dir" in
6683                 *3)  dflt=3 ;;
6684                 *3p) dflt=3p ;;
6685                 *3pm) dflt=3pm ;;
6686                 *l) dflt=l;;
6687                 *n) dflt=n;;
6688                 *o) dflt=o;;
6689                 *p) dflt=p;;
6690                 *C) dflt=C;;
6691                 *L) dflt=L;;
6692                 *L3) dflt=L3;;
6693                 *) dflt=3;;
6694                 esac
6695                 ;;
6696         *)      dflt="$man3ext";;
6697         esac
6698         . ./myread
6699         man3ext="$ans"
6700         ;;
6701 esac
6702
6703 : see if we have to deal with yellow pages, now NIS.
6704 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6705         if $test -f /usr/etc/nibindd; then
6706                 echo " "
6707                 echo "I'm fairly confident you're on a NeXT."
6708                 echo " "
6709                 rp='Do you get the hosts file via NetInfo?'
6710                 dflt=y
6711                 case "$hostcat" in
6712                 nidump*) ;;
6713                 '') ;;
6714                 *) dflt=n;;
6715                 esac
6716                 . ./myread
6717                 case "$ans" in
6718                 y*) hostcat='nidump hosts .';;
6719                 *)      case "$hostcat" in
6720                         nidump*) hostcat='';;
6721                         esac
6722                         ;;
6723                 esac
6724         fi
6725         case "$hostcat" in
6726         nidump*) ;;
6727         *)
6728                 case "$hostcat" in
6729                 *ypcat*) dflt=y;;
6730                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6731                                 dflt=y
6732                         else
6733                                 dflt=n
6734                         fi;;
6735                 *) dflt=n;;
6736                 esac
6737                 echo " "
6738                 rp='Are you getting the hosts file via yellow pages?'
6739                 . ./myread
6740                 case "$ans" in
6741                 y*) hostcat='ypcat hosts';;
6742                 *) hostcat='cat /etc/hosts';;
6743                 esac
6744                 ;;
6745         esac
6746 fi
6747 case "$hostcat" in
6748 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6749 esac
6750 case "$groupcat" in
6751 '') test -f /etc/group && groupcat='cat /etc/group';;
6752 esac
6753 case "$passcat" in
6754 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6755 esac
6756
6757 : now get the host name
6758 echo " "
6759 echo "Figuring out host name..." >&4
6760 case "$myhostname" in
6761 '') cont=true
6762         echo 'Maybe "hostname" will work...'
6763         if tans=`sh -c hostname 2>&1` ; then
6764                 myhostname=$tans
6765                 phostname=hostname
6766                 cont=''
6767         fi
6768         ;;
6769 *) cont='';;
6770 esac
6771 if $test "$cont"; then
6772         if ./xenix; then
6773                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6774                 if tans=`cat /etc/systemid 2>&1` ; then
6775                         myhostname=$tans
6776                         phostname='cat /etc/systemid'
6777                         echo "Whadyaknow.  Xenix always was a bit strange..."
6778                         cont=''
6779                 fi
6780         elif $test -r /etc/systemid; then
6781                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6782         fi
6783 fi
6784 if $test "$cont"; then
6785         echo 'No, maybe "uuname -l" will work...'
6786         if tans=`sh -c 'uuname -l' 2>&1` ; then
6787                 myhostname=$tans
6788                 phostname='uuname -l'
6789         else
6790                 echo 'Strange.  Maybe "uname -n" will work...'
6791                 if tans=`sh -c 'uname -n' 2>&1` ; then
6792                         myhostname=$tans
6793                         phostname='uname -n'
6794                 else
6795                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6796                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6797                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6798                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6799                         else
6800                                 case "$myhostname" in
6801                                 '') echo "Does this machine have an identity crisis or something?"
6802                                         phostname='';;
6803                                 *)
6804                                         echo "Well, you said $myhostname before..."
6805                                         phostname='echo $myhostname';;
6806                                 esac
6807                         fi
6808                 fi
6809         fi
6810 fi
6811 : you do not want to know about this
6812 set $myhostname
6813 myhostname=$1
6814
6815 : verify guess
6816 if $test "$myhostname" ; then
6817         dflt=y
6818         rp='Your host name appears to be "'$myhostname'".'" Right?"
6819         . ./myread
6820         case "$ans" in
6821         y*) ;;
6822         *) myhostname='';;
6823         esac
6824 fi
6825
6826 : bad guess or no guess
6827 while $test "X$myhostname" = X ; do
6828         dflt=''
6829         rp="Please type the (one word) name of your host:"
6830         . ./myread
6831         myhostname="$ans"
6832 done
6833
6834 : translate upper to lower if necessary
6835 case "$myhostname" in
6836 *[A-Z]*)
6837         echo "(Normalizing case in your host name)"
6838         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6839         ;;
6840 esac
6841
6842 case "$myhostname" in
6843 *.*)
6844         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6845         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6846         echo "(Trimming domain name from host name--host name is now $myhostname)"
6847         ;;
6848 *) case "$mydomain" in
6849         '')
6850                 {
6851                         test "X$hostcat" = "Xypcat hosts" &&
6852                         ypmatch "$myhostname" hosts 2>/dev/null |\
6853                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6854                         $test -s hosts
6855                 } || {
6856                         test "X$hostcat" != "X" &&
6857                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6858                                         /[       ]$myhostname[  . ]/p" > hosts
6859                 }
6860                 tmp_re="[       . ]"
6861                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6862                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6863                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6864                         hosts | $sort | $uniq | \
6865                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6866                 case `$echo X$dflt` in
6867                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6868                         dflt=.
6869                         ;;
6870                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6871                         ;;
6872                 esac
6873                 case "$dflt" in
6874                 .)
6875                         tans=`./loc resolv.conf X /etc /usr/etc`
6876                         if $test -f "$tans"; then
6877                                 echo "(Attempting domain name extraction from $tans)"
6878                                 dflt=.`$sed -n -e 's/   / /g' \
6879                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6880                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6881                                 case "$dflt" in
6882                                 .) dflt=.`$sed -n -e 's/        / /g' \
6883                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6884                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6885                                         ;;
6886                                 esac
6887                         fi
6888                         ;;
6889                 esac
6890                 case "$dflt" in
6891                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6892                         dflt=.`sh -c domainname 2>/dev/null`
6893                         case "$dflt" in
6894                         '') dflt='.';;
6895                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6896                         esac
6897                         ;;
6898                 esac
6899                 case "$dflt" in
6900                 .) echo "(Lost all hope -- silly guess then)"
6901                         dflt='.uucp'
6902                         ;;
6903                 esac
6904                 $rm -f hosts
6905                 ;;
6906         *) dflt="$mydomain";;
6907         esac;;
6908 esac
6909 echo " "
6910 rp="What is your domain name?"
6911 . ./myread
6912 tans="$ans"
6913 case "$ans" in
6914 '') ;;
6915 .*) ;;
6916 *) tans=".$tans";;
6917 esac
6918 mydomain="$tans"
6919
6920 : translate upper to lower if necessary
6921 case "$mydomain" in
6922 *[A-Z]*)
6923         echo "(Normalizing case in your domain name)"
6924         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6925         ;;
6926 esac
6927
6928 : a little sanity check here
6929 case "$phostname" in
6930 '') ;;
6931 *)
6932         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6933         $myhostname$mydomain|$myhostname) ;;
6934         *)
6935                 case "$phostname" in
6936                 sed*)
6937                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6938                         ;;
6939                 *)
6940                         echo "(That doesn't agree with your $phostname command, by the way.)"
6941                         ;;
6942                 esac
6943         ;;
6944         esac
6945         ;;
6946 esac
6947
6948 $cat <<EOM
6949
6950 I need to get your e-mail address in Internet format if possible, i.e.
6951 something like user@host.domain. Please answer accurately since I have
6952 no easy means to double check it. The default value provided below
6953 is most probably close to reality but may not be valid from outside
6954 your organization...
6955
6956 EOM
6957 cont=x
6958 while test "$cont"; do
6959         case "$cf_email" in
6960         '') dflt="$cf_by@$myhostname$mydomain";;
6961         *) dflt="$cf_email";;
6962         esac
6963         rp='What is your e-mail address?'
6964         . ./myread
6965         cf_email="$ans"
6966         case "$cf_email" in
6967         *@*.*) cont='' ;;
6968         *)
6969                 rp='Address does not look like an Internet one.  Use it anyway?'
6970                 case "$fastread" in
6971                 yes) dflt=y ;;
6972                 *) dflt=n ;;
6973                 esac
6974                 . ./myread
6975                 case "$ans" in
6976                 y*) cont='' ;;
6977                 *) echo " " ;;
6978                 esac
6979                 ;;
6980         esac
6981 done
6982
6983 $cat <<EOM
6984
6985 If you or somebody else will be maintaining perl at your site, please
6986 fill in the correct e-mail address here so that they may be contacted
6987 if necessary. Currently, the "perlbug" program included with perl
6988 will send mail to this address in addition to perlbug@perl.com. You may
6989 enter "none" for no administrator.
6990
6991 EOM
6992 case "$perladmin" in
6993 '') dflt="$cf_email";;
6994 *) dflt="$perladmin";;
6995 esac
6996 rp='Perl administrator e-mail address'
6997 . ./myread
6998 perladmin="$ans"
6999
7000 : figure out how to guarantee perl startup
7001 case "$startperl" in
7002 '')
7003         case "$sharpbang" in
7004         *!)
7005                 $cat <<EOH
7006
7007 I can use the #! construct to start perl on your system. This will
7008 make startup of perl scripts faster, but may cause problems if you
7009 want to share those scripts and perl is not in a standard place
7010 ($binexp/perl) on all your platforms. The alternative is to force
7011 a shell by starting the script with a single ':' character.
7012
7013 EOH
7014                 dflt="$binexp/perl"
7015                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7016                 . ./myread
7017                 case "$ans" in
7018                 none)   startperl=": # use perl";;
7019                 *)      startperl="#!$ans"
7020                         if $test 30 -lt `echo "$ans" | wc -c`; then
7021                                 $cat >&4 <<EOM
7022
7023 WARNING:  Some systems limit the #! command to 32 characters.
7024 If you experience difficulty running Perl scripts with #!, try
7025 installing Perl in a directory with a shorter pathname.
7026
7027 EOM
7028                         fi ;;
7029                 esac
7030                 ;;
7031         *) startperl=": # use perl"
7032                 ;;
7033         esac
7034         ;;
7035 esac
7036 echo "I'll use $startperl to start perl scripts."
7037
7038 : figure best path for perl in scripts
7039 case "$perlpath" in
7040 '')
7041         perlpath="$binexp/perl"
7042         case "$startperl" in
7043         *!*) ;;
7044         *)
7045                 $cat <<EOH
7046
7047 I will use the "eval 'exec'" idiom to start Perl on your system.
7048 I can use the full path of your Perl binary for this purpose, but
7049 doing so may cause problems if you want to share those scripts and
7050 Perl is not always in a standard place ($binexp/perl).
7051
7052 EOH
7053                 dflt="$binexp/perl"
7054                 rp="What path shall I use in \"eval 'exec'\"?"
7055                 . ./myread
7056                 perlpath="$ans"
7057                 ;;
7058         esac
7059         ;;
7060 esac
7061 case "$startperl" in
7062 *!*)    ;;
7063 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7064 esac
7065
7066 : determine where public executable scripts go
7067 set scriptdir scriptdir
7068 eval $prefixit
7069 case "$scriptdir" in
7070 '')
7071         dflt="$bin"
7072         : guess some guesses
7073         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7074         $test -d /usr/share/bin     && dflt=/usr/share/bin
7075         $test -d /usr/local/script  && dflt=/usr/local/script
7076         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7077         $test -d $prefixexp/script  && dflt=$prefixexp/script
7078         set dflt
7079         eval $prefixup
7080         ;;
7081 *)  dflt="$scriptdir"
7082         ;;
7083 esac
7084 $cat <<EOM
7085  
7086 Some installations have a separate directory just for executable scripts so
7087 that they can mount it across multiple architectures but keep the scripts in
7088 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7089 Or you might just lump your scripts in with all your other executables.
7090  
7091 EOM
7092 fn=d~
7093 rp='Where do you keep publicly executable scripts?'
7094 . ./getfile
7095 if $test "X$ansexp" != "X$scriptdirexp"; then
7096         installscript=''
7097 fi
7098 scriptdir="$ans"
7099 scriptdirexp="$ansexp"
7100 : Change installation prefix, if necessary.
7101 if $test X"$prefix" != X"$installprefix"; then
7102         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7103 else
7104         installscript="$scriptdirexp"
7105 fi
7106
7107 : determine where site specific architecture-dependent libraries go.
7108 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7109 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7110 : sitelib may have an optional trailing /share.
7111 case "$sitearch" in
7112 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7113         dflt="$dflt/$archname"
7114         ;;
7115 *)      dflt="$sitearch"
7116         ;;
7117 esac
7118 set sitearch sitearch none
7119 eval $prefixit
7120 $cat <<EOM
7121
7122 The installation process will also create a directory for
7123 architecture-dependent site-specific extensions and modules.
7124
7125 EOM
7126 fn=d~+
7127 rp='Pathname for the site-specific architecture-dependent library files?'
7128 . ./getfile
7129 sitearch="$ans"
7130 sitearchexp="$ansexp"
7131 : Change installation prefix, if necessary.
7132 if $test X"$prefix" != X"$installprefix"; then
7133         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7134 else
7135         installsitearch="$sitearchexp"
7136 fi
7137
7138 : determine where add-on public executables go
7139 case "$sitebin" in
7140 '')     dflt=$siteprefix/bin ;;
7141 *)      dflt=$sitebin ;;
7142 esac
7143 fn=d~
7144 rp='Pathname where the add-on public executables should be installed?'
7145 . ./getfile
7146 sitebin="$ans"
7147 sitebinexp="$ansexp"
7148 : Change installation prefix, if necessary.
7149 if $test X"$prefix" != X"$installprefix"; then
7150         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7151 else
7152         installsitebin="$sitebinexp"
7153 fi
7154
7155 : see if sqrtl exists
7156 set sqrtl d_sqrtl
7157 eval $inlibc
7158
7159 case "$ccflags" in
7160 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7161 esac
7162
7163 case "$uselongdouble" in
7164 $define|true|[yY]*)     dflt='y';;
7165 *) dflt='n';;
7166 esac
7167 cat <<EOM
7168
7169 Perl can be built to take advantage of long doubles which
7170 (if available) may give more accuracy and range for floating point numbers.
7171
7172 If this doesn't make any sense to you, just accept the default '$dflt'.
7173 EOM
7174 rp='Try to use long doubles if available?'
7175 . ./myread
7176 case "$ans" in
7177 y|Y)    val="$define"   ;;
7178 *)      val="$undef"    ;;
7179 esac
7180 set uselongdouble
7181 eval $setvar
7182
7183 case "$uselongdouble" in
7184 true|[yY]*) uselongdouble="$define" ;;
7185 esac
7186
7187 case "$uselongdouble" in
7188 $define)
7189 : Look for a hint-file generated 'call-back-unit'.  If the
7190 : user has specified that long doubles should be used,
7191 : we may need to set or change some other defaults.
7192         if $test -f uselongdouble.cbu; then
7193                 echo "Your platform has some specific hints for long doubles, using them..."
7194                 . ./uselongdouble.cbu
7195         else
7196                 $cat <<EOM
7197 (Your platform doesn't have any specific hints for long doubles.)
7198 EOM
7199         fi
7200         ;;
7201 esac
7202
7203 case "$uselongdouble:$d_sqrtl" in
7204 $define:$undef)
7205                 $cat <<EOM >&4
7206
7207 You requested the use of long doubles but you do not seem to have
7208 the mathematic functions for long doubles.  I'm disabling the use
7209 of long doubles.
7210 EOM
7211         uselongdouble=$undef
7212         ;;
7213 esac
7214
7215 case "$useperlio" in
7216 $define|true|[yY]*)     dflt='y';;
7217 *) dflt='n';;
7218 esac
7219 cat <<EOM
7220
7221 Previous version of $package used the standard IO mechanisms as defined
7222 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7223 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7224 the default.  This abstraction layer can use AT&T's sfio (if you already
7225 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7226 problems with some extension modules.  Using PerlIO with stdio is safe,
7227 but it is slower than plain stdio and therefore is not the default.
7228
7229 If this doesn't make any sense to you, just accept the default '$dflt'.
7230 EOM
7231 rp='Use the experimental PerlIO abstraction layer?'
7232 . ./myread
7233 case "$ans" in
7234 y|Y) 
7235         val="$define"
7236         ;;     
7237 *)      
7238         echo "Ok, doing things the stdio way"
7239         val="$undef"
7240         ;;
7241 esac
7242 set useperlio
7243 eval $setvar 
7244
7245 case "$vendorprefix" in
7246 '')     d_vendorbin="$undef"
7247         vendorbin=''
7248         vendorbinexp=''
7249         ;;
7250 *)      d_vendorbin="$define"
7251         : determine where vendor-supplied executables go.
7252         case "$vendorbin" in
7253         '') dflt=$vendorprefix/bin ;;
7254         *)      dflt="$vendorbin" ;;
7255         esac
7256         fn=d~+
7257         rp='Pathname for the vendor-supplied executables directory?'
7258         . ./getfile
7259         vendorbin="$ans"
7260         vendorbinexp="$ansexp"
7261         ;;
7262 esac
7263 : Change installation prefix, if necessary.
7264 if $test X"$prefix" != X"$installprefix"; then
7265         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7266 else
7267         installvendorbin="$vendorbinexp"
7268 fi
7269
7270 : check for length of double
7271 echo " "
7272 case "$doublesize" in
7273 '')
7274         echo "Checking to see how big your double precision numbers are..." >&4
7275         $cat >try.c <<'EOCP'
7276 #include <stdio.h>
7277 int main()
7278 {
7279     printf("%d\n", (int)sizeof(double));
7280     exit(0);
7281 }
7282 EOCP
7283         set try
7284         if eval $compile_ok; then
7285                 doublesize=`./try`
7286                 echo "Your double is $doublesize bytes long."
7287         else
7288                 dflt='8'
7289                 echo "(I can't seem to compile the test program.  Guessing...)"
7290                 rp="What is the size of a double precision number (in bytes)?"
7291                 . ./myread
7292                 doublesize="$ans"
7293         fi
7294         ;;
7295 esac
7296 $rm -f try.c try
7297
7298 : check for long doubles
7299 echo " "
7300 echo "Checking to see if you have long double..." >&4
7301 echo 'int main() { long double x = 7.0; }' > try.c
7302 set try
7303 if eval $compile; then
7304         val="$define"
7305         echo "You have long double."
7306 else
7307         val="$undef"
7308         echo "You do not have long double."
7309 fi
7310 $rm try.*
7311 set d_longdbl
7312 eval $setvar
7313
7314 : check for length of long double
7315 case "${d_longdbl}${longdblsize}" in
7316 $define)
7317         echo " "
7318         echo "Checking to see how big your long doubles are..." >&4
7319         $cat >try.c <<'EOCP'
7320 #include <stdio.h>
7321 int main()
7322 {
7323         printf("%d\n", sizeof(long double));
7324 }
7325 EOCP
7326         set try
7327         set try
7328         if eval $compile; then
7329                 longdblsize=`./try$exe_ext`
7330                 echo "Your long doubles are $longdblsize bytes long."
7331         else
7332                 dflt='8'
7333                 echo " "
7334                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7335                 rp="What is the size of a long double (in bytes)?"
7336                 . ./myread
7337                 longdblsize="$ans"
7338         fi
7339         if $test "X$doublesize" = "X$longdblsize"; then
7340                 echo "(That isn't any different from an ordinary double.)"
7341         fi      
7342         ;;
7343 esac
7344 $rm -f try.* try
7345
7346 : Check how to convert floats to strings.
7347 if test "X$d_Gconvert" = X; then
7348         echo " "
7349         echo "Checking for an efficient way to convert floats to strings."
7350         $cat >try.c <<EOP
7351 #ifdef TRY_gconvert
7352 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7353 char *myname = "gconvert";
7354 #endif
7355 #ifdef TRY_gcvt
7356 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7357 char *myname = "gcvt";
7358 #endif
7359 #ifdef TRY_qgcvt
7360 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7361 char *myname = "qgcvt";
7362 #define DOUBLETYPE long double
7363 #endif
7364 #ifdef TRY_sprintf
7365 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7366 char *myname = "sprintf";
7367 #endif
7368
7369 #ifndef DOUBLETYPE
7370 #define DOUBLETYPE double
7371 #endif
7372
7373 #include <stdio.h>
7374
7375 #define I_STDLIB $i_stdlib
7376 #ifdef I_STDLIB
7377 #include <stdlib.h>
7378 #endif
7379
7380 int
7381 checkit(expect, got)
7382 char *expect;
7383 char *got;
7384 {
7385     if (strcmp(expect, got)) {
7386                 printf("%s oddity:  Expected %s, got %s\n",
7387                         myname, expect, got);
7388                 exit(1);
7389         }
7390 }
7391
7392 int main()
7393
7394         char buf[64]; 
7395         buf[63] = '\0';
7396
7397         /* This must be 1st test on (which?) platform */
7398         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7399         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7400         checkit("0.1", buf);
7401
7402         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7403         checkit("1", buf);
7404
7405         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7406         checkit("0", buf);
7407
7408         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7409         checkit("-1", buf);
7410
7411         /* Some Linux gcvt's give 1.e+5 here. */
7412         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7413         checkit("100000", buf);
7414         
7415         /* Some Linux gcvt's give -1.e+5 here. */
7416         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7417         checkit("-100000", buf);
7418
7419         exit(0);
7420 }
7421 EOP
7422         case "$d_Gconvert" in
7423         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7424         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7425         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7426         *) xxx_list='gconvert gcvt sprintf' ;;
7427         esac
7428
7429         case "$d_longdbl$uselongdouble" in
7430         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7431         esac
7432
7433         for xxx_convert in $xxx_list; do
7434                 echo "Trying $xxx_convert..."
7435                 $rm -f try try$_o
7436                 set try -DTRY_$xxx_convert
7437                 if eval $compile; then
7438                         echo "$xxx_convert() found." >&4
7439                         if ./try; then
7440                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7441                                 break;
7442                         else
7443                                 echo "...But $xxx_convert didn't work as I expected."
7444                         fi
7445                 else
7446                         echo "$xxx_convert NOT found." >&4
7447                 fi
7448         done
7449                 
7450         case "$xxx_convert" in
7451         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7452         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7453         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7454         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7455         esac
7456 fi
7457
7458 echo " "
7459
7460 if $test X"$d_longdbl" = X"$define"; then
7461
7462 echo "Checking how to print long doubles..." >&4
7463
7464 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7465         $cat >try.c <<'EOCP'
7466 #include <sys/types.h>
7467 #include <stdio.h>
7468 int main() {
7469   double d = 123.456;
7470   printf("%.3f\n", d);
7471 }
7472 EOCP
7473         set try
7474         if eval $compile; then
7475                 yyy=`./try$exe_ext`
7476                 case "$yyy" in
7477                 123.456)
7478                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7479                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7480                         echo "We will use %f."
7481                         ;;
7482                 esac
7483         fi
7484 fi
7485
7486 if $test X"$sPRIfldbl" = X; then
7487         $cat >try.c <<'EOCP'
7488 #include <sys/types.h>
7489 #include <stdio.h>
7490 int main() {
7491   long double d = 123.456;
7492   printf("%.3llf\n", d);
7493 }
7494 EOCP
7495         set try
7496         if eval $compile; then
7497                 yyy=`./try$exe_ext`
7498                 case "$yyy" in
7499                 123.456)
7500                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7501                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7502                         echo "We will use %llf."
7503                         ;;
7504                 esac
7505         fi
7506 fi
7507
7508 if $test X"$sPRIfldbl" = X; then
7509         $cat >try.c <<'EOCP'
7510 #include <sys/types.h>
7511 #include <stdio.h>
7512 int main() {
7513   long double d = 123.456;
7514   printf("%.3Lf\n", d);
7515 }
7516 EOCP
7517         set try
7518         if eval $compile; then
7519                 yyy=`./try$exe_ext`
7520                 case "$yyy" in
7521                 123.456)
7522                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7523                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7524                         echo "We will use %Lf."
7525                         ;;
7526                 esac
7527         fi
7528 fi
7529
7530 if $test X"$sPRIfldbl" = X; then
7531         $cat >try.c <<'EOCP'
7532 #include <sys/types.h>
7533 #include <stdio.h>
7534 int main() {
7535   long double d = 123.456;
7536   printf("%.3lf\n", d);
7537 }
7538 EOCP
7539         set try
7540         if eval $compile; then
7541                 yyy=`./try$exe_ext`
7542                 case "$yyy" in
7543                 123.456)
7544                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7545                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7546                         echo "We will use %lf."
7547                         ;;
7548                 esac
7549         fi
7550 fi
7551
7552 if $test X"$sPRIfldbl" = X; then
7553         echo "Cannot figure out how to print long doubles." >&4
7554 fi
7555
7556 $rm -f try try.*
7557
7558 fi # d_longdbl
7559
7560 case "$sPRIfldbl" in
7561 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7562         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7563         ;;
7564 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7565         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7566         ;;
7567 esac
7568
7569 : Initialize h_fcntl
7570 h_fcntl=false
7571
7572 : Initialize h_sysfile
7573 h_sysfile=false
7574
7575 : access call always available on UNIX
7576 set access d_access
7577 eval $inlibc
7578
7579 : locate the flags for 'access()'
7580 case "$d_access" in
7581 "$define")
7582         echo " "
7583         $cat >access.c <<'EOCP'
7584 #include <sys/types.h>
7585 #ifdef I_FCNTL
7586 #include <fcntl.h>
7587 #endif
7588 #ifdef I_SYS_FILE
7589 #include <sys/file.h>
7590 #endif
7591 #ifdef I_UNISTD
7592 #include <unistd.h>
7593 #endif
7594 int main() {
7595         exit(R_OK);
7596 }
7597 EOCP
7598         : check sys/file.h first, no particular reason here
7599         if $test `./findhdr sys/file.h` && \
7600                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7601                 h_sysfile=true;
7602                 echo "<sys/file.h> defines the *_OK access constants." >&4
7603         elif $test `./findhdr fcntl.h` && \
7604                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7605                 h_fcntl=true;
7606                 echo "<fcntl.h> defines the *_OK access constants." >&4
7607         elif $test `./findhdr unistd.h` && \
7608                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7609                 echo "<unistd.h> defines the *_OK access constants." >&4
7610         else
7611                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7612         fi
7613         ;;
7614 esac
7615 $rm -f access*
7616
7617 : see if accessx exists
7618 set accessx d_accessx
7619 eval $inlibc
7620
7621 : see if alarm exists
7622 set alarm d_alarm
7623 eval $inlibc
7624
7625 : see if atolf exists
7626 set atolf d_atolf
7627 eval $inlibc
7628
7629 : see if atoll exists
7630 set atoll d_atoll
7631 eval $inlibc
7632
7633 : Look for GNU-cc style attribute checking
7634 echo " "
7635 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7636 $cat >attrib.c <<'EOCP'
7637 #include <stdio.h>
7638 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7639 EOCP
7640 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7641         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7642                 echo "Your C compiler doesn't fully support __attribute__."
7643                 val="$undef"
7644         else
7645                 echo "Your C compiler supports __attribute__."
7646                 val="$define"
7647         fi
7648 else
7649         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7650         val="$undef"
7651 fi
7652 set d_attribut
7653 eval $setvar
7654 $rm -f attrib*
7655
7656 : see if bcmp exists
7657 set bcmp d_bcmp
7658 eval $inlibc
7659
7660 : see if bcopy exists
7661 set bcopy d_bcopy
7662 eval $inlibc
7663
7664 : see if this is a unistd.h system
7665 set unistd.h i_unistd
7666 eval $inhdr
7667
7668 : see if getpgrp exists
7669 set getpgrp d_getpgrp
7670 eval $inlibc
7671
7672 case "$d_getpgrp" in
7673 "$define")
7674         echo " "
7675         echo "Checking to see which flavor of getpgrp is in use..."
7676         $cat >set.c <<EOP
7677 #$i_unistd I_UNISTD
7678 #include <sys/types.h>
7679 #ifdef I_UNISTD
7680 #  include <unistd.h>
7681 #endif
7682 int main()
7683 {
7684         if (getuid() == 0) {
7685                 printf("(I see you are running Configure as super-user...)\n");
7686                 setuid(1);
7687         }
7688 #ifdef TRY_BSD_PGRP
7689         if (getpgrp(1) == 0)
7690                 exit(0);
7691 #else
7692         if (getpgrp() > 0)
7693                 exit(0);
7694 #endif
7695         exit(1);
7696 }
7697 EOP
7698         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7699                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7700                 val="$define"
7701         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7702                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7703                 val="$undef"
7704         else
7705                 echo "I can't seem to compile and run the test program."
7706                 if ./usg; then
7707                         xxx="a USG one, i.e. you use getpgrp()."
7708                 else
7709                         # SVR4 systems can appear rather BSD-ish.
7710                         case "$i_unistd" in
7711                         $undef)
7712                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7713                                 val="$define"
7714                                 ;;
7715                         $define)
7716                                 xxx="probably a USG one, i.e. you use getpgrp()."
7717                                 val="$undef"
7718                                 ;;
7719                         esac
7720                 fi
7721                 echo "Assuming your getpgrp is $xxx" >&4
7722         fi
7723         ;;
7724 *) val="$undef";;
7725 esac
7726 set d_bsdgetpgrp
7727 eval $setvar
7728 $rm -f set set.c
7729
7730 : see if setpgrp exists
7731 set setpgrp d_setpgrp
7732 eval $inlibc
7733
7734 case "$d_setpgrp" in
7735 "$define")
7736         echo " "
7737         echo "Checking to see which flavor of setpgrp is in use..."
7738         $cat >set.c <<EOP
7739 #$i_unistd I_UNISTD
7740 #include <sys/types.h>
7741 #ifdef I_UNISTD
7742 #  include <unistd.h>
7743 #endif
7744 int main()
7745 {
7746         if (getuid() == 0) {
7747                 printf("(I see you are running Configure as super-user...)\n");
7748                 setuid(1);
7749         }
7750 #ifdef TRY_BSD_PGRP
7751         if (-1 == setpgrp(1, 1))
7752                 exit(0);
7753 #else
7754         if (setpgrp() != -1)
7755                 exit(0);
7756 #endif
7757         exit(1);
7758 }
7759 EOP
7760         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7761                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7762                 val="$define"
7763         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7764                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7765                 val="$undef"
7766         else
7767                 echo "(I can't seem to compile and run the test program.)"
7768                 if ./usg; then
7769                         xxx="a USG one, i.e. you use setpgrp()."
7770                 else
7771                         # SVR4 systems can appear rather BSD-ish.
7772                         case "$i_unistd" in
7773                         $undef)
7774                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7775                                 val="$define"
7776                                 ;;
7777                         $define)
7778                                 xxx="probably a USG one, i.e. you use setpgrp()."
7779                                 val="$undef"
7780                                 ;;
7781                         esac
7782                 fi
7783                 echo "Assuming your setpgrp is $xxx" >&4
7784         fi
7785         ;;
7786 *) val="$undef";;
7787 esac
7788 set d_bsdsetpgrp
7789 eval $setvar
7790 $rm -f set set.c
7791 : see if bzero exists
7792 set bzero d_bzero
7793 eval $inlibc
7794
7795 : see if signal is declared as pointer to function returning int or void
7796 echo " "
7797 xxx=`./findhdr signal.h`
7798 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7799 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7800         echo "You have int (*signal())() instead of void." >&4
7801         val="$undef"
7802 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7803         echo "You have void (*signal())()." >&4
7804         val="$define"
7805 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7806         echo "You have int (*signal())() instead of void." >&4
7807         val="$undef"
7808 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7809         echo "You have void (*signal())()." >&4
7810         val="$define"
7811 else
7812         case "$d_voidsig" in
7813         '')
7814         echo "I can't determine whether signal handler returns void or int..." >&4
7815                 dflt=void
7816                 rp="What type does your signal handler return?"
7817                 . ./myread
7818                 case "$ans" in
7819                 v*) val="$define";;
7820                 *) val="$undef";;
7821                 esac;;
7822         "$define")
7823                 echo "As you already told me, signal handler returns void." >&4
7824                 val="$define"
7825                 ;;
7826         *)      echo "As you already told me, signal handler returns int." >&4
7827                 val="$undef"
7828                 ;;
7829         esac
7830 fi
7831 set d_voidsig
7832 eval $setvar
7833 case "$d_voidsig" in
7834 "$define") signal_t="void";;
7835 *) signal_t="int";;
7836 esac
7837 $rm -f $$.tmp
7838
7839 : check for ability to cast large floats to 32-bit ints.
7840 echo " "
7841 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7842 if $test "$intsize" -ge 4; then
7843         xxx=int
7844 else
7845         xxx=long
7846 fi
7847 $cat >try.c <<EOCP
7848 #include <stdio.h>
7849 #include <sys/types.h>
7850 #include <signal.h>
7851 $signal_t blech(s) int s; { exit(3); }
7852 int main()
7853 {
7854         $xxx i32;
7855         double f, g;
7856         int result = 0;
7857         char str[16];
7858         signal(SIGFPE, blech);
7859
7860         /* Don't let compiler optimize the test away.  Store the number 
7861            in a writable string for gcc to pass to sscanf under HP/UX.
7862         */
7863         sprintf(str, "2147483647");
7864         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7865         g = 10 * f;
7866         i32  = ($xxx) g;
7867
7868         /* x86 processors will probably give 0x8000 0000, which is a
7869        sign change.  We don't want that.  We want to mimic SPARC
7870            behavior here, which is to preserve the sign and give
7871            back 0x7fff ffff.
7872         */
7873         if (i32 != ($xxx) f)
7874                 result |= 1;
7875         exit(result);
7876 }
7877 EOCP
7878 set try
7879 if eval $compile_ok; then
7880         ./try
7881         yyy=$?
7882 else
7883         echo "(I can't seem to compile the test program--assuming it can't)"
7884         yyy=1
7885 fi
7886 case "$yyy" in
7887 0)      val="$define"
7888         echo "Yup, it can."
7889         ;;
7890 *)      val="$undef"
7891         echo "Nope, it can't."
7892         ;;
7893 esac
7894 set d_casti32
7895 eval $setvar
7896 $rm -f try try.*
7897
7898 : check for ability to cast negative floats to unsigned
7899 echo " "
7900 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7901 $cat >try.c <<EOCP
7902 #include <stdio.h>
7903 #include <sys/types.h>
7904 #include <signal.h>
7905 $signal_t blech(s) int s; { exit(7); }
7906 $signal_t blech_in_list(s) int s; { exit(4); }
7907 unsigned long dummy_long(p) unsigned long p; { return p; }
7908 unsigned int dummy_int(p) unsigned int p; { return p; }
7909 unsigned short dummy_short(p) unsigned short p; { return p; }
7910 int main()
7911 {
7912         double f;
7913         unsigned long along;
7914         unsigned int aint;
7915         unsigned short ashort;
7916         int result = 0;
7917         char str[16];
7918         
7919         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7920            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7921            optimized the whole file away
7922         */
7923         /* Store the number in a writable string for gcc to pass to 
7924            sscanf under HP/UX.
7925         */
7926         sprintf(str, "-123");
7927         sscanf(str, "%lf", &f);  /* f = -123.; */
7928
7929         signal(SIGFPE, blech);
7930         along = (unsigned long)f;
7931         aint = (unsigned int)f;
7932         ashort = (unsigned short)f;
7933         if (along != (unsigned long)-123)
7934                 result |= 1;
7935         if (aint != (unsigned int)-123)
7936                 result |= 1;
7937         if (ashort != (unsigned short)-123)
7938                 result |= 1;
7939         sprintf(str, "1073741824.");
7940         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7941         f = f + f;
7942         along = 0;
7943         along = (unsigned long)f;
7944         if (along != 0x80000000)
7945                 result |= 2;
7946         f -= 1.;
7947         along = 0;
7948         along = (unsigned long)f;
7949         if (along != 0x7fffffff)
7950                 result |= 1;
7951         f += 2.;
7952         along = 0;
7953         along = (unsigned long)f;
7954         if (along != 0x80000001)
7955                 result |= 2;
7956         if (result)
7957                 exit(result);
7958         signal(SIGFPE, blech_in_list);
7959         sprintf(str, "123.");
7960         sscanf(str, "%lf", &f);  /* f = 123.; */
7961         along = dummy_long((unsigned long)f);
7962         aint = dummy_int((unsigned int)f);
7963         ashort = dummy_short((unsigned short)f);
7964         if (along != (unsigned long)123)
7965                 result |= 4;
7966         if (aint != (unsigned int)123)
7967                 result |= 4;
7968         if (ashort != (unsigned short)123)
7969                 result |= 4;
7970         exit(result);
7971
7972 }
7973 EOCP
7974 set try
7975 if eval $compile_ok; then
7976         ./try
7977         castflags=$?
7978 else
7979         echo "(I can't seem to compile the test program--assuming it can't)"
7980         castflags=7
7981 fi
7982 case "$castflags" in
7983 0)      val="$define"
7984         echo "Yup, it can."
7985         ;;
7986 *)      val="$undef"
7987         echo "Nope, it can't."
7988         ;;
7989 esac
7990 set d_castneg
7991 eval $setvar
7992 $rm -f try.*
7993
7994 : see if vprintf exists
7995 echo " "
7996 if set vprintf val -f d_vprintf; eval $csym; $val; then
7997         echo 'vprintf() found.' >&4
7998         val="$define"
7999         $cat >vprintf.c <<'EOF'
8000 #include <varargs.h>
8001
8002 int main() { xxx("foo"); }
8003
8004 xxx(va_alist)
8005 va_dcl
8006 {
8007         va_list args;
8008         char buf[10];
8009
8010         va_start(args);
8011         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8012 }
8013 EOF
8014         set vprintf
8015         if eval $compile && ./vprintf; then
8016                 echo "Your vsprintf() returns (int)." >&4
8017                 val2="$undef"
8018         else
8019                 echo "Your vsprintf() returns (char*)." >&4
8020                 val2="$define"
8021         fi
8022 else
8023         echo 'vprintf() NOT found.' >&4
8024                 val="$undef"
8025                 val2="$undef"
8026 fi
8027 set d_vprintf
8028 eval $setvar
8029 val=$val2
8030 set d_charvspr
8031 eval $setvar
8032
8033 : see if chown exists
8034 set chown d_chown
8035 eval $inlibc
8036
8037 : see if chroot exists
8038 set chroot d_chroot
8039 eval $inlibc
8040
8041 : see if chsize exists
8042 set chsize d_chsize
8043 eval $inlibc
8044
8045 : check for const keyword
8046 echo " "
8047 echo 'Checking to see if your C compiler knows about "const"...' >&4
8048 $cat >const.c <<'EOCP'
8049 typedef struct spug { int drokk; } spug;
8050 int main()
8051 {
8052         const char *foo;
8053         const spug y;
8054 }
8055 EOCP
8056 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8057         val="$define"
8058         echo "Yup, it does."
8059 else
8060         val="$undef"
8061         echo "Nope, it doesn't."
8062 fi
8063 set d_const
8064 eval $setvar
8065
8066 : see if crypt exists
8067 echo " "
8068 if set crypt val -f d_crypt; eval $csym; $val; then
8069         echo 'crypt() found.' >&4
8070         val="$define"
8071         cryptlib=''
8072 else
8073         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8074         if $test -z "$cryptlib"; then
8075                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8076         else
8077                 cryptlib=-lcrypt
8078         fi
8079         if $test -z "$cryptlib"; then
8080                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8081         else
8082                 cryptlib=-lcrypt
8083         fi
8084         if $test -z "$cryptlib"; then
8085                 cryptlib=`./loc libcrypt$_a "" $libpth`
8086         else
8087                 cryptlib=-lcrypt
8088         fi
8089         if $test -z "$cryptlib"; then
8090                 echo 'crypt() NOT found.' >&4
8091                 val="$undef"
8092         else
8093                 val="$define"
8094         fi
8095 fi
8096 set d_crypt
8097 eval $setvar
8098
8099 : get csh whereabouts
8100 case "$csh" in
8101 'csh') val="$undef" ;;
8102 *) val="$define" ;;
8103 esac
8104 set d_csh
8105 eval $setvar
8106 : Respect a hint or command line value for full_csh.
8107 case "$full_csh" in
8108 '') full_csh=$csh ;;
8109 esac
8110
8111 : see if cuserid exists
8112 set cuserid d_cuserid
8113 eval $inlibc
8114
8115 : see if this is a limits.h system
8116 set limits.h i_limits
8117 eval $inhdr
8118
8119 : see if this is a float.h system
8120 set float.h i_float
8121 eval $inhdr
8122
8123 : See if number of significant digits in a double precision number is known
8124 echo " "
8125 $cat >dbl_dig.c <<EOM
8126 #$i_limits I_LIMITS
8127 #$i_float I_FLOAT
8128 #ifdef I_LIMITS
8129 #include <limits.h>
8130 #endif
8131 #ifdef I_FLOAT
8132 #include <float.h>
8133 #endif
8134 #ifdef DBL_DIG
8135 printf("Contains DBL_DIG");
8136 #endif
8137 EOM
8138 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8139 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8140         echo "DBL_DIG found." >&4
8141         val="$define"
8142 else
8143         echo "DBL_DIG NOT found." >&4
8144         val="$undef"
8145 fi
8146 $rm -f dbl_dig.?
8147 set d_dbl_dig
8148 eval $setvar
8149
8150 : see if difftime exists
8151 set difftime d_difftime
8152 eval $inlibc
8153
8154 : see if this is a dirent system
8155 echo " "
8156 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8157         val="$define"
8158         echo "<dirent.h> found." >&4
8159 else
8160         val="$undef"
8161         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8162                 echo "<sys/dir.h> found." >&4
8163                 echo " "
8164         else
8165                 xinc=`./findhdr sys/ndir.h`
8166         fi
8167         echo "<dirent.h> NOT found." >&4
8168 fi
8169 set i_dirent
8170 eval $setvar
8171
8172 : Look for type of directory structure.
8173 echo " "
8174 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8175
8176 case "$direntrytype" in
8177 ''|' ')
8178         case "$i_dirent" in
8179         $define) guess1='struct dirent' ;;
8180         *) guess1='struct direct'  ;;
8181         esac
8182         ;;
8183 *)      guess1="$direntrytype"
8184         ;;
8185 esac
8186
8187 case "$guess1" in
8188 'struct dirent') guess2='struct direct' ;;
8189 *) guess2='struct dirent' ;;
8190 esac
8191                 
8192 if $contains "$guess1" try.c >/dev/null 2>&1; then
8193         direntrytype="$guess1"
8194         echo "Your directory entries are $direntrytype." >&4
8195 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8196         direntrytype="$guess2"
8197         echo "Your directory entries seem to be $direntrytype." >&4
8198 else
8199         echo "I don't recognize your system's directory entries." >&4
8200         rp="What type is used for directory entries on this system?"
8201         dflt="$guess1"
8202         . ./myread
8203         direntrytype="$ans"
8204 fi
8205 $rm -f try.c
8206
8207
8208 : see if the directory entry stores field length
8209 echo " "
8210 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8211 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8212         echo "Good, your directory entry keeps length information in d_namlen." >&4
8213         val="$define"
8214 else
8215         echo "Your directory entry does not know about the d_namlen field." >&4
8216         val="$undef"
8217 fi
8218 set d_dirnamlen
8219 eval $setvar
8220 $rm -f try.c
8221
8222 : see if dlerror exists
8223 xxx_runnm="$runnm"
8224 runnm=false
8225 set dlerror d_dlerror
8226 eval $inlibc
8227 runnm="$xxx_runnm"
8228
8229 : see if dlfcn is available
8230 set dlfcn.h i_dlfcn
8231 eval $inhdr
8232
8233 case "$usedl" in
8234 $define|y|true)
8235         $cat << EOM
8236
8237 On a few systems, the dynamically loaded modules that perl generates and uses
8238 will need a different extension than shared libs. The default will probably
8239 be appropriate.
8240
8241 EOM
8242         case "$dlext" in
8243         '')     dflt="$so" ;;
8244         *)      dflt="$dlext" ;;
8245         esac
8246         rp='What is the extension of dynamically loaded modules'
8247         . ./myread
8248         dlext="$ans"
8249         ;;
8250 *)
8251         dlext="none"
8252         ;;
8253 esac
8254
8255 : Check if dlsym need a leading underscore
8256 echo " "
8257 val="$undef"
8258
8259 case "$dlsrc" in
8260 dl_dlopen.xs)
8261         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8262         $cat >dyna.c <<'EOM'
8263 fred () { }
8264 EOM
8265
8266 $cat >fred.c<<EOM
8267
8268 #include <stdio.h>
8269 #$i_dlfcn I_DLFCN
8270 #ifdef I_DLFCN
8271 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8272 #else
8273 #include <sys/types.h>
8274 #include <nlist.h>
8275 #include <link.h>
8276 #endif
8277
8278 extern int fred() ;
8279
8280 int main()
8281 {
8282     void * handle ;
8283     void * symbol ;
8284 #ifndef RTLD_LAZY
8285     int mode = 1 ;
8286 #else
8287     int mode = RTLD_LAZY ;
8288 #endif
8289     handle = dlopen("./dyna.$dlext", mode) ;
8290     if (handle == NULL) {
8291         printf ("1\n") ;
8292         fflush (stdout) ;
8293         exit(0);
8294     }
8295     symbol = dlsym(handle, "fred") ;
8296     if (symbol == NULL) {
8297         /* try putting a leading underscore */
8298         symbol = dlsym(handle, "_fred") ;
8299         if (symbol == NULL) {
8300             printf ("2\n") ;
8301             fflush (stdout) ;
8302             exit(0);
8303         }
8304         printf ("3\n") ;
8305     }
8306     else
8307         printf ("4\n") ;
8308     fflush (stdout) ;
8309     exit(0);
8310 }
8311 EOM
8312         : Call the object file tmp-dyna.o in case dlext=o.
8313         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8314                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8315                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8316                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8317                 xxx=`./fred`
8318                 case $xxx in
8319                 1)      echo "Test program failed using dlopen." >&4
8320                         echo "Perhaps you should not use dynamic loading." >&4;;
8321                 2)      echo "Test program failed using dlsym." >&4
8322                         echo "Perhaps you should not use dynamic loading." >&4;;
8323                 3)      echo "dlsym needs a leading underscore" >&4
8324                         val="$define" ;;
8325                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8326                 esac
8327         else
8328                 echo "I can't compile and run the test program." >&4
8329                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8330         fi
8331         ;;
8332 esac
8333                 
8334 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8335
8336 set d_dlsymun
8337 eval $setvar
8338
8339 hasproto='varname=$1; func=$2; shift; shift;
8340 while $test $# -ge 2; do
8341         case "$1" in
8342         $define) echo "#include <$2>";;
8343         esac ;
8344     shift 2;
8345 done > try.c;
8346 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8347 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8348         echo "$func() prototype found.";
8349         val="$define";
8350 else
8351         echo "$func() prototype NOT found.";
8352         val="$undef";
8353 fi;
8354 set $varname;
8355 eval $setvar;
8356 $rm -f try.c tryout.c'
8357
8358 : see if prototype for drand48 is available
8359 echo " "
8360 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8361 eval $hasproto
8362
8363 : see if dup2 exists
8364 set dup2 d_dup2
8365 eval $inlibc
8366
8367 : see if eaccess exists
8368 set eaccess d_eaccess
8369 eval $inlibc
8370
8371 : see if endgrent exists
8372 set endgrent d_endgrent
8373 eval $inlibc
8374
8375 : see if endhostent exists
8376 set endhostent d_endhent
8377 eval $inlibc
8378
8379 : see if endnetent exists
8380 set endnetent d_endnent
8381 eval $inlibc
8382
8383 : see if endprotoent exists
8384 set endprotoent d_endpent
8385 eval $inlibc
8386
8387 : see if endpwent exists
8388 set endpwent d_endpwent
8389 eval $inlibc
8390
8391 : see if endservent exists
8392 set endservent d_endsent
8393 eval $inlibc
8394
8395 : see if endspent exists
8396 set endspent d_endspent
8397 eval $inlibc
8398
8399 : Locate the flags for 'open()'
8400 echo " "
8401 $cat >open3.c <<'EOCP'
8402 #include <sys/types.h>
8403 #ifdef I_FCNTL
8404 #include <fcntl.h>
8405 #endif
8406 #ifdef I_SYS_FILE
8407 #include <sys/file.h>
8408 #endif
8409 int main() {
8410         if(O_RDONLY);
8411 #ifdef O_TRUNC
8412         exit(0);
8413 #else
8414         exit(1);
8415 #endif
8416 }
8417 EOCP
8418 : check sys/file.h first to get FREAD on Sun
8419 if $test `./findhdr sys/file.h` && \
8420                 set open3 -DI_SYS_FILE && eval $compile; then
8421         h_sysfile=true;
8422         echo "<sys/file.h> defines the O_* constants..." >&4
8423         if ./open3; then
8424                 echo "and you have the 3 argument form of open()." >&4
8425                 val="$define"
8426         else
8427                 echo "but not the 3 argument form of open().  Oh, well." >&4
8428                 val="$undef"
8429         fi
8430 elif $test `./findhdr fcntl.h` && \
8431                 set open3 -DI_FCNTL && eval $compile; then
8432         h_fcntl=true;
8433         echo "<fcntl.h> defines the O_* constants..." >&4
8434         if ./open3; then
8435                 echo "and you have the 3 argument form of open()." >&4
8436                 val="$define"
8437         else
8438                 echo "but not the 3 argument form of open().  Oh, well." >&4
8439                 val="$undef"
8440         fi
8441 else
8442         val="$undef"
8443         echo "I can't find the O_* constant definitions!  You got problems." >&4
8444 fi
8445 set d_open3
8446 eval $setvar
8447 $rm -f open3*
8448
8449 : see which of string.h or strings.h is needed
8450 echo " "
8451 strings=`./findhdr string.h`
8452 if $test "$strings" && $test -r "$strings"; then
8453         echo "Using <string.h> instead of <strings.h>." >&4
8454         val="$define"
8455 else
8456         val="$undef"
8457         strings=`./findhdr strings.h`
8458         if $test "$strings" && $test -r "$strings"; then
8459                 echo "Using <strings.h> instead of <string.h>." >&4
8460         else
8461                 echo "No string header found -- You'll surely have problems." >&4
8462         fi
8463 fi
8464 set i_string
8465 eval $setvar
8466 case "$i_string" in
8467 "$undef") strings=`./findhdr strings.h`;;
8468 *)        strings=`./findhdr string.h`;;
8469 esac
8470
8471 : check for non-blocking I/O stuff
8472 case "$h_sysfile" in
8473 true) echo "#include <sys/file.h>" > head.c;;
8474 *)
8475         case "$h_fcntl" in
8476         true) echo "#include <fcntl.h>" > head.c;;
8477         *) echo "#include <sys/fcntl.h>" > head.c;;
8478         esac
8479         ;;
8480 esac
8481 echo " "
8482 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8483 case "$o_nonblock" in
8484 '')
8485         $cat head.c > try.c
8486         $cat >>try.c <<'EOCP'
8487 #include <stdio.h>
8488 int main() {
8489 #ifdef O_NONBLOCK
8490         printf("O_NONBLOCK\n");
8491         exit(0);
8492 #endif
8493 #ifdef O_NDELAY
8494         printf("O_NDELAY\n");
8495         exit(0);
8496 #endif
8497 #ifdef FNDELAY
8498         printf("FNDELAY\n");
8499         exit(0);
8500 #endif
8501         exit(0);
8502 }
8503 EOCP
8504         set try
8505         if eval $compile_ok; then
8506                 o_nonblock=`./try`
8507                 case "$o_nonblock" in
8508                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8509                 *) echo "Seems like we can use $o_nonblock.";;
8510                 esac
8511         else
8512                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8513         fi
8514         ;;
8515 *) echo "Using $hint value $o_nonblock.";;
8516 esac
8517 $rm -f try try.* .out core
8518
8519 echo " "
8520 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8521 case "$eagain" in
8522 '')
8523         $cat head.c > try.c
8524         $cat >>try.c <<EOCP
8525 #include <errno.h>
8526 #include <sys/types.h>
8527 #include <signal.h>
8528 #include <stdio.h> 
8529 #define MY_O_NONBLOCK $o_nonblock
8530 #ifndef errno  /* XXX need better Configure test */
8531 extern int errno;
8532 #endif
8533 #$i_unistd I_UNISTD
8534 #ifdef I_UNISTD
8535 #include <unistd.h>
8536 #endif
8537 #ifdef $i_string
8538 #include <string.h>
8539 #else
8540 #include <strings.h>
8541 #endif
8542 $signal_t blech(x) int x; { exit(3); }
8543 EOCP
8544         $cat >> try.c <<'EOCP'
8545 int main()
8546 {
8547         int pd[2];
8548         int pu[2];
8549         char buf[1];
8550         char string[100];
8551
8552         pipe(pd);       /* Down: child -> parent */
8553         pipe(pu);       /* Up: parent -> child */
8554         if (0 != fork()) {
8555                 int ret;
8556                 close(pd[1]);   /* Parent reads from pd[0] */
8557                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8558                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8559                         exit(1);
8560                 signal(SIGALRM, blech);
8561                 alarm(5);
8562                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8563                         exit(2);
8564                 sprintf(string, "%d\n", ret);
8565                 write(2, string, strlen(string));
8566                 alarm(0);
8567 #ifdef EAGAIN
8568                 if (errno == EAGAIN) {
8569                         printf("EAGAIN\n");
8570                         goto ok;
8571                 }
8572 #endif
8573 #ifdef EWOULDBLOCK
8574                 if (errno == EWOULDBLOCK)
8575                         printf("EWOULDBLOCK\n");
8576 #endif
8577         ok:
8578                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8579                 sleep(2);                               /* Give it time to close our pipe */
8580                 alarm(5);
8581                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8582                 alarm(0);
8583                 sprintf(string, "%d\n", ret);
8584                 write(3, string, strlen(string));
8585                 exit(0);
8586         }
8587
8588         close(pd[0]);                   /* We write to pd[1] */
8589         close(pu[1]);                   /* We read from pu[0] */
8590         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8591         close(pd[1]);                   /* Pipe pd is now fully closed! */
8592         exit(0);                                /* Bye bye, thank you for playing! */
8593 }
8594 EOCP
8595         set try
8596         if eval $compile_ok; then
8597                 echo "$startsh" >mtry
8598                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8599                 chmod +x mtry
8600                 ./mtry >/dev/null 2>&1
8601                 case $? in
8602                 0) eagain=`$cat try.out`;;
8603                 1) echo "Could not perform non-blocking setting!";;
8604                 2) echo "I did a successful read() for something that was not there!";;
8605                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8606                 *) echo "Something terribly wrong happened during testing.";;
8607                 esac
8608                 rd_nodata=`$cat try.ret`
8609                 echo "A read() system call with no data present returns $rd_nodata."
8610                 case "$rd_nodata" in
8611                 0|-1) ;;
8612                 *)
8613                         echo "(That's peculiar, fixing that to be -1.)"
8614                         rd_nodata=-1
8615                         ;;
8616                 esac
8617                 case "$eagain" in
8618                 '')
8619                         echo "Forcing errno EAGAIN on read() with no data available."
8620                         eagain=EAGAIN
8621                         ;;
8622                 *)
8623                         echo "Your read() sets errno to $eagain when no data is available."
8624                         ;;
8625                 esac
8626                 status=`$cat try.err`
8627                 case "$status" in
8628                 0) echo "And it correctly returns 0 to signal EOF.";;
8629                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8630                 *) echo "However, your read() returns '$status' on EOF??";;
8631                 esac
8632                 val="$define"
8633                 if test "$status" = "$rd_nodata"; then
8634                         echo "WARNING: you can't distinguish between EOF and no data!"
8635                         val="$undef"
8636                 fi
8637         else
8638                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8639                 eagain=EAGAIN
8640         fi
8641         set d_eofnblk
8642         eval $setvar
8643         ;;
8644 *)
8645         echo "Using $hint value $eagain."
8646         echo "Your read() returns $rd_nodata when no data is present."
8647         case "$d_eofnblk" in
8648         "$define") echo "And you can see EOF because read() returns 0.";;
8649         "$undef") echo "But you can't see EOF status from read() returned value.";;
8650         *)
8651                 echo "(Assuming you can't see EOF status from read anyway.)"
8652                 d_eofnblk=$undef
8653                 ;;
8654         esac
8655         ;;
8656 esac
8657 $rm -f try try.* .out core head.c mtry
8658
8659 : see if fchmod exists
8660 set fchmod d_fchmod
8661 eval $inlibc
8662
8663 : see if fchown exists
8664 set fchown d_fchown
8665 eval $inlibc
8666
8667 : see if this is an fcntl system
8668 set fcntl d_fcntl
8669 eval $inlibc
8670
8671 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8672 while $test $# -ge 2; do
8673         case "$1" in
8674         $define) echo "#include <$2>";;
8675         esac ;
8676     shift 2;
8677 done > try.c;
8678 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8679 set try;
8680 if eval $compile; then
8681         val="$define";
8682 else
8683         val="$undef";
8684 fi;
8685 set $varname;
8686 eval $setvar;
8687 $rm -f try.c try.o'
8688
8689 socketlib=''
8690 sockethdr=''
8691 : see whether socket exists
8692 echo " "
8693 $echo $n "Hmm... $c" >&4
8694 if set socket val -f d_socket; eval $csym; $val; then
8695         echo "Looks like you have Berkeley networking support." >&4
8696         d_socket="$define"
8697         if set setsockopt val -f; eval $csym; $val; then
8698                 d_oldsock="$undef"
8699         else
8700                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8701                 d_oldsock="$define"
8702         fi
8703 else
8704         if $contains socklib libc.list >/dev/null 2>&1; then
8705                 echo "Looks like you have Berkeley networking support." >&4
8706                 d_socket="$define"
8707                 : we will have to assume that it supports the 4.2 BSD interface
8708                 d_oldsock="$undef"
8709         else
8710                 echo "You don't have Berkeley networking in libc$_a..." >&4
8711                 if test "X$d_socket" = "X$define"; then
8712                    echo "...but you seem to believe that you have sockets." >&4
8713                 else
8714                         for net in net socket
8715                         do
8716                                 if test -f /usr/lib/lib$net$_a; then
8717                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8718                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8719                                         if $contains socket libc.list >/dev/null 2>&1; then
8720                                                 d_socket="$define"
8721                                                 socketlib="-l$net"
8722                                                 case "$net" in
8723                                                 net)
8724                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8725                                                         sockethdr="-I/usr/netinclude"
8726                                                         ;;
8727                                                 esac
8728                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8729                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8730                                                         d_oldsock="$undef"
8731                                                 else
8732                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8733                                                         d_oldsock="$define"
8734                                                 fi
8735                                                 break
8736                                         fi
8737                                 fi
8738                         done
8739                         if test "X$d_socket" != "X$define"; then
8740                            echo "or anywhere else I see." >&4
8741                            d_socket="$undef"
8742                            d_oldsock="$undef"
8743                         fi
8744                 fi
8745         fi
8746 fi
8747
8748 : see if socketpair exists
8749 set socketpair d_sockpair
8750 eval $inlibc
8751
8752
8753 echo " "
8754 echo "Checking the availability of certain socket constants..." >& 4
8755 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8756         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8757         $cat >try.c <<EOF
8758 #include <sys/types.h>
8759 #include <sys/socket.h>
8760 int main() {
8761     int i = $ENUM;
8762 }
8763 EOF
8764         val="$undef"
8765         set try; if eval $compile; then
8766                 val="$define"
8767         fi
8768         set d_${enum}; eval $setvar
8769         $rm -f try.c try
8770 done
8771
8772 : see if sys/select.h has to be included
8773 set sys/select.h i_sysselct
8774 eval $inhdr
8775
8776 : see if we should include time.h, sys/time.h, or both
8777 echo " "
8778 if test "X$timeincl" = X; then
8779         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8780         $echo $n "I'm now running the test program...$c"
8781         $cat >try.c <<'EOCP'
8782 #include <sys/types.h>
8783 #ifdef I_TIME
8784 #include <time.h>
8785 #endif
8786 #ifdef I_SYSTIME
8787 #ifdef SYSTIMEKERNEL
8788 #define KERNEL
8789 #endif
8790 #include <sys/time.h>
8791 #endif
8792 #ifdef I_SYSSELECT
8793 #include <sys/select.h>
8794 #endif
8795 int main()
8796 {
8797         struct tm foo;
8798 #ifdef S_TIMEVAL
8799         struct timeval bar;
8800 #endif
8801 #ifdef S_TIMEZONE
8802         struct timezone tzp;
8803 #endif
8804         if (foo.tm_sec == foo.tm_sec)
8805                 exit(0);
8806 #ifdef S_TIMEVAL
8807         if (bar.tv_sec == bar.tv_sec)
8808                 exit(0);
8809 #endif
8810         exit(1);
8811 }
8812 EOCP
8813         flags=''
8814         for s_timezone in '-DS_TIMEZONE' ''; do
8815         sysselect=''
8816         for s_timeval in '-DS_TIMEVAL' ''; do
8817         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8818         for i_time in '' '-DI_TIME'; do
8819         for i_systime in '-DI_SYSTIME' ''; do
8820                 case "$flags" in
8821                 '') $echo $n ".$c"
8822                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8823                         if eval $compile; then
8824                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8825                                 shift
8826                                 flags="$*"
8827                                 echo " "
8828                                 $echo $n "Succeeded with $flags$c"
8829                         fi
8830                         ;;
8831                 esac
8832         done
8833         done
8834         done
8835         done
8836         done
8837         timeincl=''
8838         echo " "
8839         case "$flags" in
8840         *SYSTIMEKERNEL*) i_systimek="$define"
8841                 timeincl=`./findhdr sys/time.h`
8842                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8843         *) i_systimek="$undef";;
8844         esac
8845         case "$flags" in
8846         *I_TIME*) i_time="$define"
8847                 timeincl=`./findhdr time.h`" $timeincl"
8848                 echo "We'll include <time.h>." >&4;;
8849         *) i_time="$undef";;
8850         esac
8851         case "$flags" in
8852         *I_SYSTIME*) i_systime="$define"
8853                 timeincl=`./findhdr sys/time.h`" $timeincl"
8854                 echo "We'll include <sys/time.h>." >&4;;
8855         *) i_systime="$undef";;
8856         esac
8857         $rm -f try.c try
8858 fi
8859
8860 : check for fd_set items
8861 $cat <<EOM
8862
8863 Checking to see how well your C compiler handles fd_set and friends ...
8864 EOM
8865 $cat >fd_set.c <<EOCP
8866 #$i_systime I_SYS_TIME
8867 #$i_sysselct I_SYS_SELECT
8868 #$d_socket HAS_SOCKET
8869 #include <sys/types.h>
8870 #ifdef HAS_SOCKET
8871 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8872 #endif
8873 #ifdef I_SYS_TIME
8874 #include <sys/time.h>
8875 #endif
8876 #ifdef I_SYS_SELECT
8877 #include <sys/select.h>
8878 #endif
8879 int main() {
8880         fd_set fds;
8881
8882 #ifdef TRYBITS
8883         if(fds.fds_bits);
8884 #endif
8885
8886 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8887         exit(0);
8888 #else
8889         exit(1);
8890 #endif
8891 }
8892 EOCP
8893 set fd_set -DTRYBITS
8894 if eval $compile; then
8895         d_fds_bits="$define"
8896         d_fd_set="$define"
8897         echo "Well, your system knows about the normal fd_set typedef..." >&4
8898         if ./fd_set; then
8899                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8900                 d_fd_macros="$define"
8901         else
8902                 $cat >&4 <<'EOM'
8903 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8904 EOM
8905                 d_fd_macros="$undef"
8906         fi
8907 else
8908         $cat <<'EOM'
8909 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8910 EOM
8911         set fd_set
8912         if eval $compile; then
8913                 d_fds_bits="$undef"
8914                 d_fd_set="$define"
8915                 echo "Well, your system has some sort of fd_set available..." >&4
8916                 if ./fd_set; then
8917                         echo "and you have the normal fd_set macros." >&4
8918                         d_fd_macros="$define"
8919                 else
8920                         $cat <<'EOM'
8921 but not the normal fd_set macros!  Gross!  More work for me...
8922 EOM
8923                         d_fd_macros="$undef"
8924                 fi
8925         else
8926         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8927                 d_fd_set="$undef"
8928                 d_fds_bits="$undef"
8929                 d_fd_macros="$undef"
8930         fi
8931 fi
8932 $rm -f fd_set*
8933
8934 : see if fgetpos exists
8935 set fgetpos d_fgetpos
8936 eval $inlibc
8937
8938 : see if flock exists
8939 set flock d_flock
8940 eval $inlibc
8941
8942 : see if fork exists
8943 set fork d_fork
8944 eval $inlibc
8945
8946 : see if pathconf exists
8947 set pathconf d_pathconf
8948 eval $inlibc
8949
8950 : see if fpathconf exists
8951 set fpathconf d_fpathconf
8952 eval $inlibc
8953
8954
8955 : check for fpos64_t
8956 echo " "
8957 echo "Checking to see if you have fpos64_t..." >&4
8958 $cat >try.c <<EOCP
8959 #include <stdio.h>
8960 int main() { fpos64_t x = 7; }
8961 EOCP
8962 set try
8963 if eval $compile; then
8964         val="$define"
8965         echo "You have fpos64_t."
8966 else
8967         val="$undef"
8968         echo "You do not have fpos64_t."
8969         case "$fpossize" in
8970         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8971         esac
8972 fi
8973 $rm -f try.* try
8974 set d_fpos64_t
8975 eval $setvar
8976
8977 hasstruct='varname=$1; struct=$2; shift; shift;
8978 while $test $# -ge 2; do
8979         case "$1" in
8980         $define) echo "#include <$2>";;
8981         esac ;
8982     shift 2;
8983 done > try.c;
8984 echo "int main () { struct $struct foo; }" >> try.c;
8985 set try;
8986 if eval $compile; then
8987         val="$define";
8988 else
8989         val="$undef";
8990 fi;
8991 set $varname;
8992 eval $setvar;
8993 $rm -f try.c try.o'
8994
8995 : see if this is a sys/param system
8996 set sys/param.h i_sysparam
8997 eval $inhdr
8998
8999 : see if this is a sys/mount.h system
9000 set sys/mount.h i_sysmount
9001 eval $inhdr
9002
9003 : see if sys/types.h has to be included
9004 set sys/types.h i_systypes
9005 eval $inhdr
9006
9007
9008 echo " "
9009 echo "Checking to see if your system supports struct fs_data..." >&4
9010 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9011 eval $hasstruct
9012 case "$d_fs_data_s" in
9013 "$define")      echo "Yes, it does."   ;;
9014 *)              echo "No, it doesn't." ;;
9015 esac
9016
9017 : see if fseeko exists
9018 set fseeko d_fseeko
9019 eval $inlibc
9020 case "$longsize" in
9021 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9022 esac
9023
9024 : see if fsetpos exists
9025 set fsetpos d_fsetpos
9026 eval $inlibc
9027
9028
9029 : see if fstatfs exists
9030 set fstatfs d_fstatfs
9031 eval $inlibc
9032
9033
9034 : see if statvfs exists
9035 set statvfs d_statvfs
9036 eval $inlibc
9037
9038 : see if fstatvfs exists
9039 set fstatvfs d_fstatvfs
9040 eval $inlibc
9041
9042
9043 : see if ftello exists
9044 set ftello d_ftello
9045 eval $inlibc
9046 case "$longsize" in
9047 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9048 esac
9049
9050 : see if getcwd exists
9051 set getcwd d_getcwd
9052 eval $inlibc
9053
9054
9055 : see if getfsstat exists
9056 set getfsstat d_getfsstat
9057 eval $inlibc
9058
9059 : see if getgrent exists
9060 set getgrent d_getgrent
9061 eval $inlibc
9062
9063 : see if gethostbyaddr exists
9064 set gethostbyaddr d_gethbyaddr
9065 eval $inlibc
9066
9067 : see if gethostbyname exists
9068 set gethostbyname d_gethbyname
9069 eval $inlibc
9070
9071 : see if gethostent exists
9072 set gethostent d_gethent
9073 eval $inlibc
9074
9075 : see how we will look up host name
9076 echo " "
9077 call=''
9078 if set gethostname val -f d_gethname; eval $csym; $val; then
9079         echo 'gethostname() found.' >&4
9080         d_gethname="$define"
9081         call=gethostname
9082 fi
9083 if set uname val -f d_uname; eval $csym; $val; then
9084         if ./xenix; then
9085                 $cat <<'EOM'
9086 uname() was found, but you're running xenix, and older versions of xenix
9087 have a broken uname(). If you don't really know whether your xenix is old
9088 enough to have a broken system call, use the default answer.
9089
9090 EOM
9091                 dflt=y
9092                 case "$d_uname" in
9093                 "$define") dflt=n;;
9094                 esac
9095                 rp='Is your uname() broken?'
9096                 . ./myread
9097                 case "$ans" in
9098                 n*) d_uname="$define"; call=uname;;
9099                 esac
9100         else
9101                 echo 'uname() found.' >&4
9102                 d_uname="$define"
9103                 case "$call" in
9104                 '') call=uname ;;
9105                 esac
9106         fi
9107 fi
9108 case "$d_gethname" in
9109 '') d_gethname="$undef";;
9110 esac
9111 case "$d_uname" in
9112 '') d_uname="$undef";;
9113 esac
9114 case "$d_uname$d_gethname" in
9115 *define*)
9116         dflt=n
9117         cat <<EOM
9118  
9119 Every now and then someone has a $call() that lies about the hostname
9120 but can't be fixed for political or economic reasons.  If you wish, I can
9121 pretend $call() isn't there and maybe compute hostname at run-time
9122 thanks to the '$phostname' command.
9123
9124 EOM
9125         rp="Shall I ignore $call() from now on?"
9126         . ./myread
9127         case "$ans" in
9128         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9129         esac;;
9130 esac
9131 case "$phostname" in
9132 '') aphostname='';;
9133 *) case "$aphostname" in
9134         /*) ;;
9135         *) set X $phostname
9136                 shift
9137                 file=$1
9138                 shift
9139                 file=`./loc $file $file $pth`
9140                 aphostname=`echo $file $*`
9141                 ;;
9142         esac
9143         ;;
9144 esac
9145 case "$d_uname$d_gethname" in
9146 *define*) ;;
9147 *)
9148         case "$phostname" in
9149         '')
9150                 echo "There will be no way for $package to get your hostname." >&4;;
9151         *)
9152         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9153                 ;;
9154         esac;;
9155 esac
9156 case "$d_phostname" in
9157 '') d_phostname="$undef";;
9158 esac
9159
9160 : see if this is a netdb.h system
9161 set netdb.h i_netdb
9162 eval $inhdr
9163
9164 : see if prototypes for various gethostxxx netdb.h functions are available
9165 echo " "
9166 set d_gethostprotos gethostent $i_netdb netdb.h
9167 eval $hasproto
9168
9169 : see if getlogin exists
9170 set getlogin d_getlogin
9171 eval $inlibc
9172
9173 : see if getmnt exists
9174 set getmnt d_getmnt
9175 eval $inlibc
9176
9177 : see if getmntent exists
9178 set getmntent d_getmntent
9179 eval $inlibc
9180
9181 : see if getnetbyaddr exists
9182 set getnetbyaddr d_getnbyaddr
9183 eval $inlibc
9184
9185 : see if getnetbyname exists
9186 set getnetbyname d_getnbyname
9187 eval $inlibc
9188
9189 : see if getnetent exists
9190 set getnetent d_getnent
9191 eval $inlibc
9192
9193 : see if prototypes for various getnetxxx netdb.h functions are available
9194 echo " "
9195 set d_getnetprotos getnetent $i_netdb netdb.h
9196 eval $hasproto
9197
9198
9199 : see if getprotobyname exists
9200 set getprotobyname d_getpbyname
9201 eval $inlibc
9202
9203 : see if getprotobynumber exists
9204 set getprotobynumber d_getpbynumber
9205 eval $inlibc
9206
9207 : see if getprotoent exists
9208 set getprotoent d_getpent
9209 eval $inlibc
9210
9211 : see if getpgid exists
9212 set getpgid d_getpgid
9213 eval $inlibc
9214
9215 : see if getpgrp2 exists
9216 set getpgrp2 d_getpgrp2
9217 eval $inlibc
9218
9219 : see if getppid exists
9220 set getppid d_getppid
9221 eval $inlibc
9222
9223 : see if getpriority exists
9224 set getpriority d_getprior
9225 eval $inlibc
9226
9227 : see if prototypes for various getprotoxxx netdb.h functions are available
9228 echo " "
9229 set d_getprotoprotos getprotoent $i_netdb netdb.h
9230 eval $hasproto
9231
9232 : see if getpwent exists
9233 set getpwent d_getpwent
9234 eval $inlibc
9235
9236
9237 : see if getservbyname exists
9238 set getservbyname d_getsbyname
9239 eval $inlibc
9240
9241 : see if getservbyport exists
9242 set getservbyport d_getsbyport
9243 eval $inlibc
9244
9245 : see if getservent exists
9246 set getservent d_getsent
9247 eval $inlibc
9248
9249 : see if prototypes for various getservxxx netdb.h functions are available
9250 echo " "
9251 set d_getservprotos getservent $i_netdb netdb.h
9252 eval $hasproto
9253
9254 : see if getspent exists
9255 set getspent d_getspent
9256 eval $inlibc
9257
9258 : see if getspnam exists
9259 set getspnam d_getspnam
9260 eval $inlibc
9261
9262 : see if gettimeofday or ftime exists
9263 set gettimeofday d_gettimeod
9264 eval $inlibc
9265 case "$d_gettimeod" in
9266 "$undef")
9267         set ftime d_ftime 
9268         eval $inlibc
9269         ;;
9270 *)
9271         val="$undef"; set d_ftime; eval $setvar
9272         ;;
9273 esac
9274 case "$d_gettimeod$d_ftime" in
9275 "$undef$undef")
9276         echo " "
9277         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9278         ;;
9279 esac
9280
9281 : see if this is an grp system
9282 set grp.h i_grp
9283 eval $inhdr
9284
9285 case "$i_grp" in
9286 $define)
9287         xxx=`./findhdr grp.h`
9288         $cppstdin $cppflags $cppminus < $xxx >$$.h
9289
9290         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9291                 val="$define"
9292         else
9293                 val="$undef"
9294         fi
9295         set d_grpasswd
9296         eval $setvar
9297
9298         $rm -f $$.h
9299         ;;
9300 *)
9301         val="$undef";
9302         set d_grpasswd; eval $setvar
9303         ;;
9304 esac
9305
9306 : see if hasmntopt exists
9307 set hasmntopt d_hasmntopt
9308 eval $inlibc
9309
9310 : see if this is a netinet/in.h or sys/in.h system
9311 set netinet/in.h i_niin sys/in.h i_sysin
9312 eval $inhdr
9313
9314 : see if arpa/inet.h has to be included
9315 set arpa/inet.h i_arpainet
9316 eval $inhdr
9317
9318 : see if htonl --and friends-- exists
9319 val=''
9320 set htonl val
9321 eval $inlibc
9322
9323 : Maybe they are macros.
9324 case "$val" in
9325 $undef)
9326         $cat >htonl.c <<EOM
9327 #include <stdio.h>
9328 #include <sys/types.h>
9329 #$i_niin I_NETINET_IN
9330 #$i_sysin I_SYS_IN
9331 #$i_arpainet I_ARPA_INET
9332 #ifdef I_NETINET_IN
9333 #include <netinet/in.h>
9334 #endif
9335 #ifdef I_SYS_IN
9336 #include <sys/in.h>
9337 #endif
9338 #ifdef I_ARPA_INET
9339 #include <arpa/inet.h>
9340 #endif
9341 #ifdef htonl
9342 printf("Defined as a macro.");
9343 #endif
9344 EOM
9345         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9346         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9347                 val="$define"
9348                 echo "But it seems to be defined as a macro." >&4
9349         fi
9350         $rm -f htonl.?
9351         ;;
9352 esac
9353 set d_htonl
9354 eval $setvar
9355
9356 : see if iconv exists
9357 set iconv d_iconv
9358 eval $inlibc
9359
9360 : index or strchr
9361 echo " "
9362 if set index val -f; eval $csym; $val; then
9363         if set strchr val -f d_strchr; eval $csym; $val; then
9364                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9365                         val="$define"
9366                         vali="$undef"
9367                         echo "strchr() found." >&4
9368                 else
9369                         val="$undef"
9370                         vali="$define"
9371                         echo "index() found." >&4
9372                 fi
9373         else
9374                 val="$undef"
9375                 vali="$define"
9376                 echo "index() found." >&4
9377         fi
9378 else
9379         if set strchr val -f d_strchr; eval $csym; $val; then
9380                 val="$define"
9381                 vali="$undef"
9382                 echo "strchr() found." >&4
9383         else
9384                 echo "No index() or strchr() found!" >&4
9385                 val="$undef"
9386                 vali="$undef"
9387         fi
9388 fi
9389 set d_strchr; eval $setvar
9390 val="$vali"
9391 set d_index; eval $setvar
9392
9393 : check whether inet_aton exists
9394 set inet_aton d_inetaton
9395 eval $inlibc
9396
9397 : see if inttypes.h is available
9398 : we want a real compile instead of Inhdr because some systems
9399 : have an inttypes.h which includes non-existent headers
9400 echo " "
9401 $cat >try.c <<EOCP
9402 #include <inttypes.h>
9403 int main() {
9404         static int32_t foo32 = 0x12345678;
9405 }
9406 EOCP
9407 set try
9408 if eval $compile; then
9409         echo "<inttypes.h> found." >&4
9410         val="$define"
9411 else
9412         echo "<inttypes.h> NOT found." >&4
9413         val="$undef"
9414 fi
9415 $rm -f try.c try
9416 set i_inttypes
9417 eval $setvar
9418
9419 : check for int64_t
9420 echo " "
9421 echo "Checking to see if you have int64_t..." >&4
9422 $cat >try.c <<EOCP
9423 #include <sys/types.h>
9424 #$i_inttypes I_INTTYPES
9425 #ifdef I_INTTYPES
9426 #include <inttypes.h>
9427 #endif
9428 int main() { int64_t x = 7; }
9429 EOCP
9430 set try
9431 if eval $compile; then
9432         val="$define"
9433         echo "You have int64_t."
9434 else
9435         val="$undef"
9436         echo "You do not have int64_t."
9437 fi
9438 $rm -f try try.*
9439 set d_int64_t
9440 eval $setvar
9441
9442 : Look for isascii
9443 echo " "
9444 $cat >isascii.c <<'EOCP'
9445 #include <stdio.h>
9446 #include <ctype.h>
9447 int main() {
9448         int c = 'A';
9449         if (isascii(c))
9450                 exit(0);
9451         else
9452                 exit(1);
9453 }
9454 EOCP
9455 set isascii
9456 if eval $compile; then
9457         echo "isascii() found." >&4
9458         val="$define"
9459 else
9460         echo "isascii() NOT found." >&4
9461         val="$undef"
9462 fi
9463 set d_isascii
9464 eval $setvar
9465 $rm -f isascii*
9466
9467 : see if killpg exists
9468 set killpg d_killpg
9469 eval $inlibc
9470
9471 : see if lchown exists
9472 echo " "
9473 $cat > try.c <<'EOCP'
9474 /* System header to define __stub macros and hopefully few prototypes,
9475     which can conflict with char lchown(); below.  */
9476 #include <assert.h>
9477 /* Override any gcc2 internal prototype to avoid an error.  */
9478 /* We use char because int might match the return type of a gcc2
9479    builtin and then its argument prototype would still apply.  */
9480 char lchown();
9481 int main() {
9482     /*  The GNU C library defines this for functions which it implements
9483         to always fail with ENOSYS.  Some functions are actually named
9484         something starting with __ and the normal name is an alias.  */
9485 #if defined (__stub_lchown) || defined (__stub___lchown)
9486 choke me
9487 #else
9488 lchown();
9489 #endif
9490 ; return 0; }
9491 EOCP
9492 set try
9493 if eval $compile; then
9494     $echo "lchown() found." >&4
9495     val="$define"
9496 else
9497     $echo "lchown() NOT found." >&4
9498     val="$undef"
9499 fi
9500 set d_lchown
9501 eval $setvar
9502
9503 : See if number of significant digits in a double precision number is known
9504 echo " "
9505 $cat >ldbl_dig.c <<EOM
9506 #$i_limits I_LIMITS
9507 #$i_float I_FLOAT
9508 #ifdef I_LIMITS
9509 #include <limits.h>
9510 #endif
9511 #ifdef I_FLOAT
9512 #include <float.h>
9513 #endif
9514 #ifdef LDBL_DIG
9515 printf("Contains LDBL_DIG");
9516 #endif
9517 EOM
9518 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9519 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9520         echo "LDBL_DIG found." >&4
9521         val="$define"
9522 else
9523         echo "LDBL_DIG NOT found." >&4
9524         val="$undef"
9525 fi
9526 $rm -f ldbl_dig.?
9527 set d_ldbl_dig
9528 eval $setvar
9529
9530 : see if link exists
9531 set link d_link
9532 eval $inlibc
9533
9534 : see if localeconv exists
9535 set localeconv d_locconv
9536 eval $inlibc
9537
9538 : see if lockf exists
9539 set lockf d_lockf
9540 eval $inlibc
9541
9542 : check for long long
9543 echo " "
9544 echo "Checking to see if you have long long..." >&4
9545 echo 'int main() { long long x = 7; return 0; }' > try.c
9546 set try
9547 if eval $compile; then
9548         val="$define"
9549         echo "You have have long long."
9550 else
9551         val="$undef"
9552         echo "You do not have long long."
9553 fi
9554 $rm try.*
9555 set d_longlong
9556 eval $setvar
9557
9558 : check for length of long long
9559 case "${d_longlong}${longlongsize}" in
9560 $define)
9561         echo " "
9562         echo "Checking to see how big your long longs are..." >&4
9563         $cat >try.c <<'EOCP'
9564 #include <stdio.h>
9565 int main()
9566 {
9567     printf("%d\n", (int)sizeof(long long));
9568     return(0);
9569 }
9570 EOCP
9571         set try
9572         if eval $compile_ok; then
9573                 longlongsize=`./try$exe_ext`
9574                 echo "Your long longs are $longlongsize bytes long."
9575         else
9576                 dflt='8'
9577                 echo " "
9578                 echo "(I can't seem to compile the test program.  Guessing...)"
9579                 rp="What is the size of a long long (in bytes)?"
9580                 . ./myread
9581                 longlongsize="$ans"
9582         fi
9583         if $test "X$longsize" = "X$longlongsize"; then
9584                 echo "(That isn't any different from an ordinary long.)"
9585         fi      
9586         ;;
9587 esac
9588 $rm -f try.* try
9589
9590 : see if prototype for lseek is available
9591 echo " "
9592 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9593 eval $hasproto
9594
9595 : see if lstat exists
9596 set lstat d_lstat
9597 eval $inlibc
9598
9599 : see if mblen exists
9600 set mblen d_mblen
9601 eval $inlibc
9602
9603 : see if mbstowcs exists
9604 set mbstowcs d_mbstowcs
9605 eval $inlibc
9606
9607 : see if mbtowc exists
9608 set mbtowc d_mbtowc
9609 eval $inlibc
9610
9611 : see if memchr exists
9612 set memchr d_memchr
9613 eval $inlibc
9614
9615 : see if memcmp exists
9616 set memcmp d_memcmp
9617 eval $inlibc
9618
9619 : see if memcpy exists
9620 set memcpy d_memcpy
9621 eval $inlibc
9622
9623 : see if memmove exists
9624 set memmove d_memmove
9625 eval $inlibc
9626
9627 : see if memset exists
9628 set memset d_memset
9629 eval $inlibc
9630
9631 : see if mkdir exists
9632 set mkdir d_mkdir
9633 eval $inlibc
9634
9635 : see if mkdtemp exists
9636 set mkdtemp d_mkdtemp
9637 eval $inlibc
9638
9639 : see if mkfifo exists
9640 set mkfifo d_mkfifo
9641 eval $inlibc
9642
9643 : see if mkstemp exists
9644 set mkstemp d_mkstemp
9645 eval $inlibc
9646
9647 : see if mkstemps exists
9648 set mkstemps d_mkstemps
9649 eval $inlibc
9650
9651 : see if mktime exists
9652 set mktime d_mktime
9653 eval $inlibc
9654
9655 : see if this is a sys/mman.h system
9656 set sys/mman.h i_sysmman
9657 eval $inhdr
9658
9659 : see if mmap exists
9660 set mmap d_mmap
9661 eval $inlibc
9662 : see what shmat returns
9663 : default to something harmless
9664 mmaptype='void *'
9665 case "$i_sysmman$d_mmap" in
9666 "$define$define")
9667         $cat >mmap.c <<'END'
9668 #include <sys/mman.h>
9669 void *mmap();
9670 END
9671         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9672                 mmaptype='void *'
9673         else
9674                 mmaptype='caddr_t'
9675         fi
9676         echo "and it returns ($mmaptype)." >&4
9677         ;;
9678 esac
9679
9680
9681
9682 : see if mprotect exists
9683 set mprotect d_mprotect
9684 eval $inlibc
9685
9686 : see if msgctl exists
9687 set msgctl d_msgctl
9688 eval $inlibc
9689
9690 : see if msgget exists
9691 set msgget d_msgget
9692 eval $inlibc
9693
9694 : see if msgsnd exists
9695 set msgsnd d_msgsnd
9696 eval $inlibc
9697
9698 : see if msgrcv exists
9699 set msgrcv d_msgrcv
9700 eval $inlibc
9701
9702 : see how much of the 'msg*(2)' library is present.
9703 h_msg=true
9704 echo " "
9705 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9706 *"$undef"*) h_msg=false;;
9707 esac
9708 case "$osname" in
9709 freebsd)
9710     case "`ipcs 2>&1`" in
9711     "SVID messages"*"not configured"*)
9712         echo "Your $osname does not have the msg*(2) configured." >&4
9713         h_msg=false
9714         val="$undef"
9715         set msgctl d_msgctl
9716         eval $setvar
9717         set msgget d_msgget
9718         eval $setvar
9719         set msgsnd d_msgsnd
9720         eval $setvar
9721         set msgrcv d_msgrcv
9722         eval $setvar
9723         ;;
9724     esac
9725     ;;
9726 esac
9727 : we could also check for sys/ipc.h ...
9728 if $h_msg && $test `./findhdr sys/msg.h`; then
9729         echo "You have the full msg*(2) library." >&4
9730         val="$define"
9731 else
9732         echo "You don't have the full msg*(2) library." >&4
9733         val="$undef"
9734 fi
9735 set d_msg
9736 eval $setvar
9737
9738 : see if msync exists
9739 set msync d_msync
9740 eval $inlibc
9741
9742 : see if munmap exists
9743 set munmap d_munmap
9744 eval $inlibc
9745
9746 : see if nice exists
9747 set nice d_nice
9748 eval $inlibc
9749
9750
9751 echo " "
9752 echo "Checking which 64-bit integer type we could use..." >&4
9753
9754 case "$intsize" in
9755 8) val=int
9756    set quadtype
9757    eval $setvar
9758    val='"unsigned int"'
9759    set uquadtype
9760    eval $setvar
9761    quadkind=1
9762    ;;
9763 *) case "$longsize" in
9764    8) val=long
9765       set quadtype
9766       eval $setvar
9767       val='"unsigned long"'
9768       set uquadtype
9769       eval $setvar
9770       quadkind=2
9771       ;;
9772    *) case "$d_longlong:$longlongsize" in
9773       define:8)
9774         val='"long long"'
9775         set quadtype
9776         eval $setvar
9777         val='"unsigned long long"'
9778         set uquadtype
9779         eval $setvar
9780         quadkind=3
9781         ;;
9782       *) case "$d_int64_t" in
9783          define)
9784            val=int64_t
9785            set quadtype
9786            eval $setvar
9787            val=uint64_t
9788            set uquadtype
9789            eval $setvar
9790            quadkind=4
9791            ;;
9792          esac
9793          ;;
9794       esac
9795       ;;
9796    esac
9797    ;;
9798 esac
9799
9800 case "$quadtype" in
9801 '')     echo "Alas, no 64-bit integer types in sight." >&4
9802         d_quad="$undef"
9803         ;;
9804 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9805             verb="will"
9806         else
9807             verb="could"
9808         fi
9809         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9810         d_quad="$define"
9811         ;;
9812 esac
9813
9814 : check for length of character
9815 echo " "
9816 case "$charsize" in
9817 '')
9818         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9819         $cat >try.c <<'EOCP'
9820 #include <stdio.h>
9821 int main()
9822 {
9823     printf("%d\n", (int)sizeof(char));
9824     exit(0);
9825 }
9826 EOCP
9827         set try
9828         if eval $compile_ok; then
9829                 dflt=`./try`
9830         else
9831                 dflt='1'
9832                 echo "(I can't seem to compile the test program.  Guessing...)"
9833         fi
9834         ;;
9835 *)
9836         dflt="$charsize"
9837         ;;
9838 esac
9839 rp="What is the size of a character (in bytes)?"
9840 . ./myread
9841 charsize="$ans"
9842 $rm -f try.c try
9843
9844
9845 echo " "
9846 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9847
9848 case "$use64bitint:$d_quad:$quadtype" in
9849 define:define:?*)
9850         ivtype="$quadtype"
9851         uvtype="$uquadtype"
9852         ivsize=8
9853         uvsize=8
9854         ;;
9855 *)      ivtype="long"
9856         uvtype="unsigned long"
9857         ivsize=$longsize
9858         uvsize=$longsize
9859         ;;
9860 esac
9861
9862 case "$uselongdouble:$d_longdbl" in
9863 define:define)
9864         nvtype="long double"
9865         nvsize=$longdblsize
9866         ;;
9867 *)      nvtype=double
9868         nvsize=$doublesize
9869         ;;
9870 esac
9871
9872 $echo "(IV will be "$ivtype", $ivsize bytes)"
9873 $echo "(UV will be "$uvtype", $uvsize bytes)"
9874 $echo "(NV will be "$nvtype", $nvsize bytes)"
9875
9876 $cat >try.c <<EOCP
9877 #$i_inttypes I_INTTYPES
9878 #ifdef I_INTTYPES
9879 #include <inttypes.h>
9880 #endif
9881 #include <stdio.h>
9882 int main() {
9883 #ifdef INT8
9884    int8_t i =  INT8_MAX;
9885   uint8_t u = UINT8_MAX;
9886   printf("int8_t\n");
9887 #endif
9888 #ifdef INT16
9889    int16_t i =  INT16_MAX;
9890   uint16_t i = UINT16_MAX;
9891   printf("int16_t\n");
9892 #endif
9893 #ifdef INT32
9894    int32_t i =  INT32_MAX;
9895   uint32_t u = UINT32_MAX;
9896   printf("int32_t\n");
9897 #endif
9898 }
9899 EOCP
9900
9901 case "$i8type" in
9902 '')     case "$charsize" in
9903         1)      i8type=char
9904                 u8type="unsigned char"
9905                 i8size=$charsize
9906                 u8size=$charsize
9907                 ;;
9908         esac
9909         ;;
9910 esac
9911 case "$i8type" in
9912 '')     set try -DINT8
9913         if eval $compile; then
9914                 case "`./try$exe_ext`" in
9915                 int8_t) i8type=int8_t
9916                         u8type=uint8_t
9917                         i8size=1
9918                         u8size=1
9919                         ;;
9920                 esac
9921         fi
9922         ;;
9923 esac
9924 case "$i8type" in
9925 '')     if $test $charsize -ge 1; then
9926                 i8type=char
9927                 u8type="unsigned char"
9928                 i8size=$charsize
9929                 u8size=$charsize
9930         fi
9931         ;;
9932 esac
9933
9934 case "$i16type" in
9935 '')     case "$shortsize" in
9936         2)      i16type=short
9937                 u16type="unsigned short"
9938                 i16size=$shortsize
9939                 u16size=$shortsize
9940                 ;;
9941         esac
9942         ;;
9943 esac
9944 case "$i16type" in
9945 '')     set try -DINT16
9946         if eval $compile; then
9947                 case "`./try$exe_ext`" in
9948                 int16_t)
9949                         i16type=int16_t
9950                         u16type=uint16_t
9951                         i16size=2
9952                         u16size=2
9953                         ;;
9954                 esac
9955         fi
9956         ;;
9957 esac
9958 case "$i16type" in
9959 '')     if $test $shortsize -ge 2; then
9960                 i16type=short
9961                 u16type="unsigned short"
9962                 i16size=$shortsize
9963                 u16size=$shortsize
9964         fi
9965         ;;
9966 esac
9967
9968 case "$i32type" in
9969 '')     case "$longsize" in
9970         4)      i32type=long
9971                 u32type="unsigned long"
9972                 i32size=$longsize
9973                 u32size=$longsize
9974                 ;;
9975         *)      case "$intsize" in
9976                 4)      i32type=int
9977                         u32type="unsigned int"
9978                         i32size=$intsize
9979                         u32size=$intsize
9980                         ;;
9981                 esac
9982                 ;;
9983         esac
9984         ;;
9985 esac
9986 case "$i32type" in
9987 '')     set try -DINT32
9988         if eval $compile; then
9989                 case "`./try$exe_ext`" in
9990                 int32_t)
9991                         i32type=int32_t
9992                         u32type=uint32_t
9993                         i32size=4
9994                         u32size=4
9995                         ;;
9996                 esac
9997         fi
9998         ;;
9999 esac
10000 case "$i32type" in
10001 '')     if $test $intsize -ge 4; then
10002                 i32type=int
10003                 u32type="unsigned int"
10004                 i32size=$intsize
10005                 u32size=$intsize
10006         fi
10007         ;;
10008 esac
10009
10010 case "$i64type" in
10011 '')     case "$d_quad:$quadtype" in
10012         define:?*)
10013                 i64type="$quadtype"
10014                 u64type="$uquadtype"
10015                 i64size=8
10016                 u64size=8
10017                 ;;
10018         esac
10019         ;;
10020 esac
10021
10022 $echo "Checking whether your NVs can preserve your UVs..." >&4
10023 $cat <<EOP >try.c
10024 #include <stdio.h>
10025 int main() {
10026     $uvtype k = ($uvtype)~0, l;
10027     $nvtype d;
10028     l = k;
10029     d = ($nvtype)l;
10030     l = ($uvtype)d;
10031     if (l == k)
10032        printf("preserve\n");
10033     exit(0);
10034 }
10035 EOP
10036 set try
10037 if eval $compile; then
10038         case "`./try$exe_ext`" in
10039         preserve) d_nv_preserves_uv="$define" ;;
10040         esac
10041 fi      
10042 case "$d_nv_preserves_uv" in
10043 $define) $echo "Yes, they can."  2>&1 ;;
10044 *)       $echo "No, they can't." 2>&1
10045          d_nv_preserves_uv="$undef"
10046          ;;
10047 esac
10048
10049 $rm -f try.* try
10050
10051
10052 : check for off64_t
10053 echo " "
10054 echo "Checking to see if you have off64_t..." >&4
10055 $cat >try.c <<EOCP
10056 #include <sys/types.h>
10057 #include <unistd.h>
10058 int main() { off64_t x = 7; }
10059 EOCP
10060 set try
10061 if eval $compile; then
10062         val="$define"
10063         echo "You have off64_t."
10064 else
10065         val="$undef"
10066         echo "You do not have off64_t."
10067         case "$lseeksize" in
10068         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10069         esac
10070 fi
10071 $rm -f try.* try
10072 set d_off64_t
10073 eval $setvar
10074
10075 : see if POSIX threads are available
10076 set pthread.h i_pthread
10077 eval $inhdr
10078
10079
10080
10081
10082 : how to create joinable pthreads
10083 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10084         echo " "
10085         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10086         $cat >try.c <<'EOCP'
10087 #include <pthread.h>
10088 int main() {
10089     int detachstate = JOINABLE;
10090 }
10091 EOCP
10092         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10093         if eval $compile; then
10094                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10095                 val="$undef" # Yes, undef.
10096                 set d_old_pthread_create_joinable
10097                 eval $setvar
10098                 val=""
10099                 set old_pthread_create_joinable
10100                 eval $setvar
10101         else
10102                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10103                 if eval $compile; then
10104                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10105                         val="$define"
10106                         set d_old_pthread_create_joinable
10107                         eval $setvar
10108                         val=PTHREAD_CREATE_UNDETACHED
10109                         set old_pthread_create_joinable
10110                         eval $setvar
10111                 else            
10112                         set try -DJOINABLE=__UNDETACHED
10113                         if eval $compile; then
10114                                 echo "You seem to use __UNDETACHED." >&4
10115                                 val="$define"
10116                                 set d_old_pthread_create_joinable
10117                                 eval $setvar
10118                                 val=__UNDETACHED
10119                                 set old_pthread_create_joinable
10120                                 eval $setvar
10121                         else
10122                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10123                                 val="$define"
10124                                 set d_old_pthread_create_joinable
10125                                 eval $setvar
10126                                 val=0
10127                                 set old_pthread_create_joinable
10128                                 eval $setvar
10129                         fi
10130                 fi
10131         fi
10132         $rm -f try try.*
10133 else
10134     d_old_pthread_create_joinable="$undef"
10135     old_pthread_create_joinable=""
10136 fi
10137
10138 : see if pause exists
10139 set pause d_pause
10140 eval $inlibc
10141
10142 : see if pipe exists
10143 set pipe d_pipe
10144 eval $inlibc
10145
10146 : see if poll exists
10147 set poll d_poll
10148 eval $inlibc
10149
10150
10151 : see whether the various POSIXish _yields exist
10152 $cat >try.c <<EOP
10153 #include <pthread.h>
10154 #include <stdio.h>
10155 int main() {
10156 #ifdef SCHED_YIELD
10157         sched_yield();
10158 #else
10159 #ifdef PTHREAD_YIELD
10160         pthread_yield();
10161 #else
10162 #ifdef PTHREAD_YIELD_NULL
10163         pthread_yield(NULL);
10164 #endif
10165 #endif
10166 #endif
10167 }
10168 EOP
10169 : see if sched_yield exists
10170 set try -DSCHED_YIELD
10171 if eval $compile; then
10172     val="$define"
10173     sched_yield='sched_yield()'
10174 else
10175     val="$undef"
10176 fi
10177 case "$usethreads" in
10178 $define)
10179         case "$val" in
10180         $define) echo 'sched_yield() found.' >&4        ;;
10181         *)       echo 'sched_yield() NOT found.' >&4    ;;
10182         esac
10183 esac
10184 set d_sched_yield
10185 eval $setvar
10186
10187 : see if pthread_yield exists
10188 set try -DPTHREAD_YIELD
10189 if eval $compile; then
10190     val="$define"
10191     case "$sched_yield" in
10192     '') sched_yield='pthread_yield()' ;;
10193     esac
10194 else
10195     set try -DPTHREAD_YIELD_NULL
10196     if eval $compile; then
10197         val="$define"
10198         case "$sched_yield" in
10199         '') sched_yield='pthread_yield(NULL)' ;;
10200         esac
10201     else
10202         val="$undef"
10203     fi
10204 fi
10205 case "$usethreads" in
10206 $define)
10207         case "$val" in
10208         $define) echo 'pthread_yield() found.' >&4      ;;
10209         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10210         esac
10211         ;;
10212 esac
10213 set d_pthread_yield
10214 eval $setvar
10215
10216 case "$sched_yield" in
10217 '') sched_yield=undef ;;
10218 esac
10219
10220 $rm -f try try.*
10221
10222 : see if this is a pwd.h system
10223 set pwd.h i_pwd
10224 eval $inhdr
10225
10226 case "$i_pwd" in
10227 $define)
10228         xxx=`./findhdr pwd.h`
10229         $cppstdin $cppflags $cppminus < $xxx >$$.h
10230
10231         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10232                 val="$define"
10233         else
10234                 val="$undef"
10235         fi
10236         set d_pwquota
10237         eval $setvar
10238
10239         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10240                 val="$define"
10241         else
10242                 val="$undef"
10243         fi
10244         set d_pwage
10245         eval $setvar
10246
10247         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10248                 val="$define"
10249         else
10250                 val="$undef"
10251         fi
10252         set d_pwchange
10253         eval $setvar
10254
10255         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10256                 val="$define"
10257         else
10258                 val="$undef"
10259         fi
10260         set d_pwclass
10261         eval $setvar
10262
10263         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10264                 val="$define"
10265         else
10266                 val="$undef"
10267         fi
10268         set d_pwexpire
10269         eval $setvar
10270
10271         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10272                 val="$define"
10273         else
10274                 val="$undef"
10275         fi
10276         set d_pwcomment
10277         eval $setvar
10278
10279         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10280                 val="$define"
10281         else
10282                 val="$undef"
10283         fi
10284         set d_pwgecos
10285         eval $setvar
10286
10287         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10288                 val="$define"
10289         else
10290                 val="$undef"
10291         fi
10292         set d_pwpasswd
10293         eval $setvar
10294
10295         $rm -f $$.h
10296         ;;
10297 *)
10298         val="$undef"; 
10299         set d_pwquota; eval $setvar
10300         set d_pwage; eval $setvar
10301         set d_pwchange; eval $setvar
10302         set d_pwclass; eval $setvar
10303         set d_pwexpire; eval $setvar
10304         set d_pwcomment; eval $setvar
10305         set d_pwgecos; eval $setvar
10306         set d_pwpasswd; eval $setvar
10307         ;;
10308 esac
10309
10310 : see if readdir and friends exist
10311 set readdir d_readdir
10312 eval $inlibc
10313 set seekdir d_seekdir
10314 eval $inlibc
10315 set telldir d_telldir
10316 eval $inlibc
10317 set rewinddir d_rewinddir
10318 eval $inlibc
10319
10320 : see if readlink exists
10321 set readlink d_readlink
10322 eval $inlibc
10323
10324 : see if rename exists
10325 set rename d_rename
10326 eval $inlibc
10327
10328 : see if rmdir exists
10329 set rmdir d_rmdir
10330 eval $inlibc
10331
10332 : see if memory.h is available.
10333 val=''
10334 set memory.h val
10335 eval $inhdr
10336
10337 : See if it conflicts with string.h
10338 case "$val" in
10339 $define)
10340         case "$strings" in
10341         '') ;;
10342         *)
10343                 $cppstdin $cppflags $cppminus < $strings > mem.h
10344                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10345                         echo " "
10346                         echo "We won't be including <memory.h>."
10347                         val="$undef"
10348                 fi
10349                 $rm -f mem.h
10350                 ;;
10351         esac
10352 esac
10353 set i_memory
10354 eval $setvar
10355
10356 : can bcopy handle overlapping blocks?
10357 val="$undef"
10358 case "$d_bcopy" in
10359 "$define")
10360         echo " "
10361         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10362         $cat >try.c <<EOCP
10363 #$i_memory I_MEMORY
10364 #$i_stdlib I_STDLIB
10365 #$i_string I_STRING
10366 #$i_unistd I_UNISTD
10367 EOCP
10368         $cat >>try.c <<'EOCP'
10369 #include <stdio.h>
10370 #ifdef I_MEMORY
10371 #  include <memory.h>
10372 #endif
10373 #ifdef I_STDLIB
10374 #  include <stdlib.h>
10375 #endif
10376 #ifdef I_STRING
10377 #  include <string.h>
10378 #else
10379 #  include <strings.h>
10380 #endif
10381 #ifdef I_UNISTD
10382 #  include <unistd.h>  /* Needed for NetBSD */
10383 #endif
10384 int main()
10385 {
10386 char buf[128], abc[128];
10387 char *b;
10388 int len;
10389 int off;
10390 int align;
10391
10392 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10393
10394 for (align = 7; align >= 0; align--) {
10395         for (len = 36; len; len--) {
10396                 b = buf+align;
10397                 bcopy(abc, b, len);
10398                 for (off = 1; off <= len; off++) {
10399                         bcopy(b, b+off, len);
10400                         bcopy(b+off, b, len);
10401                         if (bcmp(b, abc, len))
10402                                 exit(1);
10403                 }
10404         }
10405 }
10406 exit(0);
10407 }
10408 EOCP
10409         set try
10410         if eval $compile_ok; then
10411                 if ./try 2>/dev/null; then
10412                         echo "Yes, it can."
10413                         val="$define"
10414                 else
10415                         echo "It can't, sorry."
10416                         case "$d_memmove" in
10417                         "$define") echo "But that's Ok since you have memmove()." ;;
10418                         esac
10419                 fi
10420         else
10421                 echo "(I can't compile the test program, so we'll assume not...)"
10422                 case "$d_memmove" in
10423                 "$define") echo "But that's Ok since you have memmove()." ;;
10424                 esac
10425         fi
10426         ;;
10427 esac
10428 $rm -f try.* try core
10429 set d_safebcpy
10430 eval $setvar
10431
10432 : can memcpy handle overlapping blocks?
10433 val="$undef"
10434 case "$d_memcpy" in
10435 "$define")
10436         echo " "
10437         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10438         $cat >try.c <<EOCP
10439 #$i_memory I_MEMORY
10440 #$i_stdlib I_STDLIB
10441 #$i_string I_STRING
10442 #$i_unistd I_UNISTD
10443 EOCP
10444         $cat >>try.c <<'EOCP'
10445 #include <stdio.h>
10446 #ifdef I_MEMORY
10447 #  include <memory.h>
10448 #endif
10449 #ifdef I_STDLIB
10450 #  include <stdlib.h>
10451 #endif
10452 #ifdef I_STRING
10453 #  include <string.h>
10454 #else
10455 #  include <strings.h>
10456 #endif
10457 #ifdef I_UNISTD
10458 #  include <unistd.h>  /* Needed for NetBSD */
10459 #endif
10460 int main()
10461 {
10462 char buf[128], abc[128];
10463 char *b;
10464 int len;
10465 int off;
10466 int align;
10467
10468 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10469    try to store the string in read-only memory. */
10470 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10471
10472 for (align = 7; align >= 0; align--) {
10473         for (len = 36; len; len--) {
10474                 b = buf+align;
10475                 memcpy(b, abc, len);
10476                 for (off = 1; off <= len; off++) {
10477                         memcpy(b+off, b, len);
10478                         memcpy(b, b+off, len);
10479                         if (memcmp(b, abc, len))
10480                                 exit(1);
10481                 }
10482         }
10483 }
10484 exit(0);
10485 }
10486 EOCP
10487         set try
10488         if eval $compile_ok; then
10489                 if ./try 2>/dev/null; then
10490                         echo "Yes, it can."
10491                         val="$define"
10492                 else
10493                         echo "It can't, sorry."
10494                         case "$d_memmove" in
10495                         "$define") echo "But that's Ok since you have memmove()." ;;
10496                         esac
10497                 fi
10498         else
10499                 echo "(I can't compile the test program, so we'll assume not...)"
10500                 case "$d_memmove" in
10501                 "$define") echo "But that's Ok since you have memmove()." ;;
10502                 esac
10503         fi
10504         ;;
10505 esac
10506 $rm -f try.* try core
10507 set d_safemcpy
10508 eval $setvar
10509
10510 : can memcmp be trusted to compare relative magnitude?
10511 val="$undef"
10512 case "$d_memcmp" in
10513 "$define")
10514         echo " "
10515         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10516         $cat >try.c <<EOCP
10517 #$i_memory I_MEMORY
10518 #$i_stdlib I_STDLIB
10519 #$i_string I_STRING
10520 #$i_unistd I_UNISTD
10521 EOCP
10522         $cat >>try.c <<'EOCP'
10523 #include <stdio.h>
10524 #ifdef I_MEMORY
10525 #  include <memory.h>
10526 #endif
10527 #ifdef I_STDLIB
10528 #  include <stdlib.h>
10529 #endif
10530 #ifdef I_STRING
10531 #  include <string.h>
10532 #else
10533 #  include <strings.h>
10534 #endif
10535 #ifdef I_UNISTD
10536 #  include <unistd.h>  /* Needed for NetBSD */
10537 #endif
10538 int main()
10539 {
10540 char a = -1;
10541 char b = 0;
10542 if ((a < b) && memcmp(&a, &b, 1) < 0)
10543         exit(1);
10544 exit(0);
10545 }
10546 EOCP
10547         set try
10548         if eval $compile_ok; then
10549                 if ./try 2>/dev/null; then
10550                         echo "Yes, it can."
10551                         val="$define"
10552                 else
10553                         echo "No, it can't (it uses signed chars)."
10554                 fi
10555         else
10556                 echo "(I can't compile the test program, so we'll assume not...)"
10557         fi
10558         ;;
10559 esac
10560 $rm -f try.* try core
10561 set d_sanemcmp
10562 eval $setvar
10563
10564 : see if select exists
10565 set select d_select
10566 eval $inlibc
10567
10568 : see if semctl exists
10569 set semctl d_semctl
10570 eval $inlibc
10571
10572 : see if semget exists
10573 set semget d_semget
10574 eval $inlibc
10575
10576 : see if semop exists
10577 set semop d_semop
10578 eval $inlibc
10579
10580 : see how much of the 'sem*(2)' library is present.
10581 h_sem=true
10582 echo " "
10583 case "$d_semctl$d_semget$d_semop" in
10584 *"$undef"*) h_sem=false;;
10585 esac
10586 case "$osname" in
10587 freebsd)
10588     case "`ipcs 2>&1`" in
10589     "SVID messages"*"not configured"*)
10590         echo "Your $osname does not have the sem*(2) configured." >&4
10591         h_sem=false
10592         val="$undef"
10593         set semctl d_semctl
10594         eval $setvar
10595         set semget d_semget
10596         eval $setvar
10597         set semop d_semop
10598         eval $setvar
10599         ;;
10600     esac
10601     ;;
10602 esac
10603 : we could also check for sys/ipc.h ...
10604 if $h_sem && $test `./findhdr sys/sem.h`; then
10605         echo "You have the full sem*(2) library." >&4
10606         val="$define"
10607 else
10608         echo "You don't have the full sem*(2) library." >&4
10609         val="$undef"
10610 fi
10611 set d_sem
10612 eval $setvar
10613
10614 : see whether sys/sem.h defines union semun
10615 echo " "
10616 $cat > try.c <<'END'
10617 #include <sys/types.h>
10618 #include <sys/ipc.h>
10619 #include <sys/sem.h>
10620 int main () { union semun semun; semun.buf = 0; }
10621 END
10622 set try
10623 if eval $compile; then
10624     echo "You have union semun in <sys/sem.h>." >&4
10625     val="$define"
10626 else
10627     echo "You do not have union semun in <sys/sem.h>." >&4
10628     val="$undef"
10629 fi
10630 $rm -f try try.c try.h
10631 set d_union_semun
10632 eval $setvar
10633
10634 : see how to do semctl IPC_STAT
10635 case "$d_sem" in
10636 $define)
10637     : see whether semctl IPC_STAT can use union semun
10638     echo " "
10639     $cat > try.h <<END
10640 #ifndef S_IRUSR
10641 #   ifdef S_IREAD
10642 #       define S_IRUSR S_IREAD
10643 #       define S_IWUSR S_IWRITE
10644 #       define S_IXUSR S_IEXEC
10645 #   else
10646 #       define S_IRUSR 0400
10647 #       define S_IWUSR 0200
10648 #       define S_IXUSR 0100
10649 #   endif
10650 #   define S_IRGRP (S_IRUSR>>3)
10651 #   define S_IWGRP (S_IWUSR>>3)
10652 #   define S_IXGRP (S_IXUSR>>3)
10653 #   define S_IROTH (S_IRUSR>>6)
10654 #   define S_IWOTH (S_IWUSR>>6)
10655 #   define S_IXOTH (S_IXUSR>>6)
10656 #endif
10657 #ifndef S_IRWXU
10658 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10659 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10660 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10661 #endif
10662 END
10663
10664     $cat > try.c <<END
10665 #include <sys/types.h>
10666 #include <sys/ipc.h>
10667 #include <sys/sem.h>
10668 #include <sys/stat.h>
10669 #include <stdio.h>
10670 #include <errno.h>
10671 #include "try.h"
10672 #ifndef errno
10673 extern int errno;
10674 #endif
10675 #$d_union_semun HAS_UNION_SEMUN
10676 int main() {
10677     union semun
10678 #ifndef HAS_UNION_SEMUN
10679     {
10680         int val;
10681         struct semid_ds *buf;
10682         unsigned short *array;
10683     }
10684 #endif
10685     arg;
10686     int sem, st;
10687
10688 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10689     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10690     if (sem > -1) {
10691         struct semid_ds argbuf;
10692         arg.buf = &argbuf;
10693 #       ifdef IPC_STAT
10694         st = semctl(sem, 0, IPC_STAT, arg);
10695         if (st == 0)
10696             printf("semun\n");
10697         else
10698 #       endif /* IPC_STAT */
10699             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10700 #       ifdef IPC_RMID
10701         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10702 #       endif /* IPC_RMID */
10703             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10704     } else
10705 #endif /* IPC_PRIVATE && ... */
10706         printf("semget failed: errno = %d\n", errno);
10707   return 0;
10708 }
10709 END
10710     val="$undef"
10711     set try
10712     if eval $compile; then
10713         xxx=`./try`
10714         case "$xxx" in
10715         semun) val="$define" ;;
10716         esac
10717     fi
10718     $rm -f try try.c
10719     set d_semctl_semun
10720     eval $setvar
10721     case "$d_semctl_semun" in
10722     $define)
10723         echo "You can use union semun for semctl IPC_STAT." >&4
10724         also='also'
10725         ;;
10726     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10727         also=''
10728         ;;
10729     esac
10730
10731     : see whether semctl IPC_STAT can use struct semid_ds pointer
10732     $cat > try.c <<'END'
10733 #include <sys/types.h>
10734 #include <sys/ipc.h>
10735 #include <sys/sem.h>
10736 #include <sys/stat.h>
10737 #include "try.h"
10738 #include <stdio.h>
10739 #include <errno.h>
10740 #ifndef errno
10741 extern int errno;
10742 #endif
10743 int main() {
10744     struct semid_ds arg;
10745     int sem, st;
10746
10747 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10748     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10749     if (sem > -1) {
10750 #       ifdef IPC_STAT
10751         st = semctl(sem, 0, IPC_STAT, &arg);
10752         if (st == 0)
10753             printf("semid_ds\n");
10754         else
10755 #       endif /* IPC_STAT */
10756             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10757 #       ifdef IPC_RMID
10758         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10759 #       endif /* IPC_RMID */
10760             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10761     } else
10762 #endif /* IPC_PRIVATE && ... */
10763         printf("semget failed: errno = %d\n", errno);
10764
10765     return 0;
10766 }
10767 END
10768     val="$undef"
10769     set try
10770     if eval $compile; then
10771         xxx=`./try`
10772         case "$xxx" in
10773         semid_ds) val="$define" ;;
10774         esac
10775     fi
10776     $rm -f try try.c
10777     set d_semctl_semid_ds
10778     eval $setvar
10779     case "$d_semctl_semid_ds" in
10780     $define)
10781         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10782         ;;
10783     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10784         ;;
10785     esac
10786     $rm -f try.h
10787     ;;
10788 *)  val="$undef"
10789
10790     # We do not have the full sem*(2) library, so assume we can not
10791     # use either.
10792
10793     set d_semctl_semun
10794     eval $setvar
10795
10796     set d_semctl_semid_ds
10797     eval $setvar
10798     ;;
10799 esac
10800
10801 : see if setegid exists
10802 set setegid d_setegid
10803 eval $inlibc
10804
10805 : see if seteuid exists
10806 set seteuid d_seteuid
10807 eval $inlibc
10808
10809 : see if setgrent exists
10810 set setgrent d_setgrent
10811 eval $inlibc
10812
10813 : see if sethostent exists
10814 set sethostent d_sethent
10815 eval $inlibc
10816
10817 : see if setlinebuf exists
10818 set setlinebuf d_setlinebuf
10819 eval $inlibc
10820
10821 : see if setlocale exists
10822 set setlocale d_setlocale
10823 eval $inlibc
10824
10825 : see if setnetent exists
10826 set setnetent d_setnent
10827 eval $inlibc
10828
10829 : see if setprotoent exists
10830 set setprotoent d_setpent
10831 eval $inlibc
10832
10833 : see if setpgid exists
10834 set setpgid d_setpgid
10835 eval $inlibc
10836
10837 : see if setpgrp2 exists
10838 set setpgrp2 d_setpgrp2
10839 eval $inlibc
10840
10841 : see if setpriority exists
10842 set setpriority d_setprior
10843 eval $inlibc
10844
10845 : see if setpwent exists
10846 set setpwent d_setpwent
10847 eval $inlibc
10848
10849 : see if setregid exists
10850 set setregid d_setregid
10851 eval $inlibc
10852 set setresgid d_setresgid
10853 eval $inlibc
10854
10855 : see if setreuid exists
10856 set setreuid d_setreuid
10857 eval $inlibc
10858 set setresuid d_setresuid
10859 eval $inlibc
10860
10861 : see if setrgid exists
10862 set setrgid d_setrgid
10863 eval $inlibc
10864
10865 : see if setruid exists
10866 set setruid d_setruid
10867 eval $inlibc
10868
10869 : see if setservent exists
10870 set setservent d_setsent
10871 eval $inlibc
10872
10873 : see if setsid exists
10874 set setsid d_setsid
10875 eval $inlibc
10876
10877 : see if setspent exists
10878 set setspent d_setspent
10879 eval $inlibc
10880
10881 : see if setvbuf exists
10882 set setvbuf d_setvbuf
10883 eval $inlibc
10884
10885 : see if sfio.h is available
10886 set sfio.h i_sfio
10887 eval $inhdr
10888
10889
10890 : see if sfio library is available
10891 case "$i_sfio" in
10892 $define)
10893         val=''
10894         set sfreserve val
10895         eval $inlibc
10896         ;;
10897 *)
10898         val="$undef"
10899         ;;
10900 esac
10901 : Ok, but do we want to use it.
10902 case "$val" in
10903 $define)
10904         case "$usesfio" in
10905         true|$define|[yY]*) dflt='y';;
10906         *) dflt='n';;
10907         esac
10908         echo "$package can use the sfio library, but it is experimental."
10909         rp="You seem to have sfio available, do you want to try using it?"
10910         . ./myread
10911         case "$ans" in
10912         y|Y) ;;
10913         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10914                 val="$undef"
10915                 : Remove sfio from list of libraries to use
10916                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10917                 shift
10918                 libs="$*"
10919                 echo "libs = $libs" >&4
10920                 ;;
10921         esac
10922         ;;
10923 *)      case "$usesfio" in
10924         true|$define|[yY]*)
10925                 echo "Sorry, cannot find sfio on this machine" >&4
10926                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10927                 ;;
10928         esac
10929         ;;
10930 esac
10931 set d_sfio
10932 eval $setvar
10933 case "$d_sfio" in
10934 $define) usesfio='true';;
10935 *) usesfio='false';;
10936 esac
10937
10938 : see if shmctl exists
10939 set shmctl d_shmctl
10940 eval $inlibc
10941
10942 : see if shmget exists
10943 set shmget d_shmget
10944 eval $inlibc
10945
10946 : see if shmat exists
10947 set shmat d_shmat
10948 eval $inlibc
10949 : see what shmat returns
10950 case "$d_shmat" in
10951 "$define")
10952         $cat >shmat.c <<'END'
10953 #include <sys/shm.h>
10954 void *shmat();
10955 END
10956         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10957                 shmattype='void *'
10958         else
10959                 shmattype='char *'
10960         fi
10961         echo "and it returns ($shmattype)." >&4
10962         : see if a prototype for shmat is available
10963         xxx=`./findhdr sys/shm.h`
10964         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10965         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10966                 val="$define"
10967         else
10968                 val="$undef"
10969         fi
10970         $rm -f shmat.[co]
10971         ;;
10972 *)
10973         val="$undef"
10974         ;;
10975 esac
10976 set d_shmatprototype
10977 eval $setvar
10978
10979 : see if shmdt exists
10980 set shmdt d_shmdt
10981 eval $inlibc
10982
10983 : see how much of the 'shm*(2)' library is present.
10984 h_shm=true
10985 echo " "
10986 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10987 *"$undef"*) h_shm=false;;
10988 esac
10989 case "$osname" in
10990 freebsd)
10991     case "`ipcs 2>&1`" in
10992     "SVID shared memory"*"not configured"*)
10993         echo "Your $osname does not have the shm*(2) configured." >&4
10994         h_shm=false
10995         val="$undef"
10996         set shmctl d_shmctl
10997         evat $setvar
10998         set shmget d_shmget
10999         evat $setvar
11000         set shmat d_shmat
11001         evat $setvar
11002         set shmdt d_shmdt
11003         evat $setvar
11004         ;;
11005     esac
11006     ;;
11007 esac
11008 : we could also check for sys/ipc.h ...
11009 if $h_shm && $test `./findhdr sys/shm.h`; then
11010         echo "You have the full shm*(2) library." >&4
11011         val="$define"
11012 else
11013         echo "You don't have the full shm*(2) library." >&4
11014         val="$undef"
11015 fi
11016 set d_shm
11017 eval $setvar
11018
11019 echo " "
11020 : see if we have sigaction
11021 if set sigaction val -f d_sigaction; eval $csym; $val; then
11022         echo 'sigaction() found.' >&4
11023         $cat > try.c <<'EOP'
11024 #include <stdio.h>
11025 #include <sys/types.h>
11026 #include <signal.h>
11027 int main()
11028 {
11029     struct sigaction act, oact;
11030     act.sa_flags = 0;
11031     oact.sa_handler = 0;
11032     /* so that act and oact are used */
11033     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11034 }
11035 EOP
11036         set try
11037         if eval $compile_ok; then
11038                 val="$define"
11039         else
11040                 echo "But you don't seem to have a useable struct sigaction." >&4
11041                 val="$undef"
11042         fi
11043 else
11044         echo 'sigaction NOT found.' >&4
11045         val="$undef"
11046 fi
11047 set d_sigaction; eval $setvar
11048 $rm -f try try$_o try.c
11049
11050 : see if sigsetjmp exists
11051 echo " "
11052 case "$d_sigsetjmp" in
11053 '')
11054         $cat >try.c <<'EOP'
11055 #include <setjmp.h>
11056 sigjmp_buf env;
11057 int set = 1;
11058 int main()
11059 {
11060         if (sigsetjmp(env,1))
11061                 exit(set);
11062         set = 0;
11063         siglongjmp(env, 1);
11064         exit(1);
11065 }
11066 EOP
11067         set try
11068         if eval $compile; then
11069                 if ./try >/dev/null 2>&1; then
11070                         echo "POSIX sigsetjmp found." >&4
11071                         val="$define"
11072                 else
11073                         $cat >&4 <<EOM
11074 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11075 I'll ignore them.
11076 EOM
11077                         val="$undef"
11078                 fi
11079         else
11080                 echo "sigsetjmp not found." >&4
11081                 val="$undef"
11082         fi
11083         ;;
11084 *) val="$d_sigsetjmp"
11085         case "$d_sigsetjmp" in
11086         $define) echo "POSIX sigsetjmp found." >&4;;
11087         $undef) echo "sigsetjmp not found." >&4;;
11088         esac
11089         ;;
11090 esac
11091 set d_sigsetjmp
11092 eval $setvar
11093 $rm -f try.c try
11094
11095 : see if sys/stat.h is available
11096 set sys/stat.h i_sysstat
11097 eval $inhdr
11098
11099
11100 : see if stat knows about block sizes
11101 echo " "
11102 echo "Checking to see if your struct stat has st_blocks field..." >&4
11103 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11104 eval $hasfield
11105
11106
11107 : see if this is a sys/vfs.h system
11108 set sys/vfs.h i_sysvfs
11109 eval $inhdr
11110
11111
11112 : see if this is a sys/statfs.h system
11113 set sys/statfs.h i_sysstatfs
11114 eval $inhdr
11115
11116
11117 echo " "
11118 echo "Checking to see if your system supports struct statfs..." >&4
11119 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
11120 eval $hasstruct
11121 case "$d_statfs_s" in
11122 "$define")      echo "Yes, it does."   ;;
11123 *)              echo "No, it doesn't." ;;
11124 esac
11125
11126
11127
11128 : see if struct statfs knows about f_flags
11129 case "$d_statfs_s" in
11130 define) 
11131         echo " "
11132         echo "Checking to see if your struct statfs has f_flags field..." >&4
11133         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
11134         eval $hasfield
11135         ;;
11136 *)      val="$undef"
11137         set d_statfs_f_flags
11138         eval $setvar
11139         ;;
11140 esac
11141 case "$d_statfs_f_flags" in
11142 "$define")      echo "Yes, it does."   ;;
11143 *)              echo "No, it doesn't." ;;
11144 esac
11145
11146 : see if _ptr and _cnt from stdio act std
11147 echo " "
11148 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11149         echo "(Looks like you have stdio.h from Linux.)"
11150         case "$stdio_ptr" in
11151         '') stdio_ptr='((fp)->_IO_read_ptr)'
11152                 ptr_lval=$define
11153                 ;;
11154         *)      ptr_lval=$d_stdio_ptr_lval;;
11155         esac
11156         case "$stdio_cnt" in
11157         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11158                 cnt_lval=$undef
11159                 ;;
11160         *)      cnt_lval=$d_stdio_cnt_lval;;
11161         esac
11162         case "$stdio_base" in
11163         '') stdio_base='((fp)->_IO_read_base)';;
11164         esac
11165         case "$stdio_bufsiz" in
11166         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11167         esac
11168 else
11169         case "$stdio_ptr" in
11170         '') stdio_ptr='((fp)->_ptr)'
11171                 ptr_lval=$define
11172                 ;;
11173         *)      ptr_lval=$d_stdio_ptr_lval;;
11174         esac
11175         case "$stdio_cnt" in
11176         '') stdio_cnt='((fp)->_cnt)'
11177                 cnt_lval=$define
11178                 ;;
11179         *)      cnt_lval=$d_stdio_cnt_lval;;
11180         esac
11181         case "$stdio_base" in
11182         '') stdio_base='((fp)->_base)';;
11183         esac
11184         case "$stdio_bufsiz" in
11185         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11186         esac
11187 fi
11188 : test whether _ptr and _cnt really work
11189 echo "Checking how std your stdio is..." >&4
11190 $cat >try.c <<EOP
11191 #include <stdio.h>
11192 #define FILE_ptr(fp)    $stdio_ptr
11193 #define FILE_cnt(fp)    $stdio_cnt
11194 int main() {
11195         FILE *fp = fopen("try.c", "r");
11196         char c = getc(fp);
11197         if (
11198                 18 <= FILE_cnt(fp) &&
11199                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11200         )
11201                 exit(0);
11202         exit(1);
11203 }
11204 EOP
11205 val="$undef"
11206 set try
11207 if eval $compile; then
11208         if ./try; then
11209                 echo "Your stdio acts pretty std."
11210                 val="$define"
11211         else
11212                 echo "Your stdio isn't very std."
11213         fi
11214 else
11215         echo "Your stdio doesn't appear very std."
11216 fi
11217 $rm -f try.c try
11218 set d_stdstdio
11219 eval $setvar
11220
11221 : Can _ptr be used as an lvalue?
11222 case "$d_stdstdio$ptr_lval" in
11223 $define$define) val=$define ;;
11224 *) val=$undef ;;
11225 esac
11226 set d_stdio_ptr_lval
11227 eval $setvar
11228
11229 : Can _cnt be used as an lvalue?
11230 case "$d_stdstdio$cnt_lval" in
11231 $define$define) val=$define ;;
11232 *) val=$undef ;;
11233 esac
11234 set d_stdio_cnt_lval
11235 eval $setvar
11236
11237 : see if _base is also standard
11238 val="$undef"
11239 case "$d_stdstdio" in
11240 $define)
11241         $cat >try.c <<EOP
11242 #include <stdio.h>
11243 #define FILE_base(fp)   $stdio_base
11244 #define FILE_bufsiz(fp) $stdio_bufsiz
11245 int main() {
11246         FILE *fp = fopen("try.c", "r");
11247         char c = getc(fp);
11248         if (
11249                 19 <= FILE_bufsiz(fp) &&
11250                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11251         )
11252                 exit(0);
11253         exit(1);
11254 }
11255 EOP
11256         set try
11257         if eval $compile; then
11258                 if ./try; then
11259                         echo "And its _base field acts std."
11260                         val="$define"
11261                 else
11262                         echo "But its _base field isn't std."
11263                 fi
11264         else
11265                 echo "However, it seems to be lacking the _base field."
11266         fi
11267         $rm -f try.c try
11268         ;;
11269 esac
11270 set d_stdiobase
11271 eval $setvar
11272
11273 $cat >&4 <<EOM
11274 Checking how to access stdio streams by file descriptor number...
11275 EOM
11276 case "$stdio_stream_array" in
11277 '')     $cat >try.c <<EOCP
11278 #include <stdio.h>
11279 int main() {
11280   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11281     printf("yes\n");
11282 }
11283 EOCP
11284         for s in _iob __iob __sF
11285         do
11286                 set try -DSTDIO_STREAM_ARRAY=$s
11287                 if eval $compile; then
11288                         case "`./try$exe_ext`" in
11289                         yes)    stdio_stream_array=$s; break ;;
11290                         esac
11291                 fi
11292         done
11293         $rm -f try.* try$exe_ext
11294 esac
11295 case "$stdio_stream_array" in
11296 '')     $cat >&4 <<EOM
11297 I can't figure out how to access stdio streams by file descriptor number.
11298 EOM
11299         d_stdio_stream_array="$undef"
11300         ;;
11301 *)      $cat >&4 <<EOM
11302 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11303 EOM
11304         d_stdio_stream_array="$define"
11305         ;;
11306 esac
11307
11308 : see if strcoll exists
11309 set strcoll d_strcoll
11310 eval $inlibc
11311
11312 : check for structure copying
11313 echo " "
11314 echo "Checking to see if your C compiler can copy structs..." >&4
11315 $cat >try.c <<'EOCP'
11316 int main()
11317 {
11318         struct blurfl {
11319                 int dyick;
11320         } foo, bar;
11321
11322         foo = bar;
11323 }
11324 EOCP
11325 if $cc -c try.c >/dev/null 2>&1 ; then
11326         val="$define"
11327         echo "Yup, it can."
11328 else
11329         val="$undef"
11330         echo "Nope, it can't."
11331 fi
11332 set d_strctcpy
11333 eval $setvar
11334 $rm -f try.*
11335
11336 : see if strerror and/or sys_errlist[] exist
11337 echo " "
11338 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11339     if set strerror val -f d_strerror; eval $csym; $val; then
11340                 echo 'strerror() found.' >&4
11341                 d_strerror="$define"
11342                 d_strerrm='strerror(e)'
11343                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11344                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11345                         d_syserrlst="$define"
11346                 else
11347                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11348                         d_syserrlst="$undef"
11349                 fi
11350     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11351                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11352                 echo 'strerror() found in string header.' >&4
11353                 d_strerror="$define"
11354                 d_strerrm='strerror(e)'
11355                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11356                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11357                                 d_syserrlst="$define"
11358                 else
11359                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11360                         d_syserrlst="$undef"
11361                 fi
11362     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11363                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11364                 d_strerror="$undef"
11365                 d_syserrlst="$define"
11366                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11367     else
11368                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11369                 d_strerror="$undef"
11370                 d_syserrlst="$undef"
11371                 d_strerrm='"unknown"'
11372     fi
11373 fi
11374
11375 : see if strtod exists
11376 set strtod d_strtod
11377 eval $inlibc
11378
11379 : see if strtol exists
11380 set strtol d_strtol
11381 eval $inlibc
11382
11383 : see if strtold exists
11384 set strtold d_strtold
11385 eval $inlibc
11386
11387 : see if strtoll exists
11388 set strtoll d_strtoll
11389 eval $inlibc
11390
11391 : see if strtoul exists
11392 set strtoul d_strtoul
11393 eval $inlibc
11394
11395 : see if strtoull exists
11396 set strtoull d_strtoull
11397 eval $inlibc
11398
11399 : see if strtouq exists
11400 set strtouq d_strtouq
11401 eval $inlibc
11402
11403 : see if strxfrm exists
11404 set strxfrm d_strxfrm
11405 eval $inlibc
11406
11407 : see if symlink exists
11408 set symlink d_symlink
11409 eval $inlibc
11410
11411 : see if syscall exists
11412 set syscall d_syscall
11413 eval $inlibc
11414
11415 : see if sysconf exists
11416 set sysconf d_sysconf
11417 eval $inlibc
11418
11419 : see if system exists
11420 set system d_system
11421 eval $inlibc
11422
11423 : see if tcgetpgrp exists
11424 set tcgetpgrp d_tcgetpgrp
11425 eval $inlibc
11426
11427 : see if tcsetpgrp exists
11428 set tcsetpgrp d_tcsetpgrp
11429 eval $inlibc
11430
11431 : see if prototype for telldir is available
11432 echo " "
11433 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11434 eval $hasproto
11435
11436 : see if this is a sys/times.h system
11437 set sys/times.h i_systimes
11438 eval $inhdr
11439
11440 : see if times exists
11441 echo " "
11442 if set times val -f d_times; eval $csym; $val; then
11443         echo 'times() found.' >&4
11444         d_times="$define"
11445         inc=''
11446         case "$i_systimes" in
11447         "$define") inc='sys/times.h';;
11448         esac
11449         rp="What is the type returned by times() on this system?"
11450         set clock_t clocktype long stdio.h sys/types.h $inc
11451         eval $typedef_ask
11452 else
11453         echo 'times() NOT found, hope that will do.' >&4
11454         d_times="$undef"
11455         clocktype='int'
11456 fi
11457
11458 : see if truncate exists
11459 set truncate d_truncate
11460 eval $inlibc
11461
11462 : see if tzname[] exists
11463 echo " "
11464 if set tzname val -a d_tzname; eval $csym; $val; then
11465         val="$define"
11466         echo 'tzname[] found.' >&4
11467 else
11468         val="$undef"
11469         echo 'tzname[] NOT found.' >&4
11470 fi
11471 set d_tzname
11472 eval $setvar
11473
11474 : see if umask exists
11475 set umask d_umask
11476 eval $inlibc
11477
11478 : see if ustat exists
11479 set ustat d_ustat
11480 eval $inlibc
11481
11482 : backward compatibility for d_hvfork
11483 if test X$d_hvfork != X; then
11484         d_vfork="$d_hvfork"
11485         d_hvfork=''
11486 fi
11487 : see if there is a vfork
11488 val=''
11489 set vfork val
11490 eval $inlibc
11491
11492 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11493 : perl on Solaris 2.x, and probably elsewhere.
11494 case "$val" in
11495 $define)
11496         echo " "
11497         case "$usevfork" in
11498         false) dflt='n';;
11499         *) dflt='y';;
11500         esac
11501         cat <<'EOM'
11502  
11503 Perl can only use a vfork() that doesn't suffer from strict
11504 restrictions on calling functions or modifying global data in
11505 the child.  For example, glibc-2.1 contains such a vfork()
11506 that is unsuitable.  If your system provides a proper fork()
11507 call, chances are that you do NOT want perl to use vfork().
11508
11509 EOM
11510         rp="Do you still want to use vfork()?"
11511         . ./myread
11512         case "$ans" in
11513         y|Y) ;;
11514         *)
11515                 echo "Ok, we won't use vfork()."
11516                 val="$undef"
11517                 ;;
11518         esac
11519         ;;
11520 esac
11521 set d_vfork
11522 eval $setvar
11523 case "$d_vfork" in
11524 $define) usevfork='true';;
11525 *) usevfork='false';;
11526 esac
11527
11528 : see if this is an sysdir system
11529 set sys/dir.h i_sysdir
11530 eval $inhdr
11531
11532 : see if this is an sysndir system
11533 set sys/ndir.h i_sysndir
11534 eval $inhdr
11535
11536 : see if closedir exists
11537 set closedir d_closedir
11538 eval $inlibc
11539
11540 case "$d_closedir" in
11541 "$define")
11542         echo " "
11543         echo "Checking whether closedir() returns a status..." >&4
11544         cat > closedir.c <<EOM
11545 #$i_dirent I_DIRENT             /**/
11546 #$i_sysdir I_SYS_DIR            /**/
11547 #$i_sysndir I_SYS_NDIR          /**/
11548 #$i_systypes I_SYS_TYPES        /**/
11549
11550 #if defined(I_SYS_TYPES)
11551 #include <sys/types.h>
11552 #endif
11553 #if defined(I_DIRENT)
11554 #include <dirent.h>
11555 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11556 #include <sys/dir.h>
11557 #endif
11558 #else
11559 #ifdef I_SYS_NDIR
11560 #include <sys/ndir.h>
11561 #else
11562 #ifdef I_SYS_DIR
11563 #ifdef hp9000s500
11564 #include <ndir.h>       /* may be wrong in the future */
11565 #else
11566 #include <sys/dir.h>
11567 #endif
11568 #endif
11569 #endif
11570 #endif 
11571 int main() { return closedir(opendir(".")); }
11572 EOM
11573         set closedir
11574         if eval $compile_ok; then
11575                 if ./closedir > /dev/null 2>&1 ; then
11576                         echo "Yes, it does."
11577                         val="$undef"
11578                 else
11579                         echo "No, it doesn't."
11580                         val="$define"
11581                 fi
11582         else
11583                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11584                 val="$define"
11585         fi
11586         ;;
11587 *)
11588         val="$undef";
11589         ;;
11590 esac
11591 set d_void_closedir
11592 eval $setvar
11593 $rm -f closedir*
11594 : check for volatile keyword
11595 echo " "
11596 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11597 $cat >try.c <<'EOCP'
11598 int main()
11599 {
11600         typedef struct _goo_struct goo_struct;
11601         goo_struct * volatile goo = ((goo_struct *)0);
11602         struct _goo_struct {
11603                 long long_int;
11604                 int reg_int;
11605                 char char_var;
11606         };
11607         typedef unsigned short foo_t;
11608         char *volatile foo;
11609         volatile int bar;
11610         volatile foo_t blech;
11611         foo = foo;
11612 }
11613 EOCP
11614 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11615         val="$define"
11616         echo "Yup, it does."
11617 else
11618         val="$undef"
11619         echo "Nope, it doesn't."
11620 fi
11621 set d_volatile
11622 eval $setvar
11623 $rm -f try.*
11624
11625 : see if there is a wait4
11626 set wait4 d_wait4
11627 eval $inlibc
11628
11629 : see if waitpid exists
11630 set waitpid d_waitpid
11631 eval $inlibc
11632
11633 : see if wcstombs exists
11634 set wcstombs d_wcstombs
11635 eval $inlibc
11636
11637 : see if wctomb exists
11638 set wctomb d_wctomb
11639 eval $inlibc
11640
11641 : preserve RCS keywords in files with variable substitution, grrr
11642 Date='$Date'
11643 Id='$Id'
11644 Log='$Log'
11645 RCSfile='$RCSfile'
11646 Revision='$Revision'
11647
11648 case "$crosscompile" in
11649 ''|[nN]*) crosscompile="$undef" ;;
11650 esac
11651
11652 case "$osname" in
11653 next|rhapsody|darwin) multiarch="$define" ;;
11654 esac
11655 case "$multiarch" in
11656 ''|[nN]*) multiarch="$undef" ;;
11657 esac
11658
11659 : check for alignment requirements
11660 echo " "
11661 case "$crosscompile$multiarch" in
11662 *$define*)
11663         $cat <<EOM
11664 You seem to be either cross-compiling or doing a multiarchitecture build,
11665 skipping the memory alignment check.
11666
11667 EOM
11668         case "$alignbytes" in
11669         '') alignbytes=8 ;;
11670         esac
11671         ;;
11672 *)
11673         case "$alignbytes" in
11674         '') echo "Checking alignment constraints..." >&4
11675                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11676                         $cat >try.c <<'EOCP'
11677 typedef long double NV;
11678 EOCP
11679                 else
11680                         $cat >try.c <<'EOCP'
11681 typedef double NV;
11682 EOCP
11683                 fi
11684                 $cat >>try.c <<'EOCP'
11685 #include <stdio.h>
11686 struct foobar {
11687         char foo;
11688         NV bar;
11689 } try_algn;
11690 int main()
11691 {
11692     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11693     return(0);
11694 }
11695 EOCP
11696                 set try
11697                 if eval $compile_ok; then
11698                         dflt=`./try`
11699                 else
11700                         dflt='8'
11701                         echo "(I can't seem to compile the test program...)"
11702                 fi
11703                 ;;
11704         *) dflt="$alignbytes"
11705                 ;;
11706         esac
11707         rp="Doubles must be aligned on a how-many-byte boundary?"
11708         . ./myread
11709         alignbytes="$ans"
11710         $rm -f try.c try
11711         ;;
11712 esac
11713
11714
11715 : set the base revision
11716 baserev=5.0
11717
11718 : check for ordering of bytes in a long
11719 echo " "
11720 case "$crosscompile$multiarch" in
11721 *$define*)
11722         $cat <<EOM
11723 You seem to be either cross-compiling or doing a multiarchitecture build,
11724 skipping the byteorder check.
11725
11726 EOM
11727         byteorder='0xffff'
11728         ;;
11729 *)
11730         case "$byteorder" in
11731         '')
11732                 $cat <<'EOM'
11733 In the following, larger digits indicate more significance.  A big-endian
11734 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11735 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11736 machines may have weird orders like 3412.  A Cray will report 87654321,
11737 an Alpha will report 12345678. If the test program works the default is
11738 probably right.
11739 I'm now running the test program...
11740 EOM
11741                 $cat >try.c <<'EOCP'
11742 #include <stdio.h>
11743 int main()
11744 {
11745         int i;
11746         union {
11747                 unsigned long l;
11748                 char c[sizeof(long)];
11749         } u;
11750
11751         if (sizeof(long) > 4)
11752                 u.l = (0x08070605L << 32) | 0x04030201L;
11753         else
11754                 u.l = 0x04030201L;
11755         for (i = 0; i < sizeof(long); i++)
11756                 printf("%c", u.c[i]+'0');
11757         printf("\n");
11758         exit(0);
11759 }
11760 EOCP
11761                 xxx_prompt=y
11762                 set try
11763                 if eval $compile && ./try > /dev/null; then
11764                         dflt=`./try`
11765                         case "$dflt" in
11766                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11767                                 echo "(The test program ran ok.)"
11768                                 echo "byteorder=$dflt"
11769                                 xxx_prompt=n
11770                         ;;
11771                         ????|????????) echo "(The test program ran ok.)" ;;
11772                         *) echo "(The test program didn't run right for some reason.)" ;;
11773                         esac
11774                 else
11775                         dflt='4321'
11776                         cat <<'EOM'
11777 (I can't seem to compile the test program.  Guessing big-endian...)
11778 EOM
11779                 fi
11780                 case "$xxx_prompt" in
11781                 y)
11782                         rp="What is the order of bytes in a long?"
11783                         . ./myread
11784                         byteorder="$ans"
11785                         ;;
11786                 *)      byteorder=$dflt
11787                         ;;
11788                 esac
11789                 ;;
11790         esac
11791         $rm -f try.c try
11792         ;;
11793 esac
11794
11795
11796 : how do we catenate cpp tokens here?
11797 echo " "
11798 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11799 $cat >cpp_stuff.c <<'EOCP'
11800 #define RCAT(a,b)a/**/b
11801 #define ACAT(a,b)a ## b
11802 RCAT(Rei,ser)
11803 ACAT(Cir,cus)
11804 EOCP
11805 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11806 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11807         echo "Oh!  Smells like ANSI's been here." >&4
11808         echo "We can catify or stringify, separately or together!"
11809         cpp_stuff=42
11810 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11811         echo "Ah, yes!  The good old days!" >&4
11812         echo "However, in the good old days we don't know how to stringify and"
11813         echo "catify at the same time."
11814         cpp_stuff=1
11815 else
11816         $cat >&4 <<EOM
11817 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11818 to have to edit the values of CAT[2-5] in config.h...
11819 EOM
11820         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11821 fi
11822 $rm -f cpp_stuff.*
11823
11824 : see if this is a db.h system
11825 set db.h i_db
11826 eval $inhdr
11827
11828 case "$i_db" in
11829 $define)
11830         : Check db version.
11831         echo " "
11832         echo "Checking Berkeley DB version ..." >&4
11833         $cat >try.c <<EOCP
11834 #$d_const HASCONST
11835 #ifndef HASCONST
11836 #define const
11837 #endif
11838 #include <sys/types.h>
11839 #include <stdio.h>
11840 #include <db.h>
11841 int main()
11842 {
11843 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11844     int Major, Minor, Patch ;
11845     unsigned long Version ;
11846     (void)db_version(&Major, &Minor, &Patch) ;
11847     printf("You have Berkeley DB Version 2 or greater\n");
11848
11849     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11850                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11851     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11852                 Major, Minor, Patch) ;
11853
11854     /* check that db.h & libdb are compatible */
11855     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11856         printf("db.h and libdb are incompatible\n") ;
11857         exit(3);        
11858     }
11859
11860     printf("db.h and libdb are compatible\n") ;
11861
11862     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11863                 + DB_VERSION_PATCH ;
11864
11865     /* needs to be >= 2.3.4 */
11866     if (Version < 2003004) {
11867     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11868         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11869         exit(2);        
11870     }
11871
11872     exit(0);
11873 #else
11874 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11875     printf("You have Berkeley DB Version 1\n");
11876     exit(0);    /* DB version < 2: the coast is clear. */
11877 #else
11878     exit(1);    /* <db.h> not Berkeley DB? */
11879 #endif
11880 #endif
11881 }
11882 EOCP
11883         set try
11884         if eval $compile_ok && ./try; then
11885                 echo 'Looks OK.' >&4
11886         else
11887                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11888                 i_db=$undef
11889                 case " $libs " in
11890                 *"-ldb "*)
11891                         : Remove db from list of libraries to use
11892                         echo "Removing unusable -ldb from library list" >&4
11893                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11894                         shift
11895                         libs="$*"
11896                         echo "libs = $libs" >&4
11897                         ;;
11898                 esac
11899         fi
11900         $rm -f try.*
11901         ;;
11902 esac
11903
11904 case "$i_db" in
11905 define)
11906         : Check the return type needed for hash 
11907         echo " "
11908         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11909         $cat >try.c <<EOCP
11910 #$d_const HASCONST
11911 #ifndef HASCONST
11912 #define const
11913 #endif
11914 #include <sys/types.h>
11915 #include <db.h>
11916
11917 #ifndef DB_VERSION_MAJOR
11918 u_int32_t hash_cb (ptr, size)
11919 const void *ptr;
11920 size_t size;
11921 {
11922 }
11923 HASHINFO info;
11924 int main()
11925 {
11926         info.hash = hash_cb;
11927 }
11928 #endif
11929 EOCP
11930         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11931                 if $contains warning try.out >>/dev/null 2>&1 ; then
11932                         db_hashtype='int'
11933                 else
11934                         db_hashtype='u_int32_t'
11935                 fi
11936         else
11937                 : XXX Maybe we should just give up here.
11938                 db_hashtype=u_int32_t
11939                 $cat try.out >&4
11940                 echo "Help:  I can't seem to compile the db test program." >&4
11941                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11942         fi
11943         $rm -f try.*
11944         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11945         ;;
11946 *)      db_hashtype=u_int32_t
11947         ;;
11948 esac
11949 case "$i_db" in
11950 define)
11951         : Check the return type needed for prefix 
11952         echo " "
11953         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11954         cat >try.c <<EOCP
11955 #$d_const HASCONST
11956 #ifndef HASCONST
11957 #define const
11958 #endif
11959 #include <sys/types.h>
11960 #include <db.h>
11961
11962 #ifndef DB_VERSION_MAJOR
11963 size_t prefix_cb (key1, key2)
11964 const DBT *key1;
11965 const DBT *key2;
11966 {
11967 }
11968 BTREEINFO info;
11969 int main()
11970 {
11971         info.prefix = prefix_cb;
11972 }
11973 #endif
11974 EOCP
11975         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11976                 if $contains warning try.out >>/dev/null 2>&1 ; then
11977                         db_prefixtype='int'
11978                 else
11979                         db_prefixtype='size_t'
11980                 fi
11981         else
11982                 db_prefixtype='size_t'
11983                 : XXX Maybe we should just give up here.
11984                 $cat try.out >&4
11985                 echo "Help:  I can't seem to compile the db test program." >&4
11986                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11987         fi
11988         $rm -f try.*
11989         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11990         ;;
11991 *)      db_prefixtype='size_t'
11992         ;;
11993 esac
11994
11995 : check for void type
11996 echo " "
11997 echo "Checking to see how well your C compiler groks the void type..." >&4
11998 case "$voidflags" in
11999 '')
12000         $cat >try.c <<'EOCP'
12001 #if TRY & 1
12002 void sub() {
12003 #else
12004 sub() {
12005 #endif
12006         extern void moo();      /* function returning void */
12007         void (*goo)();          /* ptr to func returning void */
12008 #if TRY & 8
12009         void *hue;              /* generic ptr */
12010 #endif
12011 #if TRY & 2
12012         void (*foo[10])();
12013 #endif
12014
12015 #if TRY & 4
12016         if(goo == moo) {
12017                 exit(0);
12018         }
12019 #endif
12020         exit(0);
12021 }
12022 int main() { sub(); }
12023 EOCP
12024         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12025                 voidflags=$defvoidused
12026         echo "Good.  It appears to support void to the level $package wants.">&4
12027                 if $contains warning .out >/dev/null 2>&1; then
12028                         echo "However, you might get some warnings that look like this:"
12029                         $cat .out
12030                 fi
12031         else
12032 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12033                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12034                         echo "It supports 1..."
12035                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12036                                 echo "It also supports 2..."
12037                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12038                                         voidflags=7
12039                                         echo "And it supports 4 but not 8 definitely."
12040                                 else
12041                                         echo "It doesn't support 4..."
12042                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12043                                                 voidflags=11
12044                                                 echo "But it supports 8."
12045                                         else
12046                                                 voidflags=3
12047                                                 echo "Neither does it support 8."
12048                                         fi
12049                                 fi
12050                         else
12051                                 echo "It does not support 2..."
12052                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12053                                         voidflags=13
12054                                         echo "But it supports 4 and 8."
12055                                 else
12056                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12057                                                 voidflags=5
12058                                                 echo "And it supports 4 but has not heard about 8."
12059                                         else
12060                                                 echo "However it supports 8 but not 4."
12061                                         fi
12062                                 fi
12063                         fi
12064                 else
12065                         echo "There is no support at all for void."
12066                         voidflags=0
12067                 fi
12068         fi
12069 esac
12070 case "$voidflags" in
12071 "$defvoidused") ;;
12072 *)      $cat >&4 <<'EOM'
12073   Support flag bits are:
12074     1: basic void declarations.
12075     2: arrays of pointers to functions returning void.
12076     4: operations between pointers to and addresses of void functions.
12077     8: generic void pointers.
12078 EOM
12079         dflt="$voidflags";
12080         rp="Your void support flags add up to what?"
12081         . ./myread
12082         voidflags="$ans"
12083         ;;
12084 esac
12085 $rm -f try.* .out
12086
12087
12088 : How can we generate normalized random numbers ?
12089 echo " "
12090 echo "Looking for a random number function..." >&4
12091 case "$randfunc" in
12092 '')
12093         if set drand48 val -f; eval $csym; $val; then
12094                 dflt="drand48"
12095                 echo "Good, found drand48()." >&4
12096         elif set random val -f; eval $csym; $val; then
12097                 dflt="random"
12098                 echo "OK, found random()." >&4
12099         else
12100                 dflt="rand"
12101                 echo "Yick, looks like I have to use rand()." >&4
12102         fi
12103         echo " "
12104         ;;
12105 *)
12106         dflt="$randfunc"
12107         ;;
12108 esac
12109 cont=true
12110
12111 case "$ccflags" in
12112 *-Dmy_rand=*|*-Dmy_srand=*)
12113         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12114         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12115         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12116         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12117         ;;
12118 esac
12119
12120 while $test "$cont"; do
12121         rp="Use which function to generate random numbers?"
12122         . ./myread
12123         if $test "$ans" = "$dflt"; then
12124                 : null
12125         else
12126                 randbits=''
12127         fi
12128         randfunc="$ans"
12129         if set $ans val -f; eval $csym; $val; then
12130                 cont=''
12131         else
12132                 dflt=y
12133                 rp="I cannot find function $ans. Use that name anyway?"
12134                 . ./myread
12135                 dflt=rand
12136                 case "$ans" in
12137                         [yY]*) cont='';;
12138                 esac
12139         fi
12140         case "$cont" in
12141         '')
12142                 case "$randfunc" in
12143                 drand48)
12144                         drand01="drand48()"
12145                         seedfunc="srand48"
12146                         randbits=48
12147                         randseedtype=long
12148                         ;;
12149                 rand|random)
12150                         case "$randbits" in
12151                         '')
12152 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12153                                 $cat >try.c <<EOCP
12154 #$i_unistd I_UNISTD
12155 #$i_stdlib I_STDLIB
12156 #include <stdio.h>
12157 #ifdef I_UNISTD
12158 #  include <unistd.h>
12159 #endif
12160 #ifdef I_STDLIB
12161 #  include <stdlib.h>
12162 #endif
12163 int main()
12164 {
12165         register int i;
12166         register unsigned long tmp;
12167         register unsigned long max = 0L;
12168
12169         for (i = 1000; i; i--) {
12170                 tmp = (unsigned long) $randfunc();
12171                 if (tmp > max) max = tmp;
12172         }
12173         for (i = 0; max; i++)
12174                 max /= 2;
12175         printf("%d\n",i);
12176 }
12177 EOCP
12178                                 set try
12179                                 if eval $compile_ok; then
12180                                         dflt=`try`
12181                                 else
12182                                         dflt='?'
12183                                         echo "(I can't seem to compile the test program...)"
12184                                 fi
12185                                 ;;
12186                         *)
12187                                 dflt="$randbits"
12188                                 ;;
12189                         esac
12190                         rp="How many bits does your $randfunc() function produce?"
12191                         . ./myread
12192                         randbits="$ans"
12193                         $rm -f try.c try
12194                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12195                         seedfunc="s$randfunc"
12196                         randseedtype=unsigned
12197                         ;;
12198                 *)
12199                         dflt="31"
12200                         rp="How many bits does your $randfunc() function produce?"
12201                         . ./myread
12202                         randbits="$ans"
12203                         seedfunc="s$randfunc"
12204                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12205                         if set $seedfunc val -f; eval $csym; $val; then
12206                                 echo "(Using $seedfunc() to seed random generator)"
12207                         else
12208                                 echo "(Warning: no $seedfunc() to seed random generator)"
12209                                 seedfunc=rand
12210                         fi
12211                         randseedtype=unsigned
12212                         ;;
12213                 esac
12214                 ;;
12215         esac
12216 done
12217
12218 echo " "
12219 echo "Determining whether or not we are on an EBCDIC system..." >&4
12220 $cat >tebcdic.c <<'EOM'
12221 int main()
12222 {
12223   if ('M'==0xd4) return 0;
12224   return 1;
12225 }
12226 EOM
12227
12228 val=$undef
12229 set tebcdic
12230 if eval $compile_ok; then
12231         if ./tebcdic; then
12232                 echo "You have EBCDIC." >&4
12233                 val="$define"
12234         else
12235                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12236         fi
12237 else
12238         echo "I'm unable to compile the test program." >&4
12239         echo "I'll assume ASCII or some ISO Latin." >&4
12240 fi
12241 $rm -f tebcdic.c tebcdic
12242 set ebcdic
12243 eval $setvar
12244
12245 echo " "
12246 $cat >&4 <<EOM
12247 Checking how to flush all pending stdio output...
12248 EOM
12249 # I only know how to find the first 32 possibly open files on SunOS.
12250 # See also hints/sunos_4_1.sh and util.c  --AD
12251 case "$osname" in
12252 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12253 esac
12254 $cat >>try.c <<EOCP
12255 #include <stdio.h>
12256 #$i_unistd I_UNISTD
12257 #ifdef I_UNISTD
12258 # include <unistd.h>
12259 #endif
12260 #$d_sysconf HAS_SYSCONF
12261 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12262 #ifdef HAS_STDIO_STREAM_ARRAY
12263 # define STDIO_STREAM_ARRAY $stdio_stream_array
12264 #endif
12265 int main() {
12266   FILE* p = fopen("try.out", "w");
12267 #ifdef TRY_FPUTC
12268   fputc('x', p);
12269 #else
12270 # ifdef TRY_FPRINTF
12271   fprintf(p, "x");
12272 # endif
12273 #endif
12274 #ifdef TRY_FFLUSH_NULL
12275   fflush(NULL);
12276 #endif
12277 #ifdef TRY_FFLUSH_ALL
12278   {
12279     long open_max = -1;
12280 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12281     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12282 # else
12283 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12284     open_max = sysconf(_SC_OPEN_MAX);
12285 #  else
12286 #   ifdef FOPEN_MAX
12287     open_max = FOPEN_MAX;
12288 #   else
12289 #    ifdef OPEN_MAX
12290     open_max = OPEN_MAX;
12291 #    else
12292 #     ifdef _NFILE
12293     open_max = _NFILE;
12294 #     endif
12295 #    endif
12296 #   endif
12297 #  endif
12298 # endif 
12299 # ifdef HAS_STDIO_STREAM_ARRAY
12300     if (open_max > 0) {
12301       long i;
12302       for (i = 0; i < open_max; i++)
12303             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12304                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12305                 STDIO_STREAM_ARRAY[i]._flag)
12306                 fflush(&STDIO_STREAM_ARRAY[i]);
12307     }   
12308   }
12309 # endif
12310 #endif
12311   _exit(42);
12312 }
12313 EOCP
12314 : first we have to find out how _not_ to flush
12315 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12316     output=''
12317     set try -DTRY_FPUTC
12318     if eval $compile; then
12319             $rm -f try.out
12320             ./try$exe_ext 2>/dev/null
12321             if $test ! -s try.out -a "X$?" = X42; then
12322                 output=-DTRY_FPUTC
12323             fi
12324     fi
12325     case "$output" in
12326     '')
12327             set try -DTRY_FPRINTF
12328             $rm -f try.out
12329             if eval $compile; then
12330                     $rm -f try.out
12331                     ./try$exe_ext 2>/dev/null
12332                     if $test ! -s try.out -a "X$?" = X42; then
12333                         output=-DTRY_FPRINTF
12334                     fi
12335             fi
12336         ;;
12337     esac
12338 fi
12339 : check for fflush NULL behaviour
12340 case "$fflushNULL" in
12341 '')     set try -DTRY_FFLUSH_NULL $output
12342         if eval $compile; then
12343                 $rm -f try.out
12344                 ./try$exe_ext 2>/dev/null
12345                 code="$?"
12346                 if $test -s try.out -a "X$code" = X42; then
12347                         fflushNULL="`$cat try.out`"
12348                 else
12349                         if $test "X$code" != X42; then
12350                                 $cat >&4 <<EOM
12351 (If this test failed, don't worry, we'll try another method shortly.)
12352 EOM
12353                         fi
12354                 fi
12355         fi
12356         $rm -f core try.core core.try.*
12357         case "$fflushNULL" in
12358         x)      $cat >&4 <<EOM
12359 Your fflush(NULL) works okay.
12360 EOM
12361                 fflushNULL="$define"
12362                 ;;
12363         '')     $cat >&4 <<EOM
12364 Your fflush(NULL) isn't working (contrary to ANSI C).
12365 EOM
12366                 fflushNULL="$undef"
12367                 ;;
12368         *)      $cat >&4 <<EOM
12369 Cannot figure out whether your fflush(NULL) works or not.
12370 I'm assuming it doesn't (contrary to ANSI C).
12371 EOM
12372                 fflushNULL="$undef"
12373                 ;;
12374         esac
12375         ;;
12376 $define|true|[yY]*)
12377         fflushNULL="$define"
12378         ;;
12379 *)
12380         fflushNULL="$undef"
12381         ;;
12382 esac
12383 : check explicit looping only if NULL did not work
12384 case "$fflushNULL" in
12385 "$undef")
12386         : check for fflush all behaviour
12387         case "$fflushall" in
12388         '')     set try -DTRY_FFLUSH_ALL $output
12389                 if eval $compile; then
12390                         $cat >&4 <<EOM
12391 (Now testing the other method--but note that also this may fail.)
12392 EOM
12393                         $rm -f try.out
12394                         ./try$exe_ext 2>/dev/null
12395                         if $test -s try.out -a "X$?" = X42; then
12396                                 fflushall="`$cat try.out`"
12397                         fi
12398                 fi
12399                 $rm -f core try.core core.try.*
12400                 case "$fflushall" in
12401                 x)      $cat >&4 <<EOM
12402 Whew. Flushing explicitly all the stdio streams works.
12403 EOM
12404                         fflushall="$define"
12405                         ;;
12406                 '')     $cat >&4 <<EOM
12407 Sigh. Flushing explicitly all the stdio streams doesn't work.
12408 EOM
12409                         fflushall="$undef"
12410                         ;;
12411                 *)      $cat >&4 <<EOM
12412 Cannot figure out whether flushing stdio streams explicitly works or not.
12413 I'm assuming it doesn't.
12414 EOM
12415                         fflushall="$undef"
12416                         ;;
12417                 esac
12418                 ;;
12419         "$define"|true|[yY]*)
12420                 fflushall="$define"
12421                 ;;
12422         *)
12423                 fflushall="$undef"
12424                 ;;
12425         esac
12426         ;;
12427 *)      fflushall="$undef"      
12428         ;;
12429 esac
12430 case "$fflushNULL$fflushall" in
12431 undefundef)
12432         $cat <<EOM
12433 I cannot figure out how to flush pending stdio output.
12434 EOM
12435         ;;
12436 esac
12437 $rm -f try.* try$exe_ext
12438
12439 : Store the full pathname to the ar program for use in the C program
12440 : Respect a hint or command line value for full_ar.
12441 case "$full_ar" in
12442 '') full_ar=$ar ;;
12443 esac
12444
12445 : Store the full pathname to the sed program for use in the C program
12446 full_sed=$sed
12447
12448 : see what type gids are declared as in the kernel
12449 echo " "
12450 echo "Looking for the type for group ids returned by getgid()."
12451 set gid_t gidtype xxx stdio.h sys/types.h
12452 eval $typedef
12453 case "$gidtype" in
12454 xxx)
12455         xxx=`./findhdr sys/user.h`
12456         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12457         case $1 in
12458         unsigned) dflt="$1 $2" ;;
12459         *) dflt="$1" ;;
12460         esac
12461         ;;
12462 *) dflt="$gidtype";;
12463 esac
12464 case "$gidtype" in
12465 gid_t) echo "gid_t found." ;;
12466 *)      rp="What is the type for group ids returned by getgid()?"
12467         . ./myread
12468         gidtype="$ans"
12469         ;;
12470 esac
12471
12472 echo " "
12473 case "$gidtype" in
12474 *_t) zzz="$gidtype"     ;;
12475 *)   zzz="gid"          ;;
12476 esac
12477 echo "Checking the size of $zzz..." >&4 
12478 cat > try.c <<EOCP
12479 #include <sys/types.h>
12480 #include <stdio.h>
12481 int main() {
12482     printf("%d\n", (int)sizeof($gidtype));
12483     exit(0);
12484 }
12485 EOCP
12486 set try
12487 if eval $compile_ok; then
12488         yyy=`./try`
12489         case "$yyy" in
12490         '')     gidsize=4
12491                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12492                 ;;
12493         *)      gidsize=$yyy
12494                 echo "Your $zzz is $gidsize bytes long."
12495                 ;;
12496         esac
12497 else
12498         gidsize=4
12499         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12500 fi
12501
12502
12503 echo " "
12504 case "$gidtype" in
12505 *_t) zzz="$gidtype"     ;;
12506 *)   zzz="gid"          ;;
12507 esac
12508 echo "Checking the sign of $zzz..." >&4 
12509 cat > try.c <<EOCP
12510 #include <sys/types.h>
12511 #include <stdio.h>
12512 int main() {
12513         $gidtype foo = -1;
12514         if (foo < 0)
12515                 printf("-1\n");
12516         else
12517                 printf("1\n");
12518 }
12519 EOCP
12520 set try
12521 if eval $compile; then
12522         yyy=`./try`
12523         case "$yyy" in
12524         '')     gidsign=1
12525                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12526                 ;;
12527         *)      gidsign=$yyy
12528                 case "$gidsign" in
12529                  1) echo "Your $zzz is unsigned." ;;
12530                 -1) echo "Your $zzz is signed."   ;;
12531                 esac
12532                 ;;
12533         esac
12534 else
12535         gidsign=1
12536         echo "(I can't compile the test program--guessing unsigned.)" >&4
12537 fi
12538
12539
12540 echo " "
12541
12542 if $test X"$quadtype" != X; then
12543
12544 echo "Checking how to print 64-bit integers..." >&4
12545
12546 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12547         $cat >try.c <<'EOCP'
12548 #include <sys/types.h>
12549 #include <stdio.h>
12550 int main() {
12551   int q = 12345678901;
12552   printf("%ld\n", q);
12553 }
12554 EOCP
12555         set try
12556         if eval $compile; then
12557                 yyy=`./try$exe_ext`
12558                 case "$yyy" in
12559                 12345678901)
12560                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12561                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12562                         echo "We will use %d."
12563                         ;;
12564                 esac
12565         fi
12566 fi
12567
12568 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12569         $cat >try.c <<'EOCP'
12570 #include <sys/types.h>
12571 #include <stdio.h>
12572 int main() {
12573   long q = 12345678901;
12574   printf("%ld\n", q);
12575 }
12576 EOCP
12577         set try
12578         if eval $compile; then
12579                 yyy=`./try$exe_ext`
12580                 case "$yyy" in
12581                 12345678901)
12582                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12583                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12584                         echo "We will use %ld."
12585                         ;;
12586                 esac
12587         fi
12588 fi
12589
12590 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12591         $cat >try.c <<'EOCP'
12592 #include <sys/types.h>
12593 #include <inttypes.h>
12594 #include <stdio.h>
12595 int main() {
12596   int64_t q = 12345678901;
12597   printf("%" PRId64 "\n", q);
12598 }
12599 EOCP
12600         set try
12601         if eval $compile; then
12602                 yyy=`./try$exe_ext`
12603                 case "$yyy" in
12604                 12345678901)
12605                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12606                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12607                         echo "We will use the C9X style."
12608                         ;;
12609                 esac
12610         fi
12611 fi
12612
12613 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12614         $cat >try.c <<'EOCP'
12615 #include <sys/types.h>
12616 #include <stdio.h>
12617 int main() {
12618   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12619   printf("%lld\n", q);
12620 }
12621 EOCP
12622         set try
12623         if eval $compile; then
12624                 yyy=`./try$exe_ext`
12625                 case "$yyy" in
12626                 12345678901)
12627                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12628                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12629                         echo "We will use the %lld style."
12630                         ;;
12631                 esac
12632         fi
12633 fi
12634
12635 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12636         $cat >try.c <<EOCP
12637 #include <sys/types.h>
12638 #include <stdio.h>
12639 int main() {
12640   $quadtype q = 12345678901;
12641   printf("%Ld\n", q);
12642 }
12643 EOCP
12644         set try
12645         if eval $compile; then
12646                 yyy=`./try$exe_ext`
12647                 case "$yyy" in
12648                 12345678901)
12649                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12650                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12651                         echo "We will use %Ld."
12652                         ;;
12653                 esac
12654         fi
12655 fi
12656
12657 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12658         $cat >try.c <<EOCP
12659 #include <sys/types.h>
12660 #include <stdio.h>
12661 int main() {
12662   $quadtype q = 12345678901;
12663   printf("%qd\n", q);
12664 }
12665 EOCP
12666         set try
12667         if eval $compile; then
12668                 yyy=`./try$exe_ext`
12669                 case "$yyy" in
12670                 12345678901)
12671                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12672                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12673                         echo "We will use %qd."
12674                         ;;
12675                 esac
12676         fi
12677 fi
12678
12679 if $test X"$sPRId64" = X; then
12680         echo "Cannot figure out how to print 64-bit integers." >&4
12681 fi
12682
12683 $rm -f try try.*
12684
12685 fi
12686
12687 case "$sPRId64" in
12688 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12689         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12690         ;;
12691 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12692         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12693         ;;
12694 esac
12695
12696
12697 echo " "
12698 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12699
12700 if $test X"$ivsize" = X8; then
12701         ivdformat="$sPRId64"
12702         uvuformat="$sPRIu64"
12703         uvoformat="$sPRIo64"
12704         uvxformat="$sPRIx64"
12705 else
12706         if $test X"$ivsize" = X"$longsize"; then
12707                 ivdformat='"ld"'
12708                 uvuformat='"lu"'
12709                 uvoformat='"lo"'
12710                 uvxformat='"lx"'
12711         else
12712                 if $test X"$ivsize" = X"$intsize"; then
12713                         ivdformat='"d"'
12714                         uvuformat='"u"'
12715                         uvoformat='"o"'
12716                         uvxformat='"x"'
12717                 else
12718                         : far out
12719                         if $test X"$ivsize" = X"$shortsize"; then
12720                                 ivdformat='"hd"'
12721                                 uvuformat='"hu"'
12722                                 uvoformat='"ho"'
12723                                 uvxformat='"hx"'
12724                         fi
12725                 fi
12726         fi
12727 fi
12728
12729 case "$ivdformat" in
12730 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12731     exit 1
12732     ;;
12733 esac
12734
12735
12736 echo " "
12737 $echo "Checking the format string to be used for gids..." >&4
12738
12739 case "$gidsign" in
12740 -1)     if $test X"$gidsize" = X"$ivsize"; then
12741                 gidformat="$ivdformat"
12742         else
12743                 if $test X"$gidsize" = X"$longsize"; then
12744                         gidformat='"ld"'
12745                 else
12746                         if $test X"$gidsize" = X"$intsize"; then
12747                                 gidformat='"d"'
12748                         else
12749                                 if $test X"$gidsize" = X"$shortsize"; then
12750                                         gidformat='"hd"'
12751                                 fi
12752                         fi
12753                 fi
12754         fi
12755         ;;
12756 *)      if $test X"$gidsize" = X"$uvsize"; then
12757                 gidformat="$uvuformat"
12758         else
12759                 if $test X"$gidsize" = X"$longsize"; then
12760                         gidformat='"lu"'
12761                 else
12762                         if $test X"$gidsize" = X"$intsize"; then
12763                                 gidformat='"u"'
12764                         else
12765                                 if $test X"$gidsize" = X"$shortsize"; then
12766                                         gidformat='"hu"'
12767                                 fi
12768                         fi
12769                 fi
12770         fi
12771         ;;
12772 esac
12773
12774 : see if getgroups exists
12775 set getgroups d_getgrps
12776 eval $inlibc
12777
12778 : see if setgroups exists
12779 set setgroups d_setgrps
12780 eval $inlibc
12781
12782
12783 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12784 echo " "
12785 case "$d_getgrps$d_setgrps" in
12786 *define*)
12787         case "$groupstype" in
12788         '') dflt="$gidtype" ;;
12789         *)  dflt="$groupstype" ;;
12790         esac
12791         $cat <<EOM
12792 What type of pointer is the second argument to getgroups() and setgroups()?
12793 Usually this is the same as group ids, $gidtype, but not always.
12794
12795 EOM
12796         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12797         . ./myread
12798         groupstype="$ans"
12799         ;;
12800 *)  groupstype="$gidtype";;
12801 esac
12802
12803 echo " "
12804 echo "Checking if your $make program sets \$(MAKE)..." >&4
12805 case "$make_set_make" in
12806 '')
12807         $sed 's/^X //' > testmake.mak << 'EOF'
12808 Xall:
12809 X       @echo 'maketemp="$(MAKE)"'
12810 EOF
12811         case "`$make -f testmake.mak 2>/dev/null`" in
12812         *maketemp=*) make_set_make='#' ;;
12813         *)      make_set_make="MAKE=$make" ;;
12814         esac
12815         $rm -f testmake.mak
12816         ;;
12817 esac
12818 case "$make_set_make" in
12819 '#') echo "Yup, it does.";;
12820 *) echo "Nope, it doesn't.";;
12821 esac
12822
12823 : see what type is used for mode_t
12824 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12825 set mode_t modetype int stdio.h sys/types.h
12826 eval $typedef_ask
12827
12828 : define a fucntion to check prototypes
12829 $cat > protochk <<EOSH
12830 $startsh
12831 cc="$cc"
12832 optimize="$optimize"
12833 ccflags="$ccflags"
12834 prototype="$prototype"
12835 define="$define"
12836 rm=$rm
12837 EOSH
12838
12839 $cat >> protochk <<'EOSH'
12840
12841 $rm -f try.c
12842 foo="$1"
12843 shift
12844 while test $# -ge 2; do
12845         case "$1" in
12846                 $define) echo "#include <$2>" >> try.c ;;
12847                 literal) echo "$2" >> try.c ;;
12848         esac
12849     shift 2
12850 done
12851 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12852 cat >> try.c <<'EOCP'
12853 #ifdef CAN_PROTOTYPE
12854 #define _(args) args
12855 #else
12856 #define _(args) ()
12857 #endif
12858 EOCP
12859 echo "$foo" >> try.c
12860 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12861 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12862 status=$?
12863 $rm -f try.[co]
12864 exit $status
12865 EOSH
12866 chmod +x protochk
12867 $eunicefix protochk
12868
12869 : see what type is used for size_t
12870 rp="What is the type used for the length parameter for string functions?"
12871 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12872 eval $typedef_ask
12873
12874 : check for type of arguments to gethostbyaddr. 
12875 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12876         case "$d_gethbyaddr" in
12877         $define)
12878                 $cat <<EOM
12879
12880 Checking to see what type of arguments are accepted by gethostbyaddr().
12881 EOM
12882                 hdrs="$define sys/types.h
12883                         $d_socket sys/socket.h 
12884                         $i_niin netinet/in.h 
12885                         $i_netdb netdb.h
12886                         $i_unistd unistd.h"
12887                 : The first arg can 'char *' or 'void *'
12888                 : The second arg is some of integral type
12889                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12890                         for yyy in size_t long int; do
12891                                 case "$netdb_host_type" in
12892                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12893                                         if ./protochk "$try" $hdrs; then
12894                                                 echo "Your system accepts $xxx for the first arg."
12895                                                 echo "...and $yyy for the second arg."
12896                                                 netdb_host_type="$xxx"
12897                                                 netdb_hlen_type="$yyy"
12898                                         fi
12899                                         ;;
12900                                 esac
12901                         done
12902                 done
12903                 : In case none of those worked, prompt the user.
12904                 case "$netdb_host_type" in
12905                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12906                         dflt='char *'
12907                         . ./myread
12908                         netdb_host_type=$ans
12909                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12910                         dflt="$sizetype"
12911                         . ./myread
12912                         netdb_hlen_type=$ans
12913                         ;;
12914                 esac
12915                 ;;
12916         *)      : no gethostbyaddr, so pick harmless defaults
12917                 netdb_host_type='char *'
12918                 netdb_hlen_type="$sizetype"
12919                 ;;
12920         esac
12921         # Remove the "const" if needed. -- but then we'll have a 
12922         # prototype clash!
12923         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12924 fi
12925
12926 : check for type of argument to gethostbyname. 
12927 if test "X$netdb_name_type" = X ; then
12928         case "$d_gethbyname" in
12929         $define)
12930                 $cat <<EOM
12931
12932 Checking to see what type of argument is accepted by gethostbyname().
12933 EOM
12934                 hdrs="$define sys/types.h
12935                         $d_socket sys/socket.h 
12936                         $i_niin netinet/in.h 
12937                         $i_netdb netdb.h
12938                         $i_unistd unistd.h"
12939                 for xxx in "const char *" "char *"; do
12940                         case "$netdb_name_type" in
12941                         '')     try="extern struct hostent *gethostbyname($xxx);"
12942                                 if ./protochk "$try" $hdrs; then
12943                                         echo "Your system accepts $xxx."
12944                                         netdb_name_type="$xxx"
12945                                 fi
12946                                 ;;
12947                         esac
12948                 done
12949                 : In case none of those worked, prompt the user.
12950                 case "$netdb_name_type" in
12951                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12952                         dflt='char *'
12953                         . ./myread
12954                         netdb_name_type=$ans
12955                         ;;
12956                 esac
12957                 ;;
12958         *)      : no gethostbyname, so pick harmless default
12959                 netdb_name_type='char *'
12960                 ;;
12961         esac
12962 fi
12963
12964 : check for type of 1st argument to getnetbyaddr. 
12965 if test "X$netdb_net_type" = X ; then
12966         case "$d_getnbyaddr" in
12967         $define)
12968                 $cat <<EOM
12969
12970 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12971 EOM
12972                 hdrs="$define sys/types.h
12973                         $d_socket sys/socket.h 
12974                         $i_niin netinet/in.h 
12975                         $i_netdb netdb.h
12976                         $i_unistd unistd.h"
12977                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12978                         case "$netdb_net_type" in
12979                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12980                                 if ./protochk "$try" $hdrs; then
12981                                         echo "Your system accepts $xxx."
12982                                         netdb_net_type="$xxx"
12983                                 fi
12984                                 ;;
12985                         esac
12986                 done
12987                 : In case none of those worked, prompt the user.
12988                 case "$netdb_net_type" in
12989                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12990                         dflt='long'
12991                         . ./myread
12992                         netdb_net_type=$ans
12993                         ;;
12994                 esac
12995                 ;;
12996         *)      : no getnetbyaddr, so pick harmless default
12997                 netdb_net_type='long'
12998                 ;;
12999         esac
13000 fi
13001 : locate the preferred pager for this system
13002 case "$pager" in
13003 '')
13004         dflt=''
13005         case "$pg" in
13006         /*) dflt=$pg;;
13007         esac
13008         case "$more" in
13009         /*) dflt=$more;;
13010         esac
13011         case "$less" in
13012         /*) dflt=$less;;
13013         esac
13014         case "$dflt" in
13015         '') dflt=/usr/ucb/more;;
13016         esac
13017         ;;
13018 *) dflt="$pager";;
13019 esac
13020 echo " "
13021 fn=f/
13022 rp='What pager is used on your system?'
13023 . ./getfile
13024 pager="$ans"
13025
13026 : see what type pids are declared as in the kernel
13027 rp="What is the type of process ids on this system?"
13028 set pid_t pidtype int stdio.h sys/types.h
13029 eval $typedef_ask
13030
13031 : Find earliest binary compatible site_perl subdirectory perl can use.
13032 case "$bincompat5005" in
13033 "$define") xs_apiversion='5.005' ;;
13034 *) xs_apiversion=$version ;;   # The current site_perl version.
13035 esac
13036 : Find earliest pure perl site_perl subdirectory perl can use.
13037 : The versioned directories started at 5.005.
13038 pm_apiversion='5.005'
13039
13040 : check for length of pointer
13041 echo " "
13042 case "$ptrsize" in
13043 '')
13044         echo "Checking to see how big your pointers are..." >&4
13045         if test "$voidflags" -gt 7; then
13046                 echo '#define VOID_PTR char *' > try.c
13047         else
13048                 echo '#define VOID_PTR void *' > try.c
13049         fi
13050         $cat >>try.c <<'EOCP'
13051 #include <stdio.h>
13052 int main()
13053 {
13054     printf("%d\n", (int)sizeof(VOID_PTR));
13055     exit(0);
13056 }
13057 EOCP
13058         set try
13059         if eval $compile_ok; then
13060                 ptrsize=`./try`
13061                 echo "Your pointers are $ptrsize bytes long."
13062         else
13063                 dflt='4'
13064                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13065                 rp="What is the size of a pointer (in bytes)?"
13066                 . ./myread
13067                 ptrsize="$ans"
13068         fi
13069         ;;
13070 esac
13071 $rm -f try.c try
13072
13073 : see if ar generates random libraries by itself
13074 echo " "
13075 echo "Checking how to generate random libraries on your machine..." >&4
13076 echo 'int bar1() { return bar2(); }' > bar1.c
13077 echo 'int bar2() { return 2; }' > bar2.c
13078 $cat > foo.c <<'EOP'
13079 int main() { printf("%d\n", bar1()); exit(0); }
13080 EOP
13081 $cc $ccflags -c bar1.c >/dev/null 2>&1
13082 $cc $ccflags -c bar2.c >/dev/null 2>&1
13083 $cc $ccflags -c foo.c >/dev/null 2>&1
13084 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13085 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13086         ./foobar >/dev/null 2>&1; then
13087         echo "$ar appears to generate random libraries itself."
13088         orderlib=false
13089         ranlib=":"
13090 elif $ar ts bar$_a >/dev/null 2>&1 &&
13091         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13092         ./foobar >/dev/null 2>&1; then
13093                 echo "a table of contents needs to be added with '$ar ts'."
13094                 orderlib=false
13095                 ranlib="$ar ts"
13096 else
13097         case "$ranlib" in
13098         :) ranlib='';;
13099         '')
13100                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13101                 $test -f $ranlib || ranlib=''
13102                 ;;
13103         esac
13104         if $test -n "$ranlib"; then
13105                 echo "your system has '$ranlib'; we'll use that."
13106                 orderlib=false
13107         else
13108                 echo "your system doesn't seem to support random libraries"
13109                 echo "so we'll use lorder and tsort to order the libraries."
13110                 orderlib=true
13111                 ranlib=":"
13112         fi
13113 fi
13114 $rm -f foo* bar* 
13115
13116 : check for type of arguments to select. 
13117 case "$selecttype" in
13118 '') case "$d_select" in
13119         $define)
13120                 echo " "
13121                 $cat <<EOM
13122 Checking to see what type of arguments are accepted by select().
13123 EOM
13124                 hdrs="$define sys/types.h
13125                         $i_systime sys/time.h 
13126                         $i_sysselct sys/select.h
13127                         $d_socket sys/socket.h"
13128                 : The first arg can be int, unsigned, or size_t
13129                 : The last arg may or may not be 'const'
13130                 val=''
13131                 : void pointer has been seen but using that
13132                 : breaks the selectminbits test
13133                 for xxx in 'fd_set *' 'int *'; do
13134                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13135                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13136                                         case "$val" in
13137                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13138                                                 if ./protochk "$try" $hdrs; then
13139                                                         echo "Your system accepts $xxx."
13140                                                         val="$xxx"
13141                                                 fi
13142                                                 ;;
13143                                         esac
13144                                 done
13145                         done
13146                 done
13147                 case "$val" in
13148                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13149                         case "$d_fd_set" in
13150                                 $define) dflt="fd_set *" ;;
13151                                 *)              dflt="int *" ;;
13152                         esac
13153                         . ./myread
13154                         val=$ans
13155                         ;;
13156                 esac
13157                 selecttype="$val"
13158                 ;;
13159         *)      : no select, so pick a harmless default
13160                 selecttype='int *'
13161                 ;;
13162         esac
13163         ;;
13164 esac
13165
13166 : check for the select 'width'
13167 case "$selectminbits" in
13168 '') case "$d_select" in
13169         $define)
13170                 $cat <<EOM
13171
13172 Checking to see on how many bits at a time your select() operates...
13173 EOM
13174                 $cat >try.c <<EOCP
13175 #include <sys/types.h>
13176 #$i_time I_TIME
13177 #$i_systime I_SYS_TIME
13178 #$i_systimek I_SYS_TIME_KERNEL
13179 #ifdef I_TIME
13180 #   include <time.h>
13181 #endif
13182 #ifdef I_SYS_TIME
13183 #   ifdef I_SYS_TIME_KERNEL
13184 #       define KERNEL
13185 #   endif
13186 #   include <sys/time.h>
13187 #   ifdef I_SYS_TIME_KERNEL
13188 #       undef KERNEL
13189 #   endif
13190 #endif
13191 #$i_sysselct I_SYS_SELECT
13192 #ifdef I_SYS_SELECT
13193 #include <sys/select.h>
13194 #endif
13195 #$d_socket HAS_SOCKET
13196 #ifdef HAS_SOCKET
13197 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13198 #endif
13199 #include <stdio.h>
13200 $selecttype b;
13201 #define S sizeof(*(b))
13202 #define MINBITS 64
13203 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13204 #define NBITS  (NBYTES * 8)
13205 int main() {
13206     char s[NBYTES];
13207     struct timeval t;
13208     int i;
13209     FILE* fp;
13210     int fd;
13211
13212     fclose(stdin);
13213     fp = fopen("try.c", "r");
13214     if (fp == 0)
13215       exit(1);
13216     fd = fileno(fp);
13217     if (fd < 0)
13218       exit(2);
13219     b = ($selecttype)s;
13220     for (i = 0; i < NBITS; i++)
13221         FD_SET(i, b);
13222     t.tv_sec  = 0;
13223     t.tv_usec = 0;
13224     select(fd + 1, b, 0, 0, &t);
13225     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13226     printf("%d\n", i + 1);
13227     return 0;
13228 }
13229 EOCP
13230                 set try
13231                 if eval $compile_ok; then
13232                         selectminbits=`./try`
13233                         case "$selectminbits" in
13234                         '')     cat >&4 <<EOM
13235 Cannot figure out on how many bits at a time your select() operates.
13236 I'll play safe and guess it is 32 bits.
13237 EOM
13238                                 selectminbits=32
13239                                 bits="32 bits"
13240                                 ;;
13241                         1)      bits="1 bit" ;;
13242                         *)      bits="$selectminbits bits" ;;
13243                         esac
13244                         echo "Your select() operates on $bits at a time." >&4
13245                 else
13246                         rp='What is the minimum number of bits your select() operates on?'
13247                         case "$byteorder" in
13248                         1234|12345678)  dflt=32 ;;
13249                         *)              dflt=1  ;;
13250                         esac
13251                         . ./myread
13252                         val=$ans
13253                         selectminbits="$val"
13254                 fi
13255                 $rm -f try.* try
13256                 ;;
13257         *)      : no select, so pick a harmless default
13258                 selectminbits='32'
13259                 ;;
13260         esac
13261         ;;
13262 esac
13263
13264 : Trace out the files included by signal.h, then look for SIGxxx names.
13265 : Remove SIGARRAYSIZE used by HPUX.
13266 : Remove SIGSTKSIZE used by Linux.
13267 : Remove SIGSTKSZ used by Posix.
13268 : Remove SIGTYP void lines used by OS2.
13269 : Some cpps, like os390, dont give the file name anywhere
13270 if [ "X$fieldn" = X ]; then
13271         : Just make some guesses.  We check them later.
13272         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13273 else
13274         xxx=`echo '#include <signal.h>' |
13275         $cppstdin $cppminus $cppflags 2>/dev/null |
13276         $grep '^[       ]*#.*include' | 
13277         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13278 fi
13279 : Check this list of files to be sure we have parsed the cpp output ok.
13280 : This will also avoid potentially non-existent files, such 
13281 : as ../foo/bar.h
13282 xxxfiles=''
13283 for xx in $xxx /dev/null ; do
13284         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13285 done
13286 : If we have found no files, at least try signal.h
13287 case "$xxxfiles" in
13288 '')     xxxfiles=`./findhdr signal.h` ;;
13289 esac
13290 xxx=`awk '
13291 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13292         print substr($2, 4, 20)
13293 }
13294 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13295         print substr($3, 4, 20)
13296 }' $xxxfiles`
13297 : Append some common names just in case the awk scan failed.
13298 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13299 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13300 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13301 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13302 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13303
13304 : generate a few handy files for later
13305 $cat > signal.c <<'EOCP'
13306 #include <sys/types.h>
13307 #include <signal.h>
13308 #include <stdio.h>
13309 int main() {
13310
13311 /* Strange style to avoid deeply-nested #if/#else/#endif */
13312 #ifndef NSIG
13313 #  ifdef _NSIG
13314 #    define NSIG (_NSIG)
13315 #  endif
13316 #endif
13317
13318 #ifndef NSIG
13319 #  ifdef SIGMAX
13320 #    define NSIG (SIGMAX+1)
13321 #  endif
13322 #endif
13323
13324 #ifndef NSIG
13325 #  ifdef SIG_MAX
13326 #    define NSIG (SIG_MAX+1)
13327 #  endif
13328 #endif
13329
13330 #ifndef NSIG
13331 #  ifdef MAXSIG
13332 #    define NSIG (MAXSIG+1)
13333 #  endif
13334 #endif
13335
13336 #ifndef NSIG
13337 #  ifdef MAX_SIG
13338 #    define NSIG (MAX_SIG+1)
13339 #  endif
13340 #endif
13341
13342 #ifndef NSIG
13343 #  ifdef SIGARRAYSIZE
13344 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13345 #  endif
13346 #endif
13347
13348 #ifndef NSIG
13349 #  ifdef _sys_nsig
13350 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13351 #  endif
13352 #endif
13353
13354 /* Default to some arbitrary number that's big enough to get most
13355    of the common signals.
13356 */
13357 #ifndef NSIG
13358 #    define NSIG 50
13359 #endif
13360
13361 printf("NSIG %d\n", NSIG);
13362
13363 #ifndef JUST_NSIG
13364
13365 EOCP
13366
13367 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13368 {
13369         printf "#ifdef SIG"; printf $1; printf "\n"
13370         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13371         printf $1; printf ");\n"
13372         printf "#endif\n"
13373 }
13374 END {
13375         printf "#endif /* JUST_NSIG */\n";
13376         printf "exit(0);\n}\n";
13377 }
13378 ' >>signal.c
13379 $cat >signal.awk <<'EOP'
13380 BEGIN { ndups = 0 }
13381 $1 ~ /^NSIG$/ { nsig = $2 }
13382 ($1 !~ /^NSIG$/) && (NF == 2) {
13383     if ($2 > maxsig) { maxsig = $2 }
13384     if (sig_name[$2]) {
13385         dup_name[ndups] = $1
13386         dup_num[ndups] = $2
13387         ndups++ 
13388     }
13389     else {
13390         sig_name[$2] = $1
13391         sig_num[$2] = $2
13392     }
13393 }
13394 END { 
13395     if (nsig == 0) {
13396         nsig = maxsig + 1
13397     }
13398     printf("NSIG %d\n", nsig);
13399     for (n = 1; n < nsig; n++) {
13400         if (sig_name[n]) {
13401             printf("%s %d\n", sig_name[n], sig_num[n])
13402         }
13403         else {
13404             printf("NUM%d %d\n", n, n) 
13405         }
13406     }
13407     for (n = 0; n < ndups; n++) {
13408         printf("%s %d\n", dup_name[n], dup_num[n])
13409     }
13410 }
13411 EOP
13412 $cat >signal_cmd <<EOS
13413 $startsh
13414 if $test -s signal.lst; then
13415     echo "Using your existing signal.lst file"
13416         exit 0
13417 fi
13418 xxx="$xxx"
13419 EOS
13420 $cat >>signal_cmd <<'EOS'
13421
13422 set signal
13423 if eval $compile_ok; then
13424         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13425 else
13426         echo "(I can't seem be able to compile the whole test program)" >&4
13427         echo "(I'll try it in little pieces.)" >&4
13428         set signal -DJUST_NSIG
13429         if eval $compile_ok; then
13430                 ./signal$_exe > signal.nsg
13431                 $cat signal.nsg
13432         else
13433                 echo "I can't seem to figure out how many signals you have." >&4
13434                 echo "Guessing 50." >&4
13435                 echo 'NSIG 50' > signal.nsg
13436         fi
13437         : Now look at all the signal names, one at a time.
13438         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13439                 $cat > signal.c <<EOCP
13440 #include <sys/types.h>
13441 #include <signal.h>
13442 #include <stdio.h>
13443 int main() {
13444 printf("$xx %d\n", SIG${xx});
13445 return 0;
13446 }
13447 EOCP
13448                 set signal
13449                 if eval $compile; then
13450                         echo "SIG${xx} found."
13451                         ./signal$_exe  >> signal.ls1
13452                 else
13453                         echo "SIG${xx} NOT found."
13454                 fi
13455         done
13456         if $test -s signal.ls1; then
13457                 $cat signal.nsg signal.ls1 |
13458                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13459         fi
13460
13461 fi
13462 if $test -s signal.lst; then
13463         :
13464 else
13465         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13466         echo 'kill -l' >signal
13467         set X `csh -f <signal`
13468         $rm -f signal
13469         shift
13470         case $# in
13471         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13472         esac
13473         echo $@ | $tr ' ' $trnl | \
13474             $awk '{ printf "%s %d\n", $1, ++s; }
13475                   END { printf "NSIG %d\n", ++s }' >signal.lst
13476 fi
13477 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13478 EOS
13479 chmod a+x signal_cmd
13480 $eunicefix signal_cmd
13481
13482 : generate list of signal names
13483 echo " "
13484 case "$sig_name_init" in
13485 '') doinit=yes ;;
13486 *)  case "$sig_num_init" in
13487     ''|*,*) doinit=yes ;;
13488     esac ;;
13489 esac
13490 case "$doinit" in
13491 yes)
13492         echo "Generating a list of signal names and numbers..." >&4
13493         . ./signal_cmd
13494         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13495         sig_name=`$awk 'BEGIN { printf "ZERO " }
13496                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13497         sig_num=`$awk  'BEGIN { printf "0 " }
13498                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13499         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13500                              !/^NSIG/   { printf "\"%s\", ", $1 }
13501                              END        { printf "0\n" }' signal.lst`
13502         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13503                              !/^NSIG/   { printf "%d, ", $2}
13504                              END        { printf "0\n"}' signal.lst`
13505         ;;
13506 esac
13507 echo "The following $sig_count signals are available:"
13508 echo " "
13509 echo $sig_name | $awk \
13510 'BEGIN { linelen = 0 }
13511 {
13512         for (i = 1; i <= NF; i++) {
13513                 name = "SIG" $i " "
13514                 linelen = linelen + length(name)
13515                 if (linelen > 70) {
13516                         printf "\n"
13517                         linelen = length(name)
13518                 }
13519                 printf "%s", name
13520         }
13521         printf "\n"
13522 }'
13523 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13524
13525 : check for socklen_t
13526 echo " "
13527 echo "Checking to see if you have socklen_t..." >&4
13528 $cat >try.c <<EOCP
13529 #include <sys/types.h>
13530 #$d_socket HAS_SOCKET
13531 #ifdef HAS_SOCKET
13532 #include <sys/socket.h>
13533 #endif
13534 int main() { socklen_t x = 16; }
13535 EOCP
13536 set try
13537 if eval $compile; then
13538         val="$define"
13539         echo "You have socklen_t."
13540 else
13541         val="$undef"
13542         echo "You do not have socklen_t."
13543         case "$sizetype" in
13544         size_t) echo "(You do have size_t, that might work.)" ;;
13545         esac
13546 fi
13547 $rm -f try try.*
13548 set d_socklen_t
13549 eval $setvar
13550
13551 : check for type of the size argument to socket calls
13552 case "$d_socket" in
13553 "$define")
13554         $cat <<EOM
13555
13556 Checking to see what type is the last argument of accept().
13557 EOM
13558         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13559         yyy=''
13560         case "$d_socklen_t" in
13561         "$define") yyy="$yyy socklen_t"
13562         esac
13563         yyy="$yyy $sizetype int long"
13564         for xxx in $yyy; do
13565                 case "$socksizetype" in
13566                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13567                         if ./protochk "$try" $hdrs; then
13568                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13569                                 socksizetype="$xxx"
13570                         fi
13571                         ;;
13572                 esac
13573         done
13574 : In case none of those worked, prompt the user.
13575         case "$socksizetype" in
13576         '')     rp='What is the type for the last argument to accept()?'
13577                 dflt='int'
13578                 . ./myread
13579                 socksizetype=$ans
13580                 ;;
13581         esac
13582         ;;
13583 *)      : no sockets, so pick relatively harmless defaults
13584         socksizetype='char *'
13585         ;;
13586 esac
13587
13588 : see what type is used for signed size_t
13589 set ssize_t ssizetype int stdio.h sys/types.h
13590 eval $typedef
13591 dflt="$ssizetype"
13592 $cat > ssize.c <<EOM
13593 #include <stdio.h>
13594 #include <sys/types.h>
13595 #define Size_t $sizetype
13596 #define SSize_t $dflt
13597 int main()
13598 {
13599         if (sizeof(Size_t) == sizeof(SSize_t))
13600                 printf("$dflt\n");
13601         else if (sizeof(Size_t) == sizeof(int))
13602                 printf("int\n");
13603         else 
13604                 printf("long\n");
13605         exit(0);
13606 }
13607 EOM
13608 echo " "
13609 set ssize
13610 if eval $compile_ok && ./ssize > /dev/null; then
13611         ssizetype=`./ssize`
13612         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13613 else
13614         $cat >&4 <<EOM
13615 Help! I can't compile and run the ssize_t test program: please enlighten me!
13616 (This is probably a misconfiguration in your system or libraries, and
13617 you really ought to fix it.  Still, I'll try anyway.)
13618
13619 I need a type that is the same size as $sizetype, but is guaranteed to
13620 be signed.  Common values are ssize_t, int and long.
13621
13622 EOM
13623         rp="What signed type is the same size as $sizetype?"
13624         . ./myread
13625         ssizetype="$ans"
13626 fi
13627 $rm -f ssize ssize.*
13628
13629 : see what type of char stdio uses.
13630 echo " "
13631 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13632         echo "Your stdio uses unsigned chars." >&4
13633         stdchar="unsigned char"
13634 else
13635         echo "Your stdio uses signed chars." >&4
13636         stdchar="char"
13637 fi
13638
13639 : see if time exists
13640 echo " "
13641 if test "X$d_time" = X -o X"$timetype" = X; then
13642     if set time val -f d_time; eval $csym; $val; then
13643                 echo 'time() found.' >&4
13644                 val="$define"
13645                 rp="What is the type returned by time() on this system?"
13646                 set time_t timetype long stdio.h sys/types.h
13647                 eval $typedef_ask
13648     else
13649                 echo 'time() not found, hope that will do.' >&4
13650                 val="$undef"
13651                 timetype='int';
13652     fi
13653     set d_time
13654     eval $setvar
13655 fi
13656
13657 : see what type uids are declared as in the kernel
13658 echo " "
13659 echo "Looking for the type for user ids returned by getuid()."
13660 set uid_t uidtype xxx stdio.h sys/types.h
13661 eval $typedef
13662 case "$uidtype" in
13663 xxx)
13664         xxx=`./findhdr sys/user.h`
13665         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13666         case $1 in
13667         unsigned) dflt="$1 $2" ;;
13668         *) dflt="$1" ;;
13669         esac
13670         ;;
13671 *) dflt="$uidtype";;
13672 esac
13673 case "$uidtype" in
13674 uid_t)  echo "uid_t found." ;;
13675 *)      rp="What is the type for user ids returned by getuid()?"
13676         . ./myread
13677         uidtype="$ans"
13678         ;;
13679 esac
13680
13681 echo " "
13682 case "$uidtype" in
13683 *_t) zzz="$uidtype"     ;;
13684 *)   zzz="uid"          ;;
13685 esac
13686 echo "Checking the size of $zzz..." >&4 
13687 cat > try.c <<EOCP
13688 #include <sys/types.h>
13689 #include <stdio.h>
13690 int main() {
13691     printf("%d\n", (int)sizeof($uidtype));
13692     exit(0);
13693 }
13694 EOCP
13695 set try
13696 if eval $compile_ok; then
13697         yyy=`./try`
13698         case "$yyy" in
13699         '')     uidsize=4
13700                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13701                 ;;
13702         *)      uidsize=$yyy
13703                 echo "Your $zzz is $uidsize bytes long."
13704                 ;;
13705         esac
13706 else
13707         uidsize=4
13708         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13709 fi
13710
13711 echo " "
13712 case "$uidtype" in
13713 *_t) zzz="$uidtype"     ;;
13714 *)   zzz="uid"          ;;
13715 esac
13716 echo "Checking the sign of $zzz..." >&4
13717 cat > try.c <<EOCP
13718 #include <sys/types.h>
13719 #include <stdio.h>
13720 int main() {
13721         $uidtype foo = -1;
13722         if (foo < 0)
13723                 printf("-1\n");
13724         else
13725                 printf("1\n");
13726 }
13727 EOCP
13728 set try
13729 if eval $compile; then
13730         yyy=`./try`
13731         case "$yyy" in
13732         '')     uidsign=1
13733                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13734                 ;;
13735         *)      uidsign=$yyy
13736                 case "$uidsign" in
13737                  1) echo "Your $zzz is unsigned." ;;
13738                 -1) echo "Your $zzz is signed."   ;;
13739                 esac
13740                 ;;
13741         esac
13742 else
13743         uidsign=1
13744         echo "(I can't compile the test program--guessing unsigned.)" >&4
13745 fi
13746
13747
13748
13749 echo " "
13750 $echo "Checking the format string to be used for uids..." >&4
13751
13752 case "$uidsign" in
13753 -1)     if $test X"$uidsize" = X"$ivsize"; then
13754                 uidformat="$ivdformat"
13755         else
13756                 if $test X"$uidsize" = X"$longsize"; then
13757                         uidformat='"ld"'
13758                 else
13759                         if $test X"$uidsize" = X"$intsize"; then
13760                                 uidformat='"d"'
13761                         else
13762                                 if $test X"$uidsize" = X"$shortsize"; then
13763                                         uidformat='"hd"'
13764                                 fi
13765                         fi
13766                 fi
13767         fi
13768         ;;
13769 *)      if $test X"$uidsize" = X"$uvsize"; then
13770                 uidformat="$uvuformat"
13771         else
13772                 if $test X"$uidsize" = X"$longsize"; then
13773                         uidformat='"lu"'
13774                 else
13775                         if $test X"$uidsize" = X"$intsize"; then
13776                                 uidformat='"u"'
13777                         else
13778                                 if $test X"$uidsize" = X"$shortsize"; then
13779                                         uidformat='"hu"'
13780                                 fi
13781                         fi
13782                 fi
13783         fi
13784         ;;
13785 esac
13786
13787 : see if dbm.h is available
13788 : see if dbmclose exists
13789 set dbmclose d_dbmclose
13790 eval $inlibc
13791
13792 case "$d_dbmclose" in
13793 $define)
13794         set dbm.h i_dbm
13795         eval $inhdr
13796         case "$i_dbm" in
13797         $define)
13798                 val="$undef"
13799                 set i_rpcsvcdbm
13800                 eval $setvar
13801                 ;;
13802         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13803                 eval $inhdr
13804                 ;;
13805         esac
13806         ;;
13807 *)      echo "We won't be including <dbm.h>"
13808         val="$undef"
13809         set i_dbm
13810         eval $setvar
13811         val="$undef"
13812         set i_rpcsvcdbm
13813         eval $setvar
13814         ;;
13815 esac
13816
13817 : see if this is a sys/file.h system
13818 val=''
13819 set sys/file.h val
13820 eval $inhdr
13821
13822 : do we need to include sys/file.h ?
13823 case "$val" in
13824 "$define")
13825         echo " "
13826         if $h_sysfile; then
13827                 val="$define"
13828                 echo "We'll be including <sys/file.h>." >&4
13829         else
13830                 val="$undef"
13831                 echo "We won't be including <sys/file.h>." >&4
13832         fi
13833         ;;
13834 *)
13835         h_sysfile=false
13836         ;;
13837 esac
13838 set i_sysfile
13839 eval $setvar
13840
13841 : see if fcntl.h is there
13842 val=''
13843 set fcntl.h val
13844 eval $inhdr
13845
13846 : see if we can include fcntl.h
13847 case "$val" in
13848 "$define")
13849         echo " "
13850         if $h_fcntl; then
13851                 val="$define"
13852                 echo "We'll be including <fcntl.h>." >&4
13853         else
13854                 val="$undef"
13855                 if $h_sysfile; then
13856         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13857                 else
13858                         echo "We won't be including <fcntl.h>." >&4
13859                 fi
13860         fi
13861         ;;
13862 *)
13863         h_fcntl=false
13864         val="$undef"
13865         ;;
13866 esac
13867 set i_fcntl
13868 eval $setvar
13869
13870 : see if this is a iconv.h system
13871 set iconv.h i_iconv
13872 eval $inhdr
13873
13874 : see if locale.h is available
13875 set locale.h i_locale
13876 eval $inhdr
13877
13878 : see if mach cthreads are available
13879 if test "X$usethreads" = "X$define"; then
13880         set mach/cthreads.h i_machcthr
13881         eval $inhdr
13882 else
13883         i_machcthr="$undef"
13884 fi
13885
13886
13887
13888 : see if this is a math.h system
13889 set math.h i_math
13890 eval $inhdr
13891
13892 : see if this is a mntent.h system
13893 set mntent.h i_mntent
13894 eval $inhdr
13895
13896 : see if ndbm.h is available
13897 set ndbm.h t_ndbm
13898 eval $inhdr
13899 case "$t_ndbm" in
13900 $define)
13901         : see if dbm_open exists
13902         set dbm_open d_dbm_open
13903         eval $inlibc
13904         case "$d_dbm_open" in
13905         $undef)
13906                 t_ndbm="$undef"
13907                 echo "We won't be including <ndbm.h>"
13908                 ;;
13909         esac
13910         ;;
13911 esac
13912 val="$t_ndbm"
13913 set i_ndbm
13914 eval $setvar
13915
13916 : see if net/errno.h is available
13917 val=''
13918 set net/errno.h val
13919 eval $inhdr
13920
13921 : Unfortunately, it causes problems on some systems.  Arrgh.
13922 case "$val" in
13923 $define)
13924         cat > try.c <<'EOM'
13925 #include <stdio.h>
13926 #include <errno.h>
13927 #include <net/errno.h>
13928 int func()
13929 {
13930         return ENOTSOCK;
13931 }
13932 EOM
13933         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13934                 echo "We'll be including <net/errno.h>." >&4
13935         else
13936                 echo "We won't be including <net/errno.h>." >&4
13937                 val="$undef"
13938         fi
13939         $rm -f try.* try
13940         ;;
13941 esac
13942 set i_neterrno
13943 eval $setvar
13944
13945 : see if netinet/tcp.h is available
13946 set netinet/tcp.h i_netinettcp
13947 eval $inhdr
13948
13949 : see if this is a poll.h system
13950 set poll.h i_poll
13951 eval $inhdr
13952
13953 echo " "
13954 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13955 $cat <<'EOSH' > Cppsym.know
13956 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13957 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13958 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13959 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13960 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13961 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13962 bull c cadmus clipper CMU COFF COMPILER_VERSION
13963 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13964 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13965 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13966 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13967 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13968 H3050R H3050RX hbullx20 hcx host_mips
13969 hp200 hp300 hp700 HP700 hp800 hp9000
13970 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13971 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13972 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13973 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13974 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13975 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13976 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13977 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13978 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13979 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13980 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13981 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13982 MATH_HAS_NO_SIDE_EFFECTS
13983 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13984 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13985 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13986 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13987 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13988 NetBSD news1500 news1700 news1800 news1900 news3700
13989 news700 news800 news900 NeXT NLS ns16000 ns32000
13990 ns32016 ns32332 ns32k nsc32000
13991 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13992 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13993 pc532 pdp11 PGC PIC plexus PORTAR posix
13994 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13995 POSIX_C_SOURCE POSIX_SOURCE POWER
13996 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13997 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13998 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13999 sony sony_news sonyrisc sparc sparclite spectrum
14000 stardent stdc STDC_EXT stratos sun sun3 sun386
14001 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14002 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14003 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14004 sysV68 sysV88 Tek4132 Tek4300 titan
14005 tower tower32 tower32_200 tower32_600 tower32_700
14006 tower32_800 tower32_850 tss
14007 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14008 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14009 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14010 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14011 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14012 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14013 z8000
14014 EOSH
14015 # Maybe put other stuff here too.
14016 cat <<EOSH >>Cppsym.know
14017 $osname
14018 EOSH
14019 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14020 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14021 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14022 $rm -f Cppsym.a Cppsym.b
14023 cat <<EOSH > Cppsym
14024 $startsh
14025 if $test \$# -gt 0; then
14026     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14027     if $test -s Cppsym.got; then
14028         $rm -f Cppsym.got
14029         exit 0
14030     fi
14031     $rm -f Cppsym.got
14032     exit 1
14033 else
14034     $tr " " "$trnl" | ./Cppsym.try
14035     exit 0
14036 fi
14037 EOSH
14038 chmod +x Cppsym
14039 $eunicefix Cppsym
14040 cat <<EOSH > Cppsym.try
14041 $startsh
14042 cat <<'EOCP' > try.c
14043 #include <stdio.h>
14044 int main() {
14045 EOCP
14046 $awk \\
14047 EOSH
14048 cat <<'EOSH' >> Cppsym.try
14049 'length($1) > 0 {
14050     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
14051     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
14052     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
14053     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
14054 }'       >> try.c
14055 echo '}' >> try.c
14056 EOSH
14057 cat <<EOSH >> Cppsym.try
14058 cc="$cc"
14059 optimize="$optimize"
14060 ccflags="$ccflags"
14061 ldflags="$ldflags"
14062 libs="$libs"
14063 exe_ext="$exe_ext"
14064 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14065 EOSH
14066 chmod +x Cppsym.try
14067 $eunicefix Cppsym.try
14068 ./Cppsym < Cppsym.know > Cppsym.true
14069 : now check the C compiler for additional symbols
14070 postprocess_cc_v=''
14071 case "$osname" in
14072 aix) postprocess_cc_v="|$tr , ' '" ;;
14073 esac
14074 $cat >ccsym <<EOS
14075 $startsh
14076 $cat >tmp.c <<EOF
14077 extern int foo;
14078 EOF
14079 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14080 do
14081         case "\$i" in
14082         -D*) echo "\$i" | $sed 's/^-D//';;
14083         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14084         esac
14085 done
14086 $rm -f try.c
14087 EOS
14088 postprocess_cc_v=''
14089 chmod +x ccsym
14090 $eunicefix ccsym
14091 ./ccsym > ccsym1.raw
14092 if $test -s ccsym1.raw; then
14093        $sort ccsym1.raw | $uniq >ccsym.raw
14094 else
14095        mv ccsym1.raw ccsym.raw
14096 fi
14097
14098 $awk '/\=/ { print $0; next }
14099         { print $0"=1" }' ccsym.raw >ccsym.list
14100 $awk '/\=/ { print $0; next }
14101         { print $0"=1" }' Cppsym.true >ccsym.true
14102 $comm -13 ccsym.true ccsym.list >ccsym.own
14103 $comm -12 ccsym.true ccsym.list >ccsym.com
14104 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14105 also=''
14106 if $test -z ccsym.raw; then
14107         echo "Your C compiler doesn't seem to define any symbols!" >&4
14108         echo " "
14109         echo "However, your C preprocessor defines the following symbols:"
14110         $cat Cppsym.true
14111         ccsymbols=''
14112         cppsymbols=`$cat Cppsym.true`
14113         cppsymbols=`echo $cppsymbols`
14114         cppccsymbols="$cppsymbols"
14115 else
14116         if $test -s ccsym.com; then
14117                 echo "Your C compiler and pre-processor define these symbols:"
14118                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14119                 also='also '
14120                 symbols='ones'
14121                 cppccsymbols=`$cat ccsym.com`
14122                 cppccsymbols=`echo $cppccsymbols`
14123                 $test "$silent" || sleep 1
14124         fi
14125         if $test -s ccsym.cpp; then
14126                 $test "$also" && echo " "
14127                 echo "Your C pre-processor ${also}defines the following symbols:"
14128                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14129                 also='further '
14130                 cppsymbols=`$cat ccsym.cpp`
14131                 cppsymbols=`echo $cppsymbols`
14132                 $test "$silent" || sleep 1
14133         fi
14134         if $test -s ccsym.own; then
14135                 $test "$also" && echo " "
14136                 echo "Your C compiler ${also}defines the following cpp symbols:"
14137                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14138                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14139                 ccsymbols=`$cat ccsym.own`
14140                 ccsymbols=`echo $ccsymbols`
14141                 $test "$silent" || sleep 1
14142         fi
14143 fi
14144 $rm -f ccsym*
14145
14146 : see if this is a termio system
14147 val="$undef"
14148 val2="$undef"
14149 val3="$undef"
14150 if $test `./findhdr termios.h`; then
14151         set tcsetattr i_termios
14152         eval $inlibc
14153         val3="$i_termios"
14154 fi
14155 echo " "
14156 case "$val3" in
14157 "$define") echo "You have POSIX termios.h... good!" >&4;;
14158 *) if ./Cppsym pyr; then
14159                 case "`/bin/universe`" in
14160                 ucb) if $test `./findhdr sgtty.h`; then
14161                                 val2="$define"
14162                                 echo "<sgtty.h> found." >&4
14163                         else
14164                                 echo "System is pyramid with BSD universe."
14165                                 echo "<sgtty.h> not found--you could have problems." >&4
14166                         fi;;
14167                 *) if $test `./findhdr termio.h`; then
14168                                 val="$define"
14169                                 echo "<termio.h> found." >&4
14170                         else
14171                                 echo "System is pyramid with USG universe."
14172                                 echo "<termio.h> not found--you could have problems." >&4
14173                         fi;;
14174                 esac
14175         elif ./usg; then
14176                 if $test `./findhdr termio.h`; then
14177                         echo "<termio.h> found." >&4
14178                         val="$define"
14179                 elif $test `./findhdr sgtty.h`; then
14180                         echo "<sgtty.h> found." >&4
14181                         val2="$define"
14182                 else
14183 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14184                 fi
14185         else
14186                 if $test `./findhdr sgtty.h`; then
14187                         echo "<sgtty.h> found." >&4
14188                         val2="$define"
14189                 elif $test `./findhdr termio.h`; then
14190                         echo "<termio.h> found." >&4
14191                         val="$define"
14192                 else
14193 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14194                 fi
14195         fi;;
14196 esac
14197 set i_termio; eval $setvar
14198 val=$val2; set i_sgtty; eval $setvar
14199 val=$val3; set i_termios; eval $setvar
14200
14201 : see if this is a shadow.h system
14202 set shadow.h i_shadow
14203 eval $inhdr
14204
14205 : see if this is a socks.h system
14206 set socks.h i_socks
14207 eval $inhdr
14208
14209 : see if stdarg is available
14210 echo " "
14211 if $test `./findhdr stdarg.h`; then
14212         echo "<stdarg.h> found." >&4
14213         valstd="$define"
14214 else
14215         echo "<stdarg.h> NOT found." >&4
14216         valstd="$undef"
14217 fi
14218
14219 : see if varags is available
14220 echo " "
14221 if $test `./findhdr varargs.h`; then
14222         echo "<varargs.h> found." >&4
14223 else
14224         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14225 fi
14226
14227 : set up the varargs testing programs
14228 $cat > varargs.c <<EOP
14229 #ifdef I_STDARG
14230 #include <stdarg.h>
14231 #endif
14232 #ifdef I_VARARGS
14233 #include <varargs.h>
14234 #endif
14235
14236 #ifdef I_STDARG
14237 int f(char *p, ...)
14238 #else
14239 int f(va_alist)
14240 va_dcl
14241 #endif
14242 {
14243         va_list ap;
14244 #ifndef I_STDARG
14245         char *p;
14246 #endif
14247 #ifdef I_STDARG
14248         va_start(ap,p);
14249 #else
14250         va_start(ap);
14251         p = va_arg(ap, char *);
14252 #endif
14253         va_end(ap);
14254 }
14255 EOP
14256 $cat > varargs <<EOP
14257 $startsh
14258 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14259         echo "true"
14260 else
14261         echo "false"
14262 fi
14263 $rm -f varargs$_o
14264 EOP
14265 chmod +x varargs
14266
14267 : now check which varargs header should be included
14268 echo " "
14269 i_varhdr=''
14270 case "$valstd" in
14271 "$define")
14272         if `./varargs I_STDARG`; then
14273                 val='stdarg.h'
14274         elif `./varargs I_VARARGS`; then
14275                 val='varargs.h'
14276         fi
14277         ;;
14278 *)
14279         if `./varargs I_VARARGS`; then
14280                 val='varargs.h'
14281         fi
14282         ;;
14283 esac
14284 case "$val" in
14285 '')
14286 echo "I could not find the definition for va_dcl... You have problems..." >&4
14287         val="$undef"; set i_stdarg; eval $setvar
14288         val="$undef"; set i_varargs; eval $setvar
14289         ;;
14290 *) 
14291         set i_varhdr
14292         eval $setvar
14293         case "$i_varhdr" in
14294         stdarg.h)
14295                 val="$define"; set i_stdarg; eval $setvar
14296                 val="$undef"; set i_varargs; eval $setvar
14297                 ;;
14298         varargs.h)
14299                 val="$undef"; set i_stdarg; eval $setvar
14300                 val="$define"; set i_varargs; eval $setvar
14301                 ;;
14302         esac
14303         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14304 esac
14305 $rm -f varargs*
14306
14307 : see if stddef is available
14308 set stddef.h i_stddef
14309 eval $inhdr
14310
14311 : see if sys/access.h is available
14312 set sys/access.h i_sysaccess
14313 eval $inhdr
14314
14315 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14316 set sys/filio.h i_sysfilio
14317 eval $inhdr
14318 echo " "
14319 if $test `./findhdr sys/ioctl.h`; then
14320         val="$define"
14321         echo '<sys/ioctl.h> found.' >&4
14322 else
14323         val="$undef"
14324         if $test $i_sysfilio = "$define"; then
14325             echo '<sys/ioctl.h> NOT found.' >&4
14326         else
14327                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14328                 $test $i_termio = "$define" && xxx="termio.h"
14329                 $test $i_termios = "$define" && xxx="termios.h"
14330 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14331         fi
14332 fi
14333 set i_sysioctl
14334 eval $setvar
14335
14336
14337 : see if this is a syslog.h system
14338 set syslog.h i_syslog
14339 eval $inhdr
14340
14341
14342 : see if this is a sys/mode.h system
14343 set sys/mode.h i_sysmode
14344 eval $inhdr
14345
14346 : see if sys/resource.h has to be included
14347 set sys/resource.h i_sysresrc
14348 eval $inhdr
14349
14350 : see if sys/security.h is available
14351 set sys/security.h i_syssecrt
14352 eval $inhdr
14353
14354 : see if this is a sys/statvfs.h system
14355 set sys/statvfs.h i_sysstatvfs
14356 eval $inhdr
14357
14358 : see if this is a sys/uio.h system
14359 set sys/uio.h i_sysuio
14360 eval $inhdr
14361
14362 : see if this is a sys/un.h system
14363 set sys/un.h i_sysun
14364 eval $inhdr
14365
14366
14367 : see if this is a sys/utsname.h system
14368 set sys/utsname.h i_sysutsname
14369 eval $inhdr
14370
14371 : see if this is a syswait system
14372 set sys/wait.h i_syswait
14373 eval $inhdr
14374
14375 : see if this is a ustat.h system
14376 set ustat.h i_ustat
14377 eval $inhdr
14378
14379 : see if this is an utime system
14380 set utime.h i_utime
14381 eval $inhdr
14382
14383 : see if this is a values.h system
14384 set values.h i_values
14385 eval $inhdr
14386
14387 : see if this is a vfork system
14388 case "$d_vfork" in
14389 "$define")
14390         set vfork.h i_vfork
14391         eval $inhdr
14392         ;;
14393 *)
14394         i_vfork="$undef"
14395         ;;
14396 esac
14397
14398 : see if gdbm.h is available
14399 set gdbm.h t_gdbm
14400 eval $inhdr
14401 case "$t_gdbm" in
14402 $define)
14403         : see if gdbm_open exists
14404         set gdbm_open d_gdbm_open
14405         eval $inlibc
14406         case "$d_gdbm_open" in
14407         $undef)
14408                 t_gdbm="$undef"
14409                 echo "We won't be including <gdbm.h>"
14410                 ;;
14411         esac
14412         ;;
14413 esac
14414 val="$t_gdbm"
14415 set i_gdbm
14416 eval $setvar
14417
14418 echo " "
14419 echo "Looking for extensions..." >&4
14420 : If we are using the old config.sh, known_extensions may contain
14421 : old or inaccurate or duplicate values.
14422 known_extensions=''
14423 nonxs_extensions=''
14424 : We do not use find because it might not be available.
14425 : We do not just use MANIFEST because the user may have dropped
14426 : some additional extensions into the source tree and expect them
14427 : to be built.
14428
14429 : Function to recursively find available extensions, ignoring DynaLoader
14430 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14431 find_extensions='
14432     for xxx in *; do
14433        case "$xxx" in
14434            DynaLoader|dynaload) ;;
14435            *)
14436            if $test -f $xxx/$xxx.xs; then
14437                known_extensions="$known_extensions $1$xxx";
14438            elif $test -f $xxx/Makefile.PL; then
14439                nonxs_extensions="$nonxs_extensions $1$xxx";
14440            else
14441                if $test -d $xxx -a $# -lt 10; then
14442                    set $1$xxx/ $*;
14443                    cd $xxx;
14444                    eval $find_extensions;
14445                    cd ..;
14446                    shift;
14447                fi;
14448            fi
14449            ;;
14450        esac;
14451     done'
14452 tdir=`pwd`
14453 cd $rsrc/ext
14454 set X
14455 shift
14456 eval $find_extensions
14457 set X $nonxs_extensions
14458 shift
14459 nonxs_extensions="$*"
14460 set X $known_extensions
14461 shift
14462 known_extensions="$*"
14463 cd $tdir
14464
14465 : Now see which are supported on this system.
14466 avail_ext=''
14467 for xxx in $known_extensions ; do
14468         case "$xxx" in
14469         DB_File|db_file)
14470                 case "$i_db" in
14471                 $define) avail_ext="$avail_ext $xxx" ;;
14472                 esac
14473                 ;;
14474         GDBM_File|gdbm_fil)
14475                 case "$i_gdbm" in 
14476                 $define) avail_ext="$avail_ext $xxx" ;;
14477                 esac
14478                 ;;
14479         NDBM_File|ndbm_fil)
14480                 case "$i_ndbm" in
14481                 $define)
14482                     case "$osname-$use64bitint" in
14483                     hpux-define)
14484                         case "$libs" in
14485                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14486                         esac
14487                         ;;
14488                     *) avail_ext="$avail_ext $xxx" ;;
14489                     esac
14490                     ;;
14491                 esac
14492                 ;;
14493         ODBM_File|odbm_fil) 
14494                 case "${i_dbm}${i_rpcsvcdbm}" in
14495                 *"${define}"*)
14496                     case "$osname-$use64bitint" in
14497                     hpux-define)
14498                         case "$libs" in
14499                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14500                         esac
14501                         ;;
14502                     *) avail_ext="$avail_ext $xxx" ;;
14503                     esac
14504                     ;;
14505                 esac
14506                 ;;
14507         POSIX|posix)
14508                 case "$useposix" in
14509                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14510                 esac
14511                 ;;
14512         Opcode|opcode)
14513                 case "$useopcode" in
14514                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14515                 esac
14516                 ;;
14517         Socket|socket)
14518                 case "$d_socket" in 
14519                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14520                 esac
14521                 ;;
14522         Thread|thread)
14523                 case "$usethreads" in 
14524                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14525                 esac
14526                 ;;
14527         IPC/SysV|ipc/sysv)
14528                 : XXX Do we need a useipcsysv variable here
14529                 case "${d_msg}${d_sem}${d_shm}" in 
14530                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14531                 esac
14532                 ;;
14533         *)      avail_ext="$avail_ext $xxx"
14534                 ;;
14535         esac
14536 done
14537
14538 set X $avail_ext
14539 shift
14540 avail_ext="$*"
14541
14542 : Now see which nonxs extensions are supported on this system.
14543 : For now assume all are.
14544 nonxs_ext=''
14545 for xxx in $nonxs_extensions ; do
14546         case "$xxx" in
14547         *)      nonxs_ext="$nonxs_ext $xxx"
14548                 ;;
14549         esac
14550 done
14551
14552 set X $nonxs_ext
14553 shift
14554 nonxs_ext="$*"
14555
14556 case $usedl in
14557 $define)
14558         $cat <<EOM
14559 A number of extensions are supplied with $package.  You may choose to
14560 compile these extensions for dynamic loading (the default), compile
14561 them into the $package executable (static loading), or not include
14562 them at all.  Answer "none" to include no extensions.
14563 Note that DynaLoader is always built and need not be mentioned here.
14564
14565 EOM
14566         case "$dynamic_ext" in
14567         '') dflt="$avail_ext" ;;
14568         *)      dflt="$dynamic_ext"
14569                 # Perhaps we are reusing an old out-of-date config.sh.
14570                 case "$hint" in
14571                 previous)
14572                         if test X"$dynamic_ext" != X"$avail_ext"; then
14573                                 $cat <<EOM
14574 NOTICE:  Your previous config.sh list may be incorrect. 
14575 The extensions now available to you are 
14576         ${avail_ext}
14577 but the default list from your previous config.sh is
14578         ${dynamic_ext} 
14579
14580 EOM
14581                         fi
14582                         ;;
14583                 esac
14584                 ;;
14585         esac
14586         case "$dflt" in
14587         '')     dflt=none;;
14588         esac
14589         rp="What extensions do you wish to load dynamically?"
14590         . ./myread
14591         case "$ans" in
14592         none) dynamic_ext=' ' ;;
14593         *) dynamic_ext="$ans" ;;
14594         esac
14595
14596         case "$static_ext" in
14597         '')
14598                 : Exclude those already listed in dynamic linking
14599                 dflt=''
14600                 for xxx in $avail_ext; do
14601                         case " $dynamic_ext " in
14602                         *" $xxx "*) ;;
14603                         *) dflt="$dflt $xxx" ;;
14604                         esac
14605                 done
14606                 set X $dflt
14607                 shift
14608                 dflt="$*"
14609                 ;;
14610         *)  dflt="$static_ext" 
14611                 ;;
14612         esac
14613
14614         case "$dflt" in
14615         '')     dflt=none;;
14616         esac
14617         rp="What extensions do you wish to load statically?"
14618         . ./myread
14619         case "$ans" in
14620         none) static_ext=' ' ;;
14621         *) static_ext="$ans" ;;
14622         esac
14623         ;;
14624 *)
14625         $cat <<EOM
14626 A number of extensions are supplied with $package.  Answer "none" 
14627 to include no extensions. 
14628 Note that DynaLoader is always built and need not be mentioned here.
14629
14630 EOM
14631         case "$static_ext" in
14632         '') dflt="$avail_ext" ;;
14633         *)      dflt="$static_ext"
14634                 # Perhaps we are reusing an old out-of-date config.sh.
14635                 case "$hint" in
14636                 previous)
14637                         if test X"$static_ext" != X"$avail_ext"; then
14638                                 $cat <<EOM
14639 NOTICE:  Your previous config.sh list may be incorrect. 
14640 The extensions now available to you are 
14641         ${avail_ext}
14642 but the default list from your previous config.sh is
14643         ${static_ext} 
14644
14645 EOM
14646                         fi
14647                         ;;
14648                 esac
14649                 ;;
14650         esac
14651         : Exclude those that are not xs extensions
14652         case "$dflt" in
14653         '')     dflt=none;;
14654         esac
14655         rp="What extensions do you wish to include?"
14656         . ./myread
14657         case "$ans" in
14658         none) static_ext=' ' ;;
14659         *) static_ext="$ans" ;;
14660         esac
14661         ;;
14662 esac
14663
14664 set X $dynamic_ext $static_ext $nonxs_ext
14665 shift
14666 extensions="$*"
14667
14668 : Remove build directory name from cppstdin so it can be used from
14669 : either the present location or the final installed location.
14670 echo " "
14671 : Get out of the UU directory to get correct path name.
14672 cd ..
14673 case "$cppstdin" in
14674 `pwd`/cppstdin)
14675         echo "Stripping down cppstdin path name"
14676         cppstdin=cppstdin
14677         ;;
14678 esac
14679 cd UU
14680
14681 : end of configuration questions
14682 echo " "
14683 echo "End of configuration questions."
14684 echo " "
14685
14686 : back to where it started
14687 if test -d ../UU; then
14688         cd ..
14689 fi
14690
14691 : configuration may be patched via a 'config.over' file
14692 if $test -f config.over; then
14693         echo " "
14694         dflt=y
14695         rp='I see a config.over file.  Do you wish to load it?'
14696         . UU/myread
14697         case "$ans" in
14698         n*) echo "OK, I'll ignore it.";;
14699         *)      . ./config.over
14700                 echo "Configuration override changes have been loaded."
14701                 ;;
14702         esac
14703 fi
14704
14705 : in case they want portability, strip down executable paths
14706 case "$d_portable" in
14707 "$define")
14708         echo " "
14709         echo "Stripping down executable paths..." >&4
14710         for file in $loclist $trylist; do
14711                 eval temp=\$$file
14712                 eval $file=`basename $temp`
14713         done
14714         ;;
14715 esac
14716
14717 : create config.sh file
14718 echo " "
14719 echo "Creating config.sh..." >&4
14720 $spitshell <<EOT >config.sh
14721 $startsh
14722 #
14723 # This file was produced by running the Configure script. It holds all the
14724 # definitions figured out by Configure. Should you modify one of these values,
14725 # do not forget to propagate your changes by running "Configure -der". You may
14726 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14727 #
14728
14729 # Package name      : $package
14730 # Source directory  : $src
14731 # Configuration time: $cf_time
14732 # Configured by     : $cf_by
14733 # Target system     : $myuname
14734
14735 Author='$Author'
14736 Date='$Date'
14737 Header='$Header'
14738 Id='$Id'
14739 Locker='$Locker'
14740 Log='$Log'
14741 Mcc='$Mcc'
14742 RCSfile='$RCSfile'
14743 Revision='$Revision'
14744 Source='$Source'
14745 State='$State'
14746 _a='$_a'
14747 _exe='$_exe'
14748 _o='$_o'
14749 afs='$afs'
14750 alignbytes='$alignbytes'
14751 ansi2knr='$ansi2knr'
14752 aphostname='$aphostname'
14753 api_revision='$api_revision'
14754 api_subversion='$api_subversion'
14755 api_version='$api_version'
14756 api_versionstring='$api_versionstring'
14757 ar='$ar'
14758 archlib='$archlib'
14759 archlibexp='$archlibexp'
14760 archname64='$archname64'
14761 archname='$archname'
14762 archobjs='$archobjs'
14763 awk='$awk'
14764 baserev='$baserev'
14765 bash='$bash'
14766 bin='$bin'
14767 bincompat5005='$bincompat5005'
14768 binexp='$binexp'
14769 bison='$bison'
14770 byacc='$byacc'
14771 byteorder='$byteorder'
14772 c='$c'
14773 castflags='$castflags'
14774 cat='$cat'
14775 cc='$cc'
14776 cccdlflags='$cccdlflags'
14777 ccdlflags='$ccdlflags'
14778 ccflags='$ccflags'
14779 ccsymbols='$ccsymbols'
14780 cf_by='$cf_by'
14781 cf_email='$cf_email'
14782 cf_time='$cf_time'
14783 charsize='$charsize'
14784 chgrp='$chgrp'
14785 chmod='$chmod'
14786 chown='$chown'
14787 clocktype='$clocktype'
14788 comm='$comm'
14789 compress='$compress'
14790 contains='$contains'
14791 cp='$cp'
14792 cpio='$cpio'
14793 cpp='$cpp'
14794 cpp_stuff='$cpp_stuff'
14795 cppccsymbols='$cppccsymbols'
14796 cppflags='$cppflags'
14797 cpplast='$cpplast'
14798 cppminus='$cppminus'
14799 cpprun='$cpprun'
14800 cppstdin='$cppstdin'
14801 cppsymbols='$cppsymbols'
14802 crosscompile='$crosscompile'
14803 cryptlib='$cryptlib'
14804 csh='$csh'
14805 d_Gconvert='$d_Gconvert'
14806 d_PRIEldbl='$d_PRIEldbl'
14807 d_PRIFldbl='$d_PRIFldbl'
14808 d_PRIGldbl='$d_PRIGldbl'
14809 d_PRIX64='$d_PRIX64'
14810 d_PRId64='$d_PRId64'
14811 d_PRIeldbl='$d_PRIeldbl'
14812 d_PRIfldbl='$d_PRIfldbl'
14813 d_PRIgldbl='$d_PRIgldbl'
14814 d_PRIi64='$d_PRIi64'
14815 d_PRIo64='$d_PRIo64'
14816 d_PRIu64='$d_PRIu64'
14817 d_PRIx64='$d_PRIx64'
14818 d_access='$d_access'
14819 d_accessx='$d_accessx'
14820 d_alarm='$d_alarm'
14821 d_archlib='$d_archlib'
14822 d_atolf='$d_atolf'
14823 d_atoll='$d_atoll'
14824 d_attribut='$d_attribut'
14825 d_bcmp='$d_bcmp'
14826 d_bcopy='$d_bcopy'
14827 d_bincompat5005='$d_bincompat5005'
14828 d_bsd='$d_bsd'
14829 d_bsdgetpgrp='$d_bsdgetpgrp'
14830 d_bsdsetpgrp='$d_bsdsetpgrp'
14831 d_bzero='$d_bzero'
14832 d_casti32='$d_casti32'
14833 d_castneg='$d_castneg'
14834 d_charvspr='$d_charvspr'
14835 d_chown='$d_chown'
14836 d_chroot='$d_chroot'
14837 d_chsize='$d_chsize'
14838 d_closedir='$d_closedir'
14839 d_const='$d_const'
14840 d_crypt='$d_crypt'
14841 d_csh='$d_csh'
14842 d_cuserid='$d_cuserid'
14843 d_dbl_dig='$d_dbl_dig'
14844 d_difftime='$d_difftime'
14845 d_dirnamlen='$d_dirnamlen'
14846 d_dlerror='$d_dlerror'
14847 d_dlopen='$d_dlopen'
14848 d_dlsymun='$d_dlsymun'
14849 d_dosuid='$d_dosuid'
14850 d_drand48proto='$d_drand48proto'
14851 d_dup2='$d_dup2'
14852 d_eaccess='$d_eaccess'
14853 d_endgrent='$d_endgrent'
14854 d_endhent='$d_endhent'
14855 d_endnent='$d_endnent'
14856 d_endpent='$d_endpent'
14857 d_endpwent='$d_endpwent'
14858 d_endsent='$d_endsent'
14859 d_endspent='$d_endspent'
14860 d_eofnblk='$d_eofnblk'
14861 d_eunice='$d_eunice'
14862 d_fchmod='$d_fchmod'
14863 d_fchown='$d_fchown'
14864 d_fcntl='$d_fcntl'
14865 d_fd_macros='$d_fd_macros'
14866 d_fd_set='$d_fd_set'
14867 d_fds_bits='$d_fds_bits'
14868 d_fgetpos='$d_fgetpos'
14869 d_flexfnam='$d_flexfnam'
14870 d_flock='$d_flock'
14871 d_fork='$d_fork'
14872 d_fpathconf='$d_fpathconf'
14873 d_fpos64_t='$d_fpos64_t'
14874 d_fs_data_s='$d_fs_data_s'
14875 d_fseeko='$d_fseeko'
14876 d_fsetpos='$d_fsetpos'
14877 d_fstatfs='$d_fstatfs'
14878 d_fstatvfs='$d_fstatvfs'
14879 d_ftello='$d_ftello'
14880 d_ftime='$d_ftime'
14881 d_getcwd='$d_getcwd'
14882 d_getfsstat='$d_getfsstat'
14883 d_getgrent='$d_getgrent'
14884 d_getgrps='$d_getgrps'
14885 d_gethbyaddr='$d_gethbyaddr'
14886 d_gethbyname='$d_gethbyname'
14887 d_gethent='$d_gethent'
14888 d_gethname='$d_gethname'
14889 d_gethostprotos='$d_gethostprotos'
14890 d_getlogin='$d_getlogin'
14891 d_getmnt='$d_getmnt'
14892 d_getmntent='$d_getmntent'
14893 d_getnbyaddr='$d_getnbyaddr'
14894 d_getnbyname='$d_getnbyname'
14895 d_getnent='$d_getnent'
14896 d_getnetprotos='$d_getnetprotos'
14897 d_getpbyname='$d_getpbyname'
14898 d_getpbynumber='$d_getpbynumber'
14899 d_getpent='$d_getpent'
14900 d_getpgid='$d_getpgid'
14901 d_getpgrp2='$d_getpgrp2'
14902 d_getpgrp='$d_getpgrp'
14903 d_getppid='$d_getppid'
14904 d_getprior='$d_getprior'
14905 d_getprotoprotos='$d_getprotoprotos'
14906 d_getpwent='$d_getpwent'
14907 d_getsbyname='$d_getsbyname'
14908 d_getsbyport='$d_getsbyport'
14909 d_getsent='$d_getsent'
14910 d_getservprotos='$d_getservprotos'
14911 d_getspent='$d_getspent'
14912 d_getspnam='$d_getspnam'
14913 d_gettimeod='$d_gettimeod'
14914 d_gnulibc='$d_gnulibc'
14915 d_grpasswd='$d_grpasswd'
14916 d_hasmntopt='$d_hasmntopt'
14917 d_htonl='$d_htonl'
14918 d_iconv='$d_iconv'
14919 d_index='$d_index'
14920 d_inetaton='$d_inetaton'
14921 d_int64_t='$d_int64_t'
14922 d_isascii='$d_isascii'
14923 d_killpg='$d_killpg'
14924 d_lchown='$d_lchown'
14925 d_ldbl_dig='$d_ldbl_dig'
14926 d_link='$d_link'
14927 d_locconv='$d_locconv'
14928 d_lockf='$d_lockf'
14929 d_longdbl='$d_longdbl'
14930 d_longlong='$d_longlong'
14931 d_lseekproto='$d_lseekproto'
14932 d_lstat='$d_lstat'
14933 d_mblen='$d_mblen'
14934 d_mbstowcs='$d_mbstowcs'
14935 d_mbtowc='$d_mbtowc'
14936 d_memchr='$d_memchr'
14937 d_memcmp='$d_memcmp'
14938 d_memcpy='$d_memcpy'
14939 d_memmove='$d_memmove'
14940 d_memset='$d_memset'
14941 d_mkdir='$d_mkdir'
14942 d_mkdtemp='$d_mkdtemp'
14943 d_mkfifo='$d_mkfifo'
14944 d_mkstemp='$d_mkstemp'
14945 d_mkstemps='$d_mkstemps'
14946 d_mktime='$d_mktime'
14947 d_mmap='$d_mmap'
14948 d_mprotect='$d_mprotect'
14949 d_msg='$d_msg'
14950 d_msg_ctrunc='$d_msg_ctrunc'
14951 d_msg_dontroute='$d_msg_dontroute'
14952 d_msg_oob='$d_msg_oob'
14953 d_msg_peek='$d_msg_peek'
14954 d_msg_proxy='$d_msg_proxy'
14955 d_msgctl='$d_msgctl'
14956 d_msgget='$d_msgget'
14957 d_msgrcv='$d_msgrcv'
14958 d_msgsnd='$d_msgsnd'
14959 d_msync='$d_msync'
14960 d_munmap='$d_munmap'
14961 d_mymalloc='$d_mymalloc'
14962 d_nice='$d_nice'
14963 d_nv_preserves_uv='$d_nv_preserves_uv'
14964 d_off64_t='$d_off64_t'
14965 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14966 d_oldpthreads='$d_oldpthreads'
14967 d_oldsock='$d_oldsock'
14968 d_open3='$d_open3'
14969 d_pathconf='$d_pathconf'
14970 d_pause='$d_pause'
14971 d_phostname='$d_phostname'
14972 d_pipe='$d_pipe'
14973 d_poll='$d_poll'
14974 d_portable='$d_portable'
14975 d_pthread_yield='$d_pthread_yield'
14976 d_pwage='$d_pwage'
14977 d_pwchange='$d_pwchange'
14978 d_pwclass='$d_pwclass'
14979 d_pwcomment='$d_pwcomment'
14980 d_pwexpire='$d_pwexpire'
14981 d_pwgecos='$d_pwgecos'
14982 d_pwpasswd='$d_pwpasswd'
14983 d_pwquota='$d_pwquota'
14984 d_quad='$d_quad'
14985 d_readdir='$d_readdir'
14986 d_readlink='$d_readlink'
14987 d_rename='$d_rename'
14988 d_rewinddir='$d_rewinddir'
14989 d_rmdir='$d_rmdir'
14990 d_safebcpy='$d_safebcpy'
14991 d_safemcpy='$d_safemcpy'
14992 d_sanemcmp='$d_sanemcmp'
14993 d_sched_yield='$d_sched_yield'
14994 d_scm_rights='$d_scm_rights'
14995 d_seekdir='$d_seekdir'
14996 d_select='$d_select'
14997 d_sem='$d_sem'
14998 d_semctl='$d_semctl'
14999 d_semctl_semid_ds='$d_semctl_semid_ds'
15000 d_semctl_semun='$d_semctl_semun'
15001 d_semget='$d_semget'
15002 d_semop='$d_semop'
15003 d_setegid='$d_setegid'
15004 d_seteuid='$d_seteuid'
15005 d_setgrent='$d_setgrent'
15006 d_setgrps='$d_setgrps'
15007 d_sethent='$d_sethent'
15008 d_setlinebuf='$d_setlinebuf'
15009 d_setlocale='$d_setlocale'
15010 d_setnent='$d_setnent'
15011 d_setpent='$d_setpent'
15012 d_setpgid='$d_setpgid'
15013 d_setpgrp2='$d_setpgrp2'
15014 d_setpgrp='$d_setpgrp'
15015 d_setprior='$d_setprior'
15016 d_setpwent='$d_setpwent'
15017 d_setregid='$d_setregid'
15018 d_setresgid='$d_setresgid'
15019 d_setresuid='$d_setresuid'
15020 d_setreuid='$d_setreuid'
15021 d_setrgid='$d_setrgid'
15022 d_setruid='$d_setruid'
15023 d_setsent='$d_setsent'
15024 d_setsid='$d_setsid'
15025 d_setspent='$d_setspent'
15026 d_setvbuf='$d_setvbuf'
15027 d_sfio='$d_sfio'
15028 d_shm='$d_shm'
15029 d_shmat='$d_shmat'
15030 d_shmatprototype='$d_shmatprototype'
15031 d_shmctl='$d_shmctl'
15032 d_shmdt='$d_shmdt'
15033 d_shmget='$d_shmget'
15034 d_sigaction='$d_sigaction'
15035 d_sigsetjmp='$d_sigsetjmp'
15036 d_socket='$d_socket'
15037 d_socklen_t='$d_socklen_t'
15038 d_sockpair='$d_sockpair'
15039 d_sqrtl='$d_sqrtl'
15040 d_statblks='$d_statblks'
15041 d_statfs_f_flags='$d_statfs_f_flags'
15042 d_statfs_s='$d_statfs_s'
15043 d_statvfs='$d_statvfs'
15044 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15045 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15046 d_stdio_stream_array='$d_stdio_stream_array'
15047 d_stdiobase='$d_stdiobase'
15048 d_stdstdio='$d_stdstdio'
15049 d_strchr='$d_strchr'
15050 d_strcoll='$d_strcoll'
15051 d_strctcpy='$d_strctcpy'
15052 d_strerrm='$d_strerrm'
15053 d_strerror='$d_strerror'
15054 d_strtod='$d_strtod'
15055 d_strtol='$d_strtol'
15056 d_strtold='$d_strtold'
15057 d_strtoll='$d_strtoll'
15058 d_strtoul='$d_strtoul'
15059 d_strtoull='$d_strtoull'
15060 d_strtouq='$d_strtouq'
15061 d_strxfrm='$d_strxfrm'
15062 d_suidsafe='$d_suidsafe'
15063 d_symlink='$d_symlink'
15064 d_syscall='$d_syscall'
15065 d_sysconf='$d_sysconf'
15066 d_sysernlst='$d_sysernlst'
15067 d_syserrlst='$d_syserrlst'
15068 d_system='$d_system'
15069 d_tcgetpgrp='$d_tcgetpgrp'
15070 d_tcsetpgrp='$d_tcsetpgrp'
15071 d_telldir='$d_telldir'
15072 d_telldirproto='$d_telldirproto'
15073 d_time='$d_time'
15074 d_times='$d_times'
15075 d_truncate='$d_truncate'
15076 d_tzname='$d_tzname'
15077 d_umask='$d_umask'
15078 d_uname='$d_uname'
15079 d_union_semun='$d_union_semun'
15080 d_ustat='$d_ustat'
15081 d_vendorbin='$d_vendorbin'
15082 d_vendorlib='$d_vendorlib'
15083 d_vfork='$d_vfork'
15084 d_void_closedir='$d_void_closedir'
15085 d_voidsig='$d_voidsig'
15086 d_voidtty='$d_voidtty'
15087 d_volatile='$d_volatile'
15088 d_vprintf='$d_vprintf'
15089 d_wait4='$d_wait4'
15090 d_waitpid='$d_waitpid'
15091 d_wcstombs='$d_wcstombs'
15092 d_wctomb='$d_wctomb'
15093 d_xenix='$d_xenix'
15094 date='$date'
15095 db_hashtype='$db_hashtype'
15096 db_prefixtype='$db_prefixtype'
15097 defvoidused='$defvoidused'
15098 direntrytype='$direntrytype'
15099 dlext='$dlext'
15100 dlsrc='$dlsrc'
15101 doublesize='$doublesize'
15102 drand01='$drand01'
15103 dynamic_ext='$dynamic_ext'
15104 eagain='$eagain'
15105 ebcdic='$ebcdic'
15106 echo='$echo'
15107 egrep='$egrep'
15108 emacs='$emacs'
15109 eunicefix='$eunicefix'
15110 exe_ext='$exe_ext'
15111 expr='$expr'
15112 extensions='$extensions'
15113 fflushNULL='$fflushNULL'
15114 fflushall='$fflushall'
15115 find='$find'
15116 firstmakefile='$firstmakefile'
15117 flex='$flex'
15118 fpossize='$fpossize'
15119 fpostype='$fpostype'
15120 freetype='$freetype'
15121 full_ar='$full_ar'
15122 full_csh='$full_csh'
15123 full_sed='$full_sed'
15124 gccversion='$gccversion'
15125 gidformat='$gidformat'
15126 gidsign='$gidsign'
15127 gidsize='$gidsize'
15128 gidtype='$gidtype'
15129 glibpth='$glibpth'
15130 grep='$grep'
15131 groupcat='$groupcat'
15132 groupstype='$groupstype'
15133 gzip='$gzip'
15134 h_fcntl='$h_fcntl'
15135 h_sysfile='$h_sysfile'
15136 hint='$hint'
15137 hostcat='$hostcat'
15138 huge='$huge'
15139 i16size='$i16size'
15140 i16type='$i16type'
15141 i32size='$i32size'
15142 i32type='$i32type'
15143 i64size='$i64size'
15144 i64type='$i64type'
15145 i8size='$i8size'
15146 i8type='$i8type'
15147 i_arpainet='$i_arpainet'
15148 i_bsdioctl='$i_bsdioctl'
15149 i_db='$i_db'
15150 i_dbm='$i_dbm'
15151 i_dirent='$i_dirent'
15152 i_dld='$i_dld'
15153 i_dlfcn='$i_dlfcn'
15154 i_fcntl='$i_fcntl'
15155 i_float='$i_float'
15156 i_gdbm='$i_gdbm'
15157 i_grp='$i_grp'
15158 i_iconv='$i_iconv'
15159 i_inttypes='$i_inttypes'
15160 i_limits='$i_limits'
15161 i_locale='$i_locale'
15162 i_machcthr='$i_machcthr'
15163 i_malloc='$i_malloc'
15164 i_math='$i_math'
15165 i_memory='$i_memory'
15166 i_mntent='$i_mntent'
15167 i_ndbm='$i_ndbm'
15168 i_netdb='$i_netdb'
15169 i_neterrno='$i_neterrno'
15170 i_netinettcp='$i_netinettcp'
15171 i_niin='$i_niin'
15172 i_poll='$i_poll'
15173 i_pthread='$i_pthread'
15174 i_pwd='$i_pwd'
15175 i_rpcsvcdbm='$i_rpcsvcdbm'
15176 i_sfio='$i_sfio'
15177 i_sgtty='$i_sgtty'
15178 i_shadow='$i_shadow'
15179 i_socks='$i_socks'
15180 i_stdarg='$i_stdarg'
15181 i_stddef='$i_stddef'
15182 i_stdlib='$i_stdlib'
15183 i_string='$i_string'
15184 i_sysaccess='$i_sysaccess'
15185 i_sysdir='$i_sysdir'
15186 i_sysfile='$i_sysfile'
15187 i_sysfilio='$i_sysfilio'
15188 i_sysin='$i_sysin'
15189 i_sysioctl='$i_sysioctl'
15190 i_syslog='$i_syslog'
15191 i_sysmman='$i_sysmman'
15192 i_sysmode='$i_sysmode'
15193 i_sysmount='$i_sysmount'
15194 i_sysndir='$i_sysndir'
15195 i_sysparam='$i_sysparam'
15196 i_sysresrc='$i_sysresrc'
15197 i_syssecrt='$i_syssecrt'
15198 i_sysselct='$i_sysselct'
15199 i_syssockio='$i_syssockio'
15200 i_sysstat='$i_sysstat'
15201 i_sysstatfs='$i_sysstatfs'
15202 i_sysstatvfs='$i_sysstatvfs'
15203 i_systime='$i_systime'
15204 i_systimek='$i_systimek'
15205 i_systimes='$i_systimes'
15206 i_systypes='$i_systypes'
15207 i_sysuio='$i_sysuio'
15208 i_sysun='$i_sysun'
15209 i_sysutsname='$i_sysutsname'
15210 i_sysvfs='$i_sysvfs'
15211 i_syswait='$i_syswait'
15212 i_termio='$i_termio'
15213 i_termios='$i_termios'
15214 i_time='$i_time'
15215 i_unistd='$i_unistd'
15216 i_ustat='$i_ustat'
15217 i_utime='$i_utime'
15218 i_values='$i_values'
15219 i_varargs='$i_varargs'
15220 i_varhdr='$i_varhdr'
15221 i_vfork='$i_vfork'
15222 ignore_versioned_solibs='$ignore_versioned_solibs'
15223 inc_version_list='$inc_version_list'
15224 inc_version_list_init='$inc_version_list_init'
15225 incpath='$incpath'
15226 inews='$inews'
15227 installarchlib='$installarchlib'
15228 installbin='$installbin'
15229 installman1dir='$installman1dir'
15230 installman3dir='$installman3dir'
15231 installprefix='$installprefix'
15232 installprefixexp='$installprefixexp'
15233 installprivlib='$installprivlib'
15234 installscript='$installscript'
15235 installsitearch='$installsitearch'
15236 installsitebin='$installsitebin'
15237 installsitelib='$installsitelib'
15238 installstyle='$installstyle'
15239 installusrbinperl='$installusrbinperl'
15240 installvendorbin='$installvendorbin'
15241 installvendorlib='$installvendorlib'
15242 intsize='$intsize'
15243 ivdformat='$ivdformat'
15244 ivsize='$ivsize'
15245 ivtype='$ivtype'
15246 known_extensions='$known_extensions'
15247 ksh='$ksh'
15248 large='$large'
15249 ld='$ld'
15250 lddlflags='$lddlflags'
15251 ldflags='$ldflags'
15252 ldlibpthname='$ldlibpthname'
15253 less='$less'
15254 lib_ext='$lib_ext'
15255 libc='$libc'
15256 libperl='$libperl'
15257 libpth='$libpth'
15258 libs='$libs'
15259 libsdirs='$libsdirs'
15260 libsfiles='$libsfiles'
15261 libsfound='$libsfound'
15262 libspath='$libspath'
15263 libswanted='$libswanted'
15264 line='$line'
15265 lint='$lint'
15266 lkflags='$lkflags'
15267 ln='$ln'
15268 lns='$lns'
15269 locincpth='$locincpth'
15270 loclibpth='$loclibpth'
15271 longdblsize='$longdblsize'
15272 longlongsize='$longlongsize'
15273 longsize='$longsize'
15274 lp='$lp'
15275 lpr='$lpr'
15276 ls='$ls'
15277 lseeksize='$lseeksize'
15278 lseektype='$lseektype'
15279 mail='$mail'
15280 mailx='$mailx'
15281 make='$make'
15282 make_set_make='$make_set_make'
15283 mallocobj='$mallocobj'
15284 mallocsrc='$mallocsrc'
15285 malloctype='$malloctype'
15286 man1dir='$man1dir'
15287 man1direxp='$man1direxp'
15288 man1ext='$man1ext'
15289 man3dir='$man3dir'
15290 man3direxp='$man3direxp'
15291 man3ext='$man3ext'
15292 medium='$medium'
15293 mips_type='$mips_type'
15294 mkdir='$mkdir'
15295 mmaptype='$mmaptype'
15296 models='$models'
15297 modetype='$modetype'
15298 more='$more'
15299 multiarch='$multiarch'
15300 mv='$mv'
15301 myarchname='$myarchname'
15302 mydomain='$mydomain'
15303 myhostname='$myhostname'
15304 myuname='$myuname'
15305 n='$n'
15306 netdb_hlen_type='$netdb_hlen_type'
15307 netdb_host_type='$netdb_host_type'
15308 netdb_name_type='$netdb_name_type'
15309 netdb_net_type='$netdb_net_type'
15310 nm='$nm'
15311 nm_opt='$nm_opt'
15312 nm_so_opt='$nm_so_opt'
15313 nonxs_ext='$nonxs_ext'
15314 nroff='$nroff'
15315 nvsize='$nvsize'
15316 nvtype='$nvtype'
15317 o_nonblock='$o_nonblock'
15318 obj_ext='$obj_ext'
15319 old_pthread_create_joinable='$old_pthread_create_joinable'
15320 optimize='$optimize'
15321 orderlib='$orderlib'
15322 osname='$osname'
15323 osvers='$osvers'
15324 package='$package'
15325 pager='$pager'
15326 passcat='$passcat'
15327 patchlevel='$patchlevel'
15328 path_sep='$path_sep'
15329 perl5='$perl5'
15330 perl='$perl'
15331 perladmin='$perladmin'
15332 perlpath='$perlpath'
15333 pg='$pg'
15334 phostname='$phostname'
15335 pidtype='$pidtype'
15336 plibpth='$plibpth'
15337 pm_apiversion='$pm_apiversion'
15338 pmake='$pmake'
15339 pr='$pr'
15340 prefix='$prefix'
15341 prefixexp='$prefixexp'
15342 privlib='$privlib'
15343 privlibexp='$privlibexp'
15344 prototype='$prototype'
15345 ptrsize='$ptrsize'
15346 quadkind='$quadkind'
15347 quadtype='$quadtype'
15348 randbits='$randbits'
15349 randfunc='$randfunc'
15350 randseedtype='$randseedtype'
15351 ranlib='$ranlib'
15352 rd_nodata='$rd_nodata'
15353 revision='$revision'
15354 rm='$rm'
15355 rmail='$rmail'
15356 runnm='$runnm'
15357 sPRIEldbl='$sPRIEldbl'
15358 sPRIFldbl='$sPRIFldbl'
15359 sPRIGldbl='$sPRIGldbl'
15360 sPRIX64='$sPRIX64'
15361 sPRId64='$sPRId64'
15362 sPRIeldbl='$sPRIeldbl'
15363 sPRIfldbl='$sPRIfldbl'
15364 sPRIgldbl='$sPRIgldbl'
15365 sPRIi64='$sPRIi64'
15366 sPRIo64='$sPRIo64'
15367 sPRIu64='$sPRIu64'
15368 sPRIx64='$sPRIx64'
15369 sched_yield='$sched_yield'
15370 scriptdir='$scriptdir'
15371 scriptdirexp='$scriptdirexp'
15372 sed='$sed'
15373 seedfunc='$seedfunc'
15374 selectminbits='$selectminbits'
15375 selecttype='$selecttype'
15376 sendmail='$sendmail'
15377 sh='$sh'
15378 shar='$shar'
15379 sharpbang='$sharpbang'
15380 shmattype='$shmattype'
15381 shortsize='$shortsize'
15382 shrpenv='$shrpenv'
15383 shsharp='$shsharp'
15384 sig_count='$sig_count'
15385 sig_name='$sig_name'
15386 sig_name_init='$sig_name_init'
15387 sig_num='$sig_num'
15388 sig_num_init='$sig_num_init'
15389 signal_t='$signal_t'
15390 sitearch='$sitearch'
15391 sitearchexp='$sitearchexp'
15392 sitebin='$sitebin'
15393 sitebinexp='$sitebinexp'
15394 sitelib='$sitelib'
15395 sitelibexp='$sitelibexp'
15396 siteprefix='$siteprefix'
15397 siteprefixexp='$siteprefixexp'
15398 sizetype='$sizetype'
15399 sleep='$sleep'
15400 smail='$smail'
15401 small='$small'
15402 so='$so'
15403 sockethdr='$sockethdr'
15404 socketlib='$socketlib'
15405 socksizetype='$socksizetype'
15406 sort='$sort'
15407 spackage='$spackage'
15408 spitshell='$spitshell'
15409 split='$split'
15410 src='$src'
15411 ssizetype='$ssizetype'
15412 startperl='$startperl'
15413 startsh='$startsh'
15414 static_ext='$static_ext'
15415 stdchar='$stdchar'
15416 stdio_base='$stdio_base'
15417 stdio_bufsiz='$stdio_bufsiz'
15418 stdio_cnt='$stdio_cnt'
15419 stdio_filbuf='$stdio_filbuf'
15420 stdio_ptr='$stdio_ptr'
15421 stdio_stream_array='$stdio_stream_array'
15422 strings='$strings'
15423 submit='$submit'
15424 subversion='$subversion'
15425 sysman='$sysman'
15426 tail='$tail'
15427 tar='$tar'
15428 tbl='$tbl'
15429 tee='$tee'
15430 test='$test'
15431 timeincl='$timeincl'
15432 timetype='$timetype'
15433 touch='$touch'
15434 tr='$tr'
15435 trnl='$trnl'
15436 troff='$troff'
15437 u16size='$u16size'
15438 u16type='$u16type'
15439 u32size='$u32size'
15440 u32type='$u32type'
15441 u64size='$u64size'
15442 u64type='$u64type'
15443 u8size='$u8size'
15444 u8type='$u8type'
15445 uidformat='$uidformat'
15446 uidsign='$uidsign'
15447 uidsize='$uidsize'
15448 uidtype='$uidtype'
15449 uname='$uname'
15450 uniq='$uniq'
15451 uquadtype='$uquadtype'
15452 use5005threads='$use5005threads'
15453 use64bitall='$use64bitall'
15454 use64bitint='$use64bitint'
15455 usedl='$usedl'
15456 useithreads='$useithreads'
15457 uselargefiles='$uselargefiles'
15458 uselongdouble='$uselongdouble'
15459 usemorebits='$usemorebits'
15460 usemultiplicity='$usemultiplicity'
15461 usemymalloc='$usemymalloc'
15462 usenm='$usenm'
15463 useopcode='$useopcode'
15464 useperlio='$useperlio'
15465 useposix='$useposix'
15466 usesfio='$usesfio'
15467 useshrplib='$useshrplib'
15468 usesocks='$usesocks'
15469 usethreads='$usethreads'
15470 usevendorprefix='$usevendorprefix'
15471 usevfork='$usevfork'
15472 usrinc='$usrinc'
15473 uuname='$uuname'
15474 uvoformat='$uvoformat'
15475 uvsize='$uvsize'
15476 uvtype='$uvtype'
15477 uvuformat='$uvuformat'
15478 uvxformat='$uvxformat'
15479 vendorbin='$vendorbin'
15480 vendorbinexp='$vendorbinexp'
15481 vendorlib='$vendorlib'
15482 vendorlibexp='$vendorlibexp'
15483 vendorprefix='$vendorprefix'
15484 vendorprefixexp='$vendorprefixexp'
15485 version='$version'
15486 vi='$vi'
15487 voidflags='$voidflags'
15488 xlibpth='$xlibpth'
15489 xs_apiversion='$xs_apiversion'
15490 zcat='$zcat'
15491 zip='$zip'
15492 EOT
15493
15494 : Add in command line options if available
15495 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15496
15497 : add special variables
15498 $test -f $src/patchlevel.h && \
15499 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15500 echo "CONFIGDOTSH=true" >>config.sh
15501
15502 : propagate old symbols
15503 if $test -f UU/config.sh; then
15504         <UU/config.sh sort | uniq >UU/oldconfig.sh
15505         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15506         sort | uniq -u >UU/oldsyms
15507         set X `cat UU/oldsyms`
15508         shift
15509         case $# in
15510         0) ;;
15511         *)
15512                 cat <<EOM
15513 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15514 EOM
15515                 echo "# Variables propagated from previous config.sh file." >>config.sh
15516                 for sym in `cat UU/oldsyms`; do
15517                         echo "    Propagating $hint variable "'$'"$sym..."
15518                         eval 'tmp="$'"${sym}"'"'
15519                         echo "$tmp" | \
15520                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15521                 done
15522                 ;;
15523         esac
15524 fi
15525
15526 : Finish up by extracting the .SH files
15527 case "$alldone" in
15528 exit)
15529         $rm -rf UU
15530         echo "Done."
15531         exit 0
15532         ;;
15533 cont)
15534         ;;
15535 '')
15536         dflt=''
15537         nostick=true
15538         $cat <<EOM
15539
15540 If you'd like to make any changes to the config.sh file before I begin
15541 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15542
15543 EOM
15544         rp="Press return or use a shell escape to edit config.sh:"
15545         . UU/myread
15546         nostick=''
15547         case "$ans" in
15548         '') ;;
15549         *) : in case they cannot read
15550                 sh 1>&4 -c "$ans";;
15551         esac
15552         ;;
15553 esac
15554
15555 : if this fails, just run all the .SH files by hand
15556 . ./config.sh
15557
15558 echo " "
15559 exec 1>&4
15560 . ./UU/extract
15561
15562 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15563         dflt=y
15564         case "$silent" in
15565         true) ;;
15566         *)
15567                 $cat <<EOM
15568
15569 Now you need to generate make dependencies by running "$make depend".
15570 You might prefer to run it in background: "$make depend > makedepend.out &"
15571 It can take a while, so you might not want to run it right now.
15572
15573 EOM
15574                 ;;
15575         esac
15576         rp="Run $make depend now?"
15577         . UU/myread
15578         case "$ans" in
15579         y*)
15580                 $make depend && echo "Now you must run a $make."
15581                 ;;
15582         *)
15583                 echo "You must run '$make depend' then '$make'."
15584                 ;;
15585         esac
15586 elif test -f [Mm]akefile; then
15587         echo " "
15588         echo "Now you must run a $make."
15589 else
15590         echo "Done."
15591 fi
15592
15593 if $test -f Policy.sh; then
15594     $cat <<EOM
15595
15596 If you compile $package on a different machine or from a different object
15597 directory, copy the Policy.sh file from this object directory to the
15598 new one before you run Configure -- this will help you with most of
15599 the policy defaults.
15600
15601 EOM
15602 fi
15603 if $test -f config.msg; then
15604     echo "Hmm.  I also noted the following information while running:"
15605     echo " "
15606     $cat config.msg >&4
15607     $rm -f config.msg
15608 fi
15609 $rm -f kit*isdone ark*isdone
15610 $rm -rf UU
15611
15612 : End of Configure
15613